Merge from Chromium at DEPS revision 228962

This commit was generated by merge_to_master.py.

Change-Id: Ifa868e6d63fe87d2338d9388aa5ea81f746d485f
diff --git a/Source/core/.gitattributes b/Source/core/.gitattributes
index 01156ad..6701869 100644
--- a/Source/core/.gitattributes
+++ b/Source/core/.gitattributes
@@ -1,3 +1,2 @@
 inspector/Inspector.json -crlf
-platform/chromium/SuddenTerminationChromium.cpp -crlf
 rendering/RenderThemeChromiumWin.h -crlf
diff --git a/Source/core/.gitignore b/Source/core/.gitignore
deleted file mode 100644
index 448dc80..0000000
--- a/Source/core/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-*.Makefile
-*.mk
-*.rules
-*.sln
-*.tmp
-*.vcproj*
-*.vcxproj*
-core.xcodeproj
-core_derived_sources.xcodeproj
diff --git a/Source/core/ConvertFileToHeaderWithCharacterArray.gypi b/Source/core/ConvertFileToHeaderWithCharacterArray.gypi
deleted file mode 100644
index 063e38c..0000000
--- a/Source/core/ConvertFileToHeaderWithCharacterArray.gypi
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Copyright (C) 2013 Igalia S.L.
-#
-# 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.
-#
-# To use this, create a gyp target with the following form:
-# {
-#   'target_name': 'GenerateInjectedScriptSource',
-#   'type': 'none',
-#   'variables': {
-#     'input_file_path': 'inspector/InjectedScriptSource.js'',
-#     'output_file_path': '<(SHARED_INTERMEDIATE_DIR)/blink/InjectedScriptSource.h',
-#     'character_array_name': 'InjectedScriptSource_js',
-#   },
-#   'includes': [ 'ConvertFileToHeaderWithCharacterArray.gypi' ],
-# },
-{
-  'actions': [
-    {
-      'action_name': 'ConvertFileToHeaderWithCharacterArray',
-      'inputs': [
-        'scripts/xxd.pl',
-        '<(input_file_path)',
-      ],
-      'outputs': [ '<@(output_file_path)', ],
-      'action': [
-        '<(perl_exe)',
-        'scripts/xxd.pl',
-        '<(character_array_name)',
-        '<(input_file_path)',
-        '<@(_outputs)'
-      ],
-      'message': 'Generating <(output_file_path) from <(input_file_path)',
-    },
-  ],
-
-  # Since this target generates header files, it needs to be a hard dependency.
-  'hard_dependency': 1,
-}
diff --git a/Source/core/DEPS b/Source/core/DEPS
index bd95807..d16b280 100644
--- a/Source/core/DEPS
+++ b/Source/core/DEPS
@@ -7,18 +7,29 @@
     "+sys",
     "+weborigin",
 
-    "-web",
-    "-modules",
 # core/ should not depend on modules/ at all, but there are a number of pieces
 # of code that do. Please don't add to this list of exceptions.
-    "+modules/filesystem",
-    "+modules/geolocation",
-    "+modules/indexeddb",
-    "+modules/mediasource",
-    "+modules/mediastream",
-    "+modules/speech",
-    "+modules/webaudio",
-    "+modules/webdatabase",
-    "+modules/websockets",
-    "+modules/websockets",
+    "!modules/device_orientation/NewDeviceOrientationController.h",
+    "!modules/encryptedmedia/MediaKeyNeededEvent.h",
+    "!modules/encryptedmedia/MediaKeys.h",
+    "!modules/filesystem/DraggedIsolatedFileSystem.h",
+    "!modules/geolocation/GeolocationClient.h",
+    "!modules/geolocation/GeolocationController.h",
+    "!modules/geolocation/GeolocationError.h",
+    "!modules/geolocation/GeolocationPosition.h",
+    "!modules/mediastream/MediaStreamRegistry.h",
+    "!modules/mediastream/MediaStreamTrackSourcesRequest.h",
+    "!modules/mediastream/RTCStatsResponse.h",
+    "!modules/mediastream/SourceInfo.h",
+    "!modules/speech/DOMWindowSpeechSynthesis.h",
+    "!modules/speech/SpeechRecognitionAlternative.h",
+    "!modules/speech/SpeechSynthesis.h",
+    "!modules/speech/SpeechSynthesisVoice.h",
+    "!modules/webaudio/DelayDSPKernel.h",
+    "!modules/webaudio/MediaElementAudioSourceNode.h",
+    "!modules/webdatabase/DatabaseContext.h",
+    "!modules/webdatabase/DatabaseDetails.h",
+    "!modules/webdatabase/DatabaseManager.h",
+    "!modules/webdatabase/DatabaseManager.h",
+    "!modules/webdatabase/DatabaseTask.h",
 ]
diff --git a/Source/core/Init.cpp b/Source/core/Init.cpp
index 8aee439..0c7b07b 100644
--- a/Source/core/Init.cpp
+++ b/Source/core/Init.cpp
@@ -31,6 +31,9 @@
 #include "config.h"
 #include "Init.h"
 
+#include "EventNames.h"
+#include "EventTargetNames.h"
+#include "EventTypeNames.h"
 #include "FetchInitiatorTypeNames.h"
 #include "FontFamilyNames.h"
 #include "HTMLNames.h"
@@ -40,8 +43,9 @@
 #include "XMLNSNames.h"
 #include "XMLNames.h"
 #include "core/css/MediaFeatureNames.h"
-#include "core/platform/EventTracer.h"
-#include "core/platform/Partitions.h"
+#include "platform/EventTracer.h"
+#include "platform/Partitions.h"
+#include "platform/PlatformThreadData.h"
 #include "wtf/text/StringStatics.h"
 
 namespace WebCore {
@@ -62,13 +66,22 @@
     MathMLNames::init();
     XMLNSNames::init();
     XMLNames::init();
-    FontFamilyNames::init();
+    EventNames::init();
+    EventTargetNames::init();
+    EventTypeNames::init();
     FetchInitiatorTypeNames::init();
+    FontFamilyNames::init();
     MediaFeatureNames::init();
     WTF::StringStatics::init();
     QualifiedName::init();
     Partitions::init();
     EventTracer::initialize();
+
+    // Ensure that the main thread's thread-local data is initialized before
+    // starting any worker threads.
+    PlatformThreadData::current();
+
+    StringImpl::freezeStaticStrings();
 }
 
 void shutdown()
diff --git a/Source/core/OWNERS b/Source/core/OWNERS
index a774153..c0eb731 100644
--- a/Source/core/OWNERS
+++ b/Source/core/OWNERS
@@ -3,14 +3,15 @@
 alexis.menard@intel.com
 apavlov@chromium.org
 arv@chromium.org
-ch.dumez@sisa.samsung.com
+ch.dumez@samsung.com
 darin@chromium.org
 dglazkov@chromium.org
 dimich@chromium.org
-dominicc@chromium.org
 dmazzoni@chromium.org
+dominicc@chromium.org
 dpranke@chromium.org
 dschulze@chromium.org
+dstockwell@chromium.org
 eae@chromium.org
 enne@chromium.org
 eseidel@chromium.org
@@ -26,6 +27,7 @@
 jianli@chromium.org
 jochen@chromium.org
 kbr@chromium.org
+kenneth.r.christiansen@intel.com
 levin@chromium.org
 leviw@chromium.org
 mkwst@chromium.org
@@ -33,6 +35,7 @@
 ojan@chromium.org
 pdr@chromium.org
 pfeldman@chromium.org
+pkasting@chromium.org
 schenney@chromium.org
 senorblanco@chromium.org
 steveblock@chromium.org
diff --git a/Source/core/Resources/aliasCursor.png b/Source/core/Resources/aliasCursor.png
deleted file mode 100644
index d33d7e9..0000000
--- a/Source/core/Resources/aliasCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/cellCursor.png b/Source/core/Resources/cellCursor.png
deleted file mode 100644
index 5c616c4..0000000
--- a/Source/core/Resources/cellCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/contextMenuCursor.png b/Source/core/Resources/contextMenuCursor.png
deleted file mode 100644
index ae100c7..0000000
--- a/Source/core/Resources/contextMenuCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/copyCursor.png b/Source/core/Resources/copyCursor.png
deleted file mode 100644
index 33be332..0000000
--- a/Source/core/Resources/copyCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/deleteButton.png b/Source/core/Resources/deleteButton.png
deleted file mode 100644
index 67e2240..0000000
--- a/Source/core/Resources/deleteButton.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/deleteButton.tiff b/Source/core/Resources/deleteButton.tiff
deleted file mode 100644
index bf4347e..0000000
--- a/Source/core/Resources/deleteButton.tiff
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/deleteButton@2x.png b/Source/core/Resources/deleteButton@2x.png
deleted file mode 100644
index e6046d4..0000000
--- a/Source/core/Resources/deleteButton@2x.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/deleteButtonPressed.png b/Source/core/Resources/deleteButtonPressed.png
deleted file mode 100644
index 2dbd13d..0000000
--- a/Source/core/Resources/deleteButtonPressed.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/deleteButtonPressed.tiff b/Source/core/Resources/deleteButtonPressed.tiff
deleted file mode 100644
index 6232484..0000000
--- a/Source/core/Resources/deleteButtonPressed.tiff
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/deleteButtonPressed@2x.png b/Source/core/Resources/deleteButtonPressed@2x.png
deleted file mode 100644
index 3c999a7..0000000
--- a/Source/core/Resources/deleteButtonPressed@2x.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/eastResizeCursor.png b/Source/core/Resources/eastResizeCursor.png
deleted file mode 100644
index 9c1592e..0000000
--- a/Source/core/Resources/eastResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/eastWestResizeCursor.png b/Source/core/Resources/eastWestResizeCursor.png
deleted file mode 100644
index f43202e..0000000
--- a/Source/core/Resources/eastWestResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/helpCursor.png b/Source/core/Resources/helpCursor.png
deleted file mode 100644
index 6828d6a..0000000
--- a/Source/core/Resources/helpCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/inputSpeech.png b/Source/core/Resources/inputSpeech.png
deleted file mode 100644
index 8a5c469..0000000
--- a/Source/core/Resources/inputSpeech.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/inputSpeech.tiff b/Source/core/Resources/inputSpeech.tiff
deleted file mode 100644
index 11ba129..0000000
--- a/Source/core/Resources/inputSpeech.tiff
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/linearSRGB.icc b/Source/core/Resources/linearSRGB.icc
deleted file mode 100644
index 5cc4371..0000000
--- a/Source/core/Resources/linearSRGB.icc
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/linkCursor.png b/Source/core/Resources/linkCursor.png
deleted file mode 100644
index e5e2749..0000000
--- a/Source/core/Resources/linkCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/missingImage.png b/Source/core/Resources/missingImage.png
deleted file mode 100644
index 5c24d20..0000000
--- a/Source/core/Resources/missingImage.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/missingImage.tiff b/Source/core/Resources/missingImage.tiff
deleted file mode 100644
index bfde916..0000000
--- a/Source/core/Resources/missingImage.tiff
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/missingImage@2x.png b/Source/core/Resources/missingImage@2x.png
deleted file mode 100644
index 6573d17..0000000
--- a/Source/core/Resources/missingImage@2x.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/moveCursor.png b/Source/core/Resources/moveCursor.png
deleted file mode 100644
index 4ca8d70..0000000
--- a/Source/core/Resources/moveCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/noDropCursor.png b/Source/core/Resources/noDropCursor.png
deleted file mode 100644
index 54463fc..0000000
--- a/Source/core/Resources/noDropCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/noneCursor.png b/Source/core/Resources/noneCursor.png
deleted file mode 100644
index bd1ff35..0000000
--- a/Source/core/Resources/noneCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/northEastResizeCursor.png b/Source/core/Resources/northEastResizeCursor.png
deleted file mode 100644
index 0e89639..0000000
--- a/Source/core/Resources/northEastResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/northEastSouthWestResizeCursor.png b/Source/core/Resources/northEastSouthWestResizeCursor.png
deleted file mode 100644
index 9904c7b..0000000
--- a/Source/core/Resources/northEastSouthWestResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/northResizeCursor.png b/Source/core/Resources/northResizeCursor.png
deleted file mode 100644
index 0d020db..0000000
--- a/Source/core/Resources/northResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/northSouthResizeCursor.png b/Source/core/Resources/northSouthResizeCursor.png
deleted file mode 100644
index 92400e9..0000000
--- a/Source/core/Resources/northSouthResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/northWestResizeCursor.png b/Source/core/Resources/northWestResizeCursor.png
deleted file mode 100644
index 6723f61..0000000
--- a/Source/core/Resources/northWestResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/northWestSouthEastResizeCursor.png b/Source/core/Resources/northWestSouthEastResizeCursor.png
deleted file mode 100644
index b8de34c..0000000
--- a/Source/core/Resources/northWestSouthEastResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/nullPlugin.png b/Source/core/Resources/nullPlugin.png
deleted file mode 100644
index a4195f6..0000000
--- a/Source/core/Resources/nullPlugin.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/nullPlugin@2x.png b/Source/core/Resources/nullPlugin@2x.png
deleted file mode 100644
index ccc4018..0000000
--- a/Source/core/Resources/nullPlugin@2x.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/pagepopups/calendarPicker.css b/Source/core/Resources/pagepopups/calendarPicker.css
deleted file mode 100644
index a4e6ae9..0000000
--- a/Source/core/Resources/pagepopups/calendarPicker.css
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * 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:
- *
- *     * 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.
- */
-
-body {
-    -webkit-user-select: none;
-    background-color: white;
-    font: -webkit-control;
-    font-size: 12px;
-}
-
-.rtl {
-    direction: rtl;
-}
-
-.scroll-view {
-    overflow: hidden;
-    width: 0;
-    height: 0;
-}
-
-.list-cell {
-    position: absolute;
-    left: 0;
-    top: 0;
-    width: 0;
-    height: 0;
-}
-
-.list-cell.hidden {
-    display: none;
-}
-
-.week-number-cell,
-.day-cell {
-    position: static;
-    text-align: center;
-    box-sizing: border-box;
-    display: inline-block;
-    cursor: default;
-    transition: color 1s;
-    padding: 1px;
-}
-
-.week-number-cell {
-    box-sizing: border-box;
-    color: black;
-    padding-right: 0;
-    box-shadow: 1px 0 0 #bfbfbf;
-    margin-right: 1px;
-}
-
-.day-cell {
-    color: #bfbfbf;
-}
-
-.day-cell.highlighted.today,
-.day-cell.today {
-    border: 1px solid #bfbfbf;
-    padding: 0;
-}
-
-.week-number-cell.highlighted,
-.day-cell.highlighted {
-    background-color: #e5ecf8;
-}
-
-.week-number-cell.highlighted.disabled,
-.day-cell.highlighted.disabled {
-    border: 1px solid #e5ecf8;
-    padding: 0;
-}
-
-.week-number-cell.selected,
-.day-cell.selected {
-    background-color: #bccdec;
-}
-
-.week-number-cell.disabled,
-.day-cell.disabled {
-    background-color: #f5f5f5;
-}
-
-.day-cell.current-month {
-    color: #000000;
-}
-
-.calendar-table-view {
-    border: 1px solid #bfbfbf;
-    display: inline-block;
-    outline: none;
-}
-
-.week-number-label,
-.week-day-label {
-    text-align: center;
-    display: inline-block;
-    line-height: 23px;
-    padding-top: 1px;
-    box-sizing: padding-box;
-}
-
-.week-number-label {
-    box-sizing: border-box;
-    border-right: 1px solid #bfbfbf;
-}
-
-.calendar-table-header-view {
-    background-color: #f5f5f5;
-    border-bottom: 1px solid #bfbfbf;
-    height: 24px;
-}
-
-.calendar-picker {
-    border: 1px solid #bfbfbf;
-    border-radius: 2px;
-    position: absolute;
-    padding: 10px;
-    background-color: white;
-    overflow: hidden;
-    cursor: default;
-}
-
-.calendar-header-view {
-    margin-bottom: 10px;
-    display: flex;
-    flex-flow: row;
-}
-
-.calendar-title {
-    -webkit-align-self: center;
-    flex: 1;
-    text-align: left;
-}
-
-.rtl .calendar-title {
-    text-align: right;
-}
-
-.month-popup-button,
-.month-popup-button:hover,
-.month-popup-button:disabled {
-    background-color: transparent !important;
-    background-image: none !important;
-    box-shadow: none !important;
-    color: black;
-}
-
-.month-popup-button:disabled {
-    opacity: 0.7;
-}
-
-.month-popup-button {
-    font-size: 12px;
-    padding: 4px;
-    display: inline-block;
-    cursor: default;
-    border: 1px solid transparent !important;
-    height: 24px !important;
-}
-
-.month-popup-button .disclosure-triangle {
-    margin: 0 6px;
-}
-
-.month-popup-button .disclosure-triangle svg {
-    padding-bottom: 2px;
-}
-
-.today-button::after {
-    content: "";
-    display: block;
-    border-radius: 3px;
-    width: 6px;
-    height: 6px;
-    background-color: #6e6e6e;
-    margin: 0 auto;
-}
-
-.calendar-navigation-button {
-    -webkit-align-self: center;
-    width: 24px;
-    height: 24px;
-    min-width: 0 !important;
-    padding-left: 0 !important;
-    padding-right: 0 !important;
-    -webkit-margin-start: 4px !important;
-}
-
-.year-list-view {
-    border: 1px solid #bfbfbf;
-    background-color: white;
-    position: absolute;
-}
-
-.year-list-cell {
-    box-sizing: border-box;
-    border-bottom: 1px solid #bfbfbf;
-    background-color: white;
-    overflow: hidden;
-}
-
-.year-list-cell .label {
-    height: 24px;
-    line-height: 24px;
-    -webkit-padding-start: 8px;
-    background-color: #f5f5f5;
-    border-bottom: 1px solid #bfbfbf;
-}
-
-.year-list-cell .month-chooser {
-    padding: 0;
-}
-
-.month-buttons-row {
-    display: flex;
-}
-
-.month-button {
-    flex: 1;
-    height: 32px;
-    padding: 0 !important;
-    margin: 0 !important;
-    background-image: none !important;
-    background-color: #ffffff;
-    border-width: 0 !important;
-    box-shadow: none !important;
-}
-
-.month-button.highlighted {
-    background-color: #e5ecf8;
-}
-
-.scrubby-scroll-bar {
-    width: 14px;
-    height: 60px;
-    background-color: white;
-    border-left: 1px solid #bfbfbf;
-    position: absolute;
-    top: 0;
-}
-
-.scrubby-scroll-thumb {
-    width: 10px;
-    margin: 2px;
-    height: 30px;
-    background-color: #d8d8d8;
-    position: absolute;
-    left: 0;
-    top: 0;
-}
-
-.month-popup-view {
-    position: absolute;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    left: 0;
-}
-
-.year-list-view .scrubby-scroll-bar {
-    right: 0;
-}
-
-.rtl .year-list-view .scrubby-scroll-bar {
-    left: 0;
-    right: auto;
-    border-left-width: 0;
-    border-right: 1px solid #bfbfbf;
-}
diff --git a/Source/core/Resources/pagepopups/calendarPicker.js b/Source/core/Resources/pagepopups/calendarPicker.js
deleted file mode 100644
index a01c5ba..0000000
--- a/Source/core/Resources/pagepopups/calendarPicker.js
+++ /dev/null
@@ -1,4009 +0,0 @@
-"use strict";
-/*
- * 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:
- *
- *     * 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.
- */
-
-
-/**
- * @enum {number}
- */
-var WeekDay = {
-    Sunday: 0,
-    Monday: 1,
-    Tuesday: 2,
-    Wednesday: 3,
-    Thursday: 4,
-    Friday: 5,
-    Saturday: 6
-};
-
-/**
- * @type {Object}
- */
-var global = {
-    picker: null,
-    params: {
-        locale: "en_US",
-        weekStartDay: WeekDay.Sunday,
-        dayLabels: ["S", "M", "T", "W", "T", "F", "S"],
-        shortMonthLabels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"],
-        isLocaleRTL: false,
-        mode: "date",
-        weekLabel: "Week",
-        anchorRectInScreen: new Rectangle(0, 0, 0, 0),
-        currentValue: null
-    }
-};
-
-// ----------------------------------------------------------------
-// Utility functions
-
-/**
- * @return {!bool}
- */
-function hasInaccuratePointingDevice() {
-    return matchMedia("(pointer: coarse)").matches;
-}
-
-/**
- * @return {!string} lowercase locale name. e.g. "en-us"
- */
-function getLocale() {
-    return (global.params.locale || "en-us").toLowerCase();
-}
-
-/**
- * @return {!string} lowercase language code. e.g. "en"
- */
-function getLanguage() {
-    var locale = getLocale();
-    var result = locale.match(/^([a-z]+)/);
-    if (!result)
-        return "en";
-    return result[1];
-}
-
-/**
- * @param {!number} number
- * @return {!string}
- */
-function localizeNumber(number) {
-    return window.pagePopupController.localizeNumberString(number);
-}
-
-/**
- * @const
- * @type {number}
- */
-var ImperialEraLimit = 2087;
-
-/**
- * @param {!number} year
- * @param {!number} month
- * @return {!string}
- */
-function formatJapaneseImperialEra(year, month) {
-    // We don't show an imperial era if it is greater than 99 becase of space
-    // limitation.
-    if (year > ImperialEraLimit)
-        return "";
-    if (year > 1989)
-        return "(平成" + localizeNumber(year - 1988) + "年)";
-    if (year == 1989)
-        return "(平成元年)";
-    if (year >= 1927)
-        return "(昭和" + localizeNumber(year - 1925) + "年)";
-    if (year > 1912)
-        return "(大正" + localizeNumber(year - 1911) + "年)";
-    if (year == 1912 && month >= 7)
-        return "(大正元年)";
-    if (year > 1868)
-        return "(明治" + localizeNumber(year - 1867) + "年)";
-    if (year == 1868)
-        return "(明治元年)";
-    return "";
-}
-
-function createUTCDate(year, month, date) {
-    var newDate = new Date(0);
-    newDate.setUTCFullYear(year);
-    newDate.setUTCMonth(month);
-    newDate.setUTCDate(date);
-    return newDate;
-}
-
-/**
- * @param {string} dateString
- * @return {?Day|Week|Month}
- */
-function parseDateString(dateString) {
-    var month = Month.parse(dateString);
-    if (month)
-        return month;
-    var week = Week.parse(dateString);
-    if (week)
-        return week;
-    return Day.parse(dateString);
-}
-
-/**
- * @const
- * @type {number}
- */
-var DaysPerWeek = 7;
-
-/**
- * @const
- * @type {number}
- */
-var MonthsPerYear = 12;
-
-/**
- * @const
- * @type {number}
- */
-var MillisecondsPerDay = 24 * 60 * 60 * 1000;
-
-/**
- * @const
- * @type {number}
- */
-var MillisecondsPerWeek = DaysPerWeek * MillisecondsPerDay;
-
-/**
- * @constructor
- */
-function DateType() {
-}
-
-/**
- * @constructor
- * @extends DateType
- * @param {!number} year
- * @param {!number} month
- * @param {!number} date
- */
-function Day(year, month, date) {
-    var dateObject = createUTCDate(year, month, date);
-    if (isNaN(dateObject.valueOf()))
-        throw "Invalid date";
-    /**
-     * @type {number}
-     * @const
-     */
-    this.year = dateObject.getUTCFullYear();   
-     /**
-     * @type {number}
-     * @const
-     */  
-    this.month = dateObject.getUTCMonth();
-    /**
-     * @type {number}
-     * @const
-     */
-    this.date = dateObject.getUTCDate();
-};
-
-Day.prototype = Object.create(DateType.prototype);
-
-Day.ISOStringRegExp = /^(\d+)-(\d+)-(\d+)/;
-
-/**
- * @param {!string} str
- * @return {?Day}
- */
-Day.parse = function(str) {
-    var match = Day.ISOStringRegExp.exec(str);
-    if (!match)
-        return null;
-    var year = parseInt(match[1], 10);
-    var month = parseInt(match[2], 10) - 1;
-    var date = parseInt(match[3], 10);
-    return new Day(year, month, date);
-};
-
-/**
- * @param {!number} value
- * @return {!Day}
- */
-Day.createFromValue = function(millisecondsSinceEpoch) {
-    return Day.createFromDate(new Date(millisecondsSinceEpoch))
-};
-
-/**
- * @param {!Date} date
- * @return {!Day}
- */
-Day.createFromDate = function(date) {
-    if (isNaN(date.valueOf()))
-        throw "Invalid date";
-    return new Day(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
-};
-
-/**
- * @param {!Day} day
- * @return {!Day}
- */
-Day.createFromDay = function(day) {
-    return day;
-};
-
-/**
- * @return {!Day}
- */
-Day.createFromToday = function() {
-    var now = new Date();
-    return new Day(now.getFullYear(), now.getMonth(), now.getDate());
-};
-
-/**
- * @param {!DateType} other
- * @return {!boolean}
- */
-Day.prototype.equals = function(other) {
-    return other instanceof Day && this.year === other.year && this.month === other.month && this.date === other.date;
-};
-
-/**
- * @param {!number=} offset
- * @return {!Day}
- */
-Day.prototype.previous = function(offset) {
-    if (typeof offset === "undefined")
-        offset = 1;
-    return new Day(this.year, this.month, this.date - offset);
-};
-
-/**
- * @param {!number=} offset
- * @return {!Day}
- */
-Day.prototype.next = function(offset) {
- if (typeof offset === "undefined")
-     offset = 1;
-    return new Day(this.year, this.month, this.date + offset);
-};
-
-/**
- * @return {!Date}
- */
-Day.prototype.startDate = function() {
-    return createUTCDate(this.year, this.month, this.date);
-};
-
-/**
- * @return {!Date}
- */
-Day.prototype.endDate = function() {
-    return createUTCDate(this.year, this.month, this.date + 1);
-};
-
-/**
- * @return {!Day}
- */
-Day.prototype.firstDay = function() {
-    return this;
-};
-
-/**
- * @return {!Day}
- */
-Day.prototype.middleDay = function() {
-    return this;
-};
-
-/**
- * @return {!Day}
- */
-Day.prototype.lastDay = function() {
-    return this;
-};
-
-/**
- * @return {!number}
- */
-Day.prototype.valueOf = function() {
-    return createUTCDate(this.year, this.month, this.date).getTime();
-};
-
-/**
- * @return {!WeekDay}
- */
-Day.prototype.weekDay = function() {
-    return createUTCDate(this.year, this.month, this.date).getUTCDay();
-};
-
-/**
- * @return {!string}
- */
-Day.prototype.toString = function() {
-    var yearString = String(this.year);
-    if (yearString.length < 4)
-        yearString = ("000" + yearString).substr(-4, 4);
-    return yearString + "-" + ("0" + (this.month + 1)).substr(-2, 2) + "-" + ("0" + this.date).substr(-2, 2);
-};
-
-// See WebCore/platform/DateComponents.h.
-Day.Minimum = Day.createFromValue(-62135596800000.0);
-Day.Maximum = Day.createFromValue(8640000000000000.0);
-
-// See WebCore/html/DayInputType.cpp.
-Day.DefaultStep = 86400000;
-Day.DefaultStepBase = 0;
-
-/**
- * @constructor
- * @extends DateType
- * @param {!number} year
- * @param {!number} week
- */
-function Week(year, week) { 
-    /**
-     * @type {number}
-     * @const
-     */
-    this.year = year;
-    /**
-     * @type {number}
-     * @const
-     */
-    this.week = week;
-    // Number of years per year is either 52 or 53.
-    if (this.week < 1 || (this.week > 52 && this.week > Week.numberOfWeeksInYear(this.year))) {
-        var normalizedWeek = Week.createFromDay(this.firstDay());
-        this.year = normalizedWeek.year;
-        this.week = normalizedWeek.week;
-    }
-}
-
-Week.ISOStringRegExp = /^(\d+)-[wW](\d+)$/;
-
-// See WebCore/platform/DateComponents.h.
-Week.Minimum = new Week(1, 1);
-Week.Maximum = new Week(275760, 37);
-
-// See WebCore/html/WeekInputType.cpp.
-Week.DefaultStep = 604800000;
-Week.DefaultStepBase = -259200000;
-
-Week.EpochWeekDay = createUTCDate(1970, 0, 0).getUTCDay();
-
-/**
- * @param {!string} str
- * @return {?Week}
- */
-Week.parse = function(str) {
-    var match = Week.ISOStringRegExp.exec(str);
-    if (!match)
-        return null;
-    var year = parseInt(match[1], 10);
-    var week = parseInt(match[2], 10);
-    return new Week(year, week);
-};
-
-/**
- * @param {!number} millisecondsSinceEpoch
- * @return {!Week}
- */
-Week.createFromValue = function(millisecondsSinceEpoch) {
-    return Week.createFromDate(new Date(millisecondsSinceEpoch))
-};
-
-/**
- * @param {!Date} date
- * @return {!Week}
- */
-Week.createFromDate = function(date) {
-    if (isNaN(date.valueOf()))
-        throw "Invalid date";
-    var year = date.getUTCFullYear();
-    if (year <= Week.Maximum.year && Week.weekOneStartDateForYear(year + 1).getTime() <= date.getTime())
-        year++;
-    else if (year > 1 && Week.weekOneStartDateForYear(year).getTime() > date.getTime())
-        year--;
-    var week = 1 + Week._numberOfWeeksSinceDate(Week.weekOneStartDateForYear(year), date);
-    return new Week(year, week);
-};
-
-/**
- * @param {!Day} day
- * @return {!Week}
- */
-Week.createFromDay = function(day) {
-    var year = day.year;
-    if (year <= Week.Maximum.year && Week.weekOneStartDayForYear(year + 1) <= day)
-        year++;
-    else if (year > 1 && Week.weekOneStartDayForYear(year) > day)
-        year--;
-    var week = Math.floor(1 + (day.valueOf() - Week.weekOneStartDayForYear(year).valueOf()) / MillisecondsPerWeek);
-    return new Week(year, week);
-};
-
-/**
- * @return {!Week}
- */
-Week.createFromToday = function() {
-    var now = new Date();
-    return Week.createFromDate(createUTCDate(now.getFullYear(), now.getMonth(), now.getDate()));
-};
-
-/**
- * @param {!number} year
- * @return {!Date}
- */
-Week.weekOneStartDateForYear = function(year) {
-    if (year < 1)
-        return createUTCDate(1, 0, 1);
-    // The week containing January 4th is week one.
-    var yearStartDay = createUTCDate(year, 0, 4).getUTCDay();
-    return createUTCDate(year, 0, 4 - (yearStartDay + 6) % DaysPerWeek);
-};
-
-/**
- * @param {!number} year
- * @return {!Day}
- */
-Week.weekOneStartDayForYear = function(year) {
-    if (year < 1)
-        return Day.Minimum;
-    // The week containing January 4th is week one.
-    var yearStartDay = createUTCDate(year, 0, 4).getUTCDay();
-    return new Day(year, 0, 4 - (yearStartDay + 6) % DaysPerWeek);
-};
-
-/**
- * @param {!number} year
- * @return {!number}
- */
-Week.numberOfWeeksInYear = function(year) {
-    if (year < 1 || year > Week.Maximum.year)
-        return 0;
-    else if (year === Week.Maximum.year)
-        return Week.Maximum.week;
-    return Week._numberOfWeeksSinceDate(Week.weekOneStartDateForYear(year), Week.weekOneStartDateForYear(year + 1));
-};
-
-/**
- * @param {!Date} baseDate
- * @param {!Date} date
- * @return {!number}
- */
-Week._numberOfWeeksSinceDate = function(baseDate, date) {
-    return Math.floor((date.getTime() - baseDate.getTime()) / MillisecondsPerWeek);
-};
-
-/**
- * @param {!DateType} other
- * @return {!boolean}
- */
-Week.prototype.equals = function(other) {
-    return other instanceof Week && this.year === other.year && this.week === other.week;
-};
-
-/**
- * @param {!number=} offset
- * @return {!Week}
- */
-Week.prototype.previous = function(offset) {
-    if (typeof offset === "undefined")
-        offset = 1;
-    return new Week(this.year, this.week - offset);
-};
-
-/**
- * @param {!number=} offset
- * @return {!Week}
- */
-Week.prototype.next = function(offset) {
-    if (typeof offset === "undefined")
-        offset = 1;
-    return new Week(this.year, this.week + offset);
-};
-
-/**
- * @return {!Date}
- */
-Week.prototype.startDate = function() {
-    var weekStartDate = Week.weekOneStartDateForYear(this.year);
-    weekStartDate.setUTCDate(weekStartDate.getUTCDate() + (this.week - 1) * 7);
-    return weekStartDate;
-};
-
-/**
- * @return {!Date}
- */
-Week.prototype.endDate = function() {
-    if (this.equals(Week.Maximum))
-        return Day.Maximum.startDate();
-    return this.next().startDate();
-};
-
-/**
- * @return {!Day}
- */
-Week.prototype.firstDay = function() {
-    var weekOneStartDay = Week.weekOneStartDayForYear(this.year);
-    return weekOneStartDay.next((this.week - 1) * DaysPerWeek);
-};
-
-/**
- * @return {!Day}
- */
-Week.prototype.middleDay = function() {
-    return this.firstDay().next(3);
-};
-
-/**
- * @return {!Day}
- */
-Week.prototype.lastDay = function() {
-    if (this.equals(Week.Maximum))
-        return Day.Maximum;
-    return this.next().firstDay().previous();
-};
-
-/**
- * @return {!number}
- */
-Week.prototype.valueOf = function() {
-    return this.firstDay().valueOf() - createUTCDate(1970, 0, 1).getTime();
-};
-
-/**
- * @return {!string}
- */
-Week.prototype.toString = function() {
-    var yearString = String(this.year);
-    if (yearString.length < 4)
-        yearString = ("000" + yearString).substr(-4, 4);
-    return yearString + "-W" + ("0" + this.week).substr(-2, 2);
-};
-
-/**
- * @constructor
- * @extends DateType
- * @param {!number} year
- * @param {!number} month
- */
-function Month(year, month) { 
-    /**
-     * @type {number}
-     * @const
-     */
-    this.year = year + Math.floor(month / MonthsPerYear);
-    /**
-     * @type {number}
-     * @const
-     */
-    this.month = month % MonthsPerYear < 0 ? month % MonthsPerYear + MonthsPerYear : month % MonthsPerYear;
-};
-
-Month.ISOStringRegExp = /^(\d+)-(\d+)$/;
-
-// See WebCore/platform/DateComponents.h.
-Month.Minimum = new Month(1, 0);
-Month.Maximum = new Month(275760, 8);
-
-// See WebCore/html/MonthInputType.cpp.
-Month.DefaultStep = 1;
-Month.DefaultStepBase = 0;
-
-/**
- * @param {!string} str
- * @return {?Month}
- */
-Month.parse = function(str) {
-    var match = Month.ISOStringRegExp.exec(str);
-    if (!match)
-        return null;
-    var year = parseInt(match[1], 10);
-    var month = parseInt(match[2], 10) - 1;
-    return new Month(year, month);
-};
-
-/**
- * @param {!number} value
- * @return {!Month}
- */
-Month.createFromValue = function(monthsSinceEpoch) {
-    return new Month(1970, monthsSinceEpoch)
-};
-
-/**
- * @param {!Date} date
- * @return {!Month}
- */
-Month.createFromDate = function(date) {
-    if (isNaN(date.valueOf()))
-        throw "Invalid date";
-    return new Month(date.getUTCFullYear(), date.getUTCMonth());
-};
-
-/**
- * @param {!Day} day
- * @return {!Month}
- */
-Month.createFromDay = function(day) {
-    return new Month(day.year, day.month);
-};
-
-/**
- * @return {!Month}
- */
-Month.createFromToday = function() {
-    var now = new Date();
-    return new Month(now.getFullYear(), now.getMonth());
-};
-
-/**
- * @return {!boolean}
- */
-Month.prototype.containsDay = function(day) {
-    return this.year === day.year && this.month === day.month;
-};
-
-/**
- * @param {!Month} other
- * @return {!boolean}
- */
-Month.prototype.equals = function(other) {
-    return other instanceof Month && this.year === other.year && this.month === other.month;
-};
-
-/**
- * @param {!number=} offset
- * @return {!Month}
- */
-Month.prototype.previous = function(offset) {
-    if (typeof offset === "undefined")
-        offset = 1;
-    return new Month(this.year, this.month - offset);
-};
-
-/**
- * @param {!number=} offset
- * @return {!Month}
- */
-Month.prototype.next = function(offset) {
-    if (typeof offset === "undefined")
-        offset = 1;
-    return new Month(this.year, this.month + offset);
-};
-
-/**
- * @return {!Date}
- */
-Month.prototype.startDate = function() {
-    return createUTCDate(this.year, this.month, 1);
-};
-
-/**
- * @return {!Date}
- */
-Month.prototype.endDate = function() {
-    if (this.equals(Month.Maximum))
-        return Day.Maximum.startDate();
-    return this.next().startDate();
-};
-
-/**
- * @return {!Day}
- */
-Month.prototype.firstDay = function() {
-    return new Day(this.year, this.month, 1);
-};
-
-/**
- * @return {!Day}
- */
-Month.prototype.middleDay = function() {
-    return new Day(this.year, this.month, this.month === 2 ? 14 : 15);
-};
-
-/**
- * @return {!Day}
- */
-Month.prototype.lastDay = function() {
-    if (this.equals(Month.Maximum))
-        return Day.Maximum;
-    return this.next().firstDay().previous();
-};
-
-/**
- * @return {!number}
- */
-Month.prototype.valueOf = function() {
-    return (this.year - 1970) * MonthsPerYear + this.month;
-};
-
-/**
- * @return {!string}
- */
-Month.prototype.toString = function() {
-    var yearString = String(this.year);
-    if (yearString.length < 4)
-        yearString = ("000" + yearString).substr(-4, 4);
-    return yearString + "-" + ("0" + (this.month + 1)).substr(-2, 2);
-};
-
-/**
- * @return {!string}
- */
-Month.prototype.toLocaleString = function() {
-    if (global.params.locale === "ja")
-        return "" + this.year + "年" + formatJapaneseImperialEra(this.year, this.month) + " " + (this.month + 1) + "月";
-    return window.pagePopupController.formatMonth(this.year, this.month);
-};
-
-/**
- * @return {!string}
- */
-Month.prototype.toShortLocaleString = function() {
-    return window.pagePopupController.formatShortMonth(this.year, this.month);
-};
-
-// ----------------------------------------------------------------
-// Initialization
-
-/**
- * @param {Event} event
- */
-function handleMessage(event) {
-    if (global.argumentsReceived)
-        return;
-    global.argumentsReceived = true;
-    initialize(JSON.parse(event.data));
-}
-
-/**
- * @param {!Object} params
- */
-function setGlobalParams(params) {
-    var name;
-    for (name in global.params) {
-        if (typeof params[name] === "undefined")
-            console.warn("Missing argument: " + name);
-    }
-    for (name in params) {
-        global.params[name] = params[name];
-    }
-};
-
-/**
- * @param {!Object} args
- */
-function initialize(args) { 
-    setGlobalParams(args);
-    if (global.params.suggestionValues && global.params.suggestionValues.length)
-        openSuggestionPicker();
-    else
-        openCalendarPicker();
-}
-
-function closePicker() {
-    if (global.picker)
-        global.picker.cleanup();
-    var main = $("main");
-    main.innerHTML = "";
-    main.className = "";
-};
-
-function openSuggestionPicker() {
-    closePicker();
-    global.picker = new SuggestionPicker($("main"), global.params);
-};
-
-function openCalendarPicker() {
-    closePicker();
-    global.picker = new CalendarPicker(global.params.mode, global.params);
-    global.picker.attachTo($("main"));
-};
-
-/**
- * @constructor
- */
-function EventEmitter() {
-};
-
-/**
- * @param {!string} type
- * @param {!function({...*})} callback
- */
-EventEmitter.prototype.on = function(type, callback) {
-    console.assert(callback instanceof Function);
-    if (!this._callbacks)
-        this._callbacks = {};
-    if (!this._callbacks[type])
-        this._callbacks[type] = [];
-    this._callbacks[type].push(callback);
-};
-
-EventEmitter.prototype.hasListener = function(type) {
-    if (!this._callbacks)
-        return false;
-    var callbacksForType = this._callbacks[type];
-    if (!callbacksForType)
-        return false;
-    return callbacksForType.length > 0;
-};
-
-/**
- * @param {!string} type
- * @param {!function(Object)} callback
- */
-EventEmitter.prototype.removeListener = function(type, callback) {
-    if (!this._callbacks)
-        return;
-    var callbacksForType = this._callbacks[type];
-    if (!callbacksForType)
-        return;
-    callbacksForType.splice(callbacksForType.indexOf(callback), 1);
-    if (callbacksForType.length === 0)
-        delete this._callbacks[type];
-};
-
-/**
- * @param {!string} type
- * @param {...*} var_args
- */
-EventEmitter.prototype.dispatchEvent = function(type) {
-    if (!this._callbacks)
-        return;
-    var callbacksForType = this._callbacks[type];
-    if (!callbacksForType)
-        return;
-    for (var i = 0; i < callbacksForType.length; ++i) {
-        callbacksForType[i].apply(this, Array.prototype.slice.call(arguments, 1));
-    }
-};
-
-// Parameter t should be a number between 0 and 1.
-var AnimationTimingFunction = {
-    Linear: function(t){
-        return t;
-    },
-    EaseInOut: function(t){
-        t *= 2;
-        if (t < 1)
-            return Math.pow(t, 3) / 2;
-        t -= 2;
-        return Math.pow(t, 3) / 2 + 1;
-    }
-};
-
-/**
- * @constructor
- * @extends EventEmitter
- */
-function AnimationManager() {
-    EventEmitter.call(this);
-
-    this._isRunning = false;
-    this._runningAnimatorCount = 0;
-    this._runningAnimators = {};
-    this._animationFrameCallbackBound = this._animationFrameCallback.bind(this);
-}
-
-AnimationManager.prototype = Object.create(EventEmitter.prototype);
-
-AnimationManager.EventTypeAnimationFrameWillFinish = "animationFrameWillFinish";
-
-AnimationManager.prototype._startAnimation = function() {
-    if (this._isRunning)
-        return;
-    this._isRunning = true;
-    window.webkitRequestAnimationFrame(this._animationFrameCallbackBound);
-};
-
-AnimationManager.prototype._stopAnimation = function() {
-    if (!this._isRunning)
-        return;
-    this._isRunning = false;
-};
-
-/**
- * @param {!Animator} animator
- */
-AnimationManager.prototype.add = function(animator) {
-    if (this._runningAnimators[animator.id])
-        return;
-    this._runningAnimators[animator.id] = animator;
-    this._runningAnimatorCount++;
-    if (this._needsTimer())
-        this._startAnimation();
-};
-
-/**
- * @param {!Animator} animator
- */
-AnimationManager.prototype.remove = function(animator) {
-    if (!this._runningAnimators[animator.id])
-        return;
-    delete this._runningAnimators[animator.id];
-    this._runningAnimatorCount--;
-    if (!this._needsTimer())
-        this._stopAnimation();
-};
-
-AnimationManager.prototype._animationFrameCallback = function(now) {
-    if (this._runningAnimatorCount > 0) {
-        for (var id in this._runningAnimators) {
-            this._runningAnimators[id].onAnimationFrame(now);
-        }
-    }
-    this.dispatchEvent(AnimationManager.EventTypeAnimationFrameWillFinish);
-    if (this._isRunning)
-        window.webkitRequestAnimationFrame(this._animationFrameCallbackBound);
-};
-
-/**
- * @return {!boolean}
- */
-AnimationManager.prototype._needsTimer = function() {
-    return this._runningAnimatorCount > 0 || this.hasListener(AnimationManager.EventTypeAnimationFrameWillFinish);
-};
-
-/**
- * @param {!string} type
- * @param {!Function} callback
- * @override
- */
-AnimationManager.prototype.on = function(type, callback) {
-    EventEmitter.prototype.on.call(this, type, callback);
-    if (this._needsTimer())
-        this._startAnimation();
-};
-
-/**
- * @param {!string} type
- * @param {!Function} callback
- * @override
- */
-AnimationManager.prototype.removeListener = function(type, callback) {
-    EventEmitter.prototype.removeListener.call(this, type, callback);
-    if (!this._needsTimer())
-        this._stopAnimation();
-};
-
-AnimationManager.shared = new AnimationManager();
-
-/**
- * @constructor
- * @extends EventEmitter
- */
-function Animator() {
-    EventEmitter.call(this);
-
-    /**
-     * @type {!number}
-     * @const
-     */
-    this.id = Animator._lastId++;
-    /**
-     * @type {!number}
-     */
-    this.duration = 100;
-    /**
-     * @type {?function}
-     */
-    this.step = null;
-    /**
-     * @type {!boolean}
-     * @protected
-     */
-    this._isRunning = false;
-    /**
-     * @type {!number}
-     */
-    this.currentValue = 0;
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._lastStepTime = 0;
-}
-
-Animator.prototype = Object.create(EventEmitter.prototype);
-
-Animator._lastId = 0;
-
-Animator.EventTypeDidAnimationStop = "didAnimationStop";
-
-/**
- * @return {!boolean}
- */
-Animator.prototype.isRunning = function() {
-    return this._isRunning;
-};
-
-Animator.prototype.start = function() {
-    this._lastStepTime = Date.now();
-    this._isRunning = true;
-    AnimationManager.shared.add(this);
-};
-
-Animator.prototype.stop = function() {
-    if (!this._isRunning)
-        return;
-    this._isRunning = false;
-    AnimationManager.shared.remove(this);
-    this.dispatchEvent(Animator.EventTypeDidAnimationStop, this);
-};
-
-/**
- * @param {!number} now
- */
-Animator.prototype.onAnimationFrame = function(now) {
-    this._lastStepTime = now;
-    this.step(this);
-};
-
-/**
- * @constructor
- * @extends Animator
- */
-function TransitionAnimator() {
-    Animator.call(this);
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._from = 0;
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._to = 0;
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._delta = 0;
-    /**
-     * @type {!number}
-     */
-    this.progress = 0.0;
-    /**
-     * @type {!function}
-     */
-    this.timingFunction = AnimationTimingFunction.Linear;
-}
-
-TransitionAnimator.prototype = Object.create(Animator.prototype);
-
-/**
- * @param {!number} value
- */
-TransitionAnimator.prototype.setFrom = function(value) {
-    this._from = value;
-    this._delta = this._to - this._from;
-};
-
-TransitionAnimator.prototype.start = function() {
-    console.assert(isFinite(this.duration));
-    this.progress = 0.0;
-    this.currentValue = this._from;
-    Animator.prototype.start.call(this);
-};
-
-/**
- * @param {!number} value
- */
-TransitionAnimator.prototype.setTo = function(value) {
-    this._to = value;
-    this._delta = this._to - this._from;
-};
-
-/**
- * @param {!number} now
- */
-TransitionAnimator.prototype.onAnimationFrame = function(now) {
-    this.progress += (now - this._lastStepTime) / this.duration;
-    this.progress = Math.min(1.0, this.progress);
-    this._lastStepTime = now;
-    this.currentValue = this.timingFunction(this.progress) * this._delta + this._from;
-    this.step(this);
-    if (this.progress === 1.0) {
-        this.stop();
-        return;
-    }
-};
-
-/**
- * @constructor
- * @extends Animator
- * @param {!number} initialVelocity
- * @param {!number} initialValue
- */
-function FlingGestureAnimator(initialVelocity, initialValue) {
-    Animator.call(this);
-    /**
-     * @type {!number}
-     */
-    this.initialVelocity = initialVelocity;
-    /**
-     * @type {!number}
-     */
-    this.initialValue = initialValue;
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._elapsedTime = 0;
-    var startVelocity = Math.abs(this.initialVelocity);
-    if (startVelocity > this._velocityAtTime(0))
-        startVelocity = this._velocityAtTime(0);
-    if (startVelocity < 0)
-        startVelocity = 0;
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._timeOffset = this._timeAtVelocity(startVelocity);
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._positionOffset = this._valueAtTime(this._timeOffset);
-    /**
-     * @type {!number}
-     */
-    this.duration = this._timeAtVelocity(0);
-}
-
-FlingGestureAnimator.prototype = Object.create(Animator.prototype);
-
-// Velocity is subject to exponential decay. These parameters are coefficients
-// that determine the curve.
-FlingGestureAnimator._P0 = -5707.62;
-FlingGestureAnimator._P1 = 0.172;
-FlingGestureAnimator._P2 = 0.0037;
-
-/**
- * @param {!number} t
- */
-FlingGestureAnimator.prototype._valueAtTime = function(t) {
-    return FlingGestureAnimator._P0 * Math.exp(-FlingGestureAnimator._P2 * t) - FlingGestureAnimator._P1 * t - FlingGestureAnimator._P0;
-};
-
-/**
- * @param {!number} t
- */
-FlingGestureAnimator.prototype._velocityAtTime = function(t) {
-    return -FlingGestureAnimator._P0 * FlingGestureAnimator._P2 * Math.exp(-FlingGestureAnimator._P2 * t) - FlingGestureAnimator._P1;
-};
-
-/**
- * @param {!number} v
- */
-FlingGestureAnimator.prototype._timeAtVelocity = function(v) {
-    return -Math.log((v + FlingGestureAnimator._P1) / (-FlingGestureAnimator._P0 * FlingGestureAnimator._P2)) / FlingGestureAnimator._P2;
-};
-
-FlingGestureAnimator.prototype.start = function() {
-    this._lastStepTime = Date.now();
-    Animator.prototype.start.call(this);
-};
-
-/**
- * @param {!number} now
- */
-FlingGestureAnimator.prototype.onAnimationFrame = function(now) {
-    this._elapsedTime += now - this._lastStepTime;
-    this._lastStepTime = now;
-    if (this._elapsedTime + this._timeOffset >= this.duration) {
-        this.stop();
-        return;
-    }
-    var position = this._valueAtTime(this._elapsedTime + this._timeOffset) - this._positionOffset;
-    if (this.initialVelocity < 0)
-        position = -position;
-    this.currentValue = position + this.initialValue;
-    this.step(this);
-};
-
-/**
- * @constructor
- * @extends EventEmitter
- * @param {?Element} element
- * View adds itself as a property on the element so we can access it from Event.target.
- */
-function View(element) {
-    EventEmitter.call(this);
-    /**
-     * @type {Element}
-     * @const
-     */
-    this.element = element || createElement("div");
-    this.element.$view = this;
-    this.bindCallbackMethods();
-}
-
-View.prototype = Object.create(EventEmitter.prototype);
-
-/**
- * @param {!Element} ancestorElement
- * @return {?Object}
- */
-View.prototype.offsetRelativeTo = function(ancestorElement) {
-    var x = 0;
-    var y = 0;
-    var element = this.element;
-    while (element) {
-        x += element.offsetLeft  || 0;
-        y += element.offsetTop || 0;
-        element = element.offsetParent;
-        if (element === ancestorElement)
-            return {x: x, y: y};
-    }
-    return null;
-};
-
-/**
- * @param {!View|Node} parent
- * @param {?View|Node=} before
- */
-View.prototype.attachTo = function(parent, before) {
-    if (parent instanceof View)
-        return this.attachTo(parent.element, before);
-    if (typeof before === "undefined")
-        before = null;
-    if (before instanceof View)
-        before = before.element;
-    parent.insertBefore(this.element, before);
-};
-
-View.prototype.bindCallbackMethods = function() {
-    for (var methodName in this) {
-        if (!/^on[A-Z]/.test(methodName))
-            continue;
-        if (this.hasOwnProperty(methodName))
-            continue;
-        var method = this[methodName];
-        if (!(method instanceof Function))
-            continue;
-        this[methodName] = method.bind(this);
-    }
-};
-
-/**
- * @constructor
- * @extends View
- */
-function ScrollView() {
-    View.call(this, createElement("div", ScrollView.ClassNameScrollView));
-    /**
-     * @type {Element}
-     * @const
-     */
-    this.contentElement = createElement("div", ScrollView.ClassNameScrollViewContent);
-    this.element.appendChild(this.contentElement);
-    /**
-     * @type {number}
-     */
-    this.minimumContentOffset = -Infinity;
-    /**
-     * @type {number}
-     */
-    this.maximumContentOffset = Infinity;
-    /**
-     * @type {number}
-     * @protected
-     */
-    this._contentOffset = 0;
-    /**
-     * @type {number}
-     * @protected
-     */
-    this._width = 0;
-    /**
-     * @type {number}
-     * @protected
-     */
-    this._height = 0;
-    /**
-     * @type {Animator}
-     * @protected
-     */
-    this._scrollAnimator = null;
-    /**
-     * @type {?Object}
-     */
-    this.delegate = null;
-    /**
-     * @type {!number}
-     */
-    this._lastTouchPosition = 0;
-    /**
-     * @type {!number}
-     */
-    this._lastTouchVelocity = 0;
-    /**
-     * @type {!number}
-     */
-    this._lastTouchTimeStamp = 0;
-
-    this.element.addEventListener("mousewheel", this.onMouseWheel, false);
-    this.element.addEventListener("touchstart", this.onTouchStart, false);
-
-    /**
-     * The content offset is partitioned so the it can go beyond the CSS limit
-     * of 33554433px.
-     * @type {number}
-     * @protected
-     */
-    this._partitionNumber = 0;
-}
-
-ScrollView.prototype = Object.create(View.prototype);
-
-ScrollView.PartitionHeight = 100000;
-ScrollView.ClassNameScrollView = "scroll-view";
-ScrollView.ClassNameScrollViewContent = "scroll-view-content";
-
-/**
- * @param {!Event} event
- */
-ScrollView.prototype.onTouchStart = function(event) {
-    var touch = event.touches[0];
-    this._lastTouchPosition = touch.clientY;
-    this._lastTouchVelocity = 0;
-    this._lastTouchTimeStamp = event.timeStamp;
-    if (this._scrollAnimator)
-        this._scrollAnimator.stop();
-    window.addEventListener("touchmove", this.onWindowTouchMove, false);
-    window.addEventListener("touchend", this.onWindowTouchEnd, false);
-};
-
-/**
- * @param {!Event} event
- */
-ScrollView.prototype.onWindowTouchMove = function(event) {
-    var touch = event.touches[0];
-    var deltaTime = event.timeStamp - this._lastTouchTimeStamp;
-    var deltaY = this._lastTouchPosition - touch.clientY;
-    this.scrollBy(deltaY, false);
-    this._lastTouchVelocity = deltaY / deltaTime;
-    this._lastTouchPosition = touch.clientY;
-    this._lastTouchTimeStamp = event.timeStamp;
-    event.stopPropagation();
-    event.preventDefault();
-};
-
-/**
- * @param {!Event} event
- */
-ScrollView.prototype.onWindowTouchEnd = function(event) {
-    if (Math.abs(this._lastTouchVelocity) > 0.01) {
-        this._scrollAnimator = new FlingGestureAnimator(this._lastTouchVelocity, this._contentOffset);
-        this._scrollAnimator.step = this.onFlingGestureAnimatorStep;
-        this._scrollAnimator.start();
-    }
-    window.removeEventListener("touchmove", this.onWindowTouchMove, false);
-    window.removeEventListener("touchend", this.onWindowTouchEnd, false);
-};
-
-/**
- * @param {!Animator} animator
- */
-ScrollView.prototype.onFlingGestureAnimatorStep = function(animator) {
-    this.scrollTo(animator.currentValue, false);
-};
-
-/**
- * @return {!Animator}
- */
-ScrollView.prototype.scrollAnimator = function() {
-    return this._scrollAnimator;
-};
-
-/**
- * @param {!number} width
- */
-ScrollView.prototype.setWidth = function(width) {
-    console.assert(isFinite(width));
-    if (this._width === width)
-        return;
-    this._width = width;
-    this.element.style.width = this._width + "px";
-};
-
-/**
- * @return {!number}
- */
-ScrollView.prototype.width = function() {
-    return this._width;
-};
-
-/**
- * @param {!number} height
- */
-ScrollView.prototype.setHeight = function(height) {
-    console.assert(isFinite(height));
-    if (this._height === height)
-        return;
-    this._height = height;
-    this.element.style.height = height + "px";
-    if (this.delegate)
-        this.delegate.scrollViewDidChangeHeight(this);
-};
-
-/**
- * @return {!number}
- */
-ScrollView.prototype.height = function() {
-    return this._height;
-};
-
-/**
- * @param {!Animator} animator
- */
-ScrollView.prototype.onScrollAnimatorStep = function(animator) {
-    this.setContentOffset(animator.currentValue);
-};
-
-/**
- * @param {!number} offset
- * @param {?boolean} animate
- */
-ScrollView.prototype.scrollTo = function(offset, animate) {
-    console.assert(isFinite(offset));
-    if (!animate) {
-        this.setContentOffset(offset);
-        return;
-    }
-    if (this._scrollAnimator)
-        this._scrollAnimator.stop();
-    this._scrollAnimator = new TransitionAnimator();
-    this._scrollAnimator.step = this.onScrollAnimatorStep;
-    this._scrollAnimator.setFrom(this._contentOffset);
-    this._scrollAnimator.setTo(offset);
-    this._scrollAnimator.duration = 300;
-    this._scrollAnimator.start();
-};
-
-/**
- * @param {!number} offset
- * @param {?boolean} animate
- */
-ScrollView.prototype.scrollBy = function(offset, animate) {
-    this.scrollTo(this._contentOffset + offset, animate);
-};
-
-/**
- * @return {!number}
- */
-ScrollView.prototype.contentOffset = function() {
-    return this._contentOffset;
-};
-
-/**
- * @param {?Event} event
- */
-ScrollView.prototype.onMouseWheel = function(event) {
-    this.setContentOffset(this._contentOffset - event.wheelDelta / 30);
-    event.stopPropagation();
-    event.preventDefault();
-};
-
-
-/**
- * @param {!number} value
- */
-ScrollView.prototype.setContentOffset = function(value) {
-    console.assert(isFinite(value));
-    value = Math.min(this.maximumContentOffset - this._height, Math.max(this.minimumContentOffset, Math.floor(value)));
-    if (this._contentOffset === value)
-        return;
-    var newPartitionNumber = Math.floor(value / ScrollView.PartitionHeight);    
-    var partitionChanged = this._partitionNumber !== newPartitionNumber;
-    this._partitionNumber = newPartitionNumber;
-    this._contentOffset = value;
-    this.contentElement.style.webkitTransform = "translate(0, " + (-this.contentPositionForContentOffset(this._contentOffset)) + "px)";
-    if (this.delegate) {
-        this.delegate.scrollViewDidChangeContentOffset(this);
-        if (partitionChanged)
-            this.delegate.scrollViewDidChangePartition(this);
-    }
-};
-
-/**
- * @param {!number} offset
- */
-ScrollView.prototype.contentPositionForContentOffset = function(offset) {
-    return offset - this._partitionNumber * ScrollView.PartitionHeight;
-};
-
-/**
- * @constructor
- * @extends View
- */
-function ListCell() {
-    View.call(this, createElement("div", ListCell.ClassNameListCell));
-    
-    /**
-     * @type {!number}
-     */
-    this.row = NaN;
-    /**
-     * @type {!number}
-     */
-    this._width = 0;
-    /**
-     * @type {!number}
-     */
-    this._position = 0;
-}
-
-ListCell.prototype = Object.create(View.prototype);
-
-ListCell.DefaultRecycleBinLimit = 64;
-ListCell.ClassNameListCell = "list-cell";
-ListCell.ClassNameHidden = "hidden";
-
-/**
- * @return {!Array} An array to keep thrown away cells.
- */
-ListCell.prototype._recycleBin = function() {
-    console.assert(false, "NOT REACHED: ListCell.prototype._recycleBin needs to be overridden.");
-    return [];
-};
-
-ListCell.prototype.throwAway = function() {
-    this.hide();
-    var limit = typeof this.constructor.RecycleBinLimit === "undefined" ? ListCell.DefaultRecycleBinLimit : this.constructor.RecycleBinLimit;
-    var recycleBin = this._recycleBin();
-    if (recycleBin.length < limit)
-        recycleBin.push(this);
-};
-
-ListCell.prototype.show = function() {
-    this.element.classList.remove(ListCell.ClassNameHidden);
-};
-
-ListCell.prototype.hide = function() {
-    this.element.classList.add(ListCell.ClassNameHidden);
-};
-
-/**
- * @return {!number} Width in pixels.
- */
-ListCell.prototype.width = function(){
-    return this._width;
-};
-
-/**
- * @param {!number} width Width in pixels.
- */
-ListCell.prototype.setWidth = function(width){
-    if (this._width === width)
-        return;
-    this._width = width;
-    this.element.style.width = this._width + "px";
-};
-
-/**
- * @return {!number} Position in pixels.
- */
-ListCell.prototype.position = function(){
-    return this._position;
-};
-
-/**
- * @param {!number} y Position in pixels.
- */
-ListCell.prototype.setPosition = function(y) {
-    if (this._position === y)
-        return;
-    this._position = y;
-    this.element.style.webkitTransform = "translate(0, " + this._position + "px)";
-};
-
-/**
- * @param {!boolean} selected
- */
-ListCell.prototype.setSelected = function(selected) {
-    if (this._selected === selected)
-        return;
-    this._selected = selected;
-    if (this._selected)
-        this.element.classList.add("selected");
-    else
-        this.element.classList.remove("selected");
-};
-
-/**
- * @constructor
- * @extends View
- */
-function ListView() {
-    View.call(this, createElement("div", ListView.ClassNameListView));
-    this.element.tabIndex = 0;
-
-    /**
-     * @type {!number}
-     * @private
-     */
-    this._width = 0;
-    /**
-     * @type {!Object}
-     * @private
-     */
-    this._cells = {};
-
-    /**
-     * @type {!number}
-     */
-    this.selectedRow = ListView.NoSelection;
-
-    /**
-     * @type {!ScrollView}
-     */
-    this.scrollView = new ScrollView();
-    this.scrollView.delegate = this;
-    this.scrollView.minimumContentOffset = 0;
-    this.scrollView.setWidth(0);
-    this.scrollView.setHeight(0);
-    this.scrollView.attachTo(this);
-
-    this.element.addEventListener("click", this.onClick, false);
-
-    /**
-     * @type {!boolean}
-     * @private
-     */
-    this._needsUpdateCells = false;
-}
-
-ListView.prototype = Object.create(View.prototype);
-
-ListView.NoSelection = -1;
-ListView.ClassNameListView = "list-view";
-
-ListView.prototype.onAnimationFrameWillFinish = function() {
-    if (this._needsUpdateCells)
-        this.updateCells();
-};
-
-/**
- * @param {!boolean} needsUpdateCells
- */
-ListView.prototype.setNeedsUpdateCells = function(needsUpdateCells) {
-    if (this._needsUpdateCells === needsUpdateCells)
-        return;
-    this._needsUpdateCells = needsUpdateCells;
-    if (this._needsUpdateCells)
-        AnimationManager.shared.on(AnimationManager.EventTypeAnimationFrameWillFinish, this.onAnimationFrameWillFinish);
-    else
-        AnimationManager.shared.removeListener(AnimationManager.EventTypeAnimationFrameWillFinish, this.onAnimationFrameWillFinish);
-};
-
-/**
- * @param {!number} row
- * @return {?ListCell}
- */
-ListView.prototype.cellAtRow = function(row) {
-    return this._cells[row];
-};
-
-/**
- * @param {!number} offset Scroll offset in pixels.
- * @return {!number}
- */
-ListView.prototype.rowAtScrollOffset = function(offset) {
-    console.assert(false, "NOT REACHED: ListView.prototype.rowAtScrollOffset needs to be overridden.");
-    return 0;
-};
-
-/**
- * @param {!number} row
- * @return {!number} Scroll offset in pixels.
- */
-ListView.prototype.scrollOffsetForRow = function(row) {
-    console.assert(false, "NOT REACHED: ListView.prototype.scrollOffsetForRow needs to be overridden.");
-    return 0;
-};
-
-/**
- * @param {!number} row
- * @return {!ListCell}
- */
-ListView.prototype.addCellIfNecessary = function(row) {
-    var cell = this._cells[row];
-    if (cell)
-        return cell;
-    cell = this.prepareNewCell(row);
-    cell.attachTo(this.scrollView.contentElement);
-    cell.setWidth(this._width);
-    cell.setPosition(this.scrollView.contentPositionForContentOffset(this.scrollOffsetForRow(row)));
-    this._cells[row] = cell;
-    return cell;
-};
-
-/**
- * @param {!number} row
- * @return {!ListCell}
- */
-ListView.prototype.prepareNewCell = function(row) {
-    console.assert(false, "NOT REACHED: ListView.prototype.prepareNewCell should be overridden.");
-    return new ListCell();
-};
-
-/**
- * @param {!ListCell} cell
- */
-ListView.prototype.throwAwayCell = function(cell) {
-    delete this._cells[cell.row];
-    cell.throwAway();
-};
-
-/**
- * @return {!number}
- */
-ListView.prototype.firstVisibleRow = function() {
-    return this.rowAtScrollOffset(this.scrollView.contentOffset());
-};
-
-/**
- * @return {!number}
- */
-ListView.prototype.lastVisibleRow = function() {
-    return this.rowAtScrollOffset(this.scrollView.contentOffset() + this.scrollView.height() - 1);
-};
-
-/**
- * @param {!ScrollView} scrollView
- */
-ListView.prototype.scrollViewDidChangeContentOffset = function(scrollView) {
-    this.setNeedsUpdateCells(true);
-};
-
-/**
- * @param {!ScrollView} scrollView
- */
-ListView.prototype.scrollViewDidChangeHeight = function(scrollView) {
-    this.setNeedsUpdateCells(true);
-};
-
-/**
- * @param {!ScrollView} scrollView
- */
-ListView.prototype.scrollViewDidChangePartition = function(scrollView) {
-    this.setNeedsUpdateCells(true);
-};
-
-ListView.prototype.updateCells = function() {
-    var firstVisibleRow = this.firstVisibleRow();
-    var lastVisibleRow = this.lastVisibleRow();
-    console.assert(firstVisibleRow <= lastVisibleRow);
-    for (var c in this._cells) {
-        var cell = this._cells[c];
-        if (cell.row < firstVisibleRow || cell.row > lastVisibleRow)
-            this.throwAwayCell(cell);
-    }
-    for (var i = firstVisibleRow; i <= lastVisibleRow; ++i) {
-        var cell = this._cells[i];
-        if (cell)
-            cell.setPosition(this.scrollView.contentPositionForContentOffset(this.scrollOffsetForRow(cell.row)));
-        else
-            this.addCellIfNecessary(i);
-    }
-    this.setNeedsUpdateCells(false);
-};
-
-/**
- * @return {!number} Width in pixels.
- */
-ListView.prototype.width = function() {
-    return this._width;
-};
-
-/**
- * @param {!number} width Width in pixels.
- */
-ListView.prototype.setWidth = function(width) {
-    if (this._width === width)
-        return;
-    this._width = width;
-    this.scrollView.setWidth(this._width);
-    for (var c in this._cells) {
-        this._cells[c].setWidth(this._width);
-    }
-    this.element.style.width = this._width + "px";
-    this.setNeedsUpdateCells(true);
-};
-
-/**
- * @return {!number} Height in pixels.
- */
-ListView.prototype.height = function() {
-    return this.scrollView.height();
-};
-
-/**
- * @param {!number} height Height in pixels.
- */
-ListView.prototype.setHeight = function(height) {
-    this.scrollView.setHeight(height);
-};
-
-/**
- * @param {?Event} event
- */
-ListView.prototype.onClick = function(event) {
-    var clickedCellElement = enclosingNodeOrSelfWithClass(event.target, ListCell.ClassNameListCell);
-    if (!clickedCellElement)
-        return;
-    var clickedCell = clickedCellElement.$view;
-    if (clickedCell.row !== this.selectedRow)
-        this.select(clickedCell.row);
-};
-
-/**
- * @param {!number} row
- */
-ListView.prototype.select = function(row) {
-    if (this.selectedRow === row)
-        return;
-    this.deselect();
-    if (row === ListView.NoSelection)
-        return;
-    this.selectedRow = row;
-    var selectedCell = this._cells[this.selectedRow];
-    if (selectedCell)
-        selectedCell.setSelected(true);
-};
-
-ListView.prototype.deselect = function() {
-    if (this.selectedRow === ListView.NoSelection)
-        return;
-    var selectedCell = this._cells[this.selectedRow];
-    if (selectedCell)
-        selectedCell.setSelected(false);
-    this.selectedRow = ListView.NoSelection;
-};
-
-/**
- * @param {!number} row
- * @param {!boolean} animate
- */
-ListView.prototype.scrollToRow = function(row, animate) {
-    this.scrollView.scrollTo(this.scrollOffsetForRow(row), animate);
-};
-
-/**
- * @constructor
- * @extends View
- * @param {!ScrollView} scrollView
- */
-function ScrubbyScrollBar(scrollView) {
-    View.call(this, createElement("div", ScrubbyScrollBar.ClassNameScrubbyScrollBar));
-
-    /**
-     * @type {!Element}
-     * @const
-     */
-    this.thumb = createElement("div", ScrubbyScrollBar.ClassNameScrubbyScrollThumb);
-    this.element.appendChild(this.thumb);
-
-    /**
-     * @type {!ScrollView}
-     * @const
-     */
-    this.scrollView = scrollView;
-
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._height = 0;
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._thumbHeight = 0;
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._thumbPosition = 0;
-
-    this.setHeight(0);
-    this.setThumbHeight(ScrubbyScrollBar.ThumbHeight);
-
-    /**
-     * @type {?Animator}
-     * @protected
-     */
-    this._thumbStyleTopAnimator = null;
-
-    /** 
-     * @type {?number}
-     * @protected
-     */
-    this._timer = null;
-    
-    this.element.addEventListener("mousedown", this.onMouseDown, false);
-    this.element.addEventListener("touchstart", this.onTouchStart, false);
-}
-
-ScrubbyScrollBar.prototype = Object.create(View.prototype);
-
-ScrubbyScrollBar.ScrollInterval = 16;
-ScrubbyScrollBar.ThumbMargin = 2;
-ScrubbyScrollBar.ThumbHeight = 30;
-ScrubbyScrollBar.ClassNameScrubbyScrollBar = "scrubby-scroll-bar";
-ScrubbyScrollBar.ClassNameScrubbyScrollThumb = "scrubby-scroll-thumb";
-
-/**
- * @param {?Event} event
- */
-ScrubbyScrollBar.prototype.onTouchStart = function(event) {
-    var touch = event.touches[0];
-    this._setThumbPositionFromEventPosition(touch.clientY);
-    if (this._thumbStyleTopAnimator)
-        this._thumbStyleTopAnimator.stop();
-    this._timer = setInterval(this.onScrollTimer, ScrubbyScrollBar.ScrollInterval);
-    window.addEventListener("touchmove", this.onWindowTouchMove, false);
-    window.addEventListener("touchend", this.onWindowTouchEnd, false);
-    event.stopPropagation();
-    event.preventDefault();
-};
-
-/**
- * @param {?Event} event
- */
-ScrubbyScrollBar.prototype.onWindowTouchMove = function(event) {
-    var touch = event.touches[0];
-    this._setThumbPositionFromEventPosition(touch.clientY);
-    event.stopPropagation();
-    event.preventDefault();
-};
-
-/**
- * @param {?Event} event
- */
-ScrubbyScrollBar.prototype.onWindowTouchEnd = function(event) {
-    this._thumbStyleTopAnimator = new TransitionAnimator();
-    this._thumbStyleTopAnimator.step = this.onThumbStyleTopAnimationStep;
-    this._thumbStyleTopAnimator.setFrom(this.thumb.offsetTop);
-    this._thumbStyleTopAnimator.setTo((this._height - this._thumbHeight) / 2);
-    this._thumbStyleTopAnimator.timingFunction = AnimationTimingFunction.EaseInOut;
-    this._thumbStyleTopAnimator.duration = 100;
-    this._thumbStyleTopAnimator.start();
-
-    window.removeEventListener("touchmove", this.onWindowTouchMove, false);
-    window.removeEventListener("touchend", this.onWindowTouchEnd, false);
-    clearInterval(this._timer);
-};
-
-/**
- * @return {!number} Height of the view in pixels.
- */
-ScrubbyScrollBar.prototype.height = function() {
-    return this._height;
-};
-
-/**
- * @param {!number} height Height of the view in pixels.
- */
-ScrubbyScrollBar.prototype.setHeight = function(height) {
-    if (this._height === height)
-        return;
-    this._height = height;
-    this.element.style.height = this._height + "px";
-    this.thumb.style.top = ((this._height - this._thumbHeight) / 2) + "px";
-    this._thumbPosition = 0;
-};
-
-/**
- * @param {!number} height Height of the scroll bar thumb in pixels.
- */
-ScrubbyScrollBar.prototype.setThumbHeight = function(height) {
-    if (this._thumbHeight === height)
-        return;
-    this._thumbHeight = height;
-    this.thumb.style.height = this._thumbHeight + "px";
-    this.thumb.style.top = ((this._height - this._thumbHeight) / 2) + "px";
-    this._thumbPosition = 0;
-};
-
-/**
- * @param {number} position
- */
-ScrubbyScrollBar.prototype._setThumbPositionFromEventPosition = function(position) {
-    var thumbMin = ScrubbyScrollBar.ThumbMargin;
-    var thumbMax = this._height - this._thumbHeight - ScrubbyScrollBar.ThumbMargin * 2;
-    var y = position - this.element.getBoundingClientRect().top - this.element.clientTop + this.element.scrollTop;
-    var thumbPosition = y - this._thumbHeight / 2;
-    thumbPosition = Math.max(thumbPosition, thumbMin);
-    thumbPosition = Math.min(thumbPosition, thumbMax);
-    this.thumb.style.top = thumbPosition + "px";
-    this._thumbPosition = 1.0 - (thumbPosition - thumbMin) / (thumbMax - thumbMin) * 2;
-};
-
-/**
- * @param {?Event} event
- */
-ScrubbyScrollBar.prototype.onMouseDown = function(event) {
-    this._setThumbPositionFromEventPosition(event.clientY);
-
-    window.addEventListener("mousemove", this.onWindowMouseMove, false);
-    window.addEventListener("mouseup", this.onWindowMouseUp, false);
-    if (this._thumbStyleTopAnimator)
-        this._thumbStyleTopAnimator.stop();
-    this._timer = setInterval(this.onScrollTimer, ScrubbyScrollBar.ScrollInterval);
-    event.stopPropagation();
-    event.preventDefault();
-};
-
-/**
- * @param {?Event} event
- */
-ScrubbyScrollBar.prototype.onWindowMouseMove = function(event) {
-    this._setThumbPositionFromEventPosition(event.clientY);
-};
-
-/**
- * @param {?Event} event
- */
-ScrubbyScrollBar.prototype.onWindowMouseUp = function(event) {
-    this._thumbStyleTopAnimator = new TransitionAnimator();
-    this._thumbStyleTopAnimator.step = this.onThumbStyleTopAnimationStep;
-    this._thumbStyleTopAnimator.setFrom(this.thumb.offsetTop);
-    this._thumbStyleTopAnimator.setTo((this._height - this._thumbHeight) / 2);
-    this._thumbStyleTopAnimator.timingFunction = AnimationTimingFunction.EaseInOut;
-    this._thumbStyleTopAnimator.duration = 100;
-    this._thumbStyleTopAnimator.start();
-    
-    window.removeEventListener("mousemove", this.onWindowMouseMove, false);
-    window.removeEventListener("mouseup", this.onWindowMouseUp, false);
-    clearInterval(this._timer);
-};
-
-/**
- * @param {!Animator} animator
- */
-ScrubbyScrollBar.prototype.onThumbStyleTopAnimationStep = function(animator) {
-    this.thumb.style.top = animator.currentValue + "px";
-};
-
-ScrubbyScrollBar.prototype.onScrollTimer = function() {
-    var scrollAmount = Math.pow(this._thumbPosition, 2) * 10;
-    if (this._thumbPosition > 0)
-        scrollAmount = -scrollAmount;
-    this.scrollView.scrollBy(scrollAmount, false);
-};
-
-/**
- * @constructor
- * @extends ListCell
- * @param {!Array} shortMonthLabels
- */
-function YearListCell(shortMonthLabels) {
-    ListCell.call(this);
-    this.element.classList.add(YearListCell.ClassNameYearListCell);
-    this.element.style.height = YearListCell.Height + "px";
-
-    /**
-     * @type {!Element}
-     * @const
-     */
-    this.label = createElement("div", YearListCell.ClassNameLabel, "----");
-    this.element.appendChild(this.label);
-    this.label.style.height = (YearListCell.Height - YearListCell.BorderBottomWidth) + "px";
-    this.label.style.lineHeight = (YearListCell.Height - YearListCell.BorderBottomWidth) + "px";
-
-    /**
-     * @type {!Array} Array of the 12 month button elements.
-     * @const
-     */
-    this.monthButtons = [];
-    var monthChooserElement = createElement("div", YearListCell.ClassNameMonthChooser);
-    for (var r = 0; r < YearListCell.ButtonRows; ++r) {
-        var buttonsRow = createElement("div", YearListCell.ClassNameMonthButtonsRow);
-        for (var c = 0; c < YearListCell.ButtonColumns; ++c) {
-            var month = c + r * YearListCell.ButtonColumns;
-            var button = createElement("button", YearListCell.ClassNameMonthButton, shortMonthLabels[month]);
-            button.dataset.month = month;
-            buttonsRow.appendChild(button);
-            this.monthButtons.push(button);
-        }
-        monthChooserElement.appendChild(buttonsRow);
-    }
-    this.element.appendChild(monthChooserElement);
-
-    /**
-     * @type {!boolean}
-     * @private
-     */
-    this._selected = false;
-    /**
-     * @type {!number}
-     * @private
-     */
-    this._height = 0;
-}
-
-YearListCell.prototype = Object.create(ListCell.prototype);
-
-YearListCell.Height = hasInaccuratePointingDevice() ? 31 : 25;
-YearListCell.BorderBottomWidth = 1;
-YearListCell.ButtonRows = 3;
-YearListCell.ButtonColumns = 4;
-YearListCell.SelectedHeight = hasInaccuratePointingDevice() ? 127 : 121;
-YearListCell.ClassNameYearListCell = "year-list-cell";
-YearListCell.ClassNameLabel = "label";
-YearListCell.ClassNameMonthChooser = "month-chooser";
-YearListCell.ClassNameMonthButtonsRow = "month-buttons-row";
-YearListCell.ClassNameMonthButton = "month-button";
-YearListCell.ClassNameHighlighted = "highlighted";
-
-YearListCell._recycleBin = [];
-
-/**
- * @return {!Array}
- * @override
- */
-YearListCell.prototype._recycleBin = function() {
-    return YearListCell._recycleBin;
-};
-
-/**
- * @param {!number} row
- */
-YearListCell.prototype.reset = function(row) {
-    this.row = row;
-    this.label.textContent = row + 1;
-    for (var i = 0; i < this.monthButtons.length; ++i) {
-        this.monthButtons[i].classList.remove(YearListCell.ClassNameHighlighted);
-    }
-    this.show();
-};
-
-/**
- * @return {!number} The height in pixels.
- */
-YearListCell.prototype.height = function() {
-    return this._height;
-};
-
-/**
- * @param {!number} height Height in pixels.
- */
-YearListCell.prototype.setHeight = function(height) {
-    if (this._height === height)
-        return;
-    this._height = height;
-    this.element.style.height = this._height + "px";
-};
-
-/**
- * @constructor
- * @extends ListView
- * @param {!Month} minimumMonth
- * @param {!Month} maximumMonth
- */
-function YearListView(minimumMonth, maximumMonth) {
-    ListView.call(this);
-    this.element.classList.add("year-list-view");
-
-    /**
-     * @type {?Month}
-     */
-    this.highlightedMonth = null;
-    /**
-     * @type {!Month}
-     * @const
-     * @protected
-     */
-    this._minimumMonth = minimumMonth;
-    /**
-     * @type {!Month}
-     * @const
-     * @protected
-     */
-    this._maximumMonth = maximumMonth;
-
-    this.scrollView.minimumContentOffset = (this._minimumMonth.year - 1) * YearListCell.Height;
-    this.scrollView.maximumContentOffset = (this._maximumMonth.year - 1) * YearListCell.Height + YearListCell.SelectedHeight;
-    
-    /**
-     * @type {!Object}
-     * @const
-     * @protected
-     */
-    this._runningAnimators = {};
-    /**
-     * @type {!Array}
-     * @const
-     * @protected
-     */
-    this._animatingRows = [];
-    /**
-     * @type {!boolean}
-     * @protected
-     */
-    this._ignoreMouseOutUntillNextMouseOver = false;
-    
-    /**
-     * @type {!ScrubbyScrollBar}
-     * @const
-     */
-    this.scrubbyScrollBar = new ScrubbyScrollBar(this.scrollView);
-    this.scrubbyScrollBar.attachTo(this);
-    
-    this.element.addEventListener("mouseover", this.onMouseOver, false);
-    this.element.addEventListener("mouseout", this.onMouseOut, false);
-    this.element.addEventListener("keydown", this.onKeyDown, false);
-    this.element.addEventListener("touchstart", this.onTouchStart, false);
-}
-
-YearListView.prototype = Object.create(ListView.prototype);
-
-YearListView.Height = YearListCell.SelectedHeight - 1;
-YearListView.EventTypeYearListViewDidHide = "yearListViewDidHide";
-YearListView.EventTypeYearListViewDidSelectMonth = "yearListViewDidSelectMonth";
-
-/**
- * @param {?Event} event
- */
-YearListView.prototype.onTouchStart = function(event) {
-    var touch = event.touches[0];
-    var monthButtonElement = enclosingNodeOrSelfWithClass(touch.target, YearListCell.ClassNameMonthButton);
-    if (!monthButtonElement)
-        return;
-    var cellElement = enclosingNodeOrSelfWithClass(monthButtonElement, YearListCell.ClassNameYearListCell);
-    var cell = cellElement.$view;
-    this.highlightMonth(new Month(cell.row + 1, parseInt(monthButtonElement.dataset.month, 10)));
-};
-
-/**
- * @param {?Event} event
- */
-YearListView.prototype.onMouseOver = function(event) {
-    var monthButtonElement = enclosingNodeOrSelfWithClass(event.target, YearListCell.ClassNameMonthButton);
-    if (!monthButtonElement)
-        return;
-    var cellElement = enclosingNodeOrSelfWithClass(monthButtonElement, YearListCell.ClassNameYearListCell);
-    var cell = cellElement.$view;
-    this.highlightMonth(new Month(cell.row + 1, parseInt(monthButtonElement.dataset.month, 10)));
-    this._ignoreMouseOutUntillNextMouseOver = false;
-};
-
-/**
- * @param {?Event} event
- */
-YearListView.prototype.onMouseOut = function(event) {
-    if (this._ignoreMouseOutUntillNextMouseOver)
-        return;
-    var monthButtonElement = enclosingNodeOrSelfWithClass(event.target, YearListCell.ClassNameMonthButton);
-    if (!monthButtonElement) {
-        this.dehighlightMonth();
-    }
-};
-
-/**
- * @param {!number} width Width in pixels.
- * @override
- */
-YearListView.prototype.setWidth = function(width) {
-    ListView.prototype.setWidth.call(this, width - this.scrubbyScrollBar.element.offsetWidth);
-    this.element.style.width = width + "px";
-};
-
-/**
- * @param {!number} height Height in pixels.
- * @override
- */
-YearListView.prototype.setHeight = function(height) {
-    ListView.prototype.setHeight.call(this, height);
-    this.scrubbyScrollBar.setHeight(height);
-};
-
-/**
- * @enum {number}
- */
-YearListView.RowAnimationDirection = {
-    Opening: 0,
-    Closing: 1
-};
-
-/**
- * @param {!number} row
- * @param {!YearListView.RowAnimationDirection} direction
- */
-YearListView.prototype._animateRow = function(row, direction) {
-    var fromValue = direction === YearListView.RowAnimationDirection.Closing ? YearListCell.SelectedHeight : YearListCell.Height;
-    var oldAnimator = this._runningAnimators[row];
-    if (oldAnimator) {
-        oldAnimator.stop();
-        fromValue = oldAnimator.currentValue;
-    }
-    var cell = this.cellAtRow(row);
-    var animator = new TransitionAnimator();
-    animator.step = this.onCellHeightAnimatorStep;
-    animator.setFrom(fromValue);
-    animator.setTo(direction === YearListView.RowAnimationDirection.Opening ? YearListCell.SelectedHeight : YearListCell.Height);
-    animator.timingFunction = AnimationTimingFunction.EaseInOut;
-    animator.duration = 300;
-    animator.row = row;
-    animator.on(Animator.EventTypeDidAnimationStop, this.onCellHeightAnimatorDidStop);
-    this._runningAnimators[row] = animator;
-    this._animatingRows.push(row);
-    this._animatingRows.sort();
-    animator.start();
-};
-
-/**
- * @param {?Animator} animator
- */
-YearListView.prototype.onCellHeightAnimatorDidStop = function(animator) {
-    delete this._runningAnimators[animator.row];
-    var index = this._animatingRows.indexOf(animator.row);
-    this._animatingRows.splice(index, 1);
-};
-
-/**
- * @param {!Animator} animator
- */
-YearListView.prototype.onCellHeightAnimatorStep = function(animator) {
-    var cell = this.cellAtRow(animator.row);
-    if (cell)
-        cell.setHeight(animator.currentValue);
-    this.updateCells();
-};
-
-/**
- * @param {?Event} event
- */
-YearListView.prototype.onClick = function(event) {
-    var oldSelectedRow = this.selectedRow;
-    ListView.prototype.onClick.call(this, event);
-    var year = this.selectedRow + 1;
-    if (this.selectedRow !== oldSelectedRow) {
-        var month = this.highlightedMonth ? this.highlightedMonth.month : 0;
-        this.dispatchEvent(YearListView.EventTypeYearListViewDidSelectMonth, this, new Month(year, month));
-        this.scrollView.scrollTo(this.selectedRow * YearListCell.Height, true);
-    } else {
-        var monthButton = enclosingNodeOrSelfWithClass(event.target, YearListCell.ClassNameMonthButton);
-        if (!monthButton)
-            return;
-        var month = parseInt(monthButton.dataset.month, 10);
-        this.dispatchEvent(YearListView.EventTypeYearListViewDidSelectMonth, this, new Month(year, month));
-        this.hide();
-    }
-};
-
-/**
- * @param {!number} scrollOffset
- * @return {!number}
- * @override
- */
-YearListView.prototype.rowAtScrollOffset = function(scrollOffset) {
-    var remainingOffset = scrollOffset;
-    var lastAnimatingRow = 0;
-    var rowsWithIrregularHeight = this._animatingRows.slice();
-    if (this.selectedRow > -1 && !this._runningAnimators[this.selectedRow]) {
-        rowsWithIrregularHeight.push(this.selectedRow);
-        rowsWithIrregularHeight.sort();
-    }
-    for (var i = 0; i < rowsWithIrregularHeight.length; ++i) {
-        var row = rowsWithIrregularHeight[i];
-        var animator = this._runningAnimators[row];
-        var rowHeight = animator ? animator.currentValue : YearListCell.SelectedHeight;
-        if (remainingOffset <= (row - lastAnimatingRow) * YearListCell.Height) {
-            return lastAnimatingRow + Math.floor(remainingOffset / YearListCell.Height);
-        }
-        remainingOffset -= (row - lastAnimatingRow) * YearListCell.Height;
-        if (remainingOffset <= (rowHeight - YearListCell.Height))
-            return row;
-        remainingOffset -= rowHeight - YearListCell.Height;
-        lastAnimatingRow = row;
-    }
-    return lastAnimatingRow + Math.floor(remainingOffset / YearListCell.Height);
-};
-
-/**
- * @param {!number} row
- * @return {!number}
- * @override
- */
-YearListView.prototype.scrollOffsetForRow = function(row) {
-    var scrollOffset = row * YearListCell.Height;
-    for (var i = 0; i < this._animatingRows.length; ++i) {
-        var animatingRow = this._animatingRows[i];
-        if (animatingRow >= row)
-            break;
-        var animator = this._runningAnimators[animatingRow];
-        scrollOffset += animator.currentValue - YearListCell.Height;
-    }
-    if (this.selectedRow > -1 && this.selectedRow < row && !this._runningAnimators[this.selectedRow]) {
-        scrollOffset += YearListCell.SelectedHeight - YearListCell.Height;
-    }
-    return scrollOffset;
-};
-
-/**
- * @param {!number} row
- * @return {!YearListCell}
- * @override
- */
-YearListView.prototype.prepareNewCell = function(row) {
-    var cell = YearListCell._recycleBin.pop() || new YearListCell(global.params.shortMonthLabels);
-    cell.reset(row);
-    cell.setSelected(this.selectedRow === row);
-    if (this.highlightedMonth && row === this.highlightedMonth.year - 1) {
-        cell.monthButtons[this.highlightedMonth.month].classList.add(YearListCell.ClassNameHighlighted);
-    }
-    for (var i = 0; i < cell.monthButtons.length; ++i) {
-        var month = new Month(row + 1, i);
-        cell.monthButtons[i].disabled = this._minimumMonth > month || this._maximumMonth < month;
-    }
-    var animator = this._runningAnimators[row];
-    if (animator)
-        cell.setHeight(animator.currentValue);
-    else if (row === this.selectedRow)
-        cell.setHeight(YearListCell.SelectedHeight);
-    else
-        cell.setHeight(YearListCell.Height);
-    return cell;
-};
-
-/**
- * @override
- */
-YearListView.prototype.updateCells = function() {
-    var firstVisibleRow = this.firstVisibleRow();
-    var lastVisibleRow = this.lastVisibleRow();
-    console.assert(firstVisibleRow <= lastVisibleRow);
-    for (var c in this._cells) {
-        var cell = this._cells[c];
-        if (cell.row < firstVisibleRow || cell.row > lastVisibleRow)
-            this.throwAwayCell(cell);
-    }
-    for (var i = firstVisibleRow; i <= lastVisibleRow; ++i) {
-        var cell = this._cells[i];
-        if (cell)
-            cell.setPosition(this.scrollView.contentPositionForContentOffset(this.scrollOffsetForRow(cell.row)));
-        else
-            this.addCellIfNecessary(i);
-    }
-    this.setNeedsUpdateCells(false);
-};
-
-/**
- * @override
- */
-YearListView.prototype.deselect = function() {
-    if (this.selectedRow === ListView.NoSelection)
-        return;
-    var selectedCell = this._cells[this.selectedRow];
-    if (selectedCell)
-        selectedCell.setSelected(false);
-    this._animateRow(this.selectedRow, YearListView.RowAnimationDirection.Closing);
-    this.selectedRow = ListView.NoSelection;
-    this.setNeedsUpdateCells(true);
-};
-
-YearListView.prototype.deselectWithoutAnimating = function() {
-    if (this.selectedRow === ListView.NoSelection)
-        return;
-    var selectedCell = this._cells[this.selectedRow];
-    if (selectedCell) {
-        selectedCell.setSelected(false);
-        selectedCell.setHeight(YearListCell.Height);
-    }
-    this.selectedRow = ListView.NoSelection;
-    this.setNeedsUpdateCells(true);
-};
-
-/**
- * @param {!number} row
- * @override
- */
-YearListView.prototype.select = function(row) {
-    if (this.selectedRow === row)
-        return;
-    this.deselect();
-    if (row === ListView.NoSelection)
-        return;
-    this.selectedRow = row;
-    if (this.selectedRow !== ListView.NoSelection) {
-        var selectedCell = this._cells[this.selectedRow];
-        this._animateRow(this.selectedRow, YearListView.RowAnimationDirection.Opening);
-        if (selectedCell)
-            selectedCell.setSelected(true);
-        var month = this.highlightedMonth ? this.highlightedMonth.month : 0;
-        this.highlightMonth(new Month(this.selectedRow + 1, month));
-    }
-    this.setNeedsUpdateCells(true);
-};
-
-/**
- * @param {!number} row
- */
-YearListView.prototype.selectWithoutAnimating = function(row) {
-    if (this.selectedRow === row)
-        return;
-    this.deselectWithoutAnimating();
-    if (row === ListView.NoSelection)
-        return;
-    this.selectedRow = row;
-    if (this.selectedRow !== ListView.NoSelection) {
-        var selectedCell = this._cells[this.selectedRow];
-        if (selectedCell) {
-            selectedCell.setSelected(true);
-            selectedCell.setHeight(YearListCell.SelectedHeight);
-        }
-        var month = this.highlightedMonth ? this.highlightedMonth.month : 0;
-        this.highlightMonth(new Month(this.selectedRow + 1, month));
-    }
-    this.setNeedsUpdateCells(true);
-};
-
-/**
- * @param {!Month} month
- * @return {?HTMLButtonElement}
- */
-YearListView.prototype.buttonForMonth = function(month) {
-    if (!month)
-        return null;
-    var row = month.year - 1;
-    var cell = this.cellAtRow(row);
-    if (!cell)
-        return null;
-    return cell.monthButtons[month.month];
-};
-
-YearListView.prototype.dehighlightMonth = function() {
-    if (!this.highlightedMonth)
-        return;
-    var monthButton = this.buttonForMonth(this.highlightedMonth);
-    if (monthButton) {
-        monthButton.classList.remove(YearListCell.ClassNameHighlighted);
-    }
-    this.highlightedMonth = null;
-};
-
-/**
- * @param {!Month} month
- */
-YearListView.prototype.highlightMonth = function(month) {
-    if (this.highlightedMonth && this.highlightedMonth.equals(month))
-        return;
-    this.dehighlightMonth();
-    this.highlightedMonth = month;
-    if (!this.highlightedMonth)
-        return;
-    var monthButton = this.buttonForMonth(this.highlightedMonth);
-    if (monthButton) {
-        monthButton.classList.add(YearListCell.ClassNameHighlighted);
-    }
-};
-
-/**
- * @param {!Month} month
- */
-YearListView.prototype.show = function(month) {
-    this._ignoreMouseOutUntillNextMouseOver = true;
-    
-    this.scrollToRow(month.year - 1, false);
-    this.selectWithoutAnimating(month.year - 1);
-    this.highlightMonth(month);
-};
-
-YearListView.prototype.hide = function() {
-    this.dispatchEvent(YearListView.EventTypeYearListViewDidHide, this);
-};
-
-/**
- * @param {!Month} month
- */
-YearListView.prototype._moveHighlightTo = function(month) {
-    this.highlightMonth(month);
-    this.select(this.highlightedMonth.year - 1);
-
-    this.dispatchEvent(YearListView.EventTypeYearListViewDidSelectMonth, this, month);
-    this.scrollView.scrollTo(this.selectedRow * YearListCell.Height, true);
-    return true;
-};
-
-/**
- * @param {?Event} event
- */
-YearListView.prototype.onKeyDown = function(event) {
-    var key = event.keyIdentifier;
-    var eventHandled = false;
-    if (key == "U+0054") // 't' key.
-        eventHandled = this._moveHighlightTo(Month.createFromToday());
-    else if (this.highlightedMonth) {
-        if (global.params.isLocaleRTL ? key == "Right" : key == "Left")
-            eventHandled = this._moveHighlightTo(this.highlightedMonth.previous());
-        else if (key == "Up")
-            eventHandled = this._moveHighlightTo(this.highlightedMonth.previous(YearListCell.ButtonColumns));
-        else if (global.params.isLocaleRTL ? key == "Left" : key == "Right")
-            eventHandled = this._moveHighlightTo(this.highlightedMonth.next());
-        else if (key == "Down")
-            eventHandled = this._moveHighlightTo(this.highlightedMonth.next(YearListCell.ButtonColumns));
-        else if (key == "PageUp")
-            eventHandled = this._moveHighlightTo(this.highlightedMonth.previous(MonthsPerYear));
-        else if (key == "PageDown")
-            eventHandled = this._moveHighlightTo(this.highlightedMonth.next(MonthsPerYear));
-        else if (key == "Enter") {
-            this.dispatchEvent(YearListView.EventTypeYearListViewDidSelectMonth, this, this.highlightedMonth);
-            this.hide();
-            eventHandled = true;
-        }
-    } else if (key == "Up") {
-        this.scrollView.scrollBy(-YearListCell.Height, true);
-        eventHandled = true;
-    } else if (key == "Down") {
-        this.scrollView.scrollBy(YearListCell.Height, true);
-        eventHandled = true;
-    } else if (key == "PageUp") {
-        this.scrollView.scrollBy(-this.scrollView.height(), true);
-        eventHandled = true;
-    } else if (key == "PageDown") {
-        this.scrollView.scrollBy(this.scrollView.height(), true);
-        eventHandled = true;
-    }
-
-    if (eventHandled) {
-        event.stopPropagation();
-        event.preventDefault();
-    }
-};
-
-/**
- * @constructor
- * @extends View
- * @param {!Month} minimumMonth
- * @param {!Month} maximumMonth
- */
-function MonthPopupView(minimumMonth, maximumMonth) {
-    View.call(this, createElement("div", MonthPopupView.ClassNameMonthPopupView));
-
-    /**
-     * @type {!YearListView}
-     * @const
-     */
-    this.yearListView = new YearListView(minimumMonth, maximumMonth);
-    this.yearListView.attachTo(this);
-
-    /**
-     * @type {!boolean}
-     */
-    this.isVisible = false;
-
-    this.element.addEventListener("click", this.onClick, false);
-}
-
-MonthPopupView.prototype = Object.create(View.prototype);
-
-MonthPopupView.ClassNameMonthPopupView = "month-popup-view";
-
-MonthPopupView.prototype.show = function(initialMonth, calendarTableRect) {
-    this.isVisible = true;
-    document.body.appendChild(this.element);
-    this.yearListView.setWidth(calendarTableRect.width - 2);
-    this.yearListView.setHeight(YearListView.Height);
-    if (global.params.isLocaleRTL)
-        this.yearListView.element.style.right = calendarTableRect.x + "px";
-    else
-        this.yearListView.element.style.left = calendarTableRect.x + "px";
-    this.yearListView.element.style.top = calendarTableRect.y + "px";
-    this.yearListView.show(initialMonth);
-    this.yearListView.element.focus();
-};
-
-MonthPopupView.prototype.hide = function() {
-    if (!this.isVisible)
-        return;
-    this.isVisible = false;
-    this.element.parentNode.removeChild(this.element);
-    this.yearListView.hide();
-};
-
-/**
- * @param {?Event} event
- */
-MonthPopupView.prototype.onClick = function(event) {
-    if (event.target !== this.element)
-        return;
-    this.hide();
-};
-
-/**
- * @constructor
- * @extends View
- * @param {!number} maxWidth Maximum width in pixels.
- */
-function MonthPopupButton(maxWidth) {
-    View.call(this, createElement("button", MonthPopupButton.ClassNameMonthPopupButton));
-
-    /**
-     * @type {!Element}
-     * @const
-     */
-    this.labelElement = createElement("span", MonthPopupButton.ClassNameMonthPopupButtonLabel, "-----");
-    this.element.appendChild(this.labelElement);
-
-    /**
-     * @type {!Element}
-     * @const
-     */
-    this.disclosureTriangleIcon = createElement("span", MonthPopupButton.ClassNameDisclosureTriangle);
-    this.disclosureTriangleIcon.innerHTML = "<svg width='7' height='5'><polygon points='0,1 7,1 3.5,5' style='fill:#000000;' /></svg>";
-    this.element.appendChild(this.disclosureTriangleIcon);
-
-    /**
-     * @type {!boolean}
-     * @protected
-     */
-    this._useShortMonth = this._shouldUseShortMonth(maxWidth);
-    this.element.style.maxWidth = maxWidth + "px";
-
-    this.element.addEventListener("click", this.onClick, false);
-}
-
-MonthPopupButton.prototype = Object.create(View.prototype);
-
-MonthPopupButton.ClassNameMonthPopupButton = "month-popup-button";
-MonthPopupButton.ClassNameMonthPopupButtonLabel = "month-popup-button-label";
-MonthPopupButton.ClassNameDisclosureTriangle = "disclosure-triangle";
-MonthPopupButton.EventTypeButtonClick = "buttonClick";
-
-/**
- * @param {!number} maxWidth Maximum available width in pixels.
- * @return {!boolean}
- */
-MonthPopupButton.prototype._shouldUseShortMonth = function(maxWidth) {
-    document.body.appendChild(this.element);
-    var month = Month.Maximum;
-    for (var i = 0; i < MonthsPerYear; ++i) {
-        this.labelElement.textContent = month.toLocaleString();
-        if (this.element.offsetWidth > maxWidth)
-            return true;
-        month = month.previous();
-    }
-    document.body.removeChild(this.element);
-    return false;
-};
-
-/**
- * @param {!Month} month
- */
-MonthPopupButton.prototype.setCurrentMonth = function(month) {
-    this.labelElement.textContent = this._useShortMonth ? month.toShortLocaleString() : month.toLocaleString();
-};
-
-/**
- * @param {?Event} event
- */
-MonthPopupButton.prototype.onClick = function(event) {
-    this.dispatchEvent(MonthPopupButton.EventTypeButtonClick, this);
-};
-
-/**
- * @constructor
- * @extends View
- */
-function CalendarNavigationButton() {
-    View.call(this, createElement("button", CalendarNavigationButton.ClassNameCalendarNavigationButton));
-    /**
-     * @type {number} Threshold for starting repeating clicks in milliseconds.
-     */
-    this.repeatingClicksStartingThreshold = CalendarNavigationButton.DefaultRepeatingClicksStartingThreshold;
-    /**
-     * @type {number} Interval between reapeating clicks in milliseconds.
-     */
-    this.reapeatingClicksInterval = CalendarNavigationButton.DefaultRepeatingClicksInterval;
-    /**
-     * @type {?number} The ID for the timeout that triggers the repeating clicks.
-     */
-    this._timer = null;
-    this.element.addEventListener("click", this.onClick, false);
-    this.element.addEventListener("mousedown", this.onMouseDown, false);
-    this.element.addEventListener("touchstart", this.onTouchStart, false);
-};
-
-CalendarNavigationButton.prototype = Object.create(View.prototype);
-
-CalendarNavigationButton.DefaultRepeatingClicksStartingThreshold = 600;
-CalendarNavigationButton.DefaultRepeatingClicksInterval = 300;
-CalendarNavigationButton.LeftMargin = 4;
-CalendarNavigationButton.Width = 24;
-CalendarNavigationButton.ClassNameCalendarNavigationButton = "calendar-navigation-button";
-CalendarNavigationButton.EventTypeButtonClick = "buttonClick";
-CalendarNavigationButton.EventTypeRepeatingButtonClick = "repeatingButtonClick";
-
-/**
- * @param {!boolean} disabled
- */
-CalendarNavigationButton.prototype.setDisabled = function(disabled) {
-    this.element.disabled = disabled;
-};
-
-/**
- * @param {?Event} event
- */
-CalendarNavigationButton.prototype.onClick = function(event) {
-    this.dispatchEvent(CalendarNavigationButton.EventTypeButtonClick, this);
-};
-
-/**
- * @param {?Event} event
- */
-CalendarNavigationButton.prototype.onTouchStart = function(event) {
-    if (this._timer !== null)
-        return;
-    this._timer = setTimeout(this.onRepeatingClick, this.repeatingClicksStartingThreshold);
-    window.addEventListener("touchend", this.onWindowTouchEnd, false);
-};
-
-/**
- * @param {?Event} event
- */
-CalendarNavigationButton.prototype.onWindowTouchEnd = function(event) {
-    if (this._timer === null)
-        return;
-    clearTimeout(this._timer);
-    this._timer = null;
-    window.removeEventListener("touchend", this.onWindowMouseUp, false);
-};
-
-/**
- * @param {?Event} event
- */
-CalendarNavigationButton.prototype.onMouseDown = function(event) {
-    if (this._timer !== null)
-        return;
-    this._timer = setTimeout(this.onRepeatingClick, this.repeatingClicksStartingThreshold);
-    window.addEventListener("mouseup", this.onWindowMouseUp, false);
-};
-
-/**
- * @param {?Event} event
- */
-CalendarNavigationButton.prototype.onWindowMouseUp = function(event) {
-    if (this._timer === null)
-        return;
-    clearTimeout(this._timer);
-    this._timer = null;
-    window.removeEventListener("mouseup", this.onWindowMouseUp, false);
-};
-
-/**
- * @param {?Event} event
- */
-CalendarNavigationButton.prototype.onRepeatingClick = function(event) {
-    this.dispatchEvent(CalendarNavigationButton.EventTypeRepeatingButtonClick, this);
-    this._timer = setTimeout(this.onRepeatingClick, this.reapeatingClicksInterval);
-};
-
-/**
- * @constructor
- * @extends View
- * @param {!CalendarPicker} calendarPicker
- */
-function CalendarHeaderView(calendarPicker) {
-    View.call(this, createElement("div", CalendarHeaderView.ClassNameCalendarHeaderView));
-    this.calendarPicker = calendarPicker;
-    this.calendarPicker.on(CalendarPicker.EventTypeCurrentMonthChanged, this.onCurrentMonthChanged);
-    
-    var titleElement = createElement("div", CalendarHeaderView.ClassNameCalendarTitle);
-    this.element.appendChild(titleElement);
-
-    /**
-     * @type {!MonthPopupButton}
-     */
-    this.monthPopupButton = new MonthPopupButton(this.calendarPicker.calendarTableView.width() - CalendarTableView.BorderWidth * 2 - CalendarNavigationButton.Width * 3 - CalendarNavigationButton.LeftMargin * 2);
-    this.monthPopupButton.attachTo(titleElement);
-
-    /**
-     * @type {!CalendarNavigationButton}
-     * @const
-     */
-    this._previousMonthButton = new CalendarNavigationButton();
-    this._previousMonthButton.attachTo(this);
-    this._previousMonthButton.on(CalendarNavigationButton.EventTypeButtonClick, this.onNavigationButtonClick);
-    this._previousMonthButton.on(CalendarNavigationButton.EventTypeRepeatingButtonClick, this.onNavigationButtonClick);
-
-    /**
-     * @type {!CalendarNavigationButton}
-     * @const
-     */
-    this._todayButton = new CalendarNavigationButton();
-    this._todayButton.attachTo(this);
-    this._todayButton.on(CalendarNavigationButton.EventTypeButtonClick, this.onNavigationButtonClick);
-    this._todayButton.element.classList.add(CalendarHeaderView.ClassNameTodayButton);
-    var monthContainingToday = Month.createFromToday();
-    this._todayButton.setDisabled(monthContainingToday < this.calendarPicker.minimumMonth || monthContainingToday > this.calendarPicker.maximumMonth);
-
-    /**
-     * @type {!CalendarNavigationButton}
-     * @const
-     */
-    this._nextMonthButton = new CalendarNavigationButton();
-    this._nextMonthButton.attachTo(this);
-    this._nextMonthButton.on(CalendarNavigationButton.EventTypeButtonClick, this.onNavigationButtonClick);
-    this._nextMonthButton.on(CalendarNavigationButton.EventTypeRepeatingButtonClick, this.onNavigationButtonClick);
-
-    if (global.params.isLocaleRTL) {
-        this._nextMonthButton.element.innerHTML = CalendarHeaderView._BackwardTriangle;
-        this._previousMonthButton.element.innerHTML = CalendarHeaderView._ForwardTriangle;
-    } else {
-        this._nextMonthButton.element.innerHTML = CalendarHeaderView._ForwardTriangle;
-        this._previousMonthButton.element.innerHTML = CalendarHeaderView._BackwardTriangle;
-    }
-}
-
-CalendarHeaderView.prototype = Object.create(View.prototype);
-
-CalendarHeaderView.Height = 24;
-CalendarHeaderView.BottomMargin = 10;
-CalendarHeaderView._ForwardTriangle = "<svg width='4' height='7'><polygon points='0,7 0,0, 4,3.5' style='fill:#6e6e6e;' /></svg>";
-CalendarHeaderView._BackwardTriangle = "<svg width='4' height='7'><polygon points='0,3.5 4,7 4,0' style='fill:#6e6e6e;' /></svg>";
-CalendarHeaderView.ClassNameCalendarHeaderView = "calendar-header-view";
-CalendarHeaderView.ClassNameCalendarTitle = "calendar-title";
-CalendarHeaderView.ClassNameTodayButton = "today-button";
-
-CalendarHeaderView.prototype.onCurrentMonthChanged = function() {
-    this.monthPopupButton.setCurrentMonth(this.calendarPicker.currentMonth());
-    this._previousMonthButton.setDisabled(this.disabled || this.calendarPicker.currentMonth() <= this.calendarPicker.minimumMonth);
-    this._nextMonthButton.setDisabled(this.disabled || this.calendarPicker.currentMonth() >= this.calendarPicker.maximumMonth);
-};
-
-CalendarHeaderView.prototype.onNavigationButtonClick = function(sender) {
-    if (sender === this._previousMonthButton)
-        this.calendarPicker.setCurrentMonth(this.calendarPicker.currentMonth().previous(), CalendarPicker.NavigationBehavior.WithAnimation);
-    else if (sender === this._nextMonthButton)
-        this.calendarPicker.setCurrentMonth(this.calendarPicker.currentMonth().next(), CalendarPicker.NavigationBehavior.WithAnimation);
-    else
-        this.calendarPicker.selectRangeContainingDay(Day.createFromToday());
-};
-
-/**
- * @param {!boolean} disabled
- */
-CalendarHeaderView.prototype.setDisabled = function(disabled) {
-    this.disabled = disabled;
-    this.monthPopupButton.element.disabled = this.disabled;
-    this._previousMonthButton.setDisabled(this.disabled || this.calendarPicker.currentMonth() <= this.calendarPicker.minimumMonth);
-    this._nextMonthButton.setDisabled(this.disabled || this.calendarPicker.currentMonth() >= this.calendarPicker.maximumMonth);
-    var monthContainingToday = Month.createFromToday();
-    this._todayButton.setDisabled(this.disabled || monthContainingToday < this.calendarPicker.minimumMonth || monthContainingToday > this.calendarPicker.maximumMonth);
-};
-
-/**
- * @constructor
- * @extends ListCell
- */
-function DayCell() {
-    ListCell.call(this);
-    this.element.classList.add(DayCell.ClassNameDayCell);
-    this.element.style.width = DayCell.Width + "px";
-    this.element.style.height = DayCell.Height + "px";
-    this.element.style.lineHeight = (DayCell.Height - DayCell.PaddingSize * 2) + "px";
-    /**
-     * @type {?Day}
-     */
-    this.day = null;
-};
-
-DayCell.prototype = Object.create(ListCell.prototype);
-
-DayCell.Width = 34;
-DayCell.Height = hasInaccuratePointingDevice() ? 34 : 20;
-DayCell.PaddingSize = 1;
-DayCell.ClassNameDayCell = "day-cell";
-DayCell.ClassNameHighlighted = "highlighted";
-DayCell.ClassNameDisabled = "disabled";
-DayCell.ClassNameCurrentMonth = "current-month";
-DayCell.ClassNameToday = "today";
-
-DayCell._recycleBin = [];
-
-DayCell.recycleOrCreate = function() {
-    return DayCell._recycleBin.pop() || new DayCell();
-};
-
-/**
- * @return {!Array}
- * @override
- */
-DayCell.prototype._recycleBin = function() {
-    return DayCell._recycleBin;
-};
-
-/**
- * @override
- */
-DayCell.prototype.throwAway = function() {
-    ListCell.prototype.throwAway.call(this);
-    this.day = null;
-};
-
-/**
- * @param {!boolean} highlighted
- */
-DayCell.prototype.setHighlighted = function(highlighted) {
-    if (highlighted)
-        this.element.classList.add(DayCell.ClassNameHighlighted);
-    else
-        this.element.classList.remove(DayCell.ClassNameHighlighted);
-};
-
-/**
- * @param {!boolean} disabled
- */
-DayCell.prototype.setDisabled = function(disabled) {
-    if (disabled)
-        this.element.classList.add(DayCell.ClassNameDisabled);
-    else
-        this.element.classList.remove(DayCell.ClassNameDisabled);
-};
-
-/**
- * @param {!boolean} selected
- */
-DayCell.prototype.setIsInCurrentMonth = function(selected) {
-    if (selected)
-        this.element.classList.add(DayCell.ClassNameCurrentMonth);
-    else
-        this.element.classList.remove(DayCell.ClassNameCurrentMonth);
-};
-
-/**
- * @param {!boolean} selected
- */
-DayCell.prototype.setIsToday = function(selected) {
-    if (selected)
-        this.element.classList.add(DayCell.ClassNameToday);
-    else
-        this.element.classList.remove(DayCell.ClassNameToday);
-};
-
-/**
- * @param {!Day} day
- */
-DayCell.prototype.reset = function(day) {
-    this.day = day;
-    this.element.textContent = localizeNumber(this.day.date.toString());
-    this.show();
-};
-
-/**
- * @constructor
- * @extends ListCell
- */
-function WeekNumberCell() {
-    ListCell.call(this);
-    this.element.classList.add(WeekNumberCell.ClassNameWeekNumberCell);
-    this.element.style.width = (WeekNumberCell.Width - WeekNumberCell.SeparatorWidth) + "px";
-    this.element.style.height = WeekNumberCell.Height + "px";
-    this.element.style.lineHeight = (WeekNumberCell.Height - WeekNumberCell.PaddingSize * 2) + "px";
-    /**
-     * @type {?Week}
-     */
-    this.week = null;
-};
-
-WeekNumberCell.prototype = Object.create(ListCell.prototype);
-
-WeekNumberCell.Width = 48;
-WeekNumberCell.Height = DayCell.Height;
-WeekNumberCell.SeparatorWidth = 1;
-WeekNumberCell.PaddingSize = 1;
-WeekNumberCell.ClassNameWeekNumberCell = "week-number-cell";
-WeekNumberCell.ClassNameHighlighted = "highlighted";
-WeekNumberCell.ClassNameDisabled = "disabled";
-
-WeekNumberCell._recycleBin = [];
-
-/**
- * @return {!Array}
- * @override
- */
-WeekNumberCell.prototype._recycleBin = function() {
-    return WeekNumberCell._recycleBin;
-};
-
-/**
- * @return {!WeekNumberCell}
- */
-WeekNumberCell.recycleOrCreate = function() {
-    return WeekNumberCell._recycleBin.pop() || new WeekNumberCell();
-};
-
-/**
- * @param {!Week} week
- */
-WeekNumberCell.prototype.reset = function(week) {
-    this.week = week;
-    this.element.textContent = localizeNumber(this.week.week.toString());
-    this.show();
-};
-
-/**
- * @override
- */
-WeekNumberCell.prototype.throwAway = function() {
-    ListCell.prototype.throwAway.call(this);
-    this.week = null;
-};
-
-WeekNumberCell.prototype.setHighlighted = function(highlighted) {
-    if (highlighted)
-        this.element.classList.add(WeekNumberCell.ClassNameHighlighted);
-    else
-        this.element.classList.remove(WeekNumberCell.ClassNameHighlighted);
-};
-
-WeekNumberCell.prototype.setDisabled = function(disabled) {
-    if (disabled)
-        this.element.classList.add(WeekNumberCell.ClassNameDisabled);
-    else
-        this.element.classList.remove(WeekNumberCell.ClassNameDisabled);
-};
-
-/**
- * @constructor
- * @extends View
- * @param {!boolean} hasWeekNumberColumn
- */
-function CalendarTableHeaderView(hasWeekNumberColumn) {
-    View.call(this, createElement("div", "calendar-table-header-view"));
-    if (hasWeekNumberColumn) {
-        var weekNumberLabelElement = createElement("div", "week-number-label", global.params.weekLabel);
-        weekNumberLabelElement.style.width = WeekNumberCell.Width + "px";
-        this.element.appendChild(weekNumberLabelElement);
-    }
-    for (var i = 0; i < DaysPerWeek; ++i) {
-        var weekDayNumber = (global.params.weekStartDay + i) % DaysPerWeek;
-        var labelElement = createElement("div", "week-day-label", global.params.dayLabels[weekDayNumber]);
-        labelElement.style.width = DayCell.Width + "px";
-        this.element.appendChild(labelElement);
-        if (getLanguage() === "ja") {
-            if (weekDayNumber === 0)
-                labelElement.style.color = "red";
-            else if (weekDayNumber === 6)
-                labelElement.style.color = "blue";
-        }
-    }
-}
-
-CalendarTableHeaderView.prototype = Object.create(View.prototype);
-
-CalendarTableHeaderView.Height = 25;
-
-/**
- * @constructor
- * @extends ListCell
- */
-function CalendarRowCell() {
-    ListCell.call(this);
-    this.element.classList.add(CalendarRowCell.ClassNameCalendarRowCell);
-    this.element.style.height = CalendarRowCell.Height + "px";
-
-    /**
-     * @type {!Array}
-     * @protected
-     */
-    this._dayCells = [];
-    /**
-     * @type {!number}
-     */
-    this.row = 0;
-    /**
-     * @type {?CalendarTableView}
-     */
-    this.calendarTableView = null;
-}
-
-CalendarRowCell.prototype = Object.create(ListCell.prototype);
-
-CalendarRowCell.Height = DayCell.Height;
-CalendarRowCell.ClassNameCalendarRowCell = "calendar-row-cell";
-
-CalendarRowCell._recycleBin = [];
-
-/**
- * @return {!Array}
- * @override
- */
-CalendarRowCell.prototype._recycleBin = function() {
-    return CalendarRowCell._recycleBin;
-};
-
-/**
- * @param {!number} row
- * @param {!CalendarTableView} calendarTableView
- */
-CalendarRowCell.prototype.reset = function(row, calendarTableView) {
-    this.row = row;
-    this.calendarTableView = calendarTableView;
-    if (this.calendarTableView.hasWeekNumberColumn) {
-        var middleDay = this.calendarTableView.dayAtColumnAndRow(3, row);
-        var week = Week.createFromDay(middleDay);
-        this.weekNumberCell = this.calendarTableView.prepareNewWeekNumberCell(week);
-        this.weekNumberCell.attachTo(this);
-    }
-    var day = calendarTableView.dayAtColumnAndRow(0, row);
-    for (var i = 0; i < DaysPerWeek; ++i) {
-        var dayCell = this.calendarTableView.prepareNewDayCell(day);
-        dayCell.attachTo(this);
-        this._dayCells.push(dayCell);
-        day = day.next();
-    }
-    this.show();
-};
-
-/**
- * @override
- */
-CalendarRowCell.prototype.throwAway = function() {
-    ListCell.prototype.throwAway.call(this);
-    if (this.weekNumberCell)
-        this.calendarTableView.throwAwayWeekNumberCell(this.weekNumberCell);
-    this._dayCells.forEach(this.calendarTableView.throwAwayDayCell, this.calendarTableView);
-    this._dayCells.length = 0;
-};
-
-/**
- * @constructor
- * @extends ListView
- * @param {!CalendarPicker} calendarPicker
- */
-function CalendarTableView(calendarPicker) {
-    ListView.call(this);
-    this.element.classList.add(CalendarTableView.ClassNameCalendarTableView);
-    this.element.tabIndex = 0;
-
-    /**
-     * @type {!boolean}
-     * @const
-     */
-    this.hasWeekNumberColumn = calendarPicker.type === "week";
-    /**
-     * @type {!CalendarPicker}
-     * @const
-     */
-    this.calendarPicker = calendarPicker;
-    /**
-     * @type {!Object}
-     * @const
-     */
-    this._dayCells = {};
-    var headerView = new CalendarTableHeaderView(this.hasWeekNumberColumn);
-    headerView.attachTo(this, this.scrollView);
-
-    if (this.hasWeekNumberColumn) {
-        this.setWidth(DayCell.Width * DaysPerWeek + WeekNumberCell.Width);
-        /**
-         * @type {?Array}
-         * @const
-         */
-        this._weekNumberCells = [];
-    } else {
-        this.setWidth(DayCell.Width * DaysPerWeek);
-    }
-    
-    /**
-     * @type {!boolean}
-     * @protected
-     */
-    this._ignoreMouseOutUntillNextMouseOver = false;
-
-    this.element.addEventListener("click", this.onClick, false);
-    this.element.addEventListener("mouseover", this.onMouseOver, false);
-    this.element.addEventListener("mouseout", this.onMouseOut, false);
-
-    // You shouldn't be able to use the mouse wheel to scroll.
-    this.scrollView.element.removeEventListener("mousewheel", this.scrollView.onMouseWheel, false);
-    // You shouldn't be able to do gesture scroll.
-    this.scrollView.element.removeEventListener("touchstart", this.scrollView.onTouchStart, false);
-}
-
-CalendarTableView.prototype = Object.create(ListView.prototype);
-
-CalendarTableView.BorderWidth = 1;
-CalendarTableView.ClassNameCalendarTableView = "calendar-table-view";
-
-/**
- * @param {!number} scrollOffset
- * @return {!number}
- */
-CalendarTableView.prototype.rowAtScrollOffset = function(scrollOffset) {
-    return Math.floor(scrollOffset / CalendarRowCell.Height);
-};
-
-/**
- * @param {!number} row
- * @return {!number}
- */
-CalendarTableView.prototype.scrollOffsetForRow = function(row) {
-    return row * CalendarRowCell.Height;
-};
-
-/**
- * @param {?Event} event
- */
-CalendarTableView.prototype.onClick = function(event) {
-    if (this.hasWeekNumberColumn) {
-        var weekNumberCellElement = enclosingNodeOrSelfWithClass(event.target, WeekNumberCell.ClassNameWeekNumberCell);
-        if (weekNumberCellElement) {
-            var weekNumberCell = weekNumberCellElement.$view;
-            this.calendarPicker.selectRangeContainingDay(weekNumberCell.week.firstDay());
-            return;
-        }
-    }
-    var dayCellElement = enclosingNodeOrSelfWithClass(event.target, DayCell.ClassNameDayCell);
-    if (!dayCellElement)
-        return;
-    var dayCell = dayCellElement.$view;
-    this.calendarPicker.selectRangeContainingDay(dayCell.day);
-};
-
-/**
- * @param {?Event} event
- */
-CalendarTableView.prototype.onMouseOver = function(event) {
-    if (this.hasWeekNumberColumn) {
-        var weekNumberCellElement = enclosingNodeOrSelfWithClass(event.target, WeekNumberCell.ClassNameWeekNumberCell);
-        if (weekNumberCellElement) {
-            var weekNumberCell = weekNumberCellElement.$view;
-            this.calendarPicker.highlightRangeContainingDay(weekNumberCell.week.firstDay());
-            this._ignoreMouseOutUntillNextMouseOver = false;
-            return;
-        }
-    }
-    var dayCellElement = enclosingNodeOrSelfWithClass(event.target, DayCell.ClassNameDayCell);
-    if (!dayCellElement)
-        return;
-    var dayCell = dayCellElement.$view;
-    this.calendarPicker.highlightRangeContainingDay(dayCell.day);
-    this._ignoreMouseOutUntillNextMouseOver = false;
-};
-
-/**
- * @param {?Event} event
- */
-CalendarTableView.prototype.onMouseOut = function(event) {
-    if (this._ignoreMouseOutUntillNextMouseOver)
-        return;
-    var dayCellElement = enclosingNodeOrSelfWithClass(event.target, DayCell.ClassNameDayCell);
-    if (!dayCellElement) {
-        this.calendarPicker.highlightRangeContainingDay(null);
-    }
-};
-
-/**
- * @param {!number} row
- * @return {!CalendarRowCell}
- */
-CalendarTableView.prototype.prepareNewCell = function(row) {
-    var cell = CalendarRowCell._recycleBin.pop() || new CalendarRowCell();
-    cell.reset(row, this);
-    return cell;
-};
-
-/**
- * @return {!number} Height in pixels.
- */
-CalendarTableView.prototype.height = function() {
-    return this.scrollView.height() + CalendarTableHeaderView.Height + CalendarTableView.BorderWidth * 2;
-};
-
-/**
- * @param {!number} height Height in pixels.
- */
-CalendarTableView.prototype.setHeight = function(height) {
-    this.scrollView.setHeight(height - CalendarTableHeaderView.Height - CalendarTableView.BorderWidth * 2);
-};
-
-/**
- * @param {!Month} month
- * @param {!boolean} animate
- */
-CalendarTableView.prototype.scrollToMonth = function(month, animate) {
-    var rowForFirstDayInMonth = this.columnAndRowForDay(month.firstDay()).row;
-    this.scrollView.scrollTo(this.scrollOffsetForRow(rowForFirstDayInMonth), animate);
-};
-
-/**
- * @param {!number} column
- * @param {!number} row
- * @return {!Day}
- */
-CalendarTableView.prototype.dayAtColumnAndRow = function(column, row) {
-    var daysSinceMinimum = row * DaysPerWeek + column + global.params.weekStartDay - CalendarTableView._MinimumDayWeekDay;
-    return Day.createFromValue(daysSinceMinimum * MillisecondsPerDay + CalendarTableView._MinimumDayValue);
-};
-
-CalendarTableView._MinimumDayValue = Day.Minimum.valueOf();
-CalendarTableView._MinimumDayWeekDay = Day.Minimum.weekDay();
-
-/**
- * @param {!Day} day
- * @return {!Object} Object with properties column and row.
- */
-CalendarTableView.prototype.columnAndRowForDay = function(day) {
-    var daysSinceMinimum = (day.valueOf() - CalendarTableView._MinimumDayValue) / MillisecondsPerDay;
-    var offset = daysSinceMinimum + CalendarTableView._MinimumDayWeekDay - global.params.weekStartDay;
-    var row = Math.floor(offset / DaysPerWeek);
-    var column = offset - row * DaysPerWeek;
-    return {
-        column: column,
-        row: row
-    };
-};
-
-CalendarTableView.prototype.updateCells = function() {
-    ListView.prototype.updateCells.call(this);
-
-    var selection = this.calendarPicker.selection();
-    var firstDayInSelection;
-    var lastDayInSelection;
-    if (selection) {
-        firstDayInSelection = selection.firstDay().valueOf();
-        lastDayInSelection = selection.lastDay().valueOf();
-    } else {
-        firstDayInSelection = Infinity;
-        lastDayInSelection = Infinity;
-    }
-    var highlight = this.calendarPicker.highlight();
-    var firstDayInHighlight;
-    var lastDayInHighlight;
-    if (highlight) {
-        firstDayInHighlight = highlight.firstDay().valueOf();
-        lastDayInHighlight = highlight.lastDay().valueOf();
-    } else {
-        firstDayInHighlight = Infinity;
-        lastDayInHighlight = Infinity;
-    }
-    var currentMonth = this.calendarPicker.currentMonth();
-    var firstDayInCurrentMonth = currentMonth.firstDay().valueOf();
-    var lastDayInCurrentMonth = currentMonth.lastDay().valueOf();
-    for (var dayString in this._dayCells) {
-        var dayCell = this._dayCells[dayString];
-        var day = dayCell.day;
-        dayCell.setIsToday(Day.createFromToday().equals(day));
-        dayCell.setSelected(day >= firstDayInSelection && day <= lastDayInSelection);
-        dayCell.setHighlighted(day >= firstDayInHighlight && day <= lastDayInHighlight);
-        dayCell.setIsInCurrentMonth(day >= firstDayInCurrentMonth && day <= lastDayInCurrentMonth);
-        dayCell.setDisabled(!this.calendarPicker.isValidDay(day));
-    }
-    if (this.hasWeekNumberColumn) {
-        for (var weekString in this._weekNumberCells) {
-            var weekNumberCell = this._weekNumberCells[weekString];
-            var week = weekNumberCell.week;
-            weekNumberCell.setSelected(selection && selection.equals(week));
-            weekNumberCell.setHighlighted(highlight && highlight.equals(week));
-            weekNumberCell.setDisabled(!this.calendarPicker.isValid(week));
-        }
-    }
-};
-
-/**
- * @param {!Day} day
- * @return {!DayCell}
- */
-CalendarTableView.prototype.prepareNewDayCell = function(day) {
-    var dayCell = DayCell.recycleOrCreate();
-    dayCell.reset(day);
-    this._dayCells[dayCell.day.toString()] = dayCell;
-    return dayCell;
-};
-
-/**
- * @param {!Week} week
- * @return {!WeekNumberCell}
- */
-CalendarTableView.prototype.prepareNewWeekNumberCell = function(week) {
-    var weekNumberCell = WeekNumberCell.recycleOrCreate();
-    weekNumberCell.reset(week);
-    this._weekNumberCells[weekNumberCell.week.toString()] = weekNumberCell;
-    return weekNumberCell;
-};
-
-/**
- * @param {!DayCell} dayCell
- */
-CalendarTableView.prototype.throwAwayDayCell = function(dayCell) {
-    delete this._dayCells[dayCell.day.toString()];
-    dayCell.throwAway();
-};
-
-/**
- * @param {!WeekNumberCell} weekNumberCell
- */
-CalendarTableView.prototype.throwAwayWeekNumberCell = function(weekNumberCell) {
-    delete this._weekNumberCells[weekNumberCell.week.toString()];
-    weekNumberCell.throwAway();
-};
-
-/**
- * @constructor
- * @extends View
- * @param {!Object} config
- */
-function CalendarPicker(type, config) {
-    View.call(this, createElement("div", CalendarPicker.ClassNameCalendarPicker));
-    this.element.classList.add(CalendarPicker.ClassNamePreparing);
-
-    /**
-     * @type {!string}
-     * @const
-     */
-    this.type = type;
-    if (this.type === "week")
-        this._dateTypeConstructor = Week;
-    else if (this.type === "month")
-        this._dateTypeConstructor = Month;
-    else
-        this._dateTypeConstructor = Day;
-    /**
-     * @type {!Object}
-     * @const
-     */
-    this.config = {};
-    this._setConfig(config);
-    /**
-     * @type {!Month}
-     * @const
-     */
-    this.minimumMonth = Month.createFromDay(this.config.minimum.firstDay());
-    /**
-     * @type {!Month}
-     * @const
-     */
-    this.maximumMonth = Month.createFromDay(this.config.maximum.lastDay());
-    if (global.params.isLocaleRTL)
-        this.element.classList.add("rtl");
-    /**
-     * @type {!CalendarTableView}
-     * @const
-     */
-    this.calendarTableView = new CalendarTableView(this);
-    this.calendarTableView.hasNumberColumn = this.type === "week";
-    /**
-     * @type {!CalendarHeaderView}
-     * @const
-     */
-    this.calendarHeaderView = new CalendarHeaderView(this);
-    this.calendarHeaderView.monthPopupButton.on(MonthPopupButton.EventTypeButtonClick, this.onMonthPopupButtonClick);
-    /**
-     * @type {!MonthPopupView}
-     * @const
-     */
-    this.monthPopupView = new MonthPopupView(this.minimumMonth, this.maximumMonth);
-    this.monthPopupView.yearListView.on(YearListView.EventTypeYearListViewDidSelectMonth, this.onYearListViewDidSelectMonth);
-    this.monthPopupView.yearListView.on(YearListView.EventTypeYearListViewDidHide, this.onYearListViewDidHide);
-    this.calendarHeaderView.attachTo(this);
-    this.calendarTableView.attachTo(this);
-    /**
-     * @type {!Month}
-     * @protected
-     */
-    this._currentMonth = new Month(NaN, NaN);
-    /**
-     * @type {?DateType}
-     * @protected
-     */
-    this._selection = null;
-    /**
-     * @type {?DateType}
-     * @protected
-     */
-    this._highlight = null;
-    this.calendarTableView.element.addEventListener("keydown", this.onCalendarTableKeyDown, false);
-    document.body.addEventListener("keydown", this.onBodyKeyDown, false);
-
-    window.addEventListener("resize", this.onWindowResize, false);
-
-    /**
-     * @type {!number}
-     * @protected
-     */
-    this._height = -1;
-
-    var initialSelection = parseDateString(config.currentValue);
-    if (initialSelection) {
-        this.setCurrentMonth(Month.createFromDay(initialSelection.middleDay()), CalendarPicker.NavigationBehavior.None);
-        this.setSelection(initialSelection);
-    } else
-        this.setCurrentMonth(Month.createFromToday(), CalendarPicker.NavigationBehavior.None);
-}
-
-CalendarPicker.prototype = Object.create(View.prototype);
-
-CalendarPicker.Padding = 10;
-CalendarPicker.BorderWidth = 1;
-CalendarPicker.ClassNameCalendarPicker = "calendar-picker";
-CalendarPicker.ClassNamePreparing = "preparing";
-CalendarPicker.EventTypeCurrentMonthChanged = "currentMonthChanged";
-
-/**
- * @param {!Event} event
- */
-CalendarPicker.prototype.onWindowResize = function(event) {
-    this.element.classList.remove(CalendarPicker.ClassNamePreparing);
-    window.removeEventListener("resize", this.onWindowResize, false);
-};
-
-/**
- * @param {!YearListView} sender
- */
-CalendarPicker.prototype.onYearListViewDidHide = function(sender) {
-    this.monthPopupView.hide();
-    this.calendarHeaderView.setDisabled(false);
-    this.adjustHeight();
-};
-
-/**
- * @param {!YearListView} sender
- * @param {!Month} month
- */
-CalendarPicker.prototype.onYearListViewDidSelectMonth = function(sender, month) {
-    this.setCurrentMonth(month, CalendarPicker.NavigationBehavior.None);
-};
-
-/**
- * @param {!View|Node} parent
- * @param {?View|Node=} before
- * @override
- */
-CalendarPicker.prototype.attachTo = function(parent, before) {
-    View.prototype.attachTo.call(this, parent, before);
-    this.calendarTableView.element.focus();
-};
-
-CalendarPicker.prototype.cleanup = function() {
-    window.removeEventListener("resize", this.onWindowResize, false);
-    this.calendarTableView.element.removeEventListener("keydown", this.onBodyKeyDown, false);
-    // Month popup view might be attached to document.body.
-    this.monthPopupView.hide();
-};
-
-/**
- * @param {?MonthPopupButton} sender
- */
-CalendarPicker.prototype.onMonthPopupButtonClick = function(sender) {
-    var clientRect = this.calendarTableView.element.getBoundingClientRect();
-    var calendarTableRect = new Rectangle(clientRect.left + document.body.scrollLeft, clientRect.top + document.body.scrollTop, clientRect.width, clientRect.height);
-    this.monthPopupView.show(this.currentMonth(), calendarTableRect);
-    this.calendarHeaderView.setDisabled(true);
-    this.adjustHeight();
-};
-
-CalendarPicker.prototype._setConfig = function(config) {
-    this.config.minimum = (typeof config.min !== "undefined" && config.min) ? parseDateString(config.min) : this._dateTypeConstructor.Minimum;
-    this.config.maximum = (typeof config.max !== "undefined" && config.max) ? parseDateString(config.max) : this._dateTypeConstructor.Maximum;
-    this.config.minimumValue = this.config.minimum.valueOf();
-    this.config.maximumValue = this.config.maximum.valueOf();
-    this.config.step = (typeof config.step !== undefined) ? Number(config.step) : this._dateTypeConstructor.DefaultStep;
-    this.config.stepBase = (typeof config.stepBase !== "undefined") ? Number(config.stepBase) : this._dateTypeConstructor.DefaultStepBase;
-};
-
-/**
- * @return {!Month}
- */
-CalendarPicker.prototype.currentMonth = function() {
-    return this._currentMonth;
-};
-
-/**
- * @enum {number}
- */
-CalendarPicker.NavigationBehavior = {
-    None: 0,
-    WithAnimation: 1
-};
-
-/**
- * @param {!Month} month
- * @param {!CalendarPicker.NavigationBehavior} animate
- */
-CalendarPicker.prototype.setCurrentMonth = function(month, behavior) {
-    if (month > this.maximumMonth)
-        month = this.maximumMonth;
-    else if (month < this.minimumMonth)
-        month = this.minimumMonth;
-    if (this._currentMonth.equals(month))
-        return;
-    this._currentMonth = month;
-    this.calendarTableView.scrollToMonth(this._currentMonth, behavior === CalendarPicker.NavigationBehavior.WithAnimation);
-    this.adjustHeight();
-    this.calendarTableView.setNeedsUpdateCells(true);
-    this.dispatchEvent(CalendarPicker.EventTypeCurrentMonthChanged, {
-        target: this
-    });
-};
-
-CalendarPicker.prototype.adjustHeight = function() {
-    var rowForFirstDayInMonth = this.calendarTableView.columnAndRowForDay(this._currentMonth.firstDay()).row;
-    var rowForLastDayInMonth = this.calendarTableView.columnAndRowForDay(this._currentMonth.lastDay()).row;
-    var numberOfRows = rowForLastDayInMonth - rowForFirstDayInMonth + 1;
-    var calendarTableViewHeight = CalendarTableHeaderView.Height + numberOfRows * DayCell.Height + CalendarTableView.BorderWidth * 2;
-    var height = (this.monthPopupView.isVisible ? YearListView.Height : calendarTableViewHeight) + CalendarHeaderView.Height + CalendarHeaderView.BottomMargin + CalendarPicker.Padding * 2 + CalendarPicker.BorderWidth * 2;
-    this.setHeight(height);
-};
-
-CalendarPicker.prototype.selection = function() {
-    return this._selection;
-};
-
-CalendarPicker.prototype.highlight = function() {
-    return this._highlight;
-};
-
-/**
- * @return {!Day}
- */
-CalendarPicker.prototype.firstVisibleDay = function() {
-    var firstVisibleRow = this.calendarTableView.columnAndRowForDay(this.currentMonth().firstDay()).row;
-    var firstVisibleDay = this.calendarTableView.dayAtColumnAndRow(0, firstVisibleRow);
-    if (!firstVisibleDay)
-        firstVisibleDay = Day.Minimum;
-    return firstVisibleDay;
-};
-
-/**
- * @return {!Day}
- */
-CalendarPicker.prototype.lastVisibleDay = function() { 
-    var lastVisibleRow = this.calendarTableView.columnAndRowForDay(this.currentMonth().lastDay()).row;
-    var lastVisibleDay = this.calendarTableView.dayAtColumnAndRow(DaysPerWeek - 1, lastVisibleRow);
-    if (!lastVisibleDay)
-        lastVisibleDay = Day.Maximum;
-    return lastVisibleDay;
-};
-
-/**
- * @param {?Day} day
- */
-CalendarPicker.prototype.selectRangeContainingDay = function(day) {
-    var selection = day ? this._dateTypeConstructor.createFromDay(day) : null;
-    this.setSelection(selection);
-};
-
-/**
- * @param {?Day} day
- */
-CalendarPicker.prototype.highlightRangeContainingDay = function(day) {
-    var highlight = day ? this._dateTypeConstructor.createFromDay(day) : null;
-    this._setHighlight(highlight);
-};
-
-/**
- * @param {?DateType} dayOrWeekOrMonth
- */
-CalendarPicker.prototype.setSelection = function(dayOrWeekOrMonth) {
-    if (!this._selection && !dayOrWeekOrMonth)
-        return;
-    if (this._selection && this._selection.equals(dayOrWeekOrMonth))
-        return;
-    var firstDayInSelection = dayOrWeekOrMonth.firstDay();    
-    var lastDayInSelection = dayOrWeekOrMonth.lastDay();
-    var candidateCurrentMonth = Month.createFromDay(firstDayInSelection);
-    if (this.firstVisibleDay() > lastDayInSelection || this.lastVisibleDay() < firstDayInSelection) {
-        // Change current month if the selection is not visible at all.
-        this.setCurrentMonth(candidateCurrentMonth, CalendarPicker.NavigationBehavior.WithAnimation);
-    } else if (this.firstVisibleDay() < firstDayInSelection || this.lastVisibleDay() > lastDayInSelection) {
-        // If the selection is partly visible, only change the current month if
-        // doing so will make the whole selection visible.
-        var firstVisibleRow = this.calendarTableView.columnAndRowForDay(candidateCurrentMonth.firstDay()).row;
-        var firstVisibleDay = this.calendarTableView.dayAtColumnAndRow(0, firstVisibleRow);
-        var lastVisibleRow = this.calendarTableView.columnAndRowForDay(candidateCurrentMonth.lastDay()).row;
-        var lastVisibleDay = this.calendarTableView.dayAtColumnAndRow(DaysPerWeek - 1, lastVisibleRow);
-        if (firstDayInSelection >= firstVisibleDay && lastDayInSelection <= lastVisibleDay)
-            this.setCurrentMonth(candidateCurrentMonth, CalendarPicker.NavigationBehavior.WithAnimation);
-    }
-    this._setHighlight(dayOrWeekOrMonth);
-    if (!this.isValid(dayOrWeekOrMonth))
-        return;
-    this._selection = dayOrWeekOrMonth;
-    this.calendarTableView.setNeedsUpdateCells(true);
-    window.pagePopupController.setValue(this._selection.toString());
-};
-
-/**
- * @param {?DateType} dayOrWeekOrMonth
- */
-CalendarPicker.prototype._setHighlight = function(dayOrWeekOrMonth) {
-    if (!this._highlight && !dayOrWeekOrMonth)
-        return;
-    if (!dayOrWeekOrMonth && !this._highlight)
-        return;
-    if (this._highlight && this._highlight.equals(dayOrWeekOrMonth))
-        return;
-    this._highlight = dayOrWeekOrMonth;
-    this.calendarTableView.setNeedsUpdateCells(true);
-};
-
-/**
- * @param {!number} value
- * @return {!boolean}
- */
-CalendarPicker.prototype._stepMismatch = function(value) {
-    var nextAllowedValue = Math.ceil((value - this.config.stepBase) / this.config.step) * this.config.step + this.config.stepBase;
-    return nextAllowedValue >= value + this._dateTypeConstructor.DefaultStep;
-};
-
-/**
- * @param {!number} value
- * @return {!boolean}
- */
-CalendarPicker.prototype._outOfRange = function(value) {
-    return value < this.config.minimumValue || value > this.config.maximumValue;
-};
-
-/**
- * @param {!DateType} dayOrWeekOrMonth
- * @return {!boolean}
- */
-CalendarPicker.prototype.isValid = function(dayOrWeekOrMonth) {
-    var value = dayOrWeekOrMonth.valueOf();
-    return dayOrWeekOrMonth instanceof this._dateTypeConstructor && !this._outOfRange(value) && !this._stepMismatch(value);
-};
-
-/**
- * @param {!Day} day
- * @return {!boolean}
- */
-CalendarPicker.prototype.isValidDay = function(day) {
-    return this.isValid(this._dateTypeConstructor.createFromDay(day));
-};
-
-/**
- * @param {!DateType} dateRange
- * @return {!boolean} Returns true if the highlight was changed.
- */
-CalendarPicker.prototype._moveHighlight = function(dateRange) {
-    if (!dateRange)
-        return false;
-    if (this._outOfRange(dateRange.valueOf()))
-        return false;
-    if (this.firstVisibleDay() > dateRange.middleDay() || this.lastVisibleDay() < dateRange.middleDay())
-        this.setCurrentMonth(Month.createFromDay(dateRange.middleDay()), CalendarPicker.NavigationBehavior.WithAnimation);
-    this._setHighlight(dateRange);
-    return true;
-};
-
-/**
- * @param {?Event} event
- */
-CalendarPicker.prototype.onCalendarTableKeyDown = function(event) {
-    var key = event.keyIdentifier;
-    var eventHandled = false;
-    if (key == "U+0054") { // 't' key.
-        this.selectRangeContainingDay(Day.createFromToday());
-        eventHandled = true;
-    } else if (key == "PageUp") {
-        var previousMonth = this.currentMonth().previous();
-        if (previousMonth && previousMonth >= this.config.minimumValue) {
-            this.setCurrentMonth(previousMonth, CalendarPicker.NavigationBehavior.WithAnimation);
-            eventHandled = true;
-        }
-    } else if (key == "PageDown") {
-        var nextMonth = this.currentMonth().next();
-        if (nextMonth && nextMonth >= this.config.minimumValue) {
-            this.setCurrentMonth(nextMonth, CalendarPicker.NavigationBehavior.WithAnimation);
-            eventHandled = true;
-        }
-    } else if (this._highlight) {
-        if (global.params.isLocaleRTL ? key == "Right" : key == "Left") {
-            eventHandled = this._moveHighlight(this._highlight.previous());
-        } else if (key == "Up") {
-            eventHandled = this._moveHighlight(this._highlight.previous(this.type === "date" ? DaysPerWeek : 1));
-        } else if (global.params.isLocaleRTL ? key == "Left" : key == "Right") {
-            eventHandled = this._moveHighlight(this._highlight.next());
-        } else if (key == "Down") {
-            eventHandled = this._moveHighlight(this._highlight.next(this.type === "date" ? DaysPerWeek : 1));
-        } else if (key == "Enter") {
-            this.setSelection(this._highlight);
-        }
-    } else if (key == "Left" || key == "Up" || key == "Right" || key == "Down") {
-        // Highlight range near the middle.
-        this.highlightRangeContainingDay(this.currentMonth().middleDay());
-        eventHandled = true;
-    }
-
-    if (eventHandled) {
-        event.stopPropagation();
-        event.preventDefault();
-    }
-};
-
-/**
- * @return {!number} Width in pixels.
- */
-CalendarPicker.prototype.width = function() {
-    return this.calendarTableView.width() + (CalendarTableView.BorderWidth + CalendarPicker.BorderWidth + CalendarPicker.Padding) * 2;
-};
-
-/**
- * @return {!number} Height in pixels.
- */
-CalendarPicker.prototype.height = function() {
-    return this._height;
-};
-
-/**
- * @param {!number} height Height in pixels.
- */
-CalendarPicker.prototype.setHeight = function(height) {
-    if (this._height === height)
-        return;
-    this._height = height;
-    resizeWindow(this.width(), this._height);
-    this.calendarTableView.setHeight(this._height - CalendarHeaderView.Height - CalendarHeaderView.BottomMargin - CalendarPicker.Padding * 2 - CalendarTableView.BorderWidth * 2);
-};
-
-/**
- * @param {?Event} event
- */
-CalendarPicker.prototype.onBodyKeyDown = function(event) {
-    var key = event.keyIdentifier;
-    var eventHandled = false;
-    var offset = 0;
-    switch (key) {
-    case "U+001B": // Esc key.
-        window.pagePopupController.closePopup();
-        eventHandled = true;
-        break;
-    case "U+004D": // 'm' key.
-        offset = offset || 1; // Fall-through.
-    case "U+0059": // 'y' key.
-        offset = offset || MonthsPerYear; // Fall-through.
-    case "U+0044": // 'd' key.
-        offset = offset || MonthsPerYear * 10;
-        var oldFirstVisibleRow = this.calendarTableView.columnAndRowForDay(this.currentMonth().firstDay()).row;
-        this.setCurrentMonth(event.shiftKey ? this.currentMonth().previous(offset) : this.currentMonth().next(offset), CalendarPicker.NavigationBehavior.WithAnimation);
-        var newFirstVisibleRow = this.calendarTableView.columnAndRowForDay(this.currentMonth().firstDay()).row;
-        if (this._highlight) {
-            var highlightMiddleDay = this._highlight.middleDay();
-            this.highlightRangeContainingDay(highlightMiddleDay.next((newFirstVisibleRow - oldFirstVisibleRow) * DaysPerWeek));
-        }
-        eventHandled  =true;
-        break;
-    }
-    if (eventHandled) {
-        event.stopPropagation();
-        event.preventDefault();
-    }
-}
-
-if (window.dialogArguments) {
-    initialize(dialogArguments);
-} else {
-    window.addEventListener("message", handleMessage, false);
-}
diff --git a/Source/core/Resources/pagepopups/chromium/calendarPickerChromium.css b/Source/core/Resources/pagepopups/chromium/calendarPickerChromium.css
deleted file mode 100644
index 167590d..0000000
--- a/Source/core/Resources/pagepopups/chromium/calendarPickerChromium.css
+++ /dev/null
@@ -1,46 +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:
- * 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.
- */
-
-.year-month-button {
-    width: 24px;
-    height: 24px;
-    min-width: 0;
-    padding: 0;
-}
-
-.month-popup-button:focus,
-.year-list-view:focus,
-.calendar-table-view:focus {
-    transition: border-color 200ms;
-    /* We use border color because it follows the border radius (unlike outline).
-    * This is particularly noticeable on mac. */
-    border-color: rgb(77, 144, 254) !important;
-    outline: none;
-}
-
-.preparing button:focus,
-.preparing .year-list-view:focus,
-.preparing .calendar-table-view:focus {
-    transition: none;
-}
diff --git a/Source/core/Resources/pagepopups/chromium/pickerCommonChromium.css b/Source/core/Resources/pagepopups/chromium/pickerCommonChromium.css
deleted file mode 100644
index b207a0d..0000000
--- a/Source/core/Resources/pagepopups/chromium/pickerCommonChromium.css
+++ /dev/null
@@ -1,70 +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:
- * 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.
- */
-
-input[type='button'],
-button {
-    -webkit-appearance: none;
-    -webkit-user-select: none;
-    background-image: -webkit-linear-gradient(#ededed, #ededed 38%, #dedede);
-    border: 1px solid rgba(0, 0, 0, 0.25);
-    border-radius: 2px;
-    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08),
-    inset 0 1px 2px rgba(255, 255, 255, 0.75);
-    color: #444;
-    font: inherit;
-    text-shadow: 0 1px 0 rgb(240, 240, 240);
-    min-height: 2em;
-    min-width: 4em;
-    -webkit-padding-end: 10px;
-    -webkit-padding-start: 10px;
-    margin: 0;
-}
-
-:enabled:hover:-webkit-any(button, input[type='button']) {
-    background-image: -webkit-linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0);
-    border-color: rgba(0, 0, 0, 0.3);
-    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), inset 0 1px 2px rgba(255, 255, 255, 0.95);
-    color: black;
-}
-
-:enabled:active:-webkit-any(button, input[type='button']) {
-    background-image: -webkit-linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7);
-    box-shadow: none;
-    text-shadow: none;
-}
-
-:disabled:-webkit-any(button, input[type='button']) {
-    background-image: -webkit-linear-gradient(#f1f1f1, #f1f1f1 38%, #e6e6e6);
-    border-color: rgba(80, 80, 80, 0.2);
-    box-shadow: 0 1px 0 rgba(80, 80, 80, 0.08), inset 0 1px 2px rgba(255, 255, 255, 0.75);
-    color: #aaa;
-}
-
-:enabled:focus:-webkit-any(button, input[type='button']) {
-    transition: border-color 200ms;
-    /* We use border color because it follows the border radius (unlike outline).
-    * This is particularly noticeable on mac. */
-    border-color: rgb(77, 144, 254);
-    outline: none;
-}
diff --git a/Source/core/Resources/pagepopups/colorSuggestionPicker.css b/Source/core/Resources/pagepopups/colorSuggestionPicker.css
deleted file mode 100644
index 39a162b..0000000
--- a/Source/core/Resources/pagepopups/colorSuggestionPicker.css
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 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.
- */
-
-body {
-    -webkit-user-select: none;
-    background-color: white;
-    font: -webkit-small-control;
-    margin: 0;
-    overflow: hidden;
-}
-
-#main {
-    background-color: white;
-    border: solid 1px #8899aa;
-    box-shadow: inset 2px 2px 2px white,
-        inset -2px -2px 1px rgba(0,0,0,0.1);
-    padding: 6px;
-    float: left;
-}
-
-.color-swatch {
-    float: left;
-    width: 20px;
-    height: 20px;
-    margin: 1px;
-    padding: 0;
-    border: 1px solid #e0e0e0;
-    box-sizing: content-box;
-}
-
-.color-swatch:focus {
-    border: 1px solid #000000;
-    outline: none;
-}
-
-.color-swatch-container {
-    width: 100%;
-    max-height: 104px;
-    overflow: auto;
-    display: flex;
-    flex-flow: row wrap;
-    align-items: center;
-}
-
-.other-color {
-    width: 100%;
-    margin: 4px 0 0 0;
-}
diff --git a/Source/core/Resources/pagepopups/colorSuggestionPicker.js b/Source/core/Resources/pagepopups/colorSuggestionPicker.js
deleted file mode 100644
index 559b9e6..0000000
--- a/Source/core/Resources/pagepopups/colorSuggestionPicker.js
+++ /dev/null
@@ -1,189 +0,0 @@
-"use strict";
-/*
- * 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 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.
- */
-
-var global = {
-    argumentsReceived: false,
-    params: null
-};
-
-/**
- * @param {Event} event
- */
-function handleMessage(event) {
-    initialize(JSON.parse(event.data));
-    global.argumentsReceived = true;
-}
-
-/**
- * @param {!Object} args
- */
-function initialize(args) { 
-    global.params = args;
-    var main = $("main");
-    main.innerHTML = "";
-    var errorString = validateArguments(args);
-    if (errorString) {
-        main.textContent = "Internal error: " + errorString;
-        resizeWindow(main.offsetWidth, main.offsetHeight);
-    } else
-        new ColorPicker(main, args);
-}
-
-// The DefaultColorPalette is used when the list of values are empty. 
-var DefaultColorPalette = ["#000000", "#404040", "#808080", "#c0c0c0",
-    "#ffffff", "#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff",
-    "#4a86e8", "#0000ff", "#9900ff", "#ff00ff"];
-
-function handleArgumentsTimeout() {
-    if (global.argumentsReceived)
-        return;
-    var args = {
-        values : DefaultColorPalette,
-        otherColorLabel: "Other..."
-    };
-    initialize(args);
-}
-
-/**
- * @param {!Object} args
- * @return {?string} An error message, or null if the argument has no errors.
- */
-function validateArguments(args) {
-    if (!args.values)
-        return "No values.";
-    if (!args.otherColorLabel)
-        return "No otherColorLabel.";
-    return null;
-}
-
-function ColorPicker(element, config) {
-    Picker.call(this, element, config);
-    this._config = config;
-    if (this._config.values.length === 0)
-        this._config.values = DefaultColorPalette;
-    this._container = null;
-    this._layout();
-    document.body.addEventListener("keydown", this._handleKeyDown.bind(this));
-    this._element.addEventListener("mousemove", this._handleMouseMove.bind(this));
-    this._element.addEventListener("mousedown", this._handleMouseDown.bind(this));
-}
-ColorPicker.prototype = Object.create(Picker.prototype);
-
-var SwatchBorderBoxWidth = 24; // keep in sync with CSS
-var SwatchBorderBoxHeight = 24; // keep in sync with CSS
-var SwatchesPerRow = 5;
-var SwatchesMaxRow = 4;
-
-ColorPicker.prototype._layout = function() {
-    var container = createElement("div", "color-swatch-container");
-    container.addEventListener("click", this._handleSwatchClick.bind(this), false);
-    for (var i = 0; i < this._config.values.length; ++i) {
-        var swatch = createElement("button", "color-swatch");
-        swatch.dataset.index = i;
-        swatch.dataset.value = this._config.values[i];
-        swatch.title = this._config.values[i];
-        swatch.style.backgroundColor = this._config.values[i];
-        container.appendChild(swatch);
-    }
-    var containerWidth = SwatchBorderBoxWidth * SwatchesPerRow;
-    if (this._config.values.length > SwatchesPerRow * SwatchesMaxRow)
-        containerWidth += getScrollbarWidth();
-    container.style.width = containerWidth + "px";
-    container.style.maxHeight = (SwatchBorderBoxHeight * SwatchesMaxRow) + "px";
-    this._element.appendChild(container);
-    var otherButton = createElement("button", "other-color", this._config.otherColorLabel);
-    otherButton.addEventListener("click", this.chooseOtherColor.bind(this), false);
-    this._element.appendChild(otherButton);
-    this._container = container;
-    this._otherButton = otherButton;
-    var elementWidth = this._element.offsetWidth;
-    var elementHeight = this._element.offsetHeight;
-    resizeWindow(elementWidth, elementHeight);
-};
-
-ColorPicker.prototype.selectColorAtIndex = function(index) {
-    index = Math.max(Math.min(this._container.childNodes.length - 1, index), 0);
-    this._container.childNodes[index].focus();
-};
-
-ColorPicker.prototype._handleMouseMove = function(event) {
-    if (event.target.classList.contains("color-swatch"))
-        event.target.focus();
-};
-
-ColorPicker.prototype._handleMouseDown = function(event) {
-    // Prevent blur.
-    if (event.target.classList.contains("color-swatch"))
-        event.preventDefault();
-};
-
-ColorPicker.prototype._handleKeyDown = function(event) {
-    var key = event.keyIdentifier;
-    if (key === "U+001B") // ESC
-        this.handleCancel();
-    else if (key == "Left" || key == "Up" || key == "Right" || key == "Down") {
-        var selectedElement = document.activeElement;
-        var index = 0;
-        if (selectedElement.classList.contains("other-color")) {
-            if (key != "Right" && key != "Up")
-                return;
-            index = this._container.childNodes.length - 1;
-        } else if (selectedElement.classList.contains("color-swatch")) {
-            index = parseInt(selectedElement.dataset.index, 10);
-            switch (key) {
-            case "Left":
-                index--;
-                break;
-            case "Right":
-                index++;
-                break;
-            case "Up":
-                index -= SwatchesPerRow;
-                break;
-            case "Down":
-                index += SwatchesPerRow;
-                break;
-            }
-            if (index > this._container.childNodes.length - 1) {
-                this._otherButton.focus();
-                return;
-            }
-        }
-        this.selectColorAtIndex(index);
-    }
-    event.preventDefault();
-};
-
-ColorPicker.prototype._handleSwatchClick = function(event) {
-    if (event.target.classList.contains("color-swatch"))
-        this.submitValue(event.target.dataset.value);
-};
-
-if (window.dialogArguments) {
-    initialize(dialogArguments);
-} else {
-    window.addEventListener("message", handleMessage, false);
-    window.setTimeout(handleArgumentsTimeout, 1000);
-}
diff --git a/Source/core/Resources/pagepopups/pickerCommon.css b/Source/core/Resources/pagepopups/pickerCommon.css
deleted file mode 100644
index 696751a..0000000
--- a/Source/core/Resources/pagepopups/pickerCommon.css
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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 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.
- */
-
-body {
-    -webkit-user-select: none;
-    background-color: white;
-    font: -webkit-small-control;
-    margin: 0;
-    overflow: hidden;
-}
-
-.rtl {
-    direction: rtl;
-}
diff --git a/Source/core/Resources/pagepopups/pickerCommon.js b/Source/core/Resources/pagepopups/pickerCommon.js
deleted file mode 100644
index 7034329..0000000
--- a/Source/core/Resources/pagepopups/pickerCommon.js
+++ /dev/null
@@ -1,257 +0,0 @@
-"use strict";
-/*
- * 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 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.
- */
-
-/**
- * @param {!string} id
- */
-function $(id) {
-    return document.getElementById(id);
-}
-
-/**
- * @param {!string} tagName
- * @param {string=} opt_class
- * @param {string=} opt_text
- * @return {!Element}
- */
-function createElement(tagName, opt_class, opt_text) {
-    var element = document.createElement(tagName);
-    if (opt_class)
-        element.setAttribute("class", opt_class);
-    if (opt_text)
-        element.appendChild(document.createTextNode(opt_text));
-    return element;
-}
-
-/**
- * @constructor
- * @param {!number|Rectangle|Object} xOrRect
- * @param {!number} y
- * @param {!number} width
- * @param {!number} height
- */
-function Rectangle(xOrRect, y, width, height) {
-    if (typeof xOrRect === "object") {
-        y = xOrRect.y;
-        width = xOrRect.width;
-        height = xOrRect.height;
-        xOrRect = xOrRect.x;
-    }
-    this.x = xOrRect;
-    this.y = y;
-    this.width = width;
-    this.height = height;
-}
-
-Rectangle.prototype = {
-    get maxX() { return this.x + this.width; },
-    get maxY() { return this.y + this.height; },
-    toString: function() { return "Rectangle(" + this.x + "," + this.y + "," + this.width + "," + this.height + ")"; }
-};
-
-/**
- * @param {!Rectangle} rect1
- * @param {!Rectangle} rect2
- * @return {?Rectangle}
- */
-Rectangle.intersection = function(rect1, rect2) {
-    var x = Math.max(rect1.x, rect2.x);
-    var maxX = Math.min(rect1.maxX, rect2.maxX);
-    var y = Math.max(rect1.y, rect2.y);
-    var maxY = Math.min(rect1.maxY, rect2.maxY);
-    var width = maxX - x;
-    var height = maxY - y;
-    if (width < 0 || height < 0)
-        return null;
-    return new Rectangle(x, y, width, height);
-};
-
-/**
- * @param {!number} width
- * @param {!number} height
- */
-function resizeWindow(width, height) {
-    setWindowRect(adjustWindowRect(width, height, width, height));
-}
-
-/**
- * @param {!number} width
- * @param {!number} height
- * @param {?number} minWidth
- * @param {?number} minHeight
- * @return {!Rectangle}
- */
-function adjustWindowRect(width, height, minWidth, minHeight) {
-    if (typeof minWidth !== "number")
-        minWidth = 0;
-    if (typeof minHeight !== "number")
-        minHeight = 0;
-
-    var windowRect = new Rectangle(0, 0, width, height);
-
-    if (!global.params.anchorRectInScreen)
-        return windowRect;
-
-    var anchorRect = new Rectangle(global.params.anchorRectInScreen);
-    var availRect = new Rectangle(window.screen.availLeft, window.screen.availTop, window.screen.availWidth, window.screen.availHeight);
-
-    _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeight);
-    _adjustWindowRectHorizontally(windowRect, availRect, anchorRect, minWidth);
-
-    return windowRect;
-}
-
-function _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeight) {
-    var availableSpaceAbove = anchorRect.y - availRect.y;
-    availableSpaceAbove = Math.max(0, Math.min(availRect.height, availableSpaceAbove));
-
-    var availableSpaceBelow = availRect.maxY - anchorRect.maxY;
-    availableSpaceBelow = Math.max(0, Math.min(availRect.height, availableSpaceBelow));
-
-    if (windowRect.height > availableSpaceBelow && availableSpaceBelow < availableSpaceAbove) {
-        windowRect.height = Math.min(windowRect.height, availableSpaceAbove);
-        windowRect.height = Math.max(windowRect.height, minHeight);
-        windowRect.y = anchorRect.y - windowRect.height;
-    } else {
-        windowRect.height = Math.min(windowRect.height, availableSpaceBelow);
-        windowRect.height = Math.max(windowRect.height, minHeight);
-        windowRect.y = anchorRect.maxY;
-    }
-    windowRect.y = Math.min(windowRect.y, availRect.maxY - windowRect.height);
-    windowRect.y = Math.max(windowRect.y, availRect.y);
-}
-
-function _adjustWindowRectHorizontally(windowRect, availRect, anchorRect, minWidth) {
-    windowRect.width = Math.min(windowRect.width, availRect.width);
-    windowRect.width = Math.max(windowRect.width, minWidth);
-    windowRect.x = anchorRect.x;
-    if (global.params.isRTL)
-        windowRect.x += anchorRect.width - windowRect.width;
-    windowRect.x = Math.min(windowRect.x, availRect.maxX - windowRect.width);
-    windowRect.x = Math.max(windowRect.x, availRect.x);
-}
-
-/**
- * @param {!Rectangle} rect
- */
-function setWindowRect(rect) {
-    if (window.frameElement) {
-        window.frameElement.style.width = rect.width + "px";
-        window.frameElement.style.height = rect.height + "px";
-    } else {
-        if (isWindowHidden()) {
-            window.moveTo(rect.x - window.screen.availLeft, rect.y - window.screen.availTop);
-            window.resizeTo(rect.width, rect.height);
-        } else {
-            window.resizeTo(rect.width, rect.height);
-            window.moveTo(rect.x - window.screen.availLeft, rect.y - window.screen.availTop);
-        }
-    }
-}
-
-function hideWindow() {
-    resizeWindow(1, 1);
-}
-
-/**
- * @return {!boolean}
- */
-function isWindowHidden() {
-    return window.innerWidth === 1 && window.innerHeight === 1;
-}
-
-window.addEventListener("resize", function() {
-    if (isWindowHidden())
-        window.dispatchEvent(new CustomEvent("didHide"));
-    else
-        window.dispatchEvent(new CustomEvent("didOpenPicker"));
-}, false);
-
-/**
- * @return {!number}
- */
-function getScrollbarWidth() {
-    if (typeof window.scrollbarWidth === "undefined") {
-        var scrollDiv = document.createElement("div");
-        scrollDiv.style.opacity = "0";
-        scrollDiv.style.overflow = "scroll";
-        scrollDiv.style.width = "50px";
-        scrollDiv.style.height = "50px";
-        document.body.appendChild(scrollDiv);
-        window.scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
-        scrollDiv.parentNode.removeChild(scrollDiv);
-    }
-    return window.scrollbarWidth;
-}
-
-/**
- * @param {!string} className
- * @return {?Element}
- */
-function enclosingNodeOrSelfWithClass(selfNode, className)
-{
-    for (var node = selfNode; node && node !== selfNode.ownerDocument; node = node.parentNode) {
-        if (node.nodeType === Node.ELEMENT_NODE && node.classList.contains(className))
-            return node;
-    }
-    return null;
-};
-
-/**
- * @constructor
- * @param {!Element} element
- * @param {!Object} config
- */
-function Picker(element, config) {
-    this._element = element;
-    this._config = config;
-}
-
-/**
- * @enum {number}
- */
-Picker.Actions = {
-    SetValue: 0,
-    Cancel: -1,
-    ChooseOtherColor: -2
-};
-
-/**
- * @param {!string} value
- */
-Picker.prototype.submitValue = function(value) {
-    window.pagePopupController.setValue(value);
-    window.pagePopupController.closePopup();
-}
-
-Picker.prototype.handleCancel = function() {
-    window.pagePopupController.closePopup();
-}
-
-Picker.prototype.chooseOtherColor = function() {
-    window.pagePopupController.setValueAndClosePopup(Picker.Actions.ChooseOtherColor, "");
-}
-
-Picker.prototype.cleanup = function() {};
diff --git a/Source/core/Resources/pagepopups/suggestionPicker.css b/Source/core/Resources/pagepopups/suggestionPicker.css
deleted file mode 100644
index 0281d0d..0000000
--- a/Source/core/Resources/pagepopups/suggestionPicker.css
+++ /dev/null
@@ -1,56 +0,0 @@
-.suggestion-list {
-    list-style: none;
-    padding: 0;
-    margin: 0;
-    font: -webkit-small-control;
-    border: 1px solid #7f9db9;
-    background-color: white;
-    overflow: hidden;
-}
-
-.suggestion-list-entry {
-    white-space: nowrap;
-    height: 1.73em;
-    line-height: 1.73em;
-    -webkit-select: none;
-    cursor: default;
-}
-
-.suggestion-list-entry:focus {
-    outline: none;
-}
-
-.suggestion-list-entry .content {
-    padding: 0 4px;
-}
-
-.suggestion-list-entry .label {
-    text-align: right;
-    color: #737373;
-    float: right;
-    padding: 0 4px 0 20px;
-}
-
-.rtl .suggestion-list-entry .label {
-    float: left;
-    padding: 0 20px 0 4px;
-}
-
-.suggestion-list-entry .title {
-    direction: ltr;
-    display: inline-block;
-}
-
-.locale-rtl .suggestion-list-entry .title {
-    direction: rtl;
-}
-
-.measuring-width .suggestion-list-entry .label {
-    float: none;
-    margin-right: 0;
-}
-
-.suggestion-list .separator {
-    border-top: 1px solid #dcdcdc;
-    height: 0;
-}
diff --git a/Source/core/Resources/pagepopups/suggestionPicker.js b/Source/core/Resources/pagepopups/suggestionPicker.js
deleted file mode 100644
index 2d4bada..0000000
--- a/Source/core/Resources/pagepopups/suggestionPicker.js
+++ /dev/null
@@ -1,325 +0,0 @@
-"use strict";
-/*
- * 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 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.
- */
-
-/**
- * @constructor
- * @param {!Element} element
- * @param {!Object} config
- */
-function SuggestionPicker(element, config) {
-    Picker.call(this, element, config);
-    this._isFocusByMouse = false;
-    this._containerElement = null;
-    this._setColors();
-    this._layout();
-    this._fixWindowSize();
-    this._handleBodyKeyDownBound = this._handleBodyKeyDown.bind(this);
-    document.body.addEventListener("keydown", this._handleBodyKeyDownBound);
-    this._element.addEventListener("mouseout", this._handleMouseOut.bind(this), false);
-};
-SuggestionPicker.prototype = Object.create(Picker.prototype);
-
-SuggestionPicker.NumberOfVisibleEntries = 20;
-
-// An entry needs to be at least this many pixels visible for it to be a visible entry.
-SuggestionPicker.VisibleEntryThresholdHeight = 4;
-
-SuggestionPicker.ActionNames = {
-    OpenCalendarPicker: "openCalendarPicker"
-};
-
-SuggestionPicker.ListEntryClass = "suggestion-list-entry";
-
-SuggestionPicker.validateConfig = function(config) {
-    if (config.showOtherDateEntry && !config.otherDateLabel)
-        return "No otherDateLabel.";
-    if (config.suggestionHighlightColor && !config.suggestionHighlightColor)
-        return "No suggestionHighlightColor.";
-    if (config.suggestionHighlightTextColor && !config.suggestionHighlightTextColor)
-        return "No suggestionHighlightTextColor.";
-    if (config.suggestionValues.length !== config.localizedSuggestionValues.length)
-        return "localizedSuggestionValues.length must equal suggestionValues.length.";
-    if (config.suggestionValues.length !== config.suggestionLabels.length)
-        return "suggestionLabels.length must equal suggestionValues.length.";
-    if (typeof config.inputWidth === "undefined")
-        return "No inputWidth.";
-    return null;
-};
-
-SuggestionPicker.prototype._setColors = function() {
-    var text = "." + SuggestionPicker.ListEntryClass + ":focus {\
-        background-color: " + this._config.suggestionHighlightColor + ";\
-        color: " + this._config.suggestionHighlightTextColor + "; }";
-    text += "." + SuggestionPicker.ListEntryClass + ":focus .label { color: " + this._config.suggestionHighlightTextColor + "; }";
-    document.head.appendChild(createElement("style", null, text));
-};
-
-SuggestionPicker.prototype.cleanup = function() {
-    document.body.removeEventListener("keydown", this._handleBodyKeyDownBound, false);
-};
-
-/**
- * @param {!string} title
- * @param {!string} label
- * @param {!string} value
- * @return {!Element}
- */
-SuggestionPicker.prototype._createSuggestionEntryElement = function(title, label, value) {
-    var entryElement = createElement("li", SuggestionPicker.ListEntryClass);
-    entryElement.tabIndex = 0;
-    entryElement.dataset.value = value;
-    var content = createElement("span", "content");
-    entryElement.appendChild(content);
-    var titleElement = createElement("span", "title", title);
-    content.appendChild(titleElement);
-    if (label) {
-        var labelElement = createElement("span", "label", label);
-        content.appendChild(labelElement);
-    }
-    entryElement.addEventListener("mouseover", this._handleEntryMouseOver.bind(this), false);
-    return entryElement;
-};
-
-/**
- * @param {!string} title
- * @param {!string} actionName
- * @return {!Element}
- */
-SuggestionPicker.prototype._createActionEntryElement = function(title, actionName) {
-    var entryElement = createElement("li", SuggestionPicker.ListEntryClass);
-    entryElement.tabIndex = 0;
-    entryElement.dataset.action = actionName;
-    var content = createElement("span", "content");
-    entryElement.appendChild(content);
-    var titleElement = createElement("span", "title", title);
-    content.appendChild(titleElement);
-    entryElement.addEventListener("mouseover", this._handleEntryMouseOver.bind(this), false);
-    return entryElement;
-};
-
-/**
-* @return {!number}
-*/
-SuggestionPicker.prototype._measureMaxContentWidth = function() {
-    // To measure the required width, we first set the class to "measuring-width" which
-    // left aligns all the content including label.
-    this._containerElement.classList.add("measuring-width");
-    var maxContentWidth = 0;
-    var contentElements = this._containerElement.getElementsByClassName("content");
-    for (var i=0; i < contentElements.length; ++i) {
-        maxContentWidth = Math.max(maxContentWidth, contentElements[i].offsetWidth);
-    }
-    this._containerElement.classList.remove("measuring-width");
-    return maxContentWidth;
-};
-
-SuggestionPicker.prototype._fixWindowSize = function() {
-    var ListBorder = 2;
-    var desiredWindowWidth = this._measureMaxContentWidth() + ListBorder;
-    if (typeof this._config.inputWidth === "number")
-        desiredWindowWidth = Math.max(this._config.inputWidth, desiredWindowWidth);
-    var totalHeight = ListBorder;
-    var maxHeight = 0;
-    var entryCount = 0;
-    for (var i = 0; i < this._containerElement.childNodes.length; ++i) {
-        var node = this._containerElement.childNodes[i];
-        if (node.classList.contains(SuggestionPicker.ListEntryClass))
-            entryCount++;
-        totalHeight += node.offsetHeight;
-        if (maxHeight === 0 && entryCount == SuggestionPicker.NumberOfVisibleEntries)
-            maxHeight = totalHeight;
-    }
-    var desiredWindowHeight = totalHeight;
-    if (maxHeight !== 0 && totalHeight > maxHeight) {
-        this._containerElement.style.maxHeight = (maxHeight - ListBorder) + "px";
-        desiredWindowWidth += getScrollbarWidth();
-        desiredWindowHeight = maxHeight;
-        this._containerElement.style.overflowY = "scroll";
-    }
-
-    var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, desiredWindowWidth, 0);
-    this._containerElement.style.height = (windowRect.height - ListBorder) + "px";
-    setWindowRect(windowRect);
-};
-
-SuggestionPicker.prototype._layout = function() {
-    if (this._config.isRTL)
-        this._element.classList.add("rtl");
-    if (this._config.isLocaleRTL)
-        this._element.classList.add("locale-rtl");
-    this._containerElement = createElement("ul", "suggestion-list");
-    this._containerElement.addEventListener("click", this._handleEntryClick.bind(this), false);
-    for (var i = 0; i < this._config.suggestionValues.length; ++i) {
-        this._containerElement.appendChild(this._createSuggestionEntryElement(this._config.localizedSuggestionValues[i], this._config.suggestionLabels[i], this._config.suggestionValues[i]));
-    }
-    if (this._config.showOtherDateEntry) {
-        // Add separator
-        var separator = createElement("div", "separator");
-        this._containerElement.appendChild(separator);
-
-        // Add "Other..." entry
-        var otherEntry = this._createActionEntryElement(this._config.otherDateLabel, SuggestionPicker.ActionNames.OpenCalendarPicker);
-        this._containerElement.appendChild(otherEntry);
-    }
-    this._element.appendChild(this._containerElement);
-};
-
-/**
- * @param {!Element} entry
- */
-SuggestionPicker.prototype.selectEntry = function(entry) {
-    if (typeof entry.dataset.value !== "undefined") {
-        this.submitValue(entry.dataset.value);
-    } else if (entry.dataset.action === SuggestionPicker.ActionNames.OpenCalendarPicker) {
-        window.addEventListener("didHide", SuggestionPicker._handleWindowDidHide, false);
-        hideWindow();
-    }
-};
-
-SuggestionPicker._handleWindowDidHide = function() {
-    openCalendarPicker();
-    window.removeEventListener("didHide", SuggestionPicker._handleWindowDidHide);
-};
-
-/**
- * @param {!Event} event
- */
-SuggestionPicker.prototype._handleEntryClick = function(event) {
-    var entry = enclosingNodeOrSelfWithClass(event.target, SuggestionPicker.ListEntryClass);
-    if (!entry)
-        return;
-    this.selectEntry(entry);
-    event.preventDefault();
-};
-
-/**
- * @return {?Element}
- */
-SuggestionPicker.prototype._findFirstVisibleEntry = function() {
-    var scrollTop = this._containerElement.scrollTop;
-    var childNodes = this._containerElement.childNodes;
-    for (var i = 0; i < childNodes.length; ++i) {
-        var node = childNodes[i];
-        if (node.nodeType !== Node.ELEMENT_NODE || !node.classList.contains(SuggestionPicker.ListEntryClass))
-            continue;
-        if (node.offsetTop + node.offsetHeight - scrollTop > SuggestionPicker.VisibleEntryThresholdHeight)
-            return node;
-    }
-    return null;
-};
-
-/**
- * @return {?Element}
- */
-SuggestionPicker.prototype._findLastVisibleEntry = function() {
-    var scrollBottom = this._containerElement.scrollTop + this._containerElement.offsetHeight;
-    var childNodes = this._containerElement.childNodes;
-    for (var i = childNodes.length - 1; i >= 0; --i){
-        var node = childNodes[i];
-        if (node.nodeType !== Node.ELEMENT_NODE || !node.classList.contains(SuggestionPicker.ListEntryClass))
-            continue;
-        if (scrollBottom - node.offsetTop > SuggestionPicker.VisibleEntryThresholdHeight)
-            return node;
-    }
-    return null;
-};
-
-/**
- * @param {!Event} event
- */
-SuggestionPicker.prototype._handleBodyKeyDown = function(event) {
-    var eventHandled = false;
-    var key = event.keyIdentifier;
-    if (key === "U+001B") { // ESC
-        this.handleCancel();
-        eventHandled = true;
-    } else if (key == "Up") {
-        if (document.activeElement && document.activeElement.classList.contains(SuggestionPicker.ListEntryClass)) {
-            for (var node = document.activeElement.previousElementSibling; node; node = node.previousElementSibling) {
-                if (node.classList.contains(SuggestionPicker.ListEntryClass)) {
-                    this._isFocusByMouse = false;
-                    node.focus();
-                    break;
-                }
-            }
-        } else {
-            this._element.querySelector("." + SuggestionPicker.ListEntryClass + ":last-child").focus();
-        }
-        eventHandled = true;
-    } else if (key == "Down") {
-        if (document.activeElement && document.activeElement.classList.contains(SuggestionPicker.ListEntryClass)) {
-            for (var node = document.activeElement.nextElementSibling; node; node = node.nextElementSibling) {
-                if (node.classList.contains(SuggestionPicker.ListEntryClass)) {
-                    this._isFocusByMouse = false;
-                    node.focus();
-                    break;
-                }
-            }
-        } else {
-            this._element.querySelector("." + SuggestionPicker.ListEntryClass + ":first-child").focus();
-        }
-        eventHandled = true;
-    } else if (key === "Enter") {
-        this.selectEntry(document.activeElement);
-        eventHandled = true;
-    } else if (key === "PageUp") {
-        this._containerElement.scrollTop -= this._containerElement.clientHeight;
-        // Scrolling causes mouseover event to be called and that tries to move the focus too.
-        // To prevent flickering we won't focus if the current focus was caused by the mouse.
-        if (!this._isFocusByMouse)
-            this._findFirstVisibleEntry().focus();
-        eventHandled = true;
-    } else if (key === "PageDown") {
-        this._containerElement.scrollTop += this._containerElement.clientHeight;
-        if (!this._isFocusByMouse)
-            this._findLastVisibleEntry().focus();
-        eventHandled = true;
-    }
-    if (eventHandled)
-        event.preventDefault();
-};
-
-/**
- * @param {!Event} event
- */
-SuggestionPicker.prototype._handleEntryMouseOver = function(event) {
-    var entry = enclosingNodeOrSelfWithClass(event.target, SuggestionPicker.ListEntryClass);
-    if (!entry)
-        return;
-    this._isFocusByMouse = true;
-    entry.focus();
-    event.preventDefault();
-};
-
-/**
- * @param {!Event} event
- */
-SuggestionPicker.prototype._handleMouseOut = function(event) {
-    if (!document.activeElement.classList.contains(SuggestionPicker.ListEntryClass))
-        return;
-    this._isFocusByMouse = false;
-    document.activeElement.blur();
-    event.preventDefault();
-};
diff --git a/Source/core/Resources/panIcon.png b/Source/core/Resources/panIcon.png
deleted file mode 100644
index 4ca8d70..0000000
--- a/Source/core/Resources/panIcon.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/progressCursor.png b/Source/core/Resources/progressCursor.png
deleted file mode 100644
index 25d7021..0000000
--- a/Source/core/Resources/progressCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/southEastResizeCursor.png b/Source/core/Resources/southEastResizeCursor.png
deleted file mode 100644
index 415aa63..0000000
--- a/Source/core/Resources/southEastResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/southResizeCursor.png b/Source/core/Resources/southResizeCursor.png
deleted file mode 100644
index 60cf722..0000000
--- a/Source/core/Resources/southResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/southWestResizeCursor.png b/Source/core/Resources/southWestResizeCursor.png
deleted file mode 100644
index 8dc5cdc..0000000
--- a/Source/core/Resources/southWestResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/textAreaResizeCorner.png b/Source/core/Resources/textAreaResizeCorner.png
deleted file mode 100644
index 66105db..0000000
--- a/Source/core/Resources/textAreaResizeCorner.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/textAreaResizeCorner.tiff b/Source/core/Resources/textAreaResizeCorner.tiff
deleted file mode 100644
index 5eeab60..0000000
--- a/Source/core/Resources/textAreaResizeCorner.tiff
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/textAreaResizeCorner@2x.png b/Source/core/Resources/textAreaResizeCorner@2x.png
deleted file mode 100644
index 7d26fbc..0000000
--- a/Source/core/Resources/textAreaResizeCorner@2x.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/urlIcon.png b/Source/core/Resources/urlIcon.png
deleted file mode 100644
index 53cb354..0000000
--- a/Source/core/Resources/urlIcon.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/verticalTextCursor.png b/Source/core/Resources/verticalTextCursor.png
deleted file mode 100644
index 0f2877c..0000000
--- a/Source/core/Resources/verticalTextCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/waitCursor.png b/Source/core/Resources/waitCursor.png
deleted file mode 100644
index 91412b8..0000000
--- a/Source/core/Resources/waitCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/westResizeCursor.png b/Source/core/Resources/westResizeCursor.png
deleted file mode 100644
index 544439a..0000000
--- a/Source/core/Resources/westResizeCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/zoomInCursor.png b/Source/core/Resources/zoomInCursor.png
deleted file mode 100644
index feec9bc..0000000
--- a/Source/core/Resources/zoomInCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/Resources/zoomOutCursor.png b/Source/core/Resources/zoomOutCursor.png
deleted file mode 100644
index f4a954e..0000000
--- a/Source/core/Resources/zoomOutCursor.png
+++ /dev/null
Binary files differ
diff --git a/Source/core/accessibility/AXObjectCache.cpp b/Source/core/accessibility/AXObjectCache.cpp
index 6b1048c..6b163d6 100644
--- a/Source/core/accessibility/AXObjectCache.cpp
+++ b/Source/core/accessibility/AXObjectCache.cpp
@@ -64,7 +64,7 @@
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/platform/ScrollView.h"
 #include "core/rendering/RenderListBox.h"
@@ -148,7 +148,7 @@
         if (!child->isImageMapLink())
             continue;
 
-        if (static_cast<AccessibilityImageMapLink*>(child)->areaElement() == areaElement)
+        if (toAccessibilityImageMapLink(child)->areaElement() == areaElement)
             return child;
     }
 
@@ -319,7 +319,7 @@
     if (widget->isFrameView())
         newObj = AccessibilityScrollView::create(toScrollView(widget));
     else if (widget->isScrollbar())
-        newObj = AccessibilityScrollbar::create(static_cast<Scrollbar*>(widget));
+        newObj = AccessibilityScrollbar::create(toScrollbar(widget));
 
     // Will crash later if we have two objects for the same widget.
     ASSERT(!get(widget));
@@ -924,7 +924,7 @@
 {
     if (obj && obj->isAccessibilityScrollbar() && notification == AXValueChanged) {
         // Send document value changed on scrollbar value changed notification.
-        Scrollbar* scrollBar = static_cast<AccessibilityScrollbar*>(obj)->scrollbar();
+        Scrollbar* scrollBar = toAccessibilityScrollbar(obj)->scrollbar();
         if (!scrollBar || !scrollBar->parent() || !scrollBar->parent()->isFrameView())
             return;
         Document* document = toFrameView(scrollBar->parent())->frame().document();
diff --git a/Source/core/accessibility/AXObjectCache.h b/Source/core/accessibility/AXObjectCache.h
index 52caa5c..d4a2dc3 100644
--- a/Source/core/accessibility/AXObjectCache.h
+++ b/Source/core/accessibility/AXObjectCache.h
@@ -27,7 +27,7 @@
 #define AXObjectCache_h
 
 #include "core/accessibility/AccessibilityObject.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/Forward.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
diff --git a/Source/core/accessibility/AccessibilityARIAGrid.cpp b/Source/core/accessibility/AccessibilityARIAGrid.cpp
index 73b2fb7..bffabad 100644
--- a/Source/core/accessibility/AccessibilityARIAGrid.cpp
+++ b/Source/core/accessibility/AccessibilityARIAGrid.cpp
@@ -57,7 +57,7 @@
     if (!child || !child->isTableRow() || child->ariaRoleAttribute() != RowRole)
         return false;
 
-    AccessibilityTableRow* row = static_cast<AccessibilityTableRow*>(child);
+    AccessibilityTableRow* row = toAccessibilityTableRow(child);
     if (appendedRows.contains(row))
         return false;
 
@@ -117,7 +117,7 @@
 
     // make the columns based on the number of columns in the first body
     for (unsigned i = 0; i < columnCount; ++i) {
-        AccessibilityTableColumn* column = static_cast<AccessibilityTableColumn*>(axCache->getOrCreate(ColumnRole));
+        AccessibilityTableColumn* column = toAccessibilityTableColumn(axCache->getOrCreate(ColumnRole));
         column->setColumnIndex((int)i);
         column->setParent(this);
         m_columns.append(column);
diff --git a/Source/core/accessibility/AccessibilityARIAGridCell.cpp b/Source/core/accessibility/AccessibilityARIAGridCell.cpp
index c2c17a2..395194c 100644
--- a/Source/core/accessibility/AccessibilityARIAGridCell.cpp
+++ b/Source/core/accessibility/AccessibilityARIAGridCell.cpp
@@ -77,7 +77,7 @@
 
     if (parent->isTableRow()) {
         // We already got a table row, use its API.
-        rowRange.first = static_cast<AccessibilityTableRow*>(parent)->rowIndex();
+        rowRange.first = toAccessibilityTableRow(parent)->rowIndex();
     } else if (parent->isAccessibilityTable()) {
         // We reached the parent table, so we need to inspect its
         // children to determine the row index for the cell in it.
diff --git a/Source/core/accessibility/AccessibilityImageMapLink.h b/Source/core/accessibility/AccessibilityImageMapLink.h
index 92345dc..05941d3 100644
--- a/Source/core/accessibility/AccessibilityImageMapLink.h
+++ b/Source/core/accessibility/AccessibilityImageMapLink.h
@@ -75,6 +75,21 @@
     virtual bool isImageMapLink() const OVERRIDE { return true; }
 };
 
+inline AccessibilityImageMapLink* toAccessibilityImageMapLink(AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isImageMapLink());
+    return static_cast<AccessibilityImageMapLink*>(object);
+}
+
+inline const AccessibilityImageMapLink* toAccessibilityImageMapLink(const AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isImageMapLink());
+    return static_cast<const AccessibilityImageMapLink*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toAccessibilityImageMapLink(const AccessibilityImageMapLink*);
+
 } // namespace WebCore
 
 #endif // AccessibilityImageMapLink_h
diff --git a/Source/core/accessibility/AccessibilityListBox.cpp b/Source/core/accessibility/AccessibilityListBox.cpp
index 3b5e578..327c00c 100644
--- a/Source/core/accessibility/AccessibilityListBox.cpp
+++ b/Source/core/accessibility/AccessibilityListBox.cpp
@@ -94,7 +94,7 @@
     // disable any selected options
     unsigned length = m_children.size();
     for (unsigned i = 0; i < length; i++) {
-        AccessibilityListBoxOption* listBoxOption = static_cast<AccessibilityListBoxOption*>(m_children[i].get());
+        AccessibilityListBoxOption* listBoxOption = toAccessibilityListBoxOption(m_children[i].get());
         if (listBoxOption->isSelected())
             listBoxOption->setSelected(false);
     }
@@ -105,7 +105,7 @@
         if (obj->roleValue() != ListBoxOptionRole)
             continue;
 
-        static_cast<AccessibilityListBoxOption*>(obj)->setSelected(true);
+        toAccessibilityListBoxOption(obj)->setSelected(true);
     }
 }
 
@@ -118,7 +118,7 @@
 
     unsigned length = m_children.size();
     for (unsigned i = 0; i < length; i++) {
-        if (static_cast<AccessibilityListBoxOption*>(m_children[i].get())->isSelected())
+        if (toAccessibilityListBoxOption(m_children[i].get())->isSelected())
             result.append(m_children[i]);
     }
 }
@@ -130,7 +130,7 @@
         return 0;
 
     AccessibilityObject* listBoxObject = m_renderer->document().axObjectCache()->getOrCreate(ListBoxOptionRole);
-    static_cast<AccessibilityListBoxOption*>(listBoxObject)->setHTMLElement(element);
+    toAccessibilityListBoxOption(listBoxObject)->setHTMLElement(element);
 
     return listBoxObject;
 }
diff --git a/Source/core/accessibility/AccessibilityListBoxOption.h b/Source/core/accessibility/AccessibilityListBoxOption.h
index 987b5bc..364273d 100644
--- a/Source/core/accessibility/AccessibilityListBoxOption.h
+++ b/Source/core/accessibility/AccessibilityListBoxOption.h
@@ -66,6 +66,7 @@
 private:
     HTMLElement* m_optionElement;
 
+    virtual bool isListBoxOption() const OVERRIDE { return true; }
     virtual bool canHaveChildren() const OVERRIDE { return false; }
     virtual bool computeAccessibilityIsIgnored() const OVERRIDE;
 
@@ -74,6 +75,21 @@
     AccessibilityObject* listBoxOptionAccessibilityObject(HTMLElement*) const;
 };
 
+inline AccessibilityListBoxOption* toAccessibilityListBoxOption(AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isListBoxOption());
+    return static_cast<AccessibilityListBoxOption*>(object);
+}
+
+inline const AccessibilityListBoxOption* toAccessibilityListBoxOption(const AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isListBoxOption());
+    return static_cast<const AccessibilityListBoxOption*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toAccessibilityListBoxOption(const AccessibilityListBoxOption*);
+
 } // namespace WebCore
 
 #endif // AccessibilityListBoxOption_h
diff --git a/Source/core/accessibility/AccessibilityMediaControls.cpp b/Source/core/accessibility/AccessibilityMediaControls.cpp
index cf694b9..5410c38 100644
--- a/Source/core/accessibility/AccessibilityMediaControls.cpp
+++ b/Source/core/accessibility/AccessibilityMediaControls.cpp
@@ -28,16 +28,22 @@
 
 
 #include "config.h"
-
 #include "core/accessibility/AccessibilityMediaControls.h"
 
-#include "core/platform/LocalizedStrings.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebLocalizedString.h"
 
 namespace WebCore {
 
+using WebKit::WebLocalizedString;
 using namespace HTMLNames;
 
 
+static inline String queryString(WebLocalizedString::Name name)
+{
+    return WebKit::Platform::current()->queryLocalizedString(name);
+}
+
 AccessibilityMediaControl::AccessibilityMediaControl(RenderObject* renderer)
     : AccessibilityRenderObject(renderer)
 {
@@ -71,47 +77,6 @@
     return mediaControlElementType(renderer()->node());
 }
 
-String AccessibilityMediaControl::controlTypeName() const
-{
-    switch (controlType()) {
-    case MediaEnterFullscreenButton:
-        return "EnterFullscreenButton";
-    case MediaExitFullscreenButton:
-        return "ExitFullscreenButton";
-    case MediaMuteButton:
-        return "MuteButton";
-    case MediaPlayButton:
-        return "PlayButton";
-    case MediaSeekBackButton:
-        return "SeekBackButton";
-    case MediaSeekForwardButton:
-        return "SeekForwardButton";
-    case MediaRewindButton:
-        return "RewindButton";
-    case MediaReturnToRealtimeButton:
-        return "ReturnToRealtimeButton";
-    case MediaUnMuteButton:
-        return "UnMuteButton";
-    case MediaPauseButton:
-        return "PauseButton";
-    case MediaStatusDisplay:
-        return "StatusDisplay";
-    case MediaCurrentTimeDisplay:
-        return "CurrentTimeDisplay";
-    case MediaTimeRemainingDisplay:
-        return "TimeRemainingDisplay";
-    case MediaShowClosedCaptionsButton:
-        return "ShowClosedCaptionsButton";
-    case MediaHideClosedCaptionsButton:
-        return "HideClosedCaptionsButton";
-
-    default:
-        break;
-    }
-
-    return String();
-}
-
 void AccessibilityMediaControl::accessibilityText(Vector<AccessibilityText>& textOrder)
 {
     String description = accessibilityDescription();
@@ -130,20 +95,88 @@
 
 String AccessibilityMediaControl::title() const
 {
+    // FIXME: the ControlsPanel container should never be visible in the
+    // accessibility hierarchy.
     if (controlType() == MediaControlsPanel)
-        return localizedMediaControlElementString("ControlsPanel");
+        return queryString(WebLocalizedString::AXMediaDefault);
 
     return AccessibilityRenderObject::title();
 }
 
 String AccessibilityMediaControl::accessibilityDescription() const
 {
-    return localizedMediaControlElementString(controlTypeName());
+    switch (controlType()) {
+    case MediaEnterFullscreenButton:
+        return queryString(WebLocalizedString::AXMediaEnterFullscreenButton);
+    case MediaExitFullscreenButton:
+        return queryString(WebLocalizedString::AXMediaExitFullscreenButton);
+    case MediaMuteButton:
+        return queryString(WebLocalizedString::AXMediaMuteButton);
+    case MediaPlayButton:
+        return queryString(WebLocalizedString::AXMediaPlayButton);
+    case MediaSeekBackButton:
+        return queryString(WebLocalizedString::AXMediaSeekBackButton);
+    case MediaSeekForwardButton:
+        return queryString(WebLocalizedString::AXMediaSeekForwardButton);
+    case MediaRewindButton:
+        return queryString(WebLocalizedString::AXMediaRewindButton);
+    case MediaReturnToRealtimeButton:
+        return queryString(WebLocalizedString::AXMediaReturnToRealTime);
+    case MediaUnMuteButton:
+        return queryString(WebLocalizedString::AXMediaUnMuteButton);
+    case MediaPauseButton:
+        return queryString(WebLocalizedString::AXMediaPauseButton);
+    case MediaStatusDisplay:
+        return queryString(WebLocalizedString::AXMediaStatusDisplay);
+    case MediaCurrentTimeDisplay:
+        return queryString(WebLocalizedString::AXMediaCurrentTimeDisplay);
+    case MediaTimeRemainingDisplay:
+        return queryString(WebLocalizedString::AXMediaTimeRemainingDisplay);
+    case MediaShowClosedCaptionsButton:
+        return queryString(WebLocalizedString::AXMediaShowClosedCaptionsButton);
+    case MediaHideClosedCaptionsButton:
+        return queryString(WebLocalizedString::AXMediaHideClosedCaptionsButton);
+    default:
+        return queryString(WebLocalizedString::AXMediaDefault);
+    }
 }
 
 String AccessibilityMediaControl::helpText() const
 {
-    return localizedMediaControlElementHelpText(controlTypeName());
+    switch (controlType()) {
+    case MediaEnterFullscreenButton:
+        return queryString(WebLocalizedString::AXMediaEnterFullscreenButtonHelp);
+    case MediaExitFullscreenButton:
+        return queryString(WebLocalizedString::AXMediaExitFullscreenButtonHelp);
+    case MediaMuteButton:
+        return queryString(WebLocalizedString::AXMediaMuteButtonHelp);
+    case MediaPlayButton:
+        return queryString(WebLocalizedString::AXMediaPlayButtonHelp);
+    case MediaSeekBackButton:
+        return queryString(WebLocalizedString::AXMediaSeekBackButtonHelp);
+    case MediaSeekForwardButton:
+        return queryString(WebLocalizedString::AXMediaSeekForwardButtonHelp);
+    case MediaRewindButton:
+        return queryString(WebLocalizedString::AXMediaRewindButtonHelp);
+    case MediaReturnToRealtimeButton:
+        return queryString(WebLocalizedString::AXMediaReturnToRealTimeHelp);
+    case MediaUnMuteButton:
+        return queryString(WebLocalizedString::AXMediaUnMuteButtonHelp);
+    case MediaPauseButton:
+        return queryString(WebLocalizedString::AXMediaPauseButtonHelp);
+    case MediaStatusDisplay:
+        return queryString(WebLocalizedString::AXMediaStatusDisplayHelp);
+    case MediaCurrentTimeDisplay:
+        return queryString(WebLocalizedString::AXMediaCurrentTimeDisplayHelp);
+    case MediaTimeRemainingDisplay:
+        return queryString(WebLocalizedString::AXMediaTimeRemainingDisplayHelp);
+    case MediaShowClosedCaptionsButton:
+        return queryString(WebLocalizedString::AXMediaShowClosedCaptionsButtonHelp);
+    case MediaHideClosedCaptionsButton:
+        return queryString(WebLocalizedString::AXMediaHideClosedCaptionsButtonHelp);
+    default:
+        return queryString(WebLocalizedString::AXMediaDefault);
+    }
 }
 
 bool AccessibilityMediaControl::computeAccessibilityIsIgnored() const
@@ -201,12 +234,12 @@
 
 String AccessibilityMediaControlsContainer::accessibilityDescription() const
 {
-    return localizedMediaControlElementString(elementTypeName());
+    return queryString(controllingVideoElement() ? WebLocalizedString::AXMediaVideoElement : WebLocalizedString::AXMediaAudioElement);
 }
 
 String AccessibilityMediaControlsContainer::helpText() const
 {
-    return localizedMediaControlElementHelpText(elementTypeName());
+    return queryString(controllingVideoElement() ? WebLocalizedString::AXMediaVideoElementHelp : WebLocalizedString::AXMediaAudioElementHelp);
 }
 
 bool AccessibilityMediaControlsContainer::controllingVideoElement() const
@@ -219,13 +252,6 @@
     return toParentMediaElement(element)->isVideo();
 }
 
-const String AccessibilityMediaControlsContainer::elementTypeName() const
-{
-    if (controllingVideoElement())
-        return "VideoElement";
-    return "AudioElement";
-}
-
 bool AccessibilityMediaControlsContainer::computeAccessibilityIsIgnored() const
 {
     return accessibilityIsIgnoredByDefault();
@@ -234,6 +260,13 @@
 //
 // AccessibilityMediaTimeline
 
+static String localizedMediaTimeDescription(float /*time*/)
+{
+    // FIXME: To be fixed. See
+    // http://trac.webkit.org/browser/trunk/Source/WebCore/platform/LocalizedStrings.cpp#L928
+    return String();
+}
+
 AccessibilityMediaTimeline::AccessibilityMediaTimeline(RenderObject* renderer)
     : AccessibilitySlider(renderer)
 {
@@ -255,7 +288,7 @@
 
 String AccessibilityMediaTimeline::helpText() const
 {
-    return localizedMediaControlElementHelpText("Slider");
+    return queryString(WebLocalizedString::AXMediaSliderHelp);
 }
 
 
@@ -286,9 +319,8 @@
 String AccessibilityMediaTimeDisplay::accessibilityDescription() const
 {
     if (controlType() == MediaCurrentTimeDisplay)
-        return localizedMediaControlElementString("CurrentTimeDisplay");
-
-    return localizedMediaControlElementString("TimeRemainingDisplay");
+        return queryString(WebLocalizedString::AXMediaCurrentTimeDisplay);
+    return queryString(WebLocalizedString::AXMediaTimeRemainingDisplay);
 }
 
 String AccessibilityMediaTimeDisplay::stringValue() const
diff --git a/Source/core/accessibility/AccessibilityMediaControls.h b/Source/core/accessibility/AccessibilityMediaControls.h
index 4f61bb7..9d3b89a 100644
--- a/Source/core/accessibility/AccessibilityMediaControls.h
+++ b/Source/core/accessibility/AccessibilityMediaControls.h
@@ -50,7 +50,6 @@
 protected:
     explicit AccessibilityMediaControl(RenderObject*);
     MediaControlElementType controlType() const;
-    String controlTypeName() const;
     virtual void accessibilityText(Vector<AccessibilityText>&) OVERRIDE;
     virtual bool computeAccessibilityIsIgnored() const OVERRIDE;
 };
@@ -85,7 +84,6 @@
 private:
     explicit AccessibilityMediaControlsContainer(RenderObject*);
     bool controllingVideoElement() const;
-    const String elementTypeName() const;
     virtual bool computeAccessibilityIsIgnored() const OVERRIDE;
 };
 
diff --git a/Source/core/accessibility/AccessibilityMenuList.cpp b/Source/core/accessibility/AccessibilityMenuList.cpp
index 0cdb6c8..f2580e0 100644
--- a/Source/core/accessibility/AccessibilityMenuList.cpp
+++ b/Source/core/accessibility/AccessibilityMenuList.cpp
@@ -97,7 +97,7 @@
 
 void AccessibilityMenuList::didUpdateActiveOption(int optionIndex)
 {
-    RefPtr<Document> document = &m_renderer->document();
+    RefPtr<Document> document(m_renderer->document());
     AXObjectCache* cache = document->axObjectCache();
 
     const AccessibilityChildrenVector& childObjects = children();
@@ -106,7 +106,7 @@
         ASSERT(childObjects[0]->isMenuListPopup());
 
         if (childObjects[0]->isMenuListPopup()) {
-            if (AccessibilityMenuListPopup* popup = static_cast<AccessibilityMenuListPopup*>(childObjects[0].get()))
+            if (AccessibilityMenuListPopup* popup = toAccessibilityMenuListPopup(childObjects[0].get()))
                 popup->didUpdateActiveOption(optionIndex);
         }
     }
diff --git a/Source/core/accessibility/AccessibilityMenuListOption.h b/Source/core/accessibility/AccessibilityMenuListOption.h
index 91ca5ef..0cda8db 100644
--- a/Source/core/accessibility/AccessibilityMenuListOption.h
+++ b/Source/core/accessibility/AccessibilityMenuListOption.h
@@ -61,6 +61,21 @@
     RefPtr<HTMLElement> m_element;
 };
 
+inline AccessibilityMenuListOption* toAccessibilityMenuListOption(AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isMenuListOption());
+    return static_cast<AccessibilityMenuListOption*>(object);
+}
+
+inline const AccessibilityMenuListOption* toAccessibilityMenuListOption(const AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isMenuListOption());
+    return static_cast<const AccessibilityMenuListOption*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toAccessibilityMenuListOption(const AccessibilityMenuListOption*);
+
 } // namespace WebCore
 
 #endif // AccessibilityMenuListOption_h
diff --git a/Source/core/accessibility/AccessibilityMenuListPopup.cpp b/Source/core/accessibility/AccessibilityMenuListPopup.cpp
index 53fe8fd..ae5ff1f 100644
--- a/Source/core/accessibility/AccessibilityMenuListPopup.cpp
+++ b/Source/core/accessibility/AccessibilityMenuListPopup.cpp
@@ -66,13 +66,13 @@
 
 AccessibilityMenuListOption* AccessibilityMenuListPopup::menuListOptionAccessibilityObject(HTMLElement* element) const
 {
-    if (!element || !element->hasTagName(optionTag) || !element->attached())
+    if (!element || !element->hasTagName(optionTag) || !element->confusingAndOftenMisusedAttached())
         return 0;
 
     AccessibilityObject* object = document()->axObjectCache()->getOrCreate(MenuListOptionRole);
     ASSERT_WITH_SECURITY_IMPLICATION(object->isMenuListOption());
 
-    AccessibilityMenuListOption* option = static_cast<AccessibilityMenuListOption*>(object);
+    AccessibilityMenuListOption* option = toAccessibilityMenuListOption(object);
     option->setElement(element);
 
     return option;
@@ -114,7 +114,7 @@
     AXObjectCache* cache = axObjectCache();
     for (size_t i = m_children.size(); i > 0 ; --i) {
         AccessibilityObject* child = m_children[i - 1].get();
-        if (child->actionElement() && !child->actionElement()->attached()) {
+        if (child->actionElement() && !child->actionElement()->confusingAndOftenMisusedAttached()) {
             child->detachFromParent();
             cache->remove(child->axObjectID());
         }
diff --git a/Source/core/accessibility/AccessibilityMenuListPopup.h b/Source/core/accessibility/AccessibilityMenuListPopup.h
index 1f53a0f..acb4f40 100644
--- a/Source/core/accessibility/AccessibilityMenuListPopup.h
+++ b/Source/core/accessibility/AccessibilityMenuListPopup.h
@@ -44,7 +44,6 @@
 
     void didUpdateActiveOption(int optionIndex);
 
-
 private:
     AccessibilityMenuListPopup();
 
@@ -62,6 +61,21 @@
     AccessibilityMenuListOption* menuListOptionAccessibilityObject(HTMLElement*) const;
 };
 
+inline AccessibilityMenuListPopup* toAccessibilityMenuListPopup(AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isMenuListPopup());
+    return static_cast<AccessibilityMenuListPopup*>(object);
+}
+
+inline const AccessibilityMenuListPopup* toAccessibilityMenuListPopup(const AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isMenuListPopup());
+    return static_cast<const AccessibilityMenuListPopup*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toAccessibilityMenuListPopup(const AccessibilityMenuListPopup*);
+
 } // namespace WebCore
 
 #endif // AccessibilityMenuListPopup_h
diff --git a/Source/core/accessibility/AccessibilityNodeObject.cpp b/Source/core/accessibility/AccessibilityNodeObject.cpp
index 294fd98..0ebddbe 100644
--- a/Source/core/accessibility/AccessibilityNodeObject.cpp
+++ b/Source/core/accessibility/AccessibilityNodeObject.cpp
@@ -32,7 +32,6 @@
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Text.h"
-#include "core/dom/UserGestureIndicator.h"
 #include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLFieldSetElement.h"
 #include "core/html/HTMLFrameElementBase.h"
@@ -42,6 +41,7 @@
 #include "core/html/HTMLSelectElement.h"
 #include "core/html/HTMLTextAreaElement.h"
 #include "core/rendering/RenderObject.h"
+#include "platform/UserGestureIndicator.h"
 #include "wtf/text/StringBuilder.h"
 
 using namespace std;
@@ -406,7 +406,7 @@
 
     // FIXME: Do the continuation search like anchorElement does
     for (Element* element = toElement(node); element; element = element->parentElement()) {
-        if (element->getAttributeEventListener(eventNames().clickEvent) || element->getAttributeEventListener(eventNames().mousedownEvent) || element->getAttributeEventListener(eventNames().mouseupEvent))
+        if (element->getAttributeEventListener(EventTypeNames::click) || element->getAttributeEventListener(EventTypeNames::mousedown) || element->getAttributeEventListener(EventTypeNames::mouseup))
             return element;
     }
 
@@ -653,7 +653,7 @@
             return false;
 
         // Note: we can't call node()->willRespondToMouseClickEvents() because that triggers a style recalc and can delete this.
-        if (node()->hasEventListeners(eventNames().mouseupEvent) || node()->hasEventListeners(eventNames().mousedownEvent) || node()->hasEventListeners(eventNames().clickEvent) || node()->hasEventListeners(eventNames().DOMActivateEvent))
+        if (node()->hasEventListeners(EventTypeNames::mouseup) || node()->hasEventListeners(EventTypeNames::mousedown) || node()->hasEventListeners(EventTypeNames::click) || node()->hasEventListeners(EventTypeNames::DOMActivate))
             return true;
     }
 
diff --git a/Source/core/accessibility/AccessibilityNodeObject.h b/Source/core/accessibility/AccessibilityNodeObject.h
index f49413a..4b45b33 100644
--- a/Source/core/accessibility/AccessibilityNodeObject.h
+++ b/Source/core/accessibility/AccessibilityNodeObject.h
@@ -30,7 +30,7 @@
 #define AccessibilityNodeObject_h
 
 #include "core/accessibility/AccessibilityObject.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
diff --git a/Source/core/accessibility/AccessibilityObject.cpp b/Source/core/accessibility/AccessibilityObject.cpp
index 64f7800..e565f66 100644
--- a/Source/core/accessibility/AccessibilityObject.cpp
+++ b/Source/core/accessibility/AccessibilityObject.cpp
@@ -31,17 +31,19 @@
 
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/NodeTraversal.h"
-#include "core/dom/UserGestureIndicator.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
-#include "core/page/Frame.h"
-#include "core/platform/LocalizedStrings.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderListItem.h"
 #include "core/rendering/RenderTheme.h"
 #include "core/rendering/RenderView.h"
+#include "platform/UserGestureIndicator.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebLocalizedString.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/text/WTFString.h"
 
+using WebKit::WebLocalizedString;
 using namespace std;
 
 namespace WebCore {
@@ -315,6 +317,11 @@
 }
 
 #if HAVE(ACCESSIBILITY)
+static String queryString(WebLocalizedString::Name name)
+{
+    return WebKit::Platform::current()->queryLocalizedString(name);
+}
+
 String AccessibilityObject::actionVerb() const
 {
     // FIXME: Need to add verbs for select elements.
@@ -322,20 +329,22 @@
     switch (roleValue()) {
     case ButtonRole:
     case ToggleButtonRole:
-        return AXButtonActionVerb();
+        return queryString(WebLocalizedString::AXButtonActionVerb);
     case TextFieldRole:
     case TextAreaRole:
-        return AXTextFieldActionVerb();
+        return queryString(WebLocalizedString::AXTextFieldActionVerb);
     case RadioButtonRole:
-        return AXRadioButtonActionVerb();
+        return queryString(WebLocalizedString::AXRadioButtonActionVerb);
     case CheckBoxRole:
-        return isChecked() ? AXCheckedCheckBoxActionVerb() : AXUncheckedCheckBoxActionVerb();
+        return queryString(isChecked() ? WebLocalizedString::AXCheckedCheckBoxActionVerb : WebLocalizedString::AXUncheckedCheckBoxActionVerb);
     case LinkRole:
-        return AXLinkActionVerb();
+        return queryString(WebLocalizedString::AXLinkActionVerb);
     case PopUpButtonRole:
-        return AXMenuListActionVerb();
+        // FIXME: Implement.
+        return String();
     case MenuListPopupRole:
-        return AXMenuListPopupActionVerb();
+        // FIXME: Implement.
+        return String();
     default:
         return emptyString();
     }
diff --git a/Source/core/accessibility/AccessibilityObject.h b/Source/core/accessibility/AccessibilityObject.h
index 72bc24e..6c27e5c 100644
--- a/Source/core/accessibility/AccessibilityObject.h
+++ b/Source/core/accessibility/AccessibilityObject.h
@@ -32,8 +32,8 @@
 
 #include "core/editing/TextIterator.h"
 #include "core/editing/VisiblePosition.h"
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/Forward.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
@@ -334,6 +334,7 @@
     virtual bool isLink() const { return false; }
     virtual bool isList() const { return false; }
     bool isListItem() const { return roleValue() == ListItemRole; }
+    virtual bool isListBoxOption() const { return false; }
     virtual bool isMenu() const { return false; }
     virtual bool isMenuButton() const { return false; }
     virtual bool isMenuList() const { return false; }
@@ -355,6 +356,7 @@
     bool isTabItem() const { return roleValue() == TabRole; }
     virtual bool isTableCell() const { return false; }
     virtual bool isTableRow() const { return false; }
+    virtual bool isTableCol() const { return false; }
     bool isTextControl() const;
     bool isTree() const { return roleValue() == TreeRole; }
     bool isTreeItem() const { return roleValue() == TreeItemRole; }
diff --git a/Source/core/accessibility/AccessibilityProgressIndicator.cpp b/Source/core/accessibility/AccessibilityProgressIndicator.cpp
index 04ed218..3cad359 100644
--- a/Source/core/accessibility/AccessibilityProgressIndicator.cpp
+++ b/Source/core/accessibility/AccessibilityProgressIndicator.cpp
@@ -22,8 +22,8 @@
 #include "core/accessibility/AccessibilityProgressIndicator.h"
 
 #include "core/html/HTMLProgressElement.h"
-#include "core/platform/FloatConversion.h"
 #include "core/rendering/RenderProgress.h"
+#include "platform/FloatConversion.h"
 
 namespace WebCore {
 
diff --git a/Source/core/accessibility/AccessibilityRenderObject.cpp b/Source/core/accessibility/AccessibilityRenderObject.cpp
index e70aaf1..dbe36ef 100644
--- a/Source/core/accessibility/AccessibilityRenderObject.cpp
+++ b/Source/core/accessibility/AccessibilityRenderObject.cpp
@@ -49,9 +49,8 @@
 #include "core/html/HTMLTextAreaElement.h"
 #include "core/html/shadow/ShadowElementNames.h"
 #include "core/loader/ProgressTracker.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
-#include "core/platform/LocalizedStrings.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderFileUploadControl.h"
 #include "core/rendering/RenderHTMLCanvas.h"
@@ -67,8 +66,11 @@
 #include "core/svg/SVGDocument.h"
 #include "core/svg/SVGSVGElement.h"
 #include "core/svg/graphics/SVGImage.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebLocalizedString.h"
 #include "wtf/StdLibExtras.h"
 
+using WebKit::WebLocalizedString;
 using namespace std;
 
 namespace WebCore {
@@ -858,21 +860,26 @@
 // Properties of interactive elements.
 //
 
+static String queryString(WebLocalizedString::Name name)
+{
+    return WebKit::Platform::current()->queryLocalizedString(name);
+}
+
 String AccessibilityRenderObject::actionVerb() const
 {
     switch (roleValue()) {
     case ButtonRole:
     case ToggleButtonRole:
-        return AXButtonActionVerb();
+        return queryString(WebLocalizedString::AXButtonActionVerb);
     case TextFieldRole:
     case TextAreaRole:
-        return AXTextFieldActionVerb();
+        return queryString(WebLocalizedString::AXTextFieldActionVerb);
     case RadioButtonRole:
-        return AXRadioButtonActionVerb();
+        return queryString(WebLocalizedString::AXRadioButtonActionVerb);
     case CheckBoxRole:
-        return isChecked() ? AXCheckedCheckBoxActionVerb() : AXUncheckedCheckBoxActionVerb();
+        return queryString(isChecked() ? WebLocalizedString::AXCheckedCheckBoxActionVerb : WebLocalizedString::AXUncheckedCheckBoxActionVerb);
     case LinkRole:
-        return AXLinkActionVerb();
+        return queryString(WebLocalizedString::AXLinkActionVerb);
     default:
         return emptyString();
     }
@@ -1146,7 +1153,7 @@
         if (Node* node = this->node()) {
             if (Frame* frame = node->document().frame()) {
                 // catch stale WebCoreAXObject (see <rdar://problem/3960196>)
-                if (frame->document() != &node->document())
+                if (frame->document() != node->document())
                     return String();
 
                 return plainText(rangeOfContents(node).get(), textIteratorBehaviorForTextRange());
@@ -2216,7 +2223,7 @@
     for (Element* current = ElementTraversal::firstWithin(map); current; current = ElementTraversal::next(current, map)) {
         // add an <area> element for this child if it has a link
         if (isHTMLAreaElement(current) && current->isLink()) {
-            AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole));
+            AccessibilityImageMapLink* areaObject = toAccessibilityImageMapLink(axObjectCache()->getOrCreate(ImageMapLinkRole));
             areaObject->setHTMLAreaElement(toHTMLAreaElement(current));
             areaObject->setHTMLMapElement(map);
             areaObject->setParent(this);
diff --git a/Source/core/accessibility/AccessibilityRenderObject.h b/Source/core/accessibility/AccessibilityRenderObject.h
index d11a61e..06e8805 100644
--- a/Source/core/accessibility/AccessibilityRenderObject.h
+++ b/Source/core/accessibility/AccessibilityRenderObject.h
@@ -30,7 +30,7 @@
 #define AccessibilityRenderObject_h
 
 #include "core/accessibility/AccessibilityNodeObject.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
diff --git a/Source/core/accessibility/AccessibilityScrollView.cpp b/Source/core/accessibility/AccessibilityScrollView.cpp
index 3e13f5b..6a21693 100644
--- a/Source/core/accessibility/AccessibilityScrollView.cpp
+++ b/Source/core/accessibility/AccessibilityScrollView.cpp
@@ -29,8 +29,8 @@
 #include "core/accessibility/AXObjectCache.h"
 #include "core/accessibility/AccessibilityScrollbar.h"
 #include "core/html/HTMLFrameOwnerElement.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 
 namespace WebCore {
 
@@ -128,7 +128,7 @@
     if (!scrollbar)
         return 0;
 
-    AccessibilityScrollbar* scrollBarObject = static_cast<AccessibilityScrollbar*>(axObjectCache()->getOrCreate(scrollbar));
+    AccessibilityScrollbar* scrollBarObject = toAccessibilityScrollbar(axObjectCache()->getOrCreate(scrollbar));
     scrollBarObject->setParent(this);
     m_children.append(scrollBarObject);
     return scrollBarObject;
diff --git a/Source/core/accessibility/AccessibilityScrollbar.h b/Source/core/accessibility/AccessibilityScrollbar.h
index fe0714a..7696f62 100644
--- a/Source/core/accessibility/AccessibilityScrollbar.h
+++ b/Source/core/accessibility/AccessibilityScrollbar.h
@@ -64,6 +64,21 @@
     RefPtr<Scrollbar> m_scrollbar;
 };
 
+inline AccessibilityScrollbar* toAccessibilityScrollbar(AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isAccessibilityScrollbar());
+    return static_cast<AccessibilityScrollbar*>(object);
+}
+
+inline const AccessibilityScrollbar* toAccessibilityScrollbar(const AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isAccessibilityScrollbar());
+    return static_cast<const AccessibilityScrollbar*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toAccessibilityScrollbar(const AccessibilityScrollbar*);
+
 } // namespace WebCore
 
 #endif // AccessibilityScrollbar_h
diff --git a/Source/core/accessibility/AccessibilityTable.cpp b/Source/core/accessibility/AccessibilityTable.cpp
index 0eb0832..0e7590d 100644
--- a/Source/core/accessibility/AccessibilityTable.cpp
+++ b/Source/core/accessibility/AccessibilityTable.cpp
@@ -354,7 +354,7 @@
             if (!rowObject->isTableRow())
                 continue;
 
-            AccessibilityTableRow* row = static_cast<AccessibilityTableRow*>(rowObject);
+            AccessibilityTableRow* row = toAccessibilityTableRow(rowObject);
             // We need to check every cell for a new row, because cell spans
             // can cause us to miss rows if we just check the first column.
             if (appendedRows.contains(row))
@@ -373,7 +373,7 @@
     // make the columns based on the number of columns in the first body
     unsigned length = initialTableSection->numColumns();
     for (unsigned i = 0; i < length; ++i) {
-        AccessibilityTableColumn* column = static_cast<AccessibilityTableColumn*>(axCache->getOrCreate(ColumnRole));
+        AccessibilityTableColumn* column = toAccessibilityTableColumn(axCache->getOrCreate(ColumnRole));
         column->setColumnIndex((int)i);
         column->setParent(this);
         m_columns.append(column);
@@ -421,7 +421,7 @@
 
     unsigned colCount = m_columns.size();
     for (unsigned k = 0; k < colCount; ++k) {
-        AccessibilityObject* header = static_cast<AccessibilityTableColumn*>(m_columns[k].get())->headerObject();
+        AccessibilityObject* header = toAccessibilityTableColumn(m_columns[k].get())->headerObject();
         if (!header)
             continue;
         headers.append(header);
@@ -488,7 +488,7 @@
 
             pair<unsigned, unsigned> columnRange;
             pair<unsigned, unsigned> rowRange;
-            AccessibilityTableCell* tableCellChild = static_cast<AccessibilityTableCell*>(child);
+            AccessibilityTableCell* tableCellChild = toAccessibilityTableCell(child);
             tableCellChild->columnIndexRange(columnRange);
             tableCellChild->rowIndexRange(rowRange);
 
diff --git a/Source/core/accessibility/AccessibilityTableCell.h b/Source/core/accessibility/AccessibilityTableCell.h
index 844c56a..46959f4 100644
--- a/Source/core/accessibility/AccessibilityTableCell.h
+++ b/Source/core/accessibility/AccessibilityTableCell.h
@@ -60,6 +60,21 @@
     virtual bool computeAccessibilityIsIgnored() const OVERRIDE;
 };
 
+inline AccessibilityTableCell* toAccessibilityTableCell(AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableCell());
+    return static_cast<AccessibilityTableCell*>(object);
+}
+
+inline const AccessibilityTableCell* toAccessibilityTableCell(const AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableCell());
+    return static_cast<const AccessibilityTableCell*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toAccessibilityTableCell(const AccessibilityTableCell*);
+
 } // namespace WebCore
 
 #endif // AccessibilityTableCell_h
diff --git a/Source/core/accessibility/AccessibilityTableColumn.h b/Source/core/accessibility/AccessibilityTableColumn.h
index 09de7ec..bf0ffd3 100644
--- a/Source/core/accessibility/AccessibilityTableColumn.h
+++ b/Source/core/accessibility/AccessibilityTableColumn.h
@@ -60,10 +60,26 @@
     unsigned m_columnIndex;
     LayoutRect m_columnRect;
 
+    virtual bool isTableCol() const OVERRIDE { return true; }
     AccessibilityObject* headerObjectForSection(RenderTableSection*, bool thTagRequired);
     virtual bool computeAccessibilityIsIgnored() const OVERRIDE;
 };
 
+inline AccessibilityTableColumn* toAccessibilityTableColumn(AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableCol());
+    return static_cast<AccessibilityTableColumn*>(object);
+}
+
+inline const AccessibilityTableColumn* toAccessibilityTableColumn(const AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableCol());
+    return static_cast<const AccessibilityTableColumn*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toAccessibilityTableColumn(const AccessibilityTableColumn*);
+
 } // namespace WebCore
 
 #endif // AccessibilityTableColumn_h
diff --git a/Source/core/accessibility/AccessibilityTableRow.cpp b/Source/core/accessibility/AccessibilityTableRow.cpp
index 89da3f7..1d919e0 100644
--- a/Source/core/accessibility/AccessibilityTableRow.cpp
+++ b/Source/core/accessibility/AccessibilityTableRow.cpp
@@ -118,7 +118,7 @@
     if (!cell->isTableCell())
         return 0;
 
-    RenderObject* cellRenderer = static_cast<AccessibilityTableCell*>(cell)->renderer();
+    RenderObject* cellRenderer = toAccessibilityTableCell(cell)->renderer();
     if (!cellRenderer)
         return 0;
 
diff --git a/Source/core/accessibility/AccessibilityTableRow.h b/Source/core/accessibility/AccessibilityTableRow.h
index 3f9faa9..3a0a6a1 100644
--- a/Source/core/accessibility/AccessibilityTableRow.h
+++ b/Source/core/accessibility/AccessibilityTableRow.h
@@ -64,6 +64,21 @@
     virtual bool computeAccessibilityIsIgnored() const OVERRIDE;
 };
 
+inline AccessibilityTableRow* toAccessibilityTableRow(AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableRow());
+    return static_cast<AccessibilityTableRow*>(object);
+}
+
+inline const AccessibilityTableRow* toAccessibilityTableRow(const AccessibilityObject* object)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isTableRow());
+    return static_cast<const AccessibilityTableRow*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toAccessibilityTableRow(const AccessibilityTableRow*);
+
 } // namespace WebCore
 
 #endif // AccessibilityTableRow_h
diff --git a/Source/core/animation/ActiveAnimations.h b/Source/core/animation/ActiveAnimations.h
index b57283b..c411b5a 100644
--- a/Source/core/animation/ActiveAnimations.h
+++ b/Source/core/animation/ActiveAnimations.h
@@ -44,13 +44,10 @@
     // Animations that are currently active for this element, their effects will be applied
     // during a style recalc.
     AnimationStack* defaultStack() { return &m_defaultStack; }
-    // Tracks the state of active CSS Animations. The individual animations will also be
-    // part of the default stack, but the mapping betwen animation name and player is kept
-    // here.
+    // Tracks the state of active CSS Animations and Transitions. The individual animations
+    // will also be part of the default stack, but the mapping betwen animation name and
+    // player is kept here.
     CSSAnimations* cssAnimations() { return &m_cssAnimations; }
-    // FIXME: Add AnimationStack for CSS Transitions
-    // CSS Transitions form a separate animation stack as they apply at a different level of
-    // the style cascade. Active transitions will not be present in the default stack.
     bool isEmpty() const { return m_defaultStack.isEmpty() && m_cssAnimations.isEmpty(); }
 private:
     AnimationStack m_defaultStack;
diff --git a/Source/core/animation/AnimatableClipPathOperation.cpp b/Source/core/animation/AnimatableClipPathOperation.cpp
new file mode 100644
index 0000000..6312682
--- /dev/null
+++ b/Source/core/animation/AnimatableClipPathOperation.cpp
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableClipPathOperation.h"
+
+namespace WebCore {
+
+PassRefPtr<AnimatableValue> AnimatableClipPathOperation::interpolateTo(const AnimatableValue* value, double fraction) const
+{
+    const AnimatableClipPathOperation* toOperation = toAnimatableClipPathOperation(value);
+
+    if (m_operation->getOperationType() != ClipPathOperation::SHAPE || toOperation->m_operation->getOperationType() != ClipPathOperation::SHAPE)
+        return defaultInterpolateTo(this, value, fraction);
+
+    const BasicShape* fromShape = static_cast<ShapeClipPathOperation*>(clipPathOperation())->basicShape();
+    const BasicShape* toShape = static_cast<ShapeClipPathOperation*>(toOperation->clipPathOperation())->basicShape();
+
+    if (!fromShape->canBlend(toShape))
+        return defaultInterpolateTo(this, value, fraction);
+
+    return AnimatableClipPathOperation::create(ShapeClipPathOperation::create(toShape->blend(fromShape, fraction)).get());
+}
+
+bool AnimatableClipPathOperation::equalTo(const AnimatableValue* value) const
+{
+    const ClipPathOperation* operation = toAnimatableClipPathOperation(value)->m_operation.get();
+    return m_operation == operation || (m_operation && operation && *m_operation == *operation);
+}
+
+}
diff --git a/Source/core/animation/AnimatableClipPathOperation.h b/Source/core/animation/AnimatableClipPathOperation.h
new file mode 100644
index 0000000..0659731
--- /dev/null
+++ b/Source/core/animation/AnimatableClipPathOperation.h
@@ -0,0 +1,70 @@
+/*
+ * 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 AnimatableClipPathOperation_h
+#define AnimatableClipPathOperation_h
+
+#include "core/animation/AnimatableValue.h"
+#include "core/rendering/ClipPathOperation.h"
+
+namespace WebCore {
+
+class AnimatableClipPathOperation : public AnimatableValue {
+public:
+    virtual ~AnimatableClipPathOperation() { }
+    static PassRefPtr<AnimatableClipPathOperation> create(ClipPathOperation* operation)
+    {
+        return adoptRef(new AnimatableClipPathOperation(operation));
+    }
+    ClipPathOperation* clipPathOperation() const { return m_operation.get(); }
+
+protected:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+
+private:
+    AnimatableClipPathOperation(ClipPathOperation* operation)
+        : m_operation(operation)
+    {
+    }
+    virtual AnimatableType type() const OVERRIDE { return TypeClipPathOperation; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
+
+    RefPtr<ClipPathOperation> m_operation;
+};
+
+inline const AnimatableClipPathOperation* toAnimatableClipPathOperation(const AnimatableValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(value && value->isClipPathOperation());
+    return static_cast<const AnimatableClipPathOperation*>(value);
+}
+
+} // namespace WebCore
+
+#endif // AnimatableClipPathOperation_h
diff --git a/Source/core/animation/AnimatableColor.cpp b/Source/core/animation/AnimatableColor.cpp
index c1da47b..873e473 100644
--- a/Source/core/animation/AnimatableColor.cpp
+++ b/Source/core/animation/AnimatableColor.cpp
@@ -55,7 +55,7 @@
 Color AnimatableColorImpl::toColor() const
 {
     if (!m_alpha)
-        return Color();
+        return Color::transparent;
     return Color(m_red / m_alpha, m_green / m_alpha, m_blue / m_alpha, m_alpha);
 }
 
@@ -75,6 +75,14 @@
         m_alpha + addend.m_alpha);
 }
 
+bool AnimatableColorImpl::operator==(const AnimatableColorImpl& other) const
+{
+    return m_red == other.m_red
+        && m_green == other.m_green
+        && m_blue == other.m_blue
+        && m_alpha == other.m_alpha;
+}
+
 PassRefPtr<AnimatableColor> AnimatableColor::create(const AnimatableColorImpl& color, const AnimatableColorImpl& visitedLinkColor)
 {
     return adoptRef(new AnimatableColor(color, visitedLinkColor));
@@ -94,4 +102,10 @@
         m_visitedLinkColor.addWith(color->m_visitedLinkColor));
 }
 
+bool AnimatableColor::equalTo(const AnimatableValue* value) const
+{
+    const AnimatableColor* color = toAnimatableColor(value);
+    return m_color == color->m_color && m_visitedLinkColor == color->m_visitedLinkColor;
+}
+
 } // namespace WebCore
diff --git a/Source/core/animation/AnimatableColor.h b/Source/core/animation/AnimatableColor.h
index 63db667..51f5264 100644
--- a/Source/core/animation/AnimatableColor.h
+++ b/Source/core/animation/AnimatableColor.h
@@ -43,6 +43,7 @@
     Color toColor() const;
     AnimatableColorImpl interpolateTo(const AnimatableColorImpl&, double fraction) const;
     AnimatableColorImpl addWith(const AnimatableColorImpl&) const;
+    bool operator==(const AnimatableColorImpl&) const;
 
 private:
     float m_alpha;
@@ -51,21 +52,28 @@
     float m_blue;
 };
 
+// This class handles both the regular and 'visted link' colors for a given
+// property. Currently it is used for all properties, even those which do not
+// support a separate 'visited link' color (eg SVG properties). This is correct
+// but inefficient.
 class AnimatableColor : public AnimatableValue {
 public:
     static PassRefPtr<AnimatableColor> create(const AnimatableColorImpl&, const AnimatableColorImpl& visitedLinkColor);
-    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
-    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
     Color color() const { return m_color.toColor(); }
     Color visitedLinkColor() const { return m_visitedLinkColor.toColor(); }
 
+protected:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
+
 private:
     AnimatableColor(const AnimatableColorImpl& color, const AnimatableColorImpl& visitedLinkColor)
-        : AnimatableValue(TypeColor)
-        , m_color(color)
+        : m_color(color)
         , m_visitedLinkColor(visitedLinkColor)
     {
     }
+    virtual AnimatableType type() const OVERRIDE { return TypeColor; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
     const AnimatableColorImpl m_color;
     const AnimatableColorImpl m_visitedLinkColor;
 };
diff --git a/Source/core/animation/AnimatableColorTest.cpp b/Source/core/animation/AnimatableColorTest.cpp
index 452c172..d280504 100644
--- a/Source/core/animation/AnimatableColorTest.cpp
+++ b/Source/core/animation/AnimatableColorTest.cpp
@@ -37,6 +37,16 @@
 
 namespace {
 
+TEST(AnimatableColorImpl, ToColor)
+{
+    Color transparent = AnimatableColorImpl(Color::transparent).toColor();
+    EXPECT_TRUE(transparent.isValid());
+    EXPECT_EQ(transparent.rgb(), Color::transparent);
+    Color red = AnimatableColorImpl(Color(0xFFFF0000)).toColor();
+    EXPECT_TRUE(red.isValid());
+    EXPECT_EQ(red.rgb(), 0xFFFF0000);
+}
+
 TEST(AnimatableColorImpl, Interpolate)
 {
     EXPECT_EQ(AnimatableColorImpl(Color(0xFF00FF00)).interpolateTo(Color(0xFF00FF00), -10).toColor().rgb(), 0xFF00FF00);
diff --git a/Source/core/animation/AnimatableDouble.cpp b/Source/core/animation/AnimatableDouble.cpp
new file mode 100644
index 0000000..7f7f401
--- /dev/null
+++ b/Source/core/animation/AnimatableDouble.cpp
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableDouble.h"
+
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSValuePool.h"
+#include "core/platform/animation/AnimationUtilities.h"
+
+namespace WebCore {
+
+PassRefPtr<CSSValue> AnimatableDouble::toCSSValue() const
+{
+    return cssValuePool().createValue(m_number, CSSPrimitiveValue::CSS_NUMBER);
+}
+
+PassRefPtr<AnimatableValue> AnimatableDouble::interpolateTo(const AnimatableValue* value, double fraction) const
+{
+    const AnimatableDouble* other = toAnimatableDouble(value);
+    ASSERT(m_constraint == other->m_constraint);
+    if ((m_constraint == InterpolationIsNonContinuousWithZero) && (!m_number || !other->m_number))
+        return defaultInterpolateTo(this, value, fraction);
+    return AnimatableDouble::create(blend(m_number, other->m_number, fraction));
+}
+
+PassRefPtr<AnimatableValue> AnimatableDouble::addWith(const AnimatableValue* value) const
+{
+    // Optimization for adding with 0.
+    if (!m_number)
+        return takeConstRef(value);
+    const AnimatableDouble* other = toAnimatableDouble(value);
+    if (!other->m_number)
+        return takeConstRef(this);
+
+    return AnimatableDouble::create(m_number + other->m_number);
+}
+
+bool AnimatableDouble::equalTo(const AnimatableValue* value) const
+{
+    return m_number == toAnimatableDouble(value)->m_number;
+}
+
+} // namespace WebCore
diff --git a/Source/core/animation/AnimatableDouble.h b/Source/core/animation/AnimatableDouble.h
new file mode 100644
index 0000000..ffd921f
--- /dev/null
+++ b/Source/core/animation/AnimatableDouble.h
@@ -0,0 +1,81 @@
+/*
+ * 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 AnimatableDouble_h
+#define AnimatableDouble_h
+
+#include "core/animation/AnimatableValue.h"
+#include "core/css/CSSValue.h"
+
+namespace WebCore {
+
+class AnimatableDouble : public AnimatableValue {
+public:
+    virtual ~AnimatableDouble() { }
+
+    enum Constraint {
+        Unconstrained,
+        InterpolationIsNonContinuousWithZero,
+    };
+
+    static PassRefPtr<AnimatableDouble> create(double number, Constraint constraint = Unconstrained)
+    {
+        return adoptRef(new AnimatableDouble(number, constraint));
+    }
+
+    PassRefPtr<CSSValue> toCSSValue() const;
+    double toDouble() const { return m_number; }
+
+protected:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
+
+private:
+    AnimatableDouble(double number, Constraint constraint)
+        : m_number(number)
+        , m_constraint(constraint)
+    {
+    }
+    virtual AnimatableType type() const OVERRIDE { return TypeDouble; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
+
+    double m_number;
+    Constraint m_constraint;
+};
+
+inline const AnimatableDouble* toAnimatableDouble(const AnimatableValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(value && value->isDouble());
+    return static_cast<const AnimatableDouble*>(value);
+}
+
+} // namespace WebCore
+
+#endif // AnimatableDouble_h
diff --git a/Source/core/animation/AnimatableDoubleTest.cpp b/Source/core/animation/AnimatableDoubleTest.cpp
new file mode 100644
index 0000000..8da8c7f
--- /dev/null
+++ b/Source/core/animation/AnimatableDoubleTest.cpp
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableDouble.h"
+
+#include "core/css/CSSPrimitiveValue.h"
+
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+
+namespace {
+
+TEST(AnimatableDoubleTest, Create)
+{
+    EXPECT_TRUE(static_cast<bool>(AnimatableDouble::create(5).get()));
+    EXPECT_TRUE(static_cast<bool>(AnimatableDouble::create(10).get()));
+}
+
+TEST(AnimatableDoubleTest, Equal)
+{
+    EXPECT_TRUE(AnimatableDouble::create(10)->equals(AnimatableDouble::create(10).get()));
+    EXPECT_FALSE(AnimatableDouble::create(5)->equals(AnimatableDouble::create(10).get()));
+}
+
+TEST(AnimatableDoubleTest, ToCSSValue)
+{
+    RefPtr<CSSValue> cssValue5 = CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_NUMBER);
+    RefPtr<CSSValue> cssValue10 = CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_NUMBER);
+    EXPECT_TRUE(AnimatableDouble::create(5)->toCSSValue()->equals(*cssValue5.get()));
+    EXPECT_FALSE(AnimatableDouble::create(5)->toCSSValue()->equals(*cssValue10.get()));
+}
+
+TEST(AnimatableDoubleTest, ToDouble)
+{
+    EXPECT_EQ(5.9, AnimatableDouble::create(5.9)->toDouble());
+    EXPECT_EQ(-10, AnimatableDouble::create(-10)->toDouble());
+}
+
+
+TEST(AnimatableDoubleTest, Interpolate)
+{
+    RefPtr<AnimatableDouble> from10 = AnimatableDouble::create(10);
+    RefPtr<AnimatableDouble> to20 = AnimatableDouble::create(20);
+    EXPECT_EQ(5, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get())->toDouble());
+    EXPECT_EQ(10, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0).get())->toDouble());
+    EXPECT_EQ(14, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get())->toDouble());
+    EXPECT_EQ(15, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get())->toDouble());
+    EXPECT_EQ(16, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get())->toDouble());
+    EXPECT_EQ(20, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 1).get())->toDouble());
+    EXPECT_EQ(25, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())->toDouble());
+}
+
+TEST(AnimatableDoubleTest, Add)
+{
+    EXPECT_EQ(-10, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::create(-2).get(), AnimatableDouble::create(-8).get()).get())->toDouble());
+    EXPECT_EQ(0, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::create(50).get(), AnimatableDouble::create(-50).get()).get())->toDouble());
+    EXPECT_EQ(10, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::create(4).get(), AnimatableDouble::create(6).get()).get())->toDouble());
+    EXPECT_EQ(20, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::create(0).get(), AnimatableDouble::create(20).get()).get())->toDouble());
+    EXPECT_EQ(30, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::create(30).get(), AnimatableDouble::create(0).get()).get())->toDouble());
+}
+
+}
diff --git a/Source/core/animation/AnimatableImage.cpp b/Source/core/animation/AnimatableImage.cpp
index 3eaf0c7..b28b0a3 100644
--- a/Source/core/animation/AnimatableImage.cpp
+++ b/Source/core/animation/AnimatableImage.cpp
@@ -39,7 +39,8 @@
 
 PassRefPtr<AnimatableValue> AnimatableImage::interpolateTo(const AnimatableValue* value, double fraction) const
 {
-    const AnimatableImage* image = toAnimatableImage(value);
+    if (fraction <= 0 || fraction >= 1)
+        return defaultInterpolateTo(this, value, fraction);
     RefPtr<CSSValue> fromValue = this->toCSSValue();
     if (!fromValue->isImageValue() && !fromValue->isImageGeneratorValue()) {
         if (!m_image->isImageResource())
@@ -47,6 +48,7 @@
         ImageResource* resource = static_cast<ImageResource*>(m_image->data());
         fromValue = CSSImageValue::create(resource->url(), m_image.get());
     }
+    const AnimatableImage* image = toAnimatableImage(value);
     RefPtr<CSSValue> toValue = image->toCSSValue();
     if (!toValue->isImageValue() && !toValue->isImageGeneratorValue()) {
         if (!image->m_image->isImageResource())
@@ -55,7 +57,7 @@
         toValue = CSSImageValue::create(resource->url(), image->m_image.get());
     }
     RefPtr<CSSCrossfadeValue> crossfadeValue = CSSCrossfadeValue::create(fromValue, toValue);
-    crossfadeValue->setPercentage(CSSPrimitiveValue::create(clampTo<double>(fraction, 0.0, 1.0), CSSPrimitiveValue::CSS_NUMBER));
+    crossfadeValue->setPercentage(CSSPrimitiveValue::create(fraction, CSSPrimitiveValue::CSS_NUMBER));
     return create(StyleGeneratedImage::create(crossfadeValue.get()).get());
 }
 
@@ -65,4 +67,9 @@
     return defaultAddWith(this, value);
 }
 
+bool AnimatableImage::equalTo(const AnimatableValue* value) const
+{
+    return StyleImage::imagesEquivalent(m_image.get(), toAnimatableImage(value)->m_image.get());
+}
+
 }
diff --git a/Source/core/animation/AnimatableImage.h b/Source/core/animation/AnimatableImage.h
index 81e2463..ae048d2 100644
--- a/Source/core/animation/AnimatableImage.h
+++ b/Source/core/animation/AnimatableImage.h
@@ -53,11 +53,12 @@
 
 private:
     AnimatableImage(StyleImage* image)
-        : AnimatableValue(TypeImage)
-        , m_image(image)
+        : m_image(image)
     {
         ASSERT(m_image);
     }
+    virtual AnimatableType type() const OVERRIDE { return TypeImage; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
 
     const RefPtr<StyleImage> m_image;
 };
diff --git a/Source/core/animation/AnimatableLength.cpp b/Source/core/animation/AnimatableLength.cpp
new file mode 100644
index 0000000..44827d3
--- /dev/null
+++ b/Source/core/animation/AnimatableLength.cpp
@@ -0,0 +1,221 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableLength.h"
+
+#include "core/css/CSSPrimitiveValueMappings.h"
+#include "core/platform/CalculationValue.h"
+#include "core/platform/animation/AnimationUtilities.h"
+
+namespace WebCore {
+
+PassRefPtr<AnimatableLength> AnimatableLength::create(CSSValue* value)
+{
+    ASSERT(canCreateFrom(value));
+    if (value->isPrimitiveValue()) {
+        CSSPrimitiveValue* primitiveValue = WebCore::toCSSPrimitiveValue(value);
+        const CSSCalcValue* calcValue = primitiveValue->cssCalcValue();
+        if (calcValue)
+            return create(calcValue->expressionNode(), primitiveValue);
+        NumberUnitType unitType = primitiveUnitToNumberType(primitiveValue->primitiveType());
+        ASSERT(unitType != UnitTypeInvalid);
+        const double scale = CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(primitiveValue->primitiveType());
+        return create(primitiveValue->getDoubleValue() * scale, unitType, primitiveValue);
+    }
+
+    if (value->isCalcValue())
+        return create(toCSSCalcValue(value)->expressionNode());
+
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+bool AnimatableLength::canCreateFrom(const CSSValue* value)
+{
+    ASSERT(value);
+    if (value->isPrimitiveValue()) {
+        const CSSPrimitiveValue* primitiveValue = WebCore::toCSSPrimitiveValue(value);
+        if (primitiveValue->cssCalcValue())
+            return true;
+        return primitiveUnitToNumberType(primitiveValue->primitiveType()) != UnitTypeInvalid;
+    }
+    return value->isCalcValue();
+}
+
+PassRefPtr<CSSValue> AnimatableLength::toCSSValue(NumberRange range) const
+{
+    return toCSSPrimitiveValue(range);
+}
+
+Length AnimatableLength::toLength(const RenderStyle* style, const RenderStyle* rootStyle, double zoom, NumberRange range) const
+{
+    if (!m_isCalc) {
+        // Avoid creating a CSSValue in the common cases
+        if (m_unitType == UnitTypePixels)
+            return Length(clampedNumber(range) * zoom, Fixed);
+        if (m_unitType == UnitTypePercentage)
+            return Length(clampedNumber(range), Percent);
+    }
+    return toCSSPrimitiveValue(range)->convertToLength<AnyConversion>(style, rootStyle, zoom);
+}
+
+PassRefPtr<AnimatableValue> AnimatableLength::interpolateTo(const AnimatableValue* value, double fraction) const
+{
+    const AnimatableLength* length = toAnimatableLength(value);
+    if (hasSameUnitType(*length))
+        return AnimatableLength::create(blend(m_number, length->m_number, fraction), m_unitType);
+    return AnimatableLength::create(scale(1 - fraction).get(), length->scale(fraction).get());
+}
+
+PassRefPtr<AnimatableValue> AnimatableLength::addWith(const AnimatableValue* value) const
+{
+    // Optimization for adding with 0.
+    if (!m_isCalc && !m_number)
+        return takeConstRef(value);
+    const AnimatableLength* length = toAnimatableLength(value);
+    if (!length->m_isCalc && !length->m_number)
+        return takeConstRef(this);
+
+    if (hasSameUnitType(*length))
+        return AnimatableLength::create(m_number + length->m_number, m_unitType);
+    return AnimatableLength::create(this, length);
+}
+
+bool AnimatableLength::equalTo(const AnimatableValue* value) const
+{
+    const AnimatableLength* length = toAnimatableLength(value);
+    if (m_isCalc != length->m_isCalc)
+        return false;
+    if (m_isCalc && length->m_isCalc)
+        return m_calcExpression == length->m_calcExpression || m_calcExpression->equals(*length->m_calcExpression);
+    return m_number == length->m_number && m_unitType == length->m_unitType;
+}
+
+PassRefPtr<CSSCalcExpressionNode> AnimatableLength::toCSSCalcExpressionNode() const
+{
+    if (m_isCalc)
+        return m_calcExpression;
+    return CSSCalcValue::createExpressionNode(toCSSPrimitiveValue(AllValues), m_number == trunc(m_number));
+}
+
+static bool isCompatibleWithRange(const CSSPrimitiveValue* primitiveValue, NumberRange range)
+{
+    ASSERT(primitiveValue);
+    if (range == AllValues)
+        return true;
+    if (primitiveValue->isCalculated())
+        return primitiveValue->cssCalcValue()->permittedValueRange() == ValueRangeNonNegative;
+    return primitiveValue->getDoubleValue() >= 0;
+}
+
+PassRefPtr<CSSPrimitiveValue> AnimatableLength::toCSSPrimitiveValue(NumberRange range) const
+{
+    ASSERT(m_unitType != UnitTypeInvalid);
+    if (!m_cachedCSSPrimitiveValue || !isCompatibleWithRange(m_cachedCSSPrimitiveValue.get(), range)) {
+        if (m_isCalc)
+            m_cachedCSSPrimitiveValue = CSSPrimitiveValue::create(CSSCalcValue::create(m_calcExpression, range == AllValues ? ValueRangeAll : ValueRangeNonNegative));
+        else
+            m_cachedCSSPrimitiveValue = CSSPrimitiveValue::create(clampedNumber(range), static_cast<CSSPrimitiveValue::UnitTypes>(numberTypeToPrimitiveUnit(m_unitType)));
+    }
+    return m_cachedCSSPrimitiveValue;
+}
+
+PassRefPtr<AnimatableLength> AnimatableLength::scale(double factor) const
+{
+    if (m_isCalc) {
+        return AnimatableLength::create(CSSCalcValue::createExpressionNode(
+            m_calcExpression,
+            CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(factor, CSSPrimitiveValue::CSS_NUMBER)),
+            CalcMultiply));
+    }
+    return AnimatableLength::create(m_number * factor, m_unitType);
+}
+
+AnimatableLength::NumberUnitType AnimatableLength::primitiveUnitToNumberType(unsigned short primitiveUnit)
+{
+    switch (primitiveUnit) {
+    case CSSPrimitiveValue::CSS_PX:
+    case CSSPrimitiveValue::CSS_CM:
+    case CSSPrimitiveValue::CSS_MM:
+    case CSSPrimitiveValue::CSS_IN:
+    case CSSPrimitiveValue::CSS_PT:
+    case CSSPrimitiveValue::CSS_PC:
+        return UnitTypePixels;
+    case CSSPrimitiveValue::CSS_EMS:
+        return UnitTypeFontSize;
+    case CSSPrimitiveValue::CSS_EXS:
+        return UnitTypeFontXSize;
+    case CSSPrimitiveValue::CSS_REMS:
+        return UnitTypeRootFontSize;
+    case CSSPrimitiveValue::CSS_PERCENTAGE:
+        return UnitTypePercentage;
+    case CSSPrimitiveValue::CSS_VW:
+        return UnitTypeViewportWidth;
+    case CSSPrimitiveValue::CSS_VH:
+        return UnitTypeViewportHeight;
+    case CSSPrimitiveValue::CSS_VMIN:
+        return UnitTypeViewportMin;
+    case CSSPrimitiveValue::CSS_VMAX:
+        return UnitTypeViewportMax;
+    default:
+        return UnitTypeInvalid;
+    }
+}
+
+unsigned short AnimatableLength::numberTypeToPrimitiveUnit(NumberUnitType numberType)
+{
+    switch (numberType) {
+    case UnitTypePixels:
+        return CSSPrimitiveValue::CSS_PX;
+    case UnitTypeFontSize:
+        return CSSPrimitiveValue::CSS_EMS;
+    case UnitTypeFontXSize:
+        return CSSPrimitiveValue::CSS_EXS;
+    case UnitTypeRootFontSize:
+        return CSSPrimitiveValue::CSS_REMS;
+    case UnitTypePercentage:
+        return CSSPrimitiveValue::CSS_PERCENTAGE;
+    case UnitTypeViewportWidth:
+        return CSSPrimitiveValue::CSS_VW;
+    case UnitTypeViewportHeight:
+        return CSSPrimitiveValue::CSS_VH;
+    case UnitTypeViewportMin:
+        return CSSPrimitiveValue::CSS_VMIN;
+    case UnitTypeViewportMax:
+        return CSSPrimitiveValue::CSS_VMAX;
+    case UnitTypeInvalid:
+        return CSSPrimitiveValue::CSS_UNKNOWN;
+    }
+    ASSERT_NOT_REACHED();
+    return CSSPrimitiveValue::CSS_UNKNOWN;
+}
+
+} // namespace WebCore
diff --git a/Source/core/animation/AnimatableLength.h b/Source/core/animation/AnimatableLength.h
new file mode 100644
index 0000000..87e9b9e
--- /dev/null
+++ b/Source/core/animation/AnimatableLength.h
@@ -0,0 +1,141 @@
+/*
+ * 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 AnimatableLength_h
+#define AnimatableLength_h
+
+#include "core/animation/AnimatableValue.h"
+#include "core/css/CSSCalculationValue.h"
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/platform/Length.h"
+
+namespace WebCore {
+
+enum NumberRange {
+    AllValues,
+    NonNegativeValues,
+};
+
+// Handles animation of CSS length and percentage values including CSS calc.
+// See primitiveUnitToNumberType() for the list of supported units (with the exception of calc).
+// If created from a CSSPrimitiveValue this class will cache it to be returned in toCSSValue().
+class AnimatableLength : public AnimatableValue {
+public:
+    enum NumberUnitType {
+        UnitTypePixels,
+        UnitTypePercentage,
+        UnitTypeFontSize,
+        UnitTypeFontXSize,
+        UnitTypeRootFontSize,
+        UnitTypeViewportWidth,
+        UnitTypeViewportHeight,
+        UnitTypeViewportMin,
+        UnitTypeViewportMax,
+        UnitTypeInvalid,
+    };
+
+    virtual ~AnimatableLength() { }
+    static bool canCreateFrom(const CSSValue*);
+    static PassRefPtr<AnimatableLength> create(CSSValue*);
+    static PassRefPtr<AnimatableLength> create(double number, NumberUnitType unitType, CSSPrimitiveValue* cssPrimitiveValue = 0)
+    {
+        return adoptRef(new AnimatableLength(number, unitType, cssPrimitiveValue));
+    }
+    static PassRefPtr<AnimatableLength> create(PassRefPtr<CSSCalcExpressionNode> calcExpression, CSSPrimitiveValue* cssPrimitiveValue = 0)
+    {
+        return adoptRef(new AnimatableLength(calcExpression, cssPrimitiveValue));
+    }
+    PassRefPtr<CSSValue> toCSSValue(NumberRange = AllValues) const;
+    Length toLength(const RenderStyle* currStyle, const RenderStyle* rootStyle, double zoom, NumberRange = AllValues) const;
+
+protected:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
+
+private:
+    AnimatableLength(double number, NumberUnitType unitType, CSSPrimitiveValue* cssPrimitiveValue)
+        : m_isCalc(false)
+        , m_number(number)
+        , m_unitType(unitType)
+        , m_cachedCSSPrimitiveValue(cssPrimitiveValue)
+    {
+        ASSERT(m_unitType != UnitTypeInvalid);
+    }
+    AnimatableLength(PassRefPtr<CSSCalcExpressionNode> calcExpression, CSSPrimitiveValue* cssPrimitiveValue)
+        : m_isCalc(true)
+        , m_calcExpression(calcExpression)
+        , m_cachedCSSPrimitiveValue(cssPrimitiveValue)
+    {
+        ASSERT(m_calcExpression);
+    }
+    virtual AnimatableType type() const OVERRIDE { return TypeLength; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
+
+    static PassRefPtr<AnimatableLength> create(const AnimatableLength* leftAddend, const AnimatableLength* rightAddend)
+    {
+        ASSERT(leftAddend && rightAddend);
+        return create(CSSCalcValue::createExpressionNode(leftAddend->toCSSCalcExpressionNode(), rightAddend->toCSSCalcExpressionNode(), CalcAdd));
+    }
+
+    PassRefPtr<CSSPrimitiveValue> toCSSPrimitiveValue(NumberRange) const;
+    PassRefPtr<CSSCalcExpressionNode> toCSSCalcExpressionNode() const;
+
+    PassRefPtr<AnimatableLength> scale(double) const;
+    double clampedNumber(NumberRange range) const
+    {
+        ASSERT(!m_isCalc);
+        return (range == NonNegativeValues && m_number <= 0) ? 0 : m_number;
+    }
+    static NumberUnitType primitiveUnitToNumberType(unsigned short primitiveUnit);
+    static unsigned short numberTypeToPrimitiveUnit(NumberUnitType numberType);
+    bool hasSameUnitType(const AnimatableLength& length) const
+    {
+        return !m_isCalc && !length.m_isCalc && m_unitType == length.m_unitType;
+    }
+
+    bool m_isCalc;
+
+    double m_number;
+    NumberUnitType m_unitType;
+
+    RefPtr<CSSCalcExpressionNode> m_calcExpression;
+
+    mutable RefPtr<CSSPrimitiveValue> m_cachedCSSPrimitiveValue;
+};
+
+inline const AnimatableLength* toAnimatableLength(const AnimatableValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(value && value->isLength());
+    return static_cast<const AnimatableLength*>(value);
+}
+
+} // namespace WebCore
+
+#endif // AnimatableLength_h
diff --git a/Source/core/animation/AnimatableLengthBox.cpp b/Source/core/animation/AnimatableLengthBox.cpp
index 4898826..825a135 100644
--- a/Source/core/animation/AnimatableLengthBox.cpp
+++ b/Source/core/animation/AnimatableLengthBox.cpp
@@ -53,4 +53,13 @@
         AnimatableValue::add(this->bottom(), lengthBox->bottom()));
 }
 
+bool AnimatableLengthBox::equalTo(const AnimatableValue* value) const
+{
+    const AnimatableLengthBox* lengthBox = toAnimatableLengthBox(value);
+    return left()->equals(lengthBox->left())
+        && right()->equals(lengthBox->right())
+        && top()->equals(lengthBox->top())
+        && bottom()->equals(lengthBox->bottom());
+}
+
 }
diff --git a/Source/core/animation/AnimatableLengthBox.h b/Source/core/animation/AnimatableLengthBox.h
index 1582e86..f1ee061 100644
--- a/Source/core/animation/AnimatableLengthBox.h
+++ b/Source/core/animation/AnimatableLengthBox.h
@@ -53,13 +53,14 @@
 
 private:
     AnimatableLengthBox(PassRefPtr<AnimatableValue> left, PassRefPtr<AnimatableValue> right, PassRefPtr<AnimatableValue> top, PassRefPtr<AnimatableValue> bottom)
-        : AnimatableValue(TypeLengthBox)
-        , m_left(left)
+        : m_left(left)
         , m_right(right)
         , m_top(top)
         , m_bottom(bottom)
     {
     }
+    virtual AnimatableType type() const OVERRIDE { return TypeLengthBox; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
 
     RefPtr<AnimatableValue> m_left;
     RefPtr<AnimatableValue> m_right;
diff --git a/Source/core/animation/AnimatableLengthSize.cpp b/Source/core/animation/AnimatableLengthSize.cpp
new file mode 100644
index 0000000..b422f39
--- /dev/null
+++ b/Source/core/animation/AnimatableLengthSize.cpp
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableLengthSize.h"
+
+namespace WebCore {
+
+PassRefPtr<AnimatableValue> AnimatableLengthSize::interpolateTo(const AnimatableValue* value, double fraction) const
+{
+    const AnimatableLengthSize* lengthSize = toAnimatableLengthSize(value);
+    return AnimatableLengthSize::create(
+        AnimatableValue::interpolate(this->width(), lengthSize->width(), fraction),
+        AnimatableValue::interpolate(this->height(), lengthSize->height(), fraction));
+}
+
+PassRefPtr<AnimatableValue> AnimatableLengthSize::addWith(const AnimatableValue* value) const
+{
+    const AnimatableLengthSize* lengthSize = toAnimatableLengthSize(value);
+    return AnimatableLengthSize::create(
+        AnimatableValue::add(this->width(), lengthSize->width()),
+        AnimatableValue::add(this->height(), lengthSize->height()));
+}
+
+bool AnimatableLengthSize::equalTo(const AnimatableValue* value) const
+{
+    const AnimatableLengthSize* lengthSize = toAnimatableLengthSize(value);
+    return width()->equals(lengthSize->width()) && height()->equals(lengthSize->height());
+}
+
+}
diff --git a/Source/core/animation/AnimatableLengthSize.h b/Source/core/animation/AnimatableLengthSize.h
new file mode 100644
index 0000000..c436045
--- /dev/null
+++ b/Source/core/animation/AnimatableLengthSize.h
@@ -0,0 +1,73 @@
+/*
+ * 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 AnimatableLengthSize_h
+#define AnimatableLengthSize_h
+
+#include "core/animation/AnimatableValue.h"
+
+namespace WebCore {
+
+class AnimatableLengthSize : public AnimatableValue {
+public:
+    virtual ~AnimatableLengthSize() { }
+    static PassRefPtr<AnimatableLengthSize> create(PassRefPtr<AnimatableValue> width, PassRefPtr<AnimatableValue> height)
+    {
+        return adoptRef(new AnimatableLengthSize(width, height));
+    }
+    const AnimatableValue* width() const { return m_width.get(); }
+    const AnimatableValue* height() const { return m_height.get(); }
+
+protected:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
+
+private:
+    AnimatableLengthSize(PassRefPtr<AnimatableValue> width, PassRefPtr<AnimatableValue> height)
+        : m_width(width)
+        , m_height(height)
+    {
+    }
+    virtual AnimatableType type() const OVERRIDE { return TypeLengthSize; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
+
+    RefPtr<AnimatableValue> m_width;
+    RefPtr<AnimatableValue> m_height;
+};
+
+inline const AnimatableLengthSize* toAnimatableLengthSize(const AnimatableValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(value && value->isLengthSize());
+    return static_cast<const AnimatableLengthSize*>(value);
+}
+
+} // namespace WebCore
+
+#endif // AnimatableLengthSize_h
diff --git a/Source/core/animation/AnimatableLengthTest.cpp b/Source/core/animation/AnimatableLengthTest.cpp
new file mode 100644
index 0000000..c50ecf6
--- /dev/null
+++ b/Source/core/animation/AnimatableLengthTest.cpp
@@ -0,0 +1,258 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableLength.h"
+#include "core/animation/AnimatableValueTestHelper.h"
+
+#include "core/css/CSSCalculationValue.h"
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/platform/CalculationValue.h"
+#include "core/rendering/style/RenderStyle.h"
+#include "core/rendering/style/StyleInheritedData.h"
+#include "wtf/MathExtras.h"
+
+#include <gtest/gtest.h>
+
+#define EXPECT_ROUNDTRIP(a, f) EXPECT_REFV_EQ(a, f(a.get()))
+
+using namespace WebCore;
+
+namespace {
+
+class AnimatableLengthTest : public ::testing::Test {
+protected:
+    virtual void SetUp()
+    {
+        style = RenderStyle::createDefaultStyle();
+    }
+
+    PassRefPtr<AnimatableLength> create(double value, CSSPrimitiveValue::UnitTypes type)
+    {
+        return AnimatableLength::create(CSSPrimitiveValue::create(value, type).get());
+    }
+
+    PassRefPtr<AnimatableLength> create(double valueLeft, CSSPrimitiveValue::UnitTypes typeLeft, double valueRight, CSSPrimitiveValue::UnitTypes typeRight)
+    {
+        return AnimatableLength::create(createCalc(valueLeft, typeLeft, valueRight, typeRight).get());
+    }
+
+    PassRefPtr<CSSCalcValue> createCalc(double valueLeft, CSSPrimitiveValue::UnitTypes typeLeft, double valueRight, CSSPrimitiveValue::UnitTypes typeRight)
+    {
+        return CSSCalcValue::create(CSSCalcValue::createExpressionNode(
+            CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(valueLeft, typeLeft), valueLeft == trunc(valueLeft)),
+            CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(valueRight, typeRight), valueRight == trunc(valueRight)),
+            CalcAdd
+        ));
+    }
+
+    PassRefPtr<CSSValue> toCSSValue(CSSValue* cssValue)
+    {
+        return AnimatableLength::create(cssValue)->toCSSValue();
+    }
+
+    RefPtr<RenderStyle> style;
+};
+
+TEST_F(AnimatableLengthTest, CanCreateFrom)
+{
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_PX).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_CM).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_MM).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_IN).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_PT).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_PC).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_EMS).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_EXS).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_REMS).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_PERCENTAGE).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_VW).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_VH).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_VMIN).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_VMAX).get()));
+
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_CM).get()));
+    EXPECT_TRUE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_CM)).get()));
+
+    EXPECT_FALSE(AnimatableLength::canCreateFrom(CSSPrimitiveValue::create("NaN", CSSPrimitiveValue::CSS_STRING).get()));
+}
+
+TEST_F(AnimatableLengthTest, Create)
+{
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_PX).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_CM).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_MM).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_IN).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_PT).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_PC).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_EMS).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_EXS).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_REMS).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_PERCENTAGE).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_VW).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_VH).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_VMIN).get()));
+    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_VMAX).get()));
+
+    EXPECT_TRUE(static_cast<bool>(
+        AnimatableLength::create(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_CM).get()).get()
+    ));
+    EXPECT_TRUE(static_cast<bool>(
+        AnimatableLength::create(CSSPrimitiveValue::create(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_CM)).get()).get()
+    ));
+}
+
+
+TEST_F(AnimatableLengthTest, ToCSSValue)
+{
+
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_PX), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_CM), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_MM), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_IN), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_PT), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_PC), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_EMS), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_EXS), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_REMS), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_PERCENTAGE), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_VW), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_VH), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_VMIN), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_VMAX), toCSSValue);
+
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_IN)), toCSSValue);
+    EXPECT_ROUNDTRIP(CSSPrimitiveValue::create(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_IN)), toCSSValue);
+}
+
+
+TEST_F(AnimatableLengthTest, ToLength)
+{
+    EXPECT_EQ(Length(-5, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 1));
+    EXPECT_EQ(Length(-15, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 3));
+    EXPECT_EQ(Length(0, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 1, NonNegativeValues));
+    EXPECT_EQ(Length(0, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 3, NonNegativeValues));
+
+    EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1));
+    EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3));
+    EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1, NonNegativeValues));
+    EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3, NonNegativeValues));
+
+    EXPECT_EQ(
+        Length(CalculationValue::create(
+            adoptPtr(new CalcExpressionBinaryOperation(
+                adoptPtr(new CalcExpressionLength(Length(-5, WebCore::Fixed))),
+                adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
+                CalcAdd)),
+            ValueRangeAll)),
+        create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1));
+    EXPECT_EQ(
+        Length(CalculationValue::create(
+            adoptPtr(new CalcExpressionBinaryOperation(
+                adoptPtr(new CalcExpressionLength(Length(-15, WebCore::Fixed))),
+                adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
+                CalcAdd)),
+            ValueRangeAll)),
+        create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3));
+    EXPECT_EQ(
+        Length(CalculationValue::create(
+            adoptPtr(new CalcExpressionBinaryOperation(
+                adoptPtr(new CalcExpressionLength(Length(-5, WebCore::Fixed))),
+                adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
+                CalcAdd)),
+            ValueRangeNonNegative)),
+        create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1, NonNegativeValues));
+    EXPECT_EQ(
+        Length(CalculationValue::create(
+            adoptPtr(new CalcExpressionBinaryOperation(
+                adoptPtr(new CalcExpressionLength(Length(-15, WebCore::Fixed))),
+                adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
+                CalcAdd)),
+            ValueRangeNonNegative)),
+        create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3, NonNegativeValues));
+}
+
+TEST_F(AnimatableLengthTest, Interpolate)
+{
+    RefPtr<AnimatableLength> from10px = create(10, CSSPrimitiveValue::CSS_PX);
+    RefPtr<AnimatableLength> to20pxAsInches = create(20.0 / 96, CSSPrimitiveValue::CSS_IN);
+
+    EXPECT_REFV_EQ(create(5,  CSSPrimitiveValue::CSS_PX),
+        AnimatableValue::interpolate(from10px.get(), to20pxAsInches.get(), -0.5));
+
+    EXPECT_REFV_EQ(create(10, CSSPrimitiveValue::CSS_PX),
+        AnimatableValue::interpolate(from10px.get(), to20pxAsInches.get(),  0));
+    EXPECT_REFV_EQ(create(14, CSSPrimitiveValue::CSS_PX),
+        AnimatableValue::interpolate(from10px.get(), to20pxAsInches.get(),  0.4));
+    EXPECT_REFV_EQ(create(15, CSSPrimitiveValue::CSS_PX),
+        AnimatableValue::interpolate(from10px.get(), to20pxAsInches.get(),  0.5));
+    EXPECT_REFV_EQ(create(16, CSSPrimitiveValue::CSS_PX),
+        AnimatableValue::interpolate(from10px.get(), to20pxAsInches.get(),  0.6));
+    EXPECT_REFV_EQ(create(20.0 / 96, CSSPrimitiveValue::CSS_IN),
+        AnimatableValue::interpolate(from10px.get(), to20pxAsInches.get(),  1));
+    EXPECT_REFV_EQ(create(25, CSSPrimitiveValue::CSS_PX),
+        AnimatableValue::interpolate(from10px.get(), to20pxAsInches.get(),  1.5));
+
+    RefPtr<AnimatableLength> from10em = create(10, CSSPrimitiveValue::CSS_EMS);
+    RefPtr<AnimatableLength> to20rem = create(20, CSSPrimitiveValue::CSS_REMS);
+    EXPECT_REFV_EQ(create(15, CSSPrimitiveValue::CSS_EMS, -10, CSSPrimitiveValue::CSS_REMS),
+        AnimatableValue::interpolate(from10em.get(), to20rem.get(), -0.5));
+    EXPECT_REFV_EQ(create(10, CSSPrimitiveValue::CSS_EMS),
+        AnimatableValue::interpolate(from10em.get(), to20rem.get(),  0));
+    EXPECT_REFV_EQ(create(6, CSSPrimitiveValue::CSS_EMS, 8, CSSPrimitiveValue::CSS_REMS),
+        AnimatableValue::interpolate(from10em.get(), to20rem.get(),  0.4));
+    EXPECT_REFV_EQ(create(5, CSSPrimitiveValue::CSS_EMS, 10, CSSPrimitiveValue::CSS_REMS),
+        AnimatableValue::interpolate(from10em.get(), to20rem.get(),  0.5));
+    EXPECT_REFV_EQ(create(4, CSSPrimitiveValue::CSS_EMS, 12, CSSPrimitiveValue::CSS_REMS),
+        AnimatableValue::interpolate(from10em.get(), to20rem.get(),  0.6));
+    EXPECT_REFV_EQ(create(20, CSSPrimitiveValue::CSS_REMS),
+        AnimatableValue::interpolate(from10em.get(), to20rem.get(),  1));
+    EXPECT_REFV_EQ(create(-5, CSSPrimitiveValue::CSS_EMS, 30, CSSPrimitiveValue::CSS_REMS),
+        AnimatableValue::interpolate(from10em.get(), to20rem.get(),  1.5));
+}
+
+TEST_F(AnimatableLengthTest, Add)
+{
+    EXPECT_REFV_EQ(create(10, CSSPrimitiveValue::CSS_PX),
+        AnimatableValue::add(create(10, CSSPrimitiveValue::CSS_PX).get(), create(0, CSSPrimitiveValue::CSS_MM).get()));
+    EXPECT_REFV_EQ(create(100, CSSPrimitiveValue::CSS_PX),
+        AnimatableValue::add(create(4, CSSPrimitiveValue::CSS_PX).get(), create(1, CSSPrimitiveValue::CSS_IN).get()));
+    EXPECT_REFV_EQ(
+        create(10, CSSPrimitiveValue::CSS_EMS, 20, CSSPrimitiveValue::CSS_REMS),
+        AnimatableValue::add(create(10, CSSPrimitiveValue::CSS_EMS).get(), create(20, CSSPrimitiveValue::CSS_REMS).get()));
+    EXPECT_REFV_EQ(
+        create(10, CSSPrimitiveValue::CSS_EMS),
+        AnimatableValue::add(create(10, CSSPrimitiveValue::CSS_EMS).get(), create(0, CSSPrimitiveValue::CSS_REMS).get()));
+    EXPECT_REFV_EQ(
+        create(20, CSSPrimitiveValue::CSS_REMS),
+        AnimatableValue::add(create(0, CSSPrimitiveValue::CSS_EMS).get(), create(20, CSSPrimitiveValue::CSS_REMS).get()));
+}
+
+}
diff --git a/Source/core/animation/AnimatableNeutral.h b/Source/core/animation/AnimatableNeutral.h
index 91b702d..5b8759c 100644
--- a/Source/core/animation/AnimatableNeutral.h
+++ b/Source/core/animation/AnimatableNeutral.h
@@ -41,7 +41,6 @@
 
 protected:
     static PassRefPtr<AnimatableNeutral> create() { return adoptRef(new AnimatableNeutral()); }
-
     virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue* value, double fraction) const OVERRIDE
     {
         ASSERT_NOT_REACHED();
@@ -49,9 +48,13 @@
     }
 
 private:
-    AnimatableNeutral() : AnimatableValue(TypeNeutral) { }
-
     friend class AnimatableValue;
+    virtual AnimatableType type() const OVERRIDE { return TypeNeutral; }
+    virtual bool equalTo(const AnimatableValue* value) const OVERRIDE
+    {
+        ASSERT_NOT_REACHED();
+        return true;
+    }
 };
 
 } // namespace WebCore
diff --git a/Source/core/animation/AnimatableNumber.cpp b/Source/core/animation/AnimatableNumber.cpp
deleted file mode 100644
index 415fc8b..0000000
--- a/Source/core/animation/AnimatableNumber.cpp
+++ /dev/null
@@ -1,251 +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.
- */
-
-#include "config.h"
-#include "core/animation/AnimatableNumber.h"
-
-#include "core/css/CSSPrimitiveValueMappings.h"
-#include "core/platform/CalculationValue.h"
-#include "core/platform/Length.h"
-#include "wtf/MathExtras.h"
-
-namespace WebCore {
-
-PassRefPtr<AnimatableNumber> AnimatableNumber::create(CSSValue* value)
-{
-    ASSERT(canCreateFrom(value));
-    if (value->isPrimitiveValue()) {
-        CSSPrimitiveValue* primitiveValue = WebCore::toCSSPrimitiveValue(value);
-        const CSSCalcValue* calcValue = primitiveValue->cssCalcValue();
-        if (calcValue)
-            return create(calcValue->expressionNode(), primitiveValue);
-        NumberUnitType unitType = primitiveUnitToNumberType(primitiveValue->primitiveType());
-        ASSERT(unitType != UnitTypeInvalid);
-        const double scale = CSSPrimitiveValue::conversionToCanonicalUnitsScaleFactor(primitiveValue->primitiveType());
-        return create(primitiveValue->getDoubleValue() * scale, unitType, primitiveValue);
-    }
-
-    if (value->isCalculationValue())
-        return create(toCSSCalcValue(value)->expressionNode());
-
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-PassRefPtr<AnimatableNumber> AnimatableNumber::create(const AnimatableNumber* leftAddend, const AnimatableNumber* rightAddend)
-{
-    ASSERT(leftAddend);
-    ASSERT(rightAddend);
-
-    if (!leftAddend->m_isCalc && !rightAddend->m_isCalc && leftAddend->m_unitType == rightAddend->m_unitType)
-        return create(leftAddend->m_number + rightAddend->m_number, leftAddend->m_unitType);
-    return create(CSSCalcValue::createExpressionNode(leftAddend->toCSSCalcExpressionNode(), rightAddend->toCSSCalcExpressionNode(), CalcAdd));
-}
-
-bool AnimatableNumber::canCreateFrom(const CSSValue* value)
-{
-    ASSERT(value);
-    if (value->isPrimitiveValue()) {
-        const CSSPrimitiveValue* primitiveValue = WebCore::toCSSPrimitiveValue(value);
-        if (primitiveValue->cssCalcValue())
-            return true;
-        return primitiveUnitToNumberType(primitiveValue->primitiveType()) != UnitTypeInvalid;
-    }
-    return value->isCalculationValue();
-}
-
-PassRefPtr<CSSValue> AnimatableNumber::toCSSValue(NumberRange range) const
-{
-    return toCSSPrimitiveValue(range);
-}
-
-double AnimatableNumber::toDouble() const
-{
-    ASSERT(m_unitType == UnitTypeNumber);
-    return m_number;
-}
-
-Length AnimatableNumber::toLength(const RenderStyle* style, const RenderStyle* rootStyle, double zoom, NumberRange range) const
-{
-    if (!m_isCalc) {
-        // Avoid creating a CSSValue in the common cases
-        if (m_unitType == UnitTypeLength)
-            return Length(clampedNumber(range) * zoom, Fixed);
-        if (m_unitType == UnitTypePercentage)
-            return Length(clampedNumber(range), Percent);
-    }
-    return toCSSPrimitiveValue(range)->convertToLength<AnyConversion>(style, rootStyle, zoom);
-}
-
-PassRefPtr<AnimatableValue> AnimatableNumber::interpolateTo(const AnimatableValue* value, double fraction) const
-{
-    const AnimatableNumber* number = toAnimatableNumber(value);
-    return AnimatableNumber::create(scale(1 - fraction).get(), number->scale(fraction).get());
-}
-
-PassRefPtr<AnimatableValue> AnimatableNumber::addWith(const AnimatableValue* value) const
-{
-    // Optimization for adding with 0.
-    if (!m_isCalc && !m_number)
-        return takeConstRef(value);
-    const AnimatableNumber* number = toAnimatableNumber(value);
-    if (!number->m_isCalc && !number->m_number)
-        return takeConstRef(this);
-
-    return AnimatableNumber::create(this, number);
-}
-
-PassRefPtr<CSSCalcExpressionNode> AnimatableNumber::toCSSCalcExpressionNode() const
-{
-    if (m_isCalc)
-        return m_calcExpression;
-    return CSSCalcValue::createExpressionNode(toCSSPrimitiveValue(AllValues), m_number == trunc(m_number));
-}
-
-static bool isCompatibleWithRange(const CSSPrimitiveValue* primitiveValue, NumberRange range)
-{
-    ASSERT(primitiveValue);
-    if (range == AllValues)
-        return true;
-    if (primitiveValue->isCalculated())
-        return primitiveValue->cssCalcValue()->permittedValueRange() == CalculationRangeNonNegative;
-    return primitiveValue->getDoubleValue() >= 0;
-}
-
-PassRefPtr<CSSPrimitiveValue> AnimatableNumber::toCSSPrimitiveValue(NumberRange range) const
-{
-    ASSERT(m_unitType != UnitTypeInvalid);
-    if (!m_cachedCSSPrimitiveValue || !isCompatibleWithRange(m_cachedCSSPrimitiveValue.get(), range)) {
-        if (m_isCalc)
-            m_cachedCSSPrimitiveValue = CSSPrimitiveValue::create(CSSCalcValue::create(m_calcExpression, range == AllValues ? CalculationRangeAll : CalculationRangeNonNegative));
-        else
-            m_cachedCSSPrimitiveValue = CSSPrimitiveValue::create(clampedNumber(range), static_cast<CSSPrimitiveValue::UnitTypes>(numberTypeToPrimitiveUnit(m_unitType)));
-    }
-    return m_cachedCSSPrimitiveValue;
-}
-
-PassRefPtr<AnimatableNumber> AnimatableNumber::scale(double factor) const
-{
-    if (m_isCalc) {
-        return AnimatableNumber::create(CSSCalcValue::createExpressionNode(
-            m_calcExpression,
-            CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(factor, CSSPrimitiveValue::CSS_NUMBER)),
-            CalcMultiply));
-    }
-    return AnimatableNumber::create(m_number * factor, m_unitType);
-}
-
-AnimatableNumber::NumberUnitType AnimatableNumber::primitiveUnitToNumberType(unsigned short primitiveUnit)
-{
-    switch (primitiveUnit) {
-    case CSSPrimitiveValue::CSS_NUMBER:
-        return UnitTypeNumber;
-    case CSSPrimitiveValue::CSS_PX:
-    case CSSPrimitiveValue::CSS_CM:
-    case CSSPrimitiveValue::CSS_MM:
-    case CSSPrimitiveValue::CSS_IN:
-    case CSSPrimitiveValue::CSS_PT:
-    case CSSPrimitiveValue::CSS_PC:
-        return UnitTypeLength;
-    case CSSPrimitiveValue::CSS_EMS:
-        return UnitTypeFontSize;
-    case CSSPrimitiveValue::CSS_EXS:
-        return UnitTypeFontXSize;
-    case CSSPrimitiveValue::CSS_REMS:
-        return UnitTypeRootFontSize;
-    case CSSPrimitiveValue::CSS_DEG:
-    case CSSPrimitiveValue::CSS_RAD:
-    case CSSPrimitiveValue::CSS_GRAD:
-    case CSSPrimitiveValue::CSS_TURN:
-        return UnitTypeAngle;
-    case CSSPrimitiveValue::CSS_PERCENTAGE:
-        return UnitTypePercentage;
-    case CSSPrimitiveValue::CSS_VW:
-        return UnitTypeViewportWidth;
-    case CSSPrimitiveValue::CSS_VH:
-        return UnitTypeViewportHeight;
-    case CSSPrimitiveValue::CSS_VMIN:
-        return UnitTypeViewportMin;
-    case CSSPrimitiveValue::CSS_VMAX:
-        return UnitTypeViewportMax;
-    case CSSPrimitiveValue::CSS_MS:
-    case CSSPrimitiveValue::CSS_S:
-        return UnitTypeTime;
-    case CSSPrimitiveValue::CSS_HZ:
-    case CSSPrimitiveValue::CSS_KHZ:
-        return UnitTypeFrequency;
-    case CSSPrimitiveValue::CSS_DPPX:
-    case CSSPrimitiveValue::CSS_DPI:
-    case CSSPrimitiveValue::CSS_DPCM:
-        return UnitTypeResolution;
-    default:
-        return UnitTypeInvalid;
-    }
-}
-
-unsigned short AnimatableNumber::numberTypeToPrimitiveUnit(NumberUnitType numberType)
-{
-    switch (numberType) {
-    case UnitTypeNumber:
-        return CSSPrimitiveValue::CSS_NUMBER;
-    case UnitTypeLength:
-        return CSSPrimitiveValue::CSS_PX;
-    case UnitTypeFontSize:
-        return CSSPrimitiveValue::CSS_EMS;
-    case UnitTypeFontXSize:
-        return CSSPrimitiveValue::CSS_EXS;
-    case UnitTypeRootFontSize:
-        return CSSPrimitiveValue::CSS_REMS;
-    case UnitTypePercentage:
-        return CSSPrimitiveValue::CSS_PERCENTAGE;
-    case UnitTypeViewportWidth:
-        return CSSPrimitiveValue::CSS_VW;
-    case UnitTypeViewportHeight:
-        return CSSPrimitiveValue::CSS_VH;
-    case UnitTypeViewportMin:
-        return CSSPrimitiveValue::CSS_VMIN;
-    case UnitTypeViewportMax:
-        return CSSPrimitiveValue::CSS_VMAX;
-    case UnitTypeTime:
-        return CSSPrimitiveValue::CSS_MS;
-    case UnitTypeAngle:
-        return CSSPrimitiveValue::CSS_DEG;
-    case UnitTypeFrequency:
-        return CSSPrimitiveValue::CSS_HZ;
-    case UnitTypeResolution:
-        return CSSPrimitiveValue::CSS_DPPX;
-    case UnitTypeInvalid:
-        return CSSPrimitiveValue::CSS_UNKNOWN;
-    }
-    ASSERT_NOT_REACHED();
-    return CSSPrimitiveValue::CSS_UNKNOWN;
-}
-
-} // namespace WebCore
diff --git a/Source/core/animation/AnimatableNumber.h b/Source/core/animation/AnimatableNumber.h
deleted file mode 100644
index 9da6a7d..0000000
--- a/Source/core/animation/AnimatableNumber.h
+++ /dev/null
@@ -1,137 +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 AnimatableNumber_h
-#define AnimatableNumber_h
-
-#include "core/animation/AnimatableValue.h"
-#include "core/css/CSSCalculationValue.h"
-#include "core/css/CSSPrimitiveValue.h"
-
-namespace WebCore {
-
-enum NumberRange {
-    AllValues,
-    NonNegativeValues,
-};
-
-// Handles animation of CSSPrimitiveValues that can be represented by doubles including CSSCalcValue.
-// See primitiveUnitToNumberType() for the list of supported units (with the exception of calc).
-// If created from a CSSPrimitiveValue this class will cache it to be returned in toCSSValue().
-class AnimatableNumber : public AnimatableValue {
-public:
-    enum NumberUnitType {
-        UnitTypeNumber,
-        UnitTypeLength,
-        UnitTypeFontSize,
-        UnitTypeFontXSize,
-        UnitTypeRootFontSize,
-        UnitTypePercentage,
-        UnitTypeViewportWidth,
-        UnitTypeViewportHeight,
-        UnitTypeViewportMin,
-        UnitTypeViewportMax,
-        UnitTypeTime,
-        UnitTypeAngle,
-        UnitTypeFrequency,
-        UnitTypeResolution,
-        UnitTypeInvalid,
-    };
-
-    virtual ~AnimatableNumber() { }
-    static bool canCreateFrom(const CSSValue*);
-    static PassRefPtr<AnimatableNumber> create(CSSValue*);
-    static PassRefPtr<AnimatableNumber> create(double number, NumberUnitType unitType, CSSPrimitiveValue* cssPrimitiveValue = 0)
-    {
-        return adoptRef(new AnimatableNumber(number, unitType, cssPrimitiveValue));
-    }
-    PassRefPtr<CSSValue> toCSSValue(NumberRange = AllValues) const;
-    double toDouble() const;
-    Length toLength(const RenderStyle* currStyle, const RenderStyle* rootStyle, double zoom, NumberRange = AllValues) const;
-
-protected:
-    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
-    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
-
-private:
-    AnimatableNumber(double number, NumberUnitType unitType, CSSPrimitiveValue* cssPrimitiveValue)
-        : AnimatableValue(TypeNumber)
-        , m_number(number)
-        , m_unitType(unitType)
-        , m_isCalc(false)
-        , m_cachedCSSPrimitiveValue(cssPrimitiveValue)
-    {
-        ASSERT(m_unitType != UnitTypeInvalid);
-    }
-    AnimatableNumber(PassRefPtr<CSSCalcExpressionNode> calcExpression, CSSPrimitiveValue* cssPrimitiveValue)
-        : AnimatableValue(TypeNumber)
-        , m_isCalc(true)
-        , m_calcExpression(calcExpression)
-        , m_cachedCSSPrimitiveValue(cssPrimitiveValue)
-    {
-        ASSERT(m_calcExpression);
-    }
-
-    static PassRefPtr<AnimatableNumber> create(PassRefPtr<CSSCalcExpressionNode> calcExpression, CSSPrimitiveValue* cssPrimitiveValue = 0)
-    {
-        return adoptRef(new AnimatableNumber(calcExpression, cssPrimitiveValue));
-    }
-    static PassRefPtr<AnimatableNumber> create(const AnimatableNumber* leftAddend, const AnimatableNumber* rightAddend);
-
-    PassRefPtr<CSSPrimitiveValue> toCSSPrimitiveValue(NumberRange) const;
-    PassRefPtr<CSSCalcExpressionNode> toCSSCalcExpressionNode() const;
-
-    PassRefPtr<AnimatableNumber> scale(double) const;
-    double clampedNumber(NumberRange range) const
-    {
-        ASSERT(!m_isCalc);
-        return (range == NonNegativeValues && m_number <= 0) ? 0 : m_number;
-    }
-    static NumberUnitType primitiveUnitToNumberType(unsigned short primitiveUnit);
-    static unsigned short numberTypeToPrimitiveUnit(NumberUnitType numberType);
-
-    double m_number;
-    NumberUnitType m_unitType;
-
-    bool m_isCalc;
-    RefPtr<CSSCalcExpressionNode> m_calcExpression;
-
-    mutable RefPtr<CSSPrimitiveValue> m_cachedCSSPrimitiveValue;
-};
-
-inline const AnimatableNumber* toAnimatableNumber(const AnimatableValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(value && value->isNumber());
-    return static_cast<const AnimatableNumber*>(value);
-}
-
-} // namespace WebCore
-
-#endif // AnimatableNumber_h
diff --git a/Source/core/animation/AnimatableNumberTest.cpp b/Source/core/animation/AnimatableNumberTest.cpp
deleted file mode 100644
index 4872919..0000000
--- a/Source/core/animation/AnimatableNumberTest.cpp
+++ /dev/null
@@ -1,310 +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.
- */
-
-#include "config.h"
-#include "core/animation/AnimatableNumber.h"
-
-#include "core/css/CSSCalculationValue.h"
-#include "core/css/CSSPrimitiveValue.h"
-#include "core/platform/CalculationValue.h"
-#include "core/rendering/style/RenderStyle.h"
-#include "core/rendering/style/StyleInheritedData.h"
-#include "wtf/MathExtras.h"
-
-#include <gtest/gtest.h>
-
-using namespace WebCore;
-
-namespace {
-
-class AnimatableNumberTest : public ::testing::Test {
-protected:
-    virtual void SetUp()
-    {
-        style = RenderStyle::createDefaultStyle();
-    }
-
-    PassRefPtr<AnimatableNumber> create(double value)
-    {
-        return create(value, CSSPrimitiveValue::CSS_NUMBER);
-    }
-
-    PassRefPtr<AnimatableNumber> create(double value, CSSPrimitiveValue::UnitTypes type)
-    {
-        return AnimatableNumber::create(CSSPrimitiveValue::create(value, type).get());
-    }
-
-    PassRefPtr<AnimatableNumber> create(double valueLeft, CSSPrimitiveValue::UnitTypes typeLeft, double valueRight, CSSPrimitiveValue::UnitTypes typeRight)
-    {
-        return AnimatableNumber::create(createCalc(valueLeft, typeLeft, valueRight, typeRight).get());
-    }
-
-    PassRefPtr<CSSCalcValue> createCalc(double valueLeft, CSSPrimitiveValue::UnitTypes typeLeft, double valueRight, CSSPrimitiveValue::UnitTypes typeRight)
-    {
-        return CSSCalcValue::create(CSSCalcValue::createExpressionNode(
-            CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(valueLeft, typeLeft), valueLeft == trunc(valueLeft)),
-            CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(valueRight, typeRight), valueRight == trunc(valueRight)),
-            CalcAdd
-        ));
-    }
-
-    bool testToCSSValue(CSSValue* cssValue)
-    {
-        return testToCSSValue(cssValue, cssValue);
-    }
-    bool testToCSSValue(CSSValue* cssValueExpected, CSSValue* cssValue)
-    {
-        return AnimatableNumber::create(cssValue)->toCSSValue()->equals(*cssValueExpected);
-    }
-    bool testInterpolate(CSSValue* cssValueExpected, AnimatableNumber* numberA, AnimatableNumber* numberB, double fraction)
-    {
-        return toAnimatableNumber(AnimatableValue::interpolate(numberA, numberB, fraction).get())->toCSSValue()->equals(*cssValueExpected);
-    }
-    bool testAdd(CSSValue* cssValueExpected, AnimatableNumber* numberA, AnimatableNumber* numberB)
-    {
-        return toAnimatableNumber(AnimatableValue::add(numberA, numberB).get())->toCSSValue()->equals(*cssValueExpected);
-    }
-
-    RefPtr<RenderStyle> style;
-};
-
-TEST_F(AnimatableNumberTest, CanCreateFrom)
-{
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_NUMBER).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_PX).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_CM).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_MM).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_IN).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_PT).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_PC).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_EMS).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_EXS).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_REMS).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_DEG).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_RAD).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_GRAD).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_TURN).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_PERCENTAGE).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_VW).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_VH).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_VMIN).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_VMAX).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_MS).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_S).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_HZ).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_KHZ).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_DPPX).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_DPI).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_DPCM).get()));
-
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_CM).get()));
-    EXPECT_TRUE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_CM)).get()));
-
-    EXPECT_FALSE(AnimatableNumber::canCreateFrom(CSSPrimitiveValue::create("NaN", CSSPrimitiveValue::CSS_STRING).get()));
-}
-
-TEST_F(AnimatableNumberTest, Create)
-{
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_NUMBER).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_PX).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_CM).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_MM).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_IN).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_PT).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_PC).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_EMS).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_EXS).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_REMS).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_DEG).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_RAD).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_GRAD).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_TURN).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_PERCENTAGE).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_VW).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_VH).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_VMIN).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_VMAX).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_MS).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_S).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_HZ).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_KHZ).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_DPPX).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_DPI).get()));
-    EXPECT_TRUE(static_cast<bool>(create(5, CSSPrimitiveValue::CSS_DPCM).get()));
-
-    EXPECT_TRUE(static_cast<bool>(
-        AnimatableNumber::create(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_CM).get()).get()
-    ));
-    EXPECT_TRUE(static_cast<bool>(
-        AnimatableNumber::create(CSSPrimitiveValue::create(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_CM)).get()).get()
-    ));
-}
-
-TEST_F(AnimatableNumberTest, ToCSSValue)
-{
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_NUMBER).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_PX).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_CM).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_MM).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_IN).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_PT).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_PC).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_EMS).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_EXS).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_REMS).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_DEG).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_RAD).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_GRAD).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_TURN).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_PERCENTAGE).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_VW).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_VH).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_VMIN).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_VMAX).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_MS).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_S).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_HZ).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_KHZ).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_DPPX).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_DPI).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(-5, CSSPrimitiveValue::CSS_DPCM).get()));
-
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_IN)).get()));
-    EXPECT_TRUE(testToCSSValue(CSSPrimitiveValue::create(createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_IN)).get(),
-        createCalc(3, CSSPrimitiveValue::CSS_PX, 5, CSSPrimitiveValue::CSS_IN).get()));
-}
-
-TEST_F(AnimatableNumberTest, ToLength)
-{
-    EXPECT_EQ(Length(-5, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 1));
-    EXPECT_EQ(Length(-15, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 3));
-    EXPECT_EQ(Length(0, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 1, NonNegativeValues));
-    EXPECT_EQ(Length(0, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 3, NonNegativeValues));
-
-    EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1));
-    EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3));
-    EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1, NonNegativeValues));
-    EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3, NonNegativeValues));
-
-    EXPECT_EQ(
-        Length(CalculationValue::create(
-            adoptPtr(new CalcExpressionBinaryOperation(
-                adoptPtr(new CalcExpressionNumber(-5)),
-                adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
-                CalcAdd)),
-            CalculationRangeAll)),
-        create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1));
-    EXPECT_EQ(
-        Length(CalculationValue::create(
-            adoptPtr(new CalcExpressionBinaryOperation(
-                adoptPtr(new CalcExpressionNumber(-15)),
-                adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
-                CalcAdd)),
-            CalculationRangeAll)),
-        create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3));
-    EXPECT_EQ(
-        Length(CalculationValue::create(
-            adoptPtr(new CalcExpressionBinaryOperation(
-                adoptPtr(new CalcExpressionNumber(-5)),
-                adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
-                CalcAdd)),
-            CalculationRangeNonNegative)),
-        create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1, NonNegativeValues));
-    EXPECT_EQ(
-        Length(CalculationValue::create(
-            adoptPtr(new CalcExpressionBinaryOperation(
-                adoptPtr(new CalcExpressionNumber(-15)),
-                adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
-                CalcAdd)),
-            CalculationRangeNonNegative)),
-        create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3, NonNegativeValues));
-}
-
-TEST_F(AnimatableNumberTest, Interpolate)
-{
-    RefPtr<AnimatableNumber> from10 = create(10);
-    RefPtr<AnimatableNumber> to20 = create(20);
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(5,  CSSPrimitiveValue::CSS_NUMBER).get(), from10.get(), to20.get(), -0.5));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_NUMBER).get(), from10.get(), to20.get(),  0));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(14, CSSPrimitiveValue::CSS_NUMBER).get(), from10.get(), to20.get(),  0.4));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(15, CSSPrimitiveValue::CSS_NUMBER).get(), from10.get(), to20.get(),  0.5));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(16, CSSPrimitiveValue::CSS_NUMBER).get(), from10.get(), to20.get(),  0.6));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(20, CSSPrimitiveValue::CSS_NUMBER).get(), from10.get(), to20.get(),  1));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(25, CSSPrimitiveValue::CSS_NUMBER).get(), from10.get(), to20.get(),  1.5));
-
-    RefPtr<AnimatableNumber> from10px = create(10, CSSPrimitiveValue::CSS_PX);
-    RefPtr<AnimatableNumber> to20pxAsInches = create(20.0 / 96, CSSPrimitiveValue::CSS_IN);
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(5,  CSSPrimitiveValue::CSS_PX).get(), from10px.get(), to20pxAsInches.get(), -0.5));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX).get(), from10px.get(), to20pxAsInches.get(),  0));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(14, CSSPrimitiveValue::CSS_PX).get(), from10px.get(), to20pxAsInches.get(),  0.4));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(15, CSSPrimitiveValue::CSS_PX).get(), from10px.get(), to20pxAsInches.get(),  0.5));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(16, CSSPrimitiveValue::CSS_PX).get(), from10px.get(), to20pxAsInches.get(),  0.6));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(20.0 / 96, CSSPrimitiveValue::CSS_IN).get(), from10px.get(), to20pxAsInches.get(),  1));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(25, CSSPrimitiveValue::CSS_PX).get(), from10px.get(), to20pxAsInches.get(),  1.5));
-
-    RefPtr<AnimatableNumber> from10em = create(10, CSSPrimitiveValue::CSS_EMS);
-    RefPtr<AnimatableNumber> to20rem = create(20, CSSPrimitiveValue::CSS_REMS);
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(createCalc(15, CSSPrimitiveValue::CSS_EMS, -10, CSSPrimitiveValue::CSS_REMS)).get(),
-        from10em.get(), to20rem.get(), -0.5));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_EMS).get(),
-        from10em.get(), to20rem.get(),  0));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(createCalc(6, CSSPrimitiveValue::CSS_EMS, 8, CSSPrimitiveValue::CSS_REMS)).get(),
-        from10em.get(), to20rem.get(),  0.4));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(createCalc(5, CSSPrimitiveValue::CSS_EMS, 10, CSSPrimitiveValue::CSS_REMS)).get(),
-        from10em.get(), to20rem.get(),  0.5));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(createCalc(4, CSSPrimitiveValue::CSS_EMS, 12, CSSPrimitiveValue::CSS_REMS)).get(),
-        from10em.get(), to20rem.get(),  0.6));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(20, CSSPrimitiveValue::CSS_REMS).get(),
-        from10em.get(), to20rem.get(),  1));
-    EXPECT_TRUE(testInterpolate(CSSPrimitiveValue::create(createCalc(-5, CSSPrimitiveValue::CSS_EMS, 30, CSSPrimitiveValue::CSS_REMS)).get(),
-        from10em.get(), to20rem.get(),  1.5));
-}
-
-TEST_F(AnimatableNumberTest, Add)
-{
-    EXPECT_TRUE(testAdd(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_NUMBER).get(), create(4).get(), create(6).get()));
-    EXPECT_TRUE(testAdd(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_NUMBER).get(), create(0).get(), create(10).get()));
-    EXPECT_TRUE(testAdd(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX).get(), create(10, CSSPrimitiveValue::CSS_PX).get(), create(0, CSSPrimitiveValue::CSS_MM).get()));
-    EXPECT_TRUE(testAdd(CSSPrimitiveValue::create(100, CSSPrimitiveValue::CSS_PX).get(), create(4, CSSPrimitiveValue::CSS_PX).get(), create(1, CSSPrimitiveValue::CSS_IN).get()));
-    EXPECT_TRUE(testAdd(
-        CSSPrimitiveValue::create(createCalc(10, CSSPrimitiveValue::CSS_EMS, 20, CSSPrimitiveValue::CSS_REMS)).get(),
-        create(10, CSSPrimitiveValue::CSS_EMS).get(),
-        create(20, CSSPrimitiveValue::CSS_REMS).get()));
-    EXPECT_TRUE(testAdd(
-        CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_EMS).get(),
-        create(10, CSSPrimitiveValue::CSS_EMS).get(),
-        create(0, CSSPrimitiveValue::CSS_REMS).get()));
-    EXPECT_TRUE(testAdd(
-        CSSPrimitiveValue::create(20, CSSPrimitiveValue::CSS_REMS).get(),
-        create(0, CSSPrimitiveValue::CSS_EMS).get(),
-        create(20, CSSPrimitiveValue::CSS_REMS).get()));
-}
-
-}
diff --git a/Source/core/animation/AnimatableRepeatable.cpp b/Source/core/animation/AnimatableRepeatable.cpp
new file mode 100644
index 0000000..18c2971
--- /dev/null
+++ b/Source/core/animation/AnimatableRepeatable.cpp
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableRepeatable.h"
+
+namespace {
+
+size_t greatestCommonDivisor(size_t a, size_t b)
+{
+    return b ? greatestCommonDivisor(b, a % b) : a;
+}
+
+size_t lowestCommonMultiple(size_t a, size_t b)
+{
+    ASSERT(a && b);
+    return a / greatestCommonDivisor(a, b) * b;
+}
+
+} // namespace
+
+namespace WebCore {
+
+bool AnimatableRepeatable::interpolateLists(const Vector<RefPtr<AnimatableValue> >& fromValues, const Vector<RefPtr<AnimatableValue> >& toValues, double fraction, Vector<RefPtr<AnimatableValue> >& interpolatedValues)
+{
+    // Interpolation behaviour spec: http://www.w3.org/TR/css3-transitions/#animtype-repeatable-list
+    ASSERT(interpolatedValues.isEmpty());
+    ASSERT(!fromValues.isEmpty() && !toValues.isEmpty());
+    size_t size = lowestCommonMultiple(fromValues.size(), toValues.size());
+    for (size_t i = 0; i < size; ++i) {
+        const AnimatableValue* from = fromValues[i % fromValues.size()].get();
+        const AnimatableValue* to = toValues[i % toValues.size()].get();
+        // Spec: If a pair of values cannot be interpolated, then the lists are not interpolable.
+        if (!from->isSameType(to) || from->isUnknown())
+            return false;
+        interpolatedValues.append(interpolate(from, to, fraction));
+    }
+    return true;
+}
+
+PassRefPtr<AnimatableValue> AnimatableRepeatable::interpolateTo(const AnimatableValue* value, double fraction) const
+{
+    Vector<RefPtr<AnimatableValue> > interpolatedValues;
+    bool success = interpolateLists(m_values, toAnimatableRepeatable(value)->m_values, fraction, interpolatedValues);
+    return success ? create(interpolatedValues) : defaultInterpolateTo(this, value, fraction);
+}
+
+PassRefPtr<AnimatableValue> AnimatableRepeatable::addWith(const AnimatableValue* value) const
+{
+    const Vector<RefPtr<AnimatableValue> >& otherValues = toAnimatableRepeatable(value)->m_values;
+    ASSERT(!m_values.isEmpty() && !otherValues.isEmpty());
+    Vector<RefPtr<AnimatableValue> > addedValues(lowestCommonMultiple(m_values.size(), otherValues.size()));
+    for (size_t i = 0; i < addedValues.size(); ++i) {
+        const AnimatableValue* left = m_values[i % m_values.size()].get();
+        const AnimatableValue* right = otherValues[i % otherValues.size()].get();
+        addedValues[i] = add(left, right);
+    }
+    return create(addedValues);
+}
+
+bool AnimatableRepeatable::equalTo(const AnimatableValue* value) const
+{
+    const Vector<RefPtr<AnimatableValue> >& otherValues = toAnimatableRepeatable(value)->m_values;
+    if (m_values.size() != otherValues.size())
+        return false;
+    for (size_t i = 0; i < m_values.size(); ++i) {
+        if (!m_values[i]->equals(otherValues[i].get()))
+            return false;
+    }
+    return true;
+}
+
+} // namespace WebCore
diff --git a/Source/core/animation/AnimatableRepeatable.h b/Source/core/animation/AnimatableRepeatable.h
new file mode 100644
index 0000000..c041807
--- /dev/null
+++ b/Source/core/animation/AnimatableRepeatable.h
@@ -0,0 +1,83 @@
+/*
+ * 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 AnimatableRepeatable_h
+#define AnimatableRepeatable_h
+
+#include "core/animation/AnimatableValue.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+// This class represents collections of values that animate in a repeated fashion as described by the CSS Transitions spec:
+// http://www.w3.org/TR/css3-transitions/#animtype-repeatable-list
+class AnimatableRepeatable : public AnimatableValue {
+public:
+    virtual ~AnimatableRepeatable() { }
+
+    // This will consume the vector passed into it.
+    static PassRefPtr<AnimatableRepeatable> create(Vector<RefPtr<AnimatableValue> >& values)
+    {
+        return adoptRef(new AnimatableRepeatable(values));
+    }
+
+    const Vector<RefPtr<AnimatableValue> >& values() const { return m_values; }
+
+protected:
+    AnimatableRepeatable()
+    {
+    }
+    AnimatableRepeatable(Vector<RefPtr<AnimatableValue> >& values)
+    {
+        ASSERT(!values.isEmpty());
+        m_values.swap(values);
+    }
+
+    static bool interpolateLists(const Vector<RefPtr<AnimatableValue> >& fromValues, const Vector<RefPtr<AnimatableValue> >& toValues, double fraction, Vector<RefPtr<AnimatableValue> >& interpolatedValues);
+
+    Vector<RefPtr<AnimatableValue> > m_values;
+
+private:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
+
+    virtual AnimatableType type() const OVERRIDE { return TypeRepeatable; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
+};
+
+inline const AnimatableRepeatable* toAnimatableRepeatable(const AnimatableValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(value && value->isRepeatable());
+    return static_cast<const AnimatableRepeatable*>(value);
+}
+
+} // namespace WebCore
+
+#endif // AnimatableRepeatable_h
diff --git a/Source/core/animation/AnimatableSVGLength.cpp b/Source/core/animation/AnimatableSVGLength.cpp
new file mode 100644
index 0000000..bbf13e3
--- /dev/null
+++ b/Source/core/animation/AnimatableSVGLength.cpp
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableSVGLength.h"
+
+#include "platform/FloatConversion.h"
+
+namespace WebCore {
+
+PassRefPtr<AnimatableValue> AnimatableSVGLength::interpolateTo(const AnimatableValue* value, double fraction) const
+{
+    return create(toAnimatableSVGLength(value)->toSVGLength().blend(m_length, narrowPrecisionToFloat(fraction)));
+}
+
+PassRefPtr<AnimatableValue> AnimatableSVGLength::addWith(const AnimatableValue* value) const
+{
+    RELEASE_ASSERT_WITH_MESSAGE(false, "Web Animations not yet implemented: AnimatableSVGLength::addWith()");
+    return 0;
+}
+
+bool AnimatableSVGLength::equalTo(const AnimatableValue* value) const
+{
+    return m_length == toAnimatableSVGLength(value)->m_length;
+}
+
+} // namespace WebCore
diff --git a/Source/core/animation/AnimatableSVGLength.h b/Source/core/animation/AnimatableSVGLength.h
new file mode 100644
index 0000000..49d7d46
--- /dev/null
+++ b/Source/core/animation/AnimatableSVGLength.h
@@ -0,0 +1,77 @@
+/*
+ * 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 AnimatableSVGLength_h
+#define AnimatableSVGLength_h
+
+#include "core/animation/AnimatableValue.h"
+#include "core/svg/SVGLength.h"
+
+namespace WebCore {
+
+class AnimatableSVGLength: public AnimatableValue {
+public:
+    virtual ~AnimatableSVGLength() { }
+
+    static PassRefPtr<AnimatableSVGLength> create(const SVGLength& length)
+    {
+        return adoptRef(new AnimatableSVGLength(length));
+    }
+
+    const SVGLength& toSVGLength() const
+    {
+        return m_length;
+    }
+
+protected:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
+
+private:
+    AnimatableSVGLength(const SVGLength& length)
+        : m_length(length)
+    {
+    }
+
+    virtual AnimatableType type() const { return TypeSVGLength; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
+
+    SVGLength m_length;
+};
+
+inline const AnimatableSVGLength* toAnimatableSVGLength(const AnimatableValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(value && value->isSVGLength());
+    return static_cast<const AnimatableSVGLength*>(value);
+}
+
+} // namespace WebCore
+
+#endif // AnimatableSVGLength_h
diff --git a/Source/core/animation/AnimatableSVGPaint.cpp b/Source/core/animation/AnimatableSVGPaint.cpp
new file mode 100644
index 0000000..784c9d3
--- /dev/null
+++ b/Source/core/animation/AnimatableSVGPaint.cpp
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableSVGPaint.h"
+
+namespace WebCore {
+
+PassRefPtr<AnimatableValue> AnimatableSVGPaint::interpolateTo(const AnimatableValue* value, double fraction) const
+{
+    const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value);
+    if (paintType() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR && svgPaint->paintType() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR) {
+        ASSERT(uri().isNull());
+        return AnimatableSVGPaint::create(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, m_color.interpolateTo(svgPaint->m_color, fraction), String());
+    }
+    return defaultInterpolateTo(this, value, fraction);
+}
+
+PassRefPtr<AnimatableValue> AnimatableSVGPaint::addWith(const AnimatableValue* value) const
+{
+    const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value);
+    if (paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || svgPaint->paintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR) {
+        ASSERT(uri().isNull());
+        return AnimatableSVGPaint::create(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, m_color.addWith(svgPaint->m_color), String());
+    }
+    return defaultAddWith(this, value);
+}
+
+bool AnimatableSVGPaint::equalTo(const AnimatableValue* value) const
+{
+    const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value);
+    return paintType() == svgPaint->paintType()
+        && color() == svgPaint->color()
+        && uri() == svgPaint->uri();
+}
+
+}
diff --git a/Source/core/animation/AnimatableSVGPaint.h b/Source/core/animation/AnimatableSVGPaint.h
new file mode 100644
index 0000000..f8267fc
--- /dev/null
+++ b/Source/core/animation/AnimatableSVGPaint.h
@@ -0,0 +1,82 @@
+/*
+ * 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 AnimatableSVGPaint_h
+#define AnimatableSVGPaint_h
+
+#include "core/animation/AnimatableColor.h"
+#include "core/animation/AnimatableValue.h"
+#include "core/svg/SVGPaint.h"
+
+namespace WebCore {
+
+class AnimatableSVGPaint : public AnimatableValue {
+public:
+    virtual ~AnimatableSVGPaint() { }
+    static PassRefPtr<AnimatableSVGPaint> create(SVGPaint::SVGPaintType type, const Color& color, const String& uri)
+    {
+        return create(type, AnimatableColorImpl(color), uri);
+    }
+    static PassRefPtr<AnimatableSVGPaint> create(SVGPaint::SVGPaintType type, const AnimatableColorImpl& color, const String& uri)
+    {
+        return adoptRef(new AnimatableSVGPaint(type, color, uri));
+    }
+    SVGPaint::SVGPaintType paintType() const { return m_type; };
+    Color color() const { return m_color.toColor(); };
+    const String& uri() const { return m_uri; };
+
+protected:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+    virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
+
+private:
+    AnimatableSVGPaint(SVGPaint::SVGPaintType type, const AnimatableColorImpl& color, const String& uri)
+        : m_type(type)
+        , m_color(color)
+        , m_uri(uri)
+    {
+    }
+    virtual AnimatableType type() const OVERRIDE { return TypeSVGPaint; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
+
+    SVGPaint::SVGPaintType m_type;
+    AnimatableColorImpl m_color;
+    String m_uri;
+};
+
+inline const AnimatableSVGPaint* toAnimatableSVGPaint(const AnimatableValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(value && value->isSVGPaint());
+    return static_cast<const AnimatableSVGPaint*>(value);
+}
+
+} // namespace WebCore
+
+#endif // AnimatableSVGPaint_h
diff --git a/Source/core/animation/AnimatableShapeValue.cpp b/Source/core/animation/AnimatableShapeValue.cpp
new file mode 100644
index 0000000..9b17295
--- /dev/null
+++ b/Source/core/animation/AnimatableShapeValue.cpp
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableShapeValue.h"
+
+namespace WebCore {
+
+PassRefPtr<AnimatableValue> AnimatableShapeValue::interpolateTo(const AnimatableValue* value, double fraction) const
+{
+    const AnimatableShapeValue* shapeValue = toAnimatableShapeValue(value);
+
+    if (m_shape->type() != ShapeValue::Shape || shapeValue->m_shape->type() != ShapeValue::Shape)
+        return defaultInterpolateTo(this, value, fraction);
+
+    const BasicShape* fromShape = this->m_shape->shape();
+    const BasicShape* toShape = shapeValue->m_shape->shape();
+
+    if (!fromShape->canBlend(toShape))
+        return defaultInterpolateTo(this, value, fraction);
+
+    return AnimatableShapeValue::create(ShapeValue::createShapeValue(toShape->blend(fromShape, fraction)).get());
+}
+
+bool AnimatableShapeValue::equalTo(const AnimatableValue* value) const
+{
+    const ShapeValue* shape = toAnimatableShapeValue(value)->m_shape.get();
+    return m_shape == shape || (m_shape && shape && *m_shape == *shape);
+}
+
+}
diff --git a/Source/core/animation/AnimatableShapeValue.h b/Source/core/animation/AnimatableShapeValue.h
new file mode 100644
index 0000000..f8fcdd6
--- /dev/null
+++ b/Source/core/animation/AnimatableShapeValue.h
@@ -0,0 +1,70 @@
+/*
+ * 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 AnimatableShapeValue_h
+#define AnimatableShapeValue_h
+
+#include "core/animation/AnimatableValue.h"
+#include "core/rendering/style/ShapeValue.h"
+
+namespace WebCore {
+
+class AnimatableShapeValue : public AnimatableValue {
+public:
+    virtual ~AnimatableShapeValue() { }
+    static PassRefPtr<AnimatableShapeValue> create(ShapeValue* shape)
+    {
+        return adoptRef(new AnimatableShapeValue(shape));
+    }
+    ShapeValue* shapeValue() const { return m_shape.get(); }
+
+protected:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+
+private:
+    AnimatableShapeValue(ShapeValue* shape)
+        : m_shape(shape)
+    {
+    }
+    virtual AnimatableType type() const OVERRIDE { return TypeShapeValue; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
+
+    RefPtr<ShapeValue> m_shape;
+};
+
+inline const AnimatableShapeValue* toAnimatableShapeValue(const AnimatableValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(value && value->isShapeValue());
+    return static_cast<const AnimatableShapeValue*>(value);
+}
+
+} // namespace WebCore
+
+#endif // AnimatableShapeValue_h
diff --git a/Source/core/animation/AnimatableStrokeDasharrayList.cpp b/Source/core/animation/AnimatableStrokeDasharrayList.cpp
new file mode 100644
index 0000000..62dde8e
--- /dev/null
+++ b/Source/core/animation/AnimatableStrokeDasharrayList.cpp
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/animation/AnimatableStrokeDasharrayList.h"
+
+#include "bindings/v8/ExceptionStatePlaceholder.h"
+#include "core/animation/AnimatableSVGLength.h"
+
+namespace WebCore {
+
+AnimatableStrokeDasharrayList::AnimatableStrokeDasharrayList(const Vector<SVGLength>& lengths)
+{
+    for (size_t i = 0; i < lengths.size(); ++i)
+        m_values.append(AnimatableSVGLength::create(lengths[i]));
+}
+
+Vector<SVGLength> AnimatableStrokeDasharrayList::toSVGLengthVector() const
+{
+    Vector<SVGLength> lengths(m_values.size());
+    for (size_t i = 0; i < m_values.size(); ++i) {
+        lengths[i] = toAnimatableSVGLength(m_values[i].get())->toSVGLength();
+        if (lengths[i].valueInSpecifiedUnits() < 0)
+            lengths[i].setValueInSpecifiedUnits(0);
+    }
+    return lengths;
+}
+
+PassRefPtr<AnimatableValue> AnimatableStrokeDasharrayList::interpolateTo(const AnimatableValue* value, double fraction) const
+{
+    Vector<RefPtr<AnimatableValue> > from = m_values;
+    Vector<RefPtr<AnimatableValue> > to = toAnimatableStrokeDasharrayList(value)->m_values;
+
+    // The spec states that if the sum of all values is zero, this should be
+    // treated like a value of 'none', which means that a solid line is drawn.
+    // Since we animate to and from values of zero, treat a value of 'none' the
+    // same. If both the two and from values are 'none', we return 'none'
+    // rather than '0 0'.
+    if (from.isEmpty() && to.isEmpty())
+        return takeConstRef(this);
+    if (from.isEmpty() || to.isEmpty()) {
+        DEFINE_STATIC_LOCAL(RefPtr<AnimatableSVGLength>, zeroPixels, ());
+        if (!zeroPixels) {
+            SVGLength length;
+            length.newValueSpecifiedUnits(LengthTypePX, 0, IGNORE_EXCEPTION);
+            zeroPixels = AnimatableSVGLength::create(length);
+        }
+        if (from.isEmpty()) {
+            from.append(zeroPixels);
+            from.append(zeroPixels);
+        }
+        if (to.isEmpty()) {
+            to.append(zeroPixels);
+            to.append(zeroPixels);
+        }
+    }
+
+    Vector<RefPtr<AnimatableValue> > interpolatedValues;
+    bool success = interpolateLists(from, to, fraction, interpolatedValues);
+    ASSERT(success);
+    return adoptRef(new AnimatableStrokeDasharrayList(interpolatedValues));
+}
+
+} // namespace WebCore
diff --git a/Source/core/animation/AnimatableStrokeDasharrayList.h b/Source/core/animation/AnimatableStrokeDasharrayList.h
new file mode 100644
index 0000000..af5c9f1
--- /dev/null
+++ b/Source/core/animation/AnimatableStrokeDasharrayList.h
@@ -0,0 +1,72 @@
+/*
+ * 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 AnimatableStrokeDasharrayList_h
+#define AnimatableStrokeDasharrayList_h
+
+#include "core/animation/AnimatableRepeatable.h"
+#include "core/svg/SVGLength.h"
+
+namespace WebCore {
+
+class AnimatableStrokeDasharrayList: public AnimatableRepeatable {
+public:
+    virtual ~AnimatableStrokeDasharrayList() { }
+
+    static PassRefPtr<AnimatableStrokeDasharrayList> create(const Vector<SVGLength>& lengths)
+    {
+        return adoptRef(new AnimatableStrokeDasharrayList(lengths));
+    }
+
+    Vector<SVGLength> toSVGLengthVector() const;
+
+protected:
+    virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
+
+private:
+    AnimatableStrokeDasharrayList(const Vector<SVGLength>&);
+    // This will consume the vector passed into it.
+    AnimatableStrokeDasharrayList(Vector<RefPtr<AnimatableValue> >& values)
+        : AnimatableRepeatable(values)
+    {
+    }
+
+    virtual AnimatableType type() const { return TypeStrokeDasharrayList; }
+};
+
+inline const AnimatableStrokeDasharrayList* toAnimatableStrokeDasharrayList(const AnimatableValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(value && value->isStrokeDasharrayList());
+    return static_cast<const AnimatableStrokeDasharrayList*>(value);
+}
+
+} // namespace WebCore
+
+#endif // AnimatableStrokeDasharrayList_h
diff --git a/Source/core/animation/AnimatableTransform.cpp b/Source/core/animation/AnimatableTransform.cpp
index 8606a25..542d8c3 100644
--- a/Source/core/animation/AnimatableTransform.cpp
+++ b/Source/core/animation/AnimatableTransform.cpp
@@ -50,5 +50,10 @@
     return AnimatableTransform::create(m_transform.add(transform->m_transform));
 }
 
+bool AnimatableTransform::equalTo(const AnimatableValue* value) const
+{
+    return m_transform == toAnimatableTransform(value)->m_transform;
+}
+
 } // namespace WebCore
 
diff --git a/Source/core/animation/AnimatableTransform.h b/Source/core/animation/AnimatableTransform.h
index a0e71df..ad6ec18 100644
--- a/Source/core/animation/AnimatableTransform.h
+++ b/Source/core/animation/AnimatableTransform.h
@@ -51,10 +51,11 @@
 
 private:
     explicit AnimatableTransform(const TransformOperations& transform)
-        : AnimatableValue(TypeTransform)
-        , m_transform(transform)
+        : m_transform(transform)
     {
     }
+    virtual AnimatableType type() const OVERRIDE { return TypeTransform; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
     const TransformOperations m_transform;
 };
 
diff --git a/Source/core/animation/AnimatableUnknown.h b/Source/core/animation/AnimatableUnknown.h
index 1c0d2c6..1dcf564 100644
--- a/Source/core/animation/AnimatableUnknown.h
+++ b/Source/core/animation/AnimatableUnknown.h
@@ -31,7 +31,9 @@
 #ifndef AnimatableUnknown_h
 #define AnimatableUnknown_h
 
+#include "CSSValueKeywords.h"
 #include "core/animation/AnimatableValue.h"
+#include "core/css/CSSValuePool.h"
 
 namespace WebCore {
 
@@ -43,6 +45,10 @@
     {
         return adoptRef(new AnimatableUnknown(value));
     }
+    static PassRefPtr<AnimatableUnknown> create(CSSValueID value)
+    {
+        return adoptRef(new AnimatableUnknown(cssValuePool().createIdentifierValue(value)));
+    }
 
     PassRefPtr<CSSValue> toCSSValue() const { return m_value; }
 
@@ -54,11 +60,12 @@
 
 private:
     explicit AnimatableUnknown(PassRefPtr<CSSValue> value)
-        : AnimatableValue(TypeUnknown)
-        , m_value(value)
+        : m_value(value)
     {
         ASSERT(m_value);
     }
+    virtual AnimatableType type() const OVERRIDE { return TypeUnknown; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
 
     const RefPtr<CSSValue> m_value;
 };
@@ -69,6 +76,12 @@
     return static_cast<const AnimatableUnknown*>(value);
 }
 
+inline bool AnimatableUnknown::equalTo(const AnimatableValue* value) const
+{
+    const AnimatableUnknown* unknown = toAnimatableUnknown(value);
+    return m_value == unknown->m_value || m_value->equals(*unknown->m_value);
+}
+
 } // namespace WebCore
 
 #endif // AnimatableUnknown_h
diff --git a/Source/core/animation/AnimatableValue.h b/Source/core/animation/AnimatableValue.h
index 3c16593..75ade5e 100644
--- a/Source/core/animation/AnimatableValue.h
+++ b/Source/core/animation/AnimatableValue.h
@@ -46,35 +46,58 @@
     // For noncommutative values read add(A, B) to mean the value A with B composed onto it.
     static PassRefPtr<AnimatableValue> add(const AnimatableValue*, const AnimatableValue*);
 
-    bool isColor() const { return m_type == TypeColor; }
-    bool isImage() const { return m_type == TypeImage; }
-    bool isLengthBox() const { return m_type == TypeLengthBox; }
-    bool isNumber() const { return m_type == TypeNumber; }
-    bool isNeutral() const { return m_type == TypeNeutral; }
-    bool isTransform() const { return m_type == TypeTransform; }
-    bool isUnknown() const { return m_type == TypeUnknown; }
-    bool isVisibility() const { return m_type == TypeVisibility; }
+    bool equals(const AnimatableValue* value) const
+    {
+        return isSameType(value) && equalTo(value);
+    }
+    bool equals(const AnimatableValue& value) const
+    {
+        return equals(&value);
+    }
 
-protected:
-    enum AnimatableType {
-        TypeColor,
-        TypeImage,
-        TypeLengthBox,
-        TypeNeutral,
-        TypeNumber,
-        TypeTransform,
-        TypeUnknown,
-        TypeVisibility,
-    };
-
-    AnimatableValue(AnimatableType type) : m_type(type) { }
+    bool isClipPathOperation() const { return type() == TypeClipPathOperation; }
+    bool isColor() const { return type() == TypeColor; }
+    bool isDouble() const { return type() == TypeDouble; }
+    bool isImage() const { return type() == TypeImage; }
+    bool isLength() const { return type() == TypeLength; }
+    bool isLengthBox() const { return type() == TypeLengthBox; }
+    bool isLengthSize() const { return type() == TypeLengthSize; }
+    bool isNeutral() const { return type() == TypeNeutral; }
+    bool isRepeatable() const { return type() == TypeRepeatable; }
+    bool isSVGLength() const { return type() == TypeSVGLength; }
+    bool isSVGPaint() const { return type() == TypeSVGPaint; }
+    bool isShapeValue() const { return type() == TypeShapeValue; }
+    bool isStrokeDasharrayList() const { return type() == TypeStrokeDasharrayList; }
+    bool isTransform() const { return type() == TypeTransform; }
+    bool isUnknown() const { return type() == TypeUnknown; }
+    bool isVisibility() const { return type() == TypeVisibility; }
 
     bool isSameType(const AnimatableValue* value) const
     {
         ASSERT(value);
-        return value->m_type == m_type;
+        return value->type() == type();
     }
 
+protected:
+    enum AnimatableType {
+        TypeClipPathOperation,
+        TypeColor,
+        TypeDouble,
+        TypeImage,
+        TypeLength,
+        TypeLengthBox,
+        TypeLengthSize,
+        TypeNeutral,
+        TypeRepeatable,
+        TypeSVGLength,
+        TypeSVGPaint,
+        TypeShapeValue,
+        TypeStrokeDasharrayList,
+        TypeTransform,
+        TypeUnknown,
+        TypeVisibility,
+    };
+
     virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const = 0;
     static PassRefPtr<AnimatableValue> defaultInterpolateTo(const AnimatableValue* left, const AnimatableValue* right, double fraction) { return takeConstRef((fraction < 0.5) ? left : right); }
 
@@ -85,7 +108,10 @@
     template <class T>
     static PassRefPtr<T> takeConstRef(const T* value) { return PassRefPtr<T>(const_cast<T*>(value)); }
 
-    const AnimatableType m_type;
+private:
+    virtual AnimatableType type() const = 0;
+    // Implementations can assume that the object being compared has the same type as the object this is called on
+    virtual bool equalTo(const AnimatableValue*) const = 0;
 };
 
 } // namespace WebCore
diff --git a/Source/core/animation/AnimatableValueTestHelper.cpp b/Source/core/animation/AnimatableValueTestHelper.cpp
new file mode 100644
index 0000000..17842d4
--- /dev/null
+++ b/Source/core/animation/AnimatableValueTestHelper.cpp
@@ -0,0 +1,273 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#include "core/animation/AnimatableValueTestHelper.h"
+
+#include "core/animation/AnimatableClipPathOperation.h"
+#include "core/animation/AnimatableColor.h"
+#include "core/animation/AnimatableDouble.h"
+#include "core/animation/AnimatableImage.h"
+#include "core/animation/AnimatableLength.h"
+#include "core/animation/AnimatableLengthBox.h"
+#include "core/animation/AnimatableLengthSize.h"
+#include "core/animation/AnimatableNeutral.h"
+#include "core/animation/AnimatableSVGLength.h"
+#include "core/animation/AnimatableSVGPaint.h"
+#include "core/animation/AnimatableShapeValue.h"
+#include "core/animation/AnimatableTransform.h"
+#include "core/animation/AnimatableUnknown.h"
+#include "core/animation/AnimatableValue.h"
+#include "core/animation/AnimatableVisibility.h"
+
+
+namespace WebCore {
+
+bool operator==(const AnimatableValue& a, const AnimatableValue& b)
+{
+    return a.equals(b);
+}
+
+void PrintTo(const AnimatableClipPathOperation& animValue, ::std::ostream* os)
+{
+    *os << "AnimatableClipPathOperation@" << &animValue;
+}
+
+void PrintTo(const AnimatableColor& animColor, ::std::ostream* os)
+{
+    *os << "AnimatableColor("
+        << animColor.color().serialized().utf8().data() << ", "
+        << animColor.visitedLinkColor().serialized().utf8().data() << ")";
+}
+
+void PrintTo(const AnimatableDouble& animDouble, ::std::ostream* os)
+{
+    PrintTo(*(animDouble.toCSSValue().get()), os, "AnimatableDouble");
+}
+
+void PrintTo(const AnimatableImage& animImage, ::std::ostream* os)
+{
+    PrintTo(*(animImage.toCSSValue().get()), os, "AnimatableImage");
+}
+
+void PrintTo(const AnimatableLength& animLength, ::std::ostream* os)
+{
+    PrintTo(*(animLength.toCSSValue().get()), os, "AnimatableLength");
+}
+
+void PrintTo(const AnimatableLengthBox& animLengthBox, ::std::ostream* os)
+{
+    *os << "AnimatableLengthBox(";
+    PrintTo(*(animLengthBox.left()), os);
+    *os << ", ";
+    PrintTo(*(animLengthBox.right()), os);
+    *os << ", ";
+    PrintTo(*(animLengthBox.top()), os);
+    *os << ", ";
+    PrintTo(*(animLengthBox.bottom()), os);
+    *os << ")";
+}
+
+void PrintTo(const AnimatableLengthSize& animLengthSize, ::std::ostream* os)
+{
+    *os << "AnimatableLengthSize(";
+    PrintTo(*(animLengthSize.width()), os);
+    *os << ", ";
+    PrintTo(*(animLengthSize.height()), os);
+    *os << ")";
+}
+
+void PrintTo(const AnimatableNeutral& animValue, ::std::ostream* os)
+{
+    *os << "AnimatableNeutral@" << &animValue;
+}
+
+void PrintTo(const AnimatableRepeatable& animValue, ::std::ostream* os)
+{
+    *os << "AnimatableRepeatable(";
+
+    const Vector<RefPtr<AnimatableValue> > v = animValue.values();
+    for (Vector<RefPtr<AnimatableValue> >::const_iterator it = v.begin(); it != v.end(); ++it) {
+        PrintTo(*(it->get()), os);
+        if (it+1 != v.end())
+            *os << ", ";
+    }
+    *os << ")";
+}
+
+void PrintTo(const AnimatableSVGLength& animSVGLength, ::std::ostream* os)
+{
+    *os << "AnimatableSVGLength("
+        << animSVGLength.toSVGLength().valueAsString().utf8().data() << ")";
+}
+
+void PrintTo(const AnimatableSVGPaint& animSVGPaint, ::std::ostream* os)
+{
+    *os << "AnimatableSVGPaint(";
+    if (animSVGPaint.paintType() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR)
+        *os << animSVGPaint.color().serialized().utf8().data();
+    else if (animSVGPaint.paintType() == SVGPaint::SVG_PAINTTYPE_URI)
+        *os << "url(" << animSVGPaint.uri().utf8().data() << ")";
+    else
+        *os << animSVGPaint.paintType();
+    *os << ")";
+}
+
+void PrintTo(const AnimatableShapeValue& animValue, ::std::ostream* os)
+{
+    *os << "AnimatableShapeValue@" << &animValue;
+}
+
+void PrintTo(const AnimatableStrokeDasharrayList& animValue, ::std::ostream* os)
+{
+    *os << "AnimatableStrokeDasharrayList(";
+    const Vector<SVGLength> v = animValue.toSVGLengthVector();
+    for (Vector<SVGLength>::const_iterator it = v.begin(); it != v.end(); ++it) {
+        *os << it->valueAsString().utf8().data();
+        if (it+1 != v.end())
+            *os << ", ";
+    }
+    *os << ")";
+}
+
+void PrintTo(const AnimatableTransform& animTransform, ::std::ostream* os)
+{
+    TransformOperations ops = animTransform.transformOperations();
+
+    *os << "AnimatableTransform(";
+    // FIXME: TransformOperations should really have it's own pretty-printer
+    // then we could just call that.
+    // FIXME: Output useful names not just the raw matrixes.
+    for (unsigned i = 0; i < ops.size(); i++) {
+        const TransformOperation* op = ops.at(i);
+
+        TransformationMatrix matrix;
+        op->apply(matrix, FloatSize(1.0, 1.0));
+
+        *os << "[";
+        if (matrix.isAffine()) {
+            *os << matrix.a();
+            *os << " " << matrix.b();
+            *os << " " << matrix.c();
+            *os << " " << matrix.d();
+            *os << " " << matrix.e();
+            *os << " " << matrix.f();
+        } else {
+            *os << matrix.m11();
+            *os << " " << matrix.m12();
+            *os << " " << matrix.m13();
+            *os << " " << matrix.m14();
+            *os << " ";
+            *os << " " << matrix.m21();
+            *os << " " << matrix.m22();
+            *os << " " << matrix.m23();
+            *os << " " << matrix.m24();
+            *os << " ";
+            *os << " " << matrix.m31();
+            *os << " " << matrix.m32();
+            *os << " " << matrix.m33();
+            *os << " " << matrix.m34();
+            *os << " ";
+            *os << " " << matrix.m41();
+            *os << " " << matrix.m42();
+            *os << " " << matrix.m43();
+            *os << " " << matrix.m44();
+        }
+        *os << "]";
+        if (i < ops.size() - 1)
+            *os << ", ";
+    }
+    *os << ")";
+}
+
+void PrintTo(const AnimatableUnknown& animUnknown, ::std::ostream* os)
+{
+    PrintTo(*(animUnknown.toCSSValue().get()), os, "AnimatableUnknown");
+}
+
+void PrintTo(const AnimatableVisibility& animVisibility, ::std::ostream* os)
+{
+    *os << "AnimatableVisibility(";
+    switch (animVisibility.visibility()) {
+    case VISIBLE:
+        *os << "VISIBLE";
+        break;
+    case HIDDEN:
+        *os << "HIDDEN";
+        break;
+    case COLLAPSE:
+        *os << "COLLAPSE";
+        break;
+    default:
+        *os << "Unknown Visbilility - update switch in AnimatableValueTestHelper.h";
+    }
+    *os << ")";
+}
+
+void PrintTo(const AnimatableValue& animValue, ::std::ostream* os)
+{
+    if (animValue.isClipPathOperation())
+        PrintTo(*(toAnimatableClipPathOperation(&animValue)), os);
+    else if (animValue.isColor())
+        PrintTo(*(toAnimatableColor(&animValue)), os);
+    else if (animValue.isDouble())
+        PrintTo(*(toAnimatableDouble(&animValue)), os);
+    else if (animValue.isImage())
+        PrintTo(*(toAnimatableImage(&animValue)), os);
+    else if (animValue.isLength())
+        PrintTo(*(toAnimatableLength(&animValue)), os);
+    else if (animValue.isLengthBox())
+        PrintTo(*(toAnimatableLengthBox(&animValue)), os);
+    else if (animValue.isLengthSize())
+        PrintTo(*(toAnimatableLengthSize(&animValue)), os);
+    else if (animValue.isNeutral())
+        PrintTo(*(static_cast<const AnimatableNeutral*>(&animValue)), os);
+    else if (animValue.isRepeatable())
+        PrintTo(*(toAnimatableRepeatable(&animValue)), os);
+    else if (animValue.isSVGLength())
+        PrintTo(*(toAnimatableSVGLength(&animValue)), os);
+    else if (animValue.isSVGPaint())
+        PrintTo(*(toAnimatableSVGPaint(&animValue)), os);
+    else if (animValue.isShapeValue())
+        PrintTo(*(toAnimatableShapeValue(&animValue)), os);
+    else if (animValue.isStrokeDasharrayList())
+        PrintTo(*(toAnimatableStrokeDasharrayList(&animValue)), os);
+    else if (animValue.isTransform())
+        PrintTo(*(toAnimatableTransform(&animValue)), os);
+    else if (animValue.isUnknown())
+        PrintTo(*(toAnimatableUnknown(&animValue)), os);
+    else if (animValue.isVisibility())
+        PrintTo(*(toAnimatableVisibility(&animValue)), os);
+    else
+        *os << "Unknown AnimatableValue - update ifelse chain in AnimatableValueTestHelper.h";
+}
+
+} // namespace WebCore
diff --git a/Source/core/animation/AnimatableValueTestHelper.h b/Source/core/animation/AnimatableValueTestHelper.h
new file mode 100644
index 0000000..e2bdc19
--- /dev/null
+++ b/Source/core/animation/AnimatableValueTestHelper.h
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+/**
+ * Make testing with gtest and gmock nicer by adding pretty print and other
+ * helper functions.
+ */
+
+#ifndef AnimatableValueTestHelper_h
+#define AnimatableValueTestHelper_h
+
+#include "core/animation/AnimatableClipPathOperation.h"
+#include "core/animation/AnimatableColor.h"
+#include "core/animation/AnimatableDouble.h"
+#include "core/animation/AnimatableImage.h"
+#include "core/animation/AnimatableLength.h"
+#include "core/animation/AnimatableLengthBox.h"
+#include "core/animation/AnimatableLengthSize.h"
+#include "core/animation/AnimatableNeutral.h"
+#include "core/animation/AnimatableRepeatable.h"
+#include "core/animation/AnimatableSVGLength.h"
+#include "core/animation/AnimatableSVGPaint.h"
+#include "core/animation/AnimatableShapeValue.h"
+#include "core/animation/AnimatableStrokeDasharrayList.h"
+#include "core/animation/AnimatableTransform.h"
+#include "core/animation/AnimatableUnknown.h"
+#include "core/animation/AnimatableValue.h"
+#include "core/animation/AnimatableVisibility.h"
+
+#include "core/css/CSSValueTestHelper.h"
+
+// FIXME: Move to something like core/wtf/WTFTestHelpers.h
+// Compares the targets of two RefPtrs for equality.
+// (Objects still need an operator== defined for this to work).
+#define EXPECT_REFV_EQ(a, b) EXPECT_EQ(*(a.get()), *(b.get()))
+
+namespace WebCore {
+
+bool operator==(const AnimatableValue&, const AnimatableValue&);
+
+void PrintTo(const AnimatableClipPathOperation&, ::std::ostream*);
+void PrintTo(const AnimatableColor&, ::std::ostream*);
+void PrintTo(const AnimatableDouble&, ::std::ostream*);
+void PrintTo(const AnimatableImage&, ::std::ostream*);
+void PrintTo(const AnimatableLength&, ::std::ostream*);
+void PrintTo(const AnimatableLengthBox&, ::std::ostream*);
+void PrintTo(const AnimatableLengthSize&, ::std::ostream*);
+void PrintTo(const AnimatableNeutral&, ::std::ostream*);
+void PrintTo(const AnimatableRepeatable&, ::std::ostream*);
+void PrintTo(const AnimatableSVGLength&, ::std::ostream*);
+void PrintTo(const AnimatableSVGPaint&, ::std::ostream*);
+void PrintTo(const AnimatableShapeValue&, ::std::ostream*);
+void PrintTo(const AnimatableStrokeDasharrayList&, ::std::ostream*);
+void PrintTo(const AnimatableTransform&, ::std::ostream*);
+void PrintTo(const AnimatableUnknown&, ::std::ostream*);
+void PrintTo(const AnimatableValue&, ::std::ostream*);
+void PrintTo(const AnimatableVisibility&, ::std::ostream*);
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/animation/AnimatableValueTestHelperTest.cpp b/Source/core/animation/AnimatableValueTestHelperTest.cpp
new file mode 100644
index 0000000..356b64c
--- /dev/null
+++ b/Source/core/animation/AnimatableValueTestHelperTest.cpp
@@ -0,0 +1,154 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#include "core/animation/AnimatableValueTestHelper.h"
+
+#include "core/platform/graphics/transforms/ScaleTransformOperation.h"
+#include "core/platform/graphics/transforms/TranslateTransformOperation.h"
+#include "core/rendering/ClipPathOperation.h"
+#include "core/rendering/style/BasicShapes.h"
+#include "core/svg/SVGLengthContext.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <sstream>
+#include <string>
+
+
+using namespace WebCore;
+
+namespace {
+
+class AnimatableValueTestHelperTest : public ::testing::Test {
+protected:
+    ::std::string PrintToString(PassRefPtr<AnimatableValue> animValue)
+    {
+        return PrintToString(animValue.get());
+    }
+
+    ::std::string PrintToString(const AnimatableValue* animValue)
+    {
+        return ::testing::PrintToString(*animValue);
+    }
+};
+
+TEST_F(AnimatableValueTestHelperTest, PrintTo)
+{
+    EXPECT_THAT(
+        PrintToString(AnimatableClipPathOperation::create(ShapeClipPathOperation::create(BasicShapeCircle::create().get()).get())),
+        testing::StartsWith("AnimatableClipPathOperation")
+        );
+
+    EXPECT_EQ(
+        ::std::string("AnimatableColor(rgba(0, 0, 0, 0), #ff0000)"),
+        PrintToString(AnimatableColor::create(Color(0x000000FF), Color(0xFFFF0000))));
+
+    EXPECT_EQ(
+        ::std::string("AnimatableDouble(1)"),
+        PrintToString(AnimatableDouble::create(1.0)));
+
+    EXPECT_EQ(
+        ::std::string("AnimatableLength(5px)"),
+        PrintToString(AnimatableLength::create(CSSPrimitiveValue::create(5, CSSPrimitiveValue::CSS_PX).get())));
+
+    EXPECT_EQ(
+        ::std::string("AnimatableLengthBox(AnimatableLength(1px), AnimatableLength(2em), AnimatableLength(3rem), AnimatableLength(4pt))"),
+        PrintToString(AnimatableLengthBox::create(
+            AnimatableLength::create(CSSPrimitiveValue::create(1, CSSPrimitiveValue::CSS_PX).get()),
+            AnimatableLength::create(CSSPrimitiveValue::create(2, CSSPrimitiveValue::CSS_EMS).get()),
+            AnimatableLength::create(CSSPrimitiveValue::create(3, CSSPrimitiveValue::CSS_REMS).get()),
+            AnimatableLength::create(CSSPrimitiveValue::create(4, CSSPrimitiveValue::CSS_PT).get())
+            )));
+
+    EXPECT_EQ(
+        ::std::string("AnimatableLengthSize(AnimatableLength(3rem), AnimatableLength(4pt))"),
+        PrintToString(AnimatableLengthSize::create(
+            AnimatableLength::create(CSSPrimitiveValue::create(3, CSSPrimitiveValue::CSS_REMS).get()),
+            AnimatableLength::create(CSSPrimitiveValue::create(4, CSSPrimitiveValue::CSS_PT).get())
+            )));
+
+    EXPECT_THAT(
+        PrintToString(AnimatableValue::neutralValue()),
+        testing::StartsWith("AnimatableNeutral@"));
+
+    Vector<RefPtr<AnimatableValue> > v1;
+    v1.append(AnimatableLength::create(CSSPrimitiveValue::create(3, CSSPrimitiveValue::CSS_REMS).get()));
+    v1.append(AnimatableLength::create(CSSPrimitiveValue::create(4, CSSPrimitiveValue::CSS_PT).get()));
+    EXPECT_EQ(
+        ::std::string("AnimatableRepeatable(AnimatableLength(3rem), AnimatableLength(4pt))"),
+        PrintToString(AnimatableRepeatable::create(v1)));
+
+    EXPECT_EQ(
+        ::std::string("AnimatableSVGLength(1cm)"),
+        PrintToString(AnimatableSVGLength::create(SVGLength(LengthModeOther, "1cm"))));
+
+    EXPECT_EQ(
+        ::std::string("AnimatableSVGPaint(#ff0000)"),
+        PrintToString(AnimatableSVGPaint::create(SVGPaint::SVG_PAINTTYPE_RGBCOLOR, Color(0xFFFF0000), "")));
+
+    EXPECT_EQ(
+        ::std::string("AnimatableSVGPaint(url(abc))"),
+        PrintToString(AnimatableSVGPaint::create(SVGPaint::SVG_PAINTTYPE_URI, Color(0xFFFF0000), "abc")));
+
+    EXPECT_THAT(
+        PrintToString(AnimatableShapeValue::create(ShapeValue::createShapeValue(BasicShapeCircle::create().get()).get())),
+        testing::StartsWith("AnimatableShapeValue@"));
+
+    Vector<SVGLength> v2;
+    v2.append(SVGLength(LengthModeOther, "1cm"));
+    v2.append(SVGLength(LengthModeOther, "2cm"));
+    EXPECT_EQ(
+        ::std::string("AnimatableStrokeDasharrayList(1cm, 2cm)"),
+        PrintToString(AnimatableStrokeDasharrayList::create(v2)));
+
+    TransformOperations operations1;
+    operations1.operations().append(TranslateTransformOperation::create(Length(2, WebCore::Fixed), Length(0, WebCore::Fixed), TransformOperation::TranslateX));
+    EXPECT_EQ(
+        ::std::string("AnimatableTransform([1 0 0 1 2 0])"),
+        PrintToString(AnimatableTransform::create(operations1)));
+
+    TransformOperations operations2;
+    operations2.operations().append(ScaleTransformOperation::create(1, 1, 1, TransformOperation::Scale3D));
+    EXPECT_EQ(
+        ::std::string("AnimatableTransform([1 0 0 1 0 0])"),
+        PrintToString(AnimatableTransform::create(operations2)));
+
+    EXPECT_EQ(
+        ::std::string("AnimatableUnknown(none)"),
+        PrintToString(AnimatableUnknown::create(CSSPrimitiveValue::createIdentifier(CSSValueNone).get())));
+
+    EXPECT_EQ(
+        ::std::string("AnimatableVisibility(VISIBLE)"),
+        PrintToString(AnimatableVisibility::create(VISIBLE)));
+}
+
+} // namespace
diff --git a/Source/core/animation/AnimatableVisibility.cpp b/Source/core/animation/AnimatableVisibility.cpp
index 2cfc097..a395efa 100644
--- a/Source/core/animation/AnimatableVisibility.cpp
+++ b/Source/core/animation/AnimatableVisibility.cpp
@@ -46,4 +46,9 @@
     return takeConstRef(from == VISIBLE ? this : value);
 }
 
+bool AnimatableVisibility::equalTo(const AnimatableValue* value) const
+{
+    return m_visibility == toAnimatableVisibility(value)->m_visibility;
+}
+
 } // namespace WebCore
diff --git a/Source/core/animation/AnimatableVisibility.h b/Source/core/animation/AnimatableVisibility.h
index d24058f..c057b5a 100644
--- a/Source/core/animation/AnimatableVisibility.h
+++ b/Source/core/animation/AnimatableVisibility.h
@@ -51,10 +51,11 @@
 
 private:
     explicit AnimatableVisibility(EVisibility visibility)
-        : AnimatableValue(TypeVisibility)
-        , m_visibility(visibility)
+        : m_visibility(visibility)
     {
     }
+    virtual AnimatableType type() const OVERRIDE { return TypeVisibility; }
+    virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
     const EVisibility m_visibility;
 };
 
diff --git a/Source/core/animation/Animation.cpp b/Source/core/animation/Animation.cpp
index 0e801bb..d48b39a 100644
--- a/Source/core/animation/Animation.cpp
+++ b/Source/core/animation/Animation.cpp
@@ -79,6 +79,7 @@
     ensureAnimationStack(m_target.get())->remove(this);
     m_activeInAnimationStack = false;
     m_compositableValues.clear();
+    m_target->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
 }
 
 void Animation::updateChildrenAndEffects(bool wasInEffect) const
diff --git a/Source/core/animation/Animation.h b/Source/core/animation/Animation.h
index 2635c9e..8bdef2e 100644
--- a/Source/core/animation/Animation.h
+++ b/Source/core/animation/Animation.h
@@ -50,6 +50,8 @@
         return m_compositableValues.get();
     }
 
+    const AnimationEffect* effect() const { return m_effect.get(); }
+
 protected:
     virtual void applyEffects(bool previouslyInEffect);
     virtual void clearEffects();
diff --git a/Source/core/animation/DocumentTimeline.cpp b/Source/core/animation/DocumentTimeline.cpp
index 902897d..6d70413 100644
--- a/Source/core/animation/DocumentTimeline.cpp
+++ b/Source/core/animation/DocumentTimeline.cpp
@@ -33,7 +33,7 @@
 
 #include "core/animation/Player.h"
 #include "core/dom/Document.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 
 namespace WebCore {
 
@@ -63,22 +63,25 @@
 
 void DocumentTimeline::serviceAnimations(double monotonicAnimationStartTime)
 {
-    // FIXME: The below ASSERT fires on Windows when running chrome.exe.
-    // Does not fire with --single-process, or on Linux, or in
-    // content_shell.exe. The assert condition has been moved up into the
-    // outer 'if' to work around this. http://crbug.com/280439.
-    if (!isNull(m_zeroTimeAsPerfTime) && (m_currentTime <= monotonicAnimationStartTime - m_zeroTimeAsPerfTime)) {
-        ASSERT(m_currentTime <= monotonicAnimationStartTime - m_zeroTimeAsPerfTime);
-        m_currentTime = monotonicAnimationStartTime - m_zeroTimeAsPerfTime;
-    }
+    {
+        TRACE_EVENT0("webkit", "DocumentTimeline::serviceAnimations");
+        // FIXME: The below ASSERT fires on Windows when running chrome.exe.
+        // Does not fire with --single-process, or on Linux, or in
+        // content_shell.exe. The assert condition has been moved up into the
+        // outer 'if' to work around this. http://crbug.com/280439.
+        if (!isNull(m_zeroTimeAsPerfTime) && (m_currentTime <= monotonicAnimationStartTime - m_zeroTimeAsPerfTime)) {
+            ASSERT(m_currentTime <= monotonicAnimationStartTime - m_zeroTimeAsPerfTime);
+            m_currentTime = monotonicAnimationStartTime - m_zeroTimeAsPerfTime;
+        }
 
-    for (int i = m_players.size() - 1; i >= 0; --i) {
-        if (!m_players[i]->update())
-            m_players.remove(i);
-    }
+        for (int i = m_players.size() - 1; i >= 0; --i) {
+            if (!m_players[i]->update())
+                m_players.remove(i);
+        }
 
-    if (m_document->view() && !m_players.isEmpty())
-        m_document->view()->scheduleAnimation();
+        if (m_document->view() && !m_players.isEmpty())
+            m_document->view()->scheduleAnimation();
+    }
 
     dispatchEvents();
 }
diff --git a/Source/core/animation/InertAnimation.h b/Source/core/animation/InertAnimation.h
index e6cd2ea..6cc2377 100644
--- a/Source/core/animation/InertAnimation.h
+++ b/Source/core/animation/InertAnimation.h
@@ -42,7 +42,7 @@
 public:
     static PassRefPtr<InertAnimation> create(PassRefPtr<AnimationEffect>, const Timing&);
     PassOwnPtr<AnimationEffect::CompositableValueMap> sample();
-    AnimationEffect* effect() { return m_effect.get(); }
+    AnimationEffect* effect() const { return m_effect.get(); }
 
 protected:
     virtual void updateChildrenAndEffects(bool) const OVERRIDE { };
diff --git a/Source/core/animation/KeyframeAnimationEffect.cpp b/Source/core/animation/KeyframeAnimationEffect.cpp
index 7c70831..9131077 100644
--- a/Source/core/animation/KeyframeAnimationEffect.cpp
+++ b/Source/core/animation/KeyframeAnimationEffect.cpp
@@ -124,6 +124,11 @@
     m_propertyValues.add(property, const_cast<AnimatableValue*>(value));
 }
 
+void Keyframe::clearPropertyValue(CSSPropertyID property)
+{
+    m_propertyValues.remove(property);
+}
+
 const AnimatableValue* Keyframe::propertyValue(CSSPropertyID property) const
 {
     ASSERT(m_propertyValues.contains(property));
diff --git a/Source/core/animation/KeyframeAnimationEffect.h b/Source/core/animation/KeyframeAnimationEffect.h
index d826c1d..ea1b401 100644
--- a/Source/core/animation/KeyframeAnimationEffect.h
+++ b/Source/core/animation/KeyframeAnimationEffect.h
@@ -60,6 +60,7 @@
     void setComposite(AnimationEffect::CompositeOperation composite) { m_composite = composite; }
     AnimationEffect::CompositeOperation composite() const { return m_composite; }
     void setPropertyValue(CSSPropertyID, const AnimatableValue*);
+    void clearPropertyValue(CSSPropertyID);
     const AnimatableValue* propertyValue(CSSPropertyID) const;
     PropertySet properties() const;
     PassRefPtr<Keyframe> cloneWithOffset(double offset) const;
diff --git a/Source/core/animation/KeyframeAnimationEffectTest.cpp b/Source/core/animation/KeyframeAnimationEffectTest.cpp
index 03787a5..c6dcc2c 100644
--- a/Source/core/animation/KeyframeAnimationEffectTest.cpp
+++ b/Source/core/animation/KeyframeAnimationEffectTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/animation/KeyframeAnimationEffect.h"
 
-#include "core/animation/AnimatableNumber.h"
+#include "core/animation/AnimatableLength.h"
 #include "core/animation/AnimatableUnknown.h"
 #include "core/css/CSSPrimitiveValue.h"
 #include <gtest/gtest.h>
@@ -47,7 +47,7 @@
 
 AnimatableValue* pixelAnimatableValue(double n)
 {
-    return AnimatableNumber::create(CSSPrimitiveValue::create(n, CSSPrimitiveValue::CSS_PX).get()).leakRef();
+    return AnimatableLength::create(CSSPrimitiveValue::create(n, CSSPrimitiveValue::CSS_PX).get()).leakRef();
 }
 
 KeyframeAnimationEffect::KeyframeVector keyframesAtZeroAndOne(AnimatableValue* zeroValue, AnimatableValue* oneValue)
@@ -64,11 +64,11 @@
 
 void expectDoubleValue(double expectedValue, PassRefPtr<AnimatableValue> value)
 {
-    ASSERT_TRUE(value->isNumber() || value->isUnknown());
+    ASSERT_TRUE(value->isLength() || value->isUnknown());
 
     double actualValue;
-    if (value->isNumber())
-        actualValue = toCSSPrimitiveValue(toAnimatableNumber(value.get())->toCSSValue().get())->getDoubleValue();
+    if (value->isLength())
+        actualValue = toCSSPrimitiveValue(toAnimatableLength(value.get())->toCSSValue().get())->getDoubleValue();
     else
         actualValue = toCSSPrimitiveValue(toAnimatableUnknown(value.get())->toCSSValue().get())->getDoubleValue();
 
diff --git a/Source/core/animation/Player.h b/Source/core/animation/Player.h
index 985fb45..84ea0e4 100644
--- a/Source/core/animation/Player.h
+++ b/Source/core/animation/Player.h
@@ -56,6 +56,7 @@
     double startTime() const { return m_startTime; }
     double timeDrift() const;
     DocumentTimeline* timeline() { return m_timeline; }
+    TimedItem* source() { return m_content.get(); }
 
 private:
     Player(DocumentTimeline*, TimedItem*);
diff --git a/Source/core/animation/css/CSSAnimatableValueFactory.cpp b/Source/core/animation/css/CSSAnimatableValueFactory.cpp
index bf22b53..8989a72 100644
--- a/Source/core/animation/css/CSSAnimatableValueFactory.cpp
+++ b/Source/core/animation/css/CSSAnimatableValueFactory.cpp
@@ -32,43 +32,48 @@
 #include "core/animation/css/CSSAnimatableValueFactory.h"
 
 #include "CSSValueKeywords.h"
+#include "core/animation/AnimatableClipPathOperation.h"
 #include "core/animation/AnimatableColor.h"
+#include "core/animation/AnimatableDouble.h"
 #include "core/animation/AnimatableImage.h"
+#include "core/animation/AnimatableLength.h"
 #include "core/animation/AnimatableLengthBox.h"
-#include "core/animation/AnimatableNumber.h"
+#include "core/animation/AnimatableLengthSize.h"
+#include "core/animation/AnimatableRepeatable.h"
+#include "core/animation/AnimatableSVGLength.h"
+#include "core/animation/AnimatableSVGPaint.h"
+#include "core/animation/AnimatableShapeValue.h"
+#include "core/animation/AnimatableStrokeDasharrayList.h"
 #include "core/animation/AnimatableTransform.h"
 #include "core/animation/AnimatableUnknown.h"
 #include "core/animation/AnimatableVisibility.h"
 #include "core/animation/css/CSSAnimations.h"
+#include "core/css/CSSCalculationValue.h"
 #include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSPrimitiveValueMappings.h"
 #include "core/platform/Length.h"
 #include "core/platform/LengthBox.h"
 #include "core/rendering/style/RenderStyle.h"
 
-
 namespace WebCore {
 
 static PassRefPtr<AnimatableValue> createFromLength(const Length& length, const RenderStyle* style)
 {
     switch (length.type()) {
-    case Relative:
-        return AnimatableNumber::create(length.value(), AnimatableNumber::UnitTypeNumber);
     case Fixed:
-        return AnimatableNumber::create(adjustFloatForAbsoluteZoom(length.value(), style), AnimatableNumber::UnitTypeLength);
+        return AnimatableLength::create(adjustFloatForAbsoluteZoom(length.value(), style), AnimatableLength::UnitTypePixels);
     case Percent:
-        return AnimatableNumber::create(length.value(), AnimatableNumber::UnitTypePercentage);
+        return AnimatableLength::create(length.value(), AnimatableLength::UnitTypePercentage);
     case ViewportPercentageWidth:
-        return AnimatableNumber::create(length.value(), AnimatableNumber::UnitTypeViewportWidth);
+        return AnimatableLength::create(length.value(), AnimatableLength::UnitTypeViewportWidth);
     case ViewportPercentageHeight:
-        return AnimatableNumber::create(length.value(), AnimatableNumber::UnitTypeViewportHeight);
+        return AnimatableLength::create(length.value(), AnimatableLength::UnitTypeViewportHeight);
     case ViewportPercentageMin:
-        return AnimatableNumber::create(length.value(), AnimatableNumber::UnitTypeViewportMin);
+        return AnimatableLength::create(length.value(), AnimatableLength::UnitTypeViewportMin);
     case ViewportPercentageMax:
-        return AnimatableNumber::create(length.value(), AnimatableNumber::UnitTypeViewportMax);
+        return AnimatableLength::create(length.value(), AnimatableLength::UnitTypeViewportMax);
     case Calculated:
-        // FIXME: Convert platform calcs to CSS calcs.
-        ASSERT_WITH_MESSAGE(false, "Web Animations not yet implemented: Convert platform CalculationValue to AnimatableValue");
-        return 0;
+        return AnimatableLength::create(CSSCalcValue::createExpressionNode(length.calculationValue()->expression(), style->effectiveZoom()));
     case Auto:
     case Intrinsic:
     case MinIntrinsic:
@@ -78,8 +83,9 @@
     case FitContent:
         return AnimatableUnknown::create(CSSPrimitiveValue::create(length));
     case Undefined:
-        return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueNone));
+        return AnimatableUnknown::create(CSSValueNone);
     case ExtendToZoom: // Does not apply to elements.
+    case Relative: // Does not get used by interpolable properties.
         ASSERT_NOT_REACHED();
         return 0;
     }
@@ -87,12 +93,12 @@
     return 0;
 }
 
-inline static PassRefPtr<AnimatableValue> createFromDouble(double value)
+inline static PassRefPtr<AnimatableValue> createFromDouble(double value, AnimatableDouble::Constraint constraint = AnimatableDouble::Unconstrained)
 {
-    return AnimatableNumber::create(value, AnimatableNumber::UnitTypeNumber);
+    return AnimatableDouble::create(value, constraint);
 }
 
-inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox lengthBox, const RenderStyle* style)
+inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox& lengthBox, const RenderStyle* style)
 {
     return AnimatableLengthBox::create(
         createFromLength(lengthBox.left(), style),
@@ -101,6 +107,58 @@
         createFromLength(lengthBox.bottom(), style));
 }
 
+inline static PassRefPtr<AnimatableValue> createFromLengthSize(const LengthSize& lengthSize, const RenderStyle* style)
+{
+    return AnimatableLengthSize::create(
+        createFromLength(lengthSize.width(), style),
+        createFromLength(lengthSize.height(), style));
+}
+
+inline static PassRefPtr<AnimatableValue> createFromFillSize(const FillSize& fillSize, const RenderStyle* style)
+{
+    switch (fillSize.type) {
+    case SizeLength:
+        return createFromLengthSize(fillSize.size, style);
+    case Contain:
+    case Cover:
+    case SizeNone:
+        return AnimatableUnknown::create(CSSPrimitiveValue::create(fillSize.type));
+    default:
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+}
+
+template<CSSPropertyID property>
+inline static PassRefPtr<AnimatableValue> createFromFillLayers(const FillLayer* fillLayer, const RenderStyle* style)
+{
+    ASSERT(fillLayer);
+    Vector<RefPtr<AnimatableValue> > values;
+    while (fillLayer) {
+        if (property == CSSPropertyBackgroundImage) {
+            if (!fillLayer->isImageSet())
+                break;
+            values.append(AnimatableImage::create(fillLayer->image()));
+        } else if (property == CSSPropertyBackgroundPositionX || property == CSSPropertyWebkitMaskPositionX) {
+            if (!fillLayer->isXPositionSet())
+                break;
+            values.append(createFromLength(fillLayer->xPosition(), style));
+        } else if (property == CSSPropertyBackgroundPositionY || property == CSSPropertyWebkitMaskPositionY) {
+            if (!fillLayer->isYPositionSet())
+                break;
+            values.append(createFromLength(fillLayer->yPosition(), style));
+        } else if (property == CSSPropertyBackgroundSize) {
+            if (!fillLayer->isSizeSet())
+                break;
+            values.append(createFromFillSize(fillLayer->size(), style));
+        } else {
+            ASSERT_NOT_REACHED();
+        }
+        fillLayer = fillLayer->next();
+    }
+    return AnimatableRepeatable::create(values);
+}
+
 PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::createFromColor(CSSPropertyID property, const RenderStyle* style)
 {
     Color color = style->colorIncludingFallback(property, false);
@@ -126,8 +184,22 @@
     switch (property) {
     case CSSPropertyBackgroundColor:
         return createFromColor(property, style);
+    case CSSPropertyBackgroundImage:
+        return createFromFillLayers<CSSPropertyBackgroundImage>(style->backgroundLayers(), style);
+    case CSSPropertyBackgroundPositionX:
+        return createFromFillLayers<CSSPropertyBackgroundPositionX>(style->backgroundLayers(), style);
+    case CSSPropertyBackgroundPositionY:
+        return createFromFillLayers<CSSPropertyBackgroundPositionY>(style->backgroundLayers(), style);
+    case CSSPropertyBackgroundSize:
+        return createFromFillLayers<CSSPropertyBackgroundSize>(style->backgroundLayers(), style);
+    case CSSPropertyBaselineShift:
+        return AnimatableSVGLength::create(style->baselineShiftValue());
     case CSSPropertyBorderBottomColor:
         return createFromColor(property, style);
+    case CSSPropertyBorderBottomLeftRadius:
+        return createFromLengthSize(style->borderBottomLeftRadius(), style);
+    case CSSPropertyBorderBottomRightRadius:
+        return createFromLengthSize(style->borderBottomRightRadius(), style);
     case CSSPropertyBorderBottomWidth:
         return createFromDouble(style->borderBottomWidth());
     case CSSPropertyBorderImageOutset:
@@ -148,20 +220,52 @@
         return createFromDouble(style->borderRightWidth());
     case CSSPropertyBorderTopColor:
         return createFromColor(property, style);
+    case CSSPropertyBorderTopLeftRadius:
+        return createFromLengthSize(style->borderTopLeftRadius(), style);
+    case CSSPropertyBorderTopRightRadius:
+        return createFromLengthSize(style->borderTopRightRadius(), style);
     case CSSPropertyBorderTopWidth:
         return createFromDouble(style->borderTopWidth());
     case CSSPropertyBottom:
         return createFromLength(style->bottom(), style);
     case CSSPropertyClip:
-        return createFromLengthBox(style->clip(), style);
+        if (style->hasClip())
+            return createFromLengthBox(style->clip(), style);
+        return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueAuto));
     case CSSPropertyColor:
         return createFromColor(property, style);
+    case CSSPropertyFillOpacity:
+        return createFromDouble(style->fillOpacity());
+    case CSSPropertyFill:
+        return AnimatableSVGPaint::create(style->svgStyle()->fillPaintType(), style->svgStyle()->fillPaintColor(), style->svgStyle()->fillPaintUri());
+    case CSSPropertyFlexGrow:
+        return createFromDouble(style->flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
+    case CSSPropertyFlexShrink:
+        return createFromDouble(style->flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
+    case CSSPropertyFlexBasis:
+        return createFromLength(style->flexBasis(), style);
+    case CSSPropertyFloodColor:
+        return createFromColor(property, style);
+    case CSSPropertyFloodOpacity:
+        return createFromDouble(style->floodOpacity());
+    case CSSPropertyFontSize:
+        // Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size
+        // if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same).
+        // FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to
+        // enable text zoom rather than Text Autosizing? See http://crbug.com/227545.
+        return createFromDouble(style->specifiedFontSize());
     case CSSPropertyHeight:
         return createFromLength(style->height(), style);
+    case CSSPropertyKerning:
+        return AnimatableSVGLength::create(style->kerning());
+    case CSSPropertyLightingColor:
+        return createFromColor(property, style);
     case CSSPropertyListStyleImage:
         return AnimatableImage::create(style->listStyleImage());
     case CSSPropertyLeft:
         return createFromLength(style->left(), style);
+    case CSSPropertyLetterSpacing:
+        return createFromDouble(style->letterSpacing());
     case CSSPropertyMarginBottom:
         return createFromLength(style->marginBottom(), style);
     case CSSPropertyMarginLeft:
@@ -180,6 +284,8 @@
         return createFromLength(style->minWidth(), style);
     case CSSPropertyOpacity:
         return createFromDouble(style->opacity());
+    case CSSPropertyOrphans:
+        return createFromDouble(style->orphans());
     case CSSPropertyOutlineColor:
         return createFromColor(property, style);
     case CSSPropertyOutlineOffset:
@@ -196,24 +302,62 @@
         return createFromLength(style->paddingTop(), style);
     case CSSPropertyRight:
         return createFromLength(style->right(), style);
+    case CSSPropertyStrokeWidth:
+        return AnimatableSVGLength::create(style->strokeWidth());
+    case CSSPropertyStopColor:
+        return createFromColor(property, style);
+    case CSSPropertyStopOpacity:
+        return createFromDouble(style->stopOpacity());
+    case CSSPropertyStrokeDasharray:
+        return AnimatableStrokeDasharrayList::create(style->strokeDashArray());
+    case CSSPropertyStrokeDashoffset:
+        return AnimatableSVGLength::create(style->strokeDashOffset());
+    case CSSPropertyStrokeMiterlimit:
+        return createFromDouble(style->strokeMiterLimit());
+    case CSSPropertyStrokeOpacity:
+        return createFromDouble(style->strokeOpacity());
+    case CSSPropertyStroke:
+        return AnimatableSVGPaint::create(style->svgStyle()->strokePaintType(), style->svgStyle()->strokePaintColor(), style->svgStyle()->strokePaintUri());
     case CSSPropertyTextDecorationColor:
         return createFromColor(property, style);
+    case CSSPropertyTextIndent:
+        return createFromLength(style->textIndent(), style);
     case CSSPropertyTop:
         return createFromLength(style->top(), style);
+    case CSSPropertyWebkitBorderHorizontalSpacing:
+        return createFromDouble(style->horizontalBorderSpacing());
+    case CSSPropertyWebkitBorderVerticalSpacing:
+        return createFromDouble(style->verticalBorderSpacing());
+    case CSSPropertyWebkitClipPath:
+        return AnimatableClipPathOperation::create(style->clipPath());
+    case CSSPropertyWebkitColumnCount:
+        return createFromDouble(style->columnCount());
+    case CSSPropertyWebkitColumnGap:
+        return createFromDouble(style->columnGap());
     case CSSPropertyWebkitColumnRuleColor:
         return createFromColor(property, style);
+    case CSSPropertyWebkitColumnRuleWidth:
+        return createFromDouble(style->columnRuleWidth());
+    case CSSPropertyWebkitColumnWidth:
+        return createFromDouble(style->columnWidth());
     case CSSPropertyWebkitMaskBoxImageSource:
         return AnimatableImage::create(style->maskBoxImageSource());
     case CSSPropertyWebkitMaskImage:
         return AnimatableImage::create(style->maskImage());
+    case CSSPropertyWebkitMaskPositionX:
+        return createFromFillLayers<CSSPropertyWebkitMaskPositionX>(style->maskLayers(), style);
+    case CSSPropertyWebkitMaskPositionY:
+        return createFromFillLayers<CSSPropertyWebkitMaskPositionY>(style->maskLayers(), style);
+    case CSSPropertyWebkitPerspective:
+        return createFromDouble(style->perspective());
     case CSSPropertyWebkitPerspectiveOriginX:
         return createFromLength(style->perspectiveOriginX(), style);
     case CSSPropertyWebkitPerspectiveOriginY:
         return createFromLength(style->perspectiveOriginY(), style);
+    case CSSPropertyWebkitShapeInside:
+        return AnimatableShapeValue::create(style->shapeInside());
     case CSSPropertyWebkitTextEmphasisColor:
         return createFromColor(property, style);
-    case CSSPropertyWebkitTextFillColor:
-        return createFromColor(property, style);
     case CSSPropertyWebkitTextStrokeColor:
         return createFromColor(property, style);
     case CSSPropertyWebkitTransform:
@@ -222,12 +366,20 @@
         return createFromLength(style->transformOriginX(), style);
     case CSSPropertyWebkitTransformOriginY:
         return createFromLength(style->transformOriginY(), style);
+    case CSSPropertyWebkitTransformOriginZ:
+        return createFromDouble(style->transformOriginZ());
+    case CSSPropertyWidows:
+        return createFromDouble(style->widows());
     case CSSPropertyWidth:
         return createFromLength(style->width(), style);
+    case CSSPropertyWordSpacing:
+        return createFromDouble(style->wordSpacing());
     case CSSPropertyVisibility:
         return AnimatableVisibility::create(style->visibility());
     case CSSPropertyZIndex:
         return createFromDouble(style->zIndex());
+    case CSSPropertyZoom:
+        return createFromDouble(style->zoom());
     default:
         RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(property), "Web Animations not yet implemented: Create AnimatableValue from render style: %s", getPropertyNameString(property).utf8().data());
         ASSERT_NOT_REACHED();
diff --git a/Source/core/animation/css/CSSAnimations.cpp b/Source/core/animation/css/CSSAnimations.cpp
index 162ffd9..8360d2b 100644
--- a/Source/core/animation/css/CSSAnimations.cpp
+++ b/Source/core/animation/css/CSSAnimations.cpp
@@ -31,21 +31,38 @@
 #include "config.h"
 #include "core/animation/css/CSSAnimations.h"
 
+#include "StylePropertyShorthand.h"
 #include "core/animation/ActiveAnimations.h"
 #include "core/animation/DocumentTimeline.h"
 #include "core/animation/KeyframeAnimationEffect.h"
+#include "core/animation/css/CSSAnimatableValueFactory.h"
 #include "core/css/CSSKeyframeRule.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/Element.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/events/TransitionEvent.h"
 #include "core/events/WebKitAnimationEvent.h"
 #include "core/platform/animation/CSSAnimationDataList.h"
 #include "core/platform/animation/TimingFunction.h"
 #include "wtf/HashSet.h"
 
-namespace {
+namespace WebCore {
 
-using namespace WebCore;
+struct CandidateTransition {
+    CandidateTransition(PassRefPtr<AnimatableValue> from, PassRefPtr<AnimatableValue> to, const CSSAnimationData* anim)
+        : from(from)
+        , to(to)
+        , anim(anim)
+    {
+    }
+    CandidateTransition() { } // The HashMap calls the default ctor
+    RefPtr<AnimatableValue> from;
+    RefPtr<AnimatableValue> to;
+    const CSSAnimationData* anim;
+};
+typedef HashMap<CSSPropertyID, CandidateTransition> CandidateTransitionMap;
+
+namespace {
 
 bool isEarlierPhase(TimedItem::Phase target, TimedItem::Phase reference)
 {
@@ -61,10 +78,6 @@
     return target > reference;
 }
 
-} // namespace
-
-namespace WebCore {
-
 // Returns the default timing function.
 const PassRefPtr<TimingFunction> timingFromAnimationData(const CSSAnimationData* animationData, Timing& timing)
 {
@@ -97,6 +110,8 @@
         default:
             ASSERT_NOT_REACHED();
         }
+    } else {
+        timing.fillMode = Timing::FillModeNone;
     }
     if (animationData->isDirectionSet()) {
         switch (animationData->direction()) {
@@ -119,6 +134,48 @@
     return animationData->isTimingFunctionSet() ? animationData->timingFunction() : CSSAnimationData::initialAnimationTimingFunction();
 }
 
+void calculateCandidateTransitionForProperty(const CSSAnimationData* anim, CSSPropertyID id, const RenderStyle* oldStyle, const RenderStyle* newStyle, CandidateTransitionMap& candidateMap)
+{
+    RefPtr<AnimatableValue> from = CSSAnimatableValueFactory::create(id, oldStyle);
+    RefPtr<AnimatableValue> to = CSSAnimatableValueFactory::create(id, newStyle);
+    // If we have multiple transitions on the same property, we will use the
+    // last one since we iterate over them in order and this will override
+    // a previously set CandidateTransition.
+    if (!from->equals(to.get()))
+        candidateMap.add(id, CandidateTransition(from.release(), to.release(), anim));
+}
+
+void computeCandidateTransitions(const RenderStyle* oldStyle, const RenderStyle* newStyle, CandidateTransitionMap& candidateMap, HashSet<CSSPropertyID>& listedProperties)
+{
+    if (!newStyle->transitions())
+        return;
+
+    for (size_t i = 0; i < newStyle->transitions()->size(); ++i) {
+        const CSSAnimationData* anim = newStyle->transitions()->animation(i);
+        CSSAnimationData::AnimationMode mode = anim->animationMode();
+        if (anim->duration() + anim->delay() <= 0 || mode == CSSAnimationData::AnimateNone)
+            continue;
+
+        bool animateAll = mode == CSSAnimationData::AnimateAll;
+        ASSERT(animateAll || mode == CSSAnimationData::AnimateSingleProperty);
+        const StylePropertyShorthand& propertyList = animateAll ? CSSAnimations::animatableProperties() : shorthandForProperty(anim->property());
+        if (!propertyList.length()) {
+            listedProperties.add(anim->property());
+            calculateCandidateTransitionForProperty(anim, anim->property(), oldStyle, newStyle, candidateMap);
+        } else {
+            for (unsigned i = 0; i < propertyList.length(); ++i) {
+                CSSPropertyID id = propertyList.properties()[i];
+                if (!animateAll && !CSSAnimations::isAnimatableProperty(id))
+                    continue;
+                listedProperties.add(id);
+                calculateCandidateTransitionForProperty(anim, id, oldStyle, newStyle, candidateMap);
+            }
+        }
+    }
+}
+
+} // namespace
+
 CSSAnimationUpdateScope::CSSAnimationUpdateScope(Element* target)
     : m_target(target)
 {
@@ -143,24 +200,26 @@
         cssAnimations->maybeApplyPendingUpdate(m_target);
 }
 
-bool CSSAnimations::needsUpdate(const Element* element, const RenderStyle* style)
+PassOwnPtr<CSSAnimationUpdate> CSSAnimations::calculateUpdate(Element* element, const RenderStyle* style, StyleResolver* resolver)
 {
-    ActiveAnimations* activeAnimations = element->activeAnimations();
-    const CSSAnimationDataList* animations = style->animations();
-    const CSSAnimations* cssAnimations = activeAnimations ? activeAnimations->cssAnimations() : 0;
-    EDisplay display = style->display();
-    return (display != NONE && animations && animations->size()) || (cssAnimations && !cssAnimations->isEmpty());
+    ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled());
+    OwnPtr<CSSAnimationUpdate> update = adoptPtr(new CSSAnimationUpdate());
+    calculateAnimationUpdate(update.get(), element, style, resolver);
+    calculateTransitionUpdate(update.get(), element, style);
+    return update->isEmpty() ? nullptr : update.release();
 }
 
-PassOwnPtr<CSSAnimationUpdate> CSSAnimations::calculateUpdate(const Element* element, const RenderStyle* style, const CSSAnimations* cssAnimations, const CSSAnimationDataList* animationDataList, StyleResolver* resolver)
+void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate* update, Element* element, const RenderStyle* style, StyleResolver* resolver)
 {
-    OwnPtr<CSSAnimationUpdate> update;
+    ActiveAnimations* activeAnimations = element->activeAnimations();
+    const CSSAnimationDataList* animationDataList = style->animations();
+    const CSSAnimations* cssAnimations = activeAnimations ? activeAnimations->cssAnimations() : 0;
+
     HashSet<AtomicString> inactive;
     if (cssAnimations)
         for (AnimationMap::const_iterator iter = cssAnimations->m_animations.begin(); iter != cssAnimations->m_animations.end(); ++iter)
             inactive.add(iter->key);
 
-    RefPtr<MutableStylePropertySet> newStyles;
     if (style->display() != NONE) {
         for (size_t i = 0; animationDataList && i < animationDataList->size(); ++i) {
             const CSSAnimationData* animationData = animationDataList->animation(i);
@@ -180,23 +239,23 @@
 
             Timing timing;
             RefPtr<TimingFunction> defaultTimingFunction = timingFromAnimationData(animationData, timing);
-            KeyframeAnimationEffect::KeyframeVector keyframes;
-            resolver->resolveKeyframes(element, style, animationName, defaultTimingFunction.get(), keyframes, timing.timingFunction);
-            if (!keyframes.isEmpty()) {
-                if (!update)
-                    update = adoptPtr(new CSSAnimationUpdate());
-                // FIXME: crbug.com/268791 - Keyframes are already normalized, perhaps there should be a flag on KeyframeAnimationEffect to skip normalization.
-                update->startAnimation(animationName, InertAnimation::create(KeyframeAnimationEffect::create(keyframes), timing).get());
+            Vector<std::pair<KeyframeAnimationEffect::KeyframeVector, RefPtr<TimingFunction> > > keyframesAndTimingFunctions;
+            resolver->resolveKeyframes(element, style, animationName, defaultTimingFunction.get(), keyframesAndTimingFunctions);
+            if (!keyframesAndTimingFunctions.isEmpty()) {
+                HashSet<RefPtr<InertAnimation> > animations;
+                for (size_t j = 0; j < keyframesAndTimingFunctions.size(); ++j) {
+                    ASSERT(!keyframesAndTimingFunctions[j].first.isEmpty());
+                    timing.timingFunction = keyframesAndTimingFunctions[j].second;
+                    // FIXME: crbug.com/268791 - Keyframes are already normalized, perhaps there should be a flag on KeyframeAnimationEffect to skip normalization.
+                    animations.add(InertAnimation::create(KeyframeAnimationEffect::create(keyframesAndTimingFunctions[j].first), timing));
+                }
+                update->startAnimation(animationName, animations);
             }
         }
     }
 
-    if (!inactive.isEmpty() && !update)
-        update = adoptPtr(new CSSAnimationUpdate());
     for (HashSet<AtomicString>::const_iterator iter = inactive.begin(); iter != inactive.end(); ++iter)
         update->cancelAnimation(*iter, cssAnimations->m_animations.get(*iter));
-
-    return update.release();
 }
 
 void CSSAnimations::maybeApplyPendingUpdate(Element* element)
@@ -209,35 +268,134 @@
 
     OwnPtr<CSSAnimationUpdate> update = m_pendingUpdate.release();
 
-    for (Vector<AtomicString>::const_iterator iter = update->cancelledAnimationNames().begin(); iter != update->cancelledAnimationNames().end(); ++iter)
-        m_animations.take(*iter)->cancel();
+    for (Vector<AtomicString>::const_iterator iter = update->cancelledAnimationNames().begin(); iter != update->cancelledAnimationNames().end(); ++iter) {
+        const HashSet<RefPtr<Player> >& players = m_animations.take(*iter);
+        for (HashSet<RefPtr<Player> >::const_iterator iter = players.begin(); iter != players.end(); ++iter)
+            (*iter)->cancel();
+    }
 
     // FIXME: Apply updates to play-state.
 
     for (Vector<CSSAnimationUpdate::NewAnimation>::const_iterator iter = update->newAnimations().begin(); iter != update->newAnimations().end(); ++iter) {
-        OwnPtr<CSSAnimations::EventDelegate> eventDelegate = adoptPtr(new EventDelegate(element, iter->name));
-        RefPtr<Animation> animation = Animation::create(element, iter->animation->effect(), iter->animation->specified(), eventDelegate.release());
-        RefPtr<Player> player = element->document().timeline()->play(animation.get());
-        m_animations.set(iter->name, player.get());
+        OwnPtr<AnimationEventDelegate> eventDelegate = adoptPtr(new AnimationEventDelegate(element, iter->name));
+        HashSet<RefPtr<Player> > players;
+        for (HashSet<RefPtr<InertAnimation> >::const_iterator animationsIter = iter->animations.begin(); animationsIter != iter->animations.end(); ++animationsIter) {
+            const InertAnimation* inertAnimation = animationsIter->get();
+            // The event delegate is set on the the first animation only. We
+            // rely on the behavior of OwnPtr::release() to achieve this.
+            RefPtr<Animation> animation = Animation::create(element, inertAnimation->effect(), inertAnimation->specified(), eventDelegate.release());
+            players.add(element->document().timeline()->play(animation.get()));
+        }
+        m_animations.set(iter->name, players);
+    }
+
+    for (HashSet<CSSPropertyID>::iterator iter = update->cancelledTransitions().begin(); iter != update->cancelledTransitions().end(); ++iter) {
+        ASSERT(m_transitions.contains(*iter));
+        m_transitions.take(*iter).player->cancel();
+    }
+
+    for (size_t i = 0; i < update->newTransitions().size(); ++i) {
+        const CSSAnimationUpdate::NewTransition& newTransition = update->newTransitions()[i];
+
+        RunningTransition runningTransition;
+        runningTransition.from = newTransition.from;
+        runningTransition.to = newTransition.to;
+
+        CSSPropertyID id = newTransition.id;
+        InertAnimation* inertAnimation = newTransition.animation.get();
+        OwnPtr<TransitionEventDelegate> eventDelegate = adoptPtr(new TransitionEventDelegate(element, id));
+        RefPtr<Animation> transition = Animation::create(element, inertAnimation->effect(), inertAnimation->specified(), eventDelegate.release());
+        // FIXME: Transitions need to be added to a separate timeline.
+        runningTransition.player = element->document().timeline()->play(transition.get());
+        m_transitions.set(id, runningTransition);
+    }
+}
+
+void CSSAnimations::calculateTransitionUpdateForProperty(CSSAnimationUpdate* update, CSSPropertyID id, const CandidateTransition& newTransition, const TransitionMap* existingTransitions)
+{
+    // FIXME: Skip the rest of this if there is a running animation on this property
+
+    if (existingTransitions) {
+        TransitionMap::const_iterator existingTransitionIter = existingTransitions->find(id);
+
+        if (existingTransitionIter != existingTransitions->end() && !update->cancelledTransitions().contains(id)) {
+            const AnimatableValue* existingTo = existingTransitionIter->value.to;
+            if (newTransition.to->equals(existingTo))
+                return;
+            update->cancelTransition(id);
+        }
+    }
+
+    KeyframeAnimationEffect::KeyframeVector keyframes;
+
+    RefPtr<Keyframe> startKeyframe = Keyframe::create();
+    startKeyframe->setPropertyValue(id, newTransition.from.get());
+    startKeyframe->setOffset(0);
+    keyframes.append(startKeyframe);
+
+    RefPtr<Keyframe> endKeyframe = Keyframe::create();
+    endKeyframe->setPropertyValue(id, newTransition.to.get());
+    endKeyframe->setOffset(1);
+    keyframes.append(endKeyframe);
+
+    RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(keyframes);
+
+    Timing timing;
+    RefPtr<TimingFunction> timingFunction = timingFromAnimationData(newTransition.anim, timing);
+    timing.timingFunction = timingFunction;
+    // Note that the backwards part is required for delay to work.
+    timing.fillMode = Timing::FillModeBoth;
+
+    update->startTransition(id, newTransition.from.get(), newTransition.to.get(), InertAnimation::create(effect, timing));
+}
+
+void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const Element* element, const RenderStyle* style)
+{
+    ActiveAnimations* activeAnimations = element->activeAnimations();
+    const CSSAnimations* cssAnimations = activeAnimations ? activeAnimations->cssAnimations() : 0;
+    const TransitionMap* transitions = cssAnimations ? &cssAnimations->m_transitions : 0;
+
+    HashSet<CSSPropertyID> listedProperties;
+    if (style->display() != NONE && element->renderer() && element->renderer()->style()) {
+        CandidateTransitionMap candidateMap;
+        computeCandidateTransitions(element->renderer()->style(), style, candidateMap, listedProperties);
+        for (CandidateTransitionMap::const_iterator iter = candidateMap.begin(); iter != candidateMap.end(); ++iter)
+            calculateTransitionUpdateForProperty(update, iter->key, iter->value, transitions);
+    }
+
+    if (transitions) {
+        for (TransitionMap::const_iterator iter = transitions->begin(); iter != transitions->end(); ++iter) {
+            const TimedItem* timedItem = iter->value.player->source();
+            CSSPropertyID id = iter->key;
+            if (timedItem->phase() == TimedItem::PhaseAfter || !listedProperties.contains(id))
+                update->cancelTransition(id);
+        }
     }
 }
 
 void CSSAnimations::cancel()
 {
-    for (AnimationMap::iterator iter = m_animations.begin(); iter != m_animations.end(); ++iter)
-        iter->value->cancel();
+    for (AnimationMap::iterator iter = m_animations.begin(); iter != m_animations.end(); ++iter) {
+        const HashSet<RefPtr<Player> >& players = iter->value;
+        for (HashSet<RefPtr<Player> >::const_iterator animationsIter = players.begin(); animationsIter != players.end(); ++animationsIter)
+            (*animationsIter)->cancel();
+    }
+
+    for (TransitionMap::iterator iter = m_transitions.begin(); iter != m_transitions.end(); ++iter)
+        iter->value.player->cancel();
 
     m_animations.clear();
+    m_transitions.clear();
     m_pendingUpdate = nullptr;
 }
 
-void CSSAnimations::EventDelegate::maybeDispatch(Document::ListenerType listenerType, AtomicString& eventName, double elapsedTime)
+void CSSAnimations::AnimationEventDelegate::maybeDispatch(Document::ListenerType listenerType, const AtomicString& eventName, double elapsedTime)
 {
     if (m_target->document().hasListenerType(listenerType))
         m_target->document().timeline()->addEventToDispatch(m_target, WebKitAnimationEvent::create(eventName, m_name, elapsedTime));
 }
 
-void CSSAnimations::EventDelegate::onEventCondition(const TimedItem* timedItem, bool isFirstSample, TimedItem::Phase previousPhase, double previousIteration)
+void CSSAnimations::AnimationEventDelegate::onEventCondition(const TimedItem* timedItem, bool isFirstSample, TimedItem::Phase previousPhase, double previousIteration)
 {
     // Events for a single document are queued and dispatched as a group at
     // the end of DocumentTimeline::serviceAnimations.
@@ -256,7 +414,7 @@
         // the elapsedTime for the first iteration in question.
         ASSERT(timedItem->specified().hasIterationDuration);
         const double elapsedTime = timedItem->specified().iterationDuration * (previousIteration + 1);
-        maybeDispatch(Document::ANIMATIONITERATION_LISTENER, eventNames().animationiterationEvent, elapsedTime);
+        maybeDispatch(Document::ANIMATIONITERATION_LISTENER, EventTypeNames::animationiteration, elapsedTime);
         return;
     }
     if ((isFirstSample || previousPhase == TimedItem::PhaseBefore) && isLaterPhase(currentPhase, TimedItem::PhaseBefore)) {
@@ -264,12 +422,30 @@
         // The spec states that the elapsed time should be
         // 'delay < 0 ? -delay : 0', but we always use 0 to match the existing
         // implementation. See crbug.com/279611
-        maybeDispatch(Document::ANIMATIONSTART_LISTENER, eventNames().animationstartEvent, 0);
+        maybeDispatch(Document::ANIMATIONSTART_LISTENER, EventTypeNames::animationstart, 0);
     }
     if ((isFirstSample || isEarlierPhase(previousPhase, TimedItem::PhaseAfter)) && currentPhase == TimedItem::PhaseAfter)
-        maybeDispatch(Document::ANIMATIONEND_LISTENER, eventNames().animationendEvent, timedItem->activeDuration());
+        maybeDispatch(Document::ANIMATIONEND_LISTENER, EventTypeNames::animationend, timedItem->activeDuration());
 }
 
+void CSSAnimations::TransitionEventDelegate::onEventCondition(const TimedItem* timedItem, bool isFirstSample, TimedItem::Phase previousPhase, double previousIteration)
+{
+    // Events for a single document are queued and dispatched as a group at
+    // the end of DocumentTimeline::serviceAnimations.
+    // FIXME: Events which are queued outside of serviceAnimations should
+    // trigger a timer to dispatch when control is released.
+    const TimedItem::Phase currentPhase = timedItem->phase();
+    if (currentPhase == TimedItem::PhaseAfter && (isFirstSample || previousPhase != currentPhase) && m_target->document().hasListenerType(Document::TRANSITIONEND_LISTENER)) {
+        String propertyName = getPropertyNameString(m_property);
+        const Timing& timing = timedItem->specified();
+        double elapsedTime = timing.iterationDuration;
+        const AtomicString& eventType = EventTypeNames::transitionend;
+        String pseudoElement = PseudoElement::pseudoElementNameForEvents(m_target->pseudoId());
+        m_target->document().timeline()->addEventToDispatch(m_target, TransitionEvent::create(eventType, propertyName, elapsedTime, pseudoElement));
+    }
+}
+
+
 bool CSSAnimations::isAnimatableProperty(CSSPropertyID property)
 {
     switch (property) {
@@ -301,7 +477,13 @@
     case CSSPropertyColor:
     case CSSPropertyFill:
     case CSSPropertyFillOpacity:
+    // FIXME: Shorthands should not be present in this list, but
+    // CSSPropertyAnimation implements animation of flex directly and
+    // makes use of this method.
     case CSSPropertyFlex:
+    case CSSPropertyFlexBasis:
+    case CSSPropertyFlexGrow:
+    case CSSPropertyFlexShrink:
     case CSSPropertyFloodColor:
     case CSSPropertyFloodOpacity:
     case CSSPropertyFontSize:
@@ -364,7 +546,6 @@
     case CSSPropertyWebkitPerspectiveOriginX:
     case CSSPropertyWebkitPerspectiveOriginY:
     case CSSPropertyWebkitShapeInside:
-    case CSSPropertyWebkitTextFillColor:
     case CSSPropertyWebkitTextStrokeColor:
     case CSSPropertyWebkitTransform:
     case CSSPropertyWebkitTransformOriginX:
@@ -381,4 +562,23 @@
     }
 }
 
+const StylePropertyShorthand& CSSAnimations::animatableProperties()
+{
+    DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ());
+    DEFINE_STATIC_LOCAL(StylePropertyShorthand, propertyShorthand, ());
+    if (properties.isEmpty()) {
+        for (int i = firstCSSProperty; i < lastCSSProperty; ++i) {
+            CSSPropertyID id = convertToCSSPropertyID(i);
+            // FIXME: This is the only shorthand marked as animatable,
+            // it'll be removed from the list once we switch to the new implementation.
+            if (id == CSSPropertyFlex)
+                continue;
+            if (isAnimatableProperty(id))
+                properties.append(id);
+        }
+        propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, properties.begin(), properties.size());
+    }
+    return propertyShorthand;
+}
+
 } // namespace WebCore
diff --git a/Source/core/animation/css/CSSAnimations.h b/Source/core/animation/css/CSSAnimations.h
index f59b8f6..0853351 100644
--- a/Source/core/animation/css/CSSAnimations.h
+++ b/Source/core/animation/css/CSSAnimations.h
@@ -44,9 +44,9 @@
 
 namespace WebCore {
 
-class CSSAnimationDataList;
+class CandidateTransition;
 class Element;
-class RenderObject;
+class StylePropertyShorthand;
 class StyleResolver;
 
 // Applied to scopes where an animation update will be added as pending and should then be applied (eg. Element style recalc).
@@ -60,59 +60,128 @@
 
 class CSSAnimationUpdate FINAL {
 public:
-    void startAnimation(AtomicString& animationName, PassRefPtr<InertAnimation> animation)
+    void startAnimation(AtomicString& animationName, const HashSet<RefPtr<InertAnimation> >& animations)
     {
         NewAnimation newAnimation;
         newAnimation.name = animationName;
-        newAnimation.animation = animation;
+        newAnimation.animations = animations;
         m_newAnimations.append(newAnimation);
     }
     // Returns whether player has been cancelled and should be filtered during style application.
-    bool isCancelled(const Player* player) const { return m_cancelledAnimationPlayers.contains(player); }
-    void cancelAnimation(const AtomicString& name, const Player* player)
+    bool isCancelledAnimation(const Player* player) const { return m_cancelledAnimationPlayers.contains(player); }
+    void cancelAnimation(const AtomicString& name, const HashSet<RefPtr<Player> >& players)
     {
         m_cancelledAnimationNames.append(name);
-        m_cancelledAnimationPlayers.add(player);
+        for (HashSet<RefPtr<Player> >::const_iterator iter = players.begin(); iter != players.end(); ++iter)
+            m_cancelledAnimationPlayers.add(iter->get());
     }
+
+    void startTransition(CSSPropertyID id, const AnimatableValue* from, const AnimatableValue* to, PassRefPtr<InertAnimation> animation)
+    {
+        NewTransition newTransition;
+        newTransition.id = id;
+        newTransition.from = from;
+        newTransition.to = to;
+        newTransition.animation = animation;
+        m_newTransitions.append(newTransition);
+    }
+    void cancelTransition(CSSPropertyID id) { m_cancelledTransitions.add(id); }
+
     struct NewAnimation {
         AtomicString name;
-        RefPtr<InertAnimation> animation;
+        HashSet<RefPtr<InertAnimation> > animations;
     };
     const Vector<NewAnimation>& newAnimations() const { return m_newAnimations; }
     const Vector<AtomicString>& cancelledAnimationNames() const { return m_cancelledAnimationNames; }
+
+    struct NewTransition {
+        CSSPropertyID id;
+        const AnimatableValue* from;
+        const AnimatableValue* to;
+        RefPtr<InertAnimation> animation;
+    };
+    const Vector<NewTransition>& newTransitions() const { return m_newTransitions; }
+    const HashSet<CSSPropertyID>& cancelledTransitions() const { return m_cancelledTransitions; }
+
+    bool isEmpty() const
+    {
+        return m_newAnimations.isEmpty()
+            && m_cancelledAnimationNames.isEmpty()
+            && m_cancelledAnimationPlayers.isEmpty()
+            && m_newTransitions.isEmpty()
+            && m_cancelledTransitions.isEmpty();
+    }
 private:
-    // Order is significant since it defines the order in which new animations will be started.
+    // Order is significant since it defines the order in which new animations
+    // will be started. Note that there may be multiple animations present
+    // with the same name, due to the way in which we split up animations with
+    // incomplete keyframes.
     Vector<NewAnimation> m_newAnimations;
     Vector<AtomicString> m_cancelledAnimationNames;
     HashSet<const Player*> m_cancelledAnimationPlayers;
+
+    Vector<NewTransition> m_newTransitions;
+    HashSet<CSSPropertyID> m_cancelledTransitions;
 };
 
 class CSSAnimations FINAL {
 public:
     static bool isAnimatableProperty(CSSPropertyID);
-    static bool needsUpdate(const Element*, const RenderStyle*);
-    static PassOwnPtr<CSSAnimationUpdate> calculateUpdate(const Element*, const RenderStyle*, const CSSAnimations*, const CSSAnimationDataList*, StyleResolver*);
+    static const StylePropertyShorthand& animatableProperties();
+    // FIXME: This should take a const ScopedStyleTree instead of a StyleResolver.
+    // We should also change the Element* to a const Element*
+    static PassOwnPtr<CSSAnimationUpdate> calculateUpdate(Element*, const RenderStyle*, StyleResolver*);
+
     void setPendingUpdate(PassOwnPtr<CSSAnimationUpdate> update) { m_pendingUpdate = update; }
     void maybeApplyPendingUpdate(Element*);
-    bool isEmpty() const { return m_animations.isEmpty() && !m_pendingUpdate; }
+    bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpty() && !m_pendingUpdate; }
     void cancel();
 private:
-    typedef HashMap<AtomicString, RefPtr<Player> > AnimationMap;
+    // Note that a single animation name may map to multiple players due to
+    // the way in which we split up animations with incomplete keyframes.
+    // FIXME: Once the Web Animations model supports groups, we could use a
+    // ParGroup to drive multiple animations from a single Player.
+    typedef HashMap<AtomicString, HashSet<RefPtr<Player> > > AnimationMap;
+    struct RunningTransition {
+        RefPtr<Player> player;
+        const AnimatableValue* from;
+        const AnimatableValue* to;
+    };
+    typedef HashMap<CSSPropertyID, RunningTransition > TransitionMap;
     AnimationMap m_animations;
+    TransitionMap m_transitions;
     OwnPtr<CSSAnimationUpdate> m_pendingUpdate;
-    class EventDelegate FINAL : public TimedItem::EventDelegate {
+
+    static void calculateAnimationUpdate(CSSAnimationUpdate*, Element*, const RenderStyle*, StyleResolver*);
+    static void calculateTransitionUpdate(CSSAnimationUpdate*, const Element*, const RenderStyle*);
+    static void calculateTransitionUpdateForProperty(CSSAnimationUpdate*, CSSPropertyID, const CandidateTransition&, const TransitionMap*);
+
+    class AnimationEventDelegate FINAL : public TimedItem::EventDelegate {
     public:
-        EventDelegate(Element* target, const AtomicString& name)
+        AnimationEventDelegate(Element* target, const AtomicString& name)
             : m_target(target)
             , m_name(name)
         {
         }
         virtual void onEventCondition(const TimedItem*, bool isFirstSample, TimedItem::Phase previousPhase, double previousIteration) OVERRIDE;
     private:
-        void maybeDispatch(Document::ListenerType, AtomicString& eventName, double elapsedTime);
+        void maybeDispatch(Document::ListenerType, const AtomicString& eventName, double elapsedTime);
         Element* m_target;
         const AtomicString m_name;
     };
+
+    class TransitionEventDelegate FINAL : public TimedItem::EventDelegate {
+    public:
+        TransitionEventDelegate(Element* target, CSSPropertyID property)
+            : m_target(target)
+            , m_property(property)
+        {
+        }
+        virtual void onEventCondition(const TimedItem*, bool isFirstSample, TimedItem::Phase previousPhase, double previousIteration) OVERRIDE;
+    private:
+        Element* m_target;
+        const CSSPropertyID m_property;
+    };
 };
 
 } // namespace WebCore
diff --git a/Source/core/core.gyp b/Source/core/core.gyp
index d40a4b8..8625aa1 100644
--- a/Source/core/core.gyp
+++ b/Source/core/core.gyp
@@ -31,7 +31,7 @@
 {
   'includes': [
     '../build/win/precompile.gypi',
-    'features.gypi',
+    '../build/features.gypi',
     '../modules/modules.gypi',
     '../bindings/bindings.gypi',
     'core.gypi',
@@ -172,7 +172,7 @@
         'output_file_path': '<(SHARED_INTERMEDIATE_DIR)/blink/InspectorOverlayPage.h',
         'character_array_name': 'InspectorOverlayPage_html',
       },
-      'includes': [ 'ConvertFileToHeaderWithCharacterArray.gypi' ],
+      'includes': [ '../build/ConvertFileToHeaderWithCharacterArray.gypi' ],
     },
     {
       'target_name': 'injected_canvas_script_source',
@@ -182,7 +182,7 @@
         'output_file_path': '<(SHARED_INTERMEDIATE_DIR)/blink/InjectedScriptCanvasModuleSource.h',
         'character_array_name': 'InjectedScriptCanvasModuleSource_js',
       },
-      'includes': [ 'ConvertFileToHeaderWithCharacterArray.gypi' ],
+      'includes': [ '../build/ConvertFileToHeaderWithCharacterArray.gypi' ],
     },
     {
       'target_name': 'injected_script_source',
@@ -192,7 +192,7 @@
         'output_file_path': '<(SHARED_INTERMEDIATE_DIR)/blink/InjectedScriptSource.h',
         'character_array_name': 'InjectedScriptSource_js',
       },
-      'includes': [ 'ConvertFileToHeaderWithCharacterArray.gypi' ],
+      'includes': [ '../build/ConvertFileToHeaderWithCharacterArray.gypi' ],
     },
     {
       'target_name': 'debugger_script_source',
@@ -202,7 +202,7 @@
         'output_file_path': '<(SHARED_INTERMEDIATE_DIR)/blink/DebuggerScriptSource.h',
         'character_array_name': 'DebuggerScriptSource_js',
       },
-      'includes': [ 'ConvertFileToHeaderWithCharacterArray.gypi' ],
+      'includes': [ '../build/ConvertFileToHeaderWithCharacterArray.gypi' ],
     },
     {
       'target_name': 'webcore_derived',
@@ -257,25 +257,31 @@
         '<(SHARED_INTERMEDIATE_DIR)/blink/CSSValueKeywords.cpp',
 
         # Additional .cpp files from make_derived_sources actions.
-        '<(SHARED_INTERMEDIATE_DIR)/blink/HTMLElementFactory.cpp',
-        '<(SHARED_INTERMEDIATE_DIR)/blink/HTMLNames.cpp',
-        '<(SHARED_INTERMEDIATE_DIR)/blink/FetchInitiatorTypeNames.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/CalendarPicker.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/ColorSuggestionPicker.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/Event.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/EventHeaders.h',
         '<(SHARED_INTERMEDIATE_DIR)/blink/EventInterfaces.h',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/EventNames.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/EventNames.h',
         '<(SHARED_INTERMEDIATE_DIR)/blink/EventTargetHeaders.h',
         '<(SHARED_INTERMEDIATE_DIR)/blink/EventTargetInterfaces.h',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/EventTargetNames.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/EventTargetNames.h',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/EventTypeNames.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/EventTypeNames.h',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/FetchInitiatorTypeNames.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/FontFamilyNames.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/HTMLElementFactory.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/HTMLNames.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/MathMLNames.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/PickerCommon.cpp',
+        '<(SHARED_INTERMEDIATE_DIR)/blink/SVGNames.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/UserAgentStyleSheetsData.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/V8HTMLElementWrapperFactory.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/XLinkNames.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/XMLNSNames.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/XMLNames.cpp',
-        '<(SHARED_INTERMEDIATE_DIR)/blink/SVGNames.cpp',
-        '<(SHARED_INTERMEDIATE_DIR)/blink/MathMLNames.cpp',
-        '<(SHARED_INTERMEDIATE_DIR)/blink/FontFamilyNames.cpp',
 
         # Generated from HTMLEntityNames.in
         '<(SHARED_INTERMEDIATE_DIR)/blink/HTMLEntityTable.cpp',
@@ -286,6 +292,9 @@
         # Generated from CSSParser-in.cpp
         '<(SHARED_INTERMEDIATE_DIR)/blink/CSSParser.cpp',
 
+        # Generated from HTMLMetaElement-in.cpp
+        '<(SHARED_INTERMEDIATE_DIR)/blink/HTMLMetaElement.cpp',
+
         # Additional .cpp files from the make_derived_sources rules.
         '<(SHARED_INTERMEDIATE_DIR)/blink/CSSGrammar.cpp',
         '<(SHARED_INTERMEDIATE_DIR)/blink/XPathGrammar.cpp',
@@ -354,9 +363,9 @@
         '../config.gyp:config',
         '../platform/blink_platform.gyp:blink_platform',
         '../weborigin/weborigin.gyp:weborigin',
-        '<(DEPTH)/third_party/angle_dx11/src/build_angle.gyp:translator_glsl',
         '<(DEPTH)/gpu/gpu.gyp:gles2_c_lib',
         '<(DEPTH)/skia/skia.gyp:skia',
+        '<(DEPTH)/third_party/angle_dx11/src/build_angle.gyp:translator',
         '<(DEPTH)/third_party/iccjpeg/iccjpeg.gyp:iccjpeg',
         '<(DEPTH)/third_party/libpng/libpng.gyp:libpng',
         '<(DEPTH)/third_party/libwebp/libwebp.gyp:libwebp',
@@ -374,9 +383,9 @@
       'export_dependent_settings': [
         '../wtf/wtf.gyp:wtf',
         '../config.gyp:config',
-        '<(DEPTH)/third_party/angle_dx11/src/build_angle.gyp:translator_glsl',
         '<(DEPTH)/gpu/gpu.gyp:gles2_c_lib',
         '<(DEPTH)/skia/skia.gyp:skia',
+        '<(DEPTH)/third_party/angle_dx11/src/build_angle.gyp:translator',
         '<(DEPTH)/third_party/iccjpeg/iccjpeg.gyp:iccjpeg',
         '<(DEPTH)/third_party/libpng/libpng.gyp:libpng',
         '<(DEPTH)/third_party/libwebp/libwebp.gyp:libwebp',
@@ -394,12 +403,12 @@
       'direct_dependent_settings': {
         'defines': [
           'BLINK_IMPLEMENTATION=1',
-          'INSIDE_WEBKIT',
+          'INSIDE_BLINK',
         ],
         'include_dirs': [
           '<@(webcore_include_dirs)',
           '<(DEPTH)/gpu',
-          '<(DEPTH)/third_party/angle_dx11/include/GLSLANG',
+          '<(DEPTH)/third_party/angle_dx11/include',
         ],
         'msvs_disabled_warnings': [
           4138, 4244, 4291, 4305, 4344, 4355, 4521, 4099,
@@ -493,7 +502,7 @@
                       'TCMInterposing|ScrollAnimatorChromiumMacExt|WebCoreTheme',
                 },
                 'action': [
-                  'scripts/check_objc_rename.sh',
+                  '../build/scripts/check_objc_rename.sh',
                   '<(class_whitelist_regex)',
                   '<(category_whitelist_regex)',
                 ],
@@ -647,6 +656,11 @@
           'sources': [
             'editing/SmartReplaceCF.cpp',
           ],
+          'link_settings': {
+            'libraries': [
+              '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
+            ],
+          },
           'sources/': [
             # Additional files from the WebCore Mac build that are presently
             # used in the WebCore Chromium Mac build too.
@@ -658,9 +672,6 @@
             ['include', 'platform/(graphics/)?mac/[^/]*Font[^/]*\\.(cpp|mm?)$'],
             ['include', 'platform/graphics/mac/ComplexText[^/]*\\.(cpp|h)$'],
 
-            # We can use this for the fast Accelerate.framework FFT.
-            ['include', 'platform/audio/mac/FFTFrameMac\\.cpp$'],
-
             # Cherry-pick some files that can't be included by broader regexps.
             # Some of these are used instead of Chromium platform files, see
             # the specific exclusions in the "exclude" list below.
@@ -687,12 +698,6 @@
             # Use USE_NEW_THEME on Mac.
             ['include', 'platform/Theme\\.cpp$'],
 
-            # We use LocaleMac.mm instead of LocaleICU.cpp in order to
-            # apply system locales.
-            ['exclude', 'platform/text/LocaleICU\\.cpp$'],
-            ['exclude', 'platform/text/LocaleICU\\.h$'],
-            ['include', 'platform/text/mac/LocaleMac\\.mm$'],
-
             # The Mac uses platform/mac/KillRingMac.mm instead of the dummy
             # implementation.
             ['exclude', 'platform/KillRingNone\\.cpp$'],
@@ -747,25 +752,18 @@
             ['include', 'platform/graphics/opentype/'],
             ['include', 'platform/graphics/skia/SkiaFontWin\\.(cpp|h)$'],
 
-            # Windows currently uses FontCustomPlatformDataWin.cpp instead.
-            ['exclude', 'platform/graphics/skia/FontCustomPlatformDataSkia\\.cpp$'],
-            ['include', 'platform/graphics/win/FontCustomPlatformDataWin\\.cpp$'],
-
             # SystemInfo.cpp is useful and we don't want to copy it.
             ['include', 'platform/win/SystemInfo\\.cpp$'],
-
-            ['exclude', 'platform/text/LocaleICU\\.cpp$'],
-            ['exclude', 'platform/text/LocaleICU\\.h$'],
-            ['include', 'platform/text/win/LocaleWin\.cpp$'],
-            ['include', 'platform/text/win/LocaleWin\.h$'],
           ],
           'conditions': [
             ['"ENABLE_GDI_FONTS_ON_WINDOWS=1" in feature_defines', {
               'sources/': [
+                ['include', 'platform/graphics/win/FontCustomPlatformDataWin\\.cpp$'],
                 ['exclude', 'platform/graphics/skia/SimpleFontDataSkia\\.cpp$'],
                 ['exclude', 'platform/graphics/skia/GlyphPageTreeNodeSkia\\.cpp$'],
                 ['exclude', 'platform/graphics/skia/FontCacheSkia\\.cpp$'],
                 ['exclude', 'platform/graphics/skia/FontCacheSkiaWin\\.cpp$'],
+                ['exclude', 'platform/graphics/skia/FontCustomPlatformDataSkia\\.cpp$'],
               ],
             },{ # ENABLE_GDI_FONTS_ON_WINDOWS!=1
               'sources/': [
@@ -773,10 +771,12 @@
                 ['include', 'platform/graphics/skia/GlyphPageTreeNodeSkia\\.cpp$'],
                 ['include', 'platform/graphics/skia/FontCacheSkiaWin\\.cpp$'],
                 ['include', 'platform/graphics/skia/FontCustomPlatformDataSkia\\.cpp$'],
+                ['include', 'platform/graphics/skia/FontCustomPlatformDataSkia\\.cpp$'],
                 ['exclude', 'platform/graphics/chromium/SimpleFontDataChromiumWin\\.cpp$'],
                 ['exclude', 'platform/graphics/chromium/GlyphPageTreeNodeChromiumWin\\.cpp$'],
                 ['exclude', 'platform/graphics/chromium/FontCacheChromiumWin\\.cpp$'],
                 ['exclude', 'platform/graphics/win/FontCustomPlatformDataWin\\.cpp$'],
+                ['exclude', 'platform/graphics/win/FontCustomPlatformDataWin\\.cpp$'],
               ],
             }],
           ],
@@ -1067,7 +1067,7 @@
       ],
       'defines': [
         'BLINK_IMPLEMENTATION=1',
-        'INSIDE_WEBKIT',
+        'INSIDE_BLINK',
       ],
       'include_dirs': [
         '<(bindings_dir)/v8',  # FIXME: Remove once http://crbug.com/236119 is fixed.
diff --git a/Source/core/core.gypi b/Source/core/core.gypi
index 38b8c3c..d4d3f58 100644
--- a/Source/core/core.gypi
+++ b/Source/core/core.gypi
@@ -23,11 +23,12 @@
             # 'css/CSSUnknownRule.idl',
             'css/CSSValue.idl',
             'css/CSSValueList.idl',
-            'css/CSSViewportRule.idl',
             'css/CSSVariablesMap.idl',
+            'css/CSSVariablesMapForEachCallback.idl',
+            'css/CSSViewportRule.idl',
             'css/Counter.idl',
-            'css/FontFaceSet.idl',
             'css/FontFace.idl',
+            'css/FontFaceSet.idl',
             'css/MediaList.idl',
             'css/MediaQueryList.idl',
             'css/RGBColor.idl',
@@ -49,12 +50,6 @@
             'dom/ClientRectList.idl',
             'dom/Clipboard.idl',
             'dom/Comment.idl',
-            'dom/DataTransferItem.idl',
-            'dom/DataTransferItemList.idl',
-            'dom/Document.idl',
-            'dom/DocumentFragment.idl',
-            'dom/DocumentFullscreen.idl',
-            'dom/DocumentType.idl',
             'dom/DOMError.idl',
             'dom/DOMException.idl',
             'dom/DOMImplementation.idl',
@@ -62,6 +57,12 @@
             'dom/DOMStringList.idl',
             'dom/DOMStringMap.idl',
             'dom/DOMTokenList.idl',
+            'dom/DataTransferItem.idl',
+            'dom/DataTransferItemList.idl',
+            'dom/Document.idl',
+            'dom/DocumentFragment.idl',
+            'dom/DocumentFullscreen.idl',
+            'dom/DocumentType.idl',
             'dom/Element.idl',
             'dom/Entity.idl',
             'dom/MessageChannel.idl',
@@ -79,14 +80,17 @@
             'dom/Promise.idl',
             'dom/Range.idl',
             'dom/RequestAnimationFrameCallback.idl',
-            'dom/shadow/ShadowRoot.idl',
             'dom/StringCallback.idl',
             'dom/Text.idl',
             'dom/Touch.idl',
             'dom/TouchList.idl',
             'dom/TreeWalker.idl',
+            'dom/URL.idl',
+            'dom/URLUtils.idl',
+            'dom/URLUtilsReadOnly.idl',
             'dom/WebKitNamedFlow.idl',
             'dom/WebKitNamedFlowCollection.idl',
+            'dom/shadow/ShadowRoot.idl',
             'events/AutocompleteErrorEvent.idl',
             'events/BeforeLoadEvent.idl',
             'events/BeforeUnloadEvent.idl',
@@ -120,6 +124,21 @@
             'fileapi/FileReader.idl',
             'fileapi/FileReaderSync.idl',
             'fileapi/Stream.idl',
+            'frame/BarProp.idl',
+            'frame/Console.idl',
+            'frame/ConsoleBase.idl',
+            'frame/History.idl',
+            'frame/ImageBitmap.idl',
+            'frame/Location.idl',
+            'frame/Navigator.idl',
+            'frame/NavigatorID.idl',
+            'frame/NavigatorOnLine.idl',
+            'frame/Screen.idl',
+            'frame/SecurityPolicy.idl',
+            'frame/WebKitPoint.idl',
+            'frame/Window.idl',
+            'frame/WindowBase64.idl',
+            'frame/WindowTimers.idl',
             'html/FormData.idl',
             'html/HTMLAllCollection.idl',
             'html/HTMLAnchorElement.idl',
@@ -188,8 +207,8 @@
             'html/HTMLTableElement.idl',
             'html/HTMLTableRowElement.idl',
             'html/HTMLTableSectionElement.idl',
-            'html/HTMLTextAreaElement.idl',
             'html/HTMLTemplateElement.idl',
+            'html/HTMLTextAreaElement.idl',
             'html/HTMLTitleElement.idl',
             'html/HTMLTrackElement.idl',
             'html/HTMLUListElement.idl',
@@ -203,15 +222,14 @@
             'html/RadioNodeList.idl',
             'html/TextMetrics.idl',
             'html/TimeRanges.idl',
-            'html/URL.idl',
             'html/ValidityState.idl',
             'html/VoidCallback.idl',
             'html/canvas/ANGLEInstancedArrays.idl',
+            'html/canvas/Canvas2DContextAttributes.idl',
             'html/canvas/CanvasGradient.idl',
             'html/canvas/CanvasPattern.idl',
             'html/canvas/CanvasRenderingContext.idl',
             'html/canvas/CanvasRenderingContext2D.idl',
-            'html/canvas/Canvas2DContextAttributes.idl',
             'html/canvas/EXTFragDepth.idl',
             'html/canvas/EXTTextureFilterAnisotropic.idl',
             'html/canvas/OESElementIndexUint.idl',
@@ -251,59 +269,44 @@
             'html/track/TextTrackCue.idl',
             'html/track/TextTrackCueList.idl',
             'html/track/TextTrackList.idl',
-            'html/track/TrackEvent.idl',
             'html/track/TextTrackRegion.idl',
             'html/track/TextTrackRegionList.idl',
+            'html/track/TrackEvent.idl',
             'inspector/InjectedScriptHost.idl',
             'inspector/InspectorFrontendHost.idl',
             'inspector/InspectorOverlayHost.idl',
             'inspector/JavaScriptCallFrame.idl',
             'loader/appcache/ApplicationCache.idl',
-            'page/PerformanceNavigation.idl',
-            'page/BarProp.idl',
-            'page/ConsoleBase.idl',
-            'page/Console.idl',
             'page/EventSource.idl',
-            'page/History.idl',
-            'page/ImageBitmap.idl',
-            'page/Location.idl',
-            'page/MemoryInfo.idl',
-            'page/Navigator.idl',
-            'page/NavigatorID.idl',
-            'page/NavigatorOnLine.idl',
             'page/PagePopupController.idl',
-            'page/Performance.idl',
-            'page/PerformanceEntry.idl',
-            'page/PerformanceMark.idl',
-            'page/PerformanceMeasure.idl',
-            'page/PerformanceResourceTiming.idl',
-            'page/PerformanceTiming.idl',
-            'page/Screen.idl',
-            'page/SecurityPolicy.idl',
             'page/Selection.idl',
-            'page/SpeechInputEvent.idl',
-            'page/SpeechInputResult.idl',
-            'page/SpeechInputResultList.idl',
-            'page/WebKitPoint.idl',
-            'page/Window.idl',
-            'page/WindowBase64.idl',
             'page/WindowPagePopup.idl',
-            'page/WindowTimers.idl',
-            'page/WorkerNavigator.idl',
             'plugins/MimeType.idl',
             'plugins/MimeTypeArray.idl',
             'plugins/Plugin.idl',
             'plugins/PluginArray.idl',
+            'speech/SpeechInputEvent.idl',
+            'speech/SpeechInputResult.idl',
+            'speech/SpeechInputResultList.idl',
             'storage/Storage.idl',
             'storage/StorageEvent.idl',
+            'timing/MemoryInfo.idl',
+            'timing/Performance.idl',
+            'timing/PerformanceEntry.idl',
+            'timing/PerformanceMark.idl',
+            'timing/PerformanceMeasure.idl',
+            'timing/PerformanceNavigation.idl',
+            'timing/PerformanceResourceTiming.idl',
+            'timing/PerformanceTiming.idl',
             'workers/AbstractWorker.idl',
             'workers/DedicatedWorkerGlobalScope.idl',
             'workers/SharedWorker.idl',
             'workers/SharedWorkerGlobalScope.idl',
             'workers/Worker.idl',
-            'workers/WorkerGlobalScope.idl',
             'workers/WorkerConsole.idl',
+            'workers/WorkerGlobalScope.idl',
             'workers/WorkerLocation.idl',
+            'workers/WorkerNavigator.idl',
             'xml/DOMParser.idl',
             'xml/DocumentXPathEvaluator.idl',
             'xml/XMLHttpRequest.idl',
@@ -522,15 +525,31 @@
             'accessibility/AccessibilityTableRow.cpp',
             'accessibility/AccessibilityTableRow.h',
             'animation/ActiveAnimations.h',
-            'animation/AnimatableColor.h',
+            'animation/AnimatableClipPathOperation.cpp',
+            'animation/AnimatableClipPathOperation.h',
             'animation/AnimatableColor.cpp',
+            'animation/AnimatableColor.h',
+            'animation/AnimatableDouble.cpp',
+            'animation/AnimatableDouble.h',
             'animation/AnimatableImage.cpp',
             'animation/AnimatableImage.h',
+            'animation/AnimatableLength.cpp',
+            'animation/AnimatableLength.h',
             'animation/AnimatableLengthBox.cpp',
             'animation/AnimatableLengthBox.h',
+            'animation/AnimatableLengthSize.cpp',
+            'animation/AnimatableLengthSize.h',
             'animation/AnimatableNeutral.h',
-            'animation/AnimatableNumber.cpp',
-            'animation/AnimatableNumber.h',
+            'animation/AnimatableRepeatable.cpp',
+            'animation/AnimatableRepeatable.h',
+            'animation/AnimatableSVGLength.cpp',
+            'animation/AnimatableSVGLength.h',
+            'animation/AnimatableSVGPaint.cpp',
+            'animation/AnimatableSVGPaint.h',
+            'animation/AnimatableShapeValue.cpp',
+            'animation/AnimatableShapeValue.h',
+            'animation/AnimatableStrokeDasharrayList.cpp',
+            'animation/AnimatableStrokeDasharrayList.h',
             'animation/AnimatableTransform.cpp',
             'animation/AnimatableTransform.h',
             'animation/AnimatableUnknown.h',
@@ -594,8 +613,12 @@
             'css/CSSFontFaceSource.h',
             'css/CSSFontFaceSrcValue.cpp',
             'css/CSSFontFaceSrcValue.h',
+            'css/CSSFontFeatureValue.cpp',
+            'css/CSSFontFeatureValue.h',
             'css/CSSFontSelector.cpp',
             'css/CSSFontSelector.h',
+            'css/CSSFontValue.cpp',
+            'css/CSSFontValue.h',
             'css/CSSFunctionValue.cpp',
             'css/CSSFunctionValue.h',
             'css/CSSGradientValue.cpp',
@@ -646,11 +669,15 @@
             'css/CSSRuleList.h',
             'css/CSSSegmentedFontFace.cpp',
             'css/CSSSegmentedFontFace.h',
+            'css/CSSSegmentedFontFaceCache.cpp',
+            'css/CSSSegmentedFontFaceCache.h',
             'css/CSSSelector.cpp',
             'css/CSSSelectorList.cpp',
             'css/CSSSelectorList.h',
             'css/CSSShaderValue.cpp',
             'css/CSSShaderValue.h',
+            'css/CSSShadowValue.cpp',
+            'css/CSSShadowValue.h',
             'css/CSSStyleDeclaration.cpp',
             'css/CSSStyleDeclaration.h',
             'css/CSSStyleRule.cpp',
@@ -673,8 +700,10 @@
             'css/CSSValueList.cpp',
             'css/CSSValuePool.cpp',
             'css/CSSValuePool.h',
+            'css/CSSVariablesIterator.h',
             'css/CSSVariablesMap.cpp',
             'css/CSSVariablesMap.h',
+            'css/CSSVariablesMapForEachCallback.h',
             'css/CSSVariableValue.h',
             'css/CSSViewportRule.h',
             'css/CSSViewportRule.cpp',
@@ -689,12 +718,8 @@
             'css/FontFaceSet.cpp',
             'css/FontFace.cpp',
             'css/FontFace.h',
-            'css/FontFeatureValue.cpp',
-            'css/FontFeatureValue.h',
             'css/FontSize.cpp',
             'css/FontSize.h',
-            'css/FontValue.cpp',
-            'css/FontValue.h',
             'css/InspectorCSSOMWrappers.cpp',
             'css/InspectorCSSOMWrappers.h',
             'css/LengthFunctions.cpp',
@@ -734,8 +759,6 @@
             'css/SelectorCheckerFastPath.h',
             'css/SelectorFilter.cpp',
             'css/SelectorFilter.h',
-            'css/ShadowValue.cpp',
-            'css/ShadowValue.h',
             'css/SiblingTraversalStrategies.h',
             'css/StyleColor.h',
             'css/StyleInvalidationAnalysis.cpp',
@@ -858,6 +881,8 @@
             'editing/SimplifyMarkupCommand.cpp',
             'editing/SmartReplaceCF.cpp',
             'editing/SmartReplaceICU.cpp',
+            'editing/SpellChecker.cpp',
+            'editing/SpellChecker.h',
             'editing/SpellCheckRequester.cpp',
             'editing/SpellCheckRequester.h',
             'editing/SpellingCorrectionCommand.cpp',
@@ -1150,72 +1175,66 @@
             'loader/archive/MHTMLParser.h',
             'page/AutoscrollController.cpp',
             'page/AutoscrollController.h',
-            'page/BarProp.cpp',
-            'page/BarProp.h',
+            'frame/BarProp.cpp',
+            'frame/BarProp.h',
             'page/Chrome.cpp',
-            'page/Console.cpp',
-            'page/Console.h',
-            'page/ConsoleBase.cpp',
-            'page/ConsoleBase.h',
-            'page/ContentSecurityPolicy.cpp',
-            'page/ContentSecurityPolicyResponseHeaders.cpp',
+            'frame/Console.cpp',
+            'frame/Console.h',
+            'frame/ConsoleBase.cpp',
+            'frame/ConsoleBase.h',
+            'frame/ContentSecurityPolicy.cpp',
+            'frame/ContentSecurityPolicyResponseHeaders.cpp',
             'page/ContextMenuController.cpp',
             'page/ContextMenuProvider.h',
             'page/CreateWindow.cpp',
             'page/CreateWindow.h',
-            'page/DeviceClient.h',
-            'page/DeviceController.cpp',
-            'page/DeviceController.h',
-            'page/DiagnosticLoggingKeys.cpp',
-            'page/DiagnosticLoggingKeys.h',
-            'page/DOMPoint.h',
-            'page/DOMSecurityPolicy.cpp',
+            'frame/DOMPoint.h',
+            'frame/DOMSecurityPolicy.cpp',
             'page/DOMSelection.cpp',
             'page/DOMSelection.h',
-            'page/DOMTimer.cpp',
-            'page/DOMTimer.h',
-            'page/DOMWindow.cpp',
-            'page/DOMWindow.h',
-            'page/DOMWindowBase64.cpp',
-            'page/DOMWindowBase64.h',
-            'page/DOMWindowLifecycleNotifier.cpp',
-            'page/DOMWindowLifecycleNotifier.h',
-            'page/DOMWindowLifecycleObserver.cpp',
-            'page/DOMWindowLifecycleObserver.h',
-            'page/DOMWindowTimers.cpp',
-            'page/DOMWindowTimers.h',
+            'frame/DOMTimer.cpp',
+            'frame/DOMTimer.h',
+            'frame/DOMWindow.cpp',
+            'frame/DOMWindow.h',
+            'frame/DOMWindowBase64.cpp',
+            'frame/DOMWindowBase64.h',
+            'frame/DOMWindowLifecycleNotifier.cpp',
+            'frame/DOMWindowLifecycleNotifier.h',
+            'frame/DOMWindowLifecycleObserver.cpp',
+            'frame/DOMWindowLifecycleObserver.h',
+            'frame/DOMWindowTimers.cpp',
+            'frame/DOMWindowTimers.h',
             'page/DOMWindowPagePopup.cpp',
             'page/DOMWindowPagePopup.h',
-            'page/DOMWindowProperty.cpp',
-            'page/DOMWindowProperty.h',
+            'frame/DOMWindowProperty.cpp',
+            'frame/DOMWindowProperty.h',
             'page/DragController.cpp',
             'page/EventHandler.cpp',
             'page/EventSource.cpp',
             'page/EventSource.h',
             'page/FocusController.cpp',
-            'page/Frame.cpp',
-            'page/FrameActionScheduler.cpp',
-            'page/FrameActionScheduler.h',
-            'page/FrameDestructionObserver.cpp',
-            'page/FrameDestructionObserver.h',
+            'frame/Frame.cpp',
+            'frame/FrameDestructionObserver.cpp',
+            'frame/FrameDestructionObserver.h',
             'page/FrameTree.cpp',
-            'page/FrameView.cpp',
-            'page/History.cpp',
-            'page/History.h',
-            'page/ImageBitmap.cpp',
-            'page/ImageBitmap.h',
-            'page/LayoutMilestones.h',
-            'page/Location.cpp',
-            'page/Location.h',
-            'page/MemoryInfo.cpp',
+            'frame/FrameView.cpp',
+            'frame/History.cpp',
+            'frame/History.h',
+            'frame/ImageBitmap.cpp',
+            'frame/ImageBitmap.h',
+            'frame/Location.cpp',
+            'frame/Location.h',
+            'timing/MemoryInfo.cpp',
             'page/MouseEventWithHitTestResults.cpp',
             'page/MouseEventWithHitTestResults.h',
-            'page/Navigator.cpp',
-            'page/Navigator.h',
-            'page/NavigatorBase.h',
-            'page/NavigatorID.cpp',
-            'page/NavigatorID.h',
-            'page/NavigatorOnLine.h',
+            'frame/Navigator.cpp',
+            'frame/Navigator.h',
+            'frame/NavigatorBase.h',
+            'frame/NavigatorID.cpp',
+            'frame/NavigatorID.h',
+            'frame/NavigatorOnLine.h',
+            'page/NetworkStateNotifier.cpp',
+            'page/NetworkStateNotifier.h',
             'page/Page.cpp',
             'page/PageConsole.cpp',
             'page/PageGroup.cpp',
@@ -1231,70 +1250,57 @@
             'page/PagePopupClient.h',
             'page/PageScaleConstraints.cpp',
             'page/PageScaleConstraints.h',
-            'page/PageScaleConstraintsSet.cpp',
-            'page/PageScaleConstraintsSet.h',
             'page/PageSerializer.cpp',
             'page/PageVisibilityState.cpp',
-            'page/Performance.cpp',
-            'page/Performance.h',
-            'page/PerformanceEntry.cpp',
-            'page/PerformanceEntry.h',
-            'page/PerformanceMark.h',
-            'page/PerformanceMeasure.h',
-            'page/PerformanceNavigation.cpp',
-            'page/PerformanceNavigation.h',
-            'page/PerformanceResourceTiming.cpp',
-            'page/PerformanceResourceTiming.h',
-            'page/PerformanceTiming.cpp',
-            'page/PerformanceTiming.h',
-            'page/PerformanceUserTiming.cpp',
-            'page/PerformanceUserTiming.h',
+            'timing/Performance.cpp',
+            'timing/Performance.h',
+            'timing/PerformanceEntry.cpp',
+            'timing/PerformanceEntry.h',
+            'timing/PerformanceMark.h',
+            'timing/PerformanceMeasure.h',
+            'timing/PerformanceNavigation.cpp',
+            'timing/PerformanceNavigation.h',
+            'timing/PerformanceResourceTiming.cpp',
+            'timing/PerformanceResourceTiming.h',
+            'timing/PerformanceTiming.cpp',
+            'timing/PerformanceTiming.h',
+            'timing/PerformanceUserTiming.cpp',
+            'timing/PerformanceUserTiming.h',
             'page/PointerLockController.cpp',
             'page/PointerLockController.h',
             'page/PopupOpeningObserver.h',
             'page/PrintContext.cpp',
-            'page/ResourceTimingInfo.h',
+            'timing/ResourceTimingInfo.h',
             'page/RuntimeCSSEnabled.cpp',
             'page/RuntimeCSSEnabled.h',
             'page/RuntimeEnabledFeaturesCustom.cpp',
-            'page/Screen.cpp',
-            'page/Screen.h',
+            'frame/Screen.cpp',
+            'frame/Screen.h',
             'page/Settings.cpp',
             'page/SpatialNavigation.cpp',
-            'page/SpeechInput.cpp',
-            'page/SpeechInput.h',
-            'page/SpeechInputClient.h',
-            'page/SpeechInputEvent.cpp',
-            'page/SpeechInputEvent.h',
-            'page/SpeechInputListener.h',
-            'page/SpeechInputResult.cpp',
-            'page/SpeechInputResult.h',
-            'page/SpeechInputResultList.cpp',
-            'page/SpeechInputResultList.h',
-            'page/SuspendableTimer.cpp',
-            'page/SuspendableTimer.h',
+            'frame/SuspendableTimer.cpp',
+            'frame/SuspendableTimer.h',
             'page/TouchAdjustment.cpp',
             'page/TouchAdjustment.h',
             'page/TouchDisambiguation.cpp',
             'page/TouchDisambiguation.h',
             'page/UseCounter.cpp',
-            'page/UserContentURLPattern.cpp',
             'page/WindowFeatures.cpp',
             'page/WindowFocusAllowedIndicator.cpp',
-            'page/WorkerNavigator.cpp',
-            'page/WorkerNavigator.h',
-            'page/animation/AnimationBase.cpp',
-            'page/animation/AnimationBase.h',
-            'page/animation/AnimationController.cpp',
-            'page/animation/AnimationControllerPrivate.h',
-            'page/animation/CompositeAnimation.cpp',
-            'page/animation/CompositeAnimation.h',
-            'page/animation/CSSPropertyAnimation.cpp',
-            'page/animation/CSSPropertyAnimation.h',
-            'page/animation/ImplicitAnimation.cpp',
-            'page/animation/ImplicitAnimation.h',
-            'page/animation/KeyframeAnimation.cpp',
-            'page/animation/KeyframeAnimation.h',
+            'workers/WorkerNavigator.cpp',
+            'workers/WorkerNavigator.h',
+            'frame/animation/AnimationBase.cpp',
+            'frame/animation/AnimationBase.h',
+            'frame/animation/AnimationController.cpp',
+            'frame/animation/AnimationControllerPrivate.h',
+            'frame/animation/CompositeAnimation.cpp',
+            'frame/animation/CompositeAnimation.h',
+            'frame/animation/CSSPropertyAnimation.cpp',
+            'frame/animation/CSSPropertyAnimation.h',
+            'frame/animation/ImplicitAnimation.cpp',
+            'frame/animation/ImplicitAnimation.h',
+            'frame/animation/KeyframeAnimation.cpp',
+            'frame/animation/KeyframeAnimation.h',
             'page/scrolling/ScrollingConstraints.cpp',
             'page/scrolling/ScrollingConstraints.h',
             'page/scrolling/ScrollingCoordinator.cpp',
@@ -1320,6 +1326,7 @@
             'rendering/BidiRun.h',
             'rendering/ClipRect.cpp',
             'rendering/ClipRect.h',
+            'rendering/CompositedLayerMapping.cpp',
             'rendering/CompositingReasons.h',
             'rendering/CounterNode.cpp',
             'rendering/CounterNode.h',
@@ -1408,12 +1415,12 @@
             'rendering/RenderInputSpeech.cpp',
             'rendering/RenderInputSpeech.h',
             'rendering/RenderLayer.cpp',
-            'rendering/RenderLayerBacking.cpp',
             'rendering/RenderLayerCompositor.cpp',
             'rendering/RenderLayerCompositor.h',
             'rendering/RenderLayerFilterInfo.cpp',
             'rendering/RenderLayerFilterInfo.h',
             'rendering/RenderLayerScrollableArea.cpp',
+            'rendering/RenderLayerRepainter.cpp',
             'rendering/RenderLayerModelObject.cpp',
             'rendering/RenderLineBoxList.cpp',
             'rendering/RenderListBox.cpp',
@@ -1429,8 +1436,6 @@
             'rendering/RenderMediaControlElements.h',
             'rendering/RenderMediaControls.cpp',
             'rendering/RenderMediaControls.h',
-            'rendering/RenderMediaControlsChromium.cpp',
-            'rendering/RenderMediaControlsChromium.h',
             'rendering/RenderMenuList.cpp',
             'rendering/RenderMenuList.h',
             'rendering/RenderMeter.cpp',
@@ -1636,6 +1641,16 @@
             'rendering/svg/SVGTextQuery.h',
             'rendering/svg/SVGTextRunRenderingContext.cpp',
             'rendering/svg/SVGTextRunRenderingContext.h',
+            'speech/SpeechInput.cpp',
+            'speech/SpeechInput.h',
+            'speech/SpeechInputClient.h',
+            'speech/SpeechInputEvent.cpp',
+            'speech/SpeechInputEvent.h',
+            'speech/SpeechInputListener.h',
+            'speech/SpeechInputResult.cpp',
+            'speech/SpeechInputResult.h',
+            'speech/SpeechInputResultList.cpp',
+            'speech/SpeechInputResultList.h',
             'storage/Storage.cpp',
             'storage/Storage.h',
             'storage/StorageArea.h',
@@ -1667,7 +1682,6 @@
             'workers/WorkerGlobalScope.cpp',
             'workers/WorkerGlobalScope.h',
             'workers/WorkerLoaderProxy.h',
-            'workers/WorkerLocation.cpp',
             'workers/WorkerLocation.h',
             'workers/WorkerMessagingProxy.cpp',
             'workers/WorkerMessagingProxy.h',
@@ -1748,9 +1762,12 @@
         ],
         'webcore_dom_files': [
             'dom/ActiveDOMObject.cpp',
+            'dom/AddConsoleMessageTask.cpp',
+            'dom/AddConsoleMessageTask.h',
             'dom/Attr.cpp',
             'dom/CDATASection.cpp',
             'dom/CDATASection.h',
+            'dom/CSSSelectorWatch.cpp',
             'dom/CharacterData.cpp',
             'dom/ChildListMutationScope.cpp',
             'dom/ChildListMutationScope.h',
@@ -1775,48 +1792,24 @@
             'dom/ContextLifecycleObserver.cpp',
             'dom/ContextLifecycleObserver.h',
             'dom/CrossThreadTask.h',
-            'dom/CustomElement.cpp',
-            'dom/CustomElement.h',
-            'dom/CustomElementCallbackDispatcher.cpp',
-            'dom/CustomElementCallbackDispatcher.h',
-            'dom/CustomElementCallbackInvocation.cpp',
-            'dom/CustomElementCallbackInvocation.h',
-            'dom/CustomElementCallbackQueue.cpp',
-            'dom/CustomElementCallbackQueue.h',
-            'dom/CustomElementCallbackScheduler.cpp',
-            'dom/CustomElementCallbackScheduler.h',
-            'dom/CustomElementDefinition.cpp',
-            'dom/CustomElementDefinition.h',
-            'dom/CustomElementDescriptor.h',
-            'dom/CustomElementDescriptorHash.h',
-            'dom/CustomElementException.cpp',
-            'dom/CustomElementException.h',
-            'dom/CustomElementLifecycleCallbacks.h',
-            'dom/CustomElementObserver.cpp',
-            'dom/CustomElementObserver.h',
-            'dom/CustomElementRegistrationContext.cpp',
-            'dom/CustomElementRegistrationContext.h',
-            'dom/CustomElementRegistry.cpp',
-            'dom/CustomElementRegistry.h',
-            'dom/CustomElementUpgradeCandidateMap.cpp',
-            'dom/CustomElementUpgradeCandidateMap.h',
             'dom/DatasetDOMStringMap.cpp',
             'dom/DatasetDOMStringMap.h',
             'dom/DataTransferItem.cpp',
             'dom/DataTransferItem.h',
+            'dom/DataTransferItemList.cpp',
             'dom/DataTransferItemList.h',
             'dom/DecodedDataDocumentParser.cpp',
             'dom/DecodedDataDocumentParser.h',
-            'dom/default/chromium/PlatformMessagePortChannelChromium.cpp',
-            'dom/default/chromium/PlatformMessagePortChannelChromium.h',
-            'dom/DeviceOrientationController.cpp',
-            'dom/DeviceOrientationController.h',
             'dom/Document.cpp',
             'dom/DocumentFragment.cpp',
             'dom/DocumentFullscreen.cpp',
             'dom/DocumentFullscreen.h',
             'dom/DocumentInit.cpp',
             'dom/DocumentInit.h',
+            'dom/DocumentLifecycle.cpp',
+            'dom/DocumentLifecycle.h',
+            'dom/DocumentLifecycleNotifier.cpp',
+            'dom/DocumentLifecycleNotifier.h',
             'dom/DocumentLifecycleObserver.cpp',
             'dom/DocumentLifecycleObserver.h',
             'dom/DocumentMarker.cpp',
@@ -1844,12 +1837,20 @@
             'dom/DOMStringMap.h',
             'dom/DOMTokenList.cpp',
             'dom/DOMTokenList.h',
+            'dom/DOMURL.cpp',
+            'dom/DOMURL.h',
+            'dom/DOMURLUtils.cpp',
+            'dom/DOMURLUtils.h',
+            'dom/DOMURLUtilsReadOnly.cpp',
+            'dom/DOMURLUtilsReadOnly.h',
             'dom/Element.cpp',
             'dom/Element.h',
             'dom/ElementRareData.cpp',
             'dom/ElementRareData.h',
             'dom/ElementTraversal.h',
             'dom/Entity.h',
+            'dom/ExecutionContextTask.cpp',
+            'dom/ExecutionContextTask.h',
             'dom/FullscreenElementStack.cpp',
             'dom/FullscreenElementStack.h',
             'dom/IconURL.cpp',
@@ -1886,6 +1887,8 @@
             'dom/NameNodeList.cpp',
             'dom/NameNodeList.h',
             'dom/Node.cpp',
+            'dom/NodeChildRemovalTracker.h',
+            'dom/NodeChildRemovalTracker.cpp',
             'dom/NodeFilter.cpp',
             'dom/NodeFilter.h',
             'dom/NodeFilterCondition.cpp',
@@ -1923,7 +1926,7 @@
             'dom/ScriptableDocumentParser.h',
             'dom/ScriptedAnimationController.cpp',
             'dom/ScriptedAnimationController.h',
-            'dom/ScriptExecutionContext.cpp',
+            'dom/ExecutionContext.cpp',
             'dom/ScriptLoader.cpp',
             'dom/ScriptLoader.h',
             'dom/ScriptRunner.cpp',
@@ -1931,6 +1934,33 @@
             'dom/SecurityContext.h',
             'dom/SelectorQuery.cpp',
             'dom/SelectorQuery.h',
+            'dom/custom/CustomElement.cpp',
+            'dom/custom/CustomElement.h',
+            'dom/custom/CustomElementBaseElementQueue.cpp',
+            'dom/custom/CustomElementBaseElementQueue.h',
+            'dom/custom/CustomElementCallbackDispatcher.cpp',
+            'dom/custom/CustomElementCallbackDispatcher.h',
+            'dom/custom/CustomElementCallbackInvocation.cpp',
+            'dom/custom/CustomElementCallbackInvocation.h',
+            'dom/custom/CustomElementCallbackQueue.cpp',
+            'dom/custom/CustomElementCallbackQueue.h',
+            'dom/custom/CustomElementCallbackScheduler.cpp',
+            'dom/custom/CustomElementCallbackScheduler.h',
+            'dom/custom/CustomElementDefinition.cpp',
+            'dom/custom/CustomElementDefinition.h',
+            'dom/custom/CustomElementDescriptor.h',
+            'dom/custom/CustomElementDescriptorHash.h',
+            'dom/custom/CustomElementException.cpp',
+            'dom/custom/CustomElementException.h',
+            'dom/custom/CustomElementLifecycleCallbacks.h',
+            'dom/custom/CustomElementObserver.cpp',
+            'dom/custom/CustomElementObserver.h',
+            'dom/custom/CustomElementRegistrationContext.cpp',
+            'dom/custom/CustomElementRegistrationContext.h',
+            'dom/custom/CustomElementRegistry.cpp',
+            'dom/custom/CustomElementRegistry.h',
+            'dom/custom/CustomElementUpgradeCandidateMap.cpp',
+            'dom/custom/CustomElementUpgradeCandidateMap.h',
             'dom/shadow/ComposedTreeWalker.cpp',
             'dom/shadow/ComposedTreeWalker.h',
             'dom/shadow/ContentDistribution.cpp',
@@ -1967,8 +1997,6 @@
             'dom/TextLinkColors.h',
             'dom/Touch.cpp',
             'dom/Touch.h',
-            'dom/TouchController.cpp',
-            'dom/TouchController.h',
             'dom/TouchList.cpp',
             'dom/TouchList.h',
             'dom/TransformSource.h',
@@ -1979,18 +2007,18 @@
             'dom/TreeScope.h',
             'dom/TreeScopeAdopter.cpp',
             'dom/TreeScopeAdopter.h',
+            'dom/TreeShared.h',
             'dom/TreeWalker.cpp',
             'dom/TreeWalker.h',
             'dom/UserActionElementSet.cpp',
             'dom/UserActionElementSet.h',
-            'dom/UserGestureIndicator.cpp',
-            'dom/UserTypingGestureIndicator.cpp',
-            'dom/ViewportArguments.cpp',
-            'dom/ViewportArguments.h',
+            'dom/ViewportDescription.cpp',
+            'dom/ViewportDescription.h',
             'dom/VisitedLinkState.cpp',
             'dom/VisitedLinkState.h',
             'dom/WheelController.cpp',
             'dom/WheelController.h',
+            'dom/WhitespaceChildList.h',
             'events/AutocompleteErrorEvent.h',
             'events/BeforeLoadEvent.h',
             'events/BeforeTextInsertedEvent.cpp',
@@ -2015,7 +2043,6 @@
             'events/EventDispatchMediator.cpp',
             'events/EventDispatchMediator.h',
             'events/EventListenerMap.cpp',
-            'events/EventNames.cpp',
             'events/EventPathWalker.cpp',
             'events/EventPathWalker.h',
             'events/EventQueue.h',
@@ -2052,6 +2079,7 @@
             'events/SecurityPolicyViolationEvent.h',
             'events/TextEvent.cpp',
             'events/TextEvent.h',
+            'events/ThreadLocalEventNames.h',
             'events/TouchEvent.cpp',
             'events/TouchEvent.h',
             'events/TransitionEvent.cpp',
@@ -2070,11 +2098,7 @@
             'html/ClassList.h',
             'html/DOMFormData.cpp',
             'html/DOMFormData.h',
-            'html/DOMURL.cpp',
-            'html/DOMURL.h',
             'html/FormAssociatedElement.cpp',
-            'html/FormDataList.cpp',
-            'html/FormDataList.h',
             'html/HTMLAllCollection.cpp',
             'html/HTMLAllCollection.h',
             'html/HTMLAnchorElement.cpp',
@@ -2165,7 +2189,6 @@
             'html/HTMLMediaElement.cpp',
             'html/HTMLMenuElement.cpp',
             'html/HTMLMenuElement.h',
-            'html/HTMLMetaElement.cpp',
             'html/HTMLMetaElement.h',
             'html/HTMLMeterElement.cpp',
             'html/HTMLMeterElement.h',
@@ -2568,8 +2591,6 @@
             'html/track/TextTrack.h',
             'html/track/TextTrackCue.cpp',
             'html/track/TextTrackCue.h',
-            'html/track/TextTrackCueGeneric.cpp',
-            'html/track/TextTrackCueGeneric.h',
             'html/track/TextTrackCueList.cpp',
             'html/track/TextTrackCueList.h',
             'html/track/TextTrackList.cpp',
@@ -2591,29 +2612,16 @@
             'platform/AsyncFileSystemCallbacks.h',
             'platform/CalculationValue.cpp',
             'platform/CalculationValue.h',
-            'platform/ContentType.cpp',
-            'platform/ContentType.h',
             'platform/ContextMenu.cpp',
             'platform/ContextMenuItem.cpp',
             'platform/CrossThreadCopier.cpp',
             'platform/CrossThreadCopier.h',
             'platform/Cursor.cpp',
-            'platform/DateComponents.cpp',
-            'platform/Decimal.cpp',
             'platform/DragData.cpp',
             'platform/DragImage.cpp',
-            'platform/EventTracer.cpp',
-            'platform/FileChooser.cpp',
-            'platform/FileMetadata.h',
-            'platform/FloatConversion.h',
             'platform/HashTools.h',
-            'platform/JSONValues.cpp',
-            'platform/JSONValues.h',
             'platform/KillRing.h',
             'platform/KillRingNone.cpp',
-            'platform/Language.cpp',
-            'platform/LayoutTestSupport.cpp',
-            'platform/LayoutTestSupport.h',
             'platform/Length.cpp',
             'platform/LengthBox.cpp',
             'platform/LifecycleContext.cpp',
@@ -2622,20 +2630,11 @@
             'platform/LifecycleNotifier.h',
             'platform/LifecycleObserver.cpp',
             'platform/LifecycleObserver.h',
-            'platform/LinkHash.cpp',
-            'platform/LocalizedStrings.cpp',
-            'platform/LocalizedStrings.h',
-            'platform/Logging.cpp',
             'platform/MIMETypeFromURL.cpp',
             'platform/MIMETypeFromURL.h',
-            'platform/NotImplemented.cpp',
             'platform/ParsingUtilities.h',
-            'platform/Partitions.cpp',
-            'platform/Partitions.h',
             'platform/Pasteboard.cpp',
             'platform/Pasteboard.h',
-            'platform/PlatformEvent.cpp',
-            'platform/PlatformEvent.h',
             'platform/PlatformInstrumentation.cpp',
             'platform/PlatformInstrumentation.h',
             'platform/PlatformSpeechSynthesisUtterance.cpp',
@@ -2644,13 +2643,9 @@
             'platform/PlatformSpeechSynthesisVoice.h',
             'platform/PlatformSpeechSynthesizer.cpp',
             'platform/PlatformSpeechSynthesizer.h',
-            'platform/PlatformTouchEvent.h',
-            'platform/PlatformTouchPoint.h',
-            'platform/PrerenderHandle.h',
+            'platform/Prerender.cpp',
+            'platform/Prerender.h',
             'platform/PrerenderClient.h',
-            'platform/PurgeableBuffer.cpp',
-            'platform/PurgeableBuffer.h',
-            'platform/SSLKeyGenerator.h',
             'platform/ScrollAnimator.cpp',
             'platform/ScrollAnimator.h',
             'platform/ScrollAnimatorNone.cpp',
@@ -2664,7 +2659,6 @@
             'platform/ScrollbarThemeAndroid.cpp',
             'platform/ScrollbarThemeAuraOrGtk.cpp',
             'platform/ScrollbarThemeAuraOrGtk.h',
-            'platform/ScrollbarThemeClient.h',
             'platform/ScrollbarThemeMacCommon.h',
             'platform/ScrollbarThemeMacCommon.mm',
             'platform/ScrollbarThemeMacNonOverlayAPI.h',
@@ -2677,24 +2671,8 @@
             'platform/ScrollbarThemeOverlay.h',
             'platform/ScrollbarThemeWin.cpp',
             'platform/ScrollbarThemeWin.h',
-            'platform/SecureTextInput.cpp',
-            'platform/SecureTextInput.h',
             'platform/SerializedResource.h',
-            'platform/SharedBuffer.cpp',
-            'platform/SharedBufferChunkReader.cpp',
-            'platform/SharedTimer.h',
-            'platform/Sound.h',
-            'platform/SuddenTermination.h',
-            'platform/Task.h',
             'platform/Theme.cpp',
-            'platform/ThreadGlobalData.cpp',
-            'platform/ThreadTimers.cpp',
-            'platform/ThreadTimers.h',
-            'platform/Timer.cpp',
-            'platform/UUID.cpp',
-            'platform/UUID.h',
-            'platform/Widget.cpp',
-            'platform/Widget.h',
             'platform/animation/AnimationValue.h',
             'platform/animation/AnimationTranslationUtil.cpp',
             'platform/animation/AnimationTranslationUtil.h',
@@ -2702,104 +2680,10 @@
             'platform/animation/CSSAnimationDataList.cpp',
             'platform/animation/KeyframeValueList.cpp',
             'platform/animation/KeyframeValueList.h',
-            'platform/audio/AudioArray.h',
-            'platform/audio/AudioBus.cpp',
-            'platform/audio/AudioBus.h',
-            'platform/audio/AudioChannel.cpp',
-            'platform/audio/AudioChannel.h',
-            'platform/audio/AudioDSPKernel.h',
-            'platform/audio/AudioDSPKernelProcessor.cpp',
-            'platform/audio/AudioDSPKernelProcessor.h',
-            'platform/audio/AudioDestination.h',
-            'platform/audio/AudioFIFO.cpp',
-            'platform/audio/AudioFIFO.h',
-            'platform/audio/AudioFileReader.h',
-            'platform/audio/AudioIOCallback.h',
-            'platform/audio/AudioProcessor.h',
-            'platform/audio/AudioPullFIFO.cpp',
-            'platform/audio/AudioPullFIFO.h',
-            'platform/audio/AudioResampler.cpp',
-            'platform/audio/AudioResampler.h',
-            'platform/audio/AudioResamplerKernel.cpp',
-            'platform/audio/AudioResamplerKernel.h',
-            'platform/audio/AudioSourceProvider.h',
-            'platform/audio/AudioSourceProviderClient.h',
-            'platform/audio/AudioUtilities.cpp',
-            'platform/audio/AudioUtilities.h',
-            'platform/audio/Biquad.cpp',
-            'platform/audio/Biquad.h',
-            'platform/audio/Cone.cpp',
-            'platform/audio/Cone.h',
-            'platform/audio/DenormalDisabler.h',
-            'platform/audio/DirectConvolver.cpp',
-            'platform/audio/DirectConvolver.h',
-            'platform/audio/Distance.cpp',
-            'platform/audio/Distance.h',
-            'platform/audio/DownSampler.cpp',
-            'platform/audio/DownSampler.h',
-            'platform/audio/DynamicsCompressor.cpp',
-            'platform/audio/DynamicsCompressor.h',
-            'platform/audio/DynamicsCompressorKernel.cpp',
-            'platform/audio/DynamicsCompressorKernel.h',
-            'platform/audio/EqualPowerPanner.cpp',
-            'platform/audio/EqualPowerPanner.h',
-            'platform/audio/FFTConvolver.cpp',
-            'platform/audio/FFTConvolver.h',
-            'platform/audio/FFTFrame.cpp',
-            'platform/audio/FFTFrame.h',
-            'platform/audio/FFTFrameStub.cpp',
-            'platform/audio/HRTFDatabase.cpp',
-            'platform/audio/HRTFDatabase.h',
-            'platform/audio/HRTFDatabaseLoader.cpp',
-            'platform/audio/HRTFDatabaseLoader.h',
-            'platform/audio/HRTFElevation.cpp',
-            'platform/audio/HRTFElevation.h',
-            'platform/audio/HRTFKernel.cpp',
-            'platform/audio/HRTFKernel.h',
-            'platform/audio/HRTFPanner.cpp',
-            'platform/audio/HRTFPanner.h',
-            'platform/audio/MultiChannelResampler.cpp',
-            'platform/audio/MultiChannelResampler.h',
-            'platform/audio/Panner.cpp',
-            'platform/audio/Panner.h',
-            'platform/audio/Reverb.cpp',
-            'platform/audio/Reverb.h',
-            'platform/audio/ReverbAccumulationBuffer.cpp',
-            'platform/audio/ReverbAccumulationBuffer.h',
-            'platform/audio/ReverbConvolver.cpp',
-            'platform/audio/ReverbConvolver.h',
-            'platform/audio/ReverbConvolverStage.cpp',
-            'platform/audio/ReverbConvolverStage.h',
-            'platform/audio/ReverbInputBuffer.cpp',
-            'platform/audio/ReverbInputBuffer.h',
-            'platform/audio/SincResampler.cpp',
-            'platform/audio/SincResampler.h',
-            'platform/audio/UpSampler.cpp',
-            'platform/audio/UpSampler.h',
-            'platform/audio/VectorMath.cpp',
-            'platform/audio/VectorMath.h',
-            'platform/audio/ZeroPole.cpp',
-            'platform/audio/ZeroPole.h',
-            'platform/audio/chromium/AudioBusChromium.cpp',
-            'platform/audio/chromium/AudioDestinationChromium.cpp',
-            'platform/audio/chromium/AudioDestinationChromium.h',
-            'platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp',
-            'platform/audio/ffmpeg/FFTFrameFFMPEG.cpp',
-            'platform/audio/mac/FFTFrameMac.cpp',
-            'platform/audio/ipp/FFTFrameIPP.cpp',
             'platform/chromium/ChromiumDataObject.cpp',
             'platform/chromium/ChromiumDataObject.h',
             'platform/chromium/ChromiumDataObjectItem.cpp',
             'platform/chromium/ChromiumDataObjectItem.h',
-            'platform/chromium/ClipboardChromium.cpp',
-            'platform/chromium/ClipboardChromium.h',
-            'platform/chromium/ClipboardChromiumPosix.cpp',
-            'platform/chromium/ClipboardChromiumWin.cpp',
-            'platform/chromium/ClipboardMimeTypes.cpp',
-            'platform/chromium/ClipboardMimeTypes.h',
-            'platform/chromium/ClipboardUtilitiesChromium.cpp',
-            'platform/chromium/ClipboardUtilitiesChromium.h',
-            'platform/chromium/FileSystemChromium.cpp',
             'platform/chromium/FramelessScrollView.cpp',
             'platform/chromium/FramelessScrollView.h',
             'platform/chromium/FramelessScrollViewClient.h',
@@ -2810,26 +2694,10 @@
             'platform/chromium/KeyboardCodes.h',
             'platform/chromium/MemoryUsageSupportChromium.cpp',
             'platform/chromium/MIMETypeRegistryChromium.cpp',
-            'platform/chromium/PasteMode.h',
-            'platform/chromium/PlatformKeyboardEventChromium.cpp',
             'platform/chromium/PlatformScreenChromium.cpp',
             'platform/chromium/PlatformThemeChromiumDefault.cpp',
             'platform/chromium/PlatformThemeChromiumDefault.h',
             'platform/chromium/PlatformSpeechSynthesizerChromium.cpp',
-            'platform/chromium/Prerender.cpp',
-            'platform/chromium/Prerender.h',
-            'platform/chromium/PrerenderHandle.cpp',
-            'platform/chromium/SSLKeyGeneratorChromium.cpp',
-            'platform/chromium/SharedTimerChromium.cpp',
-            'platform/chromium/SoundChromiumPosix.cpp',
-            'platform/chromium/SoundChromiumWin.cpp',
-            'platform/chromium/StatsCounterChromium.cpp',
-            'platform/chromium/SuddenTerminationChromium.cpp',
-            'platform/chromium/TraceEvent.h',
-            'platform/cocoa/KeyEventCocoa.h',
-            'platform/cocoa/KeyEventCocoa.mm',
-            'platform/graphics/ANGLEWebKitBridge.cpp',
-            'platform/graphics/ANGLEWebKitBridge.h',
             'platform/graphics/BitmapImage.cpp',
             'platform/graphics/ContentDecryptionModule.cpp',
             'platform/graphics/ContentDecryptionModule.h',
@@ -2844,17 +2712,13 @@
             'platform/graphics/Extensions3D.h',
             'platform/graphics/Font.cpp',
             'platform/graphics/FontCache.cpp',
-            'platform/graphics/FontData.cpp',
             'platform/graphics/FontDescription.cpp',
             'platform/graphics/FontFallbackList.cpp',
-            'platform/graphics/FontFamily.cpp',
-            'platform/graphics/FontFeatureSettings.cpp',
             'platform/graphics/FontFastPath.cpp',
             'platform/graphics/FontPlatformData.cpp',
             'platform/graphics/FontPlatformData.h',
             'platform/graphics/FrameData.cpp',
             'platform/graphics/FrameData.h',
-            'platform/graphics/LayoutBoxExtent.cpp',
             'platform/graphics/GeneratorGeneratedImage.cpp',
             'platform/graphics/GeneratedImage.cpp',
             'platform/graphics/GeneratedImage.h',
@@ -2868,7 +2732,6 @@
             'platform/graphics/GraphicsTypes.cpp',
             'platform/graphics/Image.cpp',
             'platform/graphics/ImageBuffer.cpp',
-            'platform/graphics/ImageOrientation.cpp',
             'platform/graphics/ImageSource.cpp',
             'platform/graphics/InbandTextTrackPrivate.h',
             'platform/graphics/InbandTextTrackPrivateClient.h',
@@ -2876,10 +2739,7 @@
             'platform/graphics/MediaPlayer.cpp',
             'platform/graphics/MediaPlayer.h',
             'platform/graphics/Path.cpp',
-            'platform/graphics/PathTraversalState.cpp',
-            'platform/graphics/PathTraversalState.h',
             'platform/graphics/Pattern.cpp',
-            'platform/graphics/RoundedRect.cpp',
             'platform/graphics/SegmentedFontData.cpp',
             'platform/graphics/SegmentedFontData.h',
             'platform/graphics/ShadowBlur.cpp',
@@ -2888,10 +2748,6 @@
             'platform/graphics/SVGGlyph.cpp',
             'platform/graphics/StringTruncator.cpp',
             'platform/graphics/StrokeData.cpp',
-            'platform/graphics/SurrogatePairAwareTextIterator.cpp',
-            'platform/graphics/SurrogatePairAwareTextIterator.h',
-            'platform/graphics/TextRun.cpp',
-            'platform/graphics/UnitBezier.h',
             'platform/graphics/WidthIterator.cpp',
             'platform/graphics/WidthIterator.h',
             'platform/graphics/cg/FloatPointCG.cpp',
@@ -3165,13 +3021,7 @@
             'platform/mediastream/RTCSessionDescriptionRequest.h',
             'platform/mediastream/RTCStatsRequest.h',
             'platform/mediastream/RTCVoidRequest.h',
-            'platform/midi/MIDIAccessor.h',
-            'platform/midi/MIDIAccessor.cpp',
-            'platform/midi/MIDIAccessorClient.h',
-            'platform/mock/DeviceOrientationClientMock.cpp',
             'platform/mock/GeolocationClientMock.cpp',
-            'platform/mock/MIDIClientMock.cpp',
-            'platform/mock/MIDIClientMock.h',
             'platform/mock/PlatformSpeechSynthesizerMock.cpp',
             'platform/mock/PlatformSpeechSynthesizerMock.h',
             'platform/mock/ScrollbarThemeMock.cpp',
@@ -3179,95 +3029,19 @@
             'platform/mock/ScrollbarThemeOverlayMock.h',
             'platform/network/BlobData.cpp',
             'platform/network/BlobData.h',
-            'platform/network/DNS.cpp',
-            'platform/network/DNS.h',
             'platform/network/FormData.cpp',
             'platform/network/FormDataBuilder.cpp',
             'platform/network/FormDataBuilder.h',
-            'platform/network/HTTPHeaderMap.cpp',
-            'platform/network/HTTPParsers.cpp',
-            'platform/network/HTTPParsers.h',
-            'platform/network/HTTPRequest.cpp',
-            'platform/network/HTTPRequest.h',
-            'platform/network/MIMEHeader.cpp',
-            'platform/network/NetworkStateNotifier.cpp',
-            'platform/network/NetworkStateNotifier.h',
-            'platform/network/ParsedContentType.cpp',
-            'platform/network/ParsedContentType.h',
-            'platform/network/ProxyServer.cpp',
-            'platform/network/ResourceError.cpp',
-            'platform/network/ResourceError.h',
+            'platform/network/FormDataList.cpp',
+            'platform/network/FormDataList.h',
             'platform/network/ResourceRequest.cpp',
             'platform/network/ResourceRequest.h',
             'platform/network/ResourceResponse.cpp',
             'platform/network/ResourceResponse.h',
-            'platform/network/SocketStreamError.cpp',
-            'platform/network/SocketStreamError.h',
-            'platform/network/SocketStreamHandle.cpp',
-            'platform/network/SocketStreamHandle.h',
-            'platform/network/SocketStreamHandleClient.h',
-            'platform/network/SocketStreamHandleInternal.h',
-            'platform/sql/SQLValue.cpp',
-            'platform/sql/SQLiteAuthorizer.cpp',
-            'platform/sql/SQLiteDatabase.cpp',
-            'platform/sql/SQLiteFileSystem.h',
-            'platform/sql/SQLiteStatement.cpp',
-            'platform/sql/SQLiteStatement.h',
-            'platform/sql/SQLiteTransaction.cpp',
-            'platform/sql/chromium/SQLiteFileSystemChromium.cpp',
-            'platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp',
-            'platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp',
-            'platform/text/AtomicStringKeyedMRUCache.h',
-            'platform/text/BidiContext.cpp',
-            'platform/text/DateTimeFormat.cpp',
-            'platform/text/LineEnding.cpp',
-            'platform/text/LocaleICU.cpp',
-            'platform/text/LocaleICU.h',
-            'platform/text/LocaleToScriptMapping.h',
-            'platform/text/LocaleToScriptMappingDefault.cpp',
-            'platform/text/ParserUtilities.h',
-            'platform/text/PlatformLocale.cpp',
-            'platform/text/PlatformLocale.h',
-            'platform/text/QuotedPrintable.h',
-            'platform/text/QuotedPrintable.cpp',
             'platform/text/RegularExpression.cpp',
-            'platform/text/SegmentedString.cpp',
-            'platform/text/SuffixTree.h',
-            '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',
-            'platform/text/UnicodeRange.cpp',
-            'platform/text/cf/AtomicStringCF.cpp',
-            'platform/text/cf/StringCF.cpp',
-            'platform/text/cf/StringImplCF.cpp',
-            'platform/text/mac/LocaleMac.h',
-            'platform/text/mac/LocaleMac.mm',
-            'platform/text/mac/StringImplMac.mm',
-            'platform/text/mac/StringMac.mm',
-            'platform/text/transcoder/FontTranscoder.cpp',
-            'platform/text/transcoder/FontTranscoder.h',
-            'platform/text/win/LocaleWin.cpp',
-            'platform/text/win/LocaleWin.h',
-            'platform/win/SystemInfo.cpp',
-            'platform/win/SystemInfo.h',
         ],
         'webcore_platform_geometry_files': [
-            'platform/graphics/FloatPoint.cpp',
             'platform/graphics/FloatPolygon.cpp',
-            'platform/graphics/FloatPoint3D.cpp',
-            'platform/graphics/FloatQuad.cpp',
-            'platform/graphics/FloatRect.cpp',
-            'platform/graphics/FloatSize.cpp',
-            'platform/graphics/IntRect.cpp',
-            'platform/graphics/IntRectExtent.h',
-            'platform/graphics/LayoutRect.cpp',
-            'platform/graphics/Region.cpp',
-            'platform/graphics/transforms/TransformationMatrix.cpp',
-            'platform/graphics/transforms/AffineTransform.cpp',
         ],
         'webcore_svg_files': [
             'rendering/style/SVGRenderStyle.cpp',
@@ -3718,7 +3492,7 @@
             'svg/properties/SVGAnimatedPathSegListPropertyTearOff.h',
             'svg/properties/SVGPathSegListPropertyTearOff.cpp',
         ],
-        'webcore_test_support_idl_files': [
+        'webcore_testing_support_idl_files': [
           'testing/GCObservation.idl',
           'testing/Internals.idl',
           'testing/InternalProfilers.idl',
@@ -3727,6 +3501,8 @@
           'testing/LayerRectList.idl',
           'testing/MallocStatistics.idl',
           'testing/TypeConversions.idl',
+        ],
+        'generated_webcore_testing_support_idl_files': [
           '<(SHARED_INTERMEDIATE_DIR)/blink/InternalSettingsGenerated.idl',
           '<(SHARED_INTERMEDIATE_DIR)/blink/InternalRuntimeFlags.idl',
         ],
@@ -3754,16 +3530,13 @@
             '<(SHARED_INTERMEDIATE_DIR)/blink/InternalSettingsGenerated.h',
         ],
         'webcore_platform_support_files': [
-            'platform/chromium/support/Platform.cpp',
             'platform/chromium/support/WebActiveGestureAnimation.cpp',
             'platform/chromium/support/WebActiveGestureAnimation.h',
             'platform/chromium/support/WebArrayBuffer.cpp',
-            'platform/chromium/support/WebAudioBus.cpp',
             'platform/chromium/support/WebCrypto.cpp',
             'platform/chromium/support/WebCryptoAlgorithm.cpp',
             'platform/chromium/support/WebCryptoKey.cpp',
             'platform/chromium/support/WebCursorInfo.cpp',
-            'platform/chromium/support/WebData.cpp',
             'platform/chromium/support/WebDeviceMotionData.cpp',
             'platform/chromium/support/WebDeviceOrientationData.cpp',
             'platform/chromium/support/WebFileSystemCallbacks.cpp',
@@ -3789,7 +3562,6 @@
             'platform/chromium/support/WebScrollbarThemeClientImpl.h',
             'platform/chromium/support/WebScrollbarThemeGeometryNative.cpp',
             'platform/chromium/support/WebScrollbarThemeGeometryNative.h',
-            'platform/chromium/support/WebSocketStreamError.cpp',
             'platform/chromium/support/WebSourceInfo.cpp',
             'platform/chromium/support/WebSpeechSynthesisUtterance.cpp',
             'platform/chromium/support/WebSpeechSynthesisVoice.cpp',
@@ -3797,8 +3569,6 @@
             'platform/chromium/support/WebSpeechSynthesizerClientImpl.h',
             'platform/chromium/support/WebThreadSafeData.cpp',
             'platform/chromium/support/WebTransformKeyframe.cpp',
-            'platform/chromium/support/WebURL.cpp',
-            'platform/chromium/support/WebURLError.cpp',
             'platform/chromium/support/WebURLRequest.cpp',
             'platform/chromium/support/WebURLRequestPrivate.h',
             'platform/chromium/support/WebURLResponse.cpp',
@@ -3808,9 +3578,13 @@
         ],
         'core_unittest_files': [
             'animation/AnimatableColorTest.cpp',
+            'animation/AnimatableDoubleTest.cpp',
+            'animation/AnimatableLengthTest.cpp',
             'animation/AnimatableNeutralTest.cpp',
-            'animation/AnimatableNumberTest.cpp',
             'animation/AnimatableUnknownTest.cpp',
+            'animation/AnimatableValueTestHelper.cpp',
+            'animation/AnimatableValueTestHelper.h',
+            'animation/AnimatableValueTestHelperTest.cpp',
             'animation/DocumentTimelineTest.cpp',
             'animation/KeyframeAnimationEffectTest.cpp',
             'animation/PlayerTest.cpp',
@@ -3818,20 +3592,18 @@
             'animation/TimedItemTest.cpp',
             'css/CSSParserValuesTest.cpp',
             'css/CSSCalculationValueTest.cpp',
+            'css/CSSValueTestHelper.h',
             'fetch/ImageResourceTest.cpp',
             'fetch/MemoryCacheTest.cpp',
             'fetch/ResourceFetcherTest.cpp',
+            'html/HTMLDimensionTest.cpp',
+            'html/LinkRelAttributeTest.cpp',
             'html/TimeRangesTest.cpp',
-            'page/ImageBitmapTest.cpp',
-            'platform/DecimalTest.cpp',
-            'platform/SharedBufferTest.cpp',
+            'frame/ImageBitmapTest.cpp',
             'platform/animation/AnimationTranslationUtilTest.cpp',
-            'platform/chromium/ClipboardChromiumTest.cpp',
             'platform/graphics/BitmapImageTest.cpp',
             'platform/graphics/FontTest.cpp',
             'platform/graphics/GraphicsContextTest.cpp',
-            'platform/graphics/RoundedRectTest.cpp',
-            'platform/graphics/UnitBezierTest.cpp',
             'platform/graphics/chromium/Canvas2DLayerBridgeTest.cpp',
             'platform/graphics/chromium/Canvas2DLayerManagerTest.cpp',
             'platform/graphics/chromium/DeferredImageDecoderTest.cpp',
@@ -3845,31 +3617,34 @@
             'platform/image-decoders/gif/GIFImageDecoderTest.cpp',
             'platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp',
             'platform/image-decoders/webp/WEBPImageDecoderTest.cpp',
-            'platform/text/DateTimeFormatTest.cpp',
+            'platform/testing/FakeWebGraphicsContext3D.h',
             'rendering/RenderOverflowTest.cpp',
-            'tests/ArenaTestHelpers.h',
-            'tests/FakeWebGraphicsContext3D.h',
-            'tests/HTMLDimension.cpp',
-            'tests/LayoutUnit.cpp',
-            'tests/LinkRelAttribute.cpp',
-            'tests/PODArenaTest.cpp',
-            'tests/PODFreeListArenaTest.cpp',
-            'tests/PODIntervalTreeTest.cpp',
-            'tests/PODRedBlackTreeTest.cpp',
-            'tests/TreeTestHelpers.cpp',
-            'tests/TreeTestHelpers.h',
         ],
         'scripts_for_in_files': [
             # jinja2/__init__.py contains version string, so sufficient as
             # dependency for whole jinja2 package
             '<(DEPTH)/third_party/jinja2/__init__.py',
             '<(DEPTH)/third_party/markupsafe/__init__.py',  # jinja2 dep
-            'scripts/in_file.py',
-            'scripts/in_generator.py',
-            'scripts/license.py',
-            'scripts/name_macros.py',
-            'scripts/template_expander.py',
-            'scripts/templates/macros.tmpl',
+            '../build/scripts/hasher.py',
+            '../build/scripts/in_file.py',
+            '../build/scripts/in_generator.py',
+            '../build/scripts/license.py',
+            '../build/scripts/name_macros.py',
+            '../build/scripts/name_utilities.py',
+            '../build/scripts/template_expander.py',
+            '../build/scripts/templates/macros.tmpl',
+        ],
+        'make_names_files': [
+            '<@(scripts_for_in_files)',
+            '../build/scripts/make_names.py',
+            '../build/scripts/templates/MakeNames.cpp.tmpl',
+            '../build/scripts/templates/MakeNames.h.tmpl',
+        ],
+        'make_qualified_names_files': [
+            '<@(scripts_for_in_files)',
+            '../build/scripts/make_qualified_names.py',
+            '../build/scripts/templates/MakeQualifiedNames.cpp.tmpl',
+            '../build/scripts/templates/MakeQualifiedNames.h.tmpl',
         ],
         'conditions': [
             ['OS=="win"', {
diff --git a/Source/core/core_derived_sources.gyp b/Source/core/core_derived_sources.gyp
index 1ef444a..a59b25f 100644
--- a/Source/core/core_derived_sources.gyp
+++ b/Source/core/core_derived_sources.gyp
@@ -32,7 +32,7 @@
   'includes': [
     'core.gypi',
     '../bindings/bindings.gypi',
-    'features.gypi',
+    '../build/features.gypi',
   ],
 
   'targets': [
@@ -54,7 +54,7 @@
           ],
           'action': [
             'python',
-            'scripts/action_makenames.py',
+            '../build/scripts/action_makenames.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)',
@@ -65,10 +65,10 @@
           'action_name': 'InternalRuntimeFlags',
           'inputs': [
             '<@(scripts_for_in_files)',
-            'scripts/make_internal_runtime_flags.py',
+            '../build/scripts/make_internal_runtime_flags.py',
             'page/RuntimeEnabledFeatures.in',
-            'scripts/templates/InternalRuntimeFlags.h.tmpl',
-            'scripts/templates/InternalRuntimeFlags.idl.tmpl',
+            '../build/scripts/templates/InternalRuntimeFlags.h.tmpl',
+            '../build/scripts/templates/InternalRuntimeFlags.idl.tmpl',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/blink/InternalRuntimeFlags.idl',
@@ -76,7 +76,7 @@
           ],
           'action': [
             'python',
-            'scripts/make_internal_runtime_flags.py',
+            '../build/scripts/make_internal_runtime_flags.py',
             'page/RuntimeEnabledFeatures.in',
             '--output_dir',
             '<(SHARED_INTERMEDIATE_DIR)/blink',
@@ -111,7 +111,7 @@
           'msvs_cygwin_shell': 0,
           'action': [
             '<(perl_exe)',
-            'scripts/xxd.pl',
+            '../build/scripts/xxd.pl',
             'V8ArrayBufferViewCustomScript_js',
             '<@(_inputs)',
             '<@(_outputs)'
@@ -129,7 +129,7 @@
           'msvs_cygwin_shell': 0,
           'action': [
             '<(perl_exe)',
-            'scripts/xxd.pl',
+            '../build/scripts/xxd.pl',
             'XMLViewer_css',
             '<@(_inputs)',
             '<@(_outputs)'
@@ -146,7 +146,7 @@
           'msvs_cygwin_shell': 0,
           'action': [
             '<(perl_exe)',
-            'scripts/xxd.pl',
+            '../build/scripts/xxd.pl',
             'XMLViewer_js',
             '<@(_inputs)',
             '<@(_outputs)'
@@ -173,11 +173,10 @@
           'action_name': 'RuntimeEnabledFeatures',
           'inputs': [
             '<@(scripts_for_in_files)',
-            'scripts/make_runtime_features.py',
-            'scripts/name_utilities.py',
+            '../build/scripts/make_runtime_features.py',
             'page/RuntimeEnabledFeatures.in',
-            'scripts/templates/RuntimeEnabledFeatures.cpp.tmpl',
-            'scripts/templates/RuntimeEnabledFeatures.h.tmpl',
+            '../build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl',
+            '../build/scripts/templates/RuntimeEnabledFeatures.h.tmpl',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/blink/RuntimeEnabledFeatures.cpp',
@@ -185,7 +184,7 @@
           ],
           'action': [
             'python',
-            'scripts/make_runtime_features.py',
+            '../build/scripts/make_runtime_features.py',
             'page/RuntimeEnabledFeatures.in',
             '--output_dir',
             '<(SHARED_INTERMEDIATE_DIR)/blink',
@@ -201,7 +200,7 @@
           },
           'inputs': [
             '<@(scripts_for_in_files)',
-            'scripts/make_css_property_names.py',
+            '../build/scripts/make_css_property_names.py',
             '<@(in_files)'
           ],
           'outputs': [
@@ -210,7 +209,7 @@
           ],
           'action': [
             'python',
-            'scripts/make_css_property_names.py',
+            '../build/scripts/make_css_property_names.py',
             '<@(in_files)',
             '--output_dir',
             '<(SHARED_INTERMEDIATE_DIR)/blink',
@@ -222,10 +221,10 @@
           'action_name': 'StylePropertyShorthand',
           'inputs': [
             '<@(scripts_for_in_files)',
-            'scripts/make_style_shorthands.py',
+            '../build/scripts/make_style_shorthands.py',
             'css/CSSShorthands.in',
-            'scripts/templates/StylePropertyShorthand.h.tmpl',
-            'scripts/templates/StylePropertyShorthand.cpp.tmpl',
+            '../build/scripts/templates/StylePropertyShorthand.h.tmpl',
+            '../build/scripts/templates/StylePropertyShorthand.cpp.tmpl',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/blink/StylePropertyShorthand.cpp',
@@ -233,7 +232,7 @@
           ],
           'action': [
             'python',
-            'scripts/make_style_shorthands.py',
+            '../build/scripts/make_style_shorthands.py',
             'css/CSSShorthands.in',
             '--output_dir',
             '<(SHARED_INTERMEDIATE_DIR)/blink',
@@ -243,11 +242,11 @@
           'action_name': 'StyleBuilder',
           'inputs': [
             '<@(scripts_for_in_files)',
-            'scripts/make_style_builder.py',
+            '../build/scripts/make_style_builder.py',
             'css/CSSProperties.in',
-            'scripts/templates/StyleBuilder.cpp.tmpl',
-            'scripts/templates/StyleBuilderFunctions.h.tmpl',
-            'scripts/templates/StyleBuilderFunctions.cpp.tmpl',
+            '../build/scripts/templates/StyleBuilder.cpp.tmpl',
+            '../build/scripts/templates/StyleBuilderFunctions.h.tmpl',
+            '../build/scripts/templates/StyleBuilderFunctions.cpp.tmpl',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/blink/StyleBuilder.cpp',
@@ -256,7 +255,7 @@
           ],
           'action': [
             'python',
-            'scripts/make_style_builder.py',
+            '../build/scripts/make_style_builder.py',
             'css/CSSProperties.in',
             '--output_dir',
             '<(SHARED_INTERMEDIATE_DIR)/blink',
@@ -272,7 +271,7 @@
           },
           'inputs': [
             '<@(scripts_for_in_files)',
-            'scripts/make_css_value_keywords.py',
+            '../build/scripts/make_css_value_keywords.py',
             '<@(in_files)'
           ],
           'outputs': [
@@ -280,7 +279,7 @@
             '<(SHARED_INTERMEDIATE_DIR)/blink/CSSValueKeywords.h',
           ],
           'action': [
-             'scripts/make_css_value_keywords.py',
+             '../build/scripts/make_css_value_keywords.py',
              '<@(in_files)',
              '--output_dir',
              '<(SHARED_INTERMEDIATE_DIR)/blink',
@@ -291,9 +290,9 @@
         {
           'action_name': 'HTMLNames',
           'inputs': [
-            'scripts/Hasher.pm',
-            'scripts/StaticString.pm',
-            'scripts/make_names.pl',
+            '../build/scripts/Hasher.pm',
+            '../build/scripts/StaticString.pm',
+            '../build/scripts/make_names.pl',
             'html/HTMLTagNames.in',
             'html/HTMLAttributeNames.in',
           ],
@@ -306,7 +305,7 @@
           ],
           'action': [
             'python',
-            'scripts/action_makenames.py',
+            '../build/scripts/action_makenames.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)',
@@ -319,9 +318,9 @@
         {
           'action_name': 'FontFamilyNames',
           'inputs': [
-            'scripts/Hasher.pm',
-            'scripts/StaticString.pm',
-            'scripts/make_names.pl',
+            '../build/scripts/Hasher.pm',
+            '../build/scripts/StaticString.pm',
+            '../build/scripts/make_names.pl',
             'css/FontFamilyNames.in',
           ],
           'outputs': [
@@ -330,7 +329,7 @@
           ],
           'action': [
             'python',
-            'scripts/action_makenames.py',
+            '../build/scripts/action_makenames.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)',
@@ -342,9 +341,9 @@
         {
           'action_name': 'SVGNames',
           'inputs': [
-            'scripts/Hasher.pm',
-            'scripts/StaticString.pm',
-            'scripts/make_names.pl',
+            '../build/scripts/Hasher.pm',
+            '../build/scripts/StaticString.pm',
+            '../build/scripts/make_names.pl',
             'svg/SVGTagNames.in',
             'svg/SVGAttributeNames.in',
           ],
@@ -358,7 +357,7 @@
           ],
           'action': [
             'python',
-            'scripts/action_makenames.py',
+            '../build/scripts/action_makenames.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)',
@@ -372,8 +371,7 @@
           'action_name': 'EventFactory',
           'inputs': [
             '<@(scripts_for_in_files)',
-            'scripts/make_event_factory.py',
-            'scripts/name_utilities.py',
+            '../build/scripts/make_event_factory.py',
             '<(SHARED_INTERMEDIATE_DIR)/blink/EventInterfaces.in',
             'events/EventAliases.in',
           ],
@@ -384,7 +382,7 @@
           ],
           'action': [
             'python',
-            'scripts/make_event_factory.py',
+            '../build/scripts/make_event_factory.py',
             '<(SHARED_INTERMEDIATE_DIR)/blink/EventInterfaces.in',
             'events/EventAliases.in',
             '--output_dir',
@@ -392,11 +390,28 @@
           ],
         },
         {
+          'action_name': 'EventNames',
+          'inputs': [
+            '<@(make_names_files)',
+            '<(SHARED_INTERMEDIATE_DIR)/blink/EventInterfaces.in',
+          ],
+          'outputs': [
+            '<(SHARED_INTERMEDIATE_DIR)/blink/EventNames.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/blink/EventNames.h',
+          ],
+          'action': [
+            'python',
+            '../build/scripts/make_names.py',
+            '<(SHARED_INTERMEDIATE_DIR)/blink/EventInterfaces.in',
+            '--output_dir',
+            '<(SHARED_INTERMEDIATE_DIR)/blink',
+          ],
+        },
+        {
           'action_name': 'EventTargetFactory',
           'inputs': [
             '<@(scripts_for_in_files)',
-            'scripts/make_event_factory.py',
-            'scripts/name_utilities.py',
+            '../build/scripts/make_event_factory.py',
             'events/EventTargetFactory.in',
           ],
           'outputs': [
@@ -405,7 +420,25 @@
           ],
           'action': [
             'python',
-            'scripts/make_event_factory.py',
+            '../build/scripts/make_event_factory.py',
+            'events/EventTargetFactory.in',
+            '--output_dir',
+            '<(SHARED_INTERMEDIATE_DIR)/blink',
+          ],
+        },
+        {
+          'action_name': 'EventTargetNames',
+          'inputs': [
+            '<@(make_names_files)',
+            'events/EventTargetFactory.in',
+          ],
+          'outputs': [
+            '<(SHARED_INTERMEDIATE_DIR)/blink/EventTargetNames.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/blink/EventTargetNames.h',
+          ],
+          'action': [
+            'python',
+            '../build/scripts/make_names.py',
             'events/EventTargetFactory.in',
             '--output_dir',
             '<(SHARED_INTERMEDIATE_DIR)/blink',
@@ -414,9 +447,7 @@
         {
           'action_name': 'MathMLNames',
           'inputs': [
-            'scripts/Hasher.pm',
-            'scripts/StaticString.pm',
-            'scripts/make_names.pl',
+            '<@(make_qualified_names_files)',
             'html/parser/MathMLTagNames.in',
             'html/parser/MathMLAttributeNames.in',
           ],
@@ -426,21 +457,20 @@
           ],
           'action': [
             'python',
-            'scripts/action_makenames.py',
-            '<@(_outputs)',
-            '--',
-            '<@(_inputs)',
-            '--',
-            '--extraDefines', '<(feature_defines)'
+            '../build/scripts/make_qualified_names.py',
+            'html/parser/MathMLTagNames.in',
+            'html/parser/MathMLAttributeNames.in',
+            '--output_dir',
+            '<(SHARED_INTERMEDIATE_DIR)/blink',
+            '--defines', '<(feature_defines)'
           ],
-          'msvs_cygwin_shell': 1,
         },
         {
           'action_name': 'UserAgentStyleSheets',
           'variables': {
             'scripts': [
               'css/make-css-file-arrays.pl',
-              'scripts/preprocessor.pm',
+              '../build/scripts/preprocessor.pm',
             ],
             'stylesheets': [
               'css/html.css',
@@ -469,7 +499,7 @@
           ],
           'action': [
             'python',
-            'scripts/action_useragentstylesheets.py',
+            '../build/scripts/action_useragentstylesheets.py',
             '<@(_outputs)',
             '<@(stylesheets)',
             '--',
@@ -482,9 +512,7 @@
         {
           'action_name': 'FetchInitiatorTypeNames',
           'inputs': [
-            'scripts/Hasher.pm',
-            'scripts/StaticString.pm',
-            'scripts/make_names.pl',
+            '<@(make_names_files)',
             'fetch/FetchInitiatorTypeNames.in',
           ],
           'outputs': [
@@ -493,80 +521,34 @@
           ],
           'action': [
             'python',
-            'scripts/action_makenames.py',
-            '<@(_outputs)',
-            '--',
-            '<@(_inputs)',
-            '--',
-            '--resourceTypes',
-          ],
-          'msvs_cygwin_shell': 1,
-        },
-        {
-          'action_name': 'PickerCommon',
-          'inputs': [
-            'Resources/pagepopups/pickerCommon.css',
-            'Resources/pagepopups/pickerCommon.js',
-          ],
-          'outputs': [
-            '<(SHARED_INTERMEDIATE_DIR)/blink/PickerCommon.h',
-            '<(SHARED_INTERMEDIATE_DIR)/blink/PickerCommon.cpp',
-          ],
-          'action': [
-            'python',
-            'scripts/make-file-arrays.py',
-            '--out-h=<(SHARED_INTERMEDIATE_DIR)/blink/PickerCommon.h',
-            '--out-cpp=<(SHARED_INTERMEDIATE_DIR)/blink/PickerCommon.cpp',
-            '<@(_inputs)',
+            '../build/scripts/make_names.py',
+            'fetch/FetchInitiatorTypeNames.in',
+            '--output_dir',
+            '<(SHARED_INTERMEDIATE_DIR)/blink',
           ],
         },
         {
-          'action_name': 'CalendarPicker',
+          'action_name': 'EventTypeNames',
           'inputs': [
-            'Resources/pagepopups/calendarPicker.css',
-            'Resources/pagepopups/calendarPicker.js',
-            'Resources/pagepopups/chromium/calendarPickerChromium.css',
-            'Resources/pagepopups/chromium/pickerCommonChromium.css',
-            'Resources/pagepopups/suggestionPicker.css',
-            'Resources/pagepopups/suggestionPicker.js',
+            '<@(make_names_files)',
+            'events/EventTypeNames.in',
           ],
           'outputs': [
-            '<(SHARED_INTERMEDIATE_DIR)/blink/CalendarPicker.h',
-            '<(SHARED_INTERMEDIATE_DIR)/blink/CalendarPicker.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/blink/EventTypeNames.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/blink/EventTypeNames.h',
           ],
           'action': [
             'python',
-            'scripts/make-file-arrays.py',
-            '--condition=ENABLE(CALENDAR_PICKER)',
-            '--out-h=<(SHARED_INTERMEDIATE_DIR)/blink/CalendarPicker.h',
-            '--out-cpp=<(SHARED_INTERMEDIATE_DIR)/blink/CalendarPicker.cpp',
-            '<@(_inputs)',
-          ],
-        },
-        {
-          'action_name': 'ColorSuggestionPicker',
-          'inputs': [
-            'Resources/pagepopups/colorSuggestionPicker.css',
-            'Resources/pagepopups/colorSuggestionPicker.js',
-          ],
-          'outputs': [
-            '<(SHARED_INTERMEDIATE_DIR)/blink/ColorSuggestionPicker.h',
-            '<(SHARED_INTERMEDIATE_DIR)/blink/ColorSuggestionPicker.cpp',
-          ],
-          'action': [
-            'python',
-            'scripts/make-file-arrays.py',
-            '--out-h=<(SHARED_INTERMEDIATE_DIR)/blink/ColorSuggestionPicker.h',
-            '--out-cpp=<(SHARED_INTERMEDIATE_DIR)/blink/ColorSuggestionPicker.cpp',
-            '<@(_inputs)',
+            '../build/scripts/make_names.py',
+            'events/EventTypeNames.in',
+            '--output_dir',
+            '<(SHARED_INTERMEDIATE_DIR)/blink',
           ],
         },
         {
           'action_name': 'XLinkNames',
           'inputs': [
-            'scripts/Hasher.pm',
-            'scripts/StaticString.pm',
-            'scripts/make_names.pl',
+            '<@(make_qualified_names_files)',
             'svg/xlinkattrs.in',
           ],
           'outputs': [
@@ -575,21 +557,16 @@
           ],
           'action': [
             'python',
-            'scripts/action_makenames.py',
-            '<@(_outputs)',
-            '--',
-            '<@(_inputs)',
-            '--',
-            '--extraDefines', '<(feature_defines)'
+            '../build/scripts/make_qualified_names.py',
+            'svg/xlinkattrs.in',
+            '--output_dir',
+            '<(SHARED_INTERMEDIATE_DIR)/blink',
           ],
-          'msvs_cygwin_shell': 1,
         },
         {
           'action_name': 'XMLNSNames',
           'inputs': [
-            'scripts/Hasher.pm',
-            'scripts/StaticString.pm',
-            'scripts/make_names.pl',
+            '<@(make_qualified_names_files)',
             'xml/xmlnsattrs.in',
           ],
           'outputs': [
@@ -598,21 +575,16 @@
           ],
           'action': [
             'python',
-            'scripts/action_makenames.py',
-            '<@(_outputs)',
-            '--',
-            '<@(_inputs)',
-            '--',
-            '--extraDefines', '<(feature_defines)'
+            '../build/scripts/make_qualified_names.py',
+            'xml/xmlnsattrs.in',
+            '--output_dir',
+            '<(SHARED_INTERMEDIATE_DIR)/blink',
           ],
-          'msvs_cygwin_shell': 1,
         },
         {
           'action_name': 'XMLNames',
           'inputs': [
-            'scripts/Hasher.pm',
-            'scripts/StaticString.pm',
-            'scripts/make_names.pl',
+            '<@(make_qualified_names_files)',
             'xml/xmlattrs.in',
           ],
           'outputs': [
@@ -621,14 +593,11 @@
           ],
           'action': [
             'python',
-            'scripts/action_makenames.py',
-            '<@(_outputs)',
-            '--',
-            '<@(_inputs)',
-            '--',
-            '--extraDefines', '<(feature_defines)'
+            '../build/scripts/make_qualified_names.py',
+            'xml/xmlattrs.in',
+            '--output_dir',
+            '<(SHARED_INTERMEDIATE_DIR)/blink',
           ],
-          'msvs_cygwin_shell': 1,
         },
         {
           'action_name': 'preprocess_grammar',
@@ -641,7 +610,7 @@
           ],
           'action': [
             '<(perl_exe)',
-            '-Iscripts',
+            '-I../build/scripts',
             'css/makegrammar.pl',
             '--outputDir',
             '<(SHARED_INTERMEDIATE_DIR)/blink',
@@ -652,7 +621,7 @@
           'action_name': 'MakeTokenMatcher',
           'inputs': [
             '<@(scripts_for_in_files)',
-            '../core/scripts/make_token_matcher.py',
+            '../build/scripts/make_token_matcher.py',
             '../core/css/CSSParser-in.cpp',
           ],
           'outputs': [
@@ -660,11 +629,28 @@
           ],
           'action': [
             'python',
-            '../core/scripts/make_token_matcher.py',
+            '../build/scripts/make_token_matcher.py',
             '../core/css/CSSParser-in.cpp',
             '<(SHARED_INTERMEDIATE_DIR)/blink/CSSParser.cpp',
           ],
         },
+        {
+          'action_name': 'MakeTokenMatcherForViewport',
+          'inputs': [
+            '<@(scripts_for_in_files)',
+            '../build/scripts/make_token_matcher.py',
+            '../core/html/HTMLMetaElement-in.cpp',
+          ],
+          'outputs': [
+            '<(SHARED_INTERMEDIATE_DIR)/blink/HTMLMetaElement.cpp',
+          ],
+          'action': [
+            'python',
+            '../build/scripts/make_token_matcher.py',
+            '../core/html/HTMLMetaElement-in.cpp',
+            '<(SHARED_INTERMEDIATE_DIR)/blink/HTMLMetaElement.cpp',
+          ],
+        },
       ],
       'rules': [
         {
@@ -676,7 +662,7 @@
           ],
           'action': [
             'python',
-            'scripts/rule_bison.py',
+            '../build/scripts/rule_bison.py',
             '<(RULE_INPUT_PATH)',
             '<(SHARED_INTERMEDIATE_DIR)/blink',
             '<(bison_exe)',
@@ -690,12 +676,12 @@
             '<(SHARED_INTERMEDIATE_DIR)/blink/<(RULE_INPUT_ROOT).cpp',
           ],
           'inputs': [
-            'scripts/make-hash-tools.pl',
+            '../build/scripts/make-hash-tools.pl',
           ],
           'msvs_cygwin_shell': 0,
           'action': [
             '<(perl_exe)',
-            'scripts/make-hash-tools.pl',
+            '../build/scripts/make-hash-tools.pl',
             '<(SHARED_INTERMEDIATE_DIR)/blink',
             '<(RULE_INPUT_PATH)',
             '<(gperf_exe)',
diff --git a/Source/core/css/BasicShapeFunctions.cpp b/Source/core/css/BasicShapeFunctions.cpp
index e80d033..cc9f57b 100644
--- a/Source/core/css/BasicShapeFunctions.cpp
+++ b/Source/core/css/BasicShapeFunctions.cpp
@@ -35,23 +35,26 @@
 #include "core/css/CSSValuePool.h"
 #include "core/css/resolver/StyleResolverState.h"
 #include "core/rendering/style/BasicShapes.h"
+#include "core/rendering/style/RenderStyle.h"
 
 namespace WebCore {
 
-PassRefPtr<CSSValue> valueForBasicShape(const BasicShape* basicShape)
+PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle* style, const BasicShape* basicShape)
 {
+    CSSValuePool& pool = cssValuePool();
+
     RefPtr<CSSBasicShape> basicShapeValue;
     switch (basicShape->type()) {
     case BasicShape::BasicShapeRectangleType: {
         const BasicShapeRectangle* rectangle = static_cast<const BasicShapeRectangle*>(basicShape);
         RefPtr<CSSBasicShapeRectangle> rectangleValue = CSSBasicShapeRectangle::create();
 
-        rectangleValue->setX(cssValuePool().createValue(rectangle->x()));
-        rectangleValue->setY(cssValuePool().createValue(rectangle->y()));
-        rectangleValue->setWidth(cssValuePool().createValue(rectangle->width()));
-        rectangleValue->setHeight(cssValuePool().createValue(rectangle->height()));
-        rectangleValue->setRadiusX(cssValuePool().createValue(rectangle->cornerRadiusX()));
-        rectangleValue->setRadiusY(cssValuePool().createValue(rectangle->cornerRadiusY()));
+        rectangleValue->setX(pool.createValue(rectangle->x(), style));
+        rectangleValue->setY(pool.createValue(rectangle->y(), style));
+        rectangleValue->setWidth(pool.createValue(rectangle->width(), style));
+        rectangleValue->setHeight(pool.createValue(rectangle->height(), style));
+        rectangleValue->setRadiusX(pool.createValue(rectangle->cornerRadiusX(), style));
+        rectangleValue->setRadiusY(pool.createValue(rectangle->cornerRadiusY(), style));
 
         basicShapeValue = rectangleValue.release();
         break;
@@ -60,9 +63,9 @@
         const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(basicShape);
         RefPtr<CSSBasicShapeCircle> circleValue = CSSBasicShapeCircle::create();
 
-        circleValue->setCenterX(cssValuePool().createValue(circle->centerX()));
-        circleValue->setCenterY(cssValuePool().createValue(circle->centerY()));
-        circleValue->setRadius(cssValuePool().createValue(circle->radius()));
+        circleValue->setCenterX(pool.createValue(circle->centerX(), style));
+        circleValue->setCenterY(pool.createValue(circle->centerY(), style));
+        circleValue->setRadius(pool.createValue(circle->radius(), style));
 
         basicShapeValue = circleValue.release();
         break;
@@ -71,10 +74,10 @@
         const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>(basicShape);
         RefPtr<CSSBasicShapeEllipse> ellipseValue = CSSBasicShapeEllipse::create();
 
-        ellipseValue->setCenterX(cssValuePool().createValue(ellipse->centerX()));
-        ellipseValue->setCenterY(cssValuePool().createValue(ellipse->centerY()));
-        ellipseValue->setRadiusX(cssValuePool().createValue(ellipse->radiusX()));
-        ellipseValue->setRadiusY(cssValuePool().createValue(ellipse->radiusY()));
+        ellipseValue->setCenterX(pool.createValue(ellipse->centerX(), style));
+        ellipseValue->setCenterY(pool.createValue(ellipse->centerY(), style));
+        ellipseValue->setRadiusX(pool.createValue(ellipse->radiusX(), style));
+        ellipseValue->setRadiusY(pool.createValue(ellipse->radiusY(), style));
 
         basicShapeValue = ellipseValue.release();
         break;
@@ -86,7 +89,7 @@
         polygonValue->setWindRule(polygon->windRule());
         const Vector<Length>& values = polygon->values();
         for (unsigned i = 0; i < values.size(); i += 2)
-            polygonValue->appendPoint(cssValuePool().createValue(values.at(i)), cssValuePool().createValue(values.at(i + 1)));
+            polygonValue->appendPoint(pool.createValue(values.at(i), style), pool.createValue(values.at(i + 1), style));
 
         basicShapeValue = polygonValue.release();
         break;
@@ -108,7 +111,7 @@
     default:
         break;
     }
-    return cssValuePool().createValue<PassRefPtr<CSSBasicShape> >(basicShapeValue.release());
+    return pool.createValue(basicShapeValue.release());
 }
 
 static Length convertToLength(const StyleResolverState& state, CSSPrimitiveValue* value)
diff --git a/Source/core/css/BasicShapeFunctions.h b/Source/core/css/BasicShapeFunctions.h
index 4b3d39f..c0cd68a 100644
--- a/Source/core/css/BasicShapeFunctions.h
+++ b/Source/core/css/BasicShapeFunctions.h
@@ -38,8 +38,9 @@
 class CSSBasicShape;
 class CSSValue;
 class StyleResolverState;
+class RenderStyle;
 
-PassRefPtr<CSSValue> valueForBasicShape(const BasicShape*);
+PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle*, const BasicShape*);
 PassRefPtr<BasicShape> basicShapeForValue(const StyleResolverState&, const CSSBasicShape*);
 
 }
diff --git a/Source/core/css/CSSArrayFunctionValue.h b/Source/core/css/CSSArrayFunctionValue.h
index 9325207..3de65c7 100644
--- a/Source/core/css/CSSArrayFunctionValue.h
+++ b/Source/core/css/CSSArrayFunctionValue.h
@@ -53,6 +53,8 @@
     explicit CSSArrayFunctionValue(const CSSArrayFunctionValue& cloneFrom);
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(ArrayFunctionValue);
+
 } // namespace WebCore
 
 
diff --git a/Source/core/css/CSSCalculationValue.cpp b/Source/core/css/CSSCalculationValue.cpp
index f2eaae3..493500b 100644
--- a/Source/core/css/CSSCalculationValue.cpp
+++ b/Source/core/css/CSSCalculationValue.cpp
@@ -230,7 +230,7 @@
         case CalcNumber:
             return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue()));
         case CalcLength:
-            return adoptPtr(new CalcExpressionNumber(m_value->computeLength<float>(style, rootStyle, zoom)));
+            return adoptPtr(new CalcExpressionLength(Length(m_value->computeLength<float>(style, rootStyle, zoom), WebCore::Fixed)));
         case CalcPercent:
         case CalcPercentLength: {
             CSSPrimitiveValue* primitiveValue = m_value.get();
@@ -611,8 +611,7 @@
         if (!value || !value->isPrimitiveValue())
             return false;
 
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get());
-        result->value = CSSCalcPrimitiveValue::create(primitiveValue, parserValue->isInt);
+        result->value = CSSCalcPrimitiveValue::create(toCSSPrimitiveValue(value.get()), parserValue->isInt);
 
         ++*index;
         return true;
@@ -707,7 +706,7 @@
     return CSSCalcBinaryOperation::create(leftSide, rightSide, op);
 }
 
-PassRefPtr<CSSCalcExpressionNode> CSSCalcValue::createExpressionNode(const CalcExpressionNode* node, const RenderStyle* style)
+PassRefPtr<CSSCalcExpressionNode> CSSCalcValue::createExpressionNode(const CalcExpressionNode* node, float zoom)
 {
     switch (node->type()) {
     case CalcExpressionNodeNumber: {
@@ -715,10 +714,10 @@
         return createExpressionNode(CSSPrimitiveValue::create(value, CSSPrimitiveValue::CSS_NUMBER), value == trunc(value));
     }
     case CalcExpressionNodeLength:
-        return createExpressionNode(toCalcExpressionLength(node)->length(), style);
+        return createExpressionNode(toCalcExpressionLength(node)->length(), zoom);
     case CalcExpressionNodeBinaryOperation: {
         const CalcExpressionBinaryOperation* binaryNode = toCalcExpressionBinaryOperation(node);
-        return createExpressionNode(createExpressionNode(binaryNode->leftSide(), style), createExpressionNode(binaryNode->rightSide(), style), binaryNode->getOperator());
+        return createExpressionNode(createExpressionNode(binaryNode->leftSide(), zoom), createExpressionNode(binaryNode->rightSide(), zoom), binaryNode->getOperator());
     }
     case CalcExpressionNodeBlendLength: {
         // FIXME(crbug.com/269320): Create a CSSCalcExpressionNode equivalent of CalcExpressionBlendLength.
@@ -727,11 +726,11 @@
         const bool isInteger = !progress || (progress == 1);
         return createExpressionNode(
             createExpressionNode(
-                createExpressionNode(blendNode->from(), style),
+                createExpressionNode(blendNode->from(), zoom),
                 createExpressionNode(CSSPrimitiveValue::create(1 - progress, CSSPrimitiveValue::CSS_NUMBER), isInteger),
                 CalcMultiply),
             createExpressionNode(
-                createExpressionNode(blendNode->to(), style),
+                createExpressionNode(blendNode->to(), zoom),
                 createExpressionNode(CSSPrimitiveValue::create(progress, CSSPrimitiveValue::CSS_NUMBER), isInteger),
                 CalcMultiply),
             CalcAdd);
@@ -744,7 +743,7 @@
     return 0;
 }
 
-PassRefPtr<CSSCalcExpressionNode> CSSCalcValue::createExpressionNode(const Length& length, const RenderStyle* style)
+PassRefPtr<CSSCalcExpressionNode> CSSCalcValue::createExpressionNode(const Length& length, float zoom)
 {
     switch (length.type()) {
     case Percent:
@@ -753,9 +752,9 @@
     case ViewportPercentageMin:
     case ViewportPercentageMax:
     case Fixed:
-        return createExpressionNode(CSSPrimitiveValue::create(length, style), length.value() == trunc(length.value()));
+        return createExpressionNode(CSSPrimitiveValue::create(length, zoom), length.value() == trunc(length.value()));
     case Calculated:
-        return createExpressionNode(length.calculationValue()->expression(), style);
+        return createExpressionNode(length.calculationValue()->expression(), zoom);
     case Auto:
     case Intrinsic:
     case MinIntrinsic:
@@ -773,7 +772,7 @@
     return 0;
 }
 
-PassRefPtr<CSSCalcValue> CSSCalcValue::create(CSSParserString name, CSSParserValueList* parserValueList, CalculationPermittedValueRange range)
+PassRefPtr<CSSCalcValue> CSSCalcValue::create(CSSParserString name, CSSParserValueList* parserValueList, ValueRange range)
 {
     CSSCalcExpressionNodeParser parser;
     RefPtr<CSSCalcExpressionNode> expression;
@@ -785,7 +784,7 @@
     return expression ? adoptRef(new CSSCalcValue(expression, range)) : 0;
 }
 
-PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode> expression, CalculationPermittedValueRange range)
+PassRefPtr<CSSCalcValue> CSSCalcValue::create(PassRefPtr<CSSCalcExpressionNode> expression, ValueRange range)
 {
     return adoptRef(new CSSCalcValue(expression, range));
 }
diff --git a/Source/core/css/CSSCalculationValue.h b/Source/core/css/CSSCalculationValue.h
index 6bf1ac7..9d0ee82 100644
--- a/Source/core/css/CSSCalculationValue.h
+++ b/Source/core/css/CSSCalculationValue.h
@@ -93,24 +93,24 @@
 
 class CSSCalcValue : public CSSValue {
 public:
-    static PassRefPtr<CSSCalcValue> create(CSSParserString name, CSSParserValueList*, CalculationPermittedValueRange);
-    static PassRefPtr<CSSCalcValue> create(PassRefPtr<CSSCalcExpressionNode>, CalculationPermittedValueRange = CalculationRangeAll);
-    static PassRefPtr<CSSCalcValue> create(const CalculationValue* value, const RenderStyle* style) { return adoptRef(new CSSCalcValue(value, style)); }
+    static PassRefPtr<CSSCalcValue> create(CSSParserString name, CSSParserValueList*, ValueRange);
+    static PassRefPtr<CSSCalcValue> create(PassRefPtr<CSSCalcExpressionNode>, ValueRange = ValueRangeAll);
+    static PassRefPtr<CSSCalcValue> create(const CalculationValue* value, float zoom) { return adoptRef(new CSSCalcValue(value, zoom)); }
 
     static PassRefPtr<CSSCalcExpressionNode> createExpressionNode(PassRefPtr<CSSPrimitiveValue>, bool isInteger = false);
     static PassRefPtr<CSSCalcExpressionNode> createExpressionNode(PassRefPtr<CSSCalcExpressionNode>, PassRefPtr<CSSCalcExpressionNode>, CalcOperator);
-    static PassRefPtr<CSSCalcExpressionNode> createExpressionNode(const CalcExpressionNode*, const RenderStyle*);
-    static PassRefPtr<CSSCalcExpressionNode> createExpressionNode(const Length&, const RenderStyle*);
+    static PassRefPtr<CSSCalcExpressionNode> createExpressionNode(const CalcExpressionNode*, float zoom);
+    static PassRefPtr<CSSCalcExpressionNode> createExpressionNode(const Length&, float zoom);
 
     PassRefPtr<CalculationValue> toCalcValue(const RenderStyle* style, const RenderStyle* rootStyle, double zoom = 1.0) const
     {
-        return CalculationValue::create(m_expression->toCalcValue(style, rootStyle, zoom), m_nonNegative ? CalculationRangeNonNegative : CalculationRangeAll);
+        return CalculationValue::create(m_expression->toCalcValue(style, rootStyle, zoom), m_nonNegative ? ValueRangeNonNegative : ValueRangeAll);
     }
     CalculationCategory category() const { return m_expression->category(); }
     bool isInt() const { return m_expression->isInteger(); }
     double doubleValue() const;
     bool isNegative() const { return m_expression->doubleValue() < 0; }
-    CalculationPermittedValueRange permittedValueRange() { return m_nonNegative ? CalculationRangeNonNegative : CalculationRangeAll; }
+    ValueRange permittedValueRange() { return m_nonNegative ? ValueRangeNonNegative : ValueRangeAll; }
     double computeLengthPx(const RenderStyle* currentStyle, const RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const;
     CSSCalcExpressionNode* expressionNode() const { return m_expression.get(); }
 
@@ -120,15 +120,15 @@
     bool hasVariableReference() const;
 
 private:
-    CSSCalcValue(PassRefPtr<CSSCalcExpressionNode> expression, CalculationPermittedValueRange range)
+    CSSCalcValue(PassRefPtr<CSSCalcExpressionNode> expression, ValueRange range)
         : CSSValue(CalculationClass)
         , m_expression(expression)
-        , m_nonNegative(range == CalculationRangeNonNegative)
+        , m_nonNegative(range == ValueRangeNonNegative)
     {
     }
-    CSSCalcValue(const CalculationValue* value, const RenderStyle* style)
+    CSSCalcValue(const CalculationValue* value, float zoom)
         : CSSValue(CalculationClass)
-        , m_expression(createExpressionNode(value->expression(), style))
+        , m_expression(createExpressionNode(value->expression(), zoom))
         , m_nonNegative(value->isNonNegative())
     {
     }
@@ -139,17 +139,7 @@
     const bool m_nonNegative;
 };
 
-inline CSSCalcValue* toCSSCalcValue(CSSValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isCalculationValue());
-    return static_cast<CSSCalcValue*>(value);
-}
-
-inline const CSSCalcValue* toCSSCalcValue(const CSSValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isCalculationValue());
-    return static_cast<const CSSCalcValue*>(value);
-}
+DEFINE_CSS_VALUE_TYPE_CASTS(CalcValue);
 
 } // namespace WebCore
 
diff --git a/Source/core/css/CSSCalculationValueTest.cpp b/Source/core/css/CSSCalculationValueTest.cpp
index bfd0be4..687a3ea 100644
--- a/Source/core/css/CSSCalculationValueTest.cpp
+++ b/Source/core/css/CSSCalculationValueTest.cpp
@@ -41,6 +41,15 @@
 
 namespace {
 
+void testExpression(PassRefPtr<CSSCalcExpressionNode> expression, const RenderStyle* style)
+{
+    EXPECT_TRUE(
+        expression->equals(
+            *CSSCalcValue::createExpressionNode(
+                expression->toCalcValue(style, style, style->effectiveZoom()).get(),
+                style->effectiveZoom()).get()));
+}
+
 TEST(CSSCalculationValue, CreateExpressionNodeFromLength)
 {
     RefPtr<RenderStyle> style = RenderStyle::create();
@@ -48,7 +57,7 @@
     RefPtr<CSSCalcExpressionNode> actual;
 
     expected = CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX), true);
-    actual = CSSCalcValue::createExpressionNode(Length(10, WebCore::Fixed), style.get());
+    actual = CSSCalcValue::createExpressionNode(Length(10, WebCore::Fixed), style->effectiveZoom());
     EXPECT_TRUE(actual->equals(*expected.get()));
 
     expected = CSSCalcValue::createExpressionNode(
@@ -61,8 +70,8 @@
                 adoptPtr(new CalcExpressionLength(Length(10, WebCore::Fixed))),
                 adoptPtr(new CalcExpressionLength(Length(20, WebCore::Fixed))),
                 CalcAdd)),
-            CalculationRangeAll)),
-        style.get());
+            ValueRangeAll)),
+        style->effectiveZoom());
     EXPECT_TRUE(actual->equals(*expected.get()));
 
     expected = CSSCalcValue::createExpressionNode(
@@ -75,8 +84,8 @@
                 adoptPtr(new CalcExpressionLength(Length(30, WebCore::Fixed))),
                 adoptPtr(new CalcExpressionNumber(40)),
                 CalcMultiply)),
-            CalculationRangeAll)),
-        style.get());
+            ValueRangeAll)),
+        style->effectiveZoom());
     EXPECT_TRUE(actual->equals(*expected.get()));
 
     expected = CSSCalcValue::createExpressionNode(
@@ -92,9 +101,47 @@
     actual = CSSCalcValue::createExpressionNode(
         Length(CalculationValue::create(
             adoptPtr(new CalcExpressionBlendLength(Length(50, WebCore::Fixed), Length(60, WebCore::Fixed), 0.75)),
-            CalculationRangeAll)),
-        style.get());
+            ValueRangeAll)),
+        style->effectiveZoom());
     EXPECT_TRUE(actual->equals(*expected.get()));
 }
 
+TEST(CSSCalculationValue, CreateExpressionNodeFromLengthFromExpressionNode)
+{
+    RefPtr<CSSCalcExpressionNode> expression;
+    RefPtr<RenderStyle> style = RenderStyle::createDefaultStyle();
+    style->setEffectiveZoom(5);
+
+    testExpression(
+        CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX), true),
+        style.get());
+
+    testExpression(
+        CSSCalcValue::createExpressionNode(
+            CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX), true),
+            CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(20, CSSPrimitiveValue::CSS_PX), true),
+            CalcAdd),
+        style.get());
+
+    testExpression(
+        CSSCalcValue::createExpressionNode(
+            CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(30, CSSPrimitiveValue::CSS_PX), true),
+            CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(40, CSSPrimitiveValue::CSS_NUMBER), true),
+            CalcMultiply),
+        style.get());
+
+    testExpression(
+        CSSCalcValue::createExpressionNode(
+            CSSCalcValue::createExpressionNode(
+                CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(50, CSSPrimitiveValue::CSS_PX), true),
+                CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(0.25, CSSPrimitiveValue::CSS_NUMBER), false),
+                CalcMultiply),
+            CSSCalcValue::createExpressionNode(
+                CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(60, CSSPrimitiveValue::CSS_PX), true),
+                CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(0.75, CSSPrimitiveValue::CSS_NUMBER), false),
+                CalcMultiply),
+            CalcAdd),
+        style.get());
+}
+
 }
diff --git a/Source/core/css/CSSCanvasValue.h b/Source/core/css/CSSCanvasValue.h
index 8283adb..7c1476d 100644
--- a/Source/core/css/CSSCanvasValue.h
+++ b/Source/core/css/CSSCanvasValue.h
@@ -94,6 +94,8 @@
     HTMLCanvasElement* m_element;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(CanvasValue);
+
 } // namespace WebCore
 
 #endif // CSSCanvasValue_h
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index 37ef541..3975865 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -34,6 +34,8 @@
 #include "core/css/CSSAspectRatioValue.h"
 #include "core/css/CSSBorderImage.h"
 #include "core/css/CSSFilterValue.h"
+#include "core/css/CSSFontFeatureValue.h"
+#include "core/css/CSSFontValue.h"
 #include "core/css/CSSFunctionValue.h"
 #include "core/css/CSSGridTemplateValue.h"
 #include "core/css/CSSLineBoxContainValue.h"
@@ -43,23 +45,20 @@
 #include "core/css/CSSPrimitiveValueMappings.h"
 #include "core/css/CSSReflectValue.h"
 #include "core/css/CSSSelector.h"
+#include "core/css/CSSShadowValue.h"
 #include "core/css/CSSTimingFunctionValue.h"
 #include "core/css/CSSTransformValue.h"
 #include "core/css/CSSValueList.h"
 #include "core/css/CSSValuePool.h"
-#include "core/css/FontFeatureValue.h"
-#include "core/css/FontValue.h"
 #include "core/css/Pair.h"
 #include "core/css/Rect.h"
-#include "core/css/ShadowValue.h"
 #include "core/css/StylePropertySet.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/PseudoElement.h"
 #include "core/page/RuntimeCSSEnabled.h"
-#include "core/page/animation/AnimationController.h"
-#include "core/platform/graphics/FontFeatureSettings.h"
+#include "core/frame/animation/AnimationController.h"
 #include "core/rendering/RenderBox.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/style/ContentData.h"
@@ -67,6 +66,7 @@
 #include "core/rendering/style/CursorList.h"
 #include "core/rendering/style/RenderStyle.h"
 #include "core/rendering/style/ShapeValue.h"
+#include "platform/fonts/FontFeatureSettings.h"
 #include "wtf/text/StringBuilder.h"
 
 #include "core/platform/graphics/filters/custom/CustomFilterArrayParameter.h"
@@ -188,6 +188,7 @@
     CSSPropertyTextDecorationLine,
     CSSPropertyTextDecorationStyle,
     CSSPropertyTextDecorationColor,
+    CSSPropertyTextJustify,
 #if ENABLE(CSS3_TEXT)
     CSSPropertyWebkitTextUnderlinePosition,
 #endif // CSS3_TEXT
@@ -341,6 +342,7 @@
     CSSPropertyWebkitWrapFlow,
     CSSPropertyWebkitShapeMargin,
     CSSPropertyWebkitShapePadding,
+    CSSPropertyWebkitShapeImageThreshold,
     CSSPropertyWebkitWrapThrough,
     CSSPropertyBufferedRendering,
     CSSPropertyClipPath,
@@ -559,11 +561,11 @@
     return cssValuePool().createValue(value / style->effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
 }
 
-static PassRefPtr<CSSValue> zoomAdjustedPixelValueForLength(const Length& length, const RenderStyle* style)
+static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength(const Length& length, const RenderStyle* style)
 {
     if (length.isFixed())
         return zoomAdjustedPixelValue(length.value(), style);
-    return cssValuePool().createValue(length);
+    return cssValuePool().createValue(length, style);
 }
 
 static PassRefPtr<CSSValue> valueForReflection(const StyleReflection* reflection, const RenderStyle* style)
@@ -693,13 +695,14 @@
 static PassRefPtr<CSSValueList> valueForBorderRadiusShorthand(const RenderStyle* style, RenderObject* renderer, RenderView* renderView)
 {
     RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
+
     bool showHorizontalBottomLeft = style->borderTopRightRadius().width() != style->borderBottomLeftRadius().width();
-    bool showHorizontalBottomRight = style->borderBottomRightRadius().width() != style->borderTopLeftRadius().width();
-    bool showHorizontalTopRight = style->borderTopRightRadius().width() != style->borderTopLeftRadius().width();
+    bool showHorizontalBottomRight = showHorizontalBottomLeft || (style->borderBottomRightRadius().width() != style->borderTopLeftRadius().width());
+    bool showHorizontalTopRight = showHorizontalBottomRight || (style->borderTopRightRadius().width() != style->borderTopLeftRadius().width());
 
     bool showVerticalBottomLeft = style->borderTopRightRadius().height() != style->borderBottomLeftRadius().height();
-    bool showVerticalBottomRight = (style->borderBottomRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomLeft;
-    bool showVerticalTopRight = (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomRight;
+    bool showVerticalBottomRight = showVerticalBottomLeft || (style->borderBottomRightRadius().height() != style->borderTopLeftRadius().height());
+    bool showVerticalTopRight = showVerticalBottomRight || (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height());
     bool showVerticalTopLeft = (style->borderTopLeftRadius().width() != style->borderTopLeftRadius().height());
 
     RefPtr<CSSValueList> topLeftRadius = valuesForBorderRadiusCorner(style->borderTopLeftRadius(), style, renderer, renderView);
@@ -1323,7 +1326,7 @@
         RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? PassRefPtr<CSSPrimitiveValue>() : zoomAdjustedPixelValue(s->spread(), style);
         RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || s->style() == Normal ? PassRefPtr<CSSPrimitiveValue>() : cssValuePool().createIdentifierValue(CSSValueInset);
         RefPtr<CSSPrimitiveValue> color = cssValuePool().createColorValue(s->color().rgb());
-        list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
+        list->prepend(CSSShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
     }
     return list.release();
 }
@@ -1455,7 +1458,7 @@
         } else if (contentData->isText())
             list->append(cssValuePool().createValue(static_cast<const TextContentData*>(contentData)->text(), CSSPrimitiveValue::CSS_STRING));
     }
-    if (!style->regionThread().isNull())
+    if (style->hasFlowFrom())
         list->append(cssValuePool().createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING));
     return list.release();
 }
@@ -1504,7 +1507,7 @@
         // On the other hand, since font-size doesn't include the zoom factor, we really can't do
         // that here either.
         return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style->fontDescription().specifiedSize()) / 100, style);
-    return zoomAdjustedPixelValue(valueForLength(length, 0, renderView), style);
+    return zoomAdjustedPixelValue(floatValueForLength(length, 0, renderView), style);
 }
 
 static PassRefPtr<CSSPrimitiveValue> valueForFontSize(RenderStyle* style)
@@ -1907,6 +1910,10 @@
             if (style->hasAutoColumnCount())
                 return cssValuePool().createIdentifierValue(CSSValueAuto);
             return cssValuePool().createValue(style->columnCount(), CSSPrimitiveValue::CSS_NUMBER);
+        case CSSPropertyColumnFill:
+            if (RuntimeEnabledFeatures::regionBasedColumnsEnabled())
+                return cssValuePool().createValue(style->columnFill());
+            return 0;
         case CSSPropertyWebkitColumnGap:
             if (style->hasNormalColumnGap())
                 return cssValuePool().createIdentifierValue(CSSValueNormal);
@@ -1996,7 +2003,7 @@
                 return cssValuePool().createIdentifierValue(CSSValueNone);
             return cssValuePool().createValue(style->floating());
         case CSSPropertyFont: {
-            RefPtr<FontValue> computedFont = FontValue::create();
+            RefPtr<CSSFontValue> computedFont = CSSFontValue::create();
             computedFont->style = valueForFontStyle(style.get());
             computedFont->variant = valueForFontVariant(style.get());
             computedFont->weight = valueForFontWeight(style.get());
@@ -2028,7 +2035,7 @@
             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
             for (unsigned i = 0; i < featureSettings->size(); ++i) {
                 const FontFeature& feature = featureSettings->at(i);
-                RefPtr<FontFeatureValue> featureValue = FontFeatureValue::create(feature.tag(), feature.value());
+                RefPtr<CSSFontFeatureValue> featureValue = CSSFontFeatureValue::create(feature.tag(), feature.value());
                 list->append(featureValue.release());
             }
             return list.release();
@@ -2260,6 +2267,8 @@
             return valueForTextDecorationStyle(style->textDecorationStyle());
         case CSSPropertyTextDecorationColor:
             return currentColorOrValidColor(style.get(), style->textDecorationColor());
+        case CSSPropertyTextJustify:
+            return cssValuePool().createValue(style->textJustify());
 #if ENABLE(CSS3_TEXT)
         case CSSPropertyWebkitTextUnderlinePosition:
             return cssValuePool().createValue(style->textUnderlinePosition());
@@ -2710,7 +2719,7 @@
         case CSSPropertyWebkitClipPath:
             if (ClipPathOperation* operation = style->clipPath()) {
                 if (operation->getOperationType() == ClipPathOperation::SHAPE)
-                    return valueForBasicShape(static_cast<ShapeClipPathOperation*>(operation)->basicShape());
+                    return valueForBasicShape(style.get(), static_cast<ShapeClipPathOperation*>(operation)->basicShape());
                 if (operation->getOperationType() == ClipPathOperation::REFERENCE) {
                     ReferenceClipPathOperation* referenceOperation = static_cast<ReferenceClipPathOperation*>(operation);
                     return CSSPrimitiveValue::create(referenceOperation->url(), CSSPrimitiveValue::CSS_URI);
@@ -2722,7 +2731,7 @@
                 return cssValuePool().createIdentifierValue(CSSValueNone);
             return cssValuePool().createValue(style->flowThread(), CSSPrimitiveValue::CSS_STRING);
         case CSSPropertyWebkitFlowFrom:
-            if (style->regionThread().isNull())
+            if (!style->hasFlowFrom())
                 return cssValuePool().createIdentifierValue(CSSValueNone);
             return cssValuePool().createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING);
         case CSSPropertyWebkitRegionFragment:
@@ -2733,6 +2742,8 @@
             return cssValuePool().createValue(style->shapeMargin());
         case CSSPropertyWebkitShapePadding:
             return cssValuePool().createValue(style->shapePadding());
+        case CSSPropertyWebkitShapeImageThreshold:
+            return cssValuePool().createValue(style->shapeImageThreshold(), CSSPrimitiveValue::CSS_NUMBER);
         case CSSPropertyWebkitShapeInside:
             if (!style->shapeInside())
                 return cssValuePool().createIdentifierValue(CSSValueAuto);
@@ -2744,7 +2755,7 @@
                 return cssValuePool().createIdentifierValue(CSSValueNone);
             }
             ASSERT(style->shapeInside()->type() == ShapeValue::Shape);
-            return valueForBasicShape(style->shapeInside()->shape());
+            return valueForBasicShape(style.get(), style->shapeInside()->shape());
         case CSSPropertyWebkitShapeOutside:
             if (!style->shapeOutside())
                 return cssValuePool().createIdentifierValue(CSSValueAuto);
@@ -2754,7 +2765,7 @@
                 return cssValuePool().createIdentifierValue(CSSValueNone);
             }
             ASSERT(style->shapeOutside()->type() == ShapeValue::Shape);
-            return valueForBasicShape(style->shapeOutside()->shape());
+            return valueForBasicShape(style.get(), style->shapeOutside()->shape());
         case CSSPropertyWebkitWrapThrough:
             return cssValuePool().createValue(style->wrapThrough());
         case CSSPropertyWebkitFilter:
@@ -2819,6 +2830,9 @@
         case CSSPropertyBackgroundRepeatX:
         case CSSPropertyBackgroundRepeatY:
             break;
+        case CSSPropertyInternalCallback:
+            // This property is hidden from the web.
+            return 0;
 
         /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
         case CSSPropertyWebkitTextEmphasis:
@@ -3169,10 +3183,11 @@
     return it->value;
 }
 
-void CSSComputedStyleDeclaration::setVariableValue(const AtomicString& name, const String&, ExceptionState& es)
+bool CSSComputedStyleDeclaration::setVariableValue(const AtomicString& name, const String&, ExceptionState& es)
 {
     ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
     es.throwDOMException(NoModificationAllowedError, "Failed to set the '" + name + "' property on a computed 'CSSStyleDeclaration': computed styles are read-only.");
+    return false;
 }
 
 bool CSSComputedStyleDeclaration::removeVariable(const AtomicString&)
@@ -3181,10 +3196,40 @@
     return false;
 }
 
-void CSSComputedStyleDeclaration::clearVariables(ExceptionState& es)
+bool CSSComputedStyleDeclaration::clearVariables(ExceptionState& es)
 {
     ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
     es.throwDOMException(NoModificationAllowedError, "Failed to clear variables from a computed 'CSSStyleDeclaration': computed styles are read-only.");
+    return false;
+}
+
+CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::ComputedCSSVariablesIterator(const HashMap<AtomicString, String>* variables)
+    : m_active(variables)
+{
+    ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+    if (m_active) {
+        m_it = variables->begin();
+        m_end = variables->end();
+    }
+}
+
+void CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::advance()
+{
+    ASSERT(m_active);
+    ++m_it;
+    m_active = !atEnd();
+}
+
+AtomicString CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::name() const
+{
+    ASSERT(m_active);
+    return m_it->key;
+}
+
+String CSSComputedStyleDeclaration::ComputedCSSVariablesIterator::value() const
+{
+    ASSERT(m_active);
+    return m_it->value;
 }
 
 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForBackgroundShorthand() const
diff --git a/Source/core/css/CSSComputedStyleDeclaration.h b/Source/core/css/CSSComputedStyleDeclaration.h
index 6116b50..53f10d2 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.h
+++ b/Source/core/css/CSSComputedStyleDeclaration.h
@@ -49,6 +49,23 @@
 enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true };
 
 class CSSComputedStyleDeclaration : public CSSStyleDeclaration {
+private:
+    class ComputedCSSVariablesIterator : public CSSVariablesIterator {
+    public:
+        virtual ~ComputedCSSVariablesIterator() { }
+        static PassRefPtr<ComputedCSSVariablesIterator> create(const HashMap<AtomicString, String>* variableMap) { return adoptRef(new ComputedCSSVariablesIterator(variableMap)); }
+    private:
+        explicit ComputedCSSVariablesIterator(const HashMap<AtomicString, String>* variableMap);
+        virtual void advance() OVERRIDE;
+        virtual bool atEnd() const OVERRIDE { return m_it == m_end; }
+        virtual AtomicString name() const OVERRIDE;
+        virtual String value() const OVERRIDE;
+        bool m_active;
+        typedef HashMap<AtomicString, String>::const_iterator VariablesMapIterator;
+        VariablesMapIterator m_it;
+        VariablesMapIterator m_end;
+    };
+
 public:
     static PassRefPtr<CSSComputedStyleDeclaration> create(PassRefPtr<Node> node, bool allowVisitedStyle = false, const String& pseudoElementName = String())
     {
@@ -103,9 +120,10 @@
     const HashMap<AtomicString, String>* variableMap() const;
     virtual unsigned variableCount() const OVERRIDE;
     virtual String variableValue(const AtomicString& name) const OVERRIDE;
-    virtual void setVariableValue(const AtomicString& name, const String& value, ExceptionState&) OVERRIDE;
+    virtual bool setVariableValue(const AtomicString& name, const String& value, ExceptionState&) OVERRIDE;
     virtual bool removeVariable(const AtomicString& name) OVERRIDE;
-    virtual void clearVariables(ExceptionState&) OVERRIDE;
+    virtual bool clearVariables(ExceptionState&) OVERRIDE;
+    virtual PassRefPtr<CSSVariablesIterator> variablesIterator() const OVERRIDE { return ComputedCSSVariablesIterator::create(variableMap()); }
 
     virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRIDE;
 
diff --git a/Source/core/css/CSSCrossfadeValue.cpp b/Source/core/css/CSSCrossfadeValue.cpp
index b45f6cc..b547b39 100644
--- a/Source/core/css/CSSCrossfadeValue.cpp
+++ b/Source/core/css/CSSCrossfadeValue.cpp
@@ -41,7 +41,7 @@
         return toCSSImageValue(value)->cachedOrPendingImage()->isPendingImage();
 
     if (value->isImageGeneratorValue())
-        return static_cast<CSSImageGeneratorValue*>(value)->isPending();
+        return toCSSImageGeneratorValue(value)->isPending();
 
     ASSERT_NOT_REACHED();
 
@@ -54,7 +54,7 @@
         return toCSSImageValue(value)->knownToBeOpaque(renderer);
 
     if (value->isImageGeneratorValue())
-        return static_cast<CSSImageGeneratorValue*>(value)->knownToBeOpaque(renderer);
+        return toCSSImageGeneratorValue(value)->knownToBeOpaque(renderer);
 
     ASSERT_NOT_REACHED();
 
@@ -75,7 +75,7 @@
     }
 
     if (value->isImageGeneratorValue()) {
-        static_cast<CSSImageGeneratorValue*>(value)->loadSubimages(fetcher);
+        toCSSImageGeneratorValue(value)->loadSubimages(fetcher);
         // FIXME: Handle CSSImageGeneratorValue (and thus cross-fades with gradients and canvas).
         return 0;
     }
diff --git a/Source/core/css/CSSCrossfadeValue.h b/Source/core/css/CSSCrossfadeValue.h
index 4df7520..f506651 100644
--- a/Source/core/css/CSSCrossfadeValue.h
+++ b/Source/core/css/CSSCrossfadeValue.h
@@ -104,6 +104,8 @@
     CrossfadeSubimageObserverProxy m_crossfadeSubimageObserver;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(CrossfadeValue);
+
 } // namespace WebCore
 
 #endif // CSSCrossfadeValue_h
diff --git a/Source/core/css/CSSCursorImageValue.h b/Source/core/css/CSSCursorImageValue.h
index c4a895c..b163f41 100644
--- a/Source/core/css/CSSCursorImageValue.h
+++ b/Source/core/css/CSSCursorImageValue.h
@@ -22,7 +22,7 @@
 #define CSSCursorImageValue_h
 
 #include "core/css/CSSImageValue.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/geometry/IntPoint.h"
 #include "wtf/HashSet.h"
 
 namespace WebCore {
@@ -75,6 +75,8 @@
     HashSet<SVGElement*> m_referencedElements;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(CursorImageValue);
+
 } // namespace WebCore
 
 #endif // CSSCursorImageValue_h
diff --git a/Source/core/css/CSSDefaultStyleSheets.cpp b/Source/core/css/CSSDefaultStyleSheets.cpp
index 436ab64..e5fda36 100644
--- a/Source/core/css/CSSDefaultStyleSheets.cpp
+++ b/Source/core/css/CSSDefaultStyleSheets.cpp
@@ -57,7 +57,7 @@
 StyleSheetContents* CSSDefaultStyleSheets::fullscreenStyleSheet;
 
 // FIXME: It would be nice to use some mechanism that guarantees this is in sync with the real UA stylesheet.
-static const char* simpleUserAgentStyleSheet = "html,body,div{display:block}head{display:none}body{margin:8px}div:focus,span:focus{outline:auto 5px -webkit-focus-ring-color}a:-webkit-any-link{color:-webkit-link;text-decoration:underline}a:-webkit-any-link:active{color:-webkit-activelink}body:-webkit-seamless-document{margin:0}body:-webkit-full-page-media{background-color:black}";
+static const char* simpleUserAgentStyleSheet = "html,body,div{display:block}head{display:none}body{margin:8px}div:focus,span:focus,a:focus{outline:auto 5px -webkit-focus-ring-color}a:-webkit-any-link{color:-webkit-link;text-decoration:underline}a:-webkit-any-link:active{color:-webkit-activelink}body:-webkit-seamless-document{margin:0}body:-webkit-full-page-media{background-color:black}@viewport{min-width:980px}@page{size:auto;margin:auto;padding:0;border-width:0}";
 
 static inline bool elementCanUseSimpleDefaultStyle(Element* e)
 {
diff --git a/Source/core/css/CSSFilterValue.h b/Source/core/css/CSSFilterValue.h
index 3398cfa..fcbcf5a 100644
--- a/Source/core/css/CSSFilterValue.h
+++ b/Source/core/css/CSSFilterValue.h
@@ -72,6 +72,8 @@
     FilterOperationType m_type;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(FilterValue);
+
 }
 
 
diff --git a/Source/core/css/CSSFontFace.cpp b/Source/core/css/CSSFontFace.cpp
index c667aaa..ce3d142 100644
--- a/Source/core/css/CSSFontFace.cpp
+++ b/Source/core/css/CSSFontFace.cpp
@@ -31,6 +31,7 @@
 #include "core/css/CSSSegmentedFontFace.h"
 #include "core/css/FontFaceSet.h"
 #include "core/dom/Document.h"
+#include "core/page/UseCounter.h"
 #include "core/platform/graphics/SimpleFontData.h"
 
 namespace WebCore {
@@ -94,8 +95,11 @@
     fontSelector->fontLoaded();
 
     if (fontSelector->document() && loadStatus() == FontFace::Loading) {
-        if (source->ensureFontData())
+        if (source->ensureFontData()) {
             setLoadStatus(FontFace::Loaded);
+            if (source->isSVGFontFaceSource())
+                UseCounter::count(*fontSelector->document(), UseCounter::SVGFontInCSS);
+        }
         else if (!isValid())
             setLoadStatus(FontFace::Error);
     }
@@ -173,16 +177,25 @@
     }
 }
 
-#if ENABLE(SVG_FONTS)
-bool CSSFontFace::hasSVGFontFaceSource() const
+bool CSSFontFace::UnicodeRangeSet::intersectsWith(const String& text) const
 {
-    size_t size = m_sources.size();
-    for (size_t i = 0; i < size; i++) {
-        if (m_sources[i]->isSVGFontFaceSource())
-            return true;
+    if (text.isEmpty())
+        return false;
+    if (m_ranges.isEmpty())
+        return true; // Empty UnicodeRangeSet represents the whole code space.
+
+    // FIXME: This takes O(text.length() * m_ranges.size()) time. It would be
+    // better to make m_ranges sorted and use binary search.
+    unsigned index = 0;
+    while (index < text.length()) {
+        UChar32 c = text.characterStartingAt(index);
+        index += U16_LENGTH(c);
+        for (unsigned i = 0; i < m_ranges.size(); i++) {
+            if (m_ranges[i].contains(c))
+                return true;
+        }
     }
     return false;
 }
-#endif
 
 }
diff --git a/Source/core/css/CSSFontFace.h b/Source/core/css/CSSFontFace.h
index 7ada75e..b547667 100644
--- a/Source/core/css/CSSFontFace.h
+++ b/Source/core/css/CSSFontFace.h
@@ -45,12 +45,11 @@
 public:
     static PassRefPtr<CSSFontFace> create(PassRefPtr<FontFace> fontFace) { return adoptRef(new CSSFontFace(fontFace)); }
 
-    struct UnicodeRange;
+    class UnicodeRangeSet;
 
     FontFace* fontFace() const { return m_fontFace.get(); }
 
-    void addRange(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); }
-    const Vector<UnicodeRange>& ranges() const { return m_ranges; }
+    UnicodeRangeSet& ranges() { return m_ranges; }
 
     void setSegmentedFontFace(CSSSegmentedFontFace*);
     void clearSegmentedFontFace() { m_segmentedFontFace = 0; }
@@ -74,15 +73,22 @@
 
         UChar32 from() const { return m_from; }
         UChar32 to() const { return m_to; }
+        bool contains(UChar32 c) const { return m_from <= c && c <= m_to; }
 
     private:
         UChar32 m_from;
         UChar32 m_to;
     };
 
-#if ENABLE(SVG_FONTS)
-    bool hasSVGFontFaceSource() const;
-#endif
+    class UnicodeRangeSet {
+    public:
+        void add(UChar32 from, UChar32 to) { m_ranges.append(UnicodeRange(from, to)); }
+        bool intersectsWith(const String&) const;
+        size_t size() const { return m_ranges.size(); }
+        const UnicodeRange& rangeAt(size_t i) const { return m_ranges[i]; }
+    private:
+        Vector<UnicodeRange> m_ranges;
+    };
 
     FontFace::LoadStatus loadStatus() const { return m_fontFace ? m_fontFace->loadStatus() : FontFace::Loaded; }
     void willUseFontData(const FontDescription&);
@@ -96,7 +102,7 @@
     }
     void setLoadStatus(FontFace::LoadStatus);
 
-    Vector<UnicodeRange> m_ranges;
+    UnicodeRangeSet m_ranges;
     CSSSegmentedFontFace* m_segmentedFontFace;
     Vector<OwnPtr<CSSFontFaceSource> > m_sources;
     CSSFontFaceSource* m_activeSource;
diff --git a/Source/core/css/CSSFontFaceLoadEvent.cpp b/Source/core/css/CSSFontFaceLoadEvent.cpp
index 58a5e4f..95aa3b2 100644
--- a/Source/core/css/CSSFontFaceLoadEvent.cpp
+++ b/Source/core/css/CSSFontFaceLoadEvent.cpp
@@ -58,7 +58,7 @@
 
 const AtomicString& CSSFontFaceLoadEvent::interfaceName() const
 {
-    return eventNames().interfaceForCSSFontFaceLoadEvent;
+    return EventNames::CSSFontFaceLoadEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/css/CSSFontFaceLoadEvent.h b/Source/core/css/CSSFontFaceLoadEvent.h
index 432dacf..e77ca32 100644
--- a/Source/core/css/CSSFontFaceLoadEvent.h
+++ b/Source/core/css/CSSFontFaceLoadEvent.h
@@ -34,7 +34,7 @@
 #include "core/css/FontFace.h"
 #include "core/dom/DOMError.h"
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
 
diff --git a/Source/core/css/CSSFontFaceLoadEvent.idl b/Source/core/css/CSSFontFaceLoadEvent.idl
index 7ab2522..b77706c 100644
--- a/Source/core/css/CSSFontFaceLoadEvent.idl
+++ b/Source/core/css/CSSFontFaceLoadEvent.idl
@@ -31,7 +31,7 @@
 // FIXME: Make this constructable from Javascript
 [
     NoInterfaceObject,
-    EnabledAtRuntime=FontLoadEvents,
+    RuntimeEnabled=FontLoadEvents,
 ] interface CSSFontFaceLoadEvent : Event {
     readonly attribute FontFace[] fontfaces;
 };
diff --git a/Source/core/css/CSSFontFaceSource.cpp b/Source/core/css/CSSFontFaceSource.cpp
index 7fe19c9..834f3d1 100644
--- a/Source/core/css/CSSFontFaceSource.cpp
+++ b/Source/core/css/CSSFontFaceSource.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/css/CSSFontFaceSource.h"
 
+#include "RuntimeEnabledFeatures.h"
 #include "core/css/CSSFontFace.h"
 #include "core/css/CSSFontSelector.h"
 #include "core/fetch/FontResource.h"
@@ -139,9 +140,18 @@
         return fontData;
     }
 
+    float fontSize;
+    if (RuntimeEnabledFeatures::subpixelFontScalingEnabled())
+        fontSize = fontDescription.computedSize();
+    else
+        fontSize = fontDescription.computedPixelSize();
+
     // See if we have a mapping in our FontData cache.
-    unsigned hashKey = (fontDescription.computedPixelSize() + 1) << 5 | fontDescription.widthVariant() << 3
-                       | (fontDescription.orientation() == Vertical ? 4 : 0) | (syntheticBold ? 2 : 0) | (syntheticItalic ? 1 : 0);
+    unsigned hashKey = (static_cast<unsigned>(fontSize * FontCache::s_fontSizePrecisionMultiplier) + 1) << 5
+        | fontDescription.widthVariant() << 3
+        | (fontDescription.orientation() == Vertical ? 4 : 0)
+        | (syntheticBold ? 2 : 0)
+        | (syntheticItalic ? 1 : 0);
 
     RefPtr<SimpleFontData>& fontData = m_fontDataTable.add(hashKey, 0).iterator->value;
     if (fontData)
@@ -184,7 +194,7 @@
                         m_svgFontFaceElement = fontFaceElement;
                     }
 
-                    fontData = SimpleFontData::create(SVGFontData::create(fontFaceElement), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
+                    fontData = SimpleFontData::create(SVGFontData::create(fontFaceElement), fontSize, syntheticBold, syntheticItalic);
                 }
             } else
 #endif
@@ -193,14 +203,14 @@
                 if (!m_font->ensureCustomFontData())
                     return 0;
 
-                fontData = SimpleFontData::create(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic,
+                fontData = SimpleFontData::create(m_font->platformDataFromCustomData(fontSize, syntheticBold, syntheticItalic,
                     fontDescription.orientation(), fontDescription.widthVariant()), true, false);
             }
         } else {
 #if ENABLE(SVG_FONTS)
             // In-Document SVG Fonts
             if (m_svgFontFaceElement)
-                fontData = SimpleFontData::create(SVGFontData::create(m_svgFontFaceElement.get()), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic);
+                fontData = SimpleFontData::create(SVGFontData::create(m_svgFontFaceElement.get()), fontSize, syntheticBold, syntheticItalic);
 #endif
         }
     } else {
diff --git a/Source/core/css/CSSFontFaceSource.h b/Source/core/css/CSSFontFaceSource.h
index 6cdabfd..a30f994 100644
--- a/Source/core/css/CSSFontFaceSource.h
+++ b/Source/core/css/CSSFontFaceSource.h
@@ -28,7 +28,7 @@
 
 #include "core/fetch/FontResource.h"
 #include "core/fetch/ResourcePtr.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/HashMap.h"
 #include "wtf/text/AtomicString.h"
 
diff --git a/Source/core/css/CSSFontFaceSrcValue.h b/Source/core/css/CSSFontFaceSrcValue.h
index 992448e..db61e61 100644
--- a/Source/core/css/CSSFontFaceSrcValue.h
+++ b/Source/core/css/CSSFontFaceSrcValue.h
@@ -95,11 +95,7 @@
 #endif
 };
 
-inline CSSFontFaceSrcValue* toCSSFontFaceSrcValue(CSSValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isFontFaceSrcValue());
-    return static_cast<CSSFontFaceSrcValue*>(value);
-}
+DEFINE_CSS_VALUE_TYPE_CASTS(FontFaceSrcValue);
 
 }
 
diff --git a/Source/core/css/CSSFontFeatureValue.cpp b/Source/core/css/CSSFontFeatureValue.cpp
new file mode 100644
index 0000000..b6cc105
--- /dev/null
+++ b/Source/core/css/CSSFontFeatureValue.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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,
+ * 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/css/CSSFontFeatureValue.h"
+
+#include "wtf/text/StringBuilder.h"
+
+namespace WebCore {
+
+CSSFontFeatureValue::CSSFontFeatureValue(const String& tag, int value)
+    : CSSValue(FontFeatureClass)
+    , m_tag(tag)
+    , m_value(value)
+{
+}
+
+String CSSFontFeatureValue::customCssText() const
+{
+    StringBuilder builder;
+    builder.append('\'');
+    builder.append(m_tag);
+    builder.appendLiteral("' ");
+    builder.appendNumber(m_value);
+    return builder.toString();
+}
+
+bool CSSFontFeatureValue::equals(const CSSFontFeatureValue& other) const
+{
+    return m_tag == other.m_tag && m_value == other.m_value;
+}
+
+}
diff --git a/Source/core/css/CSSFontFeatureValue.h b/Source/core/css/CSSFontFeatureValue.h
new file mode 100644
index 0000000..d566a5b
--- /dev/null
+++ b/Source/core/css/CSSFontFeatureValue.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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,
+ * 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 CSSFontFeatureValue_h
+#define CSSFontFeatureValue_h
+
+#include "core/css/CSSValue.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class CSSFontFeatureValue : public CSSValue {
+public:
+    static PassRefPtr<CSSFontFeatureValue> create(const String& tag, int value)
+    {
+        return adoptRef(new CSSFontFeatureValue(tag, value));
+    }
+
+    const String& tag() const { return m_tag; }
+    int value() const { return m_value; }
+    String customCssText() const;
+
+    bool equals(const CSSFontFeatureValue&) const;
+
+private:
+    CSSFontFeatureValue(const String&, int);
+
+    String m_tag;
+    const int m_value;
+};
+
+DEFINE_CSS_VALUE_TYPE_CASTS(FontFeatureValue);
+
+} // namespace
+
+#endif
diff --git a/Source/core/css/CSSFontSelector.cpp b/Source/core/css/CSSFontSelector.cpp
index bfe6bfe..3c25503 100644
--- a/Source/core/css/CSSFontSelector.cpp
+++ b/Source/core/css/CSSFontSelector.cpp
@@ -27,7 +27,6 @@
 #include "config.h"
 #include "core/css/CSSFontSelector.h"
 
-#include "FontFamilyNames.h"
 #include "RuntimeEnabledFeatures.h"
 #include "core/css/CSSFontFace.h"
 #include "core/css/CSSFontFaceRule.h"
@@ -39,7 +38,7 @@
 #include "core/fetch/FontResource.h"
 #include "core/fetch/ResourceFetcher.h"
 #include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
 #include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/SimpleFontData.h"
@@ -49,10 +48,61 @@
 
 namespace WebCore {
 
+FontLoader::FontLoader(ResourceFetcher* resourceFetcher)
+    : m_beginLoadingTimer(this, &FontLoader::beginLoadTimerFired)
+    , m_resourceFetcher(resourceFetcher)
+{
+}
+
+void FontLoader::addFontToBeginLoading(FontResource* fontResource)
+{
+    if (!m_resourceFetcher)
+        return;
+
+    m_fontsToBeginLoading.append(fontResource);
+    // FIXME: Use RequestCountTracker??!!
+    // Increment the request count now, in order to prevent didFinishLoad from being dispatched
+    // after this font has been requested but before it began loading. Balanced by
+    // decrementRequestCount() in beginLoadTimerFired() and in clearDocument().
+    m_resourceFetcher->incrementRequestCount(fontResource);
+    m_beginLoadingTimer.startOneShot(0);
+}
+
+void FontLoader::beginLoadTimerFired(Timer<WebCore::FontLoader>*)
+{
+    ASSERT(m_resourceFetcher);
+
+    Vector<ResourcePtr<FontResource> > fontsToBeginLoading;
+    fontsToBeginLoading.swap(m_fontsToBeginLoading);
+
+    for (size_t i = 0; i < fontsToBeginLoading.size(); ++i) {
+        fontsToBeginLoading[i]->beginLoadIfNeeded(m_resourceFetcher);
+        // Balances incrementRequestCount() in beginLoadingFontSoon().
+        m_resourceFetcher->decrementRequestCount(fontsToBeginLoading[i].get());
+    }
+}
+
+void FontLoader::clearResourceFetcher()
+{
+    if (!m_resourceFetcher) {
+        ASSERT(m_fontsToBeginLoading.isEmpty());
+        return;
+    }
+
+    m_beginLoadingTimer.stop();
+
+    for (size_t i = 0; i < m_fontsToBeginLoading.size(); ++i) {
+        // Balances incrementRequestCount() in beginLoadingFontSoon().
+        m_resourceFetcher->decrementRequestCount(m_fontsToBeginLoading[i].get());
+    }
+
+    m_fontsToBeginLoading.clear();
+    m_resourceFetcher = 0;
+}
+
 CSSFontSelector::CSSFontSelector(Document* document)
     : m_document(document)
-    , m_beginLoadingTimer(this, &CSSFontSelector::beginLoadTimerFired)
-    , m_version(0)
+    , m_fontLoader(document->fetcher())
 {
     // FIXME: An old comment used to say there was no need to hold a reference to m_document
     // because "we are guaranteed to be destroyed before the document". But there does not
@@ -68,59 +118,6 @@
     fontCache()->removeClient(this);
 }
 
-bool CSSFontSelector::isEmpty() const
-{
-    return m_fonts.isEmpty();
-}
-
-void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace* fontFaceRule)
-{
-    RefPtr<FontFace> fontFace = FontFace::create(fontFaceRule);
-    if (!fontFace || fontFace->family().isEmpty())
-        return;
-
-    unsigned traitsMask = fontFace->traitsMask();
-    if (!traitsMask)
-        return;
-
-    RefPtr<CSSFontFace> cssFontFace = fontFace->createCSSFontFace(m_document);
-    if (!cssFontFace || !cssFontFace->isValid())
-        return;
-
-    OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >& familyFontFaces = m_fontFaces.add(fontFace->family(), nullptr).iterator->value;
-    if (!familyFontFaces) {
-        familyFontFaces = adoptPtr(new HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >);
-
-        ASSERT(!m_locallyInstalledFontFaces.contains(fontFace->family()));
-
-        Vector<unsigned> locallyInstalledFontsTraitsMasks;
-        fontCache()->getTraitsInFamily(fontFace->family(), locallyInstalledFontsTraitsMasks);
-        if (unsigned numLocallyInstalledFaces = locallyInstalledFontsTraitsMasks.size()) {
-            OwnPtr<Vector<RefPtr<CSSSegmentedFontFace> > > familyLocallyInstalledFaces = adoptPtr(new Vector<RefPtr<CSSSegmentedFontFace> >);
-
-            for (unsigned i = 0; i < numLocallyInstalledFaces; ++i) {
-                RefPtr<CSSFontFace> locallyInstalledFontFace = CSSFontFace::create(0);
-                locallyInstalledFontFace->addSource(adoptPtr(new CSSFontFaceSource(fontFace->family())));
-                ASSERT(locallyInstalledFontFace->isValid());
-
-                RefPtr<CSSSegmentedFontFace> segmentedFontFace = CSSSegmentedFontFace::create(this, static_cast<FontTraitsMask>(locallyInstalledFontsTraitsMasks[i]), true);
-                segmentedFontFace->appendFontFace(locallyInstalledFontFace.release());
-                familyLocallyInstalledFaces->append(segmentedFontFace);
-            }
-
-            m_locallyInstalledFontFaces.set(fontFace->family(), familyLocallyInstalledFaces.release());
-        }
-    }
-
-    RefPtr<CSSSegmentedFontFace>& segmentedFontFace = familyFontFaces->add(traitsMask, 0).iterator->value;
-    if (!segmentedFontFace)
-        segmentedFontFace = CSSSegmentedFontFace::create(this, static_cast<FontTraitsMask>(traitsMask), false);
-
-    segmentedFontFace->appendFontFace(cssFontFace);
-
-    ++m_version;
-}
-
 void CSSFontSelector::registerForInvalidationCallbacks(FontSelectorClient* client)
 {
     m_clients.add(client);
@@ -137,15 +134,6 @@
     copyToVector(m_clients, clients);
     for (size_t i = 0; i < clients.size(); ++i)
         clients[i]->fontsNeedUpdate(this);
-
-    // FIXME: Make Document a FontSelectorClient so that it can simply register for invalidation callbacks.
-    if (!m_document)
-        return;
-    if (StyleResolver* styleResolver = m_document->styleResolverIfExists())
-        styleResolver->invalidateMatchedPropertiesCache();
-    if (!m_document->renderer())
-        return;
-    m_document->setNeedsStyleRecalc();
 }
 
 void CSSFontSelector::fontLoaded()
@@ -158,189 +146,22 @@
     dispatchInvalidationCallbacks();
 }
 
-static PassRefPtr<FontData> fontDataForGenericFamily(Document* document, const FontDescription& fontDescription, const AtomicString& familyName)
+void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace* fontFaceRule)
 {
-    if (!document || !document->frame())
-        return 0;
-
-    const Settings* settings = document->frame()->settings();
-    if (!settings)
-        return 0;
-
-    AtomicString genericFamily;
-    UScriptCode script = fontDescription.script();
-
-    if (familyName == serifFamily)
-         genericFamily = settings->serifFontFamily(script);
-    else if (familyName == sansSerifFamily)
-         genericFamily = settings->sansSerifFontFamily(script);
-    else if (familyName == cursiveFamily)
-         genericFamily = settings->cursiveFontFamily(script);
-    else if (familyName == fantasyFamily)
-         genericFamily = settings->fantasyFontFamily(script);
-    else if (familyName == monospaceFamily)
-         genericFamily = settings->fixedFontFamily(script);
-    else if (familyName == pictographFamily)
-         genericFamily = settings->pictographFontFamily(script);
-    else if (familyName == standardFamily)
-         genericFamily = settings->standardFontFamily(script);
-
-    if (!genericFamily.isEmpty())
-        return fontCache()->getFontResourceData(fontDescription, genericFamily);
-
-    return 0;
-}
-
-static inline bool compareFontFaces(CSSSegmentedFontFace* first, CSSSegmentedFontFace* second, FontTraitsMask desiredTraitsMask)
-{
-    FontTraitsMask firstTraitsMask = first->traitsMask();
-    FontTraitsMask secondTraitsMask = second->traitsMask();
-
-    bool firstHasDesiredVariant = firstTraitsMask & desiredTraitsMask & FontVariantMask;
-    bool secondHasDesiredVariant = secondTraitsMask & desiredTraitsMask & FontVariantMask;
-
-    if (firstHasDesiredVariant != secondHasDesiredVariant)
-        return firstHasDesiredVariant;
-
-    // We need to check font-variant css property for CSS2.1 compatibility.
-    if ((desiredTraitsMask & FontVariantSmallCapsMask) && !first->isLocalFallback() && !second->isLocalFallback()) {
-        // Prefer a font that has indicated that it can only support small-caps to a font that claims to support
-        // all variants.  The specialized font is more likely to be true small-caps and not require synthesis.
-        bool firstRequiresSmallCaps = (firstTraitsMask & FontVariantSmallCapsMask) && !(firstTraitsMask & FontVariantNormalMask);
-        bool secondRequiresSmallCaps = (secondTraitsMask & FontVariantSmallCapsMask) && !(secondTraitsMask & FontVariantNormalMask);
-        if (firstRequiresSmallCaps != secondRequiresSmallCaps)
-            return firstRequiresSmallCaps;
-    }
-
-    bool firstHasDesiredStyle = firstTraitsMask & desiredTraitsMask & FontStyleMask;
-    bool secondHasDesiredStyle = secondTraitsMask & desiredTraitsMask & FontStyleMask;
-
-    if (firstHasDesiredStyle != secondHasDesiredStyle)
-        return firstHasDesiredStyle;
-
-    if ((desiredTraitsMask & FontStyleItalicMask) && !first->isLocalFallback() && !second->isLocalFallback()) {
-        // Prefer a font that has indicated that it can only support italics to a font that claims to support
-        // all styles.  The specialized font is more likely to be the one the author wants used.
-        bool firstRequiresItalics = (firstTraitsMask & FontStyleItalicMask) && !(firstTraitsMask & FontStyleNormalMask);
-        bool secondRequiresItalics = (secondTraitsMask & FontStyleItalicMask) && !(secondTraitsMask & FontStyleNormalMask);
-        if (firstRequiresItalics != secondRequiresItalics)
-            return firstRequiresItalics;
-    }
-
-    if (secondTraitsMask & desiredTraitsMask & FontWeightMask)
-        return false;
-    if (firstTraitsMask & desiredTraitsMask & FontWeightMask)
-        return true;
-
-    // http://www.w3.org/TR/2011/WD-css3-fonts-20111004/#font-matching-algorithm says :
-    //   - If the desired weight is less than 400, weights below the desired weight are checked in descending order followed by weights above the desired weight in ascending order until a match is found.
-    //   - If the desired weight is greater than 500, weights above the desired weight are checked in ascending order followed by weights below the desired weight in descending order until a match is found.
-    //   - If the desired weight is 400, 500 is checked first and then the rule for desired weights less than 400 is used.
-    //   - If the desired weight is 500, 400 is checked first and then the rule for desired weights less than 400 is used.
-
-    static const unsigned fallbackRuleSets = 9;
-    static const unsigned rulesPerSet = 8;
-    static const FontTraitsMask weightFallbackRuleSets[fallbackRuleSets][rulesPerSet] = {
-        { FontWeight200Mask, FontWeight300Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
-        { FontWeight100Mask, FontWeight300Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
-        { FontWeight200Mask, FontWeight100Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
-        { FontWeight500Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
-        { FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
-        { FontWeight700Mask, FontWeight800Mask, FontWeight900Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
-        { FontWeight800Mask, FontWeight900Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
-        { FontWeight900Mask, FontWeight700Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
-        { FontWeight800Mask, FontWeight700Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask }
-    };
-
-    unsigned ruleSetIndex = 0;
-    unsigned w = FontWeight100Bit;
-    while (!(desiredTraitsMask & (1 << w))) {
-        w++;
-        ruleSetIndex++;
-    }
-
-    ASSERT(ruleSetIndex < fallbackRuleSets);
-    const FontTraitsMask* weightFallbackRule = weightFallbackRuleSets[ruleSetIndex];
-    for (unsigned i = 0; i < rulesPerSet; ++i) {
-        if (secondTraitsMask & weightFallbackRule[i])
-            return false;
-        if (firstTraitsMask & weightFallbackRule[i])
-            return true;
-    }
-
-    return false;
+    m_cssSegmentedFontFaceCache.addFontFaceRule(this, fontFaceRule);
 }
 
 PassRefPtr<FontData> CSSFontSelector::getFontData(const FontDescription& fontDescription, const AtomicString& familyName)
 {
-    if (m_fontFaces.isEmpty()) {
-        if (familyName.startsWith("-webkit-"))
-            return fontDataForGenericFamily(m_document, fontDescription, familyName);
-        if (fontDescription.genericFamily() == FontDescription::StandardFamily && !fontDescription.isSpecifiedFont())
-            return fontDataForGenericFamily(m_document, fontDescription, "-webkit-standard");
+    if (!m_document || !m_document->frame())
         return 0;
-    }
 
-    CSSSegmentedFontFace* face = getFontFace(fontDescription, familyName);
-    // If no face was found, then return 0 and let the OS come up with its best match for the name.
-    if (!face) {
-        // If we were handed a generic family, but there was no match, go ahead and return the correct font based off our
-        // settings.
-        if (fontDescription.genericFamily() == FontDescription::StandardFamily && !fontDescription.isSpecifiedFont())
-            return fontDataForGenericFamily(m_document, fontDescription, "-webkit-standard");
-        return fontDataForGenericFamily(m_document, fontDescription, familyName);
-    }
-
-    // We have a face. Ask it for a font data. If it cannot produce one, it will fail, and the OS will take over.
-    return face->getFontData(fontDescription);
+    return m_cssSegmentedFontFaceCache.getFontData(m_document->frame()->settings(), fontDescription, familyName);
 }
 
-CSSSegmentedFontFace* CSSFontSelector::getFontFace(const FontDescription& fontDescription, const AtomicString& family)
+CSSSegmentedFontFace* CSSFontSelector::getFontFace(const FontDescription& fontDescription, const AtomicString& familyName)
 {
-    HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >* familyFontFaces = m_fontFaces.get(family);
-    if (!familyFontFaces || familyFontFaces->isEmpty())
-        return 0;
-
-    OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >& segmentedFontFaceCache = m_fonts.add(family, nullptr).iterator->value;
-    if (!segmentedFontFaceCache)
-        segmentedFontFaceCache = adoptPtr(new HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >);
-
-    FontTraitsMask traitsMask = fontDescription.traitsMask();
-
-    RefPtr<CSSSegmentedFontFace>& face = segmentedFontFaceCache->add(traitsMask, 0).iterator->value;
-    if (!face) {
-        for (HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >::const_iterator i = familyFontFaces->begin(); i != familyFontFaces->end(); ++i) {
-            CSSSegmentedFontFace* candidate = i->value.get();
-            unsigned candidateTraitsMask = candidate->traitsMask();
-            if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
-                continue;
-            if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask))
-                continue;
-#if ENABLE(SVG_FONTS)
-            // For SVG Fonts that specify that they only support the "normal" variant, we will assume they are incapable
-            // of small-caps synthesis and just ignore the font face as a candidate.
-            if (candidate->hasSVGFontFaceSource() && (traitsMask & FontVariantSmallCapsMask) && !(candidateTraitsMask & FontVariantSmallCapsMask))
-                continue;
-#endif
-            if (!face || compareFontFaces(candidate, face.get(), traitsMask))
-                face = candidate;
-        }
-
-        if (Vector<RefPtr<CSSSegmentedFontFace> >* familyLocallyInstalledFontFaces = m_locallyInstalledFontFaces.get(family)) {
-            unsigned numLocallyInstalledFontFaces = familyLocallyInstalledFontFaces->size();
-            for (unsigned i = 0; i < numLocallyInstalledFontFaces; ++i) {
-                CSSSegmentedFontFace* candidate = familyLocallyInstalledFontFaces->at(i).get();
-                unsigned candidateTraitsMask = candidate->traitsMask();
-                if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
-                    continue;
-                if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask))
-                    continue;
-                if (!face || compareFontFaces(candidate, face.get(), traitsMask))
-                    face = candidate;
-            }
-        }
-    }
-    return face.get();
+    return m_cssSegmentedFontFaceCache.getFontFace(fontDescription, familyName);
 }
 
 void CSSFontSelector::willUseFontData(const FontDescription& fontDescription, const AtomicString& family)
@@ -352,58 +173,13 @@
 
 void CSSFontSelector::clearDocument()
 {
-    if (!m_document) {
-        ASSERT(!m_beginLoadingTimer.isActive());
-        ASSERT(m_fontsToBeginLoading.isEmpty());
-        return;
-    }
-
-    m_beginLoadingTimer.stop();
-
-    ResourceFetcher* fetcher = m_document->fetcher();
-    for (size_t i = 0; i < m_fontsToBeginLoading.size(); ++i) {
-        // Balances incrementRequestCount() in beginLoadingFontSoon().
-        fetcher->decrementRequestCount(m_fontsToBeginLoading[i].get());
-    }
-
-    m_fontsToBeginLoading.clear();
-
+    m_fontLoader.clearResourceFetcher();
     m_document = 0;
 }
 
 void CSSFontSelector::beginLoadingFontSoon(FontResource* font)
 {
-    if (!m_document)
-        return;
-
-    m_fontsToBeginLoading.append(font);
-    // Increment the request count now, in order to prevent didFinishLoad from being dispatched
-    // after this font has been requested but before it began loading. Balanced by
-    // decrementRequestCount() in beginLoadTimerFired() and in clearDocument().
-    m_document->fetcher()->incrementRequestCount(font);
-    m_beginLoadingTimer.startOneShot(0);
-}
-
-void CSSFontSelector::beginLoadTimerFired(Timer<WebCore::CSSFontSelector>*)
-{
-    Vector<ResourcePtr<FontResource> > fontsToBeginLoading;
-    fontsToBeginLoading.swap(m_fontsToBeginLoading);
-
-    // CSSFontSelector could get deleted via beginLoadIfNeeded() or loadDone() unless protected.
-    RefPtr<CSSFontSelector> protect(this);
-
-    ResourceFetcher* fetcher = m_document->fetcher();
-    for (size_t i = 0; i < fontsToBeginLoading.size(); ++i) {
-        fontsToBeginLoading[i]->beginLoadIfNeeded(fetcher);
-        // Balances incrementRequestCount() in beginLoadingFontSoon().
-        fetcher->decrementRequestCount(fontsToBeginLoading[i].get());
-    }
-    // Ensure that if the request count reaches zero, the frame loader will know about it.
-    fetcher->didLoadResource(0);
-    // New font loads may be triggered by layout after the document load is complete but before we have dispatched
-    // didFinishLoading for the frame. Make sure the delegate is always dispatched by checking explicitly.
-    if (m_document && m_document->frame())
-        m_document->frame()->loader()->checkLoadComplete();
+    m_fontLoader.addFontToBeginLoading(font);
 }
 
 }
diff --git a/Source/core/css/CSSFontSelector.h b/Source/core/css/CSSFontSelector.h
index 559fa38..1733964 100644
--- a/Source/core/css/CSSFontSelector.h
+++ b/Source/core/css/CSSFontSelector.h
@@ -26,13 +26,13 @@
 #ifndef CSSFontSelector_h
 #define CSSFontSelector_h
 
+#include "core/css/CSSSegmentedFontFaceCache.h"
 #include "core/fetch/ResourcePtr.h"
-#include "core/platform/Timer.h"
 #include "core/platform/graphics/FontSelector.h"
+#include "platform/Timer.h"
 #include "wtf/Forward.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
-#include "wtf/text/StringHash.h"
 
 namespace WebCore {
 
@@ -44,6 +44,22 @@
 class FontDescription;
 class StyleRuleFontFace;
 
+class FontLoader {
+public:
+    explicit FontLoader(ResourceFetcher*);
+
+    void addFontToBeginLoading(FontResource*);
+
+    void clearResourceFetcher();
+
+private:
+    void beginLoadTimerFired(Timer<FontLoader>*);
+
+    Timer<FontLoader> m_beginLoadingTimer;
+    Vector<ResourcePtr<FontResource> > m_fontsToBeginLoading;
+    ResourceFetcher* m_resourceFetcher;
+};
+
 class CSSFontSelector : public FontSelector {
 public:
     static PassRefPtr<CSSFontSelector> create(Document* document)
@@ -52,7 +68,7 @@
     }
     virtual ~CSSFontSelector();
 
-    virtual unsigned version() const OVERRIDE { return m_version; }
+    virtual unsigned version() const OVERRIDE { return m_cssSegmentedFontFaceCache.version(); }
 
     virtual PassRefPtr<FontData> getFontData(const FontDescription&, const AtomicString&);
     CSSSegmentedFontFace* getFontFace(const FontDescription&, const AtomicString& family);
@@ -65,8 +81,6 @@
     void fontLoaded();
     virtual void fontCacheInvalidated();
 
-    bool isEmpty() const;
-
     virtual void registerForInvalidationCallbacks(FontSelectorClient*);
     virtual void unregisterForInvalidationCallbacks(FontSelectorClient*);
 
@@ -79,18 +93,12 @@
 
     void dispatchInvalidationCallbacks();
 
-    void beginLoadTimerFired(Timer<CSSFontSelector>*);
-
     Document* m_document;
-    HashMap<String, OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >, CaseFoldingHash> m_fontFaces;
-    HashMap<String, OwnPtr<Vector<RefPtr<CSSSegmentedFontFace> > >, CaseFoldingHash> m_locallyInstalledFontFaces;
-    HashMap<String, OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >, CaseFoldingHash> m_fonts;
+    // FIXME: Move to Document or StyleEngine.
+    CSSSegmentedFontFaceCache m_cssSegmentedFontFaceCache;
     HashSet<FontSelectorClient*> m_clients;
 
-    Vector<ResourcePtr<FontResource> > m_fontsToBeginLoading;
-    Timer<CSSFontSelector> m_beginLoadingTimer;
-
-    unsigned m_version;
+    FontLoader m_fontLoader;
 };
 
 } // namespace WebCore
diff --git a/Source/core/css/CSSFontValue.cpp b/Source/core/css/CSSFontValue.cpp
new file mode 100644
index 0000000..e4eaee5
--- /dev/null
+++ b/Source/core/css/CSSFontValue.cpp
@@ -0,0 +1,77 @@
+/**
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#include "config.h"
+#include "core/css/CSSFontValue.h"
+
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSValueList.h"
+#include "wtf/text/StringBuilder.h"
+
+namespace WebCore {
+
+String CSSFontValue::customCssText() const
+{
+    // font variant weight size / line-height family
+
+    StringBuilder result;
+
+    if (style)
+        result.append(style->cssText());
+    if (variant) {
+        if (!result.isEmpty())
+            result.append(' ');
+        result.append(variant->cssText());
+    }
+    if (weight) {
+        if (!result.isEmpty())
+            result.append(' ');
+        result.append(weight->cssText());
+    }
+    if (size) {
+        if (!result.isEmpty())
+            result.append(' ');
+        result.append(size->cssText());
+    }
+    if (lineHeight) {
+        if (!size)
+            result.append(' ');
+        result.append('/');
+        result.append(lineHeight->cssText());
+    }
+    if (family) {
+        if (!result.isEmpty())
+            result.append(' ');
+        result.append(family->cssText());
+    }
+
+    return result.toString();
+}
+
+bool CSSFontValue::equals(const CSSFontValue& other) const
+{
+    return compareCSSValuePtr(style, other.style)
+        && compareCSSValuePtr(variant, other.variant)
+        && compareCSSValuePtr(weight, other.weight)
+        && compareCSSValuePtr(size, other.size)
+        && compareCSSValuePtr(lineHeight, other.lineHeight)
+        && compareCSSValuePtr(family, other.family);
+}
+
+}
diff --git a/Source/core/css/CSSFontValue.h b/Source/core/css/CSSFontValue.h
new file mode 100644
index 0000000..5ca4f32
--- /dev/null
+++ b/Source/core/css/CSSFontValue.h
@@ -0,0 +1,62 @@
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. 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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSFontValue_h
+#define CSSFontValue_h
+
+#include "core/css/CSSValue.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+class CSSPrimitiveValue;
+class CSSValueList;
+
+class CSSFontValue : public CSSValue {
+public:
+    static PassRefPtr<CSSFontValue> create()
+    {
+        return adoptRef(new CSSFontValue);
+    }
+
+    String customCssText() const;
+
+    bool equals(const CSSFontValue&) const;
+
+    RefPtr<CSSPrimitiveValue> style;
+    RefPtr<CSSPrimitiveValue> variant;
+    RefPtr<CSSPrimitiveValue> weight;
+    RefPtr<CSSPrimitiveValue> size;
+    RefPtr<CSSPrimitiveValue> lineHeight;
+    RefPtr<CSSValueList> family;
+
+private:
+    CSSFontValue()
+        : CSSValue(FontClass)
+    {
+    }
+};
+
+DEFINE_CSS_VALUE_TYPE_CASTS(FontValue);
+
+} // namespace
+
+#endif
diff --git a/Source/core/css/CSSFunctionValue.h b/Source/core/css/CSSFunctionValue.h
index d4e7e4d..ee5c5d9 100644
--- a/Source/core/css/CSSFunctionValue.h
+++ b/Source/core/css/CSSFunctionValue.h
@@ -59,20 +59,7 @@
     RefPtr<CSSValueList> m_args;
 };
 
-inline CSSFunctionValue* toCSSFunctionValue(CSSValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(value->isFunctionValue());
-    return static_cast<CSSFunctionValue*>(value);
-}
-
-inline const CSSFunctionValue* toCSSFunctionValue(const CSSValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(value->isFunctionValue());
-    return static_cast<const CSSFunctionValue*>(value);
-}
-
-// Catch any unneeded cast.
-void toCSSFunctionValue(const CSSFunctionValue*);
+DEFINE_CSS_VALUE_TYPE_CASTS(FunctionValue);
 
 } // namespace WebCore
 
diff --git a/Source/core/css/CSSGradientValue.cpp b/Source/core/css/CSSGradientValue.cpp
index 5b7ea0b..32bc0e2 100644
--- a/Source/core/css/CSSGradientValue.cpp
+++ b/Source/core/css/CSSGradientValue.cpp
@@ -33,8 +33,8 @@
 #include "core/platform/graphics/GeneratorGeneratedImage.h"
 #include "core/platform/graphics/Gradient.h"
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/rendering/RenderObject.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/WTFString.h"
 
@@ -61,12 +61,10 @@
     // We need to create an image.
     RefPtr<Gradient> gradient;
 
-    if (isLinearGradient())
-        gradient = static_cast<CSSLinearGradientValue*>(this)->createGradient(renderer, size);
-    else {
-        ASSERT(isRadialGradient());
-        gradient = static_cast<CSSRadialGradientValue*>(this)->createGradient(renderer, size);
-    }
+    if (isLinearGradientValue())
+        gradient = toCSSLinearGradientValue(this)->createGradient(renderer, size);
+    else
+        gradient = toCSSRadialGradientValue(this)->createGradient(renderer, size);
 
     RefPtr<Image> newImage = GeneratorGeneratedImage::create(gradient, size);
     if (cacheable)
@@ -118,10 +116,10 @@
     RefPtr<CSSGradientValue> result;
     if (!derived)
         result = this;
-    else if (isLinearGradient())
-        result = static_cast<CSSLinearGradientValue*>(this)->clone();
-    else if (isRadialGradient())
-        result = static_cast<CSSRadialGradientValue*>(this)->clone();
+    else if (isLinearGradientValue())
+        result = toCSSLinearGradientValue(this)->clone();
+    else if (isRadialGradientValue())
+        result = toCSSRadialGradientValue(this)->clone();
     else {
         ASSERT_NOT_REACHED();
         return 0;
@@ -166,9 +164,9 @@
 
     FloatPoint gradientStart = gradient->p0();
     FloatPoint gradientEnd;
-    if (isLinearGradient())
+    if (isLinearGradientValue())
         gradientEnd = gradient->p1();
-    else if (isRadialGradient())
+    else if (isRadialGradientValue())
         gradientEnd = gradientStart + FloatSize(gradient->endRadius(), 0);
 
     for (size_t i = 0; i < numStops; ++i) {
@@ -269,7 +267,7 @@
 
             // Radial gradients may need to extend further than the endpoints, because they have
             // to repeat out to the corners of the box.
-            if (isRadialGradient()) {
+            if (isRadialGradientValue()) {
                 if (!computedGradientLength) {
                     FloatSize gradientSize(gradientStart - gradientEnd);
                     gradientLength = gradientSize.diagonalLength();
@@ -327,7 +325,7 @@
 
     // If the gradient goes outside the 0-1 range, normalize it by moving the endpoints, and adjusting the stops.
     if (numStops > 1 && (stops[0].offset < 0 || stops[numStops - 1].offset > 1)) {
-        if (isLinearGradient()) {
+        if (isLinearGradientValue()) {
             float firstOffset = stops[0].offset;
             float lastOffset = stops[numStops - 1].offset;
             float scale = lastOffset - firstOffset;
@@ -339,7 +337,7 @@
             FloatPoint p1 = gradient->p1();
             gradient->setP0(FloatPoint(p0.x() + firstOffset * (p1.x() - p0.x()), p0.y() + firstOffset * (p1.y() - p0.y())));
             gradient->setP1(FloatPoint(p1.x() + (lastOffset - 1) * (p1.x() - p0.x()), p1.y() + (lastOffset - 1) * (p1.y() - p0.y())));
-        } else if (isRadialGradient()) {
+        } else if (isRadialGradientValue()) {
             // Rather than scaling the points < 0, we truncate them, so only scale according to the largest point.
             float firstOffset = 0;
             float lastOffset = stops[numStops - 1].offset;
diff --git a/Source/core/css/CSSGradientValue.h b/Source/core/css/CSSGradientValue.h
index 75e5152..1429e50 100644
--- a/Source/core/css/CSSGradientValue.h
+++ b/Source/core/css/CSSGradientValue.h
@@ -75,9 +75,6 @@
 
     void sortStopsIfNeeded();
 
-    bool isLinearGradient() const { return classType() == LinearGradientClass; }
-    bool isRadialGradient() const { return classType() == RadialGradientClass; }
-
     bool isRepeating() const { return m_repeating; }
 
     CSSGradientType gradientType() const { return m_gradientType; }
@@ -134,6 +131,7 @@
     bool m_repeating;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(GradientValue);
 
 class CSSLinearGradientValue : public CSSGradientValue {
 public:
@@ -172,6 +170,8 @@
     RefPtr<CSSPrimitiveValue> m_angle; // may be null.
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(LinearGradientValue);
+
 class CSSRadialGradientValue : public CSSGradientValue {
 public:
     static PassRefPtr<CSSRadialGradientValue> create(CSSGradientRepeat repeat, CSSGradientType gradientType = CSSRadialGradient)
@@ -233,6 +233,8 @@
     RefPtr<CSSPrimitiveValue> m_endVerticalSize;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(RadialGradientValue);
+
 } // namespace WebCore
 
 #endif // CSSGradientValue_h
diff --git a/Source/core/css/CSSGrammar.y.in b/Source/core/css/CSSGrammar.y.in
index da016a2..1fc7d7a 100644
--- a/Source/core/css/CSSGrammar.y.in
+++ b/Source/core/css/CSSGrammar.y.in
@@ -170,6 +170,7 @@
 %token MEDIA_ONLY
 %token MEDIA_NOT
 %token MEDIA_AND
+%token MEDIA_OR
 
 %token SUPPORTS_NOT
 %token SUPPORTS_AND
@@ -397,9 +398,14 @@
     }
 ;
 
+space:
+    WHITESPACE
+  | space WHITESPACE
+  ;
+
 maybe_space:
     /* empty */ %prec UNIMPORTANT_TOK
-  | maybe_space WHITESPACE
+  | space
   ;
 
 maybe_sgml:
@@ -598,7 +604,7 @@
     ;
 
 media_query_exp:
-    '(' maybe_space IDENT maybe_space maybe_media_value closing_parenthesis maybe_space {
+    '(' maybe_space IDENT maybe_space maybe_media_value closing_parenthesis {
         parser->tokenToLowerCase($3);
         $$ = parser->createFloatingMediaQueryExp($3, $5);
         if (!$$)
@@ -614,18 +620,18 @@
         $$ = parser->createFloatingMediaQueryExpList();
         $$->append(parser->sinkFloatingMediaQueryExp($1));
     }
-    | media_query_exp_list MEDIA_AND maybe_space media_query_exp {
+    | media_query_exp_list space MEDIA_AND space media_query_exp {
         $$ = $1;
-        $$->append(parser->sinkFloatingMediaQueryExp($4));
+        $$->append(parser->sinkFloatingMediaQueryExp($5));
     }
     ;
 
 maybe_and_media_query_exp_list:
-    /*empty*/ {
+    maybe_space {
         $$ = parser->createFloatingMediaQueryExpList();
     }
-    | MEDIA_AND maybe_space media_query_exp_list {
-        $$ = $3;
+    | space MEDIA_AND space media_query_exp_list maybe_space {
+        $$ = $4;
     }
     ;
 
@@ -633,16 +639,16 @@
     /*empty*/ {
         $$ = MediaQuery::None;
     }
-    | MEDIA_ONLY maybe_space {
+    | MEDIA_ONLY space {
         $$ = MediaQuery::Only;
     }
-    | MEDIA_NOT maybe_space {
+    | MEDIA_NOT space {
         $$ = MediaQuery::Not;
     }
     ;
 
 valid_media_query:
-    media_query_exp_list {
+    media_query_exp_list maybe_space {
         $$ = parser->createFloatingMediaQuery(parser->sinkFloatingMediaQueryExpList($1));
     }
     | maybe_media_restrictor medium maybe_and_media_query_exp_list {
@@ -732,7 +738,7 @@
     ;
 
 medium:
-  IDENT maybe_space
+  IDENT
   ;
 
 supports:
@@ -1089,7 +1095,7 @@
     ;
 
 region:
-    before_region_rule WEBKIT_REGION_RULE_SYM WHITESPACE region_selector at_rule_header_end '{' at_rule_body_start maybe_space region_block_rule_body closing_brace {
+    before_region_rule WEBKIT_REGION_RULE_SYM maybe_space region_selector at_rule_header_end '{' at_rule_body_start maybe_space region_block_rule_body closing_brace {
         $$ = parser->createRegionRule($4, $9);
     }
   | before_region_rule WEBKIT_REGION_RULE_SYM at_rule_recovery {
@@ -1106,7 +1112,7 @@
     ;
 
 filter:
-    before_filter_rule WEBKIT_FILTER_RULE_SYM WHITESPACE IDENT at_rule_header_end_maybe_space
+    before_filter_rule WEBKIT_FILTER_RULE_SYM maybe_space IDENT at_rule_header_end_maybe_space
     '{' at_rule_body_start maybe_space_before_declaration declaration_list closing_brace {
         parser->m_inFilterRule = false;
         $$ = parser->createFilterRule($4);
@@ -1772,10 +1778,10 @@
   ;
 
 calc_func_operator:
-    WHITESPACE '+' WHITESPACE {
+    space '+' space {
         $$ = '+';
     }
-    | WHITESPACE '-' WHITESPACE {
+    | space '-' space {
         $$ = '-';
     }
     | calc_maybe_space '*' maybe_space {
diff --git a/Source/core/css/CSSGridTemplateValue.h b/Source/core/css/CSSGridTemplateValue.h
index f2b796a..40967ed 100644
--- a/Source/core/css/CSSGridTemplateValue.h
+++ b/Source/core/css/CSSGridTemplateValue.h
@@ -56,20 +56,7 @@
     size_t m_columnCount;
 };
 
-inline CSSGridTemplateValue* toCSSGridTemplateValue(CSSValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(value->isGridTemplateValue());
-    return static_cast<CSSGridTemplateValue*>(value);
-}
-
-inline const CSSGridTemplateValue* toCSSGridTemplateValue(const CSSValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(value->isGridTemplateValue());
-    return static_cast<const CSSGridTemplateValue*>(value);
-}
-
-// Catch unneeded cast.
-void toCSSGridTemplateValue(const CSSGridTemplateValue*);
+DEFINE_CSS_VALUE_TYPE_CASTS(GridTemplateValue);
 
 } // namespace WebCore
 
diff --git a/Source/core/css/CSSImageGeneratorValue.cpp b/Source/core/css/CSSImageGeneratorValue.cpp
index 472c6ee..0fb08b1 100644
--- a/Source/core/css/CSSImageGeneratorValue.cpp
+++ b/Source/core/css/CSSImageGeneratorValue.cpp
@@ -110,13 +110,13 @@
 {
     switch (classType()) {
     case CanvasClass:
-        return static_cast<CSSCanvasValue*>(this)->image(renderer, size);
+        return toCSSCanvasValue(this)->image(renderer, size);
     case CrossfadeClass:
-        return static_cast<CSSCrossfadeValue*>(this)->image(renderer, size);
+        return toCSSCrossfadeValue(this)->image(renderer, size);
     case LinearGradientClass:
-        return static_cast<CSSLinearGradientValue*>(this)->image(renderer, size);
+        return toCSSLinearGradientValue(this)->image(renderer, size);
     case RadialGradientClass:
-        return static_cast<CSSRadialGradientValue*>(this)->image(renderer, size);
+        return toCSSRadialGradientValue(this)->image(renderer, size);
     default:
         ASSERT_NOT_REACHED();
     }
@@ -127,13 +127,13 @@
 {
     switch (classType()) {
     case CanvasClass:
-        return static_cast<const CSSCanvasValue*>(this)->isFixedSize();
+        return toCSSCanvasValue(this)->isFixedSize();
     case CrossfadeClass:
-        return static_cast<const CSSCrossfadeValue*>(this)->isFixedSize();
+        return toCSSCrossfadeValue(this)->isFixedSize();
     case LinearGradientClass:
-        return static_cast<const CSSLinearGradientValue*>(this)->isFixedSize();
+        return toCSSLinearGradientValue(this)->isFixedSize();
     case RadialGradientClass:
-        return static_cast<const CSSRadialGradientValue*>(this)->isFixedSize();
+        return toCSSRadialGradientValue(this)->isFixedSize();
     default:
         ASSERT_NOT_REACHED();
     }
@@ -144,13 +144,13 @@
 {
     switch (classType()) {
     case CanvasClass:
-        return static_cast<CSSCanvasValue*>(this)->fixedSize(renderer);
+        return toCSSCanvasValue(this)->fixedSize(renderer);
     case CrossfadeClass:
-        return static_cast<CSSCrossfadeValue*>(this)->fixedSize(renderer);
+        return toCSSCrossfadeValue(this)->fixedSize(renderer);
     case LinearGradientClass:
-        return static_cast<CSSLinearGradientValue*>(this)->fixedSize(renderer);
+        return toCSSLinearGradientValue(this)->fixedSize(renderer);
     case RadialGradientClass:
-        return static_cast<CSSRadialGradientValue*>(this)->fixedSize(renderer);
+        return toCSSRadialGradientValue(this)->fixedSize(renderer);
     default:
         ASSERT_NOT_REACHED();
     }
@@ -161,13 +161,13 @@
 {
     switch (classType()) {
     case CrossfadeClass:
-        return static_cast<const CSSCrossfadeValue*>(this)->isPending();
+        return toCSSCrossfadeValue(this)->isPending();
     case CanvasClass:
-        return static_cast<const CSSCanvasValue*>(this)->isPending();
+        return toCSSCanvasValue(this)->isPending();
     case LinearGradientClass:
-        return static_cast<const CSSLinearGradientValue*>(this)->isPending();
+        return toCSSLinearGradientValue(this)->isPending();
     case RadialGradientClass:
-        return static_cast<const CSSRadialGradientValue*>(this)->isPending();
+        return toCSSRadialGradientValue(this)->isPending();
     default:
         ASSERT_NOT_REACHED();
     }
@@ -178,13 +178,13 @@
 {
     switch (classType()) {
     case CrossfadeClass:
-        return static_cast<const CSSCrossfadeValue*>(this)->knownToBeOpaque(renderer);
+        return toCSSCrossfadeValue(this)->knownToBeOpaque(renderer);
     case CanvasClass:
         return false;
     case LinearGradientClass:
-        return static_cast<const CSSLinearGradientValue*>(this)->knownToBeOpaque(renderer);
+        return toCSSLinearGradientValue(this)->knownToBeOpaque(renderer);
     case RadialGradientClass:
-        return static_cast<const CSSRadialGradientValue*>(this)->knownToBeOpaque(renderer);
+        return toCSSRadialGradientValue(this)->knownToBeOpaque(renderer);
     default:
         ASSERT_NOT_REACHED();
     }
@@ -195,16 +195,16 @@
 {
     switch (classType()) {
     case CrossfadeClass:
-        static_cast<CSSCrossfadeValue*>(this)->loadSubimages(fetcher);
+        toCSSCrossfadeValue(this)->loadSubimages(fetcher);
         break;
     case CanvasClass:
-        static_cast<CSSCanvasValue*>(this)->loadSubimages(fetcher);
+        toCSSCanvasValue(this)->loadSubimages(fetcher);
         break;
     case LinearGradientClass:
-        static_cast<CSSLinearGradientValue*>(this)->loadSubimages(fetcher);
+        toCSSLinearGradientValue(this)->loadSubimages(fetcher);
         break;
     case RadialGradientClass:
-        static_cast<CSSRadialGradientValue*>(this)->loadSubimages(fetcher);
+        toCSSRadialGradientValue(this)->loadSubimages(fetcher);
         break;
     default:
         ASSERT_NOT_REACHED();
diff --git a/Source/core/css/CSSImageGeneratorValue.h b/Source/core/css/CSSImageGeneratorValue.h
index 4d96768..d00621c 100644
--- a/Source/core/css/CSSImageGeneratorValue.h
+++ b/Source/core/css/CSSImageGeneratorValue.h
@@ -79,6 +79,8 @@
     HashMap<IntSize, RefPtr<Image> > m_images; // A cache of Image objects by image size.
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(ImageGeneratorValue);
+
 } // namespace WebCore
 
 #endif // CSSImageGeneratorValue_h
diff --git a/Source/core/css/CSSImageValue.h b/Source/core/css/CSSImageValue.h
index 0e66982..9046902 100644
--- a/Source/core/css/CSSImageValue.h
+++ b/Source/core/css/CSSImageValue.h
@@ -67,20 +67,7 @@
     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*);
+DEFINE_CSS_VALUE_TYPE_CASTS(ImageValue);
 
 } // namespace WebCore
 
diff --git a/Source/core/css/CSSInheritedValue.h b/Source/core/css/CSSInheritedValue.h
index 3e346bf..e2ed7a9 100644
--- a/Source/core/css/CSSInheritedValue.h
+++ b/Source/core/css/CSSInheritedValue.h
@@ -44,6 +44,8 @@
     }
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(InheritedValue);
+
 } // namespace WebCore
 
 #endif // CSSInheritedValue_h
diff --git a/Source/core/css/CSSInitialValue.h b/Source/core/css/CSSInitialValue.h
index f2bc029..a82192a 100644
--- a/Source/core/css/CSSInitialValue.h
+++ b/Source/core/css/CSSInitialValue.h
@@ -53,6 +53,8 @@
     bool m_isImplicit;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(InitialValue);
+
 } // namespace WebCore
 
 #endif // CSSInitialValue_h
diff --git a/Source/core/css/CSSLineBoxContainValue.h b/Source/core/css/CSSLineBoxContainValue.h
index 6e5a050..079f815 100644
--- a/Source/core/css/CSSLineBoxContainValue.h
+++ b/Source/core/css/CSSLineBoxContainValue.h
@@ -56,6 +56,8 @@
     explicit CSSLineBoxContainValue(LineBoxContain);
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(LineBoxContainValue);
+
 } // namespace
 
 #endif
diff --git a/Source/core/css/CSSMatrix.h b/Source/core/css/CSSMatrix.h
index 1f3397d..201c234 100644
--- a/Source/core/css/CSSMatrix.h
+++ b/Source/core/css/CSSMatrix.h
@@ -27,7 +27,7 @@
 #define CSSMatrix_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
+#include "platform/transforms/TransformationMatrix.h"
 #include "wtf/RefCounted.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/css/CSSMixFunctionValue.h b/Source/core/css/CSSMixFunctionValue.h
index e91542d..573437d 100644
--- a/Source/core/css/CSSMixFunctionValue.h
+++ b/Source/core/css/CSSMixFunctionValue.h
@@ -53,6 +53,8 @@
     CSSMixFunctionValue(const CSSMixFunctionValue& cloneFrom);
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(MixFunctionValue);
+
 } // namespace WebCore
 
 
diff --git a/Source/core/css/CSSParser-in.cpp b/Source/core/css/CSSParser-in.cpp
index 118d8a1..77fc6cf 100644
--- a/Source/core/css/CSSParser-in.cpp
+++ b/Source/core/css/CSSParser-in.cpp
@@ -38,6 +38,7 @@
 #include "core/css/CSSCrossfadeValue.h"
 #include "core/css/CSSCursorImageValue.h"
 #include "core/css/CSSFontFaceSrcValue.h"
+#include "core/css/CSSFontFeatureValue.h"
 #include "core/css/CSSFunctionValue.h"
 #include "core/css/CSSGradientValue.h"
 #include "core/css/CSSGridTemplateValue.h"
@@ -55,6 +56,7 @@
 #include "core/css/CSSSVGDocumentValue.h"
 #include "core/css/CSSSelector.h"
 #include "core/css/CSSShaderValue.h"
+#include "core/css/CSSShadowValue.h"
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/CSSTimingFunctionValue.h"
 #include "core/css/CSSTransformValue.h"
@@ -63,12 +65,10 @@
 #include "core/css/CSSValuePool.h"
 #include "core/css/CSSVariableValue.h"
 #include "core/css/Counter.h"
-#include "core/css/FontFeatureValue.h"
 #include "core/css/MediaList.h"
 #include "core/css/MediaQueryExp.h"
 #include "core/css/Pair.h"
 #include "core/css/Rect.h"
-#include "core/css/ShadowValue.h"
 #include "core/css/StylePropertySet.h"
 #include "core/css/StyleRule.h"
 #include "core/css/StyleRuleImport.h"
@@ -76,13 +76,12 @@
 #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"
-#include "core/platform/FloatConversion.h"
 #include "core/platform/HashTools.h"
 #include "core/rendering/RenderTheme.h"
 #include "core/svg/SVGParserUtilities.h"
+#include "platform/FloatConversion.h"
 #include "wtf/BitArray.h"
 #include "wtf/HexNumber.h"
 #include "wtf/text/StringBuffer.h"
@@ -205,8 +204,6 @@
     : baseURL(baseURL)
     , mode(mode)
     , isHTMLDocument(false)
-    , isCSSCustomFilterEnabled(false)
-    , isCSSStickyPositionEnabled(false)
     , needsSiteSpecificQuirks(false)
     , useLegacyBackgroundSizeShorthandBehavior(false)
 {
@@ -217,8 +214,6 @@
     , charset(charset)
     , mode(document.inQuirksMode() ? CSSQuirksMode : CSSStrictMode)
     , isHTMLDocument(document.isHTMLDocument())
-    , isCSSCustomFilterEnabled(document.settings() ? document.settings()->isCSSCustomFilterEnabled() : false)
-    , isCSSStickyPositionEnabled(document.cssStickyPositionEnabled())
     , needsSiteSpecificQuirks(document.settings() ? document.settings()->needsSiteSpecificQuirks() : false)
     , useLegacyBackgroundSizeShorthandBehavior(document.settings() ? document.settings()->useLegacyBackgroundSizeShorthandBehavior() : false)
 {
@@ -230,8 +225,6 @@
         && a.charset == b.charset
         && a.mode == b.mode
         && a.isHTMLDocument == b.isHTMLDocument
-        && a.isCSSCustomFilterEnabled == b.isCSSCustomFilterEnabled
-        && a.isCSSStickyPositionEnabled == b.isCSSStickyPositionEnabled
         && a.needsSiteSpecificQuirks == b.needsSiteSpecificQuirks
         && a.useLegacyBackgroundSizeShorthandBehavior == b.useLegacyBackgroundSizeShorthandBehavior;
 }
@@ -694,7 +687,7 @@
         break;
     case CSSPropertyPosition: // static | relative | absolute | fixed | sticky | inherit
         if (valueID == CSSValueStatic || valueID == CSSValueRelative || valueID == CSSValueAbsolute || valueID == CSSValueFixed
-            || (parserContext.isCSSStickyPositionEnabled && valueID == CSSValueSticky))
+            || (RuntimeEnabledFeatures::cssStickyPositionEnabled() && valueID == CSSValueSticky))
             return true;
         break;
     case CSSPropertyResize: // none | both | horizontal | vertical | auto
@@ -715,6 +708,12 @@
             && ((valueID >= CSSValueLeft && valueID <= CSSValueJustify) || valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueAuto))
             return true;
         break;
+    case CSSPropertyTextJustify:
+        // auto | none | inter-word | distribute
+        if (RuntimeEnabledFeatures::css3TextEnabled()
+            && (valueID == CSSValueInterWord || valueID == CSSValueDistribute || valueID == CSSValueAuto || valueID == CSSValueNone))
+            return true;
+        break;
     case CSSPropertyTextLineThroughMode:
     case CSSPropertyTextOverlineMode:
     case CSSPropertyTextUnderlineMode:
@@ -791,6 +790,15 @@
         if (valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueJustify)
             return true;
         break;
+    case CSSPropertyInternalCallback:
+        // This property is only injected programmatically, not parsed from stylesheets.
+        return false;
+    case CSSPropertyColumnFill:
+        if (RuntimeEnabledFeatures::regionBasedColumnsEnabled()) {
+            if (valueID == CSSValueAuto || valueID == CSSValueBalance)
+                return true;
+        }
+        break;
     case CSSPropertyAlignContent:
          if (valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround || valueID == CSSValueStretch)
              return true;
@@ -948,8 +956,6 @@
     case CSSPropertyMixBlendMode:
     case CSSPropertyIsolation:
         return RuntimeEnabledFeatures::cssCompositingEnabled();
-    case CSSPropertyTextAlignLast:
-        return RuntimeEnabledFeatures::css3TextEnabled();
     case CSSPropertyBorderBottomStyle:
     case CSSPropertyBorderCollapse:
     case CSSPropertyBorderLeftStyle:
@@ -979,6 +985,8 @@
     case CSSPropertyResize:
     case CSSPropertySpeak:
     case CSSPropertyTableLayout:
+    case CSSPropertyTextAlignLast:
+    case CSSPropertyTextJustify:
     case CSSPropertyTextLineThroughMode:
     case CSSPropertyTextLineThroughStyle:
     case CSSPropertyTextOverflow:
@@ -1003,9 +1011,11 @@
     case CSSPropertyWebkitBoxLines:
     case CSSPropertyWebkitBoxOrient:
     case CSSPropertyWebkitBoxPack:
+    case CSSPropertyInternalCallback:
     case CSSPropertyWebkitColumnBreakAfter:
     case CSSPropertyWebkitColumnBreakBefore:
     case CSSPropertyWebkitColumnBreakInside:
+    case CSSPropertyColumnFill:
     case CSSPropertyWebkitColumnRuleStyle:
     case CSSPropertyAlignContent:
     case CSSPropertyAlignItems:
@@ -1487,7 +1497,7 @@
 {
     bool mustBeNonNegative = unitflags & FNonNeg;
 
-    if (!parseCalculation(value, mustBeNonNegative ? CalculationRangeNonNegative : CalculationRangeAll))
+    if (!parseCalculation(value, mustBeNonNegative ? ValueRangeNonNegative : ValueRangeAll))
         return false;
 
     bool b = false;
@@ -1526,8 +1536,8 @@
 
 inline bool CSSParser::shouldAcceptUnitLessValues(CSSParserValue* value, Units unitflags, CSSParserMode cssParserMode)
 {
-    // Qirks mode and svg presentation attributes accept unit less values.
-    return (unitflags & (FLength | FAngle | FTime)) && (!value->fValue || cssParserMode == CSSQuirksMode || cssParserMode == SVGAttributeMode);
+    // Quirks mode and presentation attributes accept unit less values.
+    return (unitflags & (FLength | FAngle | FTime)) && (!value->fValue || cssParserMode == CSSQuirksMode || cssParserMode == SVGAttributeMode || cssParserMode == CSSAttributeMode);
 }
 
 bool CSSParser::validUnit(CSSParserValue* value, Units unitflags, CSSParserMode cssParserMode, ReleaseParsedCalcValueCondition releaseCalc)
@@ -1694,7 +1704,7 @@
 
 bool CSSParser::parseValue(CSSPropertyID propId, bool important)
 {
-    if (m_context.mode != UASheetMode && isInternalProperty(propId))
+    if ((m_context.mode != UASheetMode && m_context.mode != CSSAttributeMode) && isInternalProperty(propId))
         return false;
 
     // We don't count the UA style sheet in our statistics.
@@ -2792,6 +2802,9 @@
     case CSSPropertyWebkitShapePadding:
         validPrimitive = (RuntimeEnabledFeatures::cssShapesEnabled() && !id && validUnit(value, FLength | FNonNeg));
         break;
+    case CSSPropertyWebkitShapeImageThreshold:
+        validPrimitive = (RuntimeEnabledFeatures::cssShapesEnabled() && !id && validUnit(value, FNumber));
+        break;
     case CSSPropertyBorderBottomStyle:
     case CSSPropertyBorderCollapse:
     case CSSPropertyBorderLeftStyle:
@@ -2822,6 +2835,7 @@
     case CSSPropertySpeak:
     case CSSPropertyTableLayout:
     case CSSPropertyTextAlignLast:
+    case CSSPropertyTextJustify:
     case CSSPropertyTextLineThroughMode:
     case CSSPropertyTextLineThroughStyle:
     case CSSPropertyTextOverflow:
@@ -2847,9 +2861,11 @@
     case CSSPropertyWebkitBoxLines:
     case CSSPropertyWebkitBoxOrient:
     case CSSPropertyWebkitBoxPack:
+    case CSSPropertyInternalCallback:
     case CSSPropertyWebkitColumnBreakAfter:
     case CSSPropertyWebkitColumnBreakBefore:
     case CSSPropertyWebkitColumnBreakInside:
+    case CSSPropertyColumnFill:
     case CSSPropertyWebkitColumnRuleStyle:
     case CSSPropertyAlignContent:
     case CSSPropertyAlignItems:
@@ -6383,7 +6399,7 @@
                 values = CSSValueList::createCommaSeparated();
 
             // Construct the current shadow value and add it to the list.
-            values->append(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
+            values->append(CSSShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
         }
 
         // Now reset for the next shadow value.
@@ -7395,7 +7411,7 @@
         a = args->next();
         if (!a || a->unit != CSSPrimitiveValue::CSS_NUMBER)
             return false;
-        static_cast<CSSRadialGradientValue*>(result.get())->setFirstRadius(createPrimitiveNumericValue(a));
+        toCSSRadialGradientValue(result.get())->setFirstRadius(createPrimitiveNumericValue(a));
 
         // Comma after the first radius.
         a = args->next();
@@ -7432,7 +7448,7 @@
         a = args->next();
         if (!a || a->unit != CSSPrimitiveValue::CSS_NUMBER)
             return false;
-        static_cast<CSSRadialGradientValue*>(result.get())->setSecondRadius(createPrimitiveNumericValue(a));
+        toCSSRadialGradientValue(result.get())->setSecondRadius(createPrimitiveNumericValue(a));
     }
 
     // We now will accept any number of stops (0 or more).
@@ -8887,7 +8903,7 @@
 
             if (filterType == CSSFilterValue::CustomFilterOperation) {
                 // Make sure parsing fails if custom filters are disabled.
-                if (!m_context.isCSSCustomFilterEnabled)
+                if (!RuntimeEnabledFeatures::cssCustomFilterEnabled())
                     return 0;
 
                 RefPtr<CSSFilterValue> filterValue = parseCustomFilterFunction(value);
@@ -9320,7 +9336,7 @@
             m_valueList->next();
         }
     }
-    settings->append(FontFeatureValue::create(tag, tagValue));
+    settings->append(CSSFontFeatureValue::create(tag, tagValue));
     return true;
 }
 
@@ -9395,7 +9411,7 @@
     return true;
 }
 
-bool CSSParser::parseCalculation(CSSParserValue* value, CalculationPermittedValueRange range)
+bool CSSParser::parseCalculation(CSSParserValue* value, ValueRange range)
 {
     ASSERT(isCalculation(value));
 
@@ -10174,6 +10190,9 @@
         CASE("only") {
             m_token = MEDIA_ONLY;
         }
+        CASE("or") {
+            m_token = MEDIA_OR;
+        }
     }
 }
 
diff --git a/Source/core/css/CSSParser.h b/Source/core/css/CSSParser.h
index a63df8f..8ca92c9 100644
--- a/Source/core/css/CSSParser.h
+++ b/Source/core/css/CSSParser.h
@@ -38,7 +38,7 @@
 #include "core/page/UseCounter.h"
 #include "core/platform/graphics/Color.h"
 #include "wtf/HashSet.h"
-#include "wtf/OwnArrayPtr.h"
+#include "wtf/OwnPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/text/AtomicString.h"
 #include "wtf/text/TextPosition.h"
@@ -286,7 +286,7 @@
     PassRefPtr<CSSValue> parseTextIndent();
 
     bool parseLineBoxContain(bool important);
-    bool parseCalculation(CSSParserValue*, CalculationPermittedValueRange);
+    bool parseCalculation(CSSParserValue*, ValueRange);
 
     bool parseFontFeatureTag(CSSValueList*);
     bool parseFontFeatureSettings(bool important);
@@ -564,7 +564,7 @@
     void setStyleSheet(StyleSheetContents* styleSheet) { m_styleSheet = styleSheet; }
 
     inline bool inStrictMode() const { return isStrictParserMode(m_context.mode); }
-    inline bool inQuirksMode() const { return m_context.mode == CSSQuirksMode; }
+    inline bool inQuirksMode() const { return m_context.mode == CSSQuirksMode || m_context.mode == CSSAttributeMode; }
 
     KURL completeURL(const String& url) const;
 
@@ -614,8 +614,8 @@
 
     ParsingMode m_parsingMode;
     bool m_is8BitSource;
-    OwnArrayPtr<LChar> m_dataStart8;
-    OwnArrayPtr<UChar> m_dataStart16;
+    OwnPtr<LChar[]> m_dataStart8;
+    OwnPtr<UChar[]> m_dataStart16;
     LChar* m_currentCharacter8;
     UChar* m_currentCharacter16;
     const String* m_source;
diff --git a/Source/core/css/CSSParserMode.h b/Source/core/css/CSSParserMode.h
index 6a40a5f..3914554 100644
--- a/Source/core/css/CSSParserMode.h
+++ b/Source/core/css/CSSParserMode.h
@@ -42,6 +42,8 @@
     CSSStrictMode,
     // SVG should always be in strict mode. For SVG attributes, the rules differ to strict sometimes.
     SVGAttributeMode,
+    // CSS attribute are parsed in quirks mode. They also allow internal only properties and values.
+    CSSAttributeMode,
     // User agent style sheet should always be in strict mode. Enables internal
     // only properties and values.
     UASheetMode,
@@ -70,10 +72,6 @@
     String charset;
     CSSParserMode mode;
     bool isHTMLDocument;
-    bool isCSSCustomFilterEnabled;
-    bool isCSSStickyPositionEnabled;
-    bool isCSSCompositingEnabled;
-    bool isCSSTouchActionEnabled;
     bool needsSiteSpecificQuirks;
     // This quirk is to maintain compatibility with Android apps built on
     // the Android SDK prior to and including version 18. Presumably, this
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index fa13eda..ed807fb 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -35,9 +35,9 @@
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/Node.h"
-#include "core/platform/LayoutUnit.h"
 #include "core/platform/graphics/Color.h"
 #include "core/rendering/style/RenderStyle.h"
+#include "platform/LayoutUnit.h"
 #include "wtf/DecimalNumber.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/text/StringBuffer.h"
@@ -275,7 +275,7 @@
     m_value.rgbcolor = color;
 }
 
-CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, const RenderStyle* style)
+CSSPrimitiveValue::CSSPrimitiveValue(const Length& length, float zoom)
     : CSSValue(PrimitiveClass)
 {
     switch (length.type()) {
@@ -296,10 +296,10 @@
         return;
     case Fixed:
         m_primitiveUnitType = CSS_PX;
-        m_value.num = adjustFloatForAbsoluteZoom(length.value(), style);
+        m_value.num = length.value() / zoom;
         return;
     case Calculated:
-        init(CSSCalcValue::create(length.calculationValue().get(), style));
+        init(CSSCalcValue::create(length.calculationValue(), zoom));
         return;
     case Relative:
     case Undefined:
diff --git a/Source/core/css/CSSPrimitiveValue.h b/Source/core/css/CSSPrimitiveValue.h
index 4d2e614..b4ca9d1 100644
--- a/Source/core/css/CSSPrimitiveValue.h
+++ b/Source/core/css/CSSPrimitiveValue.h
@@ -204,7 +204,7 @@
     static PassRefPtr<CSSPrimitiveValue> createColor(unsigned rgbValue) { return adoptRef(new CSSPrimitiveValue(rgbValue)); }
     static PassRefPtr<CSSPrimitiveValue> create(double value, UnitTypes type) { return adoptRef(new CSSPrimitiveValue(value, type)); }
     static PassRefPtr<CSSPrimitiveValue> create(const String& value, UnitTypes type) { return adoptRef(new CSSPrimitiveValue(value, type)); }
-    static PassRefPtr<CSSPrimitiveValue> create(const Length& value, const RenderStyle* style) { return adoptRef(new CSSPrimitiveValue(value, style)); }
+    static PassRefPtr<CSSPrimitiveValue> create(const Length& value, float zoom) { return adoptRef(new CSSPrimitiveValue(value, zoom)); }
 
     template<typename T> static PassRefPtr<CSSPrimitiveValue> create(T value)
     {
@@ -337,7 +337,7 @@
     {
         init(length);
     }
-    CSSPrimitiveValue(const Length&, const RenderStyle*);
+    CSSPrimitiveValue(const Length&, float zoom);
     CSSPrimitiveValue(const String&, UnitTypes);
     CSSPrimitiveValue(double, UnitTypes);
 
@@ -385,20 +385,7 @@
     } 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*);
+DEFINE_CSS_VALUE_TYPE_CASTS(PrimitiveValue);
 
 } // namespace WebCore
 
diff --git a/Source/core/css/CSSPrimitiveValueMappings.h b/Source/core/css/CSSPrimitiveValueMappings.h
index 0de35fd..2778533 100644
--- a/Source/core/css/CSSPrimitiveValueMappings.h
+++ b/Source/core/css/CSSPrimitiveValueMappings.h
@@ -41,12 +41,12 @@
 #include "core/platform/ThemeTypes.h"
 #include "core/platform/graphics/Path.h"
 #include "core/platform/graphics/TextRenderingMode.h"
-#include "core/platform/text/TextDirection.h"
-#include "core/platform/text/UnicodeBidi.h"
-#include "core/platform/text/WritingMode.h"
 #include "core/rendering/style/LineClampValue.h"
 #include "core/rendering/style/RenderStyleConstants.h"
 #include "core/rendering/style/SVGRenderStyleDefs.h"
+#include "platform/text/TextDirection.h"
+#include "platform/text/UnicodeBidi.h"
+#include "platform/text/WritingMode.h"
 #include "wtf/MathExtras.h"
 
 namespace WebCore {
@@ -176,6 +176,32 @@
     return ReflectionBelow;
 }
 
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnFill columnFill)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_VALUE_ID;
+    switch (columnFill) {
+    case ColumnFillAuto:
+        m_value.valueID = CSSValueAuto;
+        break;
+    case ColumnFillBalance:
+        m_value.valueID = CSSValueBalance;
+        break;
+    }
+}
+
+template<> inline CSSPrimitiveValue::operator ColumnFill() const
+{
+    if (m_primitiveUnitType == CSS_VALUE_ID) {
+        if (m_value.valueID == CSSValueBalance)
+            return ColumnFillBalance;
+        if (m_value.valueID == CSSValueAuto)
+            return ColumnFillAuto;
+    }
+    ASSERT_NOT_REACHED();
+    return ColumnFillBalance;
+}
+
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColumnSpan columnSpan)
     : CSSValue(PrimitiveClass)
 {
@@ -2394,6 +2420,45 @@
     return TextAlignLastAuto;
 }
 
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextJustify e)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_VALUE_ID;
+    switch (e) {
+    case TextJustifyAuto:
+        m_value.valueID = CSSValueAuto;
+        break;
+    case TextJustifyNone:
+        m_value.valueID = CSSValueNone;
+        break;
+    case TextJustifyInterWord:
+        m_value.valueID = CSSValueInterWord;
+        break;
+    case TextJustifyDistribute:
+        m_value.valueID = CSSValueDistribute;
+        break;
+    }
+}
+
+template<> inline CSSPrimitiveValue::operator TextJustify() const
+{
+    switch (m_value.valueID) {
+    case CSSValueAuto:
+        return TextJustifyAuto;
+    case CSSValueNone:
+        return TextJustifyNone;
+    case CSSValueInterWord:
+        return TextJustifyInterWord;
+    case CSSValueDistribute:
+        return TextJustifyDistribute;
+    default:
+        break;
+    }
+
+    ASSERT_NOT_REACHED();
+    return TextJustifyAuto;
+}
+
 template<> inline CSSPrimitiveValue::operator TextDecoration() const
 {
     ASSERT(isValueID());
@@ -3398,6 +3463,26 @@
     }
 }
 
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillSizeType fillSize)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_VALUE_ID;
+    switch (fillSize) {
+    case Contain:
+        m_value.valueID = CSSValueContain;
+        break;
+    case Cover:
+        m_value.valueID = CSSValueCover;
+        break;
+    case SizeNone:
+        m_value.valueID = CSSValueNone;
+        break;
+    case SizeLength:
+    default:
+        ASSERT_NOT_REACHED();
+    }
+}
+
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing)
     : CSSValue(PrimitiveClass)
 {
diff --git a/Source/core/css/CSSProperties.in b/Source/core/css/CSSProperties.in
index 4bcc442..67d22c2 100644
--- a/Source/core/css/CSSProperties.in
+++ b/Source/core/css/CSSProperties.in
@@ -116,6 +116,7 @@
 text-decoration-color custom_all
 text-decoration-style type_name=TextDecorationStyle
 text-indent custom_all
+text-justify type_name=TextJustify
 text-overflow type_name=TextOverflow
 text-rendering custom_all
 text-transform
@@ -168,6 +169,7 @@
 -webkit-column-break-before type_name=EPageBreak, initial=initialPageBreak
 -webkit-column-break-inside type_name=EPageBreak, initial=initialPageBreak
 -webkit-column-count type_name=unsigned short, custom_all
+column-fill type_name=ColumnFill
 -webkit-column-gap type_name=float, custom_all
 -webkit-column-progression type_name=ColumnProgression
 -webkit-column-rule-color custom_all
@@ -225,6 +227,7 @@
 -webkit-shape-margin type_name=Length, converter=convertLength
 -webkit-shape-outside type_name=ShapeValue*, custom_value
 -webkit-shape-padding type_name=Length, converter=convertLength
+-webkit-shape-image-threshold type_name=float
 -webkit-text-combine type_name=TextCombine
 -webkit-text-emphasis-color custom_all
 -webkit-text-emphasis-position type_name=TextEmphasisPosition
diff --git a/Source/core/css/CSSProperty.cpp b/Source/core/css/CSSProperty.cpp
index 56e95f1..c3bcb10 100644
--- a/Source/core/css/CSSProperty.cpp
+++ b/Source/core/css/CSSProperty.cpp
@@ -309,6 +309,7 @@
     case CSSPropertyTabSize:
     case CSSPropertyTextAlign:
     case CSSPropertyTextAlignLast:
+    case CSSPropertyTextJustify:
     case CSSPropertyTextAnchor:
     case CSSPropertyTextIndent:
     case CSSPropertyTextRendering:
@@ -557,12 +558,14 @@
     case CSSPropertyWebkitBoxPack:
     case CSSPropertyWebkitBoxReflect:
     case CSSPropertyWebkitBoxShadow:
+    case CSSPropertyInternalCallback:
     case CSSPropertyWebkitClipPath:
     case CSSPropertyWebkitColumnAxis:
     case CSSPropertyWebkitColumnBreakAfter:
     case CSSPropertyWebkitColumnBreakBefore:
     case CSSPropertyWebkitColumnBreakInside:
     case CSSPropertyWebkitColumnCount:
+    case CSSPropertyColumnFill:
     case CSSPropertyWebkitColumnGap:
     case CSSPropertyWebkitColumnProgression:
     case CSSPropertyWebkitColumnRule:
@@ -663,6 +666,7 @@
     case CSSPropertyWebkitRegionFragment:
     case CSSPropertyWebkitWrapFlow:
     case CSSPropertyWebkitShapeMargin:
+    case CSSPropertyWebkitShapeImageThreshold:
     case CSSPropertyWebkitShapePadding:
     case CSSPropertyWebkitShapeInside:
     case CSSPropertyWebkitShapeOutside:
diff --git a/Source/core/css/CSSProperty.h b/Source/core/css/CSSProperty.h
index fd802ec..a0fb377 100644
--- a/Source/core/css/CSSProperty.h
+++ b/Source/core/css/CSSProperty.h
@@ -24,8 +24,8 @@
 #include "CSSPropertyNames.h"
 #include "RuntimeEnabledFeatures.h"
 #include "core/css/CSSValue.h"
-#include "core/platform/text/TextDirection.h"
-#include "core/platform/text/WritingMode.h"
+#include "platform/text/TextDirection.h"
+#include "platform/text/WritingMode.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
 
diff --git a/Source/core/css/CSSPropertyNames.in b/Source/core/css/CSSPropertyNames.in
index 2f88d93..3ed1bd4 100644
--- a/Source/core/css/CSSPropertyNames.in
+++ b/Source/core/css/CSSPropertyNames.in
@@ -195,6 +195,7 @@
 text-decoration-style
 text-decoration-color
 text-indent
+text-justify
 text-line-through-color
 text-line-through-mode
 text-line-through-style
@@ -270,11 +271,13 @@
 -webkit-box-pack
 -webkit-box-reflect
 -webkit-box-shadow
+-internal-callback
 -webkit-column-axis
 -webkit-column-break-after
 -webkit-column-break-before
 -webkit-column-break-inside
 -webkit-column-count
+column-fill
 -webkit-column-gap
 -webkit-column-progression
 -webkit-column-rule
@@ -411,6 +414,7 @@
 -webkit-shape-outside
 -webkit-shape-margin
 -webkit-shape-padding
+-webkit-shape-image-threshold
 -webkit-wrap-flow
 -webkit-wrap-through
 max-zoom
diff --git a/Source/core/css/CSSRule.cpp b/Source/core/css/CSSRule.cpp
index d71bee1..8f8e834 100644
--- a/Source/core/css/CSSRule.cpp
+++ b/Source/core/css/CSSRule.cpp
@@ -25,7 +25,7 @@
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/StyleRule.h"
 #include "core/css/StyleSheetContents.h"
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/CSSRule.idl b/Source/core/css/CSSRule.idl
index 94ce538..2489d2d 100644
--- a/Source/core/css/CSSRule.idl
+++ b/Source/core/css/CSSRule.idl
@@ -37,8 +37,8 @@
     const unsigned short KEYFRAME_RULE = 8;
     const unsigned short WEBKIT_KEYFRAME_RULE = 8;
     const unsigned short SUPPORTS_RULE = 12;
-    [EnabledAtRuntime=CSSViewport] const unsigned short VIEWPORT_RULE = 15;
-    [EnabledAtRuntime=CSSRegions] const unsigned short WEBKIT_REGION_RULE = 16;
+    [RuntimeEnabled=CSSViewport] const unsigned short VIEWPORT_RULE = 15;
+    [RuntimeEnabled=CSSRegions] const unsigned short WEBKIT_REGION_RULE = 16;
     const unsigned short WEBKIT_FILTER_RULE = 17;
     const unsigned short HOST_RULE = 1001;
 
diff --git a/Source/core/css/CSSSVGDocumentValue.h b/Source/core/css/CSSSVGDocumentValue.h
index 7e43406..fad50a6 100644
--- a/Source/core/css/CSSSVGDocumentValue.h
+++ b/Source/core/css/CSSSVGDocumentValue.h
@@ -54,6 +54,8 @@
     bool m_loadRequested;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(SVGDocumentValue);
+
 } // namespace WebCore
 
 #endif // CSSSVGDocumentValue_h
diff --git a/Source/core/css/CSSSegmentedFontFace.cpp b/Source/core/css/CSSSegmentedFontFace.cpp
index 60bc3c5..96c553f 100644
--- a/Source/core/css/CSSSegmentedFontFace.cpp
+++ b/Source/core/css/CSSSegmentedFontFace.cpp
@@ -26,8 +26,9 @@
 #include "config.h"
 #include "core/css/CSSSegmentedFontFace.h"
 
-#include "core/css/CSSFontFace.h"
 #include "RuntimeEnabledFeatures.h"
+#include "core/css/CSSFontFace.h"
+#include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/FontDescription.h"
 #include "core/platform/graphics/SegmentedFontData.h"
 #include "core/platform/graphics/SimpleFontData.h"
@@ -77,7 +78,7 @@
         Vector<RefPtr<LoadFontCallback> > callbacks;
         m_callbacks.swap(callbacks);
         for (size_t index = 0; index < callbacks.size(); ++index) {
-            if (checkFont())
+            if (isLoaded())
                 callbacks[index]->notifyLoaded(this);
             else
                 callbacks[index]->notifyError(this);
@@ -92,7 +93,7 @@
     m_fontFaces.append(fontFace);
 }
 
-static void appendFontData(SegmentedFontData* newFontData, PassRefPtr<SimpleFontData> prpFaceFontData, const Vector<CSSFontFace::UnicodeRange>& ranges)
+static void appendFontData(SegmentedFontData* newFontData, PassRefPtr<SimpleFontData> prpFaceFontData, const CSSFontFace::UnicodeRangeSet& ranges)
 {
     RefPtr<SimpleFontData> faceFontData = prpFaceFontData;
     unsigned numRanges = ranges.size();
@@ -102,7 +103,7 @@
     }
 
     for (unsigned j = 0; j < numRanges; ++j)
-        newFontData->appendRange(FontDataRange(ranges[j].from(), ranges[j].to(), faceFontData));
+        newFontData->appendRange(FontDataRange(ranges.rangeAt(j).from(), ranges.rangeAt(j).to(), faceFontData));
 }
 
 PassRefPtr<FontData> CSSSegmentedFontFace::getFontData(const FontDescription& fontDescription)
@@ -110,8 +111,14 @@
     if (!isValid())
         return 0;
 
+    float fontSize;
+    if (RuntimeEnabledFeatures::subpixelFontScalingEnabled())
+        fontSize = fontDescription.computedSize();
+    else
+        fontSize = fontDescription.computedPixelSize();
+
     FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
-    unsigned hashKey = ((fontDescription.computedPixelSize() + 1) << (FontTraitsMaskWidth + FontWidthVariantWidth + 1))
+    unsigned hashKey = ((static_cast<unsigned>(fontSize * FontCache::s_fontSizePrecisionMultiplier) + 1) << (FontTraitsMaskWidth + FontWidthVariantWidth + 1))
         | ((fontDescription.orientation() == Vertical ? 1 : 0) << (FontTraitsMaskWidth + FontWidthVariantWidth))
         | fontDescription.widthVariant() << FontTraitsMaskWidth
         | desiredTraitsMask;
@@ -131,6 +138,12 @@
             continue;
         if (RefPtr<SimpleFontData> faceFontData = m_fontFaces[i]->getFontData(fontDescription, syntheticBold, syntheticItalic)) {
             ASSERT(!faceFontData->isSegmented());
+#if ENABLE(SVG_FONTS)
+            // For SVG Fonts that specify that they only support the "normal" variant, we will assume they are incapable
+            // of small-caps synthesis and just ignore the font face.
+            if (faceFontData->isSVGFont() && (desiredTraitsMask & FontVariantSmallCapsMask) && !(m_traitsMask & FontVariantSmallCapsMask))
+                continue;
+#endif
             appendFontData(fontData.get(), faceFontData.release(), m_fontFaces[i]->ranges());
         }
     }
@@ -140,16 +153,6 @@
     return 0;
 }
 
-bool CSSSegmentedFontFace::hasSVGFontFaceSource() const
-{
-    unsigned size = m_fontFaces.size();
-    for (unsigned i = 0; i < size; i++) {
-        if (m_fontFaces[i]->hasSVGFontFaceSource())
-            return true;
-    }
-    return false;
-}
-
 bool CSSSegmentedFontFace::isLoading() const
 {
     unsigned size = m_fontFaces.size();
@@ -160,14 +163,7 @@
     return false;
 }
 
-void CSSSegmentedFontFace::willUseFontData(const FontDescription& fontDescription)
-{
-    unsigned size = m_fontFaces.size();
-    for (unsigned i = 0; i < size; i++)
-        m_fontFaces[i]->willUseFontData(fontDescription);
-}
-
-bool CSSSegmentedFontFace::checkFont() const
+bool CSSSegmentedFontFace::isLoaded() const
 {
     unsigned size = m_fontFaces.size();
     for (unsigned i = 0; i < size; i++) {
@@ -177,30 +173,50 @@
     return true;
 }
 
-void CSSSegmentedFontFace::loadFont(const FontDescription& fontDescription, PassRefPtr<LoadFontCallback> callback)
+void CSSSegmentedFontFace::willUseFontData(const FontDescription& fontDescription)
 {
-    RefPtr<SegmentedFontData> fontData = toSegmentedFontData(getFontData(fontDescription).get());
-    unsigned numRanges = fontData->numRanges();
-    for (unsigned i = 0; i < numRanges; i++)
-        fontData->rangeAt(i).fontData()->beginLoadIfNeeded();
+    unsigned size = m_fontFaces.size();
+    for (unsigned i = 0; i < size; i++)
+        m_fontFaces[i]->willUseFontData(fontDescription);
+}
+
+bool CSSSegmentedFontFace::checkFont(const String& text) const
+{
+    unsigned size = m_fontFaces.size();
+    for (unsigned i = 0; i < size; i++) {
+        if (m_fontFaces[i]->loadStatus() != FontFace::Loaded && m_fontFaces[i]->ranges().intersectsWith(text))
+            return false;
+    }
+    return true;
+}
+
+void CSSSegmentedFontFace::loadFont(const FontDescription& fontDescription, const String& text, PassRefPtr<LoadFontCallback> callback)
+{
+    unsigned size = m_fontFaces.size();
+    for (unsigned i = 0; i < size; i++) {
+        if (m_fontFaces[i]->loadStatus() == FontFace::Unloaded && m_fontFaces[i]->ranges().intersectsWith(text)) {
+            RefPtr<SimpleFontData> fontData = m_fontFaces[i]->getFontData(fontDescription, false, false);
+            fontData->beginLoadIfNeeded();
+        }
+    }
 
     if (callback) {
         if (isLoading())
             m_callbacks.append(callback);
-        else if (checkFont())
+        else if (isLoaded())
             callback->notifyLoaded(this);
         else
             callback->notifyError(this);
     }
 }
 
-Vector<RefPtr<FontFace> > CSSSegmentedFontFace::fontFaces() const
+Vector<RefPtr<FontFace> > CSSSegmentedFontFace::fontFaces(const String& text) const
 {
     Vector<RefPtr<FontFace> > fontFaces;
     unsigned size = m_fontFaces.size();
     for (unsigned i = 0; i < size; i++) {
         RefPtr<FontFace> face = m_fontFaces[i]->fontFace();
-        if (face)
+        if (face && m_fontFaces[i]->ranges().intersectsWith(text))
             fontFaces.append(face);
     }
     return fontFaces;
diff --git a/Source/core/css/CSSSegmentedFontFace.h b/Source/core/css/CSSSegmentedFontFace.h
index a9a624d..7cfa61d 100644
--- a/Source/core/css/CSSSegmentedFontFace.h
+++ b/Source/core/css/CSSSegmentedFontFace.h
@@ -31,6 +31,7 @@
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -56,10 +57,6 @@
 
     PassRefPtr<FontData> getFontData(const FontDescription&);
 
-#if ENABLE(SVG_FONTS)
-    bool hasSVGFontFaceSource() const;
-#endif
-
     class LoadFontCallback : public RefCounted<LoadFontCallback> {
     public:
         virtual ~LoadFontCallback() { }
@@ -67,9 +64,9 @@
         virtual void notifyError(CSSSegmentedFontFace*) = 0;
     };
 
-    bool checkFont() const;
-    void loadFont(const FontDescription&, PassRefPtr<LoadFontCallback> loadCallback);
-    Vector<RefPtr<FontFace> > fontFaces() const;
+    bool checkFont(const String&) const;
+    void loadFont(const FontDescription&, const String&, PassRefPtr<LoadFontCallback>);
+    Vector<RefPtr<FontFace> > fontFaces(const String& text) const;
     void willUseFontData(const FontDescription&);
 
 private:
@@ -78,6 +75,7 @@
     void pruneTable();
     bool isValid() const;
     bool isLoading() const;
+    bool isLoaded() const;
 
     CSSFontSelector* m_fontSelector;
     FontTraitsMask m_traitsMask;
diff --git a/Source/core/css/CSSSegmentedFontFaceCache.cpp b/Source/core/css/CSSSegmentedFontFaceCache.cpp
new file mode 100644
index 0000000..160bcdf
--- /dev/null
+++ b/Source/core/css/CSSSegmentedFontFaceCache.cpp
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2007, 2008, 2011 Apple 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 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,
+ * 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 "CSSSegmentedFontFaceCache.h"
+
+#include "FontFamilyNames.h"
+#include "core/css/CSSFontFace.h"
+#include "core/css/CSSFontFaceSource.h"
+#include "core/css/CSSFontSelector.h"
+#include "core/css/CSSSegmentedFontFace.h"
+#include "core/css/CSSValueList.h"
+#include "core/css/StyleRule.h"
+#include "core/dom/Document.h"
+#include "core/fetch/FontResource.h"
+#include "core/fetch/ResourceFetcher.h"
+#include "core/frame/Frame.h"
+#include "core/page/Settings.h"
+#include "core/platform/graphics/FontCache.h"
+#include "core/platform/graphics/FontDescription.h"
+#include "core/platform/graphics/SimpleFontData.h"
+#include "wtf/text/AtomicString.h"
+
+namespace WebCore {
+
+using namespace FontFamilyNames;
+
+
+CSSSegmentedFontFaceCache::CSSSegmentedFontFaceCache()
+    : m_version(0)
+{
+}
+
+void CSSSegmentedFontFaceCache::addFontFaceRule(CSSFontSelector* cssFontSelector, const StyleRuleFontFace* fontFaceRule)
+{
+    RefPtr<FontFace> fontFace = FontFace::create(fontFaceRule);
+    if (!fontFace || fontFace->family().isEmpty())
+        return;
+
+    unsigned traitsMask = fontFace->traitsMask();
+    if (!traitsMask)
+        return;
+
+    RefPtr<CSSFontFace> cssFontFace = fontFace->createCSSFontFace(cssFontSelector->document());
+    if (!cssFontFace || !cssFontFace->isValid())
+        return;
+
+    OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >& familyFontFaces = m_fontFaces.add(fontFace->family(), nullptr).iterator->value;
+    if (!familyFontFaces) {
+        familyFontFaces = adoptPtr(new HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >);
+
+        ASSERT(!m_locallyInstalledFontFaces.contains(fontFace->family()));
+
+        Vector<unsigned> locallyInstalledFontsTraitsMasks;
+        fontCache()->getTraitsInFamily(fontFace->family(), locallyInstalledFontsTraitsMasks);
+        if (unsigned numLocallyInstalledFaces = locallyInstalledFontsTraitsMasks.size()) {
+            OwnPtr<Vector<RefPtr<CSSSegmentedFontFace> > > familyLocallyInstalledFaces = adoptPtr(new Vector<RefPtr<CSSSegmentedFontFace> >);
+
+            for (unsigned i = 0; i < numLocallyInstalledFaces; ++i) {
+                RefPtr<CSSFontFace> locallyInstalledFontFace = CSSFontFace::create(0);
+                locallyInstalledFontFace->addSource(adoptPtr(new CSSFontFaceSource(fontFace->family())));
+                ASSERT(locallyInstalledFontFace->isValid());
+
+                RefPtr<CSSSegmentedFontFace> segmentedFontFace = CSSSegmentedFontFace::create(cssFontSelector, static_cast<FontTraitsMask>(locallyInstalledFontsTraitsMasks[i]), true);
+                segmentedFontFace->appendFontFace(locallyInstalledFontFace.release());
+                familyLocallyInstalledFaces->append(segmentedFontFace);
+            }
+
+            m_locallyInstalledFontFaces.set(fontFace->family(), familyLocallyInstalledFaces.release());
+        }
+    }
+
+    RefPtr<CSSSegmentedFontFace>& segmentedFontFace = familyFontFaces->add(traitsMask, 0).iterator->value;
+    if (!segmentedFontFace)
+        segmentedFontFace = CSSSegmentedFontFace::create(cssFontSelector, static_cast<FontTraitsMask>(traitsMask), false);
+
+    segmentedFontFace->appendFontFace(cssFontFace);
+
+    ++m_version;
+}
+
+
+static PassRefPtr<FontData> fontDataForGenericFamily(Settings* settings, const FontDescription& fontDescription, const AtomicString& familyName)
+{
+    if (!settings)
+        return 0;
+
+    AtomicString genericFamily;
+    UScriptCode script = fontDescription.script();
+
+#if OS(ANDROID)
+    genericFamily = FontCache::getGenericFamilyNameForScript(familyName, script);
+#else
+    if (familyName == serifFamily)
+        genericFamily = settings->serifFontFamily(script);
+    else if (familyName == sansSerifFamily)
+        genericFamily = settings->sansSerifFontFamily(script);
+    else if (familyName == cursiveFamily)
+        genericFamily = settings->cursiveFontFamily(script);
+    else if (familyName == fantasyFamily)
+        genericFamily = settings->fantasyFontFamily(script);
+    else if (familyName == monospaceFamily)
+        genericFamily = settings->fixedFontFamily(script);
+    else if (familyName == pictographFamily)
+        genericFamily = settings->pictographFontFamily(script);
+    else if (familyName == standardFamily)
+        genericFamily = settings->standardFontFamily(script);
+#endif
+
+    if (!genericFamily.isEmpty())
+        return fontCache()->getFontResourceData(fontDescription, genericFamily);
+
+    return 0;
+}
+
+static inline bool compareFontFaces(CSSSegmentedFontFace* first, CSSSegmentedFontFace* second, FontTraitsMask desiredTraitsMask)
+{
+    FontTraitsMask firstTraitsMask = first->traitsMask();
+    FontTraitsMask secondTraitsMask = second->traitsMask();
+
+    bool firstHasDesiredVariant = firstTraitsMask & desiredTraitsMask & FontVariantMask;
+    bool secondHasDesiredVariant = secondTraitsMask & desiredTraitsMask & FontVariantMask;
+
+    if (firstHasDesiredVariant != secondHasDesiredVariant)
+        return firstHasDesiredVariant;
+
+    // We need to check font-variant css property for CSS2.1 compatibility.
+    if ((desiredTraitsMask & FontVariantSmallCapsMask) && !first->isLocalFallback() && !second->isLocalFallback()) {
+        // Prefer a font that has indicated that it can only support small-caps to a font that claims to support
+        // all variants. The specialized font is more likely to be true small-caps and not require synthesis.
+        bool firstRequiresSmallCaps = (firstTraitsMask & FontVariantSmallCapsMask) && !(firstTraitsMask & FontVariantNormalMask);
+        bool secondRequiresSmallCaps = (secondTraitsMask & FontVariantSmallCapsMask) && !(secondTraitsMask & FontVariantNormalMask);
+        if (firstRequiresSmallCaps != secondRequiresSmallCaps)
+            return firstRequiresSmallCaps;
+    }
+
+    bool firstHasDesiredStyle = firstTraitsMask & desiredTraitsMask & FontStyleMask;
+    bool secondHasDesiredStyle = secondTraitsMask & desiredTraitsMask & FontStyleMask;
+
+    if (firstHasDesiredStyle != secondHasDesiredStyle)
+        return firstHasDesiredStyle;
+
+    if ((desiredTraitsMask & FontStyleItalicMask) && !first->isLocalFallback() && !second->isLocalFallback()) {
+        // Prefer a font that has indicated that it can only support italics to a font that claims to support
+        // all styles. The specialized font is more likely to be the one the author wants used.
+        bool firstRequiresItalics = (firstTraitsMask & FontStyleItalicMask) && !(firstTraitsMask & FontStyleNormalMask);
+        bool secondRequiresItalics = (secondTraitsMask & FontStyleItalicMask) && !(secondTraitsMask & FontStyleNormalMask);
+        if (firstRequiresItalics != secondRequiresItalics)
+            return firstRequiresItalics;
+    }
+
+    if (secondTraitsMask & desiredTraitsMask & FontWeightMask)
+        return false;
+    if (firstTraitsMask & desiredTraitsMask & FontWeightMask)
+        return true;
+
+    // http://www.w3.org/TR/2011/WD-css3-fonts-20111004/#font-matching-algorithm says :
+    //   - If the desired weight is less than 400, weights below the desired weight are checked in descending order followed by weights above the desired weight in ascending order until a match is found.
+    //   - If the desired weight is greater than 500, weights above the desired weight are checked in ascending order followed by weights below the desired weight in descending order until a match is found.
+    //   - If the desired weight is 400, 500 is checked first and then the rule for desired weights less than 400 is used.
+    //   - If the desired weight is 500, 400 is checked first and then the rule for desired weights less than 400 is used.
+
+    static const unsigned fallbackRuleSets = 9;
+    static const unsigned rulesPerSet = 8;
+    static const FontTraitsMask weightFallbackRuleSets[fallbackRuleSets][rulesPerSet] = {
+        { FontWeight200Mask, FontWeight300Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
+        { FontWeight100Mask, FontWeight300Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
+        { FontWeight200Mask, FontWeight100Mask, FontWeight400Mask, FontWeight500Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
+        { FontWeight500Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
+        { FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask, FontWeight600Mask, FontWeight700Mask, FontWeight800Mask, FontWeight900Mask },
+        { FontWeight700Mask, FontWeight800Mask, FontWeight900Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
+        { FontWeight800Mask, FontWeight900Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
+        { FontWeight900Mask, FontWeight700Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask },
+        { FontWeight800Mask, FontWeight700Mask, FontWeight600Mask, FontWeight500Mask, FontWeight400Mask, FontWeight300Mask, FontWeight200Mask, FontWeight100Mask }
+    };
+
+    unsigned ruleSetIndex = 0;
+    unsigned w = FontWeight100Bit;
+    while (!(desiredTraitsMask & (1 << w))) {
+        w++;
+        ruleSetIndex++;
+    }
+
+    ASSERT(ruleSetIndex < fallbackRuleSets);
+    const FontTraitsMask* weightFallbackRule = weightFallbackRuleSets[ruleSetIndex];
+    for (unsigned i = 0; i < rulesPerSet; ++i) {
+        if (secondTraitsMask & weightFallbackRule[i])
+            return false;
+        if (firstTraitsMask & weightFallbackRule[i])
+            return true;
+    }
+
+    return false;
+}
+
+PassRefPtr<FontData> CSSSegmentedFontFaceCache::getFontData(Settings* settings, const FontDescription& fontDescription, const AtomicString& familyName)
+{
+    if (m_fontFaces.isEmpty()) {
+        if (familyName.startsWith("-webkit-"))
+            return fontDataForGenericFamily(settings, fontDescription, familyName);
+        if (fontDescription.genericFamily() == FontDescription::StandardFamily && !fontDescription.isSpecifiedFont())
+            return fontDataForGenericFamily(settings, fontDescription, "-webkit-standard");
+        return 0;
+    }
+
+    CSSSegmentedFontFace* face = getFontFace(fontDescription, familyName);
+    // If no face was found, then return 0 and let the OS come up with its best match for the name.
+    if (!face) {
+        // If we were handed a generic family, but there was no match, go ahead and return the correct font based off our
+        // settings.
+        if (fontDescription.genericFamily() == FontDescription::StandardFamily && !fontDescription.isSpecifiedFont())
+            return fontDataForGenericFamily(settings, fontDescription, "-webkit-standard");
+        return fontDataForGenericFamily(settings, fontDescription, familyName);
+    }
+
+    // We have a face. Ask it for a font data. If it cannot produce one, it will fail, and the OS will take over.
+    return face->getFontData(fontDescription);
+}
+
+CSSSegmentedFontFace* CSSSegmentedFontFaceCache::getFontFace(const FontDescription& fontDescription, const AtomicString& family)
+{
+    HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >* familyFontFaces = m_fontFaces.get(family);
+    if (!familyFontFaces || familyFontFaces->isEmpty())
+        return 0;
+
+    OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >& segmentedFontFaceCache = m_fonts.add(family, nullptr).iterator->value;
+    if (!segmentedFontFaceCache)
+        segmentedFontFaceCache = adoptPtr(new HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >);
+
+    FontTraitsMask traitsMask = fontDescription.traitsMask();
+
+    RefPtr<CSSSegmentedFontFace>& face = segmentedFontFaceCache->add(traitsMask, 0).iterator->value;
+    if (!face) {
+        for (HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >::const_iterator i = familyFontFaces->begin(); i != familyFontFaces->end(); ++i) {
+            CSSSegmentedFontFace* candidate = i->value.get();
+            unsigned candidateTraitsMask = candidate->traitsMask();
+            if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
+                continue;
+            if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask))
+                continue;
+            if (!face || compareFontFaces(candidate, face.get(), traitsMask))
+                face = candidate;
+        }
+
+        if (Vector<RefPtr<CSSSegmentedFontFace> >* familyLocallyInstalledFontFaces = m_locallyInstalledFontFaces.get(family)) {
+            unsigned numLocallyInstalledFontFaces = familyLocallyInstalledFontFaces->size();
+            for (unsigned i = 0; i < numLocallyInstalledFontFaces; ++i) {
+                CSSSegmentedFontFace* candidate = familyLocallyInstalledFontFaces->at(i).get();
+                unsigned candidateTraitsMask = candidate->traitsMask();
+                if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
+                    continue;
+                if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask & FontVariantNormalMask))
+                    continue;
+                if (!face || compareFontFaces(candidate, face.get(), traitsMask))
+                    face = candidate;
+            }
+        }
+    }
+    return face.get();
+}
+
+}
diff --git a/Source/core/css/CSSSegmentedFontFaceCache.h b/Source/core/css/CSSSegmentedFontFaceCache.h
new file mode 100644
index 0000000..4b005a9
--- /dev/null
+++ b/Source/core/css/CSSSegmentedFontFaceCache.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2007, 2008, 2011 Apple 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 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,
+ * 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 CSSSegmentedFontFaceCache_h
+#define CSSSegmentedFontFaceCache_h
+
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/text/StringHash.h"
+
+namespace WebCore {
+
+class CSSFontSelector;
+class CSSSegmentedFontFace;
+class FontData;
+class FontDescription;
+class StyleRuleFontFace;
+class Settings;
+
+class CSSSegmentedFontFaceCache {
+public:
+    CSSSegmentedFontFaceCache();
+
+    // FIXME: Remove CSSFontSelector as argument. Passing CSSFontSelector here is
+    // a result of egregious spaghettification in CSSFontFace/FontFaceSet.
+    void addFontFaceRule(CSSFontSelector*, const StyleRuleFontFace*);
+    PassRefPtr<FontData> getFontData(Settings*, const FontDescription&, const AtomicString&);
+    CSSSegmentedFontFace* getFontFace(const FontDescription&, const AtomicString& family);
+
+    unsigned version() const { return m_version; }
+
+private:
+    HashMap<String, OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >, CaseFoldingHash> m_fontFaces;
+    HashMap<String, OwnPtr<Vector<RefPtr<CSSSegmentedFontFace> > >, CaseFoldingHash> m_locallyInstalledFontFaces;
+    HashMap<String, OwnPtr<HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > >, CaseFoldingHash> m_fonts;
+
+    // FIXME: See if this could be ditched
+    // Used to compare Font instances, and the usage seems suspect.
+    unsigned m_version;
+};
+
+}
+
+#endif
diff --git a/Source/core/css/CSSSelector.cpp b/Source/core/css/CSSSelector.cpp
index e970247..b2ea820 100644
--- a/Source/core/css/CSSSelector.cpp
+++ b/Source/core/css/CSSSelector.cpp
@@ -812,6 +812,7 @@
     case CSSSelector::PseudoFirstOfType:
     case CSSSelector::PseudoLastOfType:
     case CSSSelector::PseudoOnlyOfType:
+    case CSSSelector::PseudoHost:
         return true;
     default:
         return false;
diff --git a/Source/core/css/CSSSelector.h b/Source/core/css/CSSSelector.h
index 028e512..3f8b7e8 100644
--- a/Source/core/css/CSSSelector.h
+++ b/Source/core/css/CSSSelector.h
@@ -222,6 +222,7 @@
         bool isAttributeSelector() const;
         bool isDistributedPseudoElement() const;
         bool isContentPseudoElement() const;
+        bool isHostPseudoClass() const;
 
         Relation relation() const { return static_cast<Relation>(m_relation); }
 
@@ -311,6 +312,11 @@
     return m_match == PseudoElement && (m_pseudoType == PseudoUserAgentCustomElement || m_pseudoType == PseudoWebKitCustomElement || m_pseudoType == PseudoPart);
 }
 
+inline bool CSSSelector::isHostPseudoClass() const
+{
+    return m_match == PseudoClass && m_pseudoType == PseudoHost;
+}
+
 inline bool CSSSelector::isSiblingSelector() const
 {
     PseudoType type = pseudoType();
diff --git a/Source/core/css/CSSShaderValue.h b/Source/core/css/CSSShaderValue.h
index 69daf55..94816e8 100644
--- a/Source/core/css/CSSShaderValue.h
+++ b/Source/core/css/CSSShaderValue.h
@@ -64,13 +64,7 @@
     bool m_accessedShader;
 };
 
-// This will catch anyone doing an unnecessary cast.
-CSSShaderValue* toCSSShaderValue(const CSSShaderValue*);
-
-inline CSSShaderValue* toCSSShaderValue(CSSValue* value)
-{
-    return value->isCSSShaderValue() ? static_cast<CSSShaderValue*>(value) : 0;
-}
+DEFINE_CSS_VALUE_TYPE_CASTS(ShaderValue);
 
 } // namespace WebCore
 
diff --git a/Source/core/css/CSSShadowValue.cpp b/Source/core/css/CSSShadowValue.cpp
new file mode 100644
index 0000000..57cb927
--- /dev/null
+++ b/Source/core/css/CSSShadowValue.cpp
@@ -0,0 +1,91 @@
+/**
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2009 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#include "config.h"
+#include "core/css/CSSShadowValue.h"
+
+#include "core/css/CSSPrimitiveValue.h"
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+// Used for text-shadow and box-shadow
+CSSShadowValue::CSSShadowValue(PassRefPtr<CSSPrimitiveValue> x,
+    PassRefPtr<CSSPrimitiveValue> y,
+    PassRefPtr<CSSPrimitiveValue> blur,
+    PassRefPtr<CSSPrimitiveValue> spread,
+    PassRefPtr<CSSPrimitiveValue> style,
+    PassRefPtr<CSSPrimitiveValue> color)
+    : CSSValue(ShadowClass)
+    , x(x)
+    , y(y)
+    , blur(blur)
+    , spread(spread)
+    , style(style)
+    , color(color)
+{
+}
+
+String CSSShadowValue::customCssText() const
+{
+    StringBuilder text;
+
+    if (color)
+        text.append(color->cssText());
+    if (x) {
+        if (!text.isEmpty())
+            text.append(' ');
+        text.append(x->cssText());
+    }
+    if (y) {
+        if (!text.isEmpty())
+            text.append(' ');
+        text.append(y->cssText());
+    }
+    if (blur) {
+        if (!text.isEmpty())
+            text.append(' ');
+        text.append(blur->cssText());
+    }
+    if (spread) {
+        if (!text.isEmpty())
+            text.append(' ');
+        text.append(spread->cssText());
+    }
+    if (style) {
+        if (!text.isEmpty())
+            text.append(' ');
+        text.append(style->cssText());
+    }
+
+    return text.toString();
+}
+
+bool CSSShadowValue::equals(const CSSShadowValue& other) const
+{
+    return compareCSSValuePtr(color, other.color)
+        && compareCSSValuePtr(x, other.x)
+        && compareCSSValuePtr(y, other.y)
+        && compareCSSValuePtr(blur, other.blur)
+        && compareCSSValuePtr(spread, other.spread)
+        && compareCSSValuePtr(style, other.style);
+}
+
+}
diff --git a/Source/core/css/CSSShadowValue.h b/Source/core/css/CSSShadowValue.h
new file mode 100644
index 0000000..dd90ea9
--- /dev/null
+++ b/Source/core/css/CSSShadowValue.h
@@ -0,0 +1,69 @@
+/*
+ * (C) 1999-2003 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2008, 2009 Apple Inc. 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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CSSShadowValue_h
+#define CSSShadowValue_h
+
+#include "core/css/CSSValue.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+class CSSPrimitiveValue;
+
+// Used for text-shadow and box-shadow
+class CSSShadowValue : public CSSValue {
+public:
+    static PassRefPtr<CSSShadowValue> create(PassRefPtr<CSSPrimitiveValue> x,
+        PassRefPtr<CSSPrimitiveValue> y,
+        PassRefPtr<CSSPrimitiveValue> blur,
+        PassRefPtr<CSSPrimitiveValue> spread,
+        PassRefPtr<CSSPrimitiveValue> style,
+        PassRefPtr<CSSPrimitiveValue> color)
+    {
+        return adoptRef(new CSSShadowValue(x, y, blur, spread, style, color));
+    }
+
+    String customCssText() const;
+
+    bool equals(const CSSShadowValue&) const;
+
+    RefPtr<CSSPrimitiveValue> x;
+    RefPtr<CSSPrimitiveValue> y;
+    RefPtr<CSSPrimitiveValue> blur;
+    RefPtr<CSSPrimitiveValue> spread;
+    RefPtr<CSSPrimitiveValue> style;
+    RefPtr<CSSPrimitiveValue> color;
+
+private:
+    CSSShadowValue(PassRefPtr<CSSPrimitiveValue> x,
+        PassRefPtr<CSSPrimitiveValue> y,
+        PassRefPtr<CSSPrimitiveValue> blur,
+        PassRefPtr<CSSPrimitiveValue> spread,
+        PassRefPtr<CSSPrimitiveValue> style,
+        PassRefPtr<CSSPrimitiveValue> color);
+};
+
+DEFINE_CSS_VALUE_TYPE_CASTS(ShadowValue);
+
+} // namespace
+
+#endif
diff --git a/Source/core/css/CSSStyleDeclaration.h b/Source/core/css/CSSStyleDeclaration.h
index 5d30cae..94d77b5 100644
--- a/Source/core/css/CSSStyleDeclaration.h
+++ b/Source/core/css/CSSStyleDeclaration.h
@@ -23,6 +23,7 @@
 
 #include "CSSPropertyNames.h"
 #include "bindings/v8/ScriptWrappable.h"
+#include "core/css/CSSVariablesIterator.h"
 #include "core/css/CSSVariablesMap.h"
 #include "wtf/Forward.h"
 #include "wtf/Noncopyable.h"
@@ -61,9 +62,10 @@
     PassRefPtr<CSSVariablesMap> var();
     virtual unsigned variableCount() const = 0;
     virtual String variableValue(const AtomicString& name) const = 0;
-    virtual void setVariableValue(const AtomicString& name, const String& value, ExceptionState&) = 0;
+    virtual bool setVariableValue(const AtomicString& name, const String& value, ExceptionState&) = 0; // Return value indicates whether variable was added.
     virtual bool removeVariable(const AtomicString& name) = 0;
-    virtual void clearVariables(ExceptionState&) = 0;
+    virtual bool clearVariables(ExceptionState&) = 0;
+    virtual PassRefPtr<CSSVariablesIterator> variablesIterator() const = 0;
 
     // CSSPropertyID versions of the CSSOM functions to support bindings and editing.
     // Use the non-virtual methods in the concrete subclasses when possible.
diff --git a/Source/core/css/CSSStyleDeclaration.idl b/Source/core/css/CSSStyleDeclaration.idl
index 4f1bdf6..649a579 100644
--- a/Source/core/css/CSSStyleDeclaration.idl
+++ b/Source/core/css/CSSStyleDeclaration.idl
@@ -37,6 +37,6 @@
     [Custom, CustomEnumerateProperty] getter (DOMString or float) (DOMString name);
     [Custom] setter void (DOMString propertyName, [TreatNullAs=NullString] DOMString propertyValue);
     readonly attribute CSSRule          parentRule;
-    [EnabledAtRuntime=CSSVariables] readonly attribute CSSVariablesMap var;
+    [RuntimeEnabled=CSSVariables] readonly attribute CSSVariablesMap var;
 };
 
diff --git a/Source/core/css/CSSTimingFunctionValue.h b/Source/core/css/CSSTimingFunctionValue.h
index 87f2b7a..3f81d6a 100644
--- a/Source/core/css/CSSTimingFunctionValue.h
+++ b/Source/core/css/CSSTimingFunctionValue.h
@@ -63,6 +63,8 @@
     double m_y2;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(CubicBezierTimingFunctionValue);
+
 class CSSStepsTimingFunctionValue : public CSSValue {
 public:
     static PassRefPtr<CSSStepsTimingFunctionValue> create(int steps, bool stepAtStart)
@@ -89,6 +91,8 @@
     bool m_stepAtStart;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(StepsTimingFunctionValue);
+
 } // namespace
 
 #endif
diff --git a/Source/core/css/CSSToStyleMap.cpp b/Source/core/css/CSSToStyleMap.cpp
index 0ccfbf4..4dacaa7 100644
--- a/Source/core/css/CSSToStyleMap.cpp
+++ b/Source/core/css/CSSToStyleMap.cpp
@@ -308,8 +308,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
-    switch (primitiveValue->getValueID()) {
+    switch (toCSSPrimitiveValue(value)->getValueID()) {
     case CSSValueAlpha:
         type = MaskAlpha;
         break;
@@ -335,8 +334,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-    animation->setDelay(primitiveValue->computeTime<double, CSSPrimitiveValue::Seconds>());
+    animation->setDelay(toCSSPrimitiveValue(value)->computeTime<double, CSSPrimitiveValue::Seconds>());
 }
 
 void CSSToStyleMap::mapAnimationDirection(CSSAnimationData* layer, CSSValue* value) const
@@ -349,8 +347,7 @@
     if (!value->isPrimitiveValue())
         return;
 
-    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-    switch (primitiveValue->getValueID()) {
+    switch (toCSSPrimitiveValue(value)->getValueID()) {
     case CSSValueNormal:
         layer->setDirection(CSSAnimationData::AnimationDirectionNormal);
         break;
@@ -522,10 +519,10 @@
     }
 
     if (value->isCubicBezierTimingFunctionValue()) {
-        CSSCubicBezierTimingFunctionValue* cubicTimingFunction = static_cast<CSSCubicBezierTimingFunctionValue*>(value);
+        CSSCubicBezierTimingFunctionValue* cubicTimingFunction = toCSSCubicBezierTimingFunctionValue(value);
         animation->setTimingFunction(CubicBezierTimingFunction::create(cubicTimingFunction->x1(), cubicTimingFunction->y1(), cubicTimingFunction->x2(), cubicTimingFunction->y2()));
     } else if (value->isStepsTimingFunctionValue()) {
-        CSSStepsTimingFunctionValue* stepsTimingFunction = static_cast<CSSStepsTimingFunctionValue*>(value);
+        CSSStepsTimingFunctionValue* stepsTimingFunction = toCSSStepsTimingFunctionValue(value);
         animation->setTimingFunction(StepsTimingFunction::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtStart()));
     }
 }
diff --git a/Source/core/css/CSSTransformValue.h b/Source/core/css/CSSTransformValue.h
index 68c83cb..b37197d 100644
--- a/Source/core/css/CSSTransformValue.h
+++ b/Source/core/css/CSSTransformValue.h
@@ -79,6 +79,8 @@
     TransformOperationType m_type;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(TransformValue);
+
 }
 
 #endif
diff --git a/Source/core/css/CSSUnicodeRangeValue.h b/Source/core/css/CSSUnicodeRangeValue.h
index 91af8ec..03a45cd 100644
--- a/Source/core/css/CSSUnicodeRangeValue.h
+++ b/Source/core/css/CSSUnicodeRangeValue.h
@@ -57,6 +57,8 @@
     UChar32 m_to;
 };
 
+DEFINE_CSS_VALUE_TYPE_CASTS(UnicodeRangeValue);
+
 } // namespace WebCore
 
 #endif // CSSUnicodeRangeValue_h
diff --git a/Source/core/css/CSSValue.cpp b/Source/core/css/CSSValue.cpp
index c32bab7..cd6970f 100644
--- a/Source/core/css/CSSValue.cpp
+++ b/Source/core/css/CSSValue.cpp
@@ -36,6 +36,8 @@
 #include "core/css/CSSCursorImageValue.h"
 #include "core/css/CSSFilterValue.h"
 #include "core/css/CSSFontFaceSrcValue.h"
+#include "core/css/CSSFontFeatureValue.h"
+#include "core/css/CSSFontValue.h"
 #include "core/css/CSSFunctionValue.h"
 #include "core/css/CSSGradientValue.h"
 #include "core/css/CSSGridTemplateValue.h"
@@ -49,14 +51,12 @@
 #include "core/css/CSSReflectValue.h"
 #include "core/css/CSSSVGDocumentValue.h"
 #include "core/css/CSSShaderValue.h"
+#include "core/css/CSSShadowValue.h"
 #include "core/css/CSSTimingFunctionValue.h"
 #include "core/css/CSSTransformValue.h"
 #include "core/css/CSSUnicodeRangeValue.h"
 #include "core/css/CSSValueList.h"
 #include "core/css/CSSVariableValue.h"
-#include "core/css/FontFeatureValue.h"
-#include "core/css/FontValue.h"
-#include "core/css/ShadowValue.h"
 #include "core/svg/SVGColor.h"
 #include "core/svg/SVGPaint.h"
 
@@ -66,7 +66,7 @@
     uint32_t bitfields;
 };
 
-COMPILE_ASSERT(sizeof(CSSValue) == sizeof(SameSizeAsCSSValue), CSS_value_should_stay_small);
+COMPILE_ASSERT(sizeof(CSSValue) <= sizeof(SameSizeAsCSSValue), CSS_value_should_stay_small);
 
 class TextCloneCSSValue : public CSSValue {
 public:
@@ -87,7 +87,7 @@
 
 bool CSSValue::isImplicitInitialValue() const
 {
-    return m_classType == InitialClass && static_cast<const CSSInitialValue*>(this)->isImplicit();
+    return m_classType == InitialClass && toCSSInitialValue(this)->isImplicit();
 }
 
 CSSValue::Type CSSValue::cssValueType() const
@@ -113,9 +113,9 @@
     else if (isValueList())
         toCSSValueList(this)->addSubresourceStyleURLs(urls, styleSheet);
     else if (classType() == FontFaceSrcClass)
-        static_cast<const CSSFontFaceSrcValue*>(this)->addSubresourceStyleURLs(urls, styleSheet);
+        toCSSFontFaceSrcValue(this)->addSubresourceStyleURLs(urls, styleSheet);
     else if (classType() == ReflectClass)
-        static_cast<const CSSReflectValue*>(this)->addSubresourceStyleURLs(urls, styleSheet);
+        toCSSReflectValue(this)->addSubresourceStyleURLs(urls, styleSheet);
 }
 
 bool CSSValue::hasFailedOrCanceledSubresources() const
@@ -126,13 +126,13 @@
     if (isValueList())
         return toCSSValueList(this)->hasFailedOrCanceledSubresources();
     if (classType() == FontFaceSrcClass)
-        return static_cast<const CSSFontFaceSrcValue*>(this)->hasFailedOrCanceledSubresources();
+        return toCSSFontFaceSrcValue(this)->hasFailedOrCanceledSubresources();
     if (classType() == ImageClass)
         return toCSSImageValue(this)->hasFailedOrCanceledSubresources();
     if (classType() == CrossfadeClass)
-        return static_cast<const CSSCrossfadeValue*>(this)->hasFailedOrCanceledSubresources();
+        return toCSSCrossfadeValue(this)->hasFailedOrCanceledSubresources();
     if (classType() == ImageSetClass)
-        return static_cast<const CSSImageSetValue*>(this)->hasFailedOrCanceledSubresources();
+        return toCSSImageSetValue(this)->hasFailedOrCanceledSubresources();
 
     return false;
 }
@@ -161,11 +161,11 @@
         case CursorImageClass:
             return compareCSSValues<CSSCursorImageValue>(*this, other);
         case FontClass:
-            return compareCSSValues<FontValue>(*this, other);
+            return compareCSSValues<CSSFontValue>(*this, other);
         case FontFaceSrcClass:
             return compareCSSValues<CSSFontFaceSrcValue>(*this, other);
         case FontFeatureClass:
-            return compareCSSValues<FontFeatureValue>(*this, other);
+            return compareCSSValues<CSSFontFeatureValue>(*this, other);
         case FunctionClass:
             return compareCSSValues<CSSFunctionValue>(*this, other);
         case LinearGradientClass:
@@ -187,7 +187,7 @@
         case ReflectClass:
             return compareCSSValues<CSSReflectValue>(*this, other);
         case ShadowClass:
-            return compareCSSValues<ShadowValue>(*this, other);
+            return compareCSSValues<CSSShadowValue>(*this, other);
         case CubicBezierTimingFunctionClass:
             return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this, other);
         case StepsTimingFunctionClass:
@@ -241,73 +241,73 @@
 
     switch (classType()) {
     case AspectRatioClass:
-        return static_cast<const CSSAspectRatioValue*>(this)->customCssText();
+        return toCSSAspectRatioValue(this)->customCssText();
     case BorderImageSliceClass:
-        return static_cast<const CSSBorderImageSliceValue*>(this)->customCssText();
+        return toCSSBorderImageSliceValue(this)->customCssText();
     case CanvasClass:
-        return static_cast<const CSSCanvasValue*>(this)->customCssText();
+        return toCSSCanvasValue(this)->customCssText();
     case CursorImageClass:
-        return static_cast<const CSSCursorImageValue*>(this)->customCssText();
+        return toCSSCursorImageValue(this)->customCssText();
     case FontClass:
-        return static_cast<const FontValue*>(this)->customCssText();
+        return toCSSFontValue(this)->customCssText();
     case FontFaceSrcClass:
-        return static_cast<const CSSFontFaceSrcValue*>(this)->customCssText();
+        return toCSSFontFaceSrcValue(this)->customCssText();
     case FontFeatureClass:
-        return static_cast<const FontFeatureValue*>(this)->customCssText();
+        return toCSSFontFeatureValue(this)->customCssText();
     case FunctionClass:
-        return static_cast<const CSSFunctionValue*>(this)->customCssText();
+        return toCSSFunctionValue(this)->customCssText();
     case LinearGradientClass:
-        return static_cast<const CSSLinearGradientValue*>(this)->customCssText();
+        return toCSSLinearGradientValue(this)->customCssText();
     case RadialGradientClass:
-        return static_cast<const CSSRadialGradientValue*>(this)->customCssText();
+        return toCSSRadialGradientValue(this)->customCssText();
     case CrossfadeClass:
-        return static_cast<const CSSCrossfadeValue*>(this)->customCssText();
+        return toCSSCrossfadeValue(this)->customCssText();
     case ImageClass:
         return toCSSImageValue(this)->customCssText();
     case InheritedClass:
-        return static_cast<const CSSInheritedValue*>(this)->customCssText();
+        return toCSSInheritedValue(this)->customCssText();
     case InitialClass:
-        return static_cast<const CSSInitialValue*>(this)->customCssText();
+        return toCSSInitialValue(this)->customCssText();
     case GridTemplateClass:
-        return static_cast<const CSSGridTemplateValue*>(this)->customCssText();
+        return toCSSGridTemplateValue(this)->customCssText();
     case PrimitiveClass:
         return toCSSPrimitiveValue(this)->customCssText();
     case ReflectClass:
-        return static_cast<const CSSReflectValue*>(this)->customCssText();
+        return toCSSReflectValue(this)->customCssText();
     case ShadowClass:
-        return static_cast<const ShadowValue*>(this)->customCssText();
+        return toCSSShadowValue(this)->customCssText();
     case CubicBezierTimingFunctionClass:
-        return static_cast<const CSSCubicBezierTimingFunctionValue*>(this)->customCssText();
+        return toCSSCubicBezierTimingFunctionValue(this)->customCssText();
     case StepsTimingFunctionClass:
-        return static_cast<const CSSStepsTimingFunctionValue*>(this)->customCssText();
+        return toCSSStepsTimingFunctionValue(this)->customCssText();
     case UnicodeRangeClass:
-        return static_cast<const CSSUnicodeRangeValue*>(this)->customCssText();
+        return toCSSUnicodeRangeValue(this)->customCssText();
     case ValueListClass:
         return toCSSValueList(this)->customCssText();
     case CSSTransformClass:
-        return static_cast<const CSSTransformValue*>(this)->customCssText();
+        return toCSSTransformValue(this)->customCssText();
     case LineBoxContainClass:
-        return static_cast<const CSSLineBoxContainValue*>(this)->customCssText();
+        return toCSSLineBoxContainValue(this)->customCssText();
     case CalculationClass:
-        return static_cast<const CSSCalcValue*>(this)->customCssText();
+        return toCSSCalcValue(this)->customCssText();
     case ImageSetClass:
-        return static_cast<const CSSImageSetValue*>(this)->customCssText();
+        return toCSSImageSetValue(this)->customCssText();
     case CSSFilterClass:
-        return static_cast<const CSSFilterValue*>(this)->customCssText();
+        return toCSSFilterValue(this)->customCssText();
     case CSSArrayFunctionValueClass:
-        return static_cast<const CSSArrayFunctionValue*>(this)->customCssText();
+        return toCSSArrayFunctionValue(this)->customCssText();
     case CSSMixFunctionValueClass:
-        return static_cast<const CSSMixFunctionValue*>(this)->customCssText();
+        return toCSSMixFunctionValue(this)->customCssText();
     case CSSShaderClass:
-        return static_cast<const CSSShaderValue*>(this)->customCssText();
+        return toCSSShaderValue(this)->customCssText();
     case VariableClass:
         return toCSSVariableValue(this)->value();
     case SVGColorClass:
-        return static_cast<const SVGColor*>(this)->customCssText();
+        return toSVGColor(this)->customCssText();
     case SVGPaintClass:
-        return static_cast<const SVGPaint*>(this)->customCssText();
+        return toSVGPaint(this)->customCssText();
     case CSSSVGDocumentClass:
-        return static_cast<const CSSSVGDocumentValue*>(this)->customCssText();
+        return toCSSSVGDocumentValue(this)->customCssText();
     }
     ASSERT_NOT_REACHED();
     return String();
@@ -319,11 +319,11 @@
     case PrimitiveClass:
         return toCSSPrimitiveValue(this)->customSerializeResolvingVariables(variables);
     case ReflectClass:
-        return static_cast<const CSSReflectValue*>(this)->customSerializeResolvingVariables(variables);
+        return toCSSReflectValue(this)->customSerializeResolvingVariables(variables);
     case ValueListClass:
         return toCSSValueList(this)->customSerializeResolvingVariables(variables);
     case CSSTransformClass:
-        return static_cast<const CSSTransformValue*>(this)->customSerializeResolvingVariables(variables);
+        return toCSSTransformValue(this)->customSerializeResolvingVariables(variables);
     default:
         return cssText();
     }
@@ -346,43 +346,43 @@
         delete toCSSBorderImageSliceValue(this);
         return;
     case CanvasClass:
-        delete static_cast<CSSCanvasValue*>(this);
+        delete toCSSCanvasValue(this);
         return;
     case CursorImageClass:
-        delete static_cast<CSSCursorImageValue*>(this);
+        delete toCSSCursorImageValue(this);
         return;
     case FontClass:
-        delete static_cast<FontValue*>(this);
+        delete toCSSFontValue(this);
         return;
     case FontFaceSrcClass:
-        delete static_cast<CSSFontFaceSrcValue*>(this);
+        delete toCSSFontFaceSrcValue(this);
         return;
     case FontFeatureClass:
-        delete static_cast<FontFeatureValue*>(this);
+        delete toCSSFontFeatureValue(this);
         return;
     case FunctionClass:
-        delete static_cast<CSSFunctionValue*>(this);
+        delete toCSSFunctionValue(this);
         return;
     case LinearGradientClass:
-        delete static_cast<CSSLinearGradientValue*>(this);
+        delete toCSSLinearGradientValue(this);
         return;
     case RadialGradientClass:
-        delete static_cast<CSSRadialGradientValue*>(this);
+        delete toCSSRadialGradientValue(this);
         return;
     case CrossfadeClass:
-        delete static_cast<CSSCrossfadeValue*>(this);
+        delete toCSSCrossfadeValue(this);
         return;
     case ImageClass:
         delete toCSSImageValue(this);
         return;
     case InheritedClass:
-        delete static_cast<CSSInheritedValue*>(this);
+        delete toCSSInheritedValue(this);
         return;
     case InitialClass:
-        delete static_cast<CSSInitialValue*>(this);
+        delete toCSSInitialValue(this);
         return;
     case GridTemplateClass:
-        delete static_cast<CSSGridTemplateValue*>(this);
+        delete toCSSGridTemplateValue(this);
         return;
     case PrimitiveClass:
         delete toCSSPrimitiveValue(this);
@@ -391,55 +391,55 @@
         delete toCSSReflectValue(this);
         return;
     case ShadowClass:
-        delete static_cast<ShadowValue*>(this);
+        delete toCSSShadowValue(this);
         return;
     case CubicBezierTimingFunctionClass:
-        delete static_cast<CSSCubicBezierTimingFunctionValue*>(this);
+        delete toCSSCubicBezierTimingFunctionValue(this);
         return;
     case StepsTimingFunctionClass:
-        delete static_cast<CSSStepsTimingFunctionValue*>(this);
+        delete toCSSStepsTimingFunctionValue(this);
         return;
     case UnicodeRangeClass:
-        delete static_cast<CSSUnicodeRangeValue*>(this);
+        delete toCSSUnicodeRangeValue(this);
         return;
     case ValueListClass:
         delete toCSSValueList(this);
         return;
     case CSSTransformClass:
-        delete static_cast<CSSTransformValue*>(this);
+        delete toCSSTransformValue(this);
         return;
     case LineBoxContainClass:
-        delete static_cast<CSSLineBoxContainValue*>(this);
+        delete toCSSLineBoxContainValue(this);
         return;
     case CalculationClass:
-        delete static_cast<CSSCalcValue*>(this);
+        delete toCSSCalcValue(this);
         return;
     case ImageSetClass:
         delete toCSSImageSetValue(this);
         return;
     case CSSFilterClass:
-        delete static_cast<CSSFilterValue*>(this);
+        delete toCSSFilterValue(this);
         return;
     case CSSArrayFunctionValueClass:
-        delete static_cast<CSSArrayFunctionValue*>(this);
+        delete toCSSArrayFunctionValue(this);
         return;
     case CSSMixFunctionValueClass:
-        delete static_cast<CSSMixFunctionValue*>(this);
+        delete toCSSMixFunctionValue(this);
         return;
     case CSSShaderClass:
-        delete static_cast<CSSShaderValue*>(this);
+        delete toCSSShaderValue(this);
         return;
     case VariableClass:
         delete toCSSVariableValue(this);
         return;
     case SVGColorClass:
-        delete static_cast<SVGColor*>(this);
+        delete toSVGColor(this);
         return;
     case SVGPaintClass:
-        delete static_cast<SVGPaint*>(this);
+        delete toSVGPaint(this);
         return;
     case CSSSVGDocumentClass:
-        delete static_cast<CSSSVGDocumentValue*>(this);
+        delete toCSSSVGDocumentValue(this);
         return;
     }
     ASSERT_NOT_REACHED();
@@ -456,19 +456,19 @@
     case CursorImageClass:
         return toCSSImageValue(this)->cloneForCSSOM();
     case CSSFilterClass:
-        return static_cast<const CSSFilterValue*>(this)->cloneForCSSOM();
+        return toCSSFilterValue(this)->cloneForCSSOM();
     case CSSArrayFunctionValueClass:
-        return static_cast<const CSSArrayFunctionValue*>(this)->cloneForCSSOM();
+        return toCSSArrayFunctionValue(this)->cloneForCSSOM();
     case CSSMixFunctionValueClass:
-        return static_cast<const CSSMixFunctionValue*>(this)->cloneForCSSOM();
+        return toCSSMixFunctionValue(this)->cloneForCSSOM();
     case CSSTransformClass:
-        return static_cast<const CSSTransformValue*>(this)->cloneForCSSOM();
+        return toCSSTransformValue(this)->cloneForCSSOM();
     case ImageSetClass:
-        return static_cast<const CSSImageSetValue*>(this)->cloneForCSSOM();
+        return toCSSImageSetValue(this)->cloneForCSSOM();
     case SVGColorClass:
-        return static_cast<const SVGColor*>(this)->cloneForCSSOM();
+        return toSVGColor(this)->cloneForCSSOM();
     case SVGPaintClass:
-        return static_cast<const SVGPaint*>(this)->cloneForCSSOM();
+        return toSVGPaint(this)->cloneForCSSOM();
     default:
         ASSERT(!isSubtypeExposedToCSSOM());
         return TextCloneCSSValue::create(classType(), cssText());
diff --git a/Source/core/css/CSSValue.h b/Source/core/css/CSSValue.h
index d62f81e..61532b9 100644
--- a/Source/core/css/CSSValue.h
+++ b/Source/core/css/CSSValue.h
@@ -71,7 +71,9 @@
 
     bool isAspectRatioValue() const { return m_classType == AspectRatioClass; }
     bool isBorderImageSliceValue() const { return m_classType == BorderImageSliceClass; }
+    bool isCanvasValue() const { return m_classType == CanvasClass; }
     bool isCursorImageValue() const { return m_classType == CursorImageClass; }
+    bool isCrossfadeValue() const { return m_classType == CrossfadeClass; }
     bool isFontFeatureValue() const { return m_classType == FontFeatureClass; }
     bool isFontValue() const { return m_classType == FontClass; }
     bool isFontFaceSrcValue() const { return m_classType == FontFaceSrcClass; }
@@ -83,22 +85,25 @@
     bool isImplicitInitialValue() const;
     bool isInheritedValue() const { return m_classType == InheritedClass; }
     bool isInitialValue() const { return m_classType == InitialClass; }
+    bool isLinearGradientValue() const { return m_classType == LinearGradientClass; }
+    bool isRadialGradientValue() const { return m_classType == RadialGradientClass; }
     bool isReflectValue() const { return m_classType == ReflectClass; }
     bool isShadowValue() const { return m_classType == ShadowClass; }
     bool isCubicBezierTimingFunctionValue() const { return m_classType == CubicBezierTimingFunctionClass; }
     bool isStepsTimingFunctionValue() const { return m_classType == StepsTimingFunctionClass; }
-    bool isCSSTransformValue() const { return m_classType == CSSTransformClass; }
-    bool isCSSLineBoxContainValue() const { return m_classType == LineBoxContainClass; }
-    bool isCalculationValue() const {return m_classType == CalculationClass; }
-    bool isCSSFilterValue() const { return m_classType == CSSFilterClass; }
-    bool isCSSArrayFunctionValue() const { return m_classType == CSSArrayFunctionValueClass; }
-    bool isCSSMixFunctionValue() const { return m_classType == CSSMixFunctionValueClass; }
-    bool isCSSShaderValue() const { return m_classType == CSSShaderClass; }
+    bool isTransformValue() const { return m_classType == CSSTransformClass; }
+    bool isLineBoxContainValue() const { return m_classType == LineBoxContainClass; }
+    bool isCalcValue() const {return m_classType == CalculationClass; }
+    bool isFilterValue() const { return m_classType == CSSFilterClass; }
+    bool isArrayFunctionValue() const { return m_classType == CSSArrayFunctionValueClass; }
+    bool isMixFunctionValue() const { return m_classType == CSSMixFunctionValueClass; }
+    bool isShaderValue() const { return m_classType == CSSShaderClass; }
     bool isVariableValue() const { return m_classType == VariableClass; }
     bool isGridTemplateValue() const { return m_classType == GridTemplateClass; }
     bool isSVGColor() const { return m_classType == SVGColorClass || m_classType == SVGPaintClass; }
     bool isSVGPaint() const { return m_classType == SVGPaintClass; }
-    bool isCSSSVGDocumentValue() const { return m_classType == CSSSVGDocumentClass; }
+    bool isSVGDocumentValue() const { return m_classType == CSSSVGDocumentClass; }
+    bool isUnicodeRangeValue() const { return m_classType == UnicodeRangeClass; }
 
     bool isCSSOMSafe() const { return m_isCSSOMSafe; }
     bool isSubtypeExposedToCSSOM() const
diff --git a/Source/core/css/CSSValueKeywords.in b/Source/core/css/CSSValueKeywords.in
index f4bc3ca..41346de 100644
--- a/Source/core/css/CSSValueKeywords.in
+++ b/Source/core/css/CSSValueKeywords.in
@@ -4,7 +4,7 @@
 
 // The mode argument is used to limit the keyword to be used only for certain
 // CSSParserModes. Values that have the prefix -internal- are automatically
-// only for UASheetMode.
+// only for UASheetMode or CSSAttributeMode.
 
 inherit
 initial
@@ -229,6 +229,13 @@
 -webkit-center
 -webkit-match-parent
 //
+// CSS_PROP_TEXT_JUSTIFY:
+//
+//auto
+//none
+inter-word
+distribute
+//
 // CSS_PROP_LIST_STYLE_POSITION:
 //
 outside
@@ -454,6 +461,7 @@
 pre
 pre-line
 pre-wrap
+-internal-presence
 relative
 scroll
 separate
@@ -964,6 +972,9 @@
 // object-fit
 scale-down
 
+// column-fill
+balance
+
 // overflow
 -webkit-paged-x
 -webkit-paged-y
diff --git a/Source/core/css/CSSValuePool.cpp b/Source/core/css/CSSValuePool.cpp
index eaf8555..140dc72 100644
--- a/Source/core/css/CSSValuePool.cpp
+++ b/Source/core/css/CSSValuePool.cpp
@@ -29,6 +29,7 @@
 #include "CSSValueKeywords.h"
 #include "core/css/CSSParser.h"
 #include "core/css/CSSValueList.h"
+#include "core/rendering/style/RenderStyle.h"
 
 namespace WebCore {
 
@@ -115,6 +116,11 @@
     return cache[intValue];
 }
 
+PassRefPtr<CSSPrimitiveValue> CSSValuePool::createValue(const Length& value, const RenderStyle* style)
+{
+    return CSSPrimitiveValue::create(value, style->effectiveZoom());
+}
+
 PassRefPtr<CSSPrimitiveValue> CSSValuePool::createFontFamilyValue(const String& familyName)
 {
     RefPtr<CSSPrimitiveValue>& value = m_fontFamilyValueCache.add(familyName, 0).iterator->value;
diff --git a/Source/core/css/CSSValuePool.h b/Source/core/css/CSSValuePool.h
index ba63c18..02376a0 100644
--- a/Source/core/css/CSSValuePool.h
+++ b/Source/core/css/CSSValuePool.h
@@ -52,7 +52,8 @@
     PassRefPtr<CSSPrimitiveValue> createColorValue(unsigned rgbValue);
     PassRefPtr<CSSPrimitiveValue> createValue(double value, CSSPrimitiveValue::UnitTypes);
     PassRefPtr<CSSPrimitiveValue> createValue(const String& value, CSSPrimitiveValue::UnitTypes type) { return CSSPrimitiveValue::create(value, type); }
-    PassRefPtr<CSSPrimitiveValue> createValue(const Length& value, const RenderStyle* style) { return CSSPrimitiveValue::create(value, style); }
+    PassRefPtr<CSSPrimitiveValue> createValue(const Length& value, const RenderStyle*);
+    PassRefPtr<CSSPrimitiveValue> createValue(const Length& value, float zoom) { return CSSPrimitiveValue::create(value, zoom); }
     template<typename T> static PassRefPtr<CSSPrimitiveValue> createValue(T value) { return CSSPrimitiveValue::create(value); }
 
 private:
diff --git a/Source/core/css/CSSValueTestHelper.h b/Source/core/css/CSSValueTestHelper.h
new file mode 100644
index 0000000..765ea30
--- /dev/null
+++ b/Source/core/css/CSSValueTestHelper.h
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+/**
+ * Make testing with gtest and gmock nicer by adding pretty print and other
+ * helper functions.
+ */
+
+#ifndef CSSValueTestHelper_h
+#define CSSValueTestHelper_h
+
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSValue.h"
+
+#include <iostream>
+
+namespace testing {
+namespace internal {
+
+// gtest tests won't compile with clang when trying to EXPECT_EQ a class that
+// has the "template<typename T> operator T*()" private.
+// (See https://code.google.com/p/googletest/issues/detail?id=442)
+//
+// Work around is to define this custom IsNullLiteralHelper.
+char(&IsNullLiteralHelper(const WebCore::CSSValue&))[2];
+
+}
+}
+
+namespace WebCore {
+
+inline bool operator==(const CSSValue& a, const CSSValue& b)
+{
+    return a.equals(b);
+}
+
+inline void PrintTo(const CSSValue& cssValue, ::std::ostream* os, const char* typeName = "CSSValue")
+{
+    *os << typeName << "(" << cssValue.cssText().utf8().data() << ")";
+}
+
+inline void PrintTo(const CSSPrimitiveValue& cssValue, ::std::ostream* os, const char* typeName = "CSSPrimitiveValue")
+{
+    PrintTo(*static_cast<const CSSValue*>(&cssValue), os, typeName);
+}
+
+}
+
+#endif
diff --git a/Source/core/css/CSSVariableValue.h b/Source/core/css/CSSVariableValue.h
index 5e691e1..54577fb 100644
--- a/Source/core/css/CSSVariableValue.h
+++ b/Source/core/css/CSSVariableValue.h
@@ -59,17 +59,7 @@
     const String m_value;
 };
 
-inline CSSVariableValue* toCSSVariableValue(CSSValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isVariableValue());
-    return static_cast<CSSVariableValue*>(value);
-}
-
-inline const CSSVariableValue* toCSSVariableValue(const CSSValue* value)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isVariableValue());
-    return static_cast<const CSSVariableValue*>(value);
-}
+DEFINE_CSS_VALUE_TYPE_CASTS(VariableValue);
 
 }
 
diff --git a/Source/core/css/CSSVariablesIterator.h b/Source/core/css/CSSVariablesIterator.h
new file mode 100644
index 0000000..edfe3a7
--- /dev/null
+++ b/Source/core/css/CSSVariablesIterator.h
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ *
+ * 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 CSSVariablesIterator_h
+#define CSSVariablesIterator_h
+
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class CSSVariablesIterator : public RefCounted<CSSVariablesIterator> {
+public:
+    virtual ~CSSVariablesIterator() { }
+    virtual void advance() = 0;
+    virtual bool atEnd() const = 0;
+    virtual AtomicString name() const = 0;
+    virtual String value() const = 0;
+    virtual void addedVariable(const AtomicString& name) { }
+    virtual void removedVariable(const AtomicString& name) { }
+    virtual void clearedVariables() { }
+};
+
+}
+
+#endif // CSSVariablesIterator_h
diff --git a/Source/core/css/CSSVariablesMap.cpp b/Source/core/css/CSSVariablesMap.cpp
index 599a9dc..48e67eb 100644
--- a/Source/core/css/CSSVariablesMap.cpp
+++ b/Source/core/css/CSSVariablesMap.cpp
@@ -55,23 +55,68 @@
     return false;
 }
 
-void CSSVariablesMap::set(const AtomicString& name, const String& value, ExceptionState& es) const
+void CSSVariablesMap::set(const AtomicString& name, const String& value, ExceptionState& es)
 {
-    if (m_styleDeclaration)
-        m_styleDeclaration->setVariableValue(name, value, es);
+    if (!m_styleDeclaration)
+        return;
+    if (m_styleDeclaration->setVariableValue(name, value, es)) {
+        Iterators::iterator end = m_activeIterators.end();
+        for (Iterators::iterator it = m_activeIterators.begin(); it != end; ++it)
+            (*it)->addedVariable(name);
+    }
 }
 
-bool CSSVariablesMap::remove(const AtomicString& name) const
+bool CSSVariablesMap::remove(const AtomicString& name)
 {
-    if (m_styleDeclaration)
-        return m_styleDeclaration->removeVariable(name);
+    if (!m_styleDeclaration)
+        return false;
+    if (m_styleDeclaration->removeVariable(name)) {
+        Iterators::iterator end = m_activeIterators.end();
+        for (Iterators::iterator it = m_activeIterators.begin(); it != end; ++it)
+            (*it)->removedVariable(name);
+        return true;
+    }
     return false;
 }
 
-void CSSVariablesMap::clear(ExceptionState& es) const
+void CSSVariablesMap::clear(ExceptionState& es)
 {
-    if (m_styleDeclaration)
-        return m_styleDeclaration->clearVariables(es);
+    if (!m_styleDeclaration)
+        return;
+    if (m_styleDeclaration->clearVariables(es)) {
+        Iterators::iterator end = m_activeIterators.end();
+        for (Iterators::iterator it = m_activeIterators.begin(); it != end; ++it)
+            (*it)->clearedVariables();
+    }
+}
+
+void CSSVariablesMap::forEach(PassRefPtr<CSSVariablesMapForEachCallback> callback, ScriptValue& thisArg) const
+{
+    forEach(callback, &thisArg);
+}
+
+void CSSVariablesMap::forEach(PassRefPtr<CSSVariablesMapForEachCallback> callback) const
+{
+    forEach(callback, 0);
+}
+
+void CSSVariablesMap::forEach(PassRefPtr<CSSVariablesMapForEachCallback> callback, ScriptValue* thisArg) const
+{
+    if (!m_styleDeclaration)
+        return;
+    RefPtr<CSSVariablesIterator> iterator = m_styleDeclaration->variablesIterator();
+    m_activeIterators.append(iterator.get());
+    while (!iterator->atEnd()) {
+        String name = iterator->name();
+        String value = iterator->value();
+        if (thisArg)
+            callback->handleItem(*thisArg, value, name, const_cast<CSSVariablesMap*>(this));
+        else
+            callback->handleItem(value, name, const_cast<CSSVariablesMap*>(this));
+        iterator->advance();
+    }
+    ASSERT(m_activeIterators.last() == iterator.get());
+    m_activeIterators.removeLast();
 }
 
 } // namespace WebCore
diff --git a/Source/core/css/CSSVariablesMap.h b/Source/core/css/CSSVariablesMap.h
index 5c23695..3bd9460 100644
--- a/Source/core/css/CSSVariablesMap.h
+++ b/Source/core/css/CSSVariablesMap.h
@@ -29,12 +29,14 @@
 #define CSSVariablesMap_h
 
 #include "RuntimeEnabledFeatures.h"
+#include "core/css/CSSVariablesMapForEachCallback.h"
 #include "wtf/RefCounted.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
 class CSSStyleDeclaration;
+class CSSVariablesIterator;
 class ExceptionState;
 
 class CSSVariablesMap : public RefCounted<CSSVariablesMap> {
@@ -49,9 +51,11 @@
     unsigned size() const;
     String get(const AtomicString& name) const;
     bool has(const AtomicString& name) const;
-    void set(const AtomicString& name, const String& value, ExceptionState&) const;
-    bool remove(const AtomicString& name) const;
-    void clear(ExceptionState&) const;
+    void set(const AtomicString& name, const String& value, ExceptionState&);
+    bool remove(const AtomicString& name);
+    void clear(ExceptionState&);
+    void forEach(PassRefPtr<CSSVariablesMapForEachCallback>, ScriptValue& thisArg) const;
+    void forEach(PassRefPtr<CSSVariablesMapForEachCallback>) const;
 
     void clearStyleDeclaration() { m_styleDeclaration = 0; }
 
@@ -62,7 +66,11 @@
         ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
     }
 
+    void forEach(PassRefPtr<CSSVariablesMapForEachCallback>, ScriptValue* thisArg) const;
+
     CSSStyleDeclaration* m_styleDeclaration;
+    typedef Vector<CSSVariablesIterator*> Iterators;
+    mutable Iterators m_activeIterators;
 };
 
 } // namespace WebCore
diff --git a/Source/core/css/CSSVariablesMap.idl b/Source/core/css/CSSVariablesMap.idl
index b6ab78a..3c88025 100644
--- a/Source/core/css/CSSVariablesMap.idl
+++ b/Source/core/css/CSSVariablesMap.idl
@@ -32,4 +32,5 @@
     [RaisesException] void set(DOMString name, DOMString value);
     [ImplementedAs=remove] boolean delete(DOMString name);
     [RaisesException] void clear();
+    void forEach(CSSVariablesMapForEachCallback callback, optional any thisArg);
 };
diff --git a/Source/core/css/CSSVariablesMapForEachCallback.h b/Source/core/css/CSSVariablesMapForEachCallback.h
new file mode 100644
index 0000000..bb412bb
--- /dev/null
+++ b/Source/core/css/CSSVariablesMapForEachCallback.h
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ *
+ * 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 CSSVariablesMapForEachCallback_h
+#define CSSVariablesMapForEachCallback_h
+
+#include "bindings/v8/ScriptValue.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class CSSVariablesMap;
+
+class CSSVariablesMapForEachCallback : public RefCounted<CSSVariablesMapForEachCallback> {
+public:
+    virtual ~CSSVariablesMapForEachCallback() { }
+    virtual bool handleItem(ScriptValue thisValue, const String& value, const String& name, CSSVariablesMap*) = 0;
+    virtual bool handleItem(const String& value, const String& name, CSSVariablesMap*) = 0;
+};
+
+} // namespace WebCore
+
+#endif // CSSVariablesMapForEachCallback_h
diff --git a/Source/core/css/CSSVariablesMapForEachCallback.idl b/Source/core/css/CSSVariablesMapForEachCallback.idl
new file mode 100644
index 0000000..d66eb61
--- /dev/null
+++ b/Source/core/css/CSSVariablesMapForEachCallback.idl
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+callback interface CSSVariablesMapForEachCallback {
+    [CallWith=ThisValue] boolean handleItem(DOMString value, DOMString name, CSSVariablesMap map);
+    boolean handleItem(DOMString value, DOMString name, CSSVariablesMap map);
+};
diff --git a/Source/core/css/DocumentRuleSets.cpp b/Source/core/css/DocumentRuleSets.cpp
index 298d23d..00df1c0 100644
--- a/Source/core/css/DocumentRuleSets.cpp
+++ b/Source/core/css/DocumentRuleSets.cpp
@@ -49,12 +49,6 @@
     }
 }
 
-void ShadowDistributedRules::collectMatchRequests(bool includeEmptyRules, Vector<MatchRequest>& matchRequests)
-{
-    for (ShadowDistributedRuleSetMap::iterator it = m_shadowDistributedRuleSetMap.begin(); it != m_shadowDistributedRuleSetMap.end(); ++it)
-        matchRequests.append(MatchRequest(it->value.get(), includeEmptyRules, it->key));
-}
-
 void ShadowDistributedRules::reset(const ContainerNode* scopingNode)
 {
     m_shadowDistributedRuleSetMap.remove(scopingNode);
@@ -74,13 +68,13 @@
 {
 }
 
-void DocumentRuleSets::initUserStyle(StyleEngine* styleSheetCollection, const MediaQueryEvaluator& medium, StyleResolver& resolver)
+void DocumentRuleSets::initUserStyle(StyleEngine* styleSheetCollection, const Vector<RefPtr<StyleRule> >& watchedSelectors, const MediaQueryEvaluator& medium, StyleResolver& resolver)
 {
     OwnPtr<RuleSet> tempUserStyle = RuleSet::create();
     if (CSSStyleSheet* pageUserSheet = styleSheetCollection->pageUserSheet())
         tempUserStyle->addRulesFromSheet(pageUserSheet->contents(), medium, &resolver);
-    collectRulesFromUserStyleSheets(styleSheetCollection->injectedUserStyleSheets(), *tempUserStyle, medium, resolver);
     collectRulesFromUserStyleSheets(styleSheetCollection->documentUserStyleSheets(), *tempUserStyle, medium, resolver);
+    collectRulesFromWatchedSelectors(watchedSelectors, *tempUserStyle);
     if (tempUserStyle->ruleCount() > 0 || tempUserStyle->pageRules().size() > 0)
         m_userStyle = tempUserStyle.release();
 }
@@ -93,6 +87,12 @@
     }
 }
 
+void DocumentRuleSets::collectRulesFromWatchedSelectors(const Vector<RefPtr<StyleRule> >& watchedSelectors, RuleSet& userStyle)
+{
+    for (unsigned i = 0; i < watchedSelectors.size(); ++i)
+        userStyle.addStyleRule(watchedSelectors[i].get(), RuleHasNoSpecialState);
+}
+
 void DocumentRuleSets::resetAuthorStyle()
 {
     m_shadowDistributedRules.clear();
diff --git a/Source/core/css/DocumentRuleSets.h b/Source/core/css/DocumentRuleSets.h
index 4434ec5..3b38ac5 100644
--- a/Source/core/css/DocumentRuleSets.h
+++ b/Source/core/css/DocumentRuleSets.h
@@ -43,12 +43,15 @@
 class ShadowDistributedRules {
 public:
     void addRule(StyleRule*, size_t selectorIndex, ContainerNode* scopingNode, AddRuleFlags);
-    void collectMatchRequests(bool includeEmptyRules, Vector<MatchRequest>&);
     void clear() { m_shadowDistributedRuleSetMap.clear(); }
     void reset(const ContainerNode* scopingNode);
     bool isEmpty() const { return m_shadowDistributedRuleSetMap.isEmpty(); }
     void collectFeaturesTo(RuleFeatureSet&);
 
+    typedef HashMap<const ContainerNode*, OwnPtr<RuleSet> >::iterator iterator;
+    iterator begin() { return m_shadowDistributedRuleSetMap.begin(); }
+    iterator end() { return m_shadowDistributedRuleSetMap.end(); }
+
 private:
     typedef HashMap<const ContainerNode*, OwnPtr<RuleSet> > ShadowDistributedRuleSetMap;
     ShadowDistributedRuleSetMap m_shadowDistributedRuleSetMap;
@@ -60,7 +63,7 @@
     ~DocumentRuleSets();
     RuleSet* userStyle() const { return m_userStyle.get(); }
 
-    void initUserStyle(StyleEngine*, const MediaQueryEvaluator&, StyleResolver&);
+    void initUserStyle(StyleEngine*, const Vector<RefPtr<StyleRule> >& watchedSelectors, const MediaQueryEvaluator&, StyleResolver&);
     void resetAuthorStyle();
     void collectFeaturesTo(RuleFeatureSet&, bool isViewSource);
 
@@ -68,6 +71,7 @@
 
 private:
     void collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&, RuleSet& userStyle, const MediaQueryEvaluator&, StyleResolver&);
+    void collectRulesFromWatchedSelectors(const Vector<RefPtr<StyleRule> >&, RuleSet& userStyle);
     OwnPtr<RuleSet> m_userStyle;
     ShadowDistributedRules m_shadowDistributedRules;
 };
diff --git a/Source/core/css/ElementRuleCollector.cpp b/Source/core/css/ElementRuleCollector.cpp
index 5ccfc77..deff32a 100644
--- a/Source/core/css/ElementRuleCollector.cpp
+++ b/Source/core/css/ElementRuleCollector.cpp
@@ -48,12 +48,15 @@
     , m_regionForStyling(0)
     , m_pseudoStyleRequest(NOPSEUDO)
     , m_mode(SelectorChecker::ResolvingStyle)
-    , m_behaviorAtBoundary(SelectorChecker::DoesNotCrossBoundary)
     , m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(context.parentNode()))
     , m_sameOriginOnly(false)
     , m_matchingUARules(false)
 { }
 
+ElementRuleCollector::~ElementRuleCollector()
+{
+}
+
 MatchResult& ElementRuleCollector::matchedResult()
 {
     return m_result;
@@ -107,7 +110,7 @@
     if (elementApplyAuthorStyles)
         return true;
     // c) the rules comes from a scoped style sheet within the same tree scope
-    if (!scopingNode || &treeScope == &scopingNode->treeScope())
+    if (!scopingNode || treeScope == scopingNode->treeScope())
         return true;
     // d) the rules comes from a scoped style sheet within an active shadow root whose host is the given element
     if (element->isInShadowTree() && (behaviorAtBoundary & SelectorChecker::ScopeIsShadowHost) && scopingNode == element->containingShadowRoot()->host())
@@ -118,7 +121,7 @@
     return false;
 }
 
-void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, RuleRange& ruleRange, CascadeScope cascadeScope, CascadeOrder cascadeOrder)
+void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, RuleRange& ruleRange, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope cascadeScope, CascadeOrder cascadeOrder)
 {
     ASSERT(matchRequest.ruleSet);
     ASSERT(m_context.element());
@@ -127,11 +130,11 @@
     const AtomicString& pseudoId = element->shadowPseudoId();
     if (!pseudoId.isEmpty()) {
         ASSERT(element->isStyledElement());
-        collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId.impl()), ignoreCascadeScope, cascadeOrder, matchRequest, ruleRange);
+        collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId.impl()), behaviorAtBoundary, ignoreCascadeScope, cascadeOrder, matchRequest, ruleRange);
     }
 
     if (element->isWebVTTElement())
-        collectMatchingRulesForList(matchRequest.ruleSet->cuePseudoRules(), cascadeScope, cascadeOrder, matchRequest, ruleRange);
+        collectMatchingRulesForList(matchRequest.ruleSet->cuePseudoRules(), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
     // Check whether other types of rules are applicable in the current tree scope. Criteria for this:
     // a) it's a UA rule
     // b) the tree scope allows author rules
@@ -139,27 +142,27 @@
     // d) the rules comes from a scoped style sheet within an active shadow root whose host is the given element
     // e) the rules can cross boundaries
     // b)-e) is checked in rulesApplicableInCurrentTreeScope.
-    if (!m_matchingUARules && !rulesApplicableInCurrentTreeScope(element, matchRequest.scope, m_behaviorAtBoundary, matchRequest.elementApplyAuthorStyles))
+    if (!m_matchingUARules && !rulesApplicableInCurrentTreeScope(element, matchRequest.scope, behaviorAtBoundary, matchRequest.elementApplyAuthorStyles))
         return;
 
     // We need to collect the rules for id, class, tag, and everything else into a buffer and
     // then sort the buffer.
     if (element->hasID())
-        collectMatchingRulesForList(matchRequest.ruleSet->idRules(element->idForStyleResolution().impl()), cascadeScope, cascadeOrder, matchRequest, ruleRange);
+        collectMatchingRulesForList(matchRequest.ruleSet->idRules(element->idForStyleResolution().impl()), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
     if (element->isStyledElement() && element->hasClass()) {
         for (size_t i = 0; i < element->classNames().size(); ++i)
-            collectMatchingRulesForList(matchRequest.ruleSet->classRules(element->classNames()[i].impl()), cascadeScope, cascadeOrder, matchRequest, ruleRange);
+            collectMatchingRulesForList(matchRequest.ruleSet->classRules(element->classNames()[i].impl()), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
     }
 
     if (element->isLink())
-        collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), cascadeScope, cascadeOrder, matchRequest, ruleRange);
+        collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
     if (SelectorChecker::matchesFocusPseudoClass(element))
-        collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), cascadeScope, cascadeOrder, matchRequest, ruleRange);
-    collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element->localName().impl()), cascadeScope, cascadeOrder, matchRequest, ruleRange);
-    collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), cascadeScope, cascadeOrder, matchRequest, ruleRange);
+        collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
+    collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element->localName().impl()), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
+    collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
 }
 
-void ElementRuleCollector::collectMatchingRulesForRegion(const MatchRequest& matchRequest, RuleRange& ruleRange, CascadeScope cascadeScope, CascadeOrder cascadeOrder)
+void ElementRuleCollector::collectMatchingRulesForRegion(const MatchRequest& matchRequest, RuleRange& ruleRange, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope cascadeScope, CascadeOrder cascadeOrder)
 {
     if (!m_regionForStyling)
         return;
@@ -170,7 +173,7 @@
         if (checkRegionSelector(regionSelector, toElement(m_regionForStyling->node()))) {
             RuleSet* regionRules = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.at(i).ruleSet.get();
             ASSERT(regionRules);
-            collectMatchingRules(MatchRequest(regionRules, matchRequest.includeEmptyRules, matchRequest.scope), ruleRange, cascadeScope, cascadeOrder);
+            collectMatchingRules(MatchRequest(regionRules, matchRequest.includeEmptyRules, matchRequest.scope), ruleRange, behaviorAtBoundary, cascadeScope, cascadeOrder);
         }
     }
 }
@@ -199,9 +202,11 @@
     }
 }
 
-inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const ContainerNode* scope, PseudoId& dynamicPseudo)
+inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const ContainerNode* scope, PseudoId& dynamicPseudo, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary)
 {
-    if (ruleData.hasFastCheckableSelector()) {
+    // They can't match because the fast path uses a pool of tag/class/ids, collected from
+    // elements in that tree and those will never match the host, since it's in a different pool.
+    if (ruleData.hasFastCheckableSelector() && SelectorChecker::isHostInItsShadowTree(m_context.element(), behaviorAtBoundary, scope)) {
         // We know this selector does not include any pseudo elements.
         if (m_pseudoStyleRequest.pseudoId != NOPSEUDO)
             return false;
@@ -221,14 +226,14 @@
     }
 
     // Slow path.
-    SelectorChecker selectorChecker(document(), m_mode);
+    SelectorChecker selectorChecker(m_context.element()->document(), m_mode);
     SelectorChecker::SelectorCheckingContext context(ruleData.selector(), m_context.element(), SelectorChecker::VisitedMatchEnabled);
     context.elementStyle = m_style.get();
     context.scope = scope;
     context.pseudoId = m_pseudoStyleRequest.pseudoId;
     context.scrollbar = m_pseudoStyleRequest.scrollbar;
     context.scrollbarPart = m_pseudoStyleRequest.scrollbarPart;
-    context.behaviorAtBoundary = m_behaviorAtBoundary;
+    context.behaviorAtBoundary = behaviorAtBoundary;
     SelectorChecker::Match match = selectorChecker.match(context, dynamicPseudo, DOMSiblingTraversalStrategy());
     if (match != SelectorChecker::SelectorMatches)
         return false;
@@ -237,14 +242,14 @@
     return true;
 }
 
-void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
+void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
 {
     if (m_canUseFastReject && m_selectorFilter.fastRejectSelector<RuleData::maximumIdentifierCount>(ruleData.descendantSelectorIdentifierHashes()))
         return;
 
     StyleRule* rule = ruleData.rule();
     PseudoId dynamicPseudo = NOPSEUDO;
-    if (ruleMatches(ruleData, matchRequest.scope, dynamicPseudo)) {
+    if (ruleMatches(ruleData, matchRequest.scope, dynamicPseudo, behaviorAtBoundary)) {
         // If the rule has no properties to apply, then ignore it in the non-debug mode.
         const StylePropertySet* properties = rule->properties();
         if (!properties || (properties->isEmpty() && !matchRequest.includeEmptyRules))
@@ -258,7 +263,7 @@
             if (m_mode == SelectorChecker::CollectingRules)
                 return;
             // FIXME: Matching should not modify the style directly.
-            if (dynamicPseudo < FIRST_INTERNAL_PSEUDOID)
+            if (m_style && dynamicPseudo < FIRST_INTERNAL_PSEUDOID)
                 m_style->setHasPseudoStyle(dynamicPseudo);
         } else {
             // Update our first/last rule indices in the matched rules array.
@@ -273,22 +278,22 @@
     }
 }
 
-void ElementRuleCollector::collectMatchingRulesForList(const RuleData* rules, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
+void ElementRuleCollector::collectMatchingRulesForList(const RuleData* rules, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
 {
     if (!rules)
         return;
     while (!rules->isLastInArray())
-        collectRuleIfMatches(*rules++, cascadeScope, cascadeOrder, matchRequest, ruleRange);
-    collectRuleIfMatches(*rules, cascadeScope, cascadeOrder, matchRequest, ruleRange);
+        collectRuleIfMatches(*rules++, behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
+    collectRuleIfMatches(*rules, behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
 }
 
-void ElementRuleCollector::collectMatchingRulesForList(const Vector<RuleData>* rules, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
+void ElementRuleCollector::collectMatchingRulesForList(const Vector<RuleData>* rules, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
 {
     if (!rules)
         return;
     unsigned size = rules->size();
     for (unsigned i = 0; i < size; ++i)
-        collectRuleIfMatches(rules->at(i), cascadeScope, cascadeOrder, matchRequest, ruleRange);
+        collectRuleIfMatches(rules->at(i), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
 }
 
 static inline bool compareRules(const MatchedRule& matchedRule1, const MatchedRule& matchedRule2)
@@ -314,11 +319,10 @@
     // 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;
     RuleRange ruleRange(firstRuleIndex, lastRuleIndex);
     // FIXME: Verify whether it's ok to ignore CascadeScope here.
-    collectMatchingRules(MatchRequest(ruleSet), ruleRange);
+    collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::StaysWithinTreeScope);
 
     return m_matchedRules && !m_matchedRules->isEmpty();
 }
diff --git a/Source/core/css/ElementRuleCollector.h b/Source/core/css/ElementRuleCollector.h
index 60f7abc..bf83216 100644
--- a/Source/core/css/ElementRuleCollector.h
+++ b/Source/core/css/ElementRuleCollector.h
@@ -76,10 +76,9 @@
 class ElementRuleCollector {
     WTF_MAKE_NONCOPYABLE(ElementRuleCollector);
 public:
-    ElementRuleCollector(const ElementResolveContext&, const SelectorFilter&, RenderStyle*);
+    ElementRuleCollector(const ElementResolveContext&, const SelectorFilter&, RenderStyle* = 0);
+    ~ElementRuleCollector();
 
-    void setBehaviorAtBoundary(SelectorChecker::BehaviorAtBoundary boundary) { m_behaviorAtBoundary = boundary; }
-    SelectorChecker::BehaviorAtBoundary behaviorAtBoundary() const { return m_behaviorAtBoundary; }
     void setCanUseFastReject(bool canUseFastReject) { m_canUseFastReject = canUseFastReject; }
     bool canUseFastReject() const { return m_canUseFastReject; }
 
@@ -94,8 +93,8 @@
     MatchResult& matchedResult();
     PassRefPtr<CSSRuleList> matchedRuleList();
 
-    void collectMatchingRules(const MatchRequest&, RuleRange&, CascadeScope = ignoreCascadeScope, CascadeOrder = ignoreCascadeOrder);
-    void collectMatchingRulesForRegion(const MatchRequest&, RuleRange&, CascadeScope = ignoreCascadeScope, CascadeOrder = ignoreCascadeOrder);
+    void collectMatchingRules(const MatchRequest&, RuleRange&, SelectorChecker::BehaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary, CascadeScope = ignoreCascadeScope, CascadeOrder = ignoreCascadeOrder);
+    void collectMatchingRulesForRegion(const MatchRequest&, RuleRange&, SelectorChecker::BehaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary, CascadeScope = ignoreCascadeScope, CascadeOrder = ignoreCascadeOrder);
     void sortAndTransferMatchedRules();
     void clearMatchedRules();
     void addElementStyleProperties(const StylePropertySet*, bool isCacheable = true);
@@ -105,12 +104,10 @@
     void sortAndTransferMatchedRulesWithOnlySortBySpecificity();
 
 private:
-    Document& document() { return m_context.document(); }
-
-    void collectRuleIfMatches(const RuleData&, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&);
-    void collectMatchingRulesForList(const Vector<RuleData>*, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&);
-    void collectMatchingRulesForList(const RuleData*, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&);
-    bool ruleMatches(const RuleData&, const ContainerNode* scope, PseudoId&);
+    void collectRuleIfMatches(const RuleData&, SelectorChecker::BehaviorAtBoundary, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&);
+    void collectMatchingRulesForList(const Vector<RuleData>*, SelectorChecker::BehaviorAtBoundary, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&);
+    void collectMatchingRulesForList(const RuleData*, SelectorChecker::BehaviorAtBoundary, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&);
+    bool ruleMatches(const RuleData&, const ContainerNode* scope, PseudoId&, SelectorChecker::BehaviorAtBoundary);
 
     void sortMatchedRules();
     void addMatchedRule(const RuleData*, CascadeScope, CascadeOrder);
@@ -125,7 +122,6 @@
     const RenderRegion* m_regionForStyling;
     PseudoStyleRequest m_pseudoStyleRequest;
     SelectorChecker::Mode m_mode;
-    SelectorChecker::BehaviorAtBoundary m_behaviorAtBoundary;
     bool m_canUseFastReject;
     bool m_sameOriginOnly;
     bool m_matchingUARules;
diff --git a/Source/core/css/FontFace.cpp b/Source/core/css/FontFace.cpp
index 98a3f07..b462bb1 100644
--- a/Source/core/css/FontFace.cpp
+++ b/Source/core/css/FontFace.cpp
@@ -45,7 +45,7 @@
 #include "core/css/StylePropertySet.h"
 #include "core/css/StyleRule.h"
 #include "core/dom/Document.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
 #include "core/platform/graphics/FontTraitsMask.h"
 #include "core/svg/SVGFontFaceElement.h"
@@ -412,7 +412,7 @@
 
     for (int i = 0; i < srcLength; i++) {
         // An item in the list either specifies a string (local font name) or a URL (remote font to download).
-        CSSFontFaceSrcValue* item = static_cast<CSSFontFaceSrcValue*>(srcList->itemWithoutBoundsCheck(i));
+        CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->itemWithoutBoundsCheck(i));
         OwnPtr<CSSFontFaceSource> source;
 
 #if ENABLE(SVG_FONTS)
@@ -446,8 +446,8 @@
     if (CSSValueList* rangeList = toCSSValueList(m_unicodeRange.get())) {
         unsigned numRanges = rangeList->length();
         for (unsigned i = 0; i < numRanges; i++) {
-            CSSUnicodeRangeValue* range = static_cast<CSSUnicodeRangeValue*>(rangeList->itemWithoutBoundsCheck(i));
-            cssFontFace->addRange(range->from(), range->to());
+            CSSUnicodeRangeValue* range = toCSSUnicodeRangeValue(rangeList->itemWithoutBoundsCheck(i));
+            cssFontFace->ranges().add(range->from(), range->to());
         }
     }
     return cssFontFace;
diff --git a/Source/core/css/FontFace.idl b/Source/core/css/FontFace.idl
index a66872b..874872f 100644
--- a/Source/core/css/FontFace.idl
+++ b/Source/core/css/FontFace.idl
@@ -36,7 +36,7 @@
 };
 
 [
-    EnabledAtRuntime=FontLoadEvents,
+    RuntimeEnabled=FontLoadEvents,
     Constructor(DOMString family, DOMString source, Dictionary descriptors),
     ConstructorRaisesException
 ] interface FontFace {
diff --git a/Source/core/css/FontFaceSet.cpp b/Source/core/css/FontFaceSet.cpp
index d241d24..b593895 100644
--- a/Source/core/css/FontFaceSet.cpp
+++ b/Source/core/css/FontFaceSet.cpp
@@ -40,7 +40,7 @@
 #include "core/css/StylePropertySet.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/Document.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/platform/HistogramSupport.h"
 
 namespace WebCore {
@@ -50,7 +50,7 @@
 
 class LoadFontPromiseResolver : public CSSSegmentedFontFace::LoadFontCallback {
 public:
-    static PassRefPtr<LoadFontPromiseResolver> create(const FontFamily& family, ScriptExecutionContext* context)
+    static PassRefPtr<LoadFontPromiseResolver> create(const FontFamily& family, ExecutionContext* context)
     {
         int numFamilies = 0;
         for (const FontFamily* f = &family; f; f = f->next())
@@ -72,7 +72,7 @@
     }
 
 private:
-    LoadFontPromiseResolver(int numLoading, ScriptExecutionContext* context)
+    LoadFontPromiseResolver(int numLoading, ExecutionContext* context)
         : m_numLoading(numLoading)
         , m_errorOccured(false)
         , m_scriptState(ScriptState::current())
@@ -121,7 +121,7 @@
 
 class FontsReadyPromiseResolver {
 public:
-    static PassOwnPtr<FontsReadyPromiseResolver> create(ScriptExecutionContext* context)
+    static PassOwnPtr<FontsReadyPromiseResolver> create(ExecutionContext* context)
     {
         return adoptPtr(new FontsReadyPromiseResolver(context));
     }
@@ -140,7 +140,7 @@
     }
 
 private:
-    FontsReadyPromiseResolver(ScriptExecutionContext* context)
+    FontsReadyPromiseResolver(ExecutionContext* context)
         : m_scriptState(ScriptState::current())
         , m_resolver(ScriptPromiseResolver::create(context))
     { }
@@ -163,27 +163,17 @@
 
 Document* FontFaceSet::document() const
 {
-    return toDocument(scriptExecutionContext());
-}
-
-EventTargetData* FontFaceSet::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* FontFaceSet::ensureEventTargetData()
-{
-    return &m_eventTargetData;
+    return toDocument(executionContext());
 }
 
 const AtomicString& FontFaceSet::interfaceName() const
 {
-    return eventNames().interfaceForFontFaceSet;
+    return EventTargetNames::FontFaceSet;
 }
 
-ScriptExecutionContext* FontFaceSet::scriptExecutionContext() const
+ExecutionContext* FontFaceSet::executionContext() const
 {
-    return ActiveDOMObject::scriptExecutionContext();
+    return ActiveDOMObject::executionContext();
 }
 
 AtomicString FontFaceSet::status() const
@@ -257,7 +247,7 @@
 
     ++m_loadingCount;
     if (m_loadingCount == 1 && !m_shouldFireDoneEvent)
-        scheduleEvent(CSSFontFaceLoadEvent::createForFontFaces(eventNames().loadingEvent));
+        scheduleEvent(CSSFontFaceLoadEvent::createForFontFaces(EventTypeNames::loading));
     m_shouldFireDoneEvent = false;
 }
 
@@ -291,7 +281,7 @@
 
 ScriptPromise FontFaceSet::ready()
 {
-    OwnPtr<FontsReadyPromiseResolver> resolver = FontsReadyPromiseResolver::create(scriptExecutionContext());
+    OwnPtr<FontsReadyPromiseResolver> resolver = FontsReadyPromiseResolver::create(executionContext());
     ScriptPromise promise = resolver->promise();
     m_readyResolvers.append(resolver.release());
     if (!m_timer.isActive())
@@ -317,10 +307,10 @@
         m_shouldFireDoneEvent = false;
         RefPtr<CSSFontFaceLoadEvent> doneEvent;
         RefPtr<CSSFontFaceLoadEvent> errorEvent;
-        doneEvent = CSSFontFaceLoadEvent::createForFontFaces(eventNames().loadingdoneEvent, m_loadedFonts);
+        doneEvent = CSSFontFaceLoadEvent::createForFontFaces(EventTypeNames::loadingdone, m_loadedFonts);
         m_loadedFonts.clear();
         if (!m_failedFonts.isEmpty()) {
-            errorEvent = CSSFontFaceLoadEvent::createForFontFaces(eventNames().loadingerrorEvent, m_failedFonts);
+            errorEvent = CSSFontFaceLoadEvent::createForFontFaces(EventTypeNames::loadingerror, m_failedFonts);
             m_failedFonts.clear();
         }
         dispatchEvent(doneEvent);
@@ -336,9 +326,14 @@
     }
 }
 
-Vector<RefPtr<FontFace> > FontFaceSet::match(const String& fontString, const String&, ExceptionState& es)
+static const String& nullToSpace(const String& s)
 {
-    // FIXME: The second parameter (text) is ignored.
+    DEFINE_STATIC_LOCAL(String, space, (" "));
+    return s.isNull() ? space : s;
+}
+
+Vector<RefPtr<FontFace> > FontFaceSet::match(const String& fontString, const String& text, ExceptionState& es)
+{
     Vector<RefPtr<FontFace> > matchedFonts;
 
     Font font;
@@ -350,14 +345,13 @@
     for (const FontFamily* f = &font.family(); f; f = f->next()) {
         CSSSegmentedFontFace* face = document()->styleResolver()->fontSelector()->getFontFace(font.fontDescription(), f->family());
         if (face)
-            matchedFonts.append(face->fontFaces());
+            matchedFonts.append(face->fontFaces(nullToSpace(text)));
     }
     return matchedFonts;
 }
 
-ScriptPromise FontFaceSet::load(const String& fontString, const String&, ExceptionState& es)
+ScriptPromise FontFaceSet::load(const String& fontString, const String& text, ExceptionState& es)
 {
-    // FIXME: The second parameter (text) is ignored.
     Font font;
     if (!resolveFontStyle(fontString, font)) {
         es.throwUninformativeAndGenericDOMException(SyntaxError);
@@ -365,21 +359,20 @@
     }
 
     Document* d = document();
-    RefPtr<LoadFontPromiseResolver> resolver = LoadFontPromiseResolver::create(font.family(), scriptExecutionContext());
+    RefPtr<LoadFontPromiseResolver> resolver = LoadFontPromiseResolver::create(font.family(), executionContext());
     for (const FontFamily* f = &font.family(); f; f = f->next()) {
         CSSSegmentedFontFace* face = d->styleResolver()->fontSelector()->getFontFace(font.fontDescription(), f->family());
         if (!face) {
             resolver->error(d);
             continue;
         }
-        face->loadFont(font.fontDescription(), resolver);
+        face->loadFont(font.fontDescription(), nullToSpace(text), resolver);
     }
     return resolver->promise();
 }
 
-bool FontFaceSet::check(const String& fontString, const String&, ExceptionState& es)
+bool FontFaceSet::check(const String& fontString, const String& text, ExceptionState& es)
 {
-    // FIXME: The second parameter (text) is ignored.
     Font font;
     if (!resolveFontStyle(fontString, font)) {
         es.throwUninformativeAndGenericDOMException(SyntaxError);
@@ -388,7 +381,7 @@
 
     for (const FontFamily* f = &font.family(); f; f = f->next()) {
         CSSSegmentedFontFace* face = document()->styleResolver()->fontSelector()->getFontFace(font.fontDescription(), f->family());
-        if (!face || !face->checkFont())
+        if (!face || !face->checkFont(nullToSpace(text)))
             return false;
     }
     return true;
diff --git a/Source/core/css/FontFaceSet.h b/Source/core/css/FontFaceSet.h
index 11ad874..10ca084 100644
--- a/Source/core/css/FontFaceSet.h
+++ b/Source/core/css/FontFaceSet.h
@@ -30,9 +30,9 @@
 #include "core/css/FontFace.h"
 #include "core/dom/ActiveDOMObject.h"
 #include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
 #include "core/events/EventTarget.h"
-#include "core/platform/Timer.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "platform/Timer.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/Vector.h"
@@ -53,9 +53,9 @@
 class FontResource;
 class FontsReadyPromiseResolver;
 class LoadFontPromiseResolver;
-class ScriptExecutionContext;
+class ExecutionContext;
 
-class FontFaceSet : public RefCounted<FontFaceSet>, public ActiveDOMObject, public EventTarget {
+class FontFaceSet : public RefCounted<FontFaceSet>, public ActiveDOMObject, public EventTargetWithInlineData {
 public:
     static PassRefPtr<FontFaceSet> create(Document* document)
     {
@@ -74,8 +74,8 @@
 
     AtomicString status() const;
 
-    virtual ScriptExecutionContext* scriptExecutionContext() const;
-    virtual const AtomicString& interfaceName() const;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
+    virtual const AtomicString& interfaceName() const OVERRIDE;
 
     using RefCounted<FontFaceSet>::ref;
     using RefCounted<FontFaceSet>::deref;
@@ -102,10 +102,8 @@
 
     FontFaceSet(Document*);
 
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
-    virtual EventTargetData* eventTargetData();
-    virtual EventTargetData* ensureEventTargetData();
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
 
     void scheduleEvent(PassRefPtr<Event>);
     void queueDoneEvent(FontFace*);
@@ -115,7 +113,6 @@
     bool resolveFontStyle(const String&, Font&);
     void timerFired(Timer<FontFaceSet>*);
 
-    EventTargetData m_eventTargetData;
     unsigned m_loadingCount;
     Vector<RefPtr<Event> > m_pendingEvents;
     Vector<RefPtr<LoadFontPromiseResolver> > m_pendingLoadResolvers;
diff --git a/Source/core/css/FontFaceSet.idl b/Source/core/css/FontFaceSet.idl
index 9fe5d56..da6a824 100644
--- a/Source/core/css/FontFaceSet.idl
+++ b/Source/core/css/FontFaceSet.idl
@@ -32,7 +32,7 @@
 
 [
     NoInterfaceObject,
-    EnabledAtRuntime=FontLoadEvents,
+    RuntimeEnabled=FontLoadEvents,
     ActiveDOMObject,
     GenerateIsReachable=document
 ] interface FontFaceSet : EventTarget {
@@ -43,8 +43,8 @@
 
     [RaisesException] sequence<FontFace> match(DOMString font, [Default=NullString] optional DOMString text);
     [RaisesException] boolean check(DOMString font, [Default=NullString] optional DOMString text);
-    [EnabledAtRuntime=Promise, RaisesException] Promise load(DOMString font, [Default=NullString] optional DOMString text);
-    [EnabledAtRuntime=Promise] Promise ready();
+    [RuntimeEnabled=Promise, RaisesException] Promise load(DOMString font, [Default=NullString] optional DOMString text);
+    [RuntimeEnabled=Promise] Promise ready();
 
     readonly attribute FontFaceSetLoadStatus status;
 };
diff --git a/Source/core/css/FontFeatureValue.cpp b/Source/core/css/FontFeatureValue.cpp
deleted file mode 100644
index 37c93da..0000000
--- a/Source/core/css/FontFeatureValue.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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,
- * 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/css/FontFeatureValue.h"
-
-#include "wtf/text/StringBuilder.h"
-
-namespace WebCore {
-
-FontFeatureValue::FontFeatureValue(const String& tag, int value)
-    : CSSValue(FontFeatureClass)
-    , m_tag(tag)
-    , m_value(value)
-{
-}
-
-String FontFeatureValue::customCssText() const
-{
-    StringBuilder builder;
-    builder.append('\'');
-    builder.append(m_tag);
-    builder.appendLiteral("' ");
-    builder.appendNumber(m_value);
-    return builder.toString();
-}
-
-bool FontFeatureValue::equals(const FontFeatureValue& other) const
-{
-    return m_tag == other.m_tag && m_value == other.m_value;
-}
-
-}
diff --git a/Source/core/css/FontFeatureValue.h b/Source/core/css/FontFeatureValue.h
deleted file mode 100644
index 4aa3345..0000000
--- a/Source/core/css/FontFeatureValue.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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,
- * 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 FontFeatureValue_h
-#define FontFeatureValue_h
-
-#include "core/css/CSSValue.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class FontFeatureValue : public CSSValue {
-public:
-    static PassRefPtr<FontFeatureValue> create(const String& tag, int value)
-    {
-        return adoptRef(new FontFeatureValue(tag, value));
-    }
-
-    const String& tag() const { return m_tag; }
-    int value() const { return m_value; }
-    String customCssText() const;
-
-    bool equals(const FontFeatureValue&) const;
-
-private:
-    FontFeatureValue(const String&, int);
-
-    String m_tag;
-    const int m_value;
-};
-
-} // namespace
-
-#endif
diff --git a/Source/core/css/FontValue.cpp b/Source/core/css/FontValue.cpp
deleted file mode 100644
index 5537183..0000000
--- a/Source/core/css/FontValue.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "config.h"
-#include "core/css/FontValue.h"
-
-#include "core/css/CSSPrimitiveValue.h"
-#include "core/css/CSSValueList.h"
-#include "wtf/text/StringBuilder.h"
-
-namespace WebCore {
-
-String FontValue::customCssText() const
-{
-    // font variant weight size / line-height family
-
-    StringBuilder result;
-
-    if (style)
-        result.append(style->cssText());
-    if (variant) {
-        if (!result.isEmpty())
-            result.append(' ');
-        result.append(variant->cssText());
-    }
-    if (weight) {
-        if (!result.isEmpty())
-            result.append(' ');
-        result.append(weight->cssText());
-    }
-    if (size) {
-        if (!result.isEmpty())
-            result.append(' ');
-        result.append(size->cssText());
-    }
-    if (lineHeight) {
-        if (!size)
-            result.append(' ');
-        result.append('/');
-        result.append(lineHeight->cssText());
-    }
-    if (family) {
-        if (!result.isEmpty())
-            result.append(' ');
-        result.append(family->cssText());
-    }
-
-    return result.toString();
-}
-
-bool FontValue::equals(const FontValue& other) const
-{
-    return compareCSSValuePtr(style, other.style)
-        && compareCSSValuePtr(variant, other.variant)
-        && compareCSSValuePtr(weight, other.weight)
-        && compareCSSValuePtr(size, other.size)
-        && compareCSSValuePtr(lineHeight, other.lineHeight)
-        && compareCSSValuePtr(family, other.family);
-}
-
-}
diff --git a/Source/core/css/FontValue.h b/Source/core/css/FontValue.h
deleted file mode 100644
index df8f9a7..0000000
--- a/Source/core/css/FontValue.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef FontValue_h
-#define FontValue_h
-
-#include "core/css/CSSValue.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class CSSPrimitiveValue;
-class CSSValueList;
-
-class FontValue : public CSSValue {
-public:
-    static PassRefPtr<FontValue> create()
-    {
-        return adoptRef(new FontValue);
-    }
-
-    String customCssText() const;
-
-    bool equals(const FontValue&) const;
-
-    RefPtr<CSSPrimitiveValue> style;
-    RefPtr<CSSPrimitiveValue> variant;
-    RefPtr<CSSPrimitiveValue> weight;
-    RefPtr<CSSPrimitiveValue> size;
-    RefPtr<CSSPrimitiveValue> lineHeight;
-    RefPtr<CSSValueList> family;
-
-private:
-    FontValue()
-        : CSSValue(FontClass)
-    {
-    }
-};
-
-} // namespace
-
-#endif
diff --git a/Source/core/css/InspectorCSSOMWrappers.cpp b/Source/core/css/InspectorCSSOMWrappers.cpp
index 595d22c..324c012 100644
--- a/Source/core/css/InspectorCSSOMWrappers.cpp
+++ b/Source/core/css/InspectorCSSOMWrappers.cpp
@@ -107,7 +107,6 @@
 {
     collectFromStyleSheets(styleSheetCollection->activeAuthorStyleSheets());
     collect(styleSheetCollection->pageUserSheet());
-    collectFromStyleSheets(styleSheetCollection->injectedUserStyleSheets());
     collectFromStyleSheets(styleSheetCollection->documentUserStyleSheets());
 }
 
diff --git a/Source/core/css/LengthFunctions.cpp b/Source/core/css/LengthFunctions.cpp
index 3a91ce2..be2dfc9 100644
--- a/Source/core/css/LengthFunctions.cpp
+++ b/Source/core/css/LengthFunctions.cpp
@@ -24,9 +24,9 @@
 #include "config.h"
 #include "core/css/LengthFunctions.h"
 
-#include "core/platform/LayoutUnit.h"
 #include "core/platform/Length.h"
 #include "core/rendering/RenderView.h"
+#include "platform/LayoutUnit.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/MediaList.cpp b/Source/core/css/MediaList.cpp
index fdc4b36..ce88391 100644
--- a/Source/core/css/MediaList.cpp
+++ b/Source/core/css/MediaList.cpp
@@ -28,7 +28,7 @@
 #include "core/css/MediaQueryExp.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 #include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
diff --git a/Source/core/css/MediaQueryEvaluator.cpp b/Source/core/css/MediaQueryEvaluator.cpp
index 01800e4..7c6320a 100644
--- a/Source/core/css/MediaQueryEvaluator.cpp
+++ b/Source/core/css/MediaQueryEvaluator.cpp
@@ -37,18 +37,18 @@
 #include "core/css/MediaFeatureNames.h"
 #include "core/css/MediaList.h"
 #include "core/css/MediaQuery.h"
-#include "core/css/MediaQueryExp.h"
-#include "core/css/resolver/StyleResolver.h"
+#include "core/css/resolver/MediaQueryResult.h"
 #include "core/dom/NodeRenderStyle.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/PlatformScreen.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/style/RenderStyle.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/HashMap.h"
 
 namespace WebCore {
@@ -117,7 +117,7 @@
     return r == MediaQuery::Not ? !value : value;
 }
 
-bool MediaQueryEvaluator::eval(const MediaQuerySet* querySet, StyleResolver* styleResolver) const
+bool MediaQueryEvaluator::eval(const MediaQuerySet* querySet, MediaQueryResultList* viewportDependentMediaQueryResults) const
 {
     if (!querySet)
         return true;
@@ -137,11 +137,8 @@
             size_t j = 0;
             for (; j < expressions.size(); ++j) {
                 bool exprResult = eval(expressions.at(j).get());
-                // FIXME: Instead of storing these on StyleResolver, we should store them locally
-                // and then any client of this method can grab at them afterwords.
-                // Alternatively we could use an explicit out-parameter of this method.
-                if (styleResolver && expressions.at(j)->isViewportDependent())
-                    styleResolver->addViewportDependentMediaQueryResult(expressions.at(j).get(), exprResult);
+                if (viewportDependentMediaQueryResults && expressions.at(j)->isViewportDependent())
+                    viewportDependentMediaQueryResults->append(adoptPtr(new MediaQueryResult(*expressions.at(j), exprResult)));
                 if (!exprResult)
                     break;
             }
@@ -360,11 +357,13 @@
 static bool deviceHeightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
-        FloatRect sg = screenRect(frame->page()->mainFrame()->view());
         int length;
-        long height = sg.height();
-        InspectorInstrumentation::applyScreenHeightOverride(frame, &height);
-        return computeLength(value, !frame->document()->inQuirksMode(), style, length) && compareValue(static_cast<int>(height), length, op);
+        if (!computeLength(value, !frame->document()->inQuirksMode(), style, length))
+            return false;
+        int height = static_cast<int>(screenRect(frame->page()->mainFrame()->view()).height());
+        if (frame->settings()->reportScreenSizeInPhysicalPixelsQuirk())
+            height = lroundf(height * frame->page()->deviceScaleFactor());
+        return compareValue(height, length, op);
     }
     // ({,min-,max-}device-height)
     // assume if we have a device, assume non-zero
@@ -374,11 +373,13 @@
 static bool deviceWidthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
 {
     if (value) {
-        FloatRect sg = screenRect(frame->page()->mainFrame()->view());
         int length;
-        long width = sg.width();
-        InspectorInstrumentation::applyScreenWidthOverride(frame, &width);
-        return computeLength(value, !frame->document()->inQuirksMode(), style, length) && compareValue(static_cast<int>(width), length, op);
+        if (!computeLength(value, !frame->document()->inQuirksMode(), style, length))
+            return false;
+        int width = static_cast<int>(screenRect(frame->page()->mainFrame()->view()).width());
+        if (frame->settings()->reportScreenSizeInPhysicalPixelsQuirk())
+            width = lroundf(width * frame->page()->deviceScaleFactor());
+        return compareValue(width, length, op);
     }
     // ({,min-,max-}device-width)
     // assume if we have a device, assume non-zero
diff --git a/Source/core/css/MediaQueryEvaluator.h b/Source/core/css/MediaQueryEvaluator.h
index eb67ac7..c663d12 100644
--- a/Source/core/css/MediaQueryEvaluator.h
+++ b/Source/core/css/MediaQueryEvaluator.h
@@ -33,9 +33,9 @@
 namespace WebCore {
 class Frame;
 class MediaQueryExp;
+class MediaQueryResult;
 class MediaQuerySet;
 class RenderStyle;
-class StyleResolver;
 
 /**
  * Class that evaluates css media queries as defined in
@@ -73,8 +73,9 @@
     bool mediaTypeMatch(const AtomicString& mediaTypeToMatch) const;
     bool mediaTypeMatchSpecific(const char* mediaTypeToMatch) const;
 
+    typedef Vector<OwnPtr<MediaQueryResult> > MediaQueryResultList;
     /** Evaluates a list of media queries */
-    bool eval(const MediaQuerySet*, StyleResolver* = 0) const;
+    bool eval(const MediaQuerySet*, MediaQueryResultList* = 0) const;
 
     /** Evaluates media query subexpression, ie "and (media-feature: value)" part */
     bool eval(const MediaQueryExp*) const;
diff --git a/Source/core/css/MediaQueryMatcher.cpp b/Source/core/css/MediaQueryMatcher.cpp
index 1d16128..3d50338 100644
--- a/Source/core/css/MediaQueryMatcher.cpp
+++ b/Source/core/css/MediaQueryMatcher.cpp
@@ -26,8 +26,8 @@
 #include "core/css/MediaQueryListListener.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/Document.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/PageRuleCollector.cpp b/Source/core/css/PageRuleCollector.cpp
index 65c409e..e449452 100644
--- a/Source/core/css/PageRuleCollector.cpp
+++ b/Source/core/css/PageRuleCollector.cpp
@@ -40,10 +40,11 @@
     return r1->selector()->specificity() < r2->selector()->specificity();
 }
 
-bool PageRuleCollector::isLeftPage(int pageIndex) const
+bool PageRuleCollector::isLeftPage(const RenderStyle* rootElementStyle, int pageIndex) const
 {
     bool isFirstPageLeft = false;
-    if (!m_context.rootElementStyle() || !m_context.rootElementStyle()->isLeftToRightDirection())
+    ASSERT(rootElementStyle);
+    if (!rootElementStyle->isLeftToRightDirection())
         isFirstPageLeft = true;
 
     return (pageIndex + (isFirstPageLeft ? 1 : 0)) % 2;
@@ -61,9 +62,8 @@
     return "";
 }
 
-PageRuleCollector::PageRuleCollector(const ElementResolveContext& context, int pageIndex)
-    : m_context(context)
-    , m_isLeftPage(isLeftPage(pageIndex))
+PageRuleCollector::PageRuleCollector(const RenderStyle* rootElementStyle, int pageIndex)
+    : m_isLeftPage(isLeftPage(rootElementStyle, pageIndex))
     , m_isFirstPage(isFirstPage(pageIndex))
     , m_pageName(pageName(pageIndex)) { }
 
diff --git a/Source/core/css/PageRuleCollector.h b/Source/core/css/PageRuleCollector.h
index 296ee6f..8325161 100644
--- a/Source/core/css/PageRuleCollector.h
+++ b/Source/core/css/PageRuleCollector.h
@@ -32,20 +32,19 @@
 
 class PageRuleCollector {
 public:
-    PageRuleCollector(const ElementResolveContext&, int pageIndex);
+    PageRuleCollector(const RenderStyle* rootElementStyle, int pageIndex);
 
     void matchPageRules(RuleSet* rules);
     MatchResult& matchedResult() { return m_result; }
 
 private:
-    bool isLeftPage(int pageIndex) const;
-    bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); }
+    bool isLeftPage(const RenderStyle* rootElementStyle, int pageIndex) const;
+    bool isRightPage(const RenderStyle* rootElementStyle, int pageIndex) const { return !isLeftPage(rootElementStyle, pageIndex); }
     bool isFirstPage(int pageIndex) const;
     String pageName(int pageIndex) const;
 
     void matchPageRulesForList(Vector<StyleRulePage*>& matchedRules, const Vector<StyleRulePage*>& rules, bool isLeftPage, bool isFirstPage, const String& pageName);
 
-    const ElementResolveContext& m_context;
     const bool m_isLeftPage;
     const bool m_isFirstPage;
     const String m_pageName;
diff --git a/Source/core/css/PropertySetCSSStyleDeclaration.cpp b/Source/core/css/PropertySetCSSStyleDeclaration.cpp
index 900dc36..88f93c1 100644
--- a/Source/core/css/PropertySetCSSStyleDeclaration.cpp
+++ b/Source/core/css/PropertySetCSSStyleDeclaration.cpp
@@ -281,7 +281,7 @@
     return m_propertySet->variableValue(name);
 }
 
-void PropertySetCSSStyleDeclaration::setVariableValue(const AtomicString& name, const String& value, ExceptionState&)
+bool PropertySetCSSStyleDeclaration::setVariableValue(const AtomicString& name, const String& value, ExceptionState&)
 {
     ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
     StyleAttributeMutationScope mutationScope(this);
@@ -290,6 +290,7 @@
     didMutate(changed ? PropertyChanged : NoChanges);
     if (changed)
         mutationScope.enqueueMutationRecord();
+    return changed;
 }
 
 bool PropertySetCSSStyleDeclaration::removeVariable(const AtomicString& name)
@@ -304,7 +305,7 @@
     return changed;
 }
 
-void PropertySetCSSStyleDeclaration::clearVariables(ExceptionState&)
+bool PropertySetCSSStyleDeclaration::clearVariables(ExceptionState&)
 {
     ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
     StyleAttributeMutationScope mutationScope(this);
@@ -313,6 +314,12 @@
     didMutate(changed ? PropertyChanged : NoChanges);
     if (changed)
         mutationScope.enqueueMutationRecord();
+    return changed;
+}
+
+PassRefPtr<CSSVariablesIterator> PropertySetCSSStyleDeclaration::variablesIterator() const
+{
+    return m_propertySet->variablesIterator();
 }
 
 CSSValue* PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue* internalValue)
diff --git a/Source/core/css/PropertySetCSSStyleDeclaration.h b/Source/core/css/PropertySetCSSStyleDeclaration.h
index 4bb4c7f..3329981 100644
--- a/Source/core/css/PropertySetCSSStyleDeclaration.h
+++ b/Source/core/css/PropertySetCSSStyleDeclaration.h
@@ -70,9 +70,10 @@
 
     virtual unsigned variableCount() const OVERRIDE;
     virtual String variableValue(const AtomicString& name) const OVERRIDE;
-    virtual void setVariableValue(const AtomicString& name, const String& value, ExceptionState&) OVERRIDE;
+    virtual bool setVariableValue(const AtomicString& name, const String& value, ExceptionState&) OVERRIDE;
     virtual bool removeVariable(const AtomicString& name) OVERRIDE;
-    virtual void clearVariables(ExceptionState&) OVERRIDE;
+    virtual bool clearVariables(ExceptionState&) OVERRIDE;
+    virtual PassRefPtr<CSSVariablesIterator> variablesIterator() const OVERRIDE;
 
     virtual bool cssPropertyMatches(CSSPropertyID, const CSSValue*) const OVERRIDE;
     virtual PassRefPtr<MutableStylePropertySet> copyProperties() const OVERRIDE;
diff --git a/Source/core/css/PseudoStyleRequest.h b/Source/core/css/PseudoStyleRequest.h
index c07cb2f..11b93fc 100644
--- a/Source/core/css/PseudoStyleRequest.h
+++ b/Source/core/css/PseudoStyleRequest.h
@@ -22,8 +22,8 @@
 #ifndef PseudoStyleRequest_h
 #define PseudoStyleRequest_h
 
-#include "core/platform/ScrollTypes.h"
 #include "core/rendering/style/RenderStyleConstants.h"
+#include "platform/scroll/ScrollTypes.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/RuleSet.cpp b/Source/core/css/RuleSet.cpp
index 87fd2dc..3509682 100644
--- a/Source/core/css/RuleSet.cpp
+++ b/Source/core/css/RuleSet.cpp
@@ -371,7 +371,7 @@
             addPageRule(static_cast<StyleRulePage*>(rule));
         else if (rule->isMediaRule()) {
             StyleRuleMedia* mediaRule = static_cast<StyleRuleMedia*>(rule);
-            if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueries(), resolver)))
+            if ((!mediaRule->mediaQueries() || medium.eval(mediaRule->mediaQueries(), resolver->viewportDependentMediaQueryResults())))
                 addChildRules(mediaRule->childRules(), medium, resolver, scope, hasDocumentSecurityOrigin, addRuleFlags);
         } else if (rule->isFontFaceRule() && resolver) {
             // Add this font face to our set.
@@ -411,7 +411,7 @@
     const Vector<RefPtr<StyleRuleImport> >& importRules = sheet->importRules();
     for (unsigned i = 0; i < importRules.size(); ++i) {
         StyleRuleImport* importRule = importRules[i].get();
-        if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.eval(importRule->mediaQueries(), resolver)))
+        if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.eval(importRule->mediaQueries(), resolver->viewportDependentMediaQueryResults())))
             addRulesFromSheet(importRule->styleSheet(), medium, resolver, scope);
     }
 
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 80222e1..d5326b9 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -49,8 +49,7 @@
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
-#include "core/page/Page.h"
+#include "core/frame/Frame.h"
 #include "core/platform/ScrollableArea.h"
 #include "core/platform/ScrollbarTheme.h"
 #include "core/rendering/RenderObject.h"
@@ -263,7 +262,7 @@
     case CSSSelector::ShadowPseudo:
         {
             // If we're in the same tree-scope as the scoping element, then following a shadow descendant combinator would escape that and thus the scope.
-            if (context.scope && &context.scope->treeScope() == &context.element->treeScope() && (context.behaviorAtBoundary & BoundaryBehaviorMask) != StaysWithinTreeScope)
+            if (context.scope && context.scope->treeScope() == context.element->treeScope() && (context.behaviorAtBoundary & BoundaryBehaviorMask) != StaysWithinTreeScope)
                 return SelectorFailsCompletely;
             Element* shadowHostNode = context.element->shadowHost();
             if (!shadowHostNode)
@@ -388,20 +387,21 @@
     const CSSSelector* const & selector = context.selector;
     ASSERT(element);
     ASSERT(selector);
+    bool elementIsHostInItsShadowTree = isHostInItsShadowTree(element, context.behaviorAtBoundary, context.scope);
 
     if (selector->m_match == CSSSelector::Tag)
-        return SelectorChecker::tagMatches(element, selector->tagQName());
+        return SelectorChecker::tagMatches(element, selector->tagQName(), elementIsHostInItsShadowTree ? MatchingHostInItsShadowTree : MatchingElement);
 
     if (selector->m_match == CSSSelector::Class)
-        return element->hasClass() && element->classNames().contains(selector->value());
+        return element->hasClass() && element->classNames().contains(selector->value()) && !elementIsHostInItsShadowTree;
 
     if (selector->m_match == CSSSelector::Id)
-        return element->hasID() && element->idForStyleResolution() == selector->value();
+        return element->hasID() && element->idForStyleResolution() == selector->value() && !elementIsHostInItsShadowTree;
 
     if (selector->isAttributeSelector()) {
         const QualifiedName& attr = selector->attribute();
 
-        if (!element->hasAttributes())
+        if (!element->hasAttributes() || elementIsHostInItsShadowTree)
             return false;
 
         bool caseSensitive = !m_documentIsHTML || HTMLDocument::isCaseSensitiveAttribute(attr);
@@ -614,9 +614,7 @@
         case CSSSelector::PseudoAutofill:
             if (!element || !element->isFormControlElement())
                 break;
-            if (element->hasTagName(inputTag))
-                return toHTMLInputElement(element)->isAutofilled();
-            break;
+            return toHTMLFormControlElement(element)->isAutofilled();
         case CSSSelector::PseudoAnyLink:
         case CSSSelector::PseudoLink:
             // :visited and :link matches are separated later when applying the style. Here both classes match all links...
diff --git a/Source/core/css/SelectorChecker.h b/Source/core/css/SelectorChecker.h
index aba4e03..28325b3 100644
--- a/Source/core/css/SelectorChecker.h
+++ b/Source/core/css/SelectorChecker.h
@@ -54,6 +54,11 @@
         ScopeIsShadowHost = 8
     };
 
+    enum MatchingTagType {
+        MatchingElement = 0,
+        MatchingHostInItsShadowTree
+    };
+
     struct SelectorCheckingContext {
         // Initial selector constructor
         SelectorCheckingContext(const CSSSelector* selector, Element* element, VisitedMatchType visitedMatchType)
@@ -98,7 +103,7 @@
 
     Mode mode() const { return m_mode; }
 
-    static bool tagMatches(const Element*, const QualifiedName&);
+    static bool tagMatches(const Element*, const QualifiedName&, MatchingTagType = MatchingElement);
     static bool isCommonPseudoClassSelector(const CSSSelector*);
     static bool matchesFocusPseudoClass(const Element*);
     static bool checkExactAttribute(const Element*, const QualifiedName& selectorAttributeName, const StringImpl* value);
@@ -106,6 +111,8 @@
     enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLink | MatchVisited };
     static unsigned determineLinkMatchType(const CSSSelector*);
 
+    static bool isHostInItsShadowTree(const Element*, BehaviorAtBoundary, const ContainerNode* scope);
+
 private:
     bool checkScrollbarPseudoClass(const SelectorCheckingContext&, Document*, const CSSSelector*) const;
     Element* parentElement(const SelectorCheckingContext&) const;
@@ -129,12 +136,12 @@
         || pseudoType == CSSSelector::PseudoFocus;
 }
 
-inline bool SelectorChecker::tagMatches(const Element* element, const QualifiedName& tagQName)
+inline bool SelectorChecker::tagMatches(const Element* element, const QualifiedName& tagQName, MatchingTagType matchingTagType)
 {
     if (tagQName == anyQName())
         return true;
     const AtomicString& localName = tagQName.localName();
-    if (localName != starAtom && localName != element->localName())
+    if (localName != starAtom && (localName != element->localName() || matchingTagType == MatchingHostInItsShadowTree))
         return false;
     const AtomicString& namespaceURI = tagQName.namespaceURI();
     return namespaceURI == starAtom || namespaceURI == element->namespaceURI();
@@ -153,6 +160,11 @@
     return false;
 }
 
+inline bool SelectorChecker::isHostInItsShadowTree(const Element* element, BehaviorAtBoundary behaviorAtBoundary, const ContainerNode* scope)
+{
+    return (behaviorAtBoundary & ScopeIsShadowHost) && scope == element;
+}
+
 }
 
 #endif
diff --git a/Source/core/css/ShadowValue.cpp b/Source/core/css/ShadowValue.cpp
deleted file mode 100644
index 1ee8b1d..0000000
--- a/Source/core/css/ShadowValue.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2009 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "config.h"
-#include "core/css/ShadowValue.h"
-
-#include "core/css/CSSPrimitiveValue.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-// Used for text-shadow and box-shadow
-ShadowValue::ShadowValue(PassRefPtr<CSSPrimitiveValue> _x,
-    PassRefPtr<CSSPrimitiveValue> _y,
-    PassRefPtr<CSSPrimitiveValue> _blur,
-    PassRefPtr<CSSPrimitiveValue> _spread,
-    PassRefPtr<CSSPrimitiveValue> _style,
-    PassRefPtr<CSSPrimitiveValue> _color)
-    : CSSValue(ShadowClass)
-    , x(_x)
-    , y(_y)
-    , blur(_blur)
-    , spread(_spread)
-    , style(_style)
-    , color(_color)
-{
-}
-
-String ShadowValue::customCssText() const
-{
-    StringBuilder text;
-
-    if (color)
-        text.append(color->cssText());
-    if (x) {
-        if (!text.isEmpty())
-            text.append(' ');
-        text.append(x->cssText());
-    }
-    if (y) {
-        if (!text.isEmpty())
-            text.append(' ');
-        text.append(y->cssText());
-    }
-    if (blur) {
-        if (!text.isEmpty())
-            text.append(' ');
-        text.append(blur->cssText());
-    }
-    if (spread) {
-        if (!text.isEmpty())
-            text.append(' ');
-        text.append(spread->cssText());
-    }
-    if (style) {
-        if (!text.isEmpty())
-            text.append(' ');
-        text.append(style->cssText());
-    }
-
-    return text.toString();
-}
-
-bool ShadowValue::equals(const ShadowValue& other) const
-{
-    return compareCSSValuePtr(color, other.color)
-        && compareCSSValuePtr(x, other.x)
-        && compareCSSValuePtr(y, other.y)
-        && compareCSSValuePtr(blur, other.blur)
-        && compareCSSValuePtr(spread, other.spread)
-        && compareCSSValuePtr(style, other.style);
-}
-
-}
diff --git a/Source/core/css/ShadowValue.h b/Source/core/css/ShadowValue.h
deleted file mode 100644
index 6e0192e..0000000
--- a/Source/core/css/ShadowValue.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2008, 2009 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef ShadowValue_h
-#define ShadowValue_h
-
-#include "core/css/CSSValue.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class CSSPrimitiveValue;
-
-// Used for text-shadow and box-shadow
-class ShadowValue : public CSSValue {
-public:
-    static PassRefPtr<ShadowValue> create(PassRefPtr<CSSPrimitiveValue> x,
-        PassRefPtr<CSSPrimitiveValue> y,
-        PassRefPtr<CSSPrimitiveValue> blur,
-        PassRefPtr<CSSPrimitiveValue> spread,
-        PassRefPtr<CSSPrimitiveValue> style,
-        PassRefPtr<CSSPrimitiveValue> color)
-    {
-        return adoptRef(new ShadowValue(x, y, blur, spread, style, color));
-    }
-
-    String customCssText() const;
-
-    bool equals(const ShadowValue&) const;
-
-    RefPtr<CSSPrimitiveValue> x;
-    RefPtr<CSSPrimitiveValue> y;
-    RefPtr<CSSPrimitiveValue> blur;
-    RefPtr<CSSPrimitiveValue> spread;
-    RefPtr<CSSPrimitiveValue> style;
-    RefPtr<CSSPrimitiveValue> color;
-
-private:
-    ShadowValue(PassRefPtr<CSSPrimitiveValue> x,
-        PassRefPtr<CSSPrimitiveValue> y,
-        PassRefPtr<CSSPrimitiveValue> blur,
-        PassRefPtr<CSSPrimitiveValue> spread,
-        PassRefPtr<CSSPrimitiveValue> style,
-        PassRefPtr<CSSPrimitiveValue> color);
-};
-
-} // namespace
-
-#endif
diff --git a/Source/core/css/SiblingTraversalStrategies.h b/Source/core/css/SiblingTraversalStrategies.h
index 8751e94..5e0bc09 100644
--- a/Source/core/css/SiblingTraversalStrategies.h
+++ b/Source/core/css/SiblingTraversalStrategies.h
@@ -78,14 +78,8 @@
 inline int DOMSiblingTraversalStrategy::countElementsBefore(Element* element) const
 {
     int count = 0;
-    for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
-        unsigned index = sibling->childIndex();
-        if (index) {
-            count += index;
-            break;
-        }
+    for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling())
         count++;
-    }
 
     return count;
 }
@@ -104,8 +98,14 @@
 inline int DOMSiblingTraversalStrategy::countElementsAfter(Element* element) const
 {
     int count = 0;
-    for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling())
+    for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) {
+        unsigned index = sibling->childIndex();
+        if (index) {
+            count += index;
+            break;
+        }
         ++count;
+    }
 
     return count;
 }
@@ -139,7 +139,7 @@
     int countElementsOfTypeAfter(Element*, const QualifiedName&) const;
 
 private:
-    Vector<Node*> m_siblings;
+    const Vector<Node*>& m_siblings;
     int m_nth;
 };
 
diff --git a/Source/core/css/StyleMedia.cpp b/Source/core/css/StyleMedia.cpp
index 6f003f7..7d66459 100644
--- a/Source/core/css/StyleMedia.cpp
+++ b/Source/core/css/StyleMedia.cpp
@@ -30,8 +30,8 @@
 #include "core/css/MediaQueryEvaluator.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/Document.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 
 namespace WebCore {
 
diff --git a/Source/core/css/StyleMedia.h b/Source/core/css/StyleMedia.h
index fdf620d..21848f5 100644
--- a/Source/core/css/StyleMedia.h
+++ b/Source/core/css/StyleMedia.h
@@ -27,7 +27,7 @@
 #ifndef StyleMedia_h
 #define StyleMedia_h
 
-#include "core/page/DOMWindowProperty.h"
+#include "core/frame/DOMWindowProperty.h"
 #include "wtf/RefCounted.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/css/StylePropertySerializer.cpp b/Source/core/css/StylePropertySerializer.cpp
index 66008fe..dbe5d9f 100644
--- a/Source/core/css/StylePropertySerializer.cpp
+++ b/Source/core/css/StylePropertySerializer.cpp
@@ -62,8 +62,8 @@
     for (unsigned n = 0; n < size; ++n) {
         StylePropertySet::PropertyReference property = m_propertySet.propertyAt(n);
         CSSPropertyID propertyID = property.id();
-        // Only enabled properties should be part of the style.
-        ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID));
+        // Only enabled or internal properties should be part of the style.
+        ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID) || isInternalProperty(propertyID));
         CSSPropertyID shorthandPropertyID = CSSPropertyInvalid;
         CSSPropertyID borderFallbackShorthandProperty = CSSPropertyInvalid;
         String value;
diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp
index d19d158..3bbd748 100644
--- a/Source/core/css/StylePropertySet.cpp
+++ b/Source/core/css/StylePropertySet.cpp
@@ -286,17 +286,18 @@
 
     size_t index = findVariableIndex(name);
     if (index != kNotFound) {
-        CSSValue* cssValue = m_propertyVector.at(index).value();
+        const CSSValue* cssValue = m_propertyVector.at(index).value();
         if (toCSSVariableValue(cssValue)->value() == value)
             return false;
     }
 
     CSSProperty property(CSSPropertyVariable, CSSVariableValue::create(name, value), important);
-    if (index == kNotFound)
+    if (index == kNotFound) {
         m_propertyVector.append(property);
-    else
-        m_propertyVector.at(index) = property;
-    return true;
+        return true;
+    }
+    m_propertyVector.at(index) = property;
+    return false;
 }
 
 void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property)
@@ -421,6 +422,7 @@
     CSSPropertyTextAlign,
     CSSPropertyTextAlignLast,
     CSSPropertyTextIndent,
+    CSSPropertyTextJustify,
     CSSPropertyWidows
 };
 
@@ -483,8 +485,8 @@
     uint16_t id = static_cast<uint16_t>(propertyID);
     for (int n = propertyCount() - 1 ; n >= 0; --n) {
         if (id == propertyAt(n).propertyMetadata().m_propertyID) {
-            // Only enabled properties should be part of the style.
-            ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID));
+            // Only enabled or internal properties should be part of the style.
+            ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID) || isInternalProperty(propertyID));
             return n;
         }
     }
@@ -563,6 +565,58 @@
     return removePropertiesInSet(&variablesId, 1);
 }
 
+PassRefPtr<MutableStylePropertySet::VariablesIterator> MutableStylePropertySet::VariablesIterator::create(MutableStylePropertySet* propertySet)
+{
+    ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+    const size_t propertyCount = propertySet->propertyCount();
+    size_t variableCount = 0;
+    Vector<AtomicString> remainingNames(propertyCount);
+    for (int i = propertyCount; i--; ) {
+        const PropertyReference& property = propertySet->propertyAt(i);
+        if (property.id() == CSSPropertyVariable)
+            remainingNames[variableCount++] = toCSSVariableValue(property.value())->name();
+    }
+    remainingNames.shrink(variableCount);
+
+    RefPtr<VariablesIterator> iterator = adoptRef(new VariablesIterator(propertySet));
+    // FIXME: Make use of the Vector move constructor when rvalues are supported on all platforms.
+    iterator->takeRemainingNames(remainingNames);
+    return iterator.release();
+}
+
+void MutableStylePropertySet::VariablesIterator::addedVariable(const AtomicString& name)
+{
+    ASSERT(!m_remainingNames.contains(name));
+    ASSERT(!m_newNames.contains(name));
+    m_newNames.append(name);
+}
+
+void MutableStylePropertySet::VariablesIterator::removedVariable(const AtomicString& name)
+{
+    size_t index = m_remainingNames.find(name);
+    if (index != kNotFound)
+        m_remainingNames.remove(index);
+    index = m_newNames.find(name);
+    if (index != kNotFound)
+        m_newNames.remove(index);
+}
+
+void MutableStylePropertySet::VariablesIterator::clearedVariables()
+{
+    m_remainingNames.clear();
+    m_newNames.clear();
+}
+
+void MutableStylePropertySet::VariablesIterator::advance()
+{
+    if (!atEnd())
+        m_remainingNames.removeLast();
+    if (!m_newNames.isEmpty()) {
+        m_remainingNames.appendVector(m_newNames);
+        m_newNames.clear();
+    }
+}
+
 PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const
 {
     return adoptRef(new MutableStylePropertySet(*this));
diff --git a/Source/core/css/StylePropertySet.h b/Source/core/css/StylePropertySet.h
index 8e9c913..81b5ad1 100644
--- a/Source/core/css/StylePropertySet.h
+++ b/Source/core/css/StylePropertySet.h
@@ -25,6 +25,7 @@
 #include "core/css/CSSParserMode.h"
 #include "core/css/CSSPrimitiveValue.h"
 #include "core/css/CSSProperty.h"
+#include "core/css/CSSVariablesIterator.h"
 #include "core/css/PropertySetCSSStyleDeclaration.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/Vector.h"
@@ -174,6 +175,7 @@
 
 class MutableStylePropertySet : public StylePropertySet {
 public:
+    ~MutableStylePropertySet() { }
     static PassRefPtr<MutableStylePropertySet> create(CSSParserMode = CSSQuirksMode);
     static PassRefPtr<MutableStylePropertySet> create(const CSSProperty* properties, unsigned count);
 
@@ -204,6 +206,8 @@
     bool removeVariable(const AtomicString& name);
     bool clearVariables();
 
+    PassRefPtr<CSSVariablesIterator> variablesIterator() { return VariablesIterator::create(this); }
+
     void mergeAndOverrideOnConflict(const StylePropertySet*);
 
     void clear();
@@ -215,6 +219,26 @@
     Vector<CSSProperty, 4> m_propertyVector;
 
 private:
+    class VariablesIterator : public CSSVariablesIterator {
+    public:
+        virtual ~VariablesIterator() { }
+        static PassRefPtr<VariablesIterator> create(MutableStylePropertySet*);
+    private:
+        explicit VariablesIterator(MutableStylePropertySet* propertySet) : m_propertySet(propertySet) { }
+        void takeRemainingNames(Vector<AtomicString>& remainingNames) { m_remainingNames.swap(remainingNames); }
+        virtual void advance() OVERRIDE;
+        virtual bool atEnd() const OVERRIDE { return m_remainingNames.isEmpty(); }
+        virtual AtomicString name() const OVERRIDE { return m_remainingNames.last(); }
+        virtual String value() const OVERRIDE { return m_propertySet->variableValue(name()); }
+        virtual void addedVariable(const AtomicString& name) OVERRIDE;
+        virtual void removedVariable(const AtomicString& name) OVERRIDE;
+        virtual void clearedVariables() OVERRIDE;
+
+        RefPtr<MutableStylePropertySet> m_propertySet;
+        Vector<AtomicString> m_remainingNames;
+        Vector<AtomicString> m_newNames;
+    };
+
     explicit MutableStylePropertySet(CSSParserMode);
     explicit MutableStylePropertySet(const StylePropertySet&);
     MutableStylePropertySet(const CSSProperty* properties, unsigned count);
diff --git a/Source/core/css/StyleRule.cpp b/Source/core/css/StyleRule.cpp
index 3008e84..bb53bb8 100644
--- a/Source/core/css/StyleRule.cpp
+++ b/Source/core/css/StyleRule.cpp
@@ -43,7 +43,7 @@
     unsigned bitfields;
 };
 
-COMPILE_ASSERT(sizeof(StyleRuleBase) == sizeof(SameSizeAsStyleRuleBase), StyleRuleBase_should_stay_small);
+COMPILE_ASSERT(sizeof(StyleRuleBase) <= sizeof(SameSizeAsStyleRuleBase), StyleRuleBase_should_stay_small);
 
 PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet) const
 {
diff --git a/Source/core/css/StyleSheet.h b/Source/core/css/StyleSheet.h
index 6ca572e..2207b5a 100644
--- a/Source/core/css/StyleSheet.h
+++ b/Source/core/css/StyleSheet.h
@@ -51,7 +51,6 @@
     virtual KURL baseURL() const = 0;
     virtual bool isLoading() const = 0;
     virtual bool isCSSStyleSheet() const { return false; }
-    virtual bool isXSLStyleSheet() const { return false; }
 };
 
 } // namespace
diff --git a/Source/core/css/StyleSheetContents.cpp b/Source/core/css/StyleSheetContents.cpp
index 9eeb6f1..07d3430 100644
--- a/Source/core/css/StyleSheetContents.cpp
+++ b/Source/core/css/StyleSheetContents.cpp
@@ -29,6 +29,7 @@
 #include "core/css/StyleRuleImport.h"
 #include "core/dom/Node.h"
 #include "core/fetch/CSSStyleSheetResource.h"
+#include "platform/TraceEvent.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/Deque.h"
 
@@ -271,6 +272,8 @@
 
 void StyleSheetContents::parseAuthorStyleSheet(const CSSStyleSheetResource* cachedStyleSheet, const SecurityOrigin* securityOrigin)
 {
+    TRACE_EVENT0("webkit", "StyleSheetContents::parseAuthorStyleSheet");
+
     bool enforceMIMEType = isStrictParserMode(m_parserContext.mode);
     bool hasValidMIMEType = false;
     String sheetText = cachedStyleSheet->sheetText(enforceMIMEType, &hasValidMIMEType);
diff --git a/Source/core/css/StyleSheetList.cpp b/Source/core/css/StyleSheetList.cpp
index b773deb..17ad7b4 100644
--- a/Source/core/css/StyleSheetList.cpp
+++ b/Source/core/css/StyleSheetList.cpp
@@ -31,8 +31,8 @@
 
 using namespace HTMLNames;
 
-StyleSheetList::StyleSheetList(Document* document)
-    : m_document(document)
+StyleSheetList::StyleSheetList(TreeScope* treeScope)
+    : m_treeScope(treeScope)
 {
 }
 
@@ -40,20 +40,20 @@
 {
 }
 
-inline const Vector<RefPtr<StyleSheet> >& StyleSheetList::styleSheets() const
+inline const Vector<RefPtr<StyleSheet> >& StyleSheetList::styleSheets()
 {
-    if (!m_document)
+    if (!m_treeScope)
         return m_detachedStyleSheets;
-    return m_document->styleEngine()->styleSheetsForStyleSheetList();
+    return document()->styleEngine()->styleSheetsForStyleSheetList(*m_treeScope);
 }
 
 void StyleSheetList::detachFromDocument()
 {
-    m_detachedStyleSheets = m_document->styleEngine()->styleSheetsForStyleSheetList();
-    m_document = 0;
+    m_detachedStyleSheets = document()->styleEngine()->styleSheetsForStyleSheetList(*m_treeScope);
+    m_treeScope = 0;
 }
 
-unsigned StyleSheetList::length() const
+unsigned StyleSheetList::length()
 {
     return styleSheets().size();
 }
@@ -66,7 +66,7 @@
 
 HTMLStyleElement* StyleSheetList::getNamedItem(const String& name) const
 {
-    if (!m_document)
+    if (!m_treeScope)
         return 0;
 
     // IE also supports retrieving a stylesheet by name, using the name/id of the <style> tag
@@ -75,7 +75,7 @@
     // and doesn't look for name attribute.
     // But unicity of stylesheet ids is good practice anyway ;)
     // FIXME: We should figure out if we should change this or fix the spec.
-    Element* element = m_document->getElementById(name);
+    Element* element = m_treeScope->getElementById(name);
     if (element && element->hasTagName(styleTag))
         return toHTMLStyleElement(element);
     return 0;
diff --git a/Source/core/css/StyleSheetList.h b/Source/core/css/StyleSheetList.h
index e340f04..cd813bc 100644
--- a/Source/core/css/StyleSheetList.h
+++ b/Source/core/css/StyleSheetList.h
@@ -22,6 +22,7 @@
 #define StyleSheetList_h
 
 #include "core/css/CSSStyleSheet.h"
+#include "core/dom/TreeScope.h"
 #include "wtf/Forward.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
@@ -29,30 +30,29 @@
 
 namespace WebCore {
 
-class Document;
 class HTMLStyleElement;
 class StyleSheet;
 
 class StyleSheetList : public RefCounted<StyleSheetList> {
 public:
-    static PassRefPtr<StyleSheetList> create(Document* document) { return adoptRef(new StyleSheetList(document)); }
+    static PassRefPtr<StyleSheetList> create(TreeScope* treeScope) { return adoptRef(new StyleSheetList(treeScope)); }
     ~StyleSheetList();
 
-    unsigned length() const;
+    unsigned length();
     StyleSheet* item(unsigned index);
 
     HTMLStyleElement* getNamedItem(const String&) const;
 
-    Document* document() { return m_document; }
+    Document* document() { return m_treeScope->documentScope(); }
 
     void detachFromDocument();
     CSSStyleSheet* anonymousNamedGetter(const AtomicString&);
 
 private:
-    StyleSheetList(Document*);
-    const Vector<RefPtr<StyleSheet> >& styleSheets() const;
+    StyleSheetList(TreeScope*);
+    const Vector<RefPtr<StyleSheet> >& styleSheets();
 
-    Document* m_document;
+    TreeScope* m_treeScope;
     Vector<RefPtr<StyleSheet> > m_detachedStyleSheets;
 };
 
diff --git a/Source/core/css/WebKitCSSRegionRule.idl b/Source/core/css/WebKitCSSRegionRule.idl
index ad91ce0..6811344 100644
--- a/Source/core/css/WebKitCSSRegionRule.idl
+++ b/Source/core/css/WebKitCSSRegionRule.idl
@@ -28,7 +28,7 @@
  */
 
 [
-    EnabledAtRuntime=CSSRegions,
+    RuntimeEnabled=CSSRegions,
     ImplementedAs=CSSRegionRule
 ] interface WebKitCSSRegionRule : CSSRule {
     readonly attribute CSSRuleList cssRules;
diff --git a/Source/core/css/html.css b/Source/core/css/html.css
index b41ccf0..335a57e 100644
--- a/Source/core/css/html.css
+++ b/Source/core/css/html.css
@@ -667,7 +667,7 @@
     text-align: start !important;
 }
 
-input:-webkit-autofill {
+input:-webkit-autofill, textarea:-webkit-autofill {
     background-color: #FAFFBD !important;
     background-image:none !important;
     color: #000000 !important;
diff --git a/Source/core/css/mediaControlsAndroid.css b/Source/core/css/mediaControlsAndroid.css
index 69bdd8d..a258fa7 100644
--- a/Source/core/css/mediaControlsAndroid.css
+++ b/Source/core/css/mediaControlsAndroid.css
@@ -30,10 +30,14 @@
     height: 35px;
 }
 
-audio::-webkit-media-controls-enclosure, video::-webkit-media-controls-enclosure {
+audio::-webkit-media-controls-enclosure {
     height: 35px;
 }
 
+video::-webkit-media-controls-enclosure {
+    height: 40px;
+}
+
 audio::-webkit-media-controls-overlay-enclosure {
     display: none;
 }
@@ -54,7 +58,6 @@
 
 audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
     height: 35px;
-    border-radius: 0;
 }
 
 audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
diff --git a/Source/core/css/resolver/AnimatedStyleBuilder.cpp b/Source/core/css/resolver/AnimatedStyleBuilder.cpp
index bc86494..9991a83 100644
--- a/Source/core/css/resolver/AnimatedStyleBuilder.cpp
+++ b/Source/core/css/resolver/AnimatedStyleBuilder.cpp
@@ -31,10 +31,18 @@
 #include "config.h"
 #include "core/css/resolver/AnimatedStyleBuilder.h"
 
+#include "core/animation/AnimatableClipPathOperation.h"
 #include "core/animation/AnimatableColor.h"
+#include "core/animation/AnimatableDouble.h"
 #include "core/animation/AnimatableImage.h"
+#include "core/animation/AnimatableLength.h"
 #include "core/animation/AnimatableLengthBox.h"
-#include "core/animation/AnimatableNumber.h"
+#include "core/animation/AnimatableLengthSize.h"
+#include "core/animation/AnimatableRepeatable.h"
+#include "core/animation/AnimatableSVGLength.h"
+#include "core/animation/AnimatableSVGPaint.h"
+#include "core/animation/AnimatableShapeValue.h"
+#include "core/animation/AnimatableStrokeDasharrayList.h"
 #include "core/animation/AnimatableTransform.h"
 #include "core/animation/AnimatableUnknown.h"
 #include "core/animation/AnimatableValue.h"
@@ -51,30 +59,123 @@
 
 namespace {
 
-Length animatableValueToLength(const AnimatableValue* value, const StyleResolverState& state)
+Length animatableValueToLength(const AnimatableValue* value, const StyleResolverState& state, NumberRange range = AllValues)
 {
     const RenderStyle* style = state.style();
-    if (value->isNumber())
-        return toAnimatableNumber(value)->toLength(style, state.rootElementStyle(), style->effectiveZoom());
+    if (value->isLength())
+        return toAnimatableLength(value)->toLength(style, state.rootElementStyle(), style->effectiveZoom(), range);
     RefPtr<CSSValue> cssValue = toAnimatableUnknown(value)->toCSSValue();
     CSSPrimitiveValue* cssPrimitiveValue = toCSSPrimitiveValue(cssValue.get());
     return cssPrimitiveValue->convertToLength<AnyConversion>(style, state.rootElementStyle(), style->effectiveZoom());
 }
 
-template<typename T> T animatableValueRoundClampTo(const AnimatableValue* value)
+template<typename T> T animatableValueRoundClampTo(const AnimatableValue* value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>())
 {
     COMPILE_ASSERT(WTF::IsInteger<T>::value, ShouldUseIntegralTypeTWhenRoundingValues);
-    return clampTo<T>(round(toAnimatableNumber(value)->toDouble()));
+    return clampTo<T>(round(toAnimatableDouble(value)->toDouble()), min, max);
 }
 
-LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleResolverState& state)
+LengthBox animatableValueToLengthBox(const AnimatableValue* value, const StyleResolverState& state, NumberRange range = AllValues)
 {
     const AnimatableLengthBox* animatableLengthBox = toAnimatableLengthBox(value);
     return LengthBox(
-        animatableValueToLength(animatableLengthBox->top(), state),
-        animatableValueToLength(animatableLengthBox->right(), state),
-        animatableValueToLength(animatableLengthBox->bottom(), state),
-        animatableValueToLength(animatableLengthBox->left(), state));
+        animatableValueToLength(animatableLengthBox->top(), state, range),
+        animatableValueToLength(animatableLengthBox->right(), state, range),
+        animatableValueToLength(animatableLengthBox->bottom(), state, range),
+        animatableValueToLength(animatableLengthBox->left(), state, range));
+}
+
+LengthSize animatableValueToLengthSize(const AnimatableValue* value, const StyleResolverState& state, NumberRange range)
+{
+    const AnimatableLengthSize* animatableLengthSize = toAnimatableLengthSize(value);
+    return LengthSize(
+        animatableValueToLength(animatableLengthSize->width(), state, range),
+        animatableValueToLength(animatableLengthSize->height(), state, range));
+}
+
+template <CSSPropertyID property>
+void setFillSize(FillLayer* fillLayer, const AnimatableValue* value, const StyleResolverState& state)
+{
+    if (value->isLengthSize())
+        fillLayer->setSize(FillSize(SizeLength, animatableValueToLengthSize(value, state, NonNegativeValues)));
+    else
+        state.styleMap().mapFillSize(property, fillLayer, toAnimatableUnknown(value)->toCSSValue().get());
+}
+
+SVGLength animatableValueToNonNegativeSVGLength(const AnimatableValue* value)
+{
+    SVGLength length = toAnimatableSVGLength(value)->toSVGLength();
+    if (length.valueInSpecifiedUnits() < 0)
+        length.setValueInSpecifiedUnits(0);
+    return length;
+}
+
+template <CSSPropertyID property>
+void setOnFillLayers(FillLayer* fillLayer, const AnimatableValue* value, StyleResolverState& state)
+{
+    const Vector<RefPtr<AnimatableValue> >& values = toAnimatableRepeatable(value)->values();
+    ASSERT(!values.isEmpty());
+    FillLayer* prev = 0;
+    for (size_t i = 0; i < values.size(); ++i) {
+        if (!fillLayer) {
+            switch (property) {
+            case CSSPropertyBackgroundImage:
+            case CSSPropertyBackgroundPositionX:
+            case CSSPropertyBackgroundPositionY:
+            case CSSPropertyBackgroundSize:
+                fillLayer = new FillLayer(BackgroundFillLayer);
+                break;
+            case CSSPropertyWebkitMaskPositionX:
+            case CSSPropertyWebkitMaskPositionY:
+                fillLayer = new FillLayer(MaskFillLayer);
+                break;
+            default:
+                ASSERT_NOT_REACHED();
+            }
+            prev->setNext(fillLayer);
+        }
+        switch (property) {
+        case CSSPropertyBackgroundImage:
+            fillLayer->setImage(toAnimatableImage(values[i].get())->toStyleImage());
+            break;
+        case CSSPropertyBackgroundPositionX:
+        case CSSPropertyWebkitMaskPositionX:
+            fillLayer->setXPosition(animatableValueToLength(values[i].get(), state));
+            break;
+        case CSSPropertyBackgroundPositionY:
+        case CSSPropertyWebkitMaskPositionY:
+            fillLayer->setYPosition(animatableValueToLength(values[i].get(), state));
+            break;
+        case CSSPropertyBackgroundSize:
+            setFillSize<property>(fillLayer, values[i].get(), state);
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+        }
+        prev = fillLayer;
+        fillLayer = fillLayer->next();
+    }
+    while (fillLayer) {
+        switch (property) {
+        case CSSPropertyBackgroundImage:
+            fillLayer->clearImage();
+            break;
+        case CSSPropertyBackgroundPositionX:
+        case CSSPropertyWebkitMaskPositionX:
+            fillLayer->clearXPosition();
+            break;
+        case CSSPropertyBackgroundPositionY:
+        case CSSPropertyWebkitMaskPositionY:
+            fillLayer->clearYPosition();
+            break;
+        case CSSPropertyBackgroundSize:
+            fillLayer->clearSize();
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+        }
+        fillLayer = fillLayer->next();
+    }
 }
 
 } // namespace
@@ -92,24 +193,45 @@
         style->setBackgroundColor(toAnimatableColor(value)->color());
         style->setVisitedLinkBackgroundColor(toAnimatableColor(value)->visitedLinkColor());
         return;
+    case CSSPropertyBackgroundImage:
+        setOnFillLayers<CSSPropertyBackgroundImage>(style->accessBackgroundLayers(), value, state);
+        return;
+    case CSSPropertyBackgroundPositionX:
+        setOnFillLayers<CSSPropertyBackgroundPositionX>(style->accessBackgroundLayers(), value, state);
+        return;
+    case CSSPropertyBackgroundPositionY:
+        setOnFillLayers<CSSPropertyBackgroundPositionY>(style->accessBackgroundLayers(), value, state);
+        return;
+    case CSSPropertyBackgroundSize:
+        setOnFillLayers<CSSPropertyBackgroundSize>(style->accessBackgroundLayers(), value, state);
+        return;
+    case CSSPropertyBaselineShift:
+        style->setBaselineShiftValue(toAnimatableSVGLength(value)->toSVGLength());
+        return;
     case CSSPropertyBorderBottomColor:
         style->setBorderBottomColor(toAnimatableColor(value)->color());
         style->setVisitedLinkBorderBottomColor(toAnimatableColor(value)->visitedLinkColor());
         return;
+    case CSSPropertyBorderBottomLeftRadius:
+        style->setBorderBottomLeftRadius(animatableValueToLengthSize(value, state, NonNegativeValues));
+        return;
+    case CSSPropertyBorderBottomRightRadius:
+        style->setBorderBottomRightRadius(animatableValueToLengthSize(value, state, NonNegativeValues));
+        return;
     case CSSPropertyBorderBottomWidth:
         style->setBorderBottomWidth(animatableValueRoundClampTo<unsigned>(value));
         return;
     case CSSPropertyBorderImageOutset:
-        style->setBorderImageOutset(animatableValueToLengthBox(value, state));
+        style->setBorderImageOutset(animatableValueToLengthBox(value, state, NonNegativeValues));
         return;
     case CSSPropertyBorderImageSlice:
-        style->setBorderImageSlices(animatableValueToLengthBox(value, state));
+        style->setBorderImageSlices(animatableValueToLengthBox(value, state, NonNegativeValues));
         return;
     case CSSPropertyBorderImageSource:
         style->setBorderImageSource(toAnimatableImage(value)->toStyleImage());
         return;
     case CSSPropertyBorderImageWidth:
-        style->setBorderImageWidth(animatableValueToLengthBox(value, state));
+        style->setBorderImageWidth(animatableValueToLengthBox(value, state, NonNegativeValues));
         return;
     case CSSPropertyBorderLeftColor:
         style->setBorderLeftColor(toAnimatableColor(value)->color());
@@ -129,6 +251,12 @@
         style->setBorderTopColor(toAnimatableColor(value)->color());
         style->setVisitedLinkBorderTopColor(toAnimatableColor(value)->visitedLinkColor());
         return;
+    case CSSPropertyBorderTopLeftRadius:
+        style->setBorderTopLeftRadius(animatableValueToLengthSize(value, state, NonNegativeValues));
+        return;
+    case CSSPropertyBorderTopRightRadius:
+        style->setBorderTopRightRadius(animatableValueToLengthSize(value, state, NonNegativeValues));
+        return;
     case CSSPropertyBorderTopWidth:
         style->setBorderTopWidth(animatableValueRoundClampTo<unsigned>(value));
         return;
@@ -137,20 +265,57 @@
         return;
     case CSSPropertyClip:
         style->setClip(animatableValueToLengthBox(value, state));
+        style->setHasClip(true);
         return;
     case CSSPropertyColor:
         style->setColor(toAnimatableColor(value)->color());
         style->setVisitedLinkColor(toAnimatableColor(value)->visitedLinkColor());
         return;
+    case CSSPropertyFillOpacity:
+        style->setFillOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, 1));
+        return;
+    case CSSPropertyFill:
+        {
+            const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value);
+            style->accessSVGStyle()->setFillPaint(svgPaint->paintType(), svgPaint->color(), svgPaint->uri());
+        }
+        return;
+    case CSSPropertyFlexGrow:
+        style->setFlexGrow(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0));
+        return;
+    case CSSPropertyFlexShrink:
+        style->setFlexShrink(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0));
+        return;
+    case CSSPropertyFlexBasis:
+        style->setFlexBasis(animatableValueToLength(value, state, NonNegativeValues));
+        return;
+    case CSSPropertyFloodColor:
+        style->setFloodColor(toAnimatableColor(value)->color());
+        return;
+    case CSSPropertyFloodOpacity:
+        style->setFloodOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, 1));
+        return;
+    case CSSPropertyFontSize:
+        style->setFontSize(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0));
+        return;
     case CSSPropertyHeight:
-        style->setHeight(animatableValueToLength(value, state));
+        style->setHeight(animatableValueToLength(value, state, NonNegativeValues));
+        return;
+    case CSSPropertyKerning:
+        style->setKerning(toAnimatableSVGLength(value)->toSVGLength());
         return;
     case CSSPropertyLeft:
         style->setLeft(animatableValueToLength(value, state));
         return;
+    case CSSPropertyLightingColor:
+        style->setLightingColor(toAnimatableColor(value)->color());
+        return;
     case CSSPropertyListStyleImage:
         style->setListStyleImage(toAnimatableImage(value)->toStyleImage());
         return;
+    case CSSPropertyLetterSpacing:
+        style->setLetterSpacing(clampTo<float>(toAnimatableDouble(value)->toDouble()));
+        return;
     case CSSPropertyMarginBottom:
         style->setMarginBottom(animatableValueToLength(value, state));
         return;
@@ -164,19 +329,22 @@
         style->setMarginTop(animatableValueToLength(value, state));
         return;
     case CSSPropertyMaxHeight:
-        style->setMaxHeight(animatableValueToLength(value, state));
+        style->setMaxHeight(animatableValueToLength(value, state, NonNegativeValues));
         return;
     case CSSPropertyMaxWidth:
-        style->setMaxWidth(animatableValueToLength(value, state));
+        style->setMaxWidth(animatableValueToLength(value, state, NonNegativeValues));
         return;
     case CSSPropertyMinHeight:
-        style->setMinHeight(animatableValueToLength(value, state));
+        style->setMinHeight(animatableValueToLength(value, state, NonNegativeValues));
         return;
     case CSSPropertyMinWidth:
-        style->setMinWidth(animatableValueToLength(value, state));
+        style->setMinWidth(animatableValueToLength(value, state, NonNegativeValues));
         return;
     case CSSPropertyOpacity:
-        style->setOpacity(toAnimatableNumber(value)->toDouble());
+        style->setOpacity(toAnimatableDouble(value)->toDouble());
+        return;
+    case CSSPropertyOrphans:
+        style->setOrphans(animatableValueRoundClampTo<unsigned short>(value, 1));
         return;
     case CSSPropertyOutlineColor:
         style->setOutlineColor(toAnimatableColor(value)->color());
@@ -189,51 +357,110 @@
         style->setOutlineWidth(animatableValueRoundClampTo<unsigned short>(value));
         return;
     case CSSPropertyPaddingBottom:
-        style->setPaddingBottom(animatableValueToLength(value, state));
+        style->setPaddingBottom(animatableValueToLength(value, state, NonNegativeValues));
         return;
     case CSSPropertyPaddingLeft:
-        style->setPaddingLeft(animatableValueToLength(value, state));
+        style->setPaddingLeft(animatableValueToLength(value, state, NonNegativeValues));
         return;
     case CSSPropertyPaddingRight:
-        style->setPaddingRight(animatableValueToLength(value, state));
+        style->setPaddingRight(animatableValueToLength(value, state, NonNegativeValues));
         return;
     case CSSPropertyPaddingTop:
-        style->setPaddingTop(animatableValueToLength(value, state));
+        style->setPaddingTop(animatableValueToLength(value, state, NonNegativeValues));
         return;
     case CSSPropertyRight:
         style->setRight(animatableValueToLength(value, state));
         return;
+    case CSSPropertyStrokeWidth:
+        style->setStrokeWidth(animatableValueToNonNegativeSVGLength(value));
+        return;
+    case CSSPropertyStopColor:
+        style->setStopColor(toAnimatableColor(value)->color());
+        return;
+    case CSSPropertyStopOpacity:
+        style->setStopOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, 1));
+        return;
+    case CSSPropertyStrokeDasharray:
+        style->setStrokeDashArray(toAnimatableStrokeDasharrayList(value)->toSVGLengthVector());
+        return;
+    case CSSPropertyStrokeDashoffset:
+        style->setStrokeDashOffset(toAnimatableSVGLength(value)->toSVGLength());
+        return;
+    case CSSPropertyStrokeMiterlimit:
+        style->setStrokeMiterLimit(clampTo<float>(toAnimatableDouble(value)->toDouble(), 1));
+        return;
+    case CSSPropertyStrokeOpacity:
+        style->setStrokeOpacity(clampTo<float>(toAnimatableDouble(value)->toDouble(), 0, 1));
+        return;
+    case CSSPropertyStroke:
+        {
+            const AnimatableSVGPaint* svgPaint = toAnimatableSVGPaint(value);
+            style->accessSVGStyle()->setStrokePaint(svgPaint->paintType(), svgPaint->color(), svgPaint->uri());
+        }
+        return;
     case CSSPropertyTextDecorationColor:
         style->setTextDecorationColor(toAnimatableColor(value)->color());
         style->setVisitedLinkTextDecorationColor(toAnimatableColor(value)->visitedLinkColor());
         return;
+    case CSSPropertyTextIndent:
+        style->setTextIndent(animatableValueToLength(value, state));
+        return;
     case CSSPropertyTop:
         style->setTop(animatableValueToLength(value, state));
         return;
+    case CSSPropertyWebkitBorderHorizontalSpacing:
+        style->setHorizontalBorderSpacing(animatableValueRoundClampTo<unsigned short>(value));
+        return;
+    case CSSPropertyWebkitBorderVerticalSpacing:
+        style->setVerticalBorderSpacing(animatableValueRoundClampTo<unsigned short>(value));
+        return;
+    case CSSPropertyWebkitClipPath:
+        style->setClipPath(toAnimatableClipPathOperation(value)->clipPathOperation());
+        return;
+    case CSSPropertyWebkitColumnCount:
+        style->setColumnCount(animatableValueRoundClampTo<unsigned short>(value, 1));
+        return;
+    case CSSPropertyWebkitColumnGap:
+        style->setColumnGap(clampTo(toAnimatableDouble(value)->toDouble(), 0));
+        return;
     case CSSPropertyWebkitColumnRuleColor:
         style->setColumnRuleColor(toAnimatableColor(value)->color());
         style->setVisitedLinkColumnRuleColor(toAnimatableColor(value)->visitedLinkColor());
         return;
+    case CSSPropertyWebkitColumnWidth:
+        style->setColumnWidth(clampTo(toAnimatableDouble(value)->toDouble(), std::numeric_limits<float>::epsilon()));
+        return;
+    case CSSPropertyWebkitColumnRuleWidth:
+        style->setColumnRuleWidth(animatableValueRoundClampTo<unsigned short>(value));
+        return;
     case CSSPropertyWebkitMaskBoxImageSource:
         style->setMaskBoxImageSource(toAnimatableImage(value)->toStyleImage());
         return;
     case CSSPropertyWebkitMaskImage:
         style->setMaskImage(toAnimatableImage(value)->toStyleImage());
         return;
+    case CSSPropertyWebkitMaskPositionX:
+        setOnFillLayers<CSSPropertyWebkitMaskPositionX>(style->accessMaskLayers(), value, state);
+        return;
+    case CSSPropertyWebkitMaskPositionY:
+        setOnFillLayers<CSSPropertyWebkitMaskPositionY>(style->accessMaskLayers(), value, state);
+        return;
+    case CSSPropertyWebkitPerspective:
+        style->setPerspective(clampTo<float>(toAnimatableDouble(value)->toDouble()));
+        return;
     case CSSPropertyWebkitPerspectiveOriginX:
         style->setPerspectiveOriginX(animatableValueToLength(value, state));
         return;
     case CSSPropertyWebkitPerspectiveOriginY:
         style->setPerspectiveOriginY(animatableValueToLength(value, state));
         return;
+    case CSSPropertyWebkitShapeInside:
+        style->setShapeInside(toAnimatableShapeValue(value)->shapeValue());
+        return;
     case CSSPropertyWebkitTextEmphasisColor:
         style->setTextEmphasisColor(toAnimatableColor(value)->color());
         style->setVisitedLinkTextEmphasisColor(toAnimatableColor(value)->visitedLinkColor());
         return;
-    case CSSPropertyWebkitTextFillColor:
-        style->setTextFillColor(toAnimatableColor(value)->color());
-        style->setVisitedLinkTextFillColor(toAnimatableColor(value)->visitedLinkColor());
-        return;
     case CSSPropertyWebkitTextStrokeColor:
         style->setTextStrokeColor(toAnimatableColor(value)->color());
         style->setVisitedLinkTextStrokeColor(toAnimatableColor(value)->visitedLinkColor());
@@ -247,8 +474,17 @@
     case CSSPropertyWebkitTransformOriginY:
         style->setTransformOriginY(animatableValueToLength(value, state));
         return;
+    case CSSPropertyWebkitTransformOriginZ:
+        style->setTransformOriginZ(toAnimatableDouble(value)->toDouble());
+        return;
+    case CSSPropertyWidows:
+        style->setWidows(animatableValueRoundClampTo<unsigned short>(value, 1));
+        return;
     case CSSPropertyWidth:
-        style->setWidth(animatableValueToLength(value, state));
+        style->setWidth(animatableValueToLength(value, state, NonNegativeValues));
+        return;
+    case CSSPropertyWordSpacing:
+        style->setWordSpacing(clampTo<float>(toAnimatableDouble(value)->toDouble()));
         return;
     case CSSPropertyVisibility:
         style->setVisibility(toAnimatableVisibility(value)->visibility());
@@ -256,6 +492,9 @@
     case CSSPropertyZIndex:
         style->setZIndex(animatableValueRoundClampTo<int>(value));
         return;
+    case CSSPropertyZoom:
+        style->setZoom(clampTo<float>(toAnimatableDouble(value)->toDouble(), std::numeric_limits<float>::denorm_min()));
+        return;
     default:
         RELEASE_ASSERT_WITH_MESSAGE(!CSSAnimations::isAnimatableProperty(property), "Web Animations not yet implemented: Unable to apply AnimatableValue to RenderStyle: %s", getPropertyNameString(property).utf8().data());
         ASSERT_NOT_REACHED();
diff --git a/Source/core/css/resolver/ElementResolveContext.cpp b/Source/core/css/resolver/ElementResolveContext.cpp
index 00f9315..408475f9 100644
--- a/Source/core/css/resolver/ElementResolveContext.cpp
+++ b/Source/core/css/resolver/ElementResolveContext.cpp
@@ -29,19 +29,20 @@
 
 namespace WebCore {
 
-ElementResolveContext::ElementResolveContext(Element* element)
-    : m_element(element)
-    , m_elementLinkState(element ? element->document().visitedLinkState()->determineLinkState(element) : NotInsideLink)
+ElementResolveContext::ElementResolveContext(Element& element)
+    : m_element(&element)
+    , m_elementLinkState(element.document().visitedLinkState()->determineLinkState(element))
     , m_distributedToInsertionPoint(false)
     , m_resetStyleInheritance(false)
 {
     NodeRenderingTraversal::ParentDetails parentDetails;
-    m_parentNode = NodeRenderingTraversal::parent(element, &parentDetails);
+    m_parentNode = NodeRenderingTraversal::parent(&element, &parentDetails);
     m_distributedToInsertionPoint = parentDetails.insertionPoint();
     m_resetStyleInheritance = parentDetails.resetStyleInheritance();
 
-    Node* documentElement = document().documentElement();
-    RenderStyle* documentStyle = document().renderStyle();
+    const Document& document = element.document();
+    Node* documentElement = document.documentElement();
+    RenderStyle* documentStyle = document.renderStyle();
     m_rootElementStyle = documentElement && element != documentElement ? documentElement->renderStyle() : documentStyle;
     if (!m_rootElementStyle)
         m_rootElementStyle = documentStyle;
diff --git a/Source/core/css/resolver/ElementResolveContext.h b/Source/core/css/resolver/ElementResolveContext.h
index ebbe1cf..f255e89 100644
--- a/Source/core/css/resolver/ElementResolveContext.h
+++ b/Source/core/css/resolver/ElementResolveContext.h
@@ -45,14 +45,11 @@
     {
     }
 
-    explicit ElementResolveContext(Element*);
-
-    Document& document() const { return m_element->document(); }
-    bool isDocumentElement() const { return m_element && m_element == m_element->document().documentElement(); }
+    explicit ElementResolveContext(Element&);
 
     Element* element() const { return m_element; }
     const ContainerNode* parentNode() const { return m_parentNode; }
-    RenderStyle* rootElementStyle() const { return m_rootElementStyle; }
+    const RenderStyle* rootElementStyle() const { return m_rootElementStyle; }
     EInsideLink elementLinkState() const { return m_elementLinkState; }
     bool distributedToInsertionPoint() const { return m_distributedToInsertionPoint; }
     bool resetStyleInheritance() const { return m_resetStyleInheritance; }
diff --git a/Source/core/css/resolver/ElementStyleResources.cpp b/Source/core/css/resolver/ElementStyleResources.cpp
index 6534ea8..7ac45d0 100644
--- a/Source/core/css/resolver/ElementStyleResources.cpp
+++ b/Source/core/css/resolver/ElementStyleResources.cpp
@@ -45,15 +45,15 @@
 
     if (value->isImageGeneratorValue()) {
         if (value->isGradientValue())
-            return generatedOrPendingFromValue(property, static_cast<CSSGradientValue*>(value)->gradientWithStylesResolved(textLinkColors, currentColor).get());
-        return generatedOrPendingFromValue(property, static_cast<CSSImageGeneratorValue*>(value));
+            return generatedOrPendingFromValue(property, toCSSGradientValue(value)->gradientWithStylesResolved(textLinkColors, currentColor).get());
+        return generatedOrPendingFromValue(property, toCSSImageGeneratorValue(value));
     }
 
     if (value->isImageSetValue())
         return setOrPendingFromValue(property, toCSSImageSetValue(value));
 
     if (value->isCursorImageValue())
-        return cursorOrPendingFromValue(property, static_cast<CSSCursorImageValue*>(value));
+        return cursorOrPendingFromValue(property, toCSSCursorImageValue(value));
 
     return 0;
 }
@@ -96,12 +96,4 @@
     m_pendingSVGDocuments.set(filterOperation, cssSVGDocumentValue);
 }
 
-void ElementStyleResources::clear()
-{
-    m_pendingImageProperties.clear();
-    m_pendingSVGDocuments.clear();
-    m_hasPendingShaders = false;
-    m_deviceScaleFactor = 1;
-}
-
 }
diff --git a/Source/core/css/resolver/ElementStyleResources.h b/Source/core/css/resolver/ElementStyleResources.h
index 08aaede..ee73d8c 100644
--- a/Source/core/css/resolver/ElementStyleResources.h
+++ b/Source/core/css/resolver/ElementStyleResources.h
@@ -45,9 +45,6 @@
 
 // Holds information about resources, requested by stylesheets.
 // Lifetime: per-element style resolve.
-// FIXME: At least for the moment, the lifetime actually matches that of StyleResolverState,
-// but all data is cleared for each element resolve. We must investigate performance
-// implications of matching effective and intended lifetime.
 class ElementStyleResources {
 WTF_MAKE_NONCOPYABLE(ElementStyleResources);
 public:
@@ -71,8 +68,6 @@
 
     void addPendingSVGDocument(FilterOperation*, CSSSVGDocumentValue*);
 
-    void clear();
-
 private:
     PendingImagePropertyMap m_pendingImageProperties;
     PendingSVGDocumentMap m_pendingSVGDocuments;
diff --git a/Source/core/css/resolver/FilterOperationResolver.cpp b/Source/core/css/resolver/FilterOperationResolver.cpp
index 39d0f95..adedad5 100644
--- a/Source/core/css/resolver/FilterOperationResolver.cpp
+++ b/Source/core/css/resolver/FilterOperationResolver.cpp
@@ -34,7 +34,7 @@
 #include "core/css/CSSParser.h"
 #include "core/css/CSSPrimitiveValueMappings.h"
 #include "core/css/CSSShaderValue.h"
-#include "core/css/ShadowValue.h"
+#include "core/css/CSSShadowValue.h"
 #include "core/css/resolver/TransformBuilder.h"
 #include "core/platform/graphics/filters/custom/CustomFilterArrayParameter.h"
 #include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
@@ -102,8 +102,8 @@
 
 static StyleShader* styleShader(CSSValue* value, StyleResolverState& state)
 {
-    if (value->isCSSShaderValue())
-        return cachedOrPendingStyleShaderFromValue(static_cast<CSSShaderValue*>(value), state);
+    if (value->isShaderValue())
+        return cachedOrPendingStyleShaderFromValue(toCSSShaderValue(value), state);
     return 0;
 }
 
@@ -161,14 +161,14 @@
     if (!values->length())
         return 0;
 
-    if (parameterValue->isCSSArrayFunctionValue())
+    if (parameterValue->isArrayFunctionValue())
         return parseCustomFilterArrayParameter(name, values);
 
     // If the first value of the list is a transform function,
     // then we could safely assume that all the remaining items
     // are transforms. parseCustomFilterTransformParameter will
     // return 0 if that assumption is incorrect.
-    if (values->itemWithoutBoundsCheck(0)->isCSSTransformValue())
+    if (values->itemWithoutBoundsCheck(0)->isTransformValue())
         return parseCustomFilterTransformParameter(name, values, state);
 
     // We can have only arrays of booleans or numbers, so use the first value to choose between those two.
@@ -252,19 +252,25 @@
     unsigned shadersListLength = shadersList->length();
     ASSERT(shadersListLength);
 
-    CSSShaderValue* vertexShader = toCSSShaderValue(shadersList->itemWithoutBoundsCheck(0));
+    CSSShaderValue* vertexShader = 0;
     CSSShaderValue* fragmentShader = 0;
+
+    if (shadersList->itemWithoutBoundsCheck(0)->isShaderValue())
+        vertexShader = toCSSShaderValue(shadersList->itemWithoutBoundsCheck(0));
+
     CustomFilterProgramType programType = PROGRAM_TYPE_BLENDS_ELEMENT_TEXTURE;
     CustomFilterProgramMixSettings mixSettings;
 
     if (shadersListLength > 1) {
         CSSValue* fragmentShaderOrMixFunction = shadersList->itemWithoutBoundsCheck(1);
-        if (fragmentShaderOrMixFunction->isCSSMixFunctionValue()) {
-            CSSMixFunctionValue* mixFunction = static_cast<CSSMixFunctionValue*>(fragmentShaderOrMixFunction);
+        if (fragmentShaderOrMixFunction->isMixFunctionValue()) {
+            CSSMixFunctionValue* mixFunction = toCSSMixFunctionValue(fragmentShaderOrMixFunction);
             CSSValueListIterator iterator(mixFunction);
 
             ASSERT(mixFunction->length());
-            fragmentShader = toCSSShaderValue(iterator.value());
+            if (iterator.value()->isShaderValue())
+                fragmentShader = toCSSShaderValue(iterator.value());
+
             iterator.advance();
 
             ASSERT(mixFunction->length() <= 3);
@@ -280,7 +286,8 @@
             }
         } else {
             programType = PROGRAM_TYPE_NO_ELEMENT_TEXTURE;
-            fragmentShader = toCSSShaderValue(fragmentShaderOrMixFunction);
+            if (fragmentShaderOrMixFunction->isShaderValue())
+                fragmentShader = toCSSShaderValue(fragmentShaderOrMixFunction);
         }
     }
 
@@ -374,10 +381,10 @@
     FilterOperations operations;
     for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) {
         CSSValue* currValue = i.value();
-        if (!currValue->isCSSFilterValue())
+        if (!currValue->isFilterValue())
             continue;
 
-        CSSFilterValue* filterValue = static_cast<CSSFilterValue*>(i.value());
+        CSSFilterValue* filterValue = toCSSFilterValue(i.value());
         FilterOperation::OperationType operationType = filterOperationForType(filterValue->operationType());
 
         if (operationType == FilterOperation::VALIDATED_CUSTOM) {
@@ -398,10 +405,10 @@
                 continue;
             CSSValue* argument = filterValue->itemWithoutBoundsCheck(0);
 
-            if (!argument->isCSSSVGDocumentValue())
+            if (!argument->isSVGDocumentValue())
                 continue;
 
-            CSSSVGDocumentValue* svgDocumentValue = static_cast<CSSSVGDocumentValue*>(argument);
+            CSSSVGDocumentValue* svgDocumentValue = toCSSSVGDocumentValue(argument);
             KURL url = state.document().completeURL(svgDocumentValue->url());
 
             RefPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(svgDocumentValue->url(), url.fragmentIdentifier(), operationType);
@@ -416,7 +423,7 @@
         }
 
         // Check that all parameters are primitive values, with the
-        // exception of drop shadow which has a ShadowValue parameter.
+        // exception of drop shadow which has a CSSShadowValue parameter.
         if (operationType != FilterOperation::DROP_SHADOW) {
             bool haveNonPrimitiveValue = false;
             for (unsigned j = 0; j < filterValue->length(); ++j) {
@@ -484,7 +491,7 @@
             if (!cssValue->isShadowValue())
                 continue;
 
-            ShadowValue* item = static_cast<ShadowValue*>(cssValue);
+            CSSShadowValue* item = toCSSShadowValue(cssValue);
             IntPoint location(item->x->computeLength<int>(style, rootStyle, zoomFactor), item->y->computeLength<int>(style, rootStyle, zoomFactor));
             int blur = item->blur ? item->blur->computeLength<int>(style, rootStyle, zoomFactor) : 0;
             Color shadowColor;
diff --git a/Source/core/css/resolver/FontBuilder.cpp b/Source/core/css/resolver/FontBuilder.cpp
index 684f36d..b9655fc 100644
--- a/Source/core/css/resolver/FontBuilder.cpp
+++ b/Source/core/css/resolver/FontBuilder.cpp
@@ -24,13 +24,13 @@
 #include "core/css/resolver/FontBuilder.h"
 
 #include "core/css/CSSCalculationValue.h"
-#include "core/css/FontFeatureValue.h"
+#include "core/css/CSSFontFeatureValue.h"
 #include "core/css/FontSize.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
-#include "core/platform/text/LocaleToScriptMapping.h"
 #include "core/rendering/RenderTheme.h"
 #include "core/rendering/RenderView.h"
+#include "platform/text/LocaleToScriptMapping.h"
 
 namespace WebCore {
 
@@ -77,13 +77,6 @@
     m_fontDirty = false;
 }
 
-void FontBuilder::clear()
-{
-    m_document = 0;
-    m_style = 0;
-    m_fontDirty = false;
-}
-
 void FontBuilder::setInitial(float effectiveZoom)
 {
     ASSERT(m_document && m_document->settings());
@@ -505,7 +498,7 @@
         CSSValue* item = list->itemWithoutBoundsCheck(i);
         if (!item->isFontFeatureValue())
             continue;
-        FontFeatureValue* feature = static_cast<FontFeatureValue*>(item);
+        CSSFontFeatureValue* feature = toCSSFontFeatureValue(item);
         settings->append(FontFeature(feature->tag(), feature->value()));
     }
     scope.fontDescription().setFeatureSettings(settings.release());
diff --git a/Source/core/css/resolver/FontBuilder.h b/Source/core/css/resolver/FontBuilder.h
index 8aa5d38..847fed9 100644
--- a/Source/core/css/resolver/FontBuilder.h
+++ b/Source/core/css/resolver/FontBuilder.h
@@ -43,7 +43,6 @@
 
     // FIXME: The name is probably wrong, but matches StyleResolverState callsite for consistency.
     void initForStyleResolve(const Document&, RenderStyle*, bool useSVGZoomRules);
-    void clear();
 
     void setInitial(float effectiveZoom);
 
diff --git a/Source/core/css/resolver/MatchedPropertiesCache.cpp b/Source/core/css/resolver/MatchedPropertiesCache.cpp
index 1736795..d3c222a 100644
--- a/Source/core/css/resolver/MatchedPropertiesCache.cpp
+++ b/Source/core/css/resolver/MatchedPropertiesCache.cpp
@@ -148,6 +148,9 @@
         return false;
     if (style->hasCurrentColor())
         return false;
+    // CSSPropertyInternalCallback sets the rule's selector name into the RenderStyle, and that's not recalculated if the RenderStyle is loaded from the cache, so don't cache it.
+    if (!style->callbackSelectors().isEmpty())
+        return false;
     // The cache assumes static knowledge about which properties are inherited.
     if (parentStyle->hasExplicitlyInheritedProperties())
         return false;
diff --git a/Source/core/css/resolver/MatchedPropertiesCache.h b/Source/core/css/resolver/MatchedPropertiesCache.h
index f1ccc3d..2e5297d 100644
--- a/Source/core/css/resolver/MatchedPropertiesCache.h
+++ b/Source/core/css/resolver/MatchedPropertiesCache.h
@@ -25,7 +25,7 @@
 
 #include "core/css/resolver/MatchResult.h"
 
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/Forward.h"
 #include "wtf/HashMap.h"
 #include "wtf/Noncopyable.h"
diff --git a/Source/core/css/resolver/ScopedStyleResolver.cpp b/Source/core/css/resolver/ScopedStyleResolver.cpp
index cb60fdc..3bc70ed 100644
--- a/Source/core/css/resolver/ScopedStyleResolver.cpp
+++ b/Source/core/css/resolver/ScopedStyleResolver.cpp
@@ -34,6 +34,7 @@
 #include "core/css/RuleSet.h"
 #include "core/css/StyleRule.h"
 #include "core/css/resolver/StyleResolver.h" // For MatchRequest.
+#include "core/css/resolver/ViewportStyleResolver.h"
 #include "core/dom/Document.h"
 #include "core/dom/shadow/ElementShadow.h"
 #include "core/dom/shadow/ShadowRoot.h"
@@ -146,7 +147,7 @@
     bool applyAuthorStyles = treeScope.applyAuthorStyles();
 
     for (ScopedStyleResolver* scopedResolver = scopedResolverFor(element); scopedResolver; scopedResolver = scopedResolver->parent()) {
-        if (&scopedResolver->treeScope() == &treeScope || (applyAuthorStyles && &scopedResolver->treeScope() == &document))
+        if (scopedResolver->treeScope() == treeScope || (applyAuthorStyles && scopedResolver->treeScope() == document))
             resolvers.append(scopedResolver);
     }
 }
@@ -187,7 +188,7 @@
     if (!cacheIsValid(&scopingNode))
         return;
 
-    if (m_cache.scopedResolver && &m_cache.scopedResolver->scopingNode() == &scopingNode)
+    if (m_cache.scopedResolver && m_cache.scopedResolver->scopingNode() == scopingNode)
         m_cache.scopedResolver = m_cache.scopedResolver->parent();
     m_cache.nodeForScopedStyles = scopingNode.parentOrShadowHostNode();
 }
@@ -378,10 +379,10 @@
         shadowRoot = shadow->oldestShadowRoot();
 
     RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
-    collector.setBehaviorAtBoundary(static_cast<SelectorChecker::BehaviorAtBoundary>(SelectorChecker::DoesNotCrossBoundary | SelectorChecker::ScopeContainsLastMatchedElement));
+    SelectorChecker::BehaviorAtBoundary boundary = static_cast<SelectorChecker::BehaviorAtBoundary>(SelectorChecker::DoesNotCrossBoundary | SelectorChecker::ScopeContainsLastMatchedElement);
     for (; shadowRoot; shadowRoot = shadowRoot->youngerShadowRoot()) {
         if (RuleSet* ruleSet = atHostRuleSetFor(shadowRoot))
-            collector.collectMatchingRules(MatchRequest(ruleSet, includeEmptyRules, &m_scopingNode), ruleRange, cascadeScope);
+            collector.collectMatchingRules(MatchRequest(ruleSet, includeEmptyRules, &m_scopingNode), ruleRange, boundary, cascadeScope);
     }
 
     collector.sortAndTransferMatchedRules();
@@ -413,9 +414,8 @@
 
     MatchRequest matchRequest(m_authorStyle.get(), includeEmptyRules, scopingNode, applyAuthorStyles);
     RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
-    collector.setBehaviorAtBoundary(static_cast<SelectorChecker::BehaviorAtBoundary>(behaviorAtBoundary));
-    collector.collectMatchingRules(matchRequest, ruleRange, cascadeScope, cascadeOrder);
-    collector.collectMatchingRulesForRegion(matchRequest, ruleRange, cascadeScope, cascadeOrder);
+    collector.collectMatchingRules(matchRequest, ruleRange, static_cast<SelectorChecker::BehaviorAtBoundary>(behaviorAtBoundary), cascadeScope, cascadeOrder);
+    collector.collectMatchingRulesForRegion(matchRequest, ruleRange, static_cast<SelectorChecker::BehaviorAtBoundary>(behaviorAtBoundary), cascadeScope, cascadeOrder);
 }
 
 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector)
@@ -427,8 +427,10 @@
 
 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const
 {
+    // Only consider the global author RuleSet for @viewport rules.
+    ASSERT(m_scopingNode.isDocumentNode());
     if (m_authorStyle)
-        resolver->collectViewportRules(m_authorStyle.get(), StyleResolver::AuthorOrigin);
+        resolver->viewportStyleResolver()->collectViewportRules(m_authorStyle.get(), ViewportStyleResolver::AuthorOrigin);
 }
 
 } // namespace WebCore
diff --git a/Source/core/css/resolver/ScopedStyleResolver.h b/Source/core/css/resolver/ScopedStyleResolver.h
index 5372edd..09b1edf 100644
--- a/Source/core/css/resolver/ScopedStyleResolver.h
+++ b/Source/core/css/resolver/ScopedStyleResolver.h
@@ -60,7 +60,7 @@
     void setParent(ScopedStyleResolver* newParent) { m_parent = newParent; }
     ScopedStyleResolver* parent() { return m_parent; }
 
-    bool hasOnlyEmptyRuleSets() const { return !m_authorStyle->ruleCount() && m_atHostRules.isEmpty(); }
+    bool hasOnlyEmptyRuleSets() const { return (!m_authorStyle || !m_authorStyle->ruleCount()) && m_atHostRules.isEmpty(); }
 
 public:
     bool checkRegionStyle(Element*);
diff --git a/Source/core/css/resolver/SharedStyleFinder.cpp b/Source/core/css/resolver/SharedStyleFinder.cpp
index aad32e7..2a6dd7b 100644
--- a/Source/core/css/resolver/SharedStyleFinder.cpp
+++ b/Source/core/css/resolver/SharedStyleFinder.cpp
@@ -90,7 +90,7 @@
     if (element->isDefaultButtonForForm() != context.element()->isDefaultButtonForForm())
         return false;
 
-    if (context.document().containsValidityStyleRules()) {
+    if (element->document().containsValidityStyleRules()) {
         bool willValidate = element->willValidate();
 
         if (willValidate != context.element()->willValidate())
@@ -245,7 +245,7 @@
     if (element->isWebVTTElement() && context.element()->isWebVTTElement() && toWebVTTElement(element)->isPastNode() != toWebVTTElement(context.element())->isPastNode())
         return false;
 
-    if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExists(&context.document())) {
+    if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExists(&element->document())) {
         if (element == fullscreen->webkitCurrentFullScreenElement() || context.element() == fullscreen->webkitCurrentFullScreenElement())
             return false;
     }
@@ -297,7 +297,15 @@
     return 0;
 }
 
-RenderStyle* SharedStyleFinder::locateSharedStyle(const ElementResolveContext& context, RenderStyle* newStyle)
+bool SharedStyleFinder::matchesRuleSet(const ElementResolveContext& context, RuleSet* ruleSet)
+{
+    if (!ruleSet)
+        return false;
+    ElementRuleCollector collector(context, m_styleResolver->selectorFilter());
+    return collector.hasAnyMatchingRules(ruleSet);
+}
+
+RenderStyle* SharedStyleFinder::locateSharedStyle(const ElementResolveContext& context)
 {
     STYLE_STATS_ADD_SEARCH();
 
@@ -329,11 +337,8 @@
     if (!shareElement)
         return 0;
 
-    // Can't share if sibling rules apply. This is checked at the end as it should rarely fail.
-    if (m_styleResolver->styleSharingCandidateMatchesRuleSet(context, newStyle, m_siblingRuleSet))
-        return 0;
-    // Can't share if attribute rules apply.
-    if (m_styleResolver->styleSharingCandidateMatchesRuleSet(context, newStyle, m_uncommonAttributeRuleSet))
+    // Can't share if sibling or attribute rules apply. This is checked at the end as it should rarely fail.
+    if (matchesRuleSet(context, m_siblingRuleSet) || matchesRuleSet(context, m_uncommonAttributeRuleSet))
         return 0;
     // Tracking child index requires unique style for each node. This may get set by the sibling rule match above.
     if (parentElementPreventsSharing(context.element()->parentElement()))
diff --git a/Source/core/css/resolver/SharedStyleFinder.h b/Source/core/css/resolver/SharedStyleFinder.h
index d407279..1e12375 100644
--- a/Source/core/css/resolver/SharedStyleFinder.h
+++ b/Source/core/css/resolver/SharedStyleFinder.h
@@ -35,7 +35,6 @@
 
 class SharedStyleFinder {
 public:
-    // FIXME: StyleResolver* only used for calling styleSharingCandidateMatchesRuleSet.
     // RuleSets are passed non-const as the act of matching against them can cause them
     // to be compacted. :(
     SharedStyleFinder(const RuleFeatureSet& features, RuleSet* siblingRuleSet,
@@ -48,7 +47,7 @@
     { }
 
     // FIXME: It is not necessarily safe to call this method more than once.
-    RenderStyle* locateSharedStyle(const ElementResolveContext&, RenderStyle* newStyle);
+    RenderStyle* locateSharedStyle(const ElementResolveContext&);
 
 private:
     Element* findElementForStyleSharing(const ElementResolveContext&) const;
@@ -61,6 +60,7 @@
     bool canShareStyleWithElement(const ElementResolveContext&, Element*) const;
     bool canShareStyleWithControl(const ElementResolveContext&, Element*) const;
     bool sharingCandidateHasIdenticalStyleAffectingAttributes(const ElementResolveContext&, Element*) const;
+    bool matchesRuleSet(const ElementResolveContext&, RuleSet*);
 
     bool m_elementAffectedByClassRules;
     const RuleFeatureSet& m_features;
diff --git a/Source/core/css/resolver/StyleAdjuster.cpp b/Source/core/css/resolver/StyleAdjuster.cpp
index 10f572f..735e099 100644
--- a/Source/core/css/resolver/StyleAdjuster.cpp
+++ b/Source/core/css/resolver/StyleAdjuster.cpp
@@ -39,8 +39,7 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLTableElement.h"
 #include "core/html/HTMLTextAreaElement.h"
-#include "core/page/FrameView.h"
-#include "core/page/Page.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Settings.h"
 #include "core/platform/Length.h"
 #include "core/rendering/Pagination.h"
@@ -278,8 +277,9 @@
         || style->hasFilter()
         || style->hasBlendMode()
         || style->position() == StickyPosition
-        || (style->position() == FixedPosition && e && e->document().page() && e->document().page()->settings().fixedPositionCreatesStackingContext())
+        || (style->position() == FixedPosition && e && e->document().settings() && e->document().settings()->fixedPositionCreatesStackingContext())
         || isInTopLayer(e, style)
+        || style->hasFlowFrom()
         ))
         style->setZIndex(0);
 
@@ -336,10 +336,6 @@
     style->adjustBackgroundLayers();
     style->adjustMaskLayers();
 
-    // Do the same for animations and transitions.
-    style->adjustAnimations();
-    style->adjustTransitions();
-
     // Important: Intrinsic margins get added to controls before the theme has adjusted the style, since the theme will
     // alter fonts and heights/widths.
     if (e && e->isFormControlElement() && style->fontSize() >= 11) {
diff --git a/Source/core/css/resolver/StyleBuilderCustom.cpp b/Source/core/css/resolver/StyleBuilderCustom.cpp
index 24cdb1a..0bff4f1 100644
--- a/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -46,6 +46,7 @@
 #include "core/css/BasicShapeFunctions.h"
 #include "core/css/CSSAspectRatioValue.h"
 #include "core/css/CSSCursorImageValue.h"
+#include "core/css/CSSFontValue.h"
 #include "core/css/CSSFunctionValue.h"
 #include "core/css/CSSGradientValue.h"
 #include "core/css/CSSGridTemplateValue.h"
@@ -55,20 +56,20 @@
 #include "core/css/CSSPrimitiveValueMappings.h"
 #include "core/css/CSSProperty.h"
 #include "core/css/CSSReflectValue.h"
+#include "core/css/CSSShadowValue.h"
 #include "core/css/CSSVariableValue.h"
 #include "core/css/Counter.h"
-#include "core/css/FontValue.h"
 #include "core/css/Pair.h"
 #include "core/css/Rect.h"
-#include "core/css/ShadowValue.h"
 #include "core/css/StylePropertySet.h"
+#include "core/css/StyleRule.h"
 #include "core/css/resolver/ElementStyleResources.h"
 #include "core/css/resolver/FilterOperationResolver.h"
 #include "core/css/resolver/FontBuilder.h"
 #include "core/css/resolver/StyleBuilder.h"
 #include "core/css/resolver/StyleResolverState.h"
 #include "core/css/resolver/TransformBuilder.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
 #include "core/platform/graphics/FontDescription.h"
 #include "core/rendering/style/CounterContent.h"
@@ -151,7 +152,7 @@
         for (int i = 0; i < len; i++) {
             CSSValue* item = list->itemWithoutBoundsCheck(i);
             if (item->isCursorImageValue()) {
-                CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(item);
+                CSSCursorImageValue* image = toCSSCursorImageValue(item);
                 if (image->updateIfSVGCursorIsUsed(state.element())) // Elements with SVG cursors are not allowed to share style.
                     state.style()->setUnique();
                 state.style()->addCursor(state.styleImage(CSSPropertyCursor, image), image->hotSpot());
@@ -281,7 +282,7 @@
         lineHeight = primitiveValue->computeLength<Length>(state.style(), state.rootElementStyle(), multiplier);
     } else if (primitiveValue->isPercentage()) {
         // FIXME: percentage should not be restricted to an integer here.
-        lineHeight = Length((state.style()->fontSize() * primitiveValue->getIntValue()) / 100, Fixed);
+        lineHeight = Length((state.style()->computedFontSize() * primitiveValue->getIntValue()) / 100.0, Fixed);
     } else if (primitiveValue->isNumber()) {
         // FIXME: number and percentage values should produce the same type of Length (ie. Fixed or Percent).
         lineHeight = Length(primitiveValue->getDoubleValue() * 100.0, Percent);
@@ -799,7 +800,7 @@
 }
 
 #if ENABLE(CSS3_TEXT)
-void StyleBuilderFunctions::applyValueCSSPropetyWebkitTextUnderlinePosition(StyleResolverState& state, CSSValue* value)
+void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextUnderlinePosition(StyleResolverState& state, CSSValue* value)
 {
     // This is true if value is 'auto' or 'alphabetic'.
     if (value->isPrimitiveValue()) {
@@ -1207,8 +1208,8 @@
         return primitiveValue->hasVariableReference();
     }
 
-    if (value->isCalculationValue())
-        return static_cast<CSSCalcValue*>(value)->hasVariableReference();
+    if (value->isCalcValue())
+        return toCSSCalcValue(value)->hasVariableReference();
 
     if (value->isReflectValue()) {
         CSSReflectValue* reflectValue = toCSSReflectValue(value);
@@ -1327,9 +1328,9 @@
                 CSSValue* item = i.value();
                 if (item->isImageGeneratorValue()) {
                     if (item->isGradientValue())
-                        state.style()->setContent(StyleGeneratedImage::create(static_cast<CSSGradientValue*>(item)->gradientWithStylesResolved(state.document().textLinkColors(), state.style()->color()).get()), didSet);
+                        state.style()->setContent(StyleGeneratedImage::create(toCSSGradientValue(item)->gradientWithStylesResolved(state.document().textLinkColors(), state.style()->color()).get()), didSet);
                     else
-                        state.style()->setContent(StyleGeneratedImage::create(static_cast<CSSImageGeneratorValue*>(item)), didSet);
+                        state.style()->setContent(StyleGeneratedImage::create(toCSSImageGeneratorValue(item)), didSet);
                     didSet = true;
                 } else if (item->isImageSetValue()) {
                     state.style()->setContent(state.elementStyleResources().setOrPendingFromValue(CSSPropertyContent, toCSSImageSetValue(item)), didSet);
@@ -1502,7 +1503,7 @@
             CSSValue* currValue = i.value();
             if (!currValue->isShadowValue())
                 continue;
-            ShadowValue* item = static_cast<ShadowValue*>(currValue);
+            CSSShadowValue* item = toCSSShadowValue(currValue);
             int x = item->x->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor);
             int y = item->y->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor);
             int blur = item->blur ? item->blur->computeLength<int>(state.style(), state.rootElementStyle(), zoomFactor) : 0;
@@ -1632,6 +1633,15 @@
         state.style()->setTapHighlightColor(col);
         return;
     }
+    case CSSPropertyInternalCallback: {
+        if (isInherit || isInitial)
+            return;
+        if (primitiveValue && primitiveValue->getValueID() == CSSValueInternalPresence) {
+            state.style()->addCallbackSelector(state.currentRule()->selectorList().selectorsText());
+            return;
+        }
+        break;
+    }
     case CSSPropertyInvalid:
         return;
     // Directional properties are resolved by resolveDirectionAwareProperty() before the switch.
@@ -1717,11 +1727,10 @@
             return;
         }
 
-        if (!value->isCSSLineBoxContainValue())
+        if (!value->isLineBoxContainValue())
             return;
 
-        CSSLineBoxContainValue* lineBoxContainValue = static_cast<CSSLineBoxContainValue*>(value);
-        state.style()->setLineBoxContain(lineBoxContainValue->value());
+        state.style()->setLineBoxContain(toCSSLineBoxContainValue(value)->value());
         return;
     }
 
@@ -1986,6 +1995,7 @@
     case CSSPropertyTextDecorationStyle:
     case CSSPropertyTextDecorationColor:
     case CSSPropertyTextIndent:
+    case CSSPropertyTextJustify:
     case CSSPropertyTextOverflow:
     case CSSPropertyTextRendering:
     case CSSPropertyTextTransform:
@@ -2028,6 +2038,7 @@
     case CSSPropertyWebkitColumnBreakBefore:
     case CSSPropertyWebkitColumnBreakInside:
     case CSSPropertyWebkitColumnCount:
+    case CSSPropertyColumnFill:
     case CSSPropertyWebkitColumnGap:
     case CSSPropertyWebkitColumnProgression:
     case CSSPropertyWebkitColumnRuleColor:
@@ -2112,6 +2123,7 @@
     case CSSPropertyWebkitWrapFlow:
     case CSSPropertyWebkitShapeMargin:
     case CSSPropertyWebkitShapePadding:
+    case CSSPropertyWebkitShapeImageThreshold:
     case CSSPropertyWebkitWrapThrough:
     case CSSPropertyWebkitShapeInside:
     case CSSPropertyWebkitShapeOutside:
@@ -2205,7 +2217,7 @@
             return;
         }
         if (value->isSVGPaint()) {
-            SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
+            SVGPaint* svgPaint = toSVGPaint(value);
             svgStyle->setFillPaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style()->color()), svgPaint->uri(), state.applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle());
         }
         break;
@@ -2223,7 +2235,7 @@
             return;
         }
         if (value->isSVGPaint()) {
-            SVGPaint* svgPaint = static_cast<SVGPaint*>(value);
+            SVGPaint* svgPaint = toSVGPaint(value);
             svgStyle->setStrokePaint(svgPaint->paintType(), colorFromSVGColorCSSValue(svgPaint, state.style()->color()), svgPaint->uri(), state.applyPropertyToRegularStyle(), state.applyPropertyToVisitedLinkStyle());
         }
         break;
@@ -2344,14 +2356,14 @@
     {
         HANDLE_SVG_INHERIT_AND_INITIAL(stopColor, StopColor);
         if (value->isSVGColor())
-            state.style()->accessSVGStyle()->setStopColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style()->color()));
+            state.style()->accessSVGStyle()->setStopColor(colorFromSVGColorCSSValue(toSVGColor(value), state.style()->color()));
         break;
     }
     case CSSPropertyLightingColor:
     {
         HANDLE_SVG_INHERIT_AND_INITIAL(lightingColor, LightingColor);
         if (value->isSVGColor())
-            state.style()->accessSVGStyle()->setLightingColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style()->color()));
+            state.style()->accessSVGStyle()->setLightingColor(colorFromSVGColorCSSValue(toSVGColor(value), state.style()->color()));
         break;
     }
     case CSSPropertyFloodOpacity:
@@ -2366,7 +2378,7 @@
     {
         HANDLE_SVG_INHERIT_AND_INITIAL(floodColor, FloodColor);
         if (value->isSVGColor())
-            state.style()->accessSVGStyle()->setFloodColor(colorFromSVGColorCSSValue(static_cast<SVGColor*>(value), state.style()->color()));
+            state.style()->accessSVGStyle()->setFloodColor(colorFromSVGColorCSSValue(toSVGColor(value), state.style()->color()));
         break;
     }
     case CSSPropertyGlyphOrientationHorizontal:
diff --git a/Source/core/css/resolver/StyleBuilderCustom.h b/Source/core/css/resolver/StyleBuilderCustom.h
index 597c501..e2156f0 100644
--- a/Source/core/css/resolver/StyleBuilderCustom.h
+++ b/Source/core/css/resolver/StyleBuilderCustom.h
@@ -53,9 +53,8 @@
 template <typename T>
 T StyleBuilderConverter::convertComputedLength(StyleResolverState& state, CSSValue* value)
 {
-    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
     float zoom = state.style()->effectiveZoom();
-    return primitiveValue->computeLength<T>(state.style(), state.rootElementStyle(), zoom);
+    return toCSSPrimitiveValue(value)->computeLength<T>(state.style(), state.rootElementStyle(), zoom);
 }
 
 template <typename T>
@@ -69,6 +68,8 @@
         return 3;
     if (valueID == CSSValueThick)
         return 5;
+    if (primitiveValue->isViewportPercentageLength())
+        return intValueForLength(primitiveValue->viewportPercentageLength(), 0, state.document().renderView());
     if (valueID == CSSValueInvalid) {
         float zoom = state.style()->effectiveZoom();
         // Any original result that was >= 1 should not be allowed to fall below 1.
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index 63748e5..4a880f6 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -33,7 +33,7 @@
 #include "HTMLNames.h"
 #include "RuntimeEnabledFeatures.h"
 #include "StylePropertyShorthand.h"
-#include "core/animation/AnimatableNumber.h"
+#include "core/animation/AnimatableLength.h"
 #include "core/animation/AnimatableValue.h"
 #include "core/animation/Animation.h"
 #include "core/animation/DocumentTimeline.h"
@@ -63,6 +63,7 @@
 #include "core/css/resolver/StyleAdjuster.h"
 #include "core/css/resolver/StyleBuilder.h"
 #include "core/css/resolver/ViewportStyleResolver.h"
+#include "core/dom/CSSSelectorWatch.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/dom/StyleEngine.h"
 #include "core/dom/Text.h"
@@ -70,8 +71,8 @@
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLIFrameElement.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/style/KeyframeList.h"
 #include "core/rendering/style/StyleCustomFilterProgramCache.h"
@@ -83,6 +84,32 @@
 
 using namespace std;
 
+namespace {
+
+using namespace WebCore;
+
+PassRefPtr<TimingFunction> generateTimingFunction(const KeyframeAnimationEffect::KeyframeVector keyframes, const HashMap<double, RefPtr<TimingFunction> > perKeyframeTimingFunctions)
+{
+    // Generate the chained timing function. Note that timing functions apply
+    // from the keyframe in which they're specified to the next keyframe.
+    bool isTimingFunctionLinearThroughout = true;
+    RefPtr<ChainedTimingFunction> chainedTimingFunction = ChainedTimingFunction::create();
+    for (size_t i = 0; i < keyframes.size() - 1; ++i) {
+        double lowerBound = keyframes[i]->offset();
+        ASSERT(lowerBound >=0 && lowerBound < 1);
+        double upperBound = keyframes[i + 1]->offset();
+        ASSERT(upperBound > 0 && upperBound <= 1);
+        TimingFunction* timingFunction = perKeyframeTimingFunctions.get(lowerBound);
+        isTimingFunctionLinearThroughout &= timingFunction->type() == TimingFunction::LinearFunction;
+        chainedTimingFunction->appendSegment(upperBound, timingFunction);
+    }
+    if (isTimingFunctionLinearThroughout)
+        return LinearTimingFunction::create();
+    return chainedTimingFunction;
+}
+
+} // namespace
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -114,6 +141,8 @@
 {
     Element* root = document.documentElement();
 
+    m_fontSelector->registerForInvalidationCallbacks(this);
+
     CSSDefaultStyleSheets::initDefaultStyle(root);
 
     // construct document root element default style. this is needed
@@ -137,7 +166,7 @@
     m_styleTree.clear();
 
     StyleEngine* styleSheetCollection = document.styleEngine();
-    m_ruleSets.initUserStyle(styleSheetCollection, *m_medium, *this);
+    m_ruleSets.initUserStyle(styleSheetCollection, CSSSelectorWatch::from(document).watchedCallbackSelectors(), *m_medium, *this);
 
 #if ENABLE(SVG_FONTS)
     if (document.svgExtensions()) {
@@ -159,7 +188,7 @@
     for (unsigned i = firstNew; i < size; ++i) {
         CSSStyleSheet* cssSheet = styleSheets[i].get();
         ASSERT(!cssSheet->disabled());
-        if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), this))
+        if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), &m_viewportDependentMediaQueryResults))
             continue;
 
         StyleSheetContents* sheet = cssSheet->contents();
@@ -295,6 +324,12 @@
     m_styleSharingList.clear();
 }
 
+void StyleResolver::fontsNeedUpdate(FontSelector* fontSelector)
+{
+    invalidateMatchedPropertiesCache();
+    m_document.setNeedsStyleRecalc();
+}
+
 void StyleResolver::pushParentElement(Element* parent)
 {
     ASSERT(parent);
@@ -338,34 +373,31 @@
 
 StyleResolver::~StyleResolver()
 {
+    m_fontSelector->unregisterForInvalidationCallbacks(this);
     m_fontSelector->clearDocument();
     m_viewportStyleResolver->clearDocument();
 }
 
-inline void StyleResolver::matchShadowDistributedRules(ElementRuleCollector& collector, bool includeEmptyRules)
+inline void StyleResolver::collectShadowDistributedRules(ElementRuleCollector& collector, bool includeEmptyRules)
 {
-    // FIXME: Determine tree position.
-    CascadeScope cascadeScope = ignoreCascadeScope;
-
     if (m_ruleSets.shadowDistributedRules().isEmpty())
         return;
 
     bool previousCanUseFastReject = collector.canUseFastReject();
-    SelectorChecker::BehaviorAtBoundary previousBoundary = collector.behaviorAtBoundary();
-    collector.setBehaviorAtBoundary(static_cast<SelectorChecker::BehaviorAtBoundary>(SelectorChecker::CrossesBoundary | SelectorChecker::ScopeContainsLastMatchedElement));
     collector.setCanUseFastReject(false);
 
-    collector.clearMatchedRules();
-    collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().matchedProperties.size() - 1;
     RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
 
-    Vector<MatchRequest> matchRequests;
-    m_ruleSets.shadowDistributedRules().collectMatchRequests(includeEmptyRules, matchRequests);
-    for (size_t i = 0; i < matchRequests.size(); ++i)
-        collector.collectMatchingRules(matchRequests[i], ruleRange, cascadeScope);
-    collector.sortAndTransferMatchedRules();
+    for (ShadowDistributedRules::iterator it = m_ruleSets.shadowDistributedRules().begin(); it != m_ruleSets.shadowDistributedRules().end(); ++it) {
+        unsigned boundaryBehavior = SelectorChecker::CrossesBoundary | SelectorChecker::ScopeContainsLastMatchedElement;
+        const ContainerNode* scopingNode = it->key;
 
-    collector.setBehaviorAtBoundary(previousBoundary);
+        if (scopingNode && scopingNode->isShadowRoot()) {
+            boundaryBehavior |= SelectorChecker::ScopeIsShadowHost;
+            scopingNode = toShadowRoot(scopingNode)->host();
+        }
+        collector.collectMatchingRules(MatchRequest(it->value.get(), includeEmptyRules, scopingNode), ruleRange, static_cast<SelectorChecker::BehaviorAtBoundary>(boundaryBehavior), ignoreCascadeScope);
+    }
     collector.setCanUseFastReject(previousCanUseFastReject);
 }
 
@@ -381,7 +413,7 @@
     return element->treeScope().applyAuthorStyles() || (element->shadow() && element->shadow()->applyAuthorStyles());
 }
 
-void StyleResolver::matchScopedAuthorRulesForShadowHost(Element* element, ElementRuleCollector& collector, bool includeEmptyRules, Vector<ScopedStyleResolver*, 8>& resolvers, Vector<ScopedStyleResolver*, 8>& resolversInShadowTree)
+void StyleResolver::matchAuthorRulesForShadowHost(Element* element, ElementRuleCollector& collector, bool includeEmptyRules, Vector<ScopedStyleResolver*, 8>& resolvers, Vector<ScopedStyleResolver*, 8>& resolversInShadowTree)
 {
     collector.clearMatchedRules();
     collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().matchedProperties.size() - 1;
@@ -393,19 +425,20 @@
     for (int j = resolversInShadowTree.size() - 1; j >= 0; --j)
         resolversInShadowTree.at(j)->collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, cascadeScope, cascadeOrder++);
 
-    if (resolvers.isEmpty() || &resolvers.first()->treeScope() != &element->treeScope())
+    if (resolvers.isEmpty() || resolvers.first()->treeScope() != element->treeScope())
         ++cascadeScope;
     cascadeOrder += resolvers.size();
     for (unsigned i = 0; i < resolvers.size(); ++i)
         resolvers.at(i)->collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, cascadeScope++, --cascadeOrder);
 
+    collectShadowDistributedRules(collector, includeEmptyRules);
     collector.sortAndTransferMatchedRules();
 
     if (!resolvers.isEmpty())
         matchHostRules(element, resolvers.first(), collector, includeEmptyRules);
 }
 
-void StyleResolver::matchScopedAuthorRules(Element* element, ElementRuleCollector& collector, bool includeEmptyRules)
+void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& collector, bool includeEmptyRules)
 {
     if (m_styleTree.hasOnlyScopedResolverForDocument()) {
         m_styleTree.scopedStyleResolverForDocument()->matchAuthorRules(collector, includeEmptyRules, applyAuthorStylesOf(element));
@@ -418,7 +451,7 @@
     Vector<ScopedStyleResolver*, 8> resolversInShadowTree;
     m_styleTree.collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree);
     if (!resolversInShadowTree.isEmpty()) {
-        matchScopedAuthorRulesForShadowHost(element, collector, includeEmptyRules, resolvers, resolversInShadowTree);
+        matchAuthorRulesForShadowHost(element, collector, includeEmptyRules, resolvers, resolversInShadowTree);
         return;
     }
 
@@ -434,20 +467,15 @@
     for (unsigned i = 0; i < resolvers.size(); ++i, --cascadeOrder) {
         ScopedStyleResolver* resolver = resolvers.at(i);
         // FIXME: Need to clarify how to treat style scoped.
-        resolver->collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, cascadeScope++, &resolver->treeScope() == &element->treeScope() && resolver->scopingNode().isShadowRoot() ? 0 : cascadeOrder);
+        resolver->collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, cascadeScope++, resolver->treeScope() == element->treeScope() && resolver->scopingNode().isShadowRoot() ? 0 : cascadeOrder);
     }
 
+    collectShadowDistributedRules(collector, includeEmptyRules);
     collector.sortAndTransferMatchedRules();
 
     matchHostRules(element, resolvers.first(), collector, includeEmptyRules);
 }
 
-void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& collector, bool includeEmptyRules)
-{
-    matchScopedAuthorRules(element, collector, includeEmptyRules);
-    matchShadowDistributedRules(collector, includeEmptyRules);
-}
-
 void StyleResolver::matchUserRules(ElementRuleCollector& collector, bool includeEmptyRules)
 {
     if (!m_ruleSets.userStyle())
@@ -546,15 +574,6 @@
     }
 }
 
-bool StyleResolver::styleSharingCandidateMatchesRuleSet(const ElementResolveContext& context, RenderStyle* style, RuleSet* ruleSet)
-{
-    if (!ruleSet)
-        return false;
-
-    ElementRuleCollector collector(context, m_selectorFilter, style);
-    return collector.hasAnyMatchingRules(ruleSet);
-}
-
 PassRefPtr<RenderStyle> StyleResolver::styleForDocument(Document& document, CSSFontSelector* fontSelector)
 {
     const Frame* frame = document.frame();
@@ -631,7 +650,7 @@
 
     if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoint() && state.parentStyle()) {
         SharedStyleFinder styleFinder(m_features, m_siblingRuleSet.get(), m_uncommonAttributeRuleSet.get(), this);
-        RefPtr<RenderStyle> sharedStyle = styleFinder.locateSharedStyle(state.elementContext(), state.style());
+        RefPtr<RenderStyle> sharedStyle = styleFinder.locateSharedStyle(state.elementContext());
         if (sharedStyle)
             return sharedStyle.release();
     }
@@ -689,6 +708,7 @@
         StyleAdjuster adjuster(state.cachedUAStyle(), m_document.inQuirksMode());
         adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element);
     }
+
     document().didAccessStyleResolver();
 
     // FIXME: Shouldn't this be on RenderBody::styleDidChange?
@@ -833,19 +853,23 @@
     }
 }
 
-void StyleResolver::resolveKeyframes(const Element* element, const RenderStyle* style, const AtomicString& name, TimingFunction* defaultTimingFunction, KeyframeAnimationEffect::KeyframeVector& keyframes, RefPtr<TimingFunction>& timingFunction)
+void StyleResolver::resolveKeyframes(Element* element, const RenderStyle* style, const AtomicString& name, TimingFunction* defaultTimingFunction, Vector<std::pair<KeyframeAnimationEffect::KeyframeVector, RefPtr<TimingFunction> > >& keyframesAndTimingFunctions)
 {
     ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled());
     const StyleRuleKeyframes* keyframesRule = matchScopedKeyframesRule(element, name.impl());
     if (!keyframesRule)
         return;
 
-    // Construct and populate the style for each keyframe
-    HashMap<double, RefPtr<TimingFunction> > timingFunctions;
     const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyframes();
+    if (styleKeyframes.isEmpty())
+        return;
+
+    // Construct and populate the style for each keyframe
+    KeyframeAnimationEffect::KeyframeVector keyframes;
+    HashMap<double, RefPtr<TimingFunction> > perKeyframeTimingFunctions;
     for (size_t i = 0; i < styleKeyframes.size(); ++i) {
         const StyleKeyframe* styleKeyframe = styleKeyframes[i].get();
-        RefPtr<RenderStyle> keyframeStyle = styleForKeyframe(0, style, styleKeyframe);
+        RefPtr<RenderStyle> keyframeStyle = styleForKeyframe(element, style, styleKeyframe);
         RefPtr<Keyframe> keyframe = Keyframe::create();
         const Vector<double>& offsets = styleKeyframe->keys();
         ASSERT(!offsets.isEmpty());
@@ -856,7 +880,6 @@
             CSSPropertyID property = properties->propertyAt(j).id();
             if (property == CSSPropertyWebkitAnimationTimingFunction || property == CSSPropertyAnimationTimingFunction) {
                 // FIXME: This sometimes gets the wrong timing function. See crbug.com/288540.
-
                 timingFunction = KeyframeValue::timingFunction(keyframeStyle.get(), name);
             } else if (CSSAnimations::isAnimatableProperty(property)) {
                 keyframe->setPropertyValue(property, CSSAnimatableValueFactory::create(property, keyframeStyle.get()).get());
@@ -864,15 +887,16 @@
         }
         keyframes.append(keyframe);
         // The last keyframe specified at a given offset is used.
-        timingFunctions.set(offsets[0], timingFunction);
+        perKeyframeTimingFunctions.set(offsets[0], timingFunction);
         for (size_t j = 1; j < offsets.size(); ++j) {
             keyframes.append(keyframe->cloneWithOffset(offsets[j]));
-            timingFunctions.set(offsets[j], timingFunction);
+            perKeyframeTimingFunctions.set(offsets[j], timingFunction);
         }
     }
+    ASSERT(!keyframes.isEmpty());
 
-    if (keyframes.isEmpty())
-        return;
+    if (!perKeyframeTimingFunctions.contains(0))
+        perKeyframeTimingFunctions.set(0, defaultTimingFunction);
 
     // Remove duplicate keyframes. In CSS the last keyframe at a given offset takes priority.
     std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffsets);
@@ -902,59 +926,92 @@
     ASSERT(!keyframes.first()->offset());
     ASSERT(keyframes.last()->offset() == 1);
 
-    // Generate the chained timing function. Note that timing functions apply
-    // from the keyframe in which they're specified to the next keyframe.
-    // FIXME: Handle keyframe sets where some keyframes don't specify all
-    // properties. In this case, timing functions apply between the keyframes
-    // which specify a particular property, so we'll need a separate chained
-    // timing function (and therefore animation) for each property. See
-    // LayoutTests/animations/missing-keyframe-properties-timing-function.html
-    if (!timingFunctions.contains(0))
-        timingFunctions.set(0, defaultTimingFunction);
-    bool isTimingFunctionLinearThroughout = true;
-    RefPtr<ChainedTimingFunction> chainedTimingFunction = ChainedTimingFunction::create();
-    for (size_t i = 0; i < keyframes.size() - 1; ++i) {
-        double lowerBound = keyframes[i]->offset();
-        ASSERT(lowerBound >=0 && lowerBound < 1);
-        double upperBound = keyframes[i + 1]->offset();
-        ASSERT(upperBound > 0 && upperBound <= 1);
-        TimingFunction* timingFunction = timingFunctions.get(lowerBound);
-        ASSERT(timingFunction);
-        isTimingFunctionLinearThroughout &= timingFunction->type() == TimingFunction::LinearFunction;
-        chainedTimingFunction->appendSegment(upperBound, timingFunction);
-    }
-    if (isTimingFunctionLinearThroughout)
-        timingFunction = LinearTimingFunction::create();
-    else
-        timingFunction = chainedTimingFunction;
-
     // Snapshot current property values for 0% and 100% if missing.
-    HashSet<CSSPropertyID> allProperties;
-    for (size_t i = 0; i < keyframes.size(); i++) {
-        const HashSet<CSSPropertyID>& keyframeProperties = keyframes[i]->properties();
-        for (HashSet<CSSPropertyID>::const_iterator iter = keyframeProperties.begin(); iter != keyframeProperties.end(); ++iter)
+    PropertySet allProperties;
+    size_t numKeyframes = keyframes.size();
+    for (size_t i = 0; i < numKeyframes; i++) {
+        const PropertySet& keyframeProperties = keyframes[i]->properties();
+        for (PropertySet::const_iterator iter = keyframeProperties.begin(); iter != keyframeProperties.end(); ++iter)
             allProperties.add(*iter);
     }
-    const HashSet<CSSPropertyID>& startKeyframeProperties = startKeyframe->properties();
-    const HashSet<CSSPropertyID>& endKeyframeProperties = endKeyframe->properties();
+    const PropertySet& startKeyframeProperties = startKeyframe->properties();
+    const PropertySet& endKeyframeProperties = endKeyframe->properties();
     bool missingStartValues = startKeyframeProperties.size() < allProperties.size();
     bool missingEndValues = endKeyframeProperties.size() < allProperties.size();
-    if (!missingStartValues && !missingEndValues)
-        return;
-    for (HashSet<CSSPropertyID>::const_iterator iter = allProperties.begin(); iter != allProperties.end(); ++iter) {
-        const CSSPropertyID property = *iter;
-        bool startNeedsValue = missingStartValues && !startKeyframeProperties.contains(property);
-        bool endNeedsValue = missingEndValues && !endKeyframeProperties.contains(property);
-        if (!startNeedsValue && !endNeedsValue)
-            continue;
-        RefPtr<AnimatableValue> snapshotValue = CSSAnimatableValueFactory::create(property, style);
-        if (startNeedsValue)
-            startKeyframe->setPropertyValue(property, snapshotValue.get());
-        if (endNeedsValue)
-            endKeyframe->setPropertyValue(property, snapshotValue.get());
+    if (missingStartValues || missingEndValues) {
+        for (PropertySet::const_iterator iter = allProperties.begin(); iter != allProperties.end(); ++iter) {
+            const CSSPropertyID property = *iter;
+            bool startNeedsValue = missingStartValues && !startKeyframeProperties.contains(property);
+            bool endNeedsValue = missingEndValues && !endKeyframeProperties.contains(property);
+            if (!startNeedsValue && !endNeedsValue)
+                continue;
+            RefPtr<AnimatableValue> snapshotValue = CSSAnimatableValueFactory::create(property, style);
+            if (startNeedsValue)
+                startKeyframe->setPropertyValue(property, snapshotValue.get());
+            if (endNeedsValue)
+                endKeyframe->setPropertyValue(property, snapshotValue.get());
+        }
     }
     ASSERT(startKeyframe->properties().size() == allProperties.size());
     ASSERT(endKeyframe->properties().size() == allProperties.size());
+
+    // Determine how many keyframes specify each property. Note that this must
+    // be done after we've filled in end keyframes.
+    typedef HashCountedSet<CSSPropertyID> PropertyCountedSet;
+    PropertyCountedSet propertyCounts;
+    for (size_t i = 0; i < numKeyframes; ++i) {
+        const PropertySet& properties = keyframes[i]->properties();
+        for (PropertySet::const_iterator iter = properties.begin(); iter != properties.end(); ++iter)
+            propertyCounts.add(*iter);
+    }
+
+    // Split keyframes into groups, where each group contains only keyframes
+    // which specify all properties used in that group. Each group is animated
+    // in a separate animation, to allow per-keyframe timing functions to be
+    // applied correctly.
+    for (PropertyCountedSet::const_iterator iter = propertyCounts.begin(); iter != propertyCounts.end(); ++iter) {
+        const CSSPropertyID property = iter->key;
+        const size_t count = iter->value;
+        ASSERT(count <= numKeyframes);
+        if (count == numKeyframes)
+            continue;
+        KeyframeAnimationEffect::KeyframeVector splitOutKeyframes;
+        for (size_t i = 0; i < numKeyframes; i++) {
+            Keyframe* keyframe = keyframes[i].get();
+            if (!keyframe->properties().contains(property)) {
+                ASSERT(i && i != numKeyframes - 1);
+                continue;
+            }
+            RefPtr<Keyframe> clonedKeyframe = Keyframe::create();
+            clonedKeyframe->setOffset(keyframe->offset());
+            clonedKeyframe->setComposite(keyframe->composite());
+            clonedKeyframe->setPropertyValue(property, keyframe->propertyValue(property));
+            splitOutKeyframes.append(clonedKeyframe);
+            // Note that it's OK if this keyframe ends up having no
+            // properties. This can only happen when none of the properties
+            // are specified in all keyframes, in which case we won't animate
+            // anything with these keyframes.
+            keyframe->clearPropertyValue(property);
+        }
+        ASSERT(!splitOutKeyframes.first()->offset());
+        ASSERT(splitOutKeyframes.last()->offset() == 1);
+#ifndef NDEBUG
+        for (size_t j = 0; j < splitOutKeyframes.size(); ++j)
+            ASSERT(splitOutKeyframes[j]->properties().size() == 1);
+#endif
+        keyframesAndTimingFunctions.append(std::make_pair(splitOutKeyframes, generateTimingFunction(splitOutKeyframes, perKeyframeTimingFunctions)));
+    }
+
+    size_t numPropertiesSpecifiedInAllKeyframes = keyframes.first()->properties().size();
+#ifndef NDEBUG
+    for (size_t i = 1; i < numKeyframes; ++i)
+        ASSERT(keyframes[i]->properties().size() == numPropertiesSpecifiedInAllKeyframes);
+#endif
+
+    // If the animation specifies any keyframes, we always provide at least one
+    // vector of resolved keyframes, even if no properties are animated.
+    if (numPropertiesSpecifiedInAllKeyframes || keyframesAndTimingFunctions.isEmpty())
+        keyframesAndTimingFunctions.append(std::make_pair(keyframes, generateTimingFunction(keyframes, perKeyframeTimingFunctions)));
 }
 
 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
@@ -982,7 +1039,7 @@
 
     {
         // Check UA, user and author rules.
-    ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style());
+        ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style());
         collector.setPseudoStyleRequest(pseudoStyleRequest);
 
         matchUARules(collector);
@@ -1007,9 +1064,6 @@
         adjuster.adjustRenderStyle(state.style(), state.parentStyle(), 0);
     }
 
-    // Start loading resources referenced by this style.
-    m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyleResources());
-
     document().didAccessStyleResolver();
 
     // Now return the style.
@@ -1022,12 +1076,13 @@
     StyleResolverState state(document(), document().documentElement()); // m_rootElementStyle will be set to the document style.
 
     state.setStyle(RenderStyle::create());
-    if (state.rootElementStyle())
-        state.style()->inheritFrom(state.rootElementStyle());
+    const RenderStyle* rootElementStyle = state.rootElementStyle() ? state.rootElementStyle() : document().renderStyle();
+    ASSERT(rootElementStyle);
+    state.style()->inheritFrom(rootElementStyle);
 
     state.fontBuilder().initForStyleResolve(state.document(), state.style(), state.useSVGZoomRules());
 
-    PageRuleCollector collector(state.elementContext(), pageIndex);
+    PageRuleCollector collector(rootElementStyle, pageIndex);
 
     collector.matchPageRules(CSSDefaultStyleSheets::defaultPrintStyle);
     collector.matchPageRules(m_ruleSets.userStyle());
@@ -1064,13 +1119,13 @@
 
 void StyleResolver::collectViewportRules()
 {
-    collectViewportRules(CSSDefaultStyleSheets::defaultStyle, UserAgentOrigin);
+    viewportStyleResolver()->collectViewportRules(CSSDefaultStyleSheets::defaultStyle, ViewportStyleResolver::UserAgentOrigin);
 
     if (document().isMobileDocument())
-        collectViewportRules(CSSDefaultStyleSheets::xhtmlMobileProfileStyle(), UserAgentOrigin);
+        viewportStyleResolver()->collectViewportRules(CSSDefaultStyleSheets::xhtmlMobileProfileStyle(), ViewportStyleResolver::UserAgentOrigin);
 
     if (m_ruleSets.userStyle())
-        collectViewportRules(m_ruleSets.userStyle(), UserAgentOrigin);
+        viewportStyleResolver()->collectViewportRules(m_ruleSets.userStyle(), ViewportStyleResolver::UserAgentOrigin);
 
     if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverForDocument())
         scopedResolver->collectViewportRulesTo(this);
@@ -1078,17 +1133,6 @@
     viewportStyleResolver()->resolve();
 }
 
-void StyleResolver::collectViewportRules(RuleSet* rules, ViewportOrigin origin)
-{
-    rules->compactRulesIfNeeded();
-
-    const Vector<StyleRuleViewport*>& viewportRules = rules->viewportRules();
-    if (origin == AuthorOrigin && viewportRules.size())
-        viewportStyleResolver()->setHasAuthorStyle();
-    for (size_t i = 0; i < viewportRules.size(); ++i)
-        viewportStyleResolver()->addViewportRule(viewportRules[i]);
-}
-
 PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement()
 {
     StyleResolverState state(document(), 0);
@@ -1187,27 +1231,27 @@
     const Element* element = state.element();
     const CSSAnimationUpdate* update = state.animationUpdate();
     AnimationStack* animationStack = timeline->animationStack(element);
-    if (!animationStack)
-        return false;
     bool didApply = false;
 
-    const Vector<Animation*>& animations = animationStack->activeAnimations(element);
-    for (size_t i = 0; i < animations.size(); ++i) {
-        RefPtr<Animation> animation = animations.at(i);
-        if (update && update->isCancelled(animation->player()))
-            continue;
-        const AnimationEffect::CompositableValueMap* compositableValues = animation->compositableValues();
-        for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues->begin(); iter != compositableValues->end(); ++iter) {
-            CSSPropertyID property = iter->key;
-            if (!isPropertyForPass<pass>(property))
+    if (animationStack) {
+        const Vector<Animation*>& animations = animationStack->activeAnimations(element);
+        for (size_t i = 0; i < animations.size(); ++i) {
+            RefPtr<Animation> animation = animations.at(i);
+            if (update && update->isCancelledAnimation(animation->player()))
                 continue;
-            RELEASE_ASSERT_WITH_MESSAGE(!iter->value->dependsOnUnderlyingValue(), "Not yet implemented: An interface for compositing onto the underlying value.");
-            RefPtr<AnimatableValue> animatableValue = iter->value->compositeOnto(0);
-            if (pass == HighPriorityProperties && property == CSSPropertyLineHeight)
-                state.setLineHeightValue(toAnimatableNumber(animatableValue.get())->toCSSValue().get());
-            else
-                AnimatedStyleBuilder::applyProperty(property, state, animatableValue.get());
-            didApply = true;
+            const AnimationEffect::CompositableValueMap* compositableValues = animation->compositableValues();
+            for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues->begin(); iter != compositableValues->end(); ++iter) {
+                CSSPropertyID property = iter->key;
+                if (!isPropertyForPass<pass>(property))
+                    continue;
+                RELEASE_ASSERT_WITH_MESSAGE(!iter->value->dependsOnUnderlyingValue(), "Web Animations not yet implemented: An interface for compositing onto the underlying value.");
+                RefPtr<AnimatableValue> animatableValue = iter->value->compositeOnto(0);
+                if (pass == HighPriorityProperties && property == CSSPropertyLineHeight)
+                    state.setLineHeightValue(toAnimatableLength(animatableValue.get())->toCSSValue().get());
+                else
+                    AnimatedStyleBuilder::applyProperty(property, state, animatableValue.get());
+                didApply = true;
+            }
         }
     }
 
@@ -1220,20 +1264,22 @@
     //     applyAnimatedProperties(state, resolved);
     const Vector<CSSAnimationUpdate::NewAnimation>& newAnimations = update->newAnimations();
     for (size_t i = 0; i < newAnimations.size(); ++i) {
-        RefPtr<InertAnimation> animation = newAnimations.at(i).animation;
-        OwnPtr<AnimationEffect::CompositableValueMap> compositableValues = animation->sample();
-        if (!compositableValues)
-            continue;
-        for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues->begin(); iter != compositableValues->end(); ++iter) {
-            CSSPropertyID property = iter->key;
-            if (!isPropertyForPass<pass>(property))
+        const HashSet<RefPtr<InertAnimation> >& animations = newAnimations.at(i).animations;
+        for (HashSet<RefPtr<InertAnimation> >::const_iterator animationsIter = animations.begin(); animationsIter != animations.end(); ++animationsIter) {
+            OwnPtr<AnimationEffect::CompositableValueMap> compositableValues = (*animationsIter)->sample();
+            if (!compositableValues)
                 continue;
-            RefPtr<AnimatableValue> animatableValue = iter->value->compositeOnto(AnimatableValue::neutralValue());
-            if (pass == HighPriorityProperties && property == CSSPropertyLineHeight)
-                state.setLineHeightValue(toAnimatableNumber(animatableValue.get())->toCSSValue().get());
-            else
-                AnimatedStyleBuilder::applyProperty(property, state, animatableValue.get());
-            didApply = true;
+            for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues->begin(); iter != compositableValues->end(); ++iter) {
+                CSSPropertyID property = iter->key;
+                if (!isPropertyForPass<pass>(property))
+                    continue;
+                RefPtr<AnimatableValue> animatableValue = iter->value->compositeOnto(AnimatableValue::neutralValue());
+                if (pass == HighPriorityProperties && property == CSSPropertyLineHeight)
+                    state.setLineHeightValue(toAnimatableLength(animatableValue.get())->toCSSValue().get());
+                else
+                    AnimatedStyleBuilder::applyProperty(property, state, animatableValue.get());
+                didApply = true;
+            }
         }
     }
     return didApply;
@@ -1332,6 +1378,7 @@
 void StyleResolver::applyProperties(StyleResolverState& state, const StylePropertySet* properties, StyleRule* rule, bool isImportant, bool inheritedOnly, PropertyWhitelistType propertyWhitelistType)
 {
     ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || state.regionForStyling());
+    state.setCurrentRule(rule);
 
     unsigned propertyCount = properties->propertyCount();
     for (unsigned i = 0; i < propertyCount; ++i) {
@@ -1396,23 +1443,6 @@
     m_matchedPropertiesCache.clear();
 }
 
-void StyleResolver::calculateCSSAnimationUpdate(StyleResolverState& state)
-{
-    if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
-        return;
-
-    const Element* element = state.element();
-    ASSERT(element);
-
-    if (!CSSAnimations::needsUpdate(element, state.style()))
-        return;
-
-    ActiveAnimations* activeAnimations = element->activeAnimations();
-    const CSSAnimationDataList* animations = state.style()->animations();
-    const CSSAnimations* cssAnimations = activeAnimations ? activeAnimations->cssAnimations() : 0;
-    state.setAnimationUpdate(CSSAnimations::calculateUpdate(element, state.style(), cssAnimations, animations, this));
-}
-
 void StyleResolver::applyMatchedProperties(StyleResolverState& state, const MatchResult& matchResult)
 {
     const Element* element = state.element();
@@ -1457,6 +1487,12 @@
     applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
     applyMatchedProperties<AnimationProperties>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
 
+    // Match transition-property / animation-name length by trimming and
+    // lengthening other transition / animation property lists
+    // FIXME: This is wrong because we shouldn't affect the computed values
+    state.style()->adjustAnimations();
+    state.style()->adjustTransitions();
+
     // Now we have all of the matched rules in the appropriate order. Walk the rules and apply
     // high-priority properties first, i.e., those properties that other properties depend on.
     // The order is (1) high-priority not important, (2) high-priority important, (3) normal not important
@@ -1496,7 +1532,7 @@
     applyMatchedProperties<LowPriorityProperties>(state, matchResult, true, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
 
     if (RuntimeEnabledFeatures::webAnimationsEnabled() && !applyInheritedOnly) {
-        calculateCSSAnimationUpdate(state);
+        state.setAnimationUpdate(CSSAnimations::calculateUpdate(state.element(), state.style(), this));
         // Apply animated properties, then reapply any rules marked important.
         if (applyAnimatedProperties<HighPriorityProperties>(state, element->document().timeline())) {
             bool important = true;
@@ -1559,11 +1595,6 @@
     }
 }
 
-void StyleResolver::addViewportDependentMediaQueryResult(const MediaQueryExp* expr, bool result)
-{
-    m_viewportDependentMediaQueryResults.append(adoptPtr(new MediaQueryResult(*expr, result)));
-}
-
 bool StyleResolver::affectedByViewportChange() const
 {
     unsigned s = m_viewportDependentMediaQueryResults.size();
diff --git a/Source/core/css/resolver/StyleResolver.h b/Source/core/css/resolver/StyleResolver.h
index 16cf401..d24ad25 100644
--- a/Source/core/css/resolver/StyleResolver.h
+++ b/Source/core/css/resolver/StyleResolver.h
@@ -58,7 +58,6 @@
 class KeyframeList;
 class KeyframeValue;
 class MediaQueryEvaluator;
-class MediaQueryExp;
 class MediaQueryResult;
 class RenderRegion;
 class RuleData;
@@ -173,7 +172,7 @@
 };
 
 // This class selects a RenderStyle for a given element based on a collection of stylesheets.
-class StyleResolver {
+class StyleResolver : public FontSelectorClient {
     WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED;
 public:
     StyleResolver(Document&, bool matchAuthorAndUserStyles);
@@ -192,10 +191,7 @@
         RuleMatchingBehavior = MatchAllRules, RenderRegion* regionForStyling = 0);
 
     // FIXME: The following logic related to animations and keyframes should be factored out of StyleResolver
-    // The body of calculateCSSAnimationUpdate can move to CSSAnimations.cpp and take just const element, const style,
-    // and const ScopedStyleTree
-    void calculateCSSAnimationUpdate(StyleResolverState&);
-    void resolveKeyframes(const Element*, const RenderStyle*, const AtomicString& animationName, TimingFunction* defaultTimingFunction, KeyframeAnimationEffect::KeyframeVector&, RefPtr<TimingFunction>&);
+    void resolveKeyframes(Element*, const RenderStyle*, const AtomicString& animationName, TimingFunction* defaultTimingFunction, Vector<std::pair<KeyframeAnimationEffect::KeyframeVector, RefPtr<TimingFunction> > >&);
     void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&);
     const StyleRuleKeyframes* matchScopedKeyframesRule(const Element*, const StringImpl* animationName);
     PassRefPtr<RenderStyle> styleForKeyframe(Element*, const RenderStyle*, const StyleKeyframe*);
@@ -231,9 +227,6 @@
         return m_styleTree.ensureScopedStyleResolver(scope ? *scope : document());
     }
 
-    // FIXME: Used by SharingStyleFinder, but should be removed.
-    bool styleSharingCandidateMatchesRuleSet(const ElementResolveContext&, RenderStyle*, RuleSet*);
-
     // These methods will give back the set of rules that matched for a given element (or a pseudo-element).
     enum CSSRuleFilter {
         UAAndUserCSSRules   = 1 << 1,
@@ -252,8 +245,8 @@
     CSSFontSelector* fontSelector() const { return m_fontSelector.get(); }
     ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResolver.get(); }
 
-    // FIXME: This logic belongs in MediaQueryEvaluator.
-    void addViewportDependentMediaQueryResult(const MediaQueryExp*, bool result);
+    typedef Vector<OwnPtr<MediaQueryResult> > MediaQueryResultList;
+    MediaQueryResultList* viewportDependentMediaQueryResults() { return &m_viewportDependentMediaQueryResults; }
     bool hasViewportDependentMediaQueries() const { return !m_viewportDependentMediaQueryResults.isEmpty(); }
     bool affectedByViewportChange() const;
 
@@ -269,12 +262,6 @@
     // FIXME: StyleResolver should not have this member or method.
     InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWrappers; }
 
-    enum ViewportOrigin { UserAgentOrigin, AuthorOrigin };
-
-    // Exposed for ScopedStyleResolver.
-    // FIXME: Likely belongs on viewportStyleResolver.
-    void collectViewportRules(RuleSet*, ViewportOrigin);
-
     const RuleFeatureSet& ruleFeatureSet() const { return m_features; }
 
     StyleSharingList& styleSharingList() { return m_styleSharingList; }
@@ -287,16 +274,20 @@
 #ifdef STYLE_STATS
     ALWAYS_INLINE static StyleSharingStats& styleSharingStats() { return m_styleSharingStats; }
 #endif
+
+private:
+    // FontSelectorClient implementation.
+    virtual void fontsNeedUpdate(FontSelector*);
+
 private:
     // FIXME: This should probably go away, folded into FontBuilder.
     void updateFont(StyleResolverState&);
 
     void matchUARules(ElementRuleCollector&, RuleSet*);
     void matchAuthorRules(Element*, ElementRuleCollector&, bool includeEmptyRules);
-    void matchShadowDistributedRules(ElementRuleCollector&, bool includeEmptyRules);
-    void matchScopedAuthorRulesForShadowHost(Element*, ElementRuleCollector&, bool includeEmptyRules, Vector<ScopedStyleResolver*, 8>& resolvers, Vector<ScopedStyleResolver*, 8>& resolversInShadowTree);
+    void collectShadowDistributedRules(ElementRuleCollector&, bool includeEmptyRules);
+    void matchAuthorRulesForShadowHost(Element*, ElementRuleCollector&, bool includeEmptyRules, Vector<ScopedStyleResolver*, 8>& resolvers, Vector<ScopedStyleResolver*, 8>& resolversInShadowTree);
     void matchHostRules(Element*, ScopedStyleResolver*, ElementRuleCollector&, bool includeEmptyRules);
-    void matchScopedAuthorRules(Element*, ElementRuleCollector&, bool includeEmptyRules);
     void matchAllRules(StyleResolverState&, ElementRuleCollector&, bool matchAuthorAndUserStyles, bool includeSMILProperties);
     void matchUARules(ElementRuleCollector&);
     void matchUserRules(ElementRuleCollector&, bool includeEmptyRules);
@@ -343,6 +334,8 @@
     MatchedPropertiesCache m_matchedPropertiesCache;
 
     OwnPtr<MediaQueryEvaluator> m_medium;
+    MediaQueryResultList m_viewportDependentMediaQueryResults;
+
     RefPtr<RenderStyle> m_rootDefaultStyle;
 
     Document& m_document;
@@ -351,7 +344,6 @@
     bool m_matchAuthorAndUserStyles;
 
     RefPtr<CSSFontSelector> m_fontSelector;
-    Vector<OwnPtr<MediaQueryResult> > m_viewportDependentMediaQueryResults;
 
     RefPtr<ViewportStyleResolver> m_viewportStyleResolver;
 
diff --git a/Source/core/css/resolver/StyleResolverState.cpp b/Source/core/css/resolver/StyleResolverState.cpp
index b98a30c..7c76cca 100644
--- a/Source/core/css/resolver/StyleResolverState.cpp
+++ b/Source/core/css/resolver/StyleResolverState.cpp
@@ -30,44 +30,25 @@
 namespace WebCore {
 
 StyleResolverState::StyleResolverState(Document& document, Element* element, RenderStyle* parentStyle, RenderRegion* regionForStyling)
-    : m_elementContext(element ? ElementResolveContext(element) : ElementResolveContext())
-    , m_document(element ? m_elementContext.document() : document)
-    , m_regionForStyling(0)
+    : m_elementContext(element ? ElementResolveContext(*element) : ElementResolveContext())
+    , m_document(document)
+    , m_style(0)
+    , m_parentStyle(parentStyle)
+    , m_regionForStyling(regionForStyling)
     , m_applyPropertyToRegularStyle(true)
     , m_applyPropertyToVisitedLinkStyle(false)
     , m_lineHeightValue(0)
     , m_styleMap(*this, m_elementStyleResources)
+    , m_currentRule(0)
 {
-    m_regionForStyling = regionForStyling;
-
     if (m_elementContext.resetStyleInheritance())
         m_parentStyle = 0;
-    else if (parentStyle)
-        m_parentStyle = parentStyle;
-    else if (m_elementContext.parentNode())
+    else if (!parentStyle && m_elementContext.parentNode())
         m_parentStyle = m_elementContext.parentNode()->renderStyle();
-    else
-        m_parentStyle = 0;
 
-    m_style = 0;
-    m_elementStyleResources.clear();
-    m_fontBuilder.clear();
-
-    // FIXME: StyleResolverState is never passed between documents
-    // so we should be able to do this initialization at StyleResolverState
-    // createion time instead of now, correct?
+    // FIXME: How can we not have a page here?
     if (Page* page = document.page())
         m_elementStyleResources.setDeviceScaleFactor(page->deviceScaleFactor());
 }
 
-StyleResolverState::~StyleResolverState()
-{
-    m_elementContext = ElementResolveContext();
-    m_style = 0;
-    m_parentStyle = 0;
-    m_regionForStyling = 0;
-    m_elementStyleResources.clear();
-    m_fontBuilder.clear();
-}
-
 } // namespace WebCore
diff --git a/Source/core/css/resolver/StyleResolverState.h b/Source/core/css/resolver/StyleResolverState.h
index 6bf00dc..b97071d 100644
--- a/Source/core/css/resolver/StyleResolverState.h
+++ b/Source/core/css/resolver/StyleResolverState.h
@@ -39,12 +39,12 @@
 
 class FontDescription;
 class RenderRegion;
+class StyleRule;
 
 class StyleResolverState {
 WTF_MAKE_NONCOPYABLE(StyleResolverState);
 public:
     StyleResolverState(Document&, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0);
-    ~StyleResolverState();
 
     // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to grab the document from.
     // This is why we have to store the document separately.
@@ -73,6 +73,9 @@
 
     const RenderRegion* regionForStyling() const { return m_regionForStyling; }
 
+    void setCurrentRule(StyleRule* currentRule) { m_currentRule = currentRule; }
+    const StyleRule* currentRule() const { return m_currentRule; }
+
     // FIXME: These are effectively side-channel "out parameters" for the various
     // map functions. When we map from CSS to style objects we use this state object
     // to track various meta-data about that mapping (e.g. if it's cache-able).
@@ -162,6 +165,8 @@
     // a back-pointer to this object.
     CSSToStyleMap m_styleMap;
     Vector<AtomicString> m_contentAttrValues;
+
+    StyleRule* m_currentRule;
 };
 
 } // namespace WebCore
diff --git a/Source/core/css/resolver/StyleResourceLoader.cpp b/Source/core/css/resolver/StyleResourceLoader.cpp
index 3158763..ca5de33 100644
--- a/Source/core/css/resolver/StyleResourceLoader.cpp
+++ b/Source/core/css/resolver/StyleResourceLoader.cpp
@@ -251,9 +251,6 @@
 
     // Start loading the SVG Documents referenced by this style.
     loadPendingSVGDocuments(renderStyle, elementStyleResources);
-
-    // FIXME: Investigate if this clearing is necessary.
-    elementStyleResources.clear();
 }
 
 }
diff --git a/Source/core/css/resolver/TransformBuilder.cpp b/Source/core/css/resolver/TransformBuilder.cpp
index f13e02d..d65b7ed 100644
--- a/Source/core/css/resolver/TransformBuilder.cpp
+++ b/Source/core/css/resolver/TransformBuilder.cpp
@@ -37,7 +37,7 @@
 #include "core/platform/graphics/transforms/RotateTransformOperation.h"
 #include "core/platform/graphics/transforms/ScaleTransformOperation.h"
 #include "core/platform/graphics/transforms/SkewTransformOperation.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
+#include "platform/transforms/TransformationMatrix.h"
 #include "core/platform/graphics/transforms/TranslateTransformOperation.h"
 #include "core/rendering/style/RenderStyle.h"
 
@@ -97,10 +97,10 @@
     for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) {
         CSSValue* currValue = i.value();
 
-        if (!currValue->isCSSTransformValue())
+        if (!currValue->isTransformValue())
             continue;
 
-        CSSTransformValue* transformValue = static_cast<CSSTransformValue*>(i.value());
+        CSSTransformValue* transformValue = toCSSTransformValue(i.value());
         if (!transformValue->length())
             continue;
 
diff --git a/Source/core/css/resolver/ViewportStyleResolver.cpp b/Source/core/css/resolver/ViewportStyleResolver.cpp
index f38f7d7..21e30fe 100644
--- a/Source/core/css/resolver/ViewportStyleResolver.cpp
+++ b/Source/core/css/resolver/ViewportStyleResolver.cpp
@@ -35,7 +35,7 @@
 #include "core/css/StyleRule.h"
 #include "core/dom/Document.h"
 #include "core/dom/NodeRenderStyle.h"
-#include "core/dom/ViewportArguments.h"
+#include "core/dom/ViewportDescription.h"
 
 namespace WebCore {
 
@@ -50,7 +50,16 @@
 {
 }
 
-void ViewportStyleResolver::addViewportRule(StyleRuleViewport* viewportRule)
+void ViewportStyleResolver::collectViewportRules(RuleSet* rules, Origin origin)
+{
+    rules->compactRulesIfNeeded();
+
+    const Vector<StyleRuleViewport*>& viewportRules = rules->viewportRules();
+    for (size_t i = 0; i < viewportRules.size(); ++i)
+        addViewportRule(viewportRules[i], origin);
+}
+
+void ViewportStyleResolver::addViewportRule(StyleRuleViewport* viewportRule, Origin origin)
 {
     StylePropertySet* propertySet = viewportRule->mutableProperties();
 
@@ -58,6 +67,9 @@
     if (!propertyCount)
         return;
 
+    if (origin == AuthorOrigin)
+        m_hasAuthorStyle = true;
+
     if (!m_propertySet) {
         m_propertySet = propertySet->mutableCopy();
         return;
@@ -82,23 +94,23 @@
     if (!m_propertySet || (!m_hasAuthorStyle && m_document->hasLegacyViewportTag())) {
         ASSERT(!m_hasAuthorStyle);
         m_propertySet = 0;
-        m_document->setViewportArguments(ViewportArguments());
+        m_document->setViewportDescription(ViewportDescription());
         return;
     }
 
-    ViewportArguments arguments(m_hasAuthorStyle ? ViewportArguments::AuthorStyleSheet : ViewportArguments::UserAgentStyleSheet);
+    ViewportDescription description(m_hasAuthorStyle ? ViewportDescription::AuthorStyleSheet : ViewportDescription::UserAgentStyleSheet);
 
-    arguments.userZoom = viewportArgumentValue(CSSPropertyUserZoom);
-    arguments.zoom = viewportArgumentValue(CSSPropertyZoom);
-    arguments.minZoom = viewportArgumentValue(CSSPropertyMinZoom);
-    arguments.maxZoom = viewportArgumentValue(CSSPropertyMaxZoom);
-    arguments.minWidth = viewportLengthValue(CSSPropertyMinWidth);
-    arguments.maxWidth = viewportLengthValue(CSSPropertyMaxWidth);
-    arguments.minHeight = viewportLengthValue(CSSPropertyMinHeight);
-    arguments.maxHeight = viewportLengthValue(CSSPropertyMaxHeight);
-    arguments.orientation = viewportArgumentValue(CSSPropertyOrientation);
+    description.userZoom = viewportArgumentValue(CSSPropertyUserZoom);
+    description.zoom = viewportArgumentValue(CSSPropertyZoom);
+    description.minZoom = viewportArgumentValue(CSSPropertyMinZoom);
+    description.maxZoom = viewportArgumentValue(CSSPropertyMaxZoom);
+    description.minWidth = viewportLengthValue(CSSPropertyMinWidth);
+    description.maxWidth = viewportLengthValue(CSSPropertyMaxWidth);
+    description.minHeight = viewportLengthValue(CSSPropertyMinHeight);
+    description.maxHeight = viewportLengthValue(CSSPropertyMaxHeight);
+    description.orientation = viewportArgumentValue(CSSPropertyOrientation);
 
-    m_document->setViewportArguments(arguments);
+    m_document->setViewportDescription(description);
 
     m_propertySet = 0;
     m_hasAuthorStyle = false;
@@ -106,7 +118,7 @@
 
 float ViewportStyleResolver::viewportArgumentValue(CSSPropertyID id) const
 {
-    float defaultValue = ViewportArguments::ValueAuto;
+    float defaultValue = ViewportDescription::ValueAuto;
 
     // UserZoom default value is CSSValueZoom, which maps to true, meaning that
     // yes, it is user scalable. When the value is set to CSSValueFixed, we
@@ -143,13 +155,13 @@
     case CSSValueAuto:
         return defaultValue;
     case CSSValueLandscape:
-        return ViewportArguments::ValueLandscape;
+        return ViewportDescription::ValueLandscape;
     case CSSValuePortrait:
-        return ViewportArguments::ValuePortrait;
+        return ViewportDescription::ValuePortrait;
     case CSSValueZoom:
         return defaultValue;
     case CSSValueInternalExtendToZoom:
-        return ViewportArguments::ValueExtendToZoom;
+        return ViewportDescription::ValueExtendToZoom;
     case CSSValueFixed:
         return 0;
     default:
diff --git a/Source/core/css/resolver/ViewportStyleResolver.h b/Source/core/css/resolver/ViewportStyleResolver.h
index b71128e..bb0a36f 100644
--- a/Source/core/css/resolver/ViewportStyleResolver.h
+++ b/Source/core/css/resolver/ViewportStyleResolver.h
@@ -31,6 +31,7 @@
 #define ViewportStyleResolver_h
 
 #include "CSSPropertyNames.h"
+#include "core/css/RuleSet.h"
 #include "core/platform/Length.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
@@ -50,8 +51,9 @@
 
     ~ViewportStyleResolver();
 
-    void setHasAuthorStyle() { m_hasAuthorStyle = true; }
-    void addViewportRule(StyleRuleViewport*);
+    enum Origin { UserAgentOrigin, AuthorOrigin };
+
+    void collectViewportRules(RuleSet*, Origin);
 
     void clearDocument();
     void resolve();
@@ -59,6 +61,8 @@
 private:
     explicit ViewportStyleResolver(Document*);
 
+    void addViewportRule(StyleRuleViewport*, Origin);
+
     float viewportArgumentValue(CSSPropertyID) const;
     Length viewportLengthValue(CSSPropertyID) const;
 
diff --git a/Source/core/debugger_script_source.target.darwin-arm.mk b/Source/core/debugger_script_source.target.darwin-arm.mk
index 8952acb..cf2968b 100644
--- a/Source/core/debugger_script_source.target.darwin-arm.mk
+++ b/Source/core/debugger_script_source.target.darwin-arm.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h from ../bindings/v8/DebuggerScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
 
 
 
diff --git a/Source/core/debugger_script_source.target.darwin-mips.mk b/Source/core/debugger_script_source.target.darwin-mips.mk
index 8952acb..cf2968b 100644
--- a/Source/core/debugger_script_source.target.darwin-mips.mk
+++ b/Source/core/debugger_script_source.target.darwin-mips.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h from ../bindings/v8/DebuggerScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
 
 
 
diff --git a/Source/core/debugger_script_source.target.darwin-x86.mk b/Source/core/debugger_script_source.target.darwin-x86.mk
index 8952acb..cf2968b 100644
--- a/Source/core/debugger_script_source.target.darwin-x86.mk
+++ b/Source/core/debugger_script_source.target.darwin-x86.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h from ../bindings/v8/DebuggerScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
 
 
 
diff --git a/Source/core/debugger_script_source.target.linux-arm.mk b/Source/core/debugger_script_source.target.linux-arm.mk
index 8952acb..cf2968b 100644
--- a/Source/core/debugger_script_source.target.linux-arm.mk
+++ b/Source/core/debugger_script_source.target.linux-arm.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h from ../bindings/v8/DebuggerScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
 
 
 
diff --git a/Source/core/debugger_script_source.target.linux-mips.mk b/Source/core/debugger_script_source.target.linux-mips.mk
index 8952acb..cf2968b 100644
--- a/Source/core/debugger_script_source.target.linux-mips.mk
+++ b/Source/core/debugger_script_source.target.linux-mips.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h from ../bindings/v8/DebuggerScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
 
 
 
diff --git a/Source/core/debugger_script_source.target.linux-x86.mk b/Source/core/debugger_script_source.target.linux-x86.mk
index 8952acb..cf2968b 100644
--- a/Source/core/debugger_script_source.target.linux-x86.mk
+++ b/Source/core/debugger_script_source.target.linux-x86.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/DebuggerScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h from ../bindings/v8/DebuggerScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl DebuggerScriptSource_js ../bindings/v8/DebuggerScript.js "$(gyp_shared_intermediate_dir)/blink/DebuggerScriptSource.h"
 
 
 
diff --git a/Source/core/dom/ActiveDOMObject.cpp b/Source/core/dom/ActiveDOMObject.cpp
index 1614288..15ac7be 100644
--- a/Source/core/dom/ActiveDOMObject.cpp
+++ b/Source/core/dom/ActiveDOMObject.cpp
@@ -27,33 +27,33 @@
 #include "config.h"
 #include "core/dom/ActiveDOMObject.h"
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
 
 namespace WebCore {
 
-ActiveDOMObject::ActiveDOMObject(ScriptExecutionContext* scriptExecutionContext)
-    : ContextLifecycleObserver(scriptExecutionContext, ActiveDOMObjectType)
+ActiveDOMObject::ActiveDOMObject(ExecutionContext* executionContext)
+    : ContextLifecycleObserver(executionContext, ActiveDOMObjectType)
     , m_pendingActivityCount(0)
 #if !ASSERT_DISABLED
     , m_suspendIfNeededCalled(false)
 #endif
 {
-    ASSERT(!scriptExecutionContext || scriptExecutionContext->isContextThread());
+    ASSERT(!executionContext || executionContext->isContextThread());
 }
 
 ActiveDOMObject::~ActiveDOMObject()
 {
     // ActiveDOMObject may be inherited by a sub-class whose life-cycle
-    // exceeds that of the associated ScriptExecutionContext. In those cases,
-    // m_scriptExecutionContext would/should have been nullified by
+    // exceeds that of the associated ExecutionContext. In those cases,
+    // m_executionContext would/should have been nullified by
     // ContextLifecycleObserver::contextDestroyed() (which we implement /
     // inherit). Hence, we should ensure that this is not 0 before use it
     // here.
-    if (!scriptExecutionContext())
+    if (!executionContext())
         return;
 
     ASSERT(m_suspendIfNeededCalled);
-    ASSERT(scriptExecutionContext()->isContextThread());
+    ASSERT(executionContext()->isContextThread());
 }
 
 void ActiveDOMObject::suspendIfNeeded()
@@ -62,8 +62,8 @@
     ASSERT(!m_suspendIfNeededCalled);
     m_suspendIfNeededCalled = true;
 #endif
-    if (ScriptExecutionContext* context = scriptExecutionContext())
-        scriptExecutionContext()->suspendActiveDOMObjectIfNeeded(this);
+    if (ExecutionContext* context = executionContext())
+        executionContext()->suspendActiveDOMObjectIfNeeded(this);
 }
 
 bool ActiveDOMObject::hasPendingActivity() const
@@ -71,12 +71,7 @@
     return m_pendingActivityCount;
 }
 
-bool ActiveDOMObject::canSuspend() const
-{
-    return false;
-}
-
-void ActiveDOMObject::suspend(ReasonForSuspension)
+void ActiveDOMObject::suspend()
 {
 }
 
diff --git a/Source/core/dom/ActiveDOMObject.h b/Source/core/dom/ActiveDOMObject.h
index 0e123c7..67b5e82 100644
--- a/Source/core/dom/ActiveDOMObject.h
+++ b/Source/core/dom/ActiveDOMObject.h
@@ -35,10 +35,10 @@
 
 class ActiveDOMObject : public ContextLifecycleObserver {
 public:
-    ActiveDOMObject(ScriptExecutionContext*);
+    ActiveDOMObject(ExecutionContext*);
 
     // suspendIfNeeded() should be called exactly once after object construction to synchronize
-    // the suspend state with that in ScriptExecutionContext.
+    // the suspend state with that in ExecutionContext.
     void suspendIfNeeded();
 #if !ASSERT_DISABLED
     bool suspendIfNeededCalled() const { return m_suspendIfNeededCalled; }
@@ -46,19 +46,7 @@
 
     virtual bool hasPendingActivity() const;
 
-    // canSuspend() is used by the caller if there is a choice between suspending and stopping.
-    // For example, a page won't be suspended and placed in the back/forward cache if it has
-    // the objects that can not be suspended.
-    // However, 'suspend' can be called even if canSuspend() would return 'false'. That
-    // happens in step-by-step JS debugging for example - in this case it would be incorrect
-    // to stop the object. Exact semantics of suspend is up to the object then.
-    enum ReasonForSuspension {
-        JavaScriptDebuggerPaused,
-        WillDeferLoading,
-        DocumentWillBecomeInactive
-    };
-    virtual bool canSuspend() const;
-    virtual void suspend(ReasonForSuspension);
+    virtual void suspend();
     virtual void resume();
     virtual void stop();
 
diff --git a/Source/core/dom/AddConsoleMessageTask.cpp b/Source/core/dom/AddConsoleMessageTask.cpp
new file mode 100644
index 0000000..58f0304
--- /dev/null
+++ b/Source/core/dom/AddConsoleMessageTask.cpp
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ *     * 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/dom/AddConsoleMessageTask.h"
+
+#include "core/dom/ExecutionContext.h"
+
+namespace WebCore {
+
+void AddConsoleMessageTask::performTask(ExecutionContext* context)
+{
+    context->addConsoleMessage(m_source, m_level, m_message);
+}
+
+} // namespace
diff --git a/Source/core/dom/AddConsoleMessageTask.h b/Source/core/dom/AddConsoleMessageTask.h
new file mode 100644
index 0000000..deb1e06
--- /dev/null
+++ b/Source/core/dom/AddConsoleMessageTask.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ *     * 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 AddConsoleMessageTask_h
+#define AddConsoleMessageTask_h
+
+#include "core/dom/ExecutionContextTask.h"
+#include "core/frame/ConsoleTypes.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class AddConsoleMessageTask : public ExecutionContextTask {
+public:
+    static PassOwnPtr<AddConsoleMessageTask> create(MessageSource source, MessageLevel level, const String& message)
+    {
+        return adoptPtr(new AddConsoleMessageTask(source, level, message));
+    }
+    virtual void performTask(ExecutionContext*);
+private:
+    AddConsoleMessageTask(MessageSource source, MessageLevel level, const String& message)
+        : m_source(source)
+        , m_level(level)
+        , m_message(message.isolatedCopy())
+    {
+    }
+    MessageSource m_source;
+    MessageLevel m_level;
+    String m_message;
+};
+
+} // namespace
+
+#endif
diff --git a/Source/core/dom/Attr.cpp b/Source/core/dom/Attr.cpp
index 8ebced8..0f4a713 100644
--- a/Source/core/dom/Attr.cpp
+++ b/Source/core/dom/Attr.cpp
@@ -43,7 +43,6 @@
     , m_element(&element)
     , m_name(name)
     , m_ignoreChildrenChanged(0)
-    , m_specified(true)
 {
     ScriptWrappable::init(this);
 }
@@ -54,7 +53,6 @@
     , m_name(name)
     , m_standaloneValue(standaloneValue)
     , m_ignoreChildrenChanged(0)
-    , m_specified(true)
 {
     ScriptWrappable::init(this);
 }
diff --git a/Source/core/dom/Attr.h b/Source/core/dom/Attr.h
index bd9e7eb..40d812b 100644
--- a/Source/core/dom/Attr.h
+++ b/Source/core/dom/Attr.h
@@ -47,7 +47,7 @@
     virtual ~Attr();
 
     String name() const { return qualifiedName().toString(); }
-    bool specified() const { return m_specified; }
+    bool specified() const { return true; }
     Element* ownerElement() const { return m_element; }
 
     const AtomicString& value() const;
@@ -58,8 +58,6 @@
 
     bool isId() const;
 
-    void setSpecified(bool specified) { m_specified = specified; }
-
     void attachToElement(Element*);
     void detachFromElementWithValue(const AtomicString&);
 
@@ -94,22 +92,10 @@
     Element* m_element;
     QualifiedName m_name;
     AtomicString m_standaloneValue;
-
-    unsigned m_ignoreChildrenChanged : 31;
-    bool m_specified : 1;
+    unsigned m_ignoreChildrenChanged;
 };
 
-inline Attr* toAttr(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isAttributeNode());
-    return static_cast<Attr*>(node);
-}
-
-inline const Attr* toAttr(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isAttributeNode());
-    return static_cast<const Attr*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(Attr, isAttributeNode());
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/Attr.idl b/Source/core/dom/Attr.idl
index 0dcdb02..c145935 100644
--- a/Source/core/dom/Attr.idl
+++ b/Source/core/dom/Attr.idl
@@ -26,7 +26,7 @@
 
     readonly attribute boolean specified;
 
-    [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, SetterRaisesException, CustomElementCallbacks=Enable] attribute DOMString value;
+    [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, SetterRaisesException, CustomElementCallbacks] attribute DOMString value;
 
     // DOM Level 2
 
diff --git a/Source/core/dom/CDATASection.h b/Source/core/dom/CDATASection.h
index ed9075f..338866f 100644
--- a/Source/core/dom/CDATASection.h
+++ b/Source/core/dom/CDATASection.h
@@ -40,17 +40,7 @@
     virtual PassRefPtr<Text> cloneWithData(const String&) OVERRIDE;
 };
 
-inline CDATASection* toCDATASection(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->nodeType() == Node::CDATA_SECTION_NODE);
-    return static_cast<CDATASection*>(node);
-}
-
-inline const CDATASection* toCDATASection(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->nodeType() == Node::CDATA_SECTION_NODE);
-    return static_cast<const CDATASection*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(CDATASection, nodeType() == Node::CDATA_SECTION_NODE);
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/CSSSelectorWatch.cpp b/Source/core/dom/CSSSelectorWatch.cpp
new file mode 100644
index 0000000..d746adb
--- /dev/null
+++ b/Source/core/dom/CSSSelectorWatch.cpp
@@ -0,0 +1,175 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/dom/CSSSelectorWatch.h"
+
+#include "core/css/CSSParser.h"
+#include "core/css/CSSSelectorList.h"
+#include "core/css/StylePropertySet.h"
+#include "core/dom/Document.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/loader/FrameLoaderClient.h"
+#include "core/frame/Frame.h"
+#include "core/rendering/style/StyleRareNonInheritedData.h"
+
+namespace WebCore {
+
+// The address of this string is important; its value is just documentation.
+static const char kSupplementName[] = "CSSSelectorWatch";
+
+CSSSelectorWatch::CSSSelectorWatch(Document& document)
+    : m_document(document)
+    , m_callbackSelectorChangeTimer(this, &CSSSelectorWatch::callbackSelectorChangeTimerFired)
+    , m_timerExpirations(0)
+{
+}
+
+CSSSelectorWatch& CSSSelectorWatch::from(Document& document)
+{
+    CSSSelectorWatch* watch = static_cast<CSSSelectorWatch*>(DocumentSupplement::from(&document, kSupplementName));
+    if (!watch) {
+        watch = new CSSSelectorWatch(document);
+        DocumentSupplement::provideTo(&document, kSupplementName, adoptPtr(watch));
+    }
+    return *watch;
+}
+
+void CSSSelectorWatch::callbackSelectorChangeTimerFired(Timer<CSSSelectorWatch>*)
+{
+    // Should be ensured by updateSelectorMatches():
+    ASSERT(!m_addedSelectors.isEmpty() || !m_removedSelectors.isEmpty());
+
+    if (m_timerExpirations < 1) {
+        m_timerExpirations++;
+        m_callbackSelectorChangeTimer.startOneShot(0);
+        return;
+    }
+    if (m_document.frame()) {
+        Vector<String> addedSelectors;
+        Vector<String> removedSelectors;
+        copyToVector(m_addedSelectors, addedSelectors);
+        copyToVector(m_removedSelectors, removedSelectors);
+        m_document.frame()->loader()->client()->selectorMatchChanged(addedSelectors, removedSelectors);
+    }
+    m_addedSelectors.clear();
+    m_removedSelectors.clear();
+    m_timerExpirations = 0;
+}
+
+void CSSSelectorWatch::updateSelectorMatches(const Vector<String>& removedSelectors, const Vector<String>& addedSelectors)
+{
+    bool shouldUpdateTimer = false;
+
+    for (unsigned i = 0; i < removedSelectors.size(); ++i) {
+        const String& selector = removedSelectors[i];
+        HashMap<String, int>::iterator count = m_matchingCallbackSelectors.find(selector);
+        if (count == m_matchingCallbackSelectors.end())
+            continue;
+        --count->value;
+        if (!count->value) {
+            shouldUpdateTimer = true;
+
+            m_matchingCallbackSelectors.remove(count);
+            if (m_addedSelectors.contains(selector))
+                m_addedSelectors.remove(selector);
+            else
+                m_removedSelectors.add(selector);
+        }
+    }
+
+    for (unsigned i = 0; i < addedSelectors.size(); ++i) {
+        const String& selector = addedSelectors[i];
+        HashMap<String, int>::iterator count = m_matchingCallbackSelectors.find(selector);
+        if (count != m_matchingCallbackSelectors.end()) {
+            ++count->value;
+            continue;
+        }
+        shouldUpdateTimer = true;
+
+        m_matchingCallbackSelectors.set(selector, 1);
+        if (m_removedSelectors.contains(selector))
+            m_removedSelectors.remove(selector);
+        else
+            m_addedSelectors.add(selector);
+    }
+
+    if (!shouldUpdateTimer)
+        return;
+
+    if (m_removedSelectors.isEmpty() && m_addedSelectors.isEmpty()) {
+        if (m_callbackSelectorChangeTimer.isActive()) {
+            m_timerExpirations = 0;
+            m_callbackSelectorChangeTimer.stop();
+        }
+    } else {
+        m_timerExpirations = 0;
+        if (!m_callbackSelectorChangeTimer.isActive())
+            m_callbackSelectorChangeTimer.startOneShot(0);
+    }
+}
+
+static bool allCompound(const CSSSelectorList& selectorList)
+{
+    for (const CSSSelector* selector = selectorList.first(); selector; selector = selectorList.next(selector)) {
+        if (!selector->isCompound())
+            return false;
+    }
+    return true;
+}
+
+void CSSSelectorWatch::watchCSSSelectors(const Vector<String>& selectors)
+{
+    m_watchedCallbackSelectors.clear();
+    CSSParserContext context(UASheetMode);
+    CSSParser parser(context);
+
+    const CSSProperty callbackProperty(CSSPropertyInternalCallback, CSSPrimitiveValue::createIdentifier(CSSValueInternalPresence));
+    const RefPtr<StylePropertySet> callbackPropertySet = ImmutableStylePropertySet::create(&callbackProperty, 1, UASheetMode);
+
+    CSSSelectorList selectorList;
+    for (unsigned i = 0; i < selectors.size(); ++i) {
+        parser.parseSelector(selectors[i], selectorList);
+        if (!selectorList.isValid())
+            continue;
+
+        // Only accept Compound Selectors, since they're cheaper to match.
+        if (!allCompound(selectorList))
+            continue;
+
+        RefPtr<StyleRule> rule = StyleRule::create();
+        rule->wrapperAdoptSelectorList(selectorList);
+        rule->setProperties(callbackPropertySet);
+        m_watchedCallbackSelectors.append(rule.release());
+    }
+    m_document.changedSelectorWatch();
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/CSSSelectorWatch.h b/Source/core/dom/CSSSelectorWatch.h
new file mode 100644
index 0000000..0eb8079
--- /dev/null
+++ b/Source/core/dom/CSSSelectorWatch.h
@@ -0,0 +1,81 @@
+/*
+ * 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 CSSSelectorWatch_h
+#define CSSSelectorWatch_h
+
+#include "core/css/StyleRule.h"
+#include "core/dom/DocumentSupplementable.h"
+#include "platform/Timer.h"
+#include "wtf/HashSet.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/WeakPtr.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class CSSSelectorWatch : public DocumentSupplement {
+public:
+    virtual ~CSSSelectorWatch() { }
+
+    static CSSSelectorWatch& from(Document&);
+
+    void watchCSSSelectors(const Vector<String>& selectors);
+    const Vector<RefPtr<StyleRule> >& watchedCallbackSelectors() const { return m_watchedCallbackSelectors; }
+
+    void updateSelectorMatches(const Vector<String>& removedSelectors, const Vector<String>& addedSelectors);
+
+private:
+    CSSSelectorWatch(Document&);
+    void callbackSelectorChangeTimerFired(Timer<CSSSelectorWatch>*);
+
+    Document& m_document;
+
+    Vector<RefPtr<StyleRule> > m_watchedCallbackSelectors;
+
+    // Maps a CSS selector string with a -webkit-callback property to the number
+    // of matching RenderStyle objects in this document.
+    HashMap<String, int> m_matchingCallbackSelectors;
+    // Selectors are relative to m_matchingCallbackSelectors's contents at
+    // the previous call to selectorMatchChanged.
+    HashSet<String> m_addedSelectors;
+    HashSet<String> m_removedSelectors;
+
+    Timer<CSSSelectorWatch> m_callbackSelectorChangeTimer;
+
+    // When an element is reparented, the new location's style is evaluated after the expriation of the relayout timer.
+    // We don't want to send redundant callbacks to the embedder, so this counter lets us wait another time around the event loop.
+    int m_timerExpirations;
+};
+
+} // namespace WebCore
+
+#endif // CSSSelectorWatch_h
diff --git a/Source/core/dom/CharacterData.cpp b/Source/core/dom/CharacterData.cpp
index 7cc21d1..b414d6e 100644
--- a/Source/core/dom/CharacterData.cpp
+++ b/Source/core/dom/CharacterData.cpp
@@ -25,16 +25,15 @@
 #include "bindings/v8/ExceptionMessages.h"
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/events/MutationEvent.h"
 #include "core/dom/MutationObserverInterestGroup.h"
 #include "core/dom/MutationRecord.h"
 #include "core/dom/ProcessingInstruction.h"
 #include "core/dom/Text.h"
 #include "core/editing/FrameSelection.h"
+#include "core/events/MutationEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/platform/text/TextBreakIterator.h"
 
 using namespace std;
 
@@ -69,33 +68,10 @@
     return m_data.substring(offset, count);
 }
 
-unsigned CharacterData::parserAppendData(const String& string, unsigned offset, unsigned lengthLimit)
+void CharacterData::parserAppendData(const String& string)
 {
     unsigned oldLength = m_data.length();
-
-    ASSERT(lengthLimit >= oldLength);
-
-    unsigned characterLength = string.length() - offset;
-    unsigned characterLengthLimit = min(characterLength, lengthLimit - oldLength);
-
-    // Check that we are not on an unbreakable boundary.
-    // Some text break iterator implementations work best if the passed buffer is as small as possible,
-    // see <https://bugs.webkit.org/show_bug.cgi?id=29092>.
-    // We need at least two characters look-ahead to account for UTF-16 surrogates.
-    ASSERT(!string.is8Bit() || string.containsOnlyLatin1()); // Latin-1 doesn't have unbreakable boundaries.
-    if (characterLengthLimit < characterLength && !string.is8Bit()) {
-        NonSharedCharacterBreakIterator it(string.characters16() + offset, (characterLengthLimit + 2 > characterLength) ? characterLength : characterLengthLimit + 2);
-        if (!it.isBreak(characterLengthLimit))
-            characterLengthLimit = it.preceding(characterLengthLimit);
-    }
-
-    if (!characterLengthLimit)
-        return 0;
-
-    if (string.is8Bit())
-        m_data.append(string.characters8() + offset, characterLengthLimit);
-    else
-        m_data.append(string.characters16() + offset, characterLengthLimit);
+    m_data.append(string);
 
     ASSERT(!renderer() || isTextNode());
     if (isTextNode())
@@ -105,8 +81,6 @@
 
     if (parentNode())
         parentNode()->childrenChanged();
-
-    return characterLengthLimit;
 }
 
 void CharacterData::appendData(const String& data)
@@ -222,7 +196,7 @@
 
     if (!isInShadowTree()) {
         if (document().hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTENER))
-            dispatchScopedEvent(MutationEvent::create(eventNames().DOMCharacterDataModifiedEvent, true, 0, oldData, m_data));
+            dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMCharacterDataModified, true, 0, oldData, m_data));
         dispatchSubtreeModifiedEvent();
     }
     InspectorInstrumentation::characterDataModified(&document(), this);
diff --git a/Source/core/dom/CharacterData.h b/Source/core/dom/CharacterData.h
index 8c50a3f..1163622 100644
--- a/Source/core/dom/CharacterData.h
+++ b/Source/core/dom/CharacterData.h
@@ -48,9 +48,7 @@
 
     StringImpl* dataImpl() { return m_data.impl(); }
 
-    // Like appendData, but optimized for the parser (e.g., no mutation events).
-    // Returns how much could be added before length limit was met.
-    unsigned parserAppendData(const String& string, unsigned offset, unsigned lengthLimit);
+    void parserAppendData(const String&);
 
 protected:
     CharacterData(TreeScope& treeScope, const String& text, ConstructionType type)
@@ -79,17 +77,7 @@
     void setDataAndUpdate(const String&, unsigned offsetOfReplacedData, unsigned oldLength, unsigned newLength, RecalcStyleBehavior = DoNotRecalcStyle);
 };
 
-inline CharacterData* toCharacterData(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isCharacterDataNode());
-    return static_cast<CharacterData*>(node);
-}
-
-inline const CharacterData* toCharacterData(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isCharacterDataNode());
-    return static_cast<const CharacterData*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(CharacterData, isCharacterDataNode());
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/ChildNode.idl b/Source/core/dom/ChildNode.idl
index 8a0be4d..21441f6 100644
--- a/Source/core/dom/ChildNode.idl
+++ b/Source/core/dom/ChildNode.idl
@@ -26,6 +26,6 @@
 ] interface ChildNode {
     [PerWorldBindings] readonly attribute Element previousElementSibling;
     [PerWorldBindings] readonly attribute Element nextElementSibling;
-    [RaisesException, CustomElementCallbacks=Enable] void remove();
+    [RaisesException, CustomElementCallbacks] void remove();
 };
 
diff --git a/Source/core/dom/ChildNodeList.h b/Source/core/dom/ChildNodeList.h
index af70df3..46f5bea 100644
--- a/Source/core/dom/ChildNodeList.h
+++ b/Source/core/dom/ChildNodeList.h
@@ -29,20 +29,20 @@
 
 namespace WebCore {
 
-    class ChildNodeList : public LiveNodeList {
-    public:
-        static PassRefPtr<ChildNodeList> create(PassRefPtr<Node> rootNode)
-        {
-            return adoptRef(new ChildNodeList(rootNode));
-        }
+class ChildNodeList FINAL : public LiveNodeList {
+public:
+    static PassRefPtr<ChildNodeList> create(PassRefPtr<Node> rootNode)
+    {
+        return adoptRef(new ChildNodeList(rootNode));
+    }
 
-        virtual ~ChildNodeList();
+    virtual ~ChildNodeList();
 
-    protected:
-        explicit ChildNodeList(PassRefPtr<Node> rootNode);
+protected:
+    explicit ChildNodeList(PassRefPtr<Node> rootNode);
 
-        virtual bool nodeMatches(Element*) const;
-    };
+    virtual bool nodeMatches(Element*) const OVERRIDE;
+};
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/ClassNodeList.h b/Source/core/dom/ClassNodeList.h
index 0d90b3d..2e08ea8 100644
--- a/Source/core/dom/ClassNodeList.h
+++ b/Source/core/dom/ClassNodeList.h
@@ -37,7 +37,7 @@
 
 namespace WebCore {
 
-class ClassNodeList : public LiveNodeList {
+class ClassNodeList FINAL : public LiveNodeList {
 public:
     static PassRefPtr<ClassNodeList> create(PassRefPtr<Node> rootNode, const String& classNames)
     {
@@ -51,7 +51,7 @@
 private:
     ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames);
 
-    virtual bool nodeMatches(Element*) const;
+    virtual bool nodeMatches(Element*) const OVERRIDE;
 
     SpaceSplitString m_classNames;
     String m_originalClassNames;
diff --git a/Source/core/dom/ClientRect.h b/Source/core/dom/ClientRect.h
index 6476e0f..3ef3b24 100644
--- a/Source/core/dom/ClientRect.h
+++ b/Source/core/dom/ClientRect.h
@@ -28,7 +28,7 @@
 #define ClientRect_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/platform/graphics/FloatRect.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 
diff --git a/Source/core/dom/ClientRectList.h b/Source/core/dom/ClientRectList.h
index bf36ef9..0639714 100644
--- a/Source/core/dom/ClientRectList.h
+++ b/Source/core/dom/ClientRectList.h
@@ -28,7 +28,7 @@
 #define ClientRectList_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/platform/graphics/FloatQuad.h"
+#include "platform/geometry/FloatQuad.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/dom/Clipboard.cpp b/Source/core/dom/Clipboard.cpp
index ee98d9f..d00860b 100644
--- a/Source/core/dom/Clipboard.cpp
+++ b/Source/core/dom/Clipboard.cpp
@@ -26,52 +26,26 @@
 #include "config.h"
 #include "core/dom/Clipboard.h"
 
+#include "HTMLNames.h"
+#include "core/dom/DataTransferItem.h"
+#include "core/dom/DataTransferItemList.h"
+#include "core/editing/markup.h"
 #include "core/fetch/ImageResource.h"
 #include "core/fileapi/FileList.h"
+#include "core/html/HTMLImageElement.h"
+#include "core/frame/Frame.h"
+#include "core/platform/DragImage.h"
+#include "core/platform/MIMETypeRegistry.h"
+#include "core/platform/chromium/ChromiumDataObject.h"
+#include "core/rendering/RenderImage.h"
+#include "core/rendering/RenderObject.h"
+#include "platform/clipboard/ClipboardMimeTypes.h"
+#include "platform/clipboard/ClipboardUtilities.h"
 
 namespace WebCore {
 
-Clipboard::Clipboard(ClipboardAccessPolicy policy, ClipboardType clipboardType)
-    : m_policy(policy)
-    , m_dropEffect("uninitialized")
-    , m_effectAllowed("uninitialized")
-    , m_dragStarted(false)
-    , m_clipboardType(clipboardType)
-    , m_dragImage(0)
-{
-    ScriptWrappable::init(this);
-}
-
-void Clipboard::setAccessPolicy(ClipboardAccessPolicy policy)
-{
-    // once you go numb, can never go back
-    ASSERT(m_policy != ClipboardNumb || policy == ClipboardNumb);
-    m_policy = policy;
-}
-
-bool Clipboard::canReadTypes() const
-{
-    return m_policy == ClipboardReadable || m_policy == ClipboardTypesReadable || m_policy == ClipboardWritable;
-}
-
-bool Clipboard::canReadData() const
-{
-    return m_policy == ClipboardReadable || m_policy == ClipboardWritable;
-}
-
-bool Clipboard::canWriteData() const
-{
-    return m_policy == ClipboardWritable;
-}
-
-bool Clipboard::canSetDragImage() const
-{
-    return m_policy == ClipboardImageWritable || m_policy == ClipboardWritable;
-}
-
 // These "conversion" methods are called by both WebCore and WebKit, and never make sense to JS, so we don't
 // worry about security for these. They don't allow access to the pasteboard anyway.
-
 static DragOperation dragOpFromIEOp(const String& op)
 {
     // yep, it's really just this fixed set
@@ -118,54 +92,28 @@
     return "none";
 }
 
-DragOperation Clipboard::sourceOperation() const
+// We provide the IE clipboard types (URL and Text), and the clipboard types specified in the WHATWG Web Applications 1.0 draft
+// see http://www.whatwg.org/specs/web-apps/current-work/ Section 6.3.5.3
+static String normalizeType(const String& type, bool* convertToURL = 0)
 {
-    DragOperation op = dragOpFromIEOp(m_effectAllowed);
-    ASSERT(op != DragOperationPrivate);
-    return op;
-}
-
-DragOperation Clipboard::destinationOperation() const
-{
-    DragOperation op = dragOpFromIEOp(m_dropEffect);
-    ASSERT(op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == (DragOperation)(DragOperationGeneric | DragOperationMove) || op == DragOperationEvery);
-    return op;
-}
-
-void Clipboard::setSourceOperation(DragOperation op)
-{
-    ASSERT_ARG(op, op != DragOperationPrivate);
-    m_effectAllowed = IEOpFromDragOp(op);
-}
-
-void Clipboard::setDestinationOperation(DragOperation op)
-{
-    ASSERT_ARG(op, op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationGeneric || op == DragOperationMove || op == (DragOperation)(DragOperationGeneric | DragOperationMove));
-    m_dropEffect = IEOpFromDragOp(op);
-}
-
-bool Clipboard::hasFileOfType(const String& type) const
-{
-    if (!canReadTypes())
-        return false;
-
-    RefPtr<FileList> fileList = files();
-    if (fileList->isEmpty())
-        return false;
-
-    for (unsigned int f = 0; f < fileList->length(); f++) {
-        if (equalIgnoringCase(fileList->item(f)->type(), type))
-            return true;
+    String cleanType = type.stripWhiteSpace().lower();
+    if (cleanType == mimeTypeText || cleanType.startsWith(mimeTypeTextPlainEtc))
+        return mimeTypeTextPlain;
+    if (cleanType == mimeTypeURL) {
+        if (convertToURL)
+            *convertToURL = true;
+        return mimeTypeTextURIList;
     }
-    return false;
+    return cleanType;
 }
 
-bool Clipboard::hasStringOfType(const String& type) const
+PassRefPtr<Clipboard> Clipboard::create(ClipboardType type, ClipboardAccessPolicy policy, PassRefPtr<ChromiumDataObject> dataObject)
 {
-    if (!canReadTypes())
-        return false;
+    return adoptRef(new Clipboard(type, policy , dataObject));
+}
 
-    return types().contains(type);
+Clipboard::~Clipboard()
+{
 }
 
 void Clipboard::setDropEffect(const String &effect)
@@ -203,6 +151,352 @@
         m_effectAllowed = effect;
 }
 
+void Clipboard::clearData(const String& type)
+{
+    if (!canWriteData())
+        return;
+
+    if (type.isNull())
+        m_dataObject->clearAll();
+    else
+        m_dataObject->clearData(normalizeType(type));
+}
+
+String Clipboard::getData(const String& type) const
+{
+    if (!canReadData())
+        return String();
+
+    bool convertToURL = false;
+    String data = m_dataObject->getData(normalizeType(type, &convertToURL));
+    if (!convertToURL)
+        return data;
+    return convertURIListToURL(data);
+}
+
+bool Clipboard::setData(const String& type, const String& data)
+{
+    if (!canWriteData())
+        return false;
+
+    return m_dataObject->setData(normalizeType(type), data);
+}
+
+// extensions beyond IE's API
+Vector<String> Clipboard::types() const
+{
+    Vector<String> types;
+    if (!canReadTypes())
+        return types;
+
+    ListHashSet<String> typesSet = m_dataObject->types();
+    types.appendRange(typesSet.begin(), typesSet.end());
+    return types;
+}
+
+PassRefPtr<FileList> Clipboard::files() const
+{
+    RefPtr<FileList> files = FileList::create();
+    if (!canReadData())
+        return files.release();
+
+    for (size_t i = 0; i < m_dataObject->length(); ++i) {
+        if (m_dataObject->item(i)->kind() == DataTransferItem::kindFile) {
+            RefPtr<Blob> blob = m_dataObject->item(i)->getAsFile();
+            if (blob && blob->isFile())
+                files->append(toFile(blob.get()));
+        }
+    }
+
+    return files.release();
+}
+
+void Clipboard::setDragImage(Element* image, int x, int y, ExceptionState& es)
+{
+    if (!isForDragAndDrop())
+        return;
+
+    if (!image) {
+        es.throwTypeError("setDragImage: Invalid first argument");
+        return;
+    }
+    IntPoint location(x, y);
+    if (image->hasTagName(HTMLNames::imgTag) && !image->inDocument())
+        setDragImageResource(toHTMLImageElement(image)->cachedImage(), location);
+    else
+        setDragImageElement(image, location);
+}
+
+void Clipboard::setDragImageResource(ImageResource* img, const IntPoint& loc)
+{
+    setDragImage(img, 0, loc);
+}
+
+void Clipboard::setDragImageElement(Node* node, const IntPoint& loc)
+{
+    setDragImage(0, node, loc);
+}
+
+PassOwnPtr<DragImage> Clipboard::createDragImage(IntPoint& loc, Frame* frame) const
+{
+    if (m_dragImageElement) {
+        loc = m_dragLoc;
+        return frame->nodeImage(m_dragImageElement.get());
+    }
+    if (m_dragImage) {
+        loc = m_dragLoc;
+        return DragImage::create(m_dragImage->image());
+    }
+    return nullptr;
+}
+
+static ImageResource* getImageResource(Element* element)
+{
+    // Attempt to pull ImageResource from element
+    ASSERT(element);
+    RenderObject* renderer = element->renderer();
+    if (!renderer || !renderer->isImage())
+        return 0;
+
+    RenderImage* image = toRenderImage(renderer);
+    if (image->cachedImage() && !image->cachedImage()->errorOccurred())
+        return image->cachedImage();
+
+    return 0;
+}
+
+static void writeImageToDataObject(ChromiumDataObject* dataObject, Element* element, const KURL& url)
+{
+    // Shove image data into a DataObject for use as a file
+    ImageResource* cachedImage = getImageResource(element);
+    if (!cachedImage || !cachedImage->imageForRenderer(element->renderer()) || !cachedImage->isLoaded())
+        return;
+
+    SharedBuffer* imageBuffer = cachedImage->imageForRenderer(element->renderer())->data();
+    if (!imageBuffer || !imageBuffer->size())
+        return;
+
+    String imageExtension = cachedImage->image()->filenameExtension();
+    ASSERT(!imageExtension.isEmpty());
+
+    // Determine the filename for the file contents of the image.
+    String filename = cachedImage->response().suggestedFilename();
+    if (filename.isEmpty())
+        filename = url.lastPathComponent();
+
+    String fileExtension;
+    if (filename.isEmpty()) {
+        filename = element->getAttribute(HTMLNames::altAttr);
+    } else {
+        // Strip any existing extension. Assume that alt text is usually not a filename.
+        int extensionIndex = filename.reverseFind('.');
+        if (extensionIndex != -1) {
+            fileExtension = filename.substring(extensionIndex + 1);
+            filename.truncate(extensionIndex);
+        }
+    }
+
+    if (!fileExtension.isEmpty() && fileExtension != imageExtension) {
+        String imageMimeType = MIMETypeRegistry::getMIMETypeForExtension(imageExtension);
+        ASSERT(imageMimeType.startsWith("image/"));
+        // Use the file extension only if it has imageMimeType: it's untrustworthy otherwise.
+        if (imageMimeType == MIMETypeRegistry::getMIMETypeForExtension(fileExtension))
+            imageExtension = fileExtension;
+    }
+
+    imageExtension = "." + imageExtension;
+    validateFilename(filename, imageExtension);
+
+    dataObject->addSharedBuffer(filename + imageExtension, imageBuffer);
+}
+
+void Clipboard::declareAndWriteDragImage(Element* element, const KURL& url, const String& title)
+{
+    if (!m_dataObject)
+        return;
+
+    m_dataObject->setURLAndTitle(url, title);
+
+    // Write the bytes in the image to the file format.
+    writeImageToDataObject(m_dataObject.get(), element, url);
+
+    // Put img tag on the clipboard referencing the image
+    m_dataObject->setData(mimeTypeTextHTML, createMarkup(element, IncludeNode, 0, ResolveAllURLs));
+}
+
+void Clipboard::writeURL(const KURL& url, const String& title)
+{
+    if (!m_dataObject)
+        return;
+    ASSERT(!url.isEmpty());
+
+    m_dataObject->setURLAndTitle(url, title);
+
+    // The URL can also be used as plain text.
+    m_dataObject->setData(mimeTypeTextPlain, url.string());
+
+    // The URL can also be used as an HTML fragment.
+    m_dataObject->setHTMLAndBaseURL(urlToMarkup(url, title), url);
+}
+
+void Clipboard::writeRange(Range* selectedRange, Frame* frame)
+{
+    ASSERT(selectedRange);
+    if (!m_dataObject)
+        return;
+
+    m_dataObject->setHTMLAndBaseURL(createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs), frame->document()->url());
+
+    String str = frame->selectedTextForClipboard();
+#if OS(WIN)
+    replaceNewlinesWithWindowsStyleNewlines(str);
+#endif
+    replaceNBSPWithSpace(str);
+    m_dataObject->setData(mimeTypeTextPlain, str);
+}
+
+void Clipboard::writePlainText(const String& text)
+{
+    if (!m_dataObject)
+        return;
+
+    String str = text;
+#if OS(WIN)
+    replaceNewlinesWithWindowsStyleNewlines(str);
+#endif
+    replaceNBSPWithSpace(str);
+
+    m_dataObject->setData(mimeTypeTextPlain, str);
+}
+
+bool Clipboard::hasData()
+{
+    ASSERT(isForDragAndDrop());
+
+    return m_dataObject->length() > 0;
+}
+
+void Clipboard::setAccessPolicy(ClipboardAccessPolicy policy)
+{
+    // once you go numb, can never go back
+    ASSERT(m_policy != ClipboardNumb || policy == ClipboardNumb);
+    m_policy = policy;
+}
+
+bool Clipboard::canReadTypes() const
+{
+    return m_policy == ClipboardReadable || m_policy == ClipboardTypesReadable || m_policy == ClipboardWritable;
+}
+
+bool Clipboard::canReadData() const
+{
+    return m_policy == ClipboardReadable || m_policy == ClipboardWritable;
+}
+
+bool Clipboard::canWriteData() const
+{
+    return m_policy == ClipboardWritable;
+}
+
+bool Clipboard::canSetDragImage() const
+{
+    return m_policy == ClipboardImageWritable || m_policy == ClipboardWritable;
+}
+
+DragOperation Clipboard::sourceOperation() const
+{
+    DragOperation op = dragOpFromIEOp(m_effectAllowed);
+    ASSERT(op != DragOperationPrivate);
+    return op;
+}
+
+DragOperation Clipboard::destinationOperation() const
+{
+    DragOperation op = dragOpFromIEOp(m_dropEffect);
+    ASSERT(op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == (DragOperation)(DragOperationGeneric | DragOperationMove) || op == DragOperationEvery);
+    return op;
+}
+
+void Clipboard::setSourceOperation(DragOperation op)
+{
+    ASSERT_ARG(op, op != DragOperationPrivate);
+    m_effectAllowed = IEOpFromDragOp(op);
+}
+
+void Clipboard::setDestinationOperation(DragOperation op)
+{
+    ASSERT_ARG(op, op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationGeneric || op == DragOperationMove || op == (DragOperation)(DragOperationGeneric | DragOperationMove));
+    m_dropEffect = IEOpFromDragOp(op);
+}
+
+bool Clipboard::hasDropZoneType(const String& keyword)
+{
+    if (keyword.startsWith("file:"))
+        return hasFileOfType(keyword.substring(5));
+
+    if (keyword.startsWith("string:"))
+        return hasStringOfType(keyword.substring(7));
+
+    return false;
+}
+
+PassRefPtr<DataTransferItemList> Clipboard::items()
+{
+    // FIXME: According to the spec, we are supposed to return the same collection of items each
+    // time. We now return a wrapper that always wraps the *same* set of items, so JS shouldn't be
+    // able to tell, but we probably still want to fix this.
+    return DataTransferItemList::create(this, m_dataObject);
+}
+
+PassRefPtr<ChromiumDataObject> Clipboard::dataObject() const
+{
+    return m_dataObject;
+}
+
+Clipboard::Clipboard(ClipboardType type, ClipboardAccessPolicy policy, PassRefPtr<ChromiumDataObject> dataObject)
+    : m_policy(policy)
+    , m_dropEffect("uninitialized")
+    , m_effectAllowed("uninitialized")
+    , m_clipboardType(type)
+    , m_dataObject(dataObject)
+{
+    ScriptWrappable::init(this);
+}
+
+void Clipboard::setDragImage(ImageResource* image, Node* node, const IntPoint& loc)
+{
+    if (!canSetDragImage())
+        return;
+
+    m_dragImage = image;
+    m_dragLoc = loc;
+    m_dragImageElement = node;
+}
+
+bool Clipboard::hasFileOfType(const String& type) const
+{
+    if (!canReadTypes())
+        return false;
+
+    RefPtr<FileList> fileList = files();
+    if (fileList->isEmpty())
+        return false;
+
+    for (unsigned f = 0; f < fileList->length(); f++) {
+        if (equalIgnoringCase(fileList->item(f)->type(), type))
+            return true;
+    }
+    return false;
+}
+
+bool Clipboard::hasStringOfType(const String& type) const
+{
+    if (!canReadTypes())
+        return false;
+
+    return types().contains(type);
+}
+
 DragOperation convertDropZoneOperationToDragOperation(const String& dragOperation)
 {
     if (dragOperation == "copy")
@@ -228,15 +522,4 @@
     }
 }
 
-bool Clipboard::hasDropZoneType(const String& keyword)
-{
-    if (keyword.startsWith("file:"))
-        return hasFileOfType(keyword.substring(5));
-
-    if (keyword.startsWith("string:"))
-        return hasStringOfType(keyword.substring(7));
-
-    return false;
-}
-
 } // namespace WebCore
diff --git a/Source/core/dom/Clipboard.h b/Source/core/dom/Clipboard.h
index bc861de..dfe2271 100644
--- a/Source/core/dom/Clipboard.h
+++ b/Source/core/dom/Clipboard.h
@@ -26,21 +26,25 @@
 
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/ClipboardAccessPolicy.h"
-#include "core/dom/Node.h"
 #include "core/fetch/ResourcePtr.h"
 #include "core/page/DragActions.h"
-#include "core/platform/DragImage.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/geometry/IntPoint.h"
 #include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
 
 namespace WebCore {
 
-class ImageResource;
+class ChromiumDataObject;
 class DataTransferItemList;
-class DragData;
 class DragImage;
+class Element;
+class ExceptionState;
 class FileList;
 class Frame;
+class ImageResource;
+class Node;
 class Range;
 
 // State available during IE's events for drag and drop and copy/paste
@@ -52,9 +56,8 @@
         DragAndDrop,
     };
 
-    static PassRefPtr<Clipboard> create(ClipboardAccessPolicy, DragData*, Frame*);
-
-    virtual ~Clipboard() { }
+    static PassRefPtr<Clipboard> create(ClipboardType, ClipboardAccessPolicy, PassRefPtr<ChromiumDataObject>);
+    ~Clipboard();
 
     bool isForCopyAndPaste() const { return m_clipboardType == CopyAndPaste; }
     bool isForDragAndDrop() const { return m_clipboardType == DragAndDrop; }
@@ -65,28 +68,28 @@
     String effectAllowed() const { return m_effectAllowed; }
     void setEffectAllowed(const String&);
 
-    virtual void clearData(const String& type) = 0;
-    virtual void clearAllData() = 0;
-    virtual String getData(const String& type) const = 0;
-    virtual bool setData(const String& type, const String& data) = 0;
+    void clearData(const String& type = String());
+    String getData(const String& type) const;
+    bool setData(const String& type, const String& data);
 
     // extensions beyond IE's API
-    virtual ListHashSet<String> types() const = 0;
-    virtual PassRefPtr<FileList> files() const = 0;
+    Vector<String> types() const;
+    PassRefPtr<FileList> files() const;
 
     IntPoint dragLocation() const { return m_dragLoc; }
-    ImageResource* dragImage() const { return m_dragImage.get(); }
-    virtual void setDragImage(ImageResource*, const IntPoint&) = 0;
+    void setDragImage(Element*, int x, int y, ExceptionState&);
+    ImageResource* dragImageResource() const { return m_dragImage.get(); }
+    void setDragImageResource(ImageResource*, const IntPoint&);
     Node* dragImageElement() const { return m_dragImageElement.get(); }
-    virtual void setDragImageElement(Node*, const IntPoint&) = 0;
+    void setDragImageElement(Node*, const IntPoint&);
 
-    virtual PassOwnPtr<DragImage> createDragImage(IntPoint& dragLocation) const = 0;
-    virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*) = 0;
-    virtual void writeURL(const KURL&, const String&, Frame*) = 0;
-    virtual void writeRange(Range*, Frame*) = 0;
-    virtual void writePlainText(const String&) = 0;
+    PassOwnPtr<DragImage> createDragImage(IntPoint& dragLocation, Frame*) const;
+    void declareAndWriteDragImage(Element*, const KURL&, const String& title);
+    void writeURL(const KURL&, const String&);
+    void writeRange(Range*, Frame*);
+    void writePlainText(const String&);
 
-    virtual bool hasData() = 0;
+    bool hasData();
 
     void setAccessPolicy(ClipboardAccessPolicy);
     bool canReadTypes() const;
@@ -105,16 +108,15 @@
 
     bool hasDropZoneType(const String&);
 
-    void setDragHasStarted() { m_dragStarted = true; }
+    PassRefPtr<DataTransferItemList> items();
 
-    virtual PassRefPtr<DataTransferItemList> items() = 0;
-
-protected:
-    Clipboard(ClipboardAccessPolicy, ClipboardType);
-
-    bool dragStarted() const { return m_dragStarted; }
+    PassRefPtr<ChromiumDataObject> dataObject() const;
 
 private:
+    Clipboard(ClipboardType, ClipboardAccessPolicy, PassRefPtr<ChromiumDataObject>);
+
+    void setDragImage(ImageResource*, Node*, const IntPoint&);
+
     bool hasFileOfType(const String&) const;
     bool hasStringOfType(const String&) const;
 
@@ -122,10 +124,9 @@
     ClipboardAccessPolicy m_policy;
     String m_dropEffect;
     String m_effectAllowed;
-    bool m_dragStarted;
     ClipboardType m_clipboardType;
+    RefPtr<ChromiumDataObject> m_dataObject;
 
-protected:
     IntPoint m_dragLoc;
     ResourcePtr<ImageResource> m_dragImage;
     RefPtr<Node> m_dragImageElement;
diff --git a/Source/core/dom/Clipboard.idl b/Source/core/dom/Clipboard.idl
index 82453c7..695f70d 100644
--- a/Source/core/dom/Clipboard.idl
+++ b/Source/core/dom/Clipboard.idl
@@ -30,13 +30,13 @@
 ] interface Clipboard {
              [TreatReturnedNullStringAs=Undefined] attribute DOMString dropEffect;
              [TreatReturnedNullStringAs=Undefined] attribute DOMString effectAllowed;
-    [CustomGetter] readonly attribute Array types;
+    readonly attribute DOMString[] types;
     readonly attribute FileList files;
 
-    [Custom, RaisesException] void clearData(optional DOMString type);
+    void clearData(optional DOMString type);
     DOMString getData(DOMString type);
     boolean setData(DOMString type, DOMString data);
-    [Custom, RaisesException] void setDragImage(HTMLImageElement image, long x, long y);
+    [RaisesException] void setDragImage(Element image, long x, long y);
 
     readonly attribute DataTransferItemList items;
 };
diff --git a/Source/core/dom/Comment.h b/Source/core/dom/Comment.h
index 6b4a449..b0625f4 100644
--- a/Source/core/dom/Comment.h
+++ b/Source/core/dom/Comment.h
@@ -27,7 +27,7 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class Comment FINAL : public CharacterData {
 public:
@@ -42,17 +42,7 @@
     virtual bool childTypeAllowed(NodeType) const;
 };
 
-inline Comment* toComment(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->nodeType() == Node::COMMENT_NODE);
-    return static_cast<Comment*>(node);
-}
-
-inline const Comment* toComment(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->nodeType() == Node::COMMENT_NODE);
-    return static_cast<const Comment*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(Comment, nodeType() == Node::COMMENT_NODE);
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index dd9f85d..6115b2f 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -23,18 +23,20 @@
 #include "config.h"
 #include "core/dom/ContainerNode.h"
 
+#include "bindings/v8/ExceptionMessages.h"
 #include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/ChildListMutationScope.h"
 #include "core/dom/ContainerNodeAlgorithms.h"
 #include "core/dom/ElementTraversal.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/FullscreenElementStack.h"
-#include "core/events/MutationEvent.h"
+#include "core/dom/NodeChildRemovalTracker.h"
 #include "core/dom/NodeRareData.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/dom/NodeTraversal.h"
+#include "core/events/MutationEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLCollection.h"
 #include "core/rendering/InlineTextBox.h"
 #include "core/rendering/RenderText.h"
@@ -57,6 +59,10 @@
 unsigned NoEventDispatchAssertion::s_count = 0;
 #endif
 
+static const char appendChildMethodName[] = "appendChild";
+static const char insertBeforeMethodName[] = "insertBefore";
+static const char replaceChildMethodName[] = "replaceChild";
+
 static void collectChildrenAndRemoveFromOldParent(Node* node, NodeVector& nodes, ExceptionState& es)
 {
     if (node->nodeType() != Node::DOCUMENT_FRAGMENT_NODE) {
@@ -75,34 +81,14 @@
         for (Node* child = firstChild(); child; child = child->nextSibling())
             child->updateAncestorConnectedSubframeCountForRemoval();
     }
-    // FIXME: We should be able to ASSERT(!attached()) here: https://bugs.webkit.org/show_bug.cgi?id=107801
+    // FIXME: We should be able to ASSERT(!confusingAndOftenMisusedAttached()) here: https://bugs.webkit.org/show_bug.cgi?id=107801
     removeDetachedChildrenInContainer<Node, ContainerNode>(this);
 }
 
-void ContainerNode::takeAllChildrenFrom(ContainerNode* oldParent)
+void ContainerNode::parserTakeAllChildrenFrom(ContainerNode* oldParent)
 {
-    NodeVector children;
-    getChildNodes(oldParent, children);
-
-    if (oldParent->document().hasMutationObserversOfType(MutationObserver::ChildList)) {
-        ChildListMutationScope mutation(oldParent);
-        for (unsigned i = 0; i < children.size(); ++i)
-            mutation.willRemoveChild(children[i].get());
-    }
-
-    // FIXME: We need to do notifyMutationObserversNodeWillDetach() for each child,
-    // probably inside removeDetachedChildrenInContainer.
-
-    oldParent->removeDetachedChildren();
-
-    for (unsigned i = 0; i < children.size(); ++i) {
-        if (children[i]->attached())
-            children[i]->detach();
-        // FIXME: We need a no mutation event version of adoptNode.
-        RefPtr<Node> child = document().adoptNode(children[i].release(), ASSERT_NO_EXCEPTION);
-        // FIXME: Together with adoptNode above, the tree scope might get updated recursively twice
-        // (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree).
-        // Can we do better?
+    while (RefPtr<Node> child = oldParent->firstChild()) {
+        oldParent->parserRemoveChild(child.get());
         treeScope().adoptIfNeeded(child.get());
         parserAppendChild(child.get());
     }
@@ -130,7 +116,7 @@
 static inline bool isInTemplateContent(const Node* node)
 {
     Document& document = node->document();
-    return &document == document.templateDocument();
+    return document == document.templateDocument();
 }
 
 static inline bool containsConsideringHostElements(const Node* newChild, const Node* newParent)
@@ -140,11 +126,11 @@
         : newChild->contains(newParent);
 }
 
-static inline bool checkAcceptChild(ContainerNode* newParent, Node* newChild, Node* oldChild, ExceptionState& es)
+static inline bool checkAcceptChild(ContainerNode* newParent, Node* newChild, Node* oldChild, const char* method, ExceptionState& es)
 {
     // Not mentioned in spec: throw NotFoundError if newChild is null
     if (!newChild) {
-        es.throwUninformativeAndGenericDOMException(NotFoundError);
+        es.throwDOMException(NotFoundError, ExceptionMessages::failedToExecute(method, "Node", "The new child element is null."));
         return false;
     }
 
@@ -153,7 +139,7 @@
         ASSERT(!newParent->isDocumentTypeNode());
         ASSERT(isChildTypeAllowed(newParent, newChild));
         if (containsConsideringHostElements(newChild, newParent)) {
-            es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
+            es.throwDOMException(HierarchyRequestError, ExceptionMessages::failedToExecute(method, "Node", "The new child element contains the parent."));
             return false;
         }
         return true;
@@ -162,48 +148,49 @@
     // This should never happen, but also protect release builds from tree corruption.
     ASSERT(!newChild->isPseudoElement());
     if (newChild->isPseudoElement()) {
-        es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
+        es.throwDOMException(HierarchyRequestError, ExceptionMessages::failedToExecute(method, "Node", "The new child element is a pseudo-element."));
         return false;
     }
 
     if (containsConsideringHostElements(newChild, newParent)) {
-        es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
+        es.throwDOMException(HierarchyRequestError, ExceptionMessages::failedToExecute(method, "Node", "The new child element contains the parent."));
         return false;
     }
 
     if (oldChild && newParent->isDocumentNode()) {
         if (!toDocument(newParent)->canReplaceChild(newChild, oldChild)) {
-            es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
+            // FIXME: Adjust 'Document::canReplaceChild' to return some additional detail (or an error message).
+            es.throwDOMException(HierarchyRequestError, ExceptionMessages::failedToExecute(method, "ContainerNode"));
             return false;
         }
     } else if (!isChildTypeAllowed(newParent, newChild)) {
-        es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
+        es.throwDOMException(HierarchyRequestError, ExceptionMessages::failedToExecute(method, "Node", "Nodes of type '" + newChild->nodeName() + "' may not be inserted inside nodes of type '" + newParent->nodeName() + "'."));
         return false;
     }
 
     return true;
 }
 
-static inline bool checkAcceptChildGuaranteedNodeTypes(ContainerNode* newParent, Node* newChild, ExceptionState& es)
+static inline bool checkAcceptChildGuaranteedNodeTypes(ContainerNode* newParent, Node* newChild, const char* method, ExceptionState& es)
 {
     ASSERT(!newParent->isDocumentTypeNode());
     ASSERT(isChildTypeAllowed(newParent, newChild));
     if (newChild->contains(newParent)) {
-        es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
+        es.throwDOMException(HierarchyRequestError, ExceptionMessages::failedToExecute(method, "Node", "The new child element contains the parent."));
         return false;
     }
 
     return true;
 }
 
-static inline bool checkAddChild(ContainerNode* newParent, Node* newChild, ExceptionState& es)
+static inline bool checkAddChild(ContainerNode* newParent, Node* newChild, const char* method, ExceptionState& es)
 {
-    return checkAcceptChild(newParent, newChild, 0, es);
+    return checkAcceptChild(newParent, newChild, 0, method, es);
 }
 
-static inline bool checkReplaceChild(ContainerNode* newParent, Node* newChild, Node* oldChild, ExceptionState& es)
+static inline bool checkReplaceChild(ContainerNode* newParent, Node* newChild, Node* oldChild, const char* method, ExceptionState& es)
 {
-    return checkAcceptChild(newParent, newChild, oldChild, es);
+    return checkAcceptChild(newParent, newChild, oldChild, method, es);
 }
 
 void ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionState& es)
@@ -221,12 +208,12 @@
     }
 
     // Make sure adding the new child is OK.
-    if (!checkAddChild(this, newChild.get(), es))
+    if (!checkAddChild(this, newChild.get(), insertBeforeMethodName, es))
         return;
 
     // NotFoundError: Raised if refChild is not a child of this node
     if (refChild->parentNode() != this) {
-        es.throwUninformativeAndGenericDOMException(NotFoundError);
+        es.throwDOMException(NotFoundError, ExceptionMessages::failedToExecute(insertBeforeMethodName, "Node", "The node before which the new node is to be inserted is not a child of this node."));
         return;
     }
 
@@ -243,7 +230,7 @@
         return;
 
     // We need this extra check because collectChildrenAndRemoveFromOldParent() can fire mutation events.
-    if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), es))
+    if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), insertBeforeMethodName, es))
         return;
 
     InspectorInstrumentation::willInsertDOMNode(&document(), this);
@@ -308,7 +295,7 @@
     if (nextChild->previousSibling() == newChild || nextChild == newChild) // nothing to do
         return;
 
-    if (&document() != &newChild->document())
+    if (document() != newChild->document())
         document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION);
 
     insertBeforeCommon(nextChild, newChild.get());
@@ -334,17 +321,17 @@
         return;
 
     if (!oldChild) {
-        es.throwUninformativeAndGenericDOMException(NotFoundError);
+        es.throwDOMException(NotFoundError, ExceptionMessages::failedToExecute(replaceChildMethodName, "Node", "The node to be replaced is null."));
         return;
     }
 
     // Make sure replacing the old child with the new is ok
-    if (!checkReplaceChild(this, newChild.get(), oldChild, es))
+    if (!checkReplaceChild(this, newChild.get(), oldChild, replaceChildMethodName, es))
         return;
 
     // NotFoundError: Raised if oldChild is not a child of this node.
     if (oldChild->parentNode() != this) {
-        es.throwUninformativeAndGenericDOMException(NotFoundError);
+        es.throwDOMException(NotFoundError, ExceptionMessages::failedToExecute(replaceChildMethodName, "Node", "The node to be replaced is not a child of this node."));
         return;
     }
 
@@ -362,7 +349,7 @@
         return;
 
     // Does this one more time because removeChild() fires a MutationEvent.
-    if (!checkReplaceChild(this, newChild.get(), oldChild, es))
+    if (!checkReplaceChild(this, newChild.get(), oldChild, replaceChildMethodName, es))
         return;
 
     NodeVector targets;
@@ -371,7 +358,7 @@
         return;
 
     // Does this yet another check because collectChildrenAndRemoveFromOldParent() fires a MutationEvent.
-    if (!checkReplaceChild(this, newChild.get(), oldChild, es))
+    if (!checkReplaceChild(this, newChild.get(), oldChild, replaceChildMethodName, es))
         return;
 
     InspectorInstrumentation::willInsertDOMNode(&document(), this);
@@ -421,8 +408,6 @@
     NodeVector children;
     getChildNodes(container, children);
 
-    container->document().nodeChildrenWillBeRemoved(container);
-
     ChildListMutationScope mutation(container);
     for (NodeVector::const_iterator it = children.begin(); it != children.end(); it++) {
         Node* child = it->get();
@@ -451,7 +436,7 @@
 
     // NotFoundError: Raised if oldChild is not a child of this node.
     if (!oldChild || oldChild->parentNode() != this) {
-        es.throwUninformativeAndGenericDOMException(NotFoundError);
+        es.throwDOMException(NotFoundError, ExceptionMessages::failedToExecute("removeChild", "Node", "The node to be removed is not a child of this node."));
         return;
     }
 
@@ -465,7 +450,7 @@
     // Events fired when blurring currently focused node might have moved this
     // child into a different parent.
     if (child->parentNode() != this) {
-        es.throwUninformativeAndGenericDOMException(NotFoundError);
+        es.throwDOMException(NotFoundError, ExceptionMessages::failedToExecute("removeChild", "Node", "The node to be removed is no longer a child of this node. Perhaps it was moved in a 'blur' event handler?"));
         return;
     }
 
@@ -473,12 +458,12 @@
 
     // Mutation events might have moved this child into a different parent.
     if (child->parentNode() != this) {
-        es.throwUninformativeAndGenericDOMException(NotFoundError);
+        es.throwDOMException(NotFoundError, ExceptionMessages::failedToExecute("removeChild", "Node", "The node to be removed is no longer a child of this node. Perhaps it was moved in response to a mutation?"));
         return;
     }
 
     {
-        WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
+        RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates;
 
         Node* prev = child->previousSibling();
         Node* next = child->nextSibling();
@@ -497,7 +482,7 @@
     ASSERT(oldChild->parentNode() == this);
 
     // Remove from rendering tree
-    if (oldChild->attached())
+    if (oldChild->confusingAndOftenMisusedAttached())
         oldChild->detach();
 
     if (nextChild)
@@ -565,9 +550,11 @@
         document().removeFocusedElementOfSubtree(this, true);
     }
 
+    document().nodeChildrenWillBeRemoved(this);
+
     NodeVector removedChildren;
     {
-        WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
+        RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates;
         {
             NoEventDispatchAssertion assertNoEventDispatch;
             removedChildren.reserveInitialCapacity(childNodeCount());
@@ -595,7 +582,7 @@
     ASSERT(refCount() || parentOrShadowHostNode());
 
     // Make sure adding the new child is ok
-    if (!checkAddChild(this, newChild.get(), es))
+    if (!checkAddChild(this, newChild.get(), appendChildMethodName, es))
         return;
 
     if (newChild == m_lastChild) // nothing to do
@@ -610,7 +597,7 @@
         return;
 
     // We need this extra check because collectChildrenAndRemoveFromOldParent() can fire mutation events.
-    if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), es))
+    if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), appendChildMethodName, es))
         return;
 
     InspectorInstrumentation::willInsertDOMNode(&document(), this);
@@ -647,7 +634,7 @@
     ASSERT(!newChild->isDocumentFragment());
     ASSERT(!hasTagName(HTMLNames::templateTag));
 
-    if (&document() != &newChild->document())
+    if (document() != newChild->document())
         document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION);
 
     Node* last = m_lastChild;
@@ -938,15 +925,15 @@
     ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
 
     RefPtr<Node> c = child;
-    RefPtr<Document> document = &child->document();
+    RefPtr<Document> document(child->document());
 
     if (c->parentNode() && document->hasListenerType(Document::DOMNODEINSERTED_LISTENER))
-        c->dispatchScopedEvent(MutationEvent::create(eventNames().DOMNodeInsertedEvent, true, c->parentNode()));
+        c->dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMNodeInserted, true, c->parentNode()));
 
     // dispatch the DOMNodeInsertedIntoDocument event to all descendants
     if (c->inDocument() && document->hasListenerType(Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER)) {
         for (; c; c = NodeTraversal::next(c.get(), child))
-            c->dispatchScopedEvent(MutationEvent::create(eventNames().DOMNodeInsertedIntoDocumentEvent, false));
+            c->dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMNodeInsertedIntoDocument, false));
     }
 }
 
@@ -962,16 +949,19 @@
     InspectorInstrumentation::willRemoveDOMNode(&child->document(), child);
 
     RefPtr<Node> c = child;
-    RefPtr<Document> document = &child->document();
+    RefPtr<Document> document(child->document());
 
     // dispatch pre-removal mutation events
-    if (c->parentNode() && document->hasListenerType(Document::DOMNODEREMOVED_LISTENER))
-        c->dispatchScopedEvent(MutationEvent::create(eventNames().DOMNodeRemovedEvent, true, c->parentNode()));
+    if (c->parentNode() && document->hasListenerType(Document::DOMNODEREMOVED_LISTENER)) {
+        NodeChildRemovalTracker scope(child);
+        c->dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMNodeRemoved, true, c->parentNode()));
+    }
 
     // dispatch the DOMNodeRemovedFromDocument event to all descendants
     if (c->inDocument() && document->hasListenerType(Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER)) {
+        NodeChildRemovalTracker scope(child);
         for (; c; c = NodeTraversal::next(c.get(), child))
-            c->dispatchScopedEvent(MutationEvent::create(eventNames().DOMNodeRemovedFromDocumentEvent, false));
+            c->dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMNodeRemovedFromDocument, false));
     }
 }
 
diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h
index 80b9c88..61034cb 100644
--- a/Source/core/dom/ContainerNode.h
+++ b/Source/core/dom/ContainerNode.h
@@ -107,9 +107,9 @@
     void parserAppendChild(PassRefPtr<Node>);
     void parserRemoveChild(Node*);
     void parserInsertBefore(PassRefPtr<Node> newChild, Node* refChild);
+    void parserTakeAllChildrenFrom(ContainerNode*);
 
     void removeChildren();
-    void takeAllChildrenFrom(ContainerNode*);
 
     void cloneChildNodes(ContainerNode* clone);
 
@@ -162,20 +162,7 @@
 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*);
 #endif
 
-inline ContainerNode* toContainerNode(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isContainerNode());
-    return static_cast<ContainerNode*>(node);
-}
-
-inline const ContainerNode* toContainerNode(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isContainerNode());
-    return static_cast<const ContainerNode*>(node);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toContainerNode(const ContainerNode*);
+DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode());
 
 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type)
     : Node(treeScope, type)
@@ -190,8 +177,8 @@
     childrenContext.resolvedStyle = 0;
 
     for (Node* child = firstChild(); child; child = child->nextSibling()) {
-        ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(this));
-        if (!child->attached())
+        ASSERT(child->needsAttach() || childAttachedAllowedWhenAttachingChildren(this));
+        if (child->needsAttach())
             child->attach(childrenContext);
     }
 }
diff --git a/Source/core/dom/ContainerNodeAlgorithms.h b/Source/core/dom/ContainerNodeAlgorithms.h
index d8910cf..798d90b 100644
--- a/Source/core/dom/ContainerNodeAlgorithms.h
+++ b/Source/core/dom/ContainerNodeAlgorithms.h
@@ -87,7 +87,7 @@
     GenericNode* n;
     GenericNode* next;
     while ((n = head) != 0) {
-        ASSERT(n->m_deletionHasBegun);
+        ASSERT_WITH_SECURITY_IMPLICATION(n->m_deletionHasBegun);
 
         next = n->nextSibling();
         n->setNextSibling(0);
@@ -157,7 +157,7 @@
         // We have to tell all children that their parent has died.
         GenericNode* next = 0;
         for (GenericNode* n = container->firstChild(); n != 0; n = next) {
-            ASSERT(!n->m_deletionHasBegun);
+            ASSERT_WITH_SECURITY_IMPLICATION(!n->m_deletionHasBegun);
 
             next = n->nextSibling();
             n->setNextSibling(0);
@@ -167,7 +167,7 @@
                 next->setPreviousSibling(0);
 
             if (!n->refCount()) {
-#ifndef NDEBUG
+#if SECURITY_ASSERT_ENABLED
                 n->m_deletionHasBegun = true;
 #endif
                 // Add the node to the list of nodes to be deleted.
@@ -215,7 +215,7 @@
 
     InspectorInstrumentation::didInsertDOMNode(&node->document(), node);
 
-    RefPtr<Document> protectDocument(&node->document());
+    RefPtr<Document> protectDocument(node->document());
     RefPtr<Node> protectNode(node);
 
     if (m_insertionPoint->inDocument())
@@ -228,7 +228,7 @@
     // were inserted.
     // FIXME: We should merge the lazy attach logic into the tree traversal in
     // notifyNodeInsertedIntoDocument.
-    if (!node->attached() && node->parentNode() && node->parentNode()->attached())
+    if (!node->confusingAndOftenMisusedAttached() && node->parentNode() && node->parentNode()->confusingAndOftenMisusedAttached())
         node->lazyAttach();
 
     for (size_t i = 0; i < m_postInsertionNotificationTargets.size(); ++i) {
diff --git a/Source/core/dom/ContextLifecycleNotifier.cpp b/Source/core/dom/ContextLifecycleNotifier.cpp
index 205380d..bf319bd 100644
--- a/Source/core/dom/ContextLifecycleNotifier.cpp
+++ b/Source/core/dom/ContextLifecycleNotifier.cpp
@@ -28,12 +28,12 @@
 #include "config.h"
 #include "core/dom/ContextLifecycleNotifier.h"
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
 #include "wtf/TemporaryChange.h"
 
 namespace WebCore {
 
-ContextLifecycleNotifier::ContextLifecycleNotifier(ScriptExecutionContext* context)
+ContextLifecycleNotifier::ContextLifecycleNotifier(ExecutionContext* context)
     : LifecycleNotifier(context)
 {
 }
@@ -69,20 +69,20 @@
     TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveDOMObjects);
     ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end();
     for (ActiveDOMObjectSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
-        ASSERT((*iter)->scriptExecutionContext() == context());
+        ASSERT((*iter)->executionContext() == context());
         ASSERT((*iter)->suspendIfNeededCalled());
         (*iter)->resume();
     }
 }
 
-void ContextLifecycleNotifier::notifySuspendingActiveDOMObjects(ActiveDOMObject::ReasonForSuspension why)
+void ContextLifecycleNotifier::notifySuspendingActiveDOMObjects()
 {
     TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveDOMObjects);
     ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end();
     for (ActiveDOMObjectSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
-        ASSERT((*iter)->scriptExecutionContext() == context());
+        ASSERT((*iter)->executionContext() == context());
         ASSERT((*iter)->suspendIfNeededCalled());
-        (*iter)->suspend(why);
+        (*iter)->suspend();
     }
 }
 
@@ -91,26 +91,12 @@
     TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveDOMObjects);
     ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end();
     for (ActiveDOMObjectSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
-        ASSERT((*iter)->scriptExecutionContext() == context());
+        ASSERT((*iter)->executionContext() == context());
         ASSERT((*iter)->suspendIfNeededCalled());
         (*iter)->stop();
     }
 }
 
-bool ContextLifecycleNotifier::canSuspendActiveDOMObjects()
-{
-    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverActiveDOMObjects);
-    ActiveDOMObjectSet::iterator activeObjectsEnd = m_activeDOMObjects.end();
-    for (ActiveDOMObjectSet::const_iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) {
-        ASSERT((*iter)->scriptExecutionContext() == context());
-        ASSERT((*iter)->suspendIfNeededCalled());
-        if (!(*iter)->canSuspend())
-            return false;
-    }
-
-    return true;
-}
-
 bool ContextLifecycleNotifier::hasPendingActivity() const
 {
     ActiveDOMObjectSet::const_iterator activeObjectsEnd = activeDOMObjects().end();
@@ -123,4 +109,3 @@
 }
 
 } // namespace WebCore
-
diff --git a/Source/core/dom/ContextLifecycleNotifier.h b/Source/core/dom/ContextLifecycleNotifier.h
index 42a61f3..342b57f 100644
--- a/Source/core/dom/ContextLifecycleNotifier.h
+++ b/Source/core/dom/ContextLifecycleNotifier.h
@@ -36,11 +36,11 @@
 
 class ActiveDOMObject;
 class ContextLifecycleObserver;
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class ContextLifecycleNotifier : public LifecycleNotifier {
 public:
-    static PassOwnPtr<ContextLifecycleNotifier> create(ScriptExecutionContext*);
+    static PassOwnPtr<ContextLifecycleNotifier> create(ExecutionContext*);
 
     virtual ~ContextLifecycleNotifier();
 
@@ -52,21 +52,20 @@
     virtual void removeObserver(LifecycleObserver*) OVERRIDE;
 
     void notifyResumingActiveDOMObjects();
-    void notifySuspendingActiveDOMObjects(ActiveDOMObject::ReasonForSuspension);
+    void notifySuspendingActiveDOMObjects();
     void notifyStoppingActiveDOMObjects();
 
     bool contains(ActiveDOMObject* object) const { return m_activeDOMObjects.contains(object); }
-    bool canSuspendActiveDOMObjects();
     bool hasPendingActivity() const;
 
 protected:
-    explicit ContextLifecycleNotifier(ScriptExecutionContext*);
+    explicit ContextLifecycleNotifier(ExecutionContext*);
 
 private:
     ActiveDOMObjectSet m_activeDOMObjects;
 };
 
-inline PassOwnPtr<ContextLifecycleNotifier> ContextLifecycleNotifier::create(ScriptExecutionContext* context)
+inline PassOwnPtr<ContextLifecycleNotifier> ContextLifecycleNotifier::create(ExecutionContext* context)
 {
     return adoptPtr(new ContextLifecycleNotifier(context));
 }
diff --git a/Source/core/dom/ContextLifecycleObserver.cpp b/Source/core/dom/ContextLifecycleObserver.cpp
index be2d6c4..f10c7ca 100644
--- a/Source/core/dom/ContextLifecycleObserver.cpp
+++ b/Source/core/dom/ContextLifecycleObserver.cpp
@@ -27,12 +27,12 @@
 #include "config.h"
 #include "core/dom/ContextLifecycleObserver.h"
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
 
 namespace WebCore {
 
-ContextLifecycleObserver::ContextLifecycleObserver(ScriptExecutionContext* scriptExecutionContext, Type type)
-    : LifecycleObserver(scriptExecutionContext, type)
+ContextLifecycleObserver::ContextLifecycleObserver(ExecutionContext* executionContext, Type type)
+    : LifecycleObserver(executionContext, type)
 {
 }
 
@@ -40,9 +40,9 @@
 {
 }
 
-ScriptExecutionContext* ContextLifecycleObserver::scriptExecutionContext() const
+ExecutionContext* ContextLifecycleObserver::executionContext() const
 {
-    return static_cast<ScriptExecutionContext*>(m_lifecycleContext);
+    return static_cast<ExecutionContext*>(m_lifecycleContext);
 }
 
 } // namespace WebCore
diff --git a/Source/core/dom/ContextLifecycleObserver.h b/Source/core/dom/ContextLifecycleObserver.h
index c48a1ed..932b021 100644
--- a/Source/core/dom/ContextLifecycleObserver.h
+++ b/Source/core/dom/ContextLifecycleObserver.h
@@ -31,12 +31,12 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class ContextLifecycleObserver : public LifecycleObserver {
 public:
-    explicit ContextLifecycleObserver(ScriptExecutionContext*, Type = GenericType);
-    ScriptExecutionContext* scriptExecutionContext() const;
+    explicit ContextLifecycleObserver(ExecutionContext*, Type = GenericType);
+    ExecutionContext* executionContext() const;
 
 protected:
     virtual ~ContextLifecycleObserver();
diff --git a/Source/core/dom/CrossThreadTask.h b/Source/core/dom/CrossThreadTask.h
index 22864b8..5b48797 100644
--- a/Source/core/dom/CrossThreadTask.h
+++ b/Source/core/dom/CrossThreadTask.h
@@ -31,7 +31,8 @@
 #ifndef CrossThreadTask_h
 #define CrossThreadTask_h
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/dom/ExecutionContextTask.h"
 #include "core/platform/CrossThreadCopier.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
@@ -57,9 +58,9 @@
 };
 
 template<typename P1, typename MP1>
-class CrossThreadTask1 : public ScriptExecutionContext::Task {
+class CrossThreadTask1 : public ExecutionContextTask {
 public:
-    typedef void (*Method)(ScriptExecutionContext*, MP1);
+    typedef void (*Method)(ExecutionContext*, MP1);
     typedef CrossThreadTask1<P1, MP1> CrossThreadTask;
     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
 
@@ -75,7 +76,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ExecutionContext* context)
     {
         (*m_method)(context, m_parameter1);
     }
@@ -86,9 +87,9 @@
 };
 
 template<typename P1, typename MP1, typename P2, typename MP2>
-class CrossThreadTask2 : public ScriptExecutionContext::Task {
+class CrossThreadTask2 : public ExecutionContextTask {
 public:
-    typedef void (*Method)(ScriptExecutionContext*, MP1, MP2);
+    typedef void (*Method)(ExecutionContext*, MP1, MP2);
     typedef CrossThreadTask2<P1, MP1, P2, MP2> CrossThreadTask;
     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
@@ -106,7 +107,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ExecutionContext* context)
     {
         (*m_method)(context, m_parameter1, m_parameter2);
     }
@@ -118,9 +119,9 @@
 };
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
-class CrossThreadTask3 : public ScriptExecutionContext::Task {
+class CrossThreadTask3 : public ExecutionContextTask {
 public:
-    typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3);
+    typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3);
     typedef CrossThreadTask3<P1, MP1, P2, MP2, P3, MP3> CrossThreadTask;
     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
@@ -140,7 +141,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ExecutionContext* context)
     {
         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3);
     }
@@ -153,9 +154,9 @@
 };
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
-class CrossThreadTask4 : public ScriptExecutionContext::Task {
+class CrossThreadTask4 : public ExecutionContextTask {
 public:
-    typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4);
+    typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4);
     typedef CrossThreadTask4<P1, MP1, P2, MP2, P3, MP3, P4, MP4> CrossThreadTask;
     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
@@ -177,7 +178,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ExecutionContext* context)
     {
         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4);
     }
@@ -191,9 +192,9 @@
 };
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5>
-class CrossThreadTask5 : public ScriptExecutionContext::Task {
+class CrossThreadTask5 : public ExecutionContextTask {
 public:
-    typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5);
+    typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5);
     typedef CrossThreadTask5<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> CrossThreadTask;
     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
@@ -217,7 +218,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ExecutionContext* context)
     {
         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5);
     }
@@ -232,9 +233,9 @@
 };
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6>
-class CrossThreadTask6 : public ScriptExecutionContext::Task {
+class CrossThreadTask6 : public ExecutionContextTask {
 public:
-    typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6);
+    typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6);
     typedef CrossThreadTask6<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6> CrossThreadTask;
     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
@@ -260,7 +261,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ExecutionContext* context)
     {
         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5, m_parameter6);
     }
@@ -276,9 +277,9 @@
 };
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7>
-class CrossThreadTask7 : public ScriptExecutionContext::Task {
+class CrossThreadTask7 : public ExecutionContextTask {
 public:
-    typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7);
+    typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7);
     typedef CrossThreadTask7<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7> CrossThreadTask;
     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
@@ -306,7 +307,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ExecutionContext* context)
     {
         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5, m_parameter6, m_parameter7);
     }
@@ -323,9 +324,9 @@
 };
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
-class CrossThreadTask8 : public ScriptExecutionContext::Task {
+class CrossThreadTask8 : public ExecutionContextTask {
 public:
-    typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8);
+    typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8);
     typedef CrossThreadTask8<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7, P8, MP8> CrossThreadTask;
     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
@@ -355,7 +356,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ExecutionContext* context)
     {
         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5, m_parameter6, m_parameter7, m_parameter8);
     }
@@ -373,8 +374,8 @@
 };
 
 template<typename P1, typename MP1>
-PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
-    void (*method)(ScriptExecutionContext*, MP1),
+PassOwnPtr<ExecutionContextTask> createCallbackTask(
+    void (*method)(ExecutionContext*, MP1),
     const P1& parameter1)
 {
     return CrossThreadTask1<typename CrossThreadCopier<P1>::Type, MP1>::create(
@@ -383,8 +384,8 @@
 }
 
 template<typename P1, typename MP1, typename P2, typename MP2>
-PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
-    void (*method)(ScriptExecutionContext*, MP1, MP2),
+PassOwnPtr<ExecutionContextTask> createCallbackTask(
+    void (*method)(ExecutionContext*, MP1, MP2),
     const P1& parameter1, const P2& parameter2)
 {
     return CrossThreadTask2<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create(
@@ -393,8 +394,8 @@
 }
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
-PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
-    void (*method)(ScriptExecutionContext*, MP1, MP2, MP3),
+PassOwnPtr<ExecutionContextTask> createCallbackTask(
+    void (*method)(ExecutionContext*, MP1, MP2, MP3),
     const P1& parameter1, const P2& parameter2, const P3& parameter3)
 {
     return CrossThreadTask3<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create(
@@ -404,8 +405,8 @@
 }
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
-PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
-    void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4),
+PassOwnPtr<ExecutionContextTask> createCallbackTask(
+    void (*method)(ExecutionContext*, MP1, MP2, MP3, MP4),
     const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4)
 {
     return CrossThreadTask4<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
@@ -416,8 +417,8 @@
 }
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5>
-PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
-    void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5),
+PassOwnPtr<ExecutionContextTask> createCallbackTask(
+    void (*method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5),
     const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5)
 {
     return CrossThreadTask5<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
@@ -429,8 +430,8 @@
 }
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6>
-PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
-    void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6),
+PassOwnPtr<ExecutionContextTask> createCallbackTask(
+    void (*method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6),
     const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6)
 {
     return CrossThreadTask6<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
@@ -442,8 +443,8 @@
 }
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7>
-PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
-    void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7),
+PassOwnPtr<ExecutionContextTask> createCallbackTask(
+    void (*method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7),
     const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6, const P7& parameter7)
 {
     return CrossThreadTask7<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
@@ -457,9 +458,9 @@
 }
 
 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
-PassOwnPtr<ScriptExecutionContext::Task> createCallbackTask(
-                                                            void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8),
-                                                            const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6, const P7& parameter7, const P8& parameter8)
+PassOwnPtr<ExecutionContextTask> createCallbackTask(
+    void (*method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8),
+    const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6, const P7& parameter7, const P8& parameter8)
 {
     return CrossThreadTask8<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
     typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6,
diff --git a/Source/core/dom/CustomElement.cpp b/Source/core/dom/CustomElement.cpp
deleted file mode 100644
index d09bafc..0000000
--- a/Source/core/dom/CustomElement.cpp
+++ /dev/null
@@ -1,180 +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:
- *
- * 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.
- * 3. 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/dom/CustomElement.h"
-
-#include "HTMLNames.h"
-#include "MathMLNames.h"
-#include "RuntimeEnabledFeatures.h"
-#include "SVGNames.h"
-#include "core/dom/CustomElementCallbackScheduler.h"
-#include "core/dom/CustomElementObserver.h"
-#include "core/dom/Element.h"
-
-namespace WebCore {
-
-Vector<AtomicString>& CustomElement::embedderCustomElementNames()
-{
-    DEFINE_STATIC_LOCAL(Vector<AtomicString>, names, ());
-    return names;
-}
-
-void CustomElement::addEmbedderCustomElementName(const AtomicString& name)
-{
-    AtomicString lower = name.lower();
-    if (isValidName(lower, EmbedderNames))
-        return;
-    embedderCustomElementNames().append(lower);
-}
-
-static CustomElement::NameSet enabledNameSet()
-{
-    return CustomElement::NameSet((RuntimeEnabledFeatures::customElementsEnabled() ? CustomElement::StandardNames : 0) | (RuntimeEnabledFeatures::embedderCustomElementsEnabled() ? CustomElement::EmbedderNames : 0));
-}
-
-bool CustomElement::isValidName(const AtomicString& name, NameSet validNames)
-{
-    validNames = NameSet(validNames & enabledNameSet());
-
-    if ((validNames & EmbedderNames) && kNotFound != embedderCustomElementNames().find(name))
-        return Document::isValidName(name);
-
-    if ((validNames & StandardNames) && kNotFound != name.find('-')) {
-        DEFINE_STATIC_LOCAL(Vector<AtomicString>, reservedNames, ());
-        if (reservedNames.isEmpty()) {
-            reservedNames.append(MathMLNames::annotation_xmlTag.localName());
-            reservedNames.append(SVGNames::color_profileTag.localName());
-            reservedNames.append(SVGNames::font_faceTag.localName());
-            reservedNames.append(SVGNames::font_face_srcTag.localName());
-            reservedNames.append(SVGNames::font_face_uriTag.localName());
-            reservedNames.append(SVGNames::font_face_formatTag.localName());
-            reservedNames.append(SVGNames::font_face_nameTag.localName());
-            reservedNames.append(SVGNames::missing_glyphTag.localName());
-        }
-
-        if (kNotFound == reservedNames.find(name))
-            return Document::isValidName(name.string());
-    }
-
-    return false;
-}
-
-void CustomElement::define(Element* element, PassRefPtr<CustomElementDefinition> passDefinition)
-{
-    RefPtr<CustomElementDefinition> definition(passDefinition);
-
-    switch (element->customElementState()) {
-    case Element::NotCustomElement:
-    case Element::Upgraded:
-        ASSERT_NOT_REACHED();
-        break;
-
-    case Element::WaitingForParser:
-        definitions().add(element, definition);
-        break;
-
-    case Element::WaitingForUpgrade:
-        definitions().add(element, definition);
-        CustomElementCallbackScheduler::scheduleCreatedCallback(definition->callbacks(), element);
-        break;
-    }
-}
-
-CustomElementDefinition* CustomElement::definitionFor(Element* element)
-{
-    CustomElementDefinition* definition = definitions().get(element);
-    ASSERT(definition);
-    return definition;
-}
-
-void CustomElement::didFinishParsingChildren(Element* element)
-{
-    ASSERT(element->customElementState() == Element::WaitingForParser);
-    element->setCustomElementState(Element::WaitingForUpgrade);
-
-    CustomElementObserver::notifyElementDidFinishParsingChildren(element);
-
-    if (CustomElementDefinition* definition = definitions().get(element))
-        CustomElementCallbackScheduler::scheduleCreatedCallback(definition->callbacks(), element);
-}
-
-void CustomElement::attributeDidChange(Element* element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
-{
-    ASSERT(element->customElementState() == Element::Upgraded);
-    CustomElementCallbackScheduler::scheduleAttributeChangedCallback(definitionFor(element)->callbacks(), element, name, oldValue, newValue);
-}
-
-void CustomElement::didEnterDocument(Element* element, const Document& document)
-{
-    ASSERT(element->customElementState() == Element::Upgraded);
-    if (!document.defaultView())
-        return;
-    CustomElementCallbackScheduler::scheduleEnteredViewCallback(definitionFor(element)->callbacks(), element);
-}
-
-void CustomElement::didLeaveDocument(Element* element, const Document& document)
-{
-    ASSERT(element->customElementState() == Element::Upgraded);
-    if (!document.defaultView())
-        return;
-    CustomElementCallbackScheduler::scheduleLeftViewCallback(definitionFor(element)->callbacks(), element);
-}
-
-void CustomElement::wasDestroyed(Element* element)
-{
-    switch (element->customElementState()) {
-    case Element::NotCustomElement:
-        ASSERT_NOT_REACHED();
-        break;
-
-    case Element::WaitingForParser:
-    case Element::WaitingForUpgrade:
-    case Element::Upgraded:
-        definitions().remove(element);
-        CustomElementObserver::notifyElementWasDestroyed(element);
-        break;
-    }
-}
-
-void CustomElement::DefinitionMap::add(Element* element, PassRefPtr<CustomElementDefinition> definition)
-{
-    ASSERT(definition.get());
-    DefinitionMap::ElementDefinitionHashMap::AddResult result = m_definitions.add(element, definition);
-    ASSERT(result.isNewEntry);
-}
-
-CustomElement::DefinitionMap& CustomElement::definitions()
-{
-    DEFINE_STATIC_LOCAL(DefinitionMap, map, ());
-    return map;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CustomElement.h b/Source/core/dom/CustomElement.h
deleted file mode 100644
index 3e66512..0000000
--- a/Source/core/dom/CustomElement.h
+++ /dev/null
@@ -1,97 +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:
- *
- * 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.
- * 3. 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 CustomElement_h
-#define CustomElement_h
-
-#include "core/dom/CustomElementDefinition.h"
-#include "wtf/HashMap.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-class Document;
-class Element;
-
-class CustomElement {
-public:
-    enum NameSet {
-        EmbedderNames = 1 << 0,
-        StandardNames = 1 << 1,
-        AllNames = EmbedderNames | StandardNames
-    };
-    static bool isValidName(const AtomicString& name, NameSet validNames = AllNames);
-    static void addEmbedderCustomElementName(const AtomicString& name);
-
-    // API for registration contexts
-    static void define(Element*, PassRefPtr<CustomElementDefinition>);
-
-    // API for wrapper creation, which uses a definition as a key
-    static CustomElementDefinition* definitionFor(Element*);
-
-    // API for Element to kick off changes
-
-    static void didFinishParsingChildren(Element*);
-    static void attributeDidChange(Element*, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
-    static void didEnterDocument(Element*, const Document&);
-    static void didLeaveDocument(Element*, const Document&);
-    static void wasDestroyed(Element*);
-
-private:
-    CustomElement();
-
-    static Vector<AtomicString>& embedderCustomElementNames();
-
-    // Maps resolved elements to their definitions
-
-    class DefinitionMap {
-        WTF_MAKE_NONCOPYABLE(DefinitionMap);
-    public:
-        DefinitionMap() { }
-        ~DefinitionMap() { }
-
-        void add(Element*, PassRefPtr<CustomElementDefinition>);
-        void remove(Element* element) { m_definitions.remove(element); }
-        CustomElementDefinition* get(Element* element) const { return m_definitions.get(element); }
-
-    private:
-        typedef HashMap<Element*, RefPtr<CustomElementDefinition> > ElementDefinitionHashMap;
-        ElementDefinitionHashMap m_definitions;
-    };
-    static DefinitionMap& definitions();
-};
-
-}
-
-#endif // CustomElement_h
diff --git a/Source/core/dom/CustomElementCallbackDispatcher.cpp b/Source/core/dom/CustomElementCallbackDispatcher.cpp
deleted file mode 100644
index 9ae56c4..0000000
--- a/Source/core/dom/CustomElementCallbackDispatcher.cpp
+++ /dev/null
@@ -1,124 +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:
- *
- * 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.
- * 3. 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/dom/CustomElementCallbackDispatcher.h"
-
-#include "core/dom/CustomElementCallbackQueue.h"
-#include "core/dom/CustomElementCallbackScheduler.h"
-#include "wtf/MainThread.h"
-
-namespace WebCore {
-
-size_t CustomElementCallbackDispatcher::s_elementQueueStart = 0;
-
-// The base of the stack has a null sentinel value.
-size_t CustomElementCallbackDispatcher::s_elementQueueEnd = kNumSentinels;
-
-CustomElementCallbackDispatcher& CustomElementCallbackDispatcher::instance()
-{
-    DEFINE_STATIC_LOCAL(CustomElementCallbackDispatcher, instance, ());
-    return instance;
-}
-
-// Dispatches callbacks at microtask checkpoint.
-bool CustomElementCallbackDispatcher::dispatch()
-{
-    ASSERT(isMainThread());
-    if (inCallbackDeliveryScope())
-        return false;
-
-    size_t start = kNumSentinels; // skip null sentinel
-    size_t end = s_elementQueueEnd;
-    ElementQueue thisQueue = currentElementQueue();
-
-    for (size_t i = start; i < end; i++) {
-        {
-            // The created callback may schedule entered document
-            // callbacks.
-            CallbackDeliveryScope deliveryScope;
-            m_flattenedProcessingStack[i]->processInElementQueue(thisQueue);
-        }
-
-        ASSERT(!s_elementQueueStart);
-        ASSERT(s_elementQueueEnd == end);
-    }
-
-    s_elementQueueEnd = kNumSentinels;
-    m_flattenedProcessingStack.resize(s_elementQueueEnd);
-
-    CustomElementCallbackScheduler::clearElementCallbackQueueMap();
-
-    bool didWork = start < end;
-    return didWork;
-}
-
-// Dispatches callbacks when popping the processing stack.
-void CustomElementCallbackDispatcher::processElementQueueAndPop()
-{
-    instance().processElementQueueAndPop(s_elementQueueStart, s_elementQueueEnd);
-}
-
-void CustomElementCallbackDispatcher::processElementQueueAndPop(size_t start, size_t end)
-{
-    ASSERT(isMainThread());
-    ElementQueue thisQueue = currentElementQueue();
-
-    for (size_t i = start; i < end; i++) {
-        {
-            // The created callback may schedule entered document
-            // callbacks.
-            CallbackDeliveryScope deliveryScope;
-            m_flattenedProcessingStack[i]->processInElementQueue(thisQueue);
-        }
-
-        ASSERT(start == s_elementQueueStart);
-        ASSERT(end == s_elementQueueEnd);
-    }
-
-    // Pop the element queue from the processing stack
-    m_flattenedProcessingStack.resize(start);
-    s_elementQueueEnd = start;
-
-    if (start == kNumSentinels)
-        CustomElementCallbackScheduler::clearElementCallbackQueueMap();
-}
-
-void CustomElementCallbackDispatcher::enqueue(CustomElementCallbackQueue* callbackQueue)
-{
-    if (callbackQueue->owner() == currentElementQueue())
-        return;
-
-    callbackQueue->setOwner(currentElementQueue());
-    m_flattenedProcessingStack.append(callbackQueue);
-    ++s_elementQueueEnd;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CustomElementCallbackDispatcher.h b/Source/core/dom/CustomElementCallbackDispatcher.h
deleted file mode 100644
index 1230179..0000000
--- a/Source/core/dom/CustomElementCallbackDispatcher.h
+++ /dev/null
@@ -1,114 +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:
- *
- * 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.
- * 3. 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 CustomElementCallbackDispatcher_h
-#define CustomElementCallbackDispatcher_h
-
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class CustomElementCallbackQueue;
-class CustomElementCallbackScheduler;
-
-class CustomElementCallbackDispatcher {
-    WTF_MAKE_NONCOPYABLE(CustomElementCallbackDispatcher);
-public:
-    static CustomElementCallbackDispatcher& instance();
-
-    // This is stack allocated in many DOM callbacks. Make it cheap.
-    class CallbackDeliveryScope {
-    public:
-        CallbackDeliveryScope()
-            : m_savedElementQueueStart(s_elementQueueStart)
-        {
-            s_elementQueueStart = s_elementQueueEnd;
-        }
-
-        ~CallbackDeliveryScope()
-        {
-            if (s_elementQueueStart != s_elementQueueEnd)
-                processElementQueueAndPop();
-            s_elementQueueStart = m_savedElementQueueStart;
-        }
-
-    private:
-        size_t m_savedElementQueueStart;
-    };
-
-    // Returns true if more work may have to be performed at the
-    // checkpoint by this or other workers (for example, this work
-    // invoked author scripts)
-    bool dispatch();
-
-protected:
-    friend class CustomElementCallbackScheduler;
-    void enqueue(CustomElementCallbackQueue*);
-
-private:
-    CustomElementCallbackDispatcher()
-    {
-        // Add a null element as a sentinel. This makes it possible to
-        // identify elements queued when there is no
-        // CallbackDeliveryScope active. Also, if the processing stack
-        // is popped when empty, this sentinel will cause a null deref
-        // crash.
-        CustomElementCallbackQueue* sentinel = 0;
-        for (size_t i = 0; i < kNumSentinels; i++)
-            m_flattenedProcessingStack.append(sentinel);
-        ASSERT(s_elementQueueEnd == m_flattenedProcessingStack.size());
-    }
-
-    // The start of the element queue on the top of the processing
-    // stack. An offset into instance().m_flattenedProcessingStack.
-    static size_t s_elementQueueStart;
-
-    // The end of the element queue on the top of the processing
-    // stack. A cache of instance().m_flattenedProcessingStack.size().
-    static size_t s_elementQueueEnd;
-
-    static bool inCallbackDeliveryScope() { return s_elementQueueStart; }
-
-    typedef int ElementQueue;
-    static ElementQueue currentElementQueue() { return ElementQueue(s_elementQueueStart); }
-
-    static void processElementQueueAndPop();
-    void processElementQueueAndPop(size_t start, size_t end);
-
-    // The processing stack, flattened. Element queues lower in the
-    // stack appear toward the head of the vector. The first element
-    // is a null sentinel value.
-    static const size_t kNumSentinels = 1;
-    Vector<CustomElementCallbackQueue*> m_flattenedProcessingStack;
-};
-
-}
-
-#endif // CustomElementCallbackDispatcher_h
diff --git a/Source/core/dom/CustomElementCallbackInvocation.cpp b/Source/core/dom/CustomElementCallbackInvocation.cpp
deleted file mode 100644
index 5729833..0000000
--- a/Source/core/dom/CustomElementCallbackInvocation.cpp
+++ /dev/null
@@ -1,135 +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:
- *
- * 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.
- * 3. 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/dom/CustomElementCallbackInvocation.h"
-
-#include "core/dom/CustomElementCallbackScheduler.h"
-#include "core/dom/Element.h"
-
-namespace WebCore {
-
-class CreatedInvocation : public CustomElementCallbackInvocation {
-public:
-    CreatedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
-        : CustomElementCallbackInvocation(callbacks)
-    {
-    }
-
-private:
-    virtual void dispatch(Element*) OVERRIDE;
-    virtual bool isCreated() const OVERRIDE { return true; }
-};
-
-void CreatedInvocation::dispatch(Element* element)
-{
-    if (element->inDocument() && element->document().defaultView())
-        CustomElementCallbackScheduler::scheduleEnteredViewCallback(callbacks(), element);
-    callbacks()->created(element);
-}
-
-class EnteredLeftViewInvocation : public CustomElementCallbackInvocation {
-public:
-    EnteredLeftViewInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, CustomElementLifecycleCallbacks::CallbackType which);
-
-private:
-    virtual void dispatch(Element*) OVERRIDE;
-
-    CustomElementLifecycleCallbacks::CallbackType m_which;
-};
-
-EnteredLeftViewInvocation::EnteredLeftViewInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::CallbackType which)
-    : CustomElementCallbackInvocation(callbacks)
-    , m_which(which)
-{
-    ASSERT(m_which == CustomElementLifecycleCallbacks::EnteredView || m_which == CustomElementLifecycleCallbacks::LeftView);
-}
-
-void EnteredLeftViewInvocation::dispatch(Element* element)
-{
-    switch (m_which) {
-    case CustomElementLifecycleCallbacks::EnteredView:
-        callbacks()->enteredView(element);
-        break;
-    case CustomElementLifecycleCallbacks::LeftView:
-        callbacks()->leftView(element);
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-}
-
-class AttributeChangedInvocation : public CustomElementCallbackInvocation {
-public:
-    AttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
-
-private:
-    virtual void dispatch(Element*) OVERRIDE;
-
-    AtomicString m_name;
-    AtomicString m_oldValue;
-    AtomicString m_newValue;
-};
-
-AttributeChangedInvocation::AttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
-    : CustomElementCallbackInvocation(callbacks)
-    , m_name(name)
-    , m_oldValue(oldValue)
-    , m_newValue(newValue)
-{
-}
-
-void AttributeChangedInvocation::dispatch(Element* element)
-{
-    callbacks()->attributeChanged(element, m_name, m_oldValue, m_newValue);
-}
-
-PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::createInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::CallbackType which)
-{
-    switch (which) {
-    case CustomElementLifecycleCallbacks::Created:
-        return adoptPtr(new CreatedInvocation(callbacks));
-
-    case CustomElementLifecycleCallbacks::EnteredView:
-    case CustomElementLifecycleCallbacks::LeftView:
-        return adoptPtr(new EnteredLeftViewInvocation(callbacks, which));
-
-    default:
-        ASSERT_NOT_REACHED();
-        return PassOwnPtr<CustomElementCallbackInvocation>();
-    }
-}
-
-PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::createAttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
-{
-    return adoptPtr(new AttributeChangedInvocation(callbacks, name, oldValue, newValue));
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CustomElementCallbackInvocation.h b/Source/core/dom/CustomElementCallbackInvocation.h
deleted file mode 100644
index d2f8135..0000000
--- a/Source/core/dom/CustomElementCallbackInvocation.h
+++ /dev/null
@@ -1,68 +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:
- *
- * 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.
- * 3. 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 CustomElementCallbackInvocation_h
-#define CustomElementCallbackInvocation_h
-
-#include "core/dom/CustomElementLifecycleCallbacks.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-class Element;
-
-class CustomElementCallbackInvocation {
-    WTF_MAKE_NONCOPYABLE(CustomElementCallbackInvocation);
-public:
-    static PassOwnPtr<CustomElementCallbackInvocation> createInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, CustomElementLifecycleCallbacks::CallbackType);
-    static PassOwnPtr<CustomElementCallbackInvocation> createAttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
-
-    virtual ~CustomElementCallbackInvocation() { }
-    virtual void dispatch(Element*) = 0;
-    virtual bool isCreated() const { return false; }
-
-protected:
-    CustomElementCallbackInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
-        : m_callbacks(callbacks)
-    {
-    }
-
-    CustomElementLifecycleCallbacks* callbacks() { return m_callbacks.get(); }
-
-private:
-    RefPtr<CustomElementLifecycleCallbacks> m_callbacks;
-};
-
-}
-
-#endif // CustomElementCallbackInvocation_h
diff --git a/Source/core/dom/CustomElementCallbackQueue.cpp b/Source/core/dom/CustomElementCallbackQueue.cpp
deleted file mode 100644
index 114b21f..0000000
--- a/Source/core/dom/CustomElementCallbackQueue.cpp
+++ /dev/null
@@ -1,71 +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:
- *
- * 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.
- * 3. 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/dom/CustomElementCallbackQueue.h"
-
-namespace WebCore {
-
-PassOwnPtr<CustomElementCallbackQueue> CustomElementCallbackQueue::create(PassRefPtr<Element> element)
-{
-    return adoptPtr(new CustomElementCallbackQueue(element));
-}
-
-CustomElementCallbackQueue::CustomElementCallbackQueue(PassRefPtr<Element> element)
-    : m_element(element)
-    , m_owner(-1)
-    , m_index(0)
-    , m_inCreatedCallback(false)
-{
-}
-
-void CustomElementCallbackQueue::processInElementQueue(ElementQueue caller)
-{
-    ASSERT(!m_inCreatedCallback);
-
-    while (m_index < m_queue.size() && owner() == caller) {
-        m_inCreatedCallback = m_queue[m_index]->isCreated();
-
-        // dispatch() may cause recursion which steals this callback
-        // queue and reenters processInQueue. owner() == caller
-        // detects this recursion and cedes processing.
-        m_queue[m_index++]->dispatch(m_element.get());
-        m_inCreatedCallback = false;
-    }
-
-    if (owner() == caller && m_index == m_queue.size()) {
-        // This processInQueue exhausted the queue; shrink it.
-        m_index = 0;
-        m_queue.resize(0);
-        m_owner = -1;
-    }
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CustomElementCallbackQueue.h b/Source/core/dom/CustomElementCallbackQueue.h
deleted file mode 100644
index 9afdeed..0000000
--- a/Source/core/dom/CustomElementCallbackQueue.h
+++ /dev/null
@@ -1,74 +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:
- *
- * 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.
- * 3. 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 CustomElementCallbackQueue_h
-#define CustomElementCallbackQueue_h
-
-#include "core/dom/CustomElementCallbackInvocation.h"
-#include "core/dom/Element.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class CustomElementCallbackQueue {
-    WTF_MAKE_NONCOPYABLE(CustomElementCallbackQueue);
-public:
-    static PassOwnPtr<CustomElementCallbackQueue> create(PassRefPtr<Element>);
-
-    typedef int ElementQueue;
-    ElementQueue owner() { return m_owner; }
-    void setOwner(ElementQueue newOwner)
-    {
-        // ElementCallbackQueues only migrate towards the top of the
-        // processing stack.
-        ASSERT(newOwner >= m_owner);
-        m_owner = newOwner;
-    }
-
-    void append(PassOwnPtr<CustomElementCallbackInvocation> invocation) { m_queue.append(invocation); }
-    void processInElementQueue(ElementQueue);
-    bool inCreatedCallback() const { return m_inCreatedCallback; }
-
-private:
-    CustomElementCallbackQueue(PassRefPtr<Element>);
-
-    RefPtr<Element> m_element;
-    Vector<OwnPtr<CustomElementCallbackInvocation> > m_queue;
-    ElementQueue m_owner;
-    size_t m_index;
-    bool m_inCreatedCallback;
-};
-
-}
-
-#endif // CustomElementCallbackQueue_h
diff --git a/Source/core/dom/CustomElementCallbackScheduler.cpp b/Source/core/dom/CustomElementCallbackScheduler.cpp
deleted file mode 100644
index d6086cd..0000000
--- a/Source/core/dom/CustomElementCallbackScheduler.cpp
+++ /dev/null
@@ -1,122 +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:
- *
- * 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.
- * 3. 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/dom/CustomElementCallbackScheduler.h"
-
-#include "core/dom/CustomElementCallbackDispatcher.h"
-#include "core/dom/CustomElementCallbackQueue.h"
-#include "core/dom/CustomElementLifecycleCallbacks.h"
-#include "core/dom/Element.h"
-
-namespace WebCore {
-
-void CustomElementCallbackScheduler::scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
-{
-    if (!callbacks->hasAttributeChangedCallback())
-        return;
-
-    CustomElementCallbackQueue* queue = instance().schedule(element);
-    queue->append(CustomElementCallbackInvocation::createAttributeChangedInvocation(callbacks, name, oldValue, newValue));
-}
-
-void CustomElementCallbackScheduler::scheduleCreatedCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
-{
-    if (!callbacks->hasCreatedCallback())
-        return;
-
-    CustomElementCallbackQueue* queue = instance().scheduleInCurrentElementQueue(element);
-    queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::Created));
-}
-
-void CustomElementCallbackScheduler::scheduleEnteredViewCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
-{
-    if (!callbacks->hasEnteredViewCallback())
-        return;
-
-    CustomElementCallbackQueue* queue = instance().schedule(element);
-    queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::EnteredView));
-}
-
-void CustomElementCallbackScheduler::scheduleLeftViewCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
-{
-    if (!callbacks->hasLeftViewCallback())
-        return;
-
-    CustomElementCallbackQueue* queue = instance().schedule(element);
-    queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::LeftView));
-}
-
-CustomElementCallbackScheduler& CustomElementCallbackScheduler::instance()
-{
-    DEFINE_STATIC_LOCAL(CustomElementCallbackScheduler, instance, ());
-    return instance;
-}
-
-CustomElementCallbackQueue* CustomElementCallbackScheduler::ensureCallbackQueue(PassRefPtr<Element> element)
-{
-    Element* key = element.get();
-    ElementCallbackQueueMap::iterator it = m_elementCallbackQueueMap.find(key);
-    if (it == m_elementCallbackQueueMap.end())
-        it = m_elementCallbackQueueMap.add(key, CustomElementCallbackQueue::create(element)).iterator;
-    return it->value.get();
-}
-
-void CustomElementCallbackScheduler::clearElementCallbackQueueMap()
-{
-    ElementCallbackQueueMap emptyMap;
-    instance().m_elementCallbackQueueMap.swap(emptyMap);
-}
-
-// Finds or creates the callback queue for element. If the
-// createdCallback has not finished running, the callback queue is not
-// moved to the top-of-stack. Otherwise like
-// scheduleInCurrentElementQueue.
-CustomElementCallbackQueue* CustomElementCallbackScheduler::schedule(PassRefPtr<Element> element)
-{
-    CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element);
-    if (!callbackQueue->inCreatedCallback())
-        CustomElementCallbackDispatcher::instance().enqueue(callbackQueue);
-    return callbackQueue;
-}
-
-// Finds or creates the callback queue for element. If the element's
-// callback queue is scheduled in an earlier processing stack frame,
-// its owner is set to the element queue on the top of the processing
-// stack. Because callback queues are processed exhaustively, this
-// effectively moves the callback queue to the top of the stack.
-CustomElementCallbackQueue* CustomElementCallbackScheduler::scheduleInCurrentElementQueue(PassRefPtr<Element> element)
-{
-    CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element);
-    CustomElementCallbackDispatcher::instance().enqueue(callbackQueue);
-    return callbackQueue;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CustomElementCallbackScheduler.h b/Source/core/dom/CustomElementCallbackScheduler.h
deleted file mode 100644
index b0e757f..0000000
--- a/Source/core/dom/CustomElementCallbackScheduler.h
+++ /dev/null
@@ -1,71 +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:
- *
- * 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.
- * 3. 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 CustomElementCallbackScheduler_h
-#define CustomElementCallbackScheduler_h
-
-#include "core/dom/CustomElementCallbackQueue.h"
-#include "wtf/HashMap.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-class CustomElementLifecycleCallbacks;
-class Element;
-
-class CustomElementCallbackScheduler {
-public:
-    static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
-    static void scheduleCreatedCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
-    static void scheduleEnteredViewCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
-    static void scheduleLeftViewCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
-
-protected:
-    friend class CustomElementCallbackDispatcher;
-    static void clearElementCallbackQueueMap();
-
-private:
-    CustomElementCallbackScheduler() { }
-
-    static CustomElementCallbackScheduler& instance();
-
-    CustomElementCallbackQueue* ensureCallbackQueue(PassRefPtr<Element>);
-    CustomElementCallbackQueue* schedule(PassRefPtr<Element>);
-    CustomElementCallbackQueue* scheduleInCurrentElementQueue(PassRefPtr<Element>);
-
-    typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallbackQueueMap;
-    ElementCallbackQueueMap m_elementCallbackQueueMap;
-};
-
-}
-
-#endif // CustomElementCallbackScheduler_h
diff --git a/Source/core/dom/CustomElementDefinition.cpp b/Source/core/dom/CustomElementDefinition.cpp
deleted file mode 100644
index 5f29910..0000000
--- a/Source/core/dom/CustomElementDefinition.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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:
- *
- *     * 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/dom/CustomElementDefinition.h"
-
-namespace WebCore {
-
-PassRefPtr<CustomElementDefinition> CustomElementDefinition::create(const CustomElementDescriptor& descriptor, PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
-{
-    return adoptRef(new CustomElementDefinition(descriptor, callbacks));
-}
-
-CustomElementDefinition::CustomElementDefinition(const CustomElementDescriptor& descriptor, PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
-    : m_descriptor(descriptor)
-    , m_callbacks(callbacks)
-{
-}
-
-}
diff --git a/Source/core/dom/CustomElementDefinition.h b/Source/core/dom/CustomElementDefinition.h
deleted file mode 100644
index 96aa3dc..0000000
--- a/Source/core/dom/CustomElementDefinition.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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:
- *
- *     * 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 CustomElementDefinition_h
-#define CustomElementDefinition_h
-
-#include "core/dom/CustomElementDescriptor.h"
-#include "core/dom/CustomElementLifecycleCallbacks.h"
-#include "wtf/Forward.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class CustomElementDefinition : public RefCounted<CustomElementDefinition> {
-public:
-    static PassRefPtr<CustomElementDefinition> create(const CustomElementDescriptor&, PassRefPtr<CustomElementLifecycleCallbacks>);
-
-    virtual ~CustomElementDefinition() {}
-
-    const CustomElementDescriptor& descriptor() const { return m_descriptor; }
-    CustomElementLifecycleCallbacks* callbacks() const { return m_callbacks.get(); }
-
-private:
-    CustomElementDefinition(const CustomElementDescriptor&, PassRefPtr<CustomElementLifecycleCallbacks>);
-
-    CustomElementDescriptor m_descriptor;
-    RefPtr<CustomElementLifecycleCallbacks> m_callbacks;
-};
-
-}
-
-#endif // CustomElementDefinition_h
diff --git a/Source/core/dom/CustomElementDescriptorHash.h b/Source/core/dom/CustomElementDescriptorHash.h
deleted file mode 100644
index 81c51de..0000000
--- a/Source/core/dom/CustomElementDescriptorHash.h
+++ /dev/null
@@ -1,66 +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 CustomElementDescriptorHash_h
-#define CustomElementDescriptorHash_h
-
-#include "core/dom/CustomElementDescriptor.h"
-#include "wtf/HashFunctions.h"
-#include "wtf/HashTraits.h"
-#include "wtf/text/AtomicStringHash.h"
-
-namespace WebCore {
-
-struct CustomElementDescriptorHash {
-    static unsigned hash(const CustomElementDescriptor& descriptor)
-    {
-        return WTF::pairIntHash(AtomicStringHash::hash(descriptor.type()), WTF::pairIntHash(AtomicStringHash::hash(descriptor.namespaceURI()), AtomicStringHash::hash(descriptor.localName())));
-    }
-
-    static bool equal(const CustomElementDescriptor& a, const CustomElementDescriptor& b)
-    {
-        return a == b;
-    }
-
-    static const bool safeToCompareToEmptyOrDeleted = true;
-};
-
-} // namespace WebCore
-
-namespace WTF {
-
-template<>
-struct HashTraits<WebCore::CustomElementDescriptor> : SimpleClassHashTraits<WebCore::CustomElementDescriptor> {
-    static const bool emptyValueIsZero = HashTraits<AtomicString>::emptyValueIsZero;
-};
-
-} // namespace WTF
-
-#endif // CustomElementDescriptorHash
diff --git a/Source/core/dom/CustomElementException.cpp b/Source/core/dom/CustomElementException.cpp
deleted file mode 100644
index 3f2ccaa..0000000
--- a/Source/core/dom/CustomElementException.cpp
+++ /dev/null
@@ -1,95 +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:
- *
- * 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.
- * 3. 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/dom/CustomElementException.h"
-
-#include "bindings/v8/ExceptionState.h"
-#include "core/dom/ExceptionCode.h"
-
-namespace WebCore {
-
-String CustomElementException::preamble(const AtomicString& type)
-{
-    return "Failed to call 'register' on 'Document' for type '" + type + "': ";
-}
-
-void CustomElementException::throwException(Reason reason, const AtomicString& type, ExceptionState& es)
-{
-    switch (reason) {
-    case CannotRegisterFromExtension:
-        es.throwDOMException(NotSupportedError, preamble(type) + "elements cannot be registered from extensions.");
-        return;
-
-    case ConstructorPropertyNotConfigurable:
-        es.throwDOMException(NotSupportedError, preamble(type) + "prototype constructor property is not configurable.");
-        return;
-
-    case ContextDestroyedCheckingPrototype:
-        es.throwDOMException(InvalidStateError, preamble(type) + "the context is no longer valid.");
-        return;
-
-    case ContextDestroyedCreatingCallbacks:
-        es.throwUninformativeAndGenericDOMException(InvalidStateError);
-        return;
-
-    case ContextDestroyedRegisteringDefinition:
-        es.throwUninformativeAndGenericDOMException(NotSupportedError);
-        return;
-
-    case ExtendsIsInvalidName:
-        es.throwDOMException(InvalidCharacterError, preamble(type) + ": the tag name specified in 'extends' is not a valid tag name.");
-        return;
-
-    case ExtendsIsCustomElementName:
-        es.throwDOMException(InvalidCharacterError, preamble(type) + ": the tag name specified in 'extends' is a custom element name. Use inheritance instead.");
-        return;
-
-    case InvalidName:
-        es.throwDOMException(InvalidCharacterError, preamble(type) + ": '" + type + "' is not a valid name.");
-        return;
-
-    case PrototypeInUse:
-        es.throwDOMException(NotSupportedError, preamble(type) + "prototype is already in-use as an interface prototype object.");
-        return;
-
-    case PrototypeNotAnObject:
-        es.throwDOMException(InvalidStateError, preamble(type) + "the prototype option is not an object.");
-        return;
-
-    case TypeAlreadyRegistered:
-        es.throwDOMException(InvalidStateError, preamble(type) + "a type with that name is already registered.");
-        return;
-    }
-
-    ASSERT_NOT_REACHED();
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CustomElementObserver.cpp b/Source/core/dom/CustomElementObserver.cpp
deleted file mode 100644
index 45f1350..0000000
--- a/Source/core/dom/CustomElementObserver.cpp
+++ /dev/null
@@ -1,70 +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:
- *
- * 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.
- * 3. 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/dom/CustomElementObserver.h"
-
-namespace WebCore {
-
-CustomElementObserver::ElementObserverMap& CustomElementObserver::elementObservers()
-{
-    DEFINE_STATIC_LOCAL(ElementObserverMap, map, ());
-    return map;
-}
-
-void CustomElementObserver::notifyElementDidFinishParsingChildren(Element* element)
-{
-    ElementObserverMap::iterator it = elementObservers().find(element);
-    if (it == elementObservers().end())
-        return;
-    it->value->elementDidFinishParsingChildren(element);
-}
-
-void CustomElementObserver::notifyElementWasDestroyed(Element* element)
-{
-    ElementObserverMap::iterator it = elementObservers().find(element);
-    if (it == elementObservers().end())
-        return;
-    it->value->elementWasDestroyed(element);
-}
-
-void CustomElementObserver::observe(Element* element)
-{
-    ElementObserverMap::AddResult result = elementObservers().add(element, this);
-    ASSERT(result.isNewEntry);
-}
-
-void CustomElementObserver::unobserve(Element* element)
-{
-    CustomElementObserver* observer = elementObservers().take(element);
-    ASSERT(observer == this);
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CustomElementRegistrationContext.cpp b/Source/core/dom/CustomElementRegistrationContext.cpp
deleted file mode 100644
index 6c4133f..0000000
--- a/Source/core/dom/CustomElementRegistrationContext.cpp
+++ /dev/null
@@ -1,150 +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:
- *
- * 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.
- * 3. 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/dom/CustomElementRegistrationContext.h"
-
-#include "HTMLNames.h"
-#include "SVGNames.h"
-#include "bindings/v8/ExceptionState.h"
-#include "core/dom/CustomElement.h"
-#include "core/dom/CustomElementCallbackScheduler.h"
-#include "core/dom/CustomElementDefinition.h"
-#include "core/dom/Element.h"
-#include "core/html/HTMLElement.h"
-#include "core/html/HTMLUnknownElement.h"
-#include "core/svg/SVGUnknownElement.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-void CustomElementRegistrationContext::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& type, CustomElement::NameSet validNames, ExceptionState& es)
-{
-    CustomElementDefinition* definition = m_registry.registerElement(document, constructorBuilder, type, validNames, es);
-
-    if (!definition)
-        return;
-
-    // Upgrade elements that were waiting for this definition.
-    const CustomElementUpgradeCandidateMap::ElementSet& upgradeCandidates = m_candidates.takeUpgradeCandidatesFor(definition->descriptor());
-    for (CustomElementUpgradeCandidateMap::ElementSet::const_iterator it = upgradeCandidates.begin(); it != upgradeCandidates.end(); ++it)
-        didResolveElement(definition, *it);
-}
-
-PassRefPtr<Element> CustomElementRegistrationContext::createCustomTagElement(Document& document, const QualifiedName& tagName, CreationMode mode)
-{
-    ASSERT(CustomElement::isValidName(tagName.localName()));
-
-    RefPtr<Element> element;
-
-    if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI()) {
-        element = HTMLElement::create(tagName, document);
-    } else if (SVGNames::svgNamespaceURI == tagName.namespaceURI()) {
-        element = SVGUnknownElement::create(tagName, document);
-    } else {
-        // XML elements are not custom elements, so return early.
-        return Element::create(tagName, &document);
-    }
-
-    element->setCustomElementState(mode == CreatedByParser ? Element::WaitingForParser : Element::WaitingForUpgrade);
-    resolve(element.get(), nullAtom);
-    return element.release();
-}
-
-void CustomElementRegistrationContext::didGiveTypeExtension(Element* element, const AtomicString& type)
-{
-    resolve(element, type);
-}
-
-void CustomElementRegistrationContext::resolve(Element* element, const AtomicString& typeExtension)
-{
-    // If an element has a custom tag name it takes precedence over
-    // the "is" attribute (if any).
-    const AtomicString& type = CustomElement::isValidName(element->localName())
-        ? element->localName()
-        : typeExtension;
-    ASSERT(!type.isNull());
-
-    CustomElementDescriptor descriptor(type, element->namespaceURI(), element->localName());
-    CustomElementDefinition* definition = m_registry.find(descriptor);
-    if (definition)
-        didResolveElement(definition, element);
-    else
-        didCreateUnresolvedElement(descriptor, element);
-}
-
-void CustomElementRegistrationContext::didResolveElement(CustomElementDefinition* definition, Element* element)
-{
-    CustomElement::define(element, definition);
-}
-
-void CustomElementRegistrationContext::didCreateUnresolvedElement(const CustomElementDescriptor& descriptor, Element* element)
-{
-    ASSERT(element->customElementState() == Element::WaitingForParser || element->customElementState() == Element::WaitingForUpgrade);
-    m_candidates.add(descriptor, element);
-}
-
-PassRefPtr<CustomElementRegistrationContext> CustomElementRegistrationContext::create()
-{
-    return adoptRef(new CustomElementRegistrationContext());
-}
-
-void CustomElementRegistrationContext::setIsAttributeAndTypeExtension(Element* element, const AtomicString& type)
-{
-    ASSERT(element);
-    ASSERT(!type.isEmpty());
-    element->setAttribute(HTMLNames::isAttr, type);
-    setTypeExtension(element, type);
-}
-
-void CustomElementRegistrationContext::setTypeExtension(Element* element, const AtomicString& type, CreationMode mode)
-{
-    if (!element->isHTMLElement() && !element->isSVGElement())
-        return;
-
-    if (element->isCustomElement()) {
-        // This can happen if:
-        // 1. The element has a custom tag, which takes precedence over
-        //    type extensions.
-        // 2. Undoing a command (eg ReplaceNodeWithSpan) recycles an
-        //    element but tries to overwrite its attribute list.
-        return;
-    }
-
-    // Custom tags take precedence over type extensions
-    ASSERT(!CustomElement::isValidName(element->localName()));
-
-    element->setCustomElementState(mode == CreatedByParser ? Element::WaitingForParser : Element::WaitingForUpgrade);
-
-    if (CustomElementRegistrationContext* context = element->document().registrationContext())
-        context->didGiveTypeExtension(element, type);
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CustomElementRegistrationContext.h b/Source/core/dom/CustomElementRegistrationContext.h
deleted file mode 100644
index 7d23d72..0000000
--- a/Source/core/dom/CustomElementRegistrationContext.h
+++ /dev/null
@@ -1,89 +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:
- *
- * 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.
- * 3. 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 CustomElementRegistrationContext_h
-#define CustomElementRegistrationContext_h
-
-#include "core/dom/CustomElementDescriptor.h"
-#include "core/dom/CustomElementRegistry.h"
-#include "core/dom/CustomElementUpgradeCandidateMap.h"
-#include "core/dom/QualifiedName.h"
-#include "wtf/HashMap.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-class CustomElementConstructorBuilder;
-class CustomElementDefinition;
-class Document;
-class Element;
-class ExceptionState;
-
-class CustomElementRegistrationContext : public RefCounted<CustomElementRegistrationContext> {
-public:
-    static PassRefPtr<CustomElementRegistrationContext> create();
-
-    ~CustomElementRegistrationContext() { }
-
-    // Definitions
-    void registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& type, CustomElement::NameSet validNames, ExceptionState&);
-
-    // Instance creation
-    enum CreationMode {
-        CreatedByParser,
-        NotCreatedByParser
-    };
-
-    PassRefPtr<Element> createCustomTagElement(Document&, const QualifiedName&, CreationMode = NotCreatedByParser);
-    static void setIsAttributeAndTypeExtension(Element*, const AtomicString& type);
-    static void setTypeExtension(Element*, const AtomicString& type, CreationMode = NotCreatedByParser);
-
-protected:
-    CustomElementRegistrationContext() { }
-
-    // Instance creation
-    void didGiveTypeExtension(Element*, const AtomicString& type);
-
-private:
-    void resolve(Element*, const AtomicString& typeExtension);
-    void didResolveElement(CustomElementDefinition*, Element*);
-    void didCreateUnresolvedElement(const CustomElementDescriptor&, Element*);
-
-    CustomElementRegistry m_registry;
-
-    // Element creation
-    CustomElementUpgradeCandidateMap m_candidates;
-};
-
-}
-
-#endif // CustomElementRegistrationContext_h
-
diff --git a/Source/core/dom/CustomElementRegistry.cpp b/Source/core/dom/CustomElementRegistry.cpp
deleted file mode 100644
index 00d6d71..0000000
--- a/Source/core/dom/CustomElementRegistry.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.
- * 3. 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/dom/CustomElementRegistry.h"
-
-#include "HTMLNames.h"
-#include "SVGNames.h"
-#include "bindings/v8/CustomElementConstructorBuilder.h"
-#include "core/dom/CustomElement.h"
-#include "core/dom/CustomElementDefinition.h"
-#include "core/dom/CustomElementException.h"
-#include "core/dom/CustomElementRegistrationContext.h"
-#include "core/dom/DocumentLifecycleObserver.h"
-
-namespace WebCore {
-
-class RegistrationContextObserver : public DocumentLifecycleObserver {
-public:
-    explicit RegistrationContextObserver(Document* document)
-        : DocumentLifecycleObserver(document)
-        , m_wentAway(!document)
-    {
-    }
-
-    bool registrationContextWentAway() { return m_wentAway; }
-
-private:
-    virtual void documentWasDisposed() OVERRIDE { m_wentAway = true; }
-
-    bool m_wentAway;
-};
-
-CustomElementDefinition* CustomElementRegistry::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& userSuppliedName, CustomElement::NameSet validNames, ExceptionState& es)
-{
-    // FIXME: In every instance except one it is the
-    // CustomElementConstructorBuilder that observes document
-    // destruction during registration. This responsibility should be
-    // consolidated in one place.
-    RegistrationContextObserver observer(document);
-
-    AtomicString type = userSuppliedName.lower();
-
-    if (!constructorBuilder->isFeatureAllowed()) {
-        CustomElementException::throwException(CustomElementException::CannotRegisterFromExtension, type, es);
-        return 0;
-    }
-
-    if (!CustomElement::isValidName(type, validNames)) {
-        CustomElementException::throwException(CustomElementException::InvalidName, type, es);
-        return 0;
-    }
-
-    QualifiedName tagName = nullQName();
-    if (!constructorBuilder->validateOptions(type, tagName, es))
-        return 0;
-
-    ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.namespaceURI() == SVGNames::svgNamespaceURI);
-
-    // FIXME: This should be done earlier in validateOptions.
-    if (m_registeredTypeNames.contains(type)) {
-        CustomElementException::throwException(CustomElementException::TypeAlreadyRegistered, type, es);
-        return 0;
-    }
-
-    ASSERT(!observer.registrationContextWentAway());
-
-    RefPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = constructorBuilder->createCallbacks();
-
-    // Consulting the constructor builder could execute script and
-    // kill the document.
-    if (observer.registrationContextWentAway()) {
-        CustomElementException::throwException(CustomElementException::ContextDestroyedCreatingCallbacks, type, es);
-        return 0;
-    }
-
-    const CustomElementDescriptor descriptor(type, tagName.namespaceURI(), tagName.localName());
-    RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create(descriptor, lifecycleCallbacks);
-
-    if (!constructorBuilder->createConstructor(document, definition.get(), es))
-        return 0;
-
-    m_definitions.add(descriptor, definition);
-    m_registeredTypeNames.add(descriptor.type());
-
-    if (!constructorBuilder->didRegisterDefinition(definition.get())) {
-        CustomElementException::throwException(CustomElementException::ContextDestroyedRegisteringDefinition, type, es);
-        return 0;
-    }
-
-    return definition.get();
-}
-
-CustomElementDefinition* CustomElementRegistry::find(const CustomElementDescriptor& descriptor) const
-{
-    return m_definitions.get(descriptor);
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/CustomElementRegistry.h b/Source/core/dom/CustomElementRegistry.h
deleted file mode 100644
index d1a79bd..0000000
--- a/Source/core/dom/CustomElementRegistry.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- * 3. 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 CustomElementRegistry_h
-#define CustomElementRegistry_h
-
-#include "core/dom/CustomElement.h"
-#include "core/dom/CustomElementDefinition.h"
-#include "core/dom/CustomElementDescriptor.h"
-#include "core/dom/CustomElementDescriptorHash.h"
-#include "wtf/HashMap.h"
-#include "wtf/HashSet.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/AtomicStringHash.h"
-
-namespace WebCore {
-
-class CustomElementConstructorBuilder;
-class Document;
-class ExceptionState;
-
-class CustomElementRegistry {
-    WTF_MAKE_NONCOPYABLE(CustomElementRegistry);
-protected:
-    friend class CustomElementRegistrationContext;
-
-    CustomElementRegistry() { }
-    virtual ~CustomElementRegistry() { }
-
-    CustomElementDefinition* registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& name, CustomElement::NameSet validNames, ExceptionState&);
-    CustomElementDefinition* find(const CustomElementDescriptor&) const;
-
-private:
-    typedef HashMap<CustomElementDescriptor, RefPtr<CustomElementDefinition> > DefinitionMap;
-    DefinitionMap m_definitions;
-    HashSet<AtomicString> m_registeredTypeNames;
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/dom/CustomElementUpgradeCandidateMap.cpp b/Source/core/dom/CustomElementUpgradeCandidateMap.cpp
deleted file mode 100644
index 8583eb2..0000000
--- a/Source/core/dom/CustomElementUpgradeCandidateMap.cpp
+++ /dev/null
@@ -1,110 +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.
- */
-
-#include "config.h"
-#include "core/dom/CustomElementUpgradeCandidateMap.h"
-
-#include "core/dom/Element.h"
-
-namespace WebCore {
-
-CustomElementUpgradeCandidateMap::~CustomElementUpgradeCandidateMap()
-{
-    UpgradeCandidateMap::const_iterator::Keys end = m_upgradeCandidates.end().keys();
-    for (UpgradeCandidateMap::const_iterator::Keys it = m_upgradeCandidates.begin().keys(); it != end; ++it)
-        unobserve(*it);
-}
-
-void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descriptor, Element* element)
-{
-    observe(element);
-
-    UpgradeCandidateMap::AddResult result = m_upgradeCandidates.add(element, descriptor);
-    ASSERT(result.isNewEntry);
-
-    UnresolvedDefinitionMap::iterator it = m_unresolvedDefinitions.find(descriptor);
-    if (it == m_unresolvedDefinitions.end())
-        it = m_unresolvedDefinitions.add(descriptor, ElementSet()).iterator;
-    it->value.add(element);
-}
-
-void CustomElementUpgradeCandidateMap::remove(Element* element)
-{
-    unobserve(element);
-    removeCommon(element);
-}
-
-void CustomElementUpgradeCandidateMap::elementWasDestroyed(Element* element)
-{
-    CustomElementObserver::elementWasDestroyed(element);
-    removeCommon(element);
-}
-
-void CustomElementUpgradeCandidateMap::removeCommon(Element* element)
-{
-    UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element);
-    ASSERT(candidate != m_upgradeCandidates.end());
-
-    UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(candidate->value);
-    ASSERT(elements != m_unresolvedDefinitions.end());
-    elements->value.remove(element);
-    m_upgradeCandidates.remove(candidate);
-}
-
-void CustomElementUpgradeCandidateMap::elementDidFinishParsingChildren(Element* element)
-{
-    // An upgrade candidate finished parsing; reorder so that eventual
-    // upgrade order matches finished-parsing order.
-    moveToEnd(element);
-}
-
-void CustomElementUpgradeCandidateMap::moveToEnd(Element* element)
-{
-    UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element);
-    ASSERT(candidate != m_upgradeCandidates.end());
-
-    UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(candidate->value);
-    ASSERT(elements != m_unresolvedDefinitions.end());
-    elements->value.appendOrMoveToLast(element);
-}
-
-ListHashSet<Element*> CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor(const CustomElementDescriptor& descriptor)
-{
-    const ListHashSet<Element*>& candidates = m_unresolvedDefinitions.take(descriptor);
-
-    for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate) {
-        unobserve(*candidate);
-        m_upgradeCandidates.remove(*candidate);
-    }
-
-    return candidates;
-}
-
-}
diff --git a/Source/core/dom/CustomElementUpgradeCandidateMap.h b/Source/core/dom/CustomElementUpgradeCandidateMap.h
deleted file mode 100644
index f9f2311..0000000
--- a/Source/core/dom/CustomElementUpgradeCandidateMap.h
+++ /dev/null
@@ -1,75 +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 CustomElementUpgradeCandidateMap_h
-#define CustomElementUpgradeCandidateMap_h
-
-#include "core/dom/CustomElementDescriptor.h"
-#include "core/dom/CustomElementDescriptorHash.h"
-#include "core/dom/CustomElementObserver.h"
-#include "wtf/HashMap.h"
-#include "wtf/ListHashSet.h"
-#include "wtf/Noncopyable.h"
-
-namespace WebCore {
-
-class Element;
-
-class CustomElementUpgradeCandidateMap : CustomElementObserver {
-    WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap);
-public:
-    CustomElementUpgradeCandidateMap() { }
-    ~CustomElementUpgradeCandidateMap();
-
-    // API for CustomElementRegistrationContext to save and take candidates
-
-    typedef ListHashSet<Element*> ElementSet;
-
-    void add(const CustomElementDescriptor&, Element*);
-    void remove(Element*);
-    ElementSet takeUpgradeCandidatesFor(const CustomElementDescriptor&);
-
-private:
-    virtual void elementWasDestroyed(Element*) OVERRIDE;
-    void removeCommon(Element*);
-
-    virtual void elementDidFinishParsingChildren(Element*) OVERRIDE;
-    void moveToEnd(Element*);
-
-    typedef HashMap<Element*, CustomElementDescriptor> UpgradeCandidateMap;
-    UpgradeCandidateMap m_upgradeCandidates;
-
-    typedef HashMap<CustomElementDescriptor, ElementSet> UnresolvedDefinitionMap;
-    UnresolvedDefinitionMap m_unresolvedDefinitions;
-};
-
-}
-
-#endif // CustomElementUpgradeCandidateMap_h
diff --git a/Source/core/dom/DOMImplementation.cpp b/Source/core/dom/DOMImplementation.cpp
index 3215a6a..057877c 100644
--- a/Source/core/dom/DOMImplementation.cpp
+++ b/Source/core/dom/DOMImplementation.cpp
@@ -32,11 +32,11 @@
 #include "core/css/MediaList.h"
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/ContextFeatures.h"
-#include "core/dom/CustomElementRegistrationContext.h"
 #include "core/dom/DocumentInit.h"
 #include "core/dom/DocumentType.h"
 #include "core/dom/Element.h"
 #include "core/dom/ExceptionCode.h"
+#include "core/dom/custom/CustomElementRegistrationContext.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/HTMLViewSourceDocument.h"
@@ -45,14 +45,14 @@
 #include "core/html/PluginDocument.h"
 #include "core/html/TextDocument.h"
 #include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
-#include "core/platform/ContentType.h"
 #include "core/platform/MIMETypeRegistry.h"
 #include "core/platform/graphics/Image.h"
 #include "core/platform/graphics/MediaPlayer.h"
 #include "core/plugins/PluginData.h"
 #include "core/svg/SVGDocument.h"
+#include "platform/ContentType.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/StdLibExtras.h"
 
diff --git a/Source/core/dom/DOMNamedFlowCollection.cpp b/Source/core/dom/DOMNamedFlowCollection.cpp
index 47107a1..0be5818 100644
--- a/Source/core/dom/DOMNamedFlowCollection.cpp
+++ b/Source/core/dom/DOMNamedFlowCollection.cpp
@@ -32,6 +32,7 @@
 #include "RuntimeEnabledFeatures.h"
 #include "core/dom/NamedFlow.h"
 #include "core/dom/NamedFlowCollection.h"
+#include "wtf/text/StringHash.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DOMTokenList.cpp b/Source/core/dom/DOMTokenList.cpp
index 71a123a..68bf91c 100644
--- a/Source/core/dom/DOMTokenList.cpp
+++ b/Source/core/dom/DOMTokenList.cpp
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "core/dom/DOMTokenList.h"
 
+#include "bindings/v8/ExceptionMessages.h"
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/html/parser/HTMLParserIdioms.h"
@@ -32,17 +33,17 @@
 
 namespace WebCore {
 
-bool DOMTokenList::validateToken(const AtomicString& token, ExceptionState& es)
+bool DOMTokenList::validateToken(const AtomicString& token, const char* method, ExceptionState& es)
 {
     if (token.isEmpty()) {
-        es.throwUninformativeAndGenericDOMException(SyntaxError);
+        es.throwDOMException(SyntaxError, ExceptionMessages::failedToExecute(method, "DOMTokenList", "The token provided must not be empty."));
         return false;
     }
 
     unsigned length = token.length();
     for (unsigned i = 0; i < length; ++i) {
         if (isHTMLSpace<UChar>(token[i])) {
-            es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
+            es.throwDOMException(InvalidCharacterError, ExceptionMessages::failedToExecute(method, "DOMTokenList", "The token provided ('" + token + "') contains HTML space characters, which are not valid in tokens."));
             return false;
         }
     }
@@ -50,10 +51,10 @@
     return true;
 }
 
-bool DOMTokenList::validateTokens(const Vector<String>& tokens, ExceptionState& es)
+bool DOMTokenList::validateTokens(const Vector<String>& tokens, const char* method, ExceptionState& es)
 {
     for (size_t i = 0; i < tokens.size(); ++i) {
-        if (!validateToken(tokens[i], es))
+        if (!validateToken(tokens[i], method, es))
             return false;
     }
 
@@ -62,7 +63,7 @@
 
 bool DOMTokenList::contains(const AtomicString& token, ExceptionState& es) const
 {
-    if (!validateToken(token, es))
+    if (!validateToken(token, "contains", es))
         return false;
     return containsInternal(token);
 }
@@ -77,11 +78,15 @@
 void DOMTokenList::add(const Vector<String>& tokens, ExceptionState& es)
 {
     Vector<String> filteredTokens;
+    filteredTokens.reserveCapacity(tokens.size());
     for (size_t i = 0; i < tokens.size(); ++i) {
-        if (!validateToken(tokens[i], es))
+        if (!validateToken(tokens[i], "add", es))
             return;
-        if (!containsInternal(tokens[i]))
-            filteredTokens.append(tokens[i]);
+        if (containsInternal(tokens[i]))
+            continue;
+        if (filteredTokens.contains(tokens[i]))
+            continue;
+        filteredTokens.append(tokens[i]);
     }
 
     if (filteredTokens.isEmpty())
@@ -99,7 +104,7 @@
 
 void DOMTokenList::remove(const Vector<String>& tokens, ExceptionState& es)
 {
-    if (!validateTokens(tokens, es))
+    if (!validateTokens(tokens, "remove", es))
         return;
 
     // Check using containsInternal first since it is a lot faster than going
@@ -118,7 +123,7 @@
 
 bool DOMTokenList::toggle(const AtomicString& token, ExceptionState& es)
 {
-    if (!validateToken(token, es))
+    if (!validateToken(token, "toggle", es))
         return false;
 
     if (containsInternal(token)) {
@@ -131,7 +136,7 @@
 
 bool DOMTokenList::toggle(const AtomicString& token, bool force, ExceptionState& es)
 {
-    if (!validateToken(token, es))
+    if (!validateToken(token, "toggle", es))
         return false;
 
     if (force)
diff --git a/Source/core/dom/DOMTokenList.h b/Source/core/dom/DOMTokenList.h
index d758214..1b1957e 100644
--- a/Source/core/dom/DOMTokenList.h
+++ b/Source/core/dom/DOMTokenList.h
@@ -69,8 +69,8 @@
     virtual bool containsInternal(const AtomicString&) const = 0;
     virtual void removeInternal(const AtomicString&);
 
-    static bool validateToken(const AtomicString&, ExceptionState&);
-    static bool validateTokens(const Vector<String>&, ExceptionState&);
+    static bool validateToken(const AtomicString&, const char* method, ExceptionState&);
+    static bool validateTokens(const Vector<String>&, const char* method, ExceptionState&);
     static String addToken(const AtomicString&, const AtomicString&);
     static String addTokens(const AtomicString&, const Vector<String>&);
     static String removeToken(const AtomicString&, const AtomicString&);
diff --git a/Source/core/dom/DOMTokenList.idl b/Source/core/dom/DOMTokenList.idl
index 3f16677..9aef382 100644
--- a/Source/core/dom/DOMTokenList.idl
+++ b/Source/core/dom/DOMTokenList.idl
@@ -28,9 +28,9 @@
     readonly attribute unsigned long length;
     [TreatReturnedNullStringAs=Null] getter DOMString item(unsigned long index);
     [RaisesException] boolean contains(DOMString token);
-    [RaisesException, CustomElementCallbacks=Enable] void add(DOMString... tokens);
-    [RaisesException, CustomElementCallbacks=Enable] void remove(DOMString... tokens);
-    [RaisesException, CustomElementCallbacks=Enable] boolean toggle(DOMString token, optional boolean force);
+    [RaisesException, CustomElementCallbacks] void add(DOMString... tokens);
+    [RaisesException, CustomElementCallbacks] void remove(DOMString... tokens);
+    [RaisesException, CustomElementCallbacks] boolean toggle(DOMString token, optional boolean force);
     [NotEnumerable] DOMString toString();
 };
 
diff --git a/Source/core/dom/DOMURL.cpp b/Source/core/dom/DOMURL.cpp
new file mode 100644
index 0000000..61fc6bd
--- /dev/null
+++ b/Source/core/dom/DOMURL.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Motorola Mobility Inc.
+ *
+ * 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/dom/DOMURL.h"
+
+#include "bindings/v8/ExceptionMessages.h"
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/ExceptionCode.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/fetch/MemoryCache.h"
+#include "core/fileapi/Blob.h"
+#include "core/fileapi/BlobURL.h"
+#include "core/html/PublicURLManager.h"
+#include "weborigin/SecurityOrigin.h"
+#include "wtf/MainThread.h"
+
+namespace WebCore {
+
+DOMURL::DOMURL(const String& url, const KURL& base, ExceptionState& es)
+{
+    ScriptWrappable::init(this);
+    if (!base.isValid())
+        es.throwDOMException(SyntaxError, ExceptionMessages::failedToConstruct("URL", "Invalid base URL"));
+
+    m_url = KURL(base, url);
+    if (!m_url.isValid())
+        es.throwDOMException(SyntaxError, ExceptionMessages::failedToConstruct("URL", "Invalid URL"));
+}
+
+void DOMURL::setInput(const String& value)
+{
+    KURL url(blankURL(), value);
+    if (url.isValid()) {
+        m_url = url;
+        m_input = String();
+    } else {
+        m_url = KURL();
+        m_input = value;
+    }
+}
+
+String DOMURL::createObjectURL(ExecutionContext* executionContext, Blob* blob)
+{
+    if (!executionContext || !blob)
+        return String();
+    return createPublicURL(executionContext, blob);
+}
+
+String DOMURL::createPublicURL(ExecutionContext* executionContext, URLRegistrable* registrable)
+{
+    KURL publicURL = BlobURL::createPublicURL(executionContext->securityOrigin());
+    if (publicURL.isEmpty())
+        return String();
+
+    executionContext->publicURLManager().registerURL(executionContext->securityOrigin(), publicURL, registrable);
+
+    return publicURL.string();
+}
+
+void DOMURL::revokeObjectURL(ExecutionContext* executionContext, const String& urlString)
+{
+    if (!executionContext)
+        return;
+
+    KURL url(KURL(), urlString);
+    MemoryCache::removeURLFromCache(executionContext, url);
+    executionContext->publicURLManager().revoke(url);
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/DOMURL.h b/Source/core/dom/DOMURL.h
new file mode 100644
index 0000000..f197a11
--- /dev/null
+++ b/Source/core/dom/DOMURL.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Motorola Mobility Inc.
+ *
+ * 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 DOMURL_h
+#define DOMURL_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/dom/DOMURLUtils.h"
+#include "weborigin/KURL.h"
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class Blob;
+class ExceptionState;
+class ExecutionContext;
+class URLRegistrable;
+
+class DOMURL : public ScriptWrappable, public DOMURLUtils, public RefCounted<DOMURL> {
+
+public:
+    static PassRefPtr<DOMURL> create(const String& url, ExceptionState& es)
+    {
+        return adoptRef(new DOMURL(url, blankURL(), es));
+    }
+    static PassRefPtr<DOMURL> create(const String& url, const String& base, ExceptionState& es)
+    {
+        return adoptRef(new DOMURL(url, KURL(KURL(), base), es));
+    }
+    static PassRefPtr<DOMURL> create(const String& url, PassRefPtr<DOMURL> base, ExceptionState& es)
+    {
+        ASSERT(base);
+        return adoptRef(new DOMURL(url, base->m_url, es));
+    }
+
+    static String createObjectURL(ExecutionContext*, Blob*);
+    static void revokeObjectURL(ExecutionContext*, const String&);
+
+    static String createPublicURL(ExecutionContext*, URLRegistrable*);
+
+    virtual KURL url() const OVERRIDE { return m_url; }
+    virtual void setURL(const KURL& url) OVERRIDE { m_url = url; }
+
+    virtual String input() const OVERRIDE { return m_input; }
+    virtual void setInput(const String&) OVERRIDE;
+
+private:
+    DOMURL(const String& url, const KURL& base, ExceptionState&);
+
+    KURL m_url;
+    String m_input;
+};
+
+} // namespace WebCore
+
+#endif // DOMURL_h
diff --git a/Source/core/dom/DOMURLUtils.cpp b/Source/core/dom/DOMURLUtils.cpp
new file mode 100644
index 0000000..5a93768
--- /dev/null
+++ b/Source/core/dom/DOMURLUtils.cpp
@@ -0,0 +1,192 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Motorola Mobility Inc.
+ *
+ * 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/dom/DOMURLUtils.h"
+
+#include "weborigin/KnownPorts.h"
+
+namespace WebCore {
+
+void DOMURLUtils::setHref(DOMURLUtils* impl, const String& value)
+{
+    impl->setInput(value);
+}
+
+void DOMURLUtils::setProtocol(DOMURLUtils* impl, const String& value)
+{
+    KURL url = impl->url();
+    if (url.isNull())
+        return;
+    url.setProtocol(value);
+    impl->setURL(url);
+}
+
+void DOMURLUtils::setUsername(DOMURLUtils* impl, const String& value)
+{
+    KURL url = impl->url();
+    if (url.isNull())
+        return;
+    url.setUser(value);
+    impl->setURL(url);
+}
+
+void DOMURLUtils::setPassword(DOMURLUtils* impl, const String& value)
+{
+    KURL url = impl->url();
+    if (url.isNull())
+        return;
+    url.setPass(value);
+    impl->setURL(url);
+}
+
+// This function does not allow leading spaces before the port number.
+static unsigned parsePortFromStringPosition(const String& value, unsigned portStart, unsigned& portEnd)
+{
+    portEnd = portStart;
+    while (isASCIIDigit(value[portEnd]))
+        ++portEnd;
+    return value.substring(portStart, portEnd - portStart).toUInt();
+}
+
+void DOMURLUtils::setHost(DOMURLUtils* impl, const String& value)
+{
+    // Update once spec bug is resolved: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23474
+    if (value.isEmpty())
+        return;
+
+    KURL url = impl->url();
+    if (!url.canSetHostOrPort())
+        return;
+
+    size_t separator = value.find(':');
+    if (!separator)
+        return;
+
+    if (separator == kNotFound) {
+        url.setHost(value);
+    } else {
+        unsigned portEnd;
+        unsigned port = parsePortFromStringPosition(value, separator + 1, portEnd);
+        if (!port) {
+            // Update once spec bug is resolved: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23463
+
+            // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes
+            // specifically goes against RFC 3986 (p3.2) and
+            // requires setting the port to "0" if it is set to empty string.
+            url.setHostAndPort(value.substring(0, separator + 1) + "0");
+        } else {
+            if (isDefaultPortForProtocol(port, url.protocol()))
+                url.setHostAndPort(value.substring(0, separator));
+            else
+                url.setHostAndPort(value.substring(0, portEnd));
+        }
+    }
+
+    impl->setURL(url);
+}
+
+void DOMURLUtils::setHostname(DOMURLUtils* impl, const String& value)
+{
+    KURL url = impl->url();
+    if (!url.canSetHostOrPort())
+        return;
+
+    // Before setting new value:
+    // Remove all leading U+002F SOLIDUS ("/") characters.
+    unsigned i = 0;
+    unsigned hostLength = value.length();
+    while (value[i] == '/')
+        i++;
+
+    if (i == hostLength)
+        return;
+
+    url.setHost(value.substring(i));
+
+    impl->setURL(url);
+}
+
+void DOMURLUtils::setPort(DOMURLUtils* impl, const String& value)
+{
+    KURL url = impl->url();
+    if (!url.canSetHostOrPort())
+        return;
+
+    // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes
+    // specifically goes against RFC 3986 (p3.2) and
+    // requires setting the port to "0" if it is set to empty string.
+    unsigned port = value.toUInt();
+    if (isDefaultPortForProtocol(port, url.protocol()))
+        url.removePort();
+    else
+        url.setPort(port);
+
+    impl->setURL(url);
+}
+
+void DOMURLUtils::setPathname(DOMURLUtils* impl, const String& value)
+{
+    KURL url = impl->url();
+    if (!url.canSetPathname())
+        return;
+
+    if (value[0] == '/')
+        url.setPath(value);
+    else
+        url.setPath("/" + value);
+
+    impl->setURL(url);
+}
+
+void DOMURLUtils::setSearch(DOMURLUtils* impl, const String& value)
+{
+    KURL url = impl->url();
+    if (!url.isValid())
+        return;
+
+    String newSearch = value[0] == '?' ? value.substring(1) : value;
+    // Make sure that '#' in the query does not leak to the hash.
+    url.setQuery(newSearch.replaceWithLiteral('#', "%23"));
+
+    impl->setURL(url);
+}
+
+void DOMURLUtils::setHash(DOMURLUtils* impl, const String& value)
+{
+    KURL url = impl->url();
+    if (url.isNull())
+        return;
+
+    if (value[0] == '#')
+        url.setFragmentIdentifier(value.substring(1));
+    else
+        url.setFragmentIdentifier(value);
+
+    impl->setURL(url);
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/DOMURLUtils.h b/Source/core/dom/DOMURLUtils.h
new file mode 100644
index 0000000..b7b128e
--- /dev/null
+++ b/Source/core/dom/DOMURLUtils.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Motorola Mobility Inc.
+ *
+ * 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 DOMURLUtils_h
+#define DOMURLUtils_h
+
+#include "core/dom/DOMURLUtilsReadOnly.h"
+#include "wtf/Forward.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class KURL;
+
+class DOMURLUtils : public DOMURLUtilsReadOnly {
+public:
+    virtual void setURL(const KURL&) = 0;
+    virtual void setInput(const String&) = 0;
+
+    static void setHref(DOMURLUtils*, const String&);
+
+    static void setProtocol(DOMURLUtils*, const String&);
+    static void setUsername(DOMURLUtils*, const String&);
+    static void setPassword(DOMURLUtils*, const String&);
+    static void setHost(DOMURLUtils*, const String&);
+    static void setHostname(DOMURLUtils*, const String&);
+    static void setPort(DOMURLUtils*, const String&);
+    static void setPathname(DOMURLUtils*, const String&);
+    static void setSearch(DOMURLUtils*, const String&);
+    static void setHash(DOMURLUtils*, const String&);
+};
+
+} // namespace WebCore
+
+#endif // DOMURLUtils_h
diff --git a/Source/core/dom/DOMURLUtilsReadOnly.cpp b/Source/core/dom/DOMURLUtilsReadOnly.cpp
new file mode 100644
index 0000000..933d76f
--- /dev/null
+++ b/Source/core/dom/DOMURLUtilsReadOnly.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Motorola Mobility Inc.
+ *
+ * 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/dom/DOMURLUtilsReadOnly.h"
+
+#include "weborigin/KnownPorts.h"
+#include "weborigin/SecurityOrigin.h"
+
+namespace WebCore {
+
+String DOMURLUtilsReadOnly::href(DOMURLUtilsReadOnly* impl)
+{
+    const KURL& url = impl->url();
+    if (url.isNull())
+        return impl->input();
+    return url.string();
+}
+
+String DOMURLUtilsReadOnly::origin(const KURL& url)
+{
+    if (url.isNull())
+        return "";
+    return SecurityOrigin::create(url)->toString();
+}
+
+String DOMURLUtilsReadOnly::host(const KURL& url)
+{
+    if (url.hostEnd() == url.pathStart())
+        return url.host();
+    if (isDefaultPortForProtocol(url.port(), url.protocol()))
+        return url.host();
+    return url.host() + ":" + String::number(url.port());
+}
+
+String DOMURLUtilsReadOnly::port(const KURL& url)
+{
+    if (url.hasPort())
+        return String::number(url.port());
+
+    return emptyString();
+}
+
+String DOMURLUtilsReadOnly::search(const KURL& url)
+{
+    String query = url.query();
+    return query.isEmpty() ? emptyString() : "?" + query;
+}
+
+String DOMURLUtilsReadOnly::hash(const KURL& url)
+{
+    String fragmentIdentifier = url.fragmentIdentifier();
+    if (fragmentIdentifier.isEmpty())
+        return emptyString();
+    return AtomicString(String("#" + fragmentIdentifier));
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/DOMURLUtilsReadOnly.h b/Source/core/dom/DOMURLUtilsReadOnly.h
new file mode 100644
index 0000000..74f1d1c
--- /dev/null
+++ b/Source/core/dom/DOMURLUtilsReadOnly.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Motorola Mobility Inc.
+ *
+ * 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 DOMURLUtilsReadOnly_h
+#define DOMURLUtilsReadOnly_h
+
+#include "weborigin/KURL.h"
+#include "wtf/Forward.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class DOMURLUtilsReadOnly {
+public:
+    virtual KURL url() const = 0;
+    virtual String input() const = 0;
+
+    static String href(DOMURLUtilsReadOnly*);
+
+    static String origin(const KURL&);
+    static String origin(DOMURLUtilsReadOnly* impl) { return origin(impl->url()); }
+
+    static String protocol(const KURL& url) { return url.protocol() + ":"; }
+    static String protocol(DOMURLUtilsReadOnly* impl) { return protocol(impl->url()); }
+
+    static String username(const KURL& url) { return url.user(); }
+    static String username(DOMURLUtilsReadOnly* impl) { return username(impl->url()); }
+
+    static String password(const KURL& url) { return url.pass(); }
+    static String password(DOMURLUtilsReadOnly* impl) { return password(impl->url()); }
+
+    static String host(const KURL&);
+    static String host(DOMURLUtilsReadOnly* impl) { return host(impl->url()); }
+
+    static String hostname(const KURL& url) { return url.host(); }
+    static String hostname(DOMURLUtilsReadOnly* impl) { return hostname(impl->url()); }
+
+    static String port(const KURL&);
+    static String port(DOMURLUtilsReadOnly* impl) { return port(impl->url()); }
+
+    static String pathname(const KURL& url) { return url.path(); }
+    static String pathname(DOMURLUtilsReadOnly* impl) { return pathname(impl->url()); }
+
+    static String search(const KURL&);
+    static String search(DOMURLUtilsReadOnly* impl) { return search(impl->url()); }
+
+    static String hash(const KURL&);
+    static String hash(DOMURLUtilsReadOnly* impl) { return hash(impl->url()); }
+};
+
+} // namespace WebCore
+
+#endif // DOMURLUtilsReadOnly_h
diff --git a/Source/core/dom/DataTransferItem.cpp b/Source/core/dom/DataTransferItem.cpp
index 7d79f11..8d2d976 100644
--- a/Source/core/dom/DataTransferItem.cpp
+++ b/Source/core/dom/DataTransferItem.cpp
@@ -31,10 +31,62 @@
 #include "config.h"
 #include "core/dom/DataTransferItem.h"
 
+#include "bindings/v8/V8Binding.h"
+#include "core/dom/Clipboard.h"
+#include "core/dom/StringCallback.h"
+#include "core/platform/chromium/ChromiumDataObjectItem.h"
+
 namespace WebCore {
 
 const char DataTransferItem::kindString[] = "string";
 const char DataTransferItem::kindFile[] = "file";
 
+PassRefPtr<DataTransferItem> DataTransferItem::create(PassRefPtr<Clipboard> clipboard, PassRefPtr<ChromiumDataObjectItem> item)
+{
+    return adoptRef(new DataTransferItem(clipboard, item));
+}
+
+DataTransferItem::~DataTransferItem()
+{
+}
+
+String DataTransferItem::kind() const
+{
+    if (!m_clipboard->canReadTypes())
+        return String();
+    return m_item->kind();
+}
+
+String DataTransferItem::type() const
+{
+    if (!m_clipboard->canReadTypes())
+        return String();
+    return m_item->type();
+}
+
+void DataTransferItem::getAsString(ExecutionContext* context, PassRefPtr<StringCallback> callback) const
+{
+    if (!m_clipboard->canReadData())
+        return;
+
+    m_item->getAsString(callback, context);
+}
+
+PassRefPtr<Blob> DataTransferItem::getAsFile() const
+{
+    if (!m_clipboard->canReadData())
+        return 0;
+
+    return m_item->getAsFile();
+}
+
+DataTransferItem::DataTransferItem(PassRefPtr<Clipboard> clipboard, PassRefPtr<ChromiumDataObjectItem> item)
+    : m_clipboard(clipboard)
+    , m_item(item)
+{
+    ScriptWrappable::init(this);
+}
+
+
 } // namespace WebCore
 
diff --git a/Source/core/dom/DataTransferItem.h b/Source/core/dom/DataTransferItem.h
index 31fb28c..d06256e 100644
--- a/Source/core/dom/DataTransferItem.h
+++ b/Source/core/dom/DataTransferItem.h
@@ -34,31 +34,39 @@
 #include "bindings/v8/ScriptWrappable.h"
 #include "wtf/Forward.h"
 #include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
 class Blob;
+class ChromiumDataObjectItem;
+class Clipboard;
 class File;
 class StringCallback;
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class DataTransferItem : public RefCounted<DataTransferItem>, public ScriptWrappable {
 public:
-    DataTransferItem()
-    {
-        ScriptWrappable::init(this);
-    }
-
-    virtual ~DataTransferItem() { }
+    static PassRefPtr<DataTransferItem> create(PassRefPtr<Clipboard>, PassRefPtr<ChromiumDataObjectItem>);
+    ~DataTransferItem();
 
     static const char kindString[];
     static const char kindFile[];
 
-    virtual String kind() const = 0;
-    virtual String type() const = 0;
+    String kind() const;
+    String type() const;
 
-    virtual void getAsString(PassRefPtr<StringCallback>) const = 0;
-    virtual PassRefPtr<Blob> getAsFile() const = 0;
+    void getAsString(ExecutionContext*, PassRefPtr<StringCallback>) const;
+    PassRefPtr<Blob> getAsFile() const;
+
+    Clipboard* clipboard() { return m_clipboard.get(); }
+    ChromiumDataObjectItem* dataObjectItem() { return m_item.get(); }
+
+private:
+    DataTransferItem(PassRefPtr<Clipboard>, PassRefPtr<ChromiumDataObjectItem>);
+
+    RefPtr<Clipboard> m_clipboard;
+    RefPtr<ChromiumDataObjectItem> m_item;
 };
 
 } // namespace WebCore
diff --git a/Source/core/dom/DataTransferItem.idl b/Source/core/dom/DataTransferItem.idl
index 7a3327f..8499652 100644
--- a/Source/core/dom/DataTransferItem.idl
+++ b/Source/core/dom/DataTransferItem.idl
@@ -34,7 +34,7 @@
     readonly attribute DOMString kind;
     readonly attribute DOMString type;
 
-    void getAsString(StringCallback? callback);
+    [CallWith=ExecutionContext] void getAsString(StringCallback? callback);
     Blob getAsFile();
 };
 
diff --git a/Source/core/dom/DataTransferItemList.cpp b/Source/core/dom/DataTransferItemList.cpp
new file mode 100644
index 0000000..7e751d3
--- /dev/null
+++ b/Source/core/dom/DataTransferItemList.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2008, 2009 Google Inc.
+ *
+ * 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,
+ * 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/dom/DataTransferItemList.h"
+
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/Clipboard.h"
+#include "core/dom/DataTransferItem.h"
+#include "core/dom/ExceptionCode.h"
+#include "core/platform/chromium/ChromiumDataObject.h"
+
+namespace WebCore {
+
+PassRefPtr<DataTransferItemList> DataTransferItemList::create(PassRefPtr<Clipboard> clipboard, PassRefPtr<ChromiumDataObject> list)
+{
+    return adoptRef(new DataTransferItemList(clipboard, list));
+}
+
+DataTransferItemList::~DataTransferItemList()
+{
+}
+
+size_t DataTransferItemList::length() const
+{
+    if (!m_clipboard->canReadTypes())
+        return 0;
+    return m_dataObject->length();
+}
+
+PassRefPtr<DataTransferItem> DataTransferItemList::item(unsigned long index)
+{
+    if (!m_clipboard->canReadTypes())
+        return 0;
+    RefPtr<ChromiumDataObjectItem> item = m_dataObject->item(index);
+    if (!item)
+        return 0;
+
+    return DataTransferItem::create(m_clipboard, item);
+}
+
+void DataTransferItemList::deleteItem(unsigned long index, ExceptionState& es)
+{
+    if (!m_clipboard->canWriteData()) {
+        es.throwUninformativeAndGenericDOMException(InvalidStateError);
+        return;
+    }
+    m_dataObject->deleteItem(index);
+}
+
+void DataTransferItemList::clear()
+{
+    if (!m_clipboard->canWriteData())
+        return;
+    m_dataObject->clearAll();
+}
+
+PassRefPtr<DataTransferItem> DataTransferItemList::add(const String& data, const String& type, ExceptionState& es)
+{
+    if (!m_clipboard->canWriteData())
+        return 0;
+    RefPtr<ChromiumDataObjectItem> item = m_dataObject->add(data, type, es);
+    if (!item)
+        return 0;
+    return DataTransferItem::create(m_clipboard, item);
+}
+
+PassRefPtr<DataTransferItem> DataTransferItemList::add(PassRefPtr<File> file)
+{
+    if (!m_clipboard->canWriteData())
+        return 0;
+    RefPtr<ChromiumDataObjectItem> item = m_dataObject->add(file);
+    if (!item)
+        return 0;
+    return DataTransferItem::create(m_clipboard, item);
+}
+
+DataTransferItemList::DataTransferItemList(PassRefPtr<Clipboard> clipboard, PassRefPtr<ChromiumDataObject> dataObject)
+    : m_clipboard(clipboard)
+    , m_dataObject(dataObject)
+{
+    ScriptWrappable::init(this);
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/DataTransferItemList.h b/Source/core/dom/DataTransferItemList.h
index 90d847f..f296c7b 100644
--- a/Source/core/dom/DataTransferItemList.h
+++ b/Source/core/dom/DataTransferItemList.h
@@ -32,32 +32,36 @@
 #define DataTransferItemList_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/DataTransferItem.h"
 #include "wtf/Forward.h"
 #include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
 
 namespace WebCore {
 
+class ChromiumDataObject;
 class Clipboard;
+class DataTransferItem;
 class File;
 
 class ExceptionState;
 
 class DataTransferItemList : public RefCounted<DataTransferItemList>, public ScriptWrappable {
 public:
-    DataTransferItemList()
-    {
-        ScriptWrappable::init(this);
-    }
+    static PassRefPtr<DataTransferItemList> create(PassRefPtr<Clipboard>, PassRefPtr<ChromiumDataObject>);
+    ~DataTransferItemList();
 
-    virtual ~DataTransferItemList() { }
+    size_t length() const;
+    PassRefPtr<DataTransferItem> item(unsigned long index);
+    void deleteItem(unsigned long index, ExceptionState&);
+    void clear();
+    PassRefPtr<DataTransferItem> add(const String& data, const String& type, ExceptionState&);
+    PassRefPtr<DataTransferItem> add(PassRefPtr<File>);
 
-    virtual size_t length() const = 0;
-    virtual PassRefPtr<DataTransferItem> item(unsigned long index) = 0;
-    virtual void deleteItem(unsigned long index, ExceptionState&) = 0;
-    virtual void clear() = 0;
-    virtual PassRefPtr<DataTransferItem> add(const String& data, const String& type, ExceptionState&) = 0;
-    virtual PassRefPtr<DataTransferItem> add(PassRefPtr<File>) = 0;
+private:
+    DataTransferItemList(PassRefPtr<Clipboard>, PassRefPtr<ChromiumDataObject>);
+
+    RefPtr<Clipboard> m_clipboard;
+    RefPtr<ChromiumDataObject> m_dataObject;
 };
 
 } // namespace WebCore
diff --git a/Source/core/dom/DeviceOrientationClient.h b/Source/core/dom/DeviceOrientationClient.h
deleted file mode 100644
index 14de526..0000000
--- a/Source/core/dom/DeviceOrientationClient.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 DeviceOrientationClient_h
-#define DeviceOrientationClient_h
-
-#include "core/page/DeviceClient.h"
-
-namespace WebCore {
-
-class DeviceOrientationController;
-class DeviceOrientationData;
-class Page;
-
-class DeviceOrientationClient : public DeviceClient {
-public:
-    virtual ~DeviceOrientationClient() {}
-    virtual void setController(DeviceOrientationController*) = 0;
-    virtual DeviceOrientationData* lastOrientation() const = 0;
-    virtual void deviceOrientationControllerDestroyed() = 0;
-};
-
-void provideDeviceOrientationTo(Page*, DeviceOrientationClient*);
-
-} // namespace WebCore
-
-#endif // DeviceOrientationClient_h
diff --git a/Source/core/dom/DeviceOrientationController.cpp b/Source/core/dom/DeviceOrientationController.cpp
deleted file mode 100644
index 9071098..0000000
--- a/Source/core/dom/DeviceOrientationController.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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/dom/DeviceOrientationController.h"
-
-#include "core/dom/DeviceOrientationClient.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "modules/device_orientation/DeviceOrientationEvent.h"
-
-namespace WebCore {
-
-DeviceOrientationController::DeviceOrientationController(Page* page, DeviceOrientationClient* client)
-    : DeviceController(client)
-    , m_page(page)
-{
-    ASSERT(m_client);
-    deviceOrientationClient()->setController(this);
-}
-
-PassOwnPtr<DeviceOrientationController> DeviceOrientationController::create(Page* page, DeviceOrientationClient* client)
-{
-    return adoptPtr(new DeviceOrientationController(page, client));
-}
-
-void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationData* orientation)
-{
-    orientation = InspectorInstrumentation::overrideDeviceOrientation(m_page, orientation);
-    dispatchDeviceEvent(DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation));
-}
-
-DeviceOrientationClient* DeviceOrientationController::deviceOrientationClient()
-{
-    return static_cast<DeviceOrientationClient*>(m_client);
-}
-
-bool DeviceOrientationController::hasLastData()
-{
-    return deviceOrientationClient()->lastOrientation();
-}
-
-PassRefPtr<Event> DeviceOrientationController::getLastEvent()
-{
-    return DeviceOrientationEvent::create(eventNames().deviceorientationEvent, deviceOrientationClient()->lastOrientation());
-}
-
-const char* DeviceOrientationController::supplementName()
-{
-    return "DeviceOrientationController";
-}
-
-DeviceOrientationController* DeviceOrientationController::from(Page* page)
-{
-    return static_cast<DeviceOrientationController*>(Supplement<Page>::from(page, supplementName()));
-}
-
-bool DeviceOrientationController::isActiveAt(Page* page)
-{
-    if (DeviceOrientationController* self = DeviceOrientationController::from(page))
-        return self->isActive();
-    return false;
-}
-
-void provideDeviceOrientationTo(Page* page, DeviceOrientationClient* client)
-{
-    DeviceOrientationController::provideTo(page, DeviceOrientationController::supplementName(), DeviceOrientationController::create(page, client));
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/DeviceOrientationController.h b/Source/core/dom/DeviceOrientationController.h
deleted file mode 100644
index 3173d39..0000000
--- a/Source/core/dom/DeviceOrientationController.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 DeviceOrientationController_h
-#define DeviceOrientationController_h
-
-#include "core/page/DeviceController.h"
-
-namespace WebCore {
-
-class DeviceOrientationClient;
-class DeviceOrientationData;
-
-class DeviceOrientationController : public DeviceController {
-public:
-    ~DeviceOrientationController() { };
-
-    static PassOwnPtr<DeviceOrientationController> create(Page*, DeviceOrientationClient*);
-
-    void didChangeDeviceOrientation(DeviceOrientationData*);
-    DeviceOrientationClient* deviceOrientationClient();
-
-    virtual bool hasLastData() OVERRIDE;
-    virtual PassRefPtr<Event> getLastEvent() OVERRIDE;
-
-    static const char* supplementName();
-    static DeviceOrientationController* from(Page*);
-    static bool isActiveAt(Page*);
-
-private:
-    DeviceOrientationController(Page*, DeviceOrientationClient*);
-
-    Page* m_page;
-};
-
-} // namespace WebCore
-
-#endif // DeviceOrientationController_h
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index e536173..8d9b100 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -54,29 +54,25 @@
 #include "core/css/StyleSheetList.h"
 #include "core/css/resolver/FontBuilder.h"
 #include "core/css/resolver/StyleResolver.h"
+#include "core/dom/AddConsoleMessageTask.h"
 #include "core/dom/Attr.h"
-#include "core/events/BeforeUnloadEvent.h"
 #include "core/dom/CDATASection.h"
 #include "core/dom/Comment.h"
 #include "core/dom/ContextFeatures.h"
-#include "core/dom/CustomElementRegistrationContext.h"
 #include "core/dom/DOMImplementation.h"
 #include "core/dom/DOMNamedFlowCollection.h"
-#include "core/events/DocumentEventQueue.h"
 #include "core/dom/DocumentFragment.h"
+#include "core/dom/DocumentLifecycleNotifier.h"
 #include "core/dom/DocumentLifecycleObserver.h"
 #include "core/dom/DocumentMarkerController.h"
 #include "core/dom/DocumentSharedObjectPool.h"
 #include "core/dom/DocumentType.h"
 #include "core/dom/Element.h"
 #include "core/dom/ElementTraversal.h"
-#include "core/events/Event.h"
-#include "core/events/EventFactory.h"
-#include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/events/HashChangeEvent.h"
+#include "core/dom/ExecutionContextTask.h"
 #include "core/dom/NamedFlowCollection.h"
+#include "core/dom/NodeChildRemovalTracker.h"
 #include "core/dom/NodeFilter.h"
 #include "core/dom/NodeIterator.h"
 #include "core/dom/NodeRareData.h"
@@ -84,13 +80,10 @@
 #include "core/dom/NodeRenderingTraversal.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/NodeWithIndex.h"
-#include "core/events/PageTransitionEvent.h"
-#include "core/events/PopStateEvent.h"
 #include "core/dom/PostAttachCallbacks.h"
 #include "core/dom/ProcessingInstruction.h"
 #include "core/dom/QualifiedName.h"
 #include "core/dom/RequestAnimationFrameCallback.h"
-#include "core/events/ScopedEventQueue.h"
 #include "core/dom/ScriptRunner.h"
 #include "core/dom/ScriptedAnimationController.h"
 #include "core/dom/SelectorQuery.h"
@@ -100,12 +93,30 @@
 #include "core/dom/TreeWalker.h"
 #include "core/dom/UserActionElementSet.h"
 #include "core/dom/VisitedLinkState.h"
+#include "core/dom/custom/CustomElementRegistrationContext.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/events/BeforeUnloadEvent.h"
+#include "core/events/DocumentEventQueue.h"
+#include "core/events/Event.h"
+#include "core/events/EventFactory.h"
+#include "core/events/EventListener.h"
+#include "core/events/HashChangeEvent.h"
+#include "core/events/PageTransitionEvent.h"
+#include "core/events/PopStateEvent.h"
+#include "core/events/ScopedEventQueue.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/fetch/ResourceFetcher.h"
 #include "core/fetch/TextResourceDecoder.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/DOMSecurityPolicy.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
+#include "core/frame/History.h"
+#include "core/frame/animation/AnimationController.h"
 #include "core/html/HTMLAllCollection.h"
 #include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLCanvasElement.h"
@@ -136,33 +147,18 @@
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/loader/ImageLoader.h"
-#include "core/loader/Prerenderer.h"
 #include "core/loader/appcache/ApplicationCacheHost.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/DOMSecurityPolicy.h"
-#include "core/page/DOMWindow.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
-#include "core/page/History.h"
 #include "core/page/MouseEventWithHitTestResults.h"
 #include "core/page/Page.h"
 #include "core/page/PageConsole.h"
 #include "core/page/PointerLockController.h"
 #include "core/page/Settings.h"
-#include "core/page/animation/AnimationController.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/platform/DateComponents.h"
-#include "core/platform/Language.h"
 #include "core/platform/ScrollbarTheme.h"
-#include "core/platform/Timer.h"
-#include "core/platform/chromium/TraceEvent.h"
-#include "core/platform/network/HTTPParsers.h"
-#include "core/platform/text/PlatformLocale.h"
-#include "core/platform/text/SegmentedString.h"
 #include "core/rendering/HitTestRequest.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderView.h"
@@ -173,6 +169,13 @@
 #include "core/workers/SharedWorkerRepository.h"
 #include "core/xml/XSLTProcessor.h"
 #include "core/xml/parser/XMLDocumentParser.h"
+#include "platform/DateComponents.h"
+#include "platform/Language.h"
+#include "platform/Timer.h"
+#include "platform/TraceEvent.h"
+#include "platform/network/HTTPParsers.h"
+#include "platform/text/PlatformLocale.h"
+#include "platform/text/SegmentedString.h"
 #include "weborigin/SchemeRegistry.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/CurrentTime.h"
@@ -180,6 +183,7 @@
 #include "wtf/MainThread.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/StdLibExtras.h"
+#include "wtf/TemporaryChange.h"
 #include "wtf/UnusedParam.h"
 #include "wtf/text/StringBuffer.h"
 #include "wtf/text/TextEncodingRegistry.h"
@@ -302,12 +306,7 @@
     ASSERT(element);
     ASSERT(element->rendererIsEditable());
 
-    Element* root = element->rootEditableElement();
-    Frame* frame = element->document().frame();
-    if (!frame || !root)
-        return false;
-
-    return frame->editor().shouldBeginEditing(rangeOfContents(root).get());
+    return element->document().frame() && element->rootEditableElement();
 }
 
 static bool canAccessAncestor(const SecurityOrigin* activeSecurityOrigin, Frame* targetFrame)
@@ -349,7 +348,7 @@
 uint64_t Document::s_globalTreeVersion = 0;
 
 // This class should be passed only to Document::postTask.
-class CheckFocusedElementTask FINAL : public ScriptExecutionContext::Task {
+class CheckFocusedElementTask FINAL : public ExecutionContextTask {
 public:
     static PassOwnPtr<CheckFocusedElementTask> create()
     {
@@ -359,7 +358,7 @@
 
 private:
     CheckFocusedElementTask() { }
-    virtual void performTask(ScriptExecutionContext* context) OVERRIDE
+    virtual void performTask(ExecutionContext* context) OVERRIDE
     {
         ASSERT(context->isDocument());
         Document* document = toDocument(context);
@@ -382,7 +381,8 @@
     : ContainerNode(0, CreateDocument)
     , TreeScope(this)
     , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimerFired)
-    , m_lastStyleResolverAccessTime(0)
+    , m_styleResolverAccessCount(0)
+    , m_lastStyleResolverAccessCount(0)
     , m_didCalculateStyleResolver(false)
     , m_ignorePendingStylesheets(false)
     , m_evaluateMediaQueriesOnStyleRecalc(false)
@@ -397,7 +397,6 @@
     , m_wellFormed(false)
     , m_printing(false)
     , m_paginatedForScreen(false)
-    , m_ignoreAutofocus(false)
     , m_compatibilityMode(NoQuirksMode)
     , m_compatibilityModeLocked(false)
     , m_didPostCheckFocusedElementTask(false)
@@ -405,7 +404,7 @@
     , m_listenerTypes(0)
     , m_mutationObserverTypes(0)
     , m_styleEngine(StyleEngine::create(*this))
-    , m_visitedLinkState(VisitedLinkState::create(this))
+    , m_visitedLinkState(VisitedLinkState::create(*this))
     , m_visuallyOrdered(false)
     , m_readyState(Complete)
     , m_bParsing(false)
@@ -435,7 +434,7 @@
     , m_sawElementsInKnownNamespaces(false)
     , m_isSrcdocDocument(false)
     , m_isMobileDocument(false)
-    , m_renderer(0)
+    , m_renderView(0)
     , m_eventQueue(DocumentEventQueue::create(this))
     , m_weakFactory(this)
     , m_contextDocument(initializer.contextDocument())
@@ -450,7 +449,6 @@
     , m_writeRecursionIsTooDeep(false)
     , m_writeRecursionDepth(0)
     , m_lastHandledUserGestureTimestamp(0)
-    , m_prerenderer(Prerenderer::create(this))
     , m_textAutosizer(TextAutosizer::create(this))
     , m_registrationContext(initializer.registrationContext(this))
     , m_pendingTasksTimer(this, &Document::pendingTasksTimerFired)
@@ -464,6 +462,7 @@
     , m_fonts(0)
     , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsTimerFired)
 {
+    setClient(this);
     ScriptWrappable::init(this);
 
     if (m_frame) {
@@ -491,6 +490,8 @@
         m_nodeListCounts[i] = 0;
 
     InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter);
+
+    m_lifecyle.advanceTo(DocumentLifecycle::Inactive);
 }
 
 static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, const WebCore::QualifiedName& prefixedAttribute, const HTMLFrameOwnerElement* owner)
@@ -514,7 +515,8 @@
     if (m_templateDocument)
         m_templateDocument->setTemplateDocumentHost(0); // balanced in templateDocument().
 
-    lifecycleNotifier()->notifyDocumentBeingDestroyed();
+    if (Document* ownerDocument = this->ownerDocument())
+        ownerDocument->didRemoveEventTargetNode(this);
 
     m_scriptRunner.clear();
 
@@ -566,13 +568,14 @@
         ASSERT(!m_nodeListCounts[i]);
 
     clearDocumentScope();
+    setClient(0);
 
     InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter);
 }
 
 void Document::dispose()
 {
-    ASSERT(!m_deletionHasBegun);
+    ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
     // We must make sure not to be retaining any of our children through
     // these extra pointers or we will create a reference cycle.
     m_docType = 0;
@@ -613,6 +616,7 @@
     if (svgExtensions())
         accessSVGExtensions()->pauseAnimations();
 
+    m_lifecyle.advanceTo(DocumentLifecycle::Disposed);
     lifecycleNotifier()->notifyDocumentWasDisposed();
 }
 
@@ -675,6 +679,14 @@
     return documentElement() && isHTMLHtmlElement(documentElement()) && documentElement()->hasAttribute(manifestAttr);
 }
 
+Location* Document::location() const
+{
+    if (!frame())
+        return 0;
+
+    return domWindow()->location();
+}
+
 void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
     ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
@@ -709,12 +721,12 @@
 
     RefPtr<Element> element;
 
-    if (CustomElement::isValidName(localName) && registrationContext())
+    if (RuntimeEnabledFeatures::customElementsEnabled() && CustomElement::isValidName(localName) && registrationContext())
         element = registrationContext()->createCustomTagElement(*this, QualifiedName(nullAtom, localName, xhtmlNamespaceURI));
     else
         element = createElement(localName, es);
 
-    if (!typeExtension.isNull() && !typeExtension.isEmpty())
+    if (RuntimeEnabledFeatures::customElementsEnabled() && !typeExtension.isNull() && !typeExtension.isEmpty())
         CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element.get(), typeExtension);
 
     return element;
@@ -926,7 +938,6 @@
         Attr* attr = toAttr(source.get());
         if (attr->ownerElement())
             attr->ownerElement()->removeAttributeNode(attr, es);
-        attr->setSpecified(true);
         break;
     }
     default:
@@ -1011,11 +1022,6 @@
     return settings() && settings()->regionBasedColumnsEnabled();
 }
 
-bool Document::cssStickyPositionEnabled() const
-{
-    return settings() && settings()->cssStickyPositionEnabled();
-}
-
 bool Document::cssCompositingEnabled() const
 {
     return RuntimeEnabledFeatures::cssCompositingEnabled();
@@ -1097,15 +1103,15 @@
     }
 
     m_readyState = readyState;
-    dispatchEvent(Event::create(eventNames().readystatechangeEvent));
+    dispatchEvent(Event::create(EventTypeNames::readystatechange));
 }
 
 String Document::encodingName() const
 {
-    // TextEncoding::domName() returns a char*, no need to allocate a new
+    // TextEncoding::name() returns a char*, no need to allocate a new
     // String for it each time.
     // FIXME: We should fix TextEncoding to speak AtomicString anyway.
-    return AtomicString(m_encoding.domName());
+    return AtomicString(m_encoding.name());
 }
 
 String Document::defaultCharset() const
@@ -1204,10 +1210,11 @@
     if (!renderer())
         return 0;
     LayoutPoint localPoint;
-    Node* node = nodeFromPoint(this, x, y, &localPoint);
-    if (!node)
+    RenderObject* renderer = rendererFromPoint(this, x, y, &localPoint);
+    if (!renderer)
         return 0;
 
+    Node* node = renderer->node();
     Node* shadowAncestorNode = ancestorInThisScope(node);
     if (shadowAncestorNode != node) {
         unsigned offset = shadowAncestorNode->nodeIndex();
@@ -1215,9 +1222,6 @@
         return Range::create(*this, container, offset, container, offset);
     }
 
-    RenderObject* renderer = node->renderer();
-    if (!renderer)
-        return 0;
     PositionWithAffinity positionWithAffinity = renderer->positionForPoint(localPoint);
     if (positionWithAffinity.position().isNull())
         return 0;
@@ -1279,9 +1283,6 @@
 
     buffer.shrink(builderIndex + 1);
 
-    // Replace the backslashes with currency symbols if the encoding requires it.
-    document->displayBufferModifiedByEncoding(buffer.characters(), buffer.length());
-
     return String::adopt(buffer);
 }
 
@@ -1302,7 +1303,6 @@
 
     if (!m_frame || oldTitle == m_title)
         return;
-    m_frame->loader()->history()->setCurrentItemTitle(m_title);
     m_frame->loader()->client()->dispatchDidReceiveTitle(m_title);
 }
 
@@ -1321,11 +1321,8 @@
 
     updateTitle(title);
 
-    if (m_titleElement) {
-        ASSERT(isHTMLTitleElement(m_titleElement.get()));
-        if (isHTMLTitleElement(m_titleElement.get()))
-            toHTMLTitleElement(m_titleElement.get())->setText(title);
-    }
+    if (m_titleElement && isHTMLTitleElement(m_titleElement.get()))
+        toHTMLTitleElement(m_titleElement.get())->setText(title);
 }
 
 void Document::setTitleElement(const String& title, Element* titleElement)
@@ -1387,7 +1384,7 @@
 
 void Document::dispatchVisibilityStateChangeEvent()
 {
-    dispatchEvent(Event::create(eventNames().webkitvisibilitychangeEvent));
+    dispatchEvent(Event::create(EventTypeNames::webkitvisibilitychange));
 }
 
 DOMSecurityPolicy* Document::securityPolicy()
@@ -1548,7 +1545,7 @@
 
 void Document::unscheduleStyleRecalc()
 {
-    ASSERT(!attached() || (!needsStyleRecalc() && !childNeedsStyleRecalc()));
+    ASSERT(!isActive() || (!needsStyleRecalc() && !childNeedsStyleRecalc()));
     m_styleRecalcTimer.stop();
 }
 
@@ -1665,23 +1662,27 @@
 void Document::recalcStyle(StyleRecalcChange change)
 {
     // we should not enter style recalc while painting
-    ASSERT(!view() || !view()->isPainting());
-    if (view() && view()->isPainting())
+    RELEASE_ASSERT(!view() || !view()->isPainting());
+
+    // FIXME: We should never enter here without a FrameView or a RenderView.
+    if (!renderer() || !view())
         return;
 
     if (m_inStyleRecalc)
-        return; // Guard against re-entrancy. -dwh
+        return;
 
     TRACE_EVENT0("webkit", "Document::recalcStyle");
     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "RecalcStyle");
 
+    updateDistributionIfNeeded();
+
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this);
+
     if (m_evaluateMediaQueriesOnStyleRecalc) {
         m_evaluateMediaQueriesOnStyleRecalc = false;
         evaluateMediaQueryList();
     }
 
-    updateDistributionIfNeeded();
-
     // FIXME: We should update style on our ancestor chain before proceeding (especially for seamless),
     // however doing so currently causes several tests to crash, as Frame::setDocument calls Document::attach
     // before setting the DOMWindow on the Frame, or the SecurityOrigin on the document. The attach, in turn
@@ -1692,29 +1693,19 @@
     if (m_styleEngine->needsUpdateActiveStylesheetsOnStyleRecalc())
         m_styleEngine->updateActiveStyleSheets(FullStyleUpdate);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this);
-
     if (m_elemSheet && m_elemSheet->contents()->usesRemUnits())
         m_styleEngine->setUsesRemUnit(true);
 
-    m_inStyleRecalc = true;
     {
         PostAttachCallbacks::SuspendScope suspendPostAttachCallbacks;
-        WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
-
-        RefPtr<FrameView> frameView = view();
-        if (frameView) {
-            frameView->pauseScheduledEvents();
-            frameView->beginDeferredRepaints();
-        }
-
-        if (!renderer())
-            goto bailOut;
+        RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates;
+        FrameView::DeferredRepaintScope deferRepaints(*view());
+        TemporaryChange<bool> changeInStyleRecalc(m_inStyleRecalc, true);
 
         if (styleChangeType() >= SubtreeStyleChange)
             change = Force;
 
-        if ((change == Force) || (shouldDisplaySeamlesslyWithParent() && (change >= Inherit))) {
+        if (change == Force || (change >= Inherit && shouldDisplaySeamlesslyWithParent())) {
             m_hasNodesWithPlaceholderStyle = false;
             RefPtr<RenderStyle> documentStyle = StyleResolver::styleForDocument(*this, m_styleResolver ? m_styleResolver->fontSelector() : 0);
             StyleRecalcChange localChange = RenderStyle::compare(documentStyle.get(), renderer()->style());
@@ -1724,18 +1715,13 @@
 
         inheritHtmlAndBodyElementStyles(change);
 
-        for (Node* n = firstChild(); n; n = n->nextSibling()) {
-            if (!n->isElementNode())
-                continue;
-            Element* element = toElement(n);
-            if (shouldRecalcStyle(change, element))
-                element->recalcStyle(change);
+        if (Element* documentElement = this->documentElement()) {
+            if (shouldRecalcStyle(change, documentElement))
+                documentElement->recalcStyle(change);
         }
 
-        if (view())
-            view()->updateCompositingLayersAfterStyleChange();
+        view()->updateCompositingLayersAfterStyleChange();
 
-    bailOut:
         clearNeedsStyleRecalc();
         clearChildNeedsStyleRecalc();
         unscheduleStyleRecalc();
@@ -1745,18 +1731,11 @@
         if (m_styleEngine->needsUpdateActiveStylesheetsOnStyleRecalc())
             setNeedsStyleRecalc();
 
-        m_inStyleRecalc = false;
-
         // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
         if (m_styleResolver) {
             m_styleEngine->resetCSSFeatureFlags(m_styleResolver->ruleFeatureSet());
             m_styleResolver->clearStyleSharingList();
         }
-
-        if (frameView) {
-            frameView->resumeScheduledEvents();
-            frameView->endDeferredRepaints();
-        }
     }
 
     STYLE_STATS_PRINT();
@@ -1901,7 +1880,7 @@
 
 PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Element* element)
 {
-    ASSERT_ARG(element, &element->document() == this);
+    ASSERT_ARG(element, element->document() == this);
     TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true);
     return styleResolver()->styleForElement(element, element->parentNode() ? element->parentNode()->computedStyle() : 0);
 }
@@ -1981,21 +1960,25 @@
 
 void Document::attach(const AttachContext& context)
 {
-    ASSERT(!attached());
     ASSERT(!m_axObjectCache || this != topDocument());
 
-    // Create the rendering tree
-    setRenderer(new RenderView(this));
-    renderView()->setIsInWindow(true);
+    m_renderView = new RenderView(this);
+    m_renderView->setIsInWindow(true);
+    setRenderer(m_renderView);
 
-    recalcStyle(Force);
+    m_renderView->setStyle(StyleResolver::styleForDocument(*this));
+    view()->updateCompositingLayersAfterStyleChange();
+
+    m_styleResolverThrowawayTimer.startRepeating(60);
 
     ContainerNode::attach(context);
+
+    m_lifecyle.advanceTo(DocumentLifecycle::Active);
 }
 
 void Document::detach(const AttachContext& context)
 {
-    ASSERT(attached());
+    m_lifecyle.advanceTo(DocumentLifecycle::Stopping);
 
     if (page())
         page()->documentDetached(this);
@@ -2014,8 +1997,6 @@
     if (svgExtensions())
         accessSVGExtensions()->pauseAnimations();
 
-    RenderObject* render = renderer();
-
     documentWillBecomeInactive();
 
     SharedWorkerRepository::documentDetached(this);
@@ -2026,21 +2007,20 @@
             view->detachCustomScrollbars();
     }
 
-    // indicate destruction mode,  i.e. attached() but renderer == 0
-    setRenderer(0);
-
     m_hoverNode = 0;
     m_focusedElement = 0;
     m_activeElement = 0;
 
+    m_styleResolverThrowawayTimer.stop();
+
     ContainerNode::detach(context);
 
     unscheduleStyleRecalc();
 
     clearStyleResolver();
 
-    if (render)
-        render->destroy();
+    if (m_touchEventTargets && m_touchEventTargets->size() && parentDocument())
+        parentDocument()->didRemoveEventTargetNode(this);
 
     // This is required, as our Frame might delete itself as soon as it detaches
     // us. However, this violates Node::detach() semantics, as it's never
@@ -2053,6 +2033,7 @@
         m_mediaQueryMatcher->documentDestroyed();
 
     lifecycleNotifier()->notifyDocumentWasDetached();
+    m_lifecyle.advanceTo(DocumentLifecycle::Stopped);
 }
 
 void Document::prepareForDestruction()
@@ -2061,7 +2042,7 @@
 
     // The process of disconnecting descendant frames could have already
     // detached us.
-    if (!attached())
+    if (!isActive())
         return;
 
     if (DOMWindow* window = this->domWindow())
@@ -2079,16 +2060,6 @@
         node->removeAllEventListeners();
 }
 
-void Document::suspendActiveDOMObjects(ActiveDOMObject::ReasonForSuspension why)
-{
-    ScriptExecutionContext::suspendActiveDOMObjects(why);
-}
-
-void Document::resumeActiveDOMObjects()
-{
-    ScriptExecutionContext::resumeActiveDOMObjects();
-}
-
 void Document::clearAXObjectCache()
 {
     ASSERT(topDocument() == this);
@@ -2215,7 +2186,7 @@
     // We have to clear the parser to avoid possibly triggering
     // the onload handler when closing as a side effect of a cancel-style
     // change, such as opening a new document or closing the window while
-    // still parsing
+    // still parsing.
     detachParser();
     explicitClose();
 }
@@ -2453,7 +2424,7 @@
         return true;
     }
 
-    String text = displayStringModifiedByEncoding(beforeUnloadEvent->returnValue());
+    String text = beforeUnloadEvent->returnValue();
     if (chrome.runBeforeUnloadConfirmPanel(text, m_frame)) {
         navigatingDocument->m_didAllowNavigationViaBeforeUnloadConfirmationPanel = true;
         return true;
@@ -2473,7 +2444,7 @@
             toHTMLInputElement(currentFocusedElement)->endEditing();
         if (m_loadEventProgress < PageHideInProgress) {
             m_loadEventProgress = PageHideInProgress;
-            dispatchWindowEvent(PageTransitionEvent::create(eventNames().pagehideEvent, false), this);
+            dispatchWindowEvent(PageTransitionEvent::create(EventTypeNames::pagehide, false), this);
             if (!m_frame)
                 return;
 
@@ -2482,7 +2453,7 @@
             // time into freed memory.
             RefPtr<DocumentLoader> documentLoader =  m_frame->loader()->provisionalDocumentLoader();
             m_loadEventProgress = UnloadEventInProgress;
-            RefPtr<Event> unloadEvent(Event::create(eventNames().unloadEvent));
+            RefPtr<Event> unloadEvent(Event::create(EventTypeNames::unload));
             if (documentLoader && !documentLoader->timing()->unloadEventStart() && !documentLoader->timing()->unloadEventEnd()) {
                 DocumentLoadTiming* timing = documentLoader->timing();
                 ASSERT(timing->navigationStart());
@@ -2609,7 +2580,7 @@
 {
     Page* p = page();
     if (!p)
-        return ScriptExecutionContext::timerAlignmentInterval();
+        return ExecutionContext::timerAlignmentInterval();
     return p->timerAlignmentInterval();
 }
 
@@ -2700,7 +2671,7 @@
                     target = &value;
             }
             if (contentSecurityPolicy()->isActive())
-                UseCounter::count(this, UseCounter::ContentSecurityPolicyWithBaseElement);
+                UseCounter::count(*this, UseCounter::ContentSecurityPolicyWithBaseElement);
         }
     }
 
@@ -2952,148 +2923,35 @@
     }
 }
 
-static bool isInvalidSeparator(UChar c)
+void Document::setViewportDescription(const ViewportDescription& viewportDescription)
 {
-    return c == ';';
-}
-
-// Though isspace() considers \t and \v to be whitespace, Win IE doesn't.
-static bool isSeparator(UChar c)
-{
-    return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '=' || c == ',' || c == '\0';
-}
-
-void Document::processArguments(const String& features, void* data, ArgumentsCallback callback)
-{
-    bool error = false;
-
-    // Tread lightly in this code -- it was specifically designed to mimic Win IE's parsing behavior.
-    int keyBegin, keyEnd;
-    int valueBegin, valueEnd;
-
-    int i = 0;
-    int length = features.length();
-    String buffer = features.lower();
-    while (i < length) {
-        // skip to first non-separator, but don't skip past the end of the string
-        while (isSeparator(buffer[i])) {
-            if (i >= length)
-                break;
-            i++;
-        }
-        keyBegin = i;
-
-        // skip to first separator
-        while (!isSeparator(buffer[i])) {
-            error |= isInvalidSeparator(buffer[i]);
-            i++;
-        }
-        keyEnd = i;
-
-        // skip to first '=', but don't skip past a ',' or the end of the string
-        while (buffer[i] != '=') {
-            error |= isInvalidSeparator(buffer[i]);
-            if (buffer[i] == ',' || i >= length)
-                break;
-            i++;
-        }
-
-        // skip to first non-separator, but don't skip past a ',' or the end of the string
-        while (isSeparator(buffer[i])) {
-            if (buffer[i] == ',' || i >= length)
-                break;
-            i++;
-        }
-        valueBegin = i;
-
-        // skip to first separator
-        while (!isSeparator(buffer[i])) {
-            error |= isInvalidSeparator(buffer[i]);
-            i++;
-        }
-        valueEnd = i;
-
-        ASSERT_WITH_SECURITY_IMPLICATION(i <= length);
-
-        String keyString = buffer.substring(keyBegin, keyEnd - keyBegin);
-        String valueString = buffer.substring(valueBegin, valueEnd - valueBegin);
-        callback(keyString, valueString, this, data);
-    }
-    if (error) {
-        String message = "Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead.";
-        addConsoleMessage(RenderingMessageSource, WarningMessageLevel, message);
-    }
-}
-
-void Document::processViewport(const String& features, ViewportArguments::Type origin)
-{
-    ASSERT(!features.isNull());
-
-    if (!page() || !shouldOverrideLegacyViewport(origin))
-        return;
-
-    ViewportArguments newArgumentsFromLegacyTag(origin);
-    processArguments(features, (void*)&newArgumentsFromLegacyTag, &setViewportFeature);
-
-    if (newArgumentsFromLegacyTag.minZoom == ViewportArguments::ValueAuto)
-        newArgumentsFromLegacyTag.minZoom = 0.25;
-
-    if (newArgumentsFromLegacyTag.maxZoom == ViewportArguments::ValueAuto) {
-        newArgumentsFromLegacyTag.maxZoom = 5;
-        newArgumentsFromLegacyTag.minZoom = std::min(newArgumentsFromLegacyTag.minZoom, float(5));
-    }
-
-    const Settings& settings = document().page()->settings();
-
-    if (newArgumentsFromLegacyTag.maxWidth.isAuto()) {
-        if (newArgumentsFromLegacyTag.zoom == ViewportArguments::ValueAuto) {
-            newArgumentsFromLegacyTag.minWidth = Length(ExtendToZoom);
-            newArgumentsFromLegacyTag.maxWidth = Length(settings.layoutFallbackWidth(), Fixed);
-        } else if (newArgumentsFromLegacyTag.maxHeight.isAuto()) {
-            newArgumentsFromLegacyTag.minWidth = Length(ExtendToZoom);
-            newArgumentsFromLegacyTag.maxWidth = Length(ExtendToZoom);
-        }
-    }
-
-    if (settings.viewportMetaZeroValuesQuirk()
-        && newArgumentsFromLegacyTag.type == ViewportArguments::ViewportMeta
-        && newArgumentsFromLegacyTag.maxWidth.type() == ViewportPercentageWidth
-        && !static_cast<int>(newArgumentsFromLegacyTag.zoom)) {
-        newArgumentsFromLegacyTag.zoom = 1.0;
-    }
-
-    setViewportArguments(newArgumentsFromLegacyTag);
-}
-
-void Document::setViewportArguments(const ViewportArguments& viewportArguments)
-{
-    if (viewportArguments.isLegacyViewportType()) {
-        m_legacyViewportArguments = viewportArguments;
+    if (viewportDescription.isLegacyViewportType()) {
+        m_legacyViewportDescription = viewportDescription;
 
         // When no author style for @viewport is present, and a meta tag for defining
         // the viewport is, apply the meta tag viewport instead of the UA styles.
-        if (m_viewportArguments.type == ViewportArguments::AuthorStyleSheet)
+        if (m_viewportDescription.type == ViewportDescription::AuthorStyleSheet)
             return;
-        m_viewportArguments = viewportArguments;
+        m_viewportDescription = viewportDescription;
     } else {
         // If the legacy viewport tag has higher priority than the cascaded @viewport
         // descriptors, use the values from the legacy tag.
-        if (!shouldOverrideLegacyViewport(viewportArguments.type))
-            m_viewportArguments = m_legacyViewportArguments;
+        if (!shouldOverrideLegacyViewport(viewportDescription.type))
+            m_viewportDescription = m_legacyViewportDescription;
         else
-            m_viewportArguments = viewportArguments;
+            m_viewportDescription = viewportDescription;
     }
 
-    updateViewportArguments();
+    updateViewportDescription();
 }
 
-void Document::updateViewportArguments()
+void Document::updateViewportDescription()
 {
     if (page() && page()->mainFrame() == frame()) {
 #ifndef NDEBUG
         m_didDispatchViewportPropertiesChanged = true;
 #endif
-        page()->chrome().dispatchViewportPropertiesDidChange(m_viewportArguments);
+        page()->chrome().dispatchViewportPropertiesDidChange(m_viewportDescription);
     }
 }
 
@@ -3284,7 +3142,7 @@
 {
     // Don't bother updating, since we haven't loaded all our style info yet
     // and haven't calculated the style selector for the first time.
-    if (!attached() || (!m_didCalculateStyleResolver && !haveStylesheetsLoaded())) {
+    if (!isActive() || (!m_didCalculateStyleResolver && !haveStylesheetsLoaded())) {
         m_styleResolver.clear();
         return;
     }
@@ -3319,7 +3177,7 @@
     for (Frame* child = frame()->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
         Document* childDocument = child->document();
         if (childDocument->shouldDisplaySeamlesslyWithParent()) {
-            ASSERT(&childDocument->seamlessParentIFrame()->document() == this);
+            ASSERT(childDocument->seamlessParentIFrame()->document() == this);
             childDocument->seamlessParentUpdatedStylesheets();
         }
     }
@@ -3412,7 +3270,10 @@
     RefPtr<Element> newFocusedElement = prpNewFocusedElement;
 
     // Make sure newFocusedNode is actually in this document
-    if (newFocusedElement && (&newFocusedElement->document() != this))
+    if (newFocusedElement && (newFocusedElement->document() != this))
+        return true;
+
+    if (NodeChildRemovalTracker::isBeingRemoved(newFocusedElement.get()))
         return true;
 
     if (m_focusedElement == newFocusedElement)
@@ -3444,10 +3305,10 @@
             newFocusedElement = 0;
         }
 
-        oldFocusedElement->dispatchFocusOutEvent(eventNames().focusoutEvent, newFocusedElement.get()); // DOM level 3 name for the bubbling blur event.
+        oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, newFocusedElement.get()); // DOM level 3 name for the bubbling blur event.
         // FIXME: We should remove firing DOMFocusOutEvent event when we are sure no content depends
         // on it, probably when <rdar://problem/8503958> is resolved.
-        oldFocusedElement->dispatchFocusOutEvent(eventNames().DOMFocusOutEvent, newFocusedElement.get()); // DOM level 2 name for compatibility.
+        oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOut, newFocusedElement.get()); // DOM level 2 name for compatibility.
 
         if (m_focusedElement) {
             // handler shifted focus
@@ -3455,9 +3316,6 @@
             newFocusedElement = 0;
         }
 
-        if (oldFocusedElement->isRootEditableElement())
-            frame()->editor().didEndEditing();
-
         if (view()) {
             Widget* oldWidget = widgetForElement(oldFocusedElement.get());
             if (oldWidget)
@@ -3465,6 +3323,11 @@
             else
                 view()->setFocus(false);
         }
+
+        // Autofill client may have modified the value of newFocusedElement, thus require
+        // a layout update here, otherwise it will assert at newFocusedElement->isFocusable().
+        // See crbug.com/251163.
+        updateLayoutIgnorePendingStylesheets();
     }
 
     if (newFocusedElement && newFocusedElement->isFocusable()) {
@@ -3485,7 +3348,7 @@
             goto SetFocusedElementDone;
         }
 
-        m_focusedElement->dispatchFocusInEvent(eventNames().focusinEvent, oldFocusedElement.get()); // DOM level 3 bubbling focus event.
+        m_focusedElement->dispatchFocusInEvent(EventTypeNames::focusin, oldFocusedElement.get()); // DOM level 3 bubbling focus event.
 
         if (m_focusedElement != newFocusedElement) {
             // handler shifted focus
@@ -3495,7 +3358,7 @@
 
         // FIXME: We should remove firing DOMFocusInEvent event when we are sure no content depends
         // on it, probably when <rdar://problem/8503958> is m.
-        m_focusedElement->dispatchFocusInEvent(eventNames().DOMFocusInEvent, oldFocusedElement.get()); // DOM level 2 for compatibility.
+        m_focusedElement->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, oldFocusedElement.get()); // DOM level 2 for compatibility.
 
         if (m_focusedElement != newFocusedElement) {
             // handler shifted focus
@@ -3725,6 +3588,11 @@
     domWindow->dispatchEvent(event, target);
 }
 
+EventQueue* Document::eventQueue() const
+{
+    return m_eventQueue.get();
+}
+
 void Document::enqueueWindowEvent(PassRefPtr<Event> event)
 {
     event->setTarget(domWindow());
@@ -3737,6 +3605,14 @@
     m_eventQueue->enqueueEvent(event);
 }
 
+void Document::enqueueScrollEventForNode(Node* target)
+{
+    // Per the W3C CSSOM View Module only scroll events fired at the document should bubble.
+    RefPtr<Event> scrollEvent = target->isDocumentNode() ? Event::createBubble(EventTypeNames::scroll) : Event::create(EventTypeNames::scroll);
+    scrollEvent->setTarget(target);
+    ensureScriptedAnimationController().scheduleEvent(scrollEvent.release());
+}
+
 PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionState& es)
 {
     RefPtr<Event> event = EventFactory::create(eventType);
@@ -3764,37 +3640,38 @@
 
 void Document::addListenerTypeIfNeeded(const AtomicString& eventType)
 {
-    if (eventType == eventNames().DOMSubtreeModifiedEvent) {
-        UseCounter::count(this, UseCounter::DOMSubtreeModifiedEvent);
+    if (eventType == EventTypeNames::DOMSubtreeModified) {
+        UseCounter::count(*this, UseCounter::DOMSubtreeModifiedEvent);
         addMutationEventListenerTypeIfEnabled(DOMSUBTREEMODIFIED_LISTENER);
-    } else if (eventType == eventNames().DOMNodeInsertedEvent) {
-        UseCounter::count(this, UseCounter::DOMNodeInsertedEvent);
+    } else if (eventType == EventTypeNames::DOMNodeInserted) {
+        UseCounter::count(*this, UseCounter::DOMNodeInsertedEvent);
         addMutationEventListenerTypeIfEnabled(DOMNODEINSERTED_LISTENER);
-    } else if (eventType == eventNames().DOMNodeRemovedEvent) {
-        UseCounter::count(this, UseCounter::DOMNodeRemovedEvent);
+    } else if (eventType == EventTypeNames::DOMNodeRemoved) {
+        UseCounter::count(*this, UseCounter::DOMNodeRemovedEvent);
         addMutationEventListenerTypeIfEnabled(DOMNODEREMOVED_LISTENER);
-    } else if (eventType == eventNames().DOMNodeRemovedFromDocumentEvent) {
-        UseCounter::count(this, UseCounter::DOMNodeRemovedFromDocumentEvent);
+    } else if (eventType == EventTypeNames::DOMNodeRemovedFromDocument) {
+        UseCounter::count(*this, UseCounter::DOMNodeRemovedFromDocumentEvent);
         addMutationEventListenerTypeIfEnabled(DOMNODEREMOVEDFROMDOCUMENT_LISTENER);
-    } else if (eventType == eventNames().DOMNodeInsertedIntoDocumentEvent) {
-        UseCounter::count(this, UseCounter::DOMNodeInsertedIntoDocumentEvent);
+    } else if (eventType == EventTypeNames::DOMNodeInsertedIntoDocument) {
+        UseCounter::count(*this, UseCounter::DOMNodeInsertedIntoDocumentEvent);
         addMutationEventListenerTypeIfEnabled(DOMNODEINSERTEDINTODOCUMENT_LISTENER);
-    } else if (eventType == eventNames().DOMCharacterDataModifiedEvent) {
-        UseCounter::count(this, UseCounter::DOMCharacterDataModifiedEvent);
+    } else if (eventType == EventTypeNames::DOMCharacterDataModified) {
+        UseCounter::count(*this, UseCounter::DOMCharacterDataModifiedEvent);
         addMutationEventListenerTypeIfEnabled(DOMCHARACTERDATAMODIFIED_LISTENER);
-    } else if (eventType == eventNames().overflowchangedEvent) {
+    } else if (eventType == EventTypeNames::overflowchanged) {
         addListenerType(OVERFLOWCHANGED_LISTENER);
-    } else if (eventType == eventNames().webkitAnimationStartEvent || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == eventNames().animationstartEvent)) {
+    } else if (eventType == EventTypeNames::webkitAnimationStart || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == EventTypeNames::animationstart)) {
         addListenerType(ANIMATIONSTART_LISTENER);
-    } else if (eventType == eventNames().webkitAnimationEndEvent || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == eventNames().animationendEvent)) {
+    } else if (eventType == EventTypeNames::webkitAnimationEnd || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == EventTypeNames::animationend)) {
         addListenerType(ANIMATIONEND_LISTENER);
-    } else if (eventType == eventNames().webkitAnimationIterationEvent || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == eventNames().animationiterationEvent)) {
+    } else if (eventType == EventTypeNames::webkitAnimationIteration || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == EventTypeNames::animationiteration)) {
         addListenerType(ANIMATIONITERATION_LISTENER);
-    } else if (eventType == eventNames().webkitTransitionEndEvent || eventType == eventNames().transitionendEvent) {
+    } else if (eventType == EventTypeNames::webkitTransitionEnd || eventType == EventTypeNames::transitionend) {
         addListenerType(TRANSITIONEND_LISTENER);
-    } else if (eventType == eventNames().beforeloadEvent) {
+    } else if (eventType == EventTypeNames::beforeload) {
+        UseCounter::count(*this, UseCounter::BeforeLoadEvent);
         addListenerType(BEFORELOAD_LISTENER);
-    } else if (eventType == eventNames().scrollEvent) {
+    } else if (eventType == EventTypeNames::scroll) {
         addListenerType(SCROLL_LISTENER);
     }
 }
@@ -3813,7 +3690,7 @@
 
 String Document::cookie(ExceptionState& es) const
 {
-    if (page() && !page()->settings().cookieEnabled())
+    if (settings() && !settings()->cookieEnabled())
         return String();
 
     // FIXME: The HTML5 DOM spec states that this attribute can raise an
@@ -3840,7 +3717,7 @@
 
 void Document::setCookie(const String& value, ExceptionState& es)
 {
-    if (page() && !page()->settings().cookieEnabled())
+    if (settings() && !settings()->cookieEnabled())
         return;
 
     // FIXME: The HTML5 DOM spec states that this attribute can raise an
@@ -4235,7 +4112,7 @@
 void Document::applyXSLTransform(ProcessingInstruction* pi)
 {
     ASSERT(!pi->isLoading());
-    UseCounter::count(this, UseCounter::XSLProcessingInstruction);
+    UseCounter::count(*this, UseCounter::XSLProcessingInstruction);
     RefPtr<XSLTProcessor> processor = XSLTProcessor::create();
     processor->setXSLStyleSheet(static_cast<XSLStyleSheet*>(pi->sheet()));
     String resultMIMEType;
@@ -4390,7 +4267,7 @@
 
 PassRefPtr<HTMLCollection> Document::allForBinding()
 {
-    UseCounter::count(this, UseCounter::DocumentAll);
+    UseCounter::count(*this, UseCounter::DocumentAll);
     return all();
 }
 
@@ -4416,7 +4293,7 @@
     setParsing(false);
     if (!m_documentTiming.domContentLoadedEventStart)
         m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTime();
-    dispatchEvent(Event::createBubble(eventNames().DOMContentLoadedEvent));
+    dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded));
     if (!m_documentTiming.domContentLoadedEventEnd)
         m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime();
 
@@ -4459,23 +4336,11 @@
     m_sharedObjectPool.clear();
 }
 
-void Document::didAccessStyleResolver()
-{
-    static const int timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds = 60;
-    static const int holdOffTimeBeforeReschedulingTimerInSeconds = 5;
-
-    double currentTime = WTF::currentTime();
-
-    if (currentTime > m_lastStyleResolverAccessTime + holdOffTimeBeforeReschedulingTimerInSeconds) {
-        m_styleResolverThrowawayTimer.startOneShot(timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds);
-        m_lastStyleResolverAccessTime = currentTime;
-    }
-}
-
 void Document::styleResolverThrowawayTimerFired(Timer<Document>*)
 {
-    ASSERT(!m_inStyleRecalc);
-    clearStyleResolver();
+    if (m_styleResolverAccessCount == m_lastStyleResolverAccessCount)
+        clearStyleResolver();
+    m_lastStyleResolverAccessCount = m_styleResolverAccessCount;
 }
 
 const Vector<IconURL>& Document::shortcutIconURLs()
@@ -4643,7 +4508,7 @@
         return false;
     if (!m_frame->script()->canExecuteScripts(NotAboutToExecuteScript))
         return false;
-    if (node && &node->document() != this && !node->document().allowInlineEventHandlers(node, listener, contextURL, contextLine))
+    if (node && node->document() != this && !node->document().allowInlineEventHandlers(node, listener, contextURL, contextLine))
         return false;
 
     return true;
@@ -4808,14 +4673,14 @@
 struct PerformTaskContext {
     WTF_MAKE_NONCOPYABLE(PerformTaskContext); WTF_MAKE_FAST_ALLOCATED;
 public:
-    PerformTaskContext(WeakPtr<Document> document, PassOwnPtr<ScriptExecutionContext::Task> task)
+    PerformTaskContext(WeakPtr<Document> document, PassOwnPtr<ExecutionContextTask> task)
         : documentReference(document)
         , task(task)
     {
     }
 
     WeakPtr<Document> documentReference;
-    OwnPtr<ScriptExecutionContext::Task> task;
+    OwnPtr<ExecutionContextTask> task;
 };
 
 void Document::didReceiveTask(void* untypedContext)
@@ -4838,7 +4703,7 @@
     context->task->performTask(document);
 }
 
-void Document::postTask(PassOwnPtr<Task> task)
+void Document::postTask(PassOwnPtr<ExecutionContextTask> task)
 {
     callOnMainThread(didReceiveTask, new PerformTaskContext(m_weakFactory.createWeakPtr(), task));
 }
@@ -4846,18 +4711,18 @@
 void Document::pendingTasksTimerFired(Timer<Document>*)
 {
     while (!m_pendingTasks.isEmpty()) {
-        OwnPtr<Task> task = m_pendingTasks[0].release();
+        OwnPtr<ExecutionContextTask> task = m_pendingTasks[0].release();
         m_pendingTasks.remove(0);
         task->performTask(this);
     }
 }
 
-void Document::suspendScheduledTasks(ActiveDOMObject::ReasonForSuspension reason)
+void Document::suspendScheduledTasks()
 {
     ASSERT(!m_scheduledTasksAreSuspended);
 
     suspendScriptedAnimationControllerCallbacks();
-    suspendActiveDOMObjects(reason);
+    suspendActiveDOMObjects();
     scriptRunner()->suspend();
     m_pendingTasksTimer.stop();
     if (m_parser)
@@ -4893,35 +4758,10 @@
         m_scriptedAnimationController->resume();
 }
 
-String Document::displayStringModifiedByEncoding(const String& str) const
-{
-    if (m_decoder)
-        return m_decoder->encoding().displayString(str.impl());
-    return str;
-}
-
-PassRefPtr<StringImpl> Document::displayStringModifiedByEncoding(PassRefPtr<StringImpl> str) const
-{
-    if (m_decoder)
-        return m_decoder->encoding().displayString(str);
-    return str;
-}
-
-template <typename CharacterType>
-void Document::displayBufferModifiedByEncodingInternal(CharacterType* buffer, unsigned len) const
-{
-    if (m_decoder)
-        m_decoder->encoding().displayBuffer(buffer, len);
-}
-
-// Generate definitions for both character types
-template void Document::displayBufferModifiedByEncodingInternal<LChar>(LChar*, unsigned) const;
-template void Document::displayBufferModifiedByEncodingInternal<UChar>(UChar*, unsigned) const;
-
 void Document::enqueuePageshowEvent(PageshowEventPersistence persisted)
 {
     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=36334 Pageshow event needs to fire asynchronously.
-    dispatchWindowEvent(PageTransitionEvent::create(eventNames().pageshowEvent, persisted), this);
+    dispatchWindowEvent(PageTransitionEvent::create(EventTypeNames::pageshow, persisted), this);
 }
 
 void Document::enqueueHashchangeEvent(const String& oldURL, const String& newURL)
@@ -4976,7 +4816,7 @@
     if (!page())
         return;
     if (Element* target = page()->pointerLockController().element()) {
-        if (&target->document() != this)
+        if (target->document() != this)
             return;
     }
     page()->pointerLockController().requestPointerUnlock();
@@ -4987,7 +4827,7 @@
     if (!page() || page()->pointerLockController().lockPending())
         return 0;
     if (Element* element = page()->pointerLockController().element()) {
-        if (&element->document() == this)
+        if (element->document() == this)
             return element;
     }
     return 0;
@@ -5008,7 +4848,7 @@
         frame()->loader()->checkCompleted();
 }
 
-int Document::requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
+ScriptedAnimationController& Document::ensureScriptedAnimationController()
 {
     if (!m_scriptedAnimationController) {
         m_scriptedAnimationController = ScriptedAnimationController::create(this);
@@ -5016,8 +4856,12 @@
         if (!page())
             m_scriptedAnimationController->suspend();
     }
+    return *m_scriptedAnimationController;
+}
 
-    return m_scriptedAnimationController->registerCallback(callback);
+int Document::requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
+{
+    return ensureScriptedAnimationController().registerCallback(callback);
 }
 
 void Document::cancelAnimationFrame(int id)
@@ -5049,6 +4893,60 @@
     return TouchList::create(touches);
 }
 
+void Document::didAddTouchEventHandler(Node* handler)
+{
+    if (!m_touchEventTargets.get())
+        m_touchEventTargets = adoptPtr(new TouchEventTargetSet);
+    m_touchEventTargets->add(handler);
+    if (Document* parent = parentDocument()) {
+        parent->didAddTouchEventHandler(this);
+        return;
+    }
+    if (Page* page = this->page()) {
+        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+            scrollingCoordinator->touchEventTargetRectsDidChange(this);
+        if (m_touchEventTargets->size() == 1)
+            page->chrome().client().needTouchEvents(true);
+    }
+}
+
+void Document::didRemoveTouchEventHandler(Node* handler)
+{
+    if (!m_touchEventTargets.get())
+        return;
+    ASSERT(m_touchEventTargets->contains(handler));
+    m_touchEventTargets->remove(handler);
+    if (Document* parent = parentDocument()) {
+        parent->didRemoveTouchEventHandler(this);
+        return;
+    }
+
+    Page* page = this->page();
+    if (!page)
+        return;
+    if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+        scrollingCoordinator->touchEventTargetRectsDidChange(this);
+    if (m_touchEventTargets->size())
+        return;
+    for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+        if (frame->document() && frame->document()->hasTouchEventHandlers())
+            return;
+    }
+    page->chrome().client().needTouchEvents(false);
+}
+
+void Document::didRemoveEventTargetNode(Node* handler)
+{
+    if (m_touchEventTargets && !m_touchEventTargets->isEmpty()) {
+        if (handler == this)
+            m_touchEventTargets->clear();
+        else
+            m_touchEventTargets->removeAll(handler);
+        if (m_touchEventTargets->isEmpty() && parentDocument())
+            parentDocument()->didRemoveEventTargetNode(this);
+    }
+}
+
 void Document::resetLastHandledUserGestureTimestamp()
 {
     m_lastHandledUserGestureTimestamp = currentTime();
@@ -5174,7 +5072,7 @@
     ASSERT(!request.readOnly());
 
     Element* innerElementInDocument = innerElement;
-    while (innerElementInDocument && &innerElementInDocument->document() != this) {
+    while (innerElementInDocument && innerElementInDocument->document() != this) {
         innerElementInDocument->document().updateHoverActiveState(request, innerElementInDocument, event);
         innerElementInDocument = innerElementInDocument->document().ownerElement();
     }
@@ -5272,7 +5170,7 @@
     bool ancestorHasCapturingMouseleaveListener = false;
     if (event && newHoverNode != oldHoverNode.get()) {
         for (Node* node = oldHoverNode.get(); node; node = node->parentOrShadowHostNode()) {
-            if (node->hasCapturingEventListeners(eventNames().mouseleaveEvent)) {
+            if (node->hasCapturingEventListeners(EventTypeNames::mouseleave)) {
                 ancestorHasCapturingMouseleaveListener = true;
                 break;
             }
@@ -5282,14 +5180,14 @@
     size_t removeCount = nodesToRemoveFromChain.size();
     for (size_t i = 0; i < removeCount; ++i) {
         nodesToRemoveFromChain[i]->setHovered(false);
-        if (event && (ancestorHasCapturingMouseleaveListener || nodesToRemoveFromChain[i]->hasEventListeners(eventNames().mouseleaveEvent)))
-            nodesToRemoveFromChain[i]->dispatchMouseEvent(*event, eventNames().mouseleaveEvent, 0, newHoverNode);
+        if (event && (ancestorHasCapturingMouseleaveListener || nodesToRemoveFromChain[i]->hasEventListeners(EventTypeNames::mouseleave)))
+            nodesToRemoveFromChain[i]->dispatchMouseEvent(*event, EventTypeNames::mouseleave, 0, newHoverNode);
     }
 
     bool ancestorHasCapturingMouseenterListener = false;
     if (event && newHoverNode != oldHoverNode.get()) {
         for (Node* node = newHoverNode; node; node = node->parentOrShadowHostNode()) {
-            if (node->hasCapturingEventListeners(eventNames().mouseenterEvent)) {
+            if (node->hasCapturingEventListeners(EventTypeNames::mouseenter)) {
                 ancestorHasCapturingMouseenterListener = true;
                 break;
             }
@@ -5306,8 +5204,8 @@
             nodesToAddToChain[i]->setActive(true);
         if (!sawCommonAncestor) {
             nodesToAddToChain[i]->setHovered(true);
-            if (event && (ancestorHasCapturingMouseenterListener || nodesToAddToChain[i]->hasEventListeners(eventNames().mouseenterEvent)))
-                nodesToAddToChain[i]->dispatchMouseEvent(*event, eventNames().mouseenterEvent, 0, oldHoverNode.get());
+            if (event && (ancestorHasCapturingMouseenterListener || nodesToAddToChain[i]->hasEventListeners(EventTypeNames::mouseenter)))
+                nodesToAddToChain[i]->dispatchMouseEvent(*event, EventTypeNames::mouseenter, 0, oldHoverNode.get());
         }
     }
 
@@ -5323,7 +5221,7 @@
 {
     AtomicString localeKey = locale;
     if (locale.isEmpty() || !RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled())
-        localeKey = defaultLanguage();
+        return *Locale::defaultLocale();
     LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey, nullptr);
     if (result.isNewEntry)
         result.iterator->value = Locale::create(localeKey);
@@ -5389,7 +5287,7 @@
 
 DocumentLifecycleNotifier* Document::lifecycleNotifier()
 {
-    return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifecycleNotifier());
+    return static_cast<DocumentLifecycleNotifier*>(ExecutionContext::lifecycleNotifier());
 }
 
 } // namespace WebCore
diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h
index 5960a6c..ab46d36 100644
--- a/Source/core/dom/Document.h
+++ b/Source/core/dom/Document.h
@@ -30,25 +30,27 @@
 
 #include "bindings/v8/ScriptValue.h"
 #include "core/dom/ContainerNode.h"
-#include "core/dom/CustomElement.h"
 #include "core/dom/DOMTimeStamp.h"
-#include "core/events/DocumentEventQueue.h"
 #include "core/dom/DocumentInit.h"
+#include "core/dom/DocumentLifecycle.h"
+#include "core/dom/DocumentSupplementable.h"
 #include "core/dom/DocumentTiming.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/dom/IconURL.h"
 #include "core/dom/MutationObserver.h"
 #include "core/dom/QualifiedName.h"
-#include "core/dom/ScriptExecutionContext.h"
 #include "core/dom/TextLinkColors.h"
 #include "core/dom/TreeScope.h"
 #include "core/dom/UserActionElementSet.h"
-#include "core/dom/ViewportArguments.h"
+#include "core/dom/ViewportDescription.h"
+#include "core/dom/custom/CustomElement.h"
+#include "core/events/DocumentEventQueue.h"
 #include "core/html/CollectionType.h"
 #include "core/page/FocusDirection.h"
 #include "core/page/PageVisibilityState.h"
-#include "weborigin/ReferrerPolicy.h"
-#include "core/platform/Timer.h"
 #include "core/rendering/HitTestRequest.h"
+#include "platform/Timer.h"
+#include "weborigin/ReferrerPolicy.h"
 #include "wtf/HashSet.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
@@ -63,7 +65,6 @@
 class CSSStyleDeclaration;
 class CSSStyleSheet;
 class CSSStyleSheetResource;
-class ScriptResource;
 class CanvasRenderingContext;
 class CharacterData;
 class Chrome;
@@ -79,6 +80,7 @@
 class DOMWrapperWorld;
 class Database;
 class DatabaseThread;
+class DocumentEventQueue;
 class DocumentFragment;
 class DocumentLifecycleNotifier;
 class DocumentLifecycleObserver;
@@ -118,6 +120,7 @@
 class LayoutRect;
 class LiveNodeListBase;
 class Locale;
+class Location;
 class MediaQueryList;
 class MediaQueryMatcher;
 class MouseEventWithHitTestResults;
@@ -126,7 +129,6 @@
 class NodeIterator;
 class Page;
 class PlatformMouseEvent;
-class Prerenderer;
 class ProcessingInstruction;
 class Range;
 class RegisteredEventListener;
@@ -135,6 +137,7 @@
 class ResourceFetcher;
 class SVGDocumentExtensions;
 class ScriptElementData;
+class ScriptResource;
 class ScriptRunner;
 class ScriptableDocumentParser;
 class ScriptedAnimationController;
@@ -143,9 +146,9 @@
 class SelectorQueryCache;
 class SerializedScriptValue;
 class Settings;
+class StyleEngine;
 class StyleResolver;
 class StyleSheet;
-class StyleEngine;
 class StyleSheetContents;
 class StyleSheetList;
 class Text;
@@ -191,6 +194,8 @@
 };
 const int numNodeListInvalidationTypes = InvalidateOnAnyAttrChange + 1;
 
+typedef HashCountedSet<Node*> TouchEventTargetSet;
+
 enum DocumentClass {
     DefaultDocumentClass = 0,
     HTMLDocumentClass = 1,
@@ -203,7 +208,7 @@
 
 typedef unsigned char DocumentClassFlags;
 
-class Document : public ContainerNode, public TreeScope, public ScriptExecutionContext {
+class Document : public ContainerNode, public TreeScope, public ExecutionContext, public ExecutionContextClient, public DocumentSupplementable {
 public:
     static PassRefPtr<Document> create(const DocumentInit& initializer = DocumentInit())
     {
@@ -284,13 +289,13 @@
     DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitvisibilitychange);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(securitypolicyviolation);
 
-    bool shouldOverrideLegacyViewport(ViewportArguments::Type);
-    void setViewportArguments(const ViewportArguments&);
-    const ViewportArguments& viewportArguments() const { return m_viewportArguments; }
+    bool shouldOverrideLegacyViewport(ViewportDescription::Type);
+    void setViewportDescription(const ViewportDescription&);
+    const ViewportDescription& viewportDescription() const { return m_viewportDescription; }
 #ifndef NDEBUG
     bool didDispatchViewportPropertiesChanged() const { return m_didDispatchViewportPropertiesChanged; }
 #endif
-    bool hasLegacyViewportTag() const { return m_legacyViewportArguments.isLegacyViewportType(); }
+    bool hasLegacyViewportTag() const { return m_legacyViewportDescription.isLegacyViewportType(); }
 
     void setReferrerPolicy(ReferrerPolicy referrerPolicy) { m_referrerPolicy = referrerPolicy; }
     ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; }
@@ -307,6 +312,8 @@
 
     bool hasManifest() const;
 
+    Location* location() const;
+
     PassRefPtr<Element> createElement(const AtomicString& name, ExceptionState&);
     PassRefPtr<DocumentFragment> createDocumentFragment();
     PassRefPtr<Text> createTextNode(const String& data);
@@ -320,7 +327,6 @@
     PassRefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionState&);
     PassRefPtr<Element> createElement(const QualifiedName&, bool createdByParser);
 
-    bool cssStickyPositionEnabled() const;
     bool cssCompositingEnabled() const;
     PassRefPtr<DOMNamedFlowCollection> webkitGetNamedFlows();
 
@@ -451,8 +457,9 @@
     void removedStyleSheet(StyleSheet*, StyleResolverUpdateType type = RecalcStyleDeferred) { styleResolverChanged(type); }
     void addedStyleSheet(StyleSheet*, StyleResolverUpdateType type = RecalcStyleDeferred) { styleResolverChanged(type); }
     void modifiedStyleSheet(StyleSheet*, StyleResolverUpdateType type = RecalcStyleDeferred) { styleResolverChanged(type); }
+    void changedSelectorWatch() { styleResolverChanged(RecalcStyleDeferred); }
 
-    void didAccessStyleResolver();
+    void didAccessStyleResolver() { ++m_styleResolverAccessCount; }
 
     void evaluateMediaQueryList();
 
@@ -512,21 +519,9 @@
     virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
     void prepareForDestruction();
 
-    // Override ScriptExecutionContext methods to do additional work
-    virtual void suspendActiveDOMObjects(ActiveDOMObject::ReasonForSuspension) OVERRIDE;
-    virtual void resumeActiveDOMObjects() OVERRIDE;
-
-    // Implemented in RenderView.h to avoid a cyclic header dependency this just
-    // returns renderer so callers can avoid verbose casts.
-    RenderView* renderView() const;
-
-    // Shadow the implementations on Node to provide faster access for documents.
-    RenderObject* renderer() const { return m_renderer; }
-    void setRenderer(RenderObject* renderer)
-    {
-        m_renderer = renderer;
-        Node::setRenderer(renderer);
-    }
+    // FIXME: We should make renderer() private and all callers should use renderView().
+    RenderView* renderView() const { return m_renderView; }
+    void clearRenderView() { m_renderView = 0; }
 
     AXObjectCache* existingAXObjectCache() const;
     AXObjectCache* axObjectCache() const;
@@ -585,7 +580,6 @@
     KURL completeURL(const String&, const KURL& baseURLOverride) const;
 
     virtual String userAgent(const KURL&) const;
-
     virtual void disableEval(const String& errorMessage);
 
     bool canNavigate(Frame* targetFrame);
@@ -651,11 +645,6 @@
     void setNeedsFocusedElementCheck();
     void didRunCheckFocusedElementTask() { m_didPostCheckFocusedElementTask = false; }
 
-    // The m_ignoreAutofocus flag specifies whether or not the document has been changed by the user enough
-    // for WebCore to ignore the autofocus attribute on any form controls
-    bool ignoreAutofocus() const { return m_ignoreAutofocus; };
-    void setIgnoreAutofocus(bool shouldIgnore = true) { m_ignoreAutofocus = shouldIgnore; };
-
     void setHoverNode(PassRefPtr<Node>);
     Node* hoverNode() const { return m_hoverNode.get(); }
 
@@ -755,8 +744,8 @@
      * @param content The header value (value of the meta tag's "content" attribute)
      */
     void processHttpEquiv(const String& equiv, const String& content);
-    void processViewport(const String& features, ViewportArguments::Type origin);
-    void updateViewportArguments();
+    void processViewport(const String& features, ViewportDescription::Type origin);
+    void updateViewportDescription();
     void processReferrerPolicy(const String& policy);
 
     // Returns the owning element in the parent document.
@@ -882,7 +871,7 @@
     bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; }
     void parseDNSPrefetchControlHeader(const String&);
 
-    virtual void postTask(PassOwnPtr<Task>); // Executes the task on context's thread asynchronously.
+    virtual void postTask(PassOwnPtr<ExecutionContextTask>); // Executes the task on context's thread asynchronously.
 
     void suspendScriptedAnimationControllerCallbacks();
     void resumeScriptedAnimationControllerCallbacks();
@@ -897,17 +886,6 @@
     void setEncoding(const WTF::TextEncoding&);
     const WTF::TextEncoding& encoding() const { return m_encoding; }
 
-    String displayStringModifiedByEncoding(const String&) const;
-    PassRefPtr<StringImpl> displayStringModifiedByEncoding(PassRefPtr<StringImpl>) const;
-    void displayBufferModifiedByEncoding(LChar* buffer, unsigned len) const
-    {
-        displayBufferModifiedByEncodingInternal(buffer, len);
-    }
-    void displayBufferModifiedByEncoding(UChar* buffer, unsigned len) const
-    {
-        displayBufferModifiedByEncodingInternal(buffer, len);
-    }
-
     void setAnnotatedRegionsDirty(bool f) { m_annotatedRegionsDirty = f; }
     bool annotatedRegionsDirty() const { return m_annotatedRegionsDirty; }
     bool hasAnnotatedRegions () const { return m_hasAnnotatedRegions; }
@@ -955,7 +933,7 @@
     void enqueuePageshowEvent(PageshowEventPersistence);
     void enqueueHashchangeEvent(const String& oldURL, const String& newURL);
     void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject);
-    virtual DocumentEventQueue* eventQueue() const { return m_eventQueue.get(); }
+    void enqueueScrollEventForNode(Node*);
 
     const QualifiedName& idAttributeName() const { return m_idAttributeName; }
 
@@ -987,15 +965,22 @@
     double lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; }
     void resetLastHandledUserGestureTimestamp();
 
+    bool hasTouchEventHandlers() const { return (m_touchEventTargets.get()) ? m_touchEventTargets->size() : false; }
+
+    void didAddTouchEventHandler(Node*);
+    void didRemoveTouchEventHandler(Node*);
+
+    void didRemoveEventTargetNode(Node*);
+
+    const TouchEventTargetSet* touchEventTargets() const { return m_touchEventTargets.get(); }
+
     bool isInDocumentWrite() { return m_writeRecursionDepth > 0; }
 
-    void suspendScheduledTasks(ActiveDOMObject::ReasonForSuspension);
+    void suspendScheduledTasks();
     void resumeScheduledTasks();
 
     IntSize initialViewportSize() const;
 
-    Prerenderer* prerenderer() { return m_prerenderer.get(); }
-
     TextAutosizer* textAutosizer() { return m_textAutosizer.get(); }
 
     PassRefPtr<Element> createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState&);
@@ -1053,6 +1038,8 @@
 
     PassRefPtr<FontFaceSet> fonts();
     DocumentLifecycleNotifier* lifecycleNotifier();
+    bool isActive() const { return m_lifecyle.state() == DocumentLifecycle::Active; }
+    bool isStopping() const { return m_lifecyle.state() == DocumentLifecycle::Stopping; }
 
     enum HttpRefreshType {
         HttpRefreshFromHeader,
@@ -1073,13 +1060,13 @@
     friend class Node;
     friend class IgnoreDestructiveWriteCountIncrementer;
 
+    ScriptedAnimationController& ensureScriptedAnimationController();
+    virtual EventQueue* eventQueue() const FINAL;
+
     void updateDistributionIfNeeded();
 
     void detachParser();
 
-    typedef void (*ArgumentsCallback)(const String& keyString, const String& valueString, Document*, void* data);
-    void processArguments(const String& features, void* data, ArgumentsCallback);
-
     virtual bool isDocument() const OVERRIDE { return true; }
 
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
@@ -1089,11 +1076,11 @@
     virtual bool childTypeAllowed(NodeType) const;
     virtual PassRefPtr<Node> cloneNode(bool deep = true);
 
-    virtual void refScriptExecutionContext() { ref(); }
-    virtual void derefScriptExecutionContext() { deref(); }
+    virtual void refExecutionContext() { ref(); }
+    virtual void derefExecutionContext() { deref(); }
     virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE;
 
-    virtual const KURL& virtualURL() const; // Same as url(), but needed for ScriptExecutionContext to implement it without a performance loss for direct calls.
+    virtual const KURL& virtualURL() const; // Same as url(), but needed for ExecutionContext to implement it without a performance loss for direct calls.
     virtual KURL virtualCompleteURL(const String&) const; // Same as completeURL() for the same reason as above.
 
     virtual void addMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, ScriptState*);
@@ -1121,9 +1108,6 @@
 
     static void didReceiveTask(void*);
 
-    template <typename CharacterType>
-    void displayBufferModifiedByEncodingInternal(CharacterType*, unsigned) const;
-
     PageVisibilityState visibilityState() const;
 
     PassRefPtr<HTMLCollection> ensureCachedCollection(CollectionType);
@@ -1145,8 +1129,12 @@
     void processHttpEquivXFrameOptions(const String& content);
     void processHttpEquivContentSecurityPolicy(const String& equiv, const String& content);
 
+    DocumentLifecycle m_lifecyle;
+
+    // FIXME: This should probably be handled inside the style resolver itself.
     Timer<Document> m_styleResolverThrowawayTimer;
-    double m_lastStyleResolverAccessTime;
+    unsigned m_styleResolverAccessCount;
+    unsigned m_lastStyleResolverAccessCount;
 
     OwnPtr<StyleResolver> m_styleResolver;
     bool m_didCalculateStyleResolver;
@@ -1197,8 +1185,6 @@
     bool m_printing;
     bool m_paginatedForScreen;
 
-    bool m_ignoreAutofocus;
-
     CompatibilityMode m_compatibilityMode;
     bool m_compatibilityModeLocked; // This is cheaper than making setCompatibilityMode virtual.
 
@@ -1305,7 +1291,7 @@
     bool m_isSrcdocDocument;
     bool m_isMobileDocument;
 
-    RenderObject* m_renderer;
+    RenderView* m_renderView;
     RefPtr<DocumentEventQueue> m_eventQueue;
 
     WeakPtrFactory<Document> m_weakFactory;
@@ -1320,8 +1306,8 @@
     int m_loadEventDelayCount;
     Timer<Document> m_loadEventDelayTimer;
 
-    ViewportArguments m_viewportArguments;
-    ViewportArguments m_legacyViewportArguments;
+    ViewportDescription m_viewportDescription;
+    ViewportDescription m_legacyViewportDescription;
 
     ReferrerPolicy m_referrerPolicy;
 
@@ -1335,14 +1321,14 @@
     bool m_writeRecursionIsTooDeep;
     unsigned m_writeRecursionDepth;
 
+    OwnPtr<TouchEventTargetSet> m_touchEventTargets;
+
     double m_lastHandledUserGestureTimestamp;
 
     RefPtr<ScriptedAnimationController> m_scriptedAnimationController;
 
     Timer<Document> m_pendingTasksTimer;
-    Vector<OwnPtr<Task> > m_pendingTasks;
-
-    OwnPtr<Prerenderer> m_prerenderer;
+    Vector<OwnPtr<ExecutionContextTask> > m_pendingTasks;
 
     OwnPtr<TextAutosizer> m_textAutosizer;
 
@@ -1392,40 +1378,35 @@
     return m_templateDocument.get();
 }
 
-inline bool Document::shouldOverrideLegacyViewport(ViewportArguments::Type origin)
+inline bool Document::shouldOverrideLegacyViewport(ViewportDescription::Type origin)
 {
     // The different (legacy) meta tags have different priorities based on the type
     // regardless of which order they appear in the DOM. The priority is given by the
-    // ViewportArguments::Type enum.
-    return origin >= m_legacyViewportArguments.type;
+    // ViewportDescription::Type enum.
+    return origin >= m_legacyViewportDescription.type;
 }
 
-inline Document* toDocument(ScriptExecutionContext* scriptExecutionContext)
+inline Document* toDocument(ExecutionContext* executionContext)
 {
-    ASSERT_WITH_SECURITY_IMPLICATION(!scriptExecutionContext || scriptExecutionContext->isDocument());
-    return static_cast<Document*>(scriptExecutionContext);
+    ASSERT_WITH_SECURITY_IMPLICATION(!executionContext || executionContext->isDocument());
+    return static_cast<Document*>(executionContext);
 }
 
-inline const Document* toDocument(const ScriptExecutionContext* scriptExecutionContext)
+inline const Document* toDocument(const ExecutionContext* executionContext)
 {
-    ASSERT_WITH_SECURITY_IMPLICATION(!scriptExecutionContext || scriptExecutionContext->isDocument());
-    return static_cast<const Document*>(scriptExecutionContext);
+    ASSERT_WITH_SECURITY_IMPLICATION(!executionContext || executionContext->isDocument());
+    return static_cast<const Document*>(executionContext);
 }
 
-inline Document* toDocument(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isDocumentNode());
-    return static_cast<Document*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(Document, isDocumentNode());
 
-inline const Document* toDocument(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isDocumentNode());
-    return static_cast<const Document*>(node);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toDocument(const Document*);
+// All these varations are needed to avoid ambiguous overloads with the Node and TreeScope versions.
+inline bool operator==(const Document& a, const Document& b) { return &a == &b; }
+inline bool operator==(const Document& a, const Document* b) { return &a == b; }
+inline bool operator==(const Document* a, const Document& b) { return a == &b; }
+inline bool operator!=(const Document& a, const Document& b) { return !(a == b); }
+inline bool operator!=(const Document& a, const Document* b) { return !(a == b); }
+inline bool operator!=(const Document* a, const Document& b) { return !(a == b); }
 
 // Put these methods here, because they require the Document definition, but we really want to inline them.
 
diff --git a/Source/core/dom/Document.idl b/Source/core/dom/Document.idl
index a18606d..a310a4b 100644
--- a/Source/core/dom/Document.idl
+++ b/Source/core/dom/Document.idl
@@ -21,7 +21,7 @@
 callback CustomElementConstructor = Element ();
 
 [
-    CustomToV8
+    SpecialWrapFor=HTMLDocument|SVGDocument
 ] interface Document : Node {
 
     // DOM Level 1 Core
@@ -29,7 +29,7 @@
     readonly attribute DOMImplementation implementation;
     readonly attribute Element documentElement;
 
-    [CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Element createElement([TreatNullAs=NullString,Default=Undefined] optional DOMString tagName);
+    [CustomElementCallbacks, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, RaisesException] Element createElement([TreatNullAs=NullString,Default=Undefined] optional DOMString tagName);
     DocumentFragment   createDocumentFragment();
     [PerWorldBindings] Text createTextNode([Default=Undefined] optional DOMString data);
     Comment createComment([Default=Undefined] optional DOMString data);
@@ -41,9 +41,9 @@
 
     // Introduced in DOM Level 2:
 
-    [CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Node importNode([Default=Undefined] optional Node importedNode,
+    [CustomElementCallbacks, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, RaisesException] Node importNode([Default=Undefined] optional Node importedNode,
                     optional boolean deep);
-    [CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Element createElementNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
+    [CustomElementCallbacks, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, RaisesException] Element createElementNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                             [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName);
     [RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                                                                   [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName); // Removed from DOM4.
@@ -59,7 +59,7 @@
     [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, SetterRaisesException, MeasureAs=DocumentXMLVersion] attribute DOMString xmlVersion; // Removed from DOM4.
     [SetterRaisesException, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4.
 
-    [RaisesException, CustomElementCallbacks=Enable] Node               adoptNode([Default=Undefined] optional Node source);
+    [RaisesException, CustomElementCallbacks] Node               adoptNode([Default=Undefined] optional Node source);
 
     [TreatReturnedNullStringAs=Null] readonly attribute DOMString documentURI;
 
@@ -98,7 +98,7 @@
                                                         [Default=Undefined] optional DOMString pseudoElement);
 
     // Common extensions
-    [CustomElementCallbacks=Enable]
+    [CustomElementCallbacks]
     boolean            execCommand([Default=Undefined] optional DOMString command,
                                    [Default=Undefined] optional boolean userInterface,
                                    [TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString value);
@@ -111,14 +111,14 @@
 
     // Moved down from HTMLDocument
 
-             [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString title;
+             [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title;
     readonly attribute DOMString referrer;
              [TreatNullAs=NullString, SetterRaisesException] attribute DOMString domain;
     readonly attribute DOMString URL;
 
              [TreatNullAs=NullString, GetterRaisesException, SetterRaisesException] attribute DOMString cookie;
 
-             [SetterRaisesException, CustomElementCallbacks=Enable] attribute HTMLElement body;
+             [SetterRaisesException, CustomElementCallbacks] attribute HTMLElement body;
 
     readonly attribute HTMLHeadElement head;
     readonly attribute HTMLCollection images;
@@ -130,7 +130,7 @@
 
     [PerWorldBindings] NodeList getElementsByName([Default=Undefined] optional DOMString elementName);
 
-    [Custom, Replaceable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] readonly attribute Location location;
+    [PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, PutForwards=href] readonly attribute Location location;
 
     // IE extensions
     [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset;
@@ -165,41 +165,41 @@
     void webkitExitPointerLock();
     readonly attribute Element webkitPointerLockElement;
 
-    [EnabledAtRuntime=CSSRegions] WebKitNamedFlowCollection webkitGetNamedFlows();
+    [RuntimeEnabled=CSSRegions] WebKitNamedFlowCollection webkitGetNamedFlows();
 
-    [EnabledAtRuntime=FontLoadEvents] readonly attribute FontFaceSet fonts;
+    [RuntimeEnabled=FontLoadEvents] readonly attribute FontFaceSet fonts;
 
     // Event handler DOM attributes
     [NotEnumerable] attribute EventHandler onabort;
     [NotEnumerable] attribute EventHandler onblur;
     [NotEnumerable] attribute EventHandler onchange;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onclick;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onclick;
     [NotEnumerable] attribute EventHandler oncontextmenu;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondblclick;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondrag;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragend;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragenter;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragleave;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragover;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragstart;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondrop;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondblclick;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondrag;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondragend;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondragenter;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondragleave;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondragover;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondragstart;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondrop;
     [NotEnumerable] attribute EventHandler onerror;
     [NotEnumerable] attribute EventHandler onfocus;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler oninput;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler oninput;
     [NotEnumerable] attribute EventHandler oninvalid;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeydown;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeypress;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeyup;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onkeydown;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onkeypress;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onkeyup;
     [NotEnumerable] attribute EventHandler onload;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousedown;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseenter;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseleave;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousemove;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseout;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseover;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseup;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousewheel; // Deprecated in favor of onwheel.
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onwheel;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmousedown;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmouseenter;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmouseleave;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmousemove;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmouseout;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmouseover;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmouseup;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmousewheel; // Deprecated in favor of onwheel.
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onwheel;
     [NotEnumerable] attribute EventHandler onreadystatechange;
     [NotEnumerable] attribute EventHandler onscroll;
     [NotEnumerable] attribute EventHandler onselect;
@@ -238,17 +238,17 @@
     [NotEnumerable] attribute EventHandler onsearch;
     [NotEnumerable] attribute EventHandler onselectstart;
     [NotEnumerable] attribute EventHandler onselectionchange;
-    [NotEnumerable, EnabledAtRuntime=Touch] attribute EventHandler ontouchstart;
-    [NotEnumerable, EnabledAtRuntime=Touch] attribute EventHandler ontouchmove;
-    [NotEnumerable, EnabledAtRuntime=Touch] attribute EventHandler ontouchend;
-    [NotEnumerable, EnabledAtRuntime=Touch] attribute EventHandler ontouchcancel;
+    [NotEnumerable, RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
+    [NotEnumerable, RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
+    [NotEnumerable, RuntimeEnabled=Touch] attribute EventHandler ontouchend;
+    [NotEnumerable, RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
     [NotEnumerable] attribute EventHandler onwebkitfullscreenchange;
     [NotEnumerable] attribute EventHandler onwebkitfullscreenerror;
     [NotEnumerable] attribute EventHandler onwebkitpointerlockchange;
     [NotEnumerable] attribute EventHandler onwebkitpointerlockerror;
-    [NotEnumerable, EnabledAtRuntime=ExperimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation;
+    [NotEnumerable, RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation;
 
-    [EnabledAtRuntime=Touch] Touch createTouch([Default=Undefined] optional Window window,
+    [RuntimeEnabled=Touch] Touch createTouch([Default=Undefined] optional Window window,
                                                [Default=Undefined] optional EventTarget target,
                                                [Default=Undefined] optional long identifier,
                                                [Default=Undefined] optional long pageX,
@@ -259,12 +259,12 @@
                                                [Default=Undefined] optional long webkitRadiusY,
                                                [Default=Undefined] optional float webkitRotationAngle,
                                                [Default=Undefined] optional float webkitForce);
-    [EnabledAtRuntime=Touch] TouchList createTouchList(Touch... touches);
+    [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches);
 
-    [DeprecateAs=PrefixedDocumentRegister, EnabledAtRuntime=CustomElements, ImplementedAs=registerElement, CallWith=ScriptState, CustomElementCallbacks=Enable, RaisesException] CustomElementConstructor webkitRegister(DOMString name, optional Dictionary options);
-    [EnabledAtRuntime=CustomElements, ImplementedAs=registerElement, CallWith=ScriptState, CustomElementCallbacks=Enable, RaisesException] CustomElementConstructor register(DOMString name, optional Dictionary options);
-    [CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Element createElement(DOMString localName, [TreatNullAs=NullString] DOMString typeExtension);
-    [CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Element createElementNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName,
+    [DeprecateAs=PrefixedDocumentRegister, RuntimeEnabled=CustomElements, ImplementedAs=registerElement, CallWith=ScriptState, CustomElementCallbacks, RaisesException] CustomElementConstructor webkitRegister(DOMString name, optional Dictionary options);
+    [RuntimeEnabled=CustomElements, ImplementedAs=registerElement, CallWith=ScriptState, CustomElementCallbacks, RaisesException] CustomElementConstructor register(DOMString name, optional Dictionary options);
+    [CustomElementCallbacks, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, RaisesException] Element createElement(DOMString localName, [TreatNullAs=NullString] DOMString typeExtension);
+    [CustomElementCallbacks, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, RaisesException] Element createElementNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName,
                             [TreatNullAs=NullString] DOMString typeExtension);
 
     // Page visibility API.
@@ -272,7 +272,7 @@
     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 SecurityPolicy securityPolicy;
+    [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] readonly attribute SecurityPolicy securityPolicy;
 
     readonly attribute HTMLScriptElement currentScript;
 };
diff --git a/Source/core/dom/DocumentFragment.h b/Source/core/dom/DocumentFragment.h
index ed8a76a..4730abc 100644
--- a/Source/core/dom/DocumentFragment.h
+++ b/Source/core/dom/DocumentFragment.h
@@ -29,7 +29,7 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class DocumentFragment : public ContainerNode {
 public:
@@ -51,17 +51,7 @@
     virtual bool childTypeAllowed(NodeType) const;
 };
 
-inline DocumentFragment* toDocumentFragment(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->nodeType() == Node::DOCUMENT_FRAGMENT_NODE);
-    return static_cast<DocumentFragment*>(node);
-}
-
-inline const DocumentFragment* toDocumentFragment(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->nodeType() == Node::DOCUMENT_FRAGMENT_NODE);
-    return static_cast<const DocumentFragment*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(DocumentFragment, nodeType() == Node::DOCUMENT_FRAGMENT_NODE);
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/DocumentFullscreen.idl b/Source/core/dom/DocumentFullscreen.idl
index 3081eac..561ad80 100644
--- a/Source/core/dom/DocumentFullscreen.idl
+++ b/Source/core/dom/DocumentFullscreen.idl
@@ -20,13 +20,13 @@
  */
 partial interface Document {
     // Mozilla version
-    [EnabledAtRuntime=Fullscreen] readonly attribute boolean webkitIsFullScreen;
-    [EnabledAtRuntime=Fullscreen] readonly attribute boolean webkitFullScreenKeyboardInputAllowed;
-    [EnabledAtRuntime=Fullscreen] readonly attribute Element webkitCurrentFullScreenElement;
-    [EnabledAtRuntime=Fullscreen] void webkitCancelFullScreen();
+    [RuntimeEnabled=Fullscreen] readonly attribute boolean webkitIsFullScreen;
+    [RuntimeEnabled=Fullscreen] readonly attribute boolean webkitFullScreenKeyboardInputAllowed;
+    [RuntimeEnabled=Fullscreen] readonly attribute Element webkitCurrentFullScreenElement;
+    [RuntimeEnabled=Fullscreen] void webkitCancelFullScreen();
 
     // W3C version
-    [EnabledAtRuntime=Fullscreen] readonly attribute boolean webkitFullscreenEnabled;
-    [EnabledAtRuntime=Fullscreen] readonly attribute Element webkitFullscreenElement;
-    [EnabledAtRuntime=Fullscreen] void webkitExitFullscreen();
+    [RuntimeEnabled=Fullscreen] readonly attribute boolean webkitFullscreenEnabled;
+    [RuntimeEnabled=Fullscreen] readonly attribute Element webkitFullscreenElement;
+    [RuntimeEnabled=Fullscreen] void webkitExitFullscreen();
 };
diff --git a/Source/core/dom/DocumentInit.cpp b/Source/core/dom/DocumentInit.cpp
index ba30041..a52dfd3 100644
--- a/Source/core/dom/DocumentInit.cpp
+++ b/Source/core/dom/DocumentInit.cpp
@@ -29,10 +29,10 @@
 #include "core/dom/DocumentInit.h"
 
 #include "RuntimeEnabledFeatures.h"
-#include "core/dom/CustomElementRegistrationContext.h"
 #include "core/dom/Document.h"
+#include "core/dom/custom/CustomElementRegistrationContext.h"
 #include "core/html/HTMLImportsController.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/DocumentLifecycle.cpp b/Source/core/dom/DocumentLifecycle.cpp
new file mode 100644
index 0000000..157548f
--- /dev/null
+++ b/Source/core/dom/DocumentLifecycle.cpp
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/dom/DocumentLifecycle.h"
+
+#include "wtf/Assertions.h"
+
+namespace WebCore {
+
+DocumentLifecycle::DocumentLifecycle()
+    : m_state(Uninitialized)
+{
+}
+
+DocumentLifecycle::~DocumentLifecycle()
+{
+}
+
+void DocumentLifecycle::advanceTo(State state)
+{
+    // FIXME: We can dispose a document multiple times. This seems wrong.
+    // See https://code.google.com/p/chromium/issues/detail?id=301668.
+    ASSERT(state > m_state || (state == Disposed && m_state == Disposed));
+    m_state = state;
+}
+
+}
diff --git a/Source/core/dom/DocumentLifecycle.h b/Source/core/dom/DocumentLifecycle.h
new file mode 100644
index 0000000..c3f9196
--- /dev/null
+++ b/Source/core/dom/DocumentLifecycle.h
@@ -0,0 +1,63 @@
+/*
+ * 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 DocumentLifecycle_h
+#define DocumentLifecycle_h
+
+#include "wtf/Noncopyable.h"
+
+namespace WebCore {
+
+class DocumentLifecycle {
+    WTF_MAKE_NONCOPYABLE(DocumentLifecycle);
+public:
+    enum State {
+        Uninitialized,
+        Inactive,
+        Active,
+        Stopping,
+        Stopped,
+        Disposed,
+    };
+
+    DocumentLifecycle();
+    ~DocumentLifecycle();
+
+    State state() const { return m_state; }
+
+    void advanceTo(State);
+
+private:
+    State m_state;
+};
+
+}
+
+#endif
diff --git a/Source/core/dom/DocumentLifecycleNotifier.cpp b/Source/core/dom/DocumentLifecycleNotifier.cpp
new file mode 100644
index 0000000..ddf28a2
--- /dev/null
+++ b/Source/core/dom/DocumentLifecycleNotifier.cpp
@@ -0,0 +1,60 @@
+/*
+ * 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:
+ * 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/dom/DocumentLifecycleNotifier.h"
+
+#include "core/dom/Document.h"
+#include "wtf/Assertions.h"
+
+namespace WebCore {
+
+DocumentLifecycleNotifier::DocumentLifecycleNotifier(ExecutionContext* context)
+    : ContextLifecycleNotifier(context)
+{
+}
+
+void DocumentLifecycleNotifier::addObserver(LifecycleObserver* observer)
+{
+    if (observer->observerType() == LifecycleObserver::DocumentLifecycleObserverType) {
+        RELEASE_ASSERT(m_iterating != IteratingOverDocumentObservers);
+        m_documentObservers.add(static_cast<DocumentLifecycleObserver*>(observer));
+    }
+
+    ContextLifecycleNotifier::addObserver(observer);
+}
+
+void DocumentLifecycleNotifier::removeObserver(LifecycleObserver* observer)
+{
+    if (observer->observerType() == LifecycleObserver::DocumentLifecycleObserverType) {
+        RELEASE_ASSERT(m_iterating != IteratingOverDocumentObservers);
+        m_documentObservers.remove(static_cast<DocumentLifecycleObserver*>(observer));
+    }
+
+    ContextLifecycleNotifier::removeObserver(observer);
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/DocumentLifecycleNotifier.h b/Source/core/dom/DocumentLifecycleNotifier.h
new file mode 100644
index 0000000..6c730eb
--- /dev/null
+++ b/Source/core/dom/DocumentLifecycleNotifier.h
@@ -0,0 +1,74 @@
+/*
+ * 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:
+ * 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 DocumentLifecycleNotifier_h
+#define DocumentLifecycleNotifier_h
+
+#include "core/dom/ContextLifecycleNotifier.h"
+#include "core/dom/DocumentLifecycleObserver.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/TemporaryChange.h"
+
+namespace WebCore {
+
+class DocumentLifecycleNotifier : public ContextLifecycleNotifier {
+public:
+    static PassOwnPtr<DocumentLifecycleNotifier> create(ExecutionContext*);
+
+    void notifyDocumentWasDetached();
+    void notifyDocumentWasDisposed();
+
+    virtual void addObserver(LifecycleObserver*) OVERRIDE;
+    virtual void removeObserver(LifecycleObserver*) OVERRIDE;
+
+private:
+    explicit DocumentLifecycleNotifier(ExecutionContext*);
+
+    typedef HashSet<DocumentLifecycleObserver*> DocumentObserverSet;
+    DocumentObserverSet m_documentObservers;
+};
+
+inline PassOwnPtr<DocumentLifecycleNotifier> DocumentLifecycleNotifier::create(ExecutionContext* context)
+{
+    return adoptPtr(new DocumentLifecycleNotifier(context));
+}
+
+inline void DocumentLifecycleNotifier::notifyDocumentWasDetached()
+{
+    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDocumentObservers);
+    for (DocumentObserverSet::iterator i = m_documentObservers.begin(); i != m_documentObservers.end(); ++i)
+        (*i)->documentWasDetached();
+}
+
+inline void DocumentLifecycleNotifier::notifyDocumentWasDisposed()
+{
+    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDocumentObservers);
+    for (DocumentObserverSet::iterator i = m_documentObservers.begin(); i != m_documentObservers.end(); ++i)
+        (*i)->documentWasDisposed();
+}
+
+} // namespace WebCore
+
+#endif // DocumentLifecycleNotifier_h
diff --git a/Source/core/dom/DocumentLifecycleObserver.cpp b/Source/core/dom/DocumentLifecycleObserver.cpp
index 497d2ea..413d1ce 100644
--- a/Source/core/dom/DocumentLifecycleObserver.cpp
+++ b/Source/core/dom/DocumentLifecycleObserver.cpp
@@ -40,29 +40,4 @@
 {
 }
 
-DocumentLifecycleNotifier::DocumentLifecycleNotifier(ScriptExecutionContext* context)
-    : ContextLifecycleNotifier(context)
-{
-}
-
-void DocumentLifecycleNotifier::addObserver(LifecycleObserver* observer)
-{
-    if (observer->observerType() == LifecycleObserver::DocumentLifecycleObserverType) {
-        RELEASE_ASSERT(m_iterating != IteratingOverDocumentObservers);
-        m_documentObservers.add(static_cast<DocumentLifecycleObserver*>(observer));
-    }
-
-    ContextLifecycleNotifier::addObserver(observer);
-}
-
-void DocumentLifecycleNotifier::removeObserver(LifecycleObserver* observer)
-{
-    if (observer->observerType() == LifecycleObserver::DocumentLifecycleObserverType) {
-        RELEASE_ASSERT(m_iterating != IteratingOverDocumentObservers);
-        m_documentObservers.remove(static_cast<DocumentLifecycleObserver*>(observer));
-    }
-
-    ContextLifecycleNotifier::removeObserver(observer);
-}
-
 } // namespace WebCore
diff --git a/Source/core/dom/DocumentLifecycleObserver.h b/Source/core/dom/DocumentLifecycleObserver.h
index 6838e68..3005f72 100644
--- a/Source/core/dom/DocumentLifecycleObserver.h
+++ b/Source/core/dom/DocumentLifecycleObserver.h
@@ -28,9 +28,6 @@
 
 #include "core/dom/ContextLifecycleNotifier.h"
 #include "core/dom/ContextLifecycleObserver.h"
-#include "wtf/Assertions.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/TemporaryChange.h"
 
 namespace WebCore {
 
@@ -42,53 +39,8 @@
     virtual ~DocumentLifecycleObserver();
     virtual void documentWasDetached() { }
     virtual void documentWasDisposed() { }
-    virtual void documentBeingDestroyed() { }
 };
 
-class DocumentLifecycleNotifier : public ContextLifecycleNotifier {
-public:
-    static PassOwnPtr<DocumentLifecycleNotifier> create(ScriptExecutionContext*);
-
-    void notifyDocumentWasDetached();
-    void notifyDocumentWasDisposed();
-    void notifyDocumentBeingDestroyed();
-
-    virtual void addObserver(LifecycleObserver*) OVERRIDE;
-    virtual void removeObserver(LifecycleObserver*) OVERRIDE;
-
-private:
-    explicit DocumentLifecycleNotifier(ScriptExecutionContext*);
-
-    typedef HashSet<DocumentLifecycleObserver*> DocumentObserverSet;
-    DocumentObserverSet m_documentObservers;
-};
-
-inline PassOwnPtr<DocumentLifecycleNotifier> DocumentLifecycleNotifier::create(ScriptExecutionContext* context)
-{
-    return adoptPtr(new DocumentLifecycleNotifier(context));
-}
-
-inline void DocumentLifecycleNotifier::notifyDocumentWasDetached()
-{
-    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDocumentObservers);
-    for (DocumentObserverSet::iterator i = m_documentObservers.begin(); i != m_documentObservers.end(); ++i)
-        (*i)->documentWasDetached();
-}
-
-inline void DocumentLifecycleNotifier::notifyDocumentWasDisposed()
-{
-    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDocumentObservers);
-    for (DocumentObserverSet::iterator i = m_documentObservers.begin(); i != m_documentObservers.end(); ++i)
-        (*i)->documentWasDisposed();
-}
-
-inline void DocumentLifecycleNotifier::notifyDocumentBeingDestroyed()
-{
-    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDocumentObservers);
-    for (DocumentObserverSet::iterator i = m_documentObservers.begin(); i != m_documentObservers.end(); ++i)
-        (*i)->documentBeingDestroyed();
-}
-
 } // namespace WebCore
 
 #endif // DocumentLifecycleObserver_h
diff --git a/Source/core/dom/DocumentMarker.h b/Source/core/dom/DocumentMarker.h
index 32bf502..ded6b9d 100644
--- a/Source/core/dom/DocumentMarker.h
+++ b/Source/core/dom/DocumentMarker.h
@@ -42,13 +42,15 @@
         SpellingMarkerIndex = 0,
         GramarMarkerIndex,
         TextMatchMarkerIndex,
+        InvisibleSpellcheckMarkerIndex,
         MarkerTypeIndexesCount
     };
 
     enum MarkerType {
         Spelling = 1 << SpellingMarkerIndex,
         Grammar = 1 << GramarMarkerIndex,
-        TextMatch = 1 << TextMatchMarkerIndex
+        TextMatch = 1 << TextMatchMarkerIndex,
+        InvisibleSpellcheck = 1 << InvisibleSpellcheckMarkerIndex
     };
 
     class MarkerTypes {
@@ -70,7 +72,7 @@
     class AllMarkers : public MarkerTypes {
     public:
         AllMarkers()
-            : MarkerTypes(Spelling | Grammar | TextMatch)
+            : MarkerTypes(Spelling | Grammar | TextMatch | InvisibleSpellcheck)
         {
         }
     };
@@ -83,6 +85,14 @@
         }
     };
 
+    class SpellCheckClientMarkers : public MarkerTypes {
+    public:
+        SpellCheckClientMarkers()
+            : MarkerTypes(Spelling | Grammar | InvisibleSpellcheck)
+        {
+        }
+    };
+
     DocumentMarker();
     DocumentMarker(MarkerType, unsigned startOffset, unsigned endOffset);
     DocumentMarker(MarkerType, unsigned startOffset, unsigned endOffset, const String& description);
diff --git a/Source/core/dom/DocumentMarkerController.cpp b/Source/core/dom/DocumentMarkerController.cpp
index eb23578..554c511 100644
--- a/Source/core/dom/DocumentMarkerController.cpp
+++ b/Source/core/dom/DocumentMarkerController.cpp
@@ -51,6 +51,8 @@
         return DocumentMarker::GramarMarkerIndex;
     case DocumentMarker::TextMatch:
         return DocumentMarker::TextMatchMarkerIndex;
+    case DocumentMarker::InvisibleSpellcheck:
+        return DocumentMarker::InvisibleSpellcheckMarkerIndex;
     }
 
     ASSERT_NOT_REACHED();
diff --git a/Source/core/dom/DocumentMarkerController.h b/Source/core/dom/DocumentMarkerController.h
index d7da987..97e5d37 100644
--- a/Source/core/dom/DocumentMarkerController.h
+++ b/Source/core/dom/DocumentMarkerController.h
@@ -28,7 +28,7 @@
 #define DocumentMarkerController_h
 
 #include "core/dom/DocumentMarker.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
 #include "wtf/HashMap.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/dom/DocumentStyleSheetCollection.cpp b/Source/core/dom/DocumentStyleSheetCollection.cpp
index c4e18a9..95d2c79 100644
--- a/Source/core/dom/DocumentStyleSheetCollection.cpp
+++ b/Source/core/dom/DocumentStyleSheetCollection.cpp
@@ -28,6 +28,7 @@
 #include "core/dom/DocumentStyleSheetCollection.h"
 
 #include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
 #include "SVGNames.h"
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/resolver/StyleResolver.h"
@@ -48,7 +49,7 @@
 DocumentStyleSheetCollection::DocumentStyleSheetCollection(TreeScope& treeScope)
     : StyleSheetCollection(treeScope)
 {
-    ASSERT(treeScope.rootNode() == &treeScope.rootNode()->document());
+    ASSERT(treeScope.rootNode() == treeScope.rootNode()->document());
 }
 
 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets)
@@ -67,7 +68,7 @@
             // We don't support linking to embedded CSS stylesheets, see <https://bugs.webkit.org/show_bug.cgi?id=49281> for discussion.
             ProcessingInstruction* pi = toProcessingInstruction(n);
             // Don't apply XSL transforms to already transformed documents -- <rdar://problem/4132806>
-            if (pi->isXSL() && !document()->transformSourceDocument()) {
+            if (RuntimeEnabledFeatures::xsltEnabled() && pi->isXSL() && !document()->transformSourceDocument()) {
                 // Don't apply XSL transforms until loading is finished.
                 if (!document()->parsing() && !pi->isLoading())
                     document()->applyXSLTransform(pi);
diff --git a/Source/core/dom/DocumentSupplementable.h b/Source/core/dom/DocumentSupplementable.h
new file mode 100644
index 0000000..9b5e779
--- /dev/null
+++ b/Source/core/dom/DocumentSupplementable.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ *           (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2013 Google Inc. 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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DocumentSupplementable_h
+#define DocumentSupplementable_h
+
+#include "platform/Supplementable.h"
+
+namespace WebCore {
+
+class Document;
+
+typedef Supplementable<Document> DocumentSupplementable;
+typedef Supplement<Document> DocumentSupplement;
+
+} // namespace WebCore
+
+#endif // DocumentSupplementable_h
diff --git a/Source/core/dom/DocumentType.h b/Source/core/dom/DocumentType.h
index 7da8ac8..6aa51fe 100644
--- a/Source/core/dom/DocumentType.h
+++ b/Source/core/dom/DocumentType.h
@@ -64,17 +64,7 @@
     String m_subset;
 };
 
-inline DocumentType* toDocumentType(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->nodeType() == Node::DOCUMENT_TYPE_NODE);
-    return static_cast<DocumentType*>(node);
-}
-
-inline const DocumentType* toDocumentType(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->nodeType() == Node::DOCUMENT_TYPE_NODE);
-    return static_cast<const DocumentType*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(DocumentType, nodeType() == Node::DOCUMENT_TYPE_NODE);
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 7d79c45..8be89e5 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -44,17 +44,14 @@
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/Attr.h"
 #include "core/dom/Attribute.h"
+#include "core/dom/CSSSelectorWatch.h"
 #include "core/dom/ClientRect.h"
 #include "core/dom/ClientRectList.h"
-#include "core/dom/CustomElement.h"
-#include "core/dom/CustomElementRegistrationContext.h"
 #include "core/dom/DatasetDOMStringMap.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentSharedObjectPool.h"
 #include "core/dom/ElementRareData.h"
-#include "core/events/EventDispatcher.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/events/FocusEvent.h"
 #include "core/dom/FullscreenElementStack.h"
 #include "core/dom/MutationObserverInterestGroup.h"
 #include "core/dom/MutationRecord.h"
@@ -66,11 +63,16 @@
 #include "core/dom/ScriptableDocumentParser.h"
 #include "core/dom/SelectorQuery.h"
 #include "core/dom/Text.h"
+#include "core/dom/WhitespaceChildList.h"
+#include "core/dom/custom/CustomElement.h"
+#include "core/dom/custom/CustomElementRegistrationContext.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"
+#include "core/events/EventDispatcher.h"
+#include "core/events/FocusEvent.h"
 #include "core/html/ClassList.h"
 #include "core/html/HTMLCollection.h"
 #include "core/html/HTMLDocument.h"
@@ -81,10 +83,10 @@
 #include "core/html/HTMLOptionsCollection.h"
 #include "core/html/HTMLTableRowsCollection.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/PointerLockController.h"
 #include "core/rendering/FlowThreadController.h"
@@ -589,7 +591,7 @@
     document().updateStyleForNodeIfNeeded(this);
 
     if (RenderBox* renderer = renderBox()) {
-        if (!renderer->requiresLayoutToDetermineWidth())
+        if (renderer->canDetermineWidthWithoutLayout())
             return adjustLayoutUnitForAbsoluteZoom(renderer->fixedOffsetWidth(), renderer).round();
     }
 
@@ -685,6 +687,17 @@
 int Element::scrollLeft()
 {
     document().updateLayoutIgnorePendingStylesheets();
+
+    if (document().documentElement() == this) {
+        if (document().inQuirksMode())
+            return 0;
+
+        if (FrameView* view = document().view()) {
+            if (RenderView* renderView = document().renderView())
+                return adjustForAbsoluteZoom(view->scrollX(), renderView);
+        }
+    }
+
     if (RenderBox* rend = renderBox())
         return adjustForAbsoluteZoom(rend->scrollLeft(), rend);
     return 0;
@@ -693,6 +706,17 @@
 int Element::scrollTop()
 {
     document().updateLayoutIgnorePendingStylesheets();
+
+    if (document().documentElement() == this) {
+        if (document().inQuirksMode())
+            return 0;
+
+        if (FrameView* view = document().view()) {
+            if (RenderView* renderView = document().renderView())
+                return adjustForAbsoluteZoom(view->scrollY(), renderView);
+        }
+    }
+
     if (RenderBox* rend = renderBox())
         return adjustForAbsoluteZoom(rend->scrollTop(), rend);
     return 0;
@@ -701,6 +725,27 @@
 void Element::setScrollLeft(int newLeft)
 {
     document().updateLayoutIgnorePendingStylesheets();
+
+    if (document().documentElement() == this) {
+        if (document().inQuirksMode())
+            return;
+
+        Frame* frame = document().frame();
+        if (!frame)
+            return;
+        FrameView* view = frame->view();
+        if (!view)
+            return;
+
+        // WHATWG spec says [1]: "If the element is the root element invoke scroll()
+        // with x as first argument and zero as second". Blink intentionally matches
+        // other engine's behaviors here, instead, where the 'y' scroll position is
+        // preversed. See [2].
+        // [1] http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft
+        // [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23448
+        view->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZoomFactor()), view->scrollY()));
+    }
+
     if (RenderBox* rend = renderBox())
         rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZoom()));
 }
@@ -708,6 +753,27 @@
 void Element::setScrollTop(int newTop)
 {
     document().updateLayoutIgnorePendingStylesheets();
+
+    if (document().documentElement() == this) {
+        if (document().inQuirksMode())
+            return;
+
+        Frame* frame = document().frame();
+        if (!frame)
+            return;
+        FrameView* view = frame->view();
+        if (!view)
+            return;
+
+        // WHATWG spec says [1]: "If the element is the root element invoke scroll()
+        // with zero as first argument and y as second". Blink intentionally
+        // matches other engine's behaviors here, instead, where the 'x' scroll
+        // position is preversed. See [2].
+        // [1] http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop
+        // [2] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23448
+        view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(newTop * frame->pageZoomFactor())));
+    }
+
     if (RenderBox* rend = renderBox())
         rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoom()));
 }
@@ -917,7 +983,7 @@
     document().incDOMTreeVersion();
 
     StyleResolver* styleResolver = document().styleResolverIfExists();
-    bool testShouldInvalidateStyle = attached() && styleResolver && styleChangeType() < SubtreeStyleChange;
+    bool testShouldInvalidateStyle = confusingAndOftenMisusedAttached() && styleResolver && styleChangeType() < SubtreeStyleChange;
     bool shouldInvalidateStyle = false;
 
     if (isStyledElement() && name == styleAttr) {
@@ -1032,7 +1098,7 @@
 void Element::classAttributeChanged(const AtomicString& newClassString)
 {
     StyleResolver* styleResolver = document().styleResolverIfExists();
-    bool testShouldInvalidateStyle = attached() && styleResolver && styleChangeType() < SubtreeStyleChange;
+    bool testShouldInvalidateStyle = confusingAndOftenMisusedAttached() && styleResolver && styleChangeType() < SubtreeStyleChange;
     bool shouldInvalidateStyle = false;
 
     if (classStringHasClassName(newClassString)) {
@@ -1238,7 +1304,7 @@
         CustomElement::didEnterDocument(this, document());
 
     TreeScope& scope = insertionPoint->treeScope();
-    if (&scope != &treeScope())
+    if (scope != treeScope())
         return InsertionDone;
 
     const AtomicString& idValue = getIdAttribute();
@@ -1282,7 +1348,7 @@
 
     setSavedLayerScrollOffset(IntSize());
 
-    if (insertionPoint->isInTreeScope() && &treeScope() == &document()) {
+    if (insertionPoint->isInTreeScope() && treeScope() == document()) {
         const AtomicString& idValue = getIdAttribute();
         if (!idValue.isNull())
             updateId(insertionPoint->treeScope(), idValue, nullAtom);
@@ -1319,7 +1385,7 @@
 
     // We've already been through detach when doing a lazyAttach, but we might
     // need to clear any state that's been added since then.
-    if (hasRareData() && styleChangeType() == LazyAttachStyleChange) {
+    if (hasRareData() && styleChangeType() == NeedsReattachStyleChange) {
         ElementRareData* data = elementRareData();
         data->clearComputedStyle();
         data->resetDynamicRestyleObservations();
@@ -1329,6 +1395,9 @@
 
     NodeRenderingContext(this, context.resolvedStyle).createRendererForElementIfNeeded();
 
+    if (RenderStyle* style = renderStyle())
+        updateCallbackSelectors(0, style);
+
     createPseudoElementIfNeeded(BEFORE);
 
     // When a shadow root exists, it does the work of attaching the children.
@@ -1363,9 +1432,13 @@
 
 void Element::detach(const AttachContext& context)
 {
-    WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
+    RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates;
     unregisterNamedFlowContentNode();
     cancelFocusAppearanceUpdate();
+    if (RenderStyle* style = renderStyle()) {
+        if (!style->callbackSelectors().isEmpty())
+            updateCallbackSelectors(style, 0);
+    }
     if (hasRareData()) {
         ElementRareData* data = elementRareData();
         data->setPseudoElement(BEFORE, 0);
@@ -1446,18 +1519,21 @@
 {
     ASSERT(document().inStyleRecalc());
 
-    if (hasCustomStyleCallbacks())
-        willRecalcStyle(change);
-
     if (hasRareData() && (change > NoChange || needsStyleRecalc())) {
         ElementRareData* data = elementRareData();
         data->resetStyleState();
         data->clearComputedStyle();
     }
 
-    // Active InsertionPoints have no renderers so they never need to go through a recalc.
-    if ((change >= Inherit || needsStyleRecalc()) && parentRenderStyle() && !isActiveInsertionPoint(this))
-        change = recalcOwnStyle(change);
+    if ((change >= Inherit || needsStyleRecalc()) && parentRenderStyle()) {
+        if (hasCustomStyleCallbacks())
+            willRecalcStyle(change);
+        // Active InsertionPoints have no renderers so they never need to go through a recalc.
+        if (!isActiveInsertionPoint(this))
+            change = recalcOwnStyle(change);
+        if (hasCustomStyleCallbacks())
+            didRecalcStyle(change);
+    }
 
     // If we reattached we don't need to recalc the style of our descendants anymore.
     if (change < Reattach)
@@ -1466,12 +1542,21 @@
     clearNeedsStyleRecalc();
     clearChildNeedsStyleRecalc();
 
-    if (hasCustomStyleCallbacks())
-        didRecalcStyle(change);
-
     return change == Reattach;
 }
 
+static bool callbackSelectorsDiffer(RenderStyle* style1, RenderStyle* style2)
+{
+    const Vector<String> emptyVector;
+    const Vector<String>& callbackSelectors1 = style1 ? style1->callbackSelectors() : emptyVector;
+    const Vector<String>& callbackSelectors2 = style2 ? style2->callbackSelectors() : emptyVector;
+    if (callbackSelectors1.isEmpty() && callbackSelectors2.isEmpty()) {
+        // Help the inliner with this common case.
+        return false;
+    }
+    return callbackSelectors1 != callbackSelectors2;
+}
+
 StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change)
 {
     ASSERT(document().inStyleRecalc());
@@ -1490,6 +1575,9 @@
 
     InspectorInstrumentation::didRecalculateStyleForElement(this);
 
+    if (localChange != NoChange && callbackSelectorsDiffer(oldStyle.get(), newStyle.get()))
+        updateCallbackSelectors(oldStyle.get(), newStyle.get());
+
     if (RenderObject* renderer = this->renderer()) {
         if (localChange != NoChange || pseudoStyleCacheIsInvalid(oldStyle.get(), newStyle.get()) || (change == Force && renderer->requiresForcedStyleRecalcPropagation()) || shouldNotifyRendererWithIdenticalStyles()) {
             renderer->setAnimatableStyle(newStyle.get());
@@ -1537,40 +1625,47 @@
     bool hasIndirectAdjacentRules = childrenAffectedByForwardPositionalRules();
     bool forceCheckOfNextElementSibling = false;
     bool forceCheckOfAnyElementSibling = false;
-    bool forceReattachOfAnyWhitespaceSibling = false;
-    for (Node* child = firstChild(); child; child = child->nextSibling()) {
-        bool didReattach = false;
-
-        if (child->renderer())
-            forceReattachOfAnyWhitespaceSibling = false;
-
-        if (child->isTextNode()) {
-            if (forceReattachOfAnyWhitespaceSibling && toText(child)->containsOnlyWhitespace())
-                child->reattach();
-            else
-                didReattach = toText(child)->recalcTextStyle(change);
-        } else if (child->isElementNode()) {
+    if (hasDirectAdjacentRules || hasIndirectAdjacentRules) {
+        for (Node* child = firstChild(); child; child = child->nextSibling()) {
+            if (!child->isElementNode())
+                continue;
             Element* element = toElement(child);
-
             bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() >= SubtreeStyleChange;
-
             if (forceCheckOfNextElementSibling || forceCheckOfAnyElementSibling)
                 element->setNeedsStyleRecalc();
-
             forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules;
             forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childRulesChanged && hasIndirectAdjacentRules);
-
+        }
+    }
+    // This loop is deliberately backwards because we use insertBefore in the rendering tree, and want to avoid
+    // a potentially n^2 loop to find the insertion point while resolving style. Having us start from the last
+    // child and work our way back means in the common case, we'll find the insertion point in O(1) time.
+    // Reversing this loop can lead to non-deterministic results in our code to optimize out empty whitespace
+    // RenderTexts. We try to put off recalcing their style until the end to avoid this issue.
+    // See crbug.com/288225
+    WhitespaceChildList whitespaceChildList(change);
+    for (Node* child = lastChild(); child; child = child->previousSibling()) {
+        if (child->isTextNode()) {
+            Text* textChild = toText(child);
+            // FIXME: This check is expensive and may negate the performance gained by the optimization of
+            // avoiding whitespace renderers.
+            if (textChild->containsOnlyWhitespace())
+                whitespaceChildList.append(textChild);
+            else
+                textChild->recalcTextStyle(change);
+        } else if (child->isElementNode()) {
+            Element* element = toElement(child);
             if (shouldRecalcStyle(change, element)) {
                 parentPusher.push();
-                didReattach = element->recalcStyle(change);
+                element->recalcStyle(change);
             } else if (document().styleResolver()->supportsStyleSharing(element)) {
                 document().styleResolver()->addToStyleSharingList(element);
             }
         }
-
-        forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyWhitespaceSibling;
     }
 
+    whitespaceChildList.recalcStyle();
+
     if (shouldRecalcStyle(change, this)) {
         updatePseudoElement(AFTER, change);
         updatePseudoElement(BACKDROP, change);
@@ -1675,7 +1770,7 @@
 static void checkForSiblingStyleChanges(Element* e, RenderStyle* style, bool finishedParsingCallback,
                                         Node* beforeChange, Node* afterChange, int childCountDelta)
 {
-    if (!e->attached() || e->document().hasPendingForcedStyleRecalc() || e->styleChangeType() >= SubtreeStyleChange)
+    if (!e->confusingAndOftenMisusedAttached() || e->document().hasPendingForcedStyleRecalc() || e->styleChangeType() >= SubtreeStyleChange)
         return;
 
     // :empty selector.
@@ -1740,7 +1835,7 @@
     // The + selector.  We need to invalidate the first element following the insertion point.  It is the only possible element
     // that could be affected by this DOM change.
     if (e->childrenAffectedByDirectAdjacentRules() && afterChange) {
-        if (Node* firstElementAfterInsertion = afterChange->nextElementSibling())
+        if (Node* firstElementAfterInsertion = afterChange->isElementNode() ? afterChange : afterChange->nextElementSibling())
             firstElementAfterInsertion->setNeedsStyleRecalc();
     }
 }
@@ -1865,7 +1960,7 @@
         return 0;
     }
 
-    ASSERT(&document() == &attr->document());
+    ASSERT(document() == attr->document());
 
     synchronizeAttribute(attr->qualifiedName());
 
@@ -2055,11 +2150,8 @@
 
         // FIXME: We should restore the previous selection if there is one.
         VisibleSelection newSelection = VisibleSelection(firstPositionInOrBeforeNode(this), DOWNSTREAM);
-
-        if (frame->selection().shouldChangeSelection(newSelection)) {
-            frame->selection().setSelection(newSelection);
-            frame->selection().revealSelection();
-        }
+        frame->selection().setSelection(newSelection);
+        frame->selection().revealSelection();
     } else if (renderer() && !renderer()->isWidget())
         renderer()->scrollRectToVisible(boundingBox());
 }
@@ -2093,27 +2185,27 @@
 
 void Element::dispatchFocusEvent(Element* oldFocusedElement, FocusDirection)
 {
-    RefPtr<FocusEvent> event = FocusEvent::create(eventNames().focusEvent, false, false, document().defaultView(), 0, oldFocusedElement);
+    RefPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::focus, false, false, document().defaultView(), 0, oldFocusedElement);
     EventDispatcher::dispatchEvent(this, FocusEventDispatchMediator::create(event.release()));
 }
 
 void Element::dispatchBlurEvent(Element* newFocusedElement)
 {
-    RefPtr<FocusEvent> event = FocusEvent::create(eventNames().blurEvent, false, false, document().defaultView(), 0, newFocusedElement);
+    RefPtr<FocusEvent> event = FocusEvent::create(EventTypeNames::blur, false, false, document().defaultView(), 0, newFocusedElement);
     EventDispatcher::dispatchEvent(this, BlurEventDispatchMediator::create(event.release()));
 }
 
 void Element::dispatchFocusInEvent(const AtomicString& eventType, Element* oldFocusedElement)
 {
     ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
-    ASSERT(eventType == eventNames().focusinEvent || eventType == eventNames().DOMFocusInEvent);
+    ASSERT(eventType == EventTypeNames::focusin || eventType == EventTypeNames::DOMFocusIn);
     dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document().defaultView(), 0, oldFocusedElement)));
 }
 
 void Element::dispatchFocusOutEvent(const AtomicString& eventType, Element* newFocusedElement)
 {
     ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
-    ASSERT(eventType == eventNames().focusoutEvent || eventType == eventNames().DOMFocusOutEvent);
+    ASSERT(eventType == EventTypeNames::focusout || eventType == EventTypeNames::DOMFocusOut);
     dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(FocusEvent::create(eventType, true, false, document().defaultView(), 0, newFocusedElement)));
 }
 
@@ -2222,7 +2314,7 @@
             return usedStyle;
     }
 
-    if (!attached())
+    if (!confusingAndOftenMisusedAttached())
         // FIXME: Try to do better than this. Ensure that styleForElement() works for elements that are not in the
         // document tree and figure out when to destroy the computed style for such elements.
         return 0;
@@ -2434,6 +2526,15 @@
         document().cancelFocusAppearanceUpdate();
 }
 
+void Element::updateCallbackSelectors(RenderStyle* oldStyle, RenderStyle* newStyle)
+{
+    const Vector<String> emptyVector;
+    const Vector<String>& oldCallbackSelectors = oldStyle ? oldStyle->callbackSelectors() : emptyVector;
+    const Vector<String>& newCallbackSelectors = newStyle ? newStyle->callbackSelectors() : emptyVector;
+
+    CSSSelectorWatch::from(document()).updateSelectorMatches(oldCallbackSelectors, newCallbackSelectors);
+}
+
 void Element::normalizeAttributes()
 {
     if (!hasAttributes())
@@ -2831,7 +2932,7 @@
     }
 
     if (oldValue != newValue) {
-        if (attached() && hasSelectorForAttribute(&document(), name.localName()))
+        if (confusingAndOftenMisusedAttached() && hasSelectorForAttribute(&document(), name.localName()))
            setNeedsStyleRecalc();
 
         if (isUpgradedCustomElement())
@@ -2865,14 +2966,14 @@
     dispatchSubtreeModifiedEvent();
 }
 
-void Element::didMoveToNewDocument(Document* oldDocument)
+void Element::didMoveToNewDocument(Document& oldDocument)
 {
     Node::didMoveToNewDocument(oldDocument);
 
     // If the documents differ by quirks mode then they differ by case sensitivity
     // for class and id names so we need to go through the attribute change logic
     // to pick up the new casing in the ElementData.
-    if (oldDocument->inQuirksMode() != document().inQuirksMode()) {
+    if (oldDocument.inQuirksMode() != document().inQuirksMode()) {
         if (hasID())
             setIdAttribute(getIdAttribute());
         if (hasClass())
@@ -3397,7 +3498,7 @@
         style = cacheIterator->value->value;
         presentationAttributeCacheCleaner().didHitPresentationAttributeCache();
     } else {
-        style = MutableStylePropertySet::create(isSVGElement() ? SVGAttributeMode : CSSQuirksMode);
+        style = MutableStylePropertySet::create(isSVGElement() ? SVGAttributeMode : CSSAttributeMode);
         unsigned size = attributeCount();
         for (unsigned i = 0; i < size; ++i) {
             const Attribute* attribute = attributeItem(i);
@@ -3443,7 +3544,7 @@
 void Element::addPropertyToPresentationAttributeStyle(MutableStylePropertySet* style, CSSPropertyID propertyID, const String& value)
 {
     ASSERT(isStyledElement());
-    style->setProperty(propertyID, value, false, document().elementSheet()->contents());
+    style->setProperty(propertyID, value, false);
 }
 
 void ElementData::deref()
diff --git a/Source/core/dom/Element.h b/Source/core/dom/Element.h
index 9d1ad83..5b42acc 100644
--- a/Source/core/dom/Element.h
+++ b/Source/core/dom/Element.h
@@ -33,8 +33,8 @@
 #include "core/dom/SpaceSplitString.h"
 #include "core/html/CollectionType.h"
 #include "core/page/FocusDirection.h"
-#include "core/platform/ScrollTypes.h"
 #include "core/rendering/RegionOversetState.h"
+#include "platform/scroll/ScrollTypes.h"
 
 namespace WebCore {
 
@@ -335,7 +335,7 @@
     // Returns the absolute bounding box translated into screen coordinates:
     IntRect screenRect() const;
 
-    virtual void didMoveToNewDocument(Document*) OVERRIDE;
+    virtual void didMoveToNewDocument(Document&) OVERRIDE;
 
     void removeAttribute(const AtomicString& name);
     void removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName);
@@ -751,6 +751,8 @@
 
     virtual RenderStyle* virtualComputedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { return computedStyle(pseudoElementSpecifier); }
 
+    void updateCallbackSelectors(RenderStyle* oldStyle, RenderStyle* newStyle);
+
     // cloneNode is private so that non-virtual cloneElementWithChildren and cloneElementWithoutChildren
     // are used instead.
     virtual PassRefPtr<Node> cloneNode(bool deep) OVERRIDE;
@@ -791,26 +793,7 @@
     RefPtr<ElementData> m_elementData;
 };
 
-inline Element* toElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isElementNode());
-    return static_cast<Element*>(node);
-}
-
-inline const Element* toElement(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isElementNode());
-    return static_cast<const Element*>(node);
-}
-
-inline const Element& toElement(const Node& node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(node.isElementNode());
-    return static_cast<const Element&>(node);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toElement(const Element*);
+DEFINE_NODE_TYPE_CASTS(Element, isElementNode());
 
 inline bool isDisabledFormControl(const Node* node)
 {
@@ -822,21 +805,6 @@
     return isElementNode() && toElement(this)->hasTagName(name);
 }
 
-inline bool Node::hasLocalName(const AtomicString& name) const
-{
-    return isElementNode() && toElement(this)->hasLocalName(name);
-}
-
-inline bool Node::hasAttributes() const
-{
-    return isElementNode() && toElement(this)->hasAttributes();
-}
-
-inline NamedNodeMap* Node::attributes() const
-{
-    return isElementNode() ? toElement(this)->attributes() : 0;
-}
-
 inline Element* Node::parentElement() const
 {
     ContainerNode* parent = parentNode();
diff --git a/Source/core/dom/Element.idl b/Source/core/dom/Element.idl
index 55df834..041bad0 100644
--- a/Source/core/dom/Element.idl
+++ b/Source/core/dom/Element.idl
@@ -19,7 +19,7 @@
  */
 
 [
-    CustomToV8
+    SpecialWrapFor=HTMLElement|SVGElement
 ] interface Element : Node {
 
     // DOM Level 1 Core
@@ -27,12 +27,12 @@
     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString tagName;
 
     [TreatReturnedNullStringAs=Null] DOMString getAttribute([Default=Undefined] optional DOMString name);
-    [RaisesException, CustomElementCallbacks=Enable] void setAttribute([Default=Undefined] optional DOMString name,
+    [RaisesException, CustomElementCallbacks] void setAttribute([Default=Undefined] optional DOMString name,
                                      [Default=Undefined] optional DOMString value);
-    [CustomElementCallbacks=Enable] void removeAttribute([Default=Undefined] optional DOMString name);
+    [CustomElementCallbacks] void removeAttribute([Default=Undefined] optional DOMString name);
     [MeasureAs=ElementGetAttributeNode] Attr getAttributeNode([Default=Undefined] optional DOMString name); // Removed from DOM4.
-    [RaisesException, CustomElementCallbacks=Enable, MeasureAs=ElementSetAttributeNode] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr); // Removed from DOM4.
-    [RaisesException, CustomElementCallbacks=Enable, MeasureAs=ElementRemoveAttributeNode] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr); // Removed from DOM4.
+    [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNode] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr); // Removed from DOM4.
+    [RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNode] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr); // Removed from DOM4.
     [PerWorldBindings] NodeList getElementsByTagName([Default=Undefined] optional DOMString name);
 
     [PerWorldBindings] readonly attribute NamedNodeMap     attributes;
@@ -42,16 +42,16 @@
 
      DOMString getAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                             [Default=Undefined] optional DOMString localName);
-     [RaisesException, CustomElementCallbacks=Enable] void setAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
+     [RaisesException, CustomElementCallbacks] void setAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                        [Default=Undefined] optional DOMString qualifiedName,
                                        [Default=Undefined] optional DOMString value);
-     [CustomElementCallbacks=Enable] void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI,
+     [CustomElementCallbacks] void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI,
                                           DOMString localName);
      NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                                    [Default=Undefined] optional DOMString localName);
      [MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                                                    [Default=Undefined] optional DOMString localName); // Removed from DOM4.
-    [RaisesException, CustomElementCallbacks=Enable] Attr setAttributeNodeNS([Default=Undefined, StrictTypeChecking] optional Attr newAttr);
+    [RaisesException, CustomElementCallbacks] Attr setAttributeNodeNS([Default=Undefined, StrictTypeChecking] optional Attr newAttr);
     boolean hasAttribute(DOMString name);
      boolean hasAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                           [Default=Undefined] optional DOMString localName);
@@ -61,7 +61,7 @@
     // DOM4
     // iht.com relies on id returning the empty string when no id is present.
     // Other browsers do this as well. So we don't convert null to JS null.
-    [Reflect] attribute DOMString id;
+    [Reflect, TreatNullAs=NullString] attribute DOMString id;
     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString namespaceURI;
     [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException] attribute DOMString prefix;
     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString localName;
@@ -95,7 +95,7 @@
     // HTML 5
     NodeList getElementsByClassName([Default=Undefined] optional DOMString name);
 
-    [Reflect=class, PerWorldBindings] attribute DOMString className;
+    [Reflect=class, TreatNullAs=NullString, PerWorldBindings] attribute DOMString className;
     [PerWorldBindings] readonly attribute DOMTokenList classList;
 
     [PerWorldBindings] readonly attribute DOMStringMap dataset;
@@ -108,13 +108,13 @@
     [RaisesException] boolean webkitMatchesSelector([Default=Undefined] optional DOMString selectors);
 
     // Shadow DOM API
-    [EnabledAtRuntime=ShadowDOM, Reflect, PerWorldBindings] attribute DOMString pseudo;
-    [EnabledAtRuntime=ShadowDOM, RaisesException] ShadowRoot createShadowRoot();
-    [EnabledAtRuntime=ShadowDOM, PerWorldBindings] readonly attribute ShadowRoot shadowRoot;
-    [EnabledAtRuntime=ShadowDOM, PerWorldBindings] NodeList getDestinationInsertionPoints();
+    [RuntimeEnabled=ShadowDOM, Reflect, TreatNullAs=NullString, PerWorldBindings] attribute DOMString pseudo;
+    [RuntimeEnabled=ShadowDOM, RaisesException] ShadowRoot createShadowRoot();
+    [RuntimeEnabled=ShadowDOM, PerWorldBindings] readonly attribute ShadowRoot shadowRoot;
+    [RuntimeEnabled=ShadowDOM, PerWorldBindings] NodeList getDestinationInsertionPoints();
 
     // To-be-deprecated prefixed Shadow DOM API
-    [Reflect=pseudo, ImplementedAs=pseudo, PerWorldBindings, MeasureAs=ShadowDOMPrefixedPseudo] attribute DOMString webkitPseudo;
+    [Reflect=pseudo, TreatNullAs=NullString, ImplementedAs=pseudo, PerWorldBindings, MeasureAs=ShadowDOMPrefixedPseudo] attribute DOMString webkitPseudo;
     [ImplementedAs=createShadowRoot, RaisesException, MeasureAs=ShadowDOMPrefixedCreateShadowRoot] ShadowRoot webkitCreateShadowRoot();
     [ImplementedAs=shadowRoot, PerWorldBindings, MeasureAs=ShadowDOMPrefixedShadowRoot] readonly attribute ShadowRoot webkitShadowRoot;
 
@@ -124,51 +124,51 @@
 
     // Mozilla version
     const unsigned short ALLOW_KEYBOARD_INPUT = 1;
-    [EnabledAtRuntime=Fullscreen, PerWorldBindings, ActivityLog=Access] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags);
+    [RuntimeEnabled=Fullscreen, PerWorldBindings, ActivityLogging=Access] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags);
 
     // W3C version
-    [EnabledAtRuntime=Fullscreen, PerWorldBindings, ActivityLog=Access] void webkitRequestFullscreen();
+    [RuntimeEnabled=Fullscreen, PerWorldBindings, ActivityLogging=Access] void webkitRequestFullscreen();
 
     void webkitRequestPointerLock();
 
     // CSS Regions API
-    [EnabledAtRuntime=CSSRegions, PerWorldBindings] readonly attribute DOMString webkitRegionOverset;
-    [EnabledAtRuntime=CSSRegions] sequence<Range> webkitGetRegionFlowRanges();
+    [RuntimeEnabled=CSSRegions, PerWorldBindings] readonly attribute DOMString webkitRegionOverset;
+    [RuntimeEnabled=CSSRegions] sequence<Range> webkitGetRegionFlowRanges();
 
     // Event handler DOM attributes
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onabort;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onblur;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onchange;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onclick;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler oncontextmenu;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondblclick;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondrag;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragend;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragenter;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragleave;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragover;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragstart;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondrop;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onerror;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onfocus;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler oninput;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler oninvalid;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeydown;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeypress;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeyup;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onload;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousedown;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseenter;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseleave;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousemove;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseout;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseover;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseup;
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousewheel; // Deprecated in favor of onwheel.
-    [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onwheel;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onscroll;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onselect;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onsubmit;
+    [NotEnumerable] attribute EventHandler onabort;
+    [NotEnumerable] attribute EventHandler onblur;
+    [NotEnumerable] attribute EventHandler onchange;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onclick;
+    [NotEnumerable] attribute EventHandler oncontextmenu;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondblclick;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondrag;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondragend;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondragenter;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondragleave;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondragover;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondragstart;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler ondrop;
+    [NotEnumerable] attribute EventHandler onerror;
+    [NotEnumerable] attribute EventHandler onfocus;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler oninput;
+    [NotEnumerable] attribute EventHandler oninvalid;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onkeydown;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onkeypress;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onkeyup;
+    [NotEnumerable] attribute EventHandler onload;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmousedown;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmouseenter;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmouseleave;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmousemove;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmouseout;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmouseover;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmouseup;
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onmousewheel; // Deprecated in favor of onwheel.
+    [NotEnumerable, ActivityLogging=Setter] attribute EventHandler onwheel;
+    [NotEnumerable] attribute EventHandler onscroll;
+    [NotEnumerable] attribute EventHandler onselect;
+    [NotEnumerable] attribute EventHandler onsubmit;
 
     // attribute [NotEnumerable] EventHandler oncanplay;
     // attribute [NotEnumerable] EventHandler oncanplaythrough;
@@ -194,21 +194,21 @@
     // attribute [NotEnumerable] EventHandler onwaiting;
 
     // WebKit extensions
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onbeforecut;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler oncut;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onbeforecopy;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler oncopy;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onbeforepaste;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onpaste;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onreset;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onsearch;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onselectstart;
-    [NotEnumerable, EnabledAtRuntime=Touch, PerWorldBindings] attribute EventHandler ontouchstart;
-    [NotEnumerable, EnabledAtRuntime=Touch, PerWorldBindings] attribute EventHandler ontouchmove;
-    [NotEnumerable, EnabledAtRuntime=Touch, PerWorldBindings] attribute EventHandler ontouchend;
-    [NotEnumerable, EnabledAtRuntime=Touch, PerWorldBindings] attribute EventHandler ontouchcancel;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onwebkitfullscreenchange;
-    [NotEnumerable, PerWorldBindings] attribute EventHandler onwebkitfullscreenerror;
+    [NotEnumerable] attribute EventHandler onbeforecut;
+    [NotEnumerable] attribute EventHandler oncut;
+    [NotEnumerable] attribute EventHandler onbeforecopy;
+    [NotEnumerable] attribute EventHandler oncopy;
+    [NotEnumerable] attribute EventHandler onbeforepaste;
+    [NotEnumerable] attribute EventHandler onpaste;
+    [NotEnumerable] attribute EventHandler onreset;
+    [NotEnumerable] attribute EventHandler onsearch;
+    [NotEnumerable] attribute EventHandler onselectstart;
+    [NotEnumerable, RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
+    [NotEnumerable, RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
+    [NotEnumerable, RuntimeEnabled=Touch] attribute EventHandler ontouchend;
+    [NotEnumerable, RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
+    [NotEnumerable] attribute EventHandler onwebkitfullscreenchange;
+    [NotEnumerable] attribute EventHandler onwebkitfullscreenerror;
 };
 
 Element implements ParentNode;
diff --git a/Source/core/dom/ElementRareData.h b/Source/core/dom/ElementRareData.h
index f483681..956eda7 100644
--- a/Source/core/dom/ElementRareData.h
+++ b/Source/core/dom/ElementRareData.h
@@ -271,7 +271,7 @@
 
     InspectorInstrumentation::pseudoElementDestroyed(element);
 
-    if (element->attached())
+    if (element->confusingAndOftenMisusedAttached())
         element->detach();
 
     ASSERT(!element->nextSibling());
diff --git a/Source/core/dom/ExecutionContext.cpp b/Source/core/dom/ExecutionContext.cpp
new file mode 100644
index 0000000..cec6df5
--- /dev/null
+++ b/Source/core/dom/ExecutionContext.cpp
@@ -0,0 +1,388 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * 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 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,
+ * 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/dom/ExecutionContext.h"
+
+#include "core/dom/AddConsoleMessageTask.h"
+#include "core/dom/ContextLifecycleNotifier.h"
+#include "core/dom/ExecutionContextTask.h"
+#include "core/dom/MessagePort.h"
+#include "core/events/ErrorEvent.h"
+#include "core/events/EventTarget.h"
+#include "core/frame/DOMTimer.h"
+#include "core/html/PublicURLManager.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/inspector/ScriptCallStack.h"
+#include "core/workers/WorkerGlobalScope.h"
+#include "core/workers/WorkerThread.h"
+#include "modules/webdatabase/DatabaseContext.h"
+#include "wtf/MainThread.h"
+
+namespace WebCore {
+
+class ProcessMessagesSoonTask : public ExecutionContextTask {
+public:
+    static PassOwnPtr<ProcessMessagesSoonTask> create()
+    {
+        return adoptPtr(new ProcessMessagesSoonTask);
+    }
+
+    virtual void performTask(ExecutionContext* context)
+    {
+        context->dispatchMessagePortEvents();
+    }
+};
+
+class ExecutionContext::PendingException {
+    WTF_MAKE_NONCOPYABLE(PendingException);
+public:
+    PendingException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack)
+        : m_errorMessage(errorMessage)
+        , m_lineNumber(lineNumber)
+        , m_columnNumber(columnNumber)
+        , m_sourceURL(sourceURL)
+        , m_callStack(callStack)
+    {
+    }
+    String m_errorMessage;
+    int m_lineNumber;
+    int m_columnNumber;
+    String m_sourceURL;
+    RefPtr<ScriptCallStack> m_callStack;
+};
+
+ExecutionContext::ExecutionContext()
+    : m_circularSequentialID(0)
+    , m_inDispatchErrorEvent(false)
+    , m_activeDOMObjectsAreSuspended(false)
+    , m_activeDOMObjectsAreStopped(false)
+{
+}
+
+ExecutionContext::~ExecutionContext()
+{
+    HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end();
+    for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
+        ASSERT((*iter)->executionContext() == this);
+        (*iter)->contextDestroyed();
+    }
+}
+
+void ExecutionContext::processMessagePortMessagesSoon()
+{
+    postTask(ProcessMessagesSoonTask::create());
+}
+
+void ExecutionContext::dispatchMessagePortEvents()
+{
+    RefPtr<ExecutionContext> protect(this);
+
+    // Make a frozen copy.
+    Vector<MessagePort*> ports;
+    copyToVector(m_messagePorts, ports);
+
+    unsigned portCount = ports.size();
+    for (unsigned i = 0; i < portCount; ++i) {
+        MessagePort* port = ports[i];
+        // The port may be destroyed, and another one created at the same address, but this is safe, as the worst that can happen
+        // as a result is that dispatchMessages() will be called needlessly.
+        if (m_messagePorts.contains(port) && port->started())
+            port->dispatchMessages();
+    }
+}
+
+void ExecutionContext::createdMessagePort(MessagePort* port)
+{
+    ASSERT(port);
+    ASSERT((isDocument() && isMainThread())
+        || (isWorkerGlobalScope() && toWorkerGlobalScope(this)->thread()->isCurrentThread()));
+
+    m_messagePorts.add(port);
+}
+
+void ExecutionContext::destroyedMessagePort(MessagePort* port)
+{
+    ASSERT(port);
+    ASSERT((isDocument() && isMainThread())
+        || (isWorkerGlobalScope() && toWorkerGlobalScope(this)->thread()->isCurrentThread()));
+
+    m_messagePorts.remove(port);
+}
+
+bool ExecutionContext::hasPendingActivity()
+{
+    if (lifecycleNotifier()->hasPendingActivity())
+        return true;
+
+    HashSet<MessagePort*>::const_iterator messagePortsEnd = m_messagePorts.end();
+    for (HashSet<MessagePort*>::const_iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
+        if ((*iter)->hasPendingActivity())
+            return true;
+    }
+
+    return false;
+}
+
+void ExecutionContext::suspendActiveDOMObjects()
+{
+    lifecycleNotifier()->notifySuspendingActiveDOMObjects();
+    m_activeDOMObjectsAreSuspended = true;
+}
+
+void ExecutionContext::resumeActiveDOMObjects()
+{
+    m_activeDOMObjectsAreSuspended = false;
+    lifecycleNotifier()->notifyResumingActiveDOMObjects();
+}
+
+void ExecutionContext::stopActiveDOMObjects()
+{
+    m_activeDOMObjectsAreStopped = true;
+    lifecycleNotifier()->notifyStoppingActiveDOMObjects();
+    // Also close MessagePorts. If they were ActiveDOMObjects (they could be) then they could be stopped instead.
+    closeMessagePorts();
+}
+
+void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object)
+{
+    ASSERT(lifecycleNotifier()->contains(object));
+    // Ensure all ActiveDOMObjects are suspended also newly created ones.
+    if (m_activeDOMObjectsAreSuspended)
+        object->suspend();
+}
+
+void ExecutionContext::closeMessagePorts()
+{
+    HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end();
+    for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
+        ASSERT((*iter)->executionContext() == this);
+        (*iter)->close();
+    }
+}
+
+bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus corsStatus)
+{
+    return !(securityOrigin()->canRequest(completeURL(sourceURL)) || corsStatus == SharableCrossOrigin);
+}
+
+void ExecutionContext::reportException(PassRefPtr<ErrorEvent> event, PassRefPtr<ScriptCallStack> callStack, AccessControlStatus corsStatus)
+{
+    RefPtr<ErrorEvent> errorEvent = event;
+    if (m_inDispatchErrorEvent) {
+        if (!m_pendingExceptions)
+            m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException> >());
+        m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->messageForConsole(), errorEvent->lineno(), errorEvent->colno(), errorEvent->filename(), callStack)));
+        return;
+    }
+
+    // First report the original exception and only then all the nested ones.
+    if (!dispatchErrorEvent(errorEvent, corsStatus) && m_client)
+        m_client->logExceptionToConsole(errorEvent->messageForConsole(), errorEvent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack);
+
+    if (!m_pendingExceptions)
+        return;
+
+    for (size_t i = 0; i < m_pendingExceptions->size(); i++) {
+        PendingException* e = m_pendingExceptions->at(i).get();
+        if (m_client)
+            m_client->logExceptionToConsole(e->m_errorMessage, e->m_sourceURL, e->m_lineNumber, e->m_columnNumber, e->m_callStack);
+    }
+    m_pendingExceptions.clear();
+}
+
+void ExecutionContext::addConsoleMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber)
+{
+    if (!m_client)
+        return;
+    m_client->addMessage(source, level, message, sourceURL, lineNumber, 0);
+}
+
+void ExecutionContext::addConsoleMessage(MessageSource source, MessageLevel level, const String& message, ScriptState* state)
+{
+    if (!m_client)
+        return;
+    m_client->addMessage(source, level, message, String(), 0, state);
+}
+
+bool ExecutionContext::dispatchErrorEvent(PassRefPtr<ErrorEvent> event, AccessControlStatus corsStatus)
+{
+    if (!m_client)
+        return false;
+    EventTarget* target = m_client->errorEventTarget();
+    if (!target)
+        return false;
+
+    RefPtr<ErrorEvent> errorEvent = event;
+    if (shouldSanitizeScriptError(errorEvent->filename(), corsStatus))
+        errorEvent = ErrorEvent::createSanitizedError(errorEvent->world());
+
+    ASSERT(!m_inDispatchErrorEvent);
+    m_inDispatchErrorEvent = true;
+    target->dispatchEvent(errorEvent);
+    m_inDispatchErrorEvent = false;
+    return errorEvent->defaultPrevented();
+}
+
+int ExecutionContext::circularSequentialID()
+{
+    ++m_circularSequentialID;
+    if (m_circularSequentialID <= 0)
+        m_circularSequentialID = 1;
+    return m_circularSequentialID;
+}
+
+int ExecutionContext::installNewTimeout(PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot)
+{
+    int timeoutID;
+    while (true) {
+        timeoutID = circularSequentialID();
+        if (!m_timeouts.contains(timeoutID))
+            break;
+    }
+    TimeoutMap::AddResult result = m_timeouts.add(timeoutID, DOMTimer::create(this, action, timeout, singleShot, timeoutID));
+    ASSERT(result.isNewEntry);
+    DOMTimer* timer = result.iterator->value.get();
+
+    timer->suspendIfNeeded();
+
+    return timer->timeoutID();
+}
+
+void ExecutionContext::removeTimeoutByID(int timeoutID)
+{
+    if (timeoutID <= 0)
+        return;
+    m_timeouts.remove(timeoutID);
+}
+
+PublicURLManager& ExecutionContext::publicURLManager()
+{
+    if (!m_publicURLManager)
+        m_publicURLManager = PublicURLManager::create(this);
+    return *m_publicURLManager;
+}
+
+void ExecutionContext::didChangeTimerAlignmentInterval()
+{
+    for (TimeoutMap::iterator iter = m_timeouts.begin(); iter != m_timeouts.end(); ++iter)
+        iter->value->didChangeAlignmentInterval();
+}
+
+EventQueue* ExecutionContext::eventQueue() const
+{
+    if (!m_client)
+        return 0;
+    return m_client->eventQueue();
+}
+
+const KURL& ExecutionContext::url() const
+{
+    if (!m_client) {
+        DEFINE_STATIC_LOCAL(KURL, emptyURL, ());
+        return emptyURL;
+    }
+
+    return m_client->virtualURL();
+}
+
+KURL ExecutionContext::completeURL(const String& url) const
+{
+
+    if (!m_client) {
+        DEFINE_STATIC_LOCAL(KURL, emptyURL, ());
+        return emptyURL;
+    }
+
+    return m_client->virtualCompleteURL(url);
+}
+
+void ExecutionContext::userEventWasHandled()
+{
+    if (!m_client)
+        return;
+    m_client->userEventWasHandled();
+}
+
+void ExecutionContext::disableEval(const String& errorMessage)
+{
+    if (!m_client)
+        return;
+    return m_client->disableEval(errorMessage);
+}
+
+DOMWindow* ExecutionContext::executingWindow() const
+{
+    if (!m_client)
+        return 0;
+    return m_client->executingWindow();
+}
+
+String ExecutionContext::userAgent(const KURL& url) const
+{
+    if (!m_client)
+        return String();
+    return m_client->userAgent(url);
+}
+
+double ExecutionContext::timerAlignmentInterval() const
+{
+    if (!m_client)
+        return DOMTimer::visiblePageAlignmentInterval();
+    return m_client->timerAlignmentInterval();
+}
+
+void ExecutionContext::postTask(PassOwnPtr<ExecutionContextTask> task)
+{
+    if (!m_client)
+        return;
+    m_client->postTask(task);
+}
+
+PassOwnPtr<LifecycleNotifier> ExecutionContext::createLifecycleNotifier()
+{
+    if (!m_client)
+        return PassOwnPtr<LifecycleNotifier>();
+    return m_client->createLifecycleNotifier();
+}
+
+ContextLifecycleNotifier* ExecutionContext::lifecycleNotifier()
+{
+    return static_cast<ContextLifecycleNotifier*>(LifecycleContext::lifecycleNotifier());
+}
+
+bool ExecutionContext::isIteratingOverObservers() const
+{
+    return m_lifecycleNotifier && m_lifecycleNotifier->isIteratingOverObservers();
+}
+
+void ExecutionContext::setDatabaseContext(DatabaseContext* databaseContext)
+{
+    m_databaseContext = databaseContext;
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/ExecutionContext.h b/Source/core/dom/ExecutionContext.h
new file mode 100644
index 0000000..ee5ef60
--- /dev/null
+++ b/Source/core/dom/ExecutionContext.h
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * 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 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,
+ * 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 ExecutionContext_h
+#define ExecutionContext_h
+
+#include "core/dom/ActiveDOMObject.h"
+#include "core/dom/ExecutionContextClient.h"
+#include "core/dom/SecurityContext.h"
+#include "core/events/ErrorEvent.h"
+#include "core/fetch/CrossOriginAccessControl.h"
+#include "core/frame/ConsoleTypes.h"
+#include "core/frame/DOMTimer.h"
+#include "core/platform/LifecycleContext.h"
+#include "weborigin/KURL.h"
+#include "wtf/HashSet.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+
+namespace WTF {
+class OrdinalNumber;
+}
+
+namespace WebCore {
+
+class ContextLifecycleNotifier;
+class DOMWindow;
+class DatabaseContext;
+class EventListener;
+class EventQueue;
+class EventTarget;
+class ExecutionContextTask;
+class MessagePort;
+class PublicURLManager;
+class ScriptCallStack;
+class ScriptState;
+
+class ExecutionContext : public LifecycleContext, public SecurityContext {
+public:
+    ExecutionContext();
+    virtual ~ExecutionContext();
+
+    // Delegating to ExecutionContextClient
+    void setClient(ExecutionContextClient* client) { m_client = client; }
+    bool isDocument() const { return m_client && m_client->isDocument(); }
+    bool isWorkerGlobalScope() { return m_client && m_client->isWorkerGlobalScope(); }
+    bool isJSExecutionForbidden() { return m_client && m_client->isJSExecutionForbidden(); }
+    EventQueue* eventQueue() const;
+    const KURL& url() const;
+    KURL completeURL(const String& url) const;
+    void userEventWasHandled();
+    void disableEval(const String& errorMessage);
+    DOMWindow* executingWindow() const;
+    String userAgent(const KURL&) const;
+    void postTask(PassOwnPtr<ExecutionContextTask>);
+    double timerAlignmentInterval() const;
+
+    bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus);
+    void reportException(PassRefPtr<ErrorEvent>, PassRefPtr<ScriptCallStack>, AccessControlStatus);
+
+    void addConsoleMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber);
+    void addConsoleMessage(MessageSource, MessageLevel, const String& message, ScriptState* = 0);
+
+    PublicURLManager& publicURLManager();
+
+    // Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.
+    bool hasPendingActivity();
+
+    void suspendActiveDOMObjects();
+    void resumeActiveDOMObjects();
+    void stopActiveDOMObjects();
+
+    bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSuspended; }
+    bool activeDOMObjectsAreStopped() const { return m_activeDOMObjectsAreStopped; }
+    bool isIteratingOverObservers() const;
+
+    // Called after the construction of an ActiveDOMObject to synchronize suspend state.
+    void suspendActiveDOMObjectIfNeeded(ActiveDOMObject*);
+
+    // MessagePort is conceptually a kind of ActiveDOMObject, but it needs to be tracked separately for message dispatch.
+    void processMessagePortMessagesSoon();
+    void dispatchMessagePortEvents();
+    void createdMessagePort(MessagePort*);
+    void destroyedMessagePort(MessagePort*);
+    const HashSet<MessagePort*>& messagePorts() const { return m_messagePorts; }
+
+    void ref() { refExecutionContext(); }
+    void deref() { derefExecutionContext(); }
+
+    // Gets the next id in a circular sequence from 1 to 2^31-1.
+    int circularSequentialID();
+
+    void didChangeTimerAlignmentInterval();
+
+    void setDatabaseContext(DatabaseContext*);
+
+protected:
+
+    ContextLifecycleNotifier* lifecycleNotifier();
+
+private:
+    friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() below.
+
+    bool dispatchErrorEvent(PassRefPtr<ErrorEvent>, AccessControlStatus);
+
+    void closeMessagePorts();
+
+    virtual void refExecutionContext() = 0;
+    virtual void derefExecutionContext() = 0;
+    virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE;
+
+    // Implementation details for DOMTimer. No other classes should call these functions.
+    int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleShot);
+    void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer instance destructed.
+
+    ExecutionContextClient* m_client;
+    HashSet<MessagePort*> m_messagePorts;
+
+    int m_circularSequentialID;
+    typedef HashMap<int, OwnPtr<DOMTimer> > TimeoutMap;
+    TimeoutMap m_timeouts;
+
+    bool m_inDispatchErrorEvent;
+    class PendingException;
+    OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions;
+
+    bool m_activeDOMObjectsAreSuspended;
+    bool m_activeDOMObjectsAreStopped;
+
+    OwnPtr<PublicURLManager> m_publicURLManager;
+
+    RefPtr<DatabaseContext> m_databaseContext;
+
+    // The location of this member is important; to make sure contextDestroyed() notification on
+    // ExecutionContext's members (notably m_timeouts) is called before they are destructed,
+    // m_lifecycleNotifer should be placed *after* such members.
+    OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier;
+};
+
+} // namespace WebCore
+
+#endif // ExecutionContext_h
diff --git a/Source/core/dom/ExecutionContextClient.h b/Source/core/dom/ExecutionContextClient.h
new file mode 100644
index 0000000..fe33250
--- /dev/null
+++ b/Source/core/dom/ExecutionContextClient.h
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ *     * 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 ExecutionContextClient_h
+#define ExecutionContextClient_h
+
+#include "core/frame/ConsoleTypes.h"
+#include "core/platform/LifecycleNotifier.h"
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class DOMWindow;
+class EventQueue;
+class EventTarget;
+class ExecutionContextTask;
+class KURL;
+class LifecycleNotifier;
+class ScriptCallStack;
+class ScriptState;
+class SecurityContext;
+
+class ExecutionContextClient {
+public:
+    virtual void postTask(PassOwnPtr<ExecutionContextTask>) = 0; // Executes the task on context's thread asynchronously.
+
+    virtual bool isDocument() const { return false; }
+    virtual bool isWorkerGlobalScope() const { return false; }
+
+    virtual bool isJSExecutionForbidden() const = 0;
+    virtual DOMWindow* executingWindow() { return 0; }
+    virtual void userEventWasHandled() { }
+    virtual String userAgent(const KURL&) const = 0;
+    virtual void disableEval(const String& errorMessage) = 0;
+    virtual EventQueue* eventQueue() const = 0;
+    virtual const KURL& virtualURL() const = 0;
+    virtual KURL virtualCompleteURL(const String&) const = 0;
+    virtual void addMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, ScriptState*) = 0;
+    virtual EventTarget* errorEventTarget() = 0;
+    virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) = 0;
+    virtual double timerAlignmentInterval() const = 0;
+    virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() = 0;
+
+protected:
+    virtual ~ExecutionContextClient() { }
+};
+
+} // namespace
+
+#endif
diff --git a/Source/core/dom/ExecutionContextTask.cpp b/Source/core/dom/ExecutionContextTask.cpp
new file mode 100644
index 0000000..124a5ac
--- /dev/null
+++ b/Source/core/dom/ExecutionContextTask.cpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ *     * 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 ExecutionContextTask_h
+#define ExecutionContextTask_h
+
+#include "config.h"
+#include "core/dom/ExecutionContextTask.h"
+
+namespace WebCore {
+
+
+} // namespace
+
+#endif
diff --git a/Source/core/dom/ExecutionContextTask.h b/Source/core/dom/ExecutionContextTask.h
new file mode 100644
index 0000000..84da8ce
--- /dev/null
+++ b/Source/core/dom/ExecutionContextTask.h
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ *     * 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 ExecutionContextTask_h
+#define ExecutionContextTask_h
+
+#include "wtf/FastAllocBase.h"
+#include "wtf/Noncopyable.h"
+
+namespace WebCore {
+
+class ExecutionContext;
+
+class ExecutionContextTask {
+    WTF_MAKE_NONCOPYABLE(ExecutionContextTask);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    ExecutionContextTask() { }
+    virtual ~ExecutionContextTask() { }
+    virtual void performTask(ExecutionContext*) = 0;
+    // Certain tasks get marked specially so that they aren't discarded, and are executed, when the context is shutting down its message queue.
+    virtual bool isCleanupTask() const { return false; }
+};
+
+} // namespace
+
+#endif
diff --git a/Source/core/dom/FullscreenElementStack.cpp b/Source/core/dom/FullscreenElementStack.cpp
index b8654e8..550bd42 100644
--- a/Source/core/dom/FullscreenElementStack.cpp
+++ b/Source/core/dom/FullscreenElementStack.cpp
@@ -29,17 +29,17 @@
 #include "core/dom/FullscreenElementStack.h"
 
 #include "HTMLNames.h"
-#include "bindings/v8/ScriptController.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/events/Event.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/rendering/RenderFullScreen.h"
+#include "platform/UserGestureIndicator.h"
 
 namespace WebCore {
 
@@ -66,7 +66,7 @@
     FullscreenElementStack* fullscreen = fromIfExists(document);
     if (!fullscreen) {
         fullscreen = new FullscreenElementStack(document);
-        Supplement<ScriptExecutionContext>::provideTo(document, supplementName(), adoptPtr(fullscreen));
+        DocumentSupplement::provideTo(document, supplementName(), adoptPtr(fullscreen));
     }
 
     return fullscreen;
@@ -74,7 +74,7 @@
 
 FullscreenElementStack* FullscreenElementStack::fromIfExistsSlow(Document* document)
 {
-    return static_cast<FullscreenElementStack*>(Supplement<ScriptExecutionContext>::from(document, supplementName()));
+    return static_cast<FullscreenElementStack*>(DocumentSupplement::from(document, supplementName()));
 }
 
 Element* FullscreenElementStack::fullscreenElementFrom(Document* document)
@@ -113,7 +113,7 @@
 
 inline Document* FullscreenElementStack::document()
 {
-    return toDocument(scriptExecutionContext());
+    return toDocument(executionContext());
 }
 
 void FullscreenElementStack::documentWasDetached()
@@ -184,11 +184,13 @@
         //   An algorithm is allowed to show a pop-up if, in the task in which the algorithm is running, either:
         //   - an activation behavior is currently being processed whose click event was trusted, or
         //   - the event listener for a trusted click event is being handled.
-        if (!ScriptController::processingUserGesture())
+        // FIXME: Does this need to null-check settings()?
+        if (!UserGestureIndicator::processingUserGesture() && (!element->isMediaElement() || document()->settings()->mediaFullscreenRequiresUserGesture()))
             break;
+        UserGestureIndicator::consumeUserGesture();
 
         // There is a previously-established user preference, security risk, or platform limitation.
-        if (!document()->page() || !document()->page()->settings().fullScreenEnabled())
+        if (!document()->settings() || !document()->settings()->fullScreenEnabled())
             break;
 
         // 2. Let doc be element's node document. (i.e. "this")
@@ -304,7 +306,7 @@
         //    If doc's fullscreen element stack is non-empty and the element now at the top is either
         //    not in a document or its node document is not doc, repeat this substep.
         newTop = fullscreenElementFrom(currentDoc);
-        if (newTop && (!newTop->inDocument() || &newTop->document() != currentDoc))
+        if (newTop && (!newTop->inDocument() || newTop->document() != currentDoc))
             continue;
 
         // 2. Queue a task to fire an event named fullscreenchange with its bubbles attribute set to true
@@ -351,16 +353,16 @@
 
 void FullscreenElementStack::webkitWillEnterFullScreenForElement(Element* element)
 {
-    if (!document()->attached())
+    if (!document()->confusingAndOftenMisusedAttached())
         return;
 
     ASSERT(element);
 
     // Protect against being called after the document has been removed from the page.
-    if (!document()->page())
+    if (!document()->settings())
         return;
 
-    ASSERT(document()->page()->settings().fullScreenEnabled());
+    ASSERT(document()->settings()->fullScreenEnabled());
 
     if (m_fullScreenRenderer)
         m_fullScreenRenderer->unwrapRenderer();
@@ -391,7 +393,7 @@
     if (!m_fullScreenElement)
         return;
 
-    if (!document()->attached())
+    if (!document()->confusingAndOftenMisusedAttached())
         return;
 
     m_fullScreenElement->didBecomeFullscreenElement();
@@ -404,7 +406,7 @@
     if (!m_fullScreenElement)
         return;
 
-    if (!document()->attached())
+    if (!document()->confusingAndOftenMisusedAttached())
         return;
 
     m_fullScreenElement->willStopBeingFullscreenElement();
@@ -415,7 +417,7 @@
     if (!m_fullScreenElement)
         return;
 
-    if (!document()->attached())
+    if (!document()->confusingAndOftenMisusedAttached())
         return;
 
     m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
@@ -485,7 +487,7 @@
         if (!document()->contains(node.get()) && !node->inDocument())
             changeQueue.append(document()->documentElement());
 
-        node->dispatchEvent(Event::createBubble(eventNames().webkitfullscreenchangeEvent));
+        node->dispatchEvent(Event::createBubble(EventTypeNames::webkitfullscreenchange));
     }
 
     while (!errorQueue.isEmpty()) {
@@ -501,7 +503,7 @@
         if (!document()->contains(node.get()) && !node->inDocument())
             errorQueue.append(document()->documentElement());
 
-        node->dispatchEvent(Event::createBubble(eventNames().webkitfullscreenerrorEvent));
+        node->dispatchEvent(Event::createBubble(EventTypeNames::webkitfullscreenerror));
     }
 }
 
diff --git a/Source/core/dom/FullscreenElementStack.h b/Source/core/dom/FullscreenElementStack.h
index 8e5e986..4211a83 100644
--- a/Source/core/dom/FullscreenElementStack.h
+++ b/Source/core/dom/FullscreenElementStack.h
@@ -30,9 +30,9 @@
 
 #include "core/dom/DocumentLifecycleObserver.h"
 #include "core/dom/Element.h"
-#include "core/platform/Supplementable.h"
-#include "core/platform/Timer.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/Supplementable.h"
+#include "platform/Timer.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/Deque.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
@@ -44,10 +44,10 @@
 class Node;
 class RenderFullScreen;
 class RenderStyle;
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class FullscreenElementStack
-    : public Supplement<ScriptExecutionContext>
+    : public DocumentSupplement
     , public DocumentLifecycleObserver {
 public:
     virtual ~FullscreenElementStack();
diff --git a/Source/core/dom/MessageChannel.cpp b/Source/core/dom/MessageChannel.cpp
index 4c65fac..b880fab 100644
--- a/Source/core/dom/MessageChannel.cpp
+++ b/Source/core/dom/MessageChannel.cpp
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-MessageChannel::MessageChannel(ScriptExecutionContext* context)
+MessageChannel::MessageChannel(ExecutionContext* context)
     : m_port1(MessagePort::create(*context))
     , m_port2(MessagePort::create(*context))
 {
diff --git a/Source/core/dom/MessageChannel.h b/Source/core/dom/MessageChannel.h
index 507825b..5b1dc49 100644
--- a/Source/core/dom/MessageChannel.h
+++ b/Source/core/dom/MessageChannel.h
@@ -35,18 +35,18 @@
 namespace WebCore {
 
 class MessagePort;
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class MessageChannel : public RefCounted<MessageChannel>, public ScriptWrappable {
 public:
-    static PassRefPtr<MessageChannel> create(ScriptExecutionContext* context) { return adoptRef(new MessageChannel(context)); }
+    static PassRefPtr<MessageChannel> create(ExecutionContext* context) { return adoptRef(new MessageChannel(context)); }
     ~MessageChannel();
 
     MessagePort* port1() const { return m_port1.get(); }
     MessagePort* port2() const { return m_port2.get(); }
 
 private:
-    explicit MessageChannel(ScriptExecutionContext*);
+    explicit MessageChannel(ExecutionContext*);
 
     RefPtr<MessagePort> m_port1;
     RefPtr<MessagePort> m_port2;
diff --git a/Source/core/dom/MessagePort.cpp b/Source/core/dom/MessagePort.cpp
index b626623..b3dce05 100644
--- a/Source/core/dom/MessagePort.cpp
+++ b/Source/core/dom/MessagePort.cpp
@@ -27,25 +27,26 @@
 #include "config.h"
 #include "core/dom/MessagePort.h"
 
+#include "bindings/v8/ExceptionMessages.h"
 #include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/Document.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/events/MessageEvent.h"
-#include "core/page/DOMWindow.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/DOMWindow.h"
 #include "core/workers/WorkerGlobalScope.h"
 #include "wtf/text/AtomicString.h"
 
 namespace WebCore {
 
-MessagePort::MessagePort(ScriptExecutionContext& scriptExecutionContext)
+MessagePort::MessagePort(ExecutionContext& executionContext)
     : m_started(false)
     , m_closed(false)
-    , m_scriptExecutionContext(&scriptExecutionContext)
+    , m_executionContext(&executionContext)
 {
     ScriptWrappable::init(this);
-    m_scriptExecutionContext->createdMessagePort(this);
+    m_executionContext->createdMessagePort(this);
 
     // Don't need to call processMessagePortMessagesSoon() here, because the port will not be opened until start() is invoked.
 }
@@ -53,15 +54,15 @@
 MessagePort::~MessagePort()
 {
     close();
-    if (m_scriptExecutionContext)
-        m_scriptExecutionContext->destroyedMessagePort(this);
+    if (m_executionContext)
+        m_executionContext->destroyedMessagePort(this);
 }
 
 void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& es)
 {
     if (!isEntangled())
         return;
-    ASSERT(m_scriptExecutionContext);
+    ASSERT(m_executionContext);
 
     OwnPtr<MessagePortChannelArray> channels;
     // Make sure we aren't connected to any of the passed-in ports.
@@ -69,7 +70,7 @@
         for (unsigned int i = 0; i < ports->size(); ++i) {
             MessagePort* dataPort = (*ports)[i].get();
             if (dataPort == this || m_entangledChannel->isConnectedTo(dataPort)) {
-                es.throwUninformativeAndGenericDOMException(DataCloneError);
+                es.throwDOMException(DataCloneError, ExceptionMessages::failedToExecute("postMessage", "MessagePort", "Item #" + String::number(i) + " in the array of ports contains the " + (dataPort == this ? "source" : "target") + " port."));
                 return;
             }
         }
@@ -80,16 +81,16 @@
     m_entangledChannel->postMessageToRemote(message, channels.release());
 }
 
-PassOwnPtr<MessagePortChannel> MessagePort::disentangle()
+PassRefPtr<MessagePortChannel> MessagePort::disentangle()
 {
     ASSERT(m_entangledChannel);
 
     m_entangledChannel->disentangle();
 
     // We can't receive any messages or generate any events, so remove ourselves from the list of active ports.
-    ASSERT(m_scriptExecutionContext);
-    m_scriptExecutionContext->destroyedMessagePort(this);
-    m_scriptExecutionContext = 0;
+    ASSERT(m_executionContext);
+    m_executionContext->destroyedMessagePort(this);
+    m_executionContext = 0;
 
     return m_entangledChannel.release();
 }
@@ -98,8 +99,8 @@
 // This code may be called from another thread, and so should not call any non-threadsafe APIs (i.e. should not call into the entangled channel or access mutable variables).
 void MessagePort::messageAvailable()
 {
-    ASSERT(m_scriptExecutionContext);
-    m_scriptExecutionContext->processMessagePortMessagesSoon();
+    ASSERT(m_executionContext);
+    m_executionContext->processMessagePortMessagesSoon();
 }
 
 void MessagePort::start()
@@ -108,12 +109,12 @@
     if (!isEntangled())
         return;
 
-    ASSERT(m_scriptExecutionContext);
+    ASSERT(m_executionContext);
     if (m_started)
         return;
 
     m_started = true;
-    m_scriptExecutionContext->processMessagePortMessagesSoon();
+    m_executionContext->processMessagePortMessagesSoon();
 }
 
 void MessagePort::close()
@@ -123,34 +124,33 @@
     m_closed = true;
 }
 
-void MessagePort::entangle(PassOwnPtr<MessagePortChannel> remote)
+void MessagePort::entangle(PassRefPtr<MessagePortChannel> remote)
 {
     // Only invoked to set our initial entanglement.
     ASSERT(!m_entangledChannel);
-    ASSERT(m_scriptExecutionContext);
+    ASSERT(m_executionContext);
 
-    // Don't entangle the ports if the channel is closed.
-    if (remote->entangleIfOpen(this))
-        m_entangledChannel = remote;
+    remote->entangle(this);
+    m_entangledChannel = remote;
 }
 
 void MessagePort::contextDestroyed()
 {
-    ASSERT(m_scriptExecutionContext);
+    ASSERT(m_executionContext);
     // Must be closed before blowing away the cached context, to ensure that we get no more calls to messageAvailable().
-    // ScriptExecutionContext::closeMessagePorts() takes care of that.
+    // ExecutionContext::closeMessagePorts() takes care of that.
     ASSERT(m_closed);
-    m_scriptExecutionContext = 0;
+    m_executionContext = 0;
 }
 
 const AtomicString& MessagePort::interfaceName() const
 {
-    return eventNames().interfaceForMessagePort;
+    return EventTargetNames::MessagePort;
 }
 
-ScriptExecutionContext* MessagePort::scriptExecutionContext() const
+ExecutionContext* MessagePort::executionContext() const
 {
-    return m_scriptExecutionContext;
+    return m_executionContext;
 }
 
 void MessagePort::dispatchMessages()
@@ -164,10 +164,10 @@
     while (m_entangledChannel && m_entangledChannel->tryGetMessageFromRemote(message, channels)) {
 
         // close() in Worker onmessage handler should prevent next message from dispatching.
-        if (m_scriptExecutionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_scriptExecutionContext)->isClosing())
+        if (m_executionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_executionContext)->isClosing())
             return;
 
-        OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_scriptExecutionContext, channels.release());
+        OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_executionContext, channels.release());
         RefPtr<Event> evt = MessageEvent::create(ports.release(), message.release());
 
         dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION);
@@ -180,14 +180,7 @@
     // We'll also stipulate that the queue needs to be open (if the app drops its reference to the port before start()-ing it, then it's not really entangled as it's unreachable).
     if (m_started && m_entangledChannel && m_entangledChannel->hasPendingActivity())
         return true;
-    if (isEntangled() && !locallyEntangledPort())
-        return true;
-    return false;
-}
-
-MessagePort* MessagePort::locallyEntangledPort()
-{
-    return m_entangledChannel ? m_entangledChannel->locallyEntangledPort(m_scriptExecutionContext) : 0;
+    return isEntangled();
 }
 
 PassOwnPtr<MessagePortChannelArray> MessagePort::disentanglePorts(const MessagePortArray* ports, ExceptionState& es)
@@ -202,7 +195,14 @@
     for (unsigned int i = 0; i < ports->size(); ++i) {
         MessagePort* port = (*ports)[i].get();
         if (!port || port->isNeutered() || portSet.contains(port)) {
-            es.throwUninformativeAndGenericDOMException(DataCloneError);
+            String type;
+            if (!port)
+                type = "null";
+            else if (port->isNeutered())
+                type = "already neutered";
+            else
+                type = "a duplicate";
+            es.throwDOMException(DataCloneError, ExceptionMessages::failedToExecute("disentanglePorts", "MessagePort", "Item #"  + String::number(i) + " in the array of ports is " + type + "."));
             return nullptr;
         }
         portSet.add(port);
@@ -211,13 +211,13 @@
     // Passed-in ports passed validity checks, so we can disentangle them.
     OwnPtr<MessagePortChannelArray> portArray = adoptPtr(new MessagePortChannelArray(ports->size()));
     for (unsigned int i = 0 ; i < ports->size() ; ++i) {
-        OwnPtr<MessagePortChannel> channel = (*ports)[i]->disentangle();
+        RefPtr<MessagePortChannel> channel = (*ports)[i]->disentangle();
         (*portArray)[i] = channel.release();
     }
     return portArray.release();
 }
 
-PassOwnPtr<MessagePortArray> MessagePort::entanglePorts(ScriptExecutionContext& context, PassOwnPtr<MessagePortChannelArray> channels)
+PassOwnPtr<MessagePortArray> MessagePort::entanglePorts(ExecutionContext& context, PassOwnPtr<MessagePortChannelArray> channels)
 {
     if (!channels || !channels->size())
         return nullptr;
@@ -231,14 +231,4 @@
     return portArray.release();
 }
 
-EventTargetData* MessagePort::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* MessagePort::ensureEventTargetData()
-{
-    return &m_eventTargetData;
-}
-
 } // namespace WebCore
diff --git a/Source/core/dom/MessagePort.h b/Source/core/dom/MessagePort.h
index 53df123..c1ce6a6 100644
--- a/Source/core/dom/MessagePort.h
+++ b/Source/core/dom/MessagePort.h
@@ -44,14 +44,14 @@
 class ExceptionState;
 class Frame;
 class MessagePort;
-class ScriptExecutionContext;
+class ExecutionContext;
 
 // The overwhelmingly common case is sending a single port, so handle that efficiently with an inline buffer of size 1.
 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray;
 
-class MessagePort : public RefCounted<MessagePort>, public ScriptWrappable, public EventTarget {
+class MessagePort : public RefCounted<MessagePort>, public ScriptWrappable, public EventTargetWithInlineData {
 public:
-    static PassRefPtr<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); }
+    static PassRefPtr<MessagePort> create(ExecutionContext& executionContext) { return adoptRef(new MessagePort(executionContext)); }
     virtual ~MessagePort();
 
     void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionState&);
@@ -59,14 +59,14 @@
     void start();
     void close();
 
-    void entangle(PassOwnPtr<MessagePortChannel>);
-    PassOwnPtr<MessagePortChannel> disentangle();
+    void entangle(PassRefPtr<MessagePortChannel>);
+    PassRefPtr<MessagePortChannel> disentangle();
 
     // Returns 0 if there is an exception, or if the passed-in array is 0/empty.
     static PassOwnPtr<MessagePortChannelArray> disentanglePorts(const MessagePortArray*, ExceptionState&);
 
     // Returns 0 if the passed array is 0/empty.
-    static PassOwnPtr<MessagePortArray> entanglePorts(ScriptExecutionContext&, PassOwnPtr<MessagePortChannelArray>);
+    static PassOwnPtr<MessagePortArray> entanglePorts(ExecutionContext&, PassOwnPtr<MessagePortChannelArray>);
 
     void messageAvailable();
     bool started() const { return m_started; }
@@ -74,7 +74,7 @@
     void contextDestroyed();
 
     virtual const AtomicString& interfaceName() const OVERRIDE;
-    virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
     MessagePort* toMessagePort() OVERRIDE { return this; }
 
     void dispatchMessages();
@@ -86,15 +86,10 @@
 
     void setOnmessage(PassRefPtr<EventListener> listener, DOMWrapperWorld* world)
     {
-        setAttributeEventListener(eventNames().messageEvent, listener, world);
+        setAttributeEventListener(EventTypeNames::message, listener, world);
         start();
     }
-    EventListener* onmessage(DOMWrapperWorld* world) { return getAttributeEventListener(eventNames().messageEvent, world); }
-
-    // Returns null if there is no entangled port, or if the entangled port is run by a different thread.
-    // This is used solely to enable a GC optimization. Some platforms may not be able to determine ownership
-    // of the remote port (since it may live cross-process) - those platforms may always return null.
-    MessagePort* locallyEntangledPort();
+    EventListener* onmessage(DOMWrapperWorld* world) { return getAttributeEventListener(EventTypeNames::message, world); }
 
     // A port starts out its life entangled, and remains entangled until it is closed or is cloned.
     bool isEntangled() { return !m_closed && !isNeutered(); }
@@ -103,20 +98,17 @@
     bool isNeutered() { return !m_entangledChannel; }
 
 private:
-    explicit MessagePort(ScriptExecutionContext&);
+    explicit MessagePort(ExecutionContext&);
 
     virtual void refEventTarget() OVERRIDE { ref(); }
     virtual void derefEventTarget() OVERRIDE { deref(); }
-    virtual EventTargetData* eventTargetData() OVERRIDE;
-    virtual EventTargetData* ensureEventTargetData() OVERRIDE;
 
-    OwnPtr<MessagePortChannel> m_entangledChannel;
+    RefPtr<MessagePortChannel> m_entangledChannel;
 
     bool m_started;
     bool m_closed;
 
-    ScriptExecutionContext* m_scriptExecutionContext;
-    EventTargetData m_eventTargetData;
+    ExecutionContext* m_executionContext;
 };
 
 } // namespace WebCore
diff --git a/Source/core/dom/MessagePortChannel.cpp b/Source/core/dom/MessagePortChannel.cpp
index be07120..00fd786 100644
--- a/Source/core/dom/MessagePortChannel.cpp
+++ b/Source/core/dom/MessagePortChannel.cpp
@@ -27,9 +27,144 @@
  * (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/dom/MessagePortChannel.h"
 
+#include "core/dom/MessagePort.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebMessagePortChannel.h"
+#include "public/platform/WebString.h"
+#include "wtf/PassRefPtr.h"
+
 namespace WebCore {
 
+PassRefPtr<MessagePortChannel> MessagePortChannel::create(WebKit::WebMessagePortChannel* channel)
+{
+    return adoptRef(new MessagePortChannel(channel));
+}
+
+void MessagePortChannel::createChannel(MessagePort* port1, MessagePort* port2)
+{
+    // Create proxies for each endpoint.
+    RefPtr<MessagePortChannel> channel1 = create(WebKit::Platform::current()->createMessagePortChannel());
+    RefPtr<MessagePortChannel> channel2 = create(WebKit::Platform::current()->createMessagePortChannel());
+
+    // Entangle the two endpoints.
+    channel1->setEntangledChannel(channel2);
+    channel2->setEntangledChannel(channel1);
+
+    // Now entangle the proxies with the appropriate local ports.
+    port1->entangle(channel2.release());
+    port2->entangle(channel1.release());
+}
+
+MessagePortChannel::MessagePortChannel(WebKit::WebMessagePortChannel* channel)
+    : m_localPort(0)
+    , m_webChannel(channel)
+{
+    ASSERT(m_webChannel);
+    m_webChannel->setClient(this);
+}
+
+MessagePortChannel::~MessagePortChannel()
+{
+    if (m_webChannel)
+        m_webChannel->destroy();
+}
+
+void MessagePortChannel::entangle(MessagePort* port)
+{
+    MutexLocker lock(m_mutex);
+    m_localPort = port;
+}
+
+void MessagePortChannel::disentangle()
+{
+    MutexLocker lock(m_mutex);
+    m_localPort = 0;
+}
+
+void MessagePortChannel::postMessageToRemote(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
+{
+    if (!m_localPort || !m_webChannel)
+        return;
+
+    WebKit::WebString messageString = message->toWireString();
+    WebKit::WebMessagePortChannelArray* webChannels = 0;
+    if (channels && channels->size()) {
+        webChannels = new WebKit::WebMessagePortChannelArray(channels->size());
+        for (size_t i = 0; i < channels->size(); ++i)
+            (*webChannels)[i] = (*channels)[i]->webChannelRelease();
+    }
+    m_webChannel->postMessage(messageString, webChannels);
+}
+
+bool MessagePortChannel::tryGetMessageFromRemote(RefPtr<SerializedScriptValue>& serializedMessage, OwnPtr<MessagePortChannelArray>& channels)
+{
+    if (!m_webChannel)
+        return false;
+
+    WebKit::WebString message;
+    WebKit::WebMessagePortChannelArray webChannels;
+    bool rv = m_webChannel->tryGetMessage(&message, webChannels);
+    if (rv) {
+        if (webChannels.size()) {
+            channels = adoptPtr(new MessagePortChannelArray(webChannels.size()));
+            for (size_t i = 0; i < webChannels.size(); ++i)
+                (*channels)[i] = MessagePortChannel::create(webChannels[i]);
+        }
+        serializedMessage = SerializedScriptValue::createFromWire(message);
+    }
+
+    return rv;
+}
+
+void MessagePortChannel::close()
+{
+    MutexLocker lock(m_mutex);
+    // Disentangle ourselves from the other end. We still maintain a reference to m_webChannel,
+    // since previously-existing messages should still be delivered.
+    m_localPort = 0;
+    m_entangledChannel = 0;
+}
+
+bool MessagePortChannel::isConnectedTo(MessagePort* port)
+{
+    MutexLocker lock(m_mutex);
+    // FIXME: Shouldn't the access to m_entangledChannel->m_localPort be protected by m_entangledChannel->m_mutex?
+    return m_entangledChannel && m_entangledChannel->m_localPort == port;
+}
+
+bool MessagePortChannel::hasPendingActivity()
+{
+    MutexLocker lock(m_mutex);
+    return m_localPort;
+}
+
+void MessagePortChannel::messageAvailable()
+{
+    MutexLocker lock(m_mutex);
+    if (m_localPort)
+        m_localPort->messageAvailable();
+}
+
+void MessagePortChannel::setEntangledChannel(PassRefPtr<MessagePortChannel> remote)
+{
+    ASSERT(m_webChannel);
+    m_webChannel->entangle(remote->m_webChannel);
+
+    MutexLocker lock(m_mutex);
+    m_entangledChannel = remote;
+}
+
+WebKit::WebMessagePortChannel* MessagePortChannel::webChannelRelease()
+{
+    ASSERT(m_webChannel);
+    WebKit::WebMessagePortChannel* webChannel = m_webChannel;
+    m_webChannel = 0;
+    webChannel->setClient(0);
+    return webChannel;
+}
+
 } // namespace WebCore
diff --git a/Source/core/dom/MessagePortChannel.h b/Source/core/dom/MessagePortChannel.h
index 5c78a31..c6e5b53 100644
--- a/Source/core/dom/MessagePortChannel.h
+++ b/Source/core/dom/MessagePortChannel.h
@@ -32,65 +32,79 @@
 #define MessagePortChannel_h
 
 #include "bindings/v8/SerializedScriptValue.h"
+#include "public/platform/WebMessagePortChannelClient.h"
 #include "wtf/Forward.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
+#include "wtf/ThreadSafeRefCounted.h"
+#include "wtf/ThreadingPrimitives.h"
+
+namespace WebKit {
+class WebMessagePortChannel;
+}
 
 namespace WebCore {
 
-    class MessagePort;
-    class MessagePortChannel;
-    class PlatformMessagePortChannel;
-    class ScriptExecutionContext;
-    class SerializedScriptValue;
+class MessagePort;
+class MessagePortChannel;
+class ExecutionContext;
+class SerializedScriptValue;
 
-    // The overwhelmingly common case is sending a single port, so handle that efficiently with an inline buffer of size 1.
-    typedef Vector<OwnPtr<MessagePortChannel>, 1> MessagePortChannelArray;
+// The overwhelmingly common case is sending a single port, so handle that efficiently with an inline buffer of size 1.
+typedef Vector<RefPtr<MessagePortChannel>, 1> MessagePortChannelArray;
 
-    // MessagePortChannel is a platform-independent interface to the remote side of a message channel.
-    // It acts as a wrapper around the platform-dependent PlatformMessagePortChannel implementation which ensures that the platform-dependent close() method is invoked before destruction.
-    class MessagePortChannel {
-        WTF_MAKE_NONCOPYABLE(MessagePortChannel); WTF_MAKE_FAST_ALLOCATED;
-    public:
-        static void createChannel(PassRefPtr<MessagePort>, PassRefPtr<MessagePort>);
+// MessagePortChannel is a platform-independent interface to the remote side of a message channel.
+class MessagePortChannel : public ThreadSafeRefCounted<MessagePortChannel>, public WebKit::WebMessagePortChannelClient {
+    WTF_MAKE_NONCOPYABLE(MessagePortChannel);
+public:
+    static void createChannel(MessagePort*, MessagePort*);
+    static PassRefPtr<MessagePortChannel> create(WebKit::WebMessagePortChannel*);
 
-        // Entangles the channel with a port (called when a port has been cloned, after the clone has been marshaled to its new owning thread and is ready to receive messages).
-        // Returns false if the entanglement failed because the port was closed.
-        bool entangleIfOpen(MessagePort*);
+    virtual ~MessagePortChannel();
 
-        // Disentangles the channel from a given port so it no longer forwards messages to the port. Called when the port is being cloned and no new owning thread has yet been established.
-        void disentangle();
+    // Entangles the channel with a port (called when a port has been cloned, after the clone has been marshaled to its new owning thread and is ready to receive messages).
+    void entangle(MessagePort*);
 
-        // Closes the port (ensures that no further messages can be added to either queue).
-        void close();
+    // Disentangles the channel from a given port so it no longer forwards messages to the port. Called when the port is being cloned and no new owning thread has yet been established.
+    void disentangle();
 
-        // Used by MessagePort.postMessage() to prevent callers from passing a port's own entangled port.
-        bool isConnectedTo(MessagePort*);
+    // Closes the port (ensures that no further messages can be added to either queue).
+    void close();
 
-        // Returns true if the proxy currently contains messages for this port.
-        bool hasPendingActivity();
+    // Used by MessagePort.postMessage() to prevent callers from passing a port's own entangled port.
+    bool isConnectedTo(MessagePort*);
 
-        // Sends a message and optional cloned port to the remote port.
-        void postMessageToRemote(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>);
+    // Returns true if the proxy currently contains messages for this port.
+    bool hasPendingActivity();
 
-        // Extracts a message from the message queue for this port.
-        bool tryGetMessageFromRemote(RefPtr<SerializedScriptValue>&, OwnPtr<MessagePortChannelArray>&);
+    // Sends a message and optional cloned port to the remote port.
+    void postMessageToRemote(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>);
 
-        // Returns the entangled port if run by the same thread (see MessagePort::locallyEntangledPort() for more details).
-        MessagePort* locallyEntangledPort(const ScriptExecutionContext*);
+    // Extracts a message from the message queue for this port.
+    bool tryGetMessageFromRemote(RefPtr<SerializedScriptValue>&, OwnPtr<MessagePortChannelArray>&);
 
-        ~MessagePortChannel();
+    // Releases ownership of the contained web channel.
+    WebKit::WebMessagePortChannel* webChannelRelease();
 
-        // Creates a new wrapper for the passed channel.
-        static PassOwnPtr<MessagePortChannel> create(PassRefPtr<PlatformMessagePortChannel>);
+private:
+    explicit MessagePortChannel(WebKit::WebMessagePortChannel*);
 
-        // FIXME: PlatformMessagePortChannel is an implementation detail, and should not be exposed via a public function.
-        PlatformMessagePortChannel* channel() const { return m_channel.get(); }
+    void setEntangledChannel(PassRefPtr<MessagePortChannel>);
 
-    private:
-        explicit MessagePortChannel(PassRefPtr<PlatformMessagePortChannel>);
-        RefPtr<PlatformMessagePortChannel> m_channel;
-    };
+    // WebKit::WebMessagePortChannelClient implementation
+    virtual void messageAvailable() OVERRIDE;
+
+    // Mutex used to ensure exclusive access to the object internals.
+    Mutex m_mutex;
+
+    // Pointer to our entangled pair - cleared when close() is called.
+    RefPtr<MessagePortChannel> m_entangledChannel;
+
+    // The port we are connected to - this is the port that is notified when new messages arrive.
+    MessagePort* m_localPort;
+
+    WebKit::WebMessagePortChannel* m_webChannel;
+};
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/Microtask.cpp b/Source/core/dom/Microtask.cpp
index cb0b12b..27cd217 100644
--- a/Source/core/dom/Microtask.cpp
+++ b/Source/core/dom/Microtask.cpp
@@ -31,8 +31,8 @@
 #include "config.h"
 #include "core/dom/Microtask.h"
 
-#include "core/dom/CustomElementCallbackDispatcher.h"
 #include "core/dom/MutationObserver.h"
+#include "core/dom/custom/CustomElementCallbackDispatcher.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
diff --git a/Source/core/dom/MutationCallback.h b/Source/core/dom/MutationCallback.h
index af904e2..5e15169 100644
--- a/Source/core/dom/MutationCallback.h
+++ b/Source/core/dom/MutationCallback.h
@@ -45,7 +45,7 @@
     virtual ~MutationCallback() { }
 
     virtual void call(const Vector<RefPtr<MutationRecord> >&, MutationObserver*) = 0;
-    virtual ScriptExecutionContext* scriptExecutionContext() const = 0;
+    virtual ExecutionContext* executionContext() const = 0;
 };
 
 }
diff --git a/Source/core/dom/MutationObserver.cpp b/Source/core/dom/MutationObserver.cpp
index 36d1100..5b664c4 100644
--- a/Source/core/dom/MutationObserver.cpp
+++ b/Source/core/dom/MutationObserver.cpp
@@ -33,6 +33,7 @@
 
 #include <algorithm>
 #include "bindings/v8/Dictionary.h"
+#include "bindings/v8/ExceptionMessages.h"
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
@@ -73,18 +74,10 @@
     ASSERT(m_registrations.isEmpty());
 }
 
-bool MutationObserver::validateOptions(MutationObserverOptions options)
-{
-    return (options & (Attributes | CharacterData | ChildList))
-        && ((options & Attributes) || !(options & AttributeOldValue))
-        && ((options & Attributes) || !(options & AttributeFilter))
-        && ((options & CharacterData) || !(options & CharacterDataOldValue));
-}
-
 void MutationObserver::observe(Node* node, const Dictionary& optionsDictionary, ExceptionState& es)
 {
     if (!node) {
-        es.throwUninformativeAndGenericDOMException(NotFoundError);
+        es.throwDOMException(NotFoundError, ExceptionMessages::failedToExecute("observe", "MutationObserver", "The provided node was null."));
         return;
     }
 
@@ -110,8 +103,22 @@
     if (optionsDictionary.get("attributeFilter", attributeFilter))
         options |= AttributeFilter;
 
-    if (!validateOptions(options)) {
-        es.throwUninformativeAndGenericDOMException(SyntaxError);
+    if (!(options & (Attributes | CharacterData | ChildList))) {
+        es.throwDOMException(SyntaxError, ExceptionMessages::failedToExecute("observe", "MutationObserver", "The options object must set at least one of 'attributes', 'characterData', or 'childList' to true."));
+        return;
+    }
+    if (!(options & Attributes)) {
+        if (options & AttributeOldValue) {
+            es.throwDOMException(SyntaxError, ExceptionMessages::failedToExecute("observe", "MutationObserver", "The options object may only set 'attributeOldValue' to true when 'attributes' is also true."));
+            return;
+        }
+        if (options & AttributeFilter) {
+            es.throwDOMException(SyntaxError, ExceptionMessages::failedToExecute("observe", "MutationObserver", "The options object may only set 'attributeFilter' when 'attributes' is also true."));
+            return;
+        }
+    }
+    if (!((options & CharacterData) || !(options & CharacterDataOldValue))) {
+        es.throwDOMException(SyntaxError, ExceptionMessages::failedToExecute("observe", "MutationObserver", "The options object may only set 'characterDataOldValue' to true when 'characterData' is also true."));
         return;
     }
 
@@ -182,7 +189,7 @@
 
 bool MutationObserver::canDeliver()
 {
-    return !m_callback->scriptExecutionContext()->activeDOMObjectsAreSuspended();
+    return !m_callback->executionContext()->activeDOMObjectsAreSuspended();
 }
 
 void MutationObserver::deliver()
diff --git a/Source/core/dom/MutationObserver.h b/Source/core/dom/MutationObserver.h
index 3f2941d..ff3c442 100644
--- a/Source/core/dom/MutationObserver.h
+++ b/Source/core/dom/MutationObserver.h
@@ -92,8 +92,6 @@
     explicit MutationObserver(PassRefPtr<MutationCallback>);
     void deliver();
 
-    static bool validateOptions(MutationObserverOptions);
-
     RefPtr<MutationCallback> m_callback;
     Vector<RefPtr<MutationRecord> > m_records;
     HashSet<MutationObserverRegistration*> m_registrations;
diff --git a/Source/core/dom/NameNodeList.h b/Source/core/dom/NameNodeList.h
index 96bcac4..5a595d8 100644
--- a/Source/core/dom/NameNodeList.h
+++ b/Source/core/dom/NameNodeList.h
@@ -31,7 +31,7 @@
 namespace WebCore {
 
 // NodeList which lists all Nodes in a Element with a given "name" attribute
-class NameNodeList : public LiveNodeList {
+class NameNodeList FINAL : public LiveNodeList {
 public:
     static PassRefPtr<NameNodeList> create(PassRefPtr<Node> rootNode, CollectionType type, const AtomicString& name)
     {
@@ -44,7 +44,7 @@
 private:
     NameNodeList(PassRefPtr<Node> rootNode, const AtomicString& name);
 
-    virtual bool nodeMatches(Element*) const;
+    virtual bool nodeMatches(Element*) const OVERRIDE;
 
     AtomicString m_name;
 };
diff --git a/Source/core/dom/NamedFlow.cpp b/Source/core/dom/NamedFlow.cpp
index 36c3952..2f5063e 100644
--- a/Source/core/dom/NamedFlow.cpp
+++ b/Source/core/dom/NamedFlow.cpp
@@ -31,9 +31,9 @@
 #include "core/dom/NamedFlow.h"
 
 #include "RuntimeEnabledFeatures.h"
-#include "core/events/EventNames.h"
 #include "core/dom/NamedFlowCollection.h"
 #include "core/dom/StaticNodeList.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/events/UIEvent.h"
 #include "core/rendering/RenderNamedFlowThread.h"
 #include "core/rendering/RenderRegion.h"
@@ -204,16 +204,6 @@
     m_parentFlowThread = parentFlowThread;
 }
 
-EventTargetData* NamedFlow::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* NamedFlow::ensureEventTargetData()
-{
-    return &m_eventTargetData;
-}
-
 void NamedFlow::dispatchRegionLayoutUpdateEvent()
 {
     ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
@@ -222,7 +212,7 @@
     if (flowState() == FlowStateNull)
         return;
 
-    RefPtr<Event> event = UIEvent::create(eventNames().webkitregionlayoutupdateEvent, false, false, m_flowManager->document()->defaultView(), 0);
+    RefPtr<Event> event = UIEvent::create(EventTypeNames::webkitregionlayoutupdate, false, false, m_flowManager->document()->defaultView(), 0);
 
     dispatchEvent(event);
 }
@@ -235,17 +225,17 @@
     if (flowState() == FlowStateNull)
         return;
 
-    RefPtr<Event> event = UIEvent::create(eventNames().webkitregionoversetchangeEvent, false, false, m_flowManager->document()->defaultView(), 0);
+    RefPtr<Event> event = UIEvent::create(EventTypeNames::webkitregionoversetchange, false, false, m_flowManager->document()->defaultView(), 0);
 
     dispatchEvent(event);
 }
 
 const AtomicString& NamedFlow::interfaceName() const
 {
-    return eventNames().interfaceForNamedFlow;
+    return EventTargetNames::NamedFlow;
 }
 
-ScriptExecutionContext* NamedFlow::scriptExecutionContext() const
+ExecutionContext* NamedFlow::executionContext() const
 {
     return m_flowManager->document();
 }
diff --git a/Source/core/dom/NamedFlow.h b/Source/core/dom/NamedFlow.h
index 1bc5ce3..8c3410a 100644
--- a/Source/core/dom/NamedFlow.h
+++ b/Source/core/dom/NamedFlow.h
@@ -43,9 +43,9 @@
 class Node;
 class NodeList;
 class RenderNamedFlowThread;
-class ScriptExecutionContext;
+class ExecutionContext;
 
-class NamedFlow : public RefCounted<NamedFlow>, public ScriptWrappable, public EventTarget {
+class NamedFlow : public RefCounted<NamedFlow>, public ScriptWrappable, public EventTargetWithInlineData {
 public:
     static PassRefPtr<NamedFlow> create(PassRefPtr<NamedFlowCollection> manager, const AtomicString& flowThreadName);
 
@@ -61,8 +61,8 @@
     using RefCounted<NamedFlow>::ref;
     using RefCounted<NamedFlow>::deref;
 
-    virtual const AtomicString& interfaceName() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const;
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
 
     // This function is called from the JS binding code to determine if the NamedFlow object is reachable or not.
     // If the object has listeners, the object should only be discarded if the parent Document is not reachable.
@@ -84,19 +84,14 @@
     NamedFlow(PassRefPtr<NamedFlowCollection>, const AtomicString&);
 
     // EventTarget implementation.
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
-
-    virtual EventTargetData* eventTargetData() OVERRIDE;
-    virtual EventTargetData* ensureEventTargetData() OVERRIDE;
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
 
     // The name of the flow thread as specified in CSS.
     AtomicString m_flowThreadName;
 
     RefPtr<NamedFlowCollection> m_flowManager;
     RenderNamedFlowThread* m_parentFlowThread;
-
-    EventTargetData m_eventTargetData;
 };
 
 }
diff --git a/Source/core/dom/NamedFlowCollection.cpp b/Source/core/dom/NamedFlowCollection.cpp
index ef35fa9..49a975c 100644
--- a/Source/core/dom/NamedFlowCollection.cpp
+++ b/Source/core/dom/NamedFlowCollection.cpp
@@ -103,7 +103,7 @@
 
 Document* NamedFlowCollection::document() const
 {
-    ScriptExecutionContext* context = ContextLifecycleObserver::scriptExecutionContext();
+    ExecutionContext* context = ContextLifecycleObserver::executionContext();
     return toDocument(context);
 }
 
diff --git a/Source/core/dom/NamedNodeMap.idl b/Source/core/dom/NamedNodeMap.idl
index 6169b7a..9c687b7 100644
--- a/Source/core/dom/NamedNodeMap.idl
+++ b/Source/core/dom/NamedNodeMap.idl
@@ -25,9 +25,9 @@
     Node getNamedItem([Default=Undefined] optional DOMString name);
     [NotEnumerable, ImplementedAs=getNamedItem] getter Node ([Default=Undefined] optional DOMString name);
 
-    [RaisesException, CustomElementCallbacks=Enable] Node setNamedItem([Default=Undefined] optional Node node);
+    [RaisesException, CustomElementCallbacks] Node setNamedItem([Default=Undefined] optional Node node);
 
-    [RaisesException, CustomElementCallbacks=Enable] Node removeNamedItem([Default=Undefined] optional DOMString name);
+    [RaisesException, CustomElementCallbacks] Node removeNamedItem([Default=Undefined] optional DOMString name);
 
     getter Node item([Default=Undefined] optional unsigned long index);
 
@@ -40,9 +40,9 @@
     /*[RaisesException]*/ Node getNamedItemNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                               [Default=Undefined] optional DOMString localName);
 
-    [RaisesException, CustomElementCallbacks=Enable] Node setNamedItemNS([Default=Undefined] optional Node node);
+    [RaisesException, CustomElementCallbacks] Node setNamedItemNS([Default=Undefined] optional Node node);
 
-    [RaisesException, CustomElementCallbacks=Enable] Node removeNamedItemNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
+    [RaisesException, CustomElementCallbacks] Node removeNamedItemNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                           [Default=Undefined] optional DOMString localName);
 
 };
diff --git a/Source/core/dom/NamedNodesCollection.h b/Source/core/dom/NamedNodesCollection.h
index 0b4199b..b202bcf 100644
--- a/Source/core/dom/NamedNodesCollection.h
+++ b/Source/core/dom/NamedNodesCollection.h
@@ -39,7 +39,7 @@
 
 namespace WebCore {
 
-class NamedNodesCollection : public NodeList {
+class NamedNodesCollection FINAL : public NodeList {
 public:
     static PassRefPtr<NodeList> create(const Vector<RefPtr<Node> >& nodes)
     {
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index e299a9a..4763559 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -33,7 +33,6 @@
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Attr.h"
 #include "core/dom/Attribute.h"
-#include "core/events/BeforeLoadEvent.h"
 #include "core/dom/ChildListMutationScope.h"
 #include "core/dom/ChildNodeList.h"
 #include "core/dom/ClassNodeList.h"
@@ -43,17 +42,8 @@
 #include "core/dom/DocumentType.h"
 #include "core/dom/Element.h"
 #include "core/dom/ElementRareData.h"
-#include "core/events/Event.h"
-#include "core/events/EventDispatchMediator.h"
-#include "core/events/EventDispatcher.h"
-#include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/events/GestureEvent.h"
-#include "core/events/KeyboardEvent.h"
 #include "core/dom/LiveNodeList.h"
-#include "core/events/MouseEvent.h"
-#include "core/events/MutationEvent.h"
 #include "core/dom/NameNodeList.h"
 #include "core/dom/NodeRareData.h"
 #include "core/dom/NodeTraversal.h"
@@ -62,18 +52,27 @@
 #include "core/dom/TagNodeList.h"
 #include "core/dom/TemplateContentDocumentFragment.h"
 #include "core/dom/Text.h"
-#include "core/events/TextEvent.h"
-#include "core/dom/TouchController.h"
-#include "core/events/TouchEvent.h"
 #include "core/dom/TreeScopeAdopter.h"
-#include "core/events/UIEvent.h"
 #include "core/dom/UserActionElementSet.h"
 #include "core/dom/WheelController.h"
-#include "core/events/WheelEvent.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/events/BeforeLoadEvent.h"
+#include "core/events/Event.h"
+#include "core/events/EventDispatchMediator.h"
+#include "core/events/EventDispatcher.h"
+#include "core/events/EventListener.h"
+#include "core/events/GestureEvent.h"
+#include "core/events/KeyboardEvent.h"
+#include "core/events/MouseEvent.h"
+#include "core/events/MutationEvent.h"
+#include "core/events/TextEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/events/TouchEvent.h"
+#include "core/events/UIEvent.h"
+#include "core/events/WheelEvent.h"
 #include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLDialogElement.h"
 #include "core/html/HTMLFrameOwnerElement.h"
@@ -82,13 +81,13 @@
 #include "core/inspector/InspectorCounters.h"
 #include "core/page/ContextMenuController.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/Partitions.h"
 #include "core/rendering/FlowThreadController.h"
 #include "core/rendering/RenderBox.h"
 #include "core/svg/graphics/SVGImage.h"
+#include "platform/Partitions.h"
 #include "wtf/HashSet.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefCountedLeakCounter.h"
@@ -312,7 +311,7 @@
 {
     if (hasEventTargetData()) {
         if (document)
-            TouchController::from(document)->didRemoveEventTargetNode(document, this);
+            document->didRemoveEventTargetNode(this);
         clearEventTargetData();
     }
 
@@ -461,7 +460,7 @@
     if (isContainerNode())
         toContainerNode(this)->insertBefore(newChild, refChild, es);
     else
-        es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
+        es.throwDOMException(HierarchyRequestError, ExceptionMessages::failedToExecute("insertBefore", "Node", "This node type does not support this method."));
 }
 
 void Node::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionState& es)
@@ -469,7 +468,7 @@
     if (isContainerNode())
         toContainerNode(this)->replaceChild(newChild, oldChild, es);
     else
-        es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
+        es.throwDOMException(HierarchyRequestError, ExceptionMessages::failedToExecute("replaceChild", "Node", "This node type does not support this method."));
 }
 
 void Node::removeChild(Node* oldChild, ExceptionState& es)
@@ -477,7 +476,7 @@
     if (isContainerNode())
         toContainerNode(this)->removeChild(oldChild, es);
     else
-        es.throwUninformativeAndGenericDOMException(NotFoundError);
+        es.throwDOMException(NotFoundError, ExceptionMessages::failedToExecute("removeChild", "Node", "This node type does not support this method."));
 }
 
 void Node::appendChild(PassRefPtr<Node> newChild, ExceptionState& es)
@@ -485,7 +484,7 @@
     if (isContainerNode())
         toContainerNode(this)->appendChild(newChild, es);
     else
-        es.throwUninformativeAndGenericDOMException(HierarchyRequestError);
+        es.throwDOMException(HierarchyRequestError, ExceptionMessages::failedToExecute("appendChild", "Node", "This node type does not support this method."));
 }
 
 void Node::remove(ExceptionState& es)
@@ -528,7 +527,7 @@
     // The spec says that for nodes other than elements and attributes, prefix is always null.
     // It does not say what to do when the user tries to set the prefix on another type of
     // node, however Mozilla throws a NamespaceError exception.
-    es.throwUninformativeAndGenericDOMException(NamespaceError);
+    es.throwDOMException(NamespaceError, ExceptionMessages::failedToSet("prefix", "Node", "Prefixes are only supported on element and attribute nodes."));
 }
 
 const AtomicString& Node::localName() const
@@ -731,7 +730,7 @@
 void Node::setNeedsStyleRecalc(StyleChangeType changeType, StyleChangeSource source)
 {
     ASSERT(changeType != NoStyleChange);
-    if (!attached()) // changed compared to what?
+    if (!confusingAndOftenMisusedAttached()) // changed compared to what?
         return;
 
     if (source == StyleChangeFromRenderer)
@@ -750,7 +749,7 @@
     markAncestorsWithChildNeedsStyleRecalc();
     for (Node* node = this; node; node = NodeTraversal::next(node, this)) {
         node->setAttached();
-        node->setStyleChange(LazyAttachStyleChange);
+        node->setStyleChange(NeedsReattachStyleChange);
         if (node->isContainerNode())
             node->setChildNeedsStyleRecalc();
         for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->olderShadowRoot())
@@ -861,7 +860,7 @@
     // Element::setPrefix() and Attr::setPrefix()
 
     if (!prefix.isEmpty() && !Document::isValidName(prefix)) {
-        es.throwUninformativeAndGenericDOMException(InvalidCharacterError);
+        es.throwDOMException(InvalidCharacterError, ExceptionMessages::failedToSet("prefix", "Node", "The prefix '" + prefix + "' is not a valid name."));
         return;
     }
 
@@ -885,7 +884,7 @@
     // Return true if other is an ancestor of this, otherwise false
     if (!other || !other->hasChildNodes() || inDocument() != other->inDocument())
         return false;
-    if (&other->treeScope() != &treeScope())
+    if (other->treeScope() != treeScope())
         return false;
     if (other->isTreeScope())
         return !isTreeScope();
@@ -911,7 +910,7 @@
     if (this == node)
         return true;
 
-    if (&document() != &node->document())
+    if (document() != node->document())
         return false;
 
     if (inDocument() != node->inDocument())
@@ -923,7 +922,7 @@
         return false;
 
     for (; node; node = node->shadowHost()) {
-        if (&treeScope() == &node->treeScope())
+        if (treeScope() == node->treeScope())
             return contains(node);
     }
 
@@ -943,43 +942,21 @@
     return false;
 }
 
-inline void Node::detachNode(Node* root, const AttachContext& context)
-{
-    Node* node = root;
-    while (node) {
-        if (node->styleChangeType() == LazyAttachStyleChange) {
-            // FIXME: This is needed because Node::lazyAttach marks nodes as being attached even
-            // though they've never been through attach(). This allows us to avoid doing all the
-            // virtual calls to detach() and other associated work.
-            node->clearAttached();
-            node->clearChildNeedsStyleRecalc();
-
-            for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot())
-                detachNode(shadowRoot, context);
-
-            node = NodeTraversal::next(node, root);
-            continue;
-        }
-        // Handle normal reattaches from style recalc (ex. display type changes)
-        if (node->attached())
-            node->detach(context);
-        node = NodeTraversal::nextSkippingChildren(node, root);
-    }
-}
-
 void Node::reattach(const AttachContext& context)
 {
     AttachContext reattachContext(context);
     reattachContext.performingReattach = true;
 
-    detachNode(this, reattachContext);
+    // We only need to detach if the node has already been through attach().
+    if (styleChangeType() < NeedsReattachStyleChange)
+        detach(reattachContext);
     attach(reattachContext);
 }
 
 void Node::attach(const AttachContext&)
 {
     ASSERT(document().inStyleRecalc() || isDocumentNode());
-    ASSERT(!attached());
+    ASSERT(needsAttach());
     ASSERT(!renderer() || (renderer()->style() && (renderer()->parent() || renderer()->isRenderView())));
 
     setAttached();
@@ -1024,7 +1001,7 @@
         }
     }
 
-    clearAttached();
+    clearFlag(IsAttachedFlag);
 
 #ifndef NDEBUG
     detachingNode = 0;
@@ -1270,7 +1247,7 @@
 PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, ExceptionState& es)
 {
     if (selectors.isEmpty()) {
-        es.throwUninformativeAndGenericDOMException(SyntaxError);
+        es.throwDOMException(SyntaxError, ExceptionMessages::failedToExecute("querySelector", "Node", "The provided selector is empty."));
         return 0;
     }
 
@@ -1283,7 +1260,7 @@
 PassRefPtr<NodeList> Node::querySelectorAll(const AtomicString& selectors, ExceptionState& es)
 {
     if (selectors.isEmpty()) {
-        es.throwUninformativeAndGenericDOMException(SyntaxError);
+        es.throwDOMException(SyntaxError, ExceptionMessages::failedToExecute("querySelectorAll", "Node", "The provided selector is empty."));
         return 0;
     }
 
@@ -1682,7 +1659,7 @@
     // If one node is in the document and the other is not, we must be disconnected.
     // If the nodes have different owning documents, they must be disconnected.  Note that we avoid
     // comparing Attr nodes here, since they return false from inDocument() all the time (which seems like a bug).
-    if (start1->inDocument() != start2->inDocument() || (treatment == TreatShadowTreesAsDisconnected && &start1->treeScope() != &start2->treeScope())) {
+    if (start1->inDocument() != start2->inDocument() || (treatment == TreatShadowTreesAsDisconnected && start1->treeScope() != start2->treeScope())) {
         unsigned short direction = (this > otherNode) ? DOCUMENT_POSITION_PRECEDING : DOCUMENT_POSITION_FOLLOWING;
         return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | direction;
     }
@@ -1703,7 +1680,7 @@
         return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | direction;
     }
 
-    unsigned connection = &start1->treeScope() != &start2->treeScope() ? DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC : 0;
+    unsigned connection = start1->treeScope() != start2->treeScope() ? DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC : 0;
 
     // Walk the two chains backwards and look for the first difference.
     for (unsigned i = min(index1, index2); i; --i) {
@@ -2014,15 +1991,15 @@
 
 const AtomicString& Node::interfaceName() const
 {
-    return eventNames().interfaceForNode;
+    return EventTargetNames::Node;
 }
 
-ScriptExecutionContext* Node::scriptExecutionContext() const
+ExecutionContext* Node::executionContext() const
 {
     return document().contextDocument().get();
 }
 
-void Node::didMoveToNewDocument(Document* oldDocument)
+void Node::didMoveToNewDocument(Document& oldDocument)
 {
     TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(oldDocument);
 
@@ -2035,30 +2012,29 @@
         }
     }
 
-    if (AXObjectCache::accessibilityEnabled() && oldDocument)
-        if (AXObjectCache* cache = oldDocument->existingAXObjectCache())
+    if (AXObjectCache::accessibilityEnabled()) {
+        if (AXObjectCache* cache = oldDocument.existingAXObjectCache())
             cache->remove(this);
+    }
 
-    const EventListenerVector& mousewheelListeners = getEventListeners(eventNames().mousewheelEvent);
-    WheelController* oldWheelController = WheelController::from(oldDocument);
-    WheelController* newWheelController = WheelController::from(&document());
+    const EventListenerVector& mousewheelListeners = getEventListeners(EventTypeNames::mousewheel);
+    WheelController* oldController = WheelController::from(&oldDocument);
+    WheelController* newController = WheelController::from(&document());
     for (size_t i = 0; i < mousewheelListeners.size(); ++i) {
-        oldWheelController->didRemoveWheelEventHandler(oldDocument);
-        newWheelController->didAddWheelEventHandler(&document());
+        oldController->didRemoveWheelEventHandler(&oldDocument);
+        newController->didAddWheelEventHandler(&document());
     }
 
-    const EventListenerVector& wheelListeners = getEventListeners(eventNames().wheelEvent);
+    const EventListenerVector& wheelListeners = getEventListeners(EventTypeNames::wheel);
     for (size_t i = 0; i < wheelListeners.size(); ++i) {
-        oldWheelController->didRemoveWheelEventHandler(oldDocument);
-        newWheelController->didAddWheelEventHandler(&document());
+        oldController->didRemoveWheelEventHandler(&oldDocument);
+        newController->didAddWheelEventHandler(&document());
     }
 
-    TouchController* oldTouchController = TouchController::from(oldDocument);
-    if (const TouchEventTargetSet* touchHandlers = oldDocument ? oldTouchController->touchEventTargets() : 0) {
-        TouchController* newTouchController = TouchController::from(&document());
+    if (const TouchEventTargetSet* touchHandlers = oldDocument.touchEventTargets()) {
         while (touchHandlers->contains(this)) {
-            oldTouchController->didRemoveTouchEventHandler(oldDocument, this);
-            newTouchController->didAddTouchEventHandler(&document(), this);
+            oldDocument.didRemoveTouchEventHandler(this);
+            document().didAddTouchEventHandler(this);
         }
     }
 
@@ -2082,10 +2058,10 @@
 
     Document& document = targetNode->document();
     document.addListenerTypeIfNeeded(eventType);
-    if (eventType == eventNames().wheelEvent || eventType == eventNames().mousewheelEvent)
+    if (eventType == EventTypeNames::wheel || eventType == EventTypeNames::mousewheel)
         WheelController::from(&document)->didAddWheelEventHandler(&document);
-    else if (eventNames().isTouchEventType(eventType))
-        TouchController::from(&document)->didAddTouchEventHandler(&document, targetNode);
+    else if (isTouchEventType(eventType))
+        document.didAddTouchEventHandler(targetNode);
 
     return true;
 }
@@ -2103,10 +2079,10 @@
     // FIXME: Notify Document that the listener has vanished. We need to keep track of a number of
     // listeners for each type, not just a bool - see https://bugs.webkit.org/show_bug.cgi?id=33861
     Document& document = targetNode->document();
-    if (eventType == eventNames().wheelEvent || eventType == eventNames().mousewheelEvent)
+    if (eventType == EventTypeNames::wheel || eventType == EventTypeNames::mousewheel)
         WheelController::from(&document)->didAddWheelEventHandler(&document);
-    else if (eventNames().isTouchEventType(eventType))
-        TouchController::from(&document)->didRemoveTouchEventHandler(&document, targetNode);
+    else if (isTouchEventType(eventType))
+        document.didRemoveTouchEventHandler(targetNode);
 
     return true;
 }
@@ -2129,14 +2105,14 @@
     return hasEventTargetData() ? eventTargetDataMap().get(this) : 0;
 }
 
-EventTargetData* Node::ensureEventTargetData()
+EventTargetData& Node::ensureEventTargetData()
 {
     if (hasEventTargetData())
-        return eventTargetDataMap().get(this);
+        return *eventTargetDataMap().get(this);
     setHasEventTargetData(true);
     EventTargetData* data = new EventTargetData;
     eventTargetDataMap().set(this, adoptPtr(data));
-    return data;
+    return *data;
 }
 
 void Node::clearEventTargetData()
@@ -2304,13 +2280,13 @@
     if (!document().hasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER))
         return;
 
-    dispatchScopedEvent(MutationEvent::create(eventNames().DOMSubtreeModifiedEvent, true));
+    dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMSubtreeModified, true));
 }
 
 bool Node::dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEvent)
 {
     ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
-    RefPtr<UIEvent> event = UIEvent::create(eventNames().DOMActivateEvent, true, true, document().defaultView(), detail);
+    RefPtr<UIEvent> event = UIEvent::create(EventTypeNames::DOMActivate, true, true, document().defaultView(), detail);
     event->setUnderlyingEvent(underlyingEvent);
     dispatchScopedEvent(event);
     return event->defaultHandled();
@@ -2363,12 +2339,12 @@
 
 void Node::dispatchChangeEvent()
 {
-    dispatchScopedEvent(Event::createBubble(eventNames().changeEvent));
+    dispatchScopedEvent(Event::createBubble(EventTypeNames::change));
 }
 
 void Node::dispatchInputEvent()
 {
-    dispatchScopedEvent(Event::createBubble(eventNames().inputEvent));
+    dispatchScopedEvent(Event::createBubble(EventTypeNames::input));
 }
 
 void Node::defaultEventHandler(Event* event)
@@ -2376,24 +2352,25 @@
     if (event->target() != this)
         return;
     const AtomicString& eventType = event->type();
-    if (eventType == eventNames().keydownEvent || eventType == eventNames().keypressEvent) {
+    if (eventType == EventTypeNames::keydown || eventType == EventTypeNames::keypress) {
         if (event->isKeyboardEvent()) {
             if (Frame* frame = document().frame())
                 frame->eventHandler()->defaultKeyboardEventHandler(toKeyboardEvent(event));
         }
-    } else if (eventType == eventNames().clickEvent) {
+    } else if (eventType == EventTypeNames::click) {
         int detail = event->isUIEvent() ? static_cast<UIEvent*>(event)->detail() : 0;
         if (dispatchDOMActivateEvent(detail, event))
             event->setDefaultHandled();
-    } else if (eventType == eventNames().contextmenuEvent) {
+    } else if (eventType == EventTypeNames::contextmenu) {
         if (Page* page = document().page())
             page->contextMenuController().handleContextMenuEvent(event);
-    } else if (eventType == eventNames().textInputEvent) {
-        if (event->hasInterface(eventNames().interfaceForTextEvent))
+    } else if (eventType == EventTypeNames::textInput) {
+        if (event->hasInterface(EventNames::TextEvent)) {
             if (Frame* frame = document().frame())
-                frame->eventHandler()->defaultTextInputEventHandler(static_cast<TextEvent*>(event));
+                frame->eventHandler()->defaultTextInputEventHandler(toTextEvent(event));
+        }
 #if OS(WIN)
-    } else if (eventType == eventNames().mousedownEvent && event->isMouseEvent()) {
+    } else if (eventType == EventTypeNames::mousedown && event->isMouseEvent()) {
         MouseEvent* mouseEvent = toMouseEvent(event);
         if (mouseEvent->button() == MiddleButton) {
             if (enclosingLinkEventParentOrSelf())
@@ -2409,8 +2386,8 @@
             }
         }
 #endif
-    } else if ((eventType == eventNames().wheelEvent || eventType == eventNames().mousewheelEvent) && event->hasInterface(eventNames().interfaceForWheelEvent)) {
-        WheelEvent* wheelEvent = static_cast<WheelEvent*>(event);
+    } else if ((eventType == EventTypeNames::wheel || eventType == EventTypeNames::mousewheel) && event->hasInterface(EventNames::WheelEvent)) {
+        WheelEvent* wheelEvent = toWheelEvent(event);
 
         // If we don't have a renderer, send the wheel event to the first node we find with a renderer.
         // This is needed for <option> and <optgroup> elements so that <select>s get a wheel scroll.
@@ -2421,7 +2398,7 @@
         if (startNode && startNode->renderer())
             if (Frame* frame = document().frame())
                 frame->eventHandler()->defaultWheelEventHandler(startNode, wheelEvent);
-    } else if (event->type() == eventNames().webkitEditableContentChangedEvent) {
+    } else if (event->type() == EventTypeNames::webkitEditableContentChanged) {
         dispatchInputEvent();
     }
 }
@@ -2434,27 +2411,27 @@
 {
     if (isDisabledFormControl(this))
         return false;
-    return hasEventListeners(eventNames().mousemoveEvent) || hasEventListeners(eventNames().mouseoverEvent) || hasEventListeners(eventNames().mouseoutEvent);
+    return hasEventListeners(EventTypeNames::mousemove) || hasEventListeners(EventTypeNames::mouseover) || hasEventListeners(EventTypeNames::mouseout);
 }
 
 bool Node::willRespondToMouseClickEvents()
 {
     if (isDisabledFormControl(this))
         return false;
-    return isContentEditable(UserSelectAllIsAlwaysNonEditable) || hasEventListeners(eventNames().mouseupEvent) || hasEventListeners(eventNames().mousedownEvent) || hasEventListeners(eventNames().clickEvent) || hasEventListeners(eventNames().DOMActivateEvent);
+    return isContentEditable(UserSelectAllIsAlwaysNonEditable) || hasEventListeners(EventTypeNames::mouseup) || hasEventListeners(EventTypeNames::mousedown) || hasEventListeners(EventTypeNames::click) || hasEventListeners(EventTypeNames::DOMActivate);
 }
 
 bool Node::willRespondToTouchEvents()
 {
     if (isDisabledFormControl(this))
         return false;
-    return hasEventListeners(eventNames().touchstartEvent) || hasEventListeners(eventNames().touchmoveEvent) || hasEventListeners(eventNames().touchcancelEvent) || hasEventListeners(eventNames().touchendEvent);
+    return hasEventListeners(EventTypeNames::touchstart) || hasEventListeners(EventTypeNames::touchmove) || hasEventListeners(EventTypeNames::touchcancel) || hasEventListeners(EventTypeNames::touchend);
 }
 
 // This is here for inlining
 inline void TreeScope::removedLastRefToScope()
 {
-    ASSERT(!deletionHasBegun());
+    ASSERT_WITH_SECURITY_IMPLICATION(!deletionHasBegun());
     if (m_guardRefCount) {
         // If removing a child removes the last self-only ref, we don't
         // want the scope to be destructed until after
@@ -2462,14 +2439,16 @@
         // extra self-only ref.
         guardRef();
         dispose();
-#ifndef NDEBUG
+#if !ASSERT_DISABLED
         // We need to do this right now since guardDeref() can delete this.
         rootNode()->m_inRemovedLastRefFunction = false;
 #endif
         guardDeref();
     } else {
-#ifndef NDEBUG
+#if !ASSERT_DISABLED
         rootNode()->m_inRemovedLastRefFunction = false;
+#endif
+#if SECURITY_ASSERT_ENABLED
         beginDeletion();
 #endif
         delete this;
@@ -2488,7 +2467,7 @@
         return;
     }
 
-#ifndef NDEBUG
+#if SECURITY_ASSERT_ENABLED
     m_deletionHasBegun = true;
 #endif
     delete this;
diff --git a/Source/core/dom/Node.h b/Source/core/dom/Node.h
index 612111e..bfb6cb8 100644
--- a/Source/core/dom/Node.h
+++ b/Source/core/dom/Node.h
@@ -27,15 +27,15 @@
 
 #include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/events/EventTarget.h"
 #include "core/dom/MutationObserver.h"
 #include "core/dom/SimulatedClickOptions.h"
 #include "core/dom/TreeScope.h"
+#include "core/dom/TreeShared.h"
 #include "core/editing/EditingBoundary.h"
+#include "core/events/EventTarget.h"
 #include "core/inspector/InspectorCounters.h"
-#include "core/platform/TreeShared.h"
-#include "core/platform/graphics/LayoutRect.h"
 #include "core/rendering/style/RenderStyleConstants.h"
+#include "platform/geometry/LayoutRect.h"
 #include "weborigin/KURLHash.h"
 #include "wtf/Forward.h"
 #include "wtf/ListHashSet.h"
@@ -90,7 +90,7 @@
     NoStyleChange = 0,
     LocalStyleChange = 1 << nodeStyleChangeShift,
     SubtreeStyleChange = 2 << nodeStyleChangeShift,
-    LazyAttachStyleChange = 3 << nodeStyleChangeShift,
+    NeedsReattachStyleChange = 3 << nodeStyleChangeShift,
 };
 
 // If the style change is from the renderer then we'll call setStyle on the
@@ -167,7 +167,6 @@
     // DOM methods & attributes for Node
 
     bool hasTagName(const QualifiedName&) const;
-    bool hasLocalName(const AtomicString&) const;
     virtual String nodeName() const = 0;
     virtual String nodeValue() const;
     virtual void setNodeValue(const String&);
@@ -179,8 +178,6 @@
     PassRefPtr<NodeList> childNodes();
     Node* firstChild() const;
     Node* lastChild() const;
-    bool hasAttributes() const;
-    NamedNodeMap* attributes() const;
 
     // ChildNode interface API
     Element* previousElementSibling() const;
@@ -195,8 +192,7 @@
     virtual KURL baseURI() const;
 
     // These should all actually return a node, but this is only important for language bindings,
-    // which will already know and hold a ref on the right node to return. Returning bool allows
-    // these methods to be more efficient since they don't need to return a ref
+    // which will already know and hold a ref on the right node to return.
     void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionState& = ASSERT_NO_EXCEPTION);
     void replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionState& = ASSERT_NO_EXCEPTION);
     void removeChild(Node* child, ExceptionState&);
@@ -365,7 +361,10 @@
     bool hovered() const { return isUserActionElement() && isUserActionElementHovered(); }
     bool focused() const { return isUserActionElement() && isUserActionElementFocused(); }
 
-    bool attached() const { return getFlag(IsAttachedFlag); }
+    // FIXME: Don't let InsertionPoints attach out of order and remove
+    // childAttachedAllowedWhenAttachingChildren and child->needsAttach() checks.
+    bool needsAttach() const { return !getFlag(IsAttachedFlag) || styleChangeType() == NeedsReattachStyleChange; }
+    bool confusingAndOftenMisusedAttached() const { return getFlag(IsAttachedFlag); }
     void setAttached() { setFlag(IsAttachedFlag); }
     bool needsStyleRecalc() const { return styleChangeType() != NoStyleChange; }
     StyleChangeType styleChangeType() const { return static_cast<StyleChangeType>(m_nodeFlags & StyleChangeMask); }
@@ -636,8 +635,8 @@
 
     virtual Node* toNode();
 
-    virtual const AtomicString& interfaceName() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const;
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
 
     virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
     virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
@@ -677,8 +676,8 @@
     using TreeShared<Node>::ref;
     using TreeShared<Node>::deref;
 
-    virtual EventTargetData* eventTargetData();
-    virtual EventTargetData* ensureEventTargetData();
+    virtual EventTargetData* eventTargetData() OVERRIDE;
+    virtual EventTargetData& ensureEventTargetData() OVERRIDE;
 
     void getRegisteredMutationObserversOfType(HashMap<MutationObserver*, MutationRecordDeliveryOptions>&, MutationObserver::MutationType, const QualifiedName* attributeName);
     void registerMutationObserver(MutationObserver*, MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
@@ -791,7 +790,7 @@
         InspectorCounters::incrementCounter(InspectorCounters::NodeCounter);
     }
 
-    virtual void didMoveToNewDocument(Document* oldDocument);
+    virtual void didMoveToNewDocument(Document& oldDocument);
 
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { }
 
@@ -831,14 +830,11 @@
 
     void setStyleChange(StyleChangeType);
 
-    void detachNode(Node*, const AttachContext&);
-    void clearAttached() { clearFlag(IsAttachedFlag); }
-
     // Used to share code between lazyAttach and setNeedsStyleRecalc.
     void markAncestorsWithChildNeedsStyleRecalc();
 
-    virtual void refEventTarget();
-    virtual void derefEventTarget();
+    virtual void refEventTarget() OVERRIDE;
+    virtual void derefEventTarget() OVERRIDE;
 
     virtual RenderStyle* nonRendererStyle() const { return 0; }
 
@@ -905,19 +901,19 @@
 
 inline void Node::lazyReattachIfAttached()
 {
-    if (attached())
+    if (confusingAndOftenMisusedAttached())
         lazyReattach();
 }
 
 inline void Node::lazyReattach()
 {
-    if (styleChangeType() == LazyAttachStyleChange)
+    if (styleChangeType() == NeedsReattachStyleChange)
         return;
 
     AttachContext context;
     context.performingReattach = true;
 
-    if (attached())
+    if (confusingAndOftenMisusedAttached())
         detach(context);
     lazyAttach();
 }
@@ -927,7 +923,43 @@
     return change >= Inherit || node->childNeedsStyleRecalc() || node->needsStyleRecalc();
 }
 
-} //namespace
+// Allow equality comparisons of Nodes by reference or pointer, interchangeably.
+inline bool operator==(const Node& a, const Node& b) { return &a == &b; }
+inline bool operator==(const Node& a, const Node* b) { return &a == b; }
+inline bool operator==(const Node* a, const Node& b) { return a == &b; }
+inline bool operator!=(const Node& a, const Node& b) { return !(a == b); }
+inline bool operator!=(const Node& a, const Node* b) { return !(a == b); }
+inline bool operator!=(const Node* a, const Node& b) { return !(a == b); }
+
+// FIXME: Move to more generic place.
+#define DEFINE_TYPE_CASTS(thisType, argumentType, argumentName, pointerPredicate, referencePredicate) \
+inline thisType* to##thisType(argumentType* argumentName) \
+{ \
+    ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \
+    return static_cast<thisType*>(argumentName); \
+} \
+inline const thisType* to##thisType(const argumentType* argumentName) \
+{ \
+    ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \
+    return static_cast<const thisType*>(argumentName); \
+} \
+inline thisType& to##thisType(argumentType& argumentName) \
+{ \
+    ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \
+    return static_cast<thisType&>(argumentName); \
+} \
+inline const thisType& to##thisType(const argumentType& argumentName) \
+{ \
+    ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \
+    return static_cast<const thisType&>(argumentName); \
+} \
+void to##thisType(const thisType*); \
+void to##thisType(const thisType&)
+
+#define DEFINE_NODE_TYPE_CASTS(thisType, predicate) \
+    DEFINE_TYPE_CASTS(thisType, Node, node, node->predicate, node.predicate)
+
+} // namespace WebCore
 
 #ifndef NDEBUG
 // Outside the WebCore namespace for ease of invocation from gdb.
diff --git a/Source/core/dom/Node.idl b/Source/core/dom/Node.idl
index 3d774a2..3e3ec70 100644
--- a/Source/core/dom/Node.idl
+++ b/Source/core/dom/Node.idl
@@ -39,7 +39,7 @@
     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString        nodeName;
 
              // FIXME: the spec says this can also raise on retrieval.
-    [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, CustomElementCallbacks=Enable] attribute DOMString nodeValue;
+    [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, CustomElementCallbacks] attribute DOMString nodeValue;
 
     [PerWorldBindings] readonly attribute unsigned short   nodeType;
     [PerWorldBindings] readonly attribute Node             parentNode;
@@ -50,15 +50,15 @@
     [PerWorldBindings] readonly attribute Node             nextSibling;
     [PerWorldBindings] readonly attribute Document         ownerDocument;
 
-    [Custom, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Node insertBefore(Node newChild, Node refChild);
-    [Custom, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Node replaceChild(Node newChild, Node oldChild);
-    [Custom, PerWorldBindings, RaisesException] Node removeChild(Node oldChild);
-    [Custom, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Node appendChild(Node newChild);
+    [Custom, CustomElementCallbacks, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, RaisesException] Node insertBefore(Node newChild, Node refChild);
+    [Custom, CustomElementCallbacks, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, RaisesException] Node replaceChild(Node newChild, Node oldChild);
+    [Custom, CustomElementCallbacks, PerWorldBindings, RaisesException] Node removeChild(Node oldChild);
+    [Custom, CustomElementCallbacks, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, RaisesException] Node appendChild(Node newChild);
 
     boolean            hasChildNodes();
-    [CustomElementCallbacks=Enable, PerWorldBindings]
+    [CustomElementCallbacks, PerWorldBindings]
     Node               cloneNode(optional boolean deep);
-    [CustomElementCallbacks=Enable] void normalize();
+    [CustomElementCallbacks] void normalize();
 
     // Introduced in DOM Level 2:
     [MeasureAs=NodeIsSupported] boolean isSupported([Default=Undefined] optional DOMString feature,
@@ -72,7 +72,7 @@
     [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString       baseURI;
 
              // FIXME: the spec says this can also raise on retrieval.
-             [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException, CustomElementCallbacks=Enable] attribute DOMString       textContent;
+             [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException, CustomElementCallbacks] attribute DOMString       textContent;
 
     [MeasureAs=NodeIsSameNode] boolean isSameNode([Default=Undefined] optional Node other); // Removed in DOM4.
     boolean            isEqualNode([Default=Undefined] optional Node other);
diff --git a/Source/core/dom/NodeChildRemovalTracker.cpp b/Source/core/dom/NodeChildRemovalTracker.cpp
new file mode 100644
index 0000000..e42c942
--- /dev/null
+++ b/Source/core/dom/NodeChildRemovalTracker.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ *     * 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/dom/NodeChildRemovalTracker.h"
+
+
+namespace WebCore {
+
+NodeChildRemovalTracker* NodeChildRemovalTracker::s_last;
+
+} // namespace
diff --git a/Source/core/dom/NodeChildRemovalTracker.h b/Source/core/dom/NodeChildRemovalTracker.h
new file mode 100644
index 0000000..b4faa11
--- /dev/null
+++ b/Source/core/dom/NodeChildRemovalTracker.h
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ *     * 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 NodeChildRemovalTracker_h
+#define NodeChildRemovalTracker_h
+
+#include "core/dom/Node.h"
+
+namespace WebCore {
+
+class NodeChildRemovalTracker {
+public:
+    explicit NodeChildRemovalTracker(Node*);
+    ~NodeChildRemovalTracker();
+
+    static bool isBeingRemoved(Node*);
+
+private:
+    Node* node() const { return m_node; }
+    NodeChildRemovalTracker* previous() { return m_previous; }
+
+    Node* m_node;
+    NodeChildRemovalTracker* m_previous;
+    static NodeChildRemovalTracker* s_last;
+};
+
+inline NodeChildRemovalTracker::NodeChildRemovalTracker(Node* node)
+    : m_node(node)
+    , m_previous(s_last)
+{
+    s_last = this;
+}
+
+inline NodeChildRemovalTracker::~NodeChildRemovalTracker()
+{
+    s_last = m_previous;
+}
+
+inline bool NodeChildRemovalTracker::isBeingRemoved(Node* node)
+{
+    for (NodeChildRemovalTracker* removal = s_last; removal; removal = removal->previous()) {
+        if (removal->node()->containsIncludingShadowDOM(node))
+            return true;
+    }
+
+    return false;
+}
+
+} // namespace
+
+#endif
diff --git a/Source/core/dom/NodeIterator.cpp b/Source/core/dom/NodeIterator.cpp
index f2cb1e7..173edc4 100644
--- a/Source/core/dom/NodeIterator.cpp
+++ b/Source/core/dom/NodeIterator.cpp
@@ -163,7 +163,7 @@
 {
     ASSERT(!m_detached);
     ASSERT(removedNode);
-    ASSERT(&root()->document() == &removedNode->document());
+    ASSERT(root()->document() == removedNode->document());
 
     // Iterator is not affected if the removed node is the reference node and is the root.
     // or if removed node is not the reference node, or the ancestor of the reference node.
diff --git a/Source/core/dom/NodeList.h b/Source/core/dom/NodeList.h
index d6ddf17..1d77043 100644
--- a/Source/core/dom/NodeList.h
+++ b/Source/core/dom/NodeList.h
@@ -30,27 +30,27 @@
 
 namespace WebCore {
 
-    class Node;
+class Node;
 
-    class NodeList : public ScriptWrappable, public RefCounted<NodeList> {
-    public:
-        virtual ~NodeList() { }
+class NodeList : public ScriptWrappable, public RefCounted<NodeList> {
+public:
+    virtual ~NodeList() { }
 
-        // DOM methods & attributes for NodeList
-        virtual unsigned length() const = 0;
-        virtual Node* item(unsigned index) const = 0;
-        virtual Node* namedItem(const AtomicString&) const = 0;
+    // DOM methods & attributes for NodeList
+    virtual unsigned length() const = 0;
+    virtual Node* item(unsigned index) const = 0;
+    virtual Node* namedItem(const AtomicString&) const = 0;
 
-        // Other methods (not part of DOM)
-        virtual bool isLiveNodeList() const { return false; }
-        void anonymousNamedGetter(const AtomicString&, bool&, RefPtr<Node>&, bool&, unsigned&);
+    // Other methods (not part of DOM)
+    virtual bool isLiveNodeList() const { return false; }
+    void anonymousNamedGetter(const AtomicString&, bool&, RefPtr<Node>&, bool&, unsigned&);
 
-    protected:
-        NodeList()
-        {
-            ScriptWrappable::init(this);
-        }
-    };
+protected:
+    NodeList()
+    {
+        ScriptWrappable::init(this);
+    }
+};
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/NodeRenderingContext.cpp b/Source/core/dom/NodeRenderingContext.cpp
index 60d7d94..6c5d602 100644
--- a/Source/core/dom/NodeRenderingContext.cpp
+++ b/Source/core/dom/NodeRenderingContext.cpp
@@ -83,9 +83,8 @@
     if (m_parentFlowRenderer)
         return m_parentFlowRenderer->nextRendererForNode(m_node);
 
-    // Avoid an O(N^2) problem with this function by not checking for
-    // nextRenderer() when the parent element hasn't attached yet.
-    if (m_renderingParent && !m_renderingParent->attached())
+    // Avoid an O(N^2) walk over the children when reattaching all children of a node.
+    if (m_renderingParent && m_renderingParent->needsAttach())
         return 0;
 
     for (Node* sibling = NodeRenderingTraversal::nextSibling(m_node); sibling; sibling = NodeRenderingTraversal::nextSibling(sibling)) {
diff --git a/Source/core/dom/Position.cpp b/Source/core/dom/Position.cpp
index 8d52a1e..75d8070 100644
--- a/Source/core/dom/Position.cpp
+++ b/Source/core/dom/Position.cpp
@@ -37,9 +37,9 @@
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLTableElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
-#include "core/platform/Logging.h"
+#include "platform/Logging.h"
 #include "core/rendering/InlineIterator.h"
 #include "core/rendering/InlineTextBox.h"
 #include "core/rendering/RenderBlock.h"
@@ -55,11 +55,11 @@
 static Node* nextRenderedEditable(Node* node)
 {
     while ((node = node->nextLeafNode())) {
-        if (!node->rendererIsEditable())
-            continue;
         RenderObject* renderer = node->renderer();
         if (!renderer)
             continue;
+        if (!node->rendererIsEditable())
+            continue;
         if ((renderer->isBox() && toRenderBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox()))
             return node;
     }
@@ -69,11 +69,11 @@
 static Node* previousRenderedEditable(Node* node)
 {
     while ((node = node->previousLeafNode())) {
-        if (!node->rendererIsEditable())
-            continue;
         RenderObject* renderer = node->renderer();
         if (!renderer)
             continue;
+        if (!node->rendererIsEditable())
+            continue;
         if ((renderer->isBox() && toRenderBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox()))
             return node;
     }
diff --git a/Source/core/dom/Position.h b/Source/core/dom/Position.h
index d2b1d1e..eea78f6 100644
--- a/Source/core/dom/Position.h
+++ b/Source/core/dom/Position.h
@@ -29,7 +29,7 @@
 #include "core/dom/ContainerNode.h"
 #include "core/editing/EditingBoundary.h"
 #include "core/editing/TextAffinity.h"
-#include "core/platform/text/TextDirection.h"
+#include "platform/text/TextDirection.h"
 #include "wtf/Assertions.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/dom/ProcessingInstruction.cpp b/Source/core/dom/ProcessingInstruction.cpp
index be736e8..f838b25 100644
--- a/Source/core/dom/ProcessingInstruction.cpp
+++ b/Source/core/dom/ProcessingInstruction.cpp
@@ -85,7 +85,7 @@
 
 void ProcessingInstruction::checkStyleSheet()
 {
-    if (m_target == "xml-stylesheet" && document().frame() && parentNode() == &document()) {
+    if (m_target == "xml-stylesheet" && document().frame() && parentNode() == document()) {
         // see http://www.w3.org/TR/xml-stylesheet/
         // ### support stylesheet included in a fragment of this (or another) document
         // ### make sure this gets called when adding from javascript
@@ -270,7 +270,7 @@
     }
 
     // If we're in document teardown, then we don't need to do any notification of our sheet's removal.
-    if (document().renderer())
+    if (document().isActive())
         document().removedStyleSheet(removedSheet.get());
 }
 
diff --git a/Source/core/dom/ProcessingInstruction.h b/Source/core/dom/ProcessingInstruction.h
index 7c8ace9..b95c670 100644
--- a/Source/core/dom/ProcessingInstruction.h
+++ b/Source/core/dom/ProcessingInstruction.h
@@ -85,17 +85,7 @@
     bool m_isXSL;
 };
 
-inline ProcessingInstruction* toProcessingInstruction(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->nodeType() == Node::PROCESSING_INSTRUCTION_NODE);
-    return static_cast<ProcessingInstruction*>(node);
-}
-
-inline const ProcessingInstruction* toProcessingInstruction(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->nodeType() == Node::PROCESSING_INSTRUCTION_NODE);
-    return static_cast<const ProcessingInstruction*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(ProcessingInstruction, nodeType() == Node::PROCESSING_INSTRUCTION_NODE);
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/Promise.idl b/Source/core/dom/Promise.idl
index f7fb7ba..41f5d9f 100644
--- a/Source/core/dom/Promise.idl
+++ b/Source/core/dom/Promise.idl
@@ -33,7 +33,7 @@
 [
    GlobalContext=Window&WorkerGlobalScope,
    CustomConstructor(PromiseInit init),
-   EnabledAtRuntime=Promise
+   RuntimeEnabled=Promise
 ] interface Promise {
    [Custom] Promise then(optional AnyCallback fulfillCallback, optional AnyCallback rejectCallback);
    [Custom] Promise catch(optional AnyCallback rejectCallback);
@@ -41,6 +41,7 @@
    [Custom] static Promise resolve(any value);
    [Custom] static Promise reject(any value);
 
-   [Custom] static Promise _any(any... values);
-   [Custom] static Promise every(any... values);
+   [Custom] static Promise cast(any value);
+   [Custom] static Promise race(any iterable);
+   [Custom] static Promise all(any iterable);
 };
diff --git a/Source/core/dom/PseudoElement.cpp b/Source/core/dom/PseudoElement.cpp
index 9c10bd0..f54a507 100644
--- a/Source/core/dom/PseudoElement.cpp
+++ b/Source/core/dom/PseudoElement.cpp
@@ -77,7 +77,7 @@
     if (!renderer)
         return;
     RenderStyle* style = renderer->style();
-    if (!style->regionThread().isEmpty())
+    if (style->hasFlowFrom())
         return;
     if (style->styleType() != BEFORE && style->styleType() != AFTER)
         return;
diff --git a/Source/core/dom/PseudoElement.h b/Source/core/dom/PseudoElement.h
index a0ddf69..fa6c838 100644
--- a/Source/core/dom/PseudoElement.h
+++ b/Source/core/dom/PseudoElement.h
@@ -66,23 +66,10 @@
 
 inline bool pseudoElementRendererIsNeeded(const RenderStyle* style)
 {
-    return style && style->display() != NONE && (style->styleType() == BACKDROP || style->contentData() || !style->regionThread().isEmpty());
+    return style && style->display() != NONE && (style->styleType() == BACKDROP || style->contentData() || style->hasFlowFrom());
 }
 
-inline PseudoElement* toPseudoElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isPseudoElement());
-    return static_cast<PseudoElement*>(node);
-}
-
-inline const PseudoElement* toPseudoElement(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isPseudoElement());
-    return static_cast<const PseudoElement*>(node);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toPseudoElement(const PseudoElement*);
+DEFINE_NODE_TYPE_CASTS(PseudoElement, isPseudoElement());
 
 } // namespace
 
diff --git a/Source/core/dom/QualifiedName.cpp b/Source/core/dom/QualifiedName.cpp
index 1495d92..b2e9369 100644
--- a/Source/core/dom/QualifiedName.cpp
+++ b/Source/core/dom/QualifiedName.cpp
@@ -33,6 +33,7 @@
 #include "core/dom/QualifiedName.h"
 #include "wtf/Assertions.h"
 #include "wtf/HashSet.h"
+#include "wtf/MainThread.h"
 #include "wtf/StaticConstructors.h"
 
 namespace WebCore {
@@ -47,7 +48,15 @@
     static const int minimumTableSize = WTF::HashTableCapacityForSize<staticQualifiedNamesCount>::value;
 };
 
-typedef HashSet<QualifiedName::QualifiedNameImpl*, QualifiedNameHash, QualifiedNameHashTraits> QNameSet;
+typedef HashSet<QualifiedName::QualifiedNameImpl*, QualifiedNameHash, QualifiedNameHashTraits> QualifiedNameCache;
+
+static QualifiedNameCache& qualifiedNameCache()
+{
+    // This code is lockless and thus assumes it all runs on one thread!
+    ASSERT(isMainThread());
+    static QualifiedNameCache* gNameCache = new QualifiedNameCache;
+    return *gNameCache;
+}
 
 struct QNameComponentsTranslator {
     static unsigned hash(const QualifiedNameComponents& components)
@@ -64,14 +73,10 @@
     }
 };
 
-static QNameSet* gNameCache;
-
 QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const AtomicString& n)
 {
-    if (!gNameCache)
-        gNameCache = new QNameSet;
     QualifiedNameComponents components = { p.impl(), l.impl(), n.isEmpty() ? nullAtom.impl() : n.impl() };
-    QNameSet::AddResult addResult = gNameCache->add<QNameComponentsTranslator>(components);
+    QualifiedNameCache::AddResult addResult = qualifiedNameCache().add<QNameComponentsTranslator>(components);
     m_impl = *addResult.iterator;
     if (!addResult.isNewEntry)
         m_impl->ref();
@@ -94,7 +99,7 @@
 
 QualifiedName::QualifiedNameImpl::~QualifiedNameImpl()
 {
-    gNameCache->remove(this);
+    qualifiedNameCache().remove(this);
 }
 
 String QualifiedName::toString() const
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 9c1900a..f7bb066 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -43,9 +43,9 @@
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/markup.h"
 #include "core/html/HTMLElement.h"
-#include "core/platform/graphics/FloatQuad.h"
 #include "core/rendering/RenderBoxModelObject.h"
 #include "core/rendering/RenderText.h"
+#include "platform/geometry/FloatQuad.h"
 #include "wtf/RefCountedLeakCounter.h"
 #include "wtf/Vector.h"
 #include "wtf/text/CString.h"
@@ -119,7 +119,7 @@
 
 void Range::setDocument(Document& document)
 {
-    ASSERT(m_ownerDocument != &document);
+    ASSERT(m_ownerDocument != document);
     ASSERT(m_ownerDocument);
     m_ownerDocument->detachRange(this);
     m_ownerDocument = &document;
@@ -224,7 +224,7 @@
     }
 
     bool didMoveDocument = false;
-    if (&refNode->document() != m_ownerDocument) {
+    if (refNode->document() != m_ownerDocument) {
         setDocument(refNode->document());
         didMoveDocument = true;
     }
@@ -252,7 +252,7 @@
     }
 
     bool didMoveDocument = false;
-    if (&refNode->document() != m_ownerDocument) {
+    if (refNode->document() != m_ownerDocument) {
         setDocument(refNode->document());
         didMoveDocument = true;
     }
@@ -304,7 +304,7 @@
         return false;
     }
 
-    if (!refNode->attached() || &refNode->document() != m_ownerDocument) {
+    if (!refNode->confusingAndOftenMisusedAttached() || refNode->document() != m_ownerDocument) {
         return false;
     }
 
@@ -332,7 +332,7 @@
         return 0;
     }
 
-    if (!refNode->attached() || &refNode->document() != m_ownerDocument) {
+    if (!refNode->confusingAndOftenMisusedAttached() || refNode->document() != m_ownerDocument) {
         es.throwUninformativeAndGenericDOMException(WrongDocumentError);
         return 0;
     }
@@ -367,17 +367,17 @@
         return NODE_BEFORE;
     }
 
-    if (!m_start.container() && refNode->attached()) {
+    if (!m_start.container() && refNode->confusingAndOftenMisusedAttached()) {
         es.throwUninformativeAndGenericDOMException(InvalidStateError);
         return NODE_BEFORE;
     }
 
-    if (m_start.container() && !refNode->attached()) {
+    if (m_start.container() && !refNode->confusingAndOftenMisusedAttached()) {
         // Firefox doesn't throw an exception for this case; it returns 0.
         return NODE_BEFORE;
     }
 
-    if (&refNode->document() != m_ownerDocument) {
+    if (refNode->document() != m_ownerDocument) {
         // Firefox doesn't throw an exception for this case; it returns 0.
         return NODE_BEFORE;
     }
@@ -422,7 +422,7 @@
     if (es.hadException())
         return 0;
 
-    if (&thisCont->document() != &sourceCont->document()) {
+    if (thisCont->document() != sourceCont->document()) {
         es.throwUninformativeAndGenericDOMException(WrongDocumentError);
         return 0;
     }
@@ -581,7 +581,7 @@
         return false;
     }
 
-    if (!refNode->attached() || &refNode->document() != m_ownerDocument) {
+    if (!refNode->confusingAndOftenMisusedAttached() || refNode->document() != m_ownerDocument) {
         // Firefox doesn't throw an exception for these cases; it returns false.
         return false;
     }
@@ -1037,18 +1037,25 @@
         if (collapsed)
             m_end.setToBeforeChild(newText.get());
     } else {
-        RefPtr<Node> lastChild;
-        if (collapsed)
-            lastChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? newNode->lastChild() : newNode;
+        RefPtr<Node> lastChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? newNode->lastChild() : newNode;
+        if (lastChild && lastChild == m_start.childBefore()) {
+            // The insertion will do nothing, but we need to extend the range to include
+            // the inserted nodes.
+            Node* firstChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? newNode->firstChild() : newNode.get();
+            ASSERT(firstChild);
+            m_start.setToBeforeChild(firstChild);
+            return;
+        }
 
-        int startOffset = m_start.offset();
         container = m_start.container();
-        container->insertBefore(newNode.release(), container->childNode(startOffset), es);
+        container->insertBefore(newNode.release(), container->childNode(m_start.offset()), es);
         if (es.hadException())
             return;
 
+        // Note that m_start.offset() may have changed as a result of container->insertBefore,
+        // when the node we are inserting comes before the range in the same container.
         if (collapsed && numNewChildren)
-            m_end.set(m_start.container(), startOffset + numNewChildren, lastChild.get());
+            m_end.set(m_start.container(), m_start.offset() + numNewChildren, lastChild.get());
     }
 }
 
@@ -1319,7 +1326,7 @@
             return;
     }
 
-    if (m_ownerDocument != &refNode->document())
+    if (m_ownerDocument != refNode->document())
         setDocument(refNode->document());
 
     setStartBefore(refNode);
@@ -1360,7 +1367,7 @@
         }
     }
 
-    if (m_ownerDocument != &refNode->document())
+    if (m_ownerDocument != refNode->document())
         setDocument(refNode->document());
 
     m_start.setToStartOfNode(refNode);
@@ -1657,7 +1664,7 @@
 void Range::nodeChildrenChanged(ContainerNode* container)
 {
     ASSERT(container);
-    ASSERT(&container->document() == m_ownerDocument);
+    ASSERT(container->document() == m_ownerDocument);
     boundaryNodeChildrenChanged(m_start, container);
     boundaryNodeChildrenChanged(m_end, container);
 }
@@ -1682,7 +1689,7 @@
 void Range::nodeChildrenWillBeRemoved(ContainerNode* container)
 {
     ASSERT(container);
-    ASSERT(&container->document() == m_ownerDocument);
+    ASSERT(container->document() == m_ownerDocument);
     boundaryNodeChildrenWillBeRemoved(m_start, container);
     boundaryNodeChildrenWillBeRemoved(m_end, container);
 }
@@ -1705,7 +1712,7 @@
 void Range::nodeWillBeRemoved(Node* node)
 {
     ASSERT(node);
-    ASSERT(&node->document() == m_ownerDocument);
+    ASSERT(node->document() == m_ownerDocument);
     ASSERT(node != m_ownerDocument);
 
     // FIXME: Once DOMNodeRemovedFromDocument mutation event removed, we
@@ -1729,7 +1736,7 @@
 void Range::didInsertText(Node* text, unsigned offset, unsigned length)
 {
     ASSERT(text);
-    ASSERT(&text->document() == m_ownerDocument);
+    ASSERT(text->document() == m_ownerDocument);
     boundaryTextInserted(m_start, text, offset, length);
     boundaryTextInserted(m_end, text, offset, length);
 }
@@ -1750,7 +1757,7 @@
 void Range::didRemoveText(Node* text, unsigned offset, unsigned length)
 {
     ASSERT(text);
-    ASSERT(&text->document() == m_ownerDocument);
+    ASSERT(text->document() == m_ownerDocument);
     boundaryTextRemoved(m_start, text, offset, length);
     boundaryTextRemoved(m_end, text, offset, length);
 }
@@ -1766,7 +1773,7 @@
 void Range::didMergeTextNodes(NodeWithIndex& oldNode, unsigned offset)
 {
     ASSERT(oldNode.node());
-    ASSERT(&oldNode.node()->document() == m_ownerDocument);
+    ASSERT(oldNode.node()->document() == m_ownerDocument);
     ASSERT(oldNode.node()->parentNode());
     ASSERT(oldNode.node()->isTextNode());
     ASSERT(oldNode.node()->previousSibling());
@@ -1788,7 +1795,7 @@
 void Range::didSplitTextNode(Text* oldNode)
 {
     ASSERT(oldNode);
-    ASSERT(&oldNode->document() == m_ownerDocument);
+    ASSERT(oldNode->document() == m_ownerDocument);
     ASSERT(oldNode->parentNode());
     ASSERT(oldNode->isTextNode());
     ASSERT(oldNode->nextSibling());
diff --git a/Source/core/dom/Range.h b/Source/core/dom/Range.h
index 82b716c..8975552 100644
--- a/Source/core/dom/Range.h
+++ b/Source/core/dom/Range.h
@@ -28,8 +28,8 @@
 #include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/RangeBoundaryPoint.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/IntRect.h"
 #include "wtf/Forward.h"
 #include "wtf/RefCounted.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/dom/Range.idl b/Source/core/dom/Range.idl
index 32edd56..42ca334 100644
--- a/Source/core/dom/Range.idl
+++ b/Source/core/dom/Range.idl
@@ -52,11 +52,11 @@
      [RaisesException] short compareBoundaryPoints([Default=Undefined] optional CompareHow how,
                                                [Default=Undefined] optional Range sourceRange);
 
-    [RaisesException, CustomElementCallbacks=Enable] void deleteContents();
-    [RaisesException, CustomElementCallbacks=Enable] DocumentFragment extractContents();
-    [RaisesException, CustomElementCallbacks=Enable] DocumentFragment cloneContents();
-    [RaisesException, CustomElementCallbacks=Enable] void insertNode([Default=Undefined] optional Node newNode);
-    [RaisesException, CustomElementCallbacks=Enable] void surroundContents([Default=Undefined] optional Node newParent);
+    [RaisesException, CustomElementCallbacks] void deleteContents();
+    [RaisesException, CustomElementCallbacks] DocumentFragment extractContents();
+    [RaisesException, CustomElementCallbacks] DocumentFragment cloneContents();
+    [RaisesException, CustomElementCallbacks] void insertNode([Default=Undefined] optional Node newNode);
+    [RaisesException, CustomElementCallbacks] void surroundContents([Default=Undefined] optional Node newParent);
     [RaisesException] Range cloneRange();
     [RaisesException] DOMString toString();
 
@@ -69,7 +69,7 @@
 
     // extensions
 
-    [RaisesException, CustomElementCallbacks=Enable] DocumentFragment createContextualFragment([Default=Undefined] optional DOMString html);
+    [RaisesException, CustomElementCallbacks] DocumentFragment createContextualFragment([Default=Undefined] optional DOMString html);
 
     // WebKit extensions
 
diff --git a/Source/core/dom/ScriptExecutionContext.cpp b/Source/core/dom/ScriptExecutionContext.cpp
deleted file mode 100644
index bc013a3..0000000
--- a/Source/core/dom/ScriptExecutionContext.cpp
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- * 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 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,
- * 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/dom/ScriptExecutionContext.h"
-
-#include "core/dom/ContextLifecycleNotifier.h"
-#include "core/events/ErrorEvent.h"
-#include "core/events/EventTarget.h"
-#include "core/dom/MessagePort.h"
-#include "core/html/PublicURLManager.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/inspector/ScriptCallStack.h"
-#include "core/page/DOMTimer.h"
-#include "core/workers/WorkerGlobalScope.h"
-#include "core/workers/WorkerThread.h"
-#include "modules/webdatabase/DatabaseContext.h"
-#include "wtf/MainThread.h"
-
-namespace WebCore {
-
-class ProcessMessagesSoonTask : public ScriptExecutionContext::Task {
-public:
-    static PassOwnPtr<ProcessMessagesSoonTask> create()
-    {
-        return adoptPtr(new ProcessMessagesSoonTask);
-    }
-
-    virtual void performTask(ScriptExecutionContext* context)
-    {
-        context->dispatchMessagePortEvents();
-    }
-};
-
-class ScriptExecutionContext::PendingException {
-    WTF_MAKE_NONCOPYABLE(PendingException);
-public:
-    PendingException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack)
-        : m_errorMessage(errorMessage)
-        , m_lineNumber(lineNumber)
-        , m_columnNumber(columnNumber)
-        , m_sourceURL(sourceURL)
-        , m_callStack(callStack)
-    {
-    }
-    String m_errorMessage;
-    int m_lineNumber;
-    int m_columnNumber;
-    String m_sourceURL;
-    RefPtr<ScriptCallStack> m_callStack;
-};
-
-void ScriptExecutionContext::AddConsoleMessageTask::performTask(ScriptExecutionContext* context)
-{
-    context->addConsoleMessage(m_source, m_level, m_message);
-}
-
-ScriptExecutionContext::ScriptExecutionContext()
-    : m_circularSequentialID(0)
-    , m_inDispatchErrorEvent(false)
-    , m_activeDOMObjectsAreSuspended(false)
-    , m_reasonForSuspendingActiveDOMObjects(static_cast<ActiveDOMObject::ReasonForSuspension>(-1))
-    , m_activeDOMObjectsAreStopped(false)
-{
-}
-
-ScriptExecutionContext::~ScriptExecutionContext()
-{
-    HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end();
-    for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
-        ASSERT((*iter)->scriptExecutionContext() == this);
-        (*iter)->contextDestroyed();
-    }
-}
-
-void ScriptExecutionContext::processMessagePortMessagesSoon()
-{
-    postTask(ProcessMessagesSoonTask::create());
-}
-
-void ScriptExecutionContext::dispatchMessagePortEvents()
-{
-    RefPtr<ScriptExecutionContext> protect(this);
-
-    // Make a frozen copy.
-    Vector<MessagePort*> ports;
-    copyToVector(m_messagePorts, ports);
-
-    unsigned portCount = ports.size();
-    for (unsigned i = 0; i < portCount; ++i) {
-        MessagePort* port = ports[i];
-        // The port may be destroyed, and another one created at the same address, but this is safe, as the worst that can happen
-        // as a result is that dispatchMessages() will be called needlessly.
-        if (m_messagePorts.contains(port) && port->started())
-            port->dispatchMessages();
-    }
-}
-
-void ScriptExecutionContext::createdMessagePort(MessagePort* port)
-{
-    ASSERT(port);
-    ASSERT((isDocument() && isMainThread())
-        || (isWorkerGlobalScope() && toWorkerGlobalScope(this)->thread()->isCurrentThread()));
-
-    m_messagePorts.add(port);
-}
-
-void ScriptExecutionContext::destroyedMessagePort(MessagePort* port)
-{
-    ASSERT(port);
-    ASSERT((isDocument() && isMainThread())
-        || (isWorkerGlobalScope() && toWorkerGlobalScope(this)->thread()->isCurrentThread()));
-
-    m_messagePorts.remove(port);
-}
-
-bool ScriptExecutionContext::canSuspendActiveDOMObjects()
-{
-    return lifecycleNotifier()->canSuspendActiveDOMObjects();
-}
-
-bool ScriptExecutionContext::hasPendingActivity()
-{
-    if (lifecycleNotifier()->hasPendingActivity())
-        return true;
-
-    HashSet<MessagePort*>::const_iterator messagePortsEnd = m_messagePorts.end();
-    for (HashSet<MessagePort*>::const_iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
-        if ((*iter)->hasPendingActivity())
-            return true;
-    }
-
-    return false;
-}
-
-void ScriptExecutionContext::suspendActiveDOMObjects(ActiveDOMObject::ReasonForSuspension why)
-{
-    lifecycleNotifier()->notifySuspendingActiveDOMObjects(why);
-    m_activeDOMObjectsAreSuspended = true;
-    m_reasonForSuspendingActiveDOMObjects = why;
-}
-
-void ScriptExecutionContext::resumeActiveDOMObjects()
-{
-    m_activeDOMObjectsAreSuspended = false;
-    lifecycleNotifier()->notifyResumingActiveDOMObjects();
-}
-
-void ScriptExecutionContext::stopActiveDOMObjects()
-{
-    m_activeDOMObjectsAreStopped = true;
-    lifecycleNotifier()->notifyStoppingActiveDOMObjects();
-    // Also close MessagePorts. If they were ActiveDOMObjects (they could be) then they could be stopped instead.
-    closeMessagePorts();
-}
-
-void ScriptExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object)
-{
-    ASSERT(lifecycleNotifier()->contains(object));
-    // Ensure all ActiveDOMObjects are suspended also newly created ones.
-    if (m_activeDOMObjectsAreSuspended)
-        object->suspend(m_reasonForSuspendingActiveDOMObjects);
-}
-
-void ScriptExecutionContext::closeMessagePorts() {
-    HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end();
-    for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
-        ASSERT((*iter)->scriptExecutionContext() == this);
-        (*iter)->close();
-    }
-}
-
-bool ScriptExecutionContext::shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus corsStatus)
-{
-    return !(securityOrigin()->canRequest(completeURL(sourceURL)) || corsStatus == SharableCrossOrigin);
-}
-
-void ScriptExecutionContext::reportException(PassRefPtr<ErrorEvent> event, PassRefPtr<ScriptCallStack> callStack, AccessControlStatus corsStatus)
-{
-    RefPtr<ErrorEvent> errorEvent = event;
-    if (m_inDispatchErrorEvent) {
-        if (!m_pendingExceptions)
-            m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException> >());
-        m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->messageForConsole(), errorEvent->lineno(), errorEvent->colno(), errorEvent->filename(), callStack)));
-        return;
-    }
-
-    // First report the original exception and only then all the nested ones.
-    if (!dispatchErrorEvent(errorEvent, corsStatus))
-        logExceptionToConsole(errorEvent->messageForConsole(), errorEvent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack);
-
-    if (!m_pendingExceptions)
-        return;
-
-    for (size_t i = 0; i < m_pendingExceptions->size(); i++) {
-        PendingException* e = m_pendingExceptions->at(i).get();
-        logExceptionToConsole(e->m_errorMessage, e->m_sourceURL, e->m_lineNumber, e->m_columnNumber, e->m_callStack);
-    }
-    m_pendingExceptions.clear();
-}
-
-void ScriptExecutionContext::addConsoleMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber)
-{
-    addMessage(source, level, message, sourceURL, lineNumber, 0);
-}
-
-void ScriptExecutionContext::addConsoleMessage(MessageSource source, MessageLevel level, const String& message, ScriptState* state)
-{
-    addMessage(source, level, message, String(), 0, state);
-}
-
-bool ScriptExecutionContext::dispatchErrorEvent(PassRefPtr<ErrorEvent> event, AccessControlStatus corsStatus)
-{
-    EventTarget* target = errorEventTarget();
-    if (!target)
-        return false;
-
-    RefPtr<ErrorEvent> errorEvent = event;
-    if (shouldSanitizeScriptError(errorEvent->filename(), corsStatus))
-        errorEvent = ErrorEvent::createSanitizedError(errorEvent->world());
-
-    ASSERT(!m_inDispatchErrorEvent);
-    m_inDispatchErrorEvent = true;
-    target->dispatchEvent(errorEvent);
-    m_inDispatchErrorEvent = false;
-    return errorEvent->defaultPrevented();
-}
-
-int ScriptExecutionContext::circularSequentialID()
-{
-    ++m_circularSequentialID;
-    if (m_circularSequentialID <= 0)
-        m_circularSequentialID = 1;
-    return m_circularSequentialID;
-}
-
-int ScriptExecutionContext::installNewTimeout(PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot)
-{
-    int timeoutID;
-    while (true) {
-        timeoutID = circularSequentialID();
-        if (!m_timeouts.contains(timeoutID))
-            break;
-    }
-    TimeoutMap::AddResult result = m_timeouts.add(timeoutID, DOMTimer::create(this, action, timeout, singleShot, timeoutID));
-    ASSERT(result.isNewEntry);
-    DOMTimer* timer = result.iterator->value.get();
-
-    timer->suspendIfNeeded();
-
-    return timer->timeoutID();
-}
-
-void ScriptExecutionContext::removeTimeoutByID(int timeoutID)
-{
-    if (timeoutID <= 0)
-        return;
-    m_timeouts.remove(timeoutID);
-}
-
-PublicURLManager& ScriptExecutionContext::publicURLManager()
-{
-    if (!m_publicURLManager)
-        m_publicURLManager = PublicURLManager::create(this);
-    return *m_publicURLManager;
-}
-
-void ScriptExecutionContext::didChangeTimerAlignmentInterval()
-{
-    for (TimeoutMap::iterator iter = m_timeouts.begin(); iter != m_timeouts.end(); ++iter)
-        iter->value->didChangeAlignmentInterval();
-}
-
-double ScriptExecutionContext::timerAlignmentInterval() const
-{
-    return DOMTimer::visiblePageAlignmentInterval();
-}
-
-ContextLifecycleNotifier* ScriptExecutionContext::lifecycleNotifier()
-{
-    return static_cast<ContextLifecycleNotifier*>(LifecycleContext::lifecycleNotifier());
-}
-
-PassOwnPtr<LifecycleNotifier> ScriptExecutionContext::createLifecycleNotifier()
-{
-    return ContextLifecycleNotifier::create(this);
-}
-
-ScriptExecutionContext::Task::~Task()
-{
-}
-
-void ScriptExecutionContext::setDatabaseContext(DatabaseContext* databaseContext)
-{
-    m_databaseContext = databaseContext;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/ScriptExecutionContext.h b/Source/core/dom/ScriptExecutionContext.h
deleted file mode 100644
index 2f52840..0000000
--- a/Source/core/dom/ScriptExecutionContext.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- * 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 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,
- * 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 ScriptExecutionContext_h
-#define ScriptExecutionContext_h
-
-#include "core/dom/ActiveDOMObject.h"
-#include "core/events/ErrorEvent.h"
-#include "core/dom/SecurityContext.h"
-#include "core/fetch/CrossOriginAccessControl.h"
-#include "core/page/ConsoleTypes.h"
-#include "core/page/DOMTimer.h"
-#include "core/platform/LifecycleContext.h"
-#include "core/platform/Supplementable.h"
-#include "weborigin/KURL.h"
-#include "wtf/HashSet.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WTF {
-class OrdinalNumber;
-}
-
-namespace WebCore {
-
-class ContextLifecycleNotifier;
-class DOMWindow;
-class DatabaseContext;
-class EventListener;
-class EventQueue;
-class EventTarget;
-class MessagePort;
-class PublicURLManager;
-class ScriptCallStack;
-class ScriptState;
-
-class ScriptExecutionContext : public LifecycleContext, public SecurityContext, public Supplementable<ScriptExecutionContext> {
-public:
-    ScriptExecutionContext();
-    virtual ~ScriptExecutionContext();
-
-    virtual bool isDocument() const { return false; }
-    virtual bool isWorkerGlobalScope() const { return false; }
-
-    virtual bool isJSExecutionForbidden() const = 0;
-
-    virtual DOMWindow* executingWindow() { return 0; }
-    virtual void userEventWasHandled() { }
-
-    const KURL& url() const { return virtualURL(); }
-    KURL completeURL(const String& url) const { return virtualCompleteURL(url); }
-
-    virtual String userAgent(const KURL&) const = 0;
-
-    virtual void disableEval(const String& errorMessage) = 0;
-
-    bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus);
-    void reportException(PassRefPtr<ErrorEvent>, PassRefPtr<ScriptCallStack>, AccessControlStatus);
-
-    void addConsoleMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber);
-    void addConsoleMessage(MessageSource, MessageLevel, const String& message, ScriptState* = 0);
-
-    PublicURLManager& publicURLManager();
-
-    // Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.
-    bool canSuspendActiveDOMObjects();
-    bool hasPendingActivity();
-
-    // Active objects can be asked to suspend even if canSuspendActiveDOMObjects() returns 'false' -
-    // step-by-step JS debugging is one example.
-    virtual void suspendActiveDOMObjects(ActiveDOMObject::ReasonForSuspension);
-    virtual void resumeActiveDOMObjects();
-    virtual void stopActiveDOMObjects();
-
-    bool activeDOMObjectsAreSuspended() const { return m_activeDOMObjectsAreSuspended; }
-    bool activeDOMObjectsAreStopped() const { return m_activeDOMObjectsAreStopped; }
-
-    // Called after the construction of an ActiveDOMObject to synchronize suspend state.
-    void suspendActiveDOMObjectIfNeeded(ActiveDOMObject*);
-
-    // MessagePort is conceptually a kind of ActiveDOMObject, but it needs to be tracked separately for message dispatch.
-    void processMessagePortMessagesSoon();
-    void dispatchMessagePortEvents();
-    void createdMessagePort(MessagePort*);
-    void destroyedMessagePort(MessagePort*);
-    const HashSet<MessagePort*>& messagePorts() const { return m_messagePorts; }
-
-    void ref() { refScriptExecutionContext(); }
-    void deref() { derefScriptExecutionContext(); }
-
-    class Task {
-        WTF_MAKE_NONCOPYABLE(Task);
-        WTF_MAKE_FAST_ALLOCATED;
-    public:
-        Task() { }
-        virtual ~Task();
-        virtual void performTask(ScriptExecutionContext*) = 0;
-        // Certain tasks get marked specially so that they aren't discarded, and are executed, when the context is shutting down its message queue.
-        virtual bool isCleanupTask() const { return false; }
-    };
-
-    virtual void postTask(PassOwnPtr<Task>) = 0; // Executes the task on context's thread asynchronously.
-
-    // Gets the next id in a circular sequence from 1 to 2^31-1.
-    int circularSequentialID();
-
-    void didChangeTimerAlignmentInterval();
-    virtual double timerAlignmentInterval() const;
-
-    virtual EventQueue* eventQueue() const = 0;
-
-    void setDatabaseContext(DatabaseContext*);
-
-protected:
-    class AddConsoleMessageTask : public Task {
-    public:
-        static PassOwnPtr<AddConsoleMessageTask> create(MessageSource source, MessageLevel level, const String& message)
-        {
-            return adoptPtr(new AddConsoleMessageTask(source, level, message));
-        }
-        virtual void performTask(ScriptExecutionContext*);
-    private:
-        AddConsoleMessageTask(MessageSource source, MessageLevel level, const String& message)
-            : m_source(source)
-            , m_level(level)
-            , m_message(message.isolatedCopy())
-        {
-        }
-        MessageSource m_source;
-        MessageLevel m_level;
-        String m_message;
-    };
-
-    ContextLifecycleNotifier* lifecycleNotifier();
-
-private:
-    friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() below.
-
-    virtual const KURL& virtualURL() const = 0;
-    virtual KURL virtualCompleteURL(const String&) const = 0;
-
-    virtual void addMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, ScriptState*) = 0;
-    virtual EventTarget* errorEventTarget() = 0;
-    virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) = 0;
-    bool dispatchErrorEvent(PassRefPtr<ErrorEvent>, AccessControlStatus);
-
-    void closeMessagePorts();
-
-    virtual void refScriptExecutionContext() = 0;
-    virtual void derefScriptExecutionContext() = 0;
-    virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE;
-
-    // Implementation details for DOMTimer. No other classes should call these functions.
-    int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleShot);
-    void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer instance destructed.
-
-    HashSet<MessagePort*> m_messagePorts;
-
-    int m_circularSequentialID;
-    typedef HashMap<int, OwnPtr<DOMTimer> > TimeoutMap;
-    TimeoutMap m_timeouts;
-
-    bool m_inDispatchErrorEvent;
-    class PendingException;
-    OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions;
-
-    bool m_activeDOMObjectsAreSuspended;
-    ActiveDOMObject::ReasonForSuspension m_reasonForSuspendingActiveDOMObjects;
-    bool m_activeDOMObjectsAreStopped;
-
-    OwnPtr<PublicURLManager> m_publicURLManager;
-
-    RefPtr<DatabaseContext> m_databaseContext;
-
-    // The location of this member is important; to make sure contextDestroyed() notification on
-    // ScriptExecutionContext's members (notably m_timeouts) is called before they are destructed,
-    // m_lifecycleNotifer should be placed *after* such members.
-    OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier;
-};
-
-} // namespace WebCore
-
-#endif // ScriptExecutionContext_h
diff --git a/Source/core/dom/ScriptLoader.cpp b/Source/core/dom/ScriptLoader.cpp
index d39efef..7af7738 100644
--- a/Source/core/dom/ScriptLoader.cpp
+++ b/Source/core/dom/ScriptLoader.cpp
@@ -41,8 +41,8 @@
 #include "core/html/HTMLImport.h"
 #include "core/html/HTMLScriptElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/Frame.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/Frame.h"
 #include "core/platform/MIMETypeRegistry.h"
 #include "core/svg/SVGScriptElement.h"
 #include "weborigin/SecurityOrigin.h"
@@ -135,7 +135,7 @@
 
 void ScriptLoader::dispatchErrorEvent()
 {
-    m_element->dispatchEvent(Event::create(eventNames().errorEvent));
+    m_element->dispatchEvent(Event::create(EventTypeNames::error));
 }
 
 void ScriptLoader::dispatchLoadEvent()
@@ -251,10 +251,10 @@
 {
     ASSERT(m_element);
 
-    RefPtr<Document> elementDocument = &m_element->document();
+    RefPtr<Document> elementDocument(m_element->document());
     if (!m_element->dispatchBeforeLoadEvent(sourceUrl))
         return false;
-    if (!m_element->inDocument() || &m_element->document() != elementDocument)
+    if (!m_element->inDocument() || m_element->document() != elementDocument)
         return false;
 
     ASSERT(!m_resource);
@@ -301,7 +301,7 @@
     if (sourceCode.isEmpty())
         return;
 
-    RefPtr<Document> elementDocument = &m_element->document();
+    RefPtr<Document> elementDocument(m_element->document());
     RefPtr<Document> contextDocument = elementDocument->contextDocument().get();
     if (!contextDocument)
         return;
@@ -366,7 +366,7 @@
 {
     ASSERT(!m_willBeParserExecuted);
 
-    RefPtr<Document> elementDocument = &m_element->document();
+    RefPtr<Document> elementDocument(m_element->document());
     RefPtr<Document> contextDocument = elementDocument->contextDocument().get();
     if (!contextDocument)
         return;
diff --git a/Source/core/dom/ScriptRunner.h b/Source/core/dom/ScriptRunner.h
index b793589..91164d0 100644
--- a/Source/core/dom/ScriptRunner.h
+++ b/Source/core/dom/ScriptRunner.h
@@ -27,7 +27,7 @@
 #define ScriptRunner_h
 
 #include "core/fetch/ResourcePtr.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/HashMap.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/PassOwnPtr.h"
diff --git a/Source/core/dom/ScriptedAnimationController.cpp b/Source/core/dom/ScriptedAnimationController.cpp
index 0a27612..1152ec8 100644
--- a/Source/core/dom/ScriptedAnimationController.cpp
+++ b/Source/core/dom/ScriptedAnimationController.cpp
@@ -28,12 +28,18 @@
 
 #include "core/dom/Document.h"
 #include "core/dom/RequestAnimationFrameCallback.h"
+#include "core/events/Event.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 
 namespace WebCore {
 
+std::pair<EventTarget*, StringImpl*> scheduledEventTargetKey(const Event* event)
+{
+    return std::make_pair(event->target(), event->type().impl());
+}
+
 ScriptedAnimationController::ScriptedAnimationController(Document* document)
     : m_document(document)
     , m_nextCallbackId(0)
@@ -56,9 +62,7 @@
     // even when suspend hasn't (if a tab was created in the background).
     if (m_suspendCount > 0)
         --m_suspendCount;
-
-    if (!m_suspendCount && m_callbacks.size())
-        scheduleAnimation();
+    scheduleAnimationIfNeeded();
 }
 
 ScriptedAnimationController::CallbackId ScriptedAnimationController::registerCallback(PassRefPtr<RequestAnimationFrameCallback> callback)
@@ -67,11 +71,10 @@
     callback->m_firedOrCancelled = false;
     callback->m_id = id;
     m_callbacks.append(callback);
+    scheduleAnimationIfNeeded();
 
     InspectorInstrumentation::didRequestAnimationFrame(m_document, id);
 
-    if (!m_suspendCount)
-        scheduleAnimation();
     return id;
 }
 
@@ -89,20 +92,27 @@
 
 void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTimeNow)
 {
-    if (!m_callbacks.size() || m_suspendCount)
+    if ((!m_callbacks.size() && !m_eventQueue.size()) || m_suspendCount)
         return;
 
-    double highResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTimeToZeroBasedDocumentTime(monotonicTimeNow);
-    double legacyHighResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTimeToPseudoWallTime(monotonicTimeNow);
-
-    // First, generate a list of callbacks to consider.  Callbacks registered from this point
-    // on are considered only for the "next" frame, not this one.
-    CallbackList callbacks(m_callbacks);
-
     // Invoking callbacks may detach elements from our document, which clears the document's
     // reference to us, so take a defensive reference.
     RefPtr<ScriptedAnimationController> protector(this);
 
+    double highResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTimeToZeroBasedDocumentTime(monotonicTimeNow);
+    double legacyHighResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTimeToPseudoWallTime(monotonicTimeNow);
+
+    Vector<RefPtr<Event> > events;
+    events.swap(m_eventQueue);
+    m_scheduledEventTargets.clear();
+
+    for (size_t i = 0; i < events.size(); ++i)
+        events[i]->target()->dispatchEvent(events[i]);
+
+    // First, generate a list of callbacks to consider.  Callbacks registered from this point
+    // on are considered only for the "next" frame, not this one.
+    CallbackList callbacks(m_callbacks);
+
     for (size_t i = 0; i < callbacks.size(); ++i) {
         RequestAnimationFrameCallback* callback = callbacks[i].get();
         if (!callback->m_firedOrCancelled) {
@@ -124,15 +134,28 @@
             ++i;
     }
 
-    if (m_callbacks.size())
-        scheduleAnimation();
+    scheduleAnimationIfNeeded();
 }
 
-void ScriptedAnimationController::scheduleAnimation()
+void ScriptedAnimationController::scheduleEvent(PassRefPtr<Event> event)
+{
+    if (!m_scheduledEventTargets.add(scheduledEventTargetKey(event.get())).isNewEntry)
+        return;
+    m_eventQueue.append(event);
+    scheduleAnimationIfNeeded();
+}
+
+void ScriptedAnimationController::scheduleAnimationIfNeeded()
 {
     if (!m_document)
         return;
 
+    if (m_suspendCount)
+        return;
+
+    if (!m_callbacks.size() && !m_eventQueue.size())
+        return;
+
     if (FrameView* frameView = m_document->view())
         frameView->scheduleAnimation();
 }
diff --git a/Source/core/dom/ScriptedAnimationController.h b/Source/core/dom/ScriptedAnimationController.h
index 4379b2a..3e9dc0f 100644
--- a/Source/core/dom/ScriptedAnimationController.h
+++ b/Source/core/dom/ScriptedAnimationController.h
@@ -26,17 +26,20 @@
 #ifndef ScriptedAnimationController_h
 #define ScriptedAnimationController_h
 
+#include "wtf/ListHashSet.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
+#include "wtf/text/StringImpl.h"
 
 namespace WebCore {
 
 class Document;
+class Event;
+class EventTarget;
 class RequestAnimationFrameCallback;
 
-class ScriptedAnimationController : public RefCounted<ScriptedAnimationController>
-{
+class ScriptedAnimationController : public RefCounted<ScriptedAnimationController> {
 public:
     static PassRefPtr<ScriptedAnimationController> create(Document* document)
     {
@@ -47,10 +50,12 @@
 
     typedef int CallbackId;
 
-    CallbackId registerCallback(PassRefPtr<RequestAnimationFrameCallback>);
+    int registerCallback(PassRefPtr<RequestAnimationFrameCallback>);
     void cancelCallback(CallbackId);
     void serviceScriptedAnimations(double monotonicTimeNow);
 
+    void scheduleEvent(PassRefPtr<Event>);
+
     void suspend();
     void resume();
 
@@ -63,8 +68,10 @@
     Document* m_document;
     CallbackId m_nextCallbackId;
     int m_suspendCount;
+    Vector<RefPtr<Event> > m_eventQueue;
+    ListHashSet<std::pair<const EventTarget*, const StringImpl*> > m_scheduledEventTargets;
 
-    void scheduleAnimation();
+    void scheduleAnimationIfNeeded();
 };
 
 }
diff --git a/Source/core/dom/SecurityContext.cpp b/Source/core/dom/SecurityContext.cpp
index c81e923..eaf71c5 100644
--- a/Source/core/dom/SecurityContext.cpp
+++ b/Source/core/dom/SecurityContext.cpp
@@ -28,7 +28,7 @@
 #include "core/dom/SecurityContext.h"
 
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/text/StringBuilder.h"
 
diff --git a/Source/core/dom/SelectorQuery.cpp b/Source/core/dom/SelectorQuery.cpp
index 82baa86..5eeaeee 100644
--- a/Source/core/dom/SelectorQuery.cpp
+++ b/Source/core/dom/SelectorQuery.cpp
@@ -64,10 +64,10 @@
 
 class ClassRootNodeList : public SimpleNodeList {
 public:
-    explicit ClassRootNodeList(Node* rootNode, const AtomicString& className)
+    ClassRootNodeList(Node* rootNode, const AtomicString& className)
         : m_className(className)
         , m_rootNode(rootNode)
-        , m_currentElement(nextInternal(ElementTraversal::firstWithin(rootNode))) { }
+        , m_currentElement(nextInternal(ElementTraversal::firstWithin(m_rootNode))) { }
 
     bool isEmpty() const { return !m_currentElement; }
 
@@ -96,7 +96,7 @@
 
 class ClassElementList : public SimpleNodeList {
 public:
-    explicit ClassElementList(Node* rootNode, const AtomicString& className)
+    ClassElementList(Node* rootNode, const AtomicString& className)
         : m_className(className)
         , m_rootNode(rootNode)
         , m_currentElement(nextInternal(ElementTraversal::firstWithin(rootNode))) { }
@@ -226,6 +226,19 @@
     return m_selectors.size() == 1 && rootNode->inDocument() && !rootNode->document().inQuirksMode();
 }
 
+inline bool ancestorHasClassName(Node* rootNode, const AtomicString& className)
+{
+    if (!rootNode->isElementNode())
+        return false;
+
+    for (Element* element = toElement(rootNode); element; element = element->parentElement()) {
+        if (element->hasClass() && element->classNames().contains(className))
+            return true;
+    }
+    return false;
+}
+
+
 // If returns true, traversalRoots has the elements that may match the selector query.
 //
 // If returns false, traversalRoots has the rootNode parameter or descendants of rootNode representing
@@ -270,6 +283,10 @@
                 return adoptPtr(new ClassElementList(rootNode, selector->value()));
             }
             matchTraverseRoots = false;
+            // Since there exists some ancestor element which has the class name, we need to see all children of rootNode.
+            if (ancestorHasClassName(rootNode, selector->value()))
+                return adoptPtr(new SingleNodeList(rootNode));
+
             return adoptPtr(new ClassRootNodeList(rootNode, selector->value()));
         }
 
diff --git a/Source/core/dom/ShadowTreeStyleSheetCollection.cpp b/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
index a952d05..f77ff81 100644
--- a/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
+++ b/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
@@ -102,12 +102,10 @@
 
     bool requiresFullStyleRecalc = true;
 
-    // If we have already decided to destroy StyleResolver, we don't need to analyze. Reconstruction will take care.
+    StyleResolverUpdateType styleResolverUpdateType;
+    analyzeStyleSheetChange(updateMode, activeAuthorStyleSheets(), activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc);
+
     if (StyleResolver* styleResolver = document()->styleResolverIfExists()) {
-        StyleResolverUpdateType styleResolverUpdateType;
-
-        analyzeStyleSheetChange(updateMode, activeAuthorStyleSheets(), activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc);
-
         // FIXME: We might have already had styles in child treescope. In this case, we cannot use buildScopedStyleTreeInDocumentOrder.
         // Need to change "false" to some valid condition.
         styleResolver->setBuildScopedStyleTreeInDocumentOrder(false);
@@ -121,6 +119,9 @@
             styleResolver->appendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), activeCSSStyleSheets);
         }
     }
+    if (requiresFullStyleRecalc)
+        toShadowRoot(m_treeScope.rootNode())->host()->setNeedsStyleRecalc();
+
     m_scopingNodesForStyleScoped.didRemoveScopingNodes();
     m_activeAuthorStyleSheets.swap(activeCSSStyleSheets);
     m_styleSheetsForStyleSheetList.swap(styleSheets);
diff --git a/Source/core/dom/StaticNodeList.h b/Source/core/dom/StaticNodeList.h
index ece0926..fd66b3a 100644
--- a/Source/core/dom/StaticNodeList.h
+++ b/Source/core/dom/StaticNodeList.h
@@ -36,31 +36,29 @@
 
 namespace WebCore {
 
-    class Node;
+class Node;
 
-    class StaticNodeList : public NodeList {
-    public:
-        static PassRefPtr<StaticNodeList> adopt(Vector<RefPtr<Node> >& nodes)
-        {
-            RefPtr<StaticNodeList> nodeList = adoptRef(new StaticNodeList);
-            nodeList->m_nodes.swap(nodes);
-            return nodeList.release();
-        }
+class StaticNodeList FINAL : public NodeList {
+public:
+    static PassRefPtr<StaticNodeList> adopt(Vector<RefPtr<Node> >& nodes)
+    {
+        RefPtr<StaticNodeList> nodeList = adoptRef(new StaticNodeList);
+        nodeList->m_nodes.swap(nodes);
+        return nodeList.release();
+    }
 
-        static PassRefPtr<StaticNodeList> createEmpty()
-        {
-            return adoptRef(new StaticNodeList);
-        }
+    static PassRefPtr<StaticNodeList> createEmpty()
+    {
+        return adoptRef(new StaticNodeList);
+    }
 
-        virtual unsigned length() const OVERRIDE;
-        virtual Node* item(unsigned index) const OVERRIDE;
-        virtual Node* namedItem(const AtomicString&) const OVERRIDE;
+    virtual unsigned length() const OVERRIDE;
+    virtual Node* item(unsigned index) const OVERRIDE;
+    virtual Node* namedItem(const AtomicString&) const OVERRIDE;
 
-    private:
-        StaticNodeList() { }
-
-        Vector<RefPtr<Node> > m_nodes;
-    };
+private:
+    Vector<RefPtr<Node> > m_nodes;
+};
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/StringCallback.cpp b/Source/core/dom/StringCallback.cpp
index 092f70e..048dda5 100644
--- a/Source/core/dom/StringCallback.cpp
+++ b/Source/core/dom/StringCallback.cpp
@@ -31,21 +31,22 @@
 #include "config.h"
 #include "core/dom/StringCallback.h"
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/dom/ExecutionContextTask.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
 namespace {
 
-class DispatchCallbackTask : public ScriptExecutionContext::Task {
+class DispatchCallbackTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<DispatchCallbackTask> create(PassRefPtr<StringCallback> callback, const String& data)
     {
         return adoptPtr(new DispatchCallbackTask(callback, data));
     }
 
-    virtual void performTask(ScriptExecutionContext*)
+    virtual void performTask(ExecutionContext*)
     {
         m_callback->handleEvent(m_data);
     }
@@ -63,7 +64,7 @@
 
 } // namespace
 
-void StringCallback::scheduleCallback(ScriptExecutionContext* context, const String& data)
+void StringCallback::scheduleCallback(ExecutionContext* context, const String& data)
 {
     context->postTask(DispatchCallbackTask::create(this, data));
 }
diff --git a/Source/core/dom/StringCallback.h b/Source/core/dom/StringCallback.h
index e600847..fed4477 100644
--- a/Source/core/dom/StringCallback.h
+++ b/Source/core/dom/StringCallback.h
@@ -36,7 +36,7 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class StringCallback : public RefCounted<StringCallback> {
 public:
@@ -44,7 +44,7 @@
     virtual bool handleEvent(const String& data) = 0;
 
     // Helper to post callback task.
-    void scheduleCallback(ScriptExecutionContext*, const String& data);
+    void scheduleCallback(ExecutionContext*, const String& data);
 };
 
 } // namespace WebCore
diff --git a/Source/core/dom/StyleElement.cpp b/Source/core/dom/StyleElement.cpp
index cd1d2f4..d50689a 100644
--- a/Source/core/dom/StyleElement.cpp
+++ b/Source/core/dom/StyleElement.cpp
@@ -29,7 +29,7 @@
 #include "core/dom/ScriptableDocumentParser.h"
 #include "core/dom/StyleEngine.h"
 #include "core/html/HTMLStyleElement.h"
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/TextPosition.h"
 
@@ -76,7 +76,7 @@
         clearSheet();
 
     // If we're in document teardown, then we don't need to do any notification of our sheet's removal.
-    if (document.renderer())
+    if (document.isActive())
         document.removedStyleSheet(removedSheet.get());
 }
 
@@ -131,7 +131,8 @@
 
     // If type is empty or CSS, this is a CSS style sheet.
     const AtomicString& type = this->type();
-    if (document.contentSecurityPolicy()->allowInlineStyle(e->document().url(), m_startPosition.m_line) && isCSS(e, type)) {
+    bool passesContentSecurityPolicyChecks = document.contentSecurityPolicy()->allowStyleNonce(e->fastGetAttribute(HTMLNames::nonceAttr)) || document.contentSecurityPolicy()->allowInlineStyle(e->document().url(), m_startPosition.m_line);
+    if (isCSS(e, type) && passesContentSecurityPolicyChecks) {
         RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media());
 
         MediaQueryEvaluator screenEval("screen", true);
diff --git a/Source/core/dom/StyleEngine.cpp b/Source/core/dom/StyleEngine.cpp
index 94a218b..8d902cd 100644
--- a/Source/core/dom/StyleEngine.cpp
+++ b/Source/core/dom/StyleEngine.cpp
@@ -45,8 +45,8 @@
 #include "core/page/Page.h"
 #include "core/page/PageGroup.h"
 #include "core/page/Settings.h"
-#include "core/page/UserContentURLPattern.h"
 #include "core/svg/SVGStyleElement.h"
+#include "platform/URLPatternMatcher.h"
 
 namespace WebCore {
 
@@ -71,8 +71,6 @@
 {
     if (m_pageUserSheet)
         m_pageUserSheet->clearOwnerNode();
-    for (unsigned i = 0; i < m_injectedUserStyleSheets.size(); ++i)
-        m_injectedUserStyleSheets[i]->clearOwnerNode();
     for (unsigned i = 0; i < m_injectedAuthorStyleSheets.size(); ++i)
         m_injectedAuthorStyleSheets[i]->clearOwnerNode();
     for (unsigned i = 0; i < m_userStyleSheets.size(); ++i)
@@ -110,7 +108,7 @@
 
 StyleSheetCollection* StyleEngine::ensureStyleSheetCollectionFor(TreeScope& treeScope)
 {
-    if (&treeScope == &m_document)
+    if (treeScope == m_document)
         return &m_documentStyleSheetCollection;
 
     HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::AddResult result = m_styleSheetCollectionMap.add(&treeScope, nullptr);
@@ -121,7 +119,7 @@
 
 StyleSheetCollection* StyleEngine::styleSheetCollectionFor(TreeScope& treeScope)
 {
-    if (&treeScope == &m_document)
+    if (treeScope == m_document)
         return &m_documentStyleSheetCollection;
 
     HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::iterator it = m_styleSheetCollectionMap.find(&treeScope);
@@ -130,9 +128,12 @@
     return it->value.get();
 }
 
-const Vector<RefPtr<StyleSheet> >& StyleEngine::styleSheetsForStyleSheetList()
+const Vector<RefPtr<StyleSheet> >& StyleEngine::styleSheetsForStyleSheetList(TreeScope& treeScope)
 {
-    return m_documentStyleSheetCollection.styleSheetsForStyleSheetList();
+    if (treeScope == m_document)
+        return m_documentStyleSheetCollection.styleSheetsForStyleSheetList();
+
+    return ensureStyleSheetCollectionFor(treeScope)->styleSheetsForStyleSheetList();
 }
 
 const Vector<RefPtr<CSSStyleSheet> >& StyleEngine::activeAuthorStyleSheets() const
@@ -203,12 +204,6 @@
         m_document.addedStyleSheet(addedSheet, RecalcStyleImmediately);
 }
 
-const Vector<RefPtr<CSSStyleSheet> >& StyleEngine::injectedUserStyleSheets() const
-{
-    updateInjectedStyleSheetCache();
-    return m_injectedUserStyleSheets;
-}
-
 const Vector<RefPtr<CSSStyleSheet> >& StyleEngine::injectedAuthorStyleSheets() const
 {
     updateInjectedStyleSheetCache();
@@ -220,7 +215,6 @@
     if (m_injectedStyleSheetCacheValid)
         return;
     m_injectedStyleSheetCacheValid = true;
-    m_injectedUserStyleSheets.clear();
     m_injectedAuthorStyleSheets.clear();
 
     Page* owningPage = m_document.page();
@@ -228,20 +222,16 @@
         return;
 
     const PageGroup& pageGroup = owningPage->group();
-    const UserStyleSheetVector& sheets = pageGroup.userStyleSheets();
+    const InjectedStyleSheetVector& sheets = pageGroup.injectedStyleSheets();
     for (unsigned i = 0; i < sheets.size(); ++i) {
-        const UserStyleSheet* sheet = sheets[i].get();
-        if (sheet->injectedFrames() == InjectInTopFrameOnly && m_document.ownerElement())
+        const InjectedStyleSheet* sheet = sheets[i].get();
+        if (sheet->injectedFrames() == InjectStyleInTopFrameOnly && m_document.ownerElement())
             continue;
-        if (!UserContentURLPattern::matchesPatterns(m_document.url(), sheet->whitelist(), sheet->blacklist()))
+        if (!URLPatternMatcher::matchesPatterns(m_document.url(), sheet->whitelist()))
             continue;
-        RefPtr<CSSStyleSheet> groupSheet = CSSStyleSheet::createInline(const_cast<Document*>(&m_document), sheet->url());
-        bool isUserStyleSheet = sheet->level() == UserStyleUserLevel;
-        if (isUserStyleSheet)
-            m_injectedUserStyleSheets.append(groupSheet);
-        else
-            m_injectedAuthorStyleSheets.append(groupSheet);
-        groupSheet->contents()->setIsUserStyleSheet(isUserStyleSheet);
+        RefPtr<CSSStyleSheet> groupSheet = CSSStyleSheet::createInline(const_cast<Document*>(&m_document), KURL());
+        m_injectedAuthorStyleSheets.append(groupSheet);
+        groupSheet->contents()->setIsUserStyleSheet(false);
         groupSheet->contents()->parseString(sheet->source());
     }
 }
@@ -280,7 +270,7 @@
     m_pendingStylesheets--;
 
     TreeScope* treeScope = isHTMLStyleElement(styleSheetCandidateNode) ? &styleSheetCandidateNode->treeScope() : &m_document;
-    if (treeScope == &m_document)
+    if (treeScope == m_document)
         m_needsDocumentStyleSheetsUpdate = true;
     else
         m_dirtyTreeScopes.add(treeScope);
@@ -304,13 +294,13 @@
         return;
 
     TreeScope& treeScope = isHTMLStyleElement(node) ? node->treeScope() : m_document;
-    ASSERT(isHTMLStyleElement(node) || &treeScope == &m_document);
+    ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
 
     StyleSheetCollection* collection = ensureStyleSheetCollectionFor(treeScope);
     ASSERT(collection);
     collection->addStyleSheetCandidateNode(node, createdByParser);
 
-    if (&treeScope == &m_document) {
+    if (treeScope == m_document) {
         m_needsDocumentStyleSheetsUpdate = true;
         return;
     }
@@ -322,13 +312,13 @@
 void StyleEngine::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopingNode)
 {
     TreeScope& treeScope = scopingNode ? scopingNode->treeScope() : m_document;
-    ASSERT(isHTMLStyleElement(node) || &treeScope == &m_document);
+    ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
 
     StyleSheetCollection* collection = styleSheetCollectionFor(treeScope);
     ASSERT(collection);
     collection->removeStyleSheetCandidateNode(node, scopingNode);
 
-    if (&treeScope == &m_document) {
+    if (treeScope == m_document) {
         m_needsDocumentStyleSheetsUpdate = true;
         return;
     }
@@ -342,8 +332,8 @@
         return;
 
     TreeScope& treeScope = isHTMLStyleElement(node) ? node->treeScope() : m_document;
-    ASSERT(isHTMLStyleElement(node) || &treeScope == &m_document);
-    if (&treeScope == &m_document) {
+    ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
+    if (treeScope == m_document) {
         m_needsDocumentStyleSheetsUpdate = true;
         return;
     }
@@ -365,7 +355,7 @@
         return false;
 
     }
-    if (!m_document.renderer() || !m_document.attached())
+    if (!m_document.isActive())
         return false;
 
     bool requiresFullStyleRecalc = false;
@@ -378,7 +368,7 @@
 
         for (TreeScopeSet::iterator it = treeScopes.begin(); it != treeScopes.end(); ++it) {
             TreeScope* treeScope = *it;
-            ASSERT(treeScope != &m_document);
+            ASSERT(treeScope != m_document);
             ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleSheetCollection*>(styleSheetCollectionFor(*treeScope));
             ASSERT(collection);
             collection->updateActiveStyleSheets(this, updateMode);
diff --git a/Source/core/dom/StyleEngine.h b/Source/core/dom/StyleEngine.h
index 98d2bae..2c70a5b 100644
--- a/Source/core/dom/StyleEngine.h
+++ b/Source/core/dom/StyleEngine.h
@@ -55,13 +55,12 @@
 
     ~StyleEngine();
 
-    const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList();
+    const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList(TreeScope&);
     const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const;
 
     CSSStyleSheet* pageUserSheet();
     const Vector<RefPtr<CSSStyleSheet> >& documentUserStyleSheets() const { return m_userStyleSheets; }
     const Vector<RefPtr<CSSStyleSheet> >& documentAuthorStyleSheets() const { return m_authorStyleSheets; }
-    const Vector<RefPtr<CSSStyleSheet> >& injectedUserStyleSheets() const;
     const Vector<RefPtr<CSSStyleSheet> >& injectedAuthorStyleSheets() const;
 
     void addStyleSheetCandidateNode(Node*, bool createdByParser);
@@ -132,7 +131,6 @@
 
     RefPtr<CSSStyleSheet> m_pageUserSheet;
 
-    mutable Vector<RefPtr<CSSStyleSheet> > m_injectedUserStyleSheets;
     mutable Vector<RefPtr<CSSStyleSheet> > m_injectedAuthorStyleSheets;
     mutable bool m_injectedStyleSheetCacheValid;
 
diff --git a/Source/core/dom/TagNodeList.h b/Source/core/dom/TagNodeList.h
index 3ef510b..8ec4193 100644
--- a/Source/core/dom/TagNodeList.h
+++ b/Source/core/dom/TagNodeList.h
@@ -56,7 +56,7 @@
     AtomicString m_localName;
 };
 
-class HTMLTagNodeList : public TagNodeList {
+class HTMLTagNodeList FINAL : public TagNodeList {
 public:
     static PassRefPtr<HTMLTagNodeList> create(PassRefPtr<Node> rootNode, CollectionType type, const AtomicString& localName)
     {
@@ -69,7 +69,7 @@
 private:
     HTMLTagNodeList(PassRefPtr<Node> rootNode, const AtomicString& localName);
 
-    virtual bool nodeMatches(Element*) const;
+    virtual bool nodeMatches(Element*) const OVERRIDE;
 
     AtomicString m_loweredLocalName;
 };
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index 5c300c5..eab7ece 100644
--- a/Source/core/dom/Text.cpp
+++ b/Source/core/dom/Text.cpp
@@ -332,7 +332,7 @@
 
 void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData, RecalcStyleBehavior recalcStyleBehavior)
 {
-    if (!attached())
+    if (!confusingAndOftenMisusedAttached())
         return;
     RenderText* textRenderer = toRenderText(renderer());
     if (!textRenderer || !textRendererIsNeeded(NodeRenderingContext(this, textRenderer->style()))) {
@@ -355,19 +355,6 @@
     return create(document(), data);
 }
 
-PassRefPtr<Text> Text::createWithLengthLimit(Document& document, const String& data, unsigned start, unsigned lengthLimit)
-{
-    unsigned dataLength = data.length();
-
-    if (!start && dataLength <= lengthLimit)
-        return create(document, data);
-
-    RefPtr<Text> result = Text::create(document, String());
-    result->parserAppendData(data, start, lengthLimit);
-
-    return result;
-}
-
 #ifndef NDEBUG
 void Text::formatForDebugger(char *buffer, unsigned length) const
 {
diff --git a/Source/core/dom/Text.h b/Source/core/dom/Text.h
index df95ff1..ee66dab 100644
--- a/Source/core/dom/Text.h
+++ b/Source/core/dom/Text.h
@@ -29,14 +29,13 @@
 
 class ExceptionState;
 class RenderText;
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class Text : public CharacterData {
 public:
     static const unsigned defaultLengthLimit = 1 << 16;
 
     static PassRefPtr<Text> create(Document&, const String&);
-    static PassRefPtr<Text> createWithLengthLimit(Document&, const String&, unsigned positionInString, unsigned lengthLimit = defaultLengthLimit);
     static PassRefPtr<Text> createEditingText(Document&, const String&);
 
     // mergeNextSiblingNodesIfPossible() merges next sibling nodes if possible
@@ -80,17 +79,7 @@
 #endif
 };
 
-inline Text* toText(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isTextNode());
-    return static_cast<Text*>(node);
-}
-
-inline const Text* toText(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isTextNode());
-    return static_cast<const Text*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(Text, isTextNode());
 
 } // namespace WebCore
 
diff --git a/Source/core/dom/Text.idl b/Source/core/dom/Text.idl
index af7360a..0ee791b 100644
--- a/Source/core/dom/Text.idl
+++ b/Source/core/dom/Text.idl
@@ -30,5 +30,5 @@
     [MeasureAs=TextReplaceWholeText] Text replaceWholeText(DOMString content); // Removed from DOM4.
 
     // Shadow DOM API
-    [EnabledAtRuntime=ShadowDOM, PerWorldBindings] NodeList getDestinationInsertionPoints();
+    [RuntimeEnabled=ShadowDOM, PerWorldBindings] NodeList getDestinationInsertionPoints();
 };
diff --git a/Source/core/dom/Touch.cpp b/Source/core/dom/Touch.cpp
index 170af00..a955bab 100644
--- a/Source/core/dom/Touch.cpp
+++ b/Source/core/dom/Touch.cpp
@@ -27,8 +27,8 @@
 
 #include "core/dom/Touch.h"
 
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 
 namespace WebCore {
 
diff --git a/Source/core/dom/Touch.h b/Source/core/dom/Touch.h
index f068a2f..220d4cf 100644
--- a/Source/core/dom/Touch.h
+++ b/Source/core/dom/Touch.h
@@ -28,7 +28,7 @@
 
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/events/EventTarget.h"
-#include "core/platform/graphics/LayoutPoint.h"
+#include "platform/geometry/LayoutPoint.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/dom/TouchController.cpp b/Source/core/dom/TouchController.cpp
index 2680158..ef6b65f 100644
--- a/Source/core/dom/TouchController.cpp
+++ b/Source/core/dom/TouchController.cpp
@@ -27,11 +27,11 @@
 #include "core/dom/TouchController.h"
 
 #include "core/dom/Document.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/events/TouchEvent.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
 
@@ -54,10 +54,10 @@
 
 TouchController* TouchController::from(Document* document)
 {
-    TouchController* controller = static_cast<TouchController*>(Supplement<ScriptExecutionContext>::from(document, supplementName()));
+    TouchController* controller = static_cast<TouchController*>(DocumentSupplement::from(document, supplementName()));
     if (!controller) {
         controller = new TouchController(document);
-        Supplement<ScriptExecutionContext>::provideTo(document, supplementName(), adoptPtr(controller));
+        DocumentSupplement::provideTo(document, supplementName(), adoptPtr(controller));
     }
     return controller;
 }
@@ -119,7 +119,7 @@
 
 void TouchController::didAddEventListener(DOMWindow* window, const AtomicString& eventType)
 {
-    if (eventNames().isTouchEventType(eventType)) {
+    if (isTouchEventType(eventType)) {
         Document* document = window->document();
         didAddTouchEventHandler(document, document);
     }
@@ -127,7 +127,7 @@
 
 void TouchController::didRemoveEventListener(DOMWindow* window, const AtomicString& eventType)
 {
-    if (eventNames().isTouchEventType(eventType)) {
+    if (isTouchEventType(eventType)) {
         Document* document = window->document();
         didRemoveTouchEventHandler(document, document);
     }
@@ -141,7 +141,7 @@
 
 void TouchController::documentWasDetached()
 {
-    Document* document = static_cast<Document*>(scriptExecutionContext());
+    Document* document = static_cast<Document*>(executionContext());
     Document* parentDocument = document->parentDocument();
 
     if (parentDocument) {
@@ -153,7 +153,7 @@
 
 void TouchController::documentBeingDestroyed()
 {
-    Document* document = static_cast<Document*>(scriptExecutionContext());
+    Document* document = static_cast<Document*>(executionContext());
 
     if (Document* ownerDocument = document->ownerDocument())
         TouchController::from(ownerDocument)->didRemoveEventTargetNode(ownerDocument, document);
diff --git a/Source/core/dom/TouchController.h b/Source/core/dom/TouchController.h
index e444816..8ce5e13 100644
--- a/Source/core/dom/TouchController.h
+++ b/Source/core/dom/TouchController.h
@@ -29,8 +29,8 @@
 #include "core/dom/DocumentLifecycleObserver.h"
 #include "core/events/Event.h"
 #include "core/dom/Node.h"
-#include "core/page/DOMWindowLifecycleObserver.h"
-#include "core/platform/Supplementable.h"
+#include "core/frame/DOMWindowLifecycleObserver.h"
+#include "platform/Supplementable.h"
 #include "wtf/HashSet.h"
 
 namespace WebCore {
@@ -40,7 +40,7 @@
 class Document;
 class DOMWindow;
 
-class TouchController : public Supplement<ScriptExecutionContext>, public DOMWindowLifecycleObserver, public DocumentLifecycleObserver {
+class TouchController : public DocumentSupplement, public DOMWindowLifecycleObserver, public DocumentLifecycleObserver {
 
 public:
     virtual ~TouchController();
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index 086ecf7..1066b62 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -32,19 +32,19 @@
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/dom/ElementTraversal.h"
-#include "core/events/EventPathWalker.h"
 #include "core/dom/IdTargetObserverRegistry.h"
 #include "core/dom/TreeScopeAdopter.h"
 #include "core/dom/shadow/ElementShadow.h"
 #include "core/dom/shadow/ShadowRoot.h"
+#include "core/events/EventPathWalker.h"
 #include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/html/HTMLLabelElement.h"
 #include "core/html/HTMLMapElement.h"
 #include "core/page/DOMSelection.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderView.h"
@@ -170,7 +170,7 @@
 Node* TreeScope::ancestorInThisScope(Node* node) const
 {
     while (node) {
-        if (&node->treeScope() == this)
+        if (node->treeScope() == this)
             return node;
         if (!node->isInShadowTree())
             return 0;
@@ -214,7 +214,7 @@
     return toHTMLMapElement(m_imageMapsByName->getElementByMapName(AtomicString(name).impl(), this));
 }
 
-Node* nodeFromPoint(Document* document, int x, int y, LayoutPoint* localPoint)
+RenderObject* rendererFromPoint(Document* document, int x, int y, LayoutPoint* localPoint)
 {
     Frame* frame = document->frame();
 
@@ -237,14 +237,19 @@
     if (localPoint)
         *localPoint = result.localPoint();
 
-    return result.innerNode();
+    return result.renderer();
 }
 
 Element* TreeScope::elementFromPoint(int x, int y) const
 {
-    Node* node = nodeFromPoint(&rootNode()->document(), x, y);
-    if (node && node->isTextNode())
-        node = node->parentNode();
+    RenderObject* renderer = rendererFromPoint(&rootNode()->document(), x, y);
+    if (!renderer)
+        return 0;
+    Node* node = renderer->node();
+    if (!node)
+        return 0;
+    if (node->isPseudoElement() || node->isTextNode())
+        node = node->parentOrShadowHostNode();
     ASSERT(!node || node->isElementNode() || node->isShadowRoot());
     node = ancestorInThisScope(node);
     if (!node || !node->isElementNode())
@@ -333,7 +338,7 @@
     ASSERT(this);
     ASSERT(node);
     ASSERT(!node->isDocumentNode());
-    ASSERT(!node->m_deletionHasBegun);
+    ASSERT_WITH_SECURITY_IMPLICATION(!node->m_deletionHasBegun);
     TreeScopeAdopter adopter(node, this);
     if (adopter.needsScopeChange())
         adopter.execute();
@@ -356,24 +361,15 @@
         element = focusedFrameOwnerElement(document.page()->focusController().focusedFrame(), document.frame());
     if (!element)
         return 0;
-    Vector<Node*> targetStack;
+
     for (EventPathWalker walker(element); walker.node(); walker.moveToParent()) {
-        Node* node = walker.node();
-        if (targetStack.isEmpty())
-            targetStack.append(node);
-        else if (walker.isVisitingInsertionPointInReprojection())
-            targetStack.append(targetStack.last());
-        if (node == rootNode()) {
-            // targetStack.last() is one of the followings:
+        if (walker.node() == rootNode()) {
+            // walker.adjustedTarget() is one of the followings:
             // - InsertionPoint
             // - shadow host
             // - Document::focusedElement()
             // So, it's safe to do toElement().
-            return toElement(targetStack.last());
-        }
-        if (node->isShadowRoot()) {
-            ASSERT(!targetStack.isEmpty());
-            targetStack.removeLast();
+            return toElement(walker.adjustedTarget());
         }
     }
     return 0;
@@ -381,7 +377,7 @@
 
 unsigned short TreeScope::comparePosition(const TreeScope& otherScope) const
 {
-    if (&otherScope == this)
+    if (otherScope == this)
         return Node::DOCUMENT_POSITION_EQUIVALENT;
 
     Vector<const TreeScope*, 16> chain1;
@@ -437,7 +433,7 @@
     if (!nodeA || !nodeB)
         return 0;
 
-    if (&nodeA->treeScope() == &nodeB->treeScope())
+    if (nodeA->treeScope() == nodeB->treeScope())
         return &nodeA->treeScope();
 
     Vector<TreeScope*, 5> treeScopesA;
@@ -454,7 +450,7 @@
     return treeScopesA[indexA] == treeScopesB[indexB] ? treeScopesA[indexA] : 0;
 }
 
-#ifndef NDEBUG
+#if SECURITY_ASSERT_ENABLED
 bool TreeScope::deletionHasBegun()
 {
     return rootNode() && rootNode()->m_deletionHasBegun;
diff --git a/Source/core/dom/TreeScope.h b/Source/core/dom/TreeScope.h
index ecfc830..74798c7 100644
--- a/Source/core/dom/TreeScope.h
+++ b/Source/core/dom/TreeScope.h
@@ -42,6 +42,7 @@
 class LayoutPoint;
 class IdTargetObserverRegistry;
 class Node;
+class RenderObject;
 
 // A class which inherits both Node and TreeScope must call clearRareData() in its destructor
 // so that the Node destructor no longer does problematic NodeList cache manipulation in
@@ -151,7 +152,7 @@
     virtual void dispose() { }
 
     int refCount() const;
-#ifndef NDEBUG
+#if SECURITY_ASSERT_ENABLED
     bool deletionHasBegun();
     void beginDeletion();
 #else
@@ -186,7 +187,14 @@
     return m_elementsById && m_elementsById->containsMultiple(id.impl());
 }
 
-Node* nodeFromPoint(Document*, int x, int y, LayoutPoint* localPoint = 0);
+inline bool operator==(const TreeScope& a, const TreeScope& b) { return &a == &b; }
+inline bool operator==(const TreeScope& a, const TreeScope* b) { return &a == b; }
+inline bool operator==(const TreeScope* a, const TreeScope& b) { return a == &b; }
+inline bool operator!=(const TreeScope& a, const TreeScope& b) { return !(a == b); }
+inline bool operator!=(const TreeScope& a, const TreeScope* b) { return !(a == b); }
+inline bool operator!=(const TreeScope* a, const TreeScope& b) { return !(a == b); }
+
+RenderObject* rendererFromPoint(Document*, int x, int y, LayoutPoint* localPoint = 0);
 TreeScope* commonTreeScope(Node*, Node*);
 
 } // namespace WebCore
diff --git a/Source/core/dom/TreeScopeAdopter.cpp b/Source/core/dom/TreeScopeAdopter.cpp
index be8670b..309a0e5 100644
--- a/Source/core/dom/TreeScopeAdopter.cpp
+++ b/Source/core/dom/TreeScopeAdopter.cpp
@@ -45,9 +45,10 @@
     // of the document it was moved to. By increasing the DOMTreeVersion of the donating document here
     // we ensure that the collection cache will be invalidated as needed when the element is moved back.
     Document* oldDocument = m_oldScope->documentScope();
+    ASSERT(oldDocument);
     Document* newDocument = m_newScope->documentScope();
     bool willMoveToNewDocument = oldDocument != newDocument;
-    if (oldDocument && willMoveToNewDocument)
+    if (willMoveToNewDocument)
         oldDocument->incDOMTreeVersion();
 
     for (Node* node = root; node; node = NodeTraversal::next(node, root)) {
@@ -93,7 +94,7 @@
 static bool didMoveToNewDocumentWasCalled = false;
 static Document* oldDocumentDidMoveToNewDocumentWasCalledWith = 0;
 
-void TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(Document* oldDocument)
+void TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(Document& oldDocument)
 {
     ASSERT(!didMoveToNewDocumentWasCalled);
     ASSERT_UNUSED(oldDocument, oldDocument == oldDocumentDidMoveToNewDocumentWasCalledWith);
@@ -104,7 +105,7 @@
 inline void TreeScopeAdopter::updateTreeScope(Node* node) const
 {
     ASSERT(!node->isTreeScope());
-    ASSERT(&node->treeScope() == m_oldScope);
+    ASSERT(node->treeScope() == m_oldScope);
     m_newScope->guardRef();
     m_oldScope->guardDeref();
     node->setTreeScope(m_newScope);
@@ -113,6 +114,7 @@
 inline void TreeScopeAdopter::moveNodeToNewDocument(Node* node, Document* oldDocument, Document* newDocument) const
 {
     ASSERT(!node->inDocument() || oldDocument != newDocument);
+    ASSERT(oldDocument);
 
     if (node->hasRareData()) {
         NodeRareData* rareData = node->rareData();
@@ -120,8 +122,7 @@
             rareData->nodeLists()->adoptDocument(oldDocument, newDocument);
     }
 
-    if (oldDocument)
-        oldDocument->moveNodeIteratorsToNewDocument(node, newDocument);
+    oldDocument->moveNodeIteratorsToNewDocument(node, newDocument);
 
     if (node->isShadowRoot())
         toShadowRoot(node)->setDocumentScope(newDocument);
@@ -131,7 +132,7 @@
     oldDocumentDidMoveToNewDocumentWasCalledWith = oldDocument;
 #endif
 
-    node->didMoveToNewDocument(oldDocument);
+    node->didMoveToNewDocument(*oldDocument);
     ASSERT(didMoveToNewDocumentWasCalled);
 }
 
diff --git a/Source/core/dom/TreeScopeAdopter.h b/Source/core/dom/TreeScopeAdopter.h
index 4ad9760..a83d178 100644
--- a/Source/core/dom/TreeScopeAdopter.h
+++ b/Source/core/dom/TreeScopeAdopter.h
@@ -39,9 +39,9 @@
     bool needsScopeChange() const { return m_oldScope != m_newScope; }
 
 #ifdef NDEBUG
-    static void ensureDidMoveToNewDocumentWasCalled(Document*) { }
+    static void ensureDidMoveToNewDocumentWasCalled(Document&) { }
 #else
-    static void ensureDidMoveToNewDocumentWasCalled(Document*);
+    static void ensureDidMoveToNewDocumentWasCalled(Document&);
 #endif
 
 private:
diff --git a/Source/core/dom/TreeShared.h b/Source/core/dom/TreeShared.h
new file mode 100644
index 0000000..f57076a
--- /dev/null
+++ b/Source/core/dom/TreeShared.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2006, 2007, 2009, 2010, 2012 Apple Inc. 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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TreeShared_h
+#define TreeShared_h
+
+#include "wtf/Assertions.h"
+#include "wtf/MainThread.h"
+#include "wtf/Noncopyable.h"
+
+namespace WebCore {
+
+#if SECURITY_ASSERT_ENABLED
+template<typename NodeType> class TreeShared;
+template<typename NodeType> void adopted(TreeShared<NodeType>*);
+#endif
+
+template<typename NodeType> class TreeShared {
+    WTF_MAKE_NONCOPYABLE(TreeShared);
+protected:
+    TreeShared()
+        : m_refCount(1)
+#if SECURITY_ASSERT_ENABLED
+        , m_deletionHasBegun(false)
+#if !ASSERT_DISABLED
+        , m_inRemovedLastRefFunction(false)
+        , m_adoptionIsRequired(true)
+#endif
+#endif
+    {
+        ASSERT(isMainThread());
+    }
+
+    ~TreeShared()
+    {
+        ASSERT(isMainThread());
+        ASSERT(!m_refCount);
+        ASSERT_WITH_SECURITY_IMPLICATION(m_deletionHasBegun);
+        ASSERT(!m_adoptionIsRequired);
+    }
+
+public:
+    void ref()
+    {
+        ASSERT(isMainThread());
+        ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
+        ASSERT(!m_inRemovedLastRefFunction);
+        ASSERT(!m_adoptionIsRequired);
+        ++m_refCount;
+    }
+
+    void deref()
+    {
+        ASSERT(isMainThread());
+        ASSERT(m_refCount >= 0);
+        ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
+        ASSERT(!m_inRemovedLastRefFunction);
+        ASSERT(!m_adoptionIsRequired);
+        NodeType* thisNode = static_cast<NodeType*>(this);
+        if (--m_refCount <= 0 && !thisNode->hasTreeSharedParent()) {
+#if !ASSERT_DISABLED
+            m_inRemovedLastRefFunction = true;
+#endif
+            thisNode->removedLastRef();
+        }
+    }
+
+    bool hasOneRef() const
+    {
+        ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
+        ASSERT(!m_inRemovedLastRefFunction);
+        return m_refCount == 1;
+    }
+
+    int refCount() const
+    {
+        return m_refCount;
+    }
+
+private:
+    int m_refCount;
+
+#if SECURITY_ASSERT_ENABLED
+public:
+    bool m_deletionHasBegun;
+#if !ASSERT_DISABLED
+    bool m_inRemovedLastRefFunction;
+
+private:
+    friend void adopted<>(TreeShared<NodeType>*);
+    bool m_adoptionIsRequired;
+#endif
+#endif
+};
+
+#if SECURITY_ASSERT_ENABLED
+template<typename NodeType> inline void adopted(TreeShared<NodeType>* object)
+{
+    if (!object)
+        return;
+    ASSERT_WITH_SECURITY_IMPLICATION(!object->m_deletionHasBegun);
+#if !ASSERT_DISABLED
+    ASSERT(!object->m_inRemovedLastRefFunction);
+    object->m_adoptionIsRequired = false;
+#endif
+}
+#endif
+
+}
+
+#endif // TreeShared.h
diff --git a/Source/core/dom/URL.idl b/Source/core/dom/URL.idl
new file mode 100644
index 0000000..37e2a90
--- /dev/null
+++ b/Source/core/dom/URL.idl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Motorola Mobility Inc.
+ *
+ * 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.
+ */
+
+[
+    GlobalContext=Window&WorkerGlobalScope,
+    ConstructorRaisesException,
+    Constructor(DOMString url),
+    Constructor(DOMString url, URL base),
+    Constructor(DOMString url, DOMString base),
+    ImplementedAs=DOMURL
+] interface URL {
+    [CallWith=ExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(Blob? blob);
+    [CallWith=ExecutionContext] static void revokeObjectURL(DOMString url);
+};
+
+// Force rebuild: crbug.com/307023
+URL implements URLUtils;
diff --git a/Source/core/dom/URLUtils.idl b/Source/core/dom/URLUtils.idl
new file mode 100644
index 0000000..b4c3e67
--- /dev/null
+++ b/Source/core/dom/URLUtils.idl
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ * 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,
+ * 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.
+ */
+
+[
+    NoInterfaceObject,
+    ImplementedAs=DOMURLUtils
+] interface URLUtils {
+    // Special case null for backwards compat with HTMLAnchorElement href.
+    // https://code.google.com/p/chromium/issues/detail?id=304959
+    [TreatNullAs=NullString] attribute DOMString href;
+
+    [NotEnumerable, ImplementedAs=href] DOMString toString();
+
+    readonly attribute DOMString origin;
+    attribute DOMString protocol;
+    attribute DOMString username;
+    attribute DOMString password;
+    attribute DOMString host;
+    attribute DOMString hostname;
+    attribute DOMString port;
+    attribute DOMString pathname;
+    attribute DOMString search;
+
+    // Not yet implemented.
+    // attribute URLQuery? query;
+
+    attribute DOMString hash;
+};
+
diff --git a/Source/core/dom/URLUtilsReadOnly.idl b/Source/core/dom/URLUtilsReadOnly.idl
new file mode 100644
index 0000000..0d36b46
--- /dev/null
+++ b/Source/core/dom/URLUtilsReadOnly.idl
@@ -0,0 +1,41 @@
+/*
+ * 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:
+ * 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,
+ * 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.
+ */
+
+[
+    NoInterfaceObject,
+    ImplementedAs=DOMURLUtilsReadOnly
+] interface URLUtilsReadOnly {
+    readonly attribute DOMString href;
+
+    [NotEnumerable, ImplementedAs=href] DOMString toString();
+
+    readonly attribute DOMString protocol;
+    readonly attribute DOMString host;
+    readonly attribute DOMString hostname;
+    readonly attribute DOMString port;
+    readonly attribute DOMString pathname;
+    readonly attribute DOMString search;
+    readonly attribute DOMString hash;
+};
diff --git a/Source/core/dom/UserGestureIndicator.cpp b/Source/core/dom/UserGestureIndicator.cpp
deleted file mode 100644
index b52b871..0000000
--- a/Source/core/dom/UserGestureIndicator.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#include "config.h"
-#include "core/dom/UserGestureIndicator.h"
-#include "wtf/CurrentTime.h"
-
-namespace WebCore {
-
-namespace {
-
-// User gestures timeout in 1 second.
-const double userGestureTimeout = 1.0;
-
-// For out of process tokens we allow a 10 second delay.
-const double userGestureOutOfProcessTimeout = 10.0;
-
-class GestureToken : public UserGestureToken {
-public:
-    static PassRefPtr<UserGestureToken> create() { return adoptRef(new GestureToken); }
-
-    virtual ~GestureToken() { }
-    virtual bool hasGestures() const OVERRIDE
-    {
-        // Do not enforce timeouts for gestures which spawned javascript prompts.
-        if (m_consumableGestures < 1 || (WTF::currentTime() - m_timestamp > (m_outOfProcess ? userGestureOutOfProcessTimeout : userGestureTimeout) && !m_javascriptPrompt))
-            return false;
-        return true;
-    }
-
-    void addGesture()
-    {
-        m_consumableGestures++;
-        m_timestamp = WTF::currentTime();
-    }
-
-    void resetTimestamp()
-    {
-        m_timestamp = WTF::currentTime();
-    }
-
-    bool consumeGesture()
-    {
-        if (!m_consumableGestures)
-            return false;
-        m_consumableGestures--;
-        return true;
-    }
-
-    virtual void setOutOfProcess() OVERRIDE
-    {
-        if (WTF::currentTime() - m_timestamp > userGestureTimeout)
-            return;
-        if (hasGestures())
-            m_outOfProcess = true;
-    }
-
-    virtual void setJavascriptPrompt() OVERRIDE
-    {
-        if (WTF::currentTime() - m_timestamp > userGestureTimeout)
-            return;
-        if (hasGestures())
-            m_javascriptPrompt = true;
-    }
-
-private:
-    GestureToken()
-        : m_consumableGestures(0),
-        m_timestamp(0),
-        m_outOfProcess(false),
-        m_javascriptPrompt(false)
-    {
-    }
-
-    size_t m_consumableGestures;
-    double m_timestamp;
-    bool m_outOfProcess;
-    bool m_javascriptPrompt;
-};
-
-}
-
-static bool isDefinite(ProcessingUserGestureState state)
-{
-    return state == DefinitelyProcessingNewUserGesture || state == DefinitelyProcessingUserGesture || state == DefinitelyNotProcessingUserGesture;
-}
-
-ProcessingUserGestureState UserGestureIndicator::s_state = DefinitelyNotProcessingUserGesture;
-UserGestureIndicator* UserGestureIndicator::s_topmostIndicator = 0;
-
-UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state)
-    : m_previousState(s_state)
-{
-    // We overwrite s_state only if the caller is definite about the gesture state.
-    if (isDefinite(state)) {
-        if (!s_topmostIndicator) {
-            s_topmostIndicator = this;
-            m_token = GestureToken::create();
-        } else
-            m_token = s_topmostIndicator->currentToken();
-        s_state = state;
-    }
-
-    if (state == DefinitelyProcessingNewUserGesture)
-        static_cast<GestureToken*>(m_token.get())->addGesture();
-    else if (state == DefinitelyProcessingUserGesture && s_topmostIndicator == this)
-        static_cast<GestureToken*>(m_token.get())->addGesture();
-    ASSERT(isDefinite(s_state));
-}
-
-UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token)
-    : m_previousState(s_state)
-{
-    if (token) {
-        static_cast<GestureToken*>(token.get())->resetTimestamp();
-        if (!s_topmostIndicator) {
-            s_topmostIndicator = this;
-            m_token = token;
-        } else {
-            m_token = s_topmostIndicator->currentToken();
-            if (static_cast<GestureToken*>(token.get())->hasGestures()) {
-                static_cast<GestureToken*>(m_token.get())->addGesture();
-                static_cast<GestureToken*>(token.get())->consumeGesture();
-            }
-        }
-        s_state = DefinitelyProcessingUserGesture;
-    }
-
-    ASSERT(isDefinite(s_state));
-}
-
-UserGestureIndicator::~UserGestureIndicator()
-{
-    s_state = m_previousState;
-    if (s_topmostIndicator == this)
-        s_topmostIndicator = 0;
-    ASSERT(isDefinite(s_state));
-}
-
-bool UserGestureIndicator::processingUserGesture()
-{
-    return s_topmostIndicator && static_cast<GestureToken*>(s_topmostIndicator->currentToken())->hasGestures() && (s_state == DefinitelyProcessingNewUserGesture || s_state == DefinitelyProcessingUserGesture);
-}
-
-bool UserGestureIndicator::consumeUserGesture()
-{
-    if (!s_topmostIndicator)
-        return false;
-    return static_cast<GestureToken*>(s_topmostIndicator->currentToken())->consumeGesture();
-}
-
-UserGestureToken* UserGestureIndicator::currentToken()
-{
-    if (!s_topmostIndicator)
-        return 0;
-    return s_topmostIndicator->m_token.get();
-}
-
-UserGestureIndicatorDisabler::UserGestureIndicatorDisabler()
-    : m_savedState(UserGestureIndicator::s_state)
-    , m_savedIndicator(UserGestureIndicator::s_topmostIndicator)
-{
-    UserGestureIndicator::s_state = DefinitelyNotProcessingUserGesture;
-    UserGestureIndicator::s_topmostIndicator = 0;
-}
-
-UserGestureIndicatorDisabler::~UserGestureIndicatorDisabler()
-{
-    UserGestureIndicator::s_state = m_savedState;
-    UserGestureIndicator::s_topmostIndicator = m_savedIndicator;
-}
-
-}
diff --git a/Source/core/dom/UserGestureIndicator.h b/Source/core/dom/UserGestureIndicator.h
deleted file mode 100644
index fd251f2..0000000
--- a/Source/core/dom/UserGestureIndicator.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2010 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 UserGestureIndicator_h
-#define UserGestureIndicator_h
-
-#include "wtf/Noncopyable.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class UserGestureIndicator;
-
-enum ProcessingUserGestureState {
-    DefinitelyProcessingNewUserGesture,
-    DefinitelyProcessingUserGesture,
-    PossiblyProcessingUserGesture,
-    DefinitelyNotProcessingUserGesture
-};
-
-class UserGestureToken : public RefCounted<UserGestureToken> {
-public:
-    virtual ~UserGestureToken() { }
-    virtual bool hasGestures() const = 0;
-    virtual void setOutOfProcess() = 0;
-    virtual void setJavascriptPrompt() = 0;
-};
-
-class UserGestureIndicatorDisabler {
-    WTF_MAKE_NONCOPYABLE(UserGestureIndicatorDisabler);
-public:
-    UserGestureIndicatorDisabler();
-    ~UserGestureIndicatorDisabler();
-
-private:
-    ProcessingUserGestureState m_savedState;
-    UserGestureIndicator* m_savedIndicator;
-};
-
-class UserGestureIndicator {
-    WTF_MAKE_NONCOPYABLE(UserGestureIndicator);
-    friend class UserGestureIndicatorDisabler;
-public:
-    static bool processingUserGesture();
-    static bool consumeUserGesture();
-    static UserGestureToken* currentToken();
-
-    explicit UserGestureIndicator(ProcessingUserGestureState);
-    explicit UserGestureIndicator(PassRefPtr<UserGestureToken>);
-    ~UserGestureIndicator();
-
-
-private:
-    static ProcessingUserGestureState s_state;
-    static UserGestureIndicator* s_topmostIndicator;
-    ProcessingUserGestureState m_previousState;
-    RefPtr<UserGestureToken> m_token;
-};
-
-}
-
-#endif
diff --git a/Source/core/dom/UserTypingGestureIndicator.cpp b/Source/core/dom/UserTypingGestureIndicator.cpp
deleted file mode 100644
index e05967e..0000000
--- a/Source/core/dom/UserTypingGestureIndicator.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#include "config.h"
-#include "core/dom/UserTypingGestureIndicator.h"
-
-#include "core/dom/Document.h"
-#include "core/dom/Element.h"
-#include "core/page/Frame.h"
-
-namespace WebCore {
-
-static bool s_processingUserTypingGesture;
-bool UserTypingGestureIndicator::processingUserTypingGesture()
-{
-    return s_processingUserTypingGesture;
-}
-
-static RefPtr<Element>& focusedElement()
-{
-    DEFINE_STATIC_LOCAL(RefPtr<Element>, element, ());
-    return element;
-}
-
-Element* UserTypingGestureIndicator::focusedElementAtGestureStart()
-{
-    return focusedElement().get();
-}
-
-UserTypingGestureIndicator::UserTypingGestureIndicator(Frame* frame)
-    : m_previousProcessingUserTypingGesture(s_processingUserTypingGesture)
-    , m_previousFocusedElement(focusedElement())
-{
-    s_processingUserTypingGesture = true;
-    focusedElement() = frame->document() ? frame->document()->focusedElement() : 0;
-}
-
-UserTypingGestureIndicator::~UserTypingGestureIndicator()
-{
-    s_processingUserTypingGesture = m_previousProcessingUserTypingGesture;
-    focusedElement() = m_previousFocusedElement;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/UserTypingGestureIndicator.h b/Source/core/dom/UserTypingGestureIndicator.h
deleted file mode 100644
index 6625b36..0000000
--- a/Source/core/dom/UserTypingGestureIndicator.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2010 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 UserTypingGestureIndicator_h
-#define UserTypingGestureIndicator_h
-
-#include "wtf/Noncopyable.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class Frame;
-class Element;
-
-class UserTypingGestureIndicator {
-    WTF_MAKE_NONCOPYABLE(UserTypingGestureIndicator);
-public:
-    static bool processingUserTypingGesture();
-    static Element* focusedElementAtGestureStart();
-
-    explicit UserTypingGestureIndicator(Frame*);
-    ~UserTypingGestureIndicator();
-
-private:
-    bool m_previousProcessingUserTypingGesture;
-    RefPtr<Element> m_previousFocusedElement;
-};
-
-} // namespace WebCore
-
-#endif // UserTypingGestureIndicator_h
diff --git a/Source/core/dom/ViewportArguments.cpp b/Source/core/dom/ViewportArguments.cpp
deleted file mode 100644
index 0808c89..0000000
--- a/Source/core/dom/ViewportArguments.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- *           (C) 1999 Antti Koivisto (koivisto@kde.org)
- *           (C) 2001 Dirk Mueller (mueller@kde.org)
- *           (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2012-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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "core/dom/ViewportArguments.h"
-
-#include "core/dom/Document.h"
-#include "core/page/Page.h"
-#include "core/page/Settings.h"
-#include "wtf/text/WTFString.h"
-
-using namespace std;
-
-namespace WebCore {
-
-static const float& compareIgnoringAuto(const float& value1, const float& value2, const float& (*compare) (const float&, const float&))
-{
-    if (value1 == ViewportArguments::ValueAuto)
-        return value2;
-
-    if (value2 == ViewportArguments::ValueAuto)
-        return value1;
-
-    return compare(value1, value2);
-}
-
-static inline float clampLengthValue(float value)
-{
-    // Limits as defined in the css-device-adapt spec.
-    if (value != ViewportArguments::ValueAuto)
-        return min(float(10000), max(value, float(1)));
-    return value;
-}
-
-static inline float clampScaleValue(float value)
-{
-    // Limits as defined in the css-device-adapt spec.
-    if (value != ViewportArguments::ValueAuto)
-        return min(float(10), max(value, float(0.1)));
-    return value;
-}
-
-float ViewportArguments::resolveViewportLength(const Length& length, const FloatSize& initialViewportSize, Direction direction)
-{
-    if (length.isAuto())
-        return ViewportArguments::ValueAuto;
-
-    if (length.isFixed())
-        return length.getFloatValue();
-
-    if (length.type() == ExtendToZoom)
-        return ViewportArguments::ValueExtendToZoom;
-
-    if ((length.type() == Percent && direction == Horizontal) || length.type() == ViewportPercentageWidth)
-        return initialViewportSize.width() * length.getFloatValue() / 100.0f;
-
-    if ((length.type() == Percent && direction == Vertical) || length.type() == ViewportPercentageHeight)
-        return initialViewportSize.height() * length.getFloatValue() / 100.0f;
-
-    if (length.type() == ViewportPercentageMin)
-        return min(initialViewportSize.width(), initialViewportSize.height()) * length.viewportPercentageLength() / 100.0f;
-
-    if (length.type() == ViewportPercentageMax)
-        return max(initialViewportSize.width(), initialViewportSize.height()) * length.viewportPercentageLength() / 100.0f;
-
-    ASSERT_NOT_REACHED();
-    return ViewportArguments::ValueAuto;
-}
-
-PageScaleConstraints ViewportArguments::resolve(const FloatSize& initialViewportSize) const
-{
-    float resultWidth = ValueAuto;
-    float resultMaxWidth = resolveViewportLength(maxWidth, initialViewportSize, Horizontal);
-    float resultMinWidth = resolveViewportLength(minWidth, initialViewportSize, Horizontal);
-    float resultHeight = ValueAuto;
-    float resultMaxHeight = resolveViewportLength(maxHeight, initialViewportSize, Vertical);
-    float resultMinHeight = resolveViewportLength(minHeight, initialViewportSize, Vertical);
-
-    float resultZoom = zoom;
-    float resultMinZoom = minZoom;
-    float resultMaxZoom = maxZoom;
-    float resultUserZoom = userZoom;
-
-    // 1. Resolve min-zoom and max-zoom values.
-    if (resultMinZoom != ViewportArguments::ValueAuto && resultMaxZoom != ViewportArguments::ValueAuto)
-        resultMaxZoom = max(resultMinZoom, resultMaxZoom);
-
-    // 2. Constrain zoom value to the [min-zoom, max-zoom] range.
-    if (resultZoom != ViewportArguments::ValueAuto)
-        resultZoom = compareIgnoringAuto(resultMinZoom, compareIgnoringAuto(resultMaxZoom, resultZoom, min), max);
-
-    float extendZoom = compareIgnoringAuto(resultZoom, resultMaxZoom, min);
-
-    // 3. Resolve non-"auto" lengths to pixel lengths.
-    if (extendZoom == ViewportArguments::ValueAuto) {
-        if (resultMaxWidth == ViewportArguments::ValueExtendToZoom)
-            resultMaxWidth = ViewportArguments::ValueAuto;
-
-        if (resultMaxHeight == ViewportArguments::ValueExtendToZoom)
-            resultMaxHeight = ViewportArguments::ValueAuto;
-
-        if (resultMinWidth == ViewportArguments::ValueExtendToZoom)
-            resultMinWidth = resultMaxWidth;
-
-        if (resultMinHeight == ViewportArguments::ValueExtendToZoom)
-            resultMinHeight = resultMaxHeight;
-    } else {
-        float extendWidth = initialViewportSize.width() / extendZoom;
-        float extendHeight = initialViewportSize.height() / extendZoom;
-
-        if (resultMaxWidth == ViewportArguments::ValueExtendToZoom)
-            resultMaxWidth = extendWidth;
-
-        if (resultMaxHeight == ViewportArguments::ValueExtendToZoom)
-            resultMaxHeight = extendHeight;
-
-        if (resultMinWidth == ViewportArguments::ValueExtendToZoom)
-            resultMinWidth = compareIgnoringAuto(extendWidth, resultMaxWidth, max);
-
-        if (resultMinHeight == ViewportArguments::ValueExtendToZoom)
-            resultMinHeight = compareIgnoringAuto(extendHeight, resultMaxHeight, max);
-    }
-
-    // 4. Resolve initial width from min/max descriptors.
-    if (resultMinWidth != ViewportArguments::ValueAuto || resultMaxWidth != ViewportArguments::ValueAuto)
-        resultWidth = compareIgnoringAuto(resultMinWidth, compareIgnoringAuto(resultMaxWidth, initialViewportSize.width(), min), max);
-
-    // 5. Resolve initial height from min/max descriptors.
-    if (resultMinHeight != ViewportArguments::ValueAuto || resultMaxHeight != ViewportArguments::ValueAuto)
-        resultHeight = compareIgnoringAuto(resultMinHeight, compareIgnoringAuto(resultMaxHeight, initialViewportSize.height(), min), max);
-
-    // 6-7. Resolve width value.
-    if (resultWidth == ViewportArguments::ValueAuto) {
-        if (resultHeight == ViewportArguments::ValueAuto || !initialViewportSize.height())
-            resultWidth = initialViewportSize.width();
-        else
-            resultWidth = resultHeight * (initialViewportSize.width() / initialViewportSize.height());
-    }
-
-    // 8. Resolve height value.
-    if (resultHeight == ViewportArguments::ValueAuto) {
-        if (!initialViewportSize.width())
-            resultHeight = initialViewportSize.height();
-        else
-            resultHeight = resultWidth * initialViewportSize.height() / initialViewportSize.width();
-    }
-
-    // Resolve initial-scale value.
-    if (resultZoom == ViewportArguments::ValueAuto) {
-        if (resultWidth != ViewportArguments::ValueAuto && resultWidth > 0)
-            resultZoom = initialViewportSize.width() / resultWidth;
-        if (resultHeight != ViewportArguments::ValueAuto && resultHeight > 0) {
-            // if 'auto', the initial-scale will be negative here and thus ignored.
-            resultZoom = max<float>(resultZoom, initialViewportSize.height() / resultHeight);
-        }
-    }
-
-    // If user-scalable = no, lock the min/max scale to the computed initial
-    // scale.
-    if (!resultUserZoom)
-        resultMinZoom = resultMaxZoom = resultZoom;
-
-    // Only set initialScale to a value if it was explicitly set.
-    if (zoom == ViewportArguments::ValueAuto)
-        resultZoom = ViewportArguments::ValueAuto;
-
-    PageScaleConstraints result;
-    result.minimumScale = resultMinZoom;
-    result.maximumScale = resultMaxZoom;
-    result.initialScale = resultZoom;
-    result.layoutSize.setWidth(resultWidth);
-    result.layoutSize.setHeight(resultHeight);
-    return result;
-}
-
-static float numericPrefix(const String& keyString, const String& valueString, Document* document, bool* ok = 0)
-{
-    size_t parsedLength;
-    float value;
-    if (valueString.is8Bit())
-        value = charactersToFloat(valueString.characters8(), valueString.length(), parsedLength);
-    else
-        value = charactersToFloat(valueString.characters16(), valueString.length(), parsedLength);
-    if (!parsedLength) {
-        reportViewportWarning(document, UnrecognizedViewportArgumentValueError, valueString, keyString);
-        if (ok)
-            *ok = false;
-        return 0;
-    }
-    if (parsedLength < valueString.length())
-        reportViewportWarning(document, TruncatedViewportArgumentValueError, valueString, keyString);
-    if (ok)
-        *ok = true;
-    return value;
-}
-
-static Length findSizeValue(const String& keyString, const String& valueString, Document* document)
-{
-    // 1) Non-negative number values are translated to px lengths.
-    // 2) Negative number values are translated to auto.
-    // 3) device-width and device-height are used as keywords.
-    // 4) Other keywords and unknown values translate to 0.0.
-
-    if (equalIgnoringCase(valueString, "device-width"))
-        return Length(100, ViewportPercentageWidth);
-    if (equalIgnoringCase(valueString, "device-height"))
-        return Length(100, ViewportPercentageHeight);
-
-    float value = numericPrefix(keyString, valueString, document);
-
-    if (value < 0)
-        return Length(); // auto
-
-    if (!value && document->page() && document->page()->settings().viewportMetaZeroValuesQuirk()) {
-        if (keyString == "width")
-            return Length(100, ViewportPercentageWidth);
-        if (keyString == "height")
-            return Length(100, ViewportPercentageHeight);
-    }
-
-    return Length(clampLengthValue(value), Fixed);
-}
-
-static float findScaleValue(const String& keyString, const String& valueString, Document* document)
-{
-    // 1) Non-negative number values are translated to <number> values.
-    // 2) Negative number values are translated to auto.
-    // 3) yes is translated to 1.0.
-    // 4) device-width and device-height are translated to 10.0.
-    // 5) no and unknown values are translated to 0.0
-
-    if (equalIgnoringCase(valueString, "yes"))
-        return 1;
-    if (equalIgnoringCase(valueString, "no"))
-        return 0;
-    if (equalIgnoringCase(valueString, "device-width"))
-        return 10;
-    if (equalIgnoringCase(valueString, "device-height"))
-        return 10;
-
-    float value = numericPrefix(keyString, valueString, document);
-
-    if (value < 0)
-        return ViewportArguments::ValueAuto;
-
-    if (value > 10.0)
-        reportViewportWarning(document, MaximumScaleTooLargeError, String(), String());
-
-    if (!value && document->page() && document->page()->settings().viewportMetaZeroValuesQuirk() && (keyString == "minimum-scale" || keyString == "maximum-scale"))
-        return ViewportArguments::ValueAuto;
-
-    return clampScaleValue(value);
-}
-
-static float findUserScalableValue(const String& keyString, const String& valueString, Document* document)
-{
-    // yes and no are used as keywords.
-    // Numbers >= 1, numbers <= -1, device-width and device-height are mapped to yes.
-    // Numbers in the range <-1, 1>, and unknown values, are mapped to no.
-
-    if (equalIgnoringCase(valueString, "yes"))
-        return 1;
-    if (equalIgnoringCase(valueString, "no"))
-        return 0;
-    if (equalIgnoringCase(valueString, "device-width"))
-        return 1;
-    if (equalIgnoringCase(valueString, "device-height"))
-        return 1;
-
-    float value = numericPrefix(keyString, valueString, document);
-
-    if (fabs(value) < 1)
-        return 0;
-
-    return 1;
-}
-
-static float findTargetDensityDPIValue(const String& keyString, const String& valueString, Document* document)
-{
-    if (equalIgnoringCase(valueString, "device-dpi"))
-        return ViewportArguments::ValueDeviceDPI;
-    if (equalIgnoringCase(valueString, "low-dpi"))
-        return ViewportArguments::ValueLowDPI;
-    if (equalIgnoringCase(valueString, "medium-dpi"))
-        return ViewportArguments::ValueMediumDPI;
-    if (equalIgnoringCase(valueString, "high-dpi"))
-        return ViewportArguments::ValueHighDPI;
-
-    bool ok;
-    float value = numericPrefix(keyString, valueString, document, &ok);
-    if (!ok || value < 70 || value > 400)
-        return ViewportArguments::ValueAuto;
-
-    return value;
-}
-
-void setViewportFeature(const String& keyString, const String& valueString, Document* document, void* data)
-{
-    ViewportArguments* arguments = static_cast<ViewportArguments*>(data);
-
-    if (keyString == "width") {
-        const Length& width = findSizeValue(keyString, valueString, document);
-        if (!width.isAuto()) {
-            arguments->minWidth = Length(ExtendToZoom);
-            arguments->maxWidth = width;
-        }
-    } else if (keyString == "height") {
-        const Length& height = findSizeValue(keyString, valueString, document);
-        if (!height.isAuto()) {
-            arguments->minHeight = Length(ExtendToZoom);
-            arguments->maxHeight = height;
-        }
-    } else if (keyString == "initial-scale") {
-        arguments->zoom = findScaleValue(keyString, valueString, document);
-    } else if (keyString == "minimum-scale") {
-        arguments->minZoom = findScaleValue(keyString, valueString, document);
-    } else if (keyString == "maximum-scale") {
-        arguments->maxZoom = findScaleValue(keyString, valueString, document);
-    } else if (keyString == "user-scalable") {
-        arguments->userZoom = findUserScalableValue(keyString, valueString, document);
-    } else if (keyString == "target-densitydpi") {
-        arguments->deprecatedTargetDensityDPI = findTargetDensityDPIValue(keyString, valueString, document);
-        reportViewportWarning(document, TargetDensityDpiUnsupported, String(), String());
-    } else {
-        reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, keyString, String());
-    }
-}
-
-static const char* viewportErrorMessageTemplate(ViewportErrorCode errorCode)
-{
-    static const char* const errors[] = {
-        "The key \"%replacement1\" is not recognized and ignored.",
-        "The value \"%replacement1\" for key \"%replacement2\" is invalid, and has been ignored.",
-        "The value \"%replacement1\" for key \"%replacement2\" was truncated to its numeric prefix.",
-        "The value for key \"maximum-scale\" is out of bounds and the value has been clamped.",
-        "The key \"target-densitydpi\" is not supported.",
-    };
-
-    return errors[errorCode];
-}
-
-static MessageLevel viewportErrorMessageLevel(ViewportErrorCode errorCode)
-{
-    switch (errorCode) {
-    case TruncatedViewportArgumentValueError:
-    case TargetDensityDpiUnsupported:
-        return WarningMessageLevel;
-    case UnrecognizedViewportArgumentKeyError:
-    case UnrecognizedViewportArgumentValueError:
-    case MaximumScaleTooLargeError:
-        return ErrorMessageLevel;
-    }
-
-    ASSERT_NOT_REACHED();
-    return ErrorMessageLevel;
-}
-
-void reportViewportWarning(Document* document, ViewportErrorCode errorCode, const String& replacement1, const String& replacement2)
-{
-    Frame* frame = document->frame();
-    if (!frame)
-        return;
-
-    String message = viewportErrorMessageTemplate(errorCode);
-    if (!replacement1.isNull())
-        message.replace("%replacement1", replacement1);
-    if (!replacement2.isNull())
-        message.replace("%replacement2", replacement2);
-
-    // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
-    document->addConsoleMessage(RenderingMessageSource, viewportErrorMessageLevel(errorCode), message);
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/ViewportArguments.h b/Source/core/dom/ViewportArguments.h
deleted file mode 100644
index e0722b8..0000000
--- a/Source/core/dom/ViewportArguments.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- *           (C) 1999 Antti Koivisto (koivisto@kde.org)
- *           (C) 2001 Dirk Mueller (mueller@kde.org)
- *           (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2012-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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ViewportArguments_h
-#define ViewportArguments_h
-
-#include "core/page/PageScaleConstraints.h"
-#include "core/platform/Length.h"
-#include "core/platform/graphics/FloatSize.h"
-#include "wtf/Forward.h"
-
-namespace WebCore {
-
-class Document;
-
-enum ViewportErrorCode {
-    UnrecognizedViewportArgumentKeyError,
-    UnrecognizedViewportArgumentValueError,
-    TruncatedViewportArgumentValueError,
-    MaximumScaleTooLargeError,
-    TargetDensityDpiUnsupported
-};
-
-struct ViewportArguments {
-
-    enum Type {
-        // These are ordered in increasing importance.
-        UserAgentStyleSheet,
-        HandheldFriendlyMeta,
-        MobileOptimizedMeta,
-        ViewportMeta,
-        AuthorStyleSheet
-    } type;
-
-    enum {
-        ValueAuto = -1,
-        ValueDeviceWidth = -2,
-        ValueDeviceHeight = -3,
-        ValuePortrait = -4,
-        ValueLandscape = -5,
-        ValueDeviceDPI = -6,
-        ValueLowDPI = -7,
-        ValueMediumDPI = -8,
-        ValueHighDPI = -9,
-        ValueExtendToZoom = -10
-    };
-
-    ViewportArguments(Type type = UserAgentStyleSheet)
-        : type(type)
-        , zoom(ValueAuto)
-        , minZoom(ValueAuto)
-        , maxZoom(ValueAuto)
-        , userZoom(ValueAuto)
-        , orientation(ValueAuto)
-        , deprecatedTargetDensityDPI(ValueAuto)
-    {
-    }
-
-    // All arguments are in CSS units.
-    PageScaleConstraints resolve(const FloatSize& initialViewportSize) const;
-
-    Length minWidth;
-    Length maxWidth;
-    Length minHeight;
-    Length maxHeight;
-    float zoom;
-    float minZoom;
-    float maxZoom;
-    float userZoom;
-    float orientation;
-    float deprecatedTargetDensityDPI; // Only used for Android WebView
-
-    bool operator==(const ViewportArguments& other) const
-    {
-        // Used for figuring out whether to reset the viewport or not,
-        // thus we are not taking type into account.
-        return minWidth == other.minWidth
-            && maxWidth == other.maxWidth
-            && minHeight == other.minHeight
-            && maxHeight == other.maxHeight
-            && zoom == other.zoom
-            && minZoom == other.minZoom
-            && maxZoom == other.maxZoom
-            && userZoom == other.userZoom
-            && orientation == other.orientation
-            && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI;
-    }
-
-    bool operator!=(const ViewportArguments& other) const
-    {
-        return !(*this == other);
-    }
-
-    bool isLegacyViewportType() const { return type >= HandheldFriendlyMeta && type <= ViewportMeta; }
-
-private:
-    enum Direction { Horizontal, Vertical };
-    static float resolveViewportLength(const Length&, const FloatSize& initialViewportSize, Direction);
-};
-
-void setViewportFeature(const String& keyString, const String& valueString, Document*, void* data);
-void reportViewportWarning(Document*, ViewportErrorCode, const String& replacement1, const String& replacement2);
-
-} // namespace WebCore
-
-#endif // ViewportArguments_h
diff --git a/Source/core/dom/ViewportDescription.cpp b/Source/core/dom/ViewportDescription.cpp
new file mode 100644
index 0000000..80a7e78
--- /dev/null
+++ b/Source/core/dom/ViewportDescription.cpp
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ *           (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2012-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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "core/dom/ViewportDescription.h"
+
+#include "core/dom/Document.h"
+#include "core/page/Page.h"
+#include "core/page/Settings.h"
+#include "wtf/text/WTFString.h"
+
+using namespace std;
+
+namespace WebCore {
+
+static const float& compareIgnoringAuto(const float& value1, const float& value2, const float& (*compare) (const float&, const float&))
+{
+    if (value1 == ViewportDescription::ValueAuto)
+        return value2;
+
+    if (value2 == ViewportDescription::ValueAuto)
+        return value1;
+
+    return compare(value1, value2);
+}
+
+float ViewportDescription::resolveViewportLength(const Length& length, const FloatSize& initialViewportSize, Direction direction)
+{
+    if (length.isAuto())
+        return ViewportDescription::ValueAuto;
+
+    if (length.isFixed())
+        return length.getFloatValue();
+
+    if (length.type() == ExtendToZoom)
+        return ViewportDescription::ValueExtendToZoom;
+
+    if ((length.type() == Percent && direction == Horizontal) || length.type() == ViewportPercentageWidth)
+        return initialViewportSize.width() * length.getFloatValue() / 100.0f;
+
+    if ((length.type() == Percent && direction == Vertical) || length.type() == ViewportPercentageHeight)
+        return initialViewportSize.height() * length.getFloatValue() / 100.0f;
+
+    if (length.type() == ViewportPercentageMin)
+        return min(initialViewportSize.width(), initialViewportSize.height()) * length.viewportPercentageLength() / 100.0f;
+
+    if (length.type() == ViewportPercentageMax)
+        return max(initialViewportSize.width(), initialViewportSize.height()) * length.viewportPercentageLength() / 100.0f;
+
+    ASSERT_NOT_REACHED();
+    return ViewportDescription::ValueAuto;
+}
+
+PageScaleConstraints ViewportDescription::resolve(const FloatSize& initialViewportSize) const
+{
+    float resultWidth = ValueAuto;
+    float resultMaxWidth = resolveViewportLength(maxWidth, initialViewportSize, Horizontal);
+    float resultMinWidth = resolveViewportLength(minWidth, initialViewportSize, Horizontal);
+    float resultHeight = ValueAuto;
+    float resultMaxHeight = resolveViewportLength(maxHeight, initialViewportSize, Vertical);
+    float resultMinHeight = resolveViewportLength(minHeight, initialViewportSize, Vertical);
+
+    float resultZoom = zoom;
+    float resultMinZoom = minZoom;
+    float resultMaxZoom = maxZoom;
+    float resultUserZoom = userZoom;
+
+    // 1. Resolve min-zoom and max-zoom values.
+    if (resultMinZoom != ViewportDescription::ValueAuto && resultMaxZoom != ViewportDescription::ValueAuto)
+        resultMaxZoom = max(resultMinZoom, resultMaxZoom);
+
+    // 2. Constrain zoom value to the [min-zoom, max-zoom] range.
+    if (resultZoom != ViewportDescription::ValueAuto)
+        resultZoom = compareIgnoringAuto(resultMinZoom, compareIgnoringAuto(resultMaxZoom, resultZoom, min), max);
+
+    float extendZoom = compareIgnoringAuto(resultZoom, resultMaxZoom, min);
+
+    // 3. Resolve non-"auto" lengths to pixel lengths.
+    if (extendZoom == ViewportDescription::ValueAuto) {
+        if (resultMaxWidth == ViewportDescription::ValueExtendToZoom)
+            resultMaxWidth = ViewportDescription::ValueAuto;
+
+        if (resultMaxHeight == ViewportDescription::ValueExtendToZoom)
+            resultMaxHeight = ViewportDescription::ValueAuto;
+
+        if (resultMinWidth == ViewportDescription::ValueExtendToZoom)
+            resultMinWidth = resultMaxWidth;
+
+        if (resultMinHeight == ViewportDescription::ValueExtendToZoom)
+            resultMinHeight = resultMaxHeight;
+    } else {
+        float extendWidth = initialViewportSize.width() / extendZoom;
+        float extendHeight = initialViewportSize.height() / extendZoom;
+
+        if (resultMaxWidth == ViewportDescription::ValueExtendToZoom)
+            resultMaxWidth = extendWidth;
+
+        if (resultMaxHeight == ViewportDescription::ValueExtendToZoom)
+            resultMaxHeight = extendHeight;
+
+        if (resultMinWidth == ViewportDescription::ValueExtendToZoom)
+            resultMinWidth = compareIgnoringAuto(extendWidth, resultMaxWidth, max);
+
+        if (resultMinHeight == ViewportDescription::ValueExtendToZoom)
+            resultMinHeight = compareIgnoringAuto(extendHeight, resultMaxHeight, max);
+    }
+
+    // 4. Resolve initial width from min/max descriptors.
+    if (resultMinWidth != ViewportDescription::ValueAuto || resultMaxWidth != ViewportDescription::ValueAuto)
+        resultWidth = compareIgnoringAuto(resultMinWidth, compareIgnoringAuto(resultMaxWidth, initialViewportSize.width(), min), max);
+
+    // 5. Resolve initial height from min/max descriptors.
+    if (resultMinHeight != ViewportDescription::ValueAuto || resultMaxHeight != ViewportDescription::ValueAuto)
+        resultHeight = compareIgnoringAuto(resultMinHeight, compareIgnoringAuto(resultMaxHeight, initialViewportSize.height(), min), max);
+
+    // 6-7. Resolve width value.
+    if (resultWidth == ViewportDescription::ValueAuto) {
+        if (resultHeight == ViewportDescription::ValueAuto || !initialViewportSize.height())
+            resultWidth = initialViewportSize.width();
+        else
+            resultWidth = resultHeight * (initialViewportSize.width() / initialViewportSize.height());
+    }
+
+    // 8. Resolve height value.
+    if (resultHeight == ViewportDescription::ValueAuto) {
+        if (!initialViewportSize.width())
+            resultHeight = initialViewportSize.height();
+        else
+            resultHeight = resultWidth * initialViewportSize.height() / initialViewportSize.width();
+    }
+
+    // Resolve initial-scale value.
+    if (resultZoom == ViewportDescription::ValueAuto) {
+        if (resultWidth != ViewportDescription::ValueAuto && resultWidth > 0)
+            resultZoom = initialViewportSize.width() / resultWidth;
+        if (resultHeight != ViewportDescription::ValueAuto && resultHeight > 0) {
+            // if 'auto', the initial-scale will be negative here and thus ignored.
+            resultZoom = max<float>(resultZoom, initialViewportSize.height() / resultHeight);
+        }
+    }
+
+    // If user-scalable = no, lock the min/max scale to the computed initial
+    // scale.
+    if (!resultUserZoom)
+        resultMinZoom = resultMaxZoom = resultZoom;
+
+    // Only set initialScale to a value if it was explicitly set.
+    if (zoom == ViewportDescription::ValueAuto)
+        resultZoom = ViewportDescription::ValueAuto;
+
+    PageScaleConstraints result;
+    result.minimumScale = resultMinZoom;
+    result.maximumScale = resultMaxZoom;
+    result.initialScale = resultZoom;
+    result.layoutSize.setWidth(resultWidth);
+    result.layoutSize.setHeight(resultHeight);
+    return result;
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/ViewportDescription.h b/Source/core/dom/ViewportDescription.h
new file mode 100644
index 0000000..a78cd4f
--- /dev/null
+++ b/Source/core/dom/ViewportDescription.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ *           (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2012-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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ViewportDescription_h
+#define ViewportDescription_h
+
+#include "core/page/PageScaleConstraints.h"
+#include "core/platform/Length.h"
+#include "platform/geometry/FloatSize.h"
+#include "wtf/Forward.h"
+
+namespace WebCore {
+
+class Document;
+
+struct ViewportDescription {
+
+    enum Type {
+        // These are ordered in increasing importance.
+        UserAgentStyleSheet,
+        HandheldFriendlyMeta,
+        MobileOptimizedMeta,
+        ViewportMeta,
+        AuthorStyleSheet
+    } type;
+
+    enum {
+        ValueAuto = -1,
+        ValueDeviceWidth = -2,
+        ValueDeviceHeight = -3,
+        ValuePortrait = -4,
+        ValueLandscape = -5,
+        ValueDeviceDPI = -6,
+        ValueLowDPI = -7,
+        ValueMediumDPI = -8,
+        ValueHighDPI = -9,
+        ValueExtendToZoom = -10
+    };
+
+    ViewportDescription(Type type = UserAgentStyleSheet)
+        : type(type)
+        , zoom(ValueAuto)
+        , minZoom(ValueAuto)
+        , maxZoom(ValueAuto)
+        , userZoom(ValueAuto)
+        , orientation(ValueAuto)
+        , deprecatedTargetDensityDPI(ValueAuto)
+    {
+    }
+
+    // All arguments are in CSS units.
+    PageScaleConstraints resolve(const FloatSize& initialViewportSize) const;
+
+    Length minWidth;
+    Length maxWidth;
+    Length minHeight;
+    Length maxHeight;
+    float zoom;
+    float minZoom;
+    float maxZoom;
+    float userZoom;
+    float orientation;
+    float deprecatedTargetDensityDPI; // Only used for Android WebView
+
+    bool operator==(const ViewportDescription& other) const
+    {
+        // Used for figuring out whether to reset the viewport or not,
+        // thus we are not taking type into account.
+        return minWidth == other.minWidth
+            && maxWidth == other.maxWidth
+            && minHeight == other.minHeight
+            && maxHeight == other.maxHeight
+            && zoom == other.zoom
+            && minZoom == other.minZoom
+            && maxZoom == other.maxZoom
+            && userZoom == other.userZoom
+            && orientation == other.orientation
+            && deprecatedTargetDensityDPI == other.deprecatedTargetDensityDPI;
+    }
+
+    bool operator!=(const ViewportDescription& other) const
+    {
+        return !(*this == other);
+    }
+
+    bool isLegacyViewportType() const { return type >= HandheldFriendlyMeta && type <= ViewportMeta; }
+
+private:
+    enum Direction { Horizontal, Vertical };
+    static float resolveViewportLength(const Length&, const FloatSize& initialViewportSize, Direction);
+};
+
+} // namespace WebCore
+
+#endif // ViewportDescription_h
diff --git a/Source/core/dom/VisitedLinkState.cpp b/Source/core/dom/VisitedLinkState.cpp
index cf1d417..521d0ab 100644
--- a/Source/core/dom/VisitedLinkState.cpp
+++ b/Source/core/dom/VisitedLinkState.cpp
@@ -30,45 +30,31 @@
 #include "core/dom/VisitedLinkState.h"
 
 #include "HTMLNames.h"
+#include "XLinkNames.h"
 #include "core/dom/ElementTraversal.h"
 #include "core/html/HTMLAnchorElement.h"
-#include "core/page/Page.h"
 #include "public/platform/Platform.h"
 
 namespace WebCore {
 
-using namespace HTMLNames;
-
-inline static const AtomicString& linkAttribute(Element* element)
+static inline const AtomicString& linkAttribute(const Element& element)
 {
-    ASSERT(element->isLink());
-    if (element->isHTMLElement())
-        return element->fastGetAttribute(HTMLNames::hrefAttr);
-    ASSERT(element->isSVGElement());
-    return element->getAttribute(XLinkNames::hrefAttr);
+    ASSERT(element.isLink());
+    if (element.isHTMLElement())
+        return element.fastGetAttribute(HTMLNames::hrefAttr);
+    ASSERT(element.isSVGElement());
+    return element.getAttribute(XLinkNames::hrefAttr);
 }
 
-inline static LinkHash linkHashForElement(Document* document, Element* element)
+static inline LinkHash linkHashForElement(const Element& element, const AtomicString& attribute = AtomicString())
 {
+    ASSERT(attribute.isNull() || linkAttribute(element) == attribute);
     if (isHTMLAnchorElement(element))
-        return toHTMLAnchorElement(element)->visitedLinkHash();
-    return visitedLinkHash(document->baseURL(), linkAttribute(element));
+        return toHTMLAnchorElement(element).visitedLinkHash();
+    return visitedLinkHash(element.document().baseURL(), attribute.isNull() ? linkAttribute(element) : attribute);
 }
 
-inline static LinkHash linkHashForElementWithAttribute(Document* document, Element* element, const AtomicString& attribute)
-{
-    ASSERT(linkAttribute(element) == attribute);
-    if (isHTMLAnchorElement(element))
-        return toHTMLAnchorElement(element)->visitedLinkHash();
-    return visitedLinkHash(document->baseURL(), attribute);
-}
-
-PassOwnPtr<VisitedLinkState> VisitedLinkState::create(Document* document)
-{
-    return adoptPtr(new VisitedLinkState(document));
-}
-
-VisitedLinkState::VisitedLinkState(Document* document)
+VisitedLinkState::VisitedLinkState(const Document& document)
     : m_document(document)
 {
 }
@@ -77,7 +63,7 @@
 {
     if (m_linksCheckedForVisitedState.isEmpty())
         return;
-    for (Element* element = ElementTraversal::firstWithin(m_document); element; element = ElementTraversal::next(element)) {
+    for (Element* element = ElementTraversal::firstWithin(&m_document); element; element = ElementTraversal::next(element)) {
         if (element->isLink())
             element->setNeedsStyleRecalc();
     }
@@ -87,15 +73,17 @@
 {
     if (!m_linksCheckedForVisitedState.contains(linkHash))
         return;
-    for (Element* element = ElementTraversal::firstWithin(m_document); element; element = ElementTraversal::next(element)) {
-        if (element->isLink() && linkHashForElement(m_document, element) == linkHash)
+    for (Element* element = ElementTraversal::firstWithin(&m_document); element; element = ElementTraversal::next(element)) {
+        if (element->isLink() && linkHashForElement(*element) == linkHash)
             element->setNeedsStyleRecalc();
     }
 }
 
-EInsideLink VisitedLinkState::determineLinkStateSlowCase(Element* element)
+EInsideLink VisitedLinkState::determineLinkStateSlowCase(const Element& element)
 {
-    ASSERT(element->isLink());
+    ASSERT(element.isLink());
+    ASSERT(m_document.isActive());
+    ASSERT(m_document == element.document());
 
     const AtomicString& attribute = linkAttribute(element);
 
@@ -109,18 +97,13 @@
     if (attribute.isEmpty())
         return InsideVisitedLink;
 
-    // We null check the Frame here to avoid canonicalizing and hashing
-    // URLs in documents that aren't attached to Frames (like documents
-    // from XMLHttpRequest).
-    if (!m_document->frame())
-        return InsideUnvisitedLink;
+    if (LinkHash hash = linkHashForElement(element, attribute)) {
+        m_linksCheckedForVisitedState.add(hash);
+        if (WebKit::Platform::current()->isLinkVisited(hash))
+            return InsideVisitedLink;
+    }
 
-    LinkHash hash = linkHashForElementWithAttribute(m_document, element, attribute);
-    if (!hash)
-        return InsideUnvisitedLink;
-
-    m_linksCheckedForVisitedState.add(hash);
-    return WebKit::Platform::current()->isLinkVisited(hash) ? InsideVisitedLink : InsideUnvisitedLink;
+    return InsideUnvisitedLink;
 }
 
 }
diff --git a/Source/core/dom/VisitedLinkState.h b/Source/core/dom/VisitedLinkState.h
index 552e222..1f8ab64 100644
--- a/Source/core/dom/VisitedLinkState.h
+++ b/Source/core/dom/VisitedLinkState.h
@@ -29,10 +29,9 @@
 #ifndef VisitedLinkState_h
 #define VisitedLinkState_h
 
-#include "XLinkNames.h"
 #include "core/dom/Element.h"
-#include "core/platform/LinkHash.h"
 #include "core/rendering/style/RenderStyleConstants.h"
+#include "platform/LinkHash.h"
 #include "wtf/HashSet.h"
 
 namespace WebCore {
@@ -42,28 +41,30 @@
 class VisitedLinkState {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<VisitedLinkState> create(Document*);
+    static PassOwnPtr<VisitedLinkState> create(const Document& document)
+    {
+        return adoptPtr(new VisitedLinkState(document));
+    }
 
     void invalidateStyleForAllLinks();
     void invalidateStyleForLink(LinkHash);
-    EInsideLink determineLinkState(Element*);
+
+    EInsideLink determineLinkState(const Element& element)
+    {
+        if (element.isLink())
+            return determineLinkStateSlowCase(element);
+        return NotInsideLink;
+    }
 
 private:
-    explicit VisitedLinkState(Document*);
+    explicit VisitedLinkState(const Document&);
 
-    EInsideLink determineLinkStateSlowCase(Element*);
+    EInsideLink determineLinkStateSlowCase(const Element&);
 
-    Document* m_document;
+    const Document& m_document;
     HashSet<LinkHash, LinkHashHash> m_linksCheckedForVisitedState;
 };
 
-inline EInsideLink VisitedLinkState::determineLinkState(Element* element)
-{
-    if (!element || !element->isLink())
-        return NotInsideLink;
-    return determineLinkStateSlowCase(element);
-}
-
 }
 
 #endif
diff --git a/Source/core/dom/WebKitNamedFlow.idl b/Source/core/dom/WebKitNamedFlow.idl
index 33cff65..f1185b4 100644
--- a/Source/core/dom/WebKitNamedFlow.idl
+++ b/Source/core/dom/WebKitNamedFlow.idl
@@ -29,7 +29,7 @@
 
 [
     NoInterfaceObject,
-    EnabledAtRuntime=CSSRegions,
+    RuntimeEnabled=CSSRegions,
     ImplementedAs=NamedFlow,
     GenerateIsReachable=ownerNode
 ] interface WebKitNamedFlow : EventTarget {
diff --git a/Source/core/dom/WebKitNamedFlowCollection.idl b/Source/core/dom/WebKitNamedFlowCollection.idl
index 92aec8e..4744e06 100644
--- a/Source/core/dom/WebKitNamedFlowCollection.idl
+++ b/Source/core/dom/WebKitNamedFlowCollection.idl
@@ -29,7 +29,7 @@
 
 [
     NoInterfaceObject,
-    EnabledAtRuntime=CSSRegions,
+    RuntimeEnabled=CSSRegions,
     ImplementedAs=DOMNamedFlowCollection
 ] interface WebKitNamedFlowCollection {
     readonly attribute unsigned long length;
diff --git a/Source/core/dom/WheelController.cpp b/Source/core/dom/WheelController.cpp
index b55b9c9..68d5b18 100644
--- a/Source/core/dom/WheelController.cpp
+++ b/Source/core/dom/WheelController.cpp
@@ -27,9 +27,9 @@
 #include "core/dom/WheelController.h"
 
 #include "core/dom/Document.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/events/WheelEvent.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
 
@@ -52,10 +52,10 @@
 
 WheelController* WheelController::from(Document* document)
 {
-    WheelController* controller = static_cast<WheelController*>(Supplement<ScriptExecutionContext>::from(document, supplementName()));
+    WheelController* controller = static_cast<WheelController*>(DocumentSupplement::from(document, supplementName()));
     if (!controller) {
         controller = new WheelController(document);
-        Supplement<ScriptExecutionContext>::provideTo(document, supplementName(), adoptPtr(controller));
+        DocumentSupplement::provideTo(document, supplementName(), adoptPtr(controller));
     }
     return controller;
 }
@@ -102,7 +102,7 @@
 
 void WheelController::didAddEventListener(DOMWindow* window, const AtomicString& eventType)
 {
-    if (eventType != eventNames().wheelEvent && eventType != eventNames().mousewheelEvent)
+    if (eventType != EventTypeNames::wheel && eventType != EventTypeNames::mousewheel)
         return;
 
     Document* document = window->document();
@@ -111,7 +111,7 @@
 
 void WheelController::didRemoveEventListener(DOMWindow* window, const AtomicString& eventType)
 {
-    if (eventType != eventNames().wheelEvent && eventType != eventNames().mousewheelEvent)
+    if (eventType != EventTypeNames::wheel && eventType != EventTypeNames::mousewheel)
         return;
 
     Document* document = window->document();
diff --git a/Source/core/dom/WheelController.h b/Source/core/dom/WheelController.h
index 71ad326..550cb09 100644
--- a/Source/core/dom/WheelController.h
+++ b/Source/core/dom/WheelController.h
@@ -26,15 +26,16 @@
 #ifndef WheelController_h
 #define WheelController_h
 
+#include "core/dom/DocumentSupplementable.h"
 #include "core/events/Event.h"
-#include "core/page/DOMWindowLifecycleObserver.h"
-#include "core/platform/Supplementable.h"
+#include "core/frame/DOMWindowLifecycleObserver.h"
+
 
 namespace WebCore {
 
 class DOMWindow;
 
-class WheelController : public Supplement<ScriptExecutionContext>, public DOMWindowLifecycleObserver {
+class WheelController : public DocumentSupplement, public DOMWindowLifecycleObserver {
 
 public:
     virtual ~WheelController();
diff --git a/Source/core/dom/WhitespaceChildList.h b/Source/core/dom/WhitespaceChildList.h
new file mode 100644
index 0000000..b5a4fb1
--- /dev/null
+++ b/Source/core/dom/WhitespaceChildList.h
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ *     * 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 WhitespaceChildList_h
+#define WhitespaceChildList_h
+
+#include "core/dom/Text.h"
+#include "core/rendering/style/RenderStyleConstants.h"
+
+namespace WebCore {
+
+class Text;
+
+// Tracks a limited number of whitespace text children during style recalc
+// to postpone their style recalc as part of optimization to avoid creating
+// unnecessary whitespace text renderers. If we hit the limit, it recalcs
+// the whitespace text's style and clears the list.
+class WhitespaceChildList {
+public:
+    WhitespaceChildList(StyleRecalcChange change)
+        : m_change(change)
+    { }
+
+    void append(Text* textChild)
+    {
+        ASSERT(textChild->containsOnlyWhitespace());
+        if (m_list.size() == maxWhitespaceChildrenToDefer) {
+            recalcStyle();
+            m_list.clear();
+        }
+        m_list.append(textChild);
+    }
+
+    void recalcStyle() const
+    {
+        for (unsigned i = 0; i < m_list.size(); ++i)
+            m_list[i]->recalcTextStyle(m_change);
+    }
+private:
+    StyleRecalcChange m_change;
+
+    static const unsigned maxWhitespaceChildrenToDefer = 10;
+    Vector<Text*, maxWhitespaceChildrenToDefer> m_list;
+};
+
+} // namespace WebCore
+
+#endif // WhitespaceChildList_h
diff --git a/Source/core/dom/custom/CustomElement.cpp b/Source/core/dom/custom/CustomElement.cpp
new file mode 100644
index 0000000..f33e612
--- /dev/null
+++ b/Source/core/dom/custom/CustomElement.cpp
@@ -0,0 +1,180 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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/dom/custom/CustomElement.h"
+
+#include "HTMLNames.h"
+#include "MathMLNames.h"
+#include "RuntimeEnabledFeatures.h"
+#include "SVGNames.h"
+#include "core/dom/Element.h"
+#include "core/dom/custom/CustomElementCallbackScheduler.h"
+#include "core/dom/custom/CustomElementObserver.h"
+
+namespace WebCore {
+
+Vector<AtomicString>& CustomElement::embedderCustomElementNames()
+{
+    DEFINE_STATIC_LOCAL(Vector<AtomicString>, names, ());
+    return names;
+}
+
+void CustomElement::addEmbedderCustomElementName(const AtomicString& name)
+{
+    AtomicString lower = name.lower();
+    if (isValidName(lower, EmbedderNames))
+        return;
+    embedderCustomElementNames().append(lower);
+}
+
+static CustomElement::NameSet enabledNameSet()
+{
+    return CustomElement::NameSet((RuntimeEnabledFeatures::customElementsEnabled() ? CustomElement::StandardNames : 0) | (RuntimeEnabledFeatures::embedderCustomElementsEnabled() ? CustomElement::EmbedderNames : 0));
+}
+
+bool CustomElement::isValidName(const AtomicString& name, NameSet validNames)
+{
+    validNames = NameSet(validNames & enabledNameSet());
+
+    if ((validNames & EmbedderNames) && kNotFound != embedderCustomElementNames().find(name))
+        return Document::isValidName(name);
+
+    if ((validNames & StandardNames) && kNotFound != name.find('-')) {
+        DEFINE_STATIC_LOCAL(Vector<AtomicString>, reservedNames, ());
+        if (reservedNames.isEmpty()) {
+            reservedNames.append(MathMLNames::annotation_xmlTag.localName());
+            reservedNames.append(SVGNames::color_profileTag.localName());
+            reservedNames.append(SVGNames::font_faceTag.localName());
+            reservedNames.append(SVGNames::font_face_srcTag.localName());
+            reservedNames.append(SVGNames::font_face_uriTag.localName());
+            reservedNames.append(SVGNames::font_face_formatTag.localName());
+            reservedNames.append(SVGNames::font_face_nameTag.localName());
+            reservedNames.append(SVGNames::missing_glyphTag.localName());
+        }
+
+        if (kNotFound == reservedNames.find(name))
+            return Document::isValidName(name.string());
+    }
+
+    return false;
+}
+
+void CustomElement::define(Element* element, PassRefPtr<CustomElementDefinition> passDefinition)
+{
+    RefPtr<CustomElementDefinition> definition(passDefinition);
+
+    switch (element->customElementState()) {
+    case Element::NotCustomElement:
+    case Element::Upgraded:
+        ASSERT_NOT_REACHED();
+        break;
+
+    case Element::WaitingForParser:
+        definitions().add(element, definition);
+        break;
+
+    case Element::WaitingForUpgrade:
+        definitions().add(element, definition);
+        CustomElementCallbackScheduler::scheduleCreatedCallback(definition->callbacks(), element);
+        break;
+    }
+}
+
+CustomElementDefinition* CustomElement::definitionFor(Element* element)
+{
+    CustomElementDefinition* definition = definitions().get(element);
+    ASSERT(definition);
+    return definition;
+}
+
+void CustomElement::didFinishParsingChildren(Element* element)
+{
+    ASSERT(element->customElementState() == Element::WaitingForParser);
+    element->setCustomElementState(Element::WaitingForUpgrade);
+
+    CustomElementObserver::notifyElementDidFinishParsingChildren(element);
+
+    if (CustomElementDefinition* definition = definitions().get(element))
+        CustomElementCallbackScheduler::scheduleCreatedCallback(definition->callbacks(), element);
+}
+
+void CustomElement::attributeDidChange(Element* element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
+{
+    ASSERT(element->customElementState() == Element::Upgraded);
+    CustomElementCallbackScheduler::scheduleAttributeChangedCallback(definitionFor(element)->callbacks(), element, name, oldValue, newValue);
+}
+
+void CustomElement::didEnterDocument(Element* element, const Document& document)
+{
+    ASSERT(element->customElementState() == Element::Upgraded);
+    if (!document.defaultView())
+        return;
+    CustomElementCallbackScheduler::scheduleEnteredViewCallback(definitionFor(element)->callbacks(), element);
+}
+
+void CustomElement::didLeaveDocument(Element* element, const Document& document)
+{
+    ASSERT(element->customElementState() == Element::Upgraded);
+    if (!document.defaultView())
+        return;
+    CustomElementCallbackScheduler::scheduleLeftViewCallback(definitionFor(element)->callbacks(), element);
+}
+
+void CustomElement::wasDestroyed(Element* element)
+{
+    switch (element->customElementState()) {
+    case Element::NotCustomElement:
+        ASSERT_NOT_REACHED();
+        break;
+
+    case Element::WaitingForParser:
+    case Element::WaitingForUpgrade:
+    case Element::Upgraded:
+        definitions().remove(element);
+        CustomElementObserver::notifyElementWasDestroyed(element);
+        break;
+    }
+}
+
+void CustomElement::DefinitionMap::add(Element* element, PassRefPtr<CustomElementDefinition> definition)
+{
+    ASSERT(definition.get());
+    DefinitionMap::ElementDefinitionHashMap::AddResult result = m_definitions.add(element, definition);
+    ASSERT(result.isNewEntry);
+}
+
+CustomElement::DefinitionMap& CustomElement::definitions()
+{
+    DEFINE_STATIC_LOCAL(DefinitionMap, map, ());
+    return map;
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/custom/CustomElement.h b/Source/core/dom/custom/CustomElement.h
new file mode 100644
index 0000000..c50bc08
--- /dev/null
+++ b/Source/core/dom/custom/CustomElement.h
@@ -0,0 +1,97 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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 CustomElement_h
+#define CustomElement_h
+
+#include "core/dom/custom/CustomElementDefinition.h"
+#include "wtf/HashMap.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/AtomicString.h"
+
+namespace WebCore {
+
+class Document;
+class Element;
+
+class CustomElement {
+public:
+    enum NameSet {
+        EmbedderNames = 1 << 0,
+        StandardNames = 1 << 1,
+        AllNames = EmbedderNames | StandardNames
+    };
+    static bool isValidName(const AtomicString& name, NameSet validNames = AllNames);
+    static void addEmbedderCustomElementName(const AtomicString& name);
+
+    // API for registration contexts
+    static void define(Element*, PassRefPtr<CustomElementDefinition>);
+
+    // API for wrapper creation, which uses a definition as a key
+    static CustomElementDefinition* definitionFor(Element*);
+
+    // API for Element to kick off changes
+
+    static void didFinishParsingChildren(Element*);
+    static void attributeDidChange(Element*, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
+    static void didEnterDocument(Element*, const Document&);
+    static void didLeaveDocument(Element*, const Document&);
+    static void wasDestroyed(Element*);
+
+private:
+    CustomElement();
+
+    static Vector<AtomicString>& embedderCustomElementNames();
+
+    // Maps resolved elements to their definitions
+
+    class DefinitionMap {
+        WTF_MAKE_NONCOPYABLE(DefinitionMap);
+    public:
+        DefinitionMap() { }
+        ~DefinitionMap() { }
+
+        void add(Element*, PassRefPtr<CustomElementDefinition>);
+        void remove(Element* element) { m_definitions.remove(element); }
+        CustomElementDefinition* get(Element* element) const { return m_definitions.get(element); }
+
+    private:
+        typedef HashMap<Element*, RefPtr<CustomElementDefinition> > ElementDefinitionHashMap;
+        ElementDefinitionHashMap m_definitions;
+    };
+    static DefinitionMap& definitions();
+};
+
+}
+
+#endif // CustomElement_h
diff --git a/Source/core/dom/custom/CustomElementBaseElementQueue.cpp b/Source/core/dom/custom/CustomElementBaseElementQueue.cpp
new file mode 100644
index 0000000..0e8561d
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementBaseElementQueue.cpp
@@ -0,0 +1,64 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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/dom/custom/CustomElementBaseElementQueue.h"
+
+#include "core/dom/custom/CustomElementCallbackDispatcher.h"
+#include "core/dom/custom/CustomElementCallbackQueue.h"
+
+namespace WebCore {
+
+void CustomElementBaseElementQueue::enqueue(CustomElementCallbackQueue* queue)
+{
+    m_queue.append(queue);
+}
+
+bool CustomElementBaseElementQueue::dispatch(ElementQueue baseQueueId)
+{
+    ASSERT(!m_inDispatch);
+    m_inDispatch = true;
+
+    bool didWork = m_queue.size();
+
+    for (Vector<CustomElementCallbackQueue*>::iterator it = m_queue.begin(); it != m_queue.end(); ++it) {
+        // The created callback may schedule entered document
+        // callbacks.
+        CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
+        (*it)->processInElementQueue(baseQueueId);
+    }
+
+    m_queue.resize(0);
+    m_inDispatch = 0;
+
+    return didWork;
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/custom/CustomElementBaseElementQueue.h b/Source/core/dom/custom/CustomElementBaseElementQueue.h
new file mode 100644
index 0000000..78882aa
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementBaseElementQueue.h
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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 CustomElementBaseElementQueue_h
+#define CustomElementBaseElementQueue_h
+
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+class CustomElementCallbackQueue;
+
+class CustomElementBaseElementQueue {
+    WTF_MAKE_NONCOPYABLE(CustomElementBaseElementQueue);
+public:
+    CustomElementBaseElementQueue() : m_inDispatch(false) { }
+
+    bool isEmpty() const { return m_queue.isEmpty(); }
+    void enqueue(CustomElementCallbackQueue*);
+
+    typedef int ElementQueue;
+    bool dispatch(ElementQueue baseQueueId);
+
+private:
+    bool m_inDispatch;
+    Vector<CustomElementCallbackQueue*> m_queue;
+};
+
+}
+
+#endif // CustomElementBaseElementQueue_h
diff --git a/Source/core/dom/custom/CustomElementCallbackDispatcher.cpp b/Source/core/dom/custom/CustomElementCallbackDispatcher.cpp
new file mode 100644
index 0000000..450af4e
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementCallbackDispatcher.cpp
@@ -0,0 +1,108 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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/dom/custom/CustomElementCallbackDispatcher.h"
+
+#include "core/dom/custom/CustomElementCallbackQueue.h"
+#include "core/dom/custom/CustomElementCallbackScheduler.h"
+#include "wtf/MainThread.h"
+
+namespace WebCore {
+
+size_t CustomElementCallbackDispatcher::s_elementQueueStart = 0;
+
+// The base of the stack has a null sentinel value.
+size_t CustomElementCallbackDispatcher::s_elementQueueEnd = kNumSentinels;
+
+CustomElementCallbackDispatcher& CustomElementCallbackDispatcher::instance()
+{
+    DEFINE_STATIC_LOCAL(CustomElementCallbackDispatcher, instance, ());
+    return instance;
+}
+
+bool CustomElementCallbackDispatcher::dispatch()
+{
+    ASSERT(isMainThread());
+    if (inCallbackDeliveryScope())
+        return false;
+
+    bool didWork = m_baseElementQueue.dispatch(baseElementQueue());
+    CustomElementCallbackScheduler::clearElementCallbackQueueMap();
+    return didWork;
+}
+
+// Dispatches callbacks when popping the processing stack.
+void CustomElementCallbackDispatcher::processElementQueueAndPop()
+{
+    instance().processElementQueueAndPop(s_elementQueueStart, s_elementQueueEnd);
+}
+
+void CustomElementCallbackDispatcher::processElementQueueAndPop(size_t start, size_t end)
+{
+    ASSERT(isMainThread());
+    ElementQueue thisQueue = currentElementQueue();
+
+    for (size_t i = start; i < end; i++) {
+        {
+            // The created callback may schedule entered document
+            // callbacks.
+            CallbackDeliveryScope deliveryScope;
+            m_flattenedProcessingStack[i]->processInElementQueue(thisQueue);
+        }
+
+        ASSERT(start == s_elementQueueStart);
+        ASSERT(end == s_elementQueueEnd);
+    }
+
+    // Pop the element queue from the processing stack
+    m_flattenedProcessingStack.resize(start);
+    s_elementQueueEnd = start;
+
+    if (start == kNumSentinels && m_baseElementQueue.isEmpty())
+        CustomElementCallbackScheduler::clearElementCallbackQueueMap();
+}
+
+void CustomElementCallbackDispatcher::enqueue(CustomElementCallbackQueue* callbackQueue)
+{
+    if (callbackQueue->owner() == currentElementQueue())
+        return;
+
+    callbackQueue->setOwner(currentElementQueue());
+
+    if (inCallbackDeliveryScope()) {
+        m_flattenedProcessingStack.append(callbackQueue);
+        ++s_elementQueueEnd;
+    } else {
+        m_baseElementQueue.enqueue(callbackQueue);
+    }
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/custom/CustomElementCallbackDispatcher.h b/Source/core/dom/custom/CustomElementCallbackDispatcher.h
new file mode 100644
index 0000000..1792191
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementCallbackDispatcher.h
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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 CustomElementCallbackDispatcher_h
+#define CustomElementCallbackDispatcher_h
+
+#include "core/dom/custom/CustomElementBaseElementQueue.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+class CustomElementCallbackQueue;
+class CustomElementCallbackScheduler;
+
+class CustomElementCallbackDispatcher {
+    WTF_MAKE_NONCOPYABLE(CustomElementCallbackDispatcher);
+public:
+    static CustomElementCallbackDispatcher& instance();
+
+    // This is stack allocated in many DOM callbacks. Make it cheap.
+    class CallbackDeliveryScope {
+    public:
+        CallbackDeliveryScope()
+            : m_savedElementQueueStart(s_elementQueueStart)
+        {
+            s_elementQueueStart = s_elementQueueEnd;
+        }
+
+        ~CallbackDeliveryScope()
+        {
+            if (s_elementQueueStart != s_elementQueueEnd)
+                processElementQueueAndPop();
+            s_elementQueueStart = m_savedElementQueueStart;
+        }
+
+    private:
+        size_t m_savedElementQueueStart;
+    };
+
+    // Returns true if more work may have to be performed at the
+    // checkpoint by this or other workers (for example, this work
+    // invoked author scripts)
+    bool dispatch();
+
+protected:
+    friend class CustomElementCallbackScheduler;
+    void enqueue(CustomElementCallbackQueue*);
+
+private:
+    CustomElementCallbackDispatcher()
+    {
+        // Add a null element as a sentinel. This makes it possible to
+        // identify elements queued when there is no
+        // CallbackDeliveryScope active. Also, if the processing stack
+        // is popped when empty, this sentinel will cause a null deref
+        // crash.
+        CustomElementCallbackQueue* sentinel = 0;
+        for (size_t i = 0; i < kNumSentinels; i++)
+            m_flattenedProcessingStack.append(sentinel);
+        ASSERT(s_elementQueueEnd == m_flattenedProcessingStack.size());
+    }
+
+    // The start of the element queue on the top of the processing
+    // stack. An offset into instance().m_flattenedProcessingStack.
+    static size_t s_elementQueueStart;
+
+    // The end of the element queue on the top of the processing
+    // stack. A cache of instance().m_flattenedProcessingStack.size().
+    static size_t s_elementQueueEnd;
+
+    static bool inCallbackDeliveryScope() { return s_elementQueueStart; }
+
+    typedef int ElementQueue;
+    static ElementQueue baseElementQueue() { return ElementQueue(0); }
+    static ElementQueue currentElementQueue() { return ElementQueue(s_elementQueueStart); }
+
+    static void processElementQueueAndPop();
+    void processElementQueueAndPop(size_t start, size_t end);
+
+    // The base element queue, used when no CallbackDeliveryScope is
+    // active. Callbacks for elements created by the parser are
+    // enqueued here.
+    CustomElementBaseElementQueue m_baseElementQueue;
+
+    // The processing stack, flattened. Element queues lower in the
+    // stack appear toward the head of the vector. The first element
+    // is a null sentinel value.
+    static const size_t kNumSentinels = 1;
+    Vector<CustomElementCallbackQueue*> m_flattenedProcessingStack;
+};
+
+}
+
+#endif // CustomElementCallbackDispatcher_h
diff --git a/Source/core/dom/custom/CustomElementCallbackInvocation.cpp b/Source/core/dom/custom/CustomElementCallbackInvocation.cpp
new file mode 100644
index 0000000..119fa1f
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementCallbackInvocation.cpp
@@ -0,0 +1,135 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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/dom/custom/CustomElementCallbackInvocation.h"
+
+#include "core/dom/Element.h"
+#include "core/dom/custom/CustomElementCallbackScheduler.h"
+
+namespace WebCore {
+
+class CreatedInvocation : public CustomElementCallbackInvocation {
+public:
+    CreatedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
+        : CustomElementCallbackInvocation(callbacks)
+    {
+    }
+
+private:
+    virtual void dispatch(Element*) OVERRIDE;
+    virtual bool isCreated() const OVERRIDE { return true; }
+};
+
+void CreatedInvocation::dispatch(Element* element)
+{
+    if (element->inDocument() && element->document().defaultView())
+        CustomElementCallbackScheduler::scheduleEnteredViewCallback(callbacks(), element);
+    callbacks()->created(element);
+}
+
+class EnteredLeftViewInvocation : public CustomElementCallbackInvocation {
+public:
+    EnteredLeftViewInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, CustomElementLifecycleCallbacks::CallbackType which);
+
+private:
+    virtual void dispatch(Element*) OVERRIDE;
+
+    CustomElementLifecycleCallbacks::CallbackType m_which;
+};
+
+EnteredLeftViewInvocation::EnteredLeftViewInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::CallbackType which)
+    : CustomElementCallbackInvocation(callbacks)
+    , m_which(which)
+{
+    ASSERT(m_which == CustomElementLifecycleCallbacks::EnteredView || m_which == CustomElementLifecycleCallbacks::LeftView);
+}
+
+void EnteredLeftViewInvocation::dispatch(Element* element)
+{
+    switch (m_which) {
+    case CustomElementLifecycleCallbacks::EnteredView:
+        callbacks()->enteredView(element);
+        break;
+    case CustomElementLifecycleCallbacks::LeftView:
+        callbacks()->leftView(element);
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+}
+
+class AttributeChangedInvocation : public CustomElementCallbackInvocation {
+public:
+    AttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
+
+private:
+    virtual void dispatch(Element*) OVERRIDE;
+
+    AtomicString m_name;
+    AtomicString m_oldValue;
+    AtomicString m_newValue;
+};
+
+AttributeChangedInvocation::AttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
+    : CustomElementCallbackInvocation(callbacks)
+    , m_name(name)
+    , m_oldValue(oldValue)
+    , m_newValue(newValue)
+{
+}
+
+void AttributeChangedInvocation::dispatch(Element* element)
+{
+    callbacks()->attributeChanged(element, m_name, m_oldValue, m_newValue);
+}
+
+PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::createInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::CallbackType which)
+{
+    switch (which) {
+    case CustomElementLifecycleCallbacks::Created:
+        return adoptPtr(new CreatedInvocation(callbacks));
+
+    case CustomElementLifecycleCallbacks::EnteredView:
+    case CustomElementLifecycleCallbacks::LeftView:
+        return adoptPtr(new EnteredLeftViewInvocation(callbacks, which));
+
+    default:
+        ASSERT_NOT_REACHED();
+        return PassOwnPtr<CustomElementCallbackInvocation>();
+    }
+}
+
+PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::createAttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
+{
+    return adoptPtr(new AttributeChangedInvocation(callbacks, name, oldValue, newValue));
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/custom/CustomElementCallbackInvocation.h b/Source/core/dom/custom/CustomElementCallbackInvocation.h
new file mode 100644
index 0000000..097e091
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementCallbackInvocation.h
@@ -0,0 +1,68 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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 CustomElementCallbackInvocation_h
+#define CustomElementCallbackInvocation_h
+
+#include "core/dom/custom/CustomElementLifecycleCallbacks.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/AtomicString.h"
+
+namespace WebCore {
+
+class Element;
+
+class CustomElementCallbackInvocation {
+    WTF_MAKE_NONCOPYABLE(CustomElementCallbackInvocation);
+public:
+    static PassOwnPtr<CustomElementCallbackInvocation> createInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, CustomElementLifecycleCallbacks::CallbackType);
+    static PassOwnPtr<CustomElementCallbackInvocation> createAttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
+
+    virtual ~CustomElementCallbackInvocation() { }
+    virtual void dispatch(Element*) = 0;
+    virtual bool isCreated() const { return false; }
+
+protected:
+    CustomElementCallbackInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
+        : m_callbacks(callbacks)
+    {
+    }
+
+    CustomElementLifecycleCallbacks* callbacks() { return m_callbacks.get(); }
+
+private:
+    RefPtr<CustomElementLifecycleCallbacks> m_callbacks;
+};
+
+}
+
+#endif // CustomElementCallbackInvocation_h
diff --git a/Source/core/dom/custom/CustomElementCallbackQueue.cpp b/Source/core/dom/custom/CustomElementCallbackQueue.cpp
new file mode 100644
index 0000000..7da3b71
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementCallbackQueue.cpp
@@ -0,0 +1,71 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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/dom/custom/CustomElementCallbackQueue.h"
+
+namespace WebCore {
+
+PassOwnPtr<CustomElementCallbackQueue> CustomElementCallbackQueue::create(PassRefPtr<Element> element)
+{
+    return adoptPtr(new CustomElementCallbackQueue(element));
+}
+
+CustomElementCallbackQueue::CustomElementCallbackQueue(PassRefPtr<Element> element)
+    : m_element(element)
+    , m_owner(-1)
+    , m_index(0)
+    , m_inCreatedCallback(false)
+{
+}
+
+void CustomElementCallbackQueue::processInElementQueue(ElementQueue caller)
+{
+    ASSERT(!m_inCreatedCallback);
+
+    while (m_index < m_queue.size() && owner() == caller) {
+        m_inCreatedCallback = m_queue[m_index]->isCreated();
+
+        // dispatch() may cause recursion which steals this callback
+        // queue and reenters processInQueue. owner() == caller
+        // detects this recursion and cedes processing.
+        m_queue[m_index++]->dispatch(m_element.get());
+        m_inCreatedCallback = false;
+    }
+
+    if (owner() == caller && m_index == m_queue.size()) {
+        // This processInQueue exhausted the queue; shrink it.
+        m_index = 0;
+        m_queue.resize(0);
+        m_owner = -1;
+    }
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/custom/CustomElementCallbackQueue.h b/Source/core/dom/custom/CustomElementCallbackQueue.h
new file mode 100644
index 0000000..269bfd2
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementCallbackQueue.h
@@ -0,0 +1,74 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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 CustomElementCallbackQueue_h
+#define CustomElementCallbackQueue_h
+
+#include "core/dom/Element.h"
+#include "core/dom/custom/CustomElementCallbackInvocation.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+
+namespace WebCore {
+
+class CustomElementCallbackQueue {
+    WTF_MAKE_NONCOPYABLE(CustomElementCallbackQueue);
+public:
+    static PassOwnPtr<CustomElementCallbackQueue> create(PassRefPtr<Element>);
+
+    typedef int ElementQueue;
+    ElementQueue owner() { return m_owner; }
+    void setOwner(ElementQueue newOwner)
+    {
+        // ElementCallbackQueues only migrate towards the top of the
+        // processing stack.
+        ASSERT(newOwner >= m_owner);
+        m_owner = newOwner;
+    }
+
+    void append(PassOwnPtr<CustomElementCallbackInvocation> invocation) { m_queue.append(invocation); }
+    void processInElementQueue(ElementQueue);
+    bool inCreatedCallback() const { return m_inCreatedCallback; }
+
+private:
+    CustomElementCallbackQueue(PassRefPtr<Element>);
+
+    RefPtr<Element> m_element;
+    Vector<OwnPtr<CustomElementCallbackInvocation> > m_queue;
+    ElementQueue m_owner;
+    size_t m_index;
+    bool m_inCreatedCallback;
+};
+
+}
+
+#endif // CustomElementCallbackQueue_h
diff --git a/Source/core/dom/custom/CustomElementCallbackScheduler.cpp b/Source/core/dom/custom/CustomElementCallbackScheduler.cpp
new file mode 100644
index 0000000..0b77e75
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementCallbackScheduler.cpp
@@ -0,0 +1,122 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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/dom/custom/CustomElementCallbackScheduler.h"
+
+#include "core/dom/Element.h"
+#include "core/dom/custom/CustomElementCallbackDispatcher.h"
+#include "core/dom/custom/CustomElementCallbackQueue.h"
+#include "core/dom/custom/CustomElementLifecycleCallbacks.h"
+
+namespace WebCore {
+
+void CustomElementCallbackScheduler::scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
+{
+    if (!callbacks->hasAttributeChangedCallback())
+        return;
+
+    CustomElementCallbackQueue* queue = instance().schedule(element);
+    queue->append(CustomElementCallbackInvocation::createAttributeChangedInvocation(callbacks, name, oldValue, newValue));
+}
+
+void CustomElementCallbackScheduler::scheduleCreatedCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
+{
+    if (!callbacks->hasCreatedCallback())
+        return;
+
+    CustomElementCallbackQueue* queue = instance().scheduleInCurrentElementQueue(element);
+    queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::Created));
+}
+
+void CustomElementCallbackScheduler::scheduleEnteredViewCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
+{
+    if (!callbacks->hasEnteredViewCallback())
+        return;
+
+    CustomElementCallbackQueue* queue = instance().schedule(element);
+    queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::EnteredView));
+}
+
+void CustomElementCallbackScheduler::scheduleLeftViewCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
+{
+    if (!callbacks->hasLeftViewCallback())
+        return;
+
+    CustomElementCallbackQueue* queue = instance().schedule(element);
+    queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, CustomElementLifecycleCallbacks::LeftView));
+}
+
+CustomElementCallbackScheduler& CustomElementCallbackScheduler::instance()
+{
+    DEFINE_STATIC_LOCAL(CustomElementCallbackScheduler, instance, ());
+    return instance;
+}
+
+CustomElementCallbackQueue* CustomElementCallbackScheduler::ensureCallbackQueue(PassRefPtr<Element> element)
+{
+    Element* key = element.get();
+    ElementCallbackQueueMap::iterator it = m_elementCallbackQueueMap.find(key);
+    if (it == m_elementCallbackQueueMap.end())
+        it = m_elementCallbackQueueMap.add(key, CustomElementCallbackQueue::create(element)).iterator;
+    return it->value.get();
+}
+
+void CustomElementCallbackScheduler::clearElementCallbackQueueMap()
+{
+    ElementCallbackQueueMap emptyMap;
+    instance().m_elementCallbackQueueMap.swap(emptyMap);
+}
+
+// Finds or creates the callback queue for element. If the
+// createdCallback has not finished running, the callback queue is not
+// moved to the top-of-stack. Otherwise like
+// scheduleInCurrentElementQueue.
+CustomElementCallbackQueue* CustomElementCallbackScheduler::schedule(PassRefPtr<Element> element)
+{
+    CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element);
+    if (!callbackQueue->inCreatedCallback())
+        CustomElementCallbackDispatcher::instance().enqueue(callbackQueue);
+    return callbackQueue;
+}
+
+// Finds or creates the callback queue for element. If the element's
+// callback queue is scheduled in an earlier processing stack frame,
+// its owner is set to the element queue on the top of the processing
+// stack. Because callback queues are processed exhaustively, this
+// effectively moves the callback queue to the top of the stack.
+CustomElementCallbackQueue* CustomElementCallbackScheduler::scheduleInCurrentElementQueue(PassRefPtr<Element> element)
+{
+    CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element);
+    CustomElementCallbackDispatcher::instance().enqueue(callbackQueue);
+    return callbackQueue;
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/custom/CustomElementCallbackScheduler.h b/Source/core/dom/custom/CustomElementCallbackScheduler.h
new file mode 100644
index 0000000..0311d05
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementCallbackScheduler.h
@@ -0,0 +1,71 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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 CustomElementCallbackScheduler_h
+#define CustomElementCallbackScheduler_h
+
+#include "core/dom/custom/CustomElementCallbackQueue.h"
+#include "wtf/HashMap.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/text/AtomicString.h"
+
+namespace WebCore {
+
+class CustomElementLifecycleCallbacks;
+class Element;
+
+class CustomElementCallbackScheduler {
+public:
+    static void scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue);
+    static void scheduleCreatedCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
+    static void scheduleEnteredViewCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
+    static void scheduleLeftViewCallback(PassRefPtr<CustomElementLifecycleCallbacks>, PassRefPtr<Element>);
+
+protected:
+    friend class CustomElementCallbackDispatcher;
+    static void clearElementCallbackQueueMap();
+
+private:
+    CustomElementCallbackScheduler() { }
+
+    static CustomElementCallbackScheduler& instance();
+
+    CustomElementCallbackQueue* ensureCallbackQueue(PassRefPtr<Element>);
+    CustomElementCallbackQueue* schedule(PassRefPtr<Element>);
+    CustomElementCallbackQueue* scheduleInCurrentElementQueue(PassRefPtr<Element>);
+
+    typedef HashMap<Element*, OwnPtr<CustomElementCallbackQueue> > ElementCallbackQueueMap;
+    ElementCallbackQueueMap m_elementCallbackQueueMap;
+};
+
+}
+
+#endif // CustomElementCallbackScheduler_h
diff --git a/Source/core/dom/custom/CustomElementDefinition.cpp b/Source/core/dom/custom/CustomElementDefinition.cpp
new file mode 100644
index 0000000..34e07f9
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementDefinition.cpp
@@ -0,0 +1,47 @@
+/*
+ * 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:
+ *
+ *     * 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/dom/custom/CustomElementDefinition.h"
+
+namespace WebCore {
+
+PassRefPtr<CustomElementDefinition> CustomElementDefinition::create(const CustomElementDescriptor& descriptor, PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
+{
+    return adoptRef(new CustomElementDefinition(descriptor, callbacks));
+}
+
+CustomElementDefinition::CustomElementDefinition(const CustomElementDescriptor& descriptor, PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
+    : m_descriptor(descriptor)
+    , m_callbacks(callbacks)
+{
+}
+
+}
diff --git a/Source/core/dom/custom/CustomElementDefinition.h b/Source/core/dom/custom/CustomElementDefinition.h
new file mode 100644
index 0000000..601f671
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementDefinition.h
@@ -0,0 +1,60 @@
+/*
+ * 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:
+ *
+ *     * 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 CustomElementDefinition_h
+#define CustomElementDefinition_h
+
+#include "core/dom/custom/CustomElementDescriptor.h"
+#include "core/dom/custom/CustomElementLifecycleCallbacks.h"
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class CustomElementDefinition : public RefCounted<CustomElementDefinition> {
+public:
+    static PassRefPtr<CustomElementDefinition> create(const CustomElementDescriptor&, PassRefPtr<CustomElementLifecycleCallbacks>);
+
+    virtual ~CustomElementDefinition() { }
+
+    const CustomElementDescriptor& descriptor() const { return m_descriptor; }
+    CustomElementLifecycleCallbacks* callbacks() const { return m_callbacks.get(); }
+
+private:
+    CustomElementDefinition(const CustomElementDescriptor&, PassRefPtr<CustomElementLifecycleCallbacks>);
+
+    CustomElementDescriptor m_descriptor;
+    RefPtr<CustomElementLifecycleCallbacks> m_callbacks;
+};
+
+}
+
+#endif // CustomElementDefinition_h
diff --git a/Source/core/dom/CustomElementDescriptor.h b/Source/core/dom/custom/CustomElementDescriptor.h
similarity index 100%
rename from Source/core/dom/CustomElementDescriptor.h
rename to Source/core/dom/custom/CustomElementDescriptor.h
diff --git a/Source/core/dom/custom/CustomElementDescriptorHash.h b/Source/core/dom/custom/CustomElementDescriptorHash.h
new file mode 100644
index 0000000..fe8bcb5
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementDescriptorHash.h
@@ -0,0 +1,66 @@
+/*
+ * 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 CustomElementDescriptorHash_h
+#define CustomElementDescriptorHash_h
+
+#include "core/dom/custom/CustomElementDescriptor.h"
+#include "wtf/HashFunctions.h"
+#include "wtf/HashTraits.h"
+#include "wtf/text/AtomicStringHash.h"
+
+namespace WebCore {
+
+struct CustomElementDescriptorHash {
+    static unsigned hash(const CustomElementDescriptor& descriptor)
+    {
+        return WTF::pairIntHash(AtomicStringHash::hash(descriptor.type()), WTF::pairIntHash(AtomicStringHash::hash(descriptor.namespaceURI()), AtomicStringHash::hash(descriptor.localName())));
+    }
+
+    static bool equal(const CustomElementDescriptor& a, const CustomElementDescriptor& b)
+    {
+        return a == b;
+    }
+
+    static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+} // namespace WebCore
+
+namespace WTF {
+
+template<>
+struct HashTraits<WebCore::CustomElementDescriptor> : SimpleClassHashTraits<WebCore::CustomElementDescriptor> {
+    static const bool emptyValueIsZero = HashTraits<AtomicString>::emptyValueIsZero;
+};
+
+} // namespace WTF
+
+#endif // CustomElementDescriptorHash
diff --git a/Source/core/dom/custom/CustomElementException.cpp b/Source/core/dom/custom/CustomElementException.cpp
new file mode 100644
index 0000000..f240c86
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementException.cpp
@@ -0,0 +1,95 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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/dom/custom/CustomElementException.h"
+
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/ExceptionCode.h"
+
+namespace WebCore {
+
+String CustomElementException::preamble(const AtomicString& type)
+{
+    return "Failed to call 'register' on 'Document' for type '" + type + "': ";
+}
+
+void CustomElementException::throwException(Reason reason, const AtomicString& type, ExceptionState& es)
+{
+    switch (reason) {
+    case CannotRegisterFromExtension:
+        es.throwDOMException(NotSupportedError, preamble(type) + "elements cannot be registered from extensions.");
+        return;
+
+    case ConstructorPropertyNotConfigurable:
+        es.throwDOMException(NotSupportedError, preamble(type) + "prototype constructor property is not configurable.");
+        return;
+
+    case ContextDestroyedCheckingPrototype:
+        es.throwDOMException(InvalidStateError, preamble(type) + "the context is no longer valid.");
+        return;
+
+    case ContextDestroyedCreatingCallbacks:
+        es.throwUninformativeAndGenericDOMException(InvalidStateError);
+        return;
+
+    case ContextDestroyedRegisteringDefinition:
+        es.throwUninformativeAndGenericDOMException(NotSupportedError);
+        return;
+
+    case ExtendsIsInvalidName:
+        es.throwDOMException(InvalidCharacterError, preamble(type) + ": the tag name specified in 'extends' is not a valid tag name.");
+        return;
+
+    case ExtendsIsCustomElementName:
+        es.throwDOMException(InvalidCharacterError, preamble(type) + ": the tag name specified in 'extends' is a custom element name. Use inheritance instead.");
+        return;
+
+    case InvalidName:
+        es.throwDOMException(InvalidCharacterError, preamble(type) + ": '" + type + "' is not a valid name.");
+        return;
+
+    case PrototypeInUse:
+        es.throwDOMException(NotSupportedError, preamble(type) + "prototype is already in-use as an interface prototype object.");
+        return;
+
+    case PrototypeNotAnObject:
+        es.throwDOMException(InvalidStateError, preamble(type) + "the prototype option is not an object.");
+        return;
+
+    case TypeAlreadyRegistered:
+        es.throwDOMException(InvalidStateError, preamble(type) + "a type with that name is already registered.");
+        return;
+    }
+
+    ASSERT_NOT_REACHED();
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/CustomElementException.h b/Source/core/dom/custom/CustomElementException.h
similarity index 100%
rename from Source/core/dom/CustomElementException.h
rename to Source/core/dom/custom/CustomElementException.h
diff --git a/Source/core/dom/CustomElementLifecycleCallbacks.h b/Source/core/dom/custom/CustomElementLifecycleCallbacks.h
similarity index 100%
rename from Source/core/dom/CustomElementLifecycleCallbacks.h
rename to Source/core/dom/custom/CustomElementLifecycleCallbacks.h
diff --git a/Source/core/dom/custom/CustomElementObserver.cpp b/Source/core/dom/custom/CustomElementObserver.cpp
new file mode 100644
index 0000000..0710995
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementObserver.cpp
@@ -0,0 +1,70 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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/dom/custom/CustomElementObserver.h"
+
+namespace WebCore {
+
+CustomElementObserver::ElementObserverMap& CustomElementObserver::elementObservers()
+{
+    DEFINE_STATIC_LOCAL(ElementObserverMap, map, ());
+    return map;
+}
+
+void CustomElementObserver::notifyElementDidFinishParsingChildren(Element* element)
+{
+    ElementObserverMap::iterator it = elementObservers().find(element);
+    if (it == elementObservers().end())
+        return;
+    it->value->elementDidFinishParsingChildren(element);
+}
+
+void CustomElementObserver::notifyElementWasDestroyed(Element* element)
+{
+    ElementObserverMap::iterator it = elementObservers().find(element);
+    if (it == elementObservers().end())
+        return;
+    it->value->elementWasDestroyed(element);
+}
+
+void CustomElementObserver::observe(Element* element)
+{
+    ElementObserverMap::AddResult result = elementObservers().add(element, this);
+    ASSERT(result.isNewEntry);
+}
+
+void CustomElementObserver::unobserve(Element* element)
+{
+    CustomElementObserver* observer = elementObservers().take(element);
+    ASSERT(observer == this);
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/CustomElementObserver.h b/Source/core/dom/custom/CustomElementObserver.h
similarity index 100%
rename from Source/core/dom/CustomElementObserver.h
rename to Source/core/dom/custom/CustomElementObserver.h
diff --git a/Source/core/dom/custom/CustomElementRegistrationContext.cpp b/Source/core/dom/custom/CustomElementRegistrationContext.cpp
new file mode 100644
index 0000000..44ed913
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementRegistrationContext.cpp
@@ -0,0 +1,150 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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/dom/custom/CustomElementRegistrationContext.h"
+
+#include "HTMLNames.h"
+#include "SVGNames.h"
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/Element.h"
+#include "core/dom/custom/CustomElement.h"
+#include "core/dom/custom/CustomElementCallbackScheduler.h"
+#include "core/dom/custom/CustomElementDefinition.h"
+#include "core/html/HTMLElement.h"
+#include "core/html/HTMLUnknownElement.h"
+#include "core/svg/SVGUnknownElement.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+void CustomElementRegistrationContext::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& type, CustomElement::NameSet validNames, ExceptionState& es)
+{
+    CustomElementDefinition* definition = m_registry.registerElement(document, constructorBuilder, type, validNames, es);
+
+    if (!definition)
+        return;
+
+    // Upgrade elements that were waiting for this definition.
+    const CustomElementUpgradeCandidateMap::ElementSet& upgradeCandidates = m_candidates.takeUpgradeCandidatesFor(definition->descriptor());
+    for (CustomElementUpgradeCandidateMap::ElementSet::const_iterator it = upgradeCandidates.begin(); it != upgradeCandidates.end(); ++it)
+        didResolveElement(definition, *it);
+}
+
+PassRefPtr<Element> CustomElementRegistrationContext::createCustomTagElement(Document& document, const QualifiedName& tagName, CreationMode mode)
+{
+    ASSERT(CustomElement::isValidName(tagName.localName()));
+
+    RefPtr<Element> element;
+
+    if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI()) {
+        element = HTMLElement::create(tagName, document);
+    } else if (SVGNames::svgNamespaceURI == tagName.namespaceURI()) {
+        element = SVGUnknownElement::create(tagName, document);
+    } else {
+        // XML elements are not custom elements, so return early.
+        return Element::create(tagName, &document);
+    }
+
+    element->setCustomElementState(mode == CreatedByParser ? Element::WaitingForParser : Element::WaitingForUpgrade);
+    resolve(element.get(), nullAtom);
+    return element.release();
+}
+
+void CustomElementRegistrationContext::didGiveTypeExtension(Element* element, const AtomicString& type)
+{
+    resolve(element, type);
+}
+
+void CustomElementRegistrationContext::resolve(Element* element, const AtomicString& typeExtension)
+{
+    // If an element has a custom tag name it takes precedence over
+    // the "is" attribute (if any).
+    const AtomicString& type = CustomElement::isValidName(element->localName())
+        ? element->localName()
+        : typeExtension;
+    ASSERT(!type.isNull());
+
+    CustomElementDescriptor descriptor(type, element->namespaceURI(), element->localName());
+    CustomElementDefinition* definition = m_registry.find(descriptor);
+    if (definition)
+        didResolveElement(definition, element);
+    else
+        didCreateUnresolvedElement(descriptor, element);
+}
+
+void CustomElementRegistrationContext::didResolveElement(CustomElementDefinition* definition, Element* element)
+{
+    CustomElement::define(element, definition);
+}
+
+void CustomElementRegistrationContext::didCreateUnresolvedElement(const CustomElementDescriptor& descriptor, Element* element)
+{
+    ASSERT(element->customElementState() == Element::WaitingForParser || element->customElementState() == Element::WaitingForUpgrade);
+    m_candidates.add(descriptor, element);
+}
+
+PassRefPtr<CustomElementRegistrationContext> CustomElementRegistrationContext::create()
+{
+    return adoptRef(new CustomElementRegistrationContext());
+}
+
+void CustomElementRegistrationContext::setIsAttributeAndTypeExtension(Element* element, const AtomicString& type)
+{
+    ASSERT(element);
+    ASSERT(!type.isEmpty());
+    element->setAttribute(HTMLNames::isAttr, type);
+    setTypeExtension(element, type);
+}
+
+void CustomElementRegistrationContext::setTypeExtension(Element* element, const AtomicString& type, CreationMode mode)
+{
+    if (!element->isHTMLElement() && !element->isSVGElement())
+        return;
+
+    if (element->isCustomElement()) {
+        // This can happen if:
+        // 1. The element has a custom tag, which takes precedence over
+        //    type extensions.
+        // 2. Undoing a command (eg ReplaceNodeWithSpan) recycles an
+        //    element but tries to overwrite its attribute list.
+        return;
+    }
+
+    // Custom tags take precedence over type extensions
+    ASSERT(!CustomElement::isValidName(element->localName()));
+
+    element->setCustomElementState(mode == CreatedByParser ? Element::WaitingForParser : Element::WaitingForUpgrade);
+
+    if (CustomElementRegistrationContext* context = element->document().registrationContext())
+        context->didGiveTypeExtension(element, type);
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/custom/CustomElementRegistrationContext.h b/Source/core/dom/custom/CustomElementRegistrationContext.h
new file mode 100644
index 0000000..1c933bb
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementRegistrationContext.h
@@ -0,0 +1,89 @@
+/*
+ * 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:
+ *
+ * 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.
+ * 3. 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 CustomElementRegistrationContext_h
+#define CustomElementRegistrationContext_h
+
+#include "core/dom/QualifiedName.h"
+#include "core/dom/custom/CustomElementDescriptor.h"
+#include "core/dom/custom/CustomElementRegistry.h"
+#include "core/dom/custom/CustomElementUpgradeCandidateMap.h"
+#include "wtf/HashMap.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/text/AtomicString.h"
+
+namespace WebCore {
+
+class CustomElementConstructorBuilder;
+class CustomElementDefinition;
+class Document;
+class Element;
+class ExceptionState;
+
+class CustomElementRegistrationContext : public RefCounted<CustomElementRegistrationContext> {
+public:
+    static PassRefPtr<CustomElementRegistrationContext> create();
+
+    ~CustomElementRegistrationContext() { }
+
+    // Definitions
+    void registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& type, CustomElement::NameSet validNames, ExceptionState&);
+
+    // Instance creation
+    enum CreationMode {
+        CreatedByParser,
+        NotCreatedByParser
+    };
+
+    PassRefPtr<Element> createCustomTagElement(Document&, const QualifiedName&, CreationMode = NotCreatedByParser);
+    static void setIsAttributeAndTypeExtension(Element*, const AtomicString& type);
+    static void setTypeExtension(Element*, const AtomicString& type, CreationMode = NotCreatedByParser);
+
+protected:
+    CustomElementRegistrationContext() { }
+
+    // Instance creation
+    void didGiveTypeExtension(Element*, const AtomicString& type);
+
+private:
+    void resolve(Element*, const AtomicString& typeExtension);
+    void didResolveElement(CustomElementDefinition*, Element*);
+    void didCreateUnresolvedElement(const CustomElementDescriptor&, Element*);
+
+    CustomElementRegistry m_registry;
+
+    // Element creation
+    CustomElementUpgradeCandidateMap m_candidates;
+};
+
+}
+
+#endif // CustomElementRegistrationContext_h
+
diff --git a/Source/core/dom/custom/CustomElementRegistry.cpp b/Source/core/dom/custom/CustomElementRegistry.cpp
new file mode 100644
index 0000000..acf7e0c
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementRegistry.cpp
@@ -0,0 +1,126 @@
+/*
+ * 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.
+ * 3. 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/dom/custom/CustomElementRegistry.h"
+
+#include "HTMLNames.h"
+#include "SVGNames.h"
+#include "bindings/v8/CustomElementConstructorBuilder.h"
+#include "core/dom/DocumentLifecycleObserver.h"
+#include "core/dom/custom/CustomElement.h"
+#include "core/dom/custom/CustomElementDefinition.h"
+#include "core/dom/custom/CustomElementException.h"
+#include "core/dom/custom/CustomElementRegistrationContext.h"
+
+namespace WebCore {
+
+class RegistrationContextObserver : public DocumentLifecycleObserver {
+public:
+    explicit RegistrationContextObserver(Document* document)
+        : DocumentLifecycleObserver(document)
+        , m_wentAway(!document)
+    {
+    }
+
+    bool registrationContextWentAway() { return m_wentAway; }
+
+private:
+    virtual void documentWasDisposed() OVERRIDE { m_wentAway = true; }
+
+    bool m_wentAway;
+};
+
+CustomElementDefinition* CustomElementRegistry::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& userSuppliedName, CustomElement::NameSet validNames, ExceptionState& es)
+{
+    // FIXME: In every instance except one it is the
+    // CustomElementConstructorBuilder that observes document
+    // destruction during registration. This responsibility should be
+    // consolidated in one place.
+    RegistrationContextObserver observer(document);
+
+    AtomicString type = userSuppliedName.lower();
+
+    if (!constructorBuilder->isFeatureAllowed()) {
+        CustomElementException::throwException(CustomElementException::CannotRegisterFromExtension, type, es);
+        return 0;
+    }
+
+    if (!CustomElement::isValidName(type, validNames)) {
+        CustomElementException::throwException(CustomElementException::InvalidName, type, es);
+        return 0;
+    }
+
+    QualifiedName tagName = nullQName();
+    if (!constructorBuilder->validateOptions(type, tagName, es))
+        return 0;
+
+    ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.namespaceURI() == SVGNames::svgNamespaceURI);
+
+    // FIXME: This should be done earlier in validateOptions.
+    if (m_registeredTypeNames.contains(type)) {
+        CustomElementException::throwException(CustomElementException::TypeAlreadyRegistered, type, es);
+        return 0;
+    }
+
+    ASSERT(!observer.registrationContextWentAway());
+
+    RefPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = constructorBuilder->createCallbacks();
+
+    // Consulting the constructor builder could execute script and
+    // kill the document.
+    if (observer.registrationContextWentAway()) {
+        CustomElementException::throwException(CustomElementException::ContextDestroyedCreatingCallbacks, type, es);
+        return 0;
+    }
+
+    const CustomElementDescriptor descriptor(type, tagName.namespaceURI(), tagName.localName());
+    RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create(descriptor, lifecycleCallbacks);
+
+    if (!constructorBuilder->createConstructor(document, definition.get(), es))
+        return 0;
+
+    m_definitions.add(descriptor, definition);
+    m_registeredTypeNames.add(descriptor.type());
+
+    if (!constructorBuilder->didRegisterDefinition(definition.get())) {
+        CustomElementException::throwException(CustomElementException::ContextDestroyedRegisteringDefinition, type, es);
+        return 0;
+    }
+
+    return definition.get();
+}
+
+CustomElementDefinition* CustomElementRegistry::find(const CustomElementDescriptor& descriptor) const
+{
+    return m_definitions.get(descriptor);
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/custom/CustomElementRegistry.h b/Source/core/dom/custom/CustomElementRegistry.h
new file mode 100644
index 0000000..11642dd
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementRegistry.h
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ * 3. 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 CustomElementRegistry_h
+#define CustomElementRegistry_h
+
+#include "core/dom/custom/CustomElement.h"
+#include "core/dom/custom/CustomElementDefinition.h"
+#include "core/dom/custom/CustomElementDescriptor.h"
+#include "core/dom/custom/CustomElementDescriptorHash.h"
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/AtomicString.h"
+#include "wtf/text/AtomicStringHash.h"
+
+namespace WebCore {
+
+class CustomElementConstructorBuilder;
+class Document;
+class ExceptionState;
+
+class CustomElementRegistry {
+    WTF_MAKE_NONCOPYABLE(CustomElementRegistry);
+protected:
+    friend class CustomElementRegistrationContext;
+
+    CustomElementRegistry() { }
+    virtual ~CustomElementRegistry() { }
+
+    CustomElementDefinition* registerElement(Document*, CustomElementConstructorBuilder*, const AtomicString& name, CustomElement::NameSet validNames, ExceptionState&);
+    CustomElementDefinition* find(const CustomElementDescriptor&) const;
+
+private:
+    typedef HashMap<CustomElementDescriptor, RefPtr<CustomElementDefinition> > DefinitionMap;
+    DefinitionMap m_definitions;
+    HashSet<AtomicString> m_registeredTypeNames;
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/dom/custom/CustomElementUpgradeCandidateMap.cpp b/Source/core/dom/custom/CustomElementUpgradeCandidateMap.cpp
new file mode 100644
index 0000000..c907831
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementUpgradeCandidateMap.cpp
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/dom/custom/CustomElementUpgradeCandidateMap.h"
+
+#include "core/dom/Element.h"
+
+namespace WebCore {
+
+CustomElementUpgradeCandidateMap::~CustomElementUpgradeCandidateMap()
+{
+    UpgradeCandidateMap::const_iterator::Keys end = m_upgradeCandidates.end().keys();
+    for (UpgradeCandidateMap::const_iterator::Keys it = m_upgradeCandidates.begin().keys(); it != end; ++it)
+        unobserve(*it);
+}
+
+void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descriptor, Element* element)
+{
+    observe(element);
+
+    UpgradeCandidateMap::AddResult result = m_upgradeCandidates.add(element, descriptor);
+    ASSERT(result.isNewEntry);
+
+    UnresolvedDefinitionMap::iterator it = m_unresolvedDefinitions.find(descriptor);
+    if (it == m_unresolvedDefinitions.end())
+        it = m_unresolvedDefinitions.add(descriptor, ElementSet()).iterator;
+    it->value.add(element);
+}
+
+void CustomElementUpgradeCandidateMap::remove(Element* element)
+{
+    unobserve(element);
+    removeCommon(element);
+}
+
+void CustomElementUpgradeCandidateMap::elementWasDestroyed(Element* element)
+{
+    CustomElementObserver::elementWasDestroyed(element);
+    removeCommon(element);
+}
+
+void CustomElementUpgradeCandidateMap::removeCommon(Element* element)
+{
+    UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element);
+    ASSERT(candidate != m_upgradeCandidates.end());
+
+    UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(candidate->value);
+    ASSERT(elements != m_unresolvedDefinitions.end());
+    elements->value.remove(element);
+    m_upgradeCandidates.remove(candidate);
+}
+
+void CustomElementUpgradeCandidateMap::elementDidFinishParsingChildren(Element* element)
+{
+    // An upgrade candidate finished parsing; reorder so that eventual
+    // upgrade order matches finished-parsing order.
+    moveToEnd(element);
+}
+
+void CustomElementUpgradeCandidateMap::moveToEnd(Element* element)
+{
+    UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element);
+    ASSERT(candidate != m_upgradeCandidates.end());
+
+    UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(candidate->value);
+    ASSERT(elements != m_unresolvedDefinitions.end());
+    elements->value.appendOrMoveToLast(element);
+}
+
+ListHashSet<Element*> CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor(const CustomElementDescriptor& descriptor)
+{
+    const ListHashSet<Element*>& candidates = m_unresolvedDefinitions.take(descriptor);
+
+    for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate) {
+        unobserve(*candidate);
+        m_upgradeCandidates.remove(*candidate);
+    }
+
+    return candidates;
+}
+
+}
diff --git a/Source/core/dom/custom/CustomElementUpgradeCandidateMap.h b/Source/core/dom/custom/CustomElementUpgradeCandidateMap.h
new file mode 100644
index 0000000..f68c50b
--- /dev/null
+++ b/Source/core/dom/custom/CustomElementUpgradeCandidateMap.h
@@ -0,0 +1,75 @@
+/*
+ * 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 CustomElementUpgradeCandidateMap_h
+#define CustomElementUpgradeCandidateMap_h
+
+#include "core/dom/custom/CustomElementDescriptor.h"
+#include "core/dom/custom/CustomElementDescriptorHash.h"
+#include "core/dom/custom/CustomElementObserver.h"
+#include "wtf/HashMap.h"
+#include "wtf/ListHashSet.h"
+#include "wtf/Noncopyable.h"
+
+namespace WebCore {
+
+class Element;
+
+class CustomElementUpgradeCandidateMap : CustomElementObserver {
+    WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap);
+public:
+    CustomElementUpgradeCandidateMap() { }
+    ~CustomElementUpgradeCandidateMap();
+
+    // API for CustomElementRegistrationContext to save and take candidates
+
+    typedef ListHashSet<Element*> ElementSet;
+
+    void add(const CustomElementDescriptor&, Element*);
+    void remove(Element*);
+    ElementSet takeUpgradeCandidatesFor(const CustomElementDescriptor&);
+
+private:
+    virtual void elementWasDestroyed(Element*) OVERRIDE;
+    void removeCommon(Element*);
+
+    virtual void elementDidFinishParsingChildren(Element*) OVERRIDE;
+    void moveToEnd(Element*);
+
+    typedef HashMap<Element*, CustomElementDescriptor> UpgradeCandidateMap;
+    UpgradeCandidateMap m_upgradeCandidates;
+
+    typedef HashMap<CustomElementDescriptor, ElementSet> UnresolvedDefinitionMap;
+    UnresolvedDefinitionMap m_unresolvedDefinitions;
+};
+
+}
+
+#endif // CustomElementUpgradeCandidateMap_h
diff --git a/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp b/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp
deleted file mode 100644
index 466502f..0000000
--- a/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * 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
- * 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/dom/default/chromium/PlatformMessagePortChannelChromium.h"
-
-#include "bindings/v8/SerializedScriptValue.h"
-#include "core/dom/MessagePort.h"
-
-#include "public/platform/Platform.h"
-#include "public/platform/WebMessagePortChannel.h"
-#include "public/platform/WebString.h"
-
-namespace WebCore {
-
-PassOwnPtr<MessagePortChannel> MessagePortChannel::create(PassRefPtr<PlatformMessagePortChannel> channel)
-{
-    return adoptPtr(new MessagePortChannel(channel));
-}
-
-void MessagePortChannel::createChannel(PassRefPtr<MessagePort> port1, PassRefPtr<MessagePort> port2)
-{
-    PlatformMessagePortChannel::createChannel(port1, port2);
-}
-
-MessagePortChannel::MessagePortChannel(PassRefPtr<PlatformMessagePortChannel> channel)
-    : m_channel(channel)
-{
-}
-
-MessagePortChannel::~MessagePortChannel()
-{
-    // Make sure we close our platform channel when the base is freed, to keep the channel objects from leaking.
-    m_channel->close();
-}
-
-bool MessagePortChannel::entangleIfOpen(MessagePort* port)
-{
-    return m_channel->entangleIfOpen(port);
-}
-
-void MessagePortChannel::disentangle()
-{
-    m_channel->disentangle();
-}
-
-void MessagePortChannel::postMessageToRemote(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
-{
-    m_channel->postMessageToRemote(message, channels);
-}
-
-bool MessagePortChannel::tryGetMessageFromRemote(RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePortChannelArray>& channels)
-{
-    return m_channel->tryGetMessageFromRemote(message, channels);
-}
-
-void MessagePortChannel::close()
-{
-    m_channel->close();
-}
-
-bool MessagePortChannel::isConnectedTo(MessagePort* port)
-{
-    return m_channel->isConnectedTo(port);
-}
-
-bool MessagePortChannel::hasPendingActivity()
-{
-    return m_channel->hasPendingActivity();
-}
-
-MessagePort* MessagePortChannel::locallyEntangledPort(const ScriptExecutionContext* context)
-{
-    // This is just an optimization, so return 0 always.
-    return 0;
-}
-
-
-PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::create()
-{
-    return adoptRef(new PlatformMessagePortChannel());
-}
-
-PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::create(
-    WebKit::WebMessagePortChannel* channel)
-{
-    return adoptRef(new PlatformMessagePortChannel(channel));
-}
-
-
-PlatformMessagePortChannel::PlatformMessagePortChannel()
-    : m_localPort(0)
-{
-    m_webChannel = WebKit::Platform::current()->createMessagePortChannel();
-    if (m_webChannel)
-        m_webChannel->setClient(this);
-}
-
-PlatformMessagePortChannel::PlatformMessagePortChannel(WebKit::WebMessagePortChannel* channel)
-    : m_localPort(0)
-    , m_webChannel(channel)
-{
-}
-
-PlatformMessagePortChannel::~PlatformMessagePortChannel()
-{
-    if (m_webChannel)
-        m_webChannel->destroy();
-}
-
-void PlatformMessagePortChannel::createChannel(PassRefPtr<MessagePort> port1, PassRefPtr<MessagePort> port2)
-{
-    // Create proxies for each endpoint.
-    RefPtr<PlatformMessagePortChannel> channel1 = PlatformMessagePortChannel::create();
-    RefPtr<PlatformMessagePortChannel> channel2 = PlatformMessagePortChannel::create();
-
-    // Entangle the two endpoints.
-    channel1->setEntangledChannel(channel2);
-    channel2->setEntangledChannel(channel1);
-
-    // Now entangle the proxies with the appropriate local ports.
-    port1->entangle(MessagePortChannel::create(channel2));
-    port2->entangle(MessagePortChannel::create(channel1));
-}
-
-void PlatformMessagePortChannel::messageAvailable()
-{
-    MutexLocker lock(m_mutex);
-    if (m_localPort)
-        m_localPort->messageAvailable();
-}
-
-bool PlatformMessagePortChannel::entangleIfOpen(MessagePort* port)
-{
-    MutexLocker lock(m_mutex);
-    m_localPort = port;
-    return true;
-}
-
-void PlatformMessagePortChannel::disentangle()
-{
-    MutexLocker lock(m_mutex);
-    m_localPort = 0;
-}
-
-void PlatformMessagePortChannel::postMessageToRemote(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
-{
-    if (!m_localPort || !m_webChannel)
-        return;
-
-    WebKit::WebString messageString = message->toWireString();
-    WebKit::WebMessagePortChannelArray* webChannels = 0;
-    if (channels && channels->size()) {
-        webChannels = new WebKit::WebMessagePortChannelArray(channels->size());
-        for (size_t i = 0; i < channels->size(); ++i) {
-            PlatformMessagePortChannel* platformChannel = (*channels)[i]->channel();
-            (*webChannels)[i] = platformChannel->webChannelRelease();
-            (*webChannels)[i]->setClient(0);
-        }
-    }
-    m_webChannel->postMessage(messageString, webChannels);
-}
-
-bool PlatformMessagePortChannel::tryGetMessageFromRemote(RefPtr<SerializedScriptValue>& serializedMessage, OwnPtr<MessagePortChannelArray>& channels)
-{
-    if (!m_webChannel)
-        return false;
-
-    WebKit::WebString message;
-    WebKit::WebMessagePortChannelArray webChannels;
-    bool rv = m_webChannel->tryGetMessage(&message, webChannels);
-    if (rv) {
-        if (webChannels.size()) {
-            channels = adoptPtr(new MessagePortChannelArray(webChannels.size()));
-            for (size_t i = 0; i < webChannels.size(); ++i) {
-                RefPtr<PlatformMessagePortChannel> platformChannel = create(webChannels[i]);
-                webChannels[i]->setClient(platformChannel.get());
-                (*channels)[i] = MessagePortChannel::create(platformChannel);
-            }
-        }
-        serializedMessage = SerializedScriptValue::createFromWire(message);
-    }
-
-    return rv;
-}
-
-void PlatformMessagePortChannel::close()
-{
-    MutexLocker lock(m_mutex);
-    // Disentangle ourselves from the other end. We still maintain a reference to m_webChannel,
-    // since previously-existing messages should still be delivered.
-    m_localPort = 0;
-    m_entangledChannel = 0;
-}
-
-bool PlatformMessagePortChannel::isConnectedTo(MessagePort* port)
-{
-    MutexLocker lock(m_mutex);
-    return m_entangledChannel && m_entangledChannel->m_localPort == port;
-}
-
-bool PlatformMessagePortChannel::hasPendingActivity()
-{
-    MutexLocker lock(m_mutex);
-    return m_localPort;
-}
-
-void PlatformMessagePortChannel::setEntangledChannel(PassRefPtr<PlatformMessagePortChannel> remote)
-{
-    if (m_webChannel)
-        m_webChannel->entangle(remote->m_webChannel);
-
-    MutexLocker lock(m_mutex);
-    m_entangledChannel = remote;
-}
-
-WebKit::WebMessagePortChannel* PlatformMessagePortChannel::webChannelRelease()
-{
-    WebKit::WebMessagePortChannel* rv = m_webChannel;
-    m_webChannel = 0;
-    return rv;
-}
-
-} // namespace WebCore
diff --git a/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.h b/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.h
deleted file mode 100644
index 7c54ada..0000000
--- a/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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
- * 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 PlatformMessagePortChannelChromium_h
-#define PlatformMessagePortChannelChromium_h
-
-#include "core/dom/MessagePortChannel.h"
-#include "public/platform/WebMessagePortChannelClient.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/ThreadingPrimitives.h"
-
-namespace WebKit {
-class WebMessagePortChannel;
-}
-
-namespace WebCore {
-
-class MessagePort;
-
-// PlatformMessagePortChannel is a platform-dependent interface to the remote side of a message channel.
-class PlatformMessagePortChannel : public ThreadSafeRefCounted<PlatformMessagePortChannel>,
-    public WebKit::WebMessagePortChannelClient {
-public:
-    static void createChannel(PassRefPtr<MessagePort>, PassRefPtr<MessagePort>);
-    static PassRefPtr<PlatformMessagePortChannel> create();
-    static PassRefPtr<PlatformMessagePortChannel> create(WebKit::WebMessagePortChannel*);
-
-    // APIs delegated from core/dom/MessagePortChannel.h
-    bool entangleIfOpen(MessagePort*);
-    void disentangle();
-    void postMessageToRemote(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>);
-    bool tryGetMessageFromRemote(RefPtr<SerializedScriptValue>&, OwnPtr<MessagePortChannelArray>&);
-    void close();
-    bool isConnectedTo(MessagePort*);
-    bool hasPendingActivity();
-
-    // Releases ownership of the contained web channel.
-    WebKit::WebMessagePortChannel* webChannelRelease();
-
-    virtual ~PlatformMessagePortChannel();
-
-private:
-    PlatformMessagePortChannel();
-    PlatformMessagePortChannel(WebKit::WebMessagePortChannel*);
-
-    void setEntangledChannel(PassRefPtr<PlatformMessagePortChannel>);
-
-    // WebKit::WebMessagePortChannelClient implementation
-    virtual void messageAvailable();
-
-    // Mutex used to ensure exclusive access to the object internals.
-    Mutex m_mutex;
-
-    // Pointer to our entangled pair - cleared when close() is called.
-    RefPtr<PlatformMessagePortChannel> m_entangledChannel;
-
-    // The port we are connected to - this is the port that is notified when new messages arrive.
-    MessagePort* m_localPort;
-
-    WebKit::WebMessagePortChannel* m_webChannel;
-};
-
-} // namespace WebCore
-
-#endif // PlatformMessagePortChannelChromium_h
diff --git a/Source/core/dom/shadow/ElementShadow.cpp b/Source/core/dom/shadow/ElementShadow.cpp
index bebad50..757e808 100644
--- a/Source/core/dom/shadow/ElementShadow.cpp
+++ b/Source/core/dom/shadow/ElementShadow.cpp
@@ -38,6 +38,82 @@
 
 namespace WebCore {
 
+class DistributionPool {
+public:
+    explicit DistributionPool(const ContainerNode*);
+    ~DistributionPool();
+    void distributeTo(InsertionPoint*, ElementShadow*);
+
+private:
+    void populateChildren(const ContainerNode*);
+    void detachNonDistributedNodes();
+    Vector<Node*> m_nodes;
+    Vector<bool> m_distributed;
+};
+
+inline DistributionPool::DistributionPool(const ContainerNode* parent)
+{
+    if (parent)
+        populateChildren(parent);
+}
+
+inline void DistributionPool::populateChildren(const ContainerNode* parent)
+{
+    m_nodes.reserveInitialCapacity(32);
+    for (Node* child = parent->firstChild(); child; child = child->nextSibling()) {
+        if (isActiveInsertionPoint(child)) {
+            InsertionPoint* insertionPoint = toInsertionPoint(child);
+            if (insertionPoint->hasDistribution()) {
+                for (size_t i = 0; i < insertionPoint->size(); ++i)
+                    m_nodes.append(insertionPoint->at(i));
+            } else {
+                // Fallback elements.
+                for (Node* fallbackNode = insertionPoint->firstChild(); fallbackNode; fallbackNode = fallbackNode->nextSibling())
+                    m_nodes.append(fallbackNode);
+            }
+        } else {
+            m_nodes.append(child);
+        }
+    }
+    m_distributed.resize(m_nodes.size());
+    m_distributed.fill(false);
+}
+
+void DistributionPool::distributeTo(InsertionPoint* insertionPoint, ElementShadow* elementShadow)
+{
+    ContentDistribution distribution;
+
+    for (size_t i = 0; i < m_nodes.size(); ++i) {
+        if (m_distributed[i])
+            continue;
+
+        if (isHTMLContentElement(insertionPoint) && !toHTMLContentElement(insertionPoint)->canSelectNode(m_nodes, i))
+            continue;
+
+        Node* node = m_nodes[i];
+        distribution.append(node);
+        elementShadow->didDistributeNode(node, insertionPoint);
+        m_distributed[i] = true;
+    }
+
+    insertionPoint->setDistribution(distribution);
+}
+
+inline DistributionPool::~DistributionPool()
+{
+    detachNonDistributedNodes();
+}
+
+inline void DistributionPool::detachNonDistributedNodes()
+{
+    for (size_t i = 0; i < m_nodes.size(); ++i) {
+        if (m_distributed[i])
+            continue;
+        if (m_nodes[i]->renderer())
+            m_nodes[i]->lazyReattachIfAttached();
+    }
+}
+
 PassOwnPtr<ElementShadow> ElementShadow::create()
 {
     return adoptPtr(new ElementShadow());
@@ -85,7 +161,7 @@
         InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get());
         shadowHost->document().removeFocusedElementOfSubtree(oldRoot.get());
 
-        if (oldRoot->attached())
+        if (oldRoot->confusingAndOftenMisusedAttached())
             oldRoot->detach();
 
         m_shadowRoots.removeHead();
@@ -103,7 +179,7 @@
     childrenContext.resolvedStyle = 0;
 
     for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) {
-        if (!root->attached())
+        if (root->needsAttach())
             root->attach(childrenContext);
     }
 }
@@ -114,7 +190,7 @@
     childrenContext.resolvedStyle = 0;
 
     for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) {
-        if (root->attached())
+        if (root->confusingAndOftenMisusedAttached())
             root->detach(childrenContext);
     }
 }
@@ -174,35 +250,11 @@
     return m_nodeToInsertionPoint.get(key);
 }
 
-void ElementShadow::populate(Node* node, Vector<Node*>& pool)
-{
-    if (!isActiveInsertionPoint(node)) {
-        pool.append(node);
-        return;
-    }
-
-    InsertionPoint* insertionPoint = toInsertionPoint(node);
-    if (insertionPoint->hasDistribution()) {
-        for (size_t i = 0; i < insertionPoint->size(); ++i)
-            pool.append(insertionPoint->at(i));
-    } else {
-        for (Node* fallbackNode = insertionPoint->firstChild(); fallbackNode; fallbackNode = fallbackNode->nextSibling())
-            pool.append(fallbackNode);
-    }
-}
-
 void ElementShadow::distribute()
 {
-    Vector<Node*> pool;
-    pool.reserveInitialCapacity(32);
-    for (Node* node = host()->firstChild(); node; node = node->nextSibling())
-        populate(node, pool);
-
+    DistributionPool pool(host());
     host()->setNeedsStyleRecalc();
 
-    Vector<bool> distributed;
-    distributed.fill(false, pool.size());
-
     Vector<HTMLShadowElement*, 32> activeShadowInsertionPoints;
     for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) {
         HTMLShadowElement* firstActiveShadowInsertionPoint = 0;
@@ -217,7 +269,7 @@
                 if (!firstActiveShadowInsertionPoint)
                     firstActiveShadowInsertionPoint = toHTMLShadowElement(point);
             } else {
-                distributeSelectionsTo(point, pool, distributed);
+                pool.distributeTo(point, this);
                 if (ElementShadow* shadow = shadowOfParentForDistribution(point))
                     shadow->setNeedsDistributionRecalc();
             }
@@ -240,66 +292,22 @@
             // There's assumed to always be a UA shadow that selects all nodes.
             // We don't actually add it, instead we just distribute the pool to the
             // <shadow> in the oldest shadow root.
-            distributeSelectionsTo(shadowElement, pool, distributed);
+            pool.distributeTo(shadowElement, this);
         }
         if (ElementShadow* shadow = shadowOfParentForDistribution(shadowElement))
             shadow->setNeedsDistributionRecalc();
     }
-
-    // Detach all nodes that were not distributed and have a renderer.
-    for (size_t i = 0; i < pool.size(); ++i) {
-        if (distributed[i])
-            continue;
-        if (pool[i]->renderer())
-            pool[i]->lazyReattachIfAttached();
-    }
 }
 
-void ElementShadow::distributeSelectionsTo(InsertionPoint* insertionPoint, const Vector<Node*>& pool, Vector<bool>& distributed)
+void ElementShadow::didDistributeNode(const Node* node, InsertionPoint* insertionPoint)
 {
-    ContentDistribution distribution;
-
-    for (size_t i = 0; i < pool.size(); ++i) {
-        if (distributed[i])
-            continue;
-
-        if (isHTMLContentElement(insertionPoint) && !toHTMLContentElement(insertionPoint)->canSelectNode(pool, i))
-            continue;
-
-        Node* child = pool[i];
-        distribution.append(child);
-        m_nodeToInsertionPoint.add(child, insertionPoint);
-        distributed[i] = true;
-    }
-
-    insertionPoint->setDistribution(distribution);
+    m_nodeToInsertionPoint.add(node, insertionPoint);
 }
 
 void ElementShadow::distributeNodeChildrenTo(InsertionPoint* insertionPoint, ContainerNode* containerNode)
 {
-    ContentDistribution distribution;
-    for (Node* node = containerNode->firstChild(); node; node = node->nextSibling()) {
-        if (isActiveInsertionPoint(node)) {
-            InsertionPoint* innerInsertionPoint = toInsertionPoint(node);
-            if (innerInsertionPoint->hasDistribution()) {
-                for (size_t i = 0; i < innerInsertionPoint->size(); ++i) {
-                    Node* nodeToAdd = innerInsertionPoint->at(i);
-                    distribution.append(nodeToAdd);
-                    m_nodeToInsertionPoint.add(nodeToAdd, insertionPoint);
-                }
-            } else {
-                for (Node* child = innerInsertionPoint->firstChild(); child; child = child->nextSibling()) {
-                    distribution.append(child);
-                    m_nodeToInsertionPoint.add(child, insertionPoint);
-                }
-            }
-        } else {
-            distribution.append(node);
-            m_nodeToInsertionPoint.add(node, insertionPoint);
-        }
-    }
-
-    insertionPoint->setDistribution(distribution);
+    DistributionPool pool(containerNode);
+    pool.distributeTo(insertionPoint, this);
 }
 
 const SelectRuleFeatureSet& ElementShadow::ensureSelectFeatureSet()
diff --git a/Source/core/dom/shadow/ElementShadow.h b/Source/core/dom/shadow/ElementShadow.h
index 8ac38e9..1e915a3 100644
--- a/Source/core/dom/shadow/ElementShadow.h
+++ b/Source/core/dom/shadow/ElementShadow.h
@@ -71,6 +71,8 @@
 
     InsertionPoint* findInsertionPointFor(const Node*) const;
 
+    void didDistributeNode(const Node*, InsertionPoint*);
+
 private:
     ElementShadow();
 
@@ -79,9 +81,7 @@
 
     void distribute();
     void clearDistribution();
-    void populate(Node*, Vector<Node*>&);
     void collectSelectFeatureSetFrom(ShadowRoot*);
-    void distributeSelectionsTo(InsertionPoint*, const Vector<Node*>& pool, Vector<bool>& distributed);
     void distributeNodeChildrenTo(InsertionPoint*, ContainerNode*);
 
     bool needsSelectFeatureSet() const { return m_needsSelectFeatureSet; }
diff --git a/Source/core/dom/shadow/InsertionPoint.cpp b/Source/core/dom/shadow/InsertionPoint.cpp
index 7d05daa..673d040 100644
--- a/Source/core/dom/shadow/InsertionPoint.cpp
+++ b/Source/core/dom/shadow/InsertionPoint.cpp
@@ -100,7 +100,7 @@
     // FIXME: This loop shouldn't be needed since the distributed nodes should
     // never be detached, we can probably remove it.
     for (size_t i = 0; i < m_distribution.size(); ++i) {
-        if (!m_distribution.at(i)->attached())
+        if (m_distribution.at(i)->needsAttach())
             m_distribution.at(i)->attach(context);
     }
 
@@ -222,7 +222,7 @@
 void InsertionPoint::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (name == reset_style_inheritanceAttr) {
-        if (!inDocument() || !attached() || !isActive())
+        if (!inDocument() || !confusingAndOftenMisusedAttached() || !isActive())
             return;
         containingShadowRoot()->host()->setNeedsStyleRecalc();
     } else
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp
index bb0f5a1..b438adb 100644
--- a/Source/core/dom/shadow/ShadowRoot.cpp
+++ b/Source/core/dom/shadow/ShadowRoot.cpp
@@ -29,10 +29,12 @@
 
 #include "bindings/v8/ExceptionMessages.h"
 #include "bindings/v8/ExceptionState.h"
+#include "core/css/StyleSheetList.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/ElementTraversal.h"
 #include "core/dom/StyleEngine.h"
 #include "core/dom/Text.h"
+#include "core/dom/WhitespaceChildList.h"
 #include "core/dom/shadow/ElementShadow.h"
 #include "core/dom/shadow/InsertionPoint.h"
 #include "core/dom/shadow/ShadowRootRareData.h"
@@ -80,6 +82,9 @@
     ASSERT(!m_prev);
     ASSERT(!m_next);
 
+    if (m_shadowRootRareData && m_shadowRootRareData->styleSheets())
+        m_shadowRootRareData->styleSheets()->detachFromDocument();
+
     documentInternal()->styleEngine()->didRemoveShadowRoot(this);
 
     // We cannot let ContainerNode destructor call willBeDeletedFrom()
@@ -166,7 +171,7 @@
     StyleResolver* styleResolver = document().styleResolver();
     styleResolver->pushParentShadowRoot(*this);
 
-    if (!attached()) {
+    if (!confusingAndOftenMisusedAttached()) {
         attach();
         return;
     }
@@ -178,25 +183,21 @@
         change = Force;
 
     // FIXME: This doesn't handle :hover + div properly like Element::recalcStyle does.
-    bool forceReattachOfAnyWhitespaceSibling = false;
-    for (Node* child = firstChild(); child; child = child->nextSibling()) {
-        bool didReattach = false;
-
-        if (child->renderer())
-            forceReattachOfAnyWhitespaceSibling = false;
-
+    WhitespaceChildList whitespaceChildList(change);
+    for (Node* child = lastChild(); child; child = child->previousSibling()) {
         if (child->isTextNode()) {
-            if (forceReattachOfAnyWhitespaceSibling && toText(child)->containsOnlyWhitespace())
-                child->reattach();
+            Text* textChild = toText(child);
+            if (textChild->containsOnlyWhitespace())
+                whitespaceChildList.append(textChild);
             else
-                didReattach = toText(child)->recalcTextStyle(change);
+                textChild->recalcTextStyle(change);
         } else if (child->isElementNode() && shouldRecalcStyle(change, child)) {
-            didReattach = toElement(child)->recalcStyle(change);
+            toElement(child)->recalcStyle(change);
         }
-
-        forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyWhitespaceSibling;
     }
 
+    whitespaceChildList.recalcStyle();
+
     styleResolver->popParentShadowRoot(*this);
     clearNeedsStyleRecalc();
     clearChildNeedsStyleRecalc();
@@ -411,4 +412,12 @@
     return m_shadowRootRareData->childInsertionPoints();
 }
 
+StyleSheetList* ShadowRoot::styleSheets()
+{
+    if (!ensureShadowRootRareData()->styleSheets())
+        m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this));
+
+    return m_shadowRootRareData->styleSheets();
+}
+
 }
diff --git a/Source/core/dom/shadow/ShadowRoot.h b/Source/core/dom/shadow/ShadowRoot.h
index 99bdf97..738c7be 100644
--- a/Source/core/dom/shadow/ShadowRoot.h
+++ b/Source/core/dom/shadow/ShadowRoot.h
@@ -60,21 +60,10 @@
 
     void recalcStyle(StyleRecalcChange);
 
-    bool applyAuthorStyles() const { return m_applyAuthorStyles; }
-    void setApplyAuthorStyles(bool);
-    bool resetStyleInheritance() const { return m_resetStyleInheritance; }
-    void setResetStyleInheritance(bool);
-
     Element* host() const { return toElement(parentOrShadowHostNode()); }
     ElementShadow* owner() const { return host() ? host()->shadow() : 0; }
 
-    String innerHTML() const;
-    void setInnerHTML(const String&, ExceptionState&);
-
-    Element* activeElement() const;
-
     ShadowRoot* youngerShadowRoot() const { return prev(); }
-    ShadowRoot* olderShadowRoot() const { return next(); }
 
     ShadowRoot* bindingsOlderShadowRoot() const;
     bool shouldExposeToBindings() const { return type() == AuthorShadowRoot; }
@@ -108,9 +97,25 @@
 
     ShadowRootType type() const { return static_cast<ShadowRootType>(m_type); }
 
+public:
+    Element* activeElement() const;
+
+    bool applyAuthorStyles() const { return m_applyAuthorStyles; }
+    void setApplyAuthorStyles(bool);
+
+    bool resetStyleInheritance() const { return m_resetStyleInheritance; }
+    void setResetStyleInheritance(bool);
+
+    ShadowRoot* olderShadowRoot() const { return next(); }
+
+    String innerHTML() const;
+    void setInnerHTML(const String&, ExceptionState&);
+
     PassRefPtr<Node> cloneNode(bool, ExceptionState&);
     PassRefPtr<Node> cloneNode(ExceptionState& es) { return cloneNode(true, es); }
 
+    StyleSheetList* styleSheets();
+
 private:
     ShadowRoot(Document*, ShadowRootType);
     virtual ~ShadowRoot();
diff --git a/Source/core/dom/shadow/ShadowRoot.idl b/Source/core/dom/shadow/ShadowRoot.idl
index 105c008..502f939 100644
--- a/Source/core/dom/shadow/ShadowRoot.idl
+++ b/Source/core/dom/shadow/ShadowRoot.idl
@@ -30,9 +30,9 @@
     readonly attribute Element activeElement;
     attribute boolean applyAuthorStyles;
     attribute boolean resetStyleInheritance;
-    [EnabledAtRuntime=ShadowDOM, ImplementedAs=bindingsOlderShadowRoot] readonly attribute ShadowRoot olderShadowRoot;
+    [RuntimeEnabled=ShadowDOM, ImplementedAs=bindingsOlderShadowRoot] readonly attribute ShadowRoot olderShadowRoot;
 
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds, SetterRaisesException] attribute DOMString innerHTML;
+    [TreatNullAs=NullString, CustomElementCallbacks, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds, SetterRaisesException] attribute DOMString innerHTML;
 
     [RaisesException] Node cloneNode([Default=Undefined] optional boolean deep);
     Selection getSelection();
@@ -44,4 +44,6 @@
 
     Element elementFromPoint([Default=Undefined] optional long x,
                              [Default=Undefined] optional long y);
+
+    [RuntimeEnabled=ShadowDOM] readonly attribute StyleSheetList styleSheets;
 };
diff --git a/Source/core/dom/shadow/ShadowRootRareData.h b/Source/core/dom/shadow/ShadowRootRareData.h
index 3a0966d..df74d2b 100644
--- a/Source/core/dom/shadow/ShadowRootRareData.h
+++ b/Source/core/dom/shadow/ShadowRootRareData.h
@@ -67,12 +67,16 @@
     void setChildInsertionPoints(Vector<RefPtr<InsertionPoint> >& list) { m_childInsertionPoints.swap(list); }
     void clearChildInsertionPoints() { m_childInsertionPoints.clear(); }
 
+    StyleSheetList* styleSheets() { return m_styleSheetList.get(); }
+    void setStyleSheets(PassRefPtr<StyleSheetList> styleSheetList) { m_styleSheetList = styleSheetList; }
+
 private:
     RefPtr<InsertionPoint> m_insertionPoint;
     unsigned m_childShadowElementCount;
     unsigned m_childContentElementCount;
     unsigned m_childShadowRootCount;
     Vector<RefPtr<InsertionPoint> > m_childInsertionPoints;
+    RefPtr<StyleSheetList> m_styleSheetList;
 };
 
 inline void ShadowRootRareData::addInsertionPoint(InsertionPoint* point)
diff --git a/Source/core/editing/AppendNodeCommand.cpp b/Source/core/editing/AppendNodeCommand.cpp
index e8047c9..4d4d59e 100644
--- a/Source/core/editing/AppendNodeCommand.cpp
+++ b/Source/core/editing/AppendNodeCommand.cpp
@@ -40,12 +40,12 @@
     ASSERT(m_node);
     ASSERT(!m_node->parentNode());
 
-    ASSERT(m_parent->rendererIsEditable() || !m_parent->attached());
+    ASSERT(m_parent->rendererIsEditable() || !m_parent->confusingAndOftenMisusedAttached());
 }
 
 void AppendNodeCommand::doApply()
 {
-    if (!m_parent->rendererIsEditable() && m_parent->attached())
+    if (!m_parent->rendererIsEditable() && m_parent->confusingAndOftenMisusedAttached())
         return;
 
     m_parent->appendChild(m_node.get(), IGNORE_EXCEPTION);
diff --git a/Source/core/editing/ApplyBlockElementCommand.cpp b/Source/core/editing/ApplyBlockElementCommand.cpp
index 938ee5b..5c4166d 100644
--- a/Source/core/editing/ApplyBlockElementCommand.cpp
+++ b/Source/core/editing/ApplyBlockElementCommand.cpp
@@ -129,7 +129,6 @@
         rangeForParagraphSplittingTextNodesIfNeeded(endOfCurrentParagraph, start, end);
         endOfCurrentParagraph = end;
 
-        Position afterEnd = end.next();
         Node* enclosingCell = enclosingNodeOfType(start, &isTableCell);
         VisiblePosition endOfNextParagraph = endOfNextParagrahSplittingTextNodesIfNeeded(endOfCurrentParagraph, start, end);
 
@@ -146,11 +145,9 @@
         if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent().inDocument())
             break;
         // Sanity check: Make sure our moveParagraph calls didn't remove endOfNextParagraph.deepEquivalent().deprecatedNode()
-        // If somehow we did, return to prevent crashes.
-        if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().inDocument()) {
-            ASSERT_NOT_REACHED();
+        // If somehow, e.g. mutation event handler, we did, return to prevent crashes.
+        if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().inDocument())
             return;
-        }
         endOfCurrentParagraph = endOfNextParagraph;
     }
 }
diff --git a/Source/core/editing/ApplyStyleCommand.cpp b/Source/core/editing/ApplyStyleCommand.cpp
index ba5921b..33a153a 100644
--- a/Source/core/editing/ApplyStyleCommand.cpp
+++ b/Source/core/editing/ApplyStyleCommand.cpp
@@ -1404,7 +1404,6 @@
 Position ApplyStyleCommand::positionToComputeInlineStyleChange(PassRefPtr<Node> startNode, RefPtr<Node>& dummyElement)
 {
     // It's okay to obtain the style at the startNode because we've removed all relevant styles from the current run.
-    Position positionForStyleComparison;
     if (!startNode->isElementNode()) {
         dummyElement = createStyleSpanElement(document());
         insertNodeAt(dummyElement, positionBeforeNode(startNode.get()));
diff --git a/Source/core/editing/Caret.cpp b/Source/core/editing/Caret.cpp
index d1cb061..258d7e1 100644
--- a/Source/core/editing/Caret.cpp
+++ b/Source/core/editing/Caret.cpp
@@ -28,7 +28,7 @@
 
 #include "core/dom/Document.h"
 #include "core/editing/htmlediting.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/RenderView.h"
diff --git a/Source/core/editing/Caret.h b/Source/core/editing/Caret.h
index 5e2c61c..02eb02f 100644
--- a/Source/core/editing/Caret.h
+++ b/Source/core/editing/Caret.h
@@ -27,8 +27,8 @@
 #define Caret_h
 
 #include "core/editing/VisiblePosition.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/Noncopyable.h"
 
 namespace WebCore {
diff --git a/Source/core/editing/CompositeEditCommand.cpp b/Source/core/editing/CompositeEditCommand.cpp
index db18b11..0f5cb1b 100644
--- a/Source/core/editing/CompositeEditCommand.cpp
+++ b/Source/core/editing/CompositeEditCommand.cpp
@@ -51,6 +51,7 @@
 #include "core/editing/ReplaceNodeWithSpanCommand.h"
 #include "core/editing/ReplaceSelectionCommand.h"
 #include "core/editing/SetNodeAttributeCommand.h"
+#include "core/editing/SpellChecker.h"
 #include "core/editing/SplitElementCommand.h"
 #include "core/editing/SplitTextNodeCommand.h"
 #include "core/editing/SplitTextNodeContainingElementCommand.h"
@@ -60,7 +61,7 @@
 #include "core/editing/htmlediting.h"
 #include "core/editing/markup.h"
 #include "core/html/HTMLElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/InlineTextBox.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/RenderText.h"
@@ -675,7 +676,7 @@
 
     // Delete collapsed whitespace so that inserting nbsps doesn't uncollapse it.
     Position upstreamPos = position.upstream();
-    deleteInsignificantText(position.upstream(), position.downstream());
+    deleteInsignificantText(upstreamPos, position.downstream());
     position = upstreamPos.downstream();
 
     VisiblePosition visiblePos(position);
@@ -1195,7 +1196,7 @@
     // FIXME (5098931): We should add a new insert action "WebViewInsertActionMoved" and call shouldInsertFragment here.
 
     setEndingSelection(VisibleSelection(start, end, DOWNSTREAM));
-    document().frame()->editor().clearMisspellingsAndBadGrammar(endingSelection());
+    document().frame()->spellChecker().clearMisspellingsAndBadGrammar(endingSelection());
     deleteSelection(false, false, false, false);
 
     ASSERT(destination.deepEquivalent().inDocument());
@@ -1228,7 +1229,7 @@
         options |= ReplaceSelectionCommand::MatchStyle;
     applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment, options));
 
-    document().frame()->editor().markMisspellingsAndBadGrammar(endingSelection());
+    document().frame()->spellChecker().markMisspellingsAndBadGrammar(endingSelection());
 
     // If the selection is in an empty paragraph, restore styles from the old empty paragraph to the new empty paragraph.
     bool selectionIsEmptyParagraph = endingSelection().isCaret() && isStartOfParagraph(endingSelection().visibleStart()) && isEndOfParagraph(endingSelection().visibleStart());
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index adf8e06..62c7004 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -37,7 +37,7 @@
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLTableElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderTableCell.h"
 
 namespace WebCore {
@@ -292,7 +292,7 @@
         return;
 
     // Figure out the typing style in effect before the delete is done.
-    m_typingStyle = EditingStyle::create(m_selectionToDelete.start());
+    m_typingStyle = EditingStyle::create(m_selectionToDelete.start(), EditingStyle::EditingPropertiesInEffect);
     m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDelete.start()));
 
     // If we're deleting into a Mail blockquote, save the style at end() instead of start()
diff --git a/Source/core/editing/EditCommand.cpp b/Source/core/editing/EditCommand.cpp
index 7fdf04e..4b318f7 100644
--- a/Source/core/editing/EditCommand.cpp
+++ b/Source/core/editing/EditCommand.cpp
@@ -30,7 +30,7 @@
 #include "core/dom/NodeTraversal.h"
 #include "core/editing/CompositeEditCommand.h"
 #include "core/editing/FrameSelection.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/EditingStyle.cpp b/Source/core/editing/EditingStyle.cpp
index a06a083..ef5af48 100644
--- a/Source/core/editing/EditingStyle.cpp
+++ b/Source/core/editing/EditingStyle.cpp
@@ -50,7 +50,7 @@
 #include "core/editing/HTMLInterchange.h"
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLFontElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/RuntimeCSSEnabled.h"
 #include "core/rendering/style/RenderStyle.h"
 
diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp
index c185151..e80f95c 100644
--- a/Source/core/editing/Editor.cpp
+++ b/Source/core/editing/Editor.cpp
@@ -34,15 +34,12 @@
 #include "core/css/CSSComputedStyleDeclaration.h"
 #include "core/css/StylePropertySet.h"
 #include "core/dom/Clipboard.h"
-#include "core/events/ClipboardEvent.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/DocumentMarkerController.h"
-#include "core/events/EventNames.h"
-#include "core/events/KeyboardEvent.h"
 #include "core/dom/NodeList.h"
 #include "core/dom/NodeTraversal.h"
+#include "core/dom/ParserContentPolicy.h"
 #include "core/dom/Text.h"
-#include "core/events/TextEvent.h"
 #include "core/editing/ApplyStyleCommand.h"
 #include "core/editing/DeleteSelectionCommand.h"
 #include "core/editing/IndentOutdentCommand.h"
@@ -53,13 +50,17 @@
 #include "core/editing/RenderedPosition.h"
 #include "core/editing/ReplaceSelectionCommand.h"
 #include "core/editing/SimplifyMarkupCommand.h"
-#include "core/editing/SpellCheckRequester.h"
-#include "core/editing/TextCheckingHelper.h"
+#include "core/editing/SpellChecker.h"
 #include "core/editing/TextIterator.h"
 #include "core/editing/TypingCommand.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
 #include "core/editing/markup.h"
+#include "core/events/ClipboardEvent.h"
+#include "core/events/KeyboardEvent.h"
+#include "core/events/ScopedEventQueue.h"
+#include "core/events/TextEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/fetch/ResourceFetcher.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/html/HTMLInputElement.h"
@@ -68,19 +69,14 @@
 #include "core/page/EditorClient.h"
 #include "core/page/EventHandler.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/KillRing.h"
 #include "core/platform/Pasteboard.h"
-#include "core/platform/Sound.h"
 #include "core/platform/chromium/ChromiumDataObject.h"
-#include "core/platform/chromium/ClipboardChromium.h"
-#include "core/platform/text/TextCheckerClient.h"
 #include "core/rendering/HitTestResult.h"
-#include "core/rendering/RenderBlock.h"
-#include "core/rendering/RenderTextControl.h"
 #include "wtf/unicode/CharacterNames.h"
 
 namespace WebCore {
@@ -101,24 +97,14 @@
     ASSERT(m_editor->m_preventRevealSelection);
     --m_editor->m_preventRevealSelection;
     if (!m_editor->m_preventRevealSelection)
-        m_editor->m_frame->selection().revealSelection(ScrollAlignment::alignToEdgeIfNeeded, RevealExtent);
+        m_editor->m_frame.selection().revealSelection(ScrollAlignment::alignToEdgeIfNeeded, RevealExtent);
 }
 
-namespace {
-
-bool isSelectionInTextField(const VisibleSelection& selection)
-{
-    HTMLTextFormControlElement* textControl = enclosingTextFormControl(selection.start());
-    return textControl && textControl->hasTagName(inputTag) && toHTMLInputElement(textControl)->isTextField();
-}
-
-} // namespace
-
 // When an event handler has moved the selection outside of a text control
 // we should use the target control's selection for this editing operation.
 VisibleSelection Editor::selectionForCommand(Event* event)
 {
-    VisibleSelection selection = m_frame->selection().selection();
+    VisibleSelection selection = m_frame.selection().selection();
     if (!event)
         return selection;
     // If the target is a text control, and the current selection is outside of its shadow tree,
@@ -135,10 +121,10 @@
 // Function considers Mac editing behavior a fallback when Page or Settings is not available.
 EditingBehavior Editor::behavior() const
 {
-    if (!m_frame || !m_frame->settings())
+    if (!m_frame.settings())
         return EditingBehavior(EditingMacBehavior);
 
-    return EditingBehavior(m_frame->settings()->editingBehaviorType());
+    return EditingBehavior(m_frame.settings()->editingBehaviorType());
 }
 
 static EditorClient& emptyEditorClient()
@@ -149,16 +135,11 @@
 
 EditorClient& Editor::client() const
 {
-    if (Page* page = m_frame->page())
+    if (Page* page = m_frame.page())
         return page->editorClient();
     return emptyEditorClient();
 }
 
-TextCheckerClient& Editor::textChecker() const
-{
-    return client().textChecker();
-}
-
 void Editor::handleKeyboardEvent(KeyboardEvent* event)
 {
     client().handleKeyboardEvent(event);
@@ -191,32 +172,32 @@
 
 bool Editor::canEdit() const
 {
-    return m_frame->selection().rootEditableElement();
+    return m_frame.selection().rootEditableElement();
 }
 
 bool Editor::canEditRichly() const
 {
-    return m_frame->selection().isContentRichlyEditable();
+    return m_frame.selection().isContentRichlyEditable();
 }
 
-// WinIE uses onbeforecut and onbeforepaste to enables the cut and paste menu items.  They
+// WinIE uses onbeforecut and onbeforepaste to enables the cut and paste menu items. They
 // also send onbeforecopy, apparently for symmetry, but it doesn't affect the menu items.
 // We need to use onbeforecopy as a real menu enabler because we allow elements that are not
 // normally selectable to implement copy/paste (like divs, or a document body).
 
 bool Editor::canDHTMLCut()
 {
-    return !m_frame->selection().isInPasswordField() && !dispatchCPPEvent(eventNames().beforecutEvent, ClipboardNumb);
+    return !m_frame.selection().isInPasswordField() && !dispatchCPPEvent(EventTypeNames::beforecut, ClipboardNumb);
 }
 
 bool Editor::canDHTMLCopy()
 {
-    return !m_frame->selection().isInPasswordField() && !dispatchCPPEvent(eventNames().beforecopyEvent, ClipboardNumb);
+    return !m_frame.selection().isInPasswordField() && !dispatchCPPEvent(EventTypeNames::beforecopy, ClipboardNumb);
 }
 
 bool Editor::canDHTMLPaste()
 {
-    return !dispatchCPPEvent(eventNames().beforepasteEvent, ClipboardNumb);
+    return !dispatchCPPEvent(EventTypeNames::beforepaste, ClipboardNumb);
 }
 
 bool Editor::canCut() const
@@ -245,9 +226,9 @@
 
 bool Editor::canCopy() const
 {
-    if (imageElementFromImageDocument(m_frame->document()))
+    if (imageElementFromImageDocument(m_frame.document()))
         return true;
-    FrameSelection& selection = m_frame->selection();
+    FrameSelection& selection = m_frame.selection();
     return selection.isRange() && !selection.isInPasswordField();
 }
 
@@ -258,7 +239,7 @@
 
 bool Editor::canDelete() const
 {
-    FrameSelection& selection = m_frame->selection();
+    FrameSelection& selection = m_frame.selection();
     return selection.isRange() && selection.rootEditableElement();
 }
 
@@ -289,7 +270,7 @@
 
 bool Editor::canSmartCopyOrDelete()
 {
-    return client().smartInsertDeleteEnabled() && m_frame->selection().granularity() == WordGranularity;
+    return client().smartInsertDeleteEnabled() && m_frame.selection().granularity() == WordGranularity;
 }
 
 bool Editor::isSelectTrailingWhitespaceEnabled()
@@ -302,10 +283,10 @@
     if (!canEdit())
         return false;
 
-    if (m_frame->selection().isRange()) {
+    if (m_frame.selection().isRange()) {
         if (isTypingAction) {
-            ASSERT(m_frame->document());
-            TypingCommand::deleteKeyPressed(*m_frame->document(), canSmartCopyOrDelete() ? TypingCommand::SmartDelete : 0, granularity);
+            ASSERT(m_frame.document());
+            TypingCommand::deleteKeyPressed(*m_frame.document(), canSmartCopyOrDelete() ? TypingCommand::SmartDelete : 0, granularity);
             revealSelectionAfterEditingOperation();
         } else {
             if (killRing)
@@ -322,13 +303,13 @@
         switch (direction) {
         case DirectionForward:
         case DirectionRight:
-            ASSERT(m_frame->document());
-            TypingCommand::forwardDeleteKeyPressed(*m_frame->document(), options, granularity);
+            ASSERT(m_frame.document());
+            TypingCommand::forwardDeleteKeyPressed(*m_frame.document(), options, granularity);
             break;
         case DirectionBackward:
         case DirectionLeft:
-            ASSERT(m_frame->document());
-            TypingCommand::deleteKeyPressed(*m_frame->document(), options, granularity);
+            ASSERT(m_frame.document());
+            TypingCommand::deleteKeyPressed(*m_frame.document(), options, granularity);
             break;
         }
         revealSelectionAfterEditingOperation();
@@ -345,11 +326,11 @@
 
 void Editor::deleteSelectionWithSmartDelete(bool smartDelete)
 {
-    if (m_frame->selection().isNone())
+    if (m_frame.selection().isNone())
         return;
 
-    ASSERT(m_frame->document());
-    DeleteSelectionCommand::create(*m_frame->document(), smartDelete)->apply();
+    ASSERT(m_frame.document());
+    DeleteSelectionCommand::create(*m_frame.document(), smartDelete)->apply();
 }
 
 void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace)
@@ -357,7 +338,7 @@
     Node* target = findEventTargetFromSelection();
     if (!target)
         return;
-    target->dispatchEvent(TextEvent::createForPlainTextPaste(m_frame->domWindow(), pastingText, smartReplace), IGNORE_EXCEPTION);
+    target->dispatchEvent(TextEvent::createForPlainTextPaste(m_frame.domWindow(), pastingText, smartReplace), IGNORE_EXCEPTION);
 }
 
 void Editor::pasteAsFragment(PassRefPtr<DocumentFragment> pastingFragment, bool smartReplace, bool matchStyle)
@@ -365,43 +346,62 @@
     Node* target = findEventTargetFromSelection();
     if (!target)
         return;
-    target->dispatchEvent(TextEvent::createForFragmentPaste(m_frame->domWindow(), pastingFragment, smartReplace, matchStyle), IGNORE_EXCEPTION);
+    target->dispatchEvent(TextEvent::createForFragmentPaste(m_frame.domWindow(), pastingFragment, smartReplace, matchStyle), IGNORE_EXCEPTION);
 }
 
 bool Editor::tryDHTMLCopy()
 {
-    if (m_frame->selection().isInPasswordField())
+    if (m_frame.selection().isInPasswordField())
         return false;
 
-    return !dispatchCPPEvent(eventNames().copyEvent, ClipboardWritable);
+    return !dispatchCPPEvent(EventTypeNames::copy, ClipboardWritable);
 }
 
 bool Editor::tryDHTMLCut()
 {
-    if (m_frame->selection().isInPasswordField())
+    if (m_frame.selection().isInPasswordField())
         return false;
 
-    return !dispatchCPPEvent(eventNames().cutEvent, ClipboardWritable);
+    return !dispatchCPPEvent(EventTypeNames::cut, ClipboardWritable);
 }
 
 bool Editor::tryDHTMLPaste(PasteMode pasteMode)
 {
-    return !dispatchCPPEvent(eventNames().pasteEvent, ClipboardReadable, pasteMode);
+    return !dispatchCPPEvent(EventTypeNames::paste, ClipboardReadable, pasteMode);
 }
 
 void Editor::pasteAsPlainTextWithPasteboard(Pasteboard* pasteboard)
 {
     String text = pasteboard->plainText();
-    if (client().shouldInsertText(text, selectedRange().get(), EditorInsertActionPasted))
-        pasteAsPlainText(text, canSmartReplaceWithPasteboard(pasteboard));
+    pasteAsPlainText(text, canSmartReplaceWithPasteboard(pasteboard));
 }
 
-void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText)
+void Editor::pasteWithPasteboard(Pasteboard* pasteboard)
 {
     RefPtr<Range> range = selectedRange();
-    bool chosePlainText;
-    RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(m_frame, range, allowPlainText, chosePlainText);
-    if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted))
+    RefPtr<DocumentFragment> fragment;
+    bool chosePlainText = false;
+
+    if (pasteboard->isHTMLAvailable()) {
+        unsigned fragmentStart = 0;
+        unsigned fragmentEnd = 0;
+        KURL url;
+        String markup = pasteboard->readHTML(url, fragmentStart, fragmentEnd);
+        if (!markup.isEmpty()) {
+            ASSERT(m_frame.document());
+            fragment = createFragmentFromMarkupWithContext(*m_frame.document(), markup, fragmentStart, fragmentEnd, url, DisallowScriptingAndPluginContent);
+        }
+    }
+
+    if (!fragment) {
+        String text = pasteboard->plainText();
+        if (!text.isEmpty()) {
+            chosePlainText = true;
+            fragment = createFragmentFromText(range.get(), text);
+        }
+    }
+
+    if (fragment)
         pasteAsFragment(fragment, canSmartReplaceWithPasteboard(pasteboard), chosePlainText);
 }
 
@@ -413,19 +413,18 @@
     if (!target)
         return true;
 
-    RefPtr<Clipboard> clipboard = ClipboardChromium::create(
+    RefPtr<Clipboard> clipboard = Clipboard::create(
         Clipboard::CopyAndPaste,
+        policy,
         policy == ClipboardWritable
             ? ChromiumDataObject::create()
-            : ChromiumDataObject::createFromPasteboard(pasteMode),
-        policy,
-        m_frame);
+            : ChromiumDataObject::createFromPasteboard(pasteMode));
 
     RefPtr<Event> evt = ClipboardEvent::create(eventType, true, true, clipboard);
     target->dispatchEvent(evt, IGNORE_EXCEPTION);
     bool noDefaultProcessing = evt->defaultPrevented();
     if (noDefaultProcessing && policy == ClipboardWritable) {
-        RefPtr<ChromiumDataObject> dataObject = static_cast<ClipboardChromium*>(clipboard.get())->dataObject();
+        RefPtr<ChromiumDataObject> dataObject = clipboard->dataObject();
         Pasteboard::generalPasteboard()->writeDataObject(dataObject.release());
     }
 
@@ -440,20 +439,9 @@
     return client().smartInsertDeleteEnabled() && pasteboard->canSmartReplace();
 }
 
-bool Editor::shouldInsertFragment(PassRefPtr<DocumentFragment> fragment, PassRefPtr<Range> replacingDOMRange, EditorInsertAction givenAction)
-{
-    if (fragment) {
-        Node* child = fragment->firstChild();
-        if (child && fragment->lastChild() == child && child->isCharacterDataNode())
-            return client().shouldInsertText(toCharacterData(child)->data(), replacingDOMRange.get(), givenAction);
-    }
-
-    return client().shouldInsertNode(fragment.get(), replacingDOMRange.get(), givenAction);
-}
-
 void Editor::replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment, bool selectReplacement, bool smartReplace, bool matchStyle)
 {
-    if (m_frame->selection().isNone() || !m_frame->selection().isContentEditable() || !fragment)
+    if (m_frame.selection().isNone() || !m_frame.selection().isContentEditable() || !fragment)
         return;
 
     ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::PreventNesting | ReplaceSelectionCommand::SanitizeFragment;
@@ -463,20 +451,13 @@
         options |= ReplaceSelectionCommand::SmartReplace;
     if (matchStyle)
         options |= ReplaceSelectionCommand::MatchStyle;
-    ASSERT(m_frame->document());
-    ReplaceSelectionCommand::create(*m_frame->document(), fragment, options, EditActionPaste)->apply();
+    ASSERT(m_frame.document());
+    ReplaceSelectionCommand::create(*m_frame.document(), fragment, options, EditActionPaste)->apply();
     revealSelectionAfterEditingOperation();
 
-    if (m_frame->selection().isInPasswordField() || !isContinuousSpellCheckingEnabled())
+    if (m_frame.selection().isInPasswordField() || !isContinuousSpellCheckingEnabled())
         return;
-    Node* nodeToCheck = m_frame->selection().rootEditableElement();
-    if (!nodeToCheck)
-        return;
-
-    RefPtr<Range> rangeToCheck = Range::create(*m_frame->document(), firstPositionInNode(nodeToCheck), lastPositionInNode(nodeToCheck));
-    TextCheckingParagraph textToCheck(rangeToCheck, rangeToCheck);
-    bool asynchronous = true;
-    chunkAndMarkAllMisspellingsAndBadGrammar(resolveTextCheckingTypeMask(TextCheckingTypeSpelling | TextCheckingTypeGrammar), textToCheck, asynchronous);
+    spellChecker().chunkAndMarkAllMisspellingsAndBadGrammar(m_frame.selection().rootEditableElement());
 }
 
 void Editor::replaceSelectionWithText(const String& text, bool selectReplacement, bool smartReplace)
@@ -486,9 +467,7 @@
 
 PassRefPtr<Range> Editor::selectedRange()
 {
-    if (!m_frame)
-        return 0;
-    return m_frame->selection().toNormalizedRange();
+    return m_frame.selection().toNormalizedRange();
 }
 
 bool Editor::shouldDeleteRange(Range* range) const
@@ -496,20 +475,12 @@
     if (!range || range->collapsed(IGNORE_EXCEPTION))
         return false;
 
-    if (!canDeleteRange(range))
-        return false;
-
-    return client().shouldDeleteRange(range);
-}
-
-bool Editor::shouldInsertText(const String& text, Range* range, EditorInsertAction action) const
-{
-    return client().shouldInsertText(text, range, action);
+    return canDeleteRange(range);
 }
 
 void Editor::notifyComponentsOnChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions options)
 {
-    client().respondToChangedSelection(m_frame);
+    client().respondToChangedSelection(&m_frame);
     setStartNewKillRingSequence(true);
 }
 
@@ -517,22 +488,22 @@
 {
     if (AXObjectCache::accessibilityEnabled()) {
         Node* node = endingSelection.start().deprecatedNode();
-        if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache())
+        if (AXObjectCache* cache = m_frame.document()->existingAXObjectCache())
             cache->postNotification(node, AXObjectCache::AXValueChanged, false);
     }
 
-    updateMarkersForWordsAffectedByEditing(true);
+    spellChecker().updateMarkersForWordsAffectedByEditing(true);
     client().respondToChangedContents();
 }
 
 TriState Editor::selectionUnorderedListState() const
 {
-    if (m_frame->selection().isCaret()) {
-        if (enclosingNodeWithTag(m_frame->selection().selection().start(), ulTag))
+    if (m_frame.selection().isCaret()) {
+        if (enclosingNodeWithTag(m_frame.selection().selection().start(), ulTag))
             return TrueTriState;
-    } else if (m_frame->selection().isRange()) {
-        Node* startNode = enclosingNodeWithTag(m_frame->selection().selection().start(), ulTag);
-        Node* endNode = enclosingNodeWithTag(m_frame->selection().selection().end(), ulTag);
+    } else if (m_frame.selection().isRange()) {
+        Node* startNode = enclosingNodeWithTag(m_frame.selection().selection().start(), ulTag);
+        Node* endNode = enclosingNodeWithTag(m_frame.selection().selection().end(), ulTag);
         if (startNode && endNode && startNode == endNode)
             return TrueTriState;
     }
@@ -542,12 +513,12 @@
 
 TriState Editor::selectionOrderedListState() const
 {
-    if (m_frame->selection().isCaret()) {
-        if (enclosingNodeWithTag(m_frame->selection().selection().start(), olTag))
+    if (m_frame.selection().isCaret()) {
+        if (enclosingNodeWithTag(m_frame.selection().selection().start(), olTag))
             return TrueTriState;
-    } else if (m_frame->selection().isRange()) {
-        Node* startNode = enclosingNodeWithTag(m_frame->selection().selection().start(), olTag);
-        Node* endNode = enclosingNodeWithTag(m_frame->selection().selection().end(), olTag);
+    } else if (m_frame.selection().isRange()) {
+        Node* startNode = enclosingNodeWithTag(m_frame.selection().selection().start(), olTag);
+        Node* endNode = enclosingNodeWithTag(m_frame.selection().selection().end(), olTag);
         if (startNode && endNode && startNode == endNode)
             return TrueTriState;
     }
@@ -560,8 +531,8 @@
     if (!canEditRichly())
         return 0;
 
-    ASSERT(m_frame->document());
-    RefPtr<Node> newList = InsertListCommand::insertList(*m_frame->document(), InsertListCommand::OrderedList);
+    ASSERT(m_frame.document());
+    RefPtr<Node> newList = InsertListCommand::insertList(*m_frame.document(), InsertListCommand::OrderedList);
     revealSelectionAfterEditingOperation();
     return newList;
 }
@@ -571,71 +542,71 @@
     if (!canEditRichly())
         return 0;
 
-    ASSERT(m_frame->document());
-    RefPtr<Node> newList = InsertListCommand::insertList(*m_frame->document(), InsertListCommand::UnorderedList);
+    ASSERT(m_frame.document());
+    RefPtr<Node> newList = InsertListCommand::insertList(*m_frame.document(), InsertListCommand::UnorderedList);
     revealSelectionAfterEditingOperation();
     return newList;
 }
 
 bool Editor::canIncreaseSelectionListLevel()
 {
-    ASSERT(m_frame->document());
-    return canEditRichly() && IncreaseSelectionListLevelCommand::canIncreaseSelectionListLevel(*m_frame->document());
+    ASSERT(m_frame.document());
+    return canEditRichly() && IncreaseSelectionListLevelCommand::canIncreaseSelectionListLevel(*m_frame.document());
 }
 
 bool Editor::canDecreaseSelectionListLevel()
 {
-    ASSERT(m_frame->document());
-    return canEditRichly() && DecreaseSelectionListLevelCommand::canDecreaseSelectionListLevel(*m_frame->document());
+    ASSERT(m_frame.document());
+    return canEditRichly() && DecreaseSelectionListLevelCommand::canDecreaseSelectionListLevel(*m_frame.document());
 }
 
 PassRefPtr<Node> Editor::increaseSelectionListLevel()
 {
-    if (!canEditRichly() || m_frame->selection().isNone())
+    if (!canEditRichly() || m_frame.selection().isNone())
         return 0;
 
-    ASSERT(m_frame->document());
-    RefPtr<Node> newList = IncreaseSelectionListLevelCommand::increaseSelectionListLevel(*m_frame->document());
+    ASSERT(m_frame.document());
+    RefPtr<Node> newList = IncreaseSelectionListLevelCommand::increaseSelectionListLevel(*m_frame.document());
     revealSelectionAfterEditingOperation();
     return newList;
 }
 
 PassRefPtr<Node> Editor::increaseSelectionListLevelOrdered()
 {
-    if (!canEditRichly() || m_frame->selection().isNone())
+    if (!canEditRichly() || m_frame.selection().isNone())
         return 0;
 
-    ASSERT(m_frame->document());
-    RefPtr<Node> newList = IncreaseSelectionListLevelCommand::increaseSelectionListLevelOrdered(*m_frame->document());
+    ASSERT(m_frame.document());
+    RefPtr<Node> newList = IncreaseSelectionListLevelCommand::increaseSelectionListLevelOrdered(*m_frame.document());
     revealSelectionAfterEditingOperation();
     return newList.release();
 }
 
 PassRefPtr<Node> Editor::increaseSelectionListLevelUnordered()
 {
-    if (!canEditRichly() || m_frame->selection().isNone())
+    if (!canEditRichly() || m_frame.selection().isNone())
         return 0;
 
-    ASSERT(m_frame->document());
-    RefPtr<Node> newList = IncreaseSelectionListLevelCommand::increaseSelectionListLevelUnordered(*m_frame->document());
+    ASSERT(m_frame.document());
+    RefPtr<Node> newList = IncreaseSelectionListLevelCommand::increaseSelectionListLevelUnordered(*m_frame.document());
     revealSelectionAfterEditingOperation();
     return newList.release();
 }
 
 void Editor::decreaseSelectionListLevel()
 {
-    if (!canEditRichly() || m_frame->selection().isNone())
+    if (!canEditRichly() || m_frame.selection().isNone())
         return;
 
-    ASSERT(m_frame->document());
-    DecreaseSelectionListLevelCommand::decreaseSelectionListLevel(*m_frame->document());
+    ASSERT(m_frame.document());
+    DecreaseSelectionListLevelCommand::decreaseSelectionListLevel(*m_frame.document());
     revealSelectionAfterEditingOperation();
 }
 
 void Editor::removeFormattingAndStyle()
 {
-    ASSERT(m_frame->document());
-    RemoveFormatCommand::create(*m_frame->document())->apply();
+    ASSERT(m_frame.document());
+    RemoveFormatCommand::create(*m_frame.document())->apply();
 }
 
 void Editor::clearLastEditCommand()
@@ -647,7 +618,7 @@
 {
     Node* target = selection.start().element();
     if (!target)
-        target = m_frame->document()->body();
+        target = m_frame.document()->body();
     if (!target)
         return 0;
 
@@ -656,12 +627,12 @@
 
 Node* Editor::findEventTargetFromSelection() const
 {
-    return findEventTargetFrom(m_frame->selection().selection());
+    return findEventTargetFrom(m_frame.selection().selection());
 }
 
 void Editor::applyStyle(StylePropertySet* style, EditAction editingAction)
 {
-    switch (m_frame->selection().selectionType()) {
+    switch (m_frame.selection().selectionType()) {
     case VisibleSelection::NoSelection:
         // do nothing
         break;
@@ -670,29 +641,24 @@
         break;
     case VisibleSelection::RangeSelection:
         if (style) {
-            ASSERT(m_frame->document());
-            ApplyStyleCommand::create(*m_frame->document(), EditingStyle::create(style).get(), editingAction)->apply();
+            ASSERT(m_frame.document());
+            ApplyStyleCommand::create(*m_frame.document(), EditingStyle::create(style).get(), editingAction)->apply();
         }
         break;
     }
 }
 
-bool Editor::shouldApplyStyle(StylePropertySet* style, Range* range)
-{
-    return client().shouldApplyStyle(style, range);
-}
-
 void Editor::applyParagraphStyle(StylePropertySet* style, EditAction editingAction)
 {
-    switch (m_frame->selection().selectionType()) {
+    switch (m_frame.selection().selectionType()) {
     case VisibleSelection::NoSelection:
         // do nothing
         break;
     case VisibleSelection::CaretSelection:
     case VisibleSelection::RangeSelection:
         if (style) {
-            ASSERT(m_frame->document());
-            ApplyStyleCommand::create(*m_frame->document(), EditingStyle::create(style).get(), editingAction, ApplyStyleCommand::ForceBlockProperties)->apply();
+            ASSERT(m_frame.document());
+            ApplyStyleCommand::create(*m_frame.document(), EditingStyle::create(style).get(), editingAction, ApplyStyleCommand::ForceBlockProperties)->apply();
         }
         break;
     }
@@ -703,8 +669,7 @@
     if (!style || style->isEmpty() || !canEditRichly())
         return;
 
-    if (client().shouldApplyStyle(style, m_frame->selection().toNormalizedRange().get()))
-        applyStyle(style, editingAction);
+    applyStyle(style, editingAction);
 }
 
 void Editor::applyParagraphStyleToSelection(StylePropertySet* style, EditAction editingAction)
@@ -712,72 +677,72 @@
     if (!style || style->isEmpty() || !canEditRichly())
         return;
 
-    if (client().shouldApplyStyle(style, m_frame->selection().toNormalizedRange().get()))
-        applyParagraphStyle(style, editingAction);
+    applyParagraphStyle(style, editingAction);
 }
 
 bool Editor::selectionStartHasStyle(CSSPropertyID propertyID, const String& value) const
 {
     return EditingStyle::create(propertyID, value)->triStateOfStyle(
-        EditingStyle::styleAtSelectionStart(m_frame->selection().selection(), propertyID == CSSPropertyBackgroundColor).get());
+        EditingStyle::styleAtSelectionStart(m_frame.selection().selection(), propertyID == CSSPropertyBackgroundColor).get());
 }
 
 TriState Editor::selectionHasStyle(CSSPropertyID propertyID, const String& value) const
 {
-    return EditingStyle::create(propertyID, value)->triStateOfStyle(m_frame->selection().selection());
+    return EditingStyle::create(propertyID, value)->triStateOfStyle(m_frame.selection().selection());
 }
 
 String Editor::selectionStartCSSPropertyValue(CSSPropertyID propertyID)
 {
-    RefPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelectionStart(m_frame->selection().selection(),
+    RefPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelectionStart(m_frame.selection().selection(),
         propertyID == CSSPropertyBackgroundColor);
     if (!selectionStyle || !selectionStyle->style())
         return String();
 
     if (propertyID == CSSPropertyFontSize)
-        return String::number(selectionStyle->legacyFontSize(m_frame->document()));
+        return String::number(selectionStyle->legacyFontSize(m_frame.document()));
     return selectionStyle->style()->getPropertyValue(propertyID);
 }
 
 void Editor::indent()
 {
-    ASSERT(m_frame->document());
-    IndentOutdentCommand::create(*m_frame->document(), IndentOutdentCommand::Indent)->apply();
+    ASSERT(m_frame.document());
+    IndentOutdentCommand::create(*m_frame.document(), IndentOutdentCommand::Indent)->apply();
 }
 
 void Editor::outdent()
 {
-    ASSERT(m_frame->document());
-    IndentOutdentCommand::create(*m_frame->document(), IndentOutdentCommand::Outdent)->apply();
+    ASSERT(m_frame.document());
+    IndentOutdentCommand::create(*m_frame.document(), IndentOutdentCommand::Outdent)->apply();
 }
 
 static void dispatchEditableContentChangedEvents(PassRefPtr<Element> startRoot, PassRefPtr<Element> endRoot)
 {
     if (startRoot)
-        startRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent), IGNORE_EXCEPTION);
+        startRoot->dispatchEvent(Event::create(EventTypeNames::webkitEditableContentChanged), IGNORE_EXCEPTION);
     if (endRoot && endRoot != startRoot)
-        endRoot->dispatchEvent(Event::create(eventNames().webkitEditableContentChangedEvent), IGNORE_EXCEPTION);
+        endRoot->dispatchEvent(Event::create(EventTypeNames::webkitEditableContentChanged), IGNORE_EXCEPTION);
 }
 
 void Editor::appliedEditing(PassRefPtr<CompositeEditCommand> cmd)
 {
-    m_frame->document()->updateLayout();
+    EventQueueScope scope;
+    m_frame.document()->updateLayout();
 
     EditCommandComposition* composition = cmd->composition();
     ASSERT(composition);
+    dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement());
     VisibleSelection newSelection(cmd->endingSelection());
 
-    // Don't clear the typing style with this selection change.  We do those things elsewhere if necessary.
+    // Don't clear the typing style with this selection change. We do those things elsewhere if necessary.
     changeSelectionAfterCommand(newSelection, 0);
-    dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement());
 
     if (!cmd->preservesTypingStyle())
-        m_frame->selection().clearTypingStyle();
+        m_frame.selection().clearTypingStyle();
 
     // Command will be equal to last edit command only in the case of typing
-    if (m_lastEditCommand.get() == cmd)
+    if (m_lastEditCommand.get() == cmd) {
         ASSERT(cmd->isTypingCommand());
-    else {
+    } else {
         // Only register a new undo command if the command passed in is
         // different from the last command
         m_lastEditCommand = cmd;
@@ -789,11 +754,13 @@
 
 void Editor::unappliedEditing(PassRefPtr<EditCommandComposition> cmd)
 {
-    m_frame->document()->updateLayout();
+    EventQueueScope scope;
+    m_frame.document()->updateLayout();
+
+    dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
 
     VisibleSelection newSelection(cmd->startingSelection());
     changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
-    dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
 
     m_lastEditCommand = 0;
     client().registerRedoStep(cmd);
@@ -802,25 +769,31 @@
 
 void Editor::reappliedEditing(PassRefPtr<EditCommandComposition> cmd)
 {
-    m_frame->document()->updateLayout();
+    EventQueueScope scope;
+    m_frame.document()->updateLayout();
+
+    dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
 
     VisibleSelection newSelection(cmd->endingSelection());
     changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
-    dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd->endingRootEditableElement());
 
     m_lastEditCommand = 0;
     client().registerUndoStep(cmd);
     respondToChangedContents(newSelection);
 }
 
+PassOwnPtr<Editor> Editor::create(Frame& frame)
+{
+    return adoptPtr(new Editor(frame));
+}
+
 Editor::Editor(Frame& frame)
-    : FrameDestructionObserver(&frame)
+    : m_frame(frame)
     , m_preventRevealSelection(0)
     , m_shouldStartNewKillRingSequence(false)
     // This is off by default, since most editors want this behavior (this matches IE but not FF).
     , m_shouldStyleWithCSS(false)
     , m_killRing(adoptPtr(new KillRing))
-    , m_spellCheckRequester(adoptPtr(new SpellCheckRequester(frame)))
     , m_areMarkedTextMatchesHighlighted(false)
     , m_defaultParagraphSeparator(EditorParagraphSeparatorIsDiv)
     , m_overwriteModeEnabled(false)
@@ -833,14 +806,14 @@
 
 void Editor::clear()
 {
-    m_frame->inputMethodController().clear();
+    m_frame.inputMethodController().clear();
     m_shouldStyleWithCSS = false;
     m_defaultParagraphSeparator = EditorParagraphSeparatorIsDiv;
 }
 
 bool Editor::insertText(const String& text, Event* triggeringEvent)
 {
-    return m_frame->eventHandler()->handleTextInputEvent(text, triggeringEvent);
+    return m_frame.eventHandler()->handleTextInputEvent(text, triggeringEvent);
 }
 
 bool Editor::insertTextWithoutSendingTextEvent(const String& text, bool selectInsertedText, TextEvent* triggeringEvent)
@@ -853,11 +826,8 @@
         return false;
     RefPtr<Range> range = selection.toNormalizedRange();
 
-    if (!shouldInsertText(text, range.get(), EditorInsertActionTyped))
-        return true;
-
     if (!text.isEmpty())
-        updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text[0]));
+        spellChecker().updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text[0]));
 
     // Get the selection to use for the event that triggered this insertText.
     // If the event handler changed the selection, we may want to use a different selection
@@ -865,8 +835,7 @@
     selection = selectionForCommand(triggeringEvent);
     if (selection.isContentEditable()) {
         if (Node* selectionStart = selection.start().deprecatedNode()) {
-            RefPtr<Document> document = &selectionStart->document();
-            ASSERT(document);
+            RefPtr<Document> document(selectionStart->document());
 
             // Insert the text
             TypingCommand::Options options = 0;
@@ -890,13 +859,10 @@
     if (!canEdit())
         return false;
 
-    if (!shouldInsertText("\n", m_frame->selection().toNormalizedRange().get(), EditorInsertActionTyped))
-        return true;
-
-    VisiblePosition caret = m_frame->selection().selection().visibleStart();
+    VisiblePosition caret = m_frame.selection().selection().visibleStart();
     bool alignToEdge = isEndOfEditableOrNonEditableContent(caret);
-    ASSERT(m_frame->document());
-    TypingCommand::insertLineBreak(*m_frame->document(), 0);
+    ASSERT(m_frame.document());
+    TypingCommand::insertLineBreak(*m_frame.document(), 0);
     revealSelectionAfterEditingOperation(alignToEdge ? ScrollAlignment::alignToEdgeIfNeeded : ScrollAlignment::alignCenterIfNeeded);
 
     return true;
@@ -910,13 +876,10 @@
     if (!canEditRichly())
         return insertLineBreak();
 
-    if (!shouldInsertText("\n", m_frame->selection().toNormalizedRange().get(), EditorInsertActionTyped))
-        return true;
-
-    VisiblePosition caret = m_frame->selection().selection().visibleStart();
+    VisiblePosition caret = m_frame.selection().selection().visibleStart();
     bool alignToEdge = isEndOfEditableOrNonEditableContent(caret);
-    ASSERT(m_frame->document());
-    TypingCommand::insertParagraphSeparator(*m_frame->document(), 0);
+    ASSERT(m_frame.document());
+    TypingCommand::insertParagraphSeparator(*m_frame.document(), 0);
     revealSelectionAfterEditingOperation(alignToEdge ? ScrollAlignment::alignToEdgeIfNeeded : ScrollAlignment::alignCenterIfNeeded);
 
     return true;
@@ -926,15 +889,13 @@
 {
     if (tryDHTMLCut())
         return; // DHTML did the whole operation
-    if (!canCut()) {
-        systemBeep();
+    if (!canCut())
         return;
-    }
     RefPtr<Range> selection = selectedRange();
     if (shouldDeleteRange(selection.get())) {
-        updateMarkersForWordsAffectedByEditing(true);
-        String plainText = m_frame->selectedTextForClipboard();
-        if (enclosingTextFormControl(m_frame->selection().start())) {
+        spellChecker().updateMarkersForWordsAffectedByEditing(true);
+        String plainText = m_frame.selectedTextForClipboard();
+        if (enclosingTextFormControl(m_frame.selection().start())) {
             Pasteboard::generalPasteboard()->writePlainText(plainText,
                 canSmartCopyOrDelete() ? Pasteboard::CanSmartReplace : Pasteboard::CannotSmartReplace);
         } else {
@@ -948,35 +909,32 @@
 {
     if (tryDHTMLCopy())
         return; // DHTML did the whole operation
-    if (!canCopy()) {
-        systemBeep();
+    if (!canCopy())
         return;
-    }
-
-    if (enclosingTextFormControl(m_frame->selection().start())) {
-        Pasteboard::generalPasteboard()->writePlainText(m_frame->selectedTextForClipboard(),
+    if (enclosingTextFormControl(m_frame.selection().start())) {
+        Pasteboard::generalPasteboard()->writePlainText(m_frame.selectedTextForClipboard(),
             canSmartCopyOrDelete() ? Pasteboard::CanSmartReplace : Pasteboard::CannotSmartReplace);
     } else {
-        Document* document = m_frame->document();
+        Document* document = m_frame.document();
         if (HTMLImageElement* imageElement = imageElementFromImageDocument(document))
             Pasteboard::generalPasteboard()->writeImage(imageElement, document->url(), document->title());
         else
-            Pasteboard::generalPasteboard()->writeSelection(selectedRange().get(), canSmartCopyOrDelete(), m_frame->selectedTextForClipboard());
+            Pasteboard::generalPasteboard()->writeSelection(selectedRange().get(), canSmartCopyOrDelete(), m_frame.selectedTextForClipboard());
     }
 }
 
 void Editor::paste()
 {
-    ASSERT(m_frame->document());
+    ASSERT(m_frame.document());
     if (tryDHTMLPaste(AllMimeTypes))
         return; // DHTML did the whole operation
     if (!canPaste())
         return;
-    updateMarkersForWordsAffectedByEditing(false);
-    ResourceFetcher* loader = m_frame->document()->fetcher();
+    spellChecker().updateMarkersForWordsAffectedByEditing(false);
+    ResourceFetcher* loader = m_frame.document()->fetcher();
     ResourceCacheValidationSuppressor validationSuppressor(loader);
-    if (m_frame->selection().isContentRichlyEditable())
-        pasteWithPasteboard(Pasteboard::generalPasteboard(), true);
+    if (m_frame.selection().isContentRichlyEditable())
+        pasteWithPasteboard(Pasteboard::generalPasteboard());
     else
         pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
 }
@@ -987,17 +945,14 @@
         return;
     if (!canPaste())
         return;
-    updateMarkersForWordsAffectedByEditing(false);
+    spellChecker().updateMarkersForWordsAffectedByEditing(false);
     pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
 }
 
 void Editor::performDelete()
 {
-    if (!canDelete()) {
-        systemBeep();
+    if (!canDelete())
         return;
-    }
-
     addToKillRing(selectedRange().get(), false);
     deleteSelectionWithSmartDelete(canSmartCopyOrDelete());
 
@@ -1011,7 +966,7 @@
     if (!startNode)
         return;
     if (endNode) {
-        if (&startNode->document() != &endNode->document())
+        if (startNode->document() != endNode->document())
             return;
         // check if start node is before endNode
         Node* node = startNode;
@@ -1021,13 +976,8 @@
             return;
     }
 
-    ASSERT(m_frame->document());
-    SimplifyMarkupCommand::create(*m_frame->document(), startNode, endNode ? NodeTraversal::next(endNode) : 0)->apply();
-}
-
-void Editor::copyURL(const KURL& url, const String& title)
-{
-    Pasteboard::generalPasteboard()->writeURL(url, title);
+    ASSERT(m_frame.document());
+    SimplifyMarkupCommand::create(*m_frame.document(), startNode, endNode ? NodeTraversal::next(endNode) : 0)->apply();
 }
 
 void Editor::copyImage(const HitTestResult& result)
@@ -1039,38 +989,6 @@
     Pasteboard::generalPasteboard()->writeImage(result.innerNonSharedNode(), url, result.altDisplayString());
 }
 
-bool Editor::isContinuousSpellCheckingEnabled() const
-{
-    return client().isContinuousSpellCheckingEnabled();
-}
-
-void Editor::toggleContinuousSpellChecking()
-{
-    client().toggleContinuousSpellChecking();
-    if (isContinuousSpellCheckingEnabled())
-        return;
-    for (Frame* frame = m_frame->page()->mainFrame(); frame && frame->document(); frame = frame->tree()->traverseNext()) {
-        for (Node* node = frame->document()->rootNode(); node; node = NodeTraversal::next(node)) {
-            node->setAlreadySpellChecked(false);
-        }
-    }
-}
-
-bool Editor::isGrammarCheckingEnabled()
-{
-    return client().isGrammarCheckingEnabled();
-}
-
-bool Editor::shouldEndEditing(Range* range)
-{
-    return client().shouldEndEditing(range);
-}
-
-bool Editor::shouldBeginEditing(Range* range)
-{
-    return client().shouldBeginEditing(range);
-}
-
 void Editor::clearUndoRedoOperations()
 {
     client().clearUndoRedoOperations();
@@ -1096,41 +1014,9 @@
     client().redo();
 }
 
-void Editor::elementDidBeginEditing(Element* element)
-{
-    if (isContinuousSpellCheckingEnabled() && unifiedTextCheckerEnabled()) {
-        bool isTextField = false;
-        HTMLTextFormControlElement* enclosingHTMLTextFormControlElement = 0;
-        if (!isHTMLTextFormControlElement(element))
-            enclosingHTMLTextFormControlElement = enclosingTextFormControl(firstPositionInNode(element));
-        element = enclosingHTMLTextFormControlElement ? enclosingHTMLTextFormControlElement : element;
-        Element* parent = element;
-        if (isHTMLTextFormControlElement(element)) {
-            HTMLTextFormControlElement* textControl = toHTMLTextFormControlElement(element);
-            parent = textControl;
-            element = textControl->innerTextElement();
-            isTextField = textControl->hasTagName(inputTag) && toHTMLInputElement(textControl)->isTextField();
-        }
-
-        if (isTextField || !parent->isAlreadySpellChecked()) {
-            // We always recheck textfields because markers are removed from them on blur.
-            VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(element);
-            markMisspellingsAndBadGrammar(selection);
-            if (!isTextField)
-                parent->setAlreadySpellChecked(true);
-        }
-    }
-}
-
 void Editor::didBeginEditing(Element* rootEditableElement)
 {
-    elementDidBeginEditing(rootEditableElement);
-    client().didBeginEditing();
-}
-
-void Editor::didEndEditing()
-{
-    client().didEndEditing();
+    spellChecker().didBeginEditing(rootEditableElement);
 }
 
 void Editor::setBaseWritingDirection(WritingDirection direction)
@@ -1150,614 +1036,9 @@
     applyParagraphStyleToSelection(style.get(), EditActionSetWritingDirection);
 }
 
-WritingDirection Editor::baseWritingDirectionForSelectionStart() const
-{
-    WritingDirection result = LeftToRightWritingDirection;
-
-    Position pos = m_frame->selection().selection().visibleStart().deepEquivalent();
-    Node* node = pos.deprecatedNode();
-    if (!node)
-        return result;
-
-    RenderObject* renderer = node->renderer();
-    if (!renderer)
-        return result;
-
-    if (!renderer->isRenderBlockFlow()) {
-        renderer = renderer->containingBlock();
-        if (!renderer)
-            return result;
-    }
-
-    RenderStyle* style = renderer->style();
-    if (!style)
-        return result;
-
-    switch (style->direction()) {
-    case LTR:
-        return LeftToRightWritingDirection;
-    case RTL:
-        return RightToLeftWritingDirection;
-    }
-
-    return result;
-}
-
-void Editor::ignoreSpelling()
-{
-    if (RefPtr<Range> selectedRange = frame().selection().toNormalizedRange())
-        frame().document()->markers()->removeMarkers(selectedRange.get(), DocumentMarker::Spelling);
-}
-
-void Editor::advanceToNextMisspelling(bool startBeforeSelection)
-{
-    // The basic approach is to search in two phases - from the selection end to the end of the doc, and
-    // then we wrap and search from the doc start to (approximately) where we started.
-
-    // Start at the end of the selection, search to edge of document.  Starting at the selection end makes
-    // repeated "check spelling" commands work.
-    VisibleSelection selection(frame().selection().selection());
-    RefPtr<Range> spellingSearchRange(rangeOfContents(frame().document()));
-
-    bool startedWithSelection = false;
-    if (selection.start().deprecatedNode()) {
-        startedWithSelection = true;
-        if (startBeforeSelection) {
-            VisiblePosition start(selection.visibleStart());
-            // We match AppKit's rule: Start 1 character before the selection.
-            VisiblePosition oneBeforeStart = start.previous();
-            setStart(spellingSearchRange.get(), oneBeforeStart.isNotNull() ? oneBeforeStart : start);
-        } else
-            setStart(spellingSearchRange.get(), selection.visibleEnd());
-    }
-
-    Position position = spellingSearchRange->startPosition();
-    if (!isEditablePosition(position)) {
-        // This shouldn't happen in very often because the Spelling menu items aren't enabled unless the
-        // selection is editable.
-        // This can happen in Mail for a mix of non-editable and editable content (like Stationary),
-        // when spell checking the whole document before sending the message.
-        // In that case the document might not be editable, but there are editable pockets that need to be spell checked.
-
-        position = firstEditablePositionAfterPositionInRoot(position, frame().document()->documentElement()).deepEquivalent();
-        if (position.isNull())
-            return;
-
-        Position rangeCompliantPosition = position.parentAnchoredEquivalent();
-        spellingSearchRange->setStart(rangeCompliantPosition.deprecatedNode(), rangeCompliantPosition.deprecatedEditingOffset(), IGNORE_EXCEPTION);
-        startedWithSelection = false; // won't need to wrap
-    }
-
-    // topNode defines the whole range we want to operate on
-    Node* topNode = highestEditableRoot(position);
-    // FIXME: lastOffsetForEditing() is wrong here if editingIgnoresContent(highestEditableRoot()) returns true (e.g. a <table>)
-    spellingSearchRange->setEnd(topNode, lastOffsetForEditing(topNode), IGNORE_EXCEPTION);
-
-    // If spellingSearchRange starts in the middle of a word, advance to the next word so we start checking
-    // at a word boundary. Going back by one char and then forward by a word does the trick.
-    if (startedWithSelection) {
-        VisiblePosition oneBeforeStart = startVisiblePosition(spellingSearchRange.get(), DOWNSTREAM).previous();
-        if (oneBeforeStart.isNotNull())
-            setStart(spellingSearchRange.get(), endOfWord(oneBeforeStart));
-        // else we were already at the start of the editable node
-    }
-
-    if (spellingSearchRange->collapsed(IGNORE_EXCEPTION))
-        return; // nothing to search in
-
-    // We go to the end of our first range instead of the start of it, just to be sure
-    // we don't get foiled by any word boundary problems at the start.  It means we might
-    // do a tiny bit more searching.
-    Node* searchEndNodeAfterWrap = spellingSearchRange->endContainer();
-    int searchEndOffsetAfterWrap = spellingSearchRange->endOffset();
-
-    int misspellingOffset = 0;
-    GrammarDetail grammarDetail;
-    int grammarPhraseOffset = 0;
-    RefPtr<Range> grammarSearchRange;
-    String badGrammarPhrase;
-    String misspelledWord;
-
-    bool isSpelling = true;
-    int foundOffset = 0;
-    String foundItem;
-    RefPtr<Range> firstMisspellingRange;
-    if (unifiedTextCheckerEnabled()) {
-        grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
-        foundItem = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspellingOrBadGrammar(isGrammarCheckingEnabled(), isSpelling, foundOffset, grammarDetail);
-        if (isSpelling) {
-            misspelledWord = foundItem;
-            misspellingOffset = foundOffset;
-        } else {
-            badGrammarPhrase = foundItem;
-            grammarPhraseOffset = foundOffset;
-        }
-    } else {
-        misspelledWord = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
-        grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
-        if (!misspelledWord.isEmpty()) {
-            // Stop looking at start of next misspelled word
-            CharacterIterator chars(grammarSearchRange.get());
-            chars.advance(misspellingOffset);
-            grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION);
-        }
-
-        if (isGrammarCheckingEnabled())
-            badGrammarPhrase = TextCheckingHelper(client(), grammarSearchRange).findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
-    }
-
-    // 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
-    // block rather than at a selection).
-    if (startedWithSelection && !misspelledWord && !badGrammarPhrase) {
-        spellingSearchRange->setStart(topNode, 0, IGNORE_EXCEPTION);
-        // going until the end of the very first chunk we tested is far enough
-        spellingSearchRange->setEnd(searchEndNodeAfterWrap, searchEndOffsetAfterWrap, IGNORE_EXCEPTION);
-
-        if (unifiedTextCheckerEnabled()) {
-            grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
-            foundItem = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspellingOrBadGrammar(isGrammarCheckingEnabled(), isSpelling, foundOffset, grammarDetail);
-            if (isSpelling) {
-                misspelledWord = foundItem;
-                misspellingOffset = foundOffset;
-            } else {
-                badGrammarPhrase = foundItem;
-                grammarPhraseOffset = foundOffset;
-            }
-        } else {
-            misspelledWord = TextCheckingHelper(client(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
-            grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
-            if (!misspelledWord.isEmpty()) {
-                // Stop looking at start of next misspelled word
-                CharacterIterator chars(grammarSearchRange.get());
-                chars.advance(misspellingOffset);
-                grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION);
-            }
-
-            if (isGrammarCheckingEnabled())
-                badGrammarPhrase = TextCheckingHelper(client(), grammarSearchRange).findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
-        }
-    }
-
-    if (!badGrammarPhrase.isEmpty()) {
-        // 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.
-
-        ASSERT(badGrammarPhrase.length() > 0);
-        ASSERT(grammarDetail.location != -1 && grammarDetail.length > 0);
-
-        // FIXME 4859190: This gets confused with doubled punctuation at the end of a paragraph
-        RefPtr<Range> badGrammarRange = TextIterator::subrange(grammarSearchRange.get(), grammarPhraseOffset + grammarDetail.location, grammarDetail.length);
-        frame().selection().setSelection(VisibleSelection(badGrammarRange.get(), SEL_DEFAULT_AFFINITY));
-        frame().selection().revealSelection();
-
-        frame().document()->markers()->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, grammarDetail.userDescription);
-    } else if (!misspelledWord.isEmpty()) {
-        // We found a misspelling, but not any earlier bad grammar. Select the misspelling, update the spelling panel, and store
-        // a marker so we draw the red squiggle later.
-
-        RefPtr<Range> misspellingRange = TextIterator::subrange(spellingSearchRange.get(), misspellingOffset, misspelledWord.length());
-        frame().selection().setSelection(VisibleSelection(misspellingRange.get(), DOWNSTREAM));
-        frame().selection().revealSelection();
-
-        client().updateSpellingUIWithMisspelledWord(misspelledWord);
-        frame().document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling);
-    }
-}
-
-String Editor::misspelledWordAtCaretOrRange(Node* clickedNode) const
-{
-    if (!isContinuousSpellCheckingEnabled() || !clickedNode || !isSpellCheckingEnabledFor(clickedNode))
-        return String();
-
-    VisibleSelection selection = m_frame->selection().selection();
-    if (!selection.isContentEditable() || selection.isNone())
-        return String();
-
-    VisibleSelection wordSelection(selection.base());
-    wordSelection.expandUsingGranularity(WordGranularity);
-    RefPtr<Range> wordRange = wordSelection.toNormalizedRange();
-
-    // In compliance with GTK+ applications, additionally allow to provide suggestions when the current
-    // selection exactly match the word selection.
-    if (selection.isRange() && !areRangesEqual(wordRange.get(), selection.toNormalizedRange().get()))
-        return String();
-
-    String word = wordRange->text();
-    if (word.isEmpty())
-        return String();
-
-    int wordLength = word.length();
-    int misspellingLocation = -1;
-    int misspellingLength = 0;
-    textChecker().checkSpellingOfString(word, &misspellingLocation, &misspellingLength);
-
-    return misspellingLength == wordLength ? word : String();
-}
-
-void Editor::showSpellingGuessPanel()
-{
-    if (client().spellingUIIsShowing()) {
-        client().showSpellingUI(false);
-        return;
-    }
-
-    advanceToNextMisspelling(true);
-    client().showSpellingUI(true);
-}
-
-void Editor::clearMisspellingsAndBadGrammar(const VisibleSelection &movingSelection)
-{
-    RefPtr<Range> selectedRange = movingSelection.toNormalizedRange();
-    if (selectedRange)
-        frame().document()->markers()->removeMarkers(selectedRange.get(), DocumentMarker::MisspellingMarkers());
-}
-
-void Editor::markMisspellingsAndBadGrammar(const VisibleSelection &movingSelection)
-{
-    markMisspellingsAndBadGrammar(movingSelection, isContinuousSpellCheckingEnabled() && isGrammarCheckingEnabled(), movingSelection);
-}
-
-void Editor::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping)
-{
-    if (unifiedTextCheckerEnabled()) {
-        TextCheckingTypeMask textCheckingOptions = 0;
-
-        if (isContinuousSpellCheckingEnabled())
-            textCheckingOptions |= TextCheckingTypeSpelling;
-
-        if (!(textCheckingOptions & TextCheckingTypeSpelling))
-            return;
-
-        if (isGrammarCheckingEnabled())
-            textCheckingOptions |= TextCheckingTypeGrammar;
-
-        VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary));
-        if (textCheckingOptions & TextCheckingTypeGrammar) {
-            VisibleSelection selectedSentence = VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart));
-            markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedRange().get(), selectedSentence.toNormalizedRange().get());
-        } else
-            markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedRange().get(), adjacentWords.toNormalizedRange().get());
-        return;
-    }
-
-    if (!isContinuousSpellCheckingEnabled())
-        return;
-
-    // Check spelling of one word
-    RefPtr<Range> misspellingRange;
-    markMisspellings(VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary)), misspellingRange);
-
-    // Autocorrect the misspelled word.
-    if (!misspellingRange)
-        return;
-
-    // Get the misspelled word.
-    const String misspelledWord = plainText(misspellingRange.get());
-    String autocorrectedString = textChecker().getAutoCorrectSuggestionForMisspelledWord(misspelledWord);
-
-    // If autocorrected word is non empty, replace the misspelled word by this word.
-    if (!autocorrectedString.isEmpty()) {
-        VisibleSelection newSelection(misspellingRange.get(), DOWNSTREAM);
-        if (newSelection != frame().selection().selection()) {
-            if (!frame().selection().shouldChangeSelection(newSelection))
-                return;
-            frame().selection().setSelection(newSelection);
-        }
-
-        if (!frame().editor().shouldInsertText(autocorrectedString, misspellingRange.get(), EditorInsertActionTyped))
-            return;
-        frame().editor().replaceSelectionWithText(autocorrectedString, false, false);
-
-        // Reset the charet one character further.
-        frame().selection().moveTo(frame().selection().end());
-        frame().selection().modify(FrameSelection::AlterationMove, DirectionForward, CharacterGranularity);
-    }
-
-    if (!isGrammarCheckingEnabled())
-        return;
-
-    // Check grammar of entire sentence
-    markBadGrammar(VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart)));
-}
-
-void Editor::markMisspellingsOrBadGrammar(const VisibleSelection& selection, bool checkSpelling, RefPtr<Range>& firstMisspellingRange)
-{
-    // This function is called with a selection already expanded to word boundaries.
-    // Might be nice to assert that here.
-
-    // This function is used only for as-you-type checking, so if that's off we do nothing. Note that
-    // grammar checking can only be on if spell checking is also on.
-    if (!isContinuousSpellCheckingEnabled())
-        return;
-
-    RefPtr<Range> searchRange(selection.toNormalizedRange());
-    if (!searchRange)
-        return;
-
-    // If we're not in an editable node, bail.
-    Node* editableNode = searchRange->startContainer();
-    if (!editableNode || !editableNode->rendererIsEditable())
-        return;
-
-    if (!isSpellCheckingEnabledFor(editableNode))
-        return;
-
-    TextCheckingHelper checker(client(), searchRange);
-    if (checkSpelling)
-        checker.markAllMisspellings(firstMisspellingRange);
-    else if (isGrammarCheckingEnabled())
-        checker.markAllBadGrammar();
-}
-
-bool Editor::isSpellCheckingEnabledFor(Node* node) const
-{
-    if (!node)
-        return false;
-    const Element* focusedElement = node->isElementNode() ? toElement(node) : node->parentElement();
-    if (!focusedElement)
-        return false;
-    return focusedElement->isSpellCheckingEnabled();
-}
-
-bool Editor::isSpellCheckingEnabledInFocusedNode() const
-{
-    return isSpellCheckingEnabledFor(m_frame->selection().start().deprecatedNode());
-}
-
-void Editor::markMisspellings(const VisibleSelection& selection, RefPtr<Range>& firstMisspellingRange)
-{
-    markMisspellingsOrBadGrammar(selection, true, firstMisspellingRange);
-}
-
-void Editor::markBadGrammar(const VisibleSelection& selection)
-{
-    RefPtr<Range> firstMisspellingRange;
-    markMisspellingsOrBadGrammar(selection, false, firstMisspellingRange);
-}
-
-void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, Range* spellingRange, Range* grammarRange)
-{
-    ASSERT(m_frame);
-    ASSERT(unifiedTextCheckerEnabled());
-
-    bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
-
-    // This function is called with selections already expanded to word boundaries.
-    if (!spellingRange || (shouldMarkGrammar && !grammarRange))
-        return;
-
-    // If we're not in an editable node, bail.
-    Node* editableNode = spellingRange->startContainer();
-    if (!editableNode || !editableNode->rendererIsEditable())
-        return;
-
-    if (!isSpellCheckingEnabledFor(editableNode))
-        return;
-
-    Range* rangeToCheck = shouldMarkGrammar ? grammarRange : spellingRange;
-    TextCheckingParagraph fullParagraphToCheck(rangeToCheck);
-
-    bool asynchronous = m_frame && m_frame->settings() && m_frame->settings()->asynchronousSpellCheckingEnabled();
-    chunkAndMarkAllMisspellingsAndBadGrammar(textCheckingOptions, fullParagraphToCheck, asynchronous);
-}
-
-void Editor::chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeMask textCheckingOptions, const TextCheckingParagraph& fullParagraphToCheck, bool asynchronous)
-{
-    if (fullParagraphToCheck.isRangeEmpty() || fullParagraphToCheck.isEmpty())
-        return;
-
-    // Since the text may be quite big chunk it up and adjust to the sentence boundary.
-    const int kChunkSize = 16 * 1024;
-    int start = fullParagraphToCheck.checkingStart();
-    int end = fullParagraphToCheck.checkingEnd();
-    start = std::min(start, end);
-    end = std::max(start, end);
-    const int kNumChunksToCheck = asynchronous ? (end - start + kChunkSize - 1) / (kChunkSize) : 1;
-    int currentChunkStart = start;
-    RefPtr<Range> checkRange = fullParagraphToCheck.checkingRange();
-    if (kNumChunksToCheck == 1 && asynchronous) {
-        markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, checkRange.get(), checkRange.get(), asynchronous, 0);
-        return;
-    }
-
-    for (int iter = 0; iter < kNumChunksToCheck; ++iter) {
-        checkRange = fullParagraphToCheck.subrange(currentChunkStart, kChunkSize);
-        setStart(checkRange.get(), startOfSentence(checkRange->startPosition()));
-        setEnd(checkRange.get(), endOfSentence(checkRange->endPosition()));
-
-        int checkingLength = 0;
-        markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, checkRange.get(), checkRange.get(), asynchronous, iter, &checkingLength);
-        currentChunkStart += checkingLength;
-    }
-}
-
-void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, Range* checkRange, Range* paragraphRange, bool asynchronous, int requestNumber, int* checkingLength)
-{
-    TextCheckingParagraph sentenceToCheck(checkRange, paragraphRange);
-    if (checkingLength)
-        *checkingLength = sentenceToCheck.checkingLength();
-
-    RefPtr<SpellCheckRequest> request = SpellCheckRequest::create(resolveTextCheckingTypeMask(textCheckingOptions), TextCheckingProcessBatch, checkRange, paragraphRange, requestNumber);
-
-    if (asynchronous) {
-        m_spellCheckRequester->requestCheckingFor(request);
-    } else {
-        Vector<TextCheckingResult> results;
-        checkTextOfParagraph(textChecker(), sentenceToCheck.text(), resolveTextCheckingTypeMask(textCheckingOptions), results);
-        markAndReplaceFor(request, results);
-    }
-}
-
-void Editor::markAndReplaceFor(PassRefPtr<SpellCheckRequest> request, const Vector<TextCheckingResult>& results)
-{
-    ASSERT(request);
-
-    TextCheckingTypeMask textCheckingOptions = request->data().mask();
-    TextCheckingParagraph paragraph(request->checkingRange(), request->paragraphRange());
-
-    bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling;
-    bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
-
-    // Expand the range to encompass entire paragraphs, since text checking needs that much context.
-    int selectionOffset = 0;
-    int ambiguousBoundaryOffset = -1;
-    bool selectionChanged = false;
-    bool restoreSelectionAfterChange = false;
-    bool adjustSelectionForParagraphBoundaries = false;
-
-    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();
-            selectionOffset = paragraph.offsetTo(caretPosition, ASSERT_NO_EXCEPTION);
-            restoreSelectionAfterChange = true;
-            if (selectionOffset > 0 && (static_cast<unsigned>(selectionOffset) > paragraph.text().length() || paragraph.textCharAt(selectionOffset - 1) == newlineCharacter))
-                adjustSelectionForParagraphBoundaries = true;
-            if (selectionOffset > 0 && static_cast<unsigned>(selectionOffset) <= paragraph.text().length() && isAmbiguousBoundaryCharacter(paragraph.textCharAt(selectionOffset - 1)))
-                ambiguousBoundaryOffset = selectionOffset - 1;
-        }
-    }
-
-    for (unsigned i = 0; i < results.size(); i++) {
-        int spellingRangeEndOffset = paragraph.checkingEnd();
-        const TextCheckingResult* result = &results[i];
-        int resultLocation = result->location + paragraph.checkingStart();
-        int resultLength = result->length;
-        bool resultEndsAtAmbiguousBoundary = ambiguousBoundaryOffset >= 0 && resultLocation + resultLength == ambiguousBoundaryOffset;
-
-        // Only mark misspelling if:
-        // 1. Current text checking isn't done for autocorrection, in which case shouldMarkSpelling is false.
-        // 2. Result falls within spellingRange.
-        // 3. The word in question doesn't end at an ambiguous boundary. For instance, we would not mark
-        //    "wouldn'" as misspelled right after apostrophe is typed.
-        if (shouldMarkSpelling && result->type == TextCheckingTypeSpelling && resultLocation >= paragraph.checkingStart() && resultLocation + resultLength <= spellingRangeEndOffset && !resultEndsAtAmbiguousBoundary) {
-            ASSERT(resultLength > 0 && resultLocation >= 0);
-            RefPtr<Range> misspellingRange = paragraph.subrange(resultLocation, resultLength);
-            misspellingRange->startContainer()->document().markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling, result->replacement, result->hash);
-        } else if (shouldMarkGrammar && result->type == TextCheckingTypeGrammar && paragraph.checkingRangeCovers(resultLocation, resultLength)) {
-            ASSERT(resultLength > 0 && resultLocation >= 0);
-            for (unsigned j = 0; j < result->details.size(); j++) {
-                const GrammarDetail* detail = &result->details[j];
-                ASSERT(detail->length > 0 && detail->location >= 0);
-                if (paragraph.checkingRangeCovers(resultLocation + detail->location, detail->length)) {
-                    RefPtr<Range> badGrammarRange = paragraph.subrange(resultLocation + detail->location, detail->length);
-                    badGrammarRange->startContainer()->document().markers()->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription, result->hash);
-                }
-            }
-        }
-    }
-
-    if (selectionChanged) {
-        TextCheckingParagraph extendedParagraph(paragraph);
-        // Restore the caret position if we have made any replacements
-        extendedParagraph.expandRangeToNextEnd();
-        if (restoreSelectionAfterChange && selectionOffset >= 0 && selectionOffset <= extendedParagraph.rangeLength()) {
-            RefPtr<Range> selectionRange = extendedParagraph.subrange(0, selectionOffset);
-            m_frame->selection().moveTo(selectionRange->endPosition(), DOWNSTREAM);
-            if (adjustSelectionForParagraphBoundaries)
-                m_frame->selection().modify(FrameSelection::AlterationMove, DirectionForward, CharacterGranularity);
-        } else {
-            // If this fails for any reason, the fallback is to go one position beyond the last replacement
-            m_frame->selection().moveTo(m_frame->selection().end());
-            m_frame->selection().modify(FrameSelection::AlterationMove, DirectionForward, CharacterGranularity);
-        }
-    }
-}
-
-void Editor::markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection)
-{
-    if (unifiedTextCheckerEnabled()) {
-        if (!isContinuousSpellCheckingEnabled())
-            return;
-
-        // markMisspellingsAndBadGrammar() is triggered by selection change, in which case we check spelling and grammar, but don't autocorrect misspellings.
-        TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling;
-        if (markGrammar && isGrammarCheckingEnabled())
-            textCheckingOptions |= TextCheckingTypeGrammar;
-        markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, spellingSelection.toNormalizedRange().get(), grammarSelection.toNormalizedRange().get());
-        return;
-    }
-
-    RefPtr<Range> firstMisspellingRange;
-    markMisspellings(spellingSelection, firstMisspellingRange);
-    if (markGrammar)
-        markBadGrammar(grammarSelection);
-}
-
-void Editor::updateMarkersForWordsAffectedByEditing(bool doNotRemoveIfSelectionAtWordBoundary)
-{
-    if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTypeSpelling))
-        return;
-
-    // We want to remove the markers from a word if an editing command will change the word. This can happen in one of
-    // several scenarios:
-    // 1. Insert in the middle of a word.
-    // 2. Appending non whitespace at the beginning of word.
-    // 3. Appending non whitespace at the end of word.
-    // Note that, appending only whitespaces at the beginning or end of word won't change the word, so we don't need to
-    // remove the markers on that word.
-    // Of course, if current selection is a range, we potentially will edit two words that fall on the boundaries of
-    // selection, and remove words between the selection boundaries.
-    //
-    VisiblePosition startOfSelection = frame().selection().selection().start();
-    VisiblePosition endOfSelection = frame().selection().selection().end();
-    if (startOfSelection.isNull())
-        return;
-    // First word is the word that ends after or on the start of selection.
-    VisiblePosition startOfFirstWord = startOfWord(startOfSelection, LeftWordIfOnBoundary);
-    VisiblePosition endOfFirstWord = endOfWord(startOfSelection, LeftWordIfOnBoundary);
-    // Last word is the word that begins before or on the end of selection
-    VisiblePosition startOfLastWord = startOfWord(endOfSelection, RightWordIfOnBoundary);
-    VisiblePosition endOfLastWord = endOfWord(endOfSelection, RightWordIfOnBoundary);
-
-    if (startOfFirstWord.isNull()) {
-        startOfFirstWord = startOfWord(startOfSelection, RightWordIfOnBoundary);
-        endOfFirstWord = endOfWord(startOfSelection, RightWordIfOnBoundary);
-    }
-
-    if (endOfLastWord.isNull()) {
-        startOfLastWord = startOfWord(endOfSelection, LeftWordIfOnBoundary);
-        endOfLastWord = endOfWord(endOfSelection, LeftWordIfOnBoundary);
-    }
-
-    // If doNotRemoveIfSelectionAtWordBoundary is true, and first word ends at the start of selection,
-    // we choose next word as the first word.
-    if (doNotRemoveIfSelectionAtWordBoundary && endOfFirstWord == startOfSelection) {
-        startOfFirstWord = nextWordPosition(startOfFirstWord);
-        endOfFirstWord = endOfWord(startOfFirstWord, RightWordIfOnBoundary);
-        if (startOfFirstWord == endOfSelection)
-            return;
-    }
-
-    // If doNotRemoveIfSelectionAtWordBoundary is true, and last word begins at the end of selection,
-    // we choose previous word as the last word.
-    if (doNotRemoveIfSelectionAtWordBoundary && startOfLastWord == endOfSelection) {
-        startOfLastWord = previousWordPosition(startOfLastWord);
-        endOfLastWord = endOfWord(startOfLastWord, RightWordIfOnBoundary);
-        if (endOfLastWord == startOfSelection)
-            return;
-    }
-
-    if (startOfFirstWord.isNull() || endOfFirstWord.isNull() || startOfLastWord.isNull() || endOfLastWord.isNull())
-        return;
-
-    // Now we remove markers on everything between startOfFirstWord and endOfLastWord.
-    // However, if an autocorrection change a single word to multiple words, we want to remove correction mark from all the
-    // resulted words even we only edit one of them. For example, assuming autocorrection changes "avantgarde" to "avant
-    // garde", we will have CorrectionIndicator marker on both words and on the whitespace between them. If we then edit garde,
-    // we would like to remove the marker from word "avant" and whitespace as well. So we need to get the continous range of
-    // of marker that contains the word in question, and remove marker on that whole range.
-    Document* document = m_frame->document();
-    ASSERT(document);
-    RefPtr<Range> wordRange = Range::create(*document, startOfFirstWord.deepEquivalent(), endOfLastWord.deepEquivalent());
-
-    document->markers()->removeMarkers(wordRange.get(), DocumentMarker::MisspellingMarkers(), DocumentMarkerController::RemovePartiallyOverlappingMarker);
-}
-
 PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint)
 {
-    Document* document = m_frame->documentAtPoint(windowPoint);
+    Document* document = m_frame.documentAtPoint(windowPoint);
     if (!document)
         return 0;
 
@@ -1777,12 +1058,12 @@
     if (m_preventRevealSelection)
         return;
 
-    m_frame->selection().revealSelection(alignment, revealExtentOption);
+    m_frame.selection().revealSelection(alignment, revealExtentOption);
 }
 
 bool Editor::setSelectionOffsets(int selectionStart, int selectionEnd)
 {
-    Element* rootEditableElement = m_frame->selection().rootEditableElement();
+    Element* rootEditableElement = m_frame.selection().rootEditableElement();
     if (!rootEditableElement)
         return false;
 
@@ -1790,7 +1071,7 @@
     if (!range)
         return false;
 
-    return m_frame->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, true);
+    return m_frame.selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, true);
 }
 
 void Editor::transpose()
@@ -1798,7 +1079,7 @@
     if (!canEdit())
         return;
 
-    VisibleSelection selection = m_frame->selection().selection();
+    VisibleSelection selection = m_frame.selection().selection();
     if (!selection.isCaret())
         return;
 
@@ -1823,15 +1104,10 @@
     String transposed = text.right(1) + text.left(1);
 
     // Select the two characters.
-    if (newSelection != m_frame->selection().selection()) {
-        if (!m_frame->selection().shouldChangeSelection(newSelection))
-            return;
-        m_frame->selection().setSelection(newSelection);
-    }
+    if (newSelection != m_frame.selection().selection())
+        m_frame.selection().setSelection(newSelection);
 
     // Insert the transposed characters.
-    if (!shouldInsertText(transposed, range.get(), EditorInsertActionTyped))
-        return;
     replaceSelectionWithText(transposed, false, false);
 }
 
@@ -1854,13 +1130,9 @@
     if (newSelection.start().isOrphan() || newSelection.end().isOrphan())
         return;
 
-    // If there is no selection change, don't bother sending shouldChangeSelection, but still call setSelection,
-    // because there is work that it must do in this situation.
-    // The old selection can be invalid here and calling shouldChangeSelection can produce some strange calls.
     // See <rdar://problem/5729315> Some shouldChangeSelectedDOMRange contain Ranges for selections that are no longer valid
-    bool selectionDidNotChangeDOMPosition = newSelection == m_frame->selection().selection();
-    if (selectionDidNotChangeDOMPosition || m_frame->selection().shouldChangeSelection(newSelection))
-        m_frame->selection().setSelection(newSelection, options);
+    bool selectionDidNotChangeDOMPosition = newSelection == m_frame.selection().selection();
+    m_frame.selection().setSelection(newSelection, options);
 
     // Some editing operations change the selection visually without affecting its position within the DOM.
     // For example when you press return in the following (the caret is marked by ^):
@@ -1870,7 +1142,7 @@
     // does not call EditorClient::respondToChangedSelection(), which, on the Mac, sends selection change notifications and
     // starts a new kill ring sequence, but we want to do these things (matches AppKit).
     if (selectionDidNotChangeDOMPosition)
-        client().respondToChangedSelection(m_frame);
+        client().respondToChangedSelection(&m_frame);
 }
 
 IntRect Editor::firstRectForRange(Range* range) const
@@ -1902,58 +1174,43 @@
         startCaretRect.height());
 }
 
-bool Editor::shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity affinity, bool stillSelecting) const
-{
-    return client().shouldChangeSelectedRange(oldSelection.toNormalizedRange().get(), newSelection.toNormalizedRange().get(), affinity, stillSelecting);
-}
-
 void Editor::computeAndSetTypingStyle(StylePropertySet* style, EditAction editingAction)
 {
     if (!style || style->isEmpty()) {
-        m_frame->selection().clearTypingStyle();
+        m_frame.selection().clearTypingStyle();
         return;
     }
 
     // Calculate the current typing style.
     RefPtr<EditingStyle> typingStyle;
-    if (m_frame->selection().typingStyle()) {
-        typingStyle = m_frame->selection().typingStyle()->copy();
+    if (m_frame.selection().typingStyle()) {
+        typingStyle = m_frame.selection().typingStyle()->copy();
         typingStyle->overrideWithStyle(style);
-    } else
+    } else {
         typingStyle = EditingStyle::create(style);
+    }
 
-    typingStyle->prepareToApplyAt(m_frame->selection().selection().visibleStart().deepEquivalent(), EditingStyle::PreserveWritingDirection);
+    typingStyle->prepareToApplyAt(m_frame.selection().selection().visibleStart().deepEquivalent(), EditingStyle::PreserveWritingDirection);
 
     // Handle block styles, substracting these from the typing style.
     RefPtr<EditingStyle> blockStyle = typingStyle->extractAndRemoveBlockProperties();
     if (!blockStyle->isEmpty()) {
-        ASSERT(m_frame->document());
-        ApplyStyleCommand::create(*m_frame->document(), blockStyle.get(), editingAction)->apply();
+        ASSERT(m_frame.document());
+        ApplyStyleCommand::create(*m_frame.document(), blockStyle.get(), editingAction)->apply();
     }
 
     // Set the remaining style as the typing style.
-    m_frame->selection().setTypingStyle(typingStyle);
+    m_frame.selection().setTypingStyle(typingStyle);
 }
 
 void Editor::textAreaOrTextFieldDidBeginEditing(Element* e)
 {
-    elementDidBeginEditing(e);
+    spellChecker().didBeginEditing(e);
 }
 
 void Editor::textFieldDidEndEditing(Element* e)
 {
-    // Remove markers when deactivating a selection in an <input type="text"/>.
-    // Prevent new ones from appearing too.
-    m_spellCheckRequester->cancelCheck();
-    HTMLTextFormControlElement* textFormControlElement = toHTMLTextFormControlElement(e);
-    HTMLElement* innerText = textFormControlElement->innerTextElement();
-    DocumentMarker::MarkerTypes markerTypes(DocumentMarker::Spelling);
-    if (isGrammarCheckingEnabled() || unifiedTextCheckerEnabled())
-        markerTypes.add(DocumentMarker::Grammar);
-    for (Node* node = innerText; node; node = NodeTraversal::next(node, innerText)) {
-        m_frame->document()->markers()->removeMarkers(node, markerTypes);
-    }
-
+    spellChecker().didEndEditingOnTextField(e);
     client().textFieldDidEndEditing(e);
 }
 
@@ -1975,15 +1232,15 @@
 
 bool Editor::findString(const String& target, FindOptions options)
 {
-    VisibleSelection selection = m_frame->selection().selection();
+    VisibleSelection selection = m_frame.selection().selection();
 
     RefPtr<Range> resultRange = rangeOfString(target, selection.firstRange().get(), options);
 
     if (!resultRange)
         return false;
 
-    m_frame->selection().setSelection(VisibleSelection(resultRange.get(), DOWNSTREAM));
-    m_frame->selection().revealSelection();
+    m_frame.selection().setSelection(VisibleSelection(resultRange.get(), DOWNSTREAM));
+    m_frame.selection().revealSelection();
     return true;
 }
 
@@ -2006,7 +1263,7 @@
 
     // Start from an edge of the reference range, if there's a reference range that's not in shadow content. Which edge
     // is used depends on whether we're searching forward or backward, and whether startInSelection is set.
-    RefPtr<Range> searchRange(rangeOfContents(m_frame->document()));
+    RefPtr<Range> searchRange(rangeOfContents(m_frame.document()));
 
     bool forward = !(options & Backwards);
     bool startInReferenceRange = referenceRange && (options & StartInSelection);
@@ -2030,7 +1287,7 @@
     // Build a selection with the found range to remove collapsed whitespace.
     // Compare ranges instead of selection objects to ignore the way that the current selection was made.
     if (startInReferenceRange && areRangesEqual(VisibleSelection(resultRange.get()).toNormalizedRange().get(), referenceRange)) {
-        searchRange = rangeOfContents(m_frame->document());
+        searchRange = rangeOfContents(m_frame.document());
         if (forward)
             searchRange->setStart(referenceRange->endPosition());
         else
@@ -2048,7 +1305,7 @@
 
     // If nothing was found in the shadow tree, search in main content following the shadow tree.
     if (resultRange->collapsed(ASSERT_NO_EXCEPTION) && shadowTreeRoot) {
-        searchRange = rangeOfContents(m_frame->document());
+        searchRange = rangeOfContents(m_frame.document());
         if (forward)
             searchRange->setStartAfter(shadowTreeRoot->shadowHost());
         else
@@ -2060,7 +1317,7 @@
     // If we didn't find anything and we're wrapping, search again in the entire document (this will
     // redundantly re-search the area already searched in some cases).
     if (resultRange->collapsed(ASSERT_NO_EXCEPTION) && options & WrapAround) {
-        searchRange = rangeOfContents(m_frame->document());
+        searchRange = rangeOfContents(m_frame.document());
         resultRange = findPlainText(searchRange.get(), target, options);
         // We used to return false here if we ended up with the same range that we started with
         // (e.g., the reference range was already the only instance of this text). But we decided that
@@ -2076,147 +1333,30 @@
         return;
 
     m_areMarkedTextMatchesHighlighted = flag;
-    m_frame->document()->markers()->repaintMarkers(DocumentMarker::TextMatch);
+    m_frame.document()->markers()->repaintMarkers(DocumentMarker::TextMatch);
 }
 
 void Editor::respondToChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions options)
 {
-    bool closeTyping = options & FrameSelection::CloseTyping;
-    bool isContinuousSpellCheckingEnabled = this->isContinuousSpellCheckingEnabled();
-    bool isContinuousGrammarCheckingEnabled = isContinuousSpellCheckingEnabled && isGrammarCheckingEnabled();
-    if (isContinuousSpellCheckingEnabled) {
-        VisibleSelection newAdjacentWords;
-        VisibleSelection newSelectedSentence;
-        bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
-        if (m_frame->selection().selection().isContentEditable() || caretBrowsing) {
-            VisiblePosition newStart(m_frame->selection().selection().visibleStart());
-            newAdjacentWords = VisibleSelection(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary));
-            if (isContinuousGrammarCheckingEnabled)
-                newSelectedSentence = VisibleSelection(startOfSentence(newStart), endOfSentence(newStart));
-        }
-
-        // Don't check spelling and grammar if the change of selection is triggered by spelling correction itself.
-        bool shouldCheckSpellingAndGrammar = !(options & FrameSelection::SpellCorrectionTriggered);
-
-        // When typing we check spelling elsewhere, so don't redo it here.
-        // If this is a change in selection resulting from a delete operation,
-        // oldSelection may no longer be in the document.
-        if (shouldCheckSpellingAndGrammar
-            && closeTyping
-            && oldSelection.isContentEditable()
-            && oldSelection.start().inDocument()
-            && !isSelectionInTextField(oldSelection)) {
-            spellCheckOldSelection(oldSelection, newAdjacentWords, newSelectedSentence);
-        }
-
-        if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTypeSpelling)) {
-            if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange())
-                m_frame->document()->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling);
-        }
-        if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTypeGrammar)) {
-            if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange())
-                m_frame->document()->markers()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);
-        }
-    }
-
-    // When continuous spell checking is off, existing markers disappear after the selection changes.
-    if (!isContinuousSpellCheckingEnabled)
-        m_frame->document()->markers()->removeMarkers(DocumentMarker::Spelling);
-    if (!isContinuousGrammarCheckingEnabled)
-        m_frame->document()->markers()->removeMarkers(DocumentMarker::Grammar);
-
-    m_frame->inputMethodController().cancelCompositionIfSelectionIsInvalid();
-
+    spellChecker().respondToChangedSelection(oldSelection, options);
+    m_frame.inputMethodController().cancelCompositionIfSelectionIsInvalid();
     notifyComponentsOnChangedSelection(oldSelection, options);
 }
 
-void Editor::spellCheckAfterBlur()
+SpellChecker& Editor::spellChecker() const
 {
-    if (!m_frame->selection().selection().isContentEditable())
-        return;
-
-    if (isSelectionInTextField(m_frame->selection().selection())) {
-        // textFieldDidEndEditing() and textFieldDidBeginEditing() handle this.
-        return;
-    }
-
-    VisibleSelection empty;
-    spellCheckOldSelection(m_frame->selection().selection(), empty, empty);
+    return m_frame.spellChecker();
 }
 
-void Editor::spellCheckOldSelection(const VisibleSelection& oldSelection, const VisibleSelection& newAdjacentWords, const VisibleSelection& newSelectedSentence)
+bool Editor::isContinuousSpellCheckingEnabled() const
 {
-    VisiblePosition oldStart(oldSelection.visibleStart());
-    VisibleSelection oldAdjacentWords = VisibleSelection(startOfWord(oldStart, LeftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary));
-    if (oldAdjacentWords  != newAdjacentWords) {
-        if (isContinuousSpellCheckingEnabled() && isGrammarCheckingEnabled()) {
-            VisibleSelection selectedSentence = VisibleSelection(startOfSentence(oldStart), endOfSentence(oldStart));
-            markMisspellingsAndBadGrammar(oldAdjacentWords, selectedSentence != newSelectedSentence, selectedSentence);
-        } else {
-            markMisspellingsAndBadGrammar(oldAdjacentWords, false, oldAdjacentWords);
-        }
-    }
-}
-
-static Node* findFirstMarkable(Node* node)
-{
-    while (node) {
-        if (!node->renderer())
-            return 0;
-        if (node->renderer()->isText())
-            return node;
-        if (node->renderer()->isTextControl())
-            node = toRenderTextControl(node->renderer())->textFormControlElement()->visiblePositionForIndex(1).deepEquivalent().deprecatedNode();
-        else if (node->firstChild())
-            node = node->firstChild();
-        else
-            node = node->nextSibling();
-    }
-
-    return 0;
-}
-
-bool Editor::selectionStartHasMarkerFor(DocumentMarker::MarkerType markerType, int from, int length) const
-{
-    Node* node = findFirstMarkable(m_frame->selection().start().deprecatedNode());
-    if (!node)
-        return false;
-
-    unsigned int startOffset = static_cast<unsigned int>(from);
-    unsigned int endOffset = static_cast<unsigned int>(from + length);
-    Vector<DocumentMarker*> markers = m_frame->document()->markers()->markersFor(node);
-    for (size_t i = 0; i < markers.size(); ++i) {
-        DocumentMarker* marker = markers[i];
-        if (marker->startOffset() <= startOffset && endOffset <= marker->endOffset() && marker->type() == markerType)
-            return true;
-    }
-
-    return false;
-}
-
-TextCheckingTypeMask Editor::resolveTextCheckingTypeMask(TextCheckingTypeMask textCheckingOptions)
-{
-    bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling;
-    bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
-
-    TextCheckingTypeMask checkingTypes = 0;
-    if (shouldMarkSpelling)
-        checkingTypes |= TextCheckingTypeSpelling;
-    if (shouldMarkGrammar)
-        checkingTypes |= TextCheckingTypeGrammar;
-
-    return checkingTypes;
-}
-
-bool Editor::unifiedTextCheckerEnabled() const
-{
-    return WebCore::unifiedTextCheckerEnabled(m_frame);
+    return spellChecker().isContinuousSpellCheckingEnabled();
 }
 
 void Editor::toggleOverwriteModeEnabled()
 {
     m_overwriteModeEnabled = !m_overwriteModeEnabled;
     frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled);
-};
+}
 
 } // namespace WebCore
diff --git a/Source/core/editing/Editor.h b/Source/core/editing/Editor.h
index d53afe4..fdca95f 100644
--- a/Source/core/editing/Editor.h
+++ b/Source/core/editing/Editor.h
@@ -30,15 +30,13 @@
 #include "core/dom/DocumentMarker.h"
 #include "core/editing/EditAction.h"
 #include "core/editing/EditingBehavior.h"
-#include "core/editing/EditorInsertAction.h"
 #include "core/editing/FindOptions.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/TextIterator.h"
 #include "core/editing/VisibleSelection.h"
 #include "core/editing/WritingDirection.h"
-#include "core/page/FrameDestructionObserver.h"
-#include "core/platform/chromium/PasteMode.h"
-#include "core/platform/text/TextChecking.h"
+#include "core/frame/FrameDestructionObserver.h"
+#include "platform/PasteMode.h"
 
 namespace WebCore {
 
@@ -55,27 +53,23 @@
 class Pasteboard;
 class SharedBuffer;
 class SimpleFontData;
-class SpellCheckRequest;
-class SpellCheckRequester;
+class SpellChecker;
 class StylePropertySet;
 class Text;
-class TextCheckerClient;
-class TextCheckingParagraph;
-struct TextCheckingResult;
 class TextEvent;
 
 enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM, CommandFromDOMWithUserInterface };
 enum EditorParagraphSeparator { EditorParagraphSeparatorIsDiv, EditorParagraphSeparatorIsP };
 
-class Editor : public FrameDestructionObserver {
+class Editor {
+    WTF_MAKE_NONCOPYABLE(Editor);
 public:
-    explicit Editor(Frame&);
+    static PassOwnPtr<Editor> create(Frame&);
     ~Editor();
 
     EditorClient& client() const;
-    TextCheckerClient& textChecker() const;
 
-    Frame& frame() const { return *m_frame; }
+    Frame& frame() const { return m_frame; }
 
     CompositeEditCommand* lastEditCommand() { return m_lastEditCommand.get(); }
 
@@ -101,17 +95,13 @@
     void pasteAsPlainText();
     void performDelete();
 
-    void copyURL(const KURL&, const String&);
     void copyImage(const HitTestResult&);
 
     void indent();
     void outdent();
     void transpose();
 
-    bool shouldInsertFragment(PassRefPtr<DocumentFragment>, PassRefPtr<Range>, EditorInsertAction);
-    bool shouldInsertText(const String&, Range*, EditorInsertAction) const;
     bool shouldDeleteRange(Range*) const;
-    bool shouldApplyStyle(StylePropertySet*, Range*);
 
     void respondToChangedContents(const VisibleSelection& endingSelection);
 
@@ -182,30 +172,9 @@
     bool insertLineBreak();
     bool insertParagraphSeparator();
 
-    bool isContinuousSpellCheckingEnabled() const;
-    void toggleContinuousSpellChecking();
-    bool isGrammarCheckingEnabled();
-    void ignoreSpelling();
-    String misspelledWordAtCaretOrRange(Node* clickedNode) const;
-    bool isSpellCheckingEnabledInFocusedNode() const;
-    bool isSpellCheckingEnabledFor(Node*) const;
-    void markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping);
-    void markMisspellings(const VisibleSelection&, RefPtr<Range>& firstMisspellingRange);
-    void markBadGrammar(const VisibleSelection&);
-    void markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection);
-    void markAndReplaceFor(PassRefPtr<SpellCheckRequest>, const Vector<TextCheckingResult>&);
-
     bool isOverwriteModeEnabled() const { return m_overwriteModeEnabled; }
     void toggleOverwriteModeEnabled();
 
-    void markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask, Range* spellingRange, Range* grammarRange);
-
-    void advanceToNextMisspelling(bool startBeforeSelection = false);
-    void showSpellingGuessPanel();
-
-    bool shouldBeginEditing(Range*);
-    bool shouldEndEditing(Range*);
-
     void clearUndoRedoOperations();
     bool canUndo();
     void undo();
@@ -213,7 +182,6 @@
     void redo();
 
     void didBeginEditing(Element*);
-    void didEndEditing();
 
     void setBaseWritingDirection(WritingDirection);
 
@@ -235,7 +203,6 @@
     VisibleSelection selectionForCommand(Event*);
 
     KillRing* killRing() const { return m_killRing.get(); }
-    SpellCheckRequester& spellCheckRequester() const { return *m_spellCheckRequester; }
 
     EditingBehavior behavior() const;
 
@@ -246,9 +213,6 @@
     void pasteAsFragment(PassRefPtr<DocumentFragment>, bool smartReplace, bool matchStyle);
     void pasteAsPlainText(const String&, bool smartReplace);
 
-    void clearMisspellingsAndBadGrammar(const VisibleSelection&);
-    void markMisspellingsAndBadGrammar(const VisibleSelection&);
-
     Node* findEventTargetFrom(const VisibleSelection&) const;
 
     bool findString(const String&, FindOptions);
@@ -266,10 +230,6 @@
     IntRect firstRectForRange(Range*) const;
 
     void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions);
-    bool shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity, bool stillSelecting) const;
-
-    void spellCheckAfterBlur();
-    void spellCheckOldSelection(const VisibleSelection& oldSelection, const VisibleSelection& newAdjacentWords, const VisibleSelection& newSelectedSentence);
 
     bool markedTextMatchesAreHighlighted() const;
     void setMarkedTextMatchesAreHighlighted(bool);
@@ -278,17 +238,12 @@
     void textFieldDidEndEditing(Element*);
     void textDidChangeInTextField(Element*);
     bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
-    WritingDirection baseWritingDirectionForSelectionStart() const;
 
     void replaceSelectionWithFragment(PassRefPtr<DocumentFragment>, bool selectReplacement, bool smartReplace, bool matchStyle);
     void replaceSelectionWithText(const String&, bool selectReplacement, bool smartReplace);
-    bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int length) const;
-    void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSelection);
 
     void simplifyMarkup(Node* startNode, Node* endNode);
 
-    void deviceScaleFactorChanged();
-
     EditorParagraphSeparator defaultParagraphSeparator() const { return m_defaultParagraphSeparator; }
     void setDefaultParagraphSeparator(EditorParagraphSeparator separator) { m_defaultParagraphSeparator = separator; }
 
@@ -302,21 +257,21 @@
     };
     friend class RevealSelectionScope;
 
-    void elementDidBeginEditing(Element*);
-
 private:
+    Frame& m_frame;
     RefPtr<CompositeEditCommand> m_lastEditCommand;
     RefPtr<Node> m_removedAnchor;
     int m_preventRevealSelection;
     bool m_shouldStartNewKillRingSequence;
     bool m_shouldStyleWithCSS;
     OwnPtr<KillRing> m_killRing;
-    const OwnPtr<SpellCheckRequester> m_spellCheckRequester;
     VisibleSelection m_mark;
     bool m_areMarkedTextMatchesHighlighted;
     EditorParagraphSeparator m_defaultParagraphSeparator;
     bool m_overwriteModeEnabled;
 
+    explicit Editor(Frame&);
+
     bool canDeleteRange(Range*) const;
 
     bool tryDHTMLCopy();
@@ -325,22 +280,17 @@
 
     bool canSmartReplaceWithPasteboard(Pasteboard*);
     void pasteAsPlainTextWithPasteboard(Pasteboard*);
-    void pasteWithPasteboard(Pasteboard*, bool allowPlainText);
+    void pasteWithPasteboard(Pasteboard*);
     bool dispatchCPPEvent(const AtomicString&, ClipboardAccessPolicy, PasteMode = AllMimeTypes);
 
     void revealSelectionAfterEditingOperation(const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent);
-    void markMisspellingsOrBadGrammar(const VisibleSelection&, bool checkSpelling, RefPtr<Range>& firstMisspellingRange);
-    TextCheckingTypeMask resolveTextCheckingTypeMask(TextCheckingTypeMask);
-
     void changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions);
     void notifyComponentsOnChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions);
 
     Node* findEventTargetFromSelection() const;
 
-    bool unifiedTextCheckerEnabled() const;
-
-    void chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeMask textCheckingOptions, const TextCheckingParagraph& fullParagraphToCheck, bool asynchronous);
-    void markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, Range* checkingRange, Range* paragraphRange, bool asynchronous, int requestNumber, int* checkingLength = 0);
+    SpellChecker& spellChecker() const;
+    bool isContinuousSpellCheckingEnabled() const;
 };
 
 inline void Editor::setStartNewKillRingSequence(bool flag)
diff --git a/Source/core/editing/EditorCommand.cpp b/Source/core/editing/EditorCommand.cpp
index 93c8f2d..76bbdd9 100644
--- a/Source/core/editing/EditorCommand.cpp
+++ b/Source/core/editing/EditorCommand.cpp
@@ -37,12 +37,12 @@
 #include "core/css/StylePropertySet.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/events/Event.h"
-#include "core/dom/UserTypingGestureIndicator.h"
 #include "core/editing/CreateLinkCommand.h"
 #include "core/editing/FormatBlockCommand.h"
 #include "core/editing/IndentOutdentCommand.h"
 #include "core/editing/InsertListCommand.h"
 #include "core/editing/ReplaceSelectionCommand.h"
+#include "core/editing/SpellChecker.h"
 #include "core/editing/TypingCommand.h"
 #include "core/editing/UnlinkCommand.h"
 #include "core/editing/markup.h"
@@ -52,14 +52,13 @@
 #include "core/page/Chrome.h"
 #include "core/page/EditorClient.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/KillRing.h"
 #include "core/platform/Pasteboard.h"
 #include "core/platform/Scrollbar.h"
-#include "core/platform/Sound.h"
 #include "core/rendering/RenderBox.h"
 #include "wtf/text/AtomicString.h"
 
@@ -219,8 +218,6 @@
         return false;
     RefPtr<Range> oldRange = frame.selection().selection().toNormalizedRange();
     EAffinity affinity = frame.selection().affinity();
-    if (!frame.editor().client().shouldChangeSelectedRange(oldRange.get(), newRange.get(), affinity, false))
-        return false;
     frame.selection().setSelectedRange(newRange.get(), affinity, true);
     return true;
 }
@@ -296,14 +293,9 @@
     return true;
 }
 
-static bool executeCut(Frame& frame, Event*, EditorCommandSource source, const String&)
+static bool executeCut(Frame& frame, Event*, EditorCommandSource, const String&)
 {
-    if (source == CommandFromMenuOrKeyBinding) {
-        UserTypingGestureIndicator typingGestureIndicator(&frame);
-        frame.editor().cut();
-    } else {
-        frame.editor().cut();
-    }
+    frame.editor().cut();
     return true;
 }
 
@@ -322,7 +314,6 @@
     switch (source) {
     case CommandFromMenuOrKeyBinding: {
         // Doesn't modify the text if the current selection isn't a range.
-        UserTypingGestureIndicator typingGestureIndicator(&frame);
         frame.editor().performDelete();
         return true;
     }
@@ -477,7 +468,7 @@
 
 static bool executeIgnoreSpelling(Frame& frame, Event*, EditorCommandSource, const String&)
 {
-    frame.editor().ignoreSpelling();
+    frame.spellChecker().ignoreSpelling();
     return true;
 }
 
@@ -936,14 +927,9 @@
     return true;
 }
 
-static bool executePaste(Frame& frame, Event*, EditorCommandSource source, const String&)
+static bool executePaste(Frame& frame, Event*, EditorCommandSource, const String&)
 {
-    if (source == CommandFromMenuOrKeyBinding) {
-        UserTypingGestureIndicator typingGestureIndicator(&frame);
-        frame.editor().paste();
-    } else {
-        frame.editor().paste();
-    }
+    frame.editor().paste();
     return true;
 }
 
@@ -952,7 +938,6 @@
     if (!frame.editor().client().supportsGlobalSelection())
         return false;
     ASSERT_UNUSED(source, source == CommandFromMenuOrKeyBinding);
-    UserTypingGestureIndicator typingGestureIndicator(&frame);
 
     bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode();
     Pasteboard::generalPasteboard()->setSelectionMode(true);
@@ -961,14 +946,9 @@
     return true;
 }
 
-static bool executePasteAndMatchStyle(Frame& frame, Event*, EditorCommandSource source, const String&)
+static bool executePasteAndMatchStyle(Frame& frame, Event*, EditorCommandSource, const String&)
 {
-    if (source == CommandFromMenuOrKeyBinding) {
-        UserTypingGestureIndicator typingGestureIndicator(&frame);
-        frame.editor().pasteAsPlainText();
-    } else {
-        frame.editor().pasteAsPlainText();
-    }
+    frame.editor().pasteAsPlainText();
     return true;
 }
 
@@ -1048,10 +1028,8 @@
 {
     RefPtr<Range> mark = frame.editor().mark().toNormalizedRange();
     RefPtr<Range> selection = frame.editor().selectedRange();
-    if (!mark || !selection) {
-        systemBeep();
+    if (!mark || !selection)
         return false;
-    }
     frame.selection().setSelectedRange(unionDOMRanges(mark.get(), selection.get()).get(), DOWNSTREAM, true);
     return true;
 }
@@ -1099,10 +1077,8 @@
 {
     const VisibleSelection& mark = frame.editor().mark();
     const VisibleSelection& selection = frame.selection().selection();
-    if (mark.isNone() || selection.isNone()) {
-        systemBeep();
+    if (mark.isNone() || selection.isNone())
         return false;
-    }
     frame.selection().setSelection(mark);
     frame.editor().setMark(selection);
     return true;
@@ -1664,12 +1640,12 @@
 
 Editor::Command Editor::command(const String& commandName)
 {
-    return Command(internalCommand(commandName), CommandFromMenuOrKeyBinding, m_frame);
+    return Command(internalCommand(commandName), CommandFromMenuOrKeyBinding, &m_frame);
 }
 
 Editor::Command Editor::command(const String& commandName, EditorCommandSource source)
 {
-    return Command(internalCommand(commandName), source, m_frame);
+    return Command(internalCommand(commandName), source, &m_frame);
 }
 
 bool Editor::commandIsSupportedFromMenuOrKeyBinding(const String& commandName)
diff --git a/Source/core/editing/EditorInsertAction.h b/Source/core/editing/EditorInsertAction.h
deleted file mode 100644
index 92ee906..0000000
--- a/Source/core/editing/EditorInsertAction.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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,
- * 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 EditorInsertAction_h
-#define EditorInsertAction_h
-
-namespace WebCore {
-
-// This must be kept in sync with WebViewInsertAction defined in WebEditingDelegate.h
-enum EditorInsertAction {
-    EditorInsertActionTyped,
-    EditorInsertActionPasted,
-    EditorInsertActionDropped
-};
-
-} // namespace
-
-#endif
diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
index 2612860..4fb8a6e 100644
--- a/Source/core/editing/FrameSelection.cpp
+++ b/Source/core/editing/FrameSelection.cpp
@@ -41,6 +41,7 @@
 #include "core/editing/Editor.h"
 #include "core/editing/InputMethodController.h"
 #include "core/editing/RenderedPosition.h"
+#include "core/editing/SpellChecker.h"
 #include "core/editing/TextIterator.h"
 #include "core/editing/TypingCommand.h"
 #include "core/editing/VisibleUnits.h"
@@ -52,14 +53,12 @@
 #include "core/page/EditorClient.h"
 #include "core/page/EventHandler.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/page/SpatialNavigation.h"
-#include "core/platform/SecureTextInput.h"
-#include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/rendering/HitTestRequest.h"
 #include "core/rendering/HitTestResult.h"
@@ -68,6 +67,8 @@
 #include "core/rendering/RenderTheme.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/RenderWidget.h"
+#include "platform/SecureTextInput.h"
+#include "platform/geometry/FloatQuad.h"
 #include "wtf/text/CString.h"
 
 #define EDIT_DEBUG 0
@@ -117,14 +118,6 @@
     return node ? node->treeScope().rootNode() : 0;
 }
 
-Element* FrameSelection::rootEditableElementRespectingShadowTree() const
-{
-    Element* selectionRoot = m_selection.rootEditableElement();
-    if (selectionRoot && selectionRoot->isInShadowTree())
-        selectionRoot = selectionRoot->shadowHost();
-    return selectionRoot;
-}
-
 void FrameSelection::moveTo(const VisiblePosition &pos, EUserTriggered userTriggered, CursorAlignOnScroll align)
 {
     SetSelectionOptions options = CloseTyping | ClearTypingStyle | userTriggered;
@@ -218,7 +211,7 @@
     }
 
     newSelection.setIsDirectional(isDirectional); // Adjusting base and extent will make newSelection always directional
-    if (m_selection == newSelection || !shouldChangeSelection(newSelection))
+    if (m_selection == newSelection)
         return;
 
     setSelection(newSelection, granularity);
@@ -243,7 +236,7 @@
     // if document->frame() == m_frame we can get into an infinite loop
     if (s.base().anchorNode()) {
         Document& document = *s.base().document();
-        if (document.frame() && document.frame() != m_frame && &document != m_frame->document()) {
+        if (document.frame() && document.frame() != m_frame && document != m_frame->document()) {
             RefPtr<Frame> guard = document.frame();
             document.frame()->selection().setSelection(s, options, align, granularity);
             // It's possible that during the above set selection, this FrameSelection has been modified by
@@ -301,7 +294,7 @@
     }
 
     notifyAccessibilityForSelectionChange();
-    m_frame->document()->enqueueDocumentEvent(Event::create(eventNames().selectionchangeEvent));
+    m_frame->document()->enqueueDocumentEvent(Event::create(EventTypeNames::selectionchange));
 }
 
 static bool removingNodeRemovesPosition(Node* node, const Position& position)
@@ -411,16 +404,10 @@
     return Position(toText(node), positionOffset);
 }
 
-static inline bool nodeIsDetachedFromDocument(const Node& node)
-{
-    Node* highest = node.highestAncestor();
-    return highest->nodeType() == Node::DOCUMENT_FRAGMENT_NODE && !highest->isShadowRoot();
-}
-
 void FrameSelection::didUpdateCharacterData(CharacterData* node, unsigned offset, unsigned oldLength, unsigned newLength)
 {
     // The fragment check is a performance optimization. See http://trac.webkit.org/changeset/30062.
-    if (isNone() || !node || nodeIsDetachedFromDocument(*node))
+    if (isNone() || !node || !node->inDocument())
         return;
 
     Position base = updatePositionAfterAdoptingTextReplacement(m_selection.base(), node, offset, oldLength, newLength);
@@ -449,7 +436,7 @@
 
 void FrameSelection::didMergeTextNodes(const Text& oldNode, unsigned offset)
 {
-    if (isNone() || nodeIsDetachedFromDocument(oldNode))
+    if (isNone() || !oldNode.inDocument())
         return;
     Position base = updatePostionAfterAdoptingTextNodesMerged(m_selection.base(), oldNode, offset);
     Position extent = updatePostionAfterAdoptingTextNodesMerged(m_selection.extent(), oldNode, offset);
@@ -473,7 +460,7 @@
 
 void FrameSelection::didSplitTextNode(const Text& oldNode)
 {
-    if (isNone() || nodeIsDetachedFromDocument(oldNode))
+    if (isNone() || !oldNode.inDocument())
         return;
     Position base = updatePostionAfterAdoptingTextNodeSplit(m_selection.base(), oldNode);
     Position extent = updatePostionAfterAdoptingTextNodeSplit(m_selection.extent(), oldNode);
@@ -957,10 +944,6 @@
         trialFrameSelection.setSelection(m_selection);
         trialFrameSelection.modify(alter, direction, granularity, NotUserTriggered);
 
-        bool change = shouldChangeSelection(trialFrameSelection.selection());
-        if (!change)
-            return false;
-
         if (trialFrameSelection.selection().isRange() && m_selection.isCaret() && !dispatchSelectStart())
             return false;
     }
@@ -1074,10 +1057,6 @@
         FrameSelection trialFrameSelection;
         trialFrameSelection.setSelection(m_selection);
         trialFrameSelection.modify(alter, verticalDistance, direction, NotUserTriggered);
-
-        bool change = shouldChangeSelection(trialFrameSelection.selection());
-        if (!change)
-            return false;
     }
 
     willBeModified(alter, direction == DirectionUp ? DirectionBackward : DirectionForward);
@@ -1324,71 +1303,6 @@
         CaretBase::paintCaret(m_selection.start().deprecatedNode(), context, paintOffset, clipRect);
 }
 
-void FrameSelection::debugRenderer(RenderObject *r, bool selected) const
-{
-    if (r->node()->isElementNode()) {
-        Element* element = toElement(r->node());
-        fprintf(stderr, "%s%s\n", selected ? "==> " : "    ", element->localName().string().utf8().data());
-    } else if (r->isText()) {
-        RenderText* textRenderer = toRenderText(r);
-        if (!textRenderer->textLength() || !textRenderer->firstTextBox()) {
-            fprintf(stderr, "%s#text (empty)\n", selected ? "==> " : "    ");
-            return;
-        }
-
-        static const int max = 36;
-        String text = textRenderer->text();
-        int textLength = text.length();
-        if (selected) {
-            int offset = 0;
-            if (r->node() == m_selection.start().containerNode())
-                offset = m_selection.start().computeOffsetInContainerNode();
-            else if (r->node() == m_selection.end().containerNode())
-                offset = m_selection.end().computeOffsetInContainerNode();
-
-            int pos;
-            InlineTextBox* box = textRenderer->findNextInlineTextBox(offset, pos);
-            text = text.substring(box->start(), box->len());
-
-            String show;
-            int mid = max / 2;
-            int caret = 0;
-
-            // text is shorter than max
-            if (textLength < max) {
-                show = text;
-                caret = pos;
-            } else if (pos - mid < 0) {
-                // too few characters to left
-                show = text.left(max - 3) + "...";
-                caret = pos;
-            } else if (pos - mid >= 0 && pos + mid <= textLength) {
-                // enough characters on each side
-                show = "..." + text.substring(pos - mid + 3, max - 6) + "...";
-                caret = mid;
-            } else {
-                // too few characters on right
-                show = "..." + text.right(max - 3);
-                caret = pos - (textLength - show.length());
-            }
-
-            show.replace('\n', ' ');
-            show.replace('\r', ' ');
-            fprintf(stderr, "==> #text : \"%s\" at offset %d\n", show.utf8().data(), pos);
-            fprintf(stderr, "           ");
-            for (int i = 0; i < caret; i++)
-                fprintf(stderr, " ");
-            fprintf(stderr, "^\n");
-        } else {
-            if ((int)text.length() > max)
-                text = text.left(max - 3) + "...";
-            else
-                text = text.left(max);
-            fprintf(stderr, "    #text : \"%s\"\n", text.utf8().data());
-        }
-    }
-}
-
 bool FrameSelection::contains(const LayoutPoint& point)
 {
     Document* document = m_frame->document();
@@ -1396,7 +1310,7 @@
     // Treat a collapsed selection like no selection.
     if (!isRange())
         return false;
-    if (!document->renderer())
+    if (!document->renderView())
         return false;
 
     HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
@@ -1462,10 +1376,8 @@
 
     // Focus on the parent frame, and then select from before this element to after.
     VisibleSelection newSelection(beforeOwnerElement, afterOwnerElement);
-    if (parent->selection().shouldChangeSelection(newSelection)) {
-        page->focusController().setFocusedFrame(parent);
-        parent->selection().setSelection(newSelection);
-    }
+    page->focusController().setFocusedFrame(parent);
+    parent->selection().setSelection(newSelection);
 }
 
 void FrameSelection::selectAll()
@@ -1500,14 +1412,11 @@
     if (!root)
         return;
 
-    if (selectStartTarget && !selectStartTarget->dispatchEvent(Event::createCancelableBubble(eventNames().selectstartEvent)))
+    if (selectStartTarget && !selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventTypeNames::selectstart)))
         return;
 
     VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode(root.get()));
-
-    if (shouldChangeSelection(newSelection))
-        setSelection(newSelection);
-
+    setSelection(newSelection);
     selectFrameElementInParentIfFullySelected();
     notifyRendererOfSelectionChange(UserTriggered);
 }
@@ -1516,7 +1425,7 @@
 {
     if (!range || !range->startContainer() || !range->endContainer())
         return false;
-    ASSERT(&range->startContainer()->document() == &range->endContainer()->document());
+    ASSERT(range->startContainer()->document() == range->endContainer()->document());
 
     m_frame->document()->updateLayoutIgnorePendingStylesheets();
 
@@ -1552,17 +1461,20 @@
 {
     bool activeAndFocused = isFocusedAndActive();
 
+    RefPtr<Document> document = m_frame->document();
+    document->updateStyleIfNeeded();
+
     // Because RenderObject::selectionBackgroundColor() and
     // RenderObject::selectionForegroundColor() check if the frame is active,
     // we have to update places those colors were painted.
-    if (RenderView* view = m_frame->document()->renderView())
+    if (RenderView* view = document->renderView())
         view->repaintSelection();
 
     // Caret appears in the active frame.
     if (activeAndFocused)
         setSelectionFromNone();
     else
-        m_frame->editor().spellCheckAfterBlur();
+        m_frame->spellChecker().spellCheckAfterBlur();
     setCaretVisibility(activeAndFocused ? Visible : Hidden);
 
     // Update for caps lock state
@@ -1571,7 +1483,7 @@
     // Because StyleResolver::checkOneSelector() and
     // RenderTheme::isFocused() check if the frame is active, we have to
     // update style and theme state that depended on those.
-    if (Element* element = m_frame->document()->focusedElement()) {
+    if (Element* element = document->focusedElement()) {
         element->setNeedsStyleRecalc();
         if (RenderObject* renderer = element->renderer()) {
             if (renderer && renderer->style()->hasAppearance())
@@ -1580,7 +1492,7 @@
     }
 
     // Secure keyboard entry is set by the active frame.
-    if (m_frame->document()->useSecureKeyboardEntryWhenActive())
+    if (document->useSecureKeyboardEntryWhenActive())
         setUseSecureKeyboardEntry(activeAndFocused);
 }
 
@@ -1815,41 +1727,20 @@
     return selectedText();
 }
 
-bool FrameSelection::shouldDeleteSelection(const VisibleSelection& selection) const
-{
-    return m_frame->editor().client().shouldDeleteRange(selection.toNormalizedRange().get());
-}
-
 FloatRect FrameSelection::bounds(bool clipToVisibleContent) const
 {
-    RenderView* root = m_frame->contentRenderer();
+    m_frame->document()->updateStyleIfNeeded();
+
     FrameView* view = m_frame->view();
-    if (!root || !view)
-        return LayoutRect();
+    RenderView* renderView = m_frame->contentRenderer();
 
-    LayoutRect selectionRect = root->selectionBounds(clipToVisibleContent);
+    if (!view || !renderView)
+        return FloatRect();
+
+    LayoutRect selectionRect = renderView->selectionBounds(clipToVisibleContent);
     return clipToVisibleContent ? intersection(selectionRect, view->visibleContentRect()) : selectionRect;
 }
 
-void FrameSelection::getClippedVisibleTextRectangles(Vector<FloatRect>& rectangles) const
-{
-    RenderView* root = m_frame->contentRenderer();
-    if (!root)
-        return;
-
-    FloatRect visibleContentRect = m_frame->view()->visibleContentRect();
-
-    Vector<FloatQuad> quads;
-    toNormalizedRange()->textQuads(quads, true);
-
-    size_t size = quads.size();
-    for (size_t i = 0; i < size; ++i) {
-        FloatRect intersectionRect = intersection(quads[i].enclosingBoundingBox(), visibleContentRect);
-        if (!intersectionRect.isEmpty())
-            rectangles.append(intersectionRect);
-    }
-}
-
 // Scans logically forward from "start", including any child frames.
 static HTMLFormElement* scanForForm(Node* start)
 {
@@ -1934,24 +1825,13 @@
         setSelection(VisibleSelection(firstPositionInOrBeforeNode(node), DOWNSTREAM));
 }
 
-bool FrameSelection::shouldChangeSelection(const VisibleSelection& newSelection) const
-{
-    return m_frame->editor().shouldChangeSelection(selection(), newSelection, newSelection.affinity(), false);
-}
-
 bool FrameSelection::dispatchSelectStart()
 {
     Node* selectStartTarget = m_selection.extent().containerNode();
     if (!selectStartTarget)
         return true;
 
-    return selectStartTarget->dispatchEvent(Event::createCancelableBubble(eventNames().selectstartEvent));
-}
-
-inline bool FrameSelection::visualWordMovementEnabled() const
-{
-    Settings* settings = m_frame ? m_frame->settings() : 0;
-    return settings && settings->visualWordMovementEnabled();
+    return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventTypeNames::selectstart));
 }
 
 void FrameSelection::setShouldShowBlockCursor(bool shouldShowBlockCursor)
diff --git a/Source/core/editing/FrameSelection.h b/Source/core/editing/FrameSelection.h
index 470dce0..d4edf61 100644
--- a/Source/core/editing/FrameSelection.h
+++ b/Source/core/editing/FrameSelection.h
@@ -30,10 +30,10 @@
 #include "core/editing/Caret.h"
 #include "core/editing/EditingStyle.h"
 #include "core/editing/VisibleSelection.h"
-#include "core/platform/Timer.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/LayoutRect.h"
 #include "core/rendering/ScrollBehavior.h"
+#include "platform/Timer.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/Noncopyable.h"
 
 namespace WebCore {
@@ -82,7 +82,6 @@
     Element* rootEditableElement() const { return m_selection.rootEditableElement(); }
     Element* rootEditableElementOrDocumentElement() const;
     Node* rootEditableElementOrTreeScopeRootNode() const;
-    Element* rootEditableElementRespectingShadowTree() const;
 
     bool rendererIsEditable() const { return m_selection.rendererIsEditable(); }
     bool isContentEditable() const { return m_selection.isContentEditable(); }
@@ -152,8 +151,6 @@
 
     PassRefPtr<Range> toNormalizedRange() const { return m_selection.toNormalizedRange(); }
 
-    void debugRenderer(RenderObject*, bool selected) const;
-
     void nodeWillBeRemoved(Node*);
     void didUpdateCharacterData(CharacterData*, unsigned offset, unsigned oldLength, unsigned newLength);
     void didMergeTextNodes(const Text& oldNode, unsigned offset);
@@ -184,8 +181,6 @@
     void showTreeForThis() const;
 #endif
 
-    bool shouldChangeSelection(const VisibleSelection&) const;
-    bool shouldDeleteSelection(const VisibleSelection&) const;
     enum EndPointsAdjustmentMode { AdjustEndpointsAtBidiBoundary, DoNotAdjsutEndpoints };
     void setNonDirectionalSelectionIfNeeded(const VisibleSelection&, TextGranularity, EndPointsAdjustmentMode = DoNotAdjsutEndpoints);
     void setFocusedNodeIfNeeded();
@@ -203,8 +198,6 @@
 
     FloatRect bounds(bool clipToVisibleContent = true) const;
 
-    void getClippedVisibleTextRectangles(Vector<FloatRect>&) const;
-
     HTMLFormElement* currentForm() const;
 
     void revealSelection(const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent);
@@ -249,8 +242,6 @@
 
     bool dispatchSelectStart();
 
-    bool visualWordMovementEnabled() const;
-
     void updateSelectionIfNeeded(const Position& base, const Position& extent, const Position& start, const Position& end);
 
     Frame* m_frame;
diff --git a/Source/core/editing/IndentOutdentCommand.cpp b/Source/core/editing/IndentOutdentCommand.cpp
index fae2f40..a98c166 100644
--- a/Source/core/editing/IndentOutdentCommand.cpp
+++ b/Source/core/editing/IndentOutdentCommand.cpp
@@ -53,31 +53,31 @@
 bool IndentOutdentCommand::tryIndentingAsListItem(const Position& start, const Position& end)
 {
     // If our selection is not inside a list, bail out.
-    Node* lastNodeInSelectedParagraph = start.deprecatedNode();
-    RefPtr<Element> listNode = enclosingList(lastNodeInSelectedParagraph);
+    RefPtr<Node> lastNodeInSelectedParagraph = start.deprecatedNode();
+    RefPtr<Element> listNode = enclosingList(lastNodeInSelectedParagraph.get());
     if (!listNode)
         return false;
 
     // Find the block that we want to indent.  If it's not a list item (e.g., a div inside a list item), we bail out.
-    Element* selectedListItem = enclosingBlock(lastNodeInSelectedParagraph);
+    RefPtr<Element> selectedListItem = enclosingBlock(lastNodeInSelectedParagraph.get());
 
     // FIXME: we need to deal with the case where there is no li (malformed HTML)
     if (!selectedListItem->hasTagName(liTag))
         return false;
 
     // FIXME: previousElementSibling does not ignore non-rendered content like <span></span>.  Should we?
-    Element* previousList = selectedListItem->previousElementSibling();
-    Element* nextList = selectedListItem->nextElementSibling();
+    RefPtr<Element> previousList = selectedListItem->previousElementSibling();
+    RefPtr<Element> nextList = selectedListItem->nextElementSibling();
 
     RefPtr<Element> newList = document().createElement(listNode->tagQName(), false);
-    insertNodeBefore(newList, selectedListItem);
+    insertNodeBefore(newList, selectedListItem.get());
 
-    moveParagraphWithClones(start, end, newList.get(), selectedListItem);
+    moveParagraphWithClones(start, end, newList.get(), selectedListItem.get());
 
-    if (canMergeLists(previousList, newList.get()))
-        mergeIdenticalElements(previousList, newList);
-    if (canMergeLists(newList.get(), nextList))
-        mergeIdenticalElements(newList, nextList);
+    if (canMergeLists(previousList.get(), newList.get()))
+        mergeIdenticalElements(previousList.get(), newList.get());
+    if (canMergeLists(newList.get(), nextList.get()))
+        mergeIdenticalElements(newList.get(), nextList.get());
 
     return true;
 }
diff --git a/Source/core/editing/InputMethodController.cpp b/Source/core/editing/InputMethodController.cpp
index dc90969..da6ed10 100644
--- a/Source/core/editing/InputMethodController.cpp
+++ b/Source/core/editing/InputMethodController.cpp
@@ -32,13 +32,12 @@
 #include "core/dom/Element.h"
 #include "core/dom/Range.h"
 #include "core/dom/Text.h"
-#include "core/dom/UserTypingGestureIndicator.h"
 #include "core/editing/Editor.h"
 #include "core/editing/TypingCommand.h"
 #include "core/html/HTMLTextAreaElement.h"
 #include "core/page/EditorClient.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderObject.h"
 
 namespace WebCore {
@@ -73,12 +72,12 @@
 
 // ----------------------------
 
-PassOwnPtr<InputMethodController> InputMethodController::create(Frame* frame)
+PassOwnPtr<InputMethodController> InputMethodController::create(Frame& frame)
 {
     return adoptPtr(new InputMethodController(frame));
 }
 
-InputMethodController::InputMethodController(Frame* frame)
+InputMethodController::InputMethodController(Frame& frame)
     : m_frame(frame)
     , m_compositionStart(0)
     , m_compositionEnd(0)
@@ -91,7 +90,7 @@
 
 inline Editor& InputMethodController::editor() const
 {
-    return m_frame->editor();
+    return m_frame.editor();
 }
 
 inline EditorClient& InputMethodController::editorClient() const
@@ -107,7 +106,7 @@
 
 bool InputMethodController::insertTextForConfirmedComposition(const String& text)
 {
-    return m_frame->eventHandler()->handleTextInputEvent(text, 0, TextEventInputComposition);
+    return m_frame.eventHandler()->handleTextInputEvent(text, 0, TextEventInputComposition);
 }
 
 void InputMethodController::selectComposition() const
@@ -120,7 +119,7 @@
     // See <http://bugs.webkit.org/show_bug.cgi?id=15781>
     VisibleSelection selection;
     selection.setWithoutValidation(range->startPosition(), range->endPosition());
-    m_frame->selection().setSelection(selection, 0);
+    m_frame.selection().setSelection(selection, 0);
 }
 
 void InputMethodController::confirmComposition()
@@ -168,8 +167,8 @@
         return;
 
     // Check if selection start and selection end are valid.
-    Position start = m_frame->selection().start();
-    Position end = m_frame->selection().end();
+    Position start = m_frame.selection().start();
+    Position end = m_frame.selection().end();
     if (start.containerNode() == m_compositionNode
         && end.containerNode() == m_compositionNode
         && static_cast<unsigned>(start.computeOffsetInContainerNode()) >= m_compositionStart
@@ -183,7 +182,6 @@
 void InputMethodController::finishComposition(const String& text, FinishCompositionMode mode)
 {
     ASSERT(mode == ConfirmComposition || mode == CancelComposition);
-    UserTypingGestureIndicator typingGestureIndicator(m_frame);
 
     Editor::RevealSelectionScope revealSelectionScope(&editor());
 
@@ -192,22 +190,22 @@
     else
         selectComposition();
 
-    if (m_frame->selection().isNone())
+    if (m_frame.selection().isNone())
         return;
 
     // Dispatch a compositionend event to the focused node.
     // We should send this event before sending a TextEvent as written in Section 6.2.2 and 6.2.3 of
     // the DOM Event specification.
-    if (Element* target = m_frame->document()->focusedElement()) {
-        RefPtr<CompositionEvent> event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->domWindow(), text);
+    if (Element* target = m_frame.document()->focusedElement()) {
+        RefPtr<CompositionEvent> event = CompositionEvent::create(EventTypeNames::compositionend, m_frame.domWindow(), text);
         target->dispatchEvent(event, IGNORE_EXCEPTION);
     }
 
     // If text is empty, then delete the old composition here. If text is non-empty, InsertTextCommand::input
     // will delete the old composition with an optimized replace operation.
     if (text.isEmpty() && mode != CancelComposition) {
-        ASSERT(m_frame->document());
-        TypingCommand::deleteSelection(*m_frame->document(), 0);
+        ASSERT(m_frame.document());
+        TypingCommand::deleteSelection(*m_frame.document(), 0);
     }
 
     m_compositionNode = 0;
@@ -217,27 +215,25 @@
 
     if (mode == CancelComposition) {
         // An open typing command that disagrees about current selection would cause issues with typing later on.
-        TypingCommand::closeTyping(m_frame);
+        TypingCommand::closeTyping(&m_frame);
     }
 }
 
 void InputMethodController::setComposition(const String& text, const Vector<CompositionUnderline>& underlines, unsigned selectionStart, unsigned selectionEnd)
 {
-    UserTypingGestureIndicator typingGestureIndicator(m_frame);
-
     Editor::RevealSelectionScope revealSelectionScope(&editor());
 
     // Updates styles before setting selection for composition to prevent
     // inserting the previous composition text into text nodes oddly.
     // See https://bugs.webkit.org/show_bug.cgi?id=46868
-    m_frame->document()->updateStyleIfNeeded();
+    m_frame.document()->updateStyleIfNeeded();
 
     selectComposition();
 
-    if (m_frame->selection().isNone())
+    if (m_frame.selection().isNone())
         return;
 
-    if (Element* target = m_frame->document()->focusedElement()) {
+    if (Element* target = m_frame.document()->focusedElement()) {
         // Dispatch an appropriate composition event to the focused node.
         // We check the composition status and choose an appropriate composition event since this
         // function is used for three purposes:
@@ -258,14 +254,14 @@
             // We should send a compositionstart event only when the given text is not empty because this
             // function doesn't create a composition node when the text is empty.
             if (!text.isEmpty()) {
-                target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, m_frame->domWindow(), m_frame->selectedText()));
-                event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->domWindow(), text);
+                target->dispatchEvent(CompositionEvent::create(EventTypeNames::compositionstart, m_frame.domWindow(), m_frame.selectedText()));
+                event = CompositionEvent::create(EventTypeNames::compositionupdate, m_frame.domWindow(), text);
             }
         } else {
             if (!text.isEmpty())
-                event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->domWindow(), text);
+                event = CompositionEvent::create(EventTypeNames::compositionupdate, m_frame.domWindow(), text);
             else
-                event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->domWindow(), text);
+                event = CompositionEvent::create(EventTypeNames::compositionend, m_frame.domWindow(), text);
         }
         if (event.get())
             target->dispatchEvent(event, IGNORE_EXCEPTION);
@@ -274,20 +270,20 @@
     // If text is empty, then delete the old composition here. If text is non-empty, InsertTextCommand::input
     // will delete the old composition with an optimized replace operation.
     if (text.isEmpty()) {
-        ASSERT(m_frame->document());
-        TypingCommand::deleteSelection(*m_frame->document(), TypingCommand::PreventSpellChecking);
+        ASSERT(m_frame.document());
+        TypingCommand::deleteSelection(*m_frame.document(), TypingCommand::PreventSpellChecking);
     }
 
     m_compositionNode = 0;
     m_customCompositionUnderlines.clear();
 
     if (!text.isEmpty()) {
-        ASSERT(m_frame->document());
-        TypingCommand::insertText(*m_frame->document(), text, TypingCommand::SelectInsertedText | TypingCommand::PreventSpellChecking, TypingCommand::TextCompositionUpdate);
+        ASSERT(m_frame.document());
+        TypingCommand::insertText(*m_frame.document(), text, TypingCommand::SelectInsertedText | TypingCommand::PreventSpellChecking, TypingCommand::TextCompositionUpdate);
 
         // Find out what node has the composition now.
-        Position base = m_frame->selection().base().downstream();
-        Position extent = m_frame->selection().extent();
+        Position base = m_frame.selection().base().downstream();
+        Position extent = m_frame.selection().extent();
         Node* baseNode = base.deprecatedNode();
         unsigned baseOffset = base.deprecatedEditingOffset();
         Node* extentNode = extent.deprecatedNode();
@@ -309,15 +305,15 @@
             unsigned start = std::min(baseOffset + selectionStart, extentOffset);
             unsigned end = std::min(std::max(start, baseOffset + selectionEnd), extentOffset);
             RefPtr<Range> selectedRange = Range::create(baseNode->document(), baseNode, start, baseNode, end);
-            m_frame->selection().setSelectedRange(selectedRange.get(), DOWNSTREAM, false);
+            m_frame.selection().setSelectedRange(selectedRange.get(), DOWNSTREAM, false);
         }
     }
 }
 
 void InputMethodController::setCompositionFromExistingText(const Vector<CompositionUnderline>& underlines, unsigned compositionStart, unsigned compositionEnd)
 {
-    Node* editable = m_frame->selection().rootEditableElement();
-    Position base = m_frame->selection().base().downstream();
+    Node* editable = m_frame.selection().rootEditableElement();
+    Position base = m_frame.selection().base().downstream();
     Node* baseNode = base.anchorNode();
     if (editable->firstChild() == baseNode && editable->lastChild() == baseNode && baseNode->isTextNode()) {
         m_compositionNode = 0;
@@ -325,7 +321,7 @@
 
         if (base.anchorType() != Position::PositionIsOffsetInAnchor)
             return;
-        if (!baseNode || baseNode != m_frame->selection().extent().anchorNode())
+        if (!baseNode || baseNode != m_frame.selection().extent().anchorNode())
             return;
 
         m_compositionNode = toText(baseNode);
@@ -345,7 +341,7 @@
     Editor::RevealSelectionScope revealSelectionScope(&editor());
     SelectionOffsetsScope selectionOffsetsScope(this);
     setSelectionOffsets(PlainTextOffsets(compositionStart, compositionEnd));
-    setComposition(m_frame->selectedText(), underlines, 0, 0);
+    setComposition(m_frame.selectedText(), underlines, 0, 0);
 }
 
 PassRefPtr<Range> InputMethodController::compositionRange() const
@@ -362,13 +358,13 @@
 
 PlainTextOffsets InputMethodController::getSelectionOffsets() const
 {
-    RefPtr<Range> range = m_frame->selection().selection().firstRange();
+    RefPtr<Range> range = m_frame.selection().selection().firstRange();
     if (!range)
         return PlainTextOffsets();
     size_t location;
     size_t length;
     // FIXME: We should change TextIterator::getLocationAndLengthFromRange() returns PlainTextOffsets.
-    if (TextIterator::getLocationAndLengthFromRange(m_frame->selection().rootEditableElementOrTreeScopeRootNode(), range.get(), location, length))
+    if (TextIterator::getLocationAndLengthFromRange(m_frame.selection().rootEditableElementOrTreeScopeRootNode(), range.get(), location, length))
         return PlainTextOffsets(location, location + length);
     return PlainTextOffsets();
 }
diff --git a/Source/core/editing/InputMethodController.h b/Source/core/editing/InputMethodController.h
index 5fd3dd2..506bded 100644
--- a/Source/core/editing/InputMethodController.h
+++ b/Source/core/editing/InputMethodController.h
@@ -52,8 +52,9 @@
 };
 
 class InputMethodController {
+    WTF_MAKE_NONCOPYABLE(InputMethodController);
 public:
-    static PassOwnPtr<InputMethodController> create(Frame*);
+    static PassOwnPtr<InputMethodController> create(Frame&);
     ~InputMethodController();
 
     // international text input composition
@@ -92,7 +93,7 @@
     };
     friend class SelectionOffsetsScope;
 
-    Frame* m_frame;
+    Frame& m_frame;
     RefPtr<Text> m_compositionNode;
     // FIXME: We should use PlainTextOffsets m_compositionRange instead of
     // m_compositionStart/m_compositionEnd.
@@ -102,7 +103,7 @@
     // m_compositionNode.
     Vector<CompositionUnderline> m_customCompositionUnderlines;
 
-    explicit InputMethodController(Frame*);
+    explicit InputMethodController(Frame&);
     Editor& editor() const;
     EditorClient& editorClient() const;
     bool insertTextForConfirmedComposition(const String& text);
diff --git a/Source/core/editing/InsertLineBreakCommand.cpp b/Source/core/editing/InsertLineBreakCommand.cpp
index 659c42d..cb4ad37 100644
--- a/Source/core/editing/InsertLineBreakCommand.cpp
+++ b/Source/core/editing/InsertLineBreakCommand.cpp
@@ -36,7 +36,7 @@
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLElement.h"
 #include "core/html/HTMLTableElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderObject.h"
 
 namespace WebCore {
diff --git a/Source/core/editing/InsertNodeBeforeCommand.cpp b/Source/core/editing/InsertNodeBeforeCommand.cpp
index 16ff925..d30ea73 100644
--- a/Source/core/editing/InsertNodeBeforeCommand.cpp
+++ b/Source/core/editing/InsertNodeBeforeCommand.cpp
@@ -43,7 +43,7 @@
     ASSERT(m_refChild);
     ASSERT(m_refChild->parentNode());
 
-    ASSERT(m_refChild->parentNode()->rendererIsEditable() || !m_refChild->parentNode()->attached());
+    ASSERT(m_refChild->parentNode()->rendererIsEditable() || !m_refChild->parentNode()->confusingAndOftenMisusedAttached());
 }
 
 void InsertNodeBeforeCommand::doApply()
diff --git a/Source/core/editing/InsertTextCommand.cpp b/Source/core/editing/InsertTextCommand.cpp
index 639b518..00ba6a7 100644
--- a/Source/core/editing/InsertTextCommand.cpp
+++ b/Source/core/editing/InsertTextCommand.cpp
@@ -32,7 +32,7 @@
 #include "core/editing/Editor.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/ModifySelectionListLevel.cpp b/Source/core/editing/ModifySelectionListLevel.cpp
index 671abea..e438eb2 100644
--- a/Source/core/editing/ModifySelectionListLevel.cpp
+++ b/Source/core/editing/ModifySelectionListLevel.cpp
@@ -30,7 +30,7 @@
 #include "core/editing/FrameSelection.h"
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderObject.h"
 
 namespace WebCore {
diff --git a/Source/core/editing/RemoveFormatCommand.cpp b/Source/core/editing/RemoveFormatCommand.cpp
index 48bff2b..d36a527 100644
--- a/Source/core/editing/RemoveFormatCommand.cpp
+++ b/Source/core/editing/RemoveFormatCommand.cpp
@@ -34,7 +34,7 @@
 #include "core/editing/ApplyStyleCommand.h"
 #include "core/editing/EditingStyle.h"
 #include "core/editing/FrameSelection.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/RemoveNodeCommand.cpp b/Source/core/editing/RemoveNodeCommand.cpp
index 0640559..4fca7bd 100644
--- a/Source/core/editing/RemoveNodeCommand.cpp
+++ b/Source/core/editing/RemoveNodeCommand.cpp
@@ -45,9 +45,9 @@
 {
     ContainerNode* parent = m_node->parentNode();
     if (!parent || (m_shouldAssumeContentIsAlwaysEditable == DoNotAssumeContentIsAlwaysEditable
-        && !parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable) && parent->attached()))
+        && !parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable) && parent->confusingAndOftenMisusedAttached()))
         return;
-    ASSERT(parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable) || !parent->attached());
+    ASSERT(parent->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable) || !parent->confusingAndOftenMisusedAttached());
 
     m_parent = parent;
     m_refChild = m_node->nextSibling();
diff --git a/Source/core/editing/ReplaceSelectionCommand.cpp b/Source/core/editing/ReplaceSelectionCommand.cpp
index 41a7bde..aa05391 100644
--- a/Source/core/editing/ReplaceSelectionCommand.cpp
+++ b/Source/core/editing/ReplaceSelectionCommand.cpp
@@ -32,11 +32,9 @@
 #include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/css/CSSStyleDeclaration.h"
 #include "core/css/StylePropertySet.h"
-#include "core/events/BeforeTextInsertedEvent.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/Element.h"
-#include "core/events/EventNames.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Text.h"
 #include "core/editing/ApplyStyleCommand.h"
@@ -49,10 +47,12 @@
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
 #include "core/editing/markup.h"
+#include "core/events/BeforeTextInsertedEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLTitleElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderText.h"
 #include "wtf/StdLibExtras.h"
@@ -154,7 +154,7 @@
 
     Node* shadowAncestorNode = editableRoot->deprecatedShadowAncestorNode();
 
-    if (!editableRoot->getAttributeEventListener(eventNames().webkitBeforeTextInsertedEvent) &&
+    if (!editableRoot->getAttributeEventListener(EventTypeNames::webkitBeforeTextInserted) &&
         // FIXME: Remove these checks once textareas and textfields actually register an event handler.
         !(shadowAncestorNode && shadowAncestorNode->renderer() && shadowAncestorNode->renderer()->isTextControl()) &&
         editableRoot->rendererIsRichlyEditable()) {
diff --git a/Source/core/editing/SetSelectionCommand.cpp b/Source/core/editing/SetSelectionCommand.cpp
index 48c86bf..dff5416 100644
--- a/Source/core/editing/SetSelectionCommand.cpp
+++ b/Source/core/editing/SetSelectionCommand.cpp
@@ -27,7 +27,7 @@
 #include "core/editing/SetSelectionCommand.h"
 
 #include "core/dom/Document.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
@@ -41,17 +41,14 @@
 void SetSelectionCommand::doApply()
 {
     FrameSelection& selection = document().frame()->selection();
-    if (selection.shouldChangeSelection(m_selectionToSet) && m_selectionToSet.isNonOrphanedCaretOrRange()) {
-        selection.setSelection(m_selectionToSet, m_options);
-        setEndingSelection(m_selectionToSet);
-    }
+    selection.setSelection(m_selectionToSet, m_options);
+    setEndingSelection(m_selectionToSet);
 }
 
 void SetSelectionCommand::doUnapply()
 {
     FrameSelection& selection = document().frame()->selection();
-    if (selection.shouldChangeSelection(startingSelection()) && startingSelection().isNonOrphanedCaretOrRange())
-        selection.setSelection(startingSelection(), m_options);
+    selection.setSelection(startingSelection(), m_options);
 }
 
 } // namespace WebCore
diff --git a/Source/core/editing/SpellCheckRequester.cpp b/Source/core/editing/SpellCheckRequester.cpp
index 5ca2367..6c14888 100644
--- a/Source/core/editing/SpellCheckRequester.cpp
+++ b/Source/core/editing/SpellCheckRequester.cpp
@@ -30,12 +30,11 @@
 #include "core/dom/DocumentMarkerController.h"
 #include "core/dom/Node.h"
 #include "core/dom/Range.h"
-#include "core/editing/Editor.h"
-#include "core/page/EditorClient.h"
-#include "core/page/Frame.h"
+#include "core/editing/SpellChecker.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/text/TextCheckerClient.h"
+#include "platform/text/TextCheckerClient.h"
 
 namespace WebCore {
 
@@ -71,7 +70,7 @@
     if (!text.length())
         return PassRefPtr<SpellCheckRequest>();
 
-    const Vector<DocumentMarker*>& markers = checkingRange->ownerDocument().markers()->markersInRange(checkingRange.get(), DocumentMarker::MisspellingMarkers());
+    const Vector<DocumentMarker*>& markers = checkingRange->ownerDocument().markers()->markersInRange(checkingRange.get(), DocumentMarker::SpellCheckClientMarkers());
     Vector<uint32_t> hashes(markers.size());
     Vector<unsigned> offsets(markers.size());
     for (size_t i = 0; i < markers.size(); i++) {
@@ -136,7 +135,7 @@
 
 TextCheckerClient& SpellCheckRequester::client() const
 {
-    return m_frame.editor().client().textChecker();
+    return m_frame.spellChecker().textChecker();
 }
 
 void SpellCheckRequester::timerFiredToProcessQueuedRequest(Timer<SpellCheckRequester>*)
@@ -236,7 +235,7 @@
         return;
     }
 
-    m_frame.editor().markAndReplaceFor(m_processingRequest, results);
+    m_frame.spellChecker().markAndReplaceFor(m_processingRequest, results);
 
     if (m_lastProcessedSequence < sequence)
         m_lastProcessedSequence = sequence;
@@ -250,13 +249,12 @@
 {
     TextCheckingRequestData requestData = m_processingRequest->data();
     if (requestData.sequence() == sequence) {
-        unsigned markers = 0;
-        if (requestData.mask() & TextCheckingTypeSpelling)
-            markers |= DocumentMarker::Spelling;
-        if (requestData.mask() & TextCheckingTypeGrammar)
-            markers |= DocumentMarker::Grammar;
-        if (markers)
-            m_frame.document()->markers()->removeMarkers(m_processingRequest->checkingRange().get(), markers);
+        DocumentMarker::MarkerTypes markers = DocumentMarker::SpellCheckClientMarkers();
+        if (!requestData.maskContains(TextCheckingTypeSpelling))
+            markers.remove(DocumentMarker::Spelling);
+        if (!requestData.maskContains(TextCheckingTypeGrammar))
+            markers.remove(DocumentMarker::Grammar);
+        m_frame.document()->markers()->removeMarkers(m_processingRequest->checkingRange().get(), markers);
     }
     didCheck(sequence, results);
 }
diff --git a/Source/core/editing/SpellCheckRequester.h b/Source/core/editing/SpellCheckRequester.h
index 9a96f59..6eefe8f 100644
--- a/Source/core/editing/SpellCheckRequester.h
+++ b/Source/core/editing/SpellCheckRequester.h
@@ -28,8 +28,8 @@
 
 #include "core/dom/Element.h"
 #include "core/dom/Range.h"
-#include "core/platform/Timer.h"
-#include "core/platform/text/TextChecking.h"
+#include "platform/Timer.h"
+#include "platform/text/TextChecking.h"
 #include "wtf/Deque.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/editing/SpellChecker.cpp b/Source/core/editing/SpellChecker.cpp
new file mode 100644
index 0000000..6520f41
--- /dev/null
+++ b/Source/core/editing/SpellChecker.cpp
@@ -0,0 +1,876 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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,
+ * 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/SpellChecker.h"
+
+#include "HTMLNames.h"
+#include "core/dom/Document.h"
+#include "core/dom/DocumentMarkerController.h"
+#include "core/dom/Element.h"
+#include "core/dom/NodeTraversal.h"
+#include "core/editing/Editor.h"
+#include "core/editing/FrameSelection.h"
+#include "core/editing/SpellCheckRequester.h"
+#include "core/editing/TextCheckingHelper.h"
+#include "core/editing/VisibleUnits.h"
+#include "core/editing/htmlediting.h"
+#include "core/html/HTMLInputElement.h"
+#include "core/page/EditorClient.h"
+#include "core/frame/Frame.h"
+#include "core/page/Page.h"
+#include "core/page/Settings.h"
+#include "core/rendering/RenderTextControl.h"
+#include "platform/text/TextCheckerClient.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+namespace {
+
+bool isSelectionInTextField(const VisibleSelection& selection)
+{
+    HTMLTextFormControlElement* textControl = enclosingTextFormControl(selection.start());
+    return textControl && textControl->hasTagName(inputTag) && toHTMLInputElement(textControl)->isTextField();
+}
+
+} // namespace
+
+PassOwnPtr<SpellChecker> SpellChecker::create(Frame& frame)
+{
+    return adoptPtr(new SpellChecker(frame));
+}
+
+EditorClient& SpellChecker::editorClient() const
+{
+    return m_frame.editor().client();
+}
+
+TextCheckerClient& SpellChecker::textChecker() const
+{
+    return editorClient().textChecker();
+}
+
+SpellChecker::SpellChecker(Frame& frame)
+    : m_frame(frame)
+    , m_spellCheckRequester(adoptPtr(new SpellCheckRequester(frame)))
+{
+}
+
+SpellChecker::~SpellChecker()
+{
+}
+
+bool SpellChecker::isContinuousSpellCheckingEnabled() const
+{
+    return editorClient().isContinuousSpellCheckingEnabled();
+}
+
+void SpellChecker::toggleContinuousSpellChecking()
+{
+    editorClient().toggleContinuousSpellChecking();
+    if (isContinuousSpellCheckingEnabled())
+        return;
+    for (Frame* frame = m_frame.page()->mainFrame(); frame && frame->document(); frame = frame->tree()->traverseNext()) {
+        for (Node* node = frame->document()->rootNode(); node; node = NodeTraversal::next(node)) {
+            node->setAlreadySpellChecked(false);
+        }
+    }
+}
+
+bool SpellChecker::isGrammarCheckingEnabled()
+{
+    return editorClient().isGrammarCheckingEnabled();
+}
+
+void SpellChecker::didBeginEditing(Element* element)
+{
+    if (isContinuousSpellCheckingEnabled() && unifiedTextCheckerEnabled()) {
+        bool isTextField = false;
+        HTMLTextFormControlElement* enclosingHTMLTextFormControlElement = 0;
+        if (!isHTMLTextFormControlElement(element))
+            enclosingHTMLTextFormControlElement = enclosingTextFormControl(firstPositionInNode(element));
+        element = enclosingHTMLTextFormControlElement ? enclosingHTMLTextFormControlElement : element;
+        Element* parent = element;
+        if (isHTMLTextFormControlElement(element)) {
+            HTMLTextFormControlElement* textControl = toHTMLTextFormControlElement(element);
+            parent = textControl;
+            element = textControl->innerTextElement();
+            isTextField = textControl->hasTagName(inputTag) && toHTMLInputElement(textControl)->isTextField();
+        }
+
+        if (isTextField || !parent->isAlreadySpellChecked()) {
+            // We always recheck textfields because markers are removed from them on blur.
+            VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(element);
+            markMisspellingsAndBadGrammar(selection);
+            if (!isTextField)
+                parent->setAlreadySpellChecked(true);
+        }
+    }
+}
+
+void SpellChecker::ignoreSpelling()
+{
+    if (RefPtr<Range> selectedRange = m_frame.selection().toNormalizedRange())
+        m_frame.document()->markers()->removeMarkers(selectedRange.get(), DocumentMarker::Spelling);
+}
+
+void SpellChecker::advanceToNextMisspelling(bool startBeforeSelection)
+{
+    // The basic approach is to search in two phases - from the selection end to the end of the doc, and
+    // then we wrap and search from the doc start to (approximately) where we started.
+
+    // Start at the end of the selection, search to edge of document. Starting at the selection end makes
+    // repeated "check spelling" commands work.
+    VisibleSelection selection(m_frame.selection().selection());
+    RefPtr<Range> spellingSearchRange(rangeOfContents(m_frame.document()));
+
+    bool startedWithSelection = false;
+    if (selection.start().deprecatedNode()) {
+        startedWithSelection = true;
+        if (startBeforeSelection) {
+            VisiblePosition start(selection.visibleStart());
+            // We match AppKit's rule: Start 1 character before the selection.
+            VisiblePosition oneBeforeStart = start.previous();
+            setStart(spellingSearchRange.get(), oneBeforeStart.isNotNull() ? oneBeforeStart : start);
+        } else {
+            setStart(spellingSearchRange.get(), selection.visibleEnd());
+        }
+    }
+
+    Position position = spellingSearchRange->startPosition();
+    if (!isEditablePosition(position)) {
+        // This shouldn't happen in very often because the Spelling menu items aren't enabled unless the
+        // selection is editable.
+        // This can happen in Mail for a mix of non-editable and editable content (like Stationary),
+        // when spell checking the whole document before sending the message.
+        // In that case the document might not be editable, but there are editable pockets that need to be spell checked.
+
+        position = firstEditablePositionAfterPositionInRoot(position, m_frame.document()->documentElement()).deepEquivalent();
+        if (position.isNull())
+            return;
+
+        Position rangeCompliantPosition = position.parentAnchoredEquivalent();
+        spellingSearchRange->setStart(rangeCompliantPosition.deprecatedNode(), rangeCompliantPosition.deprecatedEditingOffset(), IGNORE_EXCEPTION);
+        startedWithSelection = false; // won't need to wrap
+    }
+
+    // topNode defines the whole range we want to operate on
+    Node* topNode = highestEditableRoot(position);
+    // FIXME: lastOffsetForEditing() is wrong here if editingIgnoresContent(highestEditableRoot()) returns true (e.g. a <table>)
+    spellingSearchRange->setEnd(topNode, lastOffsetForEditing(topNode), IGNORE_EXCEPTION);
+
+    // If spellingSearchRange starts in the middle of a word, advance to the next word so we start checking
+    // at a word boundary. Going back by one char and then forward by a word does the trick.
+    if (startedWithSelection) {
+        VisiblePosition oneBeforeStart = startVisiblePosition(spellingSearchRange.get(), DOWNSTREAM).previous();
+        if (oneBeforeStart.isNotNull())
+            setStart(spellingSearchRange.get(), endOfWord(oneBeforeStart));
+        // else we were already at the start of the editable node
+    }
+
+    if (spellingSearchRange->collapsed(IGNORE_EXCEPTION))
+        return; // nothing to search in
+
+    // We go to the end of our first range instead of the start of it, just to be sure
+    // we don't get foiled by any word boundary problems at the start. It means we might
+    // do a tiny bit more searching.
+    Node* searchEndNodeAfterWrap = spellingSearchRange->endContainer();
+    int searchEndOffsetAfterWrap = spellingSearchRange->endOffset();
+
+    int misspellingOffset = 0;
+    GrammarDetail grammarDetail;
+    int grammarPhraseOffset = 0;
+    RefPtr<Range> grammarSearchRange;
+    String badGrammarPhrase;
+    String misspelledWord;
+
+    bool isSpelling = true;
+    int foundOffset = 0;
+    String foundItem;
+    RefPtr<Range> firstMisspellingRange;
+    if (unifiedTextCheckerEnabled()) {
+        grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
+        foundItem = TextCheckingHelper(editorClient(), spellingSearchRange).findFirstMisspellingOrBadGrammar(isGrammarCheckingEnabled(), isSpelling, foundOffset, grammarDetail);
+        if (isSpelling) {
+            misspelledWord = foundItem;
+            misspellingOffset = foundOffset;
+        } else {
+            badGrammarPhrase = foundItem;
+            grammarPhraseOffset = foundOffset;
+        }
+    } else {
+        misspelledWord = TextCheckingHelper(editorClient(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
+        grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
+        if (!misspelledWord.isEmpty()) {
+            // Stop looking at start of next misspelled word
+            CharacterIterator chars(grammarSearchRange.get());
+            chars.advance(misspellingOffset);
+            grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION);
+        }
+
+        if (isGrammarCheckingEnabled())
+            badGrammarPhrase = TextCheckingHelper(editorClient(), grammarSearchRange).findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
+    }
+
+    // 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
+    // block rather than at a selection).
+    if (startedWithSelection && !misspelledWord && !badGrammarPhrase) {
+        spellingSearchRange->setStart(topNode, 0, IGNORE_EXCEPTION);
+        // going until the end of the very first chunk we tested is far enough
+        spellingSearchRange->setEnd(searchEndNodeAfterWrap, searchEndOffsetAfterWrap, IGNORE_EXCEPTION);
+
+        if (unifiedTextCheckerEnabled()) {
+            grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
+            foundItem = TextCheckingHelper(editorClient(), spellingSearchRange).findFirstMisspellingOrBadGrammar(isGrammarCheckingEnabled(), isSpelling, foundOffset, grammarDetail);
+            if (isSpelling) {
+                misspelledWord = foundItem;
+                misspellingOffset = foundOffset;
+            } else {
+                badGrammarPhrase = foundItem;
+                grammarPhraseOffset = foundOffset;
+            }
+        } else {
+            misspelledWord = TextCheckingHelper(editorClient(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
+            grammarSearchRange = spellingSearchRange->cloneRange(IGNORE_EXCEPTION);
+            if (!misspelledWord.isEmpty()) {
+                // Stop looking at start of next misspelled word
+                CharacterIterator chars(grammarSearchRange.get());
+                chars.advance(misspellingOffset);
+                grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION);
+            }
+
+            if (isGrammarCheckingEnabled())
+                badGrammarPhrase = TextCheckingHelper(editorClient(), grammarSearchRange).findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
+        }
+    }
+
+    if (!badGrammarPhrase.isEmpty()) {
+        // 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.
+
+        ASSERT(badGrammarPhrase.length() > 0);
+        ASSERT(grammarDetail.location != -1 && grammarDetail.length > 0);
+
+        // FIXME 4859190: This gets confused with doubled punctuation at the end of a paragraph
+        RefPtr<Range> badGrammarRange = TextIterator::subrange(grammarSearchRange.get(), grammarPhraseOffset + grammarDetail.location, grammarDetail.length);
+        m_frame.selection().setSelection(VisibleSelection(badGrammarRange.get(), SEL_DEFAULT_AFFINITY));
+        m_frame.selection().revealSelection();
+
+        m_frame.document()->markers()->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, grammarDetail.userDescription);
+    } else if (!misspelledWord.isEmpty()) {
+        // We found a misspelling, but not any earlier bad grammar. Select the misspelling, update the spelling panel, and store
+        // a marker so we draw the red squiggle later.
+
+        RefPtr<Range> misspellingRange = TextIterator::subrange(spellingSearchRange.get(), misspellingOffset, misspelledWord.length());
+        m_frame.selection().setSelection(VisibleSelection(misspellingRange.get(), DOWNSTREAM));
+        m_frame.selection().revealSelection();
+
+        editorClient().updateSpellingUIWithMisspelledWord(misspelledWord);
+        m_frame.document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling);
+    }
+}
+
+String SpellChecker::misspelledWordAtCaretOrRange(Node* clickedNode) const
+{
+    if (!isContinuousSpellCheckingEnabled() || !clickedNode || !isSpellCheckingEnabledFor(clickedNode))
+        return String();
+
+    VisibleSelection selection = m_frame.selection().selection();
+    if (!selection.isContentEditable() || selection.isNone())
+        return String();
+
+    VisibleSelection wordSelection(selection.base());
+    wordSelection.expandUsingGranularity(WordGranularity);
+    RefPtr<Range> wordRange = wordSelection.toNormalizedRange();
+
+    // In compliance with GTK+ applications, additionally allow to provide suggestions when the current
+    // selection exactly match the word selection.
+    if (selection.isRange() && !areRangesEqual(wordRange.get(), selection.toNormalizedRange().get()))
+        return String();
+
+    String word = wordRange->text();
+    if (word.isEmpty())
+        return String();
+
+    int wordLength = word.length();
+    int misspellingLocation = -1;
+    int misspellingLength = 0;
+    textChecker().checkSpellingOfString(word, &misspellingLocation, &misspellingLength);
+
+    return misspellingLength == wordLength ? word : String();
+}
+
+void SpellChecker::showSpellingGuessPanel()
+{
+    if (editorClient().spellingUIIsShowing()) {
+        editorClient().showSpellingUI(false);
+        return;
+    }
+
+    advanceToNextMisspelling(true);
+    editorClient().showSpellingUI(true);
+}
+
+void SpellChecker::clearMisspellingsAndBadGrammar(const VisibleSelection &movingSelection)
+{
+    RefPtr<Range> selectedRange = movingSelection.toNormalizedRange();
+    if (selectedRange)
+        m_frame.document()->markers()->removeMarkers(selectedRange.get(), DocumentMarker::MisspellingMarkers());
+}
+
+void SpellChecker::markMisspellingsAndBadGrammar(const VisibleSelection &movingSelection)
+{
+    markMisspellingsAndBadGrammar(movingSelection, isContinuousSpellCheckingEnabled() && isGrammarCheckingEnabled(), movingSelection);
+}
+
+void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping)
+{
+    if (unifiedTextCheckerEnabled()) {
+        TextCheckingTypeMask textCheckingOptions = 0;
+
+        if (isContinuousSpellCheckingEnabled())
+            textCheckingOptions |= TextCheckingTypeSpelling;
+
+        if (!(textCheckingOptions & TextCheckingTypeSpelling))
+            return;
+
+        if (isGrammarCheckingEnabled())
+            textCheckingOptions |= TextCheckingTypeGrammar;
+
+        VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary));
+        if (textCheckingOptions & TextCheckingTypeGrammar) {
+            VisibleSelection selectedSentence = VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart));
+            markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedRange().get(), selectedSentence.toNormalizedRange().get());
+        } else {
+            markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedRange().get(), adjacentWords.toNormalizedRange().get());
+        }
+        return;
+    }
+
+    if (!isContinuousSpellCheckingEnabled())
+        return;
+
+    // Check spelling of one word
+    RefPtr<Range> misspellingRange;
+    markMisspellings(VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary)), misspellingRange);
+
+    // Autocorrect the misspelled word.
+    if (!misspellingRange)
+        return;
+
+    // Get the misspelled word.
+    const String misspelledWord = plainText(misspellingRange.get());
+    String autocorrectedString = textChecker().getAutoCorrectSuggestionForMisspelledWord(misspelledWord);
+
+    // If autocorrected word is non empty, replace the misspelled word by this word.
+    if (!autocorrectedString.isEmpty()) {
+        VisibleSelection newSelection(misspellingRange.get(), DOWNSTREAM);
+        if (newSelection != m_frame.selection().selection()) {
+            m_frame.selection().setSelection(newSelection);
+        }
+
+        m_frame.editor().replaceSelectionWithText(autocorrectedString, false, false);
+
+        // Reset the charet one character further.
+        m_frame.selection().moveTo(m_frame.selection().end());
+        m_frame.selection().modify(FrameSelection::AlterationMove, DirectionForward, CharacterGranularity);
+    }
+
+    if (!isGrammarCheckingEnabled())
+        return;
+
+    // Check grammar of entire sentence
+    markBadGrammar(VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart)));
+}
+
+void SpellChecker::markMisspellingsOrBadGrammar(const VisibleSelection& selection, bool checkSpelling, RefPtr<Range>& firstMisspellingRange)
+{
+    // This function is called with a selection already expanded to word boundaries.
+    // Might be nice to assert that here.
+
+    // This function is used only for as-you-type checking, so if that's off we do nothing. Note that
+    // grammar checking can only be on if spell checking is also on.
+    if (!isContinuousSpellCheckingEnabled())
+        return;
+
+    RefPtr<Range> searchRange(selection.toNormalizedRange());
+    if (!searchRange)
+        return;
+
+    // If we're not in an editable node, bail.
+    Node* editableNode = searchRange->startContainer();
+    if (!editableNode || !editableNode->rendererIsEditable())
+        return;
+
+    if (!isSpellCheckingEnabledFor(editableNode))
+        return;
+
+    TextCheckingHelper checker(editorClient(), searchRange);
+    if (checkSpelling)
+        checker.markAllMisspellings(firstMisspellingRange);
+    else if (isGrammarCheckingEnabled())
+        checker.markAllBadGrammar();
+}
+
+bool SpellChecker::isSpellCheckingEnabledFor(Node* node) const
+{
+    if (!node)
+        return false;
+    const Element* focusedElement = node->isElementNode() ? toElement(node) : node->parentElement();
+    if (!focusedElement)
+        return false;
+    return focusedElement->isSpellCheckingEnabled();
+}
+
+bool SpellChecker::isSpellCheckingEnabledInFocusedNode() const
+{
+    return isSpellCheckingEnabledFor(m_frame.selection().start().deprecatedNode());
+}
+
+void SpellChecker::markMisspellings(const VisibleSelection& selection, RefPtr<Range>& firstMisspellingRange)
+{
+    markMisspellingsOrBadGrammar(selection, true, firstMisspellingRange);
+}
+
+void SpellChecker::markBadGrammar(const VisibleSelection& selection)
+{
+    RefPtr<Range> firstMisspellingRange;
+    markMisspellingsOrBadGrammar(selection, false, firstMisspellingRange);
+}
+
+void SpellChecker::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, Range* spellingRange, Range* grammarRange)
+{
+    ASSERT(unifiedTextCheckerEnabled());
+
+    bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
+
+    // This function is called with selections already expanded to word boundaries.
+    if (!spellingRange || (shouldMarkGrammar && !grammarRange))
+        return;
+
+    // If we're not in an editable node, bail.
+    Node* editableNode = spellingRange->startContainer();
+    if (!editableNode || !editableNode->rendererIsEditable())
+        return;
+
+    if (!isSpellCheckingEnabledFor(editableNode))
+        return;
+
+    Range* rangeToCheck = shouldMarkGrammar ? grammarRange : spellingRange;
+    TextCheckingParagraph fullParagraphToCheck(rangeToCheck);
+
+    bool asynchronous = m_frame.settings() && m_frame.settings()->asynchronousSpellCheckingEnabled();
+    chunkAndMarkAllMisspellingsAndBadGrammar(textCheckingOptions, fullParagraphToCheck, asynchronous);
+}
+
+void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(Node* node)
+{
+    if (!node)
+        return;
+    RefPtr<Range> rangeToCheck = Range::create(*m_frame.document(), firstPositionInNode(node), lastPositionInNode(node));
+    TextCheckingParagraph textToCheck(rangeToCheck, rangeToCheck);
+    bool asynchronous = true;
+    chunkAndMarkAllMisspellingsAndBadGrammar(resolveTextCheckingTypeMask(TextCheckingTypeSpelling | TextCheckingTypeGrammar), textToCheck, asynchronous);
+}
+
+void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeMask textCheckingOptions, const TextCheckingParagraph& fullParagraphToCheck, bool asynchronous)
+{
+    if (fullParagraphToCheck.isRangeEmpty() || fullParagraphToCheck.isEmpty())
+        return;
+
+    // Since the text may be quite big chunk it up and adjust to the sentence boundary.
+    const int kChunkSize = 16 * 1024;
+    int start = fullParagraphToCheck.checkingStart();
+    int end = fullParagraphToCheck.checkingEnd();
+    start = std::min(start, end);
+    end = std::max(start, end);
+    const int kNumChunksToCheck = asynchronous ? (end - start + kChunkSize - 1) / (kChunkSize) : 1;
+    int currentChunkStart = start;
+    RefPtr<Range> checkRange = fullParagraphToCheck.checkingRange();
+    if (kNumChunksToCheck == 1 && asynchronous) {
+        markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, checkRange.get(), checkRange.get(), asynchronous, 0);
+        return;
+    }
+
+    for (int iter = 0; iter < kNumChunksToCheck; ++iter) {
+        checkRange = fullParagraphToCheck.subrange(currentChunkStart, kChunkSize);
+        setStart(checkRange.get(), startOfSentence(checkRange->startPosition()));
+        setEnd(checkRange.get(), endOfSentence(checkRange->endPosition()));
+
+        int checkingLength = 0;
+        markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, checkRange.get(), checkRange.get(), asynchronous, iter, &checkingLength);
+        currentChunkStart += checkingLength;
+    }
+}
+
+void SpellChecker::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, Range* checkRange, Range* paragraphRange, bool asynchronous, int requestNumber, int* checkingLength)
+{
+    TextCheckingParagraph sentenceToCheck(checkRange, paragraphRange);
+    if (checkingLength)
+        *checkingLength = sentenceToCheck.checkingLength();
+
+    RefPtr<SpellCheckRequest> request = SpellCheckRequest::create(resolveTextCheckingTypeMask(textCheckingOptions), TextCheckingProcessBatch, checkRange, paragraphRange, requestNumber);
+
+    if (asynchronous) {
+        m_spellCheckRequester->requestCheckingFor(request);
+    } else {
+        Vector<TextCheckingResult> results;
+        checkTextOfParagraph(textChecker(), sentenceToCheck.text(), resolveTextCheckingTypeMask(textCheckingOptions), results);
+        markAndReplaceFor(request, results);
+    }
+}
+
+void SpellChecker::markAndReplaceFor(PassRefPtr<SpellCheckRequest> request, const Vector<TextCheckingResult>& results)
+{
+    ASSERT(request);
+
+    TextCheckingTypeMask textCheckingOptions = request->data().mask();
+    TextCheckingParagraph paragraph(request->checkingRange(), request->paragraphRange());
+
+    bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling;
+    bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
+
+    // Expand the range to encompass entire paragraphs, since text checking needs that much context.
+    int selectionOffset = 0;
+    int ambiguousBoundaryOffset = -1;
+    bool selectionChanged = false;
+    bool restoreSelectionAfterChange = false;
+    bool adjustSelectionForParagraphBoundaries = false;
+
+    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();
+            selectionOffset = paragraph.offsetTo(caretPosition, ASSERT_NO_EXCEPTION);
+            restoreSelectionAfterChange = true;
+            if (selectionOffset > 0 && (static_cast<unsigned>(selectionOffset) > paragraph.text().length() || paragraph.textCharAt(selectionOffset - 1) == newlineCharacter))
+                adjustSelectionForParagraphBoundaries = true;
+            if (selectionOffset > 0 && static_cast<unsigned>(selectionOffset) <= paragraph.text().length() && isAmbiguousBoundaryCharacter(paragraph.textCharAt(selectionOffset - 1)))
+                ambiguousBoundaryOffset = selectionOffset - 1;
+        }
+    }
+
+    for (unsigned i = 0; i < results.size(); i++) {
+        int spellingRangeEndOffset = paragraph.checkingEnd();
+        const TextCheckingResult* result = &results[i];
+        int resultLocation = result->location + paragraph.checkingStart();
+        int resultLength = result->length;
+        bool resultEndsAtAmbiguousBoundary = ambiguousBoundaryOffset >= 0 && resultLocation + resultLength == ambiguousBoundaryOffset;
+
+        // Only mark misspelling if:
+        // 1. Current text checking isn't done for autocorrection, in which case shouldMarkSpelling is false.
+        // 2. Result falls within spellingRange.
+        // 3. The word in question doesn't end at an ambiguous boundary. For instance, we would not mark
+        //    "wouldn'" as misspelled right after apostrophe is typed.
+        if (shouldMarkSpelling && result->decoration == TextDecorationTypeSpelling && resultLocation >= paragraph.checkingStart() && resultLocation + resultLength <= spellingRangeEndOffset && !resultEndsAtAmbiguousBoundary) {
+            ASSERT(resultLength > 0 && resultLocation >= 0);
+            RefPtr<Range> misspellingRange = paragraph.subrange(resultLocation, resultLength);
+            misspellingRange->startContainer()->document().markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling, result->replacement, result->hash);
+        } else if (shouldMarkGrammar && result->decoration == TextDecorationTypeGrammar && paragraph.checkingRangeCovers(resultLocation, resultLength)) {
+            ASSERT(resultLength > 0 && resultLocation >= 0);
+            for (unsigned j = 0; j < result->details.size(); j++) {
+                const GrammarDetail* detail = &result->details[j];
+                ASSERT(detail->length > 0 && detail->location >= 0);
+                if (paragraph.checkingRangeCovers(resultLocation + detail->location, detail->length)) {
+                    RefPtr<Range> badGrammarRange = paragraph.subrange(resultLocation + detail->location, detail->length);
+                    badGrammarRange->startContainer()->document().markers()->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription, result->hash);
+                }
+            }
+        } else if (result->decoration == TextDecorationTypeInvisibleSpellcheck && resultLocation >= paragraph.checkingStart() && resultLocation + resultLength <= spellingRangeEndOffset) {
+            ASSERT(resultLength > 0 && resultLocation >= 0);
+            RefPtr<Range> invisibleSpellcheckRange = paragraph.subrange(resultLocation, resultLength);
+            invisibleSpellcheckRange->startContainer()->document().markers()->addMarker(invisibleSpellcheckRange.get(), DocumentMarker::InvisibleSpellcheck, result->replacement, result->hash);
+        }
+    }
+
+    if (selectionChanged) {
+        TextCheckingParagraph extendedParagraph(paragraph);
+        // Restore the caret position if we have made any replacements
+        extendedParagraph.expandRangeToNextEnd();
+        if (restoreSelectionAfterChange && selectionOffset >= 0 && selectionOffset <= extendedParagraph.rangeLength()) {
+            RefPtr<Range> selectionRange = extendedParagraph.subrange(0, selectionOffset);
+            m_frame.selection().moveTo(selectionRange->endPosition(), DOWNSTREAM);
+            if (adjustSelectionForParagraphBoundaries)
+                m_frame.selection().modify(FrameSelection::AlterationMove, DirectionForward, CharacterGranularity);
+        } else {
+            // If this fails for any reason, the fallback is to go one position beyond the last replacement
+            m_frame.selection().moveTo(m_frame.selection().end());
+            m_frame.selection().modify(FrameSelection::AlterationMove, DirectionForward, CharacterGranularity);
+        }
+    }
+}
+
+void SpellChecker::markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection)
+{
+    if (unifiedTextCheckerEnabled()) {
+        if (!isContinuousSpellCheckingEnabled())
+            return;
+
+        // markMisspellingsAndBadGrammar() is triggered by selection change, in which case we check spelling and grammar, but don't autocorrect misspellings.
+        TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling;
+        if (markGrammar && isGrammarCheckingEnabled())
+            textCheckingOptions |= TextCheckingTypeGrammar;
+        markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, spellingSelection.toNormalizedRange().get(), grammarSelection.toNormalizedRange().get());
+        return;
+    }
+
+    RefPtr<Range> firstMisspellingRange;
+    markMisspellings(spellingSelection, firstMisspellingRange);
+    if (markGrammar)
+        markBadGrammar(grammarSelection);
+}
+
+void SpellChecker::updateMarkersForWordsAffectedByEditing(bool doNotRemoveIfSelectionAtWordBoundary)
+{
+    if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTypeSpelling))
+        return;
+
+    // We want to remove the markers from a word if an editing command will change the word. This can happen in one of
+    // several scenarios:
+    // 1. Insert in the middle of a word.
+    // 2. Appending non whitespace at the beginning of word.
+    // 3. Appending non whitespace at the end of word.
+    // Note that, appending only whitespaces at the beginning or end of word won't change the word, so we don't need to
+    // remove the markers on that word.
+    // Of course, if current selection is a range, we potentially will edit two words that fall on the boundaries of
+    // selection, and remove words between the selection boundaries.
+    //
+    VisiblePosition startOfSelection = m_frame.selection().selection().start();
+    VisiblePosition endOfSelection = m_frame.selection().selection().end();
+    if (startOfSelection.isNull())
+        return;
+    // First word is the word that ends after or on the start of selection.
+    VisiblePosition startOfFirstWord = startOfWord(startOfSelection, LeftWordIfOnBoundary);
+    VisiblePosition endOfFirstWord = endOfWord(startOfSelection, LeftWordIfOnBoundary);
+    // Last word is the word that begins before or on the end of selection
+    VisiblePosition startOfLastWord = startOfWord(endOfSelection, RightWordIfOnBoundary);
+    VisiblePosition endOfLastWord = endOfWord(endOfSelection, RightWordIfOnBoundary);
+
+    if (startOfFirstWord.isNull()) {
+        startOfFirstWord = startOfWord(startOfSelection, RightWordIfOnBoundary);
+        endOfFirstWord = endOfWord(startOfSelection, RightWordIfOnBoundary);
+    }
+
+    if (endOfLastWord.isNull()) {
+        startOfLastWord = startOfWord(endOfSelection, LeftWordIfOnBoundary);
+        endOfLastWord = endOfWord(endOfSelection, LeftWordIfOnBoundary);
+    }
+
+    // If doNotRemoveIfSelectionAtWordBoundary is true, and first word ends at the start of selection,
+    // we choose next word as the first word.
+    if (doNotRemoveIfSelectionAtWordBoundary && endOfFirstWord == startOfSelection) {
+        startOfFirstWord = nextWordPosition(startOfFirstWord);
+        endOfFirstWord = endOfWord(startOfFirstWord, RightWordIfOnBoundary);
+        if (startOfFirstWord == endOfSelection)
+            return;
+    }
+
+    // If doNotRemoveIfSelectionAtWordBoundary is true, and last word begins at the end of selection,
+    // we choose previous word as the last word.
+    if (doNotRemoveIfSelectionAtWordBoundary && startOfLastWord == endOfSelection) {
+        startOfLastWord = previousWordPosition(startOfLastWord);
+        endOfLastWord = endOfWord(startOfLastWord, RightWordIfOnBoundary);
+        if (endOfLastWord == startOfSelection)
+            return;
+    }
+
+    if (startOfFirstWord.isNull() || endOfFirstWord.isNull() || startOfLastWord.isNull() || endOfLastWord.isNull())
+        return;
+
+    // Now we remove markers on everything between startOfFirstWord and endOfLastWord.
+    // However, if an autocorrection change a single word to multiple words, we want to remove correction mark from all the
+    // resulted words even we only edit one of them. For example, assuming autocorrection changes "avantgarde" to "avant
+    // garde", we will have CorrectionIndicator marker on both words and on the whitespace between them. If we then edit garde,
+    // we would like to remove the marker from word "avant" and whitespace as well. So we need to get the continous range of
+    // of marker that contains the word in question, and remove marker on that whole range.
+    Document* document = m_frame.document();
+    ASSERT(document);
+    RefPtr<Range> wordRange = Range::create(*document, startOfFirstWord.deepEquivalent(), endOfLastWord.deepEquivalent());
+
+    document->markers()->removeMarkers(wordRange.get(), DocumentMarker::MisspellingMarkers(), DocumentMarkerController::RemovePartiallyOverlappingMarker);
+}
+
+void SpellChecker::didEndEditingOnTextField(Element* e)
+{
+    // Remove markers when deactivating a selection in an <input type="text"/>.
+    // Prevent new ones from appearing too.
+    m_spellCheckRequester->cancelCheck();
+    HTMLTextFormControlElement* textFormControlElement = toHTMLTextFormControlElement(e);
+    HTMLElement* innerText = textFormControlElement->innerTextElement();
+    DocumentMarker::MarkerTypes markerTypes(DocumentMarker::Spelling);
+    if (isGrammarCheckingEnabled() || unifiedTextCheckerEnabled())
+        markerTypes.add(DocumentMarker::Grammar);
+    for (Node* node = innerText; node; node = NodeTraversal::next(node, innerText)) {
+        m_frame.document()->markers()->removeMarkers(node, markerTypes);
+    }
+}
+
+void SpellChecker::respondToChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions options)
+{
+    bool closeTyping = options & FrameSelection::CloseTyping;
+    bool isContinuousSpellCheckingEnabled = this->isContinuousSpellCheckingEnabled();
+    bool isContinuousGrammarCheckingEnabled = isContinuousSpellCheckingEnabled && isGrammarCheckingEnabled();
+    if (isContinuousSpellCheckingEnabled) {
+        VisibleSelection newAdjacentWords;
+        VisibleSelection newSelectedSentence;
+        bool caretBrowsing = m_frame.settings() && m_frame.settings()->caretBrowsingEnabled();
+        if (m_frame.selection().selection().isContentEditable() || caretBrowsing) {
+            VisiblePosition newStart(m_frame.selection().selection().visibleStart());
+            newAdjacentWords = VisibleSelection(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary));
+            if (isContinuousGrammarCheckingEnabled)
+                newSelectedSentence = VisibleSelection(startOfSentence(newStart), endOfSentence(newStart));
+        }
+
+        // Don't check spelling and grammar if the change of selection is triggered by spelling correction itself.
+        bool shouldCheckSpellingAndGrammar = !(options & FrameSelection::SpellCorrectionTriggered);
+
+        // When typing we check spelling elsewhere, so don't redo it here.
+        // If this is a change in selection resulting from a delete operation,
+        // oldSelection may no longer be in the document.
+        if (shouldCheckSpellingAndGrammar
+            && closeTyping
+            && oldSelection.isContentEditable()
+            && oldSelection.start().inDocument()
+            && !isSelectionInTextField(oldSelection)) {
+            spellCheckOldSelection(oldSelection, newAdjacentWords, newSelectedSentence);
+        }
+
+        if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTypeSpelling)) {
+            if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange())
+                m_frame.document()->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling);
+        }
+        if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTypeGrammar)) {
+            if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange())
+                m_frame.document()->markers()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);
+        }
+    }
+
+    // When continuous spell checking is off, existing markers disappear after the selection changes.
+    if (!isContinuousSpellCheckingEnabled)
+        m_frame.document()->markers()->removeMarkers(DocumentMarker::Spelling);
+    if (!isContinuousGrammarCheckingEnabled)
+        m_frame.document()->markers()->removeMarkers(DocumentMarker::Grammar);
+}
+
+void SpellChecker::spellCheckAfterBlur()
+{
+    if (!m_frame.selection().selection().isContentEditable())
+        return;
+
+    if (isSelectionInTextField(m_frame.selection().selection())) {
+        // textFieldDidEndEditing() and textFieldDidBeginEditing() handle this.
+        return;
+    }
+
+    VisibleSelection empty;
+    spellCheckOldSelection(m_frame.selection().selection(), empty, empty);
+}
+
+void SpellChecker::spellCheckOldSelection(const VisibleSelection& oldSelection, const VisibleSelection& newAdjacentWords, const VisibleSelection& newSelectedSentence)
+{
+    VisiblePosition oldStart(oldSelection.visibleStart());
+    VisibleSelection oldAdjacentWords = VisibleSelection(startOfWord(oldStart, LeftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary));
+    if (oldAdjacentWords  != newAdjacentWords) {
+        if (isContinuousSpellCheckingEnabled() && isGrammarCheckingEnabled()) {
+            VisibleSelection selectedSentence = VisibleSelection(startOfSentence(oldStart), endOfSentence(oldStart));
+            markMisspellingsAndBadGrammar(oldAdjacentWords, selectedSentence != newSelectedSentence, selectedSentence);
+        } else {
+            markMisspellingsAndBadGrammar(oldAdjacentWords, false, oldAdjacentWords);
+        }
+    }
+}
+
+static Node* findFirstMarkable(Node* node)
+{
+    while (node) {
+        if (!node->renderer())
+            return 0;
+        if (node->renderer()->isText())
+            return node;
+        if (node->renderer()->isTextControl())
+            node = toRenderTextControl(node->renderer())->textFormControlElement()->visiblePositionForIndex(1).deepEquivalent().deprecatedNode();
+        else if (node->firstChild())
+            node = node->firstChild();
+        else
+            node = node->nextSibling();
+    }
+
+    return 0;
+}
+
+bool SpellChecker::selectionStartHasMarkerFor(DocumentMarker::MarkerType markerType, int from, int length) const
+{
+    Node* node = findFirstMarkable(m_frame.selection().start().deprecatedNode());
+    if (!node)
+        return false;
+
+    unsigned startOffset = static_cast<unsigned>(from);
+    unsigned endOffset = static_cast<unsigned>(from + length);
+    Vector<DocumentMarker*> markers = m_frame.document()->markers()->markersFor(node);
+    for (size_t i = 0; i < markers.size(); ++i) {
+        DocumentMarker* marker = markers[i];
+        if (marker->startOffset() <= startOffset && endOffset <= marker->endOffset() && marker->type() == markerType)
+            return true;
+    }
+
+    return false;
+}
+
+TextCheckingTypeMask SpellChecker::resolveTextCheckingTypeMask(TextCheckingTypeMask textCheckingOptions)
+{
+    bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling;
+    bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
+
+    TextCheckingTypeMask checkingTypes = 0;
+    if (shouldMarkSpelling)
+        checkingTypes |= TextCheckingTypeSpelling;
+    if (shouldMarkGrammar)
+        checkingTypes |= TextCheckingTypeGrammar;
+
+    return checkingTypes;
+}
+
+bool SpellChecker::unifiedTextCheckerEnabled() const
+{
+    return WebCore::unifiedTextCheckerEnabled(&m_frame);
+}
+
+void SpellChecker::cancelCheck()
+{
+    m_spellCheckRequester->cancelCheck();
+}
+
+void SpellChecker::requestTextChecking(const Element& element)
+{
+    RefPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element*>(&element));
+    m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextCheckingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToCheck, rangeToCheck));
+}
+
+
+} // namespace WebCore
diff --git a/Source/core/editing/SpellChecker.h b/Source/core/editing/SpellChecker.h
new file mode 100644
index 0000000..bf54744
--- /dev/null
+++ b/Source/core/editing/SpellChecker.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2006, 2007, 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 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,
+ * 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 SpellChecker_h
+#define SpellChecker_h
+
+#include "core/dom/ClipboardAccessPolicy.h"
+#include "core/dom/DocumentMarker.h"
+#include "core/editing/FrameSelection.h"
+#include "core/editing/VisibleSelection.h"
+#include "platform/text/TextChecking.h"
+
+namespace WebCore {
+
+class EditorClient;
+class Frame;
+class SpellCheckRequest;
+class SpellCheckRequester;
+class TextCheckerClient;
+class TextCheckingParagraph;
+struct TextCheckingResult;
+
+class SpellChecker {
+    WTF_MAKE_NONCOPYABLE(SpellChecker);
+public:
+    static PassOwnPtr<SpellChecker> create(Frame&);
+
+    ~SpellChecker();
+
+    EditorClient& editorClient() const;
+    TextCheckerClient& textChecker() const;
+
+    bool isContinuousSpellCheckingEnabled() const;
+    void toggleContinuousSpellChecking();
+    bool isGrammarCheckingEnabled();
+    void ignoreSpelling();
+    String misspelledWordAtCaretOrRange(Node* clickedNode) const;
+    bool isSpellCheckingEnabledInFocusedNode() const;
+    bool isSpellCheckingEnabledFor(Node*) const;
+    void markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping);
+    void markMisspellings(const VisibleSelection&, RefPtr<Range>& firstMisspellingRange);
+    void markBadGrammar(const VisibleSelection&);
+    void markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection);
+    void markAndReplaceFor(PassRefPtr<SpellCheckRequest>, const Vector<TextCheckingResult>&);
+    void markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask, Range* spellingRange, Range* grammarRange);
+    void advanceToNextMisspelling(bool startBeforeSelection = false);
+    void showSpellingGuessPanel();
+    void didBeginEditing(Element*);
+    void clearMisspellingsAndBadGrammar(const VisibleSelection&);
+    void markMisspellingsAndBadGrammar(const VisibleSelection&);
+    void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSelection::SetSelectionOptions);
+    void spellCheckAfterBlur();
+    void spellCheckOldSelection(const VisibleSelection& oldSelection, const VisibleSelection& newAdjacentWords, const VisibleSelection& newSelectedSentence);
+
+    void didEndEditingOnTextField(Element*);
+    bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int length) const;
+    void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSelection);
+    void cancelCheck();
+    void chunkAndMarkAllMisspellingsAndBadGrammar(Node*);
+    void requestTextChecking(const Element&);
+
+    // Exposed for testing only
+    SpellCheckRequester& spellCheckRequester() const { return *m_spellCheckRequester; }
+
+private:
+    Frame& m_frame;
+    const OwnPtr<SpellCheckRequester> m_spellCheckRequester;
+
+    explicit SpellChecker(Frame&);
+
+    void markMisspellingsOrBadGrammar(const VisibleSelection&, bool checkSpelling, RefPtr<Range>& firstMisspellingRange);
+    TextCheckingTypeMask resolveTextCheckingTypeMask(TextCheckingTypeMask);
+
+    bool unifiedTextCheckerEnabled() const;
+
+    void chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeMask textCheckingOptions, const TextCheckingParagraph& fullParagraphToCheck, bool asynchronous);
+    void markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, Range* checkingRange, Range* paragraphRange, bool asynchronous, int requestNumber, int* checkingLength = 0);
+};
+
+} // namespace WebCore
+
+#endif // SpellChecker_h
diff --git a/Source/core/editing/SpellingCorrectionCommand.cpp b/Source/core/editing/SpellingCorrectionCommand.cpp
index e89b81a..cc73001 100644
--- a/Source/core/editing/SpellingCorrectionCommand.cpp
+++ b/Source/core/editing/SpellingCorrectionCommand.cpp
@@ -30,7 +30,7 @@
 #include "core/editing/InsertTextCommand.h"
 #include "core/editing/SetSelectionCommand.h"
 #include "core/editing/TextIterator.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
@@ -48,9 +48,6 @@
     if (!m_corrected.length())
         return;
 
-    if (!document().frame()->selection().shouldChangeSelection(m_selectionToBeCorrected))
-        return;
-
     applyCommandToComposite(SetSelectionCommand::create(m_selectionToBeCorrected, FrameSelection::SpellCorrectionTriggered | FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle));
     applyCommandToComposite(InsertTextCommand::create(document(), m_correction));
 }
diff --git a/Source/core/editing/SplitTextNodeCommand.cpp b/Source/core/editing/SplitTextNodeCommand.cpp
index b28147b..c8550cf 100644
--- a/Source/core/editing/SplitTextNodeCommand.cpp
+++ b/Source/core/editing/SplitTextNodeCommand.cpp
@@ -72,7 +72,7 @@
     if (!m_text1 || !m_text1->rendererIsEditable())
         return;
 
-    ASSERT(&m_text1->document() == &document());
+    ASSERT(m_text1->document() == document());
 
     String prefixText = m_text1->data();
 
diff --git a/Source/core/editing/TextCheckingHelper.cpp b/Source/core/editing/TextCheckingHelper.cpp
index 33471b3..201b06d 100644
--- a/Source/core/editing/TextCheckingHelper.cpp
+++ b/Source/core/editing/TextCheckingHelper.cpp
@@ -35,10 +35,10 @@
 #include "core/editing/TextIterator.h"
 #include "core/editing/VisiblePosition.h"
 #include "core/editing/VisibleUnits.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
-#include "core/platform/text/TextBreakIterator.h"
-#include "core/platform/text/TextCheckerClient.h"
+#include "platform/text/TextBreakIterator.h"
+#include "platform/text/TextCheckerClient.h"
 
 namespace WebCore {
 
@@ -57,7 +57,7 @@
         ASSERT(0 <= badGrammarLocation && badGrammarLocation <= checkLength);
         ASSERT(0 < badGrammarLength && badGrammarLocation + badGrammarLength <= checkLength);
         TextCheckingResult badGrammar;
-        badGrammar.type = TextCheckingTypeGrammar;
+        badGrammar.decoration = TextDecorationTypeGrammar;
         badGrammar.location = checkLocation + badGrammarLocation;
         badGrammar.length = badGrammarLength;
         badGrammar.details.swap(badGrammarDetails);
@@ -73,9 +73,9 @@
     TextBreakIterator* iterator = wordBreakIterator(text + start, length);
     if (!iterator)
         return;
-    int wordStart = textBreakCurrent(iterator);
+    int wordStart = iterator->current();
     while (0 <= wordStart) {
-        int wordEnd = textBreakNext(iterator);
+        int wordEnd = iterator->next();
         if (wordEnd < 0)
             break;
         int wordLength = wordEnd - wordStart;
@@ -86,7 +86,7 @@
             ASSERT(0 <= misspellingLocation && misspellingLocation <= wordLength);
             ASSERT(0 < misspellingLength && misspellingLocation + misspellingLength <= wordLength);
             TextCheckingResult misspelling;
-            misspelling.type = TextCheckingTypeSpelling;
+            misspelling.decoration = TextDecorationTypeSpelling;
             misspelling.location = start + wordStart + misspellingLocation;
             misspelling.length = misspellingLength;
             misspelling.replacement = client.getAutoCorrectSuggestionForMisspelledWord(String(text + misspelling.location, misspelling.length));
@@ -343,14 +343,14 @@
 
                 for (unsigned i = 0; i < results.size(); i++) {
                     const TextCheckingResult* result = &results[i];
-                    if (result->type == TextCheckingTypeSpelling && result->location >= currentStartOffset && result->location + result->length <= currentEndOffset) {
+                    if (result->decoration == TextDecorationTypeSpelling && result->location >= currentStartOffset && result->location + result->length <= currentEndOffset) {
                         ASSERT(result->length > 0 && result->location >= 0);
                         spellingLocation = result->location;
                         misspelledWord = paragraphString.substring(result->location, result->length);
                         ASSERT(misspelledWord.length());
                         break;
                     }
-                    if (checkGrammar && result->type == TextCheckingTypeGrammar && result->location < currentEndOffset && result->location + result->length > currentStartOffset) {
+                    if (checkGrammar && result->decoration == TextDecorationTypeGrammar && result->location < currentEndOffset && result->location + result->length > currentStartOffset) {
                         ASSERT(result->length > 0 && result->location >= 0);
                         // We can't stop after the first grammar result, since there might still be a spelling result after
                         // it begins but before the first detail in it, but we can stop if we find a second grammar result.
diff --git a/Source/core/editing/TextCheckingHelper.h b/Source/core/editing/TextCheckingHelper.h
index cd1bc09..a458524 100644
--- a/Source/core/editing/TextCheckingHelper.h
+++ b/Source/core/editing/TextCheckingHelper.h
@@ -22,7 +22,7 @@
 #define TextCheckingHelper_h
 
 #include "core/page/EditorClient.h"
-#include "core/platform/text/TextChecking.h"
+#include "platform/text/TextChecking.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
diff --git a/Source/core/editing/TextInsertionBaseCommand.cpp b/Source/core/editing/TextInsertionBaseCommand.cpp
index 4c14a9b..918bf75 100644
--- a/Source/core/editing/TextInsertionBaseCommand.cpp
+++ b/Source/core/editing/TextInsertionBaseCommand.cpp
@@ -31,7 +31,7 @@
 #include "core/dom/Element.h"
 #include "core/dom/Node.h"
 #include "core/editing/FrameSelection.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp
index 668fde6..138e8fe 100644
--- a/Source/core/editing/TextIterator.cpp
+++ b/Source/core/editing/TextIterator.cpp
@@ -39,14 +39,14 @@
 #include "core/html/HTMLElement.h"
 #include "core/html/HTMLTextFormControlElement.h"
 #include "core/platform/graphics/Font.h"
-#include "core/platform/text/TextBoundaries.h"
-#include "core/platform/text/TextBreakIteratorInternalICU.h"
 #include "core/rendering/InlineTextBox.h"
 #include "core/rendering/RenderImage.h"
 #include "core/rendering/RenderTableCell.h"
 #include "core/rendering/RenderTableRow.h"
 #include "core/rendering/RenderTextControl.h"
 #include "core/rendering/RenderTextFragment.h"
+#include "platform/text/TextBoundaries.h"
+#include "platform/text/TextBreakIteratorInternalICU.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/unicode/CharacterNames.h"
@@ -241,7 +241,6 @@
     , m_sortedTextBoxesPosition(0)
     , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCharactersBetweenAllVisiblePositions)
     , m_entersTextControls(behavior & TextIteratorEntersTextControls)
-    , m_emitsTextWithoutTranscoding(behavior & TextIteratorEmitsTextsWithoutTranscoding)
     , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText)
     , m_handledFirstLetter(false)
     , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility)
@@ -1017,7 +1016,7 @@
 void TextIterator::emitText(Node* textNode, RenderObject* renderObject, int textStartOffset, int textEndOffset)
 {
     RenderText* renderer = toRenderText(renderObject);
-    m_text = m_emitsOriginalText ? renderer->originalText() : (m_emitsTextWithoutTranscoding ? renderer->textWithoutTranscoding() : renderer->text());
+    m_text = m_emitsOriginalText ? renderer->originalText() : renderer->text();
     ASSERT(!m_text.isEmpty());
     ASSERT(0 <= textStartOffset && textStartOffset < static_cast<int>(m_text.length()));
     ASSERT(0 <= textEndOffset && textEndOffset <= static_cast<int>(m_text.length()));
@@ -2349,7 +2348,7 @@
 
 // --------
 
-String plainText(const Range* r, TextIteratorBehavior defaultBehavior, bool isDisplayString)
+String plainText(const Range* r, TextIteratorBehavior defaultBehavior)
 {
     // The initial buffer size can be critical for performance: https://bugs.webkit.org/show_bug.cgi?id=81192
     static const unsigned initialCapacity = 1 << 15;
@@ -2357,11 +2356,8 @@
     unsigned bufferLength = 0;
     StringBuilder builder;
     builder.reserveCapacity(initialCapacity);
-    TextIteratorBehavior behavior = defaultBehavior;
-    if (!isDisplayString)
-        behavior = static_cast<TextIteratorBehavior>(behavior | TextIteratorEmitsTextsWithoutTranscoding);
 
-    for (TextIterator it(r, behavior); !it.atEnd(); it.advance()) {
+    for (TextIterator it(r, defaultBehavior); !it.atEnd(); it.advance()) {
         it.appendTextToStringBuilder(builder);
         bufferLength += it.length();
     }
@@ -2369,12 +2365,7 @@
     if (!bufferLength)
         return emptyString();
 
-    String result = builder.toString();
-
-    if (isDisplayString)
-        r->ownerDocument().displayStringModifiedByEncoding(result);
-
-    return result;
+    return builder.toString();
 }
 
 static PassRefPtr<Range> collapsedToBoundary(const Range* range, bool forward)
diff --git a/Source/core/editing/TextIterator.h b/Source/core/editing/TextIterator.h
index ecc4c41..b8b1e35 100644
--- a/Source/core/editing/TextIterator.h
+++ b/Source/core/editing/TextIterator.h
@@ -40,12 +40,11 @@
     TextIteratorDefaultBehavior = 0,
     TextIteratorEmitsCharactersBetweenAllVisiblePositions = 1 << 0,
     TextIteratorEntersTextControls = 1 << 1,
-    TextIteratorEmitsTextsWithoutTranscoding = 1 << 2,
-    TextIteratorIgnoresStyleVisibility = 1 << 3,
-    TextIteratorEmitsObjectReplacementCharacters = 1 << 4,
-    TextIteratorEmitsOriginalText = 1 << 5,
-    TextIteratorStopsOnFormControls = 1 << 6,
-    TextIteratorEmitsImageAltText = 1 << 7,
+    TextIteratorIgnoresStyleVisibility = 1 << 2,
+    TextIteratorEmitsObjectReplacementCharacters = 1 << 3,
+    TextIteratorEmitsOriginalText = 1 << 4,
+    TextIteratorStopsOnFormControls = 1 << 5,
+    TextIteratorEmitsImageAltText = 1 << 6,
 };
 
 // FIXME: Can't really answer this question correctly without knowing the white-space mode.
@@ -61,7 +60,7 @@
     }
 }
 
-String plainText(const Range*, TextIteratorBehavior defaultBehavior = TextIteratorDefaultBehavior, bool isDisplayString = false);
+String plainText(const Range*, TextIteratorBehavior defaultBehavior = TextIteratorDefaultBehavior);
 PassRefPtr<Range> findPlainText(const Range*, const String&, FindOptions);
 
 class BitStack {
@@ -194,8 +193,6 @@
     bool m_emitsCharactersBetweenAllVisiblePositions;
     bool m_entersTextControls;
 
-    // Used when we want texts for copying, pasting, and transposing.
-    bool m_emitsTextWithoutTranscoding;
     // Used in pasting inside password field.
     bool m_emitsOriginalText;
     // Used when deciding text fragment created by :first-letter should be looked into.
@@ -224,6 +221,8 @@
 
     int length() const { return m_textLength; }
 
+    Node* node() const { return m_node; }
+
     template<typename BufferType>
     void prependTextTo(BufferType& output)
     {
diff --git a/Source/core/editing/TypingCommand.cpp b/Source/core/editing/TypingCommand.cpp
index fac993b..596265b 100644
--- a/Source/core/editing/TypingCommand.cpp
+++ b/Source/core/editing/TypingCommand.cpp
@@ -35,11 +35,11 @@
 #include "core/editing/InsertLineBreakCommand.h"
 #include "core/editing/InsertParagraphSeparatorCommand.h"
 #include "core/editing/InsertTextCommand.h"
-#include "core/editing/SpellCheckRequester.h"
+#include "core/editing/SpellChecker.h"
 #include "core/editing/VisiblePosition.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderObject.h"
 
 namespace WebCore {
@@ -154,7 +154,7 @@
     ASSERT(frame);
 
     if (!text.isEmpty())
-        document.frame()->editor().updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text[0]));
+        document.frame()->spellChecker().updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text[0]));
 
     insertText(document, text, frame->selection().selection(), options, composition);
 }
@@ -285,10 +285,10 @@
     if (!frame)
         return;
 
-    if (!frame->editor().isContinuousSpellCheckingEnabled())
+    if (!frame->spellChecker().isContinuousSpellCheckingEnabled())
         return;
 
-    frame->editor().spellCheckRequester().cancelCheck();
+    frame->spellChecker().cancelCheck();
 
     // Take a look at the selection that results after typing and determine whether we need to spellcheck.
     // Since the word containing the current selection is never marked, this does a check to
@@ -300,7 +300,7 @@
         VisiblePosition p1 = startOfWord(previous, LeftWordIfOnBoundary);
         VisiblePosition p2 = startOfWord(start, LeftWordIfOnBoundary);
         if (p1 != p2)
-            frame->editor().markMisspellingsAfterTypingToWord(p1, endingSelection());
+            frame->spellChecker().markMisspellingsAfterTypingToWord(p1, endingSelection());
     }
 }
 
@@ -396,7 +396,7 @@
     if (!frame)
         return;
 
-    frame->editor().updateMarkersForWordsAffectedByEditing(false);
+    frame->spellChecker().updateMarkersForWordsAffectedByEditing(false);
 
     VisibleSelection selectionToDelete;
     VisibleSelection selectionAfterUndo;
@@ -479,7 +479,7 @@
     if (selectionToDelete.isNone())
         return;
 
-    if (selectionToDelete.isCaret() || !frame->selection().shouldDeleteSelection(selectionToDelete))
+    if (selectionToDelete.isCaret())
         return;
 
     if (killRing)
@@ -500,7 +500,7 @@
     if (!frame)
         return;
 
-    frame->editor().updateMarkersForWordsAffectedByEditing(false);
+    frame->spellChecker().updateMarkersForWordsAffectedByEditing(false);
 
     VisibleSelection selectionToDelete;
     VisibleSelection selectionAfterUndo;
@@ -572,7 +572,7 @@
     if (selectionToDelete.isNone())
         return;
 
-    if (selectionToDelete.isCaret() || !frame->selection().shouldDeleteSelection(selectionToDelete))
+    if (selectionToDelete.isCaret())
         return;
 
     if (killRing)
diff --git a/Source/core/editing/VisiblePosition.cpp b/Source/core/editing/VisiblePosition.cpp
index e863568..1d1b6f6 100644
--- a/Source/core/editing/VisiblePosition.cpp
+++ b/Source/core/editing/VisiblePosition.cpp
@@ -36,9 +36,9 @@
 #include "core/editing/htmlediting.h"
 #include "core/html/HTMLElement.h"
 #include "core/html/HTMLHtmlElement.h"
-#include "core/platform/graphics/FloatQuad.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/RootInlineBox.h"
+#include "platform/geometry/FloatQuad.h"
 #include "wtf/text/CString.h"
 
 #ifndef NDEBUG
diff --git a/Source/core/editing/VisiblePosition.h b/Source/core/editing/VisiblePosition.h
index 6c3e93b..f482450 100644
--- a/Source/core/editing/VisiblePosition.h
+++ b/Source/core/editing/VisiblePosition.h
@@ -28,7 +28,7 @@
 
 #include "core/dom/Position.h"
 #include "core/editing/EditingBoundary.h"
-#include "core/platform/text/TextDirection.h"
+#include "platform/text/TextDirection.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/VisibleSelection.cpp b/Source/core/editing/VisibleSelection.cpp
index 96ae7ec..22ed2e3 100644
--- a/Source/core/editing/VisibleSelection.cpp
+++ b/Source/core/editing/VisibleSelection.cpp
@@ -34,8 +34,8 @@
 #include "core/editing/VisiblePosition.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/editing/htmlediting.h"
-#include "core/platform/graphics/LayoutPoint.h"
 #include "core/rendering/RenderObject.h"
+#include "platform/geometry/LayoutPoint.h"
 #include "wtf/Assertions.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/StringBuilder.h"
@@ -472,7 +472,7 @@
 {
     TreeScope& treeScope = startContainerNode->treeScope();
 
-    ASSERT(&currentPosition.containerNode()->treeScope() != &treeScope);
+    ASSERT(currentPosition.containerNode()->treeScope() != treeScope);
 
     if (Node* ancestor = treeScope.ancestorInThisScope(currentPosition.containerNode())) {
         if (ancestor->contains(startContainerNode))
@@ -490,7 +490,7 @@
 {
     TreeScope& treeScope = endContainerNode->treeScope();
 
-    ASSERT(&currentPosition.containerNode()->treeScope() != &treeScope);
+    ASSERT(currentPosition.containerNode()->treeScope() != treeScope);
 
     if (Node* ancestor = treeScope.ancestorInThisScope(currentPosition.containerNode())) {
         if (ancestor->contains(endContainerNode))
@@ -509,7 +509,7 @@
     if (m_base.isNull() || m_start.isNull() || m_end.isNull())
         return;
 
-    if (&m_start.anchorNode()->treeScope() == &m_end.anchorNode()->treeScope())
+    if (m_start.anchorNode()->treeScope() == m_end.anchorNode()->treeScope())
         return;
 
     if (m_baseIsFirst) {
@@ -520,7 +520,7 @@
         m_start = m_extent;
     }
 
-    ASSERT(&m_start.anchorNode()->treeScope() == &m_end.anchorNode()->treeScope());
+    ASSERT(m_start.anchorNode()->treeScope() == m_end.anchorNode()->treeScope());
 }
 
 void VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries()
diff --git a/Source/core/editing/VisibleUnits.cpp b/Source/core/editing/VisibleUnits.cpp
index 92f8be8..bf242cf 100644
--- a/Source/core/editing/VisibleUnits.cpp
+++ b/Source/core/editing/VisibleUnits.cpp
@@ -39,10 +39,10 @@
 #include "core/editing/TextIterator.h"
 #include "core/editing/VisiblePosition.h"
 #include "core/editing/htmlediting.h"
-#include "core/platform/text/TextBoundaries.h"
 #include "core/rendering/InlineTextBox.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/RenderObject.h"
+#include "platform/text/TextBoundaries.h"
 
 namespace WebCore {
 
@@ -326,18 +326,18 @@
 
 static bool isLogicalStartOfWord(TextBreakIterator* iter, int position, bool hardLineBreak)
 {
-    bool boundary = hardLineBreak ? true : isTextBreak(iter, position);
+    bool boundary = hardLineBreak ? true : iter->isBoundary(position);
     if (!boundary)
         return false;
 
-    textBreakFollowing(iter, position);
+    iter->following(position);
     // isWordTextBreak returns true after moving across a word and false after moving across a punctuation/space.
     return isWordTextBreak(iter);
 }
 
 static bool islogicalEndOfWord(TextBreakIterator* iter, int position, bool hardLineBreak)
 {
-    bool boundary = isTextBreak(iter, position);
+    bool boundary = iter->isBoundary(position);
     return (hardLineBreak || boundary) && isWordTextBreak(iter);
 }
 
@@ -391,7 +391,7 @@
         if (!iter)
             break;
 
-        textBreakFirst(iter);
+        iter->first();
         int offsetInIterator = offsetInBox - textBox->start() + previousBoxLength;
 
         bool isWordBreak;
@@ -487,9 +487,9 @@
 
     SimplifiedBackwardsTextIterator it(searchRange.get());
     unsigned next = 0;
-    bool inTextSecurityMode = start.deprecatedNode() && start.deprecatedNode()->renderer() && start.deprecatedNode()->renderer()->style()->textSecurity() != TSNONE;
     bool needMoreContext = false;
     while (!it.atEnd()) {
+        bool inTextSecurityMode = it.node() && it.node()->renderer() && it.node()->renderer()->style()->textSecurity() != TSNONE;
         // iterate to get chunks until the searchFunction returns a non-zero value.
         if (!inTextSecurityMode)
             it.prependTextTo(string);
@@ -560,12 +560,13 @@
     searchRange->selectNodeContents(boundary, IGNORE_EXCEPTION);
     searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(), IGNORE_EXCEPTION);
     TextIterator it(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions);
-    unsigned next = 0;
-    bool inTextSecurityMode = start.deprecatedNode() && start.deprecatedNode()->renderer() && start.deprecatedNode()->renderer()->style()->textSecurity() != TSNONE;
+    const unsigned invalidOffset = static_cast<unsigned>(-1);
+    unsigned next = invalidOffset;
     bool needMoreContext = false;
     while (!it.atEnd()) {
         // Keep asking the iterator for chunks until the search function
         // returns an end value not equal to the length of the string passed to it.
+        bool inTextSecurityMode = it.node() && it.node()->renderer() && it.node()->renderer()->style()->textSecurity() != TSNONE;
         if (!inTextSecurityMode)
             it.appendTextTo(string);
         else {
@@ -588,7 +589,7 @@
 
     if (it.atEnd() && next == string.size()) {
         pos = it.range()->startPosition();
-    } else if (next != prefixLength) {
+    } else if (next != invalidOffset && next != prefixLength) {
         // Use the character iterator to translate the next value into a DOM position.
         CharacterIterator charIt(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions);
         charIt.advance(next - prefixLength - 1);
@@ -1042,7 +1043,7 @@
 {
     TextBreakIterator* iterator = sentenceBreakIterator(characters, length);
     // FIXME: The following function can return -1; we don't handle that.
-    return textBreakPreceding(iterator, length);
+    return iterator->preceding(length);
 }
 
 VisiblePosition startOfSentence(const VisiblePosition &c)
@@ -1053,7 +1054,7 @@
 static unsigned endSentenceBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&)
 {
     TextBreakIterator* iterator = sentenceBreakIterator(characters, length);
-    return textBreakNext(iterator);
+    return iterator->next();
 }
 
 // FIXME: This includes the space after the punctuation that marks the end of the sentence.
@@ -1067,7 +1068,7 @@
     // FIXME: This is identical to startSentenceBoundary. I'm pretty sure that's not right.
     TextBreakIterator* iterator = sentenceBreakIterator(characters, length);
     // FIXME: The following function can return -1; we don't handle that.
-    return textBreakPreceding(iterator, length);
+    return iterator->preceding(length);
 }
 
 VisiblePosition previousSentencePosition(const VisiblePosition &c)
@@ -1081,7 +1082,7 @@
     // FIXME: This is identical to endSentenceBoundary. This isn't right, it needs to
     // move to the equivlant position in the following sentence.
     TextBreakIterator* iterator = sentenceBreakIterator(characters, length);
-    return textBreakFollowing(iterator, 0);
+    return iterator->following(0);
 }
 
 VisiblePosition nextSentencePosition(const VisiblePosition &c)
@@ -1365,7 +1366,7 @@
     if (an == bn)
         return true;
 
-    return &an->document() == &bn->document();
+    return an->document() == bn->document();
 }
 
 bool isStartOfDocument(const VisiblePosition &p)
diff --git a/Source/core/editing/VisibleUnits.h b/Source/core/editing/VisibleUnits.h
index f1b9871..598990b 100644
--- a/Source/core/editing/VisibleUnits.h
+++ b/Source/core/editing/VisibleUnits.h
@@ -27,7 +27,7 @@
 #define VisibleUnits_h
 
 #include "core/editing/EditingBoundary.h"
-#include "core/platform/text/TextDirection.h"
+#include "platform/text/TextDirection.h"
 
 namespace WebCore {
 
diff --git a/Source/core/editing/htmlediting.cpp b/Source/core/editing/htmlediting.cpp
index 858d2e4..26fa599 100644
--- a/Source/core/editing/htmlediting.cpp
+++ b/Source/core/editing/htmlediting.cpp
@@ -49,7 +49,7 @@
 #include "core/html/HTMLParagraphElement.h"
 #include "core/html/HTMLTableElement.h"
 #include "core/html/HTMLUListElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderObject.h"
 #include "wtf/Assertions.h"
 #include "wtf/StdLibExtras.h"
@@ -138,10 +138,6 @@
 
 Node* lowestEditableAncestor(Node* node)
 {
-    if (!node)
-        return 0;
-
-    Node* lowestRoot = 0;
     while (node) {
         if (node->rendererIsEditable())
             return node->rootEditableElement();
@@ -150,7 +146,7 @@
         node = node->parentNode();
     }
 
-    return lowestRoot;
+    return 0;
 }
 
 bool isEditablePosition(const Position& p, EditableType editableType, EUpdateStyle updateStyle)
@@ -268,7 +264,7 @@
 
     Position p = position;
 
-    if (&position.deprecatedNode()->treeScope() != &highestRoot->treeScope()) {
+    if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
         Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(p.deprecatedNode());
         if (!shadowAncestor)
             return VisiblePosition();
@@ -293,7 +289,7 @@
 
     Position p = position;
 
-    if (&position.deprecatedNode()->treeScope() != &highestRoot->treeScope()) {
+    if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
         Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(p.deprecatedNode());
         if (!shadowAncestor)
             return VisiblePosition();
diff --git a/Source/core/editing/htmlediting.h b/Source/core/editing/htmlediting.h
index 7821ebe..fa03d45 100644
--- a/Source/core/editing/htmlediting.h
+++ b/Source/core/editing/htmlediting.h
@@ -28,7 +28,7 @@
 
 #include "core/dom/Position.h"
 #include "core/editing/EditingBoundary.h"
-#include "core/platform/text/TextDirection.h"
+#include "platform/text/TextDirection.h"
 #include "wtf/Forward.h"
 #include "wtf/unicode/CharacterNames.h"
 
diff --git a/Source/core/editing/markup.cpp b/Source/core/editing/markup.cpp
index 437ffb8..5d233ea 100644
--- a/Source/core/editing/markup.cpp
+++ b/Source/core/editing/markup.cpp
@@ -55,7 +55,7 @@
 #include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLTableElement.h"
 #include "core/html/HTMLTextFormControlElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderObject.h"
 #include "weborigin/KURL.h"
 #include "wtf/StdLibExtras.h"
@@ -706,7 +706,10 @@
     RefPtr<DocumentFragment> taggedFragment = createFragmentFromMarkup(document, taggedMarkup.toString(), baseURL, parserContentPolicy);
     RefPtr<Document> taggedDocument = Document::create();
     taggedDocument->setContextFeatures(document.contextFeatures());
-    taggedDocument->takeAllChildrenFrom(taggedFragment.get());
+
+    // FIXME: It's not clear what this code is trying to do. It puts nodes as direct children of a
+    // Document that are not normally allowed by using the parser machinery.
+    taggedDocument->parserTakeAllChildrenFrom(taggedFragment.get());
 
     RefPtr<Node> nodeBeforeContext;
     RefPtr<Node> nodeAfterContext;
@@ -727,7 +730,7 @@
     if (specialCommonAncestor)
         fragment->appendChild(specialCommonAncestor);
     else
-        fragment->takeAllChildrenFrom(toContainerNode(commonAncestor));
+        fragment->parserTakeAllChildrenFrom(toContainerNode(commonAncestor));
 
     trimFragment(fragment.get(), nodeBeforeContext.get(), nodeAfterContext.get());
 
diff --git a/Source/core/events/AutocompleteErrorEvent.h b/Source/core/events/AutocompleteErrorEvent.h
index fa02b5c..1eed01d 100644
--- a/Source/core/events/AutocompleteErrorEvent.h
+++ b/Source/core/events/AutocompleteErrorEvent.h
@@ -26,7 +26,7 @@
 #define AutocompleteErrorEvent_h
 
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -53,7 +53,7 @@
 
     const String& reason() const { return m_reason; }
 
-    virtual const AtomicString& interfaceName() const { return eventNames().interfaceForAutocompleteErrorEvent; }
+    virtual const AtomicString& interfaceName() const { return EventNames::AutocompleteErrorEvent; }
 
 private:
     AutocompleteErrorEvent()
@@ -62,7 +62,7 @@
     }
 
     AutocompleteErrorEvent(const String& reason)
-        : Event(eventNames().autocompleteerrorEvent, false, false)
+        : Event(EventTypeNames::autocompleteerror, false, false)
         , m_reason(reason)
     {
         ScriptWrappable::init(this);
diff --git a/Source/core/events/BeforeLoadEvent.h b/Source/core/events/BeforeLoadEvent.h
index b48e66e..f52c537 100644
--- a/Source/core/events/BeforeLoadEvent.h
+++ b/Source/core/events/BeforeLoadEvent.h
@@ -28,7 +28,7 @@
 #define BeforeLoadEvent_h
 
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -59,7 +59,7 @@
 
     const String& url() const { return m_url; }
 
-    virtual const AtomicString& interfaceName() const { return eventNames().interfaceForBeforeLoadEvent; }
+    virtual const AtomicString& interfaceName() const { return EventNames::BeforeLoadEvent; }
 
 private:
     BeforeLoadEvent()
@@ -68,7 +68,7 @@
     }
 
     explicit BeforeLoadEvent(const String& url)
-        : Event(eventNames().beforeloadEvent, false, true)
+        : Event(EventTypeNames::beforeload, false, true)
         , m_url(url)
     {
         ScriptWrappable::init(this);
diff --git a/Source/core/events/BeforeTextInsertedEvent.cpp b/Source/core/events/BeforeTextInsertedEvent.cpp
index 057bacd..fc0ed37 100644
--- a/Source/core/events/BeforeTextInsertedEvent.cpp
+++ b/Source/core/events/BeforeTextInsertedEvent.cpp
@@ -26,12 +26,12 @@
 #include "config.h"
 #include "core/events/BeforeTextInsertedEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
 BeforeTextInsertedEvent::BeforeTextInsertedEvent(const String& text)
-    : Event(eventNames().webkitBeforeTextInsertedEvent, false, true), m_text(text)
+    : Event(EventTypeNames::webkitBeforeTextInserted, false, true), m_text(text)
 {
 }
 
@@ -42,7 +42,7 @@
 const AtomicString& BeforeTextInsertedEvent::interfaceName() const
 {
     // Notice that there is no BeforeTextInsertedEvent.idl.
-    return eventNames().interfaceForEvent;
+    return EventNames::Event;
 }
 
 }
diff --git a/Source/core/events/BeforeUnloadEvent.cpp b/Source/core/events/BeforeUnloadEvent.cpp
index 5581765..c3ebbe0 100644
--- a/Source/core/events/BeforeUnloadEvent.cpp
+++ b/Source/core/events/BeforeUnloadEvent.cpp
@@ -24,12 +24,12 @@
 #include "config.h"
 #include "core/events/BeforeUnloadEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
 BeforeUnloadEvent::BeforeUnloadEvent()
-    : Event(eventNames().beforeunloadEvent, false, true)
+    : Event(EventTypeNames::beforeunload, false, true)
 {
     ScriptWrappable::init(this);
 }
diff --git a/Source/core/events/BeforeUnloadEvent.h b/Source/core/events/BeforeUnloadEvent.h
index be19940..52dbff2 100644
--- a/Source/core/events/BeforeUnloadEvent.h
+++ b/Source/core/events/BeforeUnloadEvent.h
@@ -26,7 +26,7 @@
 #define BeforeUnloadEvent_h
 
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -44,7 +44,7 @@
     void setReturnValue(const String& returnValue) { m_returnValue = returnValue; }
     String returnValue() const { return m_returnValue; }
 
-    virtual const AtomicString& interfaceName() const OVERRIDE { return eventNames().interfaceForBeforeUnloadEvent; }
+    virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::BeforeUnloadEvent; }
 
 private:
     BeforeUnloadEvent();
diff --git a/Source/core/events/ClipboardEvent.cpp b/Source/core/events/ClipboardEvent.cpp
index 30bdb42..a8fa4f9 100644
--- a/Source/core/events/ClipboardEvent.cpp
+++ b/Source/core/events/ClipboardEvent.cpp
@@ -24,7 +24,7 @@
 #include "core/events/ClipboardEvent.h"
 
 #include "core/dom/Clipboard.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -44,7 +44,7 @@
 const AtomicString& ClipboardEvent::interfaceName() const
 {
     // Notice that there is no ClipboardEvent.idl.
-    return eventNames().interfaceForEvent;
+    return EventNames::Event;
 }
 
 bool ClipboardEvent::isClipboardEvent() const
diff --git a/Source/core/events/CompositionEvent.cpp b/Source/core/events/CompositionEvent.cpp
index c73be9e..f4ecff6 100644
--- a/Source/core/events/CompositionEvent.cpp
+++ b/Source/core/events/CompositionEvent.cpp
@@ -27,7 +27,7 @@
 #include "config.h"
 #include "core/events/CompositionEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -70,7 +70,7 @@
 
 const AtomicString& CompositionEvent::interfaceName() const
 {
-    return eventNames().interfaceForCompositionEvent;
+    return EventNames::CompositionEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/events/CustomEvent.cpp b/Source/core/events/CustomEvent.cpp
index 7b57947..ea3ac91 100644
--- a/Source/core/events/CustomEvent.cpp
+++ b/Source/core/events/CustomEvent.cpp
@@ -27,7 +27,7 @@
 #include "core/events/CustomEvent.h"
 
 #include "bindings/v8/SerializedScriptValue.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -58,7 +58,7 @@
 
 const AtomicString& CustomEvent::interfaceName() const
 {
-    return eventNames().interfaceForCustomEvent;
+    return EventNames::CustomEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/events/CustomEvent.idl b/Source/core/events/CustomEvent.idl
index 12edaa5..0afe8fe 100644
--- a/Source/core/events/CustomEvent.idl
+++ b/Source/core/events/CustomEvent.idl
@@ -26,7 +26,7 @@
 [
     ConstructorTemplate=Event
 ] interface CustomEvent : Event {
-    [InitializedByEventConstructor, Custom] readonly attribute any detail;
+    [CustomGetter, InitializedByEventConstructor] readonly attribute any detail;
 
     [Custom] void initCustomEvent([Default=Undefined] optional DOMString typeArg,
                                   [Default=Undefined] optional boolean canBubbleArg,
diff --git a/Source/core/events/DocumentEventQueue.cpp b/Source/core/events/DocumentEventQueue.cpp
index e5532d2..bf0f13d 100644
--- a/Source/core/events/DocumentEventQueue.cpp
+++ b/Source/core/events/DocumentEventQueue.cpp
@@ -29,16 +29,16 @@
 
 #include "core/dom/Document.h"
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/SuspendableTimer.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/SuspendableTimer.h"
 
 namespace WebCore {
 
 class DocumentEventQueueTimer : public SuspendableTimer {
     WTF_MAKE_NONCOPYABLE(DocumentEventQueueTimer);
 public:
-    DocumentEventQueueTimer(DocumentEventQueue* eventQueue, ScriptExecutionContext* context)
+    DocumentEventQueueTimer(DocumentEventQueue* eventQueue, ExecutionContext* context)
         : SuspendableTimer(context)
         , m_eventQueue(eventQueue) { }
 
@@ -47,12 +47,12 @@
     DocumentEventQueue* m_eventQueue;
 };
 
-PassRefPtr<DocumentEventQueue> DocumentEventQueue::create(ScriptExecutionContext* context)
+PassRefPtr<DocumentEventQueue> DocumentEventQueue::create(ExecutionContext* context)
 {
     return adoptRef(new DocumentEventQueue(context));
 }
 
-DocumentEventQueue::DocumentEventQueue(ScriptExecutionContext* context)
+DocumentEventQueue::DocumentEventQueue(ExecutionContext* context)
     : m_pendingEventTimer(adoptPtr(new DocumentEventQueueTimer(this, context)))
     , m_isClosed(false)
 {
@@ -78,21 +78,6 @@
     return true;
 }
 
-void DocumentEventQueue::enqueueOrDispatchScrollEvent(PassRefPtr<Node> target, ScrollEventTargetType targetType)
-{
-    if (!target->document().hasListenerType(Document::SCROLL_LISTENER))
-        return;
-
-    // Per the W3C CSSOM View Module, scroll events fired at the document should bubble, others should not.
-    RefPtr<Event> scrollEvent = targetType == ScrollEventDocumentTarget ? Event::createBubble(eventNames().scrollEvent) : Event::create(eventNames().scrollEvent);
-
-    if (!m_nodesWithQueuedScrollEvents.add(target.get()).isNewEntry)
-        return;
-
-    scrollEvent->setTarget(target);
-    enqueueEvent(scrollEvent.release());
-}
-
 bool DocumentEventQueue::cancelEvent(Event* event)
 {
     ListHashSet<RefPtr<Event>, 16>::iterator it = m_queuedEvents.find(event);
@@ -116,8 +101,6 @@
     ASSERT(!m_pendingEventTimer->isActive());
     ASSERT(!m_queuedEvents.isEmpty());
 
-    m_nodesWithQueuedScrollEvents.clear();
-
     // Insert a marker for where we should stop.
     ASSERT(!m_queuedEvents.contains(0));
     bool wasAdded = m_queuedEvents.add(0).isNewEntry;
diff --git a/Source/core/events/DocumentEventQueue.h b/Source/core/events/DocumentEventQueue.h
index b871164..401f67d 100644
--- a/Source/core/events/DocumentEventQueue.h
+++ b/Source/core/events/DocumentEventQueue.h
@@ -39,16 +39,11 @@
 class Event;
 class DocumentEventQueueTimer;
 class Node;
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class DocumentEventQueue : public RefCounted<DocumentEventQueue>, public EventQueue {
 public:
-    enum ScrollEventTargetType {
-        ScrollEventDocumentTarget,
-        ScrollEventElementTarget
-    };
-
-    static PassRefPtr<DocumentEventQueue> create(ScriptExecutionContext*);
+    static PassRefPtr<DocumentEventQueue> create(ExecutionContext*);
     virtual ~DocumentEventQueue();
 
     // EventQueue
@@ -56,17 +51,14 @@
     virtual bool cancelEvent(Event*) OVERRIDE;
     virtual void close() OVERRIDE;
 
-    void enqueueOrDispatchScrollEvent(PassRefPtr<Node>, ScrollEventTargetType);
-
 private:
-    explicit DocumentEventQueue(ScriptExecutionContext*);
+    explicit DocumentEventQueue(ExecutionContext*);
 
     void pendingEventTimerFired();
     void dispatchEvent(PassRefPtr<Event>);
 
     OwnPtr<DocumentEventQueueTimer> m_pendingEventTimer;
     ListHashSet<RefPtr<Event>, 16> m_queuedEvents;
-    HashSet<Node*> m_nodesWithQueuedScrollEvents;
     bool m_isClosed;
 
     friend class DocumentEventQueueTimer;
diff --git a/Source/core/events/ErrorEvent.cpp b/Source/core/events/ErrorEvent.cpp
index a75cb60..0bd32f4 100644
--- a/Source/core/events/ErrorEvent.cpp
+++ b/Source/core/events/ErrorEvent.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/events/ErrorEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -60,7 +60,7 @@
 }
 
 ErrorEvent::ErrorEvent(const String& message, const String& fileName, unsigned lineNumber, unsigned columnNumber, PassRefPtr<DOMWrapperWorld> world)
-    : Event(eventNames().errorEvent, false, true)
+    : Event(EventTypeNames::error, false, true)
     , m_sanitizedMessage(message)
     , m_fileName(fileName)
     , m_lineNumber(lineNumber)
@@ -82,7 +82,7 @@
 
 const AtomicString& ErrorEvent::interfaceName() const
 {
-    return eventNames().interfaceForErrorEvent;
+    return EventNames::ErrorEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/events/ErrorEvent.idl b/Source/core/events/ErrorEvent.idl
index 33f0239..1a5d21a 100644
--- a/Source/core/events/ErrorEvent.idl
+++ b/Source/core/events/ErrorEvent.idl
@@ -35,6 +35,6 @@
     [InitializedByEventConstructor] readonly attribute DOMString filename;
     [InitializedByEventConstructor] readonly attribute unsigned long lineno;
     [InitializedByEventConstructor] readonly attribute unsigned long colno;
-    [InitializedByEventConstructor, Custom, Unserializable] readonly attribute any error;
+    [CustomGetter, InitializedByEventConstructor, Unserializable] readonly attribute any error;
 };
 
diff --git a/Source/core/events/Event.cpp b/Source/core/events/Event.cpp
index 2e5faed..7fbd04f 100644
--- a/Source/core/events/Event.cpp
+++ b/Source/core/events/Event.cpp
@@ -23,9 +23,9 @@
 #include "config.h"
 #include "core/events/Event.h"
 
-#include "core/events/EventNames.h"
-#include "core/events/EventTarget.h"
 #include "core/dom/StaticNodeList.h"
+#include "core/events/EventTarget.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/text/AtomicString.h"
 
@@ -105,7 +105,7 @@
 
 const AtomicString& Event::interfaceName() const
 {
-    return eventNames().interfaceForEvent;
+    return EventNames::Event;
 }
 
 bool Event::hasInterface(const AtomicString& name) const
@@ -138,6 +138,16 @@
     return false;
 }
 
+bool Event::isGestureEvent() const
+{
+    return false;
+}
+
+bool Event::isWheelEvent() const
+{
+    return false;
+}
+
 bool Event::isDragEvent() const
 {
     return false;
diff --git a/Source/core/events/Event.h b/Source/core/events/Event.h
index b825f70..7ecbd40 100644
--- a/Source/core/events/Event.h
+++ b/Source/core/events/Event.h
@@ -142,6 +142,8 @@
     virtual bool isFocusEvent() const;
     virtual bool isKeyboardEvent() const;
     virtual bool isTouchEvent() const;
+    virtual bool isGestureEvent() const;
+    virtual bool isWheelEvent() const;
 
     // Drag events are a subset of mouse events.
     virtual bool isDragEvent() const;
diff --git a/Source/core/events/Event.idl b/Source/core/events/Event.idl
index 88d704f..49b4914 100644
--- a/Source/core/events/Event.idl
+++ b/Source/core/events/Event.idl
@@ -59,9 +59,9 @@
 
     void               stopPropagation();
     void               preventDefault();
-     void initEvent([Default=Undefined] optional DOMString eventTypeArg,
-                                  [Default=Undefined] optional boolean canBubbleArg,
-                                  [Default=Undefined] optional boolean cancelableArg);
+    void initEvent([Default=Undefined] optional DOMString eventTypeArg,
+                   [Default=Undefined] optional boolean canBubbleArg,
+                   [Default=Undefined] optional boolean cancelableArg);
 
     // DOM Level 3 Additions.
     readonly attribute boolean defaultPrevented;
@@ -72,8 +72,7 @@
     [ImplementedAs=legacyReturnValue, DeprecateAs=EventReturnValue] attribute boolean returnValue;
              attribute boolean          cancelBubble;
 
-    [EnabledAtRuntime=ShadowDOM] readonly attribute NodeList path;
+    [RuntimeEnabled=ShadowDOM] readonly attribute NodeList path;
 
-    [Custom] readonly attribute Clipboard        clipboardData;
+    [CustomGetter] readonly attribute Clipboard clipboardData;
 };
-
diff --git a/Source/core/events/EventAliases.in b/Source/core/events/EventAliases.in
index a4b61c2..82b8e99 100644
--- a/Source/core/events/EventAliases.in
+++ b/Source/core/events/EventAliases.in
@@ -1,5 +1,5 @@
 # Aliases
-AnimationEvent ImplementedAs=WebKitAnimationEvent, EnabledAtRuntime=cssAnimationUnprefixedEnabled
+AnimationEvent ImplementedAs=WebKitAnimationEvent, RuntimeEnabled=cssAnimationUnprefixedEnabled
 Events ImplementedAs=Event
 HTMLEvents ImplementedAs=Event
 KeyboardEvents ImplementedAs=KeyboardEvent
@@ -11,4 +11,4 @@
 UIEvents ImplementedAs=UIEvent
 WebKitTransitionEvent ImplementedAs=TransitionEvent
 
-core/dom/TouchEvent EnabledAtRuntime=touchEnabled
+core/dom/TouchEvent RuntimeEnabled=touchEnabled
diff --git a/Source/core/events/EventDispatcher.cpp b/Source/core/events/EventDispatcher.cpp
index 20bc658..75a8800 100644
--- a/Source/core/events/EventDispatcher.cpp
+++ b/Source/core/events/EventDispatcher.cpp
@@ -34,7 +34,7 @@
 #include "core/events/ScopedEventQueue.h"
 #include "core/events/WindowEventContext.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "wtf/RefPtr.h"
 
 namespace WebCore {
@@ -84,17 +84,17 @@
     gNodesDispatchingSimulatedClicks->add(node);
 
     if (mouseEventOptions == SendMouseOverUpDownEvents)
-        EventDispatcher(node, SimulatedMouseEvent::create(eventNames().mouseoverEvent, node->document().defaultView(), underlyingEvent)).dispatch();
+        EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mouseover, node->document().defaultView(), underlyingEvent)).dispatch();
 
     if (mouseEventOptions != SendNoEvents)
-        EventDispatcher(node, SimulatedMouseEvent::create(eventNames().mousedownEvent, node->document().defaultView(), underlyingEvent)).dispatch();
+        EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mousedown, node->document().defaultView(), underlyingEvent)).dispatch();
     node->setActive(true, visualOptions == ShowPressedLook);
     if (mouseEventOptions != SendNoEvents)
-        EventDispatcher(node, SimulatedMouseEvent::create(eventNames().mouseupEvent, node->document().defaultView(), underlyingEvent)).dispatch();
+        EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::mouseup, node->document().defaultView(), underlyingEvent)).dispatch();
     node->setActive(false);
 
     // always send click
-    EventDispatcher(node, SimulatedMouseEvent::create(eventNames().clickEvent, node->document().defaultView(), underlyingEvent)).dispatch();
+    EventDispatcher(node, SimulatedMouseEvent::create(EventTypeNames::click, node->document().defaultView(), underlyingEvent)).dispatch();
 
     gNodesDispatchingSimulatedClicks->remove(node);
 }
diff --git a/Source/core/events/EventListener.h b/Source/core/events/EventListener.h
index cb4eaa0..a11ab13 100644
--- a/Source/core/events/EventListener.h
+++ b/Source/core/events/EventListener.h
@@ -27,7 +27,7 @@
 
     class DOMWrapperWorld;
     class Event;
-    class ScriptExecutionContext;
+    class ExecutionContext;
 
     class EventListener : public RefCounted<EventListener> {
     public:
@@ -43,7 +43,7 @@
 
         virtual ~EventListener() { }
         virtual bool operator==(const EventListener&) = 0;
-        virtual void handleEvent(ScriptExecutionContext*, Event*) = 0;
+        virtual void handleEvent(ExecutionContext*, Event*) = 0;
         virtual bool wasCreatedFromMarkup() const { return false; }
         virtual DOMWrapperWorld* world() const { return 0; }
 
diff --git a/Source/core/events/EventNames.cpp b/Source/core/events/EventNames.cpp
deleted file mode 100644
index 94db381..0000000
--- a/Source/core/events/EventNames.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "core/events/EventNames.h"
-
-namespace WebCore {
-
-#define INITIALIZE_EVENT_NAME(name) \
-    , name##Event(#name, AtomicString::ConstructFromLiteral)
-
-#define INITIALIZE_EVENT_INTERFACE(name) \
-    , interfaceFor##name(#name, AtomicString::ConstructFromLiteral)
-
-EventNames::EventNames()
-    : dummy(0)
-EVENT_NAMES_FOR_EACH(INITIALIZE_EVENT_NAME)
-EVENT_INTERFACES_FOR_EACH(INITIALIZE_EVENT_INTERFACE)
-EVENT_TARGET_INTERFACES_FOR_EACH(INITIALIZE_EVENT_INTERFACE)
-{
-}
-
-}
diff --git a/Source/core/events/EventNames.h b/Source/core/events/EventNames.h
deleted file mode 100644
index 225727d..0000000
--- a/Source/core/events/EventNames.h
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Jon Shier (jshier@iastate.edu)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef EventNames_h
-#define EventNames_h
-
-#include "EventInterfaces.h"
-#include "EventTargetInterfaces.h"
-#include "core/platform/ThreadGlobalData.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-#define EVENT_NAMES_FOR_EACH(macro) \
-    \
-    macro(abort) \
-    macro(beforecopy) \
-    macro(beforecut) \
-    macro(beforeload) \
-    macro(beforepaste) \
-    macro(beforeunload) \
-    macro(blocked) \
-    macro(blur) \
-    macro(cached) \
-    macro(cancel) \
-    macro(change) \
-    macro(chargingchange) \
-    macro(chargingtimechange) \
-    macro(checking) \
-    macro(click) \
-    macro(close) \
-    macro(complete) \
-    macro(compositionend) \
-    macro(compositionstart) \
-    macro(compositionupdate) \
-    macro(connect) \
-    macro(contextmenu) \
-    macro(copy) \
-    macro(cut) \
-    macro(dblclick) \
-    macro(devicemotion) \
-    macro(deviceorientation) \
-    macro(dischargingtimechange) \
-    macro(disconnect) \
-    macro(display) \
-    macro(downloading) \
-    macro(drag) \
-    macro(dragend) \
-    macro(dragenter) \
-    macro(dragleave) \
-    macro(dragover) \
-    macro(dragstart) \
-    macro(drop) \
-    macro(error) \
-    macro(focus) \
-    macro(focusin) \
-    macro(focusout) \
-    macro(gesturetap) \
-    macro(gesturetapunconfirmed) \
-    macro(gesturetapdown) \
-    macro(gesturescrollstart) \
-    macro(gesturescrollend) \
-    macro(gesturescrollupdate) \
-    macro(hashchange) \
-    macro(input) \
-    macro(invalid) \
-    macro(keydown) \
-    macro(keypress) \
-    macro(keyup) \
-    macro(levelchange) \
-    macro(load) \
-    macro(loading) \
-    macro(loadingdone) \
-    macro(loadingerror) \
-    macro(loadstart) \
-    macro(message) \
-    macro(midimessage) \
-    macro(mousedown) \
-    macro(mouseenter) \
-    macro(mouseleave) \
-    macro(mousemove) \
-    macro(mouseout) \
-    macro(mouseover) \
-    macro(mouseup) \
-    macro(mousewheel) \
-    macro(noupdate) \
-    macro(obsolete) \
-    macro(offline) \
-    macro(online) \
-    macro(open) \
-    macro(overflowchanged) \
-    macro(pagehide) \
-    macro(pageshow) \
-    macro(paste) \
-    macro(popstate) \
-    macro(readystatechange) \
-    macro(reset) \
-    macro(resize) \
-    macro(scroll) \
-    macro(search) \
-    macro(select) \
-    macro(selectstart) \
-    macro(selectionchange) \
-    macro(storage) \
-    macro(submit) \
-    macro(textInput) \
-    macro(unload) \
-    macro(updateready) \
-    macro(upgradeneeded) \
-    macro(versionchange) \
-    macro(webkitvisibilitychange) \
-    macro(wheel) \
-    macro(write) \
-    macro(writeend) \
-    macro(writestart) \
-    macro(zoom) \
-    \
-    macro(DOMActivate) \
-    macro(DOMFocusIn) \
-    macro(DOMFocusOut) \
-    macro(DOMCharacterDataModified) \
-    macro(DOMNodeInserted) \
-    macro(DOMNodeInsertedIntoDocument) \
-    macro(DOMNodeRemoved) \
-    macro(DOMNodeRemovedFromDocument) \
-    macro(DOMSubtreeModified) \
-    macro(DOMContentLoaded) \
-    \
-    macro(webkitBeforeTextInserted) \
-    macro(webkitEditableContentChanged) \
-    \
-    macro(canplay) \
-    macro(canplaythrough) \
-    macro(durationchange) \
-    macro(emptied) \
-    macro(ended) \
-    macro(loadeddata) \
-    macro(loadedmetadata) \
-    macro(pause) \
-    macro(play) \
-    macro(playing) \
-    macro(ratechange) \
-    macro(seeked) \
-    macro(seeking) \
-    macro(timeupdate) \
-    macro(volumechange) \
-    macro(waiting) \
-    \
-    macro(addtrack) \
-    macro(cuechange) \
-    macro(enter) \
-    macro(exit) \
-    \
-    macro(addsourcebuffer) \
-    macro(removesourcebuffer) \
-    macro(sourceopen) \
-    macro(sourceended) \
-    macro(sourceclose) \
-    macro(update) \
-    macro(updateend) \
-    macro(updatestart) \
-    macro(webkitaddsourcebuffer) \
-    macro(webkitremovesourcebuffer) \
-    macro(webkitsourceopen) \
-    macro(webkitsourceended) \
-    macro(webkitsourceclose) \
-    \
-    macro(webkitkeyadded) \
-    macro(webkitkeyerror) \
-    macro(webkitkeymessage) \
-    macro(webkitneedkey) \
-    \
-    macro(progress) \
-    macro(stalled) \
-    macro(suspend) \
-    \
-    macro(animationend) \
-    macro(webkitAnimationEnd) \
-    macro(animationstart) \
-    macro(webkitAnimationStart) \
-    macro(animationiteration) \
-    macro(webkitAnimationIteration) \
-    \
-    macro(webkitTransitionEnd) \
-    macro(transitionend) \
-    \
-    macro(orientationchange) \
-    \
-    macro(timeout) \
-    \
-    macro(touchstart) \
-    macro(touchmove) \
-    macro(touchend) \
-    macro(touchcancel) \
-    \
-    macro(success) \
-    \
-    macro(loadend) \
-    \
-    macro(webkitfullscreenchange) \
-    macro(webkitfullscreenerror) \
-    \
-    macro(webkitspeechchange) \
-    \
-    macro(audiostart) \
-    macro(soundstart) \
-    macro(speechstart) \
-    macro(speechend) \
-    macro(soundend) \
-    macro(audioend) \
-    macro(result) \
-    macro(nomatch) \
-    macro(start) \
-    macro(end) \
-    macro(mark) \
-    macro(boundary) \
-    macro(resume) \
-    \
-    macro(webglcontextlost) \
-    macro(webglcontextrestored) \
-    macro(webglcontextcreationerror) \
-    \
-    macro(audioprocess) \
-    \
-    macro(connecting) \
-    macro(addstream) \
-    macro(removestream) \
-    macro(signalingstatechange) \
-    macro(removetrack) \
-    macro(mute) \
-    macro(unmute) \
-    macro(iceconnectionstatechange) \
-    macro(icecandidate) \
-    macro(negotiationneeded) \
-    macro(datachannel) \
-    macro(tonechange) \
-    \
-    macro(show) \
-    \
-    macro(webkitpointerlockchange) \
-    macro(webkitpointerlockerror) \
-    \
-    macro(webkitregionlayoutupdate) \
-    \
-    macro(webkitregionoversetchange) \
-    \
-    macro(webkitnetworkinfochange) \
-    \
-    macro(webkitresourcetimingbufferfull) \
-    \
-    macro(webkitdeviceproximity) \
-    \
-    macro(autocomplete) \
-    macro(autocompleteerror) \
-    \
-    macro(webkitprerenderstart) \
-    macro(webkitprerenderstop) \
-    macro(webkitprerenderload) \
-    macro(webkitprerenderdomcontentloaded) \
-    \
-    macro(securitypolicyviolation) \
-    \
-
-// end of EVENT_NAMES_FOR_EACH
-
-    class EventNames {
-        WTF_MAKE_NONCOPYABLE(EventNames); WTF_MAKE_FAST_ALLOCATED;
-        int dummy; // Needed to make initialization macro work.
-        // Private to prevent accidental call to EventNames() instead of eventNames()
-        EventNames();
-        friend class ThreadGlobalData;
-
-    public:
-        #define EVENT_NAMES_DECLARE(name) AtomicString name##Event;
-        EVENT_NAMES_FOR_EACH(EVENT_NAMES_DECLARE)
-        #undef EVENT_NAMES_DECLARE
-
-        #define EVENT_INTERFACE_DECLARE(name) AtomicString interfaceFor##name;
-        EVENT_INTERFACES_FOR_EACH(EVENT_INTERFACE_DECLARE)
-        EVENT_TARGET_INTERFACES_FOR_EACH(EVENT_INTERFACE_DECLARE)
-        #undef EVENT_INTERFACE_DECLARE
-
-        inline bool isTouchEventType(const AtomicString& eventType) const
-        {
-            return eventType == touchstartEvent
-                || eventType == touchmoveEvent
-                || eventType == touchendEvent
-                || eventType == touchcancelEvent;
-        }
-
-        inline bool isGestureEventType(const AtomicString& eventType) const
-        {
-            return eventType == gesturetapEvent
-                || eventType == gesturetapunconfirmedEvent
-                || eventType == gesturetapdownEvent
-                || eventType == gesturescrollstartEvent
-                || eventType == gesturescrollendEvent
-                || eventType == gesturescrollupdateEvent;
-        }
-
-        Vector<AtomicString> touchEventNames() const
-        {
-            Vector<AtomicString> names;
-            names.reserveCapacity(4);
-            names.append(touchstartEvent);
-            names.append(touchmoveEvent);
-            names.append(touchendEvent);
-            names.append(touchcancelEvent);
-            return names;
-        }
-    };
-
-    inline EventNames& eventNames()
-    {
-        return threadGlobalData().eventNames();
-    }
-
-}
-
-#endif
diff --git a/Source/core/events/EventPathWalker.cpp b/Source/core/events/EventPathWalker.cpp
index a322bda..1376ea8 100644
--- a/Source/core/events/EventPathWalker.cpp
+++ b/Source/core/events/EventPathWalker.cpp
@@ -34,49 +34,86 @@
 namespace WebCore {
 
 EventPathWalker::EventPathWalker(const Node* node)
-    : m_node(node)
-    , m_distributedNode(node)
-    , m_isVisitingInsertionPointInReprojection(false)
+    : m_index(0)
 {
     ASSERT(node);
     node->document().updateDistributionForNodeIfNeeded(const_cast<Node*>(node));
-}
-
-Node* EventPathWalker::parent(const Node* node)
-{
-    EventPathWalker walker(node);
-    walker.moveToParent();
-    return walker.node();
-}
-
-void EventPathWalker::moveToParent()
-{
-    ASSERT(m_node);
-    ASSERT(m_distributedNode);
-    if (ElementShadow* shadow = shadowOfParent(m_node)) {
-        if (InsertionPoint* insertionPoint = shadow->findInsertionPointFor(m_distributedNode)) {
-            m_node = insertionPoint;
-            m_isVisitingInsertionPointInReprojection = true;
-            return;
+    const Node* current = node;
+    const Node* distributedNode = node;
+    while (current) {
+        m_path.append(current);
+        if (ElementShadow* shadow = shadowOfParent(current)) {
+            if (InsertionPoint* insertionPoint = shadow->findInsertionPointFor(distributedNode)) {
+                current = insertionPoint;
+                continue;
+            }
         }
-    }
-    if (!m_node->isShadowRoot()) {
-        m_node = m_node->parentNode();
-        if (!(m_node && m_node->isShadowRoot() && toShadowRoot(m_node)->insertionPoint()))
-            m_distributedNode = m_node;
-        m_isVisitingInsertionPointInReprojection = false;
-        return;
-    }
+        if (!current->isShadowRoot()) {
+            current = current->parentNode();
+            if (!(current && current->isShadowRoot() && toShadowRoot(current)->insertionPoint()))
+                distributedNode = current;
+            continue;
+        }
 
-    const ShadowRoot* shadowRoot = toShadowRoot(m_node);
-    if (InsertionPoint* insertionPoint = shadowRoot->insertionPoint()) {
-        m_node = insertionPoint;
-        m_isVisitingInsertionPointInReprojection = true;
-        return;
+        const ShadowRoot* shadowRoot = toShadowRoot(current);
+        if (InsertionPoint* insertionPoint = shadowRoot->insertionPoint()) {
+            current = insertionPoint;
+            continue;
+        }
+        current = shadowRoot->host();
+        distributedNode = current;
     }
-    m_node = shadowRoot->host();
-    m_distributedNode = m_node;
-    m_isVisitingInsertionPointInReprojection = false;
+}
+
+static inline bool movedFromParentToChild(const TreeScope* lastTreeScope, const TreeScope* currentTreeScope)
+{
+    return currentTreeScope->parentTreeScope() == lastTreeScope;
+}
+
+static inline bool movedFromChildToParent(const TreeScope* lastTreeScope, const TreeScope* currentTreeScope)
+{
+    return lastTreeScope->parentTreeScope() == currentTreeScope;
+}
+
+static inline bool movedFromOlderToYounger(const TreeScope* lastTreeScope, const TreeScope* currentTreeScope)
+{
+    Node* rootNode = lastTreeScope->rootNode();
+    return rootNode->isShadowRoot() && toShadowRoot(rootNode)->youngerShadowRoot() == currentTreeScope->rootNode();
+}
+
+void EventPathWalker::calculateAdjustedTargets()
+{
+    ASSERT(m_adjustedTargets.isEmpty());
+    Vector<const Node*, 32> targetStack;
+    const TreeScope* lastTreeScope = 0;
+    bool isSVGElement = m_path[0]->isSVGElement();
+    for (size_t i = 0; i < m_path.size(); ++i) {
+        const Node* current = m_path[i];
+        const TreeScope* currentTreeScope = &current->treeScope();
+        if (targetStack.isEmpty()) {
+            targetStack.append(current);
+        } else if (lastTreeScope != currentTreeScope && !isSVGElement) {
+            if (movedFromParentToChild(lastTreeScope, currentTreeScope)) {
+                targetStack.append(targetStack.last());
+            } else if (movedFromChildToParent(lastTreeScope, currentTreeScope)) {
+                ASSERT(!targetStack.isEmpty());
+                targetStack.removeLast();
+                if (targetStack.isEmpty())
+                    targetStack.append(current);
+            } else if (movedFromOlderToYounger(lastTreeScope, currentTreeScope)) {
+                ASSERT(!targetStack.isEmpty());
+                targetStack.removeLast();
+                if (targetStack.isEmpty())
+                    targetStack.append(current);
+                else
+                    targetStack.append(targetStack.last());
+            } else {
+                ASSERT_NOT_REACHED();
+            }
+        }
+        m_adjustedTargets.append(targetStack.last());
+        lastTreeScope = currentTreeScope;
+    }
 }
 
 } // namespace
diff --git a/Source/core/events/EventPathWalker.h b/Source/core/events/EventPathWalker.h
index 9006e9b..b27e930 100644
--- a/Source/core/events/EventPathWalker.h
+++ b/Source/core/events/EventPathWalker.h
@@ -27,6 +27,8 @@
 #ifndef EventPathWalker_h
 #define EventPathWalker_h
 
+#include "wtf/Vector.h"
+
 namespace WebCore {
 
 class Node;
@@ -35,16 +37,38 @@
 public:
     explicit EventPathWalker(const Node*);
     static Node* parent(const Node*);
-    void moveToParent();
-    Node* node() const { return const_cast<Node*>(m_node); }
-    bool isVisitingInsertionPointInReprojection() { return m_isVisitingInsertionPointInReprojection; }
+    void moveToParent() { ++m_index; };
+    Node* node() const;
+    Node* adjustedTarget();
 
 private:
-    const Node* m_node;
-    const Node* m_distributedNode;
-    bool m_isVisitingInsertionPointInReprojection;
+    void calculateAdjustedTargets();
+    size_t m_index;
+    Vector<const Node*> m_path;
+    Vector<const Node*> m_adjustedTargets;
 };
 
+inline Node* EventPathWalker::node() const
+{
+    ASSERT(m_index <= m_path.size());
+    return m_index == m_path.size() ? 0 : const_cast<Node*>(m_path[m_index]);
+}
+
+inline Node* EventPathWalker::adjustedTarget()
+{
+    if (m_adjustedTargets.isEmpty())
+        calculateAdjustedTargets();
+    ASSERT(m_index <= m_adjustedTargets.size());
+    return m_index == m_adjustedTargets.size() ? 0 : const_cast<Node*>(m_adjustedTargets[m_index]);
+}
+
+inline Node* EventPathWalker::parent(const Node* node)
+{
+    EventPathWalker walker(node);
+    walker.moveToParent();
+    return walker.node();
+}
+
 } // namespace
 
 #endif
diff --git a/Source/core/events/EventRetargeter.cpp b/Source/core/events/EventRetargeter.cpp
index 00caedc..17cfb68 100644
--- a/Source/core/events/EventRetargeter.cpp
+++ b/Source/core/events/EventRetargeter.cpp
@@ -59,15 +59,15 @@
     // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details.
     const AtomicString eventType = event->type();
     if (inTheSameScope(shadowRoot, target)
-        && (eventType == eventNames().abortEvent
-            || eventType == eventNames().changeEvent
-            || eventType == eventNames().errorEvent
-            || eventType == eventNames().loadEvent
-            || eventType == eventNames().resetEvent
-            || eventType == eventNames().resizeEvent
-            || eventType == eventNames().scrollEvent
-            || eventType == eventNames().selectEvent
-            || eventType == eventNames().selectstartEvent))
+        && (eventType == EventTypeNames::abort
+            || eventType == EventTypeNames::change
+            || eventType == EventTypeNames::error
+            || eventType == EventTypeNames::load
+            || eventType == EventTypeNames::reset
+            || eventType == EventTypeNames::resize
+            || eventType == EventTypeNames::scroll
+            || eventType == EventTypeNames::select
+            || eventType == EventTypeNames::selectstart))
         return StayInsideShadowDOM;
 
     return RetargetEvent;
@@ -84,32 +84,19 @@
     EventPath& eventPath = event->eventPath();
     eventPath.clear();
     bool inDocument = node->inDocument();
-    bool isSVGElement = node->isSVGElement();
     bool isMouseOrFocusEvent = event->isMouseEvent() || event->isFocusEvent();
     bool isTouchEvent = event->isTouchEvent();
-    Vector<EventTarget*, 32> targetStack;
     for (EventPathWalker walker(node); walker.node(); walker.moveToParent()) {
-        Node* node = walker.node();
-        if (targetStack.isEmpty())
-            targetStack.append(eventTargetRespectingTargetRules(node));
-        else if (walker.isVisitingInsertionPointInReprojection())
-            targetStack.append(targetStack.last());
         if (isMouseOrFocusEvent)
-            eventPath.append(adoptPtr(new MouseOrFocusEventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
+            eventPath.append(adoptPtr(new MouseOrFocusEventContext(walker.node(), eventTargetRespectingTargetRules(walker.node()), eventTargetRespectingTargetRules(walker.adjustedTarget()))));
         else if (isTouchEvent)
-            eventPath.append(adoptPtr(new TouchEventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
+            eventPath.append(adoptPtr(new TouchEventContext(walker.node(), eventTargetRespectingTargetRules(walker.node()), eventTargetRespectingTargetRules(walker.adjustedTarget()))));
         else
-            eventPath.append(adoptPtr(new EventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
+            eventPath.append(adoptPtr(new EventContext(walker.node(), eventTargetRespectingTargetRules(walker.node()), eventTargetRespectingTargetRules(walker.adjustedTarget()))));
         if (!inDocument)
             break;
-        if (!node->isShadowRoot())
-            continue;
-        if (determineDispatchBehavior(event, toShadowRoot(node), targetStack.last()) == StayInsideShadowDOM)
+        if (walker.node()->isShadowRoot() && determineDispatchBehavior(event, toShadowRoot(walker.node()), node) == StayInsideShadowDOM)
             break;
-        if (!isSVGElement) {
-            ASSERT(!targetStack.isEmpty());
-            targetStack.removeLast();
-        }
     }
 }
 
@@ -242,23 +229,11 @@
 
 void EventRetargeter::buildRelatedNodeMap(const Node* relatedNode, RelatedNodeMap& relatedNodeMap)
 {
-    Vector<Node*, 32> relatedNodeStack;
     TreeScope* lastTreeScope = 0;
     for (EventPathWalker walker(relatedNode); walker.node(); walker.moveToParent()) {
-        Node* node = walker.node();
-        if (relatedNodeStack.isEmpty())
-            relatedNodeStack.append(node);
-        else if (walker.isVisitingInsertionPointInReprojection())
-            relatedNodeStack.append(relatedNodeStack.last());
-        TreeScope* scope = &node->treeScope();
-        // Skips adding a node to the map if treeScope does not change. Just for the performance optimization.
-        if (scope != lastTreeScope)
-            relatedNodeMap.add(scope, relatedNodeStack.last());
-        lastTreeScope = scope;
-        if (node->isShadowRoot()) {
-            ASSERT(!relatedNodeStack.isEmpty());
-            relatedNodeStack.removeLast();
-        }
+        if (walker.node()->treeScope() != lastTreeScope)
+            relatedNodeMap.add(&walker.node()->treeScope(), walker.adjustedTarget());
+        lastTreeScope = &walker.node()->treeScope();
     }
 }
 
diff --git a/Source/core/events/EventSender.h b/Source/core/events/EventSender.h
index 51d4c78..f07678f 100644
--- a/Source/core/events/EventSender.h
+++ b/Source/core/events/EventSender.h
@@ -26,7 +26,7 @@
 #ifndef EventSender_h
 #define EventSender_h
 
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/Vector.h"
 #include "wtf/text/AtomicString.h"
 
diff --git a/Source/core/events/EventTarget.cpp b/Source/core/events/EventTarget.cpp
index b8ab146..cb149b9 100644
--- a/Source/core/events/EventTarget.cpp
+++ b/Source/core/events/EventTarget.cpp
@@ -35,11 +35,11 @@
 #include "RuntimeEnabledFeatures.h"
 #include "bindings/v8/DOMWrapperWorld.h"
 #include "bindings/v8/ExceptionState.h"
-#include "bindings/v8/ScriptController.h"
 #include "core/events/Event.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
+#include "platform/UserGestureIndicator.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/Vector.h"
 
@@ -76,15 +76,14 @@
 
 inline DOMWindow* EventTarget::executingWindow()
 {
-    if (ScriptExecutionContext* context = scriptExecutionContext())
+    if (ExecutionContext* context = executionContext())
         return context->executingWindow();
     return 0;
 }
 
 bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
 {
-    EventTargetData* d = ensureEventTargetData();
-    return d->eventListenerMap.add(eventType, listener, useCapture);
+    return ensureEventTargetData().eventListenerMap.add(eventType, listener, useCapture);
 }
 
 bool EventTarget::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture)
@@ -162,7 +161,7 @@
         return false;
     }
 
-    if (!scriptExecutionContext())
+    if (!executionContext())
         return false;
 
     return dispatchEvent(event);
@@ -184,20 +183,20 @@
 
 static AtomicString legacyType(const Event* event)
 {
-    if (event->type() == eventNames().transitionendEvent)
-        return eventNames().webkitTransitionEndEvent;
+    if (event->type() == EventTypeNames::transitionend)
+        return EventTypeNames::webkitTransitionEnd;
 
-    if (event->type() == eventNames().animationstartEvent)
-        return eventNames().webkitAnimationStartEvent;
+    if (event->type() == EventTypeNames::animationstart)
+        return EventTypeNames::webkitAnimationStart;
 
-    if (event->type() == eventNames().animationendEvent)
-        return eventNames().webkitAnimationEndEvent;
+    if (event->type() == EventTypeNames::animationend)
+        return EventTypeNames::webkitAnimationEnd;
 
-    if (event->type() == eventNames().animationiterationEvent)
-        return eventNames().webkitAnimationIterationEvent;
+    if (event->type() == EventTypeNames::animationiteration)
+        return EventTypeNames::webkitAnimationIteration;
 
-    if (event->type() == eventNames().wheelEvent)
-        return eventNames().mousewheelEvent;
+    if (event->type() == EventTypeNames::wheel)
+        return EventTypeNames::mousewheel;
 
     return emptyString();
 }
@@ -209,22 +208,22 @@
     UseCounter::Feature prefixedAndUnprefixedFeature;
     bool shouldCount = false;
 
-    if (legacyTypeName == eventNames().webkitTransitionEndEvent) {
+    if (legacyTypeName == EventTypeNames::webkitTransitionEnd) {
         prefixedFeature = UseCounter::PrefixedTransitionEndEvent;
         unprefixedFeature = UseCounter::UnprefixedTransitionEndEvent;
         prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedTransitionEndEvent;
         shouldCount = true;
-    } else if (legacyTypeName == eventNames().webkitAnimationEndEvent) {
+    } else if (legacyTypeName == EventTypeNames::webkitAnimationEnd) {
         prefixedFeature = UseCounter::PrefixedAnimationEndEvent;
         unprefixedFeature = UseCounter::UnprefixedAnimationEndEvent;
         prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimationEndEvent;
         shouldCount = true;
-    } else if (legacyTypeName == eventNames().webkitAnimationStartEvent) {
+    } else if (legacyTypeName == EventTypeNames::webkitAnimationStart) {
         prefixedFeature = UseCounter::PrefixedAnimationStartEvent;
         unprefixedFeature = UseCounter::UnprefixedAnimationStartEvent;
         prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimationStartEvent;
         shouldCount = true;
-    } else if (legacyTypeName == eventNames().webkitAnimationIterationEvent) {
+    } else if (legacyTypeName == EventTypeNames::webkitAnimationIteration) {
         prefixedFeature = UseCounter::PrefixedAnimationIterationEvent;
         unprefixedFeature = UseCounter::UnprefixedAnimationIterationEvent;
         prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimationIterationEvent;
@@ -260,8 +259,8 @@
         legacyListenersVector = d->eventListenerMap.find(legacyTypeName);
 
     EventListenerVector* listenersVector = d->eventListenerMap.find(event->type());
-    if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && (event->type() == eventNames().animationiterationEvent || event->type() == eventNames().animationendEvent
-        || event->type() == eventNames().animationstartEvent))
+    if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && (event->type() == EventTypeNames::animationiteration || event->type() == EventTypeNames::animationend
+        || event->type() == EventTypeNames::animationstart))
         listenersVector = 0;
 
     if (listenersVector) {
@@ -287,7 +286,7 @@
     // index |size|, so iterating up to (but not including) |size| naturally excludes
     // new event listeners.
 
-    if (event->type() == eventNames().beforeunloadEvent) {
+    if (event->type() == EventTypeNames::beforeunload) {
         if (DOMWindow* executingWindow = this->executingWindow()) {
             if (executingWindow->top())
                 UseCounter::count(executingWindow, UseCounter::SubFrameBeforeUnloadFired);
@@ -312,7 +311,7 @@
         if (event->immediatePropagationStopped())
             break;
 
-        ScriptExecutionContext* context = scriptExecutionContext();
+        ExecutionContext* context = executionContext();
         if (!context)
             break;
 
@@ -320,13 +319,13 @@
         // To match Mozilla, the AT_TARGET phase fires both capturing and bubbling
         // event listeners, even though that violates some versions of the DOM spec.
         registeredListener.listener->handleEvent(context, event);
-        if (!userEventWasHandled && ScriptController::processingUserGesture())
+        if (!userEventWasHandled && UserGestureIndicator::processingUserGesture())
             userEventWasHandled = true;
         InspectorInstrumentation::didHandleEvent(cookie);
     }
     d->firingEventIterators->removeLast();
     if (userEventWasHandled) {
-        if (ScriptExecutionContext* context = scriptExecutionContext())
+        if (ExecutionContext* context = executionContext())
             context->userEventWasHandled();
     }
 }
diff --git a/Source/core/events/EventTarget.h b/Source/core/events/EventTarget.h
index 4127132..f2d59f1 100644
--- a/Source/core/events/EventTarget.h
+++ b/Source/core/events/EventTarget.h
@@ -33,7 +33,7 @@
 #define EventTarget_h
 
 #include "core/events/EventListenerMap.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
@@ -61,7 +61,7 @@
     class Node;
     class Notification;
     class SVGElementInstance;
-    class ScriptExecutionContext;
+    class ExecutionContext;
     class ScriptProcessorNode;
     class SharedWorker;
     class SharedWorkerGlobalScope;
@@ -102,7 +102,7 @@
         void deref() { derefEventTarget(); }
 
         virtual const AtomicString& interfaceName() const = 0;
-        virtual ScriptExecutionContext* scriptExecutionContext() const = 0;
+        virtual ExecutionContext* executionContext() const = 0;
 
         virtual Node* toNode();
         virtual DOMWindow* toDOMWindow();
@@ -131,7 +131,7 @@
         virtual ~EventTarget();
 
         virtual EventTargetData* eventTargetData() = 0;
-        virtual EventTargetData* ensureEventTargetData() = 0;
+        virtual EventTargetData& ensureEventTargetData() = 0;
 
     private:
         virtual void refEventTarget() = 0;
@@ -146,35 +146,43 @@
         friend class EventListenerIterator;
     };
 
+    class EventTargetWithInlineData : public EventTarget {
+    protected:
+        virtual EventTargetData* eventTargetData() OVERRIDE FINAL { return &m_eventTargetData; }
+        virtual EventTargetData& ensureEventTargetData() OVERRIDE FINAL { return m_eventTargetData; }
+    private:
+        EventTargetData m_eventTargetData;
+    };
+
     // FIXME: These macros should be split into separate DEFINE and DECLARE
     // macros to avoid causing so many header includes.
     #define DEFINE_ATTRIBUTE_EVENT_LISTENER(attribute) \
-        EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(eventNames().attribute##Event, isolatedWorld); } \
-        void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld = 0) { setAttributeEventListener(eventNames().attribute##Event, listener, isolatedWorld); } \
+        EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(EventTypeNames::attribute, isolatedWorld); } \
+        void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld = 0) { setAttributeEventListener(EventTypeNames::attribute, listener, isolatedWorld); } \
 
     #define DECLARE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(attribute) \
         virtual EventListener* on##attribute(DOMWrapperWorld* isolatedWorld); \
         virtual void setOn##attribute(PassRefPtr<EventListener>, DOMWrapperWorld* isolatedWorld); \
 
     #define DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(type, attribute) \
-        EventListener* type::on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(eventNames().attribute##Event, isolatedWorld); } \
-        void type::setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { setAttributeEventListener(eventNames().attribute##Event, listener, isolatedWorld); } \
+        EventListener* type::on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(EventTypeNames::attribute, isolatedWorld); } \
+        void type::setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { setAttributeEventListener(EventTypeNames::attribute, listener, isolatedWorld); } \
 
     #define DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(attribute) \
-        EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return document().getWindowAttributeEventListener(eventNames().attribute##Event, isolatedWorld); } \
-        void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { document().setWindowAttributeEventListener(eventNames().attribute##Event, listener, isolatedWorld); } \
+        EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return document().getWindowAttributeEventListener(EventTypeNames::attribute, isolatedWorld); } \
+        void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { document().setWindowAttributeEventListener(EventTypeNames::attribute, listener, isolatedWorld); } \
 
     #define DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(attribute, eventName) \
-        EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(eventNames().eventName##Event, isolatedWorld); } \
-        void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { setAttributeEventListener(eventNames().eventName##Event, listener, isolatedWorld); } \
+        EventListener* on##attribute(DOMWrapperWorld* isolatedWorld) { return getAttributeEventListener(EventTypeNames::eventName, isolatedWorld); } \
+        void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { setAttributeEventListener(EventTypeNames::eventName, listener, isolatedWorld); } \
 
     #define DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(recipient, attribute) \
         EventListener* on##attribute(DOMWrapperWorld* isolatedWorld); \
         void setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld);
 
     #define DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(type, recipient, attribute) \
-        EventListener* type::on##attribute(DOMWrapperWorld* isolatedWorld) { return recipient ? recipient->getAttributeEventListener(eventNames().attribute##Event, isolatedWorld) : 0; } \
-        void type::setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { if (recipient) recipient->setAttributeEventListener(eventNames().attribute##Event, listener, isolatedWorld); }
+        EventListener* type::on##attribute(DOMWrapperWorld* isolatedWorld) { return recipient ? recipient->getAttributeEventListener(EventTypeNames::attribute, isolatedWorld) : 0; } \
+        void type::setOn##attribute(PassRefPtr<EventListener> listener, DOMWrapperWorld* isolatedWorld) { if (recipient) recipient->setAttributeEventListener(EventTypeNames::attribute, listener, isolatedWorld); }
 
     inline bool EventTarget::isFiringEventListeners()
     {
diff --git a/Source/core/events/EventTargetFactory.in b/Source/core/events/EventTargetFactory.in
index 9ead7d2..2e2c30d 100644
--- a/Source/core/events/EventTargetFactory.in
+++ b/Source/core/events/EventTargetFactory.in
@@ -11,8 +11,8 @@
 core/html/track/TextTrackList
 core/loader/appcache/ApplicationCache
 core/page/EventSource
-core/page/Performance
-core/page/Window ImplementedAs=DOMWindow
+core/timing/Performance
+core/frame/Window ImplementedAs=DOMWindow
 core/svg/SVGElementInstance
 core/workers/DedicatedWorkerGlobalScope
 core/workers/SharedWorker
diff --git a/Source/core/events/EventTypeNames.in b/Source/core/events/EventTypeNames.in
new file mode 100644
index 0000000..1ae04d3
--- /dev/null
+++ b/Source/core/events/EventTypeNames.in
@@ -0,0 +1,219 @@
+namespace="EventType"
+
+DOMActivate
+DOMCharacterDataModified
+DOMContentLoaded
+DOMFocusIn
+DOMFocusOut
+DOMNodeInserted
+DOMNodeInsertedIntoDocument
+DOMNodeRemoved
+DOMNodeRemovedFromDocument
+DOMSubtreeModified
+abort
+addsourcebuffer
+addstream
+addtrack
+animationend
+animationiteration
+animationstart
+audioend
+audioprocess
+audiostart
+autocomplete
+autocompleteerror
+beforecopy
+beforecut
+beforeload
+beforepaste
+beforeunload
+blocked
+blur
+boundary
+cached
+cancel
+canplay
+canplaythrough
+change
+chargingchange
+chargingtimechange
+checking
+click
+close
+complete
+compositionend
+compositionstart
+compositionupdate
+connect
+connecting
+contextmenu
+copy
+cuechange
+cut
+datachannel
+dblclick
+devicemotion
+deviceorientation
+dischargingtimechange
+disconnect
+display
+downloading
+drag
+dragend
+dragenter
+dragleave
+dragover
+dragstart
+drop
+durationchange
+emptied
+end
+ended
+enter
+error
+exit
+focus
+focusin
+focusout
+gesturescrollend
+gesturescrollstart
+gesturescrollupdate
+gestureshowpress
+gesturetap
+gesturetapdown
+gesturetapunconfirmed
+hashchange
+icecandidate
+iceconnectionstatechange
+input
+invalid
+keydown
+keypress
+keyup
+levelchange
+load
+loadeddata
+loadedmetadata
+loadend
+loading
+loadingdone
+loadingerror
+loadstart
+mark
+message
+midimessage
+mousedown
+mouseenter
+mouseleave
+mousemove
+mouseout
+mouseover
+mouseup
+mousewheel
+mute
+negotiationneeded
+nomatch
+noupdate
+obsolete
+offline
+online
+open
+orientationchange
+overflowchanged
+pagehide
+pageshow
+paste
+pause
+play
+playing
+popstate
+progress
+ratechange
+readystatechange
+removesourcebuffer
+removestream
+removetrack
+reset
+resize
+result
+resume
+scroll
+search
+securitypolicyviolation
+seeked
+seeking
+select
+selectionchange
+selectstart
+show
+signalingstatechange
+soundend
+soundstart
+sourceclose
+sourceended
+sourceopen
+speechend
+speechstart
+stalled
+start
+storage
+submit
+success
+suspend
+textInput
+timeout
+timeupdate
+tonechange
+touchcancel
+touchend
+touchmove
+touchstart
+transitionend
+unload
+unmute
+update
+updateend
+updateready
+updatestart
+upgradeneeded
+versionchange
+volumechange
+waiting
+webglcontextcreationerror
+webglcontextlost
+webglcontextrestored
+webkitAnimationEnd
+webkitAnimationIteration
+webkitAnimationStart
+webkitBeforeTextInserted
+webkitEditableContentChanged
+webkitTransitionEnd
+webkitaddsourcebuffer
+webkitdeviceproximity
+webkitfullscreenchange
+webkitfullscreenerror
+webkitkeyadded
+webkitkeyerror
+webkitkeymessage
+webkitneedkey
+webkitnetworkinfochange
+webkitpointerlockchange
+webkitpointerlockerror
+webkitprerenderdomcontentloaded
+webkitprerenderload
+webkitprerenderstart
+webkitprerenderstop
+webkitregionlayoutupdate
+webkitregionoversetchange
+webkitremovesourcebuffer
+webkitresourcetimingbufferfull
+webkitsourceclose
+webkitsourceended
+webkitsourceopen
+webkitspeechchange
+webkitvisibilitychange
+wheel
+write
+writeend
+writestart
+zoom
diff --git a/Source/core/events/FocusEvent.cpp b/Source/core/events/FocusEvent.cpp
index 9251f57..e201de0 100644
--- a/Source/core/events/FocusEvent.cpp
+++ b/Source/core/events/FocusEvent.cpp
@@ -28,8 +28,8 @@
 
 #include "core/events/Event.h"
 #include "core/events/EventDispatcher.h"
-#include "core/events/EventNames.h"
 #include "core/events/EventRetargeter.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -40,7 +40,7 @@
 
 const AtomicString& FocusEvent::interfaceName() const
 {
-    return eventNames().interfaceForFocusEvent;
+    return EventNames::FocusEvent;
 }
 
 bool FocusEvent::isFocusEvent() const
diff --git a/Source/core/events/GenericEventQueue.cpp b/Source/core/events/GenericEventQueue.cpp
index 28a2c25..7c47fb4 100644
--- a/Source/core/events/GenericEventQueue.cpp
+++ b/Source/core/events/GenericEventQueue.cpp
@@ -28,6 +28,7 @@
 #include "core/events/GenericEventQueue.h"
 
 #include "core/events/Event.h"
+#include "platform/TraceEvent.h"
 
 namespace WebCore {
 
@@ -55,6 +56,7 @@
     if (event->target() == m_owner)
         event->setTarget(0);
 
+    TRACE_EVENT_ASYNC_BEGIN1("event", "GenericEventQueue:enqueueEvent", event.get(), "type", event->type().string().ascii());
     m_pendingEvents.append(event);
 
     if (!m_timer.isActive())
@@ -67,8 +69,10 @@
 {
     bool found = m_pendingEvents.contains(event);
 
-    if (found)
+    if (found) {
         m_pendingEvents.remove(m_pendingEvents.find(event));
+        TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().string().ascii(), "status", "cancelled");
+    }
 
     if (m_pendingEvents.isEmpty())
         m_timer.stop();
@@ -86,8 +90,12 @@
 
     RefPtr<EventTarget> protect(m_owner);
     for (unsigned i = 0; i < pendingEvents.size(); ++i) {
-        EventTarget* target = pendingEvents[i]->target() ? pendingEvents[i]->target() : m_owner;
+        Event* event = pendingEvents[i].get();
+        EventTarget* target = event->target() ? event->target() : m_owner;
+        CString type(event->type().string().ascii());
+        TRACE_EVENT_ASYNC_STEP1("event", "GenericEventQueue:enqueueEvent", event, "dispatch", "type", type);
         target->dispatchEvent(pendingEvents[i].release());
+        TRACE_EVENT_ASYNC_END1("event", "GenericEventQueue:enqueueEvent", event, "type", type);
     }
 }
 
diff --git a/Source/core/events/GenericEventQueue.h b/Source/core/events/GenericEventQueue.h
index 89aaccf..ab80f89 100644
--- a/Source/core/events/GenericEventQueue.h
+++ b/Source/core/events/GenericEventQueue.h
@@ -28,7 +28,7 @@
 
 #include "core/events/EventQueue.h"
 #include "core/events/EventTarget.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/events/GestureEvent.cpp b/Source/core/events/GestureEvent.cpp
index 0bb01af..13d5f6f 100644
--- a/Source/core/events/GestureEvent.cpp
+++ b/Source/core/events/GestureEvent.cpp
@@ -38,20 +38,29 @@
 PassRefPtr<GestureEvent> GestureEvent::create(PassRefPtr<AbstractView> view, const PlatformGestureEvent& event)
 {
     AtomicString eventType;
+    float deltaX = 0;
+    float deltaY = 0;
     switch (event.type()) {
     case PlatformEvent::GestureScrollBegin:
-        eventType = eventNames().gesturescrollstartEvent; break;
+        eventType = EventTypeNames::gesturescrollstart; break;
     case PlatformEvent::GestureScrollEnd:
-        eventType = eventNames().gesturescrollendEvent; break;
+        eventType = EventTypeNames::gesturescrollend; break;
     case PlatformEvent::GestureScrollUpdate:
     case PlatformEvent::GestureScrollUpdateWithoutPropagation:
-        eventType = eventNames().gesturescrollupdateEvent; break;
+        // Only deltaX/Y are used when converting this
+        // back to a PlatformGestureEvent.
+        eventType = EventTypeNames::gesturescrollupdate;
+        deltaX = event.deltaX();
+        deltaY = event.deltaY();
+        break;
     case PlatformEvent::GestureTap:
-        eventType = eventNames().gesturetapEvent; break;
+        eventType = EventTypeNames::gesturetap; break;
     case PlatformEvent::GestureTapUnconfirmed:
-        eventType = eventNames().gesturetapunconfirmedEvent; break;
+        eventType = EventTypeNames::gesturetapunconfirmed; break;
     case PlatformEvent::GestureTapDown:
-        eventType = eventNames().gesturetapdownEvent; break;
+        eventType = EventTypeNames::gesturetapdown; break;
+    case PlatformEvent::GestureShowPress:
+        eventType = EventTypeNames::gestureshowpress; break;
     case PlatformEvent::GestureTwoFingerTap:
     case PlatformEvent::GestureLongPress:
     case PlatformEvent::GesturePinchBegin:
@@ -61,7 +70,7 @@
     default:
         return 0;
     }
-    return adoptRef(new GestureEvent(eventType, view, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.deltaX(), event.deltaY()));
+    return adoptRef(new GestureEvent(eventType, view, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), deltaX, deltaY));
 }
 
 void GestureEvent::initGestureEvent(const AtomicString& type, PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY)
@@ -90,6 +99,11 @@
     return UIEvent::interfaceName();
 }
 
+bool GestureEvent::isGestureEvent() const
+{
+    return true;
+}
+
 GestureEvent::GestureEvent()
     : m_deltaX(0)
     , m_deltaY(0)
@@ -110,7 +124,7 @@
 
 GestureEvent* GestureEventDispatchMediator::event() const
 {
-    return static_cast<GestureEvent*>(EventDispatchMediator::event());
+    return toGestureEvent(EventDispatchMediator::event());
 }
 
 bool GestureEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
diff --git a/Source/core/events/GestureEvent.h b/Source/core/events/GestureEvent.h
index 51a87df..03ca127 100644
--- a/Source/core/events/GestureEvent.h
+++ b/Source/core/events/GestureEvent.h
@@ -28,7 +28,7 @@
 
 #include "core/events/EventDispatcher.h"
 #include "core/events/MouseRelatedEvent.h"
-#include "core/platform/PlatformGestureEvent.h"
+#include "platform/PlatformGestureEvent.h"
 
 namespace WebCore {
 
@@ -41,6 +41,8 @@
 
     void initGestureEvent(const AtomicString& type, PassRefPtr<AbstractView>, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY);
 
+    virtual bool isGestureEvent() const OVERRIDE;
+
     virtual const AtomicString& interfaceName() const;
 
     float deltaX() const { return m_deltaX; }
@@ -69,6 +71,12 @@
     virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE;
 };
 
+inline GestureEvent* toGestureEvent(Event* event)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!event || event->isGestureEvent());
+    return static_cast<GestureEvent*>(event);
+}
+
 } // namespace WebCore
 
 #endif // GestureEvent_h
diff --git a/Source/core/events/HashChangeEvent.h b/Source/core/events/HashChangeEvent.h
index 4eb66bb..e652df8 100644
--- a/Source/core/events/HashChangeEvent.h
+++ b/Source/core/events/HashChangeEvent.h
@@ -22,7 +22,7 @@
 #define HashChangeEvent_h
 
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -66,7 +66,7 @@
     const String& oldURL() const { return m_oldURL; }
     const String& newURL() const { return m_newURL; }
 
-    virtual const AtomicString& interfaceName() const { return eventNames().interfaceForHashChangeEvent; }
+    virtual const AtomicString& interfaceName() const { return EventNames::HashChangeEvent; }
 
 private:
     HashChangeEvent()
@@ -75,7 +75,7 @@
     }
 
     HashChangeEvent(const String& oldURL, const String& newURL)
-        : Event(eventNames().hashchangeEvent, false, false)
+        : Event(EventTypeNames::hashchange, false, false)
         , m_oldURL(oldURL)
         , m_newURL(newURL)
     {
diff --git a/Source/core/events/HashChangeEvent.idl b/Source/core/events/HashChangeEvent.idl
index 470a208..13c83b4 100644
--- a/Source/core/events/HashChangeEvent.idl
+++ b/Source/core/events/HashChangeEvent.idl
@@ -17,7 +17,7 @@
  * Boston, MA 02110-1301, USA.
  */
 
-// Introduced in http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#event-hashchange
+// Introduced in http://www.whatwg.org/specs/web-apps/current-work/multiframe/History.html#event-hashchange
 [
     ConstructorTemplate=Event
 ] interface HashChangeEvent : Event {
diff --git a/Source/core/events/KeyboardEvent.cpp b/Source/core/events/KeyboardEvent.cpp
index bb302b9..2255e72 100644
--- a/Source/core/events/KeyboardEvent.cpp
+++ b/Source/core/events/KeyboardEvent.cpp
@@ -23,9 +23,9 @@
 #include "config.h"
 #include "core/events/KeyboardEvent.h"
 
-#include "core/events/EventNames.h"
-#include "core/platform/PlatformKeyboardEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/platform/WindowsKeyboardCodes.h"
+#include "platform/PlatformKeyboardEvent.h"
 
 namespace WebCore {
 
@@ -33,11 +33,11 @@
 {
     switch (type) {
         case PlatformEvent::KeyUp:
-            return eventNames().keyupEvent;
+            return EventTypeNames::keyup;
         case PlatformEvent::RawKeyDown:
-            return eventNames().keydownEvent;
+            return EventTypeNames::keydown;
         case PlatformEvent::Char:
-            return eventNames().keypressEvent;
+            return EventTypeNames::keypress;
         case PlatformEvent::KeyDown:
             // The caller should disambiguate the combined event into RawKeyDown or Char events.
             break;
@@ -45,7 +45,7 @@
             break;
     }
     ASSERT_NOT_REACHED();
-    return eventNames().keydownEvent;
+    return EventTypeNames::keydown;
 }
 
 static inline int windowsVirtualKeyCodeWithoutLocation(int keycode)
@@ -92,12 +92,14 @@
     , altKey(false)
     , shiftKey(false)
     , metaKey(false)
+    , repeat(false)
 {
 }
 
 KeyboardEvent::KeyboardEvent()
     : m_location(DOM_KEY_LOCATION_STANDARD)
     , m_altGraphKey(false)
+    , m_isAutoRepeat(false)
 {
     ScriptWrappable::init(this);
 }
@@ -109,6 +111,7 @@
     , m_keyIdentifier(key.keyIdentifier())
     , m_location(keyLocationCode(key))
     , m_altGraphKey(false)
+    , m_isAutoRepeat(key.isAutoRepeat())
 {
     ScriptWrappable::init(this);
 }
@@ -118,6 +121,7 @@
     , m_keyIdentifier(initializer.keyIdentifier)
     , m_location(initializer.location)
     , m_altGraphKey(false)
+    , m_isAutoRepeat(initializer.repeat)
 {
     ScriptWrappable::init(this);
 }
@@ -129,6 +133,7 @@
     , m_keyIdentifier(keyIdentifier)
     , m_location(location)
     , m_altGraphKey(altGraphKey)
+    , m_isAutoRepeat(false)
 {
     ScriptWrappable::init(this);
 }
@@ -177,7 +182,7 @@
     // We match IE.
     if (!m_keyEvent)
         return 0;
-    if (type() == eventNames().keydownEvent || type() == eventNames().keyupEvent)
+    if (type() == EventTypeNames::keydown || type() == EventTypeNames::keyup)
         return windowsVirtualKeyCodeWithoutLocation(m_keyEvent->windowsVirtualKeyCode());
 
     return charCode();
@@ -189,7 +194,7 @@
     // Firefox: 0 for keydown/keyup events, character code for keypress
     // We match Firefox
 
-    if (!m_keyEvent || (type() != eventNames().keypressEvent))
+    if (!m_keyEvent || (type() != EventTypeNames::keypress))
         return 0;
     String text = m_keyEvent->text();
     return static_cast<int>(text.characterStartingAt(0));
@@ -197,7 +202,7 @@
 
 const AtomicString& KeyboardEvent::interfaceName() const
 {
-    return eventNames().interfaceForKeyboardEvent;
+    return EventNames::KeyboardEvent;
 }
 
 bool KeyboardEvent::isKeyboardEvent() const
diff --git a/Source/core/events/KeyboardEvent.h b/Source/core/events/KeyboardEvent.h
index 7ee78e5..f11901e 100644
--- a/Source/core/events/KeyboardEvent.h
+++ b/Source/core/events/KeyboardEvent.h
@@ -42,6 +42,7 @@
     bool altKey;
     bool shiftKey;
     bool metaKey;
+    bool repeat;
 };
 
 class KeyboardEvent : public UIEventWithKeyState {
@@ -93,6 +94,7 @@
 
     int keyCode() const; // key code for keydown and keyup, character for keypress
     int charCode() const; // character code for keypress, 0 for keydown and keyup
+    bool repeat() const { return m_isAutoRepeat; }
 
     virtual const AtomicString& interfaceName() const;
     virtual bool isKeyboardEvent() const;
@@ -110,6 +112,7 @@
     String m_keyIdentifier;
     unsigned m_location;
     bool m_altGraphKey : 1;
+    bool m_isAutoRepeat : 1;
 };
 
 KeyboardEvent* findKeyboardEvent(Event*);
diff --git a/Source/core/events/KeyboardEvent.idl b/Source/core/events/KeyboardEvent.idl
index 62dd799..4d980ae 100644
--- a/Source/core/events/KeyboardEvent.idl
+++ b/Source/core/events/KeyboardEvent.idl
@@ -33,6 +33,7 @@
     [InitializedByEventConstructor] readonly attribute boolean          shiftKey;
     [InitializedByEventConstructor] readonly attribute boolean          altKey;
     [InitializedByEventConstructor] readonly attribute boolean          metaKey;
+    [InitializedByEventConstructor] readonly attribute boolean          repeat;
     readonly attribute boolean          altGraphKey;
 
     boolean getModifierState(DOMString keyArgument);
diff --git a/Source/core/events/MessageEvent.cpp b/Source/core/events/MessageEvent.cpp
index 0608a18..c95d31a 100644
--- a/Source/core/events/MessageEvent.cpp
+++ b/Source/core/events/MessageEvent.cpp
@@ -28,8 +28,8 @@
 #include "config.h"
 #include "core/events/MessageEvent.h"
 
-#include "core/events/EventNames.h"
-#include "core/page/DOMWindow.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/DOMWindow.h"
 
 namespace WebCore {
 
@@ -61,7 +61,7 @@
 }
 
 MessageEvent::MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray> ports)
-    : Event(eventNames().messageEvent, false, false)
+    : Event(EventTypeNames::message, false, false)
     , m_dataType(DataTypeScriptValue)
     , m_origin(origin)
     , m_lastEventId(lastEventId)
@@ -73,7 +73,7 @@
 }
 
 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray> ports)
-    : Event(eventNames().messageEvent, false, false)
+    : Event(EventTypeNames::message, false, false)
     , m_dataType(DataTypeSerializedScriptValue)
     , m_dataAsSerializedScriptValue(data)
     , m_origin(origin)
@@ -88,7 +88,7 @@
 }
 
 MessageEvent::MessageEvent(const String& data, const String& origin)
-    : Event(eventNames().messageEvent, false, false)
+    : Event(EventTypeNames::message, false, false)
     , m_dataType(DataTypeString)
     , m_dataAsString(data)
     , m_origin(origin)
@@ -97,7 +97,7 @@
 }
 
 MessageEvent::MessageEvent(PassRefPtr<Blob> data, const String& origin)
-    : Event(eventNames().messageEvent, false, false)
+    : Event(EventTypeNames::message, false, false)
     , m_dataType(DataTypeBlob)
     , m_dataAsBlob(data)
     , m_origin(origin)
@@ -106,7 +106,7 @@
 }
 
 MessageEvent::MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin)
-    : Event(eventNames().messageEvent, false, false)
+    : Event(EventTypeNames::message, false, false)
     , m_dataType(DataTypeArrayBuffer)
     , m_dataAsArrayBuffer(data)
     , m_origin(origin)
@@ -152,7 +152,7 @@
 
 const AtomicString& MessageEvent::interfaceName() const
 {
-    return eventNames().interfaceForMessageEvent;
+    return EventNames::MessageEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/events/MessageEvent.h b/Source/core/events/MessageEvent.h
index 3c07d5e..b64fe2f 100644
--- a/Source/core/events/MessageEvent.h
+++ b/Source/core/events/MessageEvent.h
@@ -33,7 +33,7 @@
 #include "core/events/EventTarget.h"
 #include "core/dom/MessagePort.h"
 #include "core/fileapi/Blob.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 #include "wtf/ArrayBuffer.h"
 
 namespace WebCore {
diff --git a/Source/core/events/MouseEvent.cpp b/Source/core/events/MouseEvent.cpp
index 502b664..ad0f99c 100644
--- a/Source/core/events/MouseEvent.cpp
+++ b/Source/core/events/MouseEvent.cpp
@@ -25,9 +25,9 @@
 
 #include "core/dom/Clipboard.h"
 #include "core/events/EventDispatcher.h"
-#include "core/events/EventNames.h"
 #include "core/events/EventRetargeter.h"
-#include "core/platform/PlatformMouseEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "platform/PlatformMouseEvent.h"
 
 namespace WebCore {
 
@@ -54,7 +54,7 @@
 {
     ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButton);
 
-    bool isMouseEnterOrLeave = eventType == eventNames().mouseenterEvent || eventType == eventNames().mouseleaveEvent;
+    bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventType == EventTypeNames::mouseleave;
     bool isCancelable = !isMouseEnterOrLeave;
     bool isBubbling = !isMouseEnterOrLeave;
 
@@ -160,7 +160,7 @@
 
 const AtomicString& MouseEvent::interfaceName() const
 {
-    return eventNames().interfaceForMouseEvent;
+    return EventNames::MouseEvent;
 }
 
 bool MouseEvent::isMouseEvent() const
@@ -171,8 +171,8 @@
 bool MouseEvent::isDragEvent() const
 {
     const AtomicString& t = type();
-    return t == eventNames().dragenterEvent || t == eventNames().dragoverEvent || t == eventNames().dragleaveEvent || t == eventNames().dropEvent
-               || t == eventNames().dragstartEvent|| t == eventNames().dragEvent || t == eventNames().dragendEvent;
+    return t == EventTypeNames::dragenter || t == EventTypeNames::dragover || t == EventTypeNames::dragleave || t == EventTypeNames::drop
+               || t == EventTypeNames::dragstart|| t == EventTypeNames::drag || t == EventTypeNames::dragend;
 }
 
 int MouseEvent::which() const
@@ -188,7 +188,7 @@
 Node* MouseEvent::toElement() const
 {
     // MSIE extension - "the object toward which the user is moving the mouse pointer"
-    if (type() == eventNames().mouseoutEvent || type() == eventNames().mouseleaveEvent)
+    if (type() == EventTypeNames::mouseout || type() == EventTypeNames::mouseleave)
         return relatedTarget() ? relatedTarget()->toNode() : 0;
 
     return target() ? target()->toNode() : 0;
@@ -197,7 +197,7 @@
 Node* MouseEvent::fromElement() const
 {
     // MSIE extension - "object from which activation or the mouse pointer is exiting during the event" (huh?)
-    if (type() != eventNames().mouseoutEvent && type() != eventNames().mouseleaveEvent)
+    if (type() != EventTypeNames::mouseout && type() != EventTypeNames::mouseleave)
         return relatedTarget() ? relatedTarget()->toNode() : 0;
 
     return target() ? target()->toNode() : 0;
@@ -268,14 +268,14 @@
     dispatcher->dispatch();
     bool swallowEvent = event()->defaultHandled() || event()->defaultPrevented();
 
-    if (event()->type() != eventNames().clickEvent || event()->detail() != 2)
+    if (event()->type() != EventTypeNames::click || event()->detail() != 2)
         return !swallowEvent;
 
     // Special case: If it's a double click event, we also send the dblclick event. This is not part
     // of the DOM specs, but is used for compatibility with the ondblclick="" attribute. This is treated
     // as a separate event in other DOM-compliant browsers like Firefox, and so we do the same.
     RefPtr<MouseEvent> doubleClickEvent = MouseEvent::create();
-    doubleClickEvent->initMouseEvent(eventNames().dblclickEvent, event()->bubbles(), event()->cancelable(), event()->view(),
+    doubleClickEvent->initMouseEvent(EventTypeNames::dblclick, event()->bubbles(), event()->cancelable(), event()->view(),
                                      event()->detail(), event()->screenX(), event()->screenY(), event()->clientX(), event()->clientY(),
                                      event()->ctrlKey(), event()->altKey(), event()->shiftKey(), event()->metaKey(),
                                      event()->button(), relatedTarget);
diff --git a/Source/core/events/MouseRelatedEvent.cpp b/Source/core/events/MouseRelatedEvent.cpp
index f255841..4953243 100644
--- a/Source/core/events/MouseRelatedEvent.cpp
+++ b/Source/core/events/MouseRelatedEvent.cpp
@@ -24,9 +24,9 @@
 #include "core/events/MouseRelatedEvent.h"
 
 #include "core/dom/Document.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderObject.h"
 
diff --git a/Source/core/events/MouseRelatedEvent.h b/Source/core/events/MouseRelatedEvent.h
index de546d6..fbaeb9c 100644
--- a/Source/core/events/MouseRelatedEvent.h
+++ b/Source/core/events/MouseRelatedEvent.h
@@ -25,7 +25,7 @@
 #define MouseRelatedEvent_h
 
 #include "core/events/UIEventWithKeyState.h"
-#include "core/platform/graphics/LayoutPoint.h"
+#include "platform/geometry/LayoutPoint.h"
 
 namespace WebCore {
 
diff --git a/Source/core/events/MutationEvent.cpp b/Source/core/events/MutationEvent.cpp
index 290ce2d..542b304 100644
--- a/Source/core/events/MutationEvent.cpp
+++ b/Source/core/events/MutationEvent.cpp
@@ -23,7 +23,7 @@
 #include "config.h"
 #include "core/events/MutationEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -68,7 +68,7 @@
 
 const AtomicString& MutationEvent::interfaceName() const
 {
-    return eventNames().interfaceForMutationEvent;
+    return EventNames::MutationEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/events/OverflowEvent.cpp b/Source/core/events/OverflowEvent.cpp
index eec8c48..c958ce6 100644
--- a/Source/core/events/OverflowEvent.cpp
+++ b/Source/core/events/OverflowEvent.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/events/OverflowEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -38,7 +38,7 @@
 }
 
 OverflowEvent::OverflowEvent()
-    : Event(eventNames().overflowchangedEvent, false, false)
+    : Event(EventTypeNames::overflowchanged, false, false)
     , m_orient(VERTICAL)
     , m_horizontalOverflow(false)
     , m_verticalOverflow(false)
@@ -47,7 +47,7 @@
 }
 
 OverflowEvent::OverflowEvent(bool horizontalOverflowChanged, bool horizontalOverflow, bool verticalOverflowChanged, bool verticalOverflow)
-    : Event(eventNames().overflowchangedEvent, false, false)
+    : Event(EventTypeNames::overflowchanged, false, false)
     , m_horizontalOverflow(horizontalOverflow)
     , m_verticalOverflow(verticalOverflow)
 {
@@ -73,7 +73,7 @@
 
 const AtomicString& OverflowEvent::interfaceName() const
 {
-    return eventNames().interfaceForOverflowEvent;
+    return EventNames::OverflowEvent;
 }
 
 void OverflowEvent::initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow)
diff --git a/Source/core/events/PageTransitionEvent.cpp b/Source/core/events/PageTransitionEvent.cpp
index 61b505a..a1878c4 100644
--- a/Source/core/events/PageTransitionEvent.cpp
+++ b/Source/core/events/PageTransitionEvent.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/events/PageTransitionEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -61,7 +61,7 @@
 
 const AtomicString& PageTransitionEvent::interfaceName() const
 {
-    return eventNames().interfaceForPageTransitionEvent;
+    return EventNames::PageTransitionEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/events/PopStateEvent.cpp b/Source/core/events/PopStateEvent.cpp
index 73e3363..2ab213a 100644
--- a/Source/core/events/PopStateEvent.cpp
+++ b/Source/core/events/PopStateEvent.cpp
@@ -28,13 +28,13 @@
 #include "core/events/PopStateEvent.h"
 
 #include "bindings/v8/SerializedScriptValue.h"
-#include "core/events/EventNames.h"
-#include "core/page/History.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/History.h"
 
 namespace WebCore {
 
 PopStateEvent::PopStateEvent()
-    : Event(eventNames().popstateEvent, false, true)
+    : Event(EventTypeNames::popstate, false, true)
     , m_serializedState(0)
     , m_history(0)
 {
@@ -49,7 +49,7 @@
 }
 
 PopStateEvent::PopStateEvent(PassRefPtr<SerializedScriptValue> serializedState, PassRefPtr<History> history)
-    : Event(eventNames().popstateEvent, false, true)
+    : Event(EventTypeNames::popstate, false, true)
     , m_serializedState(serializedState)
     , m_history(history)
 {
@@ -77,7 +77,7 @@
 
 const AtomicString& PopStateEvent::interfaceName() const
 {
-    return eventNames().interfaceForPopStateEvent;
+    return EventNames::PopStateEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/events/ProgressEvent.cpp b/Source/core/events/ProgressEvent.cpp
index 3a590b7..d50bdad 100644
--- a/Source/core/events/ProgressEvent.cpp
+++ b/Source/core/events/ProgressEvent.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/events/ProgressEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -65,7 +65,7 @@
 
 const AtomicString& ProgressEvent::interfaceName() const
 {
-    return eventNames().interfaceForProgressEvent;
+    return EventNames::ProgressEvent;
 }
 
 }
diff --git a/Source/core/events/ResourceProgressEvent.cpp b/Source/core/events/ResourceProgressEvent.cpp
index 50a9f43..59d10d4 100644
--- a/Source/core/events/ResourceProgressEvent.cpp
+++ b/Source/core/events/ResourceProgressEvent.cpp
@@ -48,7 +48,7 @@
 
 const AtomicString& ResourceProgressEvent::interfaceName() const
 {
-    return eventNames().interfaceForResourceProgressEvent;
+    return EventNames::ResourceProgressEvent;
 }
 
 }
diff --git a/Source/core/events/SecurityPolicyViolationEvent.h b/Source/core/events/SecurityPolicyViolationEvent.h
index bde8a28..cc88d03 100644
--- a/Source/core/events/SecurityPolicyViolationEvent.h
+++ b/Source/core/events/SecurityPolicyViolationEvent.h
@@ -26,7 +26,7 @@
 #define SecurityPolicyViolationEvent_h
 
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -70,7 +70,7 @@
     int columnNumber() const { return m_columnNumber; }
     int statusCode() const { return m_statusCode; }
 
-    virtual const AtomicString& interfaceName() const { return eventNames().interfaceForSecurityPolicyViolationEvent; }
+    virtual const AtomicString& interfaceName() const { return EventNames::SecurityPolicyViolationEvent; }
 
 private:
     SecurityPolicyViolationEvent()
diff --git a/Source/core/events/SecurityPolicyViolationEvent.idl b/Source/core/events/SecurityPolicyViolationEvent.idl
index d067fab..a5de4dc 100644
--- a/Source/core/events/SecurityPolicyViolationEvent.idl
+++ b/Source/core/events/SecurityPolicyViolationEvent.idl
@@ -23,7 +23,7 @@
  */
 
 [
-    EnabledAtRuntime=ExperimentalContentSecurityPolicyFeatures,
+    RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures,
     ConstructorTemplate=Event
 ] interface SecurityPolicyViolationEvent : Event {
     [InitializedByEventConstructor] readonly attribute DOMString documentURI;
diff --git a/Source/core/events/TextEvent.cpp b/Source/core/events/TextEvent.cpp
index a58ed60..6fd742b 100644
--- a/Source/core/events/TextEvent.cpp
+++ b/Source/core/events/TextEvent.cpp
@@ -28,7 +28,7 @@
 #include "core/events/TextEvent.h"
 
 #include "core/dom/DocumentFragment.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -66,7 +66,7 @@
 }
 
 TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType)
-    : UIEvent(eventNames().textInputEvent, true, true, view, 0)
+    : UIEvent(EventTypeNames::textInput, true, true, view, 0)
     , m_inputType(inputType)
     , m_data(data)
     , m_pastingFragment(0)
@@ -78,7 +78,7 @@
 
 TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, PassRefPtr<DocumentFragment> pastingFragment,
                      bool shouldSmartReplace, bool shouldMatchStyle)
-    : UIEvent(eventNames().textInputEvent, true, true, view, 0)
+    : UIEvent(EventTypeNames::textInput, true, true, view, 0)
     , m_inputType(TextEventInputPaste)
     , m_data(data)
     , m_pastingFragment(pastingFragment)
@@ -104,7 +104,7 @@
 
 const AtomicString& TextEvent::interfaceName() const
 {
-    return eventNames().interfaceForTextEvent;
+    return EventNames::TextEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/events/TextEvent.h b/Source/core/events/TextEvent.h
index 0037670..26cf89f 100644
--- a/Source/core/events/TextEvent.h
+++ b/Source/core/events/TextEvent.h
@@ -27,8 +27,8 @@
 #ifndef TextEvent_h
 #define TextEvent_h
 
-#include "core/events/EventNames.h"
 #include "core/events/TextEventInputType.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/events/UIEvent.h"
 
 namespace WebCore {
@@ -79,7 +79,7 @@
 
 inline TextEvent* toTextEvent(Event* event)
 {
-    ASSERT_WITH_SECURITY_IMPLICATION(!event || (event->type() == eventNames().textInputEvent && event->hasInterface(eventNames().interfaceForTextEvent)));
+    ASSERT_WITH_SECURITY_IMPLICATION(!event || (event->type() == EventTypeNames::textInput && event->hasInterface(EventNames::TextEvent)));
     return static_cast<TextEvent*>(event);
 }
 
diff --git a/Source/core/events/ThreadLocalEventNames.h b/Source/core/events/ThreadLocalEventNames.h
new file mode 100644
index 0000000..efde7b6
--- /dev/null
+++ b/Source/core/events/ThreadLocalEventNames.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Jon Shier (jshier@iastate.edu)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ThreadLocalEventNames_h
+#define ThreadLocalEventNames_h
+
+#include "EventInterfaces.h"
+#include "EventNames.h"
+#include "EventTargetInterfaces.h"
+#include "EventTargetNames.h"
+#include "EventTypeNames.h"
+#include "wtf/text/AtomicString.h"
+
+namespace WebCore {
+
+inline bool isTouchEventType(const AtomicString& eventType)
+{
+    return eventType == EventTypeNames::touchstart
+        || eventType == EventTypeNames::touchmove
+        || eventType == EventTypeNames::touchend
+        || eventType == EventTypeNames::touchcancel;
+}
+
+}
+
+#endif
diff --git a/Source/core/events/TouchEvent.cpp b/Source/core/events/TouchEvent.cpp
index 1408e0e..dab8b11 100644
--- a/Source/core/events/TouchEvent.cpp
+++ b/Source/core/events/TouchEvent.cpp
@@ -28,10 +28,10 @@
 
 #include "core/events/TouchEvent.h"
 
-#include "core/events/EventDispatcher.h"
-#include "core/events/EventNames.h"
-#include "core/events/EventRetargeter.h"
 #include "core/dom/TouchList.h"
+#include "core/events/EventDispatcher.h"
+#include "core/events/EventRetargeter.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -82,7 +82,7 @@
 
 const AtomicString& TouchEvent::interfaceName() const
 {
-    return eventNames().interfaceForTouchEvent;
+    return EventNames::TouchEvent;
 }
 
 bool TouchEvent::isTouchEvent() const
diff --git a/Source/core/events/TransitionEvent.cpp b/Source/core/events/TransitionEvent.cpp
index 3a00030..dfc32fd 100644
--- a/Source/core/events/TransitionEvent.cpp
+++ b/Source/core/events/TransitionEvent.cpp
@@ -27,7 +27,7 @@
 #include "config.h"
 #include "core/events/TransitionEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -81,7 +81,7 @@
 
 const AtomicString& TransitionEvent::interfaceName() const
 {
-    return eventNames().interfaceForTransitionEvent;
+    return EventNames::TransitionEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/events/UIEvent.cpp b/Source/core/events/UIEvent.cpp
index d0ef6f4..0ca537f 100644
--- a/Source/core/events/UIEvent.cpp
+++ b/Source/core/events/UIEvent.cpp
@@ -23,7 +23,7 @@
 #include "config.h"
 #include "core/events/UIEvent.h"
 
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 
 namespace WebCore {
 
@@ -77,7 +77,7 @@
 
 const AtomicString& UIEvent::interfaceName() const
 {
-    return eventNames().interfaceForUIEvent;
+    return EventNames::UIEvent;
 }
 
 int UIEvent::keyCode() const
diff --git a/Source/core/events/UIEvent.h b/Source/core/events/UIEvent.h
index 507185d..ebb7bd4 100644
--- a/Source/core/events/UIEvent.h
+++ b/Source/core/events/UIEvent.h
@@ -26,7 +26,7 @@
 
 #include "core/events/Event.h"
 #include "core/events/EventDispatchMediator.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 
 namespace WebCore {
 
diff --git a/Source/core/events/WebKitAnimationEvent.cpp b/Source/core/events/WebKitAnimationEvent.cpp
index b1ba493..cefe08f 100644
--- a/Source/core/events/WebKitAnimationEvent.cpp
+++ b/Source/core/events/WebKitAnimationEvent.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/events/WebKitAnimationEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -74,7 +74,7 @@
 
 const AtomicString& WebKitAnimationEvent::interfaceName() const
 {
-    return eventNames().interfaceForWebKitAnimationEvent;
+    return EventNames::WebKitAnimationEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/events/WheelEvent.cpp b/Source/core/events/WheelEvent.cpp
index c252aa3..0c23299 100644
--- a/Source/core/events/WheelEvent.cpp
+++ b/Source/core/events/WheelEvent.cpp
@@ -25,8 +25,8 @@
 #include "core/events/WheelEvent.h"
 
 #include "core/dom/Clipboard.h"
-#include "core/events/EventNames.h"
-#include "core/platform/PlatformWheelEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "platform/PlatformWheelEvent.h"
 
 namespace WebCore {
 
@@ -64,7 +64,7 @@
 WheelEvent::WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta, unsigned deltaMode,
     PassRefPtr<AbstractView> view, const IntPoint& screenLocation, const IntPoint& pageLocation,
     bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice)
-    : MouseEvent(eventNames().wheelEvent,
+    : MouseEvent(EventTypeNames::wheel,
                  true, true, view, 0, screenLocation.x(), screenLocation.y(),
                  pageLocation.x(), pageLocation.y(),
                  0, 0,
@@ -86,7 +86,7 @@
     if (dispatched())
         return;
 
-    initUIEvent(eventNames().wheelEvent, true, true, view, 0);
+    initUIEvent(EventTypeNames::wheel, true, true, view, 0);
 
     m_screenLocation = IntPoint(screenX, screenY);
     m_ctrlKey = ctrlKey;
@@ -113,7 +113,7 @@
 
 const AtomicString& WheelEvent::interfaceName() const
 {
-    return eventNames().interfaceForWheelEvent;
+    return EventNames::WheelEvent;
 }
 
 bool WheelEvent::isMouseEvent() const
@@ -121,6 +121,11 @@
     return false;
 }
 
+bool WheelEvent::isWheelEvent() const
+{
+    return true;
+}
+
 inline static unsigned deltaMode(const PlatformWheelEvent& event)
 {
     return event.granularity() == ScrollByPageWheelEvent ? WheelEvent::DOM_DELTA_PAGE : WheelEvent::DOM_DELTA_PIXEL;
@@ -143,7 +148,7 @@
 
 WheelEvent* WheelEventDispatchMediator::event() const
 {
-    return static_cast<WheelEvent*>(EventDispatchMediator::event());
+    return toWheelEvent(EventDispatchMediator::event());
 }
 
 bool WheelEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
diff --git a/Source/core/events/WheelEvent.h b/Source/core/events/WheelEvent.h
index c8c5dec..27c8967 100644
--- a/Source/core/events/WheelEvent.h
+++ b/Source/core/events/WheelEvent.h
@@ -27,7 +27,7 @@
 
 #include "core/events/EventDispatchMediator.h"
 #include "core/events/MouseEvent.h"
-#include "core/platform/graphics/FloatPoint.h"
+#include "platform/geometry/FloatPoint.h"
 
 namespace WebCore {
 
@@ -94,7 +94,8 @@
     bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedFromDevice; }
 
     virtual const AtomicString& interfaceName() const;
-    virtual bool isMouseEvent() const;
+    virtual bool isMouseEvent() const OVERRIDE;
+    virtual bool isWheelEvent() const OVERRIDE;
 
 private:
     WheelEvent();
@@ -111,6 +112,12 @@
     bool m_directionInvertedFromDevice;
 };
 
+inline WheelEvent* toWheelEvent(Event* event)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!event || event->isWheelEvent());
+    return static_cast<WheelEvent*>(event);
+}
+
 class WheelEventDispatchMediator : public EventDispatchMediator {
 public:
     static PassRefPtr<WheelEventDispatchMediator> create(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
diff --git a/Source/core/events/WindowEventContext.cpp b/Source/core/events/WindowEventContext.cpp
index 7ab4a57..673ef36 100644
--- a/Source/core/events/WindowEventContext.cpp
+++ b/Source/core/events/WindowEventContext.cpp
@@ -31,7 +31,7 @@
 #include "core/events/Event.h"
 #include "core/events/EventContext.h"
 #include "core/dom/Node.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 
 namespace WebCore {
 
@@ -39,7 +39,7 @@
 {
     // We don't dispatch load events to the window. This quirk was originally
     // added because Mozilla doesn't propagate load events to the window object.
-    if (event->type() == eventNames().loadEvent)
+    if (event->type() == EventTypeNames::load)
         return;
 
     Node* topLevelContainer = topEventContext ? topEventContext->node() : node.get();
diff --git a/Source/core/features.gypi b/Source/core/features.gypi
deleted file mode 100644
index 979137d..0000000
--- a/Source/core/features.gypi
+++ /dev/null
@@ -1,106 +0,0 @@
-#
-# 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
-# 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.
-#
-
-{
-  # The following defines turn WebKit features on and off.
-  'variables': {
-    'feature_defines': [
-      'ENABLE_CSS3_TEXT=0',
-      'ENABLE_CSS_EXCLUSIONS=1',
-      'ENABLE_CSS_REGIONS=1',
-      'ENABLE_CUSTOM_SCHEME_HANDLER=0',
-      'ENABLE_ENCRYPTED_MEDIA_V2=1',
-      'ENABLE_SVG_FONTS=1',
-      'ENABLE_TOUCH_ICON_LOADING=<(enable_touch_icon_loading)',
-      'ENABLE_GDI_FONTS_ON_WINDOWS=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.
-    ],
-    # We have to nest variables inside variables so that they can be overridden
-    # through GYP_DEFINES.
-    'variables': {
-      'enable_touch_icon_loading%' : 0,
-    },
-    'conditions': [
-      ['use_concatenated_impulse_responses==1', {
-        # Use concatenated HRTF impulse responses
-        'feature_defines': ['WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1'],
-      }],
-      ['OS=="android"', {
-        'feature_defines': [
-          'ENABLE_CALENDAR_PICKER=0',
-          'ENABLE_FAST_MOBILE_SCROLLING=1',
-          'ENABLE_INPUT_SPEECH=0',
-          'ENABLE_LEGACY_NOTIFICATIONS=0',
-          'ENABLE_MEDIA_CAPTURE=1',
-          'ENABLE_ORIENTATION_EVENTS=1',
-          'ENABLE_NAVIGATOR_CONTENT_UTILS=0',
-        ],
-        'enable_touch_icon_loading': 1,
-      }, { # OS!="android"
-        'feature_defines': [
-          'ENABLE_CALENDAR_PICKER=1',
-          'ENABLE_INPUT_SPEECH=1',
-          'ENABLE_INPUT_MULTIPLE_FIELDS_UI=1',
-          'ENABLE_LEGACY_NOTIFICATIONS=1',
-          'ENABLE_MEDIA_CAPTURE=0',
-          'ENABLE_NAVIGATOR_CONTENT_UTILS=1',
-          'ENABLE_ORIENTATION_EVENTS=0',
-          'ENABLE_WEB_AUDIO=1',
-        ],
-      }],
-      # Mac OS X uses Accelerate.framework FFT by default instead of FFmpeg.
-      ['OS!="mac" and OS!="android"', {
-        'feature_defines': [
-          'WTF_USE_WEBAUDIO_FFMPEG=1',
-        ],
-      }],
-      ['OS=="android" and use_openmax_dl_fft!=0', {
-        'feature_defines': [
-          'WTF_USE_WEBAUDIO_OPENMAX_DL_FFT=1',
-          # Enabling the FFT is enough to enable WebAudio support to
-          # allow most WebAudio features to work on Android.
-          'ENABLE_WEB_AUDIO=1',
-        ],
-      }],
-      ['OS=="win" or OS=="android" or OS=="linux"', {
-        'feature_defines': [
-          'ENABLE_OPENTYPE_VERTICAL=1',
-        ],
-      }],
-      ['use_default_render_theme==1', {
-        'feature_defines': [
-          'ENABLE_DEFAULT_RENDER_THEME=1',
-        ],
-      }],
-    ],
-  },
-}
diff --git a/Source/core/fetch/CSSStyleSheetResource.cpp b/Source/core/fetch/CSSStyleSheetResource.cpp
index 78a3455..902e189 100644
--- a/Source/core/fetch/CSSStyleSheetResource.cpp
+++ b/Source/core/fetch/CSSStyleSheetResource.cpp
@@ -31,8 +31,8 @@
 #include "core/fetch/ResourceClientWalker.h"
 #include "core/fetch/StyleSheetResourceClient.h"
 #include "core/fetch/TextResourceDecoder.h"
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/network/HTTPParsers.h"
+#include "platform/SharedBuffer.h"
+#include "platform/network/HTTPParsers.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/fetch/CrossOriginAccessControl.cpp b/Source/core/fetch/CrossOriginAccessControl.cpp
index 2647a8e..937d8ad 100644
--- a/Source/core/fetch/CrossOriginAccessControl.cpp
+++ b/Source/core/fetch/CrossOriginAccessControl.cpp
@@ -27,9 +27,9 @@
 #include "config.h"
 #include "core/fetch/CrossOriginAccessControl.h"
 
-#include "core/platform/network/HTTPParsers.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
+#include "platform/network/HTTPParsers.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/Threading.h"
 #include "wtf/text/AtomicString.h"
diff --git a/Source/core/fetch/DocumentResource.cpp b/Source/core/fetch/DocumentResource.cpp
index 5c18d84..ef9741c 100644
--- a/Source/core/fetch/DocumentResource.cpp
+++ b/Source/core/fetch/DocumentResource.cpp
@@ -26,7 +26,7 @@
 
 #include "core/fetch/ResourceClient.h"
 #include "core/fetch/ResourcePtr.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/svg/SVGDocument.h"
 #include "wtf/text/StringBuilder.h"
 
diff --git a/Source/core/fetch/FetchContext.h b/Source/core/fetch/FetchContext.h
index 1eb5596..2a1ad5d 100644
--- a/Source/core/fetch/FetchContext.h
+++ b/Source/core/fetch/FetchContext.h
@@ -39,6 +39,7 @@
 
 namespace WebCore {
 
+class Document;
 class DocumentLoader;
 class Frame;
 class KURL;
diff --git a/Source/core/fetch/FetchInitiatorTypeNames.in b/Source/core/fetch/FetchInitiatorTypeNames.in
index 5f429b0..f0cf1b8 100644
--- a/Source/core/fetch/FetchInitiatorTypeNames.in
+++ b/Source/core/fetch/FetchInitiatorTypeNames.in
@@ -1,7 +1,9 @@
+namespace="FetchInitiatorType"
+
 css
 document
 icon
-inspector
+internal
 link
 processinginstruction
 texttrack
diff --git a/Source/core/fetch/FontResource.cpp b/Source/core/fetch/FontResource.cpp
index d4db35a..39bf1e4 100644
--- a/Source/core/fetch/FontResource.cpp
+++ b/Source/core/fetch/FontResource.cpp
@@ -31,7 +31,7 @@
 #include "core/fetch/ResourceClientWalker.h"
 #include "core/fetch/TextResourceDecoder.h"
 #include "core/platform/HistogramSupport.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/FontCustomPlatformData.h"
 #include "core/platform/graphics/FontPlatformData.h"
 #include "wtf/CurrentTime.h"
@@ -100,7 +100,7 @@
         return FontPlatformData(size, bold, italic);
 #endif
     ASSERT(m_fontData);
-    return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, orientation, widthVariant);
+    return m_fontData->fontPlatformData(size, bold, italic, orientation, widthVariant);
 }
 
 #if ENABLE(SVG_FONTS)
diff --git a/Source/core/fetch/ImageResource.cpp b/Source/core/fetch/ImageResource.cpp
index 0912aec7..9001189 100644
--- a/Source/core/fetch/ImageResource.cpp
+++ b/Source/core/fetch/ImageResource.cpp
@@ -29,11 +29,11 @@
 #include "core/fetch/ResourceClient.h"
 #include "core/fetch/ResourceClientWalker.h"
 #include "core/fetch/ResourceFetcher.h"
-#include "core/page/FrameView.h"
-#include "core/platform/SharedBuffer.h"
+#include "core/frame/FrameView.h"
 #include "core/platform/graphics/BitmapImage.h"
 #include "core/rendering/RenderObject.h"
 #include "core/svg/graphics/SVGImage.h"
+#include "platform/SharedBuffer.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/Vector.h"
@@ -323,6 +323,8 @@
 
 void ImageResource::updateImage(bool allDataReceived)
 {
+    TRACE_EVENT0("webkit", "ImageResource::updateImage");
+
     if (m_data)
         createImage();
 
diff --git a/Source/core/fetch/ImageResource.h b/Source/core/fetch/ImageResource.h
index 15fc953..90b3a19 100644
--- a/Source/core/fetch/ImageResource.h
+++ b/Source/core/fetch/ImageResource.h
@@ -25,10 +25,10 @@
 
 #include "core/fetch/Resource.h"
 #include "core/platform/graphics/ImageObserver.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/IntSizeHash.h"
-#include "core/platform/graphics/LayoutSize.h"
 #include "core/svg/graphics/SVGImageCache.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/geometry/LayoutSize.h"
 #include "wtf/HashMap.h"
 
 namespace WebCore {
diff --git a/Source/core/fetch/ImageResourceTest.cpp b/Source/core/fetch/ImageResourceTest.cpp
index f1a269a..e734feb 100644
--- a/Source/core/fetch/ImageResourceTest.cpp
+++ b/Source/core/fetch/ImageResourceTest.cpp
@@ -38,10 +38,10 @@
 #include "core/fetch/ResourcePtr.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/EmptyClients.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebThread.h"
 #include "public/platform/WebURL.h"
diff --git a/Source/core/fetch/MemoryCache.cpp b/Source/core/fetch/MemoryCache.cpp
index af4809e..51f868c 100644
--- a/Source/core/fetch/MemoryCache.cpp
+++ b/Source/core/fetch/MemoryCache.cpp
@@ -27,12 +27,12 @@
 #include "core/dom/Document.h"
 #include "core/fetch/Resource.h"
 #include "core/fetch/ResourcePtr.h"
-#include "core/page/FrameView.h"
-#include "core/platform/Logging.h"
-#include "core/platform/chromium/TraceEvent.h"
+#include "core/frame/FrameView.h"
 #include "core/workers/WorkerGlobalScope.h"
 #include "core/workers/WorkerLoaderProxy.h"
 #include "core/workers/WorkerThread.h"
+#include "platform/Logging.h"
+#include "platform/TraceEvent.h"
 #include "public/platform/Platform.h"
 #include "weborigin/SecurityOrigin.h"
 #include "weborigin/SecurityOriginHash.h"
@@ -498,7 +498,7 @@
     }
 }
 
-void MemoryCache::removeURLFromCache(ScriptExecutionContext* context, const KURL& url)
+void MemoryCache::removeURLFromCache(ExecutionContext* context, const KURL& url)
 {
     if (context->isWorkerGlobalScope()) {
         WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
@@ -508,7 +508,7 @@
     removeURLFromCacheInternal(context, url);
 }
 
-void MemoryCache::removeURLFromCacheInternal(ScriptExecutionContext*, const KURL& url)
+void MemoryCache::removeURLFromCacheInternal(ExecutionContext*, const KURL& url)
 {
     if (Resource* resource = memoryCache()->resourceForURL(url))
         memoryCache()->remove(resource);
diff --git a/Source/core/fetch/MemoryCache.h b/Source/core/fetch/MemoryCache.h
index f038244..ba1d2ca 100644
--- a/Source/core/fetch/MemoryCache.h
+++ b/Source/core/fetch/MemoryCache.h
@@ -39,7 +39,7 @@
 class Resource;
 class ResourceFetcher;
 class KURL;
-class ScriptExecutionContext;
+class ExecutionContext;
 class SecurityOrigin;
 struct SecurityOriginHash;
 
@@ -142,7 +142,7 @@
     void addToLiveResourcesSize(Resource*);
     void removeFromLiveResourcesSize(Resource*);
 
-    static void removeURLFromCache(ScriptExecutionContext*, const KURL&);
+    static void removeURLFromCache(ExecutionContext*, const KURL&);
 
     Statistics getStatistics();
 
@@ -175,7 +175,7 @@
 
     void evict(Resource*);
 
-    static void removeURLFromCacheInternal(ScriptExecutionContext*, const KURL&);
+    static void removeURLFromCacheInternal(ExecutionContext*, const KURL&);
 
     bool m_inPruneResources;
     bool m_prunePending;
diff --git a/Source/core/fetch/RawResource.cpp b/Source/core/fetch/RawResource.cpp
index 5745d93..2cfda84 100644
--- a/Source/core/fetch/RawResource.cpp
+++ b/Source/core/fetch/RawResource.cpp
@@ -30,7 +30,7 @@
 #include "core/fetch/ResourceClientWalker.h"
 #include "core/fetch/ResourceFetcher.h"
 #include "core/fetch/ResourceLoader.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 
 namespace WebCore {
 
diff --git a/Source/core/fetch/Resource.cpp b/Source/core/fetch/Resource.cpp
index 0736d26..ae8542d 100644
--- a/Source/core/fetch/Resource.cpp
+++ b/Source/core/fetch/Resource.cpp
@@ -33,9 +33,9 @@
 #include "core/fetch/ResourceLoader.h"
 #include "core/fetch/ResourcePtr.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/platform/Logging.h"
-#include "core/platform/PurgeableBuffer.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/Logging.h"
+#include "platform/PurgeableBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "public/platform/Platform.h"
 #include "weborigin/KURL.h"
 #include "wtf/CurrentTime.h"
@@ -182,6 +182,11 @@
         m_fragmentIdentifierForRequest = String();
     }
     m_status = Pending;
+    if (m_loader) {
+        RELEASE_ASSERT(m_options.synchronousPolicy == RequestSynchronously);
+        m_loader->changeToSynchronous();
+        return;
+    }
     m_loader = ResourceLoader::create(fetcher, this, request, options);
     m_loader->start();
 }
@@ -198,6 +203,7 @@
 
 void Resource::appendData(const char* data, int length)
 {
+    TRACE_EVENT0("webkit", "Resource::appendData");
     ASSERT(!m_resourceToRevalidate);
     ASSERT(!errorOccurred());
     if (m_options.dataBufferingPolicy == DoNotBufferData)
diff --git a/Source/core/fetch/Resource.h b/Source/core/fetch/Resource.h
index ba300c9..d67496a 100644
--- a/Source/core/fetch/Resource.h
+++ b/Source/core/fetch/Resource.h
@@ -25,11 +25,11 @@
 
 #include "core/fetch/CachePolicy.h"
 #include "core/fetch/ResourceLoaderOptions.h"
-#include "core/platform/Timer.h"
-#include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceLoadPriority.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
+#include "platform/Timer.h"
+#include "platform/network/ResourceError.h"
 #include "wtf/HashCountedSet.h"
 #include "wtf/HashSet.h"
 #include "wtf/OwnPtr.h"
diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp
index 337a677..ac65d46 100644
--- a/Source/core/fetch/ResourceFetcher.cpp
+++ b/Source/core/fetch/ResourceFetcher.cpp
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "core/fetch/ResourceFetcher.h"
 
+#include "RuntimeEnabledFeatures.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/Document.h"
 #include "core/fetch/CSSStyleSheetResource.h"
@@ -53,14 +54,14 @@
 #include "core/loader/PingLoader.h"
 #include "core/loader/UniqueIdentifier.h"
 #include "core/loader/appcache/ApplicationCacheHost.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-#include "core/page/Performance.h"
-#include "core/page/ResourceTimingInfo.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
+#include "core/timing/Performance.h"
+#include "core/timing/ResourceTimingInfo.h"
 #include "core/page/Settings.h"
-#include "core/platform/Logging.h"
-#include "core/platform/chromium/TraceEvent.h"
+#include "platform/Logging.h"
+#include "platform/TraceEvent.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebURL.h"
 #include "weborigin/SecurityOrigin.h"
@@ -125,6 +126,7 @@
     case Resource::Image:
         return request.forPreload() ? ResourceLoadPriorityVeryLow : ResourceLoadPriorityLow;
     case Resource::XSLStyleSheet:
+        ASSERT(RuntimeEnabledFeatures::xsltEnabled());
         return ResourceLoadPriorityHigh;
     case Resource::SVGDocument:
         return ResourceLoadPriorityLow;
@@ -298,6 +300,7 @@
 
 ResourcePtr<XSLStyleSheetResource> ResourceFetcher::fetchXSLStyleSheet(FetchRequest& request)
 {
+    ASSERT(RuntimeEnabledFeatures::xsltEnabled());
     return static_cast<XSLStyleSheetResource*>(requestResource(Resource::XSLStyleSheet, request).get());
 }
 
@@ -327,8 +330,9 @@
 {
     if (treatment == TreatAsDefaultForType) {
         switch (type) {
-        case Resource::Script:
         case Resource::XSLStyleSheet:
+            ASSERT(RuntimeEnabledFeatures::xsltEnabled());
+        case Resource::Script:
         case Resource::SVGDocument:
         case Resource::CSSStyleSheet:
         case Resource::ImportResource:
@@ -405,8 +409,9 @@
             return false;
         }
         break;
-    case Resource::SVGDocument:
     case Resource::XSLStyleSheet:
+        ASSERT(RuntimeEnabledFeatures::xsltEnabled());
+    case Resource::SVGDocument:
         if (!m_document->securityOrigin()->canRequest(url)) {
             printAccessDeniedMessage(url);
             return false;
@@ -416,6 +421,7 @@
 
     switch (type) {
     case Resource::XSLStyleSheet:
+        ASSERT(RuntimeEnabledFeatures::xsltEnabled());
         if (!shouldBypassMainWorldContentSecurityPolicy && !m_document->contentSecurityPolicy()->allowScriptFromSource(url))
             return false;
         break;
@@ -508,6 +514,17 @@
     return m_documentLoader == frame()->loader()->activeDocumentLoader();
 }
 
+bool ResourceFetcher::resourceNeedsLoad(Resource* resource, const FetchRequest& request, RevalidationPolicy policy)
+{
+    if (FetchRequest::DeferredByClient == request.defer())
+        return false;
+    if (policy != Use)
+        return true;
+    if (resource->stillNeedsLoad())
+        return true;
+    return request.options().synchronousPolicy == RequestSynchronously && resource->isLoading();
+}
+
 ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, FetchRequest& request)
 {
     ASSERT(request.options().synchronousPolicy == RequestAsynchronously || type == Resource::Raw);
@@ -562,7 +579,7 @@
         }
     }
 
-    if ((policy != Use || resource->stillNeedsLoad()) && FetchRequest::NoDefer == request.defer()) {
+    if (resourceNeedsLoad(resource.get(), request, policy)) {
         if (!shouldLoadNewResource()) {
             if (resource->inCache())
                 memoryCache()->remove(resource.get());
@@ -619,8 +636,9 @@
         else
             targetType = ResourceRequest::TargetIsMainFrame;
         break;
-    case Resource::CSSStyleSheet:
     case Resource::XSLStyleSheet:
+        ASSERT(RuntimeEnabledFeatures::xsltEnabled());
+    case Resource::CSSStyleSheet:
         targetType = ResourceRequest::TargetIsStyleSheet;
         break;
     case Resource::Script:
@@ -1035,6 +1053,7 @@
     bool delaySubresourceLoad = true;
     delaySubresourceLoad = false;
     if (delaySubresourceLoad) {
+        // FIXME: It seems wrong to poke body()->renderer() here.
         bool hasRendering = m_document->body() && m_document->body()->renderer();
         bool canBlockParser = type == Resource::Script || type == Resource::CSSStyleSheet;
         if (!hasRendering && !canBlockParser) {
@@ -1050,6 +1069,7 @@
 
 void ResourceFetcher::checkForPendingPreloads()
 {
+    // FIXME: It seems wrong to poke body()->renderer() here.
     if (m_pendingPreloads.isEmpty() || !m_document->body() || !m_document->body()->renderer())
         return;
     while (!m_pendingPreloads.isEmpty()) {
diff --git a/Source/core/fetch/ResourceFetcher.h b/Source/core/fetch/ResourceFetcher.h
index 3508cf2..431bacd 100644
--- a/Source/core/fetch/ResourceFetcher.h
+++ b/Source/core/fetch/ResourceFetcher.h
@@ -33,7 +33,7 @@
 #include "core/fetch/ResourceLoaderHost.h"
 #include "core/fetch/ResourceLoaderOptions.h"
 #include "core/fetch/ResourcePtr.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/Deque.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
@@ -181,6 +181,8 @@
     bool canRequest(Resource::Type, const KURL&, const ResourceLoaderOptions&, bool forPreload = false);
     bool checkInsecureContent(Resource::Type, const KURL&, MixedContentBlockingTreatment) const;
 
+    static bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPolicy);
+
     void notifyLoadedFromMemoryCache(Resource*);
 
     void garbageCollectDocumentResourcesTimerFired(Timer<ResourceFetcher>*);
diff --git a/Source/core/fetch/ResourceLoader.cpp b/Source/core/fetch/ResourceLoader.cpp
index 7ab572c..93e7f1d 100644
--- a/Source/core/fetch/ResourceLoader.cpp
+++ b/Source/core/fetch/ResourceLoader.cpp
@@ -33,11 +33,11 @@
 #include "core/fetch/Resource.h"
 #include "core/fetch/ResourceLoaderHost.h"
 #include "core/fetch/ResourcePtr.h"
-#include "core/platform/Logging.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/Logging.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/chromium/support/WrappedResourceRequest.h"
 #include "core/platform/chromium/support/WrappedResourceResponse.h"
-#include "core/platform/network/ResourceError.h"
+#include "platform/network/ResourceError.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebData.h"
 #include "public/platform/WebURLError.h"
@@ -154,6 +154,16 @@
     m_loader->loadAsynchronously(wrappedRequest, this);
 }
 
+void ResourceLoader::changeToSynchronous()
+{
+    ASSERT(m_options.synchronousPolicy == RequestAsynchronously);
+    ASSERT(m_loader);
+    m_loader->cancel();
+    m_loader.clear();
+    m_connectionState = ConnectionStateNew;
+    requestSynchronously();
+}
+
 void ResourceLoader::setDefersLoading(bool defers)
 {
     m_defersLoading = defers;
diff --git a/Source/core/fetch/ResourceLoader.h b/Source/core/fetch/ResourceLoader.h
index f53b9f5..f75be21 100644
--- a/Source/core/fetch/ResourceLoader.h
+++ b/Source/core/fetch/ResourceLoader.h
@@ -50,6 +50,7 @@
     virtual ~ResourceLoader();
 
     void start();
+    void changeToSynchronous();
 
     void cancel();
     void cancel(const ResourceError&);
diff --git a/Source/core/fetch/ResourceLoaderHost.h b/Source/core/fetch/ResourceLoaderHost.h
index 888ccc5..7665f8f 100644
--- a/Source/core/fetch/ResourceLoaderHost.h
+++ b/Source/core/fetch/ResourceLoaderHost.h
@@ -31,8 +31,8 @@
 #ifndef ResourceLoaderHost_h
 #define ResourceLoaderHost_h
 
-#include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceLoadPriority.h"
+#include "platform/network/ResourceError.h"
 
 namespace WebCore {
 
diff --git a/Source/core/fetch/ScriptResource.cpp b/Source/core/fetch/ScriptResource.cpp
index 7bbfdeb..52bfa54 100644
--- a/Source/core/fetch/ScriptResource.cpp
+++ b/Source/core/fetch/ScriptResource.cpp
@@ -29,8 +29,8 @@
 
 #include "core/fetch/TextResourceDecoder.h"
 #include "core/platform/MIMETypeRegistry.h"
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/network/HTTPParsers.h"
+#include "platform/SharedBuffer.h"
+#include "platform/network/HTTPParsers.h"
 
 namespace WebCore {
 
diff --git a/Source/core/fetch/ShaderResource.cpp b/Source/core/fetch/ShaderResource.cpp
index cbd25df..da0fa7e 100644
--- a/Source/core/fetch/ShaderResource.cpp
+++ b/Source/core/fetch/ShaderResource.cpp
@@ -31,7 +31,7 @@
 #include "core/fetch/ShaderResource.h"
 
 #include "core/fetch/TextResourceDecoder.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
diff --git a/Source/core/fetch/TextResourceDecoder.cpp b/Source/core/fetch/TextResourceDecoder.cpp
index b6759bf..3dd24e2 100644
--- a/Source/core/fetch/TextResourceDecoder.cpp
+++ b/Source/core/fetch/TextResourceDecoder.cpp
@@ -26,7 +26,7 @@
 #include "HTMLNames.h"
 #include "core/dom/DOMImplementation.h"
 #include "core/html/parser/HTMLMetaCharsetParser.h"
-#include "core/platform/text/TextEncodingDetector.h"
+#include "platform/text/TextEncodingDetector.h"
 #include "wtf/StringExtras.h"
 #include "wtf/text/TextCodec.h"
 #include "wtf/text/TextEncoding.h"
@@ -99,215 +99,6 @@
     return buffer.data();
 }
 
-class KanjiCode {
-public:
-    enum Type { ASCII, JIS, EUC, SJIS, UTF16, UTF8 };
-    static enum Type judge(const char* str, int length);
-    static const int ESC = 0x1b;
-    static const unsigned char sjisMap[256];
-    static int ISkanji(int code)
-    {
-        if (code >= 0x100)
-            return 0;
-        return sjisMap[code & 0xff] & 1;
-    }
-    static int ISkana(int code)
-    {
-        if (code >= 0x100)
-            return 0;
-        return sjisMap[code & 0xff] & 2;
-    }
-};
-
-const unsigned char KanjiCode::sjisMap[256] = {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0
-};
-
-/*
- * EUC-JP is
- *     [0xa1 - 0xfe][0xa1 - 0xfe]
- *     0x8e[0xa1 - 0xfe](SS2)
- *     0x8f[0xa1 - 0xfe][0xa1 - 0xfe](SS3)
- *
- * Shift_Jis is
- *     [0x81 - 0x9f, 0xe0 - 0xef(0xfe?)][0x40 - 0x7e, 0x80 - 0xfc]
- *
- * Shift_Jis Hankaku Kana is
- *     [0xa1 - 0xdf]
- */
-
-/*
- * KanjiCode::judge() is based on judge_jcode() from jvim
- *     http://hp.vector.co.jp/authors/VA003457/vim/
- *
- * Special Thanks to Kenichi Tsuchida
- */
-
-enum KanjiCode::Type KanjiCode::judge(const char* str, int size)
-{
-    enum Type code;
-    int i;
-    int bfr = false;            /* Kana Moji */
-    int bfk = 0;                /* EUC Kana */
-    int sjis = 0;
-    int euc = 0;
-
-    const unsigned char* ptr = reinterpret_cast<const unsigned char*>(str);
-
-    code = ASCII;
-
-    i = 0;
-    while (i < size) {
-        if (ptr[i] == ESC && (size - i >= 3)) {
-            if (bytesEqual(str + i + 1, '$', 'B')
-                || bytesEqual(str + i + 1, '(', 'B')
-                || bytesEqual(str + i + 1, '$', '@')
-                || bytesEqual(str + i + 1, '(', 'J')) {
-                code = JIS;
-                goto breakBreak;
-            }
-            if (bytesEqual(str + i + 1, '(', 'I') || bytesEqual(str + i + 1, ')', 'I')) {
-                code = JIS;
-                i += 3;
-            } else {
-                i++;
-            }
-            bfr = false;
-            bfk = 0;
-        } else {
-            if (ptr[i] < 0x20) {
-                bfr = false;
-                bfk = 0;
-                /* ?? check kudokuten ?? && ?? hiragana ?? */
-                if ((i >= 2) && (ptr[i - 2] == 0x81)
-                    && (0x41 <= ptr[i - 1] && ptr[i - 1] <= 0x49)) {
-                    code = SJIS;
-                    sjis += 100;        /* kudokuten */
-                } else if ((i >= 2) && (ptr[i - 2] == 0xa1) && (0xa2 <= ptr[i - 1] && ptr[i - 1] <= 0xaa)) {
-                    code = EUC;
-                    euc += 100;         /* kudokuten */
-                } else if ((i >= 2) && (ptr[i - 2] == 0x82) && (0xa0 <= ptr[i - 1])) {
-                    sjis += 40;         /* hiragana */
-                } else if ((i >= 2) && (ptr[i - 2] == 0xa4) && (0xa0 <= ptr[i - 1])) {
-                    euc += 40;          /* hiragana */
-                }
-            } else {
-                /* ?? check hiragana or katana ?? */
-                if ((size - i > 1) && (ptr[i] == 0x82) && (0xa0 <= ptr[i + 1])) {
-                    sjis++;     /* hiragana */
-                } else if ((size - i > 1) && (ptr[i] == 0x83) && (0x40 <= ptr[i + 1] && ptr[i + 1] <= 0x9f)) {
-                    sjis++;     /* katakana */
-                } else if ((size - i > 1) && (ptr[i] == 0xa4) && (0xa0 <= ptr[i + 1])) {
-                    euc++;      /* hiragana */
-                } else if ((size - i > 1) && (ptr[i] == 0xa5) && (0xa0 <= ptr[i + 1])) {
-                    euc++;      /* katakana */
-                }
-                if (bfr) {
-                    if ((i >= 1) && (0x40 <= ptr[i] && ptr[i] <= 0xa0) && ISkanji(ptr[i - 1])) {
-                        code = SJIS;
-                        goto breakBreak;
-                    }
-
-                    if ((i >= 1) && (0x81 <= ptr[i - 1] && ptr[i - 1] <= 0x9f) && ((0x40 <= ptr[i] && ptr[i] < 0x7e) || (0x7e < ptr[i] && ptr[i] <= 0xfc))) {
-                        code = SJIS;
-                        goto breakBreak;
-                    }
-
-                    if ((i >= 1) && (0xfd <= ptr[i] && ptr[i] <= 0xfe) && (0xa1 <= ptr[i - 1] && ptr[i - 1] <= 0xfe)) {
-                        code = EUC;
-                        goto breakBreak;
-                    }
-
-                    if ((i >= 1) && (0xfd <= ptr[i - 1] && ptr[i - 1] <= 0xfe) && (0xa1 <= ptr[i] && ptr[i] <= 0xfe)) {
-                        code = EUC;
-                        goto breakBreak;
-                    }
-
-                    if ((i >= 1) && (ptr[i] < 0xa0 || 0xdf < ptr[i]) && (0x8e == ptr[i - 1])) {
-                        code = SJIS;
-                        goto breakBreak;
-                    }
-
-                    if (ptr[i] <= 0x7f) {
-                        code = SJIS;
-                        goto breakBreak;
-                    }
-
-                    if (0xa1 <= ptr[i] && ptr[i] <= 0xa6) {
-                        euc++;      /* sjis hankaku kana kigo */
-                    } else if (0xa1 <= ptr[i] && ptr[i] <= 0xdf) {
-                        /* sjis hankaku kana */
-                    } else if (0xa1 <= ptr[i] && ptr[i] <= 0xfe) {
-                        euc++;
-                    } else if (0x8e == ptr[i]) {
-                        euc++;
-                    } else if (0x20 <= ptr[i] && ptr[i] <= 0x7f) {
-                        sjis++;
-                    }
-
-                    bfr = false;
-                    bfk = 0;
-                } else if (0x8e == ptr[i]) {
-                    if (size - i <= 1) {
-
-                    } else if (0xa1 <= ptr[i + 1] && ptr[i + 1] <= 0xdf) {
-                        /* EUC KANA or SJIS KANJI */
-                        if (bfk == 1) {
-                            euc += 100;
-                        }
-                        bfk++;
-                        i++;
-                    } else {
-                        /* SJIS only */
-                        code = SJIS;
-                        goto breakBreak;
-                    }
-                } else if (0x81 <= ptr[i] && ptr[i] <= 0x9f) {
-                    /* SJIS only */
-                    code = SJIS;
-                    if ((size - i >= 1) && ((0x40 <= ptr[i + 1] && ptr[i + 1] <= 0x7e) || (0x80 <= ptr[i + 1] && ptr[i + 1] <= 0xfc)))
-                        goto breakBreak;
-                } else if (0xfd <= ptr[i] && ptr[i] <= 0xfe) {
-                    /* EUC only */
-                    code = EUC;
-                    if ((size - i >= 1) && (0xa1 <= ptr[i + 1] && ptr[i + 1] <= 0xfe))
-                        goto breakBreak;
-                } else if (ptr[i] <= 0x7f) {
-
-                } else {
-                    bfr = true;
-                    bfk = 0;
-                }
-            }
-            i++;
-        }
-    }
-    if (code == ASCII) {
-        if (sjis > euc) {
-            code = SJIS;
-        } else if (sjis < euc) {
-            code = EUC;
-        }
-    }
-breakBreak:
-    return (code);
-}
-
 TextResourceDecoder::ContentType TextResourceDecoder::determineContentType(const String& mimeType)
 {
     if (equalIgnoringCase(mimeType, "text/css"))
@@ -571,25 +362,6 @@
     return;
 }
 
-void TextResourceDecoder::detectJapaneseEncoding(const char* data, size_t len)
-{
-    switch (KanjiCode::judge(data, len)) {
-    case KanjiCode::JIS:
-        setEncoding("ISO-2022-JP", EncodingFromContentSniffing);
-        break;
-    case KanjiCode::EUC:
-        setEncoding("EUC-JP", EncodingFromContentSniffing);
-        break;
-    case KanjiCode::SJIS:
-        setEncoding("Shift_JIS", EncodingFromContentSniffing);
-        break;
-    case KanjiCode::ASCII:
-    case KanjiCode::UTF16:
-    case KanjiCode::UTF8:
-        break;
-    }
-}
-
 // We use the encoding detector in two cases:
 //   1. Encoding detector is turned ON and no other encoding source is
 //      available (that is, it's DefaultEncoding).
@@ -625,20 +397,6 @@
             return emptyString();
     }
 
-    // FIXME: It would be more efficient to move this logic below checkForMetaCharset because
-    //        checkForMetaCharset can overrule these detections.
-    if (shouldAutoDetect()) {
-        if (m_encoding.isJapanese()) {
-            detectJapaneseEncoding(data, len); // FIXME: We should use detectTextEncoding() for all languages.
-        } else {
-            WTF::TextEncoding detectedEncoding;
-            if (detectTextEncoding(data, len, m_hintEncoding, &detectedEncoding))
-                setEncoding(detectedEncoding, EncodingFromContentSniffing);
-        }
-    }
-
-    ASSERT(m_encoding.isValid());
-
     const char* dataForDecode = data + lengthOfBOM;
     size_t lengthForDecode = len - lengthOfBOM;
 
@@ -656,6 +414,14 @@
     if (m_contentType == HTML && !m_checkedForMetaCharset)
         checkForMetaCharset(dataForDecode, lengthForDecode);
 
+    if (shouldAutoDetect()) {
+        WTF::TextEncoding detectedEncoding;
+        if (detectTextEncoding(data, len, m_hintEncoding, &detectedEncoding))
+            setEncoding(detectedEncoding, EncodingFromContentSniffing);
+    }
+
+    ASSERT(m_encoding.isValid());
+
     if (!m_codec)
         m_codec = newTextCodec(m_encoding);
 
diff --git a/Source/core/fetch/XSLStyleSheetResource.cpp b/Source/core/fetch/XSLStyleSheetResource.cpp
index 6179a47..bb36fce 100644
--- a/Source/core/fetch/XSLStyleSheetResource.cpp
+++ b/Source/core/fetch/XSLStyleSheetResource.cpp
@@ -27,10 +27,11 @@
 #include "config.h"
 #include "core/fetch/XSLStyleSheetResource.h"
 
+#include "RuntimeEnabledFeatures.h"
 #include "core/fetch/ResourceClientWalker.h"
 #include "core/fetch/StyleSheetResourceClient.h"
 #include "core/fetch/TextResourceDecoder.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
@@ -39,6 +40,7 @@
     : Resource(resourceRequest, XSLStyleSheet)
     , m_decoder(TextResourceDecoder::create("text/xsl"))
 {
+    ASSERT(RuntimeEnabledFeatures::xsltEnabled());
     DEFINE_STATIC_LOCAL(const AtomicString, acceptXSLT, ("text/xml, application/xml, application/xhtml+xml, text/xsl, application/rss+xml, application/atom+xml", AtomicString::ConstructFromLiteral));
 
     // It's XML we want.
diff --git a/Source/core/fileapi/Blob.cpp b/Source/core/fileapi/Blob.cpp
index f93b428..dfb19cc 100644
--- a/Source/core/fileapi/Blob.cpp
+++ b/Source/core/fileapi/Blob.cpp
@@ -37,6 +37,8 @@
 
 namespace WebCore {
 
+namespace {
+
 class BlobURLRegistry : public URLRegistry {
 public:
     virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) OVERRIDE;
@@ -45,16 +47,15 @@
     static URLRegistry& registry();
 };
 
-
 void BlobURLRegistry::registerURL(SecurityOrigin* origin, const KURL& publicURL, URLRegistrable* blob)
 {
     ASSERT(&blob->registry() == this);
-    BlobRegistry::registerBlobURL(origin, publicURL, static_cast<Blob*>(blob)->url());
+    BlobRegistry::registerPublicBlobURL(origin, publicURL, static_cast<Blob*>(blob)->blobDataHandle());
 }
 
-void BlobURLRegistry::unregisterURL(const KURL& url)
+void BlobURLRegistry::unregisterURL(const KURL& publicURL)
 {
-    BlobRegistry::unregisterBlobURL(url);
+    BlobRegistry::revokePublicBlobURL(publicURL);
 }
 
 URLRegistry& BlobURLRegistry::registry()
@@ -63,44 +64,16 @@
     return instance;
 }
 
+} // namespace
 
-Blob::Blob()
-    : m_size(0)
+Blob::Blob(PassRefPtr<BlobDataHandle> dataHandle)
+    : m_blobDataHandle(dataHandle)
 {
     ScriptWrappable::init(this);
-    OwnPtr<BlobData> blobData = BlobData::create();
-
-    // Create a new internal URL and register it with the provided blob data.
-    m_internalURL = BlobURL::createInternalURL();
-    BlobRegistry::registerBlobURL(m_internalURL, blobData.release());
-}
-
-Blob::Blob(PassOwnPtr<BlobData> blobData, long long size)
-    : m_type(blobData->contentType())
-    , m_size(size)
-{
-    ASSERT(blobData);
-    ScriptWrappable::init(this);
-
-    // Create a new internal URL and register it with the provided blob data.
-    m_internalURL = BlobURL::createInternalURL();
-    BlobRegistry::registerBlobURL(m_internalURL, blobData);
-}
-
-Blob::Blob(const KURL& srcURL, const String& type, long long size)
-    : m_type(type)
-    , m_size(size)
-{
-    ScriptWrappable::init(this);
-
-    // Create a new internal URL and register it with the same blob data as the source URL.
-    m_internalURL = BlobURL::createInternalURL();
-    BlobRegistry::registerBlobURL(0, m_internalURL, srcURL);
 }
 
 Blob::~Blob()
 {
-    BlobRegistry::unregisterBlobURL(m_internalURL);
 }
 
 PassRefPtr<Blob> Blob::slice(long long start, long long end, const String& contentType) const
@@ -113,8 +86,8 @@
         // FIXME: This involves synchronous file operation. We need to figure out how to make it asynchronous.
         toFile(this)->captureSnapshot(size, modificationTime);
     } else {
-        ASSERT(m_size != -1);
-        size = m_size;
+        size = this->size();
+        ASSERT(size != -1);
     }
 
     // Convert the negative value that is used to select from the end.
@@ -141,13 +114,13 @@
     blobData->setContentType(contentType);
     if (isFile()) {
         if (!toFile(this)->fileSystemURL().isEmpty())
-            blobData->appendURL(toFile(this)->fileSystemURL(), start, length, modificationTime);
+            blobData->appendFileSystemURL(toFile(this)->fileSystemURL(), start, length, modificationTime);
         else
             blobData->appendFile(toFile(this)->path(), start, length, modificationTime);
-    } else
-        blobData->appendBlob(m_internalURL, start, length);
-
-    return Blob::create(blobData.release(), length);
+    } else {
+        blobData->appendBlob(m_blobDataHandle, start, length);
+    }
+    return Blob::create(BlobDataHandle::create(blobData.release(), length));
 }
 
 URLRegistry& Blob::registry() const
diff --git a/Source/core/fileapi/Blob.h b/Source/core/fileapi/Blob.h
index 958aa28..3d46a1a 100644
--- a/Source/core/fileapi/Blob.h
+++ b/Source/core/fileapi/Blob.h
@@ -34,7 +34,6 @@
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/html/URLRegistry.h"
 #include "core/platform/network/BlobData.h"
-#include "weborigin/KURL.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
@@ -42,53 +41,38 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class Blob : public ScriptWrappable, public URLRegistrable, public RefCounted<Blob> {
 public:
     static PassRefPtr<Blob> create()
     {
-        return adoptRef(new Blob);
+        return adoptRef(new Blob(BlobDataHandle::create()));
     }
 
-    static PassRefPtr<Blob> create(PassOwnPtr<BlobData> blobData, long long size)
+    static PassRefPtr<Blob> create(PassRefPtr<BlobDataHandle> blobDataHandle)
     {
-        return adoptRef(new Blob(blobData, size));
-    }
-
-    // For deserialization.
-    static PassRefPtr<Blob> create(const KURL& srcURL, const String& type, long long size)
-    {
-        return adoptRef(new Blob(srcURL, type, size));
+        return adoptRef(new Blob(blobDataHandle));
     }
 
     virtual ~Blob();
 
-    const KURL& url() const { return m_internalURL; }
-    const String& type() const { return m_type; }
-
-    virtual unsigned long long size() const { return static_cast<unsigned long long>(m_size); }
+    String uuid() const { return m_blobDataHandle->uuid(); }
+    String type() const {  return m_blobDataHandle->type(); }
+    virtual unsigned long long size() const { return m_blobDataHandle->size(); }
     virtual bool isFile() const { return false; }
-
-    // URLRegistrable
-    virtual URLRegistry& registry() const OVERRIDE;
-
+    PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle; }
     PassRefPtr<Blob> slice(long long start = 0, long long end = std::numeric_limits<long long>::max(), const String& contentType = String()) const;
 
+    // URLRegistrable to support PublicURLs.
+    virtual URLRegistry& registry() const OVERRIDE;
+
 protected:
+    explicit Blob(PassRefPtr<BlobDataHandle>);
+
+private:
     Blob();
-    Blob(PassOwnPtr<BlobData>, long long size);
-
-    // For deserialization.
-    Blob(const KURL& srcURL, const String& type, long long size);
-
-    // This is an internal URL referring to the blob data associated with this object. It serves
-    // as an identifier for this blob. The internal URL is never used to source the blob's content
-    // into an HTML or for FileRead'ing, public blob URLs must be used for those purposes.
-    KURL m_internalURL;
-
-    String m_type;
-    long long m_size;
+    RefPtr<BlobDataHandle> m_blobDataHandle;
 };
 
 } // namespace WebCore
diff --git a/Source/core/fileapi/Blob.idl b/Source/core/fileapi/Blob.idl
index 8dddc35..814a2fc 100644
--- a/Source/core/fileapi/Blob.idl
+++ b/Source/core/fileapi/Blob.idl
@@ -30,7 +30,7 @@
 
 [
     GlobalContext=Window&WorkerGlobalScope,
-    CustomToV8,
+    SpecialWrapFor=File,
     CustomConstructor,
     CustomConstructor(sequence<any> blobParts, optional BlobPropertyBag options)
 ] interface Blob {
diff --git a/Source/core/fileapi/BlobBuilder.cpp b/Source/core/fileapi/BlobBuilder.cpp
index dfd1562..8be60c1 100644
--- a/Source/core/fileapi/BlobBuilder.cpp
+++ b/Source/core/fileapi/BlobBuilder.cpp
@@ -34,7 +34,7 @@
 
 #include "core/fileapi/Blob.h"
 #include "core/fileapi/File.h"
-#include "core/platform/text/LineEnding.h"
+#include "platform/text/LineEnding.h"
 #include "wtf/ArrayBuffer.h"
 #include "wtf/ArrayBufferView.h"
 #include "wtf/PassRefPtr.h"
@@ -110,7 +110,7 @@
     } else {
         long long blobSize = static_cast<long long>(blob->size());
         m_size += blobSize;
-        m_items.append(BlobDataItem(blob->url(), 0, blobSize));
+        m_items.append(BlobDataItem(blob->blobDataHandle(), 0, blobSize));
     }
 }
 
@@ -128,11 +128,11 @@
     blobData->setContentType(contentType);
     blobData->swapItems(m_items);
 
-    RefPtr<Blob> blob = Blob::create(blobData.release(), m_size);
+    RefPtr<Blob> blob = Blob::create(BlobDataHandle::create(blobData.release(), m_size));
 
-    // After creating a blob from the current blob data, we do not need to keep the data around any more. Instead, we only
-    // need to keep a reference to the URL of the blob just created.
-    m_items.append(BlobDataItem(blob->url(), 0, m_size));
+    // After creating a blob from the current blob data, we do not need to keep the data around any more.
+    // Instead, we only need to keep a reference to the blob data just created.
+    m_items.append(BlobDataItem(blob->blobDataHandle(), 0, m_size));
 
     return blob;
 }
diff --git a/Source/core/fileapi/BlobRegistry.cpp b/Source/core/fileapi/BlobRegistry.cpp
index b649b26..bae718f 100644
--- a/Source/core/fileapi/BlobRegistry.cpp
+++ b/Source/core/fileapi/BlobRegistry.cpp
@@ -104,7 +104,6 @@
 
 static WebBlobRegistry* blobRegistry()
 {
-    ASSERT(isMainThread());
     return WebKit::Platform::current()->blobRegistry();
 }
 
@@ -133,66 +132,31 @@
         originMap()->remove(url.string());
 }
 
-static void registerBlobURLTask(void* context)
+void BlobRegistry::registerBlobData(const String& uuid, PassOwnPtr<BlobData> data)
 {
-    OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobRegistryContext*>(context));
-    if (WebBlobRegistry* registry = blobRegistry()) {
-        WebBlobData webBlobData(blobRegistryContext->blobData.release());
-        registry->registerBlobURL(blobRegistryContext->url, webBlobData);
-    }
+    blobRegistry()->registerBlobData(uuid, WebKit::WebBlobData(data));
 }
 
-void BlobRegistry::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> blobData)
+void BlobRegistry::addBlobDataRef(const String& uuid)
 {
-    if (isMainThread()) {
-        if (WebBlobRegistry* registry = blobRegistry()) {
-            WebBlobData webBlobData(blobData);
-            registry->registerBlobURL(url, webBlobData);
-        }
-    } else {
-        OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(url, blobData));
-        callOnMainThread(&registerBlobURLTask, context.leakPtr());
-    }
+    blobRegistry()->addBlobDataRef(uuid);
 }
 
-static void registerBlobURLFromTask(void* context)
+void BlobRegistry::removeBlobDataRef(const String& uuid)
 {
-    OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobRegistryContext*>(context));
-    if (WebBlobRegistry* registry = blobRegistry())
-        registry->registerBlobURL(blobRegistryContext->url, blobRegistryContext->srcURL);
+    blobRegistry()->removeBlobDataRef(uuid);
 }
 
-void BlobRegistry::registerBlobURL(SecurityOrigin* origin, const KURL& url, const KURL& srcURL)
+void BlobRegistry::registerPublicBlobURL(SecurityOrigin* origin, const KURL& url, PassRefPtr<BlobDataHandle> handle)
 {
     saveToOriginMap(origin, url);
-
-    if (isMainThread()) {
-        if (WebBlobRegistry* registry = blobRegistry())
-            registry->registerBlobURL(url, srcURL);
-    } else {
-        OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(url, srcURL));
-        callOnMainThread(&registerBlobURLFromTask, context.leakPtr());
-    }
+    blobRegistry()->registerPublicBlobURL(url, handle->uuid());
 }
 
-static void unregisterBlobURLTask(void* context)
-{
-    OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobRegistryContext*>(context));
-    if (WebBlobRegistry* registry = blobRegistry())
-        registry->unregisterBlobURL(blobRegistryContext->url);
-}
-
-void BlobRegistry::unregisterBlobURL(const KURL& url)
+void BlobRegistry::revokePublicBlobURL(const KURL& url)
 {
     removeFromOriginMap(url);
-
-    if (isMainThread()) {
-        if (WebBlobRegistry* registry = blobRegistry())
-            registry->unregisterBlobURL(url);
-    } else {
-        OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(url));
-        callOnMainThread(&unregisterBlobURLTask, context.leakPtr());
-    }
+    blobRegistry()->revokePublicBlobURL(url);
 }
 
 static void registerStreamURLTask(void* context)
diff --git a/Source/core/fileapi/BlobRegistry.h b/Source/core/fileapi/BlobRegistry.h
index 2889b19..b564d3b 100644
--- a/Source/core/fileapi/BlobRegistry.h
+++ b/Source/core/fileapi/BlobRegistry.h
@@ -38,20 +38,20 @@
 namespace WebCore {
 
 class BlobData;
+class BlobDataHandle;
 class KURL;
 class RawData;
 class SecurityOrigin;
 
-// A bridging class for calling WebKit::WebBlobRegistry methods on the main
-// thread. Each method gets the WebBlobRegistry implementation instance and
-// calls the corresponding method (the same name) on it using callOnMainThread()
-// if necessary.
+// A bridging class for calling WebKit::WebBlobRegistry methods.
 class BlobRegistry {
 public:
     // Methods for controlling Blobs.
-    static void registerBlobURL(const KURL&, PassOwnPtr<BlobData>);
-    static void registerBlobURL(SecurityOrigin*, const KURL&, const KURL& srcURL);
-    static void unregisterBlobURL(const KURL&);
+    static void registerBlobData(const String& uuid, PassOwnPtr<BlobData>);
+    static void addBlobDataRef(const String& uuid);
+    static void removeBlobDataRef(const String& uuid);
+    static void registerPublicBlobURL(SecurityOrigin*, const KURL&, PassRefPtr<BlobDataHandle>);
+    static void revokePublicBlobURL(const KURL&);
 
     // Methods for controlling Streams.
     static void registerStreamURL(const KURL&, const String&);
diff --git a/Source/core/fileapi/BlobURL.cpp b/Source/core/fileapi/BlobURL.cpp
index 1d9b7d8..d690055 100644
--- a/Source/core/fileapi/BlobURL.cpp
+++ b/Source/core/fileapi/BlobURL.cpp
@@ -32,7 +32,7 @@
 
 #include "core/fileapi/BlobURL.h"
 
-#include "core/platform/UUID.h"
+#include "platform/UUID.h"
 #include "weborigin/KURL.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/text/WTFString.h"
@@ -47,11 +47,6 @@
     return createBlobURL(securityOrigin->toString());
 }
 
-KURL BlobURL::createInternalURL()
-{
-    return createBlobURL("blobinternal://");
-}
-
 String BlobURL::getOrigin(const KURL& url)
 {
     ASSERT(url.protocolIs(kBlobProtocol));
@@ -61,12 +56,9 @@
     return url.string().substring(startIndex, endIndex - startIndex - 1);
 }
 
-String BlobURL::getIdentifier(const KURL& url)
+KURL BlobURL::createInternalStreamURL()
 {
-    ASSERT(url.protocolIs(kBlobProtocol));
-
-    unsigned startIndex = url.pathAfterLastSlash();
-    return url.string().substring(startIndex);
+    return createBlobURL("blobinternal://");
 }
 
 KURL BlobURL::createBlobURL(const String& originString)
diff --git a/Source/core/fileapi/BlobURL.h b/Source/core/fileapi/BlobURL.h
index 719b346..bb75da2 100644
--- a/Source/core/fileapi/BlobURL.h
+++ b/Source/core/fileapi/BlobURL.h
@@ -38,22 +38,19 @@
 class KURL;
 class SecurityOrigin;
 
-// Blob URLs are of the form
+// Public blob URLs are of the form
 //     blob:%escaped_origin%/%UUID%
-// For public urls, the origin of the host page is encoded in the URL value to
+// The origin of the host page is encoded in the URL value to
 // allow easy lookup of the origin when security checks need to be performed.
 // When loading blobs via ResourceHandle or when reading blobs via FileReader
 // the loader conducts security checks that examine the origin of host page
-// encoded in the public blob url. The origin baked into internal blob urls
-// is a simple constant value, "blobinternal://", internal urls should not
-// be used with ResourceHandle or FileReader.
+// encoded in the blob url.
 class BlobURL {
 public:
     static KURL createPublicURL(SecurityOrigin*);
-    static KURL createInternalURL();
     static String getOrigin(const KURL&);
-    static String getIdentifier(const KURL&);
-    static const char* blobProtocol() { return kBlobProtocol; }
+
+    static KURL createInternalStreamURL();
 
 private:
     static KURL createBlobURL(const String& originString);
diff --git a/Source/core/fileapi/File.cpp b/Source/core/fileapi/File.cpp
index cb04664..c578ada 100644
--- a/Source/core/fileapi/File.cpp
+++ b/Source/core/fileapi/File.cpp
@@ -26,9 +26,8 @@
 #include "config.h"
 #include "core/fileapi/File.h"
 
-#include "core/platform/FileMetadata.h"
-#include "core/platform/FileSystem.h"
 #include "core/platform/MIMETypeRegistry.h"
+#include "platform/FileMetadata.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebFileUtilities.h"
 #include "wtf/CurrentTime.h"
@@ -82,7 +81,7 @@
 {
     OwnPtr<BlobData> blobData = BlobData::create();
     blobData->setContentType(getContentTypeFromFileName(fileSystemURL.path(), File::WellKnownContentTypes));
-    blobData->appendURL(fileSystemURL, 0, metadata.length, metadata.modificationTime);
+    blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length, metadata.modificationTime);
     return blobData.release();
 }
 
@@ -94,7 +93,7 @@
 }
 
 File::File(const String& path, ContentTypeLookupPolicy policy)
-    : Blob(createBlobDataForFile(path, policy), -1)
+    : Blob(BlobDataHandle::create(createBlobDataForFile(path, policy), -1))
     , m_path(path)
     , m_name(WebKit::Platform::current()->fileUtilities()->baseName(path))
     , m_snapshotSize(-1)
@@ -103,21 +102,8 @@
     ScriptWrappable::init(this);
 }
 
-File::File(const String& path, const KURL& url, const String& type)
-    : Blob(url, type, -1)
-    , m_path(path)
-    , m_snapshotSize(-1)
-    , m_snapshotModificationTime(invalidFileTime())
-{
-    ScriptWrappable::init(this);
-    m_name = WebKit::Platform::current()->fileUtilities()->baseName(path);
-    // FIXME: File object serialization/deserialization does not include
-    // newer file object data members: m_name and m_relativePath.
-    // See SerializedScriptValue.cpp for js and v8.
-}
-
 File::File(const String& path, const String& name, ContentTypeLookupPolicy policy)
-    : Blob(createBlobDataForFileWithName(path, name, policy), -1)
+    : Blob(BlobDataHandle::create(createBlobDataForFileWithName(path, name, policy), -1))
     , m_path(path)
     , m_name(name)
     , m_snapshotSize(-1)
@@ -126,8 +112,21 @@
     ScriptWrappable::init(this);
 }
 
+File::File(const String& path, PassRefPtr<BlobDataHandle> blobDataHandle)
+    : Blob(blobDataHandle)
+    , m_path(path)
+    , m_name(WebKit::Platform::current()->fileUtilities()->baseName(path))
+    , m_snapshotSize(-1)
+    , m_snapshotModificationTime(invalidFileTime())
+{
+    ScriptWrappable::init(this);
+    // FIXME: File object serialization/deserialization does not include
+    // newer file object data members: m_name and m_relativePath.
+    // See SerializedScriptValue.cpp.
+}
+
 File::File(const String& name, const FileMetadata& metadata)
-    : Blob(createBlobDataForFileWithMetadata(name, metadata), metadata.length)
+    : Blob(BlobDataHandle::create(createBlobDataForFileWithMetadata(name, metadata),  metadata.length))
     , m_path(metadata.platformPath)
     , m_name(name)
     , m_snapshotSize(metadata.length)
@@ -137,7 +136,7 @@
 }
 
 File::File(const KURL& fileSystemURL, const FileMetadata& metadata)
-    : Blob(createBlobDataForFileSystemURL(fileSystemURL, metadata), metadata.length)
+    : Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL, metadata), metadata.length))
     , m_fileSystemURL(fileSystemURL)
     , m_snapshotSize(metadata.length)
     , m_snapshotModificationTime(metadata.modificationTime)
diff --git a/Source/core/fileapi/File.h b/Source/core/fileapi/File.h
index 063315d..c6d8db4 100644
--- a/Source/core/fileapi/File.h
+++ b/Source/core/fileapi/File.h
@@ -50,9 +50,9 @@
     }
 
     // For deserialization.
-    static PassRefPtr<File> create(const String& path, const KURL& srcURL, const String& type)
+    static PassRefPtr<File> create(const String& path, PassRefPtr<BlobDataHandle> blobDataHandle)
     {
-        return adoptRef(new File(path, srcURL, type));
+        return adoptRef(new File(path, blobDataHandle));
     }
 
     static PassRefPtr<File> createWithRelativePath(const String& path, const String& relativePath);
@@ -97,10 +97,8 @@
 
 private:
     File(const String& path, ContentTypeLookupPolicy);
-
-    // For deserialization.
-    File(const String& path, const KURL& srcURL, const String& type);
     File(const String& path, const String& name, ContentTypeLookupPolicy);
+    File(const String& path, PassRefPtr<BlobDataHandle>);
     File(const String& name, const FileMetadata&);
     File(const KURL& fileSystemURL, const FileMetadata&);
 
diff --git a/Source/core/fileapi/File.idl b/Source/core/fileapi/File.idl
index 2d2ea18..56be7fc 100644
--- a/Source/core/fileapi/File.idl
+++ b/Source/core/fileapi/File.idl
@@ -26,6 +26,6 @@
 interface File : Blob {
     readonly attribute DOMString name;
     readonly attribute Date lastModifiedDate;
-    [EnabledAtRuntime=DirectoryUpload] readonly attribute DOMString webkitRelativePath;
+    [RuntimeEnabled=DirectoryUpload] readonly attribute DOMString webkitRelativePath;
 };
 
diff --git a/Source/core/fileapi/FileReader.cpp b/Source/core/fileapi/FileReader.cpp
index 0d274c0..2ff2020 100644
--- a/Source/core/fileapi/FileReader.cpp
+++ b/Source/core/fileapi/FileReader.cpp
@@ -34,10 +34,10 @@
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/CrossThreadTask.h"
 #include "core/dom/ExceptionCode.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/events/ProgressEvent.h"
-#include "core/dom/ScriptExecutionContext.h"
 #include "core/fileapi/File.h"
-#include "core/platform/Logging.h"
+#include "platform/Logging.h"
 #include "wtf/ArrayBuffer.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/text/CString.h"
@@ -46,9 +46,9 @@
 
 namespace {
 
-const CString utf8BlobURL(Blob* blob)
+const CString utf8BlobUUID(Blob* blob)
 {
-    return blob->url().string().utf8();
+    return blob->uuid().utf8();
 }
 
 const CString utf8FilePath(Blob* blob)
@@ -60,14 +60,14 @@
 
 static const double progressNotificationIntervalMS = 50;
 
-PassRefPtr<FileReader> FileReader::create(ScriptExecutionContext* context)
+PassRefPtr<FileReader> FileReader::create(ExecutionContext* context)
 {
     RefPtr<FileReader> fileReader(adoptRef(new FileReader(context)));
     fileReader->suspendIfNeeded();
     return fileReader.release();
 }
 
-FileReader::FileReader(ScriptExecutionContext* context)
+FileReader::FileReader(ExecutionContext* context)
     : ActiveDOMObject(context)
     , m_state(EMPTY)
     , m_loadingState(LoadingStateNone)
@@ -84,13 +84,7 @@
 
 const AtomicString& FileReader::interfaceName() const
 {
-    return eventNames().interfaceForFileReader;
-}
-
-bool FileReader::canSuspend() const
-{
-    // FIXME: It is not currently possible to suspend a FileReader, so pages with FileReader can not go into page cache.
-    return false;
+    return EventTargetNames::FileReader;
 }
 
 void FileReader::stop()
@@ -103,7 +97,7 @@
     if (!blob)
         return;
 
-    LOG(FileAPI, "FileReader: reading as array buffer: %s %s\n", utf8BlobURL(blob).data(), utf8FilePath(blob).data());
+    LOG(FileAPI, "FileReader: reading as array buffer: %s %s\n", utf8BlobUUID(blob).data(), utf8FilePath(blob).data());
 
     readInternal(blob, FileReaderLoader::ReadAsArrayBuffer, es);
 }
@@ -113,7 +107,7 @@
     if (!blob)
         return;
 
-    LOG(FileAPI, "FileReader: reading as binary: %s %s\n", utf8BlobURL(blob).data(), utf8FilePath(blob).data());
+    LOG(FileAPI, "FileReader: reading as binary: %s %s\n", utf8BlobUUID(blob).data(), utf8FilePath(blob).data());
 
     readInternal(blob, FileReaderLoader::ReadAsBinaryString, es);
 }
@@ -123,7 +117,7 @@
     if (!blob)
         return;
 
-    LOG(FileAPI, "FileReader: reading as text: %s %s\n", utf8BlobURL(blob).data(), utf8FilePath(blob).data());
+    LOG(FileAPI, "FileReader: reading as text: %s %s\n", utf8BlobUUID(blob).data(), utf8FilePath(blob).data());
 
     m_encoding = encoding;
     readInternal(blob, FileReaderLoader::ReadAsText, es);
@@ -139,7 +133,7 @@
     if (!blob)
         return;
 
-    LOG(FileAPI, "FileReader: reading as data URL: %s %s\n", utf8BlobURL(blob).data(), utf8FilePath(blob).data());
+    LOG(FileAPI, "FileReader: reading as data URL: %s %s\n", utf8BlobUUID(blob).data(), utf8FilePath(blob).data());
 
     readInternal(blob, FileReaderLoader::ReadAsDataURL, es);
 }
@@ -163,10 +157,10 @@
     m_loader = adoptPtr(new FileReaderLoader(m_readType, this));
     m_loader->setEncoding(m_encoding);
     m_loader->setDataType(m_blob->type());
-    m_loader->start(scriptExecutionContext(), *m_blob);
+    m_loader->start(executionContext(), m_blob->blobDataHandle());
 }
 
-static void delayedAbort(ScriptExecutionContext*, FileReader* reader)
+static void delayedAbort(ExecutionContext*, FileReader* reader)
 {
     reader->doAbort();
 }
@@ -180,7 +174,7 @@
     m_loadingState = LoadingStateAborted;
 
     // Schedule to have the abort done later since abort() might be called from the event handler and we do not want the resource loading code to be in the stack.
-    scriptExecutionContext()->postTask(
+    executionContext()->postTask(
         createCallbackTask(&delayedAbort, AllowAccessLater(this)));
 }
 
@@ -192,9 +186,9 @@
 
     m_error = FileError::create(FileError::ABORT_ERR);
 
-    fireEvent(eventNames().errorEvent);
-    fireEvent(eventNames().abortEvent);
-    fireEvent(eventNames().loadendEvent);
+    fireEvent(EventTypeNames::error);
+    fireEvent(EventTypeNames::abort);
+    fireEvent(EventTypeNames::loadend);
 
     // All possible events have fired and we're done, no more pending activity.
     unsetPendingActivity(this);
@@ -212,7 +206,7 @@
 
 void FileReader::didStartLoading()
 {
-    fireEvent(eventNames().loadstartEvent);
+    fireEvent(EventTypeNames::loadstart);
 }
 
 void FileReader::didReceiveData()
@@ -222,7 +216,7 @@
     if (!m_lastProgressNotificationTimeMS)
         m_lastProgressNotificationTimeMS = now;
     else if (now - m_lastProgressNotificationTimeMS > progressNotificationIntervalMS) {
-        fireEvent(eventNames().progressEvent);
+        fireEvent(EventTypeNames::progress);
         m_lastProgressNotificationTimeMS = now;
     }
 }
@@ -238,13 +232,13 @@
     // if we're still loading (therefore we need abort process) or not.
     m_loadingState = LoadingStateNone;
 
-    fireEvent(eventNames().progressEvent);
+    fireEvent(EventTypeNames::progress);
 
     ASSERT(m_state != DONE);
     m_state = DONE;
 
-    fireEvent(eventNames().loadEvent);
-    fireEvent(eventNames().loadendEvent);
+    fireEvent(EventTypeNames::load);
+    fireEvent(EventTypeNames::loadend);
 
     // All possible events have fired and we're done, no more pending activity.
     unsetPendingActivity(this);
@@ -261,8 +255,8 @@
     m_state = DONE;
 
     m_error = FileError::create(static_cast<FileError::ErrorCode>(errorCode));
-    fireEvent(eventNames().errorEvent);
-    fireEvent(eventNames().loadendEvent);
+    fireEvent(EventTypeNames::error);
+    fireEvent(EventTypeNames::loadend);
 
     // All possible events have fired and we're done, no more pending activity.
     unsetPendingActivity(this);
diff --git a/Source/core/fileapi/FileReader.h b/Source/core/fileapi/FileReader.h
index 22f3708..6b94e21 100644
--- a/Source/core/fileapi/FileReader.h
+++ b/Source/core/fileapi/FileReader.h
@@ -45,11 +45,11 @@
 
 class Blob;
 class ExceptionState;
-class ScriptExecutionContext;
+class ExecutionContext;
 
-class FileReader : public RefCounted<FileReader>, public ScriptWrappable, public ActiveDOMObject, public EventTarget, public FileReaderLoaderClient {
+class FileReader : public RefCounted<FileReader>, public ScriptWrappable, public ActiveDOMObject, public EventTargetWithInlineData, public FileReaderLoaderClient {
 public:
-    static PassRefPtr<FileReader> create(ScriptExecutionContext*);
+    static PassRefPtr<FileReader> create(ExecutionContext*);
 
     virtual ~FileReader();
 
@@ -75,12 +75,11 @@
     String stringResult();
 
     // ActiveDOMObject
-    virtual bool canSuspend() const;
     virtual void stop();
 
     // EventTarget
-    virtual const AtomicString& interfaceName() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveDOMObject::executionContext(); }
 
     // FileReaderLoaderClient
     virtual void didStartLoading();
@@ -99,13 +98,11 @@
     DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend);
 
 private:
-    FileReader(ScriptExecutionContext*);
+    FileReader(ExecutionContext*);
 
     // EventTarget
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
-    virtual EventTargetData* eventTargetData() { return &m_eventTargetData; }
-    virtual EventTargetData* ensureEventTargetData() { return &m_eventTargetData; }
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
 
     void terminate();
     void readInternal(Blob*, FileReaderLoader::ReadType, ExceptionState&);
@@ -123,8 +120,6 @@
     };
     LoadingState m_loadingState;
 
-    EventTargetData m_eventTargetData;
-
     RefPtr<Blob> m_blob;
     FileReaderLoader::ReadType m_readType;
     String m_encoding;
diff --git a/Source/core/fileapi/FileReader.idl b/Source/core/fileapi/FileReader.idl
index d43e34e..eb26da7 100644
--- a/Source/core/fileapi/FileReader.idl
+++ b/Source/core/fileapi/FileReader.idl
@@ -33,7 +33,7 @@
     GlobalContext=Window&WorkerGlobalScope,
     ActiveDOMObject,
     Constructor,
-    ConstructorCallWith=ScriptExecutionContext
+    ConstructorCallWith=ExecutionContext
 ] interface FileReader : EventTarget {
     // ready states
     const unsigned short EMPTY = 0;
@@ -50,7 +50,7 @@
     void abort();
 
     // file data
-    [Custom] readonly attribute any result;
+    [CustomGetter] readonly attribute any result;
 
     readonly attribute FileError error;
 
diff --git a/Source/core/fileapi/FileReaderLoader.cpp b/Source/core/fileapi/FileReaderLoader.cpp
index 7448e67..39bb5a3 100644
--- a/Source/core/fileapi/FileReaderLoader.cpp
+++ b/Source/core/fileapi/FileReaderLoader.cpp
@@ -32,7 +32,8 @@
 
 #include "core/fileapi/FileReaderLoader.h"
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "FetchInitiatorTypeNames.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/fetch/TextResourceDecoder.h"
 #include "core/fileapi/Blob.h"
 #include "core/fileapi/BlobRegistry.h"
@@ -62,6 +63,7 @@
     , m_isRawDataConverted(false)
     , m_stringResult("")
     , m_variableLength(false)
+    , m_finishedLoading(false)
     , m_bytesLoaded(0)
     , m_totalBytes(0)
     , m_hasRange(false)
@@ -78,23 +80,26 @@
         if (m_urlForReadingIsStream)
             BlobRegistry::unregisterStreamURL(m_urlForReading);
         else
-            BlobRegistry::unregisterBlobURL(m_urlForReading);
+            BlobRegistry::revokePublicBlobURL(m_urlForReading);
     }
 }
 
-void FileReaderLoader::startForURL(ScriptExecutionContext* scriptExecutionContext, const KURL& url)
+void FileReaderLoader::startInternal(ExecutionContext* executionContext, const Stream* stream, PassRefPtr<BlobDataHandle> blobData)
 {
     // The blob is read by routing through the request handling layer given a temporary public url.
-    m_urlForReading = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin());
+    m_urlForReading = BlobURL::createPublicURL(executionContext->securityOrigin());
     if (m_urlForReading.isEmpty()) {
         failed(FileError::SECURITY_ERR);
         return;
     }
 
-    if (m_urlForReadingIsStream)
-        BlobRegistry::registerStreamURL(scriptExecutionContext->securityOrigin(), m_urlForReading, url);
-    else
-        BlobRegistry::registerBlobURL(scriptExecutionContext->securityOrigin(), m_urlForReading, url);
+    if (blobData) {
+        ASSERT(!stream);
+        BlobRegistry::registerPublicBlobURL(executionContext->securityOrigin(), m_urlForReading, blobData);
+    } else {
+        ASSERT(stream);
+        BlobRegistry::registerStreamURL(executionContext->securityOrigin(), m_urlForReading, stream->url());
+    }
 
     // Construct and load the request.
     ResourceRequest request(m_urlForReading);
@@ -110,20 +115,22 @@
     options.crossOriginRequestPolicy = DenyCrossOriginRequests;
     // FIXME: Is there a directive to which this load should be subject?
     options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPolicy;
+    // Use special initiator to hide the request from the inspector.
+    options.initiator = FetchInitiatorTypeNames::internal;
 
     if (m_client)
-        m_loader = ThreadableLoader::create(scriptExecutionContext, this, request, options);
+        m_loader = ThreadableLoader::create(executionContext, this, request, options);
     else
-        ThreadableLoader::loadResourceSynchronously(scriptExecutionContext, request, *this, options);
+        ThreadableLoader::loadResourceSynchronously(executionContext, request, *this, options);
 }
 
-void FileReaderLoader::start(ScriptExecutionContext* scriptExecutionContext, const Blob& blob)
+void FileReaderLoader::start(ExecutionContext* executionContext, PassRefPtr<BlobDataHandle> blobData)
 {
     m_urlForReadingIsStream = false;
-    startForURL(scriptExecutionContext, blob.url());
+    startInternal(executionContext, 0, blobData);
 }
 
-void FileReaderLoader::start(ScriptExecutionContext* scriptExecutionContext, const Stream& stream, unsigned readSize)
+void FileReaderLoader::start(ExecutionContext* executionContext, const Stream& stream, unsigned readSize)
 {
     if (readSize > 0) {
         m_hasRange = true;
@@ -132,7 +139,7 @@
     }
 
     m_urlForReadingIsStream = true;
-    startForURL(scriptExecutionContext, stream.url());
+    startInternal(executionContext, &stream, 0);
 }
 
 void FileReaderLoader::cancel()
@@ -158,6 +165,7 @@
         m_rawData = 0;
         m_stringResult = "";
         m_isRawDataConverted = true;
+        m_decoder = 0;
     }
 }
 
@@ -189,11 +197,14 @@
     }
 
     ASSERT(!m_rawData);
-    m_rawData = ArrayBuffer::create(static_cast<unsigned>(length), 1);
 
-    if (!m_rawData) {
-        failed(FileError::NOT_READABLE_ERR);
-        return;
+    if (m_readType != ReadByClient) {
+        m_rawData = ArrayBuffer::create(static_cast<unsigned>(length), 1);
+
+        if (!m_rawData) {
+            failed(FileError::NOT_READABLE_ERR);
+            return;
+        }
     }
 
     m_totalBytes = static_cast<unsigned>(length);
@@ -255,7 +266,7 @@
 
 void FileReaderLoader::didFinishLoading(unsigned long, double)
 {
-    if (m_readType != ReadByClient && m_variableLength && m_totalBytes > m_bytesLoaded) {
+    if (m_readType != ReadByClient && m_rawData && m_rawData->byteLength() > m_bytesLoaded) {
         RefPtr<ArrayBuffer> newData = m_rawData->slice(0, m_bytesLoaded);
 
         m_rawData = newData;
@@ -263,6 +274,9 @@
 
         m_totalBytes = m_bytesLoaded;
     }
+
+    m_finishedLoading = true;
+
     cleanup();
     if (m_client)
         m_client->didFinishLoading();
@@ -305,11 +319,11 @@
     if (!m_rawData || m_errorCode)
         return 0;
 
-    // If completed, we can simply return our buffer.
-    if (isCompleted())
+    // If m_rawData is fully used, we can simply return it.
+    if (m_rawData->byteLength() == m_bytesLoaded)
         return m_rawData;
 
-    // Otherwise, return a copy.
+    // Otherwise, return a sliced copy.
     return m_rawData->slice(0, m_bytesLoaded);
 }
 
@@ -338,7 +352,7 @@
         break;
     case ReadAsDataURL:
         // Partial data is not supported when reading as data URL.
-        if (isCompleted())
+        if (m_finishedLoading)
             convertToDataURL();
         break;
     default:
@@ -367,7 +381,7 @@
         m_decoder = TextResourceDecoder::create("text/plain", m_encoding.isValid() ? m_encoding : UTF8Encoding());
     builder.append(m_decoder->decode(static_cast<const char*>(m_rawData->data()), m_bytesLoaded));
 
-    if (isCompleted())
+    if (m_finishedLoading)
         builder.append(m_decoder->flush());
 
     m_stringResult = builder.toString();
@@ -396,11 +410,6 @@
     m_stringResult = builder.toString();
 }
 
-bool FileReaderLoader::isCompleted() const
-{
-    return m_bytesLoaded == m_totalBytes;
-}
-
 void FileReaderLoader::setEncoding(const String& encoding)
 {
     if (!encoding.isEmpty())
diff --git a/Source/core/fileapi/FileReaderLoader.h b/Source/core/fileapi/FileReaderLoader.h
index 0eb8f5e..627dd79 100644
--- a/Source/core/fileapi/FileReaderLoader.h
+++ b/Source/core/fileapi/FileReaderLoader.h
@@ -40,9 +40,9 @@
 
 namespace WebCore {
 
-class Blob;
+class BlobDataHandle;
 class FileReaderLoaderClient;
-class ScriptExecutionContext;
+class ExecutionContext;
 class Stream;
 class TextResourceDecoder;
 class ThreadableLoader;
@@ -62,8 +62,8 @@
     FileReaderLoader(ReadType, FileReaderLoaderClient*);
     ~FileReaderLoader();
 
-    void start(ScriptExecutionContext*, const Blob&);
-    void start(ScriptExecutionContext*, const Stream&, unsigned readSize);
+    void start(ExecutionContext*, PassRefPtr<BlobDataHandle>);
+    void start(ExecutionContext*, const Stream&, unsigned readSize);
     void cancel();
 
     // ThreadableLoaderClient
@@ -82,18 +82,13 @@
     void setDataType(const String& dataType) { m_dataType = dataType; }
 
 private:
-    // We have start() methods for Blob and Stream instead of exposing this
-    // method so that users don't misuse this by calling with non Blob/Stream
-    // URL.
-    void startForURL(ScriptExecutionContext*, const KURL&);
+    void startInternal(ExecutionContext*, const Stream*, PassRefPtr<BlobDataHandle>);
     void terminate();
     void cleanup();
     void failed(FileError::ErrorCode);
     void convertToText();
     void convertToDataURL();
 
-    bool isCompleted() const;
-
     static FileError::ErrorCode httpStatusCodeToErrorCode(int);
 
     ReadType m_readType;
@@ -109,12 +104,12 @@
     bool m_isRawDataConverted;
 
     String m_stringResult;
-    RefPtr<Blob> m_blobResult;
 
     // The decoder used to decode the text data.
     RefPtr<TextResourceDecoder> m_decoder;
 
     bool m_variableLength;
+    bool m_finishedLoading;
     unsigned m_bytesLoaded;
     unsigned m_totalBytes;
 
diff --git a/Source/core/fileapi/FileReaderSync.cpp b/Source/core/fileapi/FileReaderSync.cpp
index 9fc6dd5..80222cf 100644
--- a/Source/core/fileapi/FileReaderSync.cpp
+++ b/Source/core/fileapi/FileReaderSync.cpp
@@ -46,7 +46,7 @@
     ScriptWrappable::init(this);
 }
 
-PassRefPtr<ArrayBuffer> FileReaderSync::readAsArrayBuffer(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionState& es)
+PassRefPtr<ArrayBuffer> FileReaderSync::readAsArrayBuffer(ExecutionContext* executionContext, Blob* blob, ExceptionState& es)
 {
     if (!blob) {
         es.throwDOMException(NotFoundError, FileError::notFoundErrorMessage);
@@ -54,12 +54,12 @@
     }
 
     FileReaderLoader loader(FileReaderLoader::ReadAsArrayBuffer, 0);
-    startLoading(scriptExecutionContext, loader, *blob, es);
+    startLoading(executionContext, loader, *blob, es);
 
     return loader.arrayBufferResult();
 }
 
-String FileReaderSync::readAsBinaryString(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionState& es)
+String FileReaderSync::readAsBinaryString(ExecutionContext* executionContext, Blob* blob, ExceptionState& es)
 {
     if (!blob) {
         es.throwDOMException(NotFoundError, FileError::notFoundErrorMessage);
@@ -67,11 +67,11 @@
     }
 
     FileReaderLoader loader(FileReaderLoader::ReadAsBinaryString, 0);
-    startLoading(scriptExecutionContext, loader, *blob, es);
+    startLoading(executionContext, loader, *blob, es);
     return loader.stringResult();
 }
 
-String FileReaderSync::readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, const String& encoding, ExceptionState& es)
+String FileReaderSync::readAsText(ExecutionContext* executionContext, Blob* blob, const String& encoding, ExceptionState& es)
 {
     if (!blob) {
         es.throwDOMException(NotFoundError, FileError::notFoundErrorMessage);
@@ -80,11 +80,11 @@
 
     FileReaderLoader loader(FileReaderLoader::ReadAsText, 0);
     loader.setEncoding(encoding);
-    startLoading(scriptExecutionContext, loader, *blob, es);
+    startLoading(executionContext, loader, *blob, es);
     return loader.stringResult();
 }
 
-String FileReaderSync::readAsDataURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionState& es)
+String FileReaderSync::readAsDataURL(ExecutionContext* executionContext, Blob* blob, ExceptionState& es)
 {
     if (!blob) {
         es.throwDOMException(NotFoundError, FileError::notFoundErrorMessage);
@@ -93,13 +93,13 @@
 
     FileReaderLoader loader(FileReaderLoader::ReadAsDataURL, 0);
     loader.setDataType(blob->type());
-    startLoading(scriptExecutionContext, loader, *blob, es);
+    startLoading(executionContext, loader, *blob, es);
     return loader.stringResult();
 }
 
-void FileReaderSync::startLoading(ScriptExecutionContext* scriptExecutionContext, FileReaderLoader& loader, const Blob& blob, ExceptionState& es)
+void FileReaderSync::startLoading(ExecutionContext* executionContext, FileReaderLoader& loader, const Blob& blob, ExceptionState& es)
 {
-    loader.start(scriptExecutionContext, blob);
+    loader.start(executionContext, blob.blobDataHandle());
     if (loader.errorCode())
         FileError::throwDOMException(es, loader.errorCode());
 }
diff --git a/Source/core/fileapi/FileReaderSync.h b/Source/core/fileapi/FileReaderSync.h
index 122fb75..060633e 100644
--- a/Source/core/fileapi/FileReaderSync.h
+++ b/Source/core/fileapi/FileReaderSync.h
@@ -41,7 +41,7 @@
 class Blob;
 class ExceptionState;
 class FileReaderLoader;
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class FileReaderSync : public RefCounted<FileReaderSync>, public ScriptWrappable {
 public:
@@ -52,19 +52,19 @@
 
     virtual ~FileReaderSync() { }
 
-    PassRefPtr<ArrayBuffer> readAsArrayBuffer(ScriptExecutionContext*, Blob*, ExceptionState&);
-    String readAsBinaryString(ScriptExecutionContext*, Blob*, ExceptionState&);
-    String readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionState& ec)
+    PassRefPtr<ArrayBuffer> readAsArrayBuffer(ExecutionContext*, Blob*, ExceptionState&);
+    String readAsBinaryString(ExecutionContext*, Blob*, ExceptionState&);
+    String readAsText(ExecutionContext* executionContext, Blob* blob, ExceptionState& ec)
     {
-        return readAsText(scriptExecutionContext, blob, "", ec);
+        return readAsText(executionContext, blob, "", ec);
     }
-    String readAsText(ScriptExecutionContext*, Blob*, const String& encoding, ExceptionState&);
-    String readAsDataURL(ScriptExecutionContext*, Blob*, ExceptionState&);
+    String readAsText(ExecutionContext*, Blob*, const String& encoding, ExceptionState&);
+    String readAsDataURL(ExecutionContext*, Blob*, ExceptionState&);
 
 private:
     FileReaderSync();
 
-    void startLoading(ScriptExecutionContext*, FileReaderLoader&, const Blob&, ExceptionState&);
+    void startLoading(ExecutionContext*, FileReaderLoader&, const Blob&, ExceptionState&);
 };
 
 } // namespace WebCore
diff --git a/Source/core/fileapi/FileReaderSync.idl b/Source/core/fileapi/FileReaderSync.idl
index 4930687..125e002 100644
--- a/Source/core/fileapi/FileReaderSync.idl
+++ b/Source/core/fileapi/FileReaderSync.idl
@@ -32,8 +32,8 @@
     GlobalContext=WorkerGlobalScope,
     Constructor
 ] interface FileReaderSync {
-    [CallWith=ScriptExecutionContext, RaisesException] ArrayBuffer readAsArrayBuffer(Blob blob);
-    [CallWith=ScriptExecutionContext, RaisesException] DOMString readAsBinaryString(Blob blob);
-    [CallWith=ScriptExecutionContext, RaisesException] DOMString readAsText(Blob blob, optional DOMString encoding);
-    [CallWith=ScriptExecutionContext, RaisesException] DOMString readAsDataURL(Blob blob);
+    [CallWith=ExecutionContext, RaisesException] ArrayBuffer readAsArrayBuffer(Blob blob);
+    [CallWith=ExecutionContext, RaisesException] DOMString readAsBinaryString(Blob blob);
+    [CallWith=ExecutionContext, RaisesException] DOMString readAsText(Blob blob, optional DOMString encoding);
+    [CallWith=ExecutionContext, RaisesException] DOMString readAsDataURL(Blob blob);
 };
diff --git a/Source/core/fileapi/Stream.cpp b/Source/core/fileapi/Stream.cpp
index da28e23..a9412e2 100644
--- a/Source/core/fileapi/Stream.cpp
+++ b/Source/core/fileapi/Stream.cpp
@@ -45,7 +45,7 @@
 
     // Create a new internal URL for a stream and register it with the provided
     // media type.
-    m_internalURL = BlobURL::createInternalURL();
+    m_internalURL = BlobURL::createInternalStreamURL();
     BlobRegistry::registerStreamURL(m_internalURL, m_mediaType);
 }
 
diff --git a/Source/core/fileapi/Stream.idl b/Source/core/fileapi/Stream.idl
index 6ead757..dd82b76 100644
--- a/Source/core/fileapi/Stream.idl
+++ b/Source/core/fileapi/Stream.idl
@@ -37,7 +37,7 @@
 // FIXME: Make the Blob a subclass of the Stream.
 
 [
-    EnabledAtRuntime=Stream
+    RuntimeEnabled=Stream
 ] interface Stream {
     readonly attribute DOMString type;
 };
diff --git a/Source/core/frame/AbstractView.idl b/Source/core/frame/AbstractView.idl
new file mode 100644
index 0000000..01df15c
--- /dev/null
+++ b/Source/core/frame/AbstractView.idl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * 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,
+ * 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.
+ */
+
+// FIXME: I believe this file is unused.  Window.idl could use it
+// but currently it just defines these interfaces itself.
+
+// Introduced in DOM Level 2:
+[
+
+] interface AbstractView {
+    readonly attribute Document document;
+    readonly attribute StyleMedia styleMedia;
+};
+
diff --git a/Source/core/page/AdjustViewSizeOrNot.h b/Source/core/frame/AdjustViewSizeOrNot.h
similarity index 100%
rename from Source/core/page/AdjustViewSizeOrNot.h
rename to Source/core/frame/AdjustViewSizeOrNot.h
diff --git a/Source/core/frame/BarProp.cpp b/Source/core/frame/BarProp.cpp
new file mode 100644
index 0000000..cc98718
--- /dev/null
+++ b/Source/core/frame/BarProp.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2007, 2010 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.
+ * 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.
+ *
+ * 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/frame/BarProp.h"
+
+#include "core/page/Chrome.h"
+#include "core/frame/Frame.h"
+#include "core/page/Page.h"
+
+namespace WebCore {
+
+BarProp::BarProp(Frame* frame, Type type)
+    : DOMWindowProperty(frame)
+    , m_type(type)
+{
+    ScriptWrappable::init(this);
+}
+
+BarProp::Type BarProp::type() const
+{
+    return m_type;
+}
+
+bool BarProp::visible() const
+{
+    if (!m_frame)
+        return false;
+    Page* page = m_frame->page();
+    if (!page)
+        return false;
+
+    switch (m_type) {
+    case Locationbar:
+    case Personalbar:
+    case Toolbar:
+        return page->chrome().toolbarsVisible();
+    case Menubar:
+        return page->chrome().menubarVisible();
+    case Scrollbars:
+        return page->chrome().scrollbarsVisible();
+    case Statusbar:
+        return page->chrome().statusbarVisible();
+    }
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/BarProp.h b/Source/core/frame/BarProp.h
new file mode 100644
index 0000000..1d188e1
--- /dev/null
+++ b/Source/core/frame/BarProp.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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 BarProp_h
+#define BarProp_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+    class Frame;
+
+    class BarProp : public ScriptWrappable, public RefCounted<BarProp>, public DOMWindowProperty {
+    public:
+        enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar };
+
+        static PassRefPtr<BarProp> create(Frame* frame, Type type) { return adoptRef(new BarProp(frame, type)); }
+
+        Type type() const;
+        bool visible() const;
+
+    private:
+        BarProp(Frame*, Type);
+        Type m_type;
+    };
+
+} // namespace WebCore
+
+#endif // BarProp_h
diff --git a/Source/core/page/BarProp.idl b/Source/core/frame/BarProp.idl
similarity index 100%
rename from Source/core/page/BarProp.idl
rename to Source/core/frame/BarProp.idl
diff --git a/Source/core/frame/Console.cpp b/Source/core/frame/Console.cpp
new file mode 100644
index 0000000..37ca322
--- /dev/null
+++ b/Source/core/frame/Console.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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/frame/Console.h"
+
+#include "bindings/v8/ScriptCallStackFactory.h"
+#include "bindings/v8/ScriptProfiler.h"
+#include "core/frame/ConsoleBase.h"
+#include "core/frame/ConsoleTypes.h"
+#include "core/inspector/ConsoleAPITypes.h"
+#include "core/inspector/InspectorConsoleInstrumentation.h"
+#include "core/inspector/ScriptArguments.h"
+#include "core/inspector/ScriptCallStack.h"
+#include "core/inspector/ScriptProfile.h"
+#include "core/page/Chrome.h"
+#include "core/page/ChromeClient.h"
+#include "core/frame/Frame.h"
+#include "core/page/Page.h"
+#include "core/page/PageConsole.h"
+#include "core/timing/MemoryInfo.h"
+#include "wtf/text/CString.h"
+#include "wtf/text/WTFString.h"
+
+#include "platform/TraceEvent.h"
+
+namespace WebCore {
+
+Console::Console(Frame* frame)
+    : DOMWindowProperty(frame)
+{
+    ScriptWrappable::init(this);
+}
+
+Console::~Console()
+{
+}
+
+ExecutionContext* Console::context()
+{
+    if (!m_frame)
+        return 0;
+    return m_frame->document();
+}
+
+void Console::reportMessageToClient(MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack)
+{
+    String stackTrace;
+    if (m_frame->page()->chrome().client().shouldReportDetailedMessageForSource(callStack->at(0).sourceURL())) {
+        RefPtr<ScriptCallStack> fullStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture);
+        stackTrace = PageConsole::formatStackTraceString(message, fullStack);
+    }
+    m_frame->page()->chrome().client().addMessageToConsole(ConsoleAPIMessageSource, level, message, callStack->at(0).lineNumber(), callStack->at(0).sourceURL(), stackTrace);
+}
+
+bool Console::profilerEnabled()
+{
+    return InspectorInstrumentation::profilerEnabled(m_frame->page());
+}
+
+PassRefPtr<MemoryInfo> Console::memory() const
+{
+    // FIXME: Because we create a new object here each time,
+    // console.memory !== console.memory, which seems wrong.
+    return MemoryInfo::create(m_frame);
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/Console.h b/Source/core/frame/Console.h
new file mode 100644
index 0000000..128bf82
--- /dev/null
+++ b/Source/core/frame/Console.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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 Console_h
+#define Console_h
+
+#include "bindings/v8/ScriptState.h"
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/frame/ConsoleBase.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class Frame;
+class MemoryInfo;
+class Page;
+class ScriptArguments;
+
+class Console : public RefCounted<Console>, public ConsoleBase, public ScriptWrappable, public DOMWindowProperty {
+public:
+    using RefCounted<Console>::ref;
+    using RefCounted<Console>::deref;
+
+    static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Console(frame)); }
+    virtual ~Console();
+
+    PassRefPtr<MemoryInfo> memory() const;
+
+protected:
+    virtual ExecutionContext* context();
+    virtual void reportMessageToClient(MessageLevel, const String& message, PassRefPtr<ScriptCallStack>) OVERRIDE;
+    virtual bool profilerEnabled();
+
+private:
+    explicit Console(Frame*);
+    inline Page* page() const;
+
+    virtual void refConsole() { ref(); }
+    virtual void derefConsole() { deref(); }
+};
+
+} // namespace WebCore
+
+#endif // Console_h
diff --git a/Source/core/page/Console.idl b/Source/core/frame/Console.idl
similarity index 100%
rename from Source/core/page/Console.idl
rename to Source/core/frame/Console.idl
diff --git a/Source/core/frame/ConsoleBase.cpp b/Source/core/frame/ConsoleBase.cpp
new file mode 100644
index 0000000..c367df8
--- /dev/null
+++ b/Source/core/frame/ConsoleBase.cpp
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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/frame/Console.h"
+
+#include "bindings/v8/ScriptCallStackFactory.h"
+#include "bindings/v8/ScriptProfiler.h"
+#include "core/dom/Document.h"
+#include "core/inspector/ConsoleAPITypes.h"
+#include "core/inspector/InspectorConsoleInstrumentation.h"
+#include "core/inspector/ScriptArguments.h"
+#include "core/inspector/ScriptCallStack.h"
+#include "core/inspector/ScriptProfile.h"
+#include "core/frame/ConsoleTypes.h"
+#include "platform/TraceEvent.h"
+#include "wtf/text/CString.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+ConsoleBase::~ConsoleBase()
+{
+}
+
+void ConsoleBase::debug(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    internalAddMessage(LogMessageType, DebugMessageLevel, state, arguments);
+}
+
+void ConsoleBase::error(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    internalAddMessage(LogMessageType, ErrorMessageLevel, state, arguments);
+}
+
+void ConsoleBase::info(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    log(state, arguments);
+}
+
+void ConsoleBase::log(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    internalAddMessage(LogMessageType, LogMessageLevel, state, arguments);
+}
+
+void ConsoleBase::warn(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    internalAddMessage(LogMessageType, WarningMessageLevel, state, arguments);
+}
+
+void ConsoleBase::dir(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    internalAddMessage(DirMessageType, LogMessageLevel, state, arguments);
+}
+
+void ConsoleBase::dirxml(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    internalAddMessage(DirXMLMessageType, LogMessageLevel, state, arguments);
+}
+
+void ConsoleBase::table(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    internalAddMessage(TableMessageType, LogMessageLevel, state, arguments);
+}
+
+void ConsoleBase::clear(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSource, ClearMessageType, LogMessageLevel, String(), state, arguments);
+}
+
+void ConsoleBase::trace(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    internalAddMessage(TraceMessageType, LogMessageLevel, state, arguments, true, true);
+}
+
+void ConsoleBase::assertCondition(ScriptState* state, PassRefPtr<ScriptArguments> arguments, bool condition)
+{
+    if (condition)
+        return;
+
+    internalAddMessage(AssertMessageType, ErrorMessageLevel, state, arguments, true);
+}
+
+void ConsoleBase::count(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    InspectorInstrumentation::consoleCount(context(), state, arguments);
+}
+
+void ConsoleBase::markTimeline(const String& title)
+{
+    InspectorInstrumentation::consoleTimeStamp(context(), title);
+}
+
+void ConsoleBase::profile(ScriptState* state, const String& title)
+{
+    ExecutionContext* context = this->context();
+    if (!context)
+        return;
+
+    // FIXME: log a console message when profiling is disabled.
+    if (!profilerEnabled())
+        return;
+
+    String resolvedTitle = title;
+    if (title.isNull()) // no title so give it the next user initiated profile title.
+        resolvedTitle = InspectorInstrumentation::getCurrentUserInitiatedProfileName(context, true);
+
+    ScriptProfiler::start(resolvedTitle);
+    InspectorInstrumentation::addMessageToConsole(context, ConsoleAPIMessageSource, ProfileMessageType, DebugMessageLevel, resolvedTitle, String(), 0, 0, state);
+}
+
+void ConsoleBase::profileEnd(ScriptState* state, const String& title)
+{
+    ExecutionContext* context = this->context();
+    if (!context)
+        return;
+
+    if (!profilerEnabled())
+        return;
+
+    RefPtr<ScriptProfile> profile = ScriptProfiler::stop(title);
+    if (!profile)
+        return;
+
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(1));
+    InspectorInstrumentation::addProfile(context, profile, callStack);
+}
+
+void ConsoleBase::time(const String& title)
+{
+    InspectorInstrumentation::consoleTime(context(), title);
+    TRACE_EVENT_COPY_ASYNC_BEGIN0("webkit.console", title.utf8().data(), this);
+}
+
+void ConsoleBase::timeEnd(ScriptState* state, const String& title)
+{
+    TRACE_EVENT_COPY_ASYNC_END0("webkit.console", title.utf8().data(), this);
+    InspectorInstrumentation::consoleTimeEnd(context(), title, state);
+}
+
+void ConsoleBase::timeStamp(const String& title)
+{
+    InspectorInstrumentation::consoleTimeStamp(context(), title);
+}
+
+void ConsoleBase::timeline(ScriptState* state, const String& title)
+{
+    InspectorInstrumentation::consoleTimeline(context(), title, state);
+}
+
+void ConsoleBase::timelineEnd(ScriptState* state, const String& title)
+{
+    InspectorInstrumentation::consoleTimelineEnd(context(), title, state);
+}
+
+void ConsoleBase::group(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSource, StartGroupMessageType, LogMessageLevel, String(), state, arguments);
+}
+
+void ConsoleBase::groupCollapsed(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
+{
+    InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSource, StartGroupCollapsedMessageType, LogMessageLevel, String(), state, arguments);
+}
+
+void ConsoleBase::groupEnd()
+{
+    InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSource, EndGroupMessageType, LogMessageLevel, String(), 0);
+}
+
+void ConsoleBase::internalAddMessage(MessageType type, MessageLevel level, ScriptState* state, PassRefPtr<ScriptArguments> scriptArguments, bool acceptNoArguments, bool printTrace)
+{
+    if (!context())
+        return;
+
+    RefPtr<ScriptArguments> arguments = scriptArguments;
+    if (!acceptNoArguments && !arguments->argumentCount())
+        return;
+
+    size_t stackSize = printTrace ? ScriptCallStack::maxCallStackSizeToCapture : 1;
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(stackSize));
+    const ScriptCallFrame& lastCaller = callStack->at(0);
+
+    String message;
+    bool gotStringMessage = arguments->getFirstArgumentAsString(message);
+    InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSource, type, level, message, state, arguments);
+    if (gotStringMessage)
+        reportMessageToClient(level, message, callStack);
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/ConsoleBase.h b/Source/core/frame/ConsoleBase.h
new file mode 100644
index 0000000..37d95ec
--- /dev/null
+++ b/Source/core/frame/ConsoleBase.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2007 Apple 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 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.
+ * 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.
+ *
+ * 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 ConsoleBase_h
+#define ConsoleBase_h
+
+#include "bindings/v8/ScriptState.h"
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/inspector/ConsoleAPITypes.h"
+#include "core/inspector/ScriptCallStack.h"
+#include "core/frame/ConsoleTypes.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class ScriptArguments;
+
+class ConsoleBase {
+public:
+    void ref() { refConsole(); }
+    void deref() { derefConsole(); }
+
+    void debug(ScriptState*, PassRefPtr<ScriptArguments>);
+    void error(ScriptState*, PassRefPtr<ScriptArguments>);
+    void info(ScriptState*, PassRefPtr<ScriptArguments>);
+    void log(ScriptState*, PassRefPtr<ScriptArguments>);
+    void clear(ScriptState*, PassRefPtr<ScriptArguments>);
+    void warn(ScriptState*, PassRefPtr<ScriptArguments>);
+    void dir(ScriptState*, PassRefPtr<ScriptArguments>);
+    void dirxml(ScriptState*, PassRefPtr<ScriptArguments>);
+    void table(ScriptState*, PassRefPtr<ScriptArguments>);
+    void trace(ScriptState*, PassRefPtr<ScriptArguments>);
+    void assertCondition(ScriptState*, PassRefPtr<ScriptArguments>, bool condition);
+    void count(ScriptState*, PassRefPtr<ScriptArguments>);
+    void markTimeline(const String&);
+    void profile(ScriptState*, const String&);
+    void profileEnd(ScriptState*, const String&);
+    void time(const String&);
+    void timeEnd(ScriptState*, const String&);
+    void timeStamp(const String&);
+    void timeline(ScriptState*, const String&);
+    void timelineEnd(ScriptState*, const String&);
+    void group(ScriptState*, PassRefPtr<ScriptArguments>);
+    void groupCollapsed(ScriptState*, PassRefPtr<ScriptArguments>);
+    void groupEnd();
+
+protected:
+    virtual ~ConsoleBase();
+    virtual ExecutionContext* context() = 0;
+    virtual void reportMessageToClient(MessageLevel, const String& message, PassRefPtr<ScriptCallStack>) = 0;
+    virtual bool profilerEnabled() = 0;
+
+private:
+    virtual void refConsole() = 0;
+    virtual void derefConsole() = 0;
+
+    void internalAddMessage(MessageType, MessageLevel, ScriptState*, PassRefPtr<ScriptArguments>, bool acceptNoArguments = false, bool printTrace = false);
+};
+
+} // namespace WebCore
+
+#endif // ConsoleBase_h
diff --git a/Source/core/page/ConsoleBase.idl b/Source/core/frame/ConsoleBase.idl
similarity index 100%
rename from Source/core/page/ConsoleBase.idl
rename to Source/core/frame/ConsoleBase.idl
diff --git a/Source/core/page/ConsoleTypes.h b/Source/core/frame/ConsoleTypes.h
similarity index 100%
rename from Source/core/page/ConsoleTypes.h
rename to Source/core/frame/ConsoleTypes.h
diff --git a/Source/core/frame/ContentSecurityPolicy.cpp b/Source/core/frame/ContentSecurityPolicy.cpp
new file mode 100644
index 0000000..f7cf5ca
--- /dev/null
+++ b/Source/core/frame/ContentSecurityPolicy.cpp
@@ -0,0 +1,1904 @@
+/*
+ * Copyright (C) 2011 Google, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE 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,
+ * 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/frame/ContentSecurityPolicy.h"
+
+#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"
+#include "core/events/SecurityPolicyViolationEvent.h"
+#include "core/frame/ContentSecurityPolicyResponseHeaders.h"
+#include "core/frame/Frame.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/inspector/ScriptCallStack.h"
+#include "core/loader/DocumentLoader.h"
+#include "core/loader/PingLoader.h"
+#include "core/page/UseCounter.h"
+#include "core/platform/ParsingUtilities.h"
+#include "core/platform/network/FormData.h"
+#include "core/platform/network/ResourceResponse.h"
+#include "platform/JSONValues.h"
+#include "weborigin/KURL.h"
+#include "weborigin/KnownPorts.h"
+#include "weborigin/SchemeRegistry.h"
+#include "weborigin/SecurityOrigin.h"
+#include "wtf/HashSet.h"
+#include "wtf/text/TextPosition.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+// Normally WebKit uses "static" for internal linkage, but using "static" for
+// these functions causes a compile error because these functions are used as
+// template parameters.
+namespace {
+
+bool isDirectiveNameCharacter(UChar c)
+{
+    return isASCIIAlphanumeric(c) || c == '-';
+}
+
+bool isDirectiveValueCharacter(UChar c)
+{
+    return isASCIISpace(c) || (c >= 0x21 && c <= 0x7e); // Whitespace + VCHAR
+}
+
+bool isNonceCharacter(UChar c)
+{
+    return isASCIIAlphanumeric(c) || c == '+' || c == '/';
+}
+
+bool isSourceCharacter(UChar c)
+{
+    return !isASCIISpace(c);
+}
+
+bool isPathComponentCharacter(UChar c)
+{
+    return c != '?' && c != '#';
+}
+
+bool isHostCharacter(UChar c)
+{
+    return isASCIIAlphanumeric(c) || c == '-';
+}
+
+bool isSchemeContinuationCharacter(UChar c)
+{
+    return isASCIIAlphanumeric(c) || c == '+' || c == '-' || c == '.';
+}
+
+bool isNotASCIISpace(UChar c)
+{
+    return !isASCIISpace(c);
+}
+
+bool isNotColonOrSlash(UChar c)
+{
+    return c != ':' && c != '/';
+}
+
+bool isMediaTypeCharacter(UChar c)
+{
+    return !isASCIISpace(c) && c != '/';
+}
+
+// CSP 1.0 Directives
+static const char connectSrc[] = "connect-src";
+static const char defaultSrc[] = "default-src";
+static const char fontSrc[] = "font-src";
+static const char frameSrc[] = "frame-src";
+static const char imgSrc[] = "img-src";
+static const char mediaSrc[] = "media-src";
+static const char objectSrc[] = "object-src";
+static const char reportURI[] = "report-uri";
+static const char sandbox[] = "sandbox";
+static const char scriptSrc[] = "script-src";
+static const char styleSrc[] = "style-src";
+
+// CSP 1.1 Directives
+static const char baseURI[] = "base-uri";
+static const char formAction[] = "form-action";
+static const char pluginTypes[] = "plugin-types";
+static const char reflectedXSS[] = "reflected-xss";
+
+bool isDirectiveName(const String& name)
+{
+    return (equalIgnoringCase(name, connectSrc)
+        || equalIgnoringCase(name, defaultSrc)
+        || equalIgnoringCase(name, fontSrc)
+        || equalIgnoringCase(name, frameSrc)
+        || equalIgnoringCase(name, imgSrc)
+        || equalIgnoringCase(name, mediaSrc)
+        || equalIgnoringCase(name, objectSrc)
+        || equalIgnoringCase(name, reportURI)
+        || equalIgnoringCase(name, sandbox)
+        || equalIgnoringCase(name, scriptSrc)
+        || equalIgnoringCase(name, styleSrc)
+        || equalIgnoringCase(name, baseURI)
+        || equalIgnoringCase(name, formAction)
+        || equalIgnoringCase(name, pluginTypes)
+        || equalIgnoringCase(name, reflectedXSS)
+    );
+}
+
+UseCounter::Feature getUseCounterType(ContentSecurityPolicy::HeaderType type)
+{
+    switch (type) {
+    case ContentSecurityPolicy::PrefixedEnforce:
+        return UseCounter::PrefixedContentSecurityPolicy;
+    case ContentSecurityPolicy::Enforce:
+        return UseCounter::ContentSecurityPolicy;
+    case ContentSecurityPolicy::PrefixedReport:
+        return UseCounter::PrefixedContentSecurityPolicyReportOnly;
+    case ContentSecurityPolicy::Report:
+        return UseCounter::ContentSecurityPolicyReportOnly;
+    }
+    ASSERT_NOT_REACHED();
+    return UseCounter::NumberOfFeatures;
+}
+
+} // namespace
+
+static bool isSourceListNone(const UChar* begin, const UChar* end)
+{
+    skipWhile<UChar, isASCIISpace>(begin, end);
+
+    const UChar* position = begin;
+    skipWhile<UChar, isSourceCharacter>(position, end);
+    if (!equalIgnoringCase("'none'", begin, position - begin))
+        return false;
+
+    skipWhile<UChar, isASCIISpace>(position, end);
+    if (position != end)
+        return false;
+
+    return true;
+}
+
+class CSPSource {
+public:
+    CSPSource(ContentSecurityPolicy* policy, const String& scheme, const String& host, int port, const String& path, bool hostHasWildcard, bool portHasWildcard)
+        : m_policy(policy)
+        , m_scheme(scheme)
+        , m_host(host)
+        , m_port(port)
+        , m_path(path)
+        , m_hostHasWildcard(hostHasWildcard)
+        , m_portHasWildcard(portHasWildcard)
+    {
+    }
+
+    bool matches(const KURL& url) const
+    {
+        if (!schemeMatches(url))
+            return false;
+        if (isSchemeOnly())
+            return true;
+        return hostMatches(url) && portMatches(url) && pathMatches(url);
+    }
+
+private:
+    bool schemeMatches(const KURL& url) const
+    {
+        if (m_scheme.isEmpty()) {
+            String protectedResourceScheme(m_policy->securityOrigin()->protocol());
+            if (equalIgnoringCase("http", protectedResourceScheme))
+                return url.protocolIs("http") || url.protocolIs("https");
+            return equalIgnoringCase(url.protocol(), protectedResourceScheme);
+        }
+        return equalIgnoringCase(url.protocol(), m_scheme);
+    }
+
+    bool hostMatches(const KURL& url) const
+    {
+        const String& host = url.host();
+        if (equalIgnoringCase(host, m_host))
+            return true;
+        return m_hostHasWildcard && host.endsWith("." + m_host, false);
+
+    }
+
+    bool pathMatches(const KURL& url) const
+    {
+        if (m_path.isEmpty())
+            return true;
+
+        String path = decodeURLEscapeSequences(url.path());
+
+        if (m_path.endsWith("/"))
+            return path.startsWith(m_path, false);
+
+        return path == m_path;
+    }
+
+    bool portMatches(const KURL& url) const
+    {
+        if (m_portHasWildcard)
+            return true;
+
+        int port = url.port();
+
+        if (port == m_port)
+            return true;
+
+        if (!port)
+            return isDefaultPortForProtocol(m_port, url.protocol());
+
+        if (!m_port)
+            return isDefaultPortForProtocol(port, url.protocol());
+
+        return false;
+    }
+
+    bool isSchemeOnly() const { return m_host.isEmpty(); }
+
+    ContentSecurityPolicy* m_policy;
+    String m_scheme;
+    String m_host;
+    int m_port;
+    String m_path;
+
+    bool m_hostHasWildcard;
+    bool m_portHasWildcard;
+};
+
+class CSPSourceList {
+public:
+    CSPSourceList(ContentSecurityPolicy*, const String& directiveName);
+
+    void parse(const UChar* begin, const UChar* end);
+
+    bool matches(const KURL&);
+    bool allowInline() const { return m_allowInline; }
+    bool allowEval() const { return m_allowEval; }
+    bool allowNonce(const String& nonce) const { return !nonce.isNull() && m_nonces.contains(nonce); }
+
+private:
+    bool parseSource(const UChar* begin, const UChar* end, String& scheme, String& host, int& port, String& path, bool& hostHasWildcard, bool& portHasWildcard);
+    bool parseScheme(const UChar* begin, const UChar* end, String& scheme);
+    bool parseHost(const UChar* begin, const UChar* end, String& host, bool& hostHasWildcard);
+    bool parsePort(const UChar* begin, const UChar* end, int& port, bool& portHasWildcard);
+    bool parsePath(const UChar* begin, const UChar* end, String& path);
+    bool parseNonce(const UChar* begin, const UChar* end, String& nonce);
+
+    void addSourceSelf();
+    void addSourceStar();
+    void addSourceUnsafeInline();
+    void addSourceUnsafeEval();
+    void addSourceNonce(const String& nonce);
+
+    ContentSecurityPolicy* m_policy;
+    Vector<CSPSource> m_list;
+    String m_directiveName;
+    bool m_allowStar;
+    bool m_allowInline;
+    bool m_allowEval;
+    HashSet<String> m_nonces;
+};
+
+CSPSourceList::CSPSourceList(ContentSecurityPolicy* policy, const String& directiveName)
+    : m_policy(policy)
+    , m_directiveName(directiveName)
+    , m_allowStar(false)
+    , m_allowInline(false)
+    , m_allowEval(false)
+{
+}
+
+bool CSPSourceList::matches(const KURL& url)
+{
+    if (m_allowStar)
+        return true;
+
+    KURL effectiveURL = SecurityOrigin::shouldUseInnerURL(url) ? SecurityOrigin::extractInnerURL(url) : url;
+
+    for (size_t i = 0; i < m_list.size(); ++i) {
+        if (m_list[i].matches(effectiveURL))
+            return true;
+    }
+
+    return false;
+}
+
+// source-list       = *WSP [ source *( 1*WSP source ) *WSP ]
+//                   / *WSP "'none'" *WSP
+//
+void CSPSourceList::parse(const UChar* begin, const UChar* end)
+{
+    // We represent 'none' as an empty m_list.
+    if (isSourceListNone(begin, end))
+        return;
+
+    const UChar* position = begin;
+    while (position < end) {
+        skipWhile<UChar, isASCIISpace>(position, end);
+        if (position == end)
+            return;
+
+        const UChar* beginSource = position;
+        skipWhile<UChar, isSourceCharacter>(position, end);
+
+        String scheme, host, path;
+        int port = 0;
+        bool hostHasWildcard = false;
+        bool portHasWildcard = false;
+
+        if (parseSource(beginSource, position, scheme, host, port, path, hostHasWildcard, portHasWildcard)) {
+            // Wildcard hosts and keyword sources ('self', 'unsafe-inline',
+            // etc.) aren't stored in m_list, but as attributes on the source
+            // list itself.
+            if (scheme.isEmpty() && host.isEmpty())
+                continue;
+            if (isDirectiveName(host))
+                m_policy->reportDirectiveAsSourceExpression(m_directiveName, host);
+            m_list.append(CSPSource(m_policy, scheme, host, port, path, hostHasWildcard, portHasWildcard));
+        } else {
+            m_policy->reportInvalidSourceExpression(m_directiveName, String(beginSource, position - beginSource));
+        }
+
+        ASSERT(position == end || isASCIISpace(*position));
+    }
+}
+
+// source            = scheme ":"
+//                   / ( [ scheme "://" ] host [ port ] [ path ] )
+//                   / "'self'"
+bool CSPSourceList::parseSource(const UChar* begin, const UChar* end, String& scheme, String& host, int& port, String& path, bool& hostHasWildcard, bool& portHasWildcard)
+{
+    if (begin == end)
+        return false;
+
+    if (equalIgnoringCase("'none'", begin, end - begin))
+        return false;
+
+    if (end - begin == 1 && *begin == '*') {
+        addSourceStar();
+        return true;
+    }
+
+    if (equalIgnoringCase("'self'", begin, end - begin)) {
+        addSourceSelf();
+        return true;
+    }
+
+    if (equalIgnoringCase("'unsafe-inline'", begin, end - begin)) {
+        addSourceUnsafeInline();
+        return true;
+    }
+
+    if (equalIgnoringCase("'unsafe-eval'", begin, end - begin)) {
+        addSourceUnsafeEval();
+        return true;
+    }
+
+    if (m_policy->experimentalFeaturesEnabled()) {
+        String nonce;
+        if (!parseNonce(begin, end, nonce))
+            return false;
+
+        if (!nonce.isNull()) {
+            addSourceNonce(nonce);
+            return true;
+        }
+    }
+
+    const UChar* position = begin;
+    const UChar* beginHost = begin;
+    const UChar* beginPath = end;
+    const UChar* beginPort = 0;
+
+    skipWhile<UChar, isNotColonOrSlash>(position, end);
+
+    if (position == end) {
+        // host
+        //     ^
+        return parseHost(beginHost, position, host, hostHasWildcard);
+    }
+
+    if (position < end && *position == '/') {
+        // host/path || host/ || /
+        //     ^            ^    ^
+        return parseHost(beginHost, position, host, hostHasWildcard) && parsePath(position, end, path);
+    }
+
+    if (position < end && *position == ':') {
+        if (end - position == 1) {
+            // scheme:
+            //       ^
+            return parseScheme(begin, position, scheme);
+        }
+
+        if (position[1] == '/') {
+            // scheme://host || scheme://
+            //       ^                ^
+            if (!parseScheme(begin, position, scheme)
+                || !skipExactly<UChar>(position, end, ':')
+                || !skipExactly<UChar>(position, end, '/')
+                || !skipExactly<UChar>(position, end, '/'))
+                return false;
+            if (position == end)
+                return true;
+            beginHost = position;
+            skipWhile<UChar, isNotColonOrSlash>(position, end);
+        }
+
+        if (position < end && *position == ':') {
+            // host:port || scheme://host:port
+            //     ^                     ^
+            beginPort = position;
+            skipUntil<UChar>(position, end, '/');
+        }
+    }
+
+    if (position < end && *position == '/') {
+        // scheme://host/path || scheme://host:port/path
+        //              ^                          ^
+        if (position == beginHost)
+            return false;
+        beginPath = position;
+    }
+
+    if (!parseHost(beginHost, beginPort ? beginPort : beginPath, host, hostHasWildcard))
+        return false;
+
+    if (beginPort) {
+        if (!parsePort(beginPort, beginPath, port, portHasWildcard))
+            return false;
+    } else {
+        port = 0;
+    }
+
+    if (beginPath != end) {
+        if (!parsePath(beginPath, end, path))
+            return false;
+    }
+
+    return true;
+}
+
+// nonce-source      = "'nonce-" nonce-value "'"
+// nonce-value       = 1*( ALPHA / DIGIT / "+" / "/" )
+//
+bool CSPSourceList::parseNonce(const UChar* begin, const UChar* end, String& nonce)
+{
+    DEFINE_STATIC_LOCAL(const String, noncePrefix, ("'nonce-"));
+
+    if (!equalIgnoringCase(noncePrefix.characters8(), begin, noncePrefix.length()))
+        return true;
+
+    const UChar* position = begin + noncePrefix.length();
+    const UChar* nonceBegin = position;
+
+    skipWhile<UChar, isNonceCharacter>(position, end);
+    ASSERT(nonceBegin <= position);
+
+    if (((position + 1) != end  && *position != '\'') || !(position - nonceBegin))
+        return false;
+
+    nonce = String(nonceBegin, position - nonceBegin);
+    return true;
+}
+
+//                     ; <scheme> production from RFC 3986
+// scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
+//
+bool CSPSourceList::parseScheme(const UChar* begin, const UChar* end, String& scheme)
+{
+    ASSERT(begin <= end);
+    ASSERT(scheme.isEmpty());
+
+    if (begin == end)
+        return false;
+
+    const UChar* position = begin;
+
+    if (!skipExactly<UChar, isASCIIAlpha>(position, end))
+        return false;
+
+    skipWhile<UChar, isSchemeContinuationCharacter>(position, end);
+
+    if (position != end)
+        return false;
+
+    scheme = String(begin, end - begin);
+    return true;
+}
+
+// host              = [ "*." ] 1*host-char *( "." 1*host-char )
+//                   / "*"
+// host-char         = ALPHA / DIGIT / "-"
+//
+bool CSPSourceList::parseHost(const UChar* begin, const UChar* end, String& host, bool& hostHasWildcard)
+{
+    ASSERT(begin <= end);
+    ASSERT(host.isEmpty());
+    ASSERT(!hostHasWildcard);
+
+    if (begin == end)
+        return false;
+
+    const UChar* position = begin;
+
+    if (skipExactly<UChar>(position, end, '*')) {
+        hostHasWildcard = true;
+
+        if (position == end)
+            return true;
+
+        if (!skipExactly<UChar>(position, end, '.'))
+            return false;
+    }
+
+    const UChar* hostBegin = position;
+
+    while (position < end) {
+        if (!skipExactly<UChar, isHostCharacter>(position, end))
+            return false;
+
+        skipWhile<UChar, isHostCharacter>(position, end);
+
+        if (position < end && !skipExactly<UChar>(position, end, '.'))
+            return false;
+    }
+
+    ASSERT(position == end);
+    host = String(hostBegin, end - hostBegin);
+    return true;
+}
+
+bool CSPSourceList::parsePath(const UChar* begin, const UChar* end, String& path)
+{
+    ASSERT(begin <= end);
+    ASSERT(path.isEmpty());
+
+    const UChar* position = begin;
+    skipWhile<UChar, isPathComponentCharacter>(position, end);
+    // path/to/file.js?query=string || path/to/file.js#anchor
+    //                ^                               ^
+    if (position < end)
+        m_policy->reportInvalidPathCharacter(m_directiveName, String(begin, end - begin), *position);
+
+    path = decodeURLEscapeSequences(String(begin, position - begin));
+
+    ASSERT(position <= end);
+    ASSERT(position == end || (*position == '#' || *position == '?'));
+    return true;
+}
+
+// port              = ":" ( 1*DIGIT / "*" )
+//
+bool CSPSourceList::parsePort(const UChar* begin, const UChar* end, int& port, bool& portHasWildcard)
+{
+    ASSERT(begin <= end);
+    ASSERT(!port);
+    ASSERT(!portHasWildcard);
+
+    if (!skipExactly<UChar>(begin, end, ':'))
+        ASSERT_NOT_REACHED();
+
+    if (begin == end)
+        return false;
+
+    if (end - begin == 1 && *begin == '*') {
+        port = 0;
+        portHasWildcard = true;
+        return true;
+    }
+
+    const UChar* position = begin;
+    skipWhile<UChar, isASCIIDigit>(position, end);
+
+    if (position != end)
+        return false;
+
+    bool ok;
+    port = charactersToIntStrict(begin, end - begin, &ok);
+    return ok;
+}
+
+void CSPSourceList::addSourceSelf()
+{
+    m_list.append(CSPSource(m_policy, m_policy->securityOrigin()->protocol(), m_policy->securityOrigin()->host(), m_policy->securityOrigin()->port(), String(), false, false));
+}
+
+void CSPSourceList::addSourceStar()
+{
+    m_allowStar = true;
+}
+
+void CSPSourceList::addSourceUnsafeInline()
+{
+    m_allowInline = true;
+}
+
+void CSPSourceList::addSourceUnsafeEval()
+{
+    m_allowEval = true;
+}
+
+void CSPSourceList::addSourceNonce(const String& nonce)
+{
+    m_nonces.add(nonce);
+}
+
+class CSPDirective {
+public:
+    CSPDirective(const String& name, const String& value, ContentSecurityPolicy* policy)
+        : m_name(name)
+        , m_text(name + ' ' + value)
+        , m_policy(policy)
+    {
+    }
+
+    const String& text() const { return m_text; }
+
+protected:
+    const ContentSecurityPolicy* policy() const { return m_policy; }
+
+private:
+    String m_name;
+    String m_text;
+    ContentSecurityPolicy* m_policy;
+};
+
+class MediaListDirective : public CSPDirective {
+public:
+    MediaListDirective(const String& name, const String& value, ContentSecurityPolicy* policy)
+        : CSPDirective(name, value, policy)
+    {
+        Vector<UChar> characters;
+        value.appendTo(characters);
+        parse(characters.data(), characters.data() + characters.size());
+    }
+
+    bool allows(const String& type)
+    {
+        return m_pluginTypes.contains(type);
+    }
+
+private:
+    void parse(const UChar* begin, const UChar* end)
+    {
+        const UChar* position = begin;
+
+        // 'plugin-types ____;' OR 'plugin-types;'
+        if (position == end) {
+            policy()->reportInvalidPluginTypes(String());
+            return;
+        }
+
+        while (position < end) {
+            // _____ OR _____mime1/mime1
+            // ^        ^
+            skipWhile<UChar, isASCIISpace>(position, end);
+            if (position == end)
+                return;
+
+            // mime1/mime1 mime2/mime2
+            // ^
+            begin = position;
+            if (!skipExactly<UChar, isMediaTypeCharacter>(position, end)) {
+                skipWhile<UChar, isNotASCIISpace>(position, end);
+                policy()->reportInvalidPluginTypes(String(begin, position - begin));
+                continue;
+            }
+            skipWhile<UChar, isMediaTypeCharacter>(position, end);
+
+            // mime1/mime1 mime2/mime2
+            //      ^
+            if (!skipExactly<UChar>(position, end, '/')) {
+                skipWhile<UChar, isNotASCIISpace>(position, end);
+                policy()->reportInvalidPluginTypes(String(begin, position - begin));
+                continue;
+            }
+
+            // mime1/mime1 mime2/mime2
+            //       ^
+            if (!skipExactly<UChar, isMediaTypeCharacter>(position, end)) {
+                skipWhile<UChar, isNotASCIISpace>(position, end);
+                policy()->reportInvalidPluginTypes(String(begin, position - begin));
+                continue;
+            }
+            skipWhile<UChar, isMediaTypeCharacter>(position, end);
+
+            // mime1/mime1 mime2/mime2 OR mime1/mime1  OR mime1/mime1/error
+            //            ^                          ^               ^
+            if (position < end && isNotASCIISpace(*position)) {
+                skipWhile<UChar, isNotASCIISpace>(position, end);
+                policy()->reportInvalidPluginTypes(String(begin, position - begin));
+                continue;
+            }
+            m_pluginTypes.add(String(begin, position - begin));
+
+            ASSERT(position == end || isASCIISpace(*position));
+        }
+    }
+
+    HashSet<String> m_pluginTypes;
+};
+
+class SourceListDirective : public CSPDirective {
+public:
+    SourceListDirective(const String& name, const String& value, ContentSecurityPolicy* policy)
+        : CSPDirective(name, value, policy)
+        , m_sourceList(policy, name)
+    {
+        Vector<UChar> characters;
+        value.appendTo(characters);
+
+        m_sourceList.parse(characters.data(), characters.data() + characters.size());
+    }
+
+    bool allows(const KURL& url)
+    {
+        return m_sourceList.matches(url.isEmpty() ? policy()->url() : url);
+    }
+
+    bool allowInline() const { return m_sourceList.allowInline(); }
+    bool allowEval() const { return m_sourceList.allowEval(); }
+    bool allowNonce(const String& nonce) const { return m_sourceList.allowNonce(nonce.stripWhiteSpace()); }
+
+private:
+    CSPSourceList m_sourceList;
+};
+
+class CSPDirectiveList {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    static PassOwnPtr<CSPDirectiveList> create(ContentSecurityPolicy*, const UChar* begin, const UChar* end, ContentSecurityPolicy::HeaderType);
+
+    void parse(const UChar* begin, const UChar* end);
+
+    const String& header() const { return m_header; }
+    ContentSecurityPolicy::HeaderType headerType() const { return m_headerType; }
+
+    bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowEval(ScriptState*, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowPluginType(const String& type, const String& typeAttribute, const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+
+    bool allowScriptFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowObjectFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowChildFrameFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowImageFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowStyleFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowFontFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowMediaFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowConnectToSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowFormAction(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowBaseURI(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
+    bool allowScriptNonce(const String&) const;
+    bool allowStyleNonce(const String&) const;
+
+    void gatherReportURIs(DOMStringList&) const;
+    const String& evalDisabledErrorMessage() const { return m_evalDisabledErrorMessage; }
+    ReflectedXSSDisposition reflectedXSSDisposition() const { return m_reflectedXSSDisposition; }
+    bool isReportOnly() const { return m_reportOnly; }
+    const Vector<KURL>& reportURIs() const { return m_reportURIs; }
+
+private:
+    CSPDirectiveList(ContentSecurityPolicy*, ContentSecurityPolicy::HeaderType);
+
+    bool parseDirective(const UChar* begin, const UChar* end, String& name, String& value);
+    void parseReportURI(const String& name, const String& value);
+    void parsePluginTypes(const String& name, const String& value);
+    void parseReflectedXSS(const String& name, const String& value);
+    void addDirective(const String& name, const String& value);
+    void applySandboxPolicy(const String& name, const String& sandboxPolicy);
+
+    template <class CSPDirectiveType>
+    void setCSPDirective(const String& name, const String& value, OwnPtr<CSPDirectiveType>&);
+
+    SourceListDirective* operativeDirective(SourceListDirective*) const;
+    void reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL) const;
+    void reportViolationWithLocation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const String& contextURL, const WTF::OrdinalNumber& contextLine) const;
+    void reportViolationWithState(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, ScriptState*) const;
+
+    bool checkEval(SourceListDirective*) const;
+    bool checkInline(SourceListDirective*) const;
+    bool checkNonce(SourceListDirective*, const String&) const;
+    bool checkSource(SourceListDirective*, const KURL&) const;
+    bool checkMediaType(MediaListDirective*, const String& type, const String& typeAttribute) const;
+
+    void setEvalDisabledErrorMessage(const String& errorMessage) { m_evalDisabledErrorMessage = errorMessage; }
+
+    bool checkEvalAndReportViolation(SourceListDirective*, const String& consoleMessage, ScriptState*) const;
+    bool checkInlineAndReportViolation(SourceListDirective*, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, bool isScript) const;
+
+    bool checkSourceAndReportViolation(SourceListDirective*, const KURL&, const String& effectiveDirective) const;
+    bool checkMediaTypeAndReportViolation(MediaListDirective*, const String& type, const String& typeAttribute, const String& consoleMessage) const;
+
+    bool denyIfEnforcingPolicy() const { return m_reportOnly; }
+
+    ContentSecurityPolicy* m_policy;
+
+    String m_header;
+    ContentSecurityPolicy::HeaderType m_headerType;
+
+    bool m_reportOnly;
+    bool m_haveSandboxPolicy;
+    ReflectedXSSDisposition m_reflectedXSSDisposition;
+
+    OwnPtr<MediaListDirective> m_pluginTypes;
+    OwnPtr<SourceListDirective> m_baseURI;
+    OwnPtr<SourceListDirective> m_connectSrc;
+    OwnPtr<SourceListDirective> m_defaultSrc;
+    OwnPtr<SourceListDirective> m_fontSrc;
+    OwnPtr<SourceListDirective> m_formAction;
+    OwnPtr<SourceListDirective> m_frameSrc;
+    OwnPtr<SourceListDirective> m_imgSrc;
+    OwnPtr<SourceListDirective> m_mediaSrc;
+    OwnPtr<SourceListDirective> m_objectSrc;
+    OwnPtr<SourceListDirective> m_scriptSrc;
+    OwnPtr<SourceListDirective> m_styleSrc;
+
+    Vector<KURL> m_reportURIs;
+
+    String m_evalDisabledErrorMessage;
+};
+
+CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy, ContentSecurityPolicy::HeaderType type)
+    : m_policy(policy)
+    , m_headerType(type)
+    , m_reportOnly(false)
+    , m_haveSandboxPolicy(false)
+    , m_reflectedXSSDisposition(ReflectedXSSUnset)
+{
+    m_reportOnly = (type == ContentSecurityPolicy::Report || type == ContentSecurityPolicy::PrefixedReport);
+}
+
+PassOwnPtr<CSPDirectiveList> CSPDirectiveList::create(ContentSecurityPolicy* policy, const UChar* begin, const UChar* end, ContentSecurityPolicy::HeaderType type)
+{
+    OwnPtr<CSPDirectiveList> directives = adoptPtr(new CSPDirectiveList(policy, type));
+    directives->parse(begin, end);
+
+    if (!directives->checkEval(directives->operativeDirective(directives->m_scriptSrc.get()))) {
+        String message = "Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: \"" + directives->operativeDirective(directives->m_scriptSrc.get())->text() + "\".\n";
+        directives->setEvalDisabledErrorMessage(message);
+    }
+
+    if (directives->isReportOnly() && directives->reportURIs().isEmpty())
+        policy->reportMissingReportURI(String(begin, end - begin));
+
+    return directives.release();
+}
+
+void CSPDirectiveList::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL) const
+{
+    String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleMessage;
+    m_policy->executionContext()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
+    m_policy->reportViolation(directiveText, effectiveDirective, message, blockedURL, m_reportURIs, m_header);
+}
+
+void CSPDirectiveList::reportViolationWithLocation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const String& contextURL, const WTF::OrdinalNumber& contextLine) const
+{
+    String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleMessage;
+    m_policy->executionContext()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, contextURL, contextLine.oneBasedInt());
+    m_policy->reportViolation(directiveText, effectiveDirective, message, blockedURL, m_reportURIs, m_header);
+}
+
+void CSPDirectiveList::reportViolationWithState(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, ScriptState* state) const
+{
+    String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleMessage;
+    m_policy->executionContext()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, state);
+    m_policy->reportViolation(directiveText, effectiveDirective, message, blockedURL, m_reportURIs, m_header);
+}
+
+bool CSPDirectiveList::checkEval(SourceListDirective* directive) const
+{
+    return !directive || directive->allowEval();
+}
+
+bool CSPDirectiveList::checkInline(SourceListDirective* directive) const
+{
+    return !directive || directive->allowInline();
+}
+
+bool CSPDirectiveList::checkNonce(SourceListDirective* directive, const String& nonce) const
+{
+    return !directive || directive->allowNonce(nonce);
+}
+
+bool CSPDirectiveList::checkSource(SourceListDirective* directive, const KURL& url) const
+{
+    return !directive || directive->allows(url);
+}
+
+bool CSPDirectiveList::checkMediaType(MediaListDirective* directive, const String& type, const String& typeAttribute) const
+{
+    if (!directive)
+        return true;
+    if (typeAttribute.isEmpty() || typeAttribute.stripWhiteSpace() != type)
+        return false;
+    return directive->allows(type);
+}
+
+SourceListDirective* CSPDirectiveList::operativeDirective(SourceListDirective* directive) const
+{
+    return directive ? directive : m_defaultSrc.get();
+}
+
+bool CSPDirectiveList::checkEvalAndReportViolation(SourceListDirective* directive, const String& consoleMessage, ScriptState* state) const
+{
+    if (checkEval(directive))
+        return true;
+
+    String suffix = String();
+    if (directive == m_defaultSrc)
+        suffix = " Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.";
+
+    reportViolationWithState(directive->text(), scriptSrc, consoleMessage + "\"" + directive->text() + "\"." + suffix + "\n", KURL(), state);
+    if (!m_reportOnly) {
+        m_policy->reportBlockedScriptExecutionToInspector(directive->text());
+        return false;
+    }
+    return true;
+}
+
+bool CSPDirectiveList::checkMediaTypeAndReportViolation(MediaListDirective* directive, const String& type, const String& typeAttribute, const String& consoleMessage) const
+{
+    if (checkMediaType(directive, type, typeAttribute))
+        return true;
+
+    String message = consoleMessage + "\'" + directive->text() + "\'.";
+    if (typeAttribute.isEmpty())
+        message = message + " When enforcing the 'plugin-types' directive, the plugin's media type must be explicitly declared with a 'type' attribute on the containing element (e.g. '<object type=\"[TYPE GOES HERE]\" ...>').";
+
+    reportViolation(directive->text(), pluginTypes, message + "\n", KURL());
+    return denyIfEnforcingPolicy();
+}
+
+bool CSPDirectiveList::checkInlineAndReportViolation(SourceListDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, bool isScript) const
+{
+    if (checkInline(directive))
+        return true;
+
+    String suffix = String();
+    if (directive == m_defaultSrc)
+        suffix = " Note that '" + String(isScript ? "script" : "style") + "-src' was not explicitly set, so 'default-src' is used as a fallback.";
+
+    reportViolationWithLocation(directive->text(), isScript ? scriptSrc : styleSrc, consoleMessage + "\"" + directive->text() + "\"." + suffix + "\n", KURL(), contextURL, contextLine);
+
+    if (!m_reportOnly) {
+        if (isScript)
+            m_policy->reportBlockedScriptExecutionToInspector(directive->text());
+        return false;
+    }
+    return true;
+}
+
+bool CSPDirectiveList::checkSourceAndReportViolation(SourceListDirective* directive, const KURL& url, const String& effectiveDirective) const
+{
+    if (checkSource(directive, url))
+        return true;
+
+    String prefix;
+    if (baseURI == effectiveDirective)
+        prefix = "Refused to set the document's base URI to '";
+    else if (connectSrc == effectiveDirective)
+        prefix = "Refused to connect to '";
+    else if (fontSrc == effectiveDirective)
+        prefix = "Refused to load the font '";
+    else if (formAction == effectiveDirective)
+        prefix = "Refused to send form data to '";
+    else if (frameSrc == effectiveDirective)
+        prefix = "Refused to frame '";
+    else if (imgSrc == effectiveDirective)
+        prefix = "Refused to load the image '";
+    else if (mediaSrc == effectiveDirective)
+        prefix = "Refused to load media from '";
+    else if (objectSrc == effectiveDirective)
+        prefix = "Refused to load plugin data from '";
+    else if (scriptSrc == effectiveDirective)
+        prefix = "Refused to load the script '";
+    else if (styleSrc == effectiveDirective)
+        prefix = "Refused to load the stylesheet '";
+
+    String suffix = String();
+    if (directive == m_defaultSrc)
+        suffix = " Note that '" + effectiveDirective + "' was not explicitly set, so 'default-src' is used as a fallback.";
+
+    reportViolation(directive->text(), effectiveDirective, prefix + url.elidedString() + "' because it violates the following Content Security Policy directive: \"" + directive->text() + "\"." + suffix + "\n", url);
+    return denyIfEnforcingPolicy();
+}
+
+bool CSPDirectiveList::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute JavaScript URL because it violates the following Content Security Policy directive: "));
+    if (reportingStatus == ContentSecurityPolicy::SendReport)
+        return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true);
+
+    return checkInline(operativeDirective(m_scriptSrc.get()));
+}
+
+bool CSPDirectiveList::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute inline event handler because it violates the following Content Security Policy directive: "));
+    if (reportingStatus == ContentSecurityPolicy::SendReport)
+        return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true);
+    return checkInline(operativeDirective(m_scriptSrc.get()));
+}
+
+bool CSPDirectiveList::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute inline script because it violates the following Content Security Policy directive: "));
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true) :
+        checkInline(operativeDirective(m_scriptSrc.get()));
+}
+
+bool CSPDirectiveList::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to apply inline style because it violates the following Content Security Policy directive: "));
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkInlineAndReportViolation(operativeDirective(m_styleSrc.get()), consoleMessage, contextURL, contextLine, false) :
+        checkInline(operativeDirective(m_styleSrc.get()));
+}
+
+bool CSPDirectiveList::allowEval(ScriptState* state, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "));
+
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkEvalAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, state) :
+        checkEval(operativeDirective(m_scriptSrc.get()));
+}
+
+bool CSPDirectiveList::allowPluginType(const String& type, const String& typeAttribute, const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkMediaTypeAndReportViolation(m_pluginTypes.get(), type, typeAttribute, "Refused to load '" + url.elidedString() + "' (MIME type '" + typeAttribute + "') because it violates the following Content Security Policy Directive: ") :
+        checkMediaType(m_pluginTypes.get(), type, typeAttribute);
+}
+
+bool CSPDirectiveList::allowScriptFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkSourceAndReportViolation(operativeDirective(m_scriptSrc.get()), url, scriptSrc) :
+        checkSource(operativeDirective(m_scriptSrc.get()), url);
+}
+
+bool CSPDirectiveList::allowObjectFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    if (url.isBlankURL())
+        return true;
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkSourceAndReportViolation(operativeDirective(m_objectSrc.get()), url, objectSrc) :
+        checkSource(operativeDirective(m_objectSrc.get()), url);
+}
+
+bool CSPDirectiveList::allowChildFrameFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    if (url.isBlankURL())
+        return true;
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkSourceAndReportViolation(operativeDirective(m_frameSrc.get()), url, frameSrc) :
+        checkSource(operativeDirective(m_frameSrc.get()), url);
+}
+
+bool CSPDirectiveList::allowImageFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkSourceAndReportViolation(operativeDirective(m_imgSrc.get()), url, imgSrc) :
+        checkSource(operativeDirective(m_imgSrc.get()), url);
+}
+
+bool CSPDirectiveList::allowStyleFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkSourceAndReportViolation(operativeDirective(m_styleSrc.get()), url, styleSrc) :
+        checkSource(operativeDirective(m_styleSrc.get()), url);
+}
+
+bool CSPDirectiveList::allowFontFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkSourceAndReportViolation(operativeDirective(m_fontSrc.get()), url, fontSrc) :
+        checkSource(operativeDirective(m_fontSrc.get()), url);
+}
+
+bool CSPDirectiveList::allowMediaFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkSourceAndReportViolation(operativeDirective(m_mediaSrc.get()), url, mediaSrc) :
+        checkSource(operativeDirective(m_mediaSrc.get()), url);
+}
+
+bool CSPDirectiveList::allowConnectToSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkSourceAndReportViolation(operativeDirective(m_connectSrc.get()), url, connectSrc) :
+        checkSource(operativeDirective(m_connectSrc.get()), url);
+}
+
+void CSPDirectiveList::gatherReportURIs(DOMStringList& list) const
+{
+    for (size_t i = 0; i < m_reportURIs.size(); ++i)
+        list.append(m_reportURIs[i].string());
+}
+
+bool CSPDirectiveList::allowFormAction(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkSourceAndReportViolation(m_formAction.get(), url, formAction) :
+        checkSource(m_formAction.get(), url);
+}
+
+bool CSPDirectiveList::allowBaseURI(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return reportingStatus == ContentSecurityPolicy::SendReport ?
+        checkSourceAndReportViolation(m_baseURI.get(), url, baseURI) :
+        checkSource(m_baseURI.get(), url);
+}
+
+bool CSPDirectiveList::allowScriptNonce(const String& nonce) const
+{
+    return checkNonce(operativeDirective(m_scriptSrc.get()), nonce);
+}
+
+bool CSPDirectiveList::allowStyleNonce(const String& nonce) const
+{
+    return checkNonce(operativeDirective(m_styleSrc.get()), nonce);
+}
+
+// policy            = directive-list
+// directive-list    = [ directive *( ";" [ directive ] ) ]
+//
+void CSPDirectiveList::parse(const UChar* begin, const UChar* end)
+{
+    m_header = String(begin, end - begin);
+
+    if (begin == end)
+        return;
+
+    const UChar* position = begin;
+    while (position < end) {
+        const UChar* directiveBegin = position;
+        skipUntil<UChar>(position, end, ';');
+
+        String name, value;
+        if (parseDirective(directiveBegin, position, name, value)) {
+            ASSERT(!name.isEmpty());
+            addDirective(name, value);
+        }
+
+        ASSERT(position == end || *position == ';');
+        skipExactly<UChar>(position, end, ';');
+    }
+}
+
+// directive         = *WSP [ directive-name [ WSP directive-value ] ]
+// directive-name    = 1*( ALPHA / DIGIT / "-" )
+// directive-value   = *( WSP / <VCHAR except ";"> )
+//
+bool CSPDirectiveList::parseDirective(const UChar* begin, const UChar* end, String& name, String& value)
+{
+    ASSERT(name.isEmpty());
+    ASSERT(value.isEmpty());
+
+    const UChar* position = begin;
+    skipWhile<UChar, isASCIISpace>(position, end);
+
+    // Empty directive (e.g. ";;;"). Exit early.
+    if (position == end)
+        return false;
+
+    const UChar* nameBegin = position;
+    skipWhile<UChar, isDirectiveNameCharacter>(position, end);
+
+    // The directive-name must be non-empty.
+    if (nameBegin == position) {
+        skipWhile<UChar, isNotASCIISpace>(position, end);
+        m_policy->reportUnsupportedDirective(String(nameBegin, position - nameBegin));
+        return false;
+    }
+
+    name = String(nameBegin, position - nameBegin);
+
+    if (position == end)
+        return true;
+
+    if (!skipExactly<UChar, isASCIISpace>(position, end)) {
+        skipWhile<UChar, isNotASCIISpace>(position, end);
+        m_policy->reportUnsupportedDirective(String(nameBegin, position - nameBegin));
+        return false;
+    }
+
+    skipWhile<UChar, isASCIISpace>(position, end);
+
+    const UChar* valueBegin = position;
+    skipWhile<UChar, isDirectiveValueCharacter>(position, end);
+
+    if (position != end) {
+        m_policy->reportInvalidDirectiveValueCharacter(name, String(valueBegin, end - valueBegin));
+        return false;
+    }
+
+    // The directive-value may be empty.
+    if (valueBegin == position)
+        return true;
+
+    value = String(valueBegin, position - valueBegin);
+    return true;
+}
+
+void CSPDirectiveList::parseReportURI(const String& name, const String& value)
+{
+    if (!m_reportURIs.isEmpty()) {
+        m_policy->reportDuplicateDirective(name);
+        return;
+    }
+
+    Vector<UChar> characters;
+    value.appendTo(characters);
+
+    const UChar* position = characters.data();
+    const UChar* end = position + characters.size();
+
+    while (position < end) {
+        skipWhile<UChar, isASCIISpace>(position, end);
+
+        const UChar* urlBegin = position;
+        skipWhile<UChar, isNotASCIISpace>(position, end);
+
+        if (urlBegin < position) {
+            String url = String(urlBegin, position - urlBegin);
+            m_reportURIs.append(m_policy->completeURL(url));
+        }
+    }
+}
+
+
+template<class CSPDirectiveType>
+void CSPDirectiveList::setCSPDirective(const String& name, const String& value, OwnPtr<CSPDirectiveType>& directive)
+{
+    if (directive) {
+        m_policy->reportDuplicateDirective(name);
+        return;
+    }
+    directive = adoptPtr(new CSPDirectiveType(name, value, m_policy));
+}
+
+void CSPDirectiveList::applySandboxPolicy(const String& name, const String& sandboxPolicy)
+{
+    if (m_haveSandboxPolicy) {
+        m_policy->reportDuplicateDirective(name);
+        return;
+    }
+    m_haveSandboxPolicy = true;
+    String invalidTokens;
+    m_policy->enforceSandboxFlags(SecurityContext::parseSandboxPolicy(sandboxPolicy, invalidTokens));
+    if (!invalidTokens.isNull())
+        m_policy->reportInvalidSandboxFlags(invalidTokens);
+}
+
+void CSPDirectiveList::parseReflectedXSS(const String& name, const String& value)
+{
+    if (m_reflectedXSSDisposition != ReflectedXSSUnset) {
+        m_policy->reportDuplicateDirective(name);
+        m_reflectedXSSDisposition = ReflectedXSSInvalid;
+        return;
+    }
+
+    if (value.isEmpty()) {
+        m_reflectedXSSDisposition = ReflectedXSSInvalid;
+        m_policy->reportInvalidReflectedXSS(value);
+        return;
+    }
+
+    Vector<UChar> characters;
+    value.appendTo(characters);
+
+    const UChar* position = characters.data();
+    const UChar* end = position + characters.size();
+
+    skipWhile<UChar, isASCIISpace>(position, end);
+    const UChar* begin = position;
+    skipWhile<UChar, isNotASCIISpace>(position, end);
+
+    // value1
+    //       ^
+    if (equalIgnoringCase("allow", begin, position - begin)) {
+        m_reflectedXSSDisposition = AllowReflectedXSS;
+    } else if (equalIgnoringCase("filter", begin, position - begin)) {
+        m_reflectedXSSDisposition = FilterReflectedXSS;
+    } else if (equalIgnoringCase("block", begin, position - begin)) {
+        m_reflectedXSSDisposition = BlockReflectedXSS;
+    } else {
+        m_reflectedXSSDisposition = ReflectedXSSInvalid;
+        m_policy->reportInvalidReflectedXSS(value);
+        return;
+    }
+
+    skipWhile<UChar, isASCIISpace>(position, end);
+    if (position == end && m_reflectedXSSDisposition != ReflectedXSSUnset)
+        return;
+
+    // value1 value2
+    //        ^
+    m_reflectedXSSDisposition = ReflectedXSSInvalid;
+    m_policy->reportInvalidReflectedXSS(value);
+}
+
+void CSPDirectiveList::addDirective(const String& name, const String& value)
+{
+    ASSERT(!name.isEmpty());
+
+    if (equalIgnoringCase(name, defaultSrc)) {
+        setCSPDirective<SourceListDirective>(name, value, m_defaultSrc);
+    } else if (equalIgnoringCase(name, scriptSrc)) {
+        setCSPDirective<SourceListDirective>(name, value, m_scriptSrc);
+    } else if (equalIgnoringCase(name, objectSrc)) {
+        setCSPDirective<SourceListDirective>(name, value, m_objectSrc);
+    } else if (equalIgnoringCase(name, frameSrc)) {
+        setCSPDirective<SourceListDirective>(name, value, m_frameSrc);
+    } else if (equalIgnoringCase(name, imgSrc)) {
+        setCSPDirective<SourceListDirective>(name, value, m_imgSrc);
+    } else if (equalIgnoringCase(name, styleSrc)) {
+        setCSPDirective<SourceListDirective>(name, value, m_styleSrc);
+    } else if (equalIgnoringCase(name, fontSrc)) {
+        setCSPDirective<SourceListDirective>(name, value, m_fontSrc);
+    } else if (equalIgnoringCase(name, mediaSrc)) {
+        setCSPDirective<SourceListDirective>(name, value, m_mediaSrc);
+    } else if (equalIgnoringCase(name, connectSrc)) {
+        setCSPDirective<SourceListDirective>(name, value, m_connectSrc);
+    } else if (equalIgnoringCase(name, sandbox)) {
+        applySandboxPolicy(name, value);
+    } else if (equalIgnoringCase(name, reportURI)) {
+        parseReportURI(name, value);
+    } else if (m_policy->experimentalFeaturesEnabled()) {
+        if (equalIgnoringCase(name, baseURI))
+            setCSPDirective<SourceListDirective>(name, value, m_baseURI);
+        else if (equalIgnoringCase(name, formAction))
+            setCSPDirective<SourceListDirective>(name, value, m_formAction);
+        else if (equalIgnoringCase(name, pluginTypes))
+            setCSPDirective<MediaListDirective>(name, value, m_pluginTypes);
+        else if (equalIgnoringCase(name, reflectedXSS))
+            parseReflectedXSS(name, value);
+        else
+            m_policy->reportUnsupportedDirective(name);
+    } else {
+        m_policy->reportUnsupportedDirective(name);
+    }
+}
+
+ContentSecurityPolicy::ContentSecurityPolicy(ExecutionContext* executionContext)
+    : m_executionContext(executionContext)
+    , m_overrideInlineStyleAllowed(false)
+{
+}
+
+ContentSecurityPolicy::~ContentSecurityPolicy()
+{
+}
+
+void ContentSecurityPolicy::copyStateFrom(const ContentSecurityPolicy* other)
+{
+    ASSERT(m_policies.isEmpty());
+    for (CSPDirectiveListVector::const_iterator iter = other->m_policies.begin(); iter != other->m_policies.end(); ++iter)
+        addPolicyFromHeaderValue((*iter)->header(), (*iter)->headerType());
+}
+
+void ContentSecurityPolicy::didReceiveHeaders(const ContentSecurityPolicyResponseHeaders& headers)
+{
+    if (!headers.contentSecurityPolicy().isEmpty())
+        didReceiveHeader(headers.contentSecurityPolicy(), ContentSecurityPolicy::Enforce);
+    if (!headers.contentSecurityPolicyReportOnly().isEmpty())
+        didReceiveHeader(headers.contentSecurityPolicyReportOnly(), ContentSecurityPolicy::Report);
+    if (!headers.xWebKitCSP().isEmpty())
+        didReceiveHeader(headers.xWebKitCSP(), ContentSecurityPolicy::PrefixedEnforce);
+    if (!headers.xWebKitCSPReportOnly().isEmpty())
+        didReceiveHeader(headers.xWebKitCSPReportOnly(), ContentSecurityPolicy::PrefixedReport);
+}
+
+void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType type)
+{
+    addPolicyFromHeaderValue(header, type);
+}
+
+void ContentSecurityPolicy::addPolicyFromHeaderValue(const String& header, HeaderType type)
+{
+    if (m_executionContext->isDocument()) {
+        Document* document = toDocument(m_executionContext);
+        if (type == PrefixedReport || type == PrefixedEnforce)
+            UseCounter::countDeprecation(*document, getUseCounterType(type));
+        else
+            UseCounter::count(*document, getUseCounterType(type));
+    }
+
+    Vector<UChar> characters;
+    header.appendTo(characters);
+
+    const UChar* begin = characters.data();
+    const UChar* end = begin + characters.size();
+
+    // RFC2616, section 4.2 specifies that headers appearing multiple times can
+    // be combined with a comma. Walk the header string, and parse each comma
+    // separated chunk as a separate header.
+    const UChar* position = begin;
+    while (position < end) {
+        skipUntil<UChar>(position, end, ',');
+
+        // header1,header2 OR header1
+        //        ^                  ^
+        OwnPtr<CSPDirectiveList> policy = CSPDirectiveList::create(this, begin, position, type);
+
+        // We disable 'eval()' even in the case of report-only policies, and rely on the check in the V8Initializer::codeGenerationCheckCallbackInMainThread callback to determine whether the call should execute or not.
+        if (!policy->allowEval(0, SuppressReport))
+            m_executionContext->disableEval(policy->evalDisabledErrorMessage());
+
+        m_policies.append(policy.release());
+
+        // Skip the comma, and begin the next header from the current position.
+        ASSERT(position == end || *position == ',');
+        skipExactly<UChar>(position, end, ',');
+        begin = position;
+    }
+}
+
+void ContentSecurityPolicy::setOverrideAllowInlineStyle(bool value)
+{
+    m_overrideInlineStyleAllowed = value;
+}
+
+const String& ContentSecurityPolicy::deprecatedHeader() const
+{
+    return m_policies.isEmpty() ? emptyString() : m_policies[0]->header();
+}
+
+ContentSecurityPolicy::HeaderType ContentSecurityPolicy::deprecatedHeaderType() const
+{
+    return m_policies.isEmpty() ? Enforce : m_policies[0]->headerType();
+}
+
+template<bool (CSPDirectiveList::*allowed)(ContentSecurityPolicy::ReportingStatus) const>
+bool isAllowedByAll(const CSPDirectiveListVector& policies, ContentSecurityPolicy::ReportingStatus reportingStatus)
+{
+    for (size_t i = 0; i < policies.size(); ++i) {
+        if (!(policies[i].get()->*allowed)(reportingStatus))
+            return false;
+    }
+    return true;
+}
+
+template<bool (CSPDirectiveList::*allowed)(ScriptState* state, ContentSecurityPolicy::ReportingStatus) const>
+bool isAllowedByAllWithState(const CSPDirectiveListVector& policies, ScriptState* state, ContentSecurityPolicy::ReportingStatus reportingStatus)
+{
+    for (size_t i = 0; i < policies.size(); ++i) {
+        if (!(policies[i].get()->*allowed)(state, reportingStatus))
+            return false;
+    }
+    return true;
+}
+
+template<bool (CSPDirectiveList::*allowed)(const String&, const WTF::OrdinalNumber&, ContentSecurityPolicy::ReportingStatus) const>
+bool isAllowedByAllWithContext(const CSPDirectiveListVector& policies, const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus)
+{
+    for (size_t i = 0; i < policies.size(); ++i) {
+        if (!(policies[i].get()->*allowed)(contextURL, contextLine, reportingStatus))
+            return false;
+    }
+    return true;
+}
+
+template<bool (CSPDirectiveList::*allowed)(const String&) const>
+bool isAllowedByAllWithNonce(const CSPDirectiveListVector& policies, const String& nonce)
+{
+    for (size_t i = 0; i < policies.size(); ++i) {
+        if (!(policies[i].get()->*allowed)(nonce))
+            return false;
+    }
+    return true;
+}
+template<bool (CSPDirectiveList::*allowFromURL)(const KURL&, ContentSecurityPolicy::ReportingStatus) const>
+bool isAllowedByAllWithURL(const CSPDirectiveListVector& policies, const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus)
+{
+    if (SchemeRegistry::schemeShouldBypassContentSecurityPolicy(url.protocol()))
+        return true;
+
+    for (size_t i = 0; i < policies.size(); ++i) {
+        if (!(policies[i].get()->*allowFromURL)(url, reportingStatus))
+            return false;
+    }
+    return true;
+}
+
+bool ContentSecurityPolicy::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithContext<&CSPDirectiveList::allowJavaScriptURLs>(m_policies, contextURL, contextLine, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineEventHandlers>(m_policies, contextURL, contextLine, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineScript>(m_policies, contextURL, contextLine, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    if (m_overrideInlineStyleAllowed)
+        return true;
+    return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineStyle>(m_policies, contextURL, contextLine, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowEval(ScriptState* state, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithState<&CSPDirectiveList::allowEval>(m_policies, state, reportingStatus);
+}
+
+String ContentSecurityPolicy::evalDisabledErrorMessage() const
+{
+    for (size_t i = 0; i < m_policies.size(); ++i) {
+        if (!m_policies[i]->allowEval(0, SuppressReport))
+            return m_policies[i]->evalDisabledErrorMessage();
+    }
+    return String();
+}
+
+bool ContentSecurityPolicy::allowPluginType(const String& type, const String& typeAttribute, const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    for (size_t i = 0; i < m_policies.size(); ++i) {
+        if (!m_policies[i]->allowPluginType(type, typeAttribute, url, reportingStatus))
+            return false;
+    }
+    return true;
+}
+
+bool ContentSecurityPolicy::allowScriptFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithURL<&CSPDirectiveList::allowScriptFromSource>(m_policies, url, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowScriptNonce(const String& nonce) const
+{
+    return isAllowedByAllWithNonce<&CSPDirectiveList::allowScriptNonce>(m_policies, nonce);
+}
+
+bool ContentSecurityPolicy::allowStyleNonce(const String& nonce) const
+{
+    return isAllowedByAllWithNonce<&CSPDirectiveList::allowStyleNonce>(m_policies, nonce);
+}
+
+bool ContentSecurityPolicy::allowObjectFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithURL<&CSPDirectiveList::allowObjectFromSource>(m_policies, url, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowChildFrameFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithURL<&CSPDirectiveList::allowChildFrameFromSource>(m_policies, url, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowImageFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithURL<&CSPDirectiveList::allowImageFromSource>(m_policies, url, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowStyleFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithURL<&CSPDirectiveList::allowStyleFromSource>(m_policies, url, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowFontFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithURL<&CSPDirectiveList::allowFontFromSource>(m_policies, url, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowMediaFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithURL<&CSPDirectiveList::allowMediaFromSource>(m_policies, url, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowConnectToSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithURL<&CSPDirectiveList::allowConnectToSource>(m_policies, url, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowFormAction(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithURL<&CSPDirectiveList::allowFormAction>(m_policies, url, reportingStatus);
+}
+
+bool ContentSecurityPolicy::allowBaseURI(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
+{
+    return isAllowedByAllWithURL<&CSPDirectiveList::allowBaseURI>(m_policies, url, reportingStatus);
+}
+
+bool ContentSecurityPolicy::isActive() const
+{
+    return !m_policies.isEmpty();
+}
+
+ReflectedXSSDisposition ContentSecurityPolicy::reflectedXSSDisposition() const
+{
+    ReflectedXSSDisposition disposition = ReflectedXSSUnset;
+    for (size_t i = 0; i < m_policies.size(); ++i) {
+        if (m_policies[i]->reflectedXSSDisposition() > disposition)
+            disposition = std::max(disposition, m_policies[i]->reflectedXSSDisposition());
+    }
+    return disposition;
+}
+
+void ContentSecurityPolicy::gatherReportURIs(DOMStringList& list) const
+{
+    for (size_t i = 0; i < m_policies.size(); ++i)
+        m_policies[i]->gatherReportURIs(list);
+}
+
+SecurityOrigin* ContentSecurityPolicy::securityOrigin() const
+{
+    return m_executionContext->securityOrigin();
+}
+
+const KURL& ContentSecurityPolicy::url() const
+{
+    return m_executionContext->url();
+}
+
+KURL ContentSecurityPolicy::completeURL(const String& url) const
+{
+    return m_executionContext->completeURL(url);
+}
+
+void ContentSecurityPolicy::enforceSandboxFlags(SandboxFlags mask) const
+{
+    m_executionContext->enforceSandboxFlags(mask);
+}
+
+static String stripURLForUseInReport(Document* document, const KURL& url)
+{
+    if (!url.isValid())
+        return String();
+    if (!url.isHierarchical() || url.protocolIs("file"))
+        return url.protocol();
+    return document->securityOrigin()->canRequest(url) ? url.strippedForUseAsReferrer() : SecurityOrigin::create(url)->toString();
+}
+
+static void gatherSecurityPolicyViolationEventData(SecurityPolicyViolationEventInit& init, Document* document, const String& directiveText, const String& effectiveDirective, const KURL& blockedURL, const String& header)
+{
+    init.documentURI = document->url().string();
+    init.referrer = document->referrer();
+    init.blockedURI = stripURLForUseInReport(document, blockedURL);
+    init.violatedDirective = directiveText;
+    init.effectiveDirective = effectiveDirective;
+    init.originalPolicy = header;
+    init.sourceFile = String();
+    init.lineNumber = 0;
+    init.columnNumber = 0;
+    init.statusCode = 0;
+
+    if (!SecurityOrigin::isSecure(document->url()) && document->loader())
+        init.statusCode = document->loader()->response().httpStatusCode();
+
+    RefPtr<ScriptCallStack> stack = createScriptCallStack(1, false);
+    if (!stack)
+        return;
+
+    const ScriptCallFrame& callFrame = stack->at(0);
+
+    if (callFrame.lineNumber()) {
+        KURL source = KURL(ParsedURLString, callFrame.sourceURL());
+        init.sourceFile = stripURLForUseInReport(document, source);
+        init.lineNumber = callFrame.lineNumber();
+        init.columnNumber = callFrame.columnNumber();
+    }
+}
+
+void ContentSecurityPolicy::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header)
+{
+    // FIXME: Support sending reports from worker.
+    if (!m_executionContext->isDocument())
+        return;
+
+    Document* document = toDocument(m_executionContext);
+    Frame* frame = document->frame();
+    if (!frame)
+        return;
+
+    SecurityPolicyViolationEventInit violationData;
+    gatherSecurityPolicyViolationEventData(violationData, document, directiveText, effectiveDirective, blockedURL, header);
+
+    if (experimentalFeaturesEnabled())
+        document->enqueueDocumentEvent(SecurityPolicyViolationEvent::create(EventTypeNames::securitypolicyviolation, violationData));
+
+    if (reportURIs.isEmpty())
+        return;
+
+    // We need to be careful here when deciding what information to send to the
+    // report-uri. Currently, we send only the current document's URL and the
+    // directive that was violated. The document's URL is safe to send because
+    // it's the document itself that's requesting that it be sent. You could
+    // make an argument that we shouldn't send HTTPS document URLs to HTTP
+    // report-uris (for the same reasons that we supress the Referer in that
+    // case), but the Referer is sent implicitly whereas this request is only
+    // sent explicitly. As for which directive was violated, that's pretty
+    // harmless information.
+
+    RefPtr<JSONObject> cspReport = JSONObject::create();
+    cspReport->setString("document-uri", violationData.documentURI);
+    cspReport->setString("referrer", violationData.referrer);
+    cspReport->setString("violated-directive", violationData.violatedDirective);
+    if (experimentalFeaturesEnabled())
+        cspReport->setString("effective-directive", violationData.effectiveDirective);
+    cspReport->setString("original-policy", violationData.originalPolicy);
+    cspReport->setString("blocked-uri", violationData.blockedURI);
+    if (!violationData.sourceFile.isEmpty() && violationData.lineNumber) {
+        cspReport->setString("source-file", violationData.sourceFile);
+        cspReport->setNumber("line-number", violationData.lineNumber);
+        cspReport->setNumber("column-number", violationData.columnNumber);
+    }
+    cspReport->setNumber("status-code", violationData.statusCode);
+
+    RefPtr<JSONObject> reportObject = JSONObject::create();
+    reportObject->setObject("csp-report", cspReport.release());
+    String stringifiedReport = reportObject->toJSONString();
+
+    if (!shouldSendViolationReport(stringifiedReport))
+        return;
+
+    RefPtr<FormData> report = FormData::create(stringifiedReport.utf8());
+
+    for (size_t i = 0; i < reportURIs.size(); ++i)
+        PingLoader::sendViolationReport(frame, reportURIs[i], report, PingLoader::ContentSecurityPolicyViolationReport);
+
+    didSendViolationReport(stringifiedReport);
+}
+
+void ContentSecurityPolicy::reportUnsupportedDirective(const String& name) const
+{
+    DEFINE_STATIC_LOCAL(String, allow, ("allow"));
+    DEFINE_STATIC_LOCAL(String, options, ("options"));
+    DEFINE_STATIC_LOCAL(String, policyURI, ("policy-uri"));
+    DEFINE_STATIC_LOCAL(String, allowMessage, ("The 'allow' directive has been replaced with 'default-src'. Please use that directive instead, as 'allow' has no effect."));
+    DEFINE_STATIC_LOCAL(String, optionsMessage, ("The 'options' directive has been replaced with 'unsafe-inline' and 'unsafe-eval' source expressions for the 'script-src' and 'style-src' directives. Please use those directives instead, as 'options' has no effect."));
+    DEFINE_STATIC_LOCAL(String, policyURIMessage, ("The 'policy-uri' directive has been removed from the specification. Please specify a complete policy via the Content-Security-Policy header."));
+
+    String message = "Unrecognized Content-Security-Policy directive '" + name + "'.\n";
+    if (equalIgnoringCase(name, allow))
+        message = allowMessage;
+    else if (equalIgnoringCase(name, options))
+        message = optionsMessage;
+    else if (equalIgnoringCase(name, policyURI))
+        message = policyURIMessage;
+
+    logToConsole(message);
+}
+
+void ContentSecurityPolicy::reportDirectiveAsSourceExpression(const String& directiveName, const String& sourceExpression) const
+{
+    String message = "The Content Security Policy directive '" + directiveName + "' contains '" + sourceExpression + "' as a source expression. Did you mean '" + directiveName + " ...; " + sourceExpression + "...' (note the semicolon)?";
+    logToConsole(message);
+}
+
+void ContentSecurityPolicy::reportDuplicateDirective(const String& name) const
+{
+    String message = "Ignoring duplicate Content-Security-Policy directive '" + name + "'.\n";
+    logToConsole(message);
+}
+
+void ContentSecurityPolicy::reportInvalidPluginTypes(const String& pluginType) const
+{
+    String message;
+    if (pluginType.isNull())
+        message = "'plugin-types' Content Security Policy directive is empty; all plugins will be blocked.\n";
+    else
+        message = "Invalid plugin type in 'plugin-types' Content Security Policy directive: '" + pluginType + "'.\n";
+    logToConsole(message);
+}
+
+void ContentSecurityPolicy::reportInvalidSandboxFlags(const String& invalidFlags) const
+{
+    logToConsole("Error while parsing the 'sandbox' Content Security Policy directive: " + invalidFlags);
+}
+
+void ContentSecurityPolicy::reportInvalidReflectedXSS(const String& invalidValue) const
+{
+    logToConsole("The 'reflected-xss' Content Security Policy directive has the invalid value \"" + invalidValue + "\". Valid values are \"allow\", \"filter\", and \"block\".");
+}
+
+void ContentSecurityPolicy::reportInvalidDirectiveValueCharacter(const String& directiveName, const String& value) const
+{
+    String message = "The value for Content Security Policy directive '" + directiveName + "' contains an invalid character: '" + value + "'. Non-whitespace characters outside ASCII 0x21-0x7E must be percent-encoded, as described in RFC 3986, section 2.1: http://tools.ietf.org/html/rfc3986#section-2.1.";
+    logToConsole(message);
+}
+
+void ContentSecurityPolicy::reportInvalidPathCharacter(const String& directiveName, const String& value, const char invalidChar) const
+{
+    ASSERT(invalidChar == '#' || invalidChar == '?');
+
+    String ignoring = "The fragment identifier, including the '#', will be ignored.";
+    if (invalidChar == '?')
+        ignoring = "The query component, including the '?', will be ignored.";
+    String message = "The source list for Content Security Policy directive '" + directiveName + "' contains a source with an invalid path: '" + value + "'. " + ignoring;
+    logToConsole(message);
+}
+
+void ContentSecurityPolicy::reportInvalidNonce(const String& nonce) const
+{
+    String message = "Ignoring invalid Content Security Policy script nonce: '" + nonce + "'.\n";
+    logToConsole(message);
+}
+
+void ContentSecurityPolicy::reportInvalidSourceExpression(const String& directiveName, const String& source) const
+{
+    String message = "The source list for Content Security Policy directive '" + directiveName + "' contains an invalid source: '" + source + "'. It will be ignored.";
+    if (equalIgnoringCase(source, "'none'"))
+        message = message + " Note that 'none' has no effect unless it is the only expression in the source list.";
+    logToConsole(message);
+}
+
+void ContentSecurityPolicy::reportMissingReportURI(const String& policy) const
+{
+    logToConsole("The Content Security Policy '" + policy + "' was delivered in report-only mode, but does not specify a 'report-uri'; the policy will have no effect. Please either add a 'report-uri' directive, or deliver the policy via the 'Content-Security-Policy' header.");
+}
+
+void ContentSecurityPolicy::logToConsole(const String& message) const
+{
+    m_executionContext->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
+}
+
+void ContentSecurityPolicy::reportBlockedScriptExecutionToInspector(const String& directiveText) const
+{
+    InspectorInstrumentation::scriptExecutionBlockedByCSP(m_executionContext, directiveText);
+}
+
+bool ContentSecurityPolicy::experimentalFeaturesEnabled() const
+{
+    return RuntimeEnabledFeatures::experimentalContentSecurityPolicyFeaturesEnabled();
+}
+
+bool ContentSecurityPolicy::shouldBypassMainWorld(ExecutionContext* context)
+{
+    if (context && context->isDocument()) {
+        Document* document = toDocument(context);
+        if (document->frame())
+            return document->frame()->script()->shouldBypassMainWorldContentSecurityPolicy();
+    }
+    return false;
+}
+
+bool ContentSecurityPolicy::shouldSendViolationReport(const String& report) const
+{
+    // Collisions have no security impact, so we can save space by storing only the string's hash rather than the whole report.
+    return !m_violationReportsSent.contains(report.impl()->hash());
+}
+
+void ContentSecurityPolicy::didSendViolationReport(const String& report)
+{
+    m_violationReportsSent.add(report.impl()->hash());
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/ContentSecurityPolicy.h b/Source/core/frame/ContentSecurityPolicy.h
new file mode 100644
index 0000000..927d853
--- /dev/null
+++ b/Source/core/frame/ContentSecurityPolicy.h
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2011 Google, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE 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,
+ * 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 ContentSecurityPolicy_h
+#define ContentSecurityPolicy_h
+
+#include "bindings/v8/ScriptState.h"
+#include "platform/network/HTTPParsers.h"
+#include "wtf/HashSet.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/StringHash.h"
+#include "wtf/text/TextPosition.h"
+#include "wtf/text/WTFString.h"
+
+namespace WTF {
+class OrdinalNumber;
+}
+
+namespace WebCore {
+
+class ContentSecurityPolicyResponseHeaders;
+class CSPDirectiveList;
+class DOMStringList;
+class JSONObject;
+class KURL;
+class ExecutionContext;
+class SecurityOrigin;
+
+typedef int SandboxFlags;
+typedef Vector<OwnPtr<CSPDirectiveList> > CSPDirectiveListVector;
+
+class ContentSecurityPolicy {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    static PassOwnPtr<ContentSecurityPolicy> create(ExecutionContext* executionContext)
+    {
+        return adoptPtr(new ContentSecurityPolicy(executionContext));
+    }
+    ~ContentSecurityPolicy();
+
+    void copyStateFrom(const ContentSecurityPolicy*);
+
+    enum HeaderType {
+        Report,
+        Enforce,
+        PrefixedReport,
+        PrefixedEnforce
+    };
+
+    enum ReportingStatus {
+        SendReport,
+        SuppressReport
+    };
+
+    void didReceiveHeaders(const ContentSecurityPolicyResponseHeaders&);
+    void didReceiveHeader(const String&, HeaderType);
+
+    // These functions are wrong because they assume that there is only one header.
+    // FIXME: Replace them with functions that return vectors.
+    const String& deprecatedHeader() const;
+    HeaderType deprecatedHeaderType() const;
+
+    bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const;
+    bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const;
+    bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const;
+    bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const;
+    bool allowEval(ScriptState* = 0, ReportingStatus = SendReport) const;
+    bool allowPluginType(const String& type, const String& typeAttribute, const KURL&, ReportingStatus = SendReport) const;
+
+    bool allowScriptFromSource(const KURL&, ReportingStatus = SendReport) const;
+    bool allowObjectFromSource(const KURL&, ReportingStatus = SendReport) const;
+    bool allowChildFrameFromSource(const KURL&, ReportingStatus = SendReport) const;
+    bool allowImageFromSource(const KURL&, ReportingStatus = SendReport) const;
+    bool allowStyleFromSource(const KURL&, ReportingStatus = SendReport) const;
+    bool allowFontFromSource(const KURL&, ReportingStatus = SendReport) const;
+    bool allowMediaFromSource(const KURL&, ReportingStatus = SendReport) const;
+    bool allowConnectToSource(const KURL&, ReportingStatus = SendReport) const;
+    bool allowFormAction(const KURL&, ReportingStatus = SendReport) const;
+    bool allowBaseURI(const KURL&, ReportingStatus = SendReport) const;
+    bool allowScriptNonce(const String& nonce) const;
+    bool allowStyleNonce(const String& nonce) const;
+
+    ReflectedXSSDisposition reflectedXSSDisposition() const;
+
+    void setOverrideAllowInlineStyle(bool);
+
+    bool isActive() const;
+    void gatherReportURIs(DOMStringList&) const;
+
+    void reportDirectiveAsSourceExpression(const String& directiveName, const String& sourceExpression) const;
+    void reportDuplicateDirective(const String&) const;
+    void reportInvalidDirectiveValueCharacter(const String& directiveName, const String& value) const;
+    void reportInvalidPathCharacter(const String& directiveName, const String& value, const char) const;
+    void reportInvalidNonce(const String&) const;
+    void reportInvalidPluginTypes(const String&) const;
+    void reportInvalidSandboxFlags(const String&) const;
+    void reportInvalidSourceExpression(const String& directiveName, const String& source) const;
+    void reportInvalidReflectedXSS(const String&) const;
+    void reportMissingReportURI(const String&) const;
+    void reportUnsupportedDirective(const String&) const;
+    void reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header);
+
+    void reportBlockedScriptExecutionToInspector(const String& directiveText) const;
+
+    const KURL& url() const;
+    KURL completeURL(const String&) const;
+    SecurityOrigin* securityOrigin() const;
+    void enforceSandboxFlags(SandboxFlags) const;
+    String evalDisabledErrorMessage() const;
+
+    bool experimentalFeaturesEnabled() const;
+
+    static bool shouldBypassMainWorld(ExecutionContext*);
+
+    ExecutionContext* executionContext() { return m_executionContext; }
+
+private:
+    explicit ContentSecurityPolicy(ExecutionContext*);
+
+    void logToConsole(const String& message) const;
+    void addPolicyFromHeaderValue(const String&, HeaderType);
+
+    bool shouldSendViolationReport(const String&) const;
+    void didSendViolationReport(const String&);
+
+    ExecutionContext* m_executionContext;
+    bool m_overrideInlineStyleAllowed;
+    CSPDirectiveListVector m_policies;
+
+    HashSet<unsigned, AlreadyHashed> m_violationReportsSent;
+};
+
+}
+
+#endif
diff --git a/Source/core/frame/ContentSecurityPolicyResponseHeaders.cpp b/Source/core/frame/ContentSecurityPolicyResponseHeaders.cpp
new file mode 100644
index 0000000..507a494
--- /dev/null
+++ b/Source/core/frame/ContentSecurityPolicyResponseHeaders.cpp
@@ -0,0 +1,42 @@
+/*
+ * 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:
+ * 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 GOOGLE 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,
+ * 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/frame/ContentSecurityPolicyResponseHeaders.h"
+
+#include "core/platform/network/ResourceResponse.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders(const ResourceResponse& response)
+    : m_contentSecurityPolicy(response.httpHeaderField("Content-Security-Policy"))
+    , m_contentSecurityPolicyReportOnly(response.httpHeaderField("Content-Security-Policy-Report-Only"))
+    , m_xWebKitCSP(response.httpHeaderField("X-WebKit-CSP"))
+    , m_xWebKitCSPReportOnly(response.httpHeaderField("X-WebKit-CSP-Report-Only"))
+{
+}
+
+}
diff --git a/Source/core/page/ContentSecurityPolicyResponseHeaders.h b/Source/core/frame/ContentSecurityPolicyResponseHeaders.h
similarity index 100%
rename from Source/core/page/ContentSecurityPolicyResponseHeaders.h
rename to Source/core/frame/ContentSecurityPolicyResponseHeaders.h
diff --git a/Source/core/frame/DOMPoint.h b/Source/core/frame/DOMPoint.h
new file mode 100644
index 0000000..ae8478b
--- /dev/null
+++ b/Source/core/frame/DOMPoint.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2009 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,
+ * 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 DOMPoint_h
+#define DOMPoint_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class DOMPoint : public RefCounted<DOMPoint>, public ScriptWrappable {
+public:
+    static PassRefPtr<DOMPoint> create()
+    {
+        return adoptRef(new DOMPoint());
+    }
+    static PassRefPtr<DOMPoint> create(float x, float y)
+    {
+        return adoptRef(new DOMPoint(x, y));
+    }
+
+    float x() const { return m_x; }
+    float y() const { return m_y; }
+
+    void setX(float x) { m_x = x; }
+    void setY(float y) { m_y = y; }
+
+private:
+    DOMPoint(float x = 0, float y = 0)
+        : m_x(x)
+        , m_y(y)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    float m_x;
+    float m_y;
+};
+
+} // namespace WebCore
+
+#endif // DOMPoint_h
diff --git a/Source/core/frame/DOMSecurityPolicy.cpp b/Source/core/frame/DOMSecurityPolicy.cpp
new file mode 100644
index 0000000..fec38b7
--- /dev/null
+++ b/Source/core/frame/DOMSecurityPolicy.cpp
@@ -0,0 +1,176 @@
+/*
+ * 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 GOOGLE 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,
+ * 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/frame/DOMSecurityPolicy.h"
+
+#include "core/dom/ContextLifecycleObserver.h"
+#include "core/dom/DOMStringList.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "wtf/text/TextPosition.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+namespace {
+
+bool isPolicyActiveInContext(ExecutionContext* context)
+{
+    // If the ExecutionContext has been destroyed, there's no active policy.
+    if (!context)
+        return false;
+
+    return context->contentSecurityPolicy()->isActive();
+}
+
+template<bool (ContentSecurityPolicy::*allowWithType)(const String&, const String&, const KURL&, ContentSecurityPolicy::ReportingStatus) const>
+bool isAllowedWithType(ExecutionContext* context, const String& type)
+{
+    if (!isPolicyActiveInContext(context))
+        return true;
+
+    return (context->contentSecurityPolicy()->*allowWithType)(type, type, KURL(), ContentSecurityPolicy::SuppressReport);
+}
+
+template<bool (ContentSecurityPolicy::*allowWithURL)(const KURL&, ContentSecurityPolicy::ReportingStatus) const>
+bool isAllowedWithURL(ExecutionContext* context, const String& url)
+{
+    if (!isPolicyActiveInContext(context))
+        return true;
+
+    KURL parsedURL = context->completeURL(url);
+    if (!parsedURL.isValid())
+        return false; // FIXME: Figure out how to throw a JavaScript error.
+
+    return (context->contentSecurityPolicy()->*allowWithURL)(parsedURL, ContentSecurityPolicy::SuppressReport);
+}
+
+template<bool (ContentSecurityPolicy::*allowWithContext)(const String&, const WTF::OrdinalNumber&, ContentSecurityPolicy::ReportingStatus) const>
+bool isAllowed(ExecutionContext* context)
+{
+    if (!isPolicyActiveInContext(context))
+        return true;
+
+    return (context->contentSecurityPolicy()->*allowWithContext)(String(), WTF::OrdinalNumber::beforeFirst(), ContentSecurityPolicy::SuppressReport);
+}
+
+} // namespace
+
+DOMSecurityPolicy::DOMSecurityPolicy(ExecutionContext* context)
+    : ContextLifecycleObserver(context)
+{
+    ScriptWrappable::init(this);
+}
+
+DOMSecurityPolicy::~DOMSecurityPolicy()
+{
+}
+
+bool DOMSecurityPolicy::isActive() const
+{
+    return isPolicyActiveInContext(executionContext());
+}
+
+PassRefPtr<DOMStringList> DOMSecurityPolicy::reportURIs() const
+{
+    RefPtr<DOMStringList> result = DOMStringList::create();
+
+    if (isActive())
+        executionContext()->contentSecurityPolicy()->gatherReportURIs(*result.get());
+
+    return result.release();
+}
+
+bool DOMSecurityPolicy::allowsInlineScript() const
+{
+    return isAllowed<&ContentSecurityPolicy::allowInlineScript>(executionContext());
+}
+
+bool DOMSecurityPolicy::allowsInlineStyle() const
+{
+    return isAllowed<&ContentSecurityPolicy::allowInlineStyle>(executionContext());
+}
+
+bool DOMSecurityPolicy::allowsEval() const
+{
+    if (!isActive())
+        return true;
+
+    return executionContext()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport);
+}
+
+
+bool DOMSecurityPolicy::allowsConnectionTo(const String& url) const
+{
+    return isAllowedWithURL<&ContentSecurityPolicy::allowConnectToSource>(executionContext(), url);
+}
+
+bool DOMSecurityPolicy::allowsFontFrom(const String& url) const
+{
+    return isAllowedWithURL<&ContentSecurityPolicy::allowFontFromSource>(executionContext(), url);
+}
+
+bool DOMSecurityPolicy::allowsFormAction(const String& url) const
+{
+    return isAllowedWithURL<&ContentSecurityPolicy::allowFormAction>(executionContext(), url);
+}
+
+bool DOMSecurityPolicy::allowsFrameFrom(const String& url) const
+{
+    return isAllowedWithURL<&ContentSecurityPolicy::allowChildFrameFromSource>(executionContext(), url);
+}
+
+bool DOMSecurityPolicy::allowsImageFrom(const String& url) const
+{
+    return isAllowedWithURL<&ContentSecurityPolicy::allowImageFromSource>(executionContext(), url);
+}
+
+bool DOMSecurityPolicy::allowsMediaFrom(const String& url) const
+{
+    return isAllowedWithURL<&ContentSecurityPolicy::allowMediaFromSource>(executionContext(), url);
+}
+
+bool DOMSecurityPolicy::allowsObjectFrom(const String& url) const
+{
+    return isAllowedWithURL<&ContentSecurityPolicy::allowObjectFromSource>(executionContext(), url);
+}
+
+bool DOMSecurityPolicy::allowsPluginType(const String& type) const
+{
+    return isAllowedWithType<&ContentSecurityPolicy::allowPluginType>(executionContext(), type);
+}
+
+bool DOMSecurityPolicy::allowsScriptFrom(const String& url) const
+{
+    return isAllowedWithURL<&ContentSecurityPolicy::allowScriptFromSource>(executionContext(), url);
+}
+
+bool DOMSecurityPolicy::allowsStyleFrom(const String& url) const
+{
+    return isAllowedWithURL<&ContentSecurityPolicy::allowStyleFromSource>(executionContext(), url);
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/DOMSecurityPolicy.h b/Source/core/frame/DOMSecurityPolicy.h
new file mode 100644
index 0000000..7881301
--- /dev/null
+++ b/Source/core/frame/DOMSecurityPolicy.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2011 Google, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE 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,
+ * 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 DOMSecurityPolicy_h
+#define DOMSecurityPolicy_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/dom/ContextLifecycleObserver.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class ContentSecurityPolicy;
+class DOMStringList;
+class Frame;
+
+class DOMSecurityPolicy : public RefCounted<DOMSecurityPolicy>, public ScriptWrappable, public ContextLifecycleObserver {
+public:
+    static PassRefPtr<DOMSecurityPolicy> create(ExecutionContext* context)
+    {
+        return adoptRef(new DOMSecurityPolicy(context));
+    }
+    ~DOMSecurityPolicy();
+
+    bool isActive() const;
+    PassRefPtr<DOMStringList> reportURIs() const;
+
+    bool allowsInlineScript() const;
+    bool allowsInlineStyle() const;
+    bool allowsEval() const;
+
+    bool allowsConnectionTo(const String& url) const;
+    bool allowsFontFrom(const String& url) const;
+    bool allowsFormAction(const String& url) const;
+    bool allowsFrameFrom(const String& url) const;
+    bool allowsImageFrom(const String& url) const;
+    bool allowsMediaFrom(const String& url) const;
+    bool allowsObjectFrom(const String& url) const;
+    bool allowsPluginType(const String& type) const;
+    bool allowsScriptFrom(const String& url) const;
+    bool allowsStyleFrom(const String& url) const;
+
+private:
+    explicit DOMSecurityPolicy(ExecutionContext*);
+};
+
+}
+
+#endif
diff --git a/Source/core/frame/DOMTimer.cpp b/Source/core/frame/DOMTimer.cpp
new file mode 100644
index 0000000..4aaef50
--- /dev/null
+++ b/Source/core/frame/DOMTimer.cpp
@@ -0,0 +1,201 @@
+/*
+ * 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 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,
+ * 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/frame/DOMTimer.h"
+
+#include "bindings/v8/ScheduledAction.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "wtf/CurrentTime.h"
+
+using namespace std;
+
+namespace WebCore {
+
+static const int maxIntervalForUserGestureForwarding = 1000; // One second matches Gecko.
+static const int maxTimerNestingLevel = 5;
+static const double oneMillisecond = 0.001;
+// Chromium uses a minimum timer interval of 4ms. We'd like to go
+// lower; however, there are poorly coded websites out there which do
+// create CPU-spinning loops.  Using 4ms prevents the CPU from
+// spinning too busily and provides a balance between CPU spinning and
+// the smallest possible interval timer.
+static const double minimumInterval = 0.004;
+
+static int timerNestingLevel = 0;
+
+static inline bool shouldForwardUserGesture(int interval, int nestingLevel)
+{
+    return UserGestureIndicator::processingUserGesture()
+        && interval <= maxIntervalForUserGestureForwarding
+        && nestingLevel == 1; // Gestures should not be forwarded to nested timers.
+}
+
+double DOMTimer::hiddenPageAlignmentInterval()
+{
+    // Timers on hidden pages are aligned so that they fire once per
+    // second at most.
+    return 1.0;
+}
+
+double DOMTimer::visiblePageAlignmentInterval()
+{
+    // Alignment does not apply to timers on visible pages.
+    return 0;
+}
+
+int DOMTimer::install(ExecutionContext* context, PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot)
+{
+    int timeoutID = context->installNewTimeout(action, timeout, singleShot);
+    InspectorInstrumentation::didInstallTimer(context, timeoutID, timeout, singleShot);
+    return timeoutID;
+}
+
+void DOMTimer::removeByID(ExecutionContext* context, int timeoutID)
+{
+    context->removeTimeoutByID(timeoutID);
+    InspectorInstrumentation::didRemoveTimer(context, timeoutID);
+}
+
+DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtr<ScheduledAction> action, int interval, bool singleShot, int timeoutID)
+    : SuspendableTimer(context)
+    , m_timeoutID(timeoutID)
+    , m_nestingLevel(timerNestingLevel + 1)
+    , m_action(action)
+{
+    ASSERT(timeoutID > 0);
+    if (shouldForwardUserGesture(interval, m_nestingLevel))
+        m_userGestureToken = UserGestureIndicator::currentToken();
+
+    double intervalMilliseconds = max(oneMillisecond, interval * oneMillisecond);
+    if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNestingLevel)
+        intervalMilliseconds = minimumInterval;
+    if (singleShot)
+        startOneShot(intervalMilliseconds);
+    else
+        startRepeating(intervalMilliseconds);
+}
+
+DOMTimer::~DOMTimer()
+{
+}
+
+int DOMTimer::timeoutID() const
+{
+    return m_timeoutID;
+}
+
+void DOMTimer::fired()
+{
+    ExecutionContext* context = executionContext();
+    timerNestingLevel = m_nestingLevel;
+    ASSERT(!context->activeDOMObjectsAreSuspended());
+    // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator.
+    UserGestureIndicator gestureIndicator(m_userGestureToken.release());
+
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID);
+
+    // Simple case for non-one-shot timers.
+    if (isActive()) {
+        if (repeatInterval() && repeatInterval() < minimumInterval) {
+            m_nestingLevel++;
+            if (m_nestingLevel >= maxTimerNestingLevel)
+                augmentRepeatInterval(minimumInterval - repeatInterval());
+        }
+
+        // No access to member variables after this point, it can delete the timer.
+        m_action->execute(context);
+
+        InspectorInstrumentation::didFireTimer(cookie);
+
+        return;
+    }
+
+    // Delete timer before executing the action for one-shot timers.
+    OwnPtr<ScheduledAction> action = m_action.release();
+
+    // This timer is being deleted; no access to member variables allowed after this point.
+    context->removeTimeoutByID(m_timeoutID);
+
+    action->execute(context);
+
+    InspectorInstrumentation::didFireTimer(cookie);
+
+    timerNestingLevel = 0;
+}
+
+void DOMTimer::contextDestroyed()
+{
+    SuspendableTimer::contextDestroyed();
+}
+
+void DOMTimer::stop()
+{
+    SuspendableTimer::stop();
+    // Need to release JS objects potentially protected by ScheduledAction
+    // because they can form circular references back to the ExecutionContext
+    // which will cause a memory leak.
+    m_action.clear();
+}
+
+double DOMTimer::alignedFireTime(double fireTime) const
+{
+    double alignmentInterval = executionContext()->timerAlignmentInterval();
+    if (alignmentInterval) {
+        double currentTime = monotonicallyIncreasingTime();
+        if (fireTime <= currentTime)
+            return fireTime;
+
+        // When a repeating timer is scheduled for exactly the
+        // background page alignment interval, because it's impossible
+        // for the timer to be rescheduled instantaneously, it misses
+        // every other fire time. Avoid this by looking at the next
+        // fire time rounded both down and up.
+
+        double alignedTimeRoundedDown = floor(fireTime / alignmentInterval) * alignmentInterval;
+        double alignedTimeRoundedUp = ceil(fireTime / alignmentInterval) * alignmentInterval;
+
+        // If the version rounded down is in the past, discard it
+        // immediately.
+
+        if (alignedTimeRoundedDown <= currentTime)
+            return alignedTimeRoundedUp;
+
+        // Only use the rounded-down time if it's within a certain
+        // tolerance of the fire time. This avoids speeding up timers
+        // on background pages in the common case.
+
+        if (fireTime - alignedTimeRoundedDown < minimumInterval)
+            return alignedTimeRoundedDown;
+
+        return alignedTimeRoundedUp;
+    }
+
+    return fireTime;
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/DOMTimer.h b/Source/core/frame/DOMTimer.h
new file mode 100644
index 0000000..95c094b
--- /dev/null
+++ b/Source/core/frame/DOMTimer.h
@@ -0,0 +1,82 @@
+/*
+ * 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 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,
+ * 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 DOMTimer_h
+#define DOMTimer_h
+
+#include "bindings/v8/ScheduledAction.h"
+#include "core/frame/SuspendableTimer.h"
+#include "platform/UserGestureIndicator.h"
+#include "wtf/Compiler.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+
+namespace WebCore {
+
+class ExecutionContext;
+
+class DOMTimer : public SuspendableTimer {
+public:
+    // Creates a new timer owned by the ExecutionContext, starts it and returns its ID.
+    static int install(ExecutionContext*, PassOwnPtr<ScheduledAction>, int timeout, bool singleShot);
+    static void removeByID(ExecutionContext*, int timeoutID);
+
+    virtual ~DOMTimer();
+
+    int timeoutID() const;
+
+    // ActiveDOMObject
+    virtual void contextDestroyed() OVERRIDE;
+    virtual void stop() OVERRIDE;
+
+    // The following are essentially constants. All intervals are in seconds.
+    static double hiddenPageAlignmentInterval();
+    static double visiblePageAlignmentInterval();
+
+private:
+    friend class ExecutionContext; // For create().
+
+    // Should only be used by ExecutionContext.
+    static PassOwnPtr<DOMTimer> create(ExecutionContext* context, PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot, int timeoutID)
+    {
+        return adoptPtr(new DOMTimer(context, action, timeout, singleShot, timeoutID));
+    }
+
+    DOMTimer(ExecutionContext*, PassOwnPtr<ScheduledAction>, int interval, bool singleShot, int timeoutID);
+    virtual void fired();
+
+    // Retuns timer fire time rounded to the next multiple of timer alignment interval.
+    virtual double alignedFireTime(double) const;
+
+    int m_timeoutID;
+    int m_nestingLevel;
+    OwnPtr<ScheduledAction> m_action;
+    RefPtr<UserGestureToken> m_userGestureToken;
+};
+
+} // namespace WebCore
+
+#endif // DOMTimer_h
diff --git a/Source/core/frame/DOMWindow.cpp b/Source/core/frame/DOMWindow.cpp
new file mode 100644
index 0000000..a434de1
--- /dev/null
+++ b/Source/core/frame/DOMWindow.cpp
@@ -0,0 +1,1775 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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,
+ * 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/frame/DOMWindow.h"
+
+#include <algorithm>
+#include "RuntimeEnabledFeatures.h"
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/ExceptionStatePlaceholder.h"
+#include "bindings/v8/ScriptCallStackFactory.h"
+#include "bindings/v8/ScriptController.h"
+#include "bindings/v8/SerializedScriptValue.h"
+#include "core/css/CSSComputedStyleDeclaration.h"
+#include "core/css/CSSRuleList.h"
+#include "core/css/DOMWindowCSS.h"
+#include "core/css/MediaQueryList.h"
+#include "core/css/MediaQueryMatcher.h"
+#include "core/css/StyleMedia.h"
+#include "core/css/resolver/StyleResolver.h"
+#include "core/dom/Document.h"
+#include "core/dom/Element.h"
+#include "core/dom/ExceptionCode.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/dom/RequestAnimationFrameCallback.h"
+#include "core/editing/Editor.h"
+#include "core/events/EventListener.h"
+#include "core/events/MessageEvent.h"
+#include "core/events/PageTransitionEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/Console.h"
+#include "core/frame/DOMPoint.h"
+#include "core/frame/Frame.h"
+#include "core/frame/History.h"
+#include "core/frame/Location.h"
+#include "core/frame/Navigator.h"
+#include "core/frame/Screen.h"
+#include "core/history/BackForwardController.h"
+#include "core/html/HTMLFrameOwnerElement.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/inspector/ScriptCallStack.h"
+#include "core/loader/DocumentLoader.h"
+#include "core/loader/FrameLoadRequest.h"
+#include "core/loader/FrameLoader.h"
+#include "core/loader/FrameLoaderClient.h"
+#include "core/loader/appcache/ApplicationCache.h"
+#include "core/frame/BarProp.h"
+#include "core/page/Chrome.h"
+#include "core/page/ChromeClient.h"
+#include "core/page/CreateWindow.h"
+#include "core/frame/DOMWindowLifecycleNotifier.h"
+#include "core/page/EventHandler.h"
+#include "core/page/FrameTree.h"
+#include "core/frame/FrameView.h"
+#include "core/page/Page.h"
+#include "core/page/PageConsole.h"
+#include "core/page/PageGroup.h"
+#include "core/page/Settings.h"
+#include "core/page/WindowFeatures.h"
+#include "core/page/WindowFocusAllowedIndicator.h"
+#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/platform/PlatformScreen.h"
+#include "core/platform/graphics/MediaPlayer.h"
+#include "core/storage/Storage.h"
+#include "core/storage/StorageArea.h"
+#include "core/storage/StorageNamespace.h"
+#include "core/timing/Performance.h"
+#include "modules/device_orientation/NewDeviceOrientationController.h"
+#include "platform/UserGestureIndicator.h"
+#include "platform/geometry/FloatRect.h"
+#include "public/platform/Platform.h"
+#include "weborigin/KURL.h"
+#include "weborigin/SecurityOrigin.h"
+#include "weborigin/SecurityPolicy.h"
+#include "wtf/MainThread.h"
+#include "wtf/MathExtras.h"
+#include "wtf/text/WTFString.h"
+
+using std::min;
+using std::max;
+
+namespace WebCore {
+
+class PostMessageTimer : public TimerBase {
+public:
+    PostMessageTimer(DOMWindow* window, PassRefPtr<SerializedScriptValue> message, const String& sourceOrigin, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, PassRefPtr<ScriptCallStack> stackTrace)
+        : m_window(window)
+        , m_message(message)
+        , m_origin(sourceOrigin)
+        , m_source(source)
+        , m_channels(channels)
+        , m_targetOrigin(targetOrigin)
+        , m_stackTrace(stackTrace)
+    {
+    }
+
+    PassRefPtr<MessageEvent> event(ExecutionContext* context)
+    {
+        OwnPtr<MessagePortArray> messagePorts = MessagePort::entanglePorts(*context, m_channels.release());
+        return MessageEvent::create(messagePorts.release(), m_message, m_origin, String(), m_source);
+    }
+    SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); }
+    ScriptCallStack* stackTrace() const { return m_stackTrace.get(); }
+
+private:
+    virtual void fired()
+    {
+        m_window->postMessageTimerFired(adoptPtr(this));
+        // This object is deleted now.
+    }
+
+    RefPtr<DOMWindow> m_window;
+    RefPtr<SerializedScriptValue> m_message;
+    String m_origin;
+    RefPtr<DOMWindow> m_source;
+    OwnPtr<MessagePortChannelArray> m_channels;
+    RefPtr<SecurityOrigin> m_targetOrigin;
+    RefPtr<ScriptCallStack> m_stackTrace;
+};
+
+static void disableSuddenTermination()
+{
+    WebKit::Platform::current()->suddenTerminationChanged(false);
+}
+
+static void enableSuddenTermination()
+{
+    WebKit::Platform::current()->suddenTerminationChanged(true);
+}
+
+typedef HashCountedSet<DOMWindow*> DOMWindowSet;
+
+static DOMWindowSet& windowsWithUnloadEventListeners()
+{
+    DEFINE_STATIC_LOCAL(DOMWindowSet, windowsWithUnloadEventListeners, ());
+    return windowsWithUnloadEventListeners;
+}
+
+static DOMWindowSet& windowsWithBeforeUnloadEventListeners()
+{
+    DEFINE_STATIC_LOCAL(DOMWindowSet, windowsWithBeforeUnloadEventListeners, ());
+    return windowsWithBeforeUnloadEventListeners;
+}
+
+static void addUnloadEventListener(DOMWindow* domWindow)
+{
+    DOMWindowSet& set = windowsWithUnloadEventListeners();
+    if (set.isEmpty())
+        disableSuddenTermination();
+    set.add(domWindow);
+}
+
+static void removeUnloadEventListener(DOMWindow* domWindow)
+{
+    DOMWindowSet& set = windowsWithUnloadEventListeners();
+    DOMWindowSet::iterator it = set.find(domWindow);
+    if (it == set.end())
+        return;
+    set.remove(it);
+    if (set.isEmpty())
+        enableSuddenTermination();
+}
+
+static void removeAllUnloadEventListeners(DOMWindow* domWindow)
+{
+    DOMWindowSet& set = windowsWithUnloadEventListeners();
+    DOMWindowSet::iterator it = set.find(domWindow);
+    if (it == set.end())
+        return;
+    set.removeAll(it);
+    if (set.isEmpty())
+        enableSuddenTermination();
+}
+
+static void addBeforeUnloadEventListener(DOMWindow* domWindow)
+{
+    DOMWindowSet& set = windowsWithBeforeUnloadEventListeners();
+    if (set.isEmpty())
+        disableSuddenTermination();
+    set.add(domWindow);
+}
+
+static void removeBeforeUnloadEventListener(DOMWindow* domWindow)
+{
+    DOMWindowSet& set = windowsWithBeforeUnloadEventListeners();
+    DOMWindowSet::iterator it = set.find(domWindow);
+    if (it == set.end())
+        return;
+    set.remove(it);
+    if (set.isEmpty())
+        enableSuddenTermination();
+}
+
+static void removeAllBeforeUnloadEventListeners(DOMWindow* domWindow)
+{
+    DOMWindowSet& set = windowsWithBeforeUnloadEventListeners();
+    DOMWindowSet::iterator it = set.find(domWindow);
+    if (it == set.end())
+        return;
+    set.removeAll(it);
+    if (set.isEmpty())
+        enableSuddenTermination();
+}
+
+static bool allowsBeforeUnloadListeners(DOMWindow* window)
+{
+    ASSERT_ARG(window, window);
+    Frame* frame = window->frame();
+    if (!frame)
+        return false;
+    Page* page = frame->page();
+    if (!page)
+        return false;
+    return frame == page->mainFrame();
+}
+
+unsigned DOMWindow::pendingUnloadEventListeners() const
+{
+    return windowsWithUnloadEventListeners().count(const_cast<DOMWindow*>(this));
+}
+
+// This function:
+// 1) Validates the pending changes are not changing any value to NaN; in that case keep original value.
+// 2) Constrains the window rect to the minimum window size and no bigger than the float rect's dimensions.
+// 3) Constrains the window rect to within the top and left boundaries of the available screen rect.
+// 4) Constrains the window rect to within the bottom and right boundaries of the available screen rect.
+// 5) Translate the window rect coordinates to be within the coordinate space of the screen.
+FloatRect DOMWindow::adjustWindowRect(Page* page, const FloatRect& pendingChanges)
+{
+    ASSERT(page);
+
+    FloatRect screen = screenAvailableRect(page->mainFrame()->view());
+    FloatRect window = page->chrome().windowRect();
+
+    // Make sure we're in a valid state before adjusting dimensions.
+    ASSERT(std::isfinite(screen.x()));
+    ASSERT(std::isfinite(screen.y()));
+    ASSERT(std::isfinite(screen.width()));
+    ASSERT(std::isfinite(screen.height()));
+    ASSERT(std::isfinite(window.x()));
+    ASSERT(std::isfinite(window.y()));
+    ASSERT(std::isfinite(window.width()));
+    ASSERT(std::isfinite(window.height()));
+
+    // Update window values if new requested values are not NaN.
+    if (!std::isnan(pendingChanges.x()))
+        window.setX(pendingChanges.x());
+    if (!std::isnan(pendingChanges.y()))
+        window.setY(pendingChanges.y());
+    if (!std::isnan(pendingChanges.width()))
+        window.setWidth(pendingChanges.width());
+    if (!std::isnan(pendingChanges.height()))
+        window.setHeight(pendingChanges.height());
+
+    FloatSize minimumSize = page->chrome().client().minimumWindowSize();
+    // Let size 0 pass through, since that indicates default size, not minimum size.
+    if (window.width())
+        window.setWidth(min(max(minimumSize.width(), window.width()), screen.width()));
+    if (window.height())
+        window.setHeight(min(max(minimumSize.height(), window.height()), screen.height()));
+
+    // Constrain the window position within the valid screen area.
+    window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width())));
+    window.setY(max(screen.y(), min(window.y(), screen.maxY() - window.height())));
+
+    return window;
+}
+
+bool DOMWindow::allowPopUp(Frame* firstFrame)
+{
+    ASSERT(firstFrame);
+
+    if (UserGestureIndicator::processingUserGesture())
+        return true;
+
+    Settings* settings = firstFrame->settings();
+    return settings && settings->javaScriptCanOpenWindowsAutomatically();
+}
+
+bool DOMWindow::allowPopUp()
+{
+    return m_frame && allowPopUp(m_frame);
+}
+
+bool DOMWindow::canShowModalDialog(const Frame* frame)
+{
+    if (!frame)
+        return false;
+    Page* page = frame->page();
+    if (!page)
+        return false;
+    return page->chrome().canRunModal();
+}
+
+bool DOMWindow::canShowModalDialogNow(const Frame* frame)
+{
+    if (!frame)
+        return false;
+    Page* page = frame->page();
+    if (!page)
+        return false;
+    return page->chrome().canRunModalNow();
+}
+
+DOMWindow::DOMWindow(Frame* frame)
+    : FrameDestructionObserver(frame)
+    , m_shouldPrintWhenFinishedLoading(false)
+{
+    ASSERT(frame);
+    ScriptWrappable::init(this);
+}
+
+void DOMWindow::setDocument(PassRefPtr<Document> document)
+{
+    ASSERT(!document || document->frame() == m_frame);
+    if (m_document) {
+        if (m_document->confusingAndOftenMisusedAttached()) {
+            // FIXME: We don't call willRemove here. Why is that OK?
+            // This detach() call is also mostly redundant. Most of the calls to
+            // this function come via DocumentLoader::createWriterFor, which
+            // always detaches the previous Document first. Only XSLTProcessor
+            // depends on this detach() call, so it seems like there's some room
+            // for cleanup.
+            m_document->detach();
+        }
+        m_document->setDOMWindow(0);
+    }
+
+    m_document = document;
+
+    if (!m_document)
+        return;
+
+    m_document->setDOMWindow(this);
+    if (!m_document->confusingAndOftenMisusedAttached())
+        m_document->attach();
+
+    if (!m_frame)
+        return;
+
+    m_frame->script()->updateDocument();
+    m_document->updateViewportDescription();
+
+    if (m_frame->page() && m_frame->view()) {
+        if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scrollingCoordinator()) {
+            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame->view(), HorizontalScrollbar);
+            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame->view(), VerticalScrollbar);
+            scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_frame->view());
+        }
+    }
+
+    m_frame->selection().updateSecureKeyboardEntryIfActive();
+
+    if (m_frame->page() && m_frame->page()->mainFrame() == m_frame) {
+        m_frame->page()->mainFrame()->notifyChromeClientWheelEventHandlerCountChanged();
+        if (m_document->hasTouchEventHandlers())
+            m_frame->page()->chrome().client().needTouchEvents(true);
+    }
+}
+
+DOMWindow::~DOMWindow()
+{
+    ASSERT(!m_screen);
+    ASSERT(!m_history);
+    ASSERT(!m_locationbar);
+    ASSERT(!m_menubar);
+    ASSERT(!m_personalbar);
+    ASSERT(!m_scrollbars);
+    ASSERT(!m_statusbar);
+    ASSERT(!m_toolbar);
+    ASSERT(!m_console);
+    ASSERT(!m_navigator);
+    ASSERT(!m_performance);
+    ASSERT(!m_location);
+    ASSERT(!m_media);
+    ASSERT(!m_sessionStorage);
+    ASSERT(!m_localStorage);
+    ASSERT(!m_applicationCache);
+
+    reset();
+
+    removeAllEventListeners();
+
+    ASSERT(!m_document->confusingAndOftenMisusedAttached());
+    setDocument(0);
+}
+
+const AtomicString& DOMWindow::interfaceName() const
+{
+    return EventTargetNames::DOMWindow;
+}
+
+ExecutionContext* DOMWindow::executionContext() const
+{
+    return m_document.get();
+}
+
+DOMWindow* DOMWindow::toDOMWindow()
+{
+    return this;
+}
+
+PassRefPtr<MediaQueryList> DOMWindow::matchMedia(const String& media)
+{
+    return document() ? document()->mediaQueryMatcher()->matchMedia(media) : 0;
+}
+
+Page* DOMWindow::page()
+{
+    return frame() ? frame()->page() : 0;
+}
+
+void DOMWindow::frameDestroyed()
+{
+    FrameDestructionObserver::frameDestroyed();
+    reset();
+}
+
+void DOMWindow::willDetachPage()
+{
+    InspectorInstrumentation::frameWindowDiscarded(m_frame, this);
+    // FIXME: Once DeviceOrientationController is a ExecutionContext
+    // Supplement, this will no longer be needed.
+    if (NewDeviceOrientationController* controller = NewDeviceOrientationController::from(document()))
+        controller->stopUpdating();
+}
+
+void DOMWindow::willDestroyDocumentInFrame()
+{
+    // It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
+    // unregister themselves from the DOMWindow as a result of the call to willDestroyGlobalObjectInFrame.
+    Vector<DOMWindowProperty*> properties;
+    copyToVector(m_properties, properties);
+    for (size_t i = 0; i < properties.size(); ++i)
+        properties[i]->willDestroyGlobalObjectInFrame();
+}
+
+void DOMWindow::willDetachDocumentFromFrame()
+{
+    // It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
+    // unregister themselves from the DOMWindow as a result of the call to willDetachGlobalObjectFromFrame.
+    Vector<DOMWindowProperty*> properties;
+    copyToVector(m_properties, properties);
+    for (size_t i = 0; i < properties.size(); ++i)
+        properties[i]->willDetachGlobalObjectFromFrame();
+}
+
+void DOMWindow::registerProperty(DOMWindowProperty* property)
+{
+    m_properties.add(property);
+}
+
+void DOMWindow::unregisterProperty(DOMWindowProperty* property)
+{
+    m_properties.remove(property);
+}
+
+void DOMWindow::reset()
+{
+    willDestroyDocumentInFrame();
+    resetDOMWindowProperties();
+}
+
+void DOMWindow::resetDOMWindowProperties()
+{
+    m_properties.clear();
+
+    m_screen = 0;
+    m_history = 0;
+    m_locationbar = 0;
+    m_menubar = 0;
+    m_personalbar = 0;
+    m_scrollbars = 0;
+    m_statusbar = 0;
+    m_toolbar = 0;
+    m_console = 0;
+    m_navigator = 0;
+    m_performance = 0;
+    m_location = 0;
+    m_media = 0;
+    m_sessionStorage = 0;
+    m_localStorage = 0;
+    m_applicationCache = 0;
+}
+
+bool DOMWindow::isCurrentlyDisplayedInFrame() const
+{
+    return m_frame && m_frame->domWindow() == this;
+}
+
+#if ENABLE(ORIENTATION_EVENTS)
+int DOMWindow::orientation() const
+{
+    if (!m_frame)
+        return 0;
+
+    return m_frame->orientation();
+}
+#endif
+
+Screen* DOMWindow::screen() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_screen)
+        m_screen = Screen::create(m_frame);
+    return m_screen.get();
+}
+
+History* DOMWindow::history() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_history)
+        m_history = History::create(m_frame);
+    return m_history.get();
+}
+
+BarProp* DOMWindow::locationbar() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_locationbar)
+        m_locationbar = BarProp::create(m_frame, BarProp::Locationbar);
+    return m_locationbar.get();
+}
+
+BarProp* DOMWindow::menubar() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_menubar)
+        m_menubar = BarProp::create(m_frame, BarProp::Menubar);
+    return m_menubar.get();
+}
+
+BarProp* DOMWindow::personalbar() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_personalbar)
+        m_personalbar = BarProp::create(m_frame, BarProp::Personalbar);
+    return m_personalbar.get();
+}
+
+BarProp* DOMWindow::scrollbars() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_scrollbars)
+        m_scrollbars = BarProp::create(m_frame, BarProp::Scrollbars);
+    return m_scrollbars.get();
+}
+
+BarProp* DOMWindow::statusbar() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_statusbar)
+        m_statusbar = BarProp::create(m_frame, BarProp::Statusbar);
+    return m_statusbar.get();
+}
+
+BarProp* DOMWindow::toolbar() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_toolbar)
+        m_toolbar = BarProp::create(m_frame, BarProp::Toolbar);
+    return m_toolbar.get();
+}
+
+Console* DOMWindow::console() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_console)
+        m_console = Console::create(m_frame);
+    return m_console.get();
+}
+
+PageConsole* DOMWindow::pageConsole() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    return m_frame->page() ? &m_frame->page()->console() : 0;
+}
+
+ApplicationCache* DOMWindow::applicationCache() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_applicationCache)
+        m_applicationCache = ApplicationCache::create(m_frame);
+    return m_applicationCache.get();
+}
+
+Navigator* DOMWindow::navigator() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_navigator)
+        m_navigator = Navigator::create(m_frame);
+    return m_navigator.get();
+}
+
+Performance* DOMWindow::performance() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_performance)
+        m_performance = Performance::create(m_frame);
+    return m_performance.get();
+}
+
+Location* DOMWindow::location() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_location)
+        m_location = Location::create(m_frame);
+    return m_location.get();
+}
+
+Storage* DOMWindow::sessionStorage(ExceptionState& es) const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+
+    Document* document = this->document();
+    if (!document)
+        return 0;
+
+    String accessDeniedMessage = "Access to 'sessionStorage' is denied for this document.";
+    if (!document->securityOrigin()->canAccessLocalStorage()) {
+        if (document->isSandboxed(SandboxOrigin))
+            es.throwSecurityError(accessDeniedMessage + " The document is sandboxed and lacks the 'allow-same-origin' flag.");
+        else if (document->url().protocolIs("data"))
+            es.throwSecurityError(accessDeniedMessage + " Storage is disabled inside 'data:' URLs.");
+        else
+            es.throwSecurityError(accessDeniedMessage);
+        return 0;
+    }
+
+    if (m_sessionStorage) {
+        if (!m_sessionStorage->area()->canAccessStorage(m_frame)) {
+            es.throwSecurityError(accessDeniedMessage);
+            return 0;
+        }
+        return m_sessionStorage.get();
+    }
+
+    Page* page = document->page();
+    if (!page)
+        return 0;
+
+    OwnPtr<StorageArea> storageArea = page->sessionStorage()->storageArea(document->securityOrigin());
+    if (!storageArea->canAccessStorage(m_frame)) {
+        es.throwSecurityError(accessDeniedMessage);
+        return 0;
+    }
+
+    m_sessionStorage = Storage::create(m_frame, storageArea.release());
+    return m_sessionStorage.get();
+}
+
+Storage* DOMWindow::localStorage(ExceptionState& es) const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+
+    Document* document = this->document();
+    if (!document)
+        return 0;
+
+    String accessDeniedMessage = "Access to 'localStorage' is denied for this document.";
+    if (!document->securityOrigin()->canAccessLocalStorage()) {
+        if (document->isSandboxed(SandboxOrigin))
+            es.throwSecurityError(accessDeniedMessage + " The document is sandboxed and lacks the 'allow-same-origin' flag.");
+        else if (document->url().protocolIs("data"))
+            es.throwSecurityError(accessDeniedMessage + " Storage is disabled inside 'data:' URLs.");
+        else
+            es.throwSecurityError(accessDeniedMessage);
+        return 0;
+    }
+
+    if (m_localStorage) {
+        if (!m_localStorage->area()->canAccessStorage(m_frame)) {
+            es.throwSecurityError(accessDeniedMessage);
+            return 0;
+        }
+        return m_localStorage.get();
+    }
+
+    Page* page = document->page();
+    if (!page)
+        return 0;
+
+    if (!page->settings().localStorageEnabled())
+        return 0;
+
+    OwnPtr<StorageArea> storageArea = StorageNamespace::localStorageArea(document->securityOrigin());
+    if (!storageArea->canAccessStorage(m_frame)) {
+        es.throwSecurityError(accessDeniedMessage);
+        return 0;
+    }
+
+    m_localStorage = Storage::create(m_frame, storageArea.release());
+    return m_localStorage.get();
+}
+
+void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, const String& targetOrigin, DOMWindow* source, ExceptionState& es)
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return;
+
+    Document* sourceDocument = source->document();
+
+    // Compute the target origin.  We need to do this synchronously in order
+    // to generate the SyntaxError exception correctly.
+    RefPtr<SecurityOrigin> target;
+    if (targetOrigin == "/") {
+        if (!sourceDocument)
+            return;
+        target = sourceDocument->securityOrigin();
+    } else if (targetOrigin != "*") {
+        target = SecurityOrigin::createFromString(targetOrigin);
+        // It doesn't make sense target a postMessage at a unique origin
+        // because there's no way to represent a unique origin in a string.
+        if (target->isUnique()) {
+            es.throwDOMException(SyntaxError, "Invalid target origin '" + targetOrigin + "' in a call to 'postMessage'.");
+            return;
+        }
+    }
+
+    OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(ports, es);
+    if (es.hadException())
+        return;
+
+    // Capture the source of the message.  We need to do this synchronously
+    // in order to capture the source of the message correctly.
+    if (!sourceDocument)
+        return;
+    String sourceOrigin = sourceDocument->securityOrigin()->toString();
+
+    // Capture stack trace only when inspector front-end is loaded as it may be time consuming.
+    RefPtr<ScriptCallStack> stackTrace;
+    if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument))
+        stackTrace = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
+
+    // Schedule the message.
+    PostMessageTimer* timer = new PostMessageTimer(this, message, sourceOrigin, source, channels.release(), target.get(), stackTrace.release());
+    timer->startOneShot(0);
+}
+
+void DOMWindow::postMessageTimerFired(PassOwnPtr<PostMessageTimer> t)
+{
+    OwnPtr<PostMessageTimer> timer(t);
+
+    if (!document() || !isCurrentlyDisplayedInFrame())
+        return;
+
+    RefPtr<MessageEvent> event = timer->event(document());
+
+    // Give the embedder a chance to intercept this postMessage because this
+    // DOMWindow might be a proxy for another in browsers that support
+    // postMessage calls across WebKit instances.
+    if (m_frame->loader()->client()->willCheckAndDispatchMessageEvent(timer->targetOrigin(), event.get()))
+        return;
+
+    dispatchMessageEventWithOriginCheck(timer->targetOrigin(), event, timer->stackTrace());
+}
+
+void DOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, PassRefPtr<Event> event, PassRefPtr<ScriptCallStack> stackTrace)
+{
+    if (intendedTargetOrigin) {
+        // Check target origin now since the target document may have changed since the timer was scheduled.
+        if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrigin())) {
+            String message = "Unable to post message to " + intendedTargetOrigin->toString() +
+                             ". Recipient has origin " + document()->securityOrigin()->toString() + ".\n";
+            pageConsole()->addMessage(SecurityMessageSource, ErrorMessageLevel, message, stackTrace);
+            return;
+        }
+    }
+
+    dispatchEvent(event);
+}
+
+DOMSelection* DOMWindow::getSelection()
+{
+    if (!isCurrentlyDisplayedInFrame() || !m_frame)
+        return 0;
+
+    return m_frame->document()->getSelection();
+}
+
+Element* DOMWindow::frameElement() const
+{
+    if (!m_frame)
+        return 0;
+
+    return m_frame->ownerElement();
+}
+
+void DOMWindow::focus(ExecutionContext* context)
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed();
+    if (context) {
+        ASSERT(isMainThread());
+        Document* activeDocument = toDocument(context);
+        if (opener() && opener() != this && activeDocument->domWindow() == opener())
+            allowFocus = true;
+    }
+
+    // If we're a top level window, bring the window to the front.
+    if (m_frame == page->mainFrame() && allowFocus)
+        page->chrome().focus();
+
+    if (!m_frame)
+        return;
+
+    m_frame->eventHandler()->focusDocumentView();
+}
+
+void DOMWindow::blur()
+{
+}
+
+void DOMWindow::close(ExecutionContext* context)
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    if (m_frame != page->mainFrame())
+        return;
+
+    if (context) {
+        ASSERT(isMainThread());
+        Document* activeDocument = toDocument(context);
+        if (!activeDocument)
+            return;
+
+        if (!activeDocument->canNavigate(m_frame))
+            return;
+    }
+
+    Settings* settings = m_frame->settings();
+    bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseWindows();
+
+    if (!(page->openedByDOM() || page->backForward().count() <= 1 || allowScriptsToCloseWindows))
+        return;
+
+    if (!m_frame->loader()->shouldClose())
+        return;
+
+    page->chrome().closeWindowSoon();
+}
+
+void DOMWindow::print()
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    if (m_frame->loader()->activeDocumentLoader()->isLoading()) {
+        m_shouldPrintWhenFinishedLoading = true;
+        return;
+    }
+    m_shouldPrintWhenFinishedLoading = false;
+    page->chrome().print(m_frame);
+}
+
+void DOMWindow::stop()
+{
+    if (!m_frame)
+        return;
+    m_frame->loader()->stopAllLoaders();
+}
+
+void DOMWindow::alert(const String& message)
+{
+    if (!m_frame)
+        return;
+
+    m_frame->document()->updateStyleIfNeeded();
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    page->chrome().runJavaScriptAlert(m_frame, message);
+}
+
+bool DOMWindow::confirm(const String& message)
+{
+    if (!m_frame)
+        return false;
+
+    m_frame->document()->updateStyleIfNeeded();
+
+    Page* page = m_frame->page();
+    if (!page)
+        return false;
+
+    return page->chrome().runJavaScriptConfirm(m_frame, message);
+}
+
+String DOMWindow::prompt(const String& message, const String& defaultValue)
+{
+    if (!m_frame)
+        return String();
+
+    m_frame->document()->updateStyleIfNeeded();
+
+    Page* page = m_frame->page();
+    if (!page)
+        return String();
+
+    String returnValue;
+    if (page->chrome().runJavaScriptPrompt(m_frame, message, defaultValue, returnValue))
+        return returnValue;
+
+    return String();
+}
+
+bool DOMWindow::find(const String& string, bool caseSensitive, bool backwards, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return false;
+
+    // FIXME (13016): Support wholeWord, searchInFrames and showDialog
+    return m_frame->editor().findString(string, !backwards, caseSensitive, wrap, false);
+}
+
+bool DOMWindow::offscreenBuffering() const
+{
+    return true;
+}
+
+int DOMWindow::outerHeight() const
+{
+    if (!m_frame)
+        return 0;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return 0;
+
+    if (page->settings().reportScreenSizeInPhysicalPixelsQuirk())
+        return lroundf(page->chrome().windowRect().height() * page->deviceScaleFactor());
+    return static_cast<int>(page->chrome().windowRect().height());
+}
+
+int DOMWindow::outerWidth() const
+{
+    if (!m_frame)
+        return 0;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return 0;
+
+    if (page->settings().reportScreenSizeInPhysicalPixelsQuirk())
+        return lroundf(page->chrome().windowRect().width() * page->deviceScaleFactor());
+    return static_cast<int>(page->chrome().windowRect().width());
+}
+
+int DOMWindow::innerHeight() const
+{
+    if (!m_frame)
+        return 0;
+
+    FrameView* view = m_frame->view();
+    if (!view)
+        return 0;
+
+    // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer.
+    if (Frame* parent = m_frame->tree()->parent())
+        parent->document()->updateLayoutIgnorePendingStylesheets();
+
+    return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRect(ScrollableArea::IncludeScrollbars).height()));
+}
+
+int DOMWindow::innerWidth() const
+{
+    if (!m_frame)
+        return 0;
+
+    FrameView* view = m_frame->view();
+    if (!view)
+        return 0;
+
+    // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer.
+    if (Frame* parent = m_frame->tree()->parent())
+        parent->document()->updateLayoutIgnorePendingStylesheets();
+
+    return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRect(ScrollableArea::IncludeScrollbars).width()));
+}
+
+int DOMWindow::screenX() const
+{
+    if (!m_frame)
+        return 0;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return 0;
+
+    if (page->settings().reportScreenSizeInPhysicalPixelsQuirk())
+        return lroundf(page->chrome().windowRect().x() * page->deviceScaleFactor());
+    return static_cast<int>(page->chrome().windowRect().x());
+}
+
+int DOMWindow::screenY() const
+{
+    if (!m_frame)
+        return 0;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return 0;
+
+    if (page->settings().reportScreenSizeInPhysicalPixelsQuirk())
+        return lroundf(page->chrome().windowRect().y() * page->deviceScaleFactor());
+    return static_cast<int>(page->chrome().windowRect().y());
+}
+
+int DOMWindow::scrollX() const
+{
+    if (!m_frame)
+        return 0;
+
+    FrameView* view = m_frame->view();
+    if (!view)
+        return 0;
+
+    m_frame->document()->updateLayoutIgnorePendingStylesheets();
+
+    return view->mapFromLayoutToCSSUnits(view->scrollX());
+}
+
+int DOMWindow::scrollY() const
+{
+    if (!m_frame)
+        return 0;
+
+    FrameView* view = m_frame->view();
+    if (!view)
+        return 0;
+
+    m_frame->document()->updateLayoutIgnorePendingStylesheets();
+
+    return view->mapFromLayoutToCSSUnits(view->scrollY());
+}
+
+bool DOMWindow::closed() const
+{
+    return !m_frame;
+}
+
+unsigned DOMWindow::length() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+
+    return m_frame->tree()->scopedChildCount();
+}
+
+String DOMWindow::name() const
+{
+    if (!m_frame)
+        return String();
+
+    return m_frame->tree()->name();
+}
+
+void DOMWindow::setName(const String& string)
+{
+    if (!m_frame)
+        return;
+
+    m_frame->tree()->setName(string);
+    m_frame->loader()->client()->didChangeName(string);
+}
+
+void DOMWindow::setStatus(const String& string)
+{
+    m_status = string;
+
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    ASSERT(m_frame->document()); // Client calls shouldn't be made when the frame is in inconsistent state.
+    page->chrome().setStatusbarText(m_frame, m_status);
+}
+
+void DOMWindow::setDefaultStatus(const String& string)
+{
+    m_defaultStatus = string;
+
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    ASSERT(m_frame->document()); // Client calls shouldn't be made when the frame is in inconsistent state.
+    page->chrome().setStatusbarText(m_frame, m_defaultStatus);
+}
+
+DOMWindow* DOMWindow::self() const
+{
+    if (!m_frame)
+        return 0;
+
+    return m_frame->domWindow();
+}
+
+DOMWindow* DOMWindow::opener() const
+{
+    if (!m_frame)
+        return 0;
+
+    Frame* opener = m_frame->loader()->opener();
+    if (!opener)
+        return 0;
+
+    return opener->domWindow();
+}
+
+DOMWindow* DOMWindow::parent() const
+{
+    if (!m_frame)
+        return 0;
+
+    Frame* parent = m_frame->tree()->parent();
+    if (parent)
+        return parent->domWindow();
+
+    return m_frame->domWindow();
+}
+
+DOMWindow* DOMWindow::top() const
+{
+    if (!m_frame)
+        return 0;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return 0;
+
+    return m_frame->tree()->top()->domWindow();
+}
+
+Document* DOMWindow::document() const
+{
+    return m_document.get();
+}
+
+PassRefPtr<StyleMedia> DOMWindow::styleMedia() const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    if (!m_media)
+        m_media = StyleMedia::create(m_frame);
+    return m_media.get();
+}
+
+PassRefPtr<CSSStyleDeclaration> DOMWindow::getComputedStyle(Element* elt, const String& pseudoElt) const
+{
+    if (!elt)
+        return 0;
+
+    return CSSComputedStyleDeclaration::create(elt, false, pseudoElt);
+}
+
+PassRefPtr<CSSRuleList> DOMWindow::getMatchedCSSRules(Element* element, const String& pseudoElement, bool authorOnly) const
+{
+    UseCounter::count(this, UseCounter::GetMatchedCSSRules);
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+
+    unsigned colonStart = pseudoElement[0] == ':' ? (pseudoElement[1] == ':' ? 2 : 1) : 0;
+    CSSSelector::PseudoType pseudoType = CSSSelector::parsePseudoType(AtomicString(pseudoElement.substring(colonStart)));
+    if (pseudoType == CSSSelector::PseudoUnknown && !pseudoElement.isEmpty())
+        return 0;
+
+    unsigned rulesToInclude = StyleResolver::AuthorCSSRules;
+    if (!authorOnly)
+        rulesToInclude |= StyleResolver::UAAndUserCSSRules;
+
+    PseudoId pseudoId = CSSSelector::pseudoId(pseudoType);
+
+    return m_frame->document()->styleResolver()->pseudoStyleRulesForElement(element, pseudoId, rulesToInclude);
+}
+
+PassRefPtr<DOMPoint> DOMWindow::webkitConvertPointFromNodeToPage(Node* node, const DOMPoint* p) const
+{
+    if (!node || !p)
+        return 0;
+
+    if (!document())
+        return 0;
+
+    document()->updateLayoutIgnorePendingStylesheets();
+
+    FloatPoint pagePoint(p->x(), p->y());
+    pagePoint = node->convertToPage(pagePoint);
+    return DOMPoint::create(pagePoint.x(), pagePoint.y());
+}
+
+PassRefPtr<DOMPoint> DOMWindow::webkitConvertPointFromPageToNode(Node* node, const DOMPoint* p) const
+{
+    if (!node || !p)
+        return 0;
+
+    if (!document())
+        return 0;
+
+    document()->updateLayoutIgnorePendingStylesheets();
+
+    FloatPoint nodePoint(p->x(), p->y());
+    nodePoint = node->convertFromPage(nodePoint);
+    return DOMPoint::create(nodePoint.x(), nodePoint.y());
+}
+
+double DOMWindow::devicePixelRatio() const
+{
+    if (!m_frame)
+        return 0.0;
+
+    return m_frame->devicePixelRatio();
+}
+
+void DOMWindow::scrollBy(int x, int y) const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return;
+
+    document()->updateLayoutIgnorePendingStylesheets();
+
+    FrameView* view = m_frame->view();
+    if (!view)
+        return;
+
+    IntSize scaledOffset(view->mapFromCSSToLayoutUnits(x), view->mapFromCSSToLayoutUnits(y));
+    view->scrollBy(scaledOffset);
+}
+
+void DOMWindow::scrollTo(int x, int y) const
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return;
+
+    document()->updateLayoutIgnorePendingStylesheets();
+
+    RefPtr<FrameView> view = m_frame->view();
+    if (!view)
+        return;
+
+    IntPoint layoutPos(view->mapFromCSSToLayoutUnits(x), view->mapFromCSSToLayoutUnits(y));
+    view->setScrollPosition(layoutPos);
+}
+
+void DOMWindow::moveBy(float x, float y) const
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    if (m_frame != page->mainFrame())
+        return;
+
+    FloatRect fr = page->chrome().windowRect();
+    FloatRect update = fr;
+    update.move(x, y);
+    // Security check (the spec talks about UniversalBrowserWrite to disable this check...)
+    page->chrome().setWindowRect(adjustWindowRect(page, update));
+}
+
+void DOMWindow::moveTo(float x, float y) const
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    if (m_frame != page->mainFrame())
+        return;
+
+    FloatRect fr = page->chrome().windowRect();
+    FloatRect sr = screenAvailableRect(page->mainFrame()->view());
+    fr.setLocation(sr.location());
+    FloatRect update = fr;
+    update.move(x, y);
+    // Security check (the spec talks about UniversalBrowserWrite to disable this check...)
+    page->chrome().setWindowRect(adjustWindowRect(page, update));
+}
+
+void DOMWindow::resizeBy(float x, float y) const
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    if (m_frame != page->mainFrame())
+        return;
+
+    FloatRect fr = page->chrome().windowRect();
+    FloatSize dest = fr.size() + FloatSize(x, y);
+    FloatRect update(fr.location(), dest);
+    page->chrome().setWindowRect(adjustWindowRect(page, update));
+}
+
+void DOMWindow::resizeTo(float width, float height) const
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    if (m_frame != page->mainFrame())
+        return;
+
+    FloatRect fr = page->chrome().windowRect();
+    FloatSize dest = FloatSize(width, height);
+    FloatRect update(fr.location(), dest);
+    page->chrome().setWindowRect(adjustWindowRect(page, update));
+}
+
+int DOMWindow::requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
+{
+    callback->m_useLegacyTimeBase = false;
+    if (Document* d = document())
+        return d->requestAnimationFrame(callback);
+    return 0;
+}
+
+int DOMWindow::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
+{
+    callback->m_useLegacyTimeBase = true;
+    if (Document* d = document())
+        return d->requestAnimationFrame(callback);
+    return 0;
+}
+
+void DOMWindow::cancelAnimationFrame(int id)
+{
+    if (Document* d = document())
+        d->cancelAnimationFrame(id);
+}
+
+DOMWindowCSS* DOMWindow::css()
+{
+    if (!m_css)
+        m_css = DOMWindowCSS::create();
+    return m_css.get();
+}
+
+static void didAddStorageEventListener(DOMWindow* window)
+{
+    // Creating these WebCore::Storage objects informs the system that we'd like to receive
+    // notifications about storage events that might be triggered in other processes. Rather
+    // than subscribe to these notifications explicitly, we subscribe to them implicitly to
+    // simplify the work done by the system.
+    window->localStorage(IGNORE_EXCEPTION);
+    window->sessionStorage(IGNORE_EXCEPTION);
+}
+
+bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
+{
+    if (!EventTarget::addEventListener(eventType, listener, useCapture))
+        return false;
+
+    if (Document* document = this->document()) {
+        document->addListenerTypeIfNeeded(eventType);
+        if (isTouchEventType(eventType))
+            document->didAddTouchEventHandler(document);
+        else if (eventType == EventTypeNames::storage)
+            didAddStorageEventListener(this);
+    }
+
+    lifecycleNotifier()->notifyAddEventListener(this, eventType);
+
+    if (eventType == EventTypeNames::unload) {
+        addUnloadEventListener(this);
+    } else if (eventType == EventTypeNames::beforeunload) {
+        if (allowsBeforeUnloadListeners(this)) {
+            // This is confusingly named. It doesn't actually add the listener. It just increments a count
+            // so that we know we have listeners registered for the purposes of determining if we can
+            // fast terminate the renderer process.
+            addBeforeUnloadEventListener(this);
+        } else {
+            // Subframes return false from allowsBeforeUnloadListeners.
+            UseCounter::count(this, UseCounter::SubFrameBeforeUnloadRegistered);
+        }
+    } else if (eventType == EventTypeNames::deviceorientation && RuntimeEnabledFeatures::deviceOrientationEnabled()) {
+        if (NewDeviceOrientationController* controller = NewDeviceOrientationController::from(document()))
+            controller->startUpdating();
+    }
+
+    return true;
+}
+
+bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture)
+{
+    if (!EventTarget::removeEventListener(eventType, listener, useCapture))
+        return false;
+
+    if (Document* document = this->document()) {
+        if (isTouchEventType(eventType))
+            document->didRemoveTouchEventHandler(document);
+    }
+
+    lifecycleNotifier()->notifyRemoveEventListener(this, eventType);
+
+    if (eventType == EventTypeNames::unload) {
+        removeUnloadEventListener(this);
+    } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadListeners(this)) {
+        removeBeforeUnloadEventListener(this);
+    } else if (eventType == EventTypeNames::deviceorientation) {
+        if (NewDeviceOrientationController* controller = NewDeviceOrientationController::from(document()))
+            controller->stopUpdating();
+    }
+
+    return true;
+}
+
+void DOMWindow::dispatchLoadEvent()
+{
+    RefPtr<Event> loadEvent(Event::create(EventTypeNames::load));
+    if (m_frame && m_frame->loader()->documentLoader() && !m_frame->loader()->documentLoader()->timing()->loadEventStart()) {
+        // The DocumentLoader (and thus its DocumentLoadTiming) might get destroyed while dispatching
+        // the event, so protect it to prevent writing the end time into freed memory.
+        RefPtr<DocumentLoader> documentLoader = m_frame->loader()->documentLoader();
+        DocumentLoadTiming* timing = documentLoader->timing();
+        timing->markLoadEventStart();
+        dispatchEvent(loadEvent, document());
+        timing->markLoadEventEnd();
+    } else
+        dispatchEvent(loadEvent, document());
+
+    // For load events, send a separate load event to the enclosing frame only.
+    // This is a DOM extension and is independent of bubbling/capturing rules of
+    // the DOM.
+    Element* ownerElement = m_frame ? m_frame->ownerElement() : 0;
+    if (ownerElement)
+        ownerElement->dispatchEvent(Event::create(EventTypeNames::load));
+
+    InspectorInstrumentation::loadEventFired(frame());
+}
+
+bool DOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget)
+{
+    RefPtr<EventTarget> protect = this;
+    RefPtr<Event> event = prpEvent;
+
+    event->setTarget(prpTarget ? prpTarget : this);
+    event->setCurrentTarget(this);
+    event->setEventPhase(Event::AT_TARGET);
+
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEventOnWindow(frame(), *event, this);
+
+    bool result = fireEventListeners(event.get());
+
+    InspectorInstrumentation::didDispatchEventOnWindow(cookie);
+
+    return result;
+}
+
+void DOMWindow::removeAllEventListeners()
+{
+    EventTarget::removeAllEventListeners();
+
+    lifecycleNotifier()->notifyRemoveAllEventListeners(this);
+
+    if (NewDeviceOrientationController* controller = NewDeviceOrientationController::from(document()))
+        controller->stopUpdating();
+    if (Document* document = this->document())
+        document->didRemoveEventTargetNode(document);
+
+    removeAllUnloadEventListeners(this);
+    removeAllBeforeUnloadEventListeners(this);
+}
+
+void DOMWindow::finishedLoading()
+{
+    if (m_shouldPrintWhenFinishedLoading) {
+        m_shouldPrintWhenFinishedLoading = false;
+        print();
+    }
+}
+
+void DOMWindow::setLocation(const String& urlString, DOMWindow* activeWindow, DOMWindow* firstWindow, SetLocationLocking locking)
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return;
+
+    Document* activeDocument = activeWindow->document();
+    if (!activeDocument)
+        return;
+
+    if (!activeDocument->canNavigate(m_frame))
+        return;
+
+    Frame* firstFrame = firstWindow->frame();
+    if (!firstFrame)
+        return;
+
+    KURL completedURL = firstFrame->document()->completeURL(urlString);
+    if (completedURL.isNull())
+        return;
+
+    if (isInsecureScriptAccess(activeWindow, completedURL))
+        return;
+
+    // We want a new history item if we are processing a user gesture.
+    m_frame->navigationScheduler()->scheduleLocationChange(activeDocument->securityOrigin(),
+        // FIXME: What if activeDocument()->frame() is 0?
+        completedURL, activeDocument->frame()->loader()->outgoingReferrer(),
+        locking != LockHistoryBasedOnGestureState);
+}
+
+void DOMWindow::printErrorMessage(const String& message)
+{
+    if (message.isEmpty())
+        return;
+
+    pageConsole()->addMessage(JSMessageSource, ErrorMessageLevel, message);
+}
+
+// FIXME: Once we're throwing exceptions for cross-origin access violations, we will always sanitize the target
+// frame details, so we can safely combine 'crossDomainAccessErrorMessage' with this method after considering
+// exactly which details may be exposed to JavaScript.
+//
+// http://crbug.com/17325
+String DOMWindow::sanitizedCrossDomainAccessErrorMessage(DOMWindow* activeWindow)
+{
+    const KURL& activeWindowURL = activeWindow->document()->url();
+    if (activeWindowURL.isNull())
+        return String();
+
+    ASSERT(!activeWindow->document()->securityOrigin()->canAccess(document()->securityOrigin()));
+
+    SecurityOrigin* activeOrigin = activeWindow->document()->securityOrigin();
+    String message = "Blocked a frame with origin \"" + activeOrigin->toString() + "\" from accessing a cross-origin frame.";
+
+    // FIXME: Evaluate which details from 'crossDomainAccessErrorMessage' may safely be reported to JavaScript.
+
+    return message;
+}
+
+String DOMWindow::crossDomainAccessErrorMessage(DOMWindow* activeWindow)
+{
+    const KURL& activeWindowURL = activeWindow->document()->url();
+    if (activeWindowURL.isNull())
+        return String();
+
+    ASSERT(!activeWindow->document()->securityOrigin()->canAccess(document()->securityOrigin()));
+
+    // FIXME: This message, and other console messages, have extra newlines. Should remove them.
+    SecurityOrigin* activeOrigin = activeWindow->document()->securityOrigin();
+    SecurityOrigin* targetOrigin = document()->securityOrigin();
+    String message = "Blocked a frame with origin \"" + activeOrigin->toString() + "\" from accessing a frame with origin \"" + targetOrigin->toString() + "\". ";
+
+    // Sandbox errors: Use the origin of the frames' location, rather than their actual origin (since we know that at least one will be "null").
+    KURL activeURL = activeWindow->document()->url();
+    KURL targetURL = document()->url();
+    if (document()->isSandboxed(SandboxOrigin) || activeWindow->document()->isSandboxed(SandboxOrigin)) {
+        message = "Blocked a frame at \"" + SecurityOrigin::create(activeURL)->toString() + "\" from accessing a frame at \"" + SecurityOrigin::create(targetURL)->toString() + "\". ";
+        if (document()->isSandboxed(SandboxOrigin) && activeWindow->document()->isSandboxed(SandboxOrigin))
+            return "Sandbox access violation: " + message + " Both frames are sandboxed and lack the \"allow-same-origin\" flag.";
+        if (document()->isSandboxed(SandboxOrigin))
+            return "Sandbox access violation: " + message + " The frame being accessed is sandboxed and lacks the \"allow-same-origin\" flag.";
+        return "Sandbox access violation: " + message + " The frame requesting access is sandboxed and lacks the \"allow-same-origin\" flag.";
+    }
+
+    // Protocol errors: Use the URL's protocol rather than the origin's protocol so that we get a useful message for non-heirarchal URLs like 'data:'.
+    if (targetOrigin->protocol() != activeOrigin->protocol())
+        return message + " The frame requesting access has a protocol of \"" + activeURL.protocol() + "\", the frame being accessed has a protocol of \"" + targetURL.protocol() + "\". Protocols must match.\n";
+
+    // 'document.domain' errors.
+    if (targetOrigin->domainWasSetInDOM() && activeOrigin->domainWasSetInDOM())
+        return message + "The frame requesting access set \"document.domain\" to \"" + activeOrigin->domain() + "\", the frame being accessed set it to \"" + targetOrigin->domain() + "\". Both must set \"document.domain\" to the same value to allow access.";
+    if (activeOrigin->domainWasSetInDOM())
+        return message + "The frame requesting access set \"document.domain\" to \"" + activeOrigin->domain() + "\", but the frame being accessed did not. Both must set \"document.domain\" to the same value to allow access.";
+    if (targetOrigin->domainWasSetInDOM())
+        return message + "The frame being accessed set \"document.domain\" to \"" + targetOrigin->domain() + "\", but the frame requesting access did not. Both must set \"document.domain\" to the same value to allow access.";
+
+    // Default.
+    return message + "Protocols, domains, and ports must match.";
+}
+
+bool DOMWindow::isInsecureScriptAccess(DOMWindow* activeWindow, const String& urlString)
+{
+    if (!protocolIsJavaScript(urlString))
+        return false;
+
+    // If this DOMWindow isn't currently active in the Frame, then there's no
+    // way we should allow the access.
+    // FIXME: Remove this check if we're able to disconnect DOMWindow from
+    // Frame on navigation: https://bugs.webkit.org/show_bug.cgi?id=62054
+    if (isCurrentlyDisplayedInFrame()) {
+        // FIXME: Is there some way to eliminate the need for a separate "activeWindow == this" check?
+        if (activeWindow == this)
+            return false;
+
+        // FIXME: The name canAccess seems to be a roundabout way to ask "can execute script".
+        // Can we name the SecurityOrigin function better to make this more clear?
+        if (activeWindow->document()->securityOrigin()->canAccess(document()->securityOrigin()))
+            return false;
+    }
+
+    printErrorMessage(crossDomainAccessErrorMessage(activeWindow));
+    return true;
+}
+
+PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicString& frameName, const String& windowFeaturesString,
+    DOMWindow* activeWindow, DOMWindow* firstWindow)
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return 0;
+    Document* activeDocument = activeWindow->document();
+    if (!activeDocument)
+        return 0;
+    Frame* firstFrame = firstWindow->frame();
+    if (!firstFrame)
+        return 0;
+
+    if (!firstWindow->allowPopUp()) {
+        // Because FrameTree::find() returns true for empty strings, we must check for empty frame names.
+        // Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker.
+        if (frameName.isEmpty() || !m_frame->tree()->find(frameName))
+            return 0;
+    }
+
+    // Get the target frame for the special cases of _top and _parent.
+    // In those cases, we schedule a location change right now and return early.
+    Frame* targetFrame = 0;
+    if (frameName == "_top")
+        targetFrame = m_frame->tree()->top();
+    else if (frameName == "_parent") {
+        if (Frame* parent = m_frame->tree()->parent())
+            targetFrame = parent;
+        else
+            targetFrame = m_frame;
+    }
+    if (targetFrame) {
+        if (!activeDocument->canNavigate(targetFrame))
+            return 0;
+
+        KURL completedURL = firstFrame->document()->completeURL(urlString);
+
+        if (targetFrame->domWindow()->isInsecureScriptAccess(activeWindow, completedURL))
+            return targetFrame->domWindow();
+
+        if (urlString.isEmpty())
+            return targetFrame->domWindow();
+
+        // For whatever reason, Firefox uses the first window rather than the active window to
+        // determine the outgoing referrer. We replicate that behavior here.
+        targetFrame->navigationScheduler()->scheduleLocationChange(
+            activeDocument->securityOrigin(),
+            completedURL,
+            firstFrame->loader()->outgoingReferrer(),
+            false);
+        return targetFrame->domWindow();
+    }
+
+    WindowFeatures windowFeatures(windowFeaturesString);
+    Frame* result = createWindow(urlString, frameName, windowFeatures, activeWindow, firstFrame, m_frame);
+    return result ? result->domWindow() : 0;
+}
+
+void DOMWindow::showModalDialog(const String& urlString, const String& dialogFeaturesString,
+    DOMWindow* activeWindow, DOMWindow* firstWindow, PrepareDialogFunction function, void* functionContext)
+{
+    if (!isCurrentlyDisplayedInFrame())
+        return;
+    Frame* activeFrame = activeWindow->frame();
+    if (!activeFrame)
+        return;
+    Frame* firstFrame = firstWindow->frame();
+    if (!firstFrame)
+        return;
+
+    if (!canShowModalDialogNow(m_frame) || !firstWindow->allowPopUp())
+        return;
+
+    WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_frame->view()));
+    Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures,
+        activeWindow, firstFrame, m_frame, function, functionContext);
+    if (!dialogFrame)
+        return;
+    UserGestureIndicatorDisabler disabler;
+    dialogFrame->page()->chrome().runModal();
+}
+
+DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index)
+{
+    Frame* frame = this->frame();
+    if (!frame)
+        return 0;
+
+    Frame* child = frame->tree()->scopedChild(index);
+    if (child)
+        return child->domWindow();
+
+    return 0;
+}
+
+DOMWindowLifecycleNotifier* DOMWindow::lifecycleNotifier()
+{
+    return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleNotifier());
+}
+
+PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier()
+{
+    return DOMWindowLifecycleNotifier::create(this);
+}
+
+
+} // namespace WebCore
diff --git a/Source/core/frame/DOMWindow.h b/Source/core/frame/DOMWindow.h
new file mode 100644
index 0000000..9126d6e
--- /dev/null
+++ b/Source/core/frame/DOMWindow.h
@@ -0,0 +1,444 @@
+/*
+ * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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,
+ * 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 DOMWindow_h
+#define DOMWindow_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/events/EventTarget.h"
+#include "core/frame/FrameDestructionObserver.h"
+#include "core/platform/LifecycleContext.h"
+#include "platform/Supplementable.h"
+
+#include "wtf/Forward.h"
+
+namespace WebCore {
+    class ApplicationCache;
+    class BarProp;
+    class CSSRuleList;
+    class CSSStyleDeclaration;
+    class Console;
+    class DOMPoint;
+    class DOMSelection;
+    class DOMURL;
+    class DOMWindowProperty;
+    class Database;
+    class DatabaseCallback;
+    class Document;
+    class DOMWindowLifecycleNotifier;
+    class Element;
+    class EventListener;
+    class ExceptionState;
+    class FloatRect;
+    class Frame;
+    class History;
+    class IDBFactory;
+    class Location;
+    class MediaQueryList;
+    class MessageEvent;
+    class Navigator;
+    class Node;
+    class Page;
+    class PageConsole;
+    class Performance;
+    class PostMessageTimer;
+    class RequestAnimationFrameCallback;
+    class ScheduledAction;
+    class Screen;
+    class ScriptCallStack;
+    class SecurityOrigin;
+    class SerializedScriptValue;
+    class Storage;
+    class StyleMedia;
+    class DOMWindowCSS;
+
+    struct WindowFeatures;
+
+    typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray;
+
+    enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBackForwardList };
+
+    class DOMWindow : public RefCounted<DOMWindow>, public ScriptWrappable, public EventTargetWithInlineData, public FrameDestructionObserver, public Supplementable<DOMWindow>, public LifecycleContext {
+    public:
+        static PassRefPtr<DOMWindow> create(Frame* frame) { return adoptRef(new DOMWindow(frame)); }
+        virtual ~DOMWindow();
+
+        // In some rare cases, we'll re-used a DOMWindow for a new Document. For example,
+        // when a script calls window.open("..."), the browser gives JavaScript a window
+        // synchronously but kicks off the load in the window asynchronously. Web sites
+        // expect that modifications that they make to the window object synchronously
+        // won't be blown away when the network load commits. To make that happen, we
+        // "securely transition" the existing DOMWindow to the Document that results from
+        // the network load. See also SecurityContext::isSecureTransitionTo.
+        void setDocument(PassRefPtr<Document>);
+
+        virtual const AtomicString& interfaceName() const OVERRIDE;
+        virtual ExecutionContext* executionContext() const OVERRIDE;
+
+        virtual DOMWindow* toDOMWindow();
+
+        void registerProperty(DOMWindowProperty*);
+        void unregisterProperty(DOMWindowProperty*);
+
+        void reset();
+
+        PassRefPtr<MediaQueryList> matchMedia(const String&);
+
+        unsigned pendingUnloadEventListeners() const;
+
+        static FloatRect adjustWindowRect(Page*, const FloatRect& pendingChanges);
+
+        bool allowPopUp(); // Call on first window, not target window.
+        static bool allowPopUp(Frame* firstFrame);
+        static bool canShowModalDialog(const Frame*);
+        static bool canShowModalDialogNow(const Frame*);
+
+        // DOM Level 0
+
+        Screen* screen() const;
+        History* history() 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(); }
+
+        Location* location() const;
+        void setLocation(const String& location, DOMWindow* activeWindow, DOMWindow* firstWindow,
+            SetLocationLocking = LockHistoryBasedOnGestureState);
+
+        DOMSelection* getSelection();
+
+        Element* frameElement() const;
+
+        void focus(ExecutionContext* = 0);
+        void blur();
+        void close(ExecutionContext* = 0);
+        void print();
+        void stop();
+
+        PassRefPtr<DOMWindow> open(const String& urlString, const AtomicString& frameName, const String& windowFeaturesString,
+            DOMWindow* activeWindow, DOMWindow* firstWindow);
+
+        typedef void (*PrepareDialogFunction)(DOMWindow*, void* context);
+        void showModalDialog(const String& urlString, const String& dialogFeaturesString,
+            DOMWindow* activeWindow, DOMWindow* firstWindow, PrepareDialogFunction, void* functionContext);
+
+        void alert(const String& message);
+        bool confirm(const String& message);
+        String prompt(const String& message, const String& defaultValue);
+
+        bool find(const String&, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) const;
+
+        bool offscreenBuffering() const;
+
+        int outerHeight() const;
+        int outerWidth() const;
+        int innerHeight() const;
+        int innerWidth() const;
+        int screenX() const;
+        int screenY() const;
+        int screenLeft() const { return screenX(); }
+        int screenTop() const { return screenY(); }
+        int scrollX() const;
+        int scrollY() const;
+        int pageXOffset() const { return scrollX(); }
+        int pageYOffset() const { return scrollY(); }
+
+        bool closed() const;
+
+        unsigned length() const;
+
+        String name() const;
+        void setName(const String&);
+
+        String status() const;
+        void setStatus(const String&);
+        String defaultStatus() const;
+        void setDefaultStatus(const String&);
+
+        // This attribute is an alias of defaultStatus and is necessary for legacy uses.
+        String defaultstatus() const { return defaultStatus(); }
+        void setDefaultstatus(const String& status) { setDefaultStatus(status); }
+
+        // Self-referential attributes
+
+        DOMWindow* self() const;
+        DOMWindow* window() const { return self(); }
+        DOMWindow* frames() const { return self(); }
+
+        DOMWindow* opener() const;
+        DOMWindow* parent() const;
+        DOMWindow* top() const;
+
+        // DOM Level 2 AbstractView Interface
+
+        Document* document() const;
+
+        // CSSOM View Module
+
+        PassRefPtr<StyleMedia> styleMedia() const;
+
+        // DOM Level 2 Style Interface
+
+        PassRefPtr<CSSStyleDeclaration> getComputedStyle(Element*, const String& pseudoElt) const;
+
+        // WebKit extensions
+
+        PassRefPtr<CSSRuleList> getMatchedCSSRules(Element*, const String& pseudoElt, bool authorOnly = true) const;
+        double devicePixelRatio() const;
+
+        PassRefPtr<DOMPoint> webkitConvertPointFromPageToNode(Node*, const DOMPoint*) const;
+        PassRefPtr<DOMPoint> webkitConvertPointFromNodeToPage(Node*, const DOMPoint*) const;
+
+        Console* console() const;
+        PageConsole* pageConsole() const;
+
+        void printErrorMessage(const String&);
+        String crossDomainAccessErrorMessage(DOMWindow* activeWindow);
+        String sanitizedCrossDomainAccessErrorMessage(DOMWindow* activeWindow);
+
+        void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionState&);
+        void postMessageTimerFired(PassOwnPtr<PostMessageTimer>);
+        void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, PassRefPtr<Event>, PassRefPtr<ScriptCallStack>);
+
+        void scrollBy(int x, int y) const;
+        void scrollTo(int x, int y) const;
+        void scroll(int x, int y) const { scrollTo(x, y); }
+
+        void moveBy(float x, float y) const;
+        void moveTo(float x, float y) const;
+
+        void resizeBy(float x, float y) const;
+        void resizeTo(float width, float height) const;
+
+        // WebKit animation extensions
+        int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
+        int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
+        void cancelAnimationFrame(int id);
+
+        DOMWindowCSS* css();
+
+        // Events
+        // EventTarget API
+        virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) OVERRIDE;
+        virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture) OVERRIDE;
+        virtual void removeAllEventListeners() OVERRIDE;
+
+        using EventTarget::dispatchEvent;
+        bool dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget);
+
+        void dispatchLoadEvent();
+
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(beforeunload);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(blur);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(canplay);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(canplaythrough);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(change);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(click);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(contextmenu);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(dblclick);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(drag);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(dragenter);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(dragleave);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(dragover);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(drop);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(durationchange);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(emptied);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(ended);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(focus);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(hashchange);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(input);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(keypress);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(keyup);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(load);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(loadeddata);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(loadedmetadata);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(mousedown);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseenter);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseleave);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(mousemove);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseout);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseover);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseup);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(mousewheel);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(offline);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(online);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(pagehide);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(pageshow);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(pause);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(play);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(playing);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(popstate);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(progress);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(ratechange);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(reset);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(resize);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(scroll);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(search);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(seeked);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(seeking);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(select);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(stalled);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(storage);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(submit);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(suspend);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(timeupdate);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(transitionend);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(unload);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(volumechange);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(waiting);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(wheel);
+
+        DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart, webkitAnimationStart);
+        DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitAnimationIteration);
+        DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEnd);
+        DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransitionEnd);
+
+        void captureEvents() { }
+        void releaseEvents() { }
+
+        void finishedLoading();
+
+        using RefCounted<DOMWindow>::ref;
+        using RefCounted<DOMWindow>::deref;
+
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(devicemotion);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(deviceorientation);
+
+        // HTML 5 key/value storage
+        Storage* sessionStorage(ExceptionState&) const;
+        Storage* localStorage(ExceptionState&) const;
+        Storage* optionalSessionStorage() const { return m_sessionStorage.get(); }
+        Storage* optionalLocalStorage() const { return m_localStorage.get(); }
+
+        ApplicationCache* applicationCache() const;
+        ApplicationCache* optionalApplicationCache() const { return m_applicationCache.get(); }
+
+#if ENABLE(ORIENTATION_EVENTS)
+        // This is the interface orientation in degrees. Some examples are:
+        //  0 is straight up; -90 is when the device is rotated 90 clockwise;
+        //  90 is when rotated counter clockwise.
+        int orientation() const;
+
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange);
+#endif
+
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
+
+        Performance* performance() const;
+
+        // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e.,
+        // when its document is no longer the document that is displayed in its
+        // frame), we would like to zero out m_frame to avoid being confused
+        // by the document that is currently active in m_frame.
+        bool isCurrentlyDisplayedInFrame() const;
+
+        void willDetachDocumentFromFrame();
+        DOMWindow* anonymousIndexedGetter(uint32_t);
+
+        bool isInsecureScriptAccess(DOMWindow* activeWindow, const String& urlString);
+
+    protected:
+        DOMWindowLifecycleNotifier* lifecycleNotifier();
+
+    private:
+        explicit DOMWindow(Frame*);
+
+        Page* page();
+
+        virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE;
+
+        virtual void frameDestroyed() OVERRIDE;
+        virtual void willDetachPage() OVERRIDE;
+
+        virtual void refEventTarget() OVERRIDE { ref(); }
+        virtual void derefEventTarget() OVERRIDE { deref(); }
+
+        void resetDOMWindowProperties();
+        void willDestroyDocumentInFrame();
+
+        RefPtr<Document> m_document;
+
+        bool m_shouldPrintWhenFinishedLoading;
+
+        HashSet<DOMWindowProperty*> m_properties;
+
+        mutable RefPtr<Screen> m_screen;
+        mutable RefPtr<History> m_history;
+        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;
+        mutable RefPtr<StyleMedia> m_media;
+
+        String m_status;
+        String m_defaultStatus;
+
+        mutable RefPtr<Storage> m_sessionStorage;
+        mutable RefPtr<Storage> m_localStorage;
+        mutable RefPtr<ApplicationCache> m_applicationCache;
+
+        mutable RefPtr<Performance> m_performance;
+
+        mutable RefPtr<DOMWindowCSS> m_css;
+    };
+
+    inline String DOMWindow::status() const
+    {
+        return m_status;
+    }
+
+    inline String DOMWindow::defaultStatus() const
+    {
+        return m_defaultStatus;
+    }
+
+} // namespace WebCore
+
+#endif // DOMWindow_h
diff --git a/Source/core/frame/DOMWindowBase64.cpp b/Source/core/frame/DOMWindowBase64.cpp
new file mode 100644
index 0000000..d2c1787
--- /dev/null
+++ b/Source/core/frame/DOMWindowBase64.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2013 Samsung Electronics. 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/frame/DOMWindowBase64.h"
+
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/ExceptionCode.h"
+#include "wtf/text/Base64.h"
+
+namespace WebCore {
+
+namespace DOMWindowBase64 {
+
+String btoa(void*, const String& stringToEncode, ExceptionState& es)
+{
+    if (stringToEncode.isNull())
+        return String();
+
+    if (!stringToEncode.containsOnlyLatin1()) {
+        es.throwDOMException(InvalidCharacterError, "'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
+        return String();
+    }
+
+    return base64Encode(stringToEncode.latin1());
+}
+
+String atob(void*, const String& encodedString, ExceptionState& es)
+{
+    if (encodedString.isNull())
+        return String();
+
+    if (!encodedString.containsOnlyLatin1()) {
+        es.throwDOMException(InvalidCharacterError, "'atob' failed: The string to be decoded contains characters outside of the Latin1 range.");
+        return String();
+    }
+
+    Vector<char> out;
+    if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacterOrExcessPadding)) {
+        es.throwDOMException(InvalidCharacterError, "'atob' failed: The string to be decoded is not correctly encoded.");
+        return String();
+    }
+
+    return String(out.data(), out.size());
+}
+
+} // namespace DOMWindowBase64
+
+} // namespace WebCore
diff --git a/Source/core/page/DOMWindowBase64.h b/Source/core/frame/DOMWindowBase64.h
similarity index 100%
rename from Source/core/page/DOMWindowBase64.h
rename to Source/core/frame/DOMWindowBase64.h
diff --git a/Source/core/frame/DOMWindowLifecycleNotifier.cpp b/Source/core/frame/DOMWindowLifecycleNotifier.cpp
new file mode 100644
index 0000000..7132bf6
--- /dev/null
+++ b/Source/core/frame/DOMWindowLifecycleNotifier.cpp
@@ -0,0 +1,83 @@
+/*
+ * 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:
+ * 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/frame/DOMWindowLifecycleNotifier.h"
+
+namespace WebCore {
+
+DOMWindowLifecycleNotifier::DOMWindowLifecycleNotifier(LifecycleContext* context)
+    : LifecycleNotifier(context)
+{
+}
+
+void DOMWindowLifecycleNotifier::addObserver(LifecycleObserver* observer)
+{
+    if (observer->observerType() == LifecycleObserver::DOMWindowLifecycleObserverType) {
+        RELEASE_ASSERT(m_iterating != IteratingOverDOMWindowObservers);
+        m_windowObservers.add(static_cast<DOMWindowLifecycleObserver*>(observer));
+    }
+
+    LifecycleNotifier::addObserver(observer);
+}
+
+void DOMWindowLifecycleNotifier::removeObserver(LifecycleObserver* observer)
+{
+    if (observer->observerType() == LifecycleObserver::DOMWindowLifecycleObserverType) {
+        RELEASE_ASSERT(m_iterating != IteratingOverDOMWindowObservers);
+        m_windowObservers.remove(static_cast<DOMWindowLifecycleObserver*>(observer));
+    }
+
+    LifecycleNotifier::removeObserver(observer);
+}
+
+PassOwnPtr<DOMWindowLifecycleNotifier> DOMWindowLifecycleNotifier::create(LifecycleContext* context)
+{
+    return adoptPtr(new DOMWindowLifecycleNotifier(context));
+}
+
+void DOMWindowLifecycleNotifier::notifyAddEventListener(DOMWindow* window, const AtomicString& eventType)
+{
+    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDOMWindowObservers);
+    for (DOMWindowObserverSet::iterator it = m_windowObservers.begin(); it != m_windowObservers.end(); ++it)
+        (*it)->didAddEventListener(window, eventType);
+}
+
+void DOMWindowLifecycleNotifier::notifyRemoveEventListener(DOMWindow* window, const AtomicString& eventType)
+{
+    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDOMWindowObservers);
+    for (DOMWindowObserverSet::iterator it = m_windowObservers.begin(); it != m_windowObservers.end(); ++it)
+        (*it)->didRemoveEventListener(window, eventType);
+}
+
+void DOMWindowLifecycleNotifier::notifyRemoveAllEventListeners(DOMWindow* window)
+{
+    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDOMWindowObservers);
+    for (DOMWindowObserverSet::iterator it = m_windowObservers.begin(); it != m_windowObservers.end(); ++it)
+        (*it)->didRemoveAllEventListeners(window);
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/DOMWindowLifecycleNotifier.h b/Source/core/frame/DOMWindowLifecycleNotifier.h
new file mode 100644
index 0000000..f439420
--- /dev/null
+++ b/Source/core/frame/DOMWindowLifecycleNotifier.h
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ * 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 DOMWindowLifecycleNotifier_h
+#define DOMWindowLifecycleNotifier_h
+
+#include "core/frame/DOMWindowLifecycleObserver.h"
+#include "core/platform/LifecycleNotifier.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/TemporaryChange.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class DOMWindow;
+
+class DOMWindowLifecycleNotifier : public LifecycleNotifier {
+public:
+    static PassOwnPtr<DOMWindowLifecycleNotifier> create(LifecycleContext*);
+
+    void notifyAddEventListener(DOMWindow*, const AtomicString& eventType);
+    void notifyRemoveEventListener(DOMWindow*, const AtomicString& eventType);
+    void notifyRemoveAllEventListeners(DOMWindow*);
+
+    virtual void addObserver(LifecycleObserver*) OVERRIDE;
+    virtual void removeObserver(LifecycleObserver*) OVERRIDE;
+
+private:
+    explicit DOMWindowLifecycleNotifier(LifecycleContext*);
+
+    typedef HashSet<DOMWindowLifecycleObserver*> DOMWindowObserverSet;
+    DOMWindowObserverSet m_windowObservers;
+};
+
+} // namespace WebCore
+
+#endif // DOMWindowLifecycleNotifier_h
diff --git a/Source/core/frame/DOMWindowLifecycleObserver.cpp b/Source/core/frame/DOMWindowLifecycleObserver.cpp
new file mode 100644
index 0000000..cb52bb2
--- /dev/null
+++ b/Source/core/frame/DOMWindowLifecycleObserver.cpp
@@ -0,0 +1,48 @@
+/*
+ * 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:
+ * 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/frame/DOMWindowLifecycleObserver.h"
+
+#include "core/frame/DOMWindow.h"
+
+namespace WebCore {
+
+DOMWindowLifecycleObserver::DOMWindowLifecycleObserver(DOMWindow* window)
+    : LifecycleObserver(window, DOMWindowLifecycleObserverType)
+{
+}
+
+DOMWindowLifecycleObserver::~DOMWindowLifecycleObserver()
+{
+}
+
+DOMWindow* DOMWindowLifecycleObserver::window() const
+{
+    return static_cast<DOMWindow*>(lifecycleContext());
+}
+
+} // namespace WebCore
diff --git a/Source/core/page/DOMWindowLifecycleObserver.h b/Source/core/frame/DOMWindowLifecycleObserver.h
similarity index 100%
rename from Source/core/page/DOMWindowLifecycleObserver.h
rename to Source/core/frame/DOMWindowLifecycleObserver.h
diff --git a/Source/core/frame/DOMWindowProperty.cpp b/Source/core/frame/DOMWindowProperty.cpp
new file mode 100644
index 0000000..6649a2f
--- /dev/null
+++ b/Source/core/frame/DOMWindowProperty.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2011 Google, Inc. All Rights Reserved.
+ * 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 GOOGLE 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/frame/DOMWindowProperty.h"
+
+#include "core/dom/Document.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
+
+namespace WebCore {
+
+DOMWindowProperty::DOMWindowProperty(Frame* frame)
+    : m_frame(frame)
+    , m_associatedDOMWindow(0)
+{
+    // FIXME: For now it *is* acceptable for a DOMWindowProperty to be created with a null frame.
+    // See fast/dom/navigator-detached-no-crash.html for the recipe.
+    // We should fix that.  <rdar://problem/11567132>
+    if (m_frame) {
+        m_associatedDOMWindow = m_frame->domWindow();
+        m_associatedDOMWindow->registerProperty(this);
+    }
+}
+
+DOMWindowProperty::~DOMWindowProperty()
+{
+    if (m_associatedDOMWindow)
+        m_associatedDOMWindow->unregisterProperty(this);
+
+    m_associatedDOMWindow = 0;
+    m_frame = 0;
+}
+
+void DOMWindowProperty::willDestroyGlobalObjectInFrame()
+{
+    // If the property is getting this callback it must have been created with a Frame/DOMWindow and it should still have them.
+    ASSERT(m_frame);
+    ASSERT(m_associatedDOMWindow);
+
+    // DOMWindowProperty lifetime isn't tied directly to the DOMWindow itself so it is important that it unregister
+    // itself from any DOMWindow it is associated with if that DOMWindow is going away.
+    if (m_associatedDOMWindow)
+        m_associatedDOMWindow->unregisterProperty(this);
+    m_associatedDOMWindow = 0;
+    m_frame = 0;
+}
+
+void DOMWindowProperty::willDetachGlobalObjectFromFrame()
+{
+    // If the property is getting this callback it must have been created with a Frame/DOMWindow and it should still have them.
+    ASSERT(m_frame);
+    ASSERT(m_associatedDOMWindow);
+}
+
+}
diff --git a/Source/core/page/DOMWindowProperty.h b/Source/core/frame/DOMWindowProperty.h
similarity index 100%
rename from Source/core/page/DOMWindowProperty.h
rename to Source/core/frame/DOMWindowProperty.h
diff --git a/Source/core/frame/DOMWindowTimers.cpp b/Source/core/frame/DOMWindowTimers.cpp
new file mode 100644
index 0000000..b0e082c
--- /dev/null
+++ b/Source/core/frame/DOMWindowTimers.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2013 Samsung Electronics. 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/frame/DOMWindowTimers.h"
+
+#include "core/events/EventTarget.h"
+#include "core/frame/DOMTimer.h"
+
+namespace WebCore {
+
+namespace DOMWindowTimers {
+
+int setTimeout(EventTarget* eventTarget, PassOwnPtr<ScheduledAction> action, int timeout)
+{
+    return DOMTimer::install(eventTarget->executionContext(), action, timeout, true);
+}
+
+int setInterval(EventTarget* eventTarget, PassOwnPtr<ScheduledAction> action, int timeout)
+{
+    return DOMTimer::install(eventTarget->executionContext(), action, timeout, false);
+}
+
+void clearTimeout(EventTarget* eventTarget, int timeoutID)
+{
+    if (ExecutionContext* context = eventTarget->executionContext())
+        DOMTimer::removeByID(context, timeoutID);
+}
+
+void clearInterval(EventTarget* eventTarget, int timeoutID)
+{
+    if (ExecutionContext* context = eventTarget->executionContext())
+        DOMTimer::removeByID(context, timeoutID);
+}
+
+} // namespace DOMWindowTimers
+
+} // namespace WebCore
diff --git a/Source/core/page/DOMWindowTimers.h b/Source/core/frame/DOMWindowTimers.h
similarity index 100%
rename from Source/core/page/DOMWindowTimers.h
rename to Source/core/frame/DOMWindowTimers.h
diff --git a/Source/core/frame/Frame.cpp b/Source/core/frame/Frame.cpp
new file mode 100644
index 0000000..786fd49
--- /dev/null
+++ b/Source/core/frame/Frame.cpp
@@ -0,0 +1,685 @@
+/*
+ * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ *                     1999 Lars Knoll <knoll@kde.org>
+ *                     1999 Antti Koivisto <koivisto@kde.org>
+ *                     2000 Simon Hausmann <hausmann@kde.org>
+ *                     2000 Stefan Schimanski <1Stein@gmx.de>
+ *                     2001 George Staikos <staikos@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
+ * Copyright (C) 2008 Google Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "core/frame/Frame.h"
+
+#include "RuntimeEnabledFeatures.h"
+#include "bindings/v8/ScriptController.h"
+#include "core/dom/DocumentType.h"
+#include "core/events/Event.h"
+#include "core/dom/WheelController.h"
+#include "core/editing/Editor.h"
+#include "core/editing/FrameSelection.h"
+#include "core/editing/InputMethodController.h"
+#include "core/editing/SpellChecker.h"
+#include "core/editing/htmlediting.h"
+#include "core/editing/markup.h"
+#include "core/fetch/ResourceFetcher.h"
+#include "core/html/HTMLFrameElementBase.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/loader/FrameLoader.h"
+#include "core/loader/FrameLoaderClient.h"
+#include "core/page/Chrome.h"
+#include "core/page/ChromeClient.h"
+#include "core/frame/DOMWindow.h"
+#include "core/page/EventHandler.h"
+#include "core/page/FocusController.h"
+#include "core/frame/FrameDestructionObserver.h"
+#include "core/frame/FrameView.h"
+#include "core/page/Page.h"
+#include "core/page/Settings.h"
+#include "core/frame/animation/AnimationController.h"
+#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/platform/DragImage.h"
+#include "core/platform/graphics/GraphicsContext.h"
+#include "core/platform/graphics/ImageBuffer.h"
+#include "core/rendering/HitTestResult.h"
+#include "core/rendering/RenderLayerCompositor.h"
+#include "core/rendering/RenderPart.h"
+#include "core/rendering/RenderView.h"
+#include "core/svg/SVGDocument.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/RefCountedLeakCounter.h"
+#include "wtf/StdLibExtras.h"
+
+using namespace std;
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, frameCounter, ("Frame"));
+
+static inline Frame* parentFromOwnerElement(HTMLFrameOwnerElement* ownerElement)
+{
+    if (!ownerElement)
+        return 0;
+    return ownerElement->document().frame();
+}
+
+static inline float parentPageZoomFactor(Frame* frame)
+{
+    Frame* parent = frame->tree()->parent();
+    if (!parent)
+        return 1;
+    return parent->pageZoomFactor();
+}
+
+static inline float parentTextZoomFactor(Frame* frame)
+{
+    Frame* parent = frame->tree()->parent();
+    if (!parent)
+        return 1;
+    return parent->textZoomFactor();
+}
+
+inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* frameLoaderClient)
+    : m_page(page)
+    , m_treeNode(this, parentFromOwnerElement(ownerElement))
+    , m_loader(this, frameLoaderClient)
+    , m_navigationScheduler(this)
+    , m_ownerElement(ownerElement)
+    , m_script(adoptPtr(new ScriptController(this)))
+    , m_editor(Editor::create(*this))
+    , m_spellChecker(SpellChecker::create(*this))
+    , m_selection(adoptPtr(new FrameSelection(this)))
+    , m_eventHandler(adoptPtr(new EventHandler(this)))
+    , m_animationController(adoptPtr(new AnimationController(this)))
+    , m_inputMethodController(InputMethodController::create(*this))
+    , m_pageZoomFactor(parentPageZoomFactor(this))
+    , m_textZoomFactor(parentTextZoomFactor(this))
+#if ENABLE(ORIENTATION_EVENTS)
+    , m_orientation(0)
+#endif
+    , m_inViewSourceMode(false)
+{
+    ASSERT(page);
+
+    if (ownerElement) {
+        page->incrementSubframeCount();
+        ownerElement->setContentFrame(this);
+    }
+
+#ifndef NDEBUG
+    frameCounter.increment();
+#endif
+}
+
+PassRefPtr<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client)
+{
+    RefPtr<Frame> frame = adoptRef(new Frame(page, ownerElement, client));
+    if (!ownerElement)
+        page->setMainFrame(frame);
+    InspectorInstrumentation::frameAttachedToParent(frame.get());
+    return frame.release();
+}
+
+Frame::~Frame()
+{
+    setView(0);
+    loader()->clear(ClearScriptObjects | ClearWindowObject);
+
+    // FIXME: We should not be doing all this work inside the destructor
+
+#ifndef NDEBUG
+    frameCounter.decrement();
+#endif
+
+    disconnectOwnerElement();
+
+    HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.end();
+    for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it)
+        (*it)->frameDestroyed();
+}
+
+bool Frame::inScope(TreeScope* scope) const
+{
+    ASSERT(scope);
+    Document* doc = document();
+    if (!doc)
+        return false;
+    HTMLFrameOwnerElement* owner = doc->ownerElement();
+    if (!owner)
+        return false;
+    return owner->treeScope() == scope;
+}
+
+void Frame::addDestructionObserver(FrameDestructionObserver* observer)
+{
+    m_destructionObservers.add(observer);
+}
+
+void Frame::removeDestructionObserver(FrameDestructionObserver* observer)
+{
+    m_destructionObservers.remove(observer);
+}
+
+void Frame::setView(PassRefPtr<FrameView> view)
+{
+    // We the custom scroll bars as early as possible to prevent m_doc->detach()
+    // from messing with the view such that its scroll bars won't be torn down.
+    // FIXME: We should revisit this.
+    if (m_view)
+        m_view->prepareForDetach();
+
+    // Prepare for destruction now, so any unload event handlers get run and the DOMWindow is
+    // notified. If we wait until the view is destroyed, then things won't be hooked up enough for
+    // these calls to work.
+    if (!view && document() && document()->confusingAndOftenMisusedAttached()) {
+        // FIXME: We don't call willRemove here. Why is that OK?
+        document()->prepareForDestruction();
+    }
+
+    if (m_view)
+        m_view->unscheduleRelayout();
+
+    eventHandler()->clear();
+
+    m_view = view;
+
+    if (m_view && m_page && m_page->mainFrame() == this)
+        m_view->setVisibleContentScaleFactor(m_page->pageScaleFactor());
+}
+
+#if ENABLE(ORIENTATION_EVENTS)
+void Frame::sendOrientationChangeEvent(int orientation)
+{
+    m_orientation = orientation;
+    if (Document* doc = document())
+        doc->dispatchWindowEvent(Event::create(EventTypeNames::orientationchange));
+}
+#endif // ENABLE(ORIENTATION_EVENTS)
+
+Settings* Frame::settings() const
+{
+    return m_page ? &m_page->settings() : 0;
+}
+
+void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize)
+{
+    // In setting printing, we should not validate resources already cached for the document.
+    // See https://bugs.webkit.org/show_bug.cgi?id=43704
+    ResourceCacheValidationSuppressor validationSuppressor(document()->fetcher());
+
+    document()->setPrinting(printing);
+    view()->adjustMediaTypeForPrinting(printing);
+
+    document()->styleResolverChanged(RecalcStyleImmediately);
+    if (shouldUsePrintingLayout()) {
+        view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize);
+    } else {
+        view()->forceLayout();
+        if (shouldAdjustViewSize == AdjustViewSize)
+            view()->adjustViewSize();
+    }
+
+    // Subframes of the one we're printing don't lay out to the page size.
+    for (RefPtr<Frame> child = tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->setPrinting(printing, FloatSize(), FloatSize(), 0, shouldAdjustViewSize);
+}
+
+bool Frame::shouldUsePrintingLayout() const
+{
+    // Only top frame being printed should be fit to page size.
+    // Subframes should be constrained by parents only.
+    return document()->printing() && (!tree()->parent() || !tree()->parent()->document()->printing());
+}
+
+FloatSize Frame::resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize)
+{
+    FloatSize resultSize;
+    if (!contentRenderer())
+        return FloatSize();
+
+    if (contentRenderer()->style()->isHorizontalWritingMode()) {
+        ASSERT(fabs(originalSize.width()) > numeric_limits<float>::epsilon());
+        float ratio = originalSize.height() / originalSize.width();
+        resultSize.setWidth(floorf(expectedSize.width()));
+        resultSize.setHeight(floorf(resultSize.width() * ratio));
+    } else {
+        ASSERT(fabs(originalSize.height()) > numeric_limits<float>::epsilon());
+        float ratio = originalSize.width() / originalSize.height();
+        resultSize.setHeight(floorf(expectedSize.height()));
+        resultSize.setWidth(floorf(resultSize.height() * ratio));
+    }
+    return resultSize;
+}
+
+void Frame::setDOMWindow(PassRefPtr<DOMWindow> domWindow)
+{
+    m_domWindow = domWindow;
+}
+
+Document* Frame::document() const
+{
+    return m_domWindow ? m_domWindow->document() : 0;
+}
+
+RenderView* Frame::contentRenderer() const
+{
+    return document() ? document()->renderView() : 0;
+}
+
+RenderPart* Frame::ownerRenderer() const
+{
+    HTMLFrameOwnerElement* ownerElement = m_ownerElement;
+    if (!ownerElement)
+        return 0;
+    RenderObject* object = ownerElement->renderer();
+    if (!object)
+        return 0;
+    // FIXME: If <object> is ever fixed to disassociate itself from frames
+    // that it has started but canceled, then this can turn into an ASSERT
+    // since m_ownerElement would be 0 when the load is canceled.
+    // https://bugs.webkit.org/show_bug.cgi?id=18585
+    if (!object->isRenderPart())
+        return 0;
+    return toRenderPart(object);
+}
+
+void Frame::dispatchVisibilityStateChangeEvent()
+{
+    if (document())
+        document()->dispatchVisibilityStateChangeEvent();
+
+    Vector<RefPtr<Frame> > childFrames;
+    for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
+        childFrames.append(child);
+
+    for (size_t i = 0; i < childFrames.size(); ++i)
+        childFrames[i]->dispatchVisibilityStateChangeEvent();
+}
+
+void Frame::willDetachPage()
+{
+    // We should never be detatching the page during a Layout.
+    RELEASE_ASSERT(!m_view || !m_view->isInLayout());
+
+    if (Frame* parent = tree()->parent())
+        parent->loader()->checkLoadComplete();
+
+    HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.end();
+    for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it)
+        (*it)->willDetachPage();
+
+    // FIXME: It's unclear as to why this is called more than once, but it is,
+    // so page() could be NULL.
+    if (page() && page()->focusController().focusedFrame() == this)
+        page()->focusController().setFocusedFrame(0);
+
+    if (page() && page()->scrollingCoordinator() && m_view)
+        page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
+
+    script()->clearScriptObjects();
+}
+
+void Frame::detachFromPage()
+{
+    // We should never be detatching the page during a Layout.
+    RELEASE_ASSERT(!m_view || !m_view->isInLayout());
+    m_page = 0;
+}
+
+void Frame::disconnectOwnerElement()
+{
+    if (m_ownerElement) {
+        if (Document* doc = document())
+            doc->topDocument()->clearAXObjectCache();
+        m_ownerElement->clearContentFrame();
+        if (m_page)
+            m_page->decrementSubframeCount();
+    }
+    m_ownerElement = 0;
+}
+
+String Frame::documentTypeString() const
+{
+    if (DocumentType* doctype = document()->doctype())
+        return createMarkup(doctype);
+
+    return String();
+}
+
+String Frame::selectedText() const
+{
+    return selection().selectedText();
+}
+
+String Frame::selectedTextForClipboard() const
+{
+    return selection().selectedTextForClipboard();
+}
+
+VisiblePosition Frame::visiblePositionForPoint(const IntPoint& framePoint)
+{
+    HitTestResult result = eventHandler()->hitTestResultAtPoint(framePoint);
+    Node* node = result.innerNonSharedNode();
+    if (!node)
+        return VisiblePosition();
+    RenderObject* renderer = node->renderer();
+    if (!renderer)
+        return VisiblePosition();
+    VisiblePosition visiblePos = VisiblePosition(renderer->positionForPoint(result.localPoint()));
+    if (visiblePos.isNull())
+        visiblePos = firstPositionInOrBeforeNode(node);
+    return visiblePos;
+}
+
+Document* Frame::documentAtPoint(const IntPoint& point)
+{
+    if (!view())
+        return 0;
+
+    IntPoint pt = view()->windowToContents(point);
+    HitTestResult result = HitTestResult(pt);
+
+    if (contentRenderer())
+        result = eventHandler()->hitTestResultAtPoint(pt, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
+    return result.innerNode() ? &result.innerNode()->document() : 0;
+}
+
+PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint)
+{
+    VisiblePosition position = visiblePositionForPoint(framePoint);
+    if (position.isNull())
+        return 0;
+
+    VisiblePosition previous = position.previous();
+    if (previous.isNotNull()) {
+        RefPtr<Range> previousCharacterRange = makeRange(previous, position);
+        LayoutRect rect = editor().firstRectForRange(previousCharacterRange.get());
+        if (rect.contains(framePoint))
+            return previousCharacterRange.release();
+    }
+
+    VisiblePosition next = position.next();
+    if (RefPtr<Range> nextCharacterRange = makeRange(position, next)) {
+        LayoutRect rect = editor().firstRectForRange(nextCharacterRange.get());
+        if (rect.contains(framePoint))
+            return nextCharacterRange.release();
+    }
+
+    return 0;
+}
+
+void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent,
+    const IntSize& fixedLayoutSize, bool useFixedLayout, ScrollbarMode horizontalScrollbarMode, bool horizontalLock,
+    ScrollbarMode verticalScrollbarMode, bool verticalLock)
+{
+    ASSERT(this);
+    ASSERT(m_page);
+
+    bool isMainFrame = this == m_page->mainFrame();
+
+    if (isMainFrame && view())
+        view()->setParentVisible(false);
+
+    setView(0);
+
+    RefPtr<FrameView> frameView;
+    if (isMainFrame) {
+        frameView = FrameView::create(this, viewportSize);
+        frameView->setFixedLayoutSize(fixedLayoutSize);
+        frameView->setUseFixedLayout(useFixedLayout);
+    } else
+        frameView = FrameView::create(this);
+
+    frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock);
+
+    setView(frameView);
+
+    if (backgroundColor.isValid())
+        frameView->updateBackgroundRecursively(backgroundColor, transparent);
+
+    if (isMainFrame)
+        frameView->setParentVisible(true);
+
+    if (ownerRenderer())
+        ownerRenderer()->setWidget(frameView);
+
+    if (HTMLFrameOwnerElement* owner = ownerElement())
+        view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOff);
+}
+
+String Frame::layerTreeAsText(unsigned flags) const
+{
+    document()->updateLayout();
+
+    if (!contentRenderer())
+        return String();
+
+    return contentRenderer()->compositor()->layerTreeAsText(static_cast<LayerTreeFlags>(flags));
+}
+
+String Frame::trackedRepaintRectsAsText() const
+{
+    if (!m_view)
+        return String();
+    return m_view->trackedRepaintRectsAsText();
+}
+
+void Frame::setPageZoomFactor(float factor)
+{
+    setPageAndTextZoomFactors(factor, m_textZoomFactor);
+}
+
+void Frame::setTextZoomFactor(float factor)
+{
+    setPageAndTextZoomFactors(m_pageZoomFactor, factor);
+}
+
+void Frame::setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor)
+{
+    if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor)
+        return;
+
+    Page* page = this->page();
+    if (!page)
+        return;
+
+    Document* document = this->document();
+    if (!document)
+        return;
+
+    // Respect SVGs zoomAndPan="disabled" property in standalone SVG documents.
+    // FIXME: How to handle compound documents + zoomAndPan="disabled"? Needs SVG WG clarification.
+    if (document->isSVGDocument()) {
+        if (!toSVGDocument(document)->zoomAndPanEnabled())
+            return;
+    }
+
+    if (m_pageZoomFactor != pageZoomFactor) {
+        if (FrameView* view = this->view()) {
+            // Update the scroll position when doing a full page zoom, so the content stays in relatively the same position.
+            LayoutPoint scrollPosition = view->scrollPosition();
+            float percentDifference = (pageZoomFactor / m_pageZoomFactor);
+            view->setScrollPosition(IntPoint(scrollPosition.x() * percentDifference, scrollPosition.y() * percentDifference));
+        }
+    }
+
+    m_pageZoomFactor = pageZoomFactor;
+    m_textZoomFactor = textZoomFactor;
+
+    document->recalcStyle(Force);
+
+    for (RefPtr<Frame> child = tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->setPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor);
+
+    if (FrameView* view = this->view()) {
+        if (document->renderer() && document->renderer()->needsLayout() && view->didFirstLayout())
+            view->layout();
+    }
+}
+
+void Frame::deviceOrPageScaleFactorChanged()
+{
+    for (RefPtr<Frame> child = tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->deviceOrPageScaleFactorChanged();
+}
+
+void Frame::notifyChromeClientWheelEventHandlerCountChanged() const
+{
+    // Ensure that this method is being called on the main frame of the page.
+    ASSERT(m_page && m_page->mainFrame() == this);
+
+    unsigned count = 0;
+    for (const Frame* frame = this; frame; frame = frame->tree()->traverseNext()) {
+        if (frame->document())
+            count += WheelController::from(frame->document())->wheelEventHandlerCount();
+    }
+
+    m_page->chrome().client().numWheelEventHandlersChanged(count);
+}
+
+bool Frame::isURLAllowed(const KURL& url) const
+{
+    // We allow one level of self-reference because some sites depend on that,
+    // but we don't allow more than one.
+    if (m_page->subframeCount() >= Page::maxNumberOfFrames)
+        return false;
+    bool foundSelfReference = false;
+    for (const Frame* frame = this; frame; frame = frame->tree()->parent()) {
+        if (equalIgnoringFragmentIdentifier(frame->document()->url(), url)) {
+            if (foundSelfReference)
+                return false;
+            foundSelfReference = true;
+        }
+    }
+    return true;
+}
+
+struct ScopedFramePaintingState {
+    ScopedFramePaintingState(Frame* frame, Node* node)
+        : frame(frame)
+        , node(node)
+        , paintBehavior(frame->view()->paintBehavior())
+        , backgroundColor(frame->view()->baseBackgroundColor())
+    {
+        ASSERT(!node || node->renderer());
+        if (node)
+            node->renderer()->updateDragState(true);
+    }
+
+    ~ScopedFramePaintingState()
+    {
+        if (node && node->renderer())
+            node->renderer()->updateDragState(false);
+        frame->view()->setPaintBehavior(paintBehavior);
+        frame->view()->setBaseBackgroundColor(backgroundColor);
+        frame->view()->setNodeToDraw(0);
+    }
+
+    Frame* frame;
+    Node* node;
+    PaintBehavior paintBehavior;
+    Color backgroundColor;
+};
+
+PassOwnPtr<DragImage> Frame::nodeImage(Node* node)
+{
+    if (!node->renderer())
+        return nullptr;
+
+    const ScopedFramePaintingState state(this, node);
+
+    m_view->setPaintBehavior(state.paintBehavior | PaintBehaviorFlattenCompositingLayers);
+
+    // When generating the drag image for an element, ignore the document background.
+    m_view->setBaseBackgroundColor(Color::transparent);
+    document()->updateLayout();
+    m_view->setNodeToDraw(node); // Enable special sub-tree drawing mode.
+
+    // Document::updateLayout may have blown away the original RenderObject.
+    RenderObject* renderer = node->renderer();
+    if (!renderer)
+        return nullptr;
+
+    LayoutRect topLevelRect;
+    IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLevelRect));
+
+    float deviceScaleFactor = 1;
+    if (m_page)
+        deviceScaleFactor = m_page->deviceScaleFactor();
+    paintingRect.setWidth(paintingRect.width() * deviceScaleFactor);
+    paintingRect.setHeight(paintingRect.height() * deviceScaleFactor);
+
+    OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor));
+    if (!buffer)
+        return nullptr;
+    buffer->context()->translate(-paintingRect.x(), -paintingRect.y());
+    buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY()));
+
+    m_view->paintContents(buffer->context(), paintingRect);
+
+    RefPtr<Image> image = buffer->copyImage();
+    return DragImage::create(image.get(), renderer->shouldRespectImageOrientation());
+}
+
+PassOwnPtr<DragImage> Frame::dragImageForSelection()
+{
+    if (!selection().isRange())
+        return nullptr;
+
+    const ScopedFramePaintingState state(this, 0);
+    m_view->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorFlattenCompositingLayers);
+    document()->updateLayout();
+
+    IntRect paintingRect = enclosingIntRect(selection().bounds());
+
+    float deviceScaleFactor = 1;
+    if (m_page)
+        deviceScaleFactor = m_page->deviceScaleFactor();
+    paintingRect.setWidth(paintingRect.width() * deviceScaleFactor);
+    paintingRect.setHeight(paintingRect.height() * deviceScaleFactor);
+
+    OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor));
+    if (!buffer)
+        return nullptr;
+    buffer->context()->translate(-paintingRect.x(), -paintingRect.y());
+    buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY()));
+
+    m_view->paintContents(buffer->context(), paintingRect);
+
+    RefPtr<Image> image = buffer->copyImage();
+    return DragImage::create(image.get());
+}
+
+double Frame::devicePixelRatio() const
+{
+    if (!m_page)
+        return 0;
+
+    double ratio = m_page->deviceScaleFactor();
+    if (RuntimeEnabledFeatures::devicePixelRatioIncludesZoomEnabled())
+        ratio *= pageZoomFactor();
+    return ratio;
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/Frame.h b/Source/core/frame/Frame.h
new file mode 100644
index 0000000..33eba25
--- /dev/null
+++ b/Source/core/frame/Frame.h
@@ -0,0 +1,287 @@
+/*
+ * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ *                     1999-2001 Lars Knoll <knoll@kde.org>
+ *                     1999-2001 Antti Koivisto <koivisto@kde.org>
+ *                     2000-2001 Simon Hausmann <hausmann@kde.org>
+ *                     2000-2001 Dirk Mueller <mueller@kde.org>
+ *                     2000 Stefan Schimanski <1Stein@gmx.de>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef Frame_h
+#define Frame_h
+
+#include "core/loader/FrameLoader.h"
+#include "core/loader/NavigationScheduler.h"
+#include "core/frame/AdjustViewSizeOrNot.h"
+#include "core/page/FrameTree.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/scroll/ScrollTypes.h"
+#include "wtf/Forward.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+    class AnimationController;
+    class Color;
+    class DOMWindow;
+    class Document;
+    class DragImage;
+    class Editor;
+    class Element;
+    class EventHandler;
+    class FetchContext;
+    class FloatSize;
+    class FrameDestructionObserver;
+    class FrameSelection;
+    class FrameView;
+    class HTMLFrameOwnerElement;
+    class HTMLTableCellElement;
+    class InputMethodController;
+    class IntPoint;
+    class Node;
+    class Range;
+    class RenderPart;
+    class RenderView;
+    class TreeScope;
+    class ScriptController;
+    class Settings;
+    class SpellChecker;
+    class TreeScope;
+    class VisiblePosition;
+    class Widget;
+
+    class Frame : public RefCounted<Frame> {
+    public:
+        static PassRefPtr<Frame> create(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
+
+        void init();
+        void setView(PassRefPtr<FrameView>);
+        void createView(const IntSize&, const Color&, bool,
+            const IntSize& fixedLayoutSize = IntSize(), bool useFixedLayout = false, ScrollbarMode = ScrollbarAuto, bool horizontalLock = false,
+            ScrollbarMode = ScrollbarAuto, bool verticalLock = false);
+
+        ~Frame();
+
+        void addDestructionObserver(FrameDestructionObserver*);
+        void removeDestructionObserver(FrameDestructionObserver*);
+
+        void willDetachPage();
+        void detachFromPage();
+        void disconnectOwnerElement();
+
+        Page* page() const;
+        HTMLFrameOwnerElement* ownerElement() const;
+
+        void setDOMWindow(PassRefPtr<DOMWindow>);
+        DOMWindow* domWindow() const;
+        Document* document() const;
+        FrameView* view() const;
+
+        Editor& editor() const;
+        EventHandler* eventHandler() const;
+        FrameLoader* loader() const;
+        NavigationScheduler* navigationScheduler() const;
+        FrameSelection& selection() const;
+        FrameTree* tree() const;
+        AnimationController* animation() const;
+        InputMethodController& inputMethodController() const;
+        FetchContext& fetchContext() const { return loader()->fetchContext(); }
+        ScriptController* script();
+        SpellChecker& spellChecker() const;
+
+        RenderView* contentRenderer() const; // Root of the render tree for the document contained in this frame.
+        RenderPart* ownerRenderer() const; // Renderer for the element that contains this frame.
+
+        void dispatchVisibilityStateChangeEvent();
+
+    // ======== All public functions below this point are candidates to move out of Frame into another class. ========
+
+        bool inScope(TreeScope*) const;
+
+        // See GraphicsLayerClient.h for accepted flags.
+        String layerTreeAsText(unsigned flags = 0) const;
+        String trackedRepaintRectsAsText() const;
+
+        Settings* settings() const; // can be NULL
+
+        void setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot);
+        bool shouldUsePrintingLayout() const;
+        FloatSize resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize);
+
+        bool inViewSourceMode() const;
+        void setInViewSourceMode(bool = true);
+
+        void setPageZoomFactor(float factor);
+        float pageZoomFactor() const { return m_pageZoomFactor; }
+        void setTextZoomFactor(float factor);
+        float textZoomFactor() const { return m_textZoomFactor; }
+        void setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor);
+
+        void deviceOrPageScaleFactorChanged();
+        double devicePixelRatio() const;
+
+#if ENABLE(ORIENTATION_EVENTS)
+        // Orientation is the interface orientation in degrees. Some examples are:
+        //  0 is straight up; -90 is when the device is rotated 90 clockwise;
+        //  90 is when rotated counter clockwise.
+        void sendOrientationChangeEvent(int orientation);
+        int orientation() const { return m_orientation; }
+#endif
+
+        String documentTypeString() const;
+
+        PassOwnPtr<DragImage> nodeImage(Node*);
+        PassOwnPtr<DragImage> dragImageForSelection();
+
+        String selectedText() const;
+        String selectedTextForClipboard() const;
+
+        VisiblePosition visiblePositionForPoint(const IntPoint& framePoint);
+        Document* documentAtPoint(const IntPoint& windowPoint);
+        PassRefPtr<Range> rangeForPoint(const IntPoint& framePoint);
+
+        // Should only be called on the main frame of a page.
+        void notifyChromeClientWheelEventHandlerCountChanged() const;
+
+        bool isURLAllowed(const KURL&) const;
+
+    // ========
+
+    private:
+        Frame(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
+
+        HashSet<FrameDestructionObserver*> m_destructionObservers;
+
+        Page* m_page;
+        mutable FrameTree m_treeNode;
+        mutable FrameLoader m_loader;
+        mutable NavigationScheduler m_navigationScheduler;
+
+        HTMLFrameOwnerElement* m_ownerElement;
+        RefPtr<FrameView> m_view;
+        RefPtr<DOMWindow> m_domWindow;
+
+        OwnPtr<ScriptController> m_script;
+        const OwnPtr<Editor> m_editor;
+        const OwnPtr<SpellChecker> m_spellChecker;
+        const OwnPtr<FrameSelection> m_selection;
+        OwnPtr<EventHandler> m_eventHandler;
+        OwnPtr<AnimationController> m_animationController;
+        OwnPtr<InputMethodController> m_inputMethodController;
+
+        float m_pageZoomFactor;
+        float m_textZoomFactor;
+
+#if ENABLE(ORIENTATION_EVENTS)
+        int m_orientation;
+#endif
+
+        bool m_inViewSourceMode;
+    };
+
+    inline void Frame::init()
+    {
+        m_loader.init();
+    }
+
+    inline FrameLoader* Frame::loader() const
+    {
+        return &m_loader;
+    }
+
+    inline NavigationScheduler* Frame::navigationScheduler() const
+    {
+        return &m_navigationScheduler;
+    }
+
+    inline FrameView* Frame::view() const
+    {
+        return m_view.get();
+    }
+
+    inline ScriptController* Frame::script()
+    {
+        return m_script.get();
+    }
+
+    inline DOMWindow* Frame::domWindow() const
+    {
+        return m_domWindow.get();
+    }
+
+    inline FrameSelection& Frame::selection() const
+    {
+        return *m_selection;
+    }
+
+    inline Editor& Frame::editor() const
+    {
+        return *m_editor;
+    }
+
+    inline SpellChecker& Frame::spellChecker() const
+    {
+        return *m_spellChecker;
+    }
+
+    inline AnimationController* Frame::animation() const
+    {
+        return m_animationController.get();
+    }
+
+    inline InputMethodController& Frame::inputMethodController() const
+    {
+        return *m_inputMethodController;
+    }
+
+    inline HTMLFrameOwnerElement* Frame::ownerElement() const
+    {
+        return m_ownerElement;
+    }
+
+    inline bool Frame::inViewSourceMode() const
+    {
+        return m_inViewSourceMode;
+    }
+
+    inline void Frame::setInViewSourceMode(bool mode)
+    {
+        m_inViewSourceMode = mode;
+    }
+
+    inline FrameTree* Frame::tree() const
+    {
+        return &m_treeNode;
+    }
+
+    inline Page* Frame::page() const
+    {
+        return m_page;
+    }
+
+    inline EventHandler* Frame::eventHandler() const
+    {
+        return m_eventHandler.get();
+    }
+
+} // namespace WebCore
+
+#endif // Frame_h
diff --git a/Source/core/frame/FrameDestructionObserver.cpp b/Source/core/frame/FrameDestructionObserver.cpp
new file mode 100644
index 0000000..ea3923e
--- /dev/null
+++ b/Source/core/frame/FrameDestructionObserver.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2011 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE 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/frame/FrameDestructionObserver.h"
+
+#include "core/frame/Frame.h"
+
+namespace WebCore {
+
+FrameDestructionObserver::FrameDestructionObserver(Frame* frame)
+    : m_frame(0)
+{
+    observeFrame(frame);
+}
+
+FrameDestructionObserver::~FrameDestructionObserver()
+{
+    observeFrame(0);
+
+}
+
+void FrameDestructionObserver::observeFrame(Frame* frame)
+{
+    if (m_frame)
+        m_frame->removeDestructionObserver(this);
+
+    m_frame = frame;
+
+    if (m_frame)
+        m_frame->addDestructionObserver(this);
+}
+
+void FrameDestructionObserver::frameDestroyed()
+{
+    m_frame = 0;
+}
+
+void FrameDestructionObserver::willDetachPage()
+{
+    // Subclasses should override this function to handle this notification.
+}
+
+}
diff --git a/Source/core/page/FrameDestructionObserver.h b/Source/core/frame/FrameDestructionObserver.h
similarity index 100%
rename from Source/core/page/FrameDestructionObserver.h
rename to Source/core/frame/FrameDestructionObserver.h
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
new file mode 100644
index 0000000..624850a
--- /dev/null
+++ b/Source/core/frame/FrameView.cpp
@@ -0,0 +1,3429 @@
+/*
+ * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ *                     1999 Lars Knoll <knoll@kde.org>
+ *                     1999 Antti Koivisto <koivisto@kde.org>
+ *                     2000 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
+ *           (C) 2006 Alexey Proskuryakov (ap@nypop.com)
+ * Copyright (C) 2009 Google Inc. 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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "core/frame/FrameView.h"
+
+#include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
+#include "core/accessibility/AXObjectCache.h"
+#include "core/animation/DocumentTimeline.h"
+#include "core/css/FontFaceSet.h"
+#include "core/css/resolver/StyleResolver.h"
+#include "core/dom/DocumentMarkerController.h"
+#include "core/editing/FrameSelection.h"
+#include "core/events/OverflowEvent.h"
+#include "core/fetch/ResourceFetcher.h"
+#include "core/fetch/TextResourceDecoder.h"
+#include "core/html/HTMLFrameElement.h"
+#include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLPlugInImageElement.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/loader/FrameLoader.h"
+#include "core/loader/FrameLoaderClient.h"
+#include "core/page/Chrome.h"
+#include "core/page/ChromeClient.h"
+#include "core/page/EventHandler.h"
+#include "core/page/FocusController.h"
+#include "core/frame/Frame.h"
+#include "core/page/FrameTree.h"
+#include "core/page/Settings.h"
+#include "core/frame/animation/AnimationController.h"
+#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/platform/ScrollAnimator.h"
+#include "core/platform/graphics/FontCache.h"
+#include "core/platform/graphics/GraphicsContext.h"
+#include "core/rendering/CompositedLayerMapping.h"
+#include "core/rendering/LayoutIndicator.h"
+#include "core/rendering/RenderCounter.h"
+#include "core/rendering/RenderEmbeddedObject.h"
+#include "core/rendering/RenderLayer.h"
+#include "core/rendering/RenderLayerCompositor.h"
+#include "core/rendering/RenderPart.h"
+#include "core/rendering/RenderScrollbar.h"
+#include "core/rendering/RenderScrollbarPart.h"
+#include "core/rendering/RenderTheme.h"
+#include "core/rendering/RenderView.h"
+#include "core/rendering/TextAutosizer.h"
+#include "core/rendering/style/RenderStyle.h"
+#include "core/rendering/svg/RenderSVGRoot.h"
+#include "core/svg/SVGDocument.h"
+#include "core/svg/SVGSVGElement.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/text/TextStream.h"
+#include "wtf/CurrentTime.h"
+#include "wtf/TemporaryChange.h"
+
+#include "platform/TraceEvent.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+double FrameView::s_currentFrameTimeStamp = 0.0;
+bool FrameView::s_inPaintContents = false;
+
+
+// REPAINT_THROTTLING now chooses default values for throttling parameters.
+// Should be removed when applications start using runtime configuration.
+#if ENABLE(REPAINT_THROTTLING)
+// Normal delay
+double FrameView::s_normalDeferredRepaintDelay = 0.016;
+// Negative value would mean that first few repaints happen without a delay
+double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0;
+// The delay grows on each repaint to this maximum value
+double FrameView::s_maxDeferredRepaintDelayDuringLoading = 2.5;
+// On each repaint the delay increses by this amount
+double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0.5;
+#else
+// FIXME: Repaint throttling could be good to have on all platform.
+// The balance between CPU use and repaint frequency will need some tuning for desktop.
+// More hooks may be needed to reset the delay on things like GIF and CSS animations.
+double FrameView::s_normalDeferredRepaintDelay = 0;
+double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0;
+double FrameView::s_maxDeferredRepaintDelayDuringLoading = 0;
+double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0;
+#endif
+
+// The maximum number of updateWidgets iterations that should be done before returning.
+static const unsigned maxUpdateWidgetsIterations = 2;
+
+static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLayer* layer, bool isRelayoutingSubtree, bool didFullRepaint)
+{
+    RenderLayer::UpdateLayerPositionsFlags flags = RenderLayer::defaultFlags;
+    if (didFullRepaint) {
+        flags &= ~RenderLayer::CheckForRepaint;
+        flags |= RenderLayer::NeedsFullRepaintInBacking;
+    }
+    if (isRelayoutingSubtree && layer->isPaginated())
+        flags |= RenderLayer::UpdatePagination;
+    return flags;
+}
+
+Pagination::Mode paginationModeForRenderStyle(RenderStyle* style)
+{
+    EOverflow overflow = style->overflowY();
+    if (overflow != OPAGEDX && overflow != OPAGEDY)
+        return Pagination::Unpaginated;
+
+    bool isHorizontalWritingMode = style->isHorizontalWritingMode();
+    TextDirection textDirection = style->direction();
+    WritingMode writingMode = style->writingMode();
+
+    // paged-x always corresponds to LeftToRightPaginated or RightToLeftPaginated. If the WritingMode
+    // is horizontal, then we use TextDirection to choose between those options. If the WritingMode
+    // is vertical, then the direction of the verticality dictates the choice.
+    if (overflow == OPAGEDX) {
+        if ((isHorizontalWritingMode && textDirection == LTR) || writingMode == LeftToRightWritingMode)
+            return Pagination::LeftToRightPaginated;
+        return Pagination::RightToLeftPaginated;
+    }
+
+    // paged-y always corresponds to TopToBottomPaginated or BottomToTopPaginated. If the WritingMode
+    // is horizontal, then the direction of the horizontality dictates the choice. If the WritingMode
+    // is vertical, then we use TextDirection to choose between those options.
+    if (writingMode == TopToBottomWritingMode || (!isHorizontalWritingMode && textDirection == RTL))
+        return Pagination::TopToBottomPaginated;
+    return Pagination::BottomToTopPaginated;
+}
+
+FrameView::DeferredRepaintScope::DeferredRepaintScope(FrameView& view)
+    : m_view(&view)
+{
+    m_view->beginDeferredRepaints();
+}
+
+FrameView::DeferredRepaintScope::~DeferredRepaintScope()
+{
+    m_view->endDeferredRepaints();
+}
+
+FrameView::FrameView(Frame* frame)
+    : m_frame(frame)
+    , m_canHaveScrollbars(true)
+    , m_slowRepaintObjectCount(0)
+    , m_layoutTimer(this, &FrameView::layoutTimerFired)
+    , m_layoutRoot(0)
+    , m_inSynchronousPostLayout(false)
+    , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
+    , m_isTransparent(false)
+    , m_baseBackgroundColor(Color::white)
+    , m_mediaType("screen")
+    , m_overflowEventSuspendCount(0)
+    , m_overflowStatusDirty(true)
+    , m_viewportRenderer(0)
+    , m_wasScrolledByUser(false)
+    , m_inProgrammaticScroll(false)
+    , m_safeToPropagateScrollToParent(true)
+    , m_deferredRepaintTimer(this, &FrameView::deferredRepaintTimerFired)
+    , m_isTrackingRepaints(false)
+    , m_shouldUpdateWhileOffscreen(true)
+    , m_deferSetNeedsLayouts(0)
+    , m_setNeedsLayoutWasDeferred(false)
+    , m_scrollCorner(0)
+    , m_shouldAutoSize(false)
+    , m_inAutoSize(false)
+    , m_didRunAutosize(false)
+    , m_hasSoftwareFilters(false)
+    , m_visibleContentScaleFactor(1)
+    , m_inputEventsScaleFactorForEmulation(1)
+    , m_partialLayout()
+{
+    ASSERT(m_frame);
+    init();
+
+    if (!isMainFrame())
+        return;
+
+    ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed);
+    ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed);
+}
+
+PassRefPtr<FrameView> FrameView::create(Frame* frame)
+{
+    RefPtr<FrameView> view = adoptRef(new FrameView(frame));
+    view->show();
+    return view.release();
+}
+
+PassRefPtr<FrameView> FrameView::create(Frame* frame, const IntSize& initialSize)
+{
+    RefPtr<FrameView> view = adoptRef(new FrameView(frame));
+    view->Widget::setFrameRect(IntRect(view->location(), initialSize));
+    view->show();
+    return view.release();
+}
+
+FrameView::~FrameView()
+{
+    if (m_postLayoutTasksTimer.isActive()) {
+        m_postLayoutTasksTimer.stop();
+        m_overflowEventQueue.clear();
+    }
+
+    removeFromAXObjectCache();
+    resetScrollbars();
+
+    // Custom scrollbars should already be destroyed at this point
+    ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar());
+    ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar());
+
+    setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow.
+    setHasVerticalScrollbar(false);
+
+    ASSERT(!m_scrollCorner);
+    ASSERT(m_overflowEventQueue.isEmpty());
+
+    ASSERT(m_frame);
+    ASSERT(m_frame->view() != this || !m_frame->contentRenderer());
+    RenderPart* renderer = m_frame->ownerRenderer();
+    if (renderer && renderer->widget() == this)
+        renderer->setWidget(0);
+}
+
+void FrameView::reset()
+{
+    m_cannotBlitToWindow = false;
+    m_isOverlapped = false;
+    m_contentIsOpaque = false;
+    m_borderX = 30;
+    m_borderY = 30;
+    m_layoutTimer.stop();
+    m_layoutRoot = 0;
+    m_delayedLayout = false;
+    m_doFullRepaint = true;
+    m_layoutSchedulingEnabled = true;
+    m_inLayout = false;
+    m_doingPreLayoutStyleUpdate = false;
+    m_inSynchronousPostLayout = false;
+    m_layoutCount = 0;
+    m_nestedLayoutCount = 0;
+    m_postLayoutTasksTimer.stop();
+    m_firstLayout = true;
+    m_firstLayoutCallbackPending = false;
+    m_wasScrolledByUser = false;
+    m_safeToPropagateScrollToParent = true;
+    m_lastViewportSize = IntSize();
+    m_lastZoomFactor = 1.0f;
+    m_deferringRepaints = 0;
+    m_repaintCount = 0;
+    m_repaintRects.clear();
+    m_deferredRepaintDelay = s_initialDeferredRepaintDelayDuringLoading;
+    m_deferredRepaintTimer.stop();
+    m_isTrackingRepaints = false;
+    m_trackedRepaintRects.clear();
+    m_lastPaintTime = 0;
+    m_paintBehavior = PaintBehaviorNormal;
+    m_isPainting = false;
+    m_visuallyNonEmptyCharacterCount = 0;
+    m_visuallyNonEmptyPixelCount = 0;
+    m_isVisuallyNonEmpty = false;
+    m_firstVisuallyNonEmptyLayoutCallbackPending = true;
+    m_maintainScrollPositionAnchor = 0;
+    m_partialLayout.reset();
+}
+
+void FrameView::removeFromAXObjectCache()
+{
+    if (AXObjectCache* cache = axObjectCache())
+        cache->remove(this);
+}
+
+void FrameView::resetScrollbars()
+{
+    // Reset the document's scrollbars back to our defaults before we yield the floor.
+    m_firstLayout = true;
+    setScrollbarsSuppressed(true);
+    if (m_canHaveScrollbars)
+        setScrollbarModes(ScrollbarAuto, ScrollbarAuto);
+    else
+        setScrollbarModes(ScrollbarAlwaysOff, ScrollbarAlwaysOff);
+    setScrollbarsSuppressed(false);
+}
+
+void FrameView::init()
+{
+    reset();
+
+    m_margins = LayoutSize(-1, -1); // undefined
+    m_size = LayoutSize();
+
+    // Propagate the marginwidth/height and scrolling modes to the view.
+    Element* ownerElement = m_frame->ownerElement();
+    if (ownerElement && (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))) {
+        HTMLFrameElementBase* frameElt = toHTMLFrameElementBase(ownerElement);
+        if (frameElt->scrollingMode() == ScrollbarAlwaysOff)
+            setCanHaveScrollbars(false);
+        LayoutUnit marginWidth = frameElt->marginWidth();
+        LayoutUnit marginHeight = frameElt->marginHeight();
+        if (marginWidth != -1)
+            setMarginWidth(marginWidth);
+        if (marginHeight != -1)
+            setMarginHeight(marginHeight);
+    }
+}
+
+void FrameView::prepareForDetach()
+{
+    RELEASE_ASSERT(!isInLayout());
+
+    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
+        scrollAnimator->cancelAnimations();
+
+    detachCustomScrollbars();
+    // When the view is no longer associated with a frame, it needs to be removed from the ax object cache
+    // right now, otherwise it won't be able to reach the topDocument()'s axObject cache later.
+    removeFromAXObjectCache();
+
+    if (m_frame->page()) {
+        if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scrollingCoordinator())
+            scrollingCoordinator->willDestroyScrollableArea(this);
+    }
+}
+
+void FrameView::detachCustomScrollbars()
+{
+    Scrollbar* horizontalBar = horizontalScrollbar();
+    if (horizontalBar && horizontalBar->isCustomScrollbar())
+        setHasHorizontalScrollbar(false);
+
+    Scrollbar* verticalBar = verticalScrollbar();
+    if (verticalBar && verticalBar->isCustomScrollbar())
+        setHasVerticalScrollbar(false);
+
+    if (m_scrollCorner) {
+        m_scrollCorner->destroy();
+        m_scrollCorner = 0;
+    }
+}
+
+void FrameView::recalculateScrollbarOverlayStyle()
+{
+    ScrollbarOverlayStyle oldOverlayStyle = scrollbarOverlayStyle();
+    ScrollbarOverlayStyle overlayStyle = ScrollbarOverlayStyleDefault;
+
+    Color backgroundColor = documentBackgroundColor();
+    if (backgroundColor.isValid()) {
+        // Reduce the background color from RGB to a lightness value
+        // and determine which scrollbar style to use based on a lightness
+        // heuristic.
+        double hue, saturation, lightness;
+        backgroundColor.getHSL(hue, saturation, lightness);
+        if (lightness <= .5)
+            overlayStyle = ScrollbarOverlayStyleLight;
+    }
+
+    if (oldOverlayStyle != overlayStyle)
+        setScrollbarOverlayStyle(overlayStyle);
+}
+
+void FrameView::clear()
+{
+    setCanBlitOnScroll(true);
+
+    reset();
+
+    if (RenderPart* renderer = m_frame->ownerRenderer())
+        renderer->viewCleared();
+
+    setScrollbarsSuppressed(true);
+}
+
+bool FrameView::didFirstLayout() const
+{
+    return !m_firstLayout;
+}
+
+void FrameView::invalidateRect(const IntRect& rect)
+{
+    if (!parent()) {
+        if (HostWindow* window = hostWindow())
+            window->invalidateContentsAndRootView(rect);
+        return;
+    }
+
+    RenderPart* renderer = m_frame->ownerRenderer();
+    if (!renderer)
+        return;
+
+    IntRect repaintRect = rect;
+    repaintRect.move(renderer->borderLeft() + renderer->paddingLeft(),
+                     renderer->borderTop() + renderer->paddingTop());
+    renderer->repaintRectangle(repaintRect);
+}
+
+void FrameView::setFrameRect(const IntRect& newRect)
+{
+    IntRect oldRect = frameRect();
+    if (newRect == oldRect)
+        return;
+
+    // Autosized font sizes depend on the width of the viewing area.
+    if (newRect.width() != oldRect.width()) {
+        Page* page = m_frame->page();
+        if (isMainFrame() && page->settings().textAutosizingEnabled()) {
+            for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
+                m_frame->document()->textAutosizer()->recalculateMultipliers();
+        }
+    }
+
+    ScrollView::setFrameRect(newRect);
+
+    updateScrollableAreaSet();
+
+    if (RenderView* renderView = this->renderView()) {
+        if (renderView->usesCompositing())
+            renderView->compositor()->frameViewDidChangeSize();
+    }
+}
+
+bool FrameView::scheduleAnimation()
+{
+    if (HostWindow* window = hostWindow()) {
+        window->scheduleAnimation();
+        return true;
+    }
+    return false;
+}
+
+RenderView* FrameView::renderView() const
+{
+    return frame().contentRenderer();
+}
+
+int FrameView::mapFromLayoutToCSSUnits(LayoutUnit value) const
+{
+    return value / frame().pageZoomFactor();
+}
+
+LayoutUnit FrameView::mapFromCSSToLayoutUnits(int value) const
+{
+    return value * frame().pageZoomFactor();
+}
+
+void FrameView::setMarginWidth(LayoutUnit w)
+{
+    // make it update the rendering area when set
+    m_margins.setWidth(w);
+}
+
+void FrameView::setMarginHeight(LayoutUnit h)
+{
+    // make it update the rendering area when set
+    m_margins.setHeight(h);
+}
+
+void FrameView::setCanHaveScrollbars(bool canHaveScrollbars)
+{
+    m_canHaveScrollbars = canHaveScrollbars;
+    ScrollView::setCanHaveScrollbars(canHaveScrollbars);
+}
+
+void FrameView::updateCanHaveScrollbars()
+{
+    ScrollbarMode hMode;
+    ScrollbarMode vMode;
+    scrollbarModes(hMode, vMode);
+    if (hMode == ScrollbarAlwaysOff && vMode == ScrollbarAlwaysOff)
+        setCanHaveScrollbars(false);
+    else
+        setCanHaveScrollbars(true);
+}
+
+PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation)
+{
+    if (Settings* settings = m_frame->settings()) {
+        if (!settings->allowCustomScrollbarInMainFrame() && isMainFrame())
+            return ScrollView::createScrollbar(orientation);
+    }
+
+    // FIXME: We need to update the scrollbar dynamically as documents change (or as doc elements and bodies get discovered that have custom styles).
+    Document* doc = m_frame->document();
+
+    // Try the <body> element first as a scrollbar source.
+    Element* body = doc ? doc->body() : 0;
+    if (body && body->renderer() && body->renderer()->style()->hasPseudoStyle(SCROLLBAR))
+        return RenderScrollbar::createCustomScrollbar(this, orientation, body);
+
+    // If the <body> didn't have a custom style, then the root element might.
+    Element* docElement = doc ? doc->documentElement() : 0;
+    if (docElement && docElement->renderer() && docElement->renderer()->style()->hasPseudoStyle(SCROLLBAR))
+        return RenderScrollbar::createCustomScrollbar(this, orientation, docElement);
+
+    // If we have an owning ipage/Frame element, then it can set the custom scrollbar also.
+    RenderPart* frameRenderer = m_frame->ownerRenderer();
+    if (frameRenderer && frameRenderer->style()->hasPseudoStyle(SCROLLBAR))
+        return RenderScrollbar::createCustomScrollbar(this, orientation, 0, m_frame.get());
+
+    // Nobody set a custom style, so we just use a native scrollbar.
+    return ScrollView::createScrollbar(orientation);
+}
+
+void FrameView::setContentsSize(const IntSize& size)
+{
+    if (size == contentsSize())
+        return;
+
+    m_deferSetNeedsLayouts++;
+
+    ScrollView::setContentsSize(size);
+    ScrollView::contentsResized();
+
+    Page* page = frame().page();
+    if (!page)
+        return;
+
+    updateScrollableAreaSet();
+
+    page->chrome().contentsSizeChanged(m_frame.get(), size); // Notify only.
+
+    m_deferSetNeedsLayouts--;
+
+    if (!m_deferSetNeedsLayouts)
+        m_setNeedsLayoutWasDeferred = false; // FIXME: Find a way to make the deferred layout actually happen.
+}
+
+void FrameView::adjustViewSize()
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return;
+
+    ASSERT(m_frame->view() == this);
+
+    const IntRect rect = renderView->documentRect();
+    const IntSize& size = rect.size();
+    ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->document()->printing(), size == contentsSize());
+
+    setContentsSize(size);
+}
+
+void FrameView::applyOverflowToViewport(RenderObject* o, ScrollbarMode& hMode, ScrollbarMode& vMode)
+{
+    // Handle the overflow:hidden/scroll case for the body/html elements.  WinIE treats
+    // overflow:hidden and overflow:scroll on <body> as applying to the document's
+    // scrollbars.  The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should
+    // use the root element.
+
+    EOverflow overflowX = o->style()->overflowX();
+    EOverflow overflowY = o->style()->overflowY();
+
+    if (o->isSVGRoot()) {
+        // overflow is ignored in stand-alone SVG documents.
+        if (!toRenderSVGRoot(o)->isEmbeddedThroughFrameContainingSVGDocument())
+            return;
+        overflowX = OHIDDEN;
+        overflowY = OHIDDEN;
+    }
+
+    bool ignoreOverflowHidden = false;
+    if (m_frame->settings()->ignoreMainFrameOverflowHiddenQuirk() && m_frame->page()->mainFrame() == m_frame)
+        ignoreOverflowHidden = true;
+
+    switch (overflowX) {
+        case OHIDDEN:
+            if (!ignoreOverflowHidden)
+                hMode = ScrollbarAlwaysOff;
+            break;
+        case OSCROLL:
+            hMode = ScrollbarAlwaysOn;
+            break;
+        case OAUTO:
+            hMode = ScrollbarAuto;
+            break;
+        default:
+            // Don't set it at all.
+            ;
+    }
+
+     switch (overflowY) {
+        case OHIDDEN:
+            if (!ignoreOverflowHidden)
+                vMode = ScrollbarAlwaysOff;
+            break;
+        case OSCROLL:
+            vMode = ScrollbarAlwaysOn;
+            break;
+        case OAUTO:
+            vMode = ScrollbarAuto;
+            break;
+        default:
+            // Don't set it at all. Values of OPAGEDX and OPAGEDY are handled by applyPaginationToViewPort().
+            ;
+    }
+
+    m_viewportRenderer = o;
+}
+
+void FrameView::applyPaginationToViewport()
+{
+    Document* document = m_frame->document();
+    Node* documentElement = document->documentElement();
+    RenderObject* documentRenderer = documentElement ? documentElement->renderer() : 0;
+    RenderObject* documentOrBodyRenderer = documentRenderer;
+    Node* body = document->body();
+    if (body && body->renderer()) {
+        if (body->hasTagName(bodyTag))
+            documentOrBodyRenderer = documentRenderer->style()->overflowX() == OVISIBLE && isHTMLHtmlElement(documentElement) ? body->renderer() : documentRenderer;
+    }
+
+    Pagination pagination;
+
+    if (!documentOrBodyRenderer) {
+        setPagination(pagination);
+        return;
+    }
+
+    EOverflow overflowY = documentOrBodyRenderer->style()->overflowY();
+    if (overflowY == OPAGEDX || overflowY == OPAGEDY) {
+        pagination.mode = WebCore::paginationModeForRenderStyle(documentOrBodyRenderer->style());
+        pagination.gap = static_cast<unsigned>(documentOrBodyRenderer->style()->columnGap());
+    }
+
+    setPagination(pagination);
+}
+
+void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy strategy)
+{
+    m_viewportRenderer = 0;
+
+    const HTMLFrameOwnerElement* owner = m_frame->ownerElement();
+    if (owner && (owner->scrollingMode() == ScrollbarAlwaysOff)) {
+        hMode = ScrollbarAlwaysOff;
+        vMode = ScrollbarAlwaysOff;
+        return;
+    }
+
+    if (m_canHaveScrollbars || strategy == RulesFromWebContentOnly) {
+        hMode = ScrollbarAuto;
+        // Seamless documents begin with heights of 0; we special case that here
+        // to correctly render documents that don't need scrollbars.
+        IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size();
+        bool isSeamlessDocument = frame().document() && frame().document()->shouldDisplaySeamlesslyWithParent();
+        vMode = (isSeamlessDocument && !fullVisibleSize.height()) ? ScrollbarAlwaysOff : ScrollbarAuto;
+    } else {
+        hMode = ScrollbarAlwaysOff;
+        vMode = ScrollbarAlwaysOff;
+    }
+
+    if (!m_layoutRoot) {
+        Document* document = m_frame->document();
+        Node* documentElement = document->documentElement();
+        RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0;
+        Node* body = document->body();
+        if (body && body->renderer()) {
+            if (body->hasTagName(framesetTag)) {
+                vMode = ScrollbarAlwaysOff;
+                hMode = ScrollbarAlwaysOff;
+            } else if (body->hasTagName(bodyTag)) {
+                // It's sufficient to just check the X overflow,
+                // since it's illegal to have visible in only one direction.
+                RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE && isHTMLHtmlElement(document->documentElement()) ? body->renderer() : rootRenderer;
+                if (o->style())
+                    applyOverflowToViewport(o, hMode, vMode);
+            }
+        } else if (rootRenderer)
+            applyOverflowToViewport(rootRenderer, hMode, vMode);
+    }
+}
+
+void FrameView::updateCompositingLayersAfterStyleChange()
+{
+    TRACE_EVENT0("webkit", "FrameView::updateCompositingLayersAfterStyleChange");
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return;
+
+    // If we expect to update compositing after an incipient layout, don't do so here.
+    if (m_doingPreLayoutStyleUpdate || layoutPending() || renderView->needsLayout())
+        return;
+
+    // This call will make sure the cached hasAcceleratedCompositing is updated from the pref
+    renderView->compositor()->cacheAcceleratedCompositingFlags();
+
+    // Sometimes we will change a property (for example, z-index) that will not
+    // cause a layout, but will require us to update compositing state. We only
+    // need to do this if a layout is not already scheduled.
+    if (!needsLayout())
+        renderView->compositor()->updateCompositingRequirementsState();
+
+    renderView->compositor()->updateCompositingLayers(CompositingUpdateAfterStyleChange);
+}
+
+void FrameView::updateCompositingLayersAfterLayout()
+{
+    TRACE_EVENT0("webkit", "FrameView::updateCompositingLayersAfterLayout");
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return;
+
+    // This call will make sure the cached hasAcceleratedCompositing is updated from the pref
+    renderView->compositor()->cacheAcceleratedCompositingFlags();
+    renderView->compositor()->updateCompositingRequirementsState();
+    renderView->compositor()->updateCompositingLayers(CompositingUpdateAfterLayout);
+}
+
+bool FrameView::usesCompositedScrolling() const
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return false;
+    if (m_frame->settings() && m_frame->settings()->compositedScrollingForFramesEnabled())
+        return renderView->compositor()->inForcedCompositingMode();
+    return false;
+}
+
+GraphicsLayer* FrameView::layerForScrolling() const
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return 0;
+    return renderView->compositor()->scrollLayer();
+}
+
+GraphicsLayer* FrameView::layerForHorizontalScrollbar() const
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return 0;
+    return renderView->compositor()->layerForHorizontalScrollbar();
+}
+
+GraphicsLayer* FrameView::layerForVerticalScrollbar() const
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return 0;
+    return renderView->compositor()->layerForVerticalScrollbar();
+}
+
+GraphicsLayer* FrameView::layerForScrollCorner() const
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return 0;
+    return renderView->compositor()->layerForScrollCorner();
+}
+
+#if USE(RUBBER_BANDING)
+GraphicsLayer* FrameView::layerForOverhangAreas() const
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return 0;
+    return renderView->compositor()->layerForOverhangAreas();
+}
+#endif // USE(RUBBER_BANDING)
+
+bool FrameView::hasCompositedContent() const
+{
+    if (RenderView* renderView = this->renderView())
+        return renderView->compositor()->inCompositingMode();
+    return false;
+}
+
+bool FrameView::isEnclosedInCompositingLayer() const
+{
+    RenderObject* frameOwnerRenderer = m_frame->ownerRenderer();
+    if (frameOwnerRenderer && frameOwnerRenderer->containerForRepaint())
+        return true;
+
+    if (FrameView* parentView = parentFrameView())
+        return parentView->isEnclosedInCompositingLayer();
+
+    return false;
+}
+
+bool FrameView::isSoftwareRenderable() const
+{
+    RenderView* renderView = this->renderView();
+    return !renderView || !renderView->compositor()->has3DContent();
+}
+
+RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const
+{
+    return onlyDuringLayout && layoutPending() ? 0 : m_layoutRoot;
+}
+
+static inline void collectFrameViewChildren(FrameView* frameView, Vector<RefPtr<FrameView> >& frameViews)
+{
+    const HashSet<RefPtr<Widget> >* viewChildren = frameView->children();
+    ASSERT(viewChildren);
+
+    const HashSet<RefPtr<Widget> >::iterator end = viewChildren->end();
+    for (HashSet<RefPtr<Widget> >::iterator current = viewChildren->begin(); current != end; ++current) {
+        Widget* widget = (*current).get();
+        if (widget->isFrameView())
+            frameViews.append(toFrameView(widget));
+    }
+}
+
+inline void FrameView::forceLayoutParentViewIfNeeded()
+{
+    RenderPart* ownerRenderer = m_frame->ownerRenderer();
+    if (!ownerRenderer || !ownerRenderer->frame())
+        return;
+
+    RenderBox* contentBox = embeddedContentBox();
+    if (!contentBox)
+        return;
+
+    RenderSVGRoot* svgRoot = toRenderSVGRoot(contentBox);
+    if (svgRoot->everHadLayout() && !svgRoot->needsLayout())
+        return;
+
+    // If the embedded SVG document appears the first time, the ownerRenderer has already finished
+    // layout without knowing about the existence of the embedded SVG document, because RenderReplaced
+    // embeddedContentBox() returns 0, as long as the embedded document isn't loaded yet. Before
+    // bothering to lay out the SVG document, mark the ownerRenderer needing layout and ask its
+    // FrameView for a layout. After that the RenderEmbeddedObject (ownerRenderer) carries the
+    // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rely on, when laying
+    // out for the first time, or when the RenderSVGRoot size has changed dynamically (eg. via <script>).
+    RefPtr<FrameView> frameView = ownerRenderer->frame()->view();
+
+    // Mark the owner renderer as needing layout.
+    ownerRenderer->setNeedsLayoutAndPrefWidthsRecalc();
+
+    // Synchronously enter layout, to layout the view containing the host object/embed/iframe.
+    ASSERT(frameView);
+    frameView->layout();
+}
+
+void FrameView::performPreLayoutTasks()
+{
+    // Don't schedule more layouts, we're in one.
+    TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
+
+    if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksTimer.isActive() && !frame().document()->shouldDisplaySeamlesslyWithParent()) {
+        // This is a new top-level layout. If there are any remaining tasks from the previous layout, finish them now.
+        m_inSynchronousPostLayout = true;
+        performPostLayoutTasks();
+        m_inSynchronousPostLayout = false;
+    }
+
+    // Viewport-dependent media queries may cause us to need completely different style information.
+    Document* document = m_frame->document();
+    if (!document->styleResolverIfExists() || document->styleResolverIfExists()->affectedByViewportChange()) {
+        document->styleResolverChanged(RecalcStyleDeferred);
+        // FIXME: This instrumentation event is not strictly accurate since cached media query results
+        //        do not persist across StyleResolver rebuilds.
+        InspectorInstrumentation::mediaQueryResultChanged(document);
+    } else {
+        document->evaluateMediaQueryList();
+    }
+
+    // If there is any pagination to apply, it will affect the RenderView's style, so we should
+    // take care of that now.
+    applyPaginationToViewport();
+
+    // Always ensure our style info is up-to-date. This can happen in situations where
+    // the layout beats any sort of style recalc update that needs to occur.
+    TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleUpdate, true);
+    document->updateStyleIfNeeded();
+}
+
+void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLayout)
+{
+    // performLayout is the actual guts of layout().
+    // FIXME: The 300 other lines in layout() probably belong in other helper functions
+    // so that a single human could understand what layout() is actually doing.
+    FrameView::DeferredRepaintScope deferRepaints(*this);
+
+    {
+        bool disableLayoutState = false;
+        if (inSubtreeLayout) {
+            RenderView* view = rootForThisLayout->view();
+            disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootForThisLayout);
+            view->pushLayoutState(rootForThisLayout);
+        }
+        LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootForThisLayout->view() : 0);
+
+        m_inLayout = true;
+
+        forceLayoutParentViewIfNeeded();
+        renderView()->updateConfiguration();
+
+        // Text Autosizing requires two-pass layout which is incompatible with partial layout.
+        // If enabled, only do partial layout for the second layout.
+        // FIXME (crbug.com/256657): Do not do two layouts for text autosizing.
+        PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->settings() && m_frame->settings()->textAutosizingEnabled());
+
+        LayoutIndicator layoutIndicator;
+        rootForThisLayout->layout();
+    }
+
+    bool autosized = frame().document()->textAutosizer()->processSubtree(rootForThisLayout);
+    if (autosized && rootForThisLayout->needsLayout()) {
+        TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing");
+        LayoutIndicator layoutIndicator;
+        rootForThisLayout->layout();
+    }
+
+    m_inLayout = false;
+
+    if (inSubtreeLayout)
+        rootForThisLayout->view()->popLayoutState(rootForThisLayout);
+}
+
+void FrameView::scheduleOrPerformPostLayoutTasks()
+{
+    if (m_postLayoutTasksTimer.isActive()) {
+        resumeOverflowEvents();
+        return;
+    }
+
+    // Partial layouts should not happen with synchronous post layouts.
+    ASSERT(!(m_inSynchronousPostLayout && partialLayout().isStopping()));
+
+    if (!m_inSynchronousPostLayout) {
+        if (frame().document()->shouldDisplaySeamlesslyWithParent()) {
+            if (RenderView* renderView = this->renderView())
+                renderView->updateWidgetPositions();
+        } else {
+            m_inSynchronousPostLayout = true;
+            // Calls resumeScheduledEvents()
+            performPostLayoutTasks();
+            m_inSynchronousPostLayout = false;
+        }
+    }
+
+    if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousPostLayout || frame().document()->shouldDisplaySeamlesslyWithParent())) {
+        // If we need layout or are already in a synchronous call to postLayoutTasks(),
+        // defer widget updates and event dispatch until after we return. postLayoutTasks()
+        // can make us need to update again, and we can get stuck in a nasty cycle unless
+        // we call it through the timer here.
+        m_postLayoutTasksTimer.startOneShot(0);
+        if (!partialLayout().isStopping() && needsLayout()) {
+            suspendOverflowEvents();
+            layout();
+        }
+    }
+}
+
+void FrameView::layout(bool allowSubtree)
+{
+    // We should never layout a Document which is not in a Frame.
+    ASSERT(m_frame);
+    ASSERT(m_frame->view() == this);
+    ASSERT(m_frame->page());
+
+    if (m_inLayout)
+        return;
+
+    ASSERT(!partialLayout().isStopping());
+
+    TRACE_EVENT0("webkit", "FrameView::layout");
+    TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout");
+
+    // Protect the view from being deleted during layout (in recalcStyle)
+    RefPtr<FrameView> protector(this);
+
+    // Every scroll that happens during layout is programmatic.
+    TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true);
+
+    m_layoutTimer.stop();
+    m_delayedLayout = false;
+    m_setNeedsLayoutWasDeferred = false;
+
+    // we shouldn't enter layout() while painting
+    ASSERT(!isPainting());
+    if (isPainting())
+        return;
+
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout(m_frame.get());
+
+    if (!allowSubtree && m_layoutRoot) {
+        m_layoutRoot->markContainingBlocksForLayout(false);
+        m_layoutRoot = 0;
+    }
+
+    performPreLayoutTasks();
+
+    // If there is only one ref to this view left, then its going to be destroyed as soon as we exit,
+    // so there's no point to continuing to layout
+    if (protector->hasOneRef())
+        return;
+
+    Document* document = m_frame->document();
+    bool inSubtreeLayout = m_layoutRoot;
+    RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutRoot : document->renderer();
+    if (!rootForThisLayout) {
+        // FIXME: Do we need to set m_size here?
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    bool isPartialLayout = partialLayout().isPartialLayout();
+
+    FontCachePurgePreventer fontCachePurgePreventer;
+    RenderLayer* layer;
+    {
+        TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
+
+        m_nestedLayoutCount++;
+
+        updateCounters();
+        autoSizeIfEnabled();
+
+        ScrollbarMode hMode;
+        ScrollbarMode vMode;
+        calculateScrollbarModesForLayout(hMode, vMode);
+
+        m_doFullRepaint = !inSubtreeLayout && !isPartialLayout && (m_firstLayout || toRenderView(rootForThisLayout)->document().printing());
+
+        if (!inSubtreeLayout && !isPartialLayout) {
+            // Now set our scrollbar state for the layout.
+            ScrollbarMode currentHMode = horizontalScrollbarMode();
+            ScrollbarMode currentVMode = verticalScrollbarMode();
+
+            if (m_firstLayout || (hMode != currentHMode || vMode != currentVMode)) {
+                if (m_firstLayout) {
+                    setScrollbarsSuppressed(true);
+
+                    m_firstLayout = false;
+                    m_firstLayoutCallbackPending = true;
+                    m_lastViewportSize = layoutSize(IncludeScrollbars);
+                    m_lastZoomFactor = rootForThisLayout->style()->zoom();
+
+                    // Set the initial vMode to AlwaysOn if we're auto.
+                    if (vMode == ScrollbarAuto)
+                        setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
+                    // Set the initial hMode to AlwaysOff if we're auto.
+                    if (hMode == ScrollbarAuto)
+                        setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
+
+                    setScrollbarModes(hMode, vMode);
+                    setScrollbarsSuppressed(false, true);
+                } else
+                    setScrollbarModes(hMode, vMode);
+            }
+
+            LayoutSize oldSize = m_size;
+
+            m_size = LayoutSize(layoutWidth(), layoutHeight());
+
+            if (oldSize != m_size) {
+                m_doFullRepaint = true;
+                if (!m_firstLayout) {
+                    RenderBox* rootRenderer = document->documentElement() ? document->documentElement()->renderBox() : 0;
+                    RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0;
+                    if (bodyRenderer && bodyRenderer->stretchesToViewport())
+                        bodyRenderer->setChildNeedsLayout();
+                    else if (rootRenderer && rootRenderer->stretchesToViewport())
+                        rootRenderer->setChildNeedsLayout();
+                }
+            }
+        }
+
+        layer = rootForThisLayout->enclosingLayer();
+
+        suspendOverflowEvents();
+
+        performLayout(rootForThisLayout, inSubtreeLayout);
+        m_layoutRoot = 0;
+    } // Reset m_layoutSchedulingEnabled to its previous value.
+
+    bool neededFullRepaint = m_doFullRepaint;
+
+    if (!inSubtreeLayout && !isPartialLayout && !toRenderView(rootForThisLayout)->document().printing())
+        adjustViewSize();
+
+    m_doFullRepaint = neededFullRepaint;
+
+    {
+        // FIXME: Can this scope just encompass this entire function?
+        FrameView::DeferredRepaintScope deferRepaints(*this);
+
+        if (m_doFullRepaint) {
+            // FIXME: This isn't really right, since the RenderView doesn't fully encompass
+            // the visibleContentRect(). It just happens to work out most of the time,
+            // since first layouts and printing don't have you scrolled anywhere.
+            rootForThisLayout->view()->repaint();
+        }
+
+        layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPositionFlags(layer, inSubtreeLayout, m_doFullRepaint));
+    }
+
+    updateCompositingLayersAfterLayout();
+
+    m_layoutCount++;
+
+    if (AXObjectCache* cache = rootForThisLayout->document().existingAXObjectCache())
+        cache->postNotification(rootForThisLayout, AXObjectCache::AXLayoutComplete, true);
+    updateAnnotatedRegions();
+
+    ASSERT(partialLayout().isStopping() || !rootForThisLayout->needsLayout());
+
+    updateCanBlitOnScrollRecursively();
+
+    if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER))
+        updateOverflowStatus(layoutWidth() < contentsWidth(), layoutHeight() < contentsHeight());
+
+    scheduleOrPerformPostLayoutTasks();
+
+    InspectorInstrumentation::didLayout(cookie, rootForThisLayout);
+
+    m_nestedLayoutCount--;
+    if (m_nestedLayoutCount)
+        return;
+
+    if (partialLayout().isStopping())
+        return;
+
+#ifndef NDEBUG
+    // Post-layout assert that nobody was re-marked as needing layout during layout.
+    document->renderer()->assertSubtreeIsLaidOut();
+#endif
+
+    // FIXME: It should be not possible to remove the FrameView from the frame/page during layout
+    // however m_inLayout is not set for most of this function, so none of our RELEASE_ASSERTS
+    // in Frame/Page will fire. One of the post-layout tasks is disconnecting the Frame from
+    // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.html
+    // necessitating this check here.
+    // ASSERT(frame()->page());
+    if (frame().page())
+        frame().page()->chrome().client().layoutUpdated(m_frame.get());
+}
+
+RenderBox* FrameView::embeddedContentBox() const
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return 0;
+
+    RenderObject* firstChild = renderView->firstChild();
+    if (!firstChild || !firstChild->isBox())
+        return 0;
+
+    // Curently only embedded SVG documents participate in the size-negotiation logic.
+    if (firstChild->isSVGRoot())
+        return toRenderBox(firstChild);
+
+    return 0;
+}
+
+void FrameView::addWidgetToUpdate(RenderObject* object)
+{
+    if (!m_widgetUpdateSet)
+        m_widgetUpdateSet = adoptPtr(new RenderObjectSet);
+
+    // Tell the DOM element that it needs a widget update.
+    Node* node = object->node();
+    if (node->hasTagName(objectTag) || node->hasTagName(embedTag)) {
+        HTMLPlugInImageElement* pluginElement = toHTMLPlugInImageElement(node);
+        pluginElement->setNeedsWidgetUpdate(true);
+    }
+
+    m_widgetUpdateSet->add(object);
+}
+
+void FrameView::removeWidgetToUpdate(RenderObject* object)
+{
+    if (!m_widgetUpdateSet)
+        return;
+
+    m_widgetUpdateSet->remove(object);
+}
+
+void FrameView::setMediaType(const AtomicString& mediaType)
+{
+    m_mediaType = mediaType;
+}
+
+AtomicString FrameView::mediaType() const
+{
+    // See if we have an override type.
+    String overrideType;
+    InspectorInstrumentation::applyEmulatedMedia(m_frame.get(), &overrideType);
+    if (!overrideType.isNull())
+        return overrideType;
+    return m_mediaType;
+}
+
+void FrameView::adjustMediaTypeForPrinting(bool printing)
+{
+    if (printing) {
+        if (m_mediaTypeWhenNotPrinting.isNull())
+            m_mediaTypeWhenNotPrinting = mediaType();
+            setMediaType("print");
+    } else {
+        if (!m_mediaTypeWhenNotPrinting.isNull())
+            setMediaType(m_mediaTypeWhenNotPrinting);
+        m_mediaTypeWhenNotPrinting = nullAtom;
+    }
+}
+
+bool FrameView::useSlowRepaints(bool considerOverlap) const
+{
+    bool mustBeSlow = m_slowRepaintObjectCount > 0;
+
+    if (contentsInCompositedLayer())
+        return mustBeSlow;
+
+    // The chromium compositor does not support scrolling a non-composited frame within a composited page through
+    // the fast scrolling path, so force slow scrolling in that case.
+    if (m_frame->ownerElement() && !hasCompositedContent() && m_frame->page() && m_frame->page()->mainFrame()->view()->hasCompositedContent())
+        return true;
+
+    bool isOverlapped = m_isOverlapped && considerOverlap;
+
+    if (mustBeSlow || m_cannotBlitToWindow || isOverlapped || !m_contentIsOpaque)
+        return true;
+
+    if (FrameView* parentView = parentFrameView())
+        return parentView->useSlowRepaints(considerOverlap);
+
+    return false;
+}
+
+bool FrameView::useSlowRepaintsIfNotOverlapped() const
+{
+    return useSlowRepaints(false);
+}
+
+void FrameView::updateCanBlitOnScrollRecursively()
+{
+    for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext(m_frame.get())) {
+        if (FrameView* view = frame->view())
+            view->setCanBlitOnScroll(!view->useSlowRepaints());
+    }
+}
+
+bool FrameView::contentsInCompositedLayer() const
+{
+    RenderView* renderView = this->renderView();
+    if (renderView && renderView->isComposited()) {
+        GraphicsLayer* layer = renderView->layer()->compositedLayerMapping()->mainGraphicsLayer();
+        if (layer && layer->drawsContent())
+            return true;
+    }
+
+    return false;
+}
+
+void FrameView::setCannotBlitToWindow()
+{
+    m_cannotBlitToWindow = true;
+    updateCanBlitOnScrollRecursively();
+}
+
+void FrameView::addSlowRepaintObject()
+{
+    if (!m_slowRepaintObjectCount++) {
+        updateCanBlitOnScrollRecursively();
+
+        if (Page* page = m_frame->page()) {
+            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+                scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this);
+        }
+    }
+}
+
+void FrameView::removeSlowRepaintObject()
+{
+    ASSERT(m_slowRepaintObjectCount > 0);
+    m_slowRepaintObjectCount--;
+    if (!m_slowRepaintObjectCount) {
+        updateCanBlitOnScrollRecursively();
+
+        if (Page* page = m_frame->page()) {
+            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+                scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this);
+        }
+    }
+}
+
+void FrameView::addViewportConstrainedObject(RenderObject* object)
+{
+    if (!m_viewportConstrainedObjects)
+        m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet);
+
+    if (!m_viewportConstrainedObjects->contains(object)) {
+        m_viewportConstrainedObjects->add(object);
+
+        if (Page* page = m_frame->page()) {
+            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+                scrollingCoordinator->frameViewFixedObjectsDidChange(this);
+        }
+    }
+}
+
+void FrameView::removeViewportConstrainedObject(RenderObject* object)
+{
+    if (m_viewportConstrainedObjects && m_viewportConstrainedObjects->contains(object)) {
+        m_viewportConstrainedObjects->remove(object);
+        if (Page* page = m_frame->page()) {
+            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+                scrollingCoordinator->frameViewFixedObjectsDidChange(this);
+        }
+
+        // FIXME: In addFixedObject() we only call this if there's a platform widget,
+        // why isn't the same check being made here?
+        updateCanBlitOnScrollRecursively();
+    }
+}
+
+LayoutRect FrameView::viewportConstrainedVisibleContentRect() const
+{
+    LayoutRect viewportRect = visibleContentRect();
+    // Ignore overhang. No-op when not using rubber banding.
+    viewportRect.setLocation(clampScrollPosition(scrollPosition()));
+    return viewportRect;
+}
+
+
+IntSize FrameView::scrollOffsetForFixedPosition() const
+{
+    return toIntSize(clampScrollPosition(scrollPosition()));
+}
+
+IntPoint FrameView::lastKnownMousePosition() const
+{
+    return m_frame->eventHandler()->lastKnownMousePosition();
+}
+
+bool FrameView::shouldSetCursor() const
+{
+    Page* page = frame().page();
+    return page && page->visibilityState() != PageVisibilityStateHidden && page->focusController().isActive();
+}
+
+bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
+{
+    if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()) {
+        hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
+        return true;
+    }
+
+    const bool isCompositedContentLayer = contentsInCompositedLayer();
+
+    // Get the rects of the fixed objects visible in the rectToScroll
+    Region regionToUpdate;
+    ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObjects->end();
+    for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrainedObjects->begin(); it != end; ++it) {
+        RenderObject* renderer = *it;
+        if (!renderer->style()->hasViewportConstrainedPosition())
+            continue;
+
+        // Fixed items should always have layers.
+        ASSERT(renderer->hasLayer());
+        RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
+
+        // Composited layers may still actually paint into their ancestor.
+        // If that happens, the viewport constrained object needs to be
+        // repainted on scroll.
+        if (layer->isComposited() && !layer->compositedLayerMapping()->paintsIntoCompositedAncestor())
+            continue;
+
+        if (layer->viewportConstrainedNotCompositedReason() == RenderLayer::NotCompositedForBoundsOutOfView
+            || layer->viewportConstrainedNotCompositedReason() == RenderLayer::NotCompositedForNoVisibleContent) {
+            // Don't invalidate for invisible fixed layers.
+            continue;
+        }
+
+        if (layer->hasAncestorWithFilterOutsets()) {
+            // If the fixed layer has a blur/drop-shadow filter applied on at least one of its parents, we cannot
+            // scroll using the fast path, otherwise the outsets of the filter will be moved around the page.
+            return false;
+        }
+
+        IntRect updateRect = pixelSnappedIntRect(layer->repainter().repaintRectIncludingNonCompositingDescendants());
+
+        RenderLayer* enclosingCompositingLayer = layer->enclosingCompositingLayer(false);
+        if (enclosingCompositingLayer && !enclosingCompositingLayer->renderer()->isRenderView()) {
+            // If the fixed-position layer is contained by a composited layer that is not its containing block,
+            // then we have to invlidate that enclosing layer, not the RenderView.
+            updateRect.moveBy(scrollPosition());
+            IntRect previousRect = updateRect;
+            previousRect.move(scrollDelta);
+            updateRect.unite(previousRect);
+            enclosingCompositingLayer->setBackingNeedsRepaintInRect(updateRect);
+        } else {
+            // Coalesce the repaints that will be issued to the renderView.
+            updateRect = contentsToRootView(updateRect);
+            if (!isCompositedContentLayer && clipsRepaints())
+                updateRect.intersect(rectToScroll);
+            if (!updateRect.isEmpty())
+                regionToUpdate.unite(updateRect);
+        }
+    }
+
+    // 1) scroll
+    hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
+
+    // 2) update the area of fixed objects that has been invalidated
+    Vector<IntRect> subRectsToUpdate = regionToUpdate.rects();
+    size_t viewportConstrainedObjectsCount = subRectsToUpdate.size();
+    for (size_t i = 0; i < viewportConstrainedObjectsCount; ++i) {
+        IntRect updateRect = subRectsToUpdate[i];
+        IntRect scrolledRect = updateRect;
+        scrolledRect.move(scrollDelta);
+        updateRect.unite(scrolledRect);
+        if (isCompositedContentLayer) {
+            updateRect = rootViewToContents(updateRect);
+            ASSERT(renderView());
+            renderView()->layer()->setBackingNeedsRepaintInRect(updateRect);
+            continue;
+        }
+        if (clipsRepaints())
+            updateRect.intersect(rectToScroll);
+        hostWindow()->invalidateContentsAndRootView(updateRect);
+    }
+
+    return true;
+}
+
+void FrameView::scrollContentsSlowPath(const IntRect& updateRect)
+{
+    if (contentsInCompositedLayer()) {
+        IntRect updateRect = visibleContentRect();
+        ASSERT(renderView());
+        renderView()->layer()->setBackingNeedsRepaintInRect(updateRect);
+    }
+    if (RenderPart* frameRenderer = m_frame->ownerRenderer()) {
+        if (isEnclosedInCompositingLayer()) {
+            LayoutRect rect(frameRenderer->borderLeft() + frameRenderer->paddingLeft(),
+                            frameRenderer->borderTop() + frameRenderer->paddingTop(),
+                            visibleWidth(), visibleHeight());
+            frameRenderer->repaintRectangle(rect);
+            return;
+        }
+    }
+
+    ScrollView::scrollContentsSlowPath(updateRect);
+}
+
+// Note that this gets called at painting time.
+void FrameView::setIsOverlapped(bool isOverlapped)
+{
+    if (isOverlapped == m_isOverlapped)
+        return;
+
+    m_isOverlapped = isOverlapped;
+    updateCanBlitOnScrollRecursively();
+}
+
+bool FrameView::isOverlappedIncludingAncestors() const
+{
+    if (isOverlapped())
+        return true;
+
+    if (FrameView* parentView = parentFrameView()) {
+        if (parentView->isOverlapped())
+            return true;
+    }
+
+    return false;
+}
+
+void FrameView::setContentIsOpaque(bool contentIsOpaque)
+{
+    if (contentIsOpaque == m_contentIsOpaque)
+        return;
+
+    m_contentIsOpaque = contentIsOpaque;
+    updateCanBlitOnScrollRecursively();
+}
+
+void FrameView::restoreScrollbar()
+{
+    setScrollbarsSuppressed(false);
+}
+
+bool FrameView::scrollToFragment(const KURL& url)
+{
+    // If our URL has no ref, then we have no place we need to jump to.
+    // OTOH If CSS target was set previously, we want to set it to 0, recalc
+    // and possibly repaint because :target pseudo class may have been
+    // set (see bug 11321).
+    if (!url.hasFragmentIdentifier() && !m_frame->document()->cssTarget())
+        return false;
+
+    String fragmentIdentifier = url.fragmentIdentifier();
+    if (scrollToAnchor(fragmentIdentifier))
+        return true;
+
+    // Try again after decoding the ref, based on the document's encoding.
+    if (m_frame->document()->encoding().isValid())
+        return scrollToAnchor(decodeURLEscapeSequences(fragmentIdentifier, m_frame->document()->encoding()));
+
+    return false;
+}
+
+bool FrameView::scrollToAnchor(const String& name)
+{
+    ASSERT(m_frame->document());
+
+    if (!m_frame->document()->haveStylesheetsLoaded()) {
+        m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(true);
+        return false;
+    }
+
+    m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(false);
+
+    Element* anchorNode = m_frame->document()->findAnchor(name);
+
+    // Setting to null will clear the current target.
+    m_frame->document()->setCSSTarget(anchorNode);
+
+    if (m_frame->document()->isSVGDocument()) {
+        if (SVGSVGElement* svg = toSVGDocument(m_frame->document())->rootElement()) {
+            svg->setupInitialView(name, anchorNode);
+            if (!anchorNode)
+                return true;
+        }
+    }
+
+    // Implement the rule that "" and "top" both mean top of page as in other browsers.
+    if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top")))
+        return false;
+
+    maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame->document());
+
+    // If the anchor accepts keyboard focus, move focus there to aid users relying on keyboard navigation.
+    if (anchorNode && anchorNode->isFocusable())
+        m_frame->document()->setFocusedElement(anchorNode);
+
+    return true;
+}
+
+void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode)
+{
+    m_maintainScrollPositionAnchor = anchorNode;
+    if (!m_maintainScrollPositionAnchor)
+        return;
+
+    // We need to update the layout before scrolling, otherwise we could
+    // really mess things up if an anchor scroll comes at a bad moment.
+    m_frame->document()->updateStyleIfNeeded();
+    // Only do a layout if changes have occurred that make it necessary.
+    RenderView* renderView = this->renderView();
+    if (renderView && renderView->needsLayout())
+        layout();
+    else
+        scrollToAnchor();
+}
+
+void FrameView::scrollElementToRect(Element* element, const IntRect& rect)
+{
+    m_frame->document()->updateLayoutIgnorePendingStylesheets();
+
+    LayoutRect bounds = element->boundingBox();
+    int centeringOffsetX = (rect.width() - bounds.width()) / 2;
+    int centeringOffsetY = (rect.height() - bounds.height()) / 2;
+    setScrollPosition(IntPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.y() - centeringOffsetY - rect.y()));
+}
+
+void FrameView::setScrollPosition(const IntPoint& scrollPoint)
+{
+    TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true);
+    m_maintainScrollPositionAnchor = 0;
+
+    IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
+
+    if (newScrollPosition == scrollPosition())
+        return;
+
+    Page* page = m_frame->page();
+    if (page && RuntimeEnabledFeatures::programmaticScrollNotificationsEnabled())
+        page->chrome().client().didProgrammaticallyScroll(m_frame.get(), newScrollPosition);
+
+    if (requestScrollPositionUpdate(newScrollPosition))
+        return;
+
+    ScrollView::setScrollPosition(newScrollPosition);
+}
+
+void FrameView::setScrollPositionNonProgrammatically(const IntPoint& scrollPoint)
+{
+    IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
+
+    if (newScrollPosition == scrollPosition())
+        return;
+
+    TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, false);
+    notifyScrollPositionChanged(newScrollPosition);
+}
+
+void FrameView::setViewportConstrainedObjectsNeedLayout()
+{
+    if (!hasViewportConstrainedObjects())
+        return;
+
+    ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObjects->end();
+    for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrainedObjects->begin(); it != end; ++it) {
+        RenderObject* renderer = *it;
+        renderer->setNeedsLayout();
+    }
+}
+
+
+void FrameView::scrollPositionChanged()
+{
+    m_frame->eventHandler()->sendScrollEvent();
+    m_frame->eventHandler()->dispatchFakeMouseMoveEventSoon();
+
+    if (RenderView* renderView = this->renderView()) {
+        if (renderView->usesCompositing())
+            renderView->compositor()->frameViewDidScroll();
+    }
+}
+
+void FrameView::repaintFixedElementsAfterScrolling()
+{
+    // For fixed position elements, update widget positions and compositing layers after scrolling,
+    // but only if we're not inside of layout.
+    if (!m_nestedLayoutCount && hasViewportConstrainedObjects()) {
+        if (RenderView* renderView = this->renderView()) {
+            renderView->updateWidgetPositions();
+            renderView->layer()->updateLayerPositionsAfterDocumentScroll();
+        }
+    }
+}
+
+void FrameView::updateFixedElementsAfterScrolling()
+{
+    if (m_nestedLayoutCount <= 1 && hasViewportConstrainedObjects()) {
+        if (RenderView* renderView = this->renderView())
+            renderView->compositor()->updateCompositingLayers(CompositingUpdateOnScroll);
+    }
+}
+
+bool FrameView::shouldRubberBandInDirection(ScrollDirection direction) const
+{
+    Page* page = frame().page();
+    if (!page)
+        return ScrollView::shouldRubberBandInDirection(direction);
+    return page->chrome().client().shouldRubberBandInDirection(direction);
+}
+
+bool FrameView::isRubberBandInProgress() const
+{
+    if (scrollbarsSuppressed())
+        return false;
+
+    // If the main thread updates the scroll position for this FrameView, we should return
+    // ScrollAnimator::isRubberBandInProgress().
+    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
+        return scrollAnimator->isRubberBandInProgress();
+
+    return false;
+}
+
+bool FrameView::requestScrollPositionUpdate(const IntPoint& position)
+{
+    return false;
+}
+
+HostWindow* FrameView::hostWindow() const
+{
+    Page* page = frame().page();
+    if (!page)
+        return 0;
+    return &page->chrome();
+}
+
+const unsigned cRepaintRectUnionThreshold = 25;
+
+void FrameView::repaintContentRectangle(const IntRect& r)
+{
+    ASSERT(!m_frame->ownerElement());
+
+    if (m_isTrackingRepaints) {
+        IntRect repaintRect = r;
+        repaintRect.move(-scrollOffset());
+        m_trackedRepaintRects.append(repaintRect);
+    }
+
+    double delay = m_deferringRepaints ? 0 : adjustedDeferredRepaintDelay();
+    if (m_deferringRepaints || m_deferredRepaintTimer.isActive() || delay) {
+        IntRect paintRect = r;
+        if (clipsRepaints() && !paintsEntireContents())
+            paintRect.intersect(visibleContentRect());
+        if (paintRect.isEmpty())
+            return;
+        if (m_repaintCount == cRepaintRectUnionThreshold) {
+            IntRect unionedRect;
+            for (unsigned i = 0; i < cRepaintRectUnionThreshold; ++i)
+                unionedRect.unite(pixelSnappedIntRect(m_repaintRects[i]));
+            m_repaintRects.clear();
+            m_repaintRects.append(unionedRect);
+        }
+        if (m_repaintCount < cRepaintRectUnionThreshold)
+            m_repaintRects.append(paintRect);
+        else
+            m_repaintRects[0].unite(paintRect);
+        m_repaintCount++;
+
+        if (!m_deferringRepaints)
+            startDeferredRepaintTimer(delay);
+
+        return;
+    }
+
+    if (!shouldUpdate())
+        return;
+
+    ScrollView::repaintContentRectangle(r);
+}
+
+void FrameView::contentsResized()
+{
+    ScrollView::contentsResized();
+    setNeedsLayout();
+}
+
+void FrameView::visibleContentsResized()
+{
+    // We check to make sure the view is attached to a frame() as this method can
+    // be triggered before the view is attached by Frame::createView(...) setting
+    // various values such as setScrollBarModes(...) for example.  An ASSERT is
+    // triggered when a view is layout before being attached to a frame().
+    if (!frame().view())
+        return;
+
+    if (!useFixedLayout() && needsLayout())
+        layout();
+
+    if (RenderView* renderView = this->renderView()) {
+        if (renderView->usesCompositing())
+            renderView->compositor()->frameViewDidChangeSize();
+    }
+}
+
+void FrameView::beginDeferredRepaints()
+{
+    Page* page = m_frame->page();
+    ASSERT(page);
+
+    if (!isMainFrame()) {
+        page->mainFrame()->view()->beginDeferredRepaints();
+        return;
+    }
+
+    m_deferringRepaints++;
+}
+
+void FrameView::endDeferredRepaints()
+{
+    Page* page = m_frame->page();
+    ASSERT(page);
+
+    if (!isMainFrame()) {
+        page->mainFrame()->view()->endDeferredRepaints();
+        return;
+    }
+
+    ASSERT(m_deferringRepaints > 0);
+
+    if (--m_deferringRepaints)
+        return;
+
+    if (m_deferredRepaintTimer.isActive())
+        return;
+
+    if (double delay = adjustedDeferredRepaintDelay()) {
+        startDeferredRepaintTimer(delay);
+        return;
+    }
+
+    doDeferredRepaints();
+}
+
+void FrameView::startDeferredRepaintTimer(double delay)
+{
+    if (m_deferredRepaintTimer.isActive())
+        return;
+
+    m_deferredRepaintTimer.startOneShot(delay);
+}
+
+void FrameView::handleLoadCompleted()
+{
+    // Once loading has completed, allow autoSize one last opportunity to
+    // reduce the size of the frame.
+    autoSizeIfEnabled();
+    if (shouldUseLoadTimeDeferredRepaintDelay())
+        return;
+    m_deferredRepaintDelay = s_normalDeferredRepaintDelay;
+    flushDeferredRepaints();
+}
+
+void FrameView::flushDeferredRepaints()
+{
+    if (!m_deferredRepaintTimer.isActive())
+        return;
+    m_deferredRepaintTimer.stop();
+    doDeferredRepaints();
+}
+
+void FrameView::doDeferredRepaints()
+{
+    ASSERT(!m_deferringRepaints);
+    if (!shouldUpdate()) {
+        m_repaintRects.clear();
+        m_repaintCount = 0;
+        return;
+    }
+    unsigned size = m_repaintRects.size();
+    for (unsigned i = 0; i < size; i++) {
+        ScrollView::repaintContentRectangle(pixelSnappedIntRect(m_repaintRects[i]));
+    }
+    m_repaintRects.clear();
+    m_repaintCount = 0;
+
+    updateDeferredRepaintDelayAfterRepaint();
+}
+
+bool FrameView::shouldUseLoadTimeDeferredRepaintDelay() const
+{
+    // Don't defer after the initial load of the page has been completed.
+    if (m_frame->tree()->top()->document()->loadEventFinished())
+        return false;
+    Document* document = m_frame->document();
+    if (!document)
+        return false;
+    if (document->parsing())
+        return true;
+    if (document->fetcher()->requestCount())
+        return true;
+    return false;
+}
+
+void FrameView::updateDeferredRepaintDelayAfterRepaint()
+{
+    if (!shouldUseLoadTimeDeferredRepaintDelay()) {
+        m_deferredRepaintDelay = s_normalDeferredRepaintDelay;
+        return;
+    }
+    double incrementedRepaintDelay = m_deferredRepaintDelay + s_deferredRepaintDelayIncrementDuringLoading;
+    m_deferredRepaintDelay = std::min(incrementedRepaintDelay, s_maxDeferredRepaintDelayDuringLoading);
+}
+
+void FrameView::resetDeferredRepaintDelay()
+{
+    m_deferredRepaintDelay = 0;
+    if (m_deferredRepaintTimer.isActive()) {
+        m_deferredRepaintTimer.stop();
+        if (!m_deferringRepaints)
+            doDeferredRepaints();
+    }
+}
+
+double FrameView::adjustedDeferredRepaintDelay() const
+{
+    ASSERT(!m_deferringRepaints);
+    if (!m_deferredRepaintDelay)
+        return 0;
+    double timeSinceLastPaint = currentTime() - m_lastPaintTime;
+    return max(0., m_deferredRepaintDelay - timeSinceLastPaint);
+}
+
+void FrameView::deferredRepaintTimerFired(Timer<FrameView>*)
+{
+    doDeferredRepaints();
+}
+
+void FrameView::layoutTimerFired(Timer<FrameView>*)
+{
+    layout();
+}
+
+void FrameView::scheduleRelayout()
+{
+    ASSERT(m_frame->view() == this);
+
+    if (m_layoutRoot) {
+        m_layoutRoot->markContainingBlocksForLayout(false);
+        m_layoutRoot = 0;
+    }
+    if (!m_layoutSchedulingEnabled)
+        return;
+    if (!needsLayout())
+        return;
+    if (!m_frame->document()->shouldScheduleLayout())
+        return;
+    InspectorInstrumentation::didInvalidateLayout(m_frame.get());
+
+    // When frame seamless is enabled, the contents of the frame could affect the layout of the parent frames.
+    // Also invalidate parent frame starting from the owner element of this frame.
+    if (m_frame->ownerRenderer() && m_frame->document()->shouldDisplaySeamlesslyWithParent())
+        m_frame->ownerRenderer()->setNeedsLayout();
+
+    int delay = m_frame->document()->minimumLayoutDelay();
+    if (m_layoutTimer.isActive() && m_delayedLayout && !delay)
+        unscheduleRelayout();
+    if (m_layoutTimer.isActive())
+        return;
+
+    m_delayedLayout = delay != 0;
+    m_layoutTimer.startOneShot(delay * 0.001);
+}
+
+static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* descendant)
+{
+    for (RenderObject* r = descendant; r; r = r->container()) {
+        if (r == ancestor)
+            return true;
+    }
+    return false;
+}
+
+void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot)
+{
+    ASSERT(m_frame->view() == this);
+
+    RenderView* renderView = this->renderView();
+    if (renderView && renderView->needsLayout()) {
+        if (relayoutRoot)
+            relayoutRoot->markContainingBlocksForLayout(false);
+        return;
+    }
+
+    if (layoutPending() || !m_layoutSchedulingEnabled) {
+        if (m_layoutRoot != relayoutRoot) {
+            if (isObjectAncestorContainerOf(m_layoutRoot, relayoutRoot)) {
+                // Keep the current root
+                relayoutRoot->markContainingBlocksForLayout(false, m_layoutRoot);
+                ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
+            } else if (m_layoutRoot && isObjectAncestorContainerOf(relayoutRoot, m_layoutRoot)) {
+                // Re-root at relayoutRoot
+                m_layoutRoot->markContainingBlocksForLayout(false, relayoutRoot);
+                m_layoutRoot = relayoutRoot;
+                ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
+                InspectorInstrumentation::didInvalidateLayout(m_frame.get());
+            } else {
+                // Just do a full relayout
+                if (m_layoutRoot)
+                    m_layoutRoot->markContainingBlocksForLayout(false);
+                m_layoutRoot = 0;
+                relayoutRoot->markContainingBlocksForLayout(false);
+                InspectorInstrumentation::didInvalidateLayout(m_frame.get());
+            }
+        }
+    } else if (m_layoutSchedulingEnabled) {
+        int delay = m_frame->document()->minimumLayoutDelay();
+        m_layoutRoot = relayoutRoot;
+        ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
+        InspectorInstrumentation::didInvalidateLayout(m_frame.get());
+        m_delayedLayout = delay != 0;
+        m_layoutTimer.startOneShot(delay * 0.001);
+    }
+}
+
+bool FrameView::layoutPending() const
+{
+    return m_layoutTimer.isActive();
+}
+
+bool FrameView::needsLayout() const
+{
+    // This can return true in cases where the document does not have a body yet.
+    // Document::shouldScheduleLayout takes care of preventing us from scheduling
+    // layout in that case.
+
+    RenderView* renderView = this->renderView();
+    return layoutPending()
+        || (renderView && renderView->needsLayout())
+        || m_layoutRoot
+        || (m_deferSetNeedsLayouts && m_setNeedsLayoutWasDeferred);
+}
+
+void FrameView::setNeedsLayout()
+{
+    if (m_deferSetNeedsLayouts) {
+        m_setNeedsLayoutWasDeferred = true;
+        return;
+    }
+
+    if (RenderView* renderView = this->renderView())
+        renderView->setNeedsLayout();
+}
+
+void FrameView::unscheduleRelayout()
+{
+    if (!m_layoutTimer.isActive())
+        return;
+
+    m_layoutTimer.stop();
+    m_delayedLayout = false;
+}
+
+void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime)
+{
+    for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree()->traverseNext()) {
+        frame->view()->serviceScrollAnimations();
+        if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
+            frame->animation()->serviceAnimations();
+        if (RuntimeEnabledFeatures::webAnimationsEnabled())
+            frame->document()->timeline()->serviceAnimations(monotonicAnimationStartTime);
+    }
+
+    Vector<RefPtr<Document> > documents;
+    for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext())
+        documents.append(frame->document());
+
+    for (size_t i = 0; i < documents.size(); ++i)
+        documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime);
+}
+
+bool FrameView::isTransparent() const
+{
+    return m_isTransparent;
+}
+
+void FrameView::setTransparent(bool isTransparent)
+{
+    m_isTransparent = isTransparent;
+    if (renderView() && renderView()->layer()->compositedLayerMapping())
+        renderView()->layer()->compositedLayerMapping()->updateContentsOpaque();
+}
+
+bool FrameView::hasOpaqueBackground() const
+{
+    return !m_isTransparent && !m_baseBackgroundColor.hasAlpha();
+}
+
+Color FrameView::baseBackgroundColor() const
+{
+    return m_baseBackgroundColor;
+}
+
+void FrameView::setBaseBackgroundColor(const Color& backgroundColor)
+{
+    if (!backgroundColor.isValid())
+        m_baseBackgroundColor = Color::white;
+    else
+        m_baseBackgroundColor = backgroundColor;
+
+    if (CompositedLayerMapping* compositedLayerMapping = renderView() ? renderView()->layer()->compositedLayerMapping() : 0) {
+        compositedLayerMapping->updateContentsOpaque();
+        if (compositedLayerMapping->mainGraphicsLayer())
+            compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay();
+    }
+    recalculateScrollbarOverlayStyle();
+}
+
+void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool transparent)
+{
+    for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext(m_frame.get())) {
+        if (FrameView* view = frame->view()) {
+            view->setTransparent(transparent);
+            view->setBaseBackgroundColor(backgroundColor);
+        }
+    }
+}
+
+bool FrameView::shouldUpdateWhileOffscreen() const
+{
+    return m_shouldUpdateWhileOffscreen;
+}
+
+void FrameView::setShouldUpdateWhileOffscreen(bool shouldUpdateWhileOffscreen)
+{
+    m_shouldUpdateWhileOffscreen = shouldUpdateWhileOffscreen;
+}
+
+bool FrameView::shouldUpdate() const
+{
+    if (isOffscreen() && !shouldUpdateWhileOffscreen())
+        return false;
+    return true;
+}
+
+void FrameView::suspendOverflowEvents()
+{
+    ++m_overflowEventSuspendCount;
+}
+
+void FrameView::resumeOverflowEvents()
+{
+    // FIXME: We should assert here but it makes several tests fail. See http://crbug.com/299788
+    // ASSERT(m_overflowEventSuspendCount > 0);
+
+    if (--m_overflowEventSuspendCount)
+        return;
+
+    Vector<RefPtr<OverflowEvent> > events;
+    m_overflowEventQueue.swap(events);
+
+    for (Vector<RefPtr<OverflowEvent> >::iterator it = events.begin(); it != events.end(); ++it) {
+        Node* target = (*it)->target()->toNode();
+        if (target->inDocument())
+            target->dispatchEvent(*it, IGNORE_EXCEPTION);
+    }
+}
+
+void FrameView::scheduleOverflowEvent(PassRefPtr<OverflowEvent> event)
+{
+    m_overflowEventQueue.append(event);
+}
+
+void FrameView::scrollToAnchor()
+{
+    RefPtr<Node> anchorNode = m_maintainScrollPositionAnchor;
+    if (!anchorNode)
+        return;
+
+    if (!anchorNode->renderer())
+        return;
+
+    LayoutRect rect;
+    if (anchorNode != m_frame->document())
+        rect = anchorNode->boundingBox();
+
+    // Scroll nested layers and frames to reveal the anchor.
+    // Align to the top and to the closest side (this matches other browsers).
+    anchorNode->renderer()->scrollRectToVisible(rect, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways);
+
+    if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache())
+        cache->handleScrolledToAnchor(anchorNode.get());
+
+    // scrollRectToVisible can call into setScrollPosition(), which resets m_maintainScrollPositionAnchor.
+    m_maintainScrollPositionAnchor = anchorNode;
+}
+
+void FrameView::updateWidget(RenderObject* object)
+{
+    ASSERT(!object->node() || object->node()->isElementNode());
+    Element* ownerElement = toElement(object->node());
+    // The object may have already been destroyed (thus node cleared),
+    // but FrameView holds a manual ref, so it won't have been deleted.
+    ASSERT(m_widgetUpdateSet->contains(object));
+    if (!ownerElement)
+        return;
+
+    if (object->isEmbeddedObject()) {
+        RenderEmbeddedObject* embeddedObject = static_cast<RenderEmbeddedObject*>(object);
+        // No need to update if it's already crashed or known to be missing.
+        if (embeddedObject->showsUnavailablePluginIndicator())
+            return;
+
+        // FIXME: This could turn into a real virtual dispatch if we defined
+        // updateWidget(PluginCreationOption) on HTMLElement.
+        if (ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag) || ownerElement->hasTagName(appletTag)) {
+            HTMLPlugInImageElement* pluginElement = toHTMLPlugInImageElement(ownerElement);
+            if (pluginElement->needsWidgetUpdate())
+                pluginElement->updateWidget(CreateAnyWidgetType);
+        } else
+            ASSERT_NOT_REACHED();
+
+        // Caution: it's possible the object was destroyed again, since loading a
+        // plugin may run any arbitrary JavaScript.
+        embeddedObject->updateWidgetPosition();
+    }
+}
+
+bool FrameView::updateWidgets()
+{
+    if (m_nestedLayoutCount > 1 || !m_widgetUpdateSet || m_widgetUpdateSet->isEmpty())
+        return true;
+
+    size_t size = m_widgetUpdateSet->size();
+
+    Vector<RenderObject*> objects;
+    objects.reserveInitialCapacity(size);
+
+    RenderObjectSet::const_iterator end = m_widgetUpdateSet->end();
+    for (RenderObjectSet::const_iterator it = m_widgetUpdateSet->begin(); it != end; ++it) {
+        RenderObject* object = *it;
+        objects.uncheckedAppend(object);
+        if (object->isEmbeddedObject()) {
+            RenderEmbeddedObject* embeddedObject = static_cast<RenderEmbeddedObject*>(object);
+            embeddedObject->ref();
+        }
+    }
+
+    for (size_t i = 0; i < size; ++i) {
+        RenderObject* object = objects[i];
+        updateWidget(object);
+        m_widgetUpdateSet->remove(object);
+    }
+
+    for (size_t i = 0; i < size; ++i) {
+        RenderObject* object = objects[i];
+        if (object->isEmbeddedObject()) {
+            RenderEmbeddedObject* embeddedObject = static_cast<RenderEmbeddedObject*>(object);
+            embeddedObject->deref();
+        }
+    }
+
+    return m_widgetUpdateSet->isEmpty();
+}
+
+void FrameView::flushAnyPendingPostLayoutTasks()
+{
+    if (!m_postLayoutTasksTimer.isActive())
+        return;
+
+    performPostLayoutTasks();
+}
+
+void FrameView::performPostLayoutTasks()
+{
+    TRACE_EVENT0("webkit", "FrameView::performPostLayoutTasks");
+    // updateWidgets() call below can blow us away from underneath.
+    RefPtr<FrameView> protect(this);
+
+    m_postLayoutTasksTimer.stop();
+
+    m_frame->selection().setCaretRectNeedsUpdate();
+    m_frame->selection().updateAppearance();
+
+    if (m_nestedLayoutCount <= 1) {
+        if (m_firstLayoutCallbackPending) {
+            m_firstLayoutCallbackPending = false;
+            m_frame->loader()->didFirstLayout();
+        }
+
+        // Ensure that we always send this eventually.
+        if (!m_frame->document()->parsing() && m_frame->loader()->stateMachine()->committedFirstRealDocumentLoad())
+            m_isVisuallyNonEmpty = true;
+
+        // If the layout was done with pending sheets, we are not in fact visually non-empty yet.
+        if (m_isVisuallyNonEmpty && !m_frame->document()->didLayoutWithPendingStylesheets() && m_firstVisuallyNonEmptyLayoutCallbackPending) {
+            m_firstVisuallyNonEmptyLayoutCallbackPending = false;
+            // FIXME: This callback is probably not needed, but is currently used
+            // by android for setting the background color.
+            m_frame->loader()->client()->dispatchDidFirstVisuallyNonEmptyLayout();
+        }
+    }
+
+    m_frame->document()->fonts()->didLayout();
+
+    RenderView* renderView = this->renderView();
+    if (renderView)
+        renderView->updateWidgetPositions();
+
+    for (unsigned i = 0; i < maxUpdateWidgetsIterations; i++) {
+        if (updateWidgets())
+            break;
+    }
+
+    if (Page* page = m_frame->page()) {
+        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+            scrollingCoordinator->frameViewLayoutUpdated(this);
+    }
+
+    scrollToAnchor();
+
+    resumeOverflowEvents();
+
+    sendResizeEventIfNeeded();
+}
+
+void FrameView::sendResizeEventIfNeeded()
+{
+    ASSERT(m_frame);
+
+    RenderView* renderView = this->renderView();
+    if (!renderView || renderView->document().printing())
+        return;
+
+    IntSize currentSize = layoutSize(IncludeScrollbars);
+    float currentZoomFactor = renderView->style()->zoom();
+
+    bool shouldSendResizeEvent = currentSize != m_lastViewportSize || currentZoomFactor != m_lastZoomFactor;
+
+    m_lastViewportSize = currentSize;
+    m_lastZoomFactor = currentZoomFactor;
+
+    if (!shouldSendResizeEvent)
+        return;
+
+    m_frame->eventHandler()->sendResizeEvent();
+
+    if (isMainFrame())
+        InspectorInstrumentation::didResizeMainFrame(m_frame->page());
+}
+
+void FrameView::postLayoutTimerFired(Timer<FrameView>*)
+{
+    performPostLayoutTasks();
+}
+
+void FrameView::updateCounters()
+{
+    RenderView* view = renderView();
+    if (!view->hasRenderCounters())
+        return;
+
+    for (RenderObject* renderer = view; renderer; renderer = renderer->nextInPreOrder()) {
+        if (!renderer->isCounter())
+            continue;
+
+        toRenderCounter(renderer)->updateCounter();
+    }
+}
+
+void FrameView::autoSizeIfEnabled()
+{
+    if (!m_shouldAutoSize)
+        return;
+
+    if (m_inAutoSize)
+        return;
+
+    TemporaryChange<bool> changeInAutoSize(m_inAutoSize, true);
+
+    Document* document = frame().document();
+    if (!document)
+        return;
+
+    RenderView* documentView = document->renderView();
+    Element* documentElement = document->documentElement();
+    if (!documentView || !documentElement)
+        return;
+
+    RenderBox* documentRenderBox = documentElement->renderBox();
+    if (!documentRenderBox)
+        return;
+
+    // If this is the first time we run autosize, start from small height and
+    // allow it to grow.
+    if (!m_didRunAutosize)
+        resize(frameRect().width(), m_minAutoSize.height());
+
+    IntSize size = frameRect().size();
+
+    // Do the resizing twice. The first time is basically a rough calculation using the preferred width
+    // which may result in a height change during the second iteration.
+    for (int i = 0; i < 2; i++) {
+        // Update various sizes including contentsSize, scrollHeight, etc.
+        document->updateLayoutIgnorePendingStylesheets();
+        int width = documentView->minPreferredLogicalWidth();
+        int height = documentRenderBox->scrollHeight();
+        IntSize newSize(width, height);
+
+        // Check to see if a scrollbar is needed for a given dimension and
+        // if so, increase the other dimension to account for the scrollbar.
+        // Since the dimensions are only for the view rectangle, once a
+        // dimension exceeds the maximum, there is no need to increase it further.
+        if (newSize.width() > m_maxAutoSize.width()) {
+            RefPtr<Scrollbar> localHorizontalScrollbar = horizontalScrollbar();
+            if (!localHorizontalScrollbar)
+                localHorizontalScrollbar = createScrollbar(HorizontalScrollbar);
+            if (!localHorizontalScrollbar->isOverlayScrollbar())
+                newSize.setHeight(newSize.height() + localHorizontalScrollbar->height());
+
+            // Don't bother checking for a vertical scrollbar because the width is at
+            // already greater the maximum.
+        } else if (newSize.height() > m_maxAutoSize.height()) {
+            RefPtr<Scrollbar> localVerticalScrollbar = verticalScrollbar();
+            if (!localVerticalScrollbar)
+                localVerticalScrollbar = createScrollbar(VerticalScrollbar);
+            if (!localVerticalScrollbar->isOverlayScrollbar())
+                newSize.setWidth(newSize.width() + localVerticalScrollbar->width());
+
+            // Don't bother checking for a horizontal scrollbar because the height is
+            // already greater the maximum.
+        }
+
+        // Ensure the size is at least the min bounds.
+        newSize = newSize.expandedTo(m_minAutoSize);
+
+        // Bound the dimensions by the max bounds and determine what scrollbars to show.
+        ScrollbarMode horizonalScrollbarMode = ScrollbarAlwaysOff;
+        if (newSize.width() > m_maxAutoSize.width()) {
+            newSize.setWidth(m_maxAutoSize.width());
+            horizonalScrollbarMode = ScrollbarAlwaysOn;
+        }
+        ScrollbarMode verticalScrollbarMode = ScrollbarAlwaysOff;
+        if (newSize.height() > m_maxAutoSize.height()) {
+            newSize.setHeight(m_maxAutoSize.height());
+            verticalScrollbarMode = ScrollbarAlwaysOn;
+        }
+
+        if (newSize == size)
+            continue;
+
+        // While loading only allow the size to increase (to avoid twitching during intermediate smaller states)
+        // unless autoresize has just been turned on or the maximum size is smaller than the current size.
+        if (m_didRunAutosize && size.height() <= m_maxAutoSize.height() && size.width() <= m_maxAutoSize.width()
+            && !m_frame->document()->loadEventFinished() && (newSize.height() < size.height() || newSize.width() < size.width()))
+            break;
+
+        resize(newSize.width(), newSize.height());
+        // Force the scrollbar state to avoid the scrollbar code adding them and causing them to be needed. For example,
+        // a vertical scrollbar may cause text to wrap and thus increase the height (which is the only reason the scollbar is needed).
+        setVerticalScrollbarLock(false);
+        setHorizontalScrollbarLock(false);
+        setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, true);
+    }
+    m_didRunAutosize = true;
+}
+
+void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow)
+{
+    if (!m_viewportRenderer)
+        return;
+
+    if (m_overflowStatusDirty) {
+        m_horizontalOverflow = horizontalOverflow;
+        m_verticalOverflow = verticalOverflow;
+        m_overflowStatusDirty = false;
+        return;
+    }
+
+    bool horizontalOverflowChanged = (m_horizontalOverflow != horizontalOverflow);
+    bool verticalOverflowChanged = (m_verticalOverflow != verticalOverflow);
+
+    if (horizontalOverflowChanged || verticalOverflowChanged) {
+        m_horizontalOverflow = horizontalOverflow;
+        m_verticalOverflow = verticalOverflow;
+
+        RefPtr<OverflowEvent> event = OverflowEvent::create(horizontalOverflowChanged, horizontalOverflow, verticalOverflowChanged, verticalOverflow);
+        event->setTarget(m_viewportRenderer->node());
+        scheduleOverflowEvent(event);
+    }
+
+}
+
+const Pagination& FrameView::pagination() const
+{
+    if (m_pagination != Pagination())
+        return m_pagination;
+
+    if (isMainFrame())
+        return m_frame->page()->pagination();
+
+    return m_pagination;
+}
+
+void FrameView::setPagination(const Pagination& pagination)
+{
+    if (m_pagination == pagination)
+        return;
+
+    m_pagination = pagination;
+
+    m_frame->document()->styleResolverChanged(RecalcStyleDeferred);
+}
+
+IntRect FrameView::windowClipRect(bool clipToContents) const
+{
+    ASSERT(m_frame->view() == this);
+
+    if (paintsEntireContents())
+        return IntRect(IntPoint(), contentsSize());
+
+    // Set our clip rect to be our contents.
+    IntRect clipRect = contentsToWindow(visibleContentRect(clipToContents ? ExcludeScrollbars : IncludeScrollbars));
+    if (!m_frame->ownerElement())
+        return clipRect;
+
+    // Take our owner element and get its clip rect.
+    HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement();
+    FrameView* parentView = ownerElement->document().view();
+    if (parentView)
+        clipRect.intersect(parentView->windowClipRectForFrameOwner(ownerElement, true));
+    return clipRect;
+}
+
+IntRect FrameView::windowClipRectForFrameOwner(const HTMLFrameOwnerElement* ownerElement, bool clipToLayerContents) const
+{
+    // The renderer can sometimes be null when style="display:none" interacts
+    // with external content and plugins.
+    if (!ownerElement->renderer())
+        return windowClipRect();
+
+    // If we have no layer, just return our window clip rect.
+    const RenderLayer* enclosingLayer = ownerElement->renderer()->enclosingLayer();
+    if (!enclosingLayer)
+        return windowClipRect();
+
+    // Apply the clip from the layer.
+    IntRect clipRect;
+    if (clipToLayerContents)
+        clipRect = pixelSnappedIntRect(enclosingLayer->childrenClipRect());
+    else
+        clipRect = pixelSnappedIntRect(enclosingLayer->selfClipRect());
+    clipRect = contentsToWindow(clipRect);
+    return intersection(clipRect, windowClipRect());
+}
+
+bool FrameView::isActive() const
+{
+    Page* page = frame().page();
+    return page && page->focusController().isActive();
+}
+
+void FrameView::scrollTo(const IntSize& newOffset)
+{
+    LayoutSize offset = scrollOffset();
+    ScrollView::scrollTo(newOffset);
+    if (offset != scrollOffset())
+        scrollPositionChanged();
+    frame().loader()->client()->didChangeScrollOffset();
+}
+
+void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
+{
+    // Add in our offset within the FrameView.
+    IntRect dirtyRect = rect;
+    dirtyRect.moveBy(scrollbar->location());
+    invalidateRect(dirtyRect);
+}
+
+void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const
+{
+    tickmarks = frame().document()->markers()->renderedRectsForMarkers(DocumentMarker::TextMatch);
+}
+
+IntRect FrameView::windowResizerRect() const
+{
+    Page* page = frame().page();
+    if (!page)
+        return IntRect();
+    return page->chrome().windowResizerRect();
+}
+
+void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor)
+{
+    if (m_visibleContentScaleFactor == visibleContentScaleFactor)
+        return;
+
+    m_visibleContentScaleFactor = visibleContentScaleFactor;
+    updateScrollbars(scrollOffset());
+}
+
+void FrameView::setInputEventsScaleFactorForEmulation(float contentScaleFactor)
+{
+    if (m_inputEventsScaleFactorForEmulation == contentScaleFactor)
+        return;
+
+    m_inputEventsScaleFactorForEmulation = contentScaleFactor;
+}
+
+float FrameView::inputEventsScaleFactor() const
+{
+    return visibleContentScaleFactor() * m_inputEventsScaleFactorForEmulation;
+}
+
+bool FrameView::scrollbarsCanBeActive() const
+{
+    if (m_frame->view() != this)
+        return false;
+
+    return !!m_frame->document();
+}
+
+ScrollableArea* FrameView::enclosingScrollableArea() const
+{
+    // FIXME: Walk up the frame tree and look for a scrollable parent frame or RenderLayer.
+    return 0;
+}
+
+IntRect FrameView::scrollableAreaBoundingBox() const
+{
+    RenderPart* ownerRenderer = frame().ownerRenderer();
+    if (!ownerRenderer)
+        return frameRect();
+
+    return ownerRenderer->absoluteContentQuad().enclosingBoundingBox();
+}
+
+bool FrameView::isScrollable()
+{
+    // Check for:
+    // 1) If there an actual overflow.
+    // 2) display:none or visibility:hidden set to self or inherited.
+    // 3) overflow{-x,-y}: hidden;
+    // 4) scrolling: no;
+
+    // Covers #1
+    IntSize contentsSize = this->contentsSize();
+    IntSize visibleContentSize = visibleContentRect().size();
+    if ((contentsSize.height() <= visibleContentSize.height() && contentsSize.width() <= visibleContentSize.width()))
+        return false;
+
+    // Covers #2.
+    HTMLFrameOwnerElement* owner = m_frame->ownerElement();
+    if (owner && (!owner->renderer() || !owner->renderer()->visibleToHitTesting()))
+        return false;
+
+    // Cover #3 and #4.
+    ScrollbarMode horizontalMode;
+    ScrollbarMode verticalMode;
+    calculateScrollbarModesForLayout(horizontalMode, verticalMode, RulesFromWebContentOnly);
+    if (horizontalMode == ScrollbarAlwaysOff && verticalMode == ScrollbarAlwaysOff)
+        return false;
+
+    return true;
+}
+
+void FrameView::updateScrollableAreaSet()
+{
+    // That ensures that only inner frames are cached.
+    FrameView* parentFrameView = this->parentFrameView();
+    if (!parentFrameView)
+        return;
+
+    if (!isScrollable()) {
+        parentFrameView->removeScrollableArea(this);
+        return;
+    }
+
+    parentFrameView->addScrollableArea(this);
+}
+
+bool FrameView::shouldSuspendScrollAnimations() const
+{
+    return m_frame->loader()->state() != FrameStateComplete;
+}
+
+void FrameView::scrollbarStyleChanged(int newStyle, bool forceUpdate)
+{
+    if (!isMainFrame())
+        return;
+
+    if (forceUpdate)
+        ScrollView::scrollbarStyleChanged(newStyle, forceUpdate);
+}
+
+void FrameView::setAnimatorsAreActive()
+{
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
+        scrollAnimator->setIsActive();
+
+    if (!m_scrollableAreas)
+        return;
+
+    for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin(), end = m_scrollableAreas->end(); it != end; ++it) {
+        ScrollableArea* scrollableArea = *it;
+
+        ASSERT(scrollableArea->scrollbarsCanBeActive());
+        scrollableArea->scrollAnimator()->setIsActive();
+    }
+}
+
+void FrameView::notifyPageThatContentAreaWillPaint() const
+{
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    contentAreaWillPaint();
+
+    if (!m_scrollableAreas)
+        return;
+
+    for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin(), end = m_scrollableAreas->end(); it != end; ++it) {
+        ScrollableArea* scrollableArea = *it;
+
+        if (!scrollableArea->scrollbarsCanBeActive())
+            continue;
+
+        scrollableArea->contentAreaWillPaint();
+    }
+}
+
+bool FrameView::scrollAnimatorEnabled() const
+{
+    if (m_frame->settings())
+        return m_frame->settings()->scrollAnimatorEnabled();
+    return false;
+}
+
+void FrameView::updateAnnotatedRegions()
+{
+    Document* document = m_frame->document();
+    if (!document->hasAnnotatedRegions())
+        return;
+    Vector<AnnotatedRegionValue> newRegions;
+    document->renderBox()->collectAnnotatedRegions(newRegions);
+    if (newRegions == document->annotatedRegions())
+        return;
+    document->setAnnotatedRegions(newRegions);
+    if (Page* page = m_frame->page())
+        page->chrome().client().annotatedRegionsChanged();
+}
+
+void FrameView::updateScrollCorner()
+{
+    RefPtr<RenderStyle> cornerStyle;
+    IntRect cornerRect = scrollCornerRect();
+    Document* doc = m_frame->document();
+
+    if (doc && !cornerRect.isEmpty()) {
+        // Try the <body> element first as a scroll corner source.
+        if (Element* body = doc->body()) {
+            if (RenderObject* renderer = body->renderer())
+                cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), renderer->style());
+        }
+
+        if (!cornerStyle) {
+            // If the <body> didn't have a custom style, then the root element might.
+            if (Element* docElement = doc->documentElement()) {
+                if (RenderObject* renderer = docElement->renderer())
+                    cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), renderer->style());
+            }
+        }
+
+        if (!cornerStyle) {
+            // If we have an owning ipage/Frame element, then it can set the custom scrollbar also.
+            if (RenderPart* renderer = m_frame->ownerRenderer())
+                cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), renderer->style());
+        }
+    }
+
+    if (cornerStyle) {
+        if (!m_scrollCorner)
+            m_scrollCorner = RenderScrollbarPart::createAnonymous(doc);
+        m_scrollCorner->setStyle(cornerStyle.release());
+        invalidateScrollCorner(cornerRect);
+    } else if (m_scrollCorner) {
+        m_scrollCorner->destroy();
+        m_scrollCorner = 0;
+    }
+
+    ScrollView::updateScrollCorner();
+}
+
+void FrameView::paintScrollCorner(GraphicsContext* context, const IntRect& cornerRect)
+{
+    if (context->updatingControlTints()) {
+        updateScrollCorner();
+        return;
+    }
+
+    if (m_scrollCorner) {
+        bool needsBackgorund = isMainFrame();
+        if (needsBackgorund)
+            context->fillRect(cornerRect, baseBackgroundColor());
+        m_scrollCorner->paintIntoRect(context, cornerRect.location(), cornerRect);
+        return;
+    }
+
+    ScrollView::paintScrollCorner(context, cornerRect);
+}
+
+void FrameView::paintScrollbar(GraphicsContext* context, Scrollbar* bar, const IntRect& rect)
+{
+    bool needsBackgorund = bar->isCustomScrollbar() && isMainFrame();
+    if (needsBackgorund) {
+        IntRect toFill = bar->frameRect();
+        toFill.intersect(rect);
+        context->fillRect(toFill, baseBackgroundColor());
+    }
+
+    ScrollView::paintScrollbar(context, bar, rect);
+}
+
+Color FrameView::documentBackgroundColor() const
+{
+    // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background color of
+    // the document and the body against the base background color of the frame view.
+    // Background images are unfortunately impractical to include.
+
+    // Return invalid Color objects whenever there is insufficient information.
+    if (!frame().document())
+        return Color();
+
+    Element* htmlElement = frame().document()->documentElement();
+    Element* bodyElement = frame().document()->body();
+
+    // Start with invalid colors.
+    Color htmlBackgroundColor;
+    Color bodyBackgroundColor;
+    if (htmlElement && htmlElement->renderer())
+        htmlBackgroundColor = htmlElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
+    if (bodyElement && bodyElement->renderer())
+        bodyBackgroundColor = bodyElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
+
+    if (!bodyBackgroundColor.isValid()) {
+        if (!htmlBackgroundColor.isValid())
+            return Color();
+        return baseBackgroundColor().blend(htmlBackgroundColor);
+    }
+
+    if (!htmlBackgroundColor.isValid())
+        return baseBackgroundColor().blend(bodyBackgroundColor);
+
+    // We take the aggregate of the base background color
+    // the <html> background color, and the <body>
+    // background color to find the document color. The
+    // addition of the base background color is not
+    // technically part of the document background, but it
+    // otherwise poses problems when the aggregate is not
+    // fully opaque.
+    return baseBackgroundColor().blend(htmlBackgroundColor).blend(bodyBackgroundColor);
+}
+
+bool FrameView::hasCustomScrollbars() const
+{
+    const HashSet<RefPtr<Widget> >* viewChildren = children();
+    HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end();
+    for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) {
+        Widget* widget = current->get();
+        if (widget->isFrameView()) {
+            if (toFrameView(widget)->hasCustomScrollbars())
+                return true;
+        } else if (widget->isScrollbar()) {
+            Scrollbar* scrollbar = static_cast<Scrollbar*>(widget);
+            if (scrollbar->isCustomScrollbar())
+                return true;
+        }
+    }
+
+    return false;
+}
+
+FrameView* FrameView::parentFrameView() const
+{
+    if (!parent())
+        return 0;
+
+    if (Frame* parentFrame = m_frame->tree()->parent())
+        return parentFrame->view();
+
+    return 0;
+}
+
+void FrameView::updateControlTints()
+{
+    // This is called when control tints are changed from aqua/graphite to clear and vice versa.
+    // We do a "fake" paint, and when the theme gets a paint call, it can then do an invalidate.
+    // This is only done if the theme supports control tinting. It's up to the theme and platform
+    // to define when controls get the tint and to call this function when that changes.
+
+    // Optimize the common case where we bring a window to the front while it's still empty.
+    if (m_frame->document()->url().isEmpty())
+        return;
+
+    if (RenderTheme::theme().supportsControlTints() || hasCustomScrollbars())
+        paintControlTints();
+}
+
+void FrameView::paintControlTints()
+{
+    if (needsLayout())
+        layout();
+    // FIXME: The use of paint seems like overkill: crbug.com/236892
+    GraphicsContext context(0); // NULL canvas to get a non-painting context.
+    context.setUpdatingControlTints(true);
+    paint(&context, frameRect());
+}
+
+bool FrameView::wasScrolledByUser() const
+{
+    return m_wasScrolledByUser;
+}
+
+void FrameView::setWasScrolledByUser(bool wasScrolledByUser)
+{
+    if (m_inProgrammaticScroll)
+        return;
+    m_maintainScrollPositionAnchor = 0;
+    m_wasScrolledByUser = wasScrolledByUser;
+}
+
+void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
+{
+    Document* document = m_frame->document();
+
+#ifndef NDEBUG
+    bool fillWithRed;
+    if (document->printing())
+        fillWithRed = false; // Printing, don't fill with red (can't remember why).
+    else if (m_frame->ownerElement())
+        fillWithRed = false; // Subframe, don't fill with red.
+    else if (isTransparent())
+        fillWithRed = false; // Transparent, don't fill with red.
+    else if (m_paintBehavior & PaintBehaviorSelectionOnly)
+        fillWithRed = false; // Selections are transparent, don't fill with red.
+    else if (m_nodeToDraw)
+        fillWithRed = false; // Element images are transparent, don't fill with red.
+    else
+        fillWithRed = true;
+
+    if (fillWithRed)
+        p->fillRect(rect, Color(0xFF, 0, 0));
+#endif
+
+    RenderView* renderView = this->renderView();
+    if (!renderView) {
+        LOG_ERROR("called FrameView::paint with nil renderer");
+        return;
+    }
+
+    ASSERT(!needsLayout());
+    if (needsLayout())
+        return;
+
+    InspectorInstrumentation::willPaint(renderView);
+
+    bool isTopLevelPainter = !s_inPaintContents;
+    s_inPaintContents = true;
+
+    FontCachePurgePreventer fontCachePurgePreventer;
+
+    PaintBehavior oldPaintBehavior = m_paintBehavior;
+
+    if (FrameView* parentView = parentFrameView()) {
+        if (parentView->paintBehavior() & PaintBehaviorFlattenCompositingLayers)
+            m_paintBehavior |= PaintBehaviorFlattenCompositingLayers;
+    }
+
+    if (m_paintBehavior == PaintBehaviorNormal)
+        document->markers()->invalidateRenderedRectsForMarkersInRect(rect);
+
+    if (document->printing())
+        m_paintBehavior |= PaintBehaviorFlattenCompositingLayers;
+
+    ASSERT(!m_isPainting);
+    m_isPainting = true;
+
+    // m_nodeToDraw is used to draw only one element (and its descendants)
+    RenderObject* eltRenderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0;
+    RenderLayer* rootLayer = renderView->layer();
+
+#ifndef NDEBUG
+    renderView->assertSubtreeIsLaidOut();
+    RenderObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(rootLayer->renderer());
+#endif
+
+    RenderObject* enclosingLayerRenderer = eltRenderer->enclosingLayer() ? eltRenderer->enclosingLayer()->renderer() : eltRenderer;
+    rootLayer->paint(p, rect, m_paintBehavior, enclosingLayerRenderer);
+
+    if (rootLayer->containsDirtyOverlayScrollbars())
+        rootLayer->paintOverlayScrollbars(p, rect, m_paintBehavior, eltRenderer);
+
+    m_isPainting = false;
+
+    m_paintBehavior = oldPaintBehavior;
+    m_lastPaintTime = currentTime();
+
+    // Regions may have changed as a result of the visibility/z-index of element changing.
+    if (document->annotatedRegionsDirty())
+        updateAnnotatedRegions();
+
+    if (isTopLevelPainter) {
+        // Everythin that happens after paintContents completions is considered
+        // to be part of the next frame.
+        s_currentFrameTimeStamp = currentTime();
+        s_inPaintContents = false;
+    }
+
+    InspectorInstrumentation::didPaint(renderView, p, rect);
+}
+
+void FrameView::setPaintBehavior(PaintBehavior behavior)
+{
+    m_paintBehavior = behavior;
+}
+
+PaintBehavior FrameView::paintBehavior() const
+{
+    return m_paintBehavior;
+}
+
+bool FrameView::isPainting() const
+{
+    return m_isPainting;
+}
+
+void FrameView::setNodeToDraw(Node* node)
+{
+    m_nodeToDraw = node;
+}
+
+void FrameView::paintOverhangAreas(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect)
+{
+    if (context->paintingDisabled())
+        return;
+
+    if (m_frame->document()->printing())
+        return;
+
+    if (isMainFrame()) {
+        if (m_frame->page()->chrome().client().paintCustomOverhangArea(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect))
+            return;
+    }
+
+    ScrollView::paintOverhangAreas(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect);
+}
+
+void FrameView::updateLayoutAndStyleIfNeededRecursive()
+{
+    // We have to crawl our entire tree looking for any FrameViews that need
+    // layout and make sure they are up to date.
+    // Mac actually tests for intersection with the dirty region and tries not to
+    // update layout for frames that are outside the dirty region.  Not only does this seem
+    // pointless (since those frames will have set a zero timer to layout anyway), but
+    // it is also incorrect, since if two frames overlap, the first could be excluded from the dirty
+    // region but then become included later by the second frame adding rects to the dirty region
+    // when it lays out.
+
+    m_frame->document()->updateStyleIfNeeded();
+
+    if (needsLayout())
+        layout();
+
+    // Grab a copy of the children() set, as it may be mutated by the following updateLayoutAndStyleIfNeededRecursive
+    // calls, as they can potentially re-enter a layout of the parent frame view, which may add/remove scrollbars
+    // and thus mutates the children() set.
+    Vector<RefPtr<FrameView> > frameViews;
+    collectFrameViewChildren(this, frameViews);
+
+    const Vector<RefPtr<FrameView> >::iterator end = frameViews.end();
+    for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end; ++it)
+        (*it)->updateLayoutAndStyleIfNeededRecursive();
+
+    // updateLayoutAndStyleIfNeededRecursive is called when we need to make sure style and layout are up-to-date before
+    // painting, so we need to flush out any deferred repaints too.
+    flushDeferredRepaints();
+
+    // When seamless is on, child frame can mark parent frame dirty. In such case, child frame
+    // needs to call layout on parent frame recursively.
+    // This assert ensures that parent frames are clean, when child frames finished updating layout and style.
+    ASSERT(!needsLayout());
+}
+
+void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize)
+{
+    ASSERT(!enable || !minSize.isEmpty());
+    ASSERT(minSize.width() <= maxSize.width());
+    ASSERT(minSize.height() <= maxSize.height());
+
+    if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize)
+        return;
+
+    m_shouldAutoSize = enable;
+    m_minAutoSize = minSize;
+    m_maxAutoSize = maxSize;
+    m_didRunAutosize = false;
+
+    setNeedsLayout();
+    scheduleRelayout();
+    if (m_shouldAutoSize)
+        return;
+
+    // Since autosize mode forces the scrollbar mode, change them to being auto.
+    setVerticalScrollbarLock(false);
+    setHorizontalScrollbarLock(false);
+    setScrollbarModes(ScrollbarAuto, ScrollbarAuto);
+}
+
+void FrameView::forceLayout(bool allowSubtree)
+{
+    layout(allowSubtree);
+}
+
+void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot shouldAdjustViewSize)
+{
+    // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good trick to see
+    // the state of things before and after the layout
+    if (RenderView* renderView = this->renderView()) {
+        float pageLogicalWidth = renderView->style()->isHorizontalWritingMode() ? pageSize.width() : pageSize.height();
+        float pageLogicalHeight = renderView->style()->isHorizontalWritingMode() ? pageSize.height() : pageSize.width();
+
+        LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth);
+        LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight);
+        renderView->setLogicalWidth(flooredPageLogicalWidth);
+        renderView->setPageLogicalHeight(flooredPageLogicalHeight);
+        renderView->setNeedsLayoutAndPrefWidthsRecalc();
+        forceLayout();
+
+        // If we don't fit in the given page width, we'll lay out again. If we don't fit in the
+        // page width when shrunk, we will lay out at maximum shrink and clip extra content.
+        // FIXME: We are assuming a shrink-to-fit printing implementation.  A cropping
+        // implementation should not do this!
+        bool horizontalWritingMode = renderView->style()->isHorizontalWritingMode();
+        const LayoutRect& documentRect = renderView->documentRect();
+        LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width() : documentRect.height();
+        if (docLogicalWidth > pageLogicalWidth) {
+            int expectedPageWidth = std::min<float>(documentRect.width(), pageSize.width() * maximumShrinkFactor);
+            int expectedPageHeight = std::min<float>(documentRect.height(), pageSize.height() * maximumShrinkFactor);
+            FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSize(originalPageSize.width(), originalPageSize.height()), FloatSize(expectedPageWidth, expectedPageHeight));
+            pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : maxPageSize.height();
+            pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : maxPageSize.width();
+
+            flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth);
+            flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight);
+            renderView->setLogicalWidth(flooredPageLogicalWidth);
+            renderView->setPageLogicalHeight(flooredPageLogicalHeight);
+            renderView->setNeedsLayoutAndPrefWidthsRecalc();
+            forceLayout();
+
+            const LayoutRect& updatedDocumentRect = renderView->documentRect();
+            LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumentRect.height() : updatedDocumentRect.width();
+            LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRect.y() : updatedDocumentRect.x();
+            LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocumentRect.maxX() : updatedDocumentRect.maxY();
+            LayoutUnit clippedLogicalLeft = 0;
+            if (!renderView->style()->isLeftToRightDirection())
+                clippedLogicalLeft = docLogicalRight - pageLogicalWidth;
+            LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWidth, docLogicalHeight);
+
+            if (!horizontalWritingMode)
+                overflow = overflow.transposedRect();
+            renderView->clearLayoutOverflow();
+            renderView->addLayoutOverflow(overflow); // This is how we clip in case we overflow again.
+        }
+    }
+
+    if (shouldAdjustViewSize)
+        adjustViewSize();
+}
+
+IntRect FrameView::convertFromRenderer(const RenderObject* renderer, const IntRect& rendererRect) const
+{
+    IntRect rect = pixelSnappedIntRect(enclosingLayoutRect(renderer->localToAbsoluteQuad(FloatRect(rendererRect)).boundingBox()));
+
+    // Convert from page ("absolute") to FrameView coordinates.
+    rect.moveBy(-scrollPosition());
+
+    return rect;
+}
+
+IntRect FrameView::convertToRenderer(const RenderObject* renderer, const IntRect& viewRect) const
+{
+    IntRect rect = viewRect;
+
+    // Convert from FrameView coords into page ("absolute") coordinates.
+    rect.moveBy(scrollPosition());
+
+    // FIXME: we don't have a way to map an absolute rect down to a local quad, so just
+    // move the rect for now.
+    rect.setLocation(roundedIntPoint(renderer->absoluteToLocal(rect.location(), UseTransforms)));
+    return rect;
+}
+
+IntPoint FrameView::convertFromRenderer(const RenderObject* renderer, const IntPoint& rendererPoint) const
+{
+    IntPoint point = roundedIntPoint(renderer->localToAbsolute(rendererPoint, UseTransforms));
+
+    // Convert from page ("absolute") to FrameView coordinates.
+    point.moveBy(-scrollPosition());
+    return point;
+}
+
+IntPoint FrameView::convertToRenderer(const RenderObject* renderer, const IntPoint& viewPoint) const
+{
+    IntPoint point = viewPoint;
+
+    // Convert from FrameView coords into page ("absolute") coordinates.
+    point += IntSize(scrollX(), scrollY());
+
+    return roundedIntPoint(renderer->absoluteToLocal(point, UseTransforms));
+}
+
+IntRect FrameView::convertToContainingView(const IntRect& localRect) const
+{
+    if (const ScrollView* parentScrollView = toScrollView(parent())) {
+        if (parentScrollView->isFrameView()) {
+            const FrameView* parentView = toFrameView(parentScrollView);
+            // Get our renderer in the parent view
+            RenderPart* renderer = m_frame->ownerRenderer();
+            if (!renderer)
+                return localRect;
+
+            IntRect rect(localRect);
+            // Add borders and padding??
+            rect.move(renderer->borderLeft() + renderer->paddingLeft(),
+                renderer->borderTop() + renderer->paddingTop());
+            return parentView->convertFromRenderer(renderer, rect);
+        }
+
+        return Widget::convertToContainingView(localRect);
+    }
+
+    return localRect;
+}
+
+IntRect FrameView::convertFromContainingView(const IntRect& parentRect) const
+{
+    if (const ScrollView* parentScrollView = toScrollView(parent())) {
+        if (parentScrollView->isFrameView()) {
+            const FrameView* parentView = toFrameView(parentScrollView);
+
+            // Get our renderer in the parent view
+            RenderPart* renderer = m_frame->ownerRenderer();
+            if (!renderer)
+                return parentRect;
+
+            IntRect rect = parentView->convertToRenderer(renderer, parentRect);
+            // Subtract borders and padding
+            rect.move(-renderer->borderLeft() - renderer->paddingLeft(),
+                      -renderer->borderTop() - renderer->paddingTop());
+            return rect;
+        }
+
+        return Widget::convertFromContainingView(parentRect);
+    }
+
+    return parentRect;
+}
+
+IntPoint FrameView::convertToContainingView(const IntPoint& localPoint) const
+{
+    if (const ScrollView* parentScrollView = toScrollView(parent())) {
+        if (parentScrollView->isFrameView()) {
+            const FrameView* parentView = toFrameView(parentScrollView);
+
+            // Get our renderer in the parent view
+            RenderPart* renderer = m_frame->ownerRenderer();
+            if (!renderer)
+                return localPoint;
+
+            IntPoint point(localPoint);
+
+            // Add borders and padding
+            point.move(renderer->borderLeft() + renderer->paddingLeft(),
+                       renderer->borderTop() + renderer->paddingTop());
+            return parentView->convertFromRenderer(renderer, point);
+        }
+
+        return Widget::convertToContainingView(localPoint);
+    }
+
+    return localPoint;
+}
+
+IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const
+{
+    if (const ScrollView* parentScrollView = toScrollView(parent())) {
+        if (parentScrollView->isFrameView()) {
+            const FrameView* parentView = toFrameView(parentScrollView);
+
+            // Get our renderer in the parent view
+            RenderPart* renderer = m_frame->ownerRenderer();
+            if (!renderer)
+                return parentPoint;
+
+            IntPoint point = parentView->convertToRenderer(renderer, parentPoint);
+            // Subtract borders and padding
+            point.move(-renderer->borderLeft() - renderer->paddingLeft(),
+                       -renderer->borderTop() - renderer->paddingTop());
+            return point;
+        }
+
+        return Widget::convertFromContainingView(parentPoint);
+    }
+
+    return parentPoint;
+}
+
+// Normal delay
+void FrameView::setRepaintThrottlingDeferredRepaintDelay(double p)
+{
+    s_normalDeferredRepaintDelay = p;
+}
+
+// Negative value would mean that first few repaints happen without a delay
+void FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p)
+{
+    s_initialDeferredRepaintDelayDuringLoading = p;
+}
+
+// The delay grows on each repaint to this maximum value
+void FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p)
+{
+    s_maxDeferredRepaintDelayDuringLoading = p;
+}
+
+// On each repaint the delay increases by this amount
+void FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p)
+{
+    s_deferredRepaintDelayIncrementDuringLoading = p;
+}
+
+void FrameView::setTracksRepaints(bool trackRepaints)
+{
+    if (trackRepaints == m_isTrackingRepaints)
+        return;
+
+    for (Frame* frame = m_frame->tree()->top(); frame; frame = frame->tree()->traverseNext()) {
+        if (RenderView* renderView = frame->contentRenderer())
+            renderView->compositor()->setTracksRepaints(trackRepaints);
+    }
+
+    resetTrackedRepaints();
+    m_isTrackingRepaints = trackRepaints;
+}
+
+void FrameView::resetTrackedRepaints()
+{
+    m_trackedRepaintRects.clear();
+    if (RenderView* renderView = this->renderView())
+        renderView->compositor()->resetTrackedRepaintRects();
+}
+
+String FrameView::trackedRepaintRectsAsText() const
+{
+    TextStream ts;
+    if (!m_trackedRepaintRects.isEmpty()) {
+        ts << "(repaint rects\n";
+        for (size_t i = 0; i < m_trackedRepaintRects.size(); ++i)
+            ts << "  (rect " << m_trackedRepaintRects[i].x() << " " << m_trackedRepaintRects[i].y() << " " << m_trackedRepaintRects[i].width() << " " << m_trackedRepaintRects[i].height() << ")\n";
+        ts << ")\n";
+    }
+    return ts.release();
+}
+
+void FrameView::addResizerArea(RenderBox* resizerBox)
+{
+    if (!m_resizerAreas)
+        m_resizerAreas = adoptPtr(new ResizerAreaSet);
+    m_resizerAreas->add(resizerBox);
+}
+
+void FrameView::removeResizerArea(RenderBox* resizerBox)
+{
+    if (!m_resizerAreas)
+        return;
+
+    ResizerAreaSet::iterator it = m_resizerAreas->find(resizerBox);
+    if (it != m_resizerAreas->end())
+        m_resizerAreas->remove(it);
+}
+
+bool FrameView::addScrollableArea(ScrollableArea* scrollableArea)
+{
+    if (!m_scrollableAreas)
+        m_scrollableAreas = adoptPtr(new ScrollableAreaSet);
+    return m_scrollableAreas->add(scrollableArea).isNewEntry;
+}
+
+bool FrameView::removeScrollableArea(ScrollableArea* scrollableArea)
+{
+    if (!m_scrollableAreas)
+        return false;
+
+    ScrollableAreaSet::iterator it = m_scrollableAreas->find(scrollableArea);
+    if (it == m_scrollableAreas->end())
+        return false;
+
+    m_scrollableAreas->remove(it);
+    return true;
+}
+
+bool FrameView::containsScrollableArea(const ScrollableArea* scrollableArea) const
+{
+    if (!m_scrollableAreas)
+        return false;
+    return m_scrollableAreas->contains(const_cast<ScrollableArea*>(scrollableArea));
+}
+
+void FrameView::removeChild(Widget* widget)
+{
+    if (widget->isFrameView())
+        removeScrollableArea(toFrameView(widget));
+
+    ScrollView::removeChild(widget);
+}
+
+bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
+{
+    // Note that to allow for rubber-band over-scroll behavior, even non-scrollable views
+    // should handle wheel events.
+#if !USE(RUBBER_BANDING)
+    if (!isScrollable())
+        return false;
+#endif
+
+    // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled.
+    if (!canHaveScrollbars())
+        return false;
+
+    return ScrollableArea::handleWheelEvent(wheelEvent);
+}
+
+bool FrameView::isVerticalDocument() const
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return true;
+
+    return renderView->style()->isHorizontalWritingMode();
+}
+
+bool FrameView::isFlippedDocument() const
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return false;
+
+    return renderView->style()->isFlippedBlocksWritingMode();
+}
+
+AXObjectCache* FrameView::axObjectCache() const
+{
+    if (frame().document())
+        return frame().document()->existingAXObjectCache();
+    return 0;
+}
+
+bool FrameView::isMainFrame() const
+{
+    return m_frame->page() && m_frame->page()->mainFrame() == m_frame;
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/FrameView.h b/Source/core/frame/FrameView.h
new file mode 100644
index 0000000..670ad89
--- /dev/null
+++ b/Source/core/frame/FrameView.h
@@ -0,0 +1,591 @@
+/*
+   Copyright (C) 1997 Martin Jones (mjones@kde.org)
+             (C) 1998 Waldo Bastian (bastian@kde.org)
+             (C) 1998, 1999 Torben Weis (weis@kde.org)
+             (C) 1999 Lars Knoll (knoll@kde.org)
+             (C) 1999 Antti Koivisto (koivisto@kde.org)
+   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 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
+   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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+*/
+
+#ifndef FrameView_h
+#define FrameView_h
+
+#include "core/frame/AdjustViewSizeOrNot.h"
+#include "core/platform/ScrollView.h"
+#include "core/platform/graphics/Color.h"
+#include "core/rendering/Pagination.h"
+#include "core/rendering/PaintPhase.h"
+#include "core/rendering/PartialLayoutState.h"
+#include "platform/geometry/LayoutRect.h"
+#include "wtf/Forward.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class Element;
+class FloatSize;
+class Frame;
+class KURL;
+class Node;
+class OverflowEvent;
+class Page;
+class RenderBox;
+class RenderEmbeddedObject;
+class RenderObject;
+class RenderScrollbarPart;
+class RenderStyle;
+
+Pagination::Mode paginationModeForRenderStyle(RenderStyle*);
+
+typedef unsigned long long DOMTimeStamp;
+
+class FrameView : public ScrollView {
+public:
+    friend class RenderView;
+    friend class Internals;
+
+    static PassRefPtr<FrameView> create(Frame*);
+    static PassRefPtr<FrameView> create(Frame*, const IntSize& initialSize);
+
+    virtual ~FrameView();
+
+    virtual HostWindow* hostWindow() const;
+
+    virtual void invalidateRect(const IntRect&);
+    virtual void setFrameRect(const IntRect&);
+
+    virtual bool scheduleAnimation();
+
+    Frame& frame() const { return *m_frame; }
+
+    RenderView* renderView() const;
+
+    int mapFromLayoutToCSSUnits(LayoutUnit) const;
+    LayoutUnit mapFromCSSToLayoutUnits(int) const;
+
+    LayoutUnit marginWidth() const { return m_margins.width(); } // -1 means default
+    LayoutUnit marginHeight() const { return m_margins.height(); } // -1 means default
+    void setMarginWidth(LayoutUnit);
+    void setMarginHeight(LayoutUnit);
+
+    virtual void setCanHaveScrollbars(bool);
+    void updateCanHaveScrollbars();
+
+    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
+
+    virtual void setContentsSize(const IntSize&);
+
+    void layout(bool allowSubtree = true);
+    bool didFirstLayout() const;
+    void layoutTimerFired(Timer<FrameView>*);
+    void scheduleRelayout();
+    void scheduleRelayoutOfSubtree(RenderObject*);
+    void unscheduleRelayout();
+    bool layoutPending() const;
+    bool isInLayout() const { return m_inLayout; }
+
+    RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
+    void clearLayoutRoot() { m_layoutRoot = 0; }
+    int layoutCount() const { return m_layoutCount; }
+
+    bool needsLayout() const;
+    void setNeedsLayout();
+    void setViewportConstrainedObjectsNeedLayout();
+
+    bool needsFullRepaint() const { return m_doFullRepaint; }
+
+    void serviceScriptedAnimations(double monotonicAnimationStartTime);
+
+    void updateCompositingLayersAfterStyleChange();
+    void updateCompositingLayersAfterLayout();
+
+    bool hasCompositedContent() const;
+    bool isEnclosedInCompositingLayer() const;
+
+    // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives
+    // a faithful representation of the content.
+    bool isSoftwareRenderable() const;
+
+    void resetScrollbars();
+    void prepareForDetach();
+    void detachCustomScrollbars();
+    virtual void recalculateScrollbarOverlayStyle();
+
+    void clear();
+
+    bool isTransparent() const;
+    void setTransparent(bool isTransparent);
+
+    // True if the FrameView is not transparent, and the base background color is opaque.
+    bool hasOpaqueBackground() const;
+
+    Color baseBackgroundColor() const;
+    void setBaseBackgroundColor(const Color&);
+    void updateBackgroundRecursively(const Color&, bool);
+
+    bool shouldUpdateWhileOffscreen() const;
+    void setShouldUpdateWhileOffscreen(bool);
+    bool shouldUpdate() const;
+
+    void adjustViewSize();
+
+    virtual IntRect windowClipRect(bool clipToContents = true) const;
+    IntRect windowClipRectForFrameOwner(const HTMLFrameOwnerElement*, bool clipToLayerContents) const;
+
+    virtual IntRect windowResizerRect() const;
+
+    virtual float visibleContentScaleFactor() const OVERRIDE { return m_visibleContentScaleFactor; }
+    void setVisibleContentScaleFactor(float);
+
+    virtual float inputEventsScaleFactor() const OVERRIDE;
+    void setInputEventsScaleFactorForEmulation(float);
+
+    virtual void setScrollPosition(const IntPoint&) OVERRIDE;
+    virtual void repaintFixedElementsAfterScrolling();
+    virtual void updateFixedElementsAfterScrolling();
+    virtual bool shouldRubberBandInDirection(ScrollDirection) const;
+    virtual bool requestScrollPositionUpdate(const IntPoint&) OVERRIDE;
+    virtual bool isRubberBandInProgress() const OVERRIDE;
+    void setScrollPositionNonProgrammatically(const IntPoint&);
+
+    // This is different than visibleContentRect() in that it ignores negative (or overly positive)
+    // offsets from rubber-banding, and it takes zooming into account.
+    LayoutRect viewportConstrainedVisibleContentRect() const;
+
+    AtomicString mediaType() const;
+    void setMediaType(const AtomicString&);
+    void adjustMediaTypeForPrinting(bool printing);
+
+    void setCannotBlitToWindow();
+    void setIsOverlapped(bool);
+    bool isOverlapped() const { return m_isOverlapped; }
+    bool isOverlappedIncludingAncestors() const;
+    void setContentIsOpaque(bool);
+
+    void addSlowRepaintObject();
+    void removeSlowRepaintObject();
+    bool hasSlowRepaintObjects() const { return m_slowRepaintObjectCount; }
+
+    // Includes fixed- and sticky-position objects.
+    typedef HashSet<RenderObject*> ViewportConstrainedObjectSet;
+    void addViewportConstrainedObject(RenderObject*);
+    void removeViewportConstrainedObject(RenderObject*);
+    const ViewportConstrainedObjectSet* viewportConstrainedObjects() const { return m_viewportConstrainedObjects.get(); }
+    bool hasViewportConstrainedObjects() const { return m_viewportConstrainedObjects && m_viewportConstrainedObjects->size() > 0; }
+
+    void handleLoadCompleted();
+    void resetDeferredRepaintDelay();
+
+    void updateAnnotatedRegions();
+    void updateControlTints();
+
+    void restoreScrollbar();
+
+    void suspendOverflowEvents();
+    void resumeOverflowEvents();
+    void scheduleOverflowEvent(PassRefPtr<OverflowEvent>);
+
+    void postLayoutTimerFired(Timer<FrameView>*);
+
+    bool wasScrolledByUser() const;
+    void setWasScrolledByUser(bool);
+
+    bool safeToPropagateScrollToParent() const { return m_safeToPropagateScrollToParent; }
+    void setSafeToPropagateScrollToParent(bool isSafe) { m_safeToPropagateScrollToParent = isSafe; }
+
+    void addWidgetToUpdate(RenderObject*);
+    void removeWidgetToUpdate(RenderObject*);
+
+    virtual void paintContents(GraphicsContext*, const IntRect& damageRect);
+    void setPaintBehavior(PaintBehavior);
+    PaintBehavior paintBehavior() const;
+    bool isPainting() const;
+    bool hasEverPainted() const { return m_lastPaintTime; }
+    void setLastPaintTime(double lastPaintTime) { m_lastPaintTime = lastPaintTime; }
+    void setNodeToDraw(Node*);
+
+    virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
+    virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
+    virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) OVERRIDE;
+
+    Color documentBackgroundColor() const;
+
+    static double currentFrameTimeStamp() { return s_currentFrameTimeStamp; }
+
+    void updateLayoutAndStyleIfNeededRecursive();
+
+    void incrementVisuallyNonEmptyCharacterCount(unsigned);
+    void incrementVisuallyNonEmptyPixelCount(const IntSize&);
+    void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; }
+    bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; }
+    void enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize);
+
+    void forceLayout(bool allowSubtree = false);
+    void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot);
+
+    bool scrollToFragment(const KURL&);
+    bool scrollToAnchor(const String&);
+    void maintainScrollPositionAtAnchor(Node*);
+    void scrollElementToRect(Element*, const IntRect&);
+
+    // Methods to convert points and rects between the coordinate space of the renderer, and this view.
+    virtual IntRect convertFromRenderer(const RenderObject*, const IntRect&) const;
+    virtual IntRect convertToRenderer(const RenderObject*, const IntRect&) const;
+    virtual IntPoint convertFromRenderer(const RenderObject*, const IntPoint&) const;
+    virtual IntPoint convertToRenderer(const RenderObject*, const IntPoint&) const;
+
+    bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
+
+    bool isScrollable();
+
+    enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
+    void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
+
+    // Normal delay
+    static void setRepaintThrottlingDeferredRepaintDelay(double);
+    // Negative value would mean that first few repaints happen without a delay
+    static void setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double);
+    // The delay grows on each repaint to this maximum value
+    static void setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double);
+    // On each repaint the delay increses by this amount
+    static void setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double);
+
+    virtual IntPoint lastKnownMousePosition() const;
+    bool shouldSetCursor() const;
+
+    virtual bool scrollbarsCanBeActive() const OVERRIDE;
+
+    // FIXME: Remove this method once plugin loading is decoupled from layout.
+    void flushAnyPendingPostLayoutTasks();
+
+    virtual bool shouldSuspendScrollAnimations() const;
+    virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
+
+    void setAnimatorsAreActive();
+
+    RenderBox* embeddedContentBox() const;
+
+    void setTracksRepaints(bool);
+    bool isTrackingRepaints() const { return m_isTrackingRepaints; }
+    void resetTrackedRepaints();
+    const Vector<IntRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }
+    String trackedRepaintRectsAsText() const;
+
+    typedef HashSet<ScrollableArea*> ScrollableAreaSet;
+    // Returns whether the scrollable area has just been newly added.
+    bool addScrollableArea(ScrollableArea*);
+    // Returns whether the scrollable area has just been removed.
+    bool removeScrollableArea(ScrollableArea*);
+    bool containsScrollableArea(const ScrollableArea*) const;
+    const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
+
+    // With CSS style "resize:" enabled, a little resizer handle will appear at the bottom
+    // right of the object. We keep track of these resizer areas for checking if touches
+    // (implemented using Scroll gesture) are targeting the resizer.
+    typedef HashSet<RenderBox*> ResizerAreaSet;
+    void addResizerArea(RenderBox*);
+    void removeResizerArea(RenderBox*);
+    const ResizerAreaSet* resizerAreas() const { return m_resizerAreas.get(); }
+
+    virtual void removeChild(Widget*) OVERRIDE;
+
+    // This function exists for ports that need to handle wheel events manually.
+    // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
+    // we need this function in order to do the scroll ourselves.
+    bool wheelEvent(const PlatformWheelEvent&);
+
+    // Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
+    // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
+    // FrameViews in the page cache, but FrameView::pagination() only affects the current
+    // FrameView. FrameView::pagination() will return m_pagination if it has been set. Otherwise,
+    // it will return Page::pagination() since currently there are no callers that need to
+    // distinguish between the two.
+    const Pagination& pagination() const;
+    void setPagination(const Pagination&);
+
+    bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
+    void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
+
+    void setHasSoftwareFilters(bool hasSoftwareFilters) { m_hasSoftwareFilters = hasSoftwareFilters; }
+    bool hasSoftwareFilters() const { return m_hasSoftwareFilters; }
+
+    virtual bool isActive() const OVERRIDE;
+
+    // DEPRECATED: Use viewportConstrainedVisibleContentRect() instead.
+    IntSize scrollOffsetForFixedPosition() const;
+
+    PartialLayoutState& partialLayout() { return m_partialLayout; }
+
+    class DeferredRepaintScope {
+    public:
+        DeferredRepaintScope(FrameView&);
+        ~DeferredRepaintScope();
+    private:
+        RefPtr<FrameView> m_view;
+    };
+
+protected:
+    virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
+    virtual void scrollContentsSlowPath(const IntRect& updateRect);
+
+    virtual bool isVerticalDocument() const;
+    virtual bool isFlippedDocument() const;
+
+private:
+    explicit FrameView(Frame*);
+
+    void beginDeferredRepaints();
+    void endDeferredRepaints();
+    void flushDeferredRepaints();
+    void startDeferredRepaintTimer(double delay);
+
+    void reset();
+    void init();
+
+    virtual bool isFrameView() const OVERRIDE { return true; }
+
+    friend class RenderWidget;
+    bool useSlowRepaints(bool considerOverlap = true) const;
+    bool useSlowRepaintsIfNotOverlapped() const;
+    void updateCanBlitOnScrollRecursively();
+    bool contentsInCompositedLayer() const;
+
+    void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode);
+    void applyPaginationToViewport();
+
+    void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
+
+    void paintControlTints();
+
+    void updateCounters();
+    void autoSizeIfEnabled();
+    void forceLayoutParentViewIfNeeded();
+    void performPreLayoutTasks();
+    void performLayout(RenderObject* rootForThisLayout, bool inSubtreeLayout);
+    void scheduleOrPerformPostLayoutTasks();
+    void performPostLayoutTasks();
+
+    virtual void repaintContentRectangle(const IntRect&);
+    virtual void contentsResized() OVERRIDE;
+    virtual void visibleContentsResized();
+
+    // Override ScrollView methods to do point conversion via renderers, in order to
+    // take transforms into account.
+    virtual IntRect convertToContainingView(const IntRect&) const OVERRIDE;
+    virtual IntRect convertFromContainingView(const IntRect&) const OVERRIDE;
+    virtual IntPoint convertToContainingView(const IntPoint&) const OVERRIDE;
+    virtual IntPoint convertFromContainingView(const IntPoint&) const OVERRIDE;
+
+    // ScrollableArea interface
+    virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE;
+    virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE;
+    virtual void scrollTo(const IntSize&) OVERRIDE;
+    virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE;
+    virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
+    virtual bool scrollAnimatorEnabled() const OVERRIDE;
+    virtual bool usesCompositedScrolling() const OVERRIDE;
+    virtual GraphicsLayer* layerForScrolling() const OVERRIDE;
+    virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE;
+    virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE;
+    virtual GraphicsLayer* layerForScrollCorner() const OVERRIDE;
+#if USE(RUBBER_BANDING)
+    virtual GraphicsLayer* layerForOverhangAreas() const OVERRIDE;
+#endif
+
+    void sendResizeEventIfNeeded();
+
+    void updateScrollableAreaSet();
+
+    virtual void notifyPageThatContentAreaWillPaint() const;
+
+    bool shouldUseLoadTimeDeferredRepaintDelay() const;
+    void deferredRepaintTimerFired(Timer<FrameView>*);
+    void doDeferredRepaints();
+    void updateDeferredRepaintDelayAfterRepaint();
+    double adjustedDeferredRepaintDelay() const;
+
+    bool updateWidgets();
+    void updateWidget(RenderObject*);
+    void scrollToAnchor();
+    void scrollPositionChanged();
+
+    bool hasCustomScrollbars() const;
+
+    virtual void updateScrollCorner();
+
+    FrameView* parentFrameView() const;
+
+    virtual AXObjectCache* axObjectCache() const;
+    void removeFromAXObjectCache();
+
+    bool isMainFrame() const;
+
+    static double s_currentFrameTimeStamp; // used for detecting decoded resource thrash in the cache
+    static bool s_inPaintContents;
+
+    LayoutSize m_size;
+    LayoutSize m_margins;
+
+    typedef HashSet<RenderObject*> RenderObjectSet;
+    OwnPtr<RenderObjectSet> m_widgetUpdateSet;
+    RefPtr<Frame> m_frame;
+
+    bool m_doFullRepaint;
+
+    bool m_canHaveScrollbars;
+    bool m_cannotBlitToWindow;
+    bool m_isOverlapped;
+    bool m_contentIsOpaque;
+    unsigned m_slowRepaintObjectCount;
+    int m_borderX;
+    int m_borderY;
+
+    Timer<FrameView> m_layoutTimer;
+    bool m_delayedLayout;
+    RenderObject* m_layoutRoot;
+
+    bool m_layoutSchedulingEnabled;
+    bool m_inLayout;
+    bool m_doingPreLayoutStyleUpdate;
+    bool m_inSynchronousPostLayout;
+    int m_layoutCount;
+    unsigned m_nestedLayoutCount;
+    Timer<FrameView> m_postLayoutTasksTimer;
+    bool m_firstLayoutCallbackPending;
+
+    bool m_firstLayout;
+    bool m_isTransparent;
+    Color m_baseBackgroundColor;
+    IntSize m_lastViewportSize;
+    float m_lastZoomFactor;
+
+    AtomicString m_mediaType;
+    AtomicString m_mediaTypeWhenNotPrinting;
+
+    unsigned m_overflowEventSuspendCount;
+    Vector<RefPtr<OverflowEvent> > m_overflowEventQueue;
+
+    bool m_overflowStatusDirty;
+    bool m_horizontalOverflow;
+    bool m_verticalOverflow;
+    RenderObject* m_viewportRenderer;
+
+    Pagination m_pagination;
+
+    bool m_wasScrolledByUser;
+    bool m_inProgrammaticScroll;
+    bool m_safeToPropagateScrollToParent;
+
+    unsigned m_deferringRepaints;
+    unsigned m_repaintCount;
+    Vector<LayoutRect> m_repaintRects;
+    Timer<FrameView> m_deferredRepaintTimer;
+    double m_deferredRepaintDelay;
+    double m_lastPaintTime;
+
+    bool m_isTrackingRepaints; // Used for testing.
+    Vector<IntRect> m_trackedRepaintRects;
+
+    bool m_shouldUpdateWhileOffscreen;
+
+    unsigned m_deferSetNeedsLayouts;
+    bool m_setNeedsLayoutWasDeferred;
+
+    RefPtr<Node> m_nodeToDraw;
+    PaintBehavior m_paintBehavior;
+    bool m_isPainting;
+
+    unsigned m_visuallyNonEmptyCharacterCount;
+    unsigned m_visuallyNonEmptyPixelCount;
+    bool m_isVisuallyNonEmpty;
+    bool m_firstVisuallyNonEmptyLayoutCallbackPending;
+
+    RefPtr<Node> m_maintainScrollPositionAnchor;
+
+    // Renderer to hold our custom scroll corner.
+    RenderScrollbarPart* m_scrollCorner;
+
+    // If true, automatically resize the frame view around its content.
+    bool m_shouldAutoSize;
+    bool m_inAutoSize;
+    // True if autosize has been run since m_shouldAutoSize was set.
+    bool m_didRunAutosize;
+    // The lower bound on the size when autosizing.
+    IntSize m_minAutoSize;
+    // The upper bound on the size when autosizing.
+    IntSize m_maxAutoSize;
+
+    OwnPtr<ScrollableAreaSet> m_scrollableAreas;
+    OwnPtr<ResizerAreaSet> m_resizerAreas;
+    OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
+
+    static double s_normalDeferredRepaintDelay;
+    static double s_initialDeferredRepaintDelayDuringLoading;
+    static double s_maxDeferredRepaintDelayDuringLoading;
+    static double s_deferredRepaintDelayIncrementDuringLoading;
+
+    bool m_hasSoftwareFilters;
+
+    float m_visibleContentScaleFactor;
+    float m_inputEventsScaleFactorForEmulation;
+
+    PartialLayoutState m_partialLayout;
+};
+
+inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
+{
+    if (m_isVisuallyNonEmpty)
+        return;
+    m_visuallyNonEmptyCharacterCount += count;
+    // Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout.
+    // The first few hundred characters rarely contain the interesting content of the page.
+    static const unsigned visualCharacterThreshold = 200;
+    if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold)
+        setIsVisuallyNonEmpty();
+}
+
+inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
+{
+    if (m_isVisuallyNonEmpty)
+        return;
+    m_visuallyNonEmptyPixelCount += size.width() * size.height();
+    // Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout
+    static const unsigned visualPixelThreshold = 32 * 32;
+    if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
+        setIsVisuallyNonEmpty();
+}
+
+inline FrameView* toFrameView(Widget* widget)
+{
+    ASSERT(!widget || widget->isFrameView());
+    return static_cast<FrameView*>(widget);
+}
+
+inline const FrameView* toFrameView(const Widget* widget)
+{
+    ASSERT(!widget || widget->isFrameView());
+    return static_cast<const FrameView*>(widget);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toFrameView(const FrameView*);
+
+} // namespace WebCore
+
+#endif // FrameView_h
diff --git a/Source/core/frame/History.cpp b/Source/core/frame/History.cpp
new file mode 100644
index 0000000..b9397c9
--- /dev/null
+++ b/Source/core/frame/History.cpp
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2007 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,
+ * 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/frame/History.h"
+
+#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/SerializedScriptValue.h"
+#include "core/dom/Document.h"
+#include "core/dom/ExceptionCode.h"
+#include "core/history/BackForwardController.h"
+#include "core/history/HistoryItem.h"
+#include "core/loader/DocumentLoader.h"
+#include "core/loader/FrameLoader.h"
+#include "core/loader/FrameLoaderClient.h"
+#include "core/frame/Frame.h"
+#include "core/page/Page.h"
+#include "weborigin/KURL.h"
+#include "weborigin/SecurityOrigin.h"
+#include "wtf/MainThread.h"
+
+namespace WebCore {
+
+History::History(Frame* frame)
+    : DOMWindowProperty(frame)
+    , m_lastStateObjectRequested(0)
+{
+    ScriptWrappable::init(this);
+}
+
+unsigned History::length() const
+{
+    if (!m_frame)
+        return 0;
+    if (!m_frame->page())
+        return 0;
+    return m_frame->page()->backForward().count();
+}
+
+SerializedScriptValue* History::state()
+{
+    m_lastStateObjectRequested = stateInternal();
+    return m_lastStateObjectRequested.get();
+}
+
+SerializedScriptValue* History::stateInternal() const
+{
+    if (!m_frame)
+        return 0;
+
+    if (HistoryItem* historyItem = m_frame->loader()->history()->currentItem())
+        return historyItem->stateObject();
+
+    return 0;
+}
+
+bool History::stateChanged() const
+{
+    return m_lastStateObjectRequested != stateInternal();
+}
+
+bool History::isSameAsCurrentState(SerializedScriptValue* state) const
+{
+    return state == stateInternal();
+}
+
+void History::back()
+{
+    go(-1);
+}
+
+void History::back(ExecutionContext* context)
+{
+    go(context, -1);
+}
+
+void History::forward()
+{
+    go(1);
+}
+
+void History::forward(ExecutionContext* context)
+{
+    go(context, 1);
+}
+
+void History::go(int distance)
+{
+    if (!m_frame)
+        return;
+
+    m_frame->navigationScheduler()->scheduleHistoryNavigation(distance);
+}
+
+void History::go(ExecutionContext* context, int distance)
+{
+    if (!m_frame)
+        return;
+
+    ASSERT(isMainThread());
+    Document* activeDocument = toDocument(context);
+    if (!activeDocument)
+        return;
+
+    if (!activeDocument->canNavigate(m_frame))
+        return;
+
+    m_frame->navigationScheduler()->scheduleHistoryNavigation(distance);
+}
+
+KURL History::urlForState(const String& urlString)
+{
+    Document* document = m_frame->document();
+
+    if (urlString.isNull())
+        return document->url();
+    if (urlString.isEmpty())
+        return document->baseURL();
+
+    return KURL(document->baseURL(), urlString);
+}
+
+void History::stateObjectAdded(PassRefPtr<SerializedScriptValue> data, const String& /* title */, const String& urlString, SameDocumentNavigationSource sameDocumentNavigationSource, ExceptionState& es)
+{
+    if (!m_frame || !m_frame->page())
+        return;
+
+    KURL fullURL = urlForState(urlString);
+    if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest(fullURL)) {
+        // We can safely expose the URL to JavaScript, as a) no redirection takes place: JavaScript already had this URL, b) JavaScript can only access a same-origin History object.
+        es.throwSecurityError("A history state object with URL '" + fullURL.elidedString() + "' cannot be created in a document with origin '" + m_frame->document()->securityOrigin()->toString() + "'.");
+        return;
+    }
+    m_frame->loader()->updateForSameDocumentNavigation(fullURL, sameDocumentNavigationSource, data, FrameLoader::DoNotUpdateBackForwardList);
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/History.h b/Source/core/frame/History.h
new file mode 100644
index 0000000..6a26abf
--- /dev/null
+++ b/Source/core/frame/History.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2007 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,
+ * 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 History_h
+#define History_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "bindings/v8/SerializedScriptValue.h"
+#include "core/loader/FrameLoaderTypes.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class Frame;
+class KURL;
+class ExecutionContext;
+class ExceptionState;
+
+class History : public ScriptWrappable, public RefCounted<History>, public DOMWindowProperty {
+public:
+    static PassRefPtr<History> create(Frame* frame) { return adoptRef(new History(frame)); }
+
+    unsigned length() const;
+    SerializedScriptValue* state();
+    void back();
+    void forward();
+    void go(int distance);
+
+    void back(ExecutionContext*);
+    void forward(ExecutionContext*);
+    void go(ExecutionContext*, int distance);
+
+    bool stateChanged() const;
+    bool isSameAsCurrentState(SerializedScriptValue*) const;
+
+    void stateObjectAdded(PassRefPtr<SerializedScriptValue>, const String& title, const String& url, SameDocumentNavigationSource, ExceptionState&);
+
+private:
+    explicit History(Frame*);
+
+    KURL urlForState(const String& url);
+
+    SerializedScriptValue* stateInternal() const;
+
+    RefPtr<SerializedScriptValue> m_lastStateObjectRequested;
+};
+
+} // namespace WebCore
+
+#endif // History_h
diff --git a/Source/core/frame/History.idl b/Source/core/frame/History.idl
new file mode 100644
index 0000000..9f76ce1
--- /dev/null
+++ b/Source/core/frame/History.idl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2007, 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 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,
+ * 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.
+ */
+
+interface History {
+    readonly attribute unsigned long length;
+    [CustomGetter] readonly attribute SerializedScriptValue state;
+
+    [CallWith=ExecutionContext] void back();
+    [CallWith=ExecutionContext] void forward();
+    [CallWith=ExecutionContext] void go([Default=Undefined] optional long distance);
+
+    [Custom, PerContextEnabled=pushState, RaisesException] void pushState(any data, DOMString title, optional DOMString url);
+    [Custom, PerContextEnabled=pushState, RaisesException] void replaceState(any data, DOMString title, optional DOMString url);
+};
diff --git a/Source/core/frame/ImageBitmap.cpp b/Source/core/frame/ImageBitmap.cpp
new file mode 100644
index 0000000..ba0e18f
--- /dev/null
+++ b/Source/core/frame/ImageBitmap.cpp
@@ -0,0 +1,200 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/frame/ImageBitmap.h"
+
+#include "core/html/HTMLCanvasElement.h"
+#include "core/html/HTMLImageElement.h"
+#include "core/html/HTMLVideoElement.h"
+#include "core/html/ImageData.h"
+#include "core/html/canvas/CanvasRenderingContext.h"
+#include "core/platform/graphics/BitmapImage.h"
+#include "core/platform/graphics/GraphicsContext.h"
+#include "core/platform/graphics/ImageBuffer.h"
+#include "wtf/RefPtr.h"
+
+using namespace std;
+
+namespace WebCore {
+
+static inline IntRect normalizeRect(const IntRect& rect)
+{
+    return IntRect(min(rect.x(), rect.maxX()),
+        min(rect.y(), rect.maxY()),
+        max(rect.width(), -rect.width()),
+        max(rect.height(), -rect.height()));
+}
+
+static inline PassRefPtr<Image> cropImage(Image* image, const IntRect& cropRect)
+{
+    IntRect intersectRect = intersection(IntRect(IntPoint(), image->size()), cropRect);
+    if (!intersectRect.width() || !intersectRect.height())
+        return 0;
+
+    SkBitmap cropped;
+    image->nativeImageForCurrentFrame()->bitmap().extractSubset(&cropped, intersectRect);
+    return BitmapImage::create(NativeImageSkia::create(cropped));
+}
+
+ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect)
+    : m_cropRect(cropRect)
+    , m_bitmap(0)
+    , m_imageElement(image)
+{
+    IntRect srcRect = intersection(cropRect, IntRect(0, 0, image->width(), image->height()));
+    m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())), srcRect.size());
+    m_bitmapOffset = srcRect.location();
+
+    if (!srcRect.width() || !srcRect.height())
+        m_imageElement = 0;
+    else
+        m_imageElement->addClient(this);
+
+    ScriptWrappable::init(this);
+}
+
+ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect)
+    : m_cropRect(cropRect)
+    , m_imageElement(0)
+    , m_bitmapOffset(IntPoint())
+{
+    IntRect videoRect = IntRect(IntPoint(), video->player()->naturalSize());
+    IntRect srcRect = intersection(cropRect, videoRect);
+    IntRect dstRect(IntPoint(), srcRect.size());
+
+    OwnPtr<ImageBuffer> buf = ImageBuffer::create(videoRect.size(), 1, UnacceleratedNonPlatformBuffer);
+    GraphicsContext* c = buf->context();
+    c->clip(dstRect);
+    c->translate(-srcRect.x(), -srcRect.y());
+    video->paintCurrentFrameInContext(c, videoRect);
+    m_bitmap = buf->copyImage(DontCopyBackingStore);
+    m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())), srcRect.size());
+
+    ScriptWrappable::init(this);
+}
+
+ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect)
+    : m_cropRect(cropRect)
+    , m_imageElement(0)
+    , m_bitmapOffset(IntPoint())
+{
+    CanvasRenderingContext* sourceContext = canvas->renderingContext();
+    if (sourceContext && sourceContext->is3d())
+        sourceContext->paintRenderingResultsToCanvas();
+
+    IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), canvas->size()));
+    m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())), srcRect.size());
+    m_bitmap = cropImage(canvas->buffer()->copyImage(CopyBackingStore).get(), cropRect);
+
+    ScriptWrappable::init(this);
+}
+
+ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect)
+    : m_cropRect(cropRect)
+    , m_imageElement(0)
+    , m_bitmapOffset(IntPoint())
+{
+    IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), data->size()));
+
+    OwnPtr<ImageBuffer> buf = ImageBuffer::create(data->size(), 1, UnacceleratedNonPlatformBuffer);
+    if (srcRect.width() > 0 && srcRect.height() > 0)
+        buf->putByteArray(Premultiplied, data->data(), data->size(), srcRect, IntPoint(min(0, -cropRect.x()), min(0, -cropRect.y())));
+
+    m_bitmap = buf->copyImage(DontCopyBackingStore);
+    m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())),  srcRect.size());
+
+    ScriptWrappable::init(this);
+}
+
+ImageBitmap::ImageBitmap(ImageBitmap* bitmap, const IntRect& cropRect)
+    : m_cropRect(cropRect)
+    , m_bitmap(0)
+    , m_imageElement(bitmap->imageElement())
+    , m_bitmapOffset(IntPoint())
+{
+    IntRect oldBitmapRect = bitmap->bitmapRect();
+    IntRect srcRect = intersection(cropRect, oldBitmapRect);
+    m_bitmapRect = IntRect(IntPoint(max(0, oldBitmapRect.x() - cropRect.x()), max(0, oldBitmapRect.y() - cropRect.y())), srcRect.size());
+
+    if (m_imageElement) {
+        m_imageElement->addClient(this);
+        m_bitmapOffset = srcRect.location();
+    } else if (bitmap->bitmapImage()) {
+        IntRect adjustedCropRect(IntPoint(cropRect.x() -oldBitmapRect.x(), cropRect.y() - oldBitmapRect.y()), cropRect.size());
+        m_bitmap = cropImage(bitmap->bitmapImage().get(), adjustedCropRect);
+    }
+
+    ScriptWrappable::init(this);
+}
+
+ImageBitmap::ImageBitmap(Image* image, const IntRect& cropRect)
+    : m_cropRect(cropRect)
+    , m_imageElement(0)
+{
+    IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), image->size()));
+    m_bitmap = cropImage(image, cropRect);
+    m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())),  srcRect.size());
+
+    ScriptWrappable::init(this);
+}
+
+ImageBitmap::~ImageBitmap()
+{
+    if (m_imageElement)
+        m_imageElement->removeClient(this);
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRect& cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    return adoptRef(new ImageBitmap(image, normalizedCropRect));
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video, const IntRect& cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    return adoptRef(new ImageBitmap(video, normalizedCropRect));
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canvas, const IntRect& cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    return adoptRef(new ImageBitmap(canvas, normalizedCropRect));
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(ImageData* data, const IntRect& cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    return adoptRef(new ImageBitmap(data, normalizedCropRect));
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(ImageBitmap* bitmap, const IntRect& cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    return adoptRef(new ImageBitmap(bitmap, normalizedCropRect));
+}
+
+PassRefPtr<ImageBitmap> ImageBitmap::create(Image* image, const IntRect& cropRect)
+{
+    IntRect normalizedCropRect = normalizeRect(cropRect);
+    return adoptRef(new ImageBitmap(image, normalizedCropRect));
+}
+
+void ImageBitmap::notifyImageSourceChanged()
+{
+    m_bitmap = cropImage(m_imageElement->cachedImage()->image(), m_cropRect);
+    m_bitmapOffset = IntPoint();
+    m_imageElement = 0;
+}
+
+PassRefPtr<Image> ImageBitmap::bitmapImage() const
+{
+    ASSERT((m_imageElement || m_bitmap || !m_bitmapRect.width() || !m_bitmapRect.height()) && (!m_imageElement || !m_bitmap));
+    if (m_imageElement)
+        return m_imageElement->cachedImage()->image();
+    return m_bitmap;
+}
+
+}
diff --git a/Source/core/frame/ImageBitmap.h b/Source/core/frame/ImageBitmap.h
new file mode 100644
index 0000000..31925ba
--- /dev/null
+++ b/Source/core/frame/ImageBitmap.h
@@ -0,0 +1,72 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ImageBitmap_h
+#define ImageBitmap_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/html/HTMLImageElement.h"
+#include "core/platform/graphics/Image.h"
+#include "platform/geometry/IntRect.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class HTMLCanvasElement;
+class HTMLVideoElement;
+class ImageData;
+
+class ImageBitmap : public RefCounted<ImageBitmap>, public ScriptWrappable, public ImageLoaderClient {
+
+public:
+    static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&);
+    static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, const IntRect&);
+    static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&);
+    static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&);
+    static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&);
+    static PassRefPtr<ImageBitmap> create(Image*, const IntRect&);
+
+    PassRefPtr<Image> bitmapImage() const;
+    PassRefPtr<HTMLImageElement> imageElement() const { return m_imageElement; }
+
+    IntRect bitmapRect() const { return m_bitmapRect; }
+    IntPoint bitmapOffset() const { return m_bitmapOffset; }
+
+    int width() const { return m_cropRect.width(); }
+    int height() const { return m_cropRect.height(); }
+    IntSize size() const { return m_cropRect.size(); }
+
+    virtual ~ImageBitmap();
+
+private:
+    ImageBitmap(HTMLImageElement*, const IntRect&);
+    ImageBitmap(HTMLVideoElement*, const IntRect&);
+    ImageBitmap(HTMLCanvasElement*, const IntRect&);
+    ImageBitmap(ImageData*, const IntRect&);
+    ImageBitmap(ImageBitmap*, const IntRect&);
+    ImageBitmap(Image*, const IntRect&);
+
+    // ImageLoaderClient
+    virtual void notifyImageSourceChanged();
+    virtual bool requestsHighLiveResourceCachePriority() { return true; }
+
+    // ImageBitmaps constructed from HTMLImageElements hold a reference to the HTMLImageElement until
+    // the image source changes.
+    RefPtr<HTMLImageElement> m_imageElement;
+    RefPtr<Image> m_bitmap;
+
+    IntRect m_bitmapRect; // The rect where the underlying Image should be placed in reference to the ImageBitmap.
+    IntRect m_cropRect;
+
+    // The offset by which the desired Image is stored internally.
+    // ImageBitmaps constructed from HTMLImageElements reference the entire ImageResource and may have a non-zero bitmap offset.
+    // ImageBitmaps not constructed from HTMLImageElements always pre-crop and store the image at (0, 0).
+    IntPoint m_bitmapOffset;
+
+};
+
+} // namespace WebCore
+
+#endif // ImageBitmap_h
diff --git a/Source/core/page/ImageBitmap.idl b/Source/core/frame/ImageBitmap.idl
similarity index 100%
rename from Source/core/page/ImageBitmap.idl
rename to Source/core/frame/ImageBitmap.idl
diff --git a/Source/core/frame/ImageBitmapTest.cpp b/Source/core/frame/ImageBitmapTest.cpp
new file mode 100644
index 0000000..7ae7774
--- /dev/null
+++ b/Source/core/frame/ImageBitmapTest.cpp
@@ -0,0 +1,209 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/frame/ImageBitmap.h"
+
+#include "SkPixelRef.h"
+#include "core/dom/Document.h"
+#include "core/fetch/ImageResource.h"
+#include "core/fetch/MemoryCache.h"
+#include "core/fetch/MockImageResourceClient.h"
+#include "core/fetch/ResourcePtr.h"
+#include "core/html/HTMLCanvasElement.h"
+#include "core/html/HTMLImageElement.h"
+#include "core/html/canvas/CanvasRenderingContext2D.h"
+#include "core/platform/graphics/BitmapImage.h"
+#include "core/platform/graphics/skia/NativeImageSkia.h"
+#include "core/platform/network/ResourceRequest.h"
+#include "wtf/OwnPtr.h"
+
+#include <gtest/gtest.h>
+
+namespace WebCore {
+
+class ImageBitmapTest : public ::testing::Test {
+protected:
+    virtual void SetUp()
+    {
+        m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
+        m_bitmap.allocPixels();
+        m_bitmap.eraseColor(0xFFFFFFFF);
+
+        m_bitmap2.setConfig(SkBitmap::kARGB_8888_Config, 5, 5);
+        m_bitmap2.allocPixels();
+        m_bitmap2.eraseColor(0xAAAAAAAA);
+
+        // Save the global memory cache to restore it upon teardown.
+        m_globalMemoryCache = adoptPtr(memoryCache());
+        // Create the test memory cache instance and hook it in.
+        m_testingMemoryCache = adoptPtr(new MemoryCache());
+        setMemoryCacheForTesting(m_testingMemoryCache.leakPtr());
+    }
+    virtual void TearDown()
+    {
+        // Regain the ownership of testing memory cache, so that it will be
+        // destroyed.
+        m_testingMemoryCache = adoptPtr(memoryCache());
+        // Yield the ownership of the global memory cache back.
+        setMemoryCacheForTesting(m_globalMemoryCache.leakPtr());
+    }
+
+    SkBitmap m_bitmap, m_bitmap2;
+    OwnPtr<MemoryCache> m_testingMemoryCache;
+    OwnPtr<MemoryCache> m_globalMemoryCache;
+};
+
+// Verifies that the image resource held by an ImageBitmap is the same as the
+// one held by the HTMLImageElement.
+TEST_F(ImageBitmapTest, ImageResourceConsistency)
+{
+    RefPtr<HTMLImageElement> imageElement = HTMLImageElement::create(*Document::create().get());
+    imageElement->setImageResource(new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get()));
+
+    RefPtr<ImageBitmap> imageBitmapNoCrop = ImageBitmap::create(imageElement.get(), IntRect(0, 0, m_bitmap.width(), m_bitmap.height()));
+    RefPtr<ImageBitmap> imageBitmapInteriorCrop = ImageBitmap::create(imageElement.get(), IntRect(m_bitmap.width() / 2, m_bitmap.height() / 2, m_bitmap.width() / 2, m_bitmap.height() / 2));
+    RefPtr<ImageBitmap> imageBitmapExteriorCrop = ImageBitmap::create(imageElement.get(), IntRect(-m_bitmap.width() / 2, -m_bitmap.height() / 2, m_bitmap.width(), m_bitmap.height()));
+    RefPtr<ImageBitmap> imageBitmapOutsideCrop = ImageBitmap::create(imageElement.get(), IntRect(-m_bitmap.width(), -m_bitmap.height(), m_bitmap.width(), m_bitmap.height()));
+
+    ASSERT_EQ(imageBitmapNoCrop->bitmapImage().get(), imageElement->cachedImage()->image());
+    ASSERT_EQ(imageBitmapInteriorCrop->bitmapImage().get(), imageElement->cachedImage()->image());
+    ASSERT_EQ(imageBitmapExteriorCrop->bitmapImage().get(), imageElement->cachedImage()->image());
+
+    RefPtr<Image> emptyImage = imageBitmapOutsideCrop->bitmapImage();
+    ASSERT_NE(emptyImage.get(), imageElement->cachedImage()->image());
+}
+
+// Verifies that HTMLImageElements are given an elevated CacheLiveResourcePriority when used to construct an ImageBitmap.
+// ImageBitmaps that have crop rects outside of the bounds of the HTMLImageElement do not have elevated CacheLiveResourcePriority.
+TEST_F(ImageBitmapTest, ImageBitmapLiveResourcePriority)
+{
+    RefPtr<HTMLImageElement> imageNoCrop = HTMLImageElement::create(*Document::create().get());
+    ResourcePtr<ImageResource> cachedImageNoCrop = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get());
+    imageNoCrop->setImageResource(cachedImageNoCrop.get());
+
+    RefPtr<HTMLImageElement> imageInteriorCrop = HTMLImageElement::create(*Document::create().get());
+    ResourcePtr<ImageResource> cachedImageInteriorCrop = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get());
+    imageInteriorCrop->setImageResource(cachedImageInteriorCrop.get());
+
+    RefPtr<HTMLImageElement> imageExteriorCrop = HTMLImageElement::create(*Document::create().get());
+    ResourcePtr<ImageResource> cachedImageExteriorCrop = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get());
+    imageExteriorCrop->setImageResource(cachedImageExteriorCrop.get());
+
+    RefPtr<HTMLImageElement> imageOutsideCrop = HTMLImageElement::create(*Document::create().get());
+    ResourcePtr<ImageResource> cachedImageOutsideCrop = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get());
+    imageOutsideCrop->setImageResource(cachedImageOutsideCrop.get());
+
+    MockImageResourceClient mockClient1, mockClient2, mockClient3, mockClient4;
+    cachedImageNoCrop->addClient(&mockClient1);
+    cachedImageInteriorCrop->addClient(&mockClient2);
+    cachedImageExteriorCrop->addClient(&mockClient3);
+    cachedImageOutsideCrop->addClient(&mockClient4);
+
+    memoryCache()->add(cachedImageNoCrop.get());
+    memoryCache()->add(cachedImageInteriorCrop.get());
+    memoryCache()->add(cachedImageExteriorCrop.get());
+    memoryCache()->add(cachedImageOutsideCrop.get());
+    memoryCache()->insertInLiveDecodedResourcesList(cachedImageNoCrop.get());
+    memoryCache()->insertInLiveDecodedResourcesList(cachedImageInteriorCrop.get());
+    memoryCache()->insertInLiveDecodedResourcesList(cachedImageExteriorCrop.get());
+    memoryCache()->insertInLiveDecodedResourcesList(cachedImageOutsideCrop.get());
+
+    // HTMLImageElements should default to CacheLiveResourcePriorityLow.
+    ASSERT_EQ(imageNoCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
+    ASSERT_EQ(imageInteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
+    ASSERT_EQ(imageExteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
+    ASSERT_EQ(imageOutsideCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
+
+    RefPtr<ImageBitmap> imageBitmapInteriorCrop = ImageBitmap::create(imageInteriorCrop.get(), IntRect(m_bitmap.width() / 2, m_bitmap.height() / 2, m_bitmap.width(), m_bitmap.height()));
+    {
+        RefPtr<ImageBitmap> imageBitmapNoCrop = ImageBitmap::create(imageNoCrop.get(), IntRect(0, 0, m_bitmap.width(), m_bitmap.height()));
+        RefPtr<ImageBitmap> imageBitmapInteriorCrop2 = ImageBitmap::create(imageInteriorCrop.get(), IntRect(m_bitmap.width() / 2, m_bitmap.height() / 2, m_bitmap.width(), m_bitmap.height()));
+        RefPtr<ImageBitmap> imageBitmapExteriorCrop = ImageBitmap::create(imageExteriorCrop.get(), IntRect(-m_bitmap.width() / 2, -m_bitmap.height() / 2, m_bitmap.width(), m_bitmap.height()));
+        RefPtr<ImageBitmap> imageBitmapOutsideCrop = ImageBitmap::create(imageOutsideCrop.get(), IntRect(-m_bitmap.width(), -m_bitmap.height(), m_bitmap.width(), m_bitmap.height()));
+
+        // Images that are referenced by ImageBitmaps have CacheLiveResourcePriorityHigh.
+        ASSERT_EQ(imageNoCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityHigh);
+        ASSERT_EQ(imageInteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityHigh);
+        ASSERT_EQ(imageExteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityHigh);
+
+        // ImageBitmaps that do not contain any of the source image do not elevate CacheLiveResourcePriority.
+        ASSERT_EQ(imageOutsideCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
+    }
+
+    // CacheLiveResourcePriroity should return to CacheLiveResourcePriorityLow when no ImageBitmaps reference the image.
+    ASSERT_EQ(imageNoCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
+    ASSERT_EQ(imageExteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
+    ASSERT_EQ(imageOutsideCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
+
+    // There is still an ImageBitmap that references this image.
+    ASSERT_EQ(imageInteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityHigh);
+}
+
+// Verifies that ImageBitmaps constructed from HTMLImageElements hold a reference to the original Image if the HTMLImageElement src is changed.
+TEST_F(ImageBitmapTest, ImageBitmapSourceChanged)
+{
+    RefPtr<HTMLImageElement> image = HTMLImageElement::create(*Document::create().get());
+    ResourcePtr<ImageResource> originalImageResource = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get());
+    image->setImageResource(originalImageResource.get());
+
+    RefPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get(), IntRect(0, 0, m_bitmap.width(), m_bitmap.height()));
+    ASSERT_EQ(imageBitmap->bitmapImage().get(), originalImageResource->image());
+
+    ResourcePtr<ImageResource> newImageResource = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap2)).get());
+    image->setImageResource(newImageResource.get());
+
+    // The ImageBitmap should contain the same data as the original cached image but should no longer hold a reference.
+    ASSERT_NE(imageBitmap->bitmapImage().get(), originalImageResource->image());
+    ASSERT_EQ(imageBitmap->bitmapImage()->nativeImageForCurrentFrame()->bitmap().pixelRef()->pixels(),
+        originalImageResource->image()->nativeImageForCurrentFrame()->bitmap().pixelRef()->pixels());
+
+    ASSERT_NE(imageBitmap->bitmapImage().get(), newImageResource->image());
+    ASSERT_NE(imageBitmap->bitmapImage()->nativeImageForCurrentFrame()->bitmap().pixelRef()->pixels(),
+        newImageResource->image()->nativeImageForCurrentFrame()->bitmap().pixelRef()->pixels());
+}
+
+// Verifies that ImageBitmaps constructed from ImageBitmaps hold onto their own Image.
+TEST_F(ImageBitmapTest, ImageResourceLifetime)
+{
+    RefPtr<HTMLCanvasElement> canvasElement = HTMLCanvasElement::create(*Document::create().get());
+    canvasElement->setHeight(40);
+    canvasElement->setWidth(40);
+    RefPtr<ImageBitmap> imageBitmapDerived;
+    {
+        RefPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::create(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->height()));
+        imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), IntRect(0, 0, 20, 20));
+    }
+    CanvasRenderingContext* context = canvasElement->getContext("2d");
+    TrackExceptionState es;
+    static_cast<CanvasRenderingContext2D*>(context)->drawImage(imageBitmapDerived.get(), 0, 0, es);
+}
+
+} // namespace
diff --git a/Source/core/frame/Location.cpp b/Source/core/frame/Location.cpp
new file mode 100644
index 0000000..77dfd44
--- /dev/null
+++ b/Source/core/frame/Location.cpp
@@ -0,0 +1,257 @@
+/*
+ * Copyright (C) 2008, 2010 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.
+ * 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.
+ *
+ * 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/frame/Location.h"
+
+#include "bindings/v8/ExceptionMessages.h"
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/DOMURLUtilsReadOnly.h"
+#include "core/dom/Document.h"
+#include "core/dom/ExceptionCode.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
+#include "core/loader/FrameLoader.h"
+#include "weborigin/KURL.h"
+#include "weborigin/SecurityOrigin.h"
+
+namespace WebCore {
+
+Location::Location(Frame* frame)
+    : DOMWindowProperty(frame)
+{
+    ScriptWrappable::init(this);
+}
+
+inline const KURL& Location::url() const
+{
+    ASSERT(m_frame);
+
+    const KURL& url = m_frame->document()->url();
+    if (!url.isValid())
+        return blankURL(); // Use "about:blank" while the page is still loading (before we have a frame).
+
+    return url;
+}
+
+String Location::href() const
+{
+    if (!m_frame)
+        return String();
+
+    return url().string();
+}
+
+String Location::protocol() const
+{
+    if (!m_frame)
+        return String();
+    return DOMURLUtilsReadOnly::protocol(url());
+}
+
+String Location::host() const
+{
+    if (!m_frame)
+        return String();
+    return DOMURLUtilsReadOnly::host(url());
+}
+
+String Location::hostname() const
+{
+    if (!m_frame)
+        return String();
+    return DOMURLUtilsReadOnly::hostname(url());
+}
+
+String Location::port() const
+{
+    if (!m_frame)
+        return String();
+    return DOMURLUtilsReadOnly::port(url());
+}
+
+String Location::pathname() const
+{
+    if (!m_frame)
+        return String();
+    return DOMURLUtilsReadOnly::pathname(url());
+}
+
+String Location::search() const
+{
+    if (!m_frame)
+        return String();
+    return DOMURLUtilsReadOnly::search(url());
+}
+
+String Location::origin() const
+{
+    if (!m_frame)
+        return String();
+    return DOMURLUtilsReadOnly::origin(url());
+}
+
+PassRefPtr<DOMStringList> Location::ancestorOrigins() const
+{
+    RefPtr<DOMStringList> origins = DOMStringList::create();
+    if (!m_frame)
+        return origins.release();
+    for (Frame* frame = m_frame->tree()->parent(); frame; frame = frame->tree()->parent())
+        origins->append(frame->document()->securityOrigin()->toString());
+    return origins.release();
+}
+
+String Location::hash() const
+{
+    if (!m_frame)
+        return String();
+
+    return DOMURLUtilsReadOnly::hash(url());
+}
+
+void Location::setHref(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& url)
+{
+    if (!m_frame)
+        return;
+    setLocation(url, activeWindow, firstWindow);
+}
+
+void Location::setProtocol(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& protocol, ExceptionState& es)
+{
+    if (!m_frame)
+        return;
+    KURL url = m_frame->document()->url();
+    if (!url.setProtocol(protocol)) {
+        es.throwDOMException(SyntaxError, ExceptionMessages::failedToSet("protocol", "Location", "'" + protocol + "' is an invalid protocol."));
+        return;
+    }
+    setLocation(url.string(), activeWindow, firstWindow);
+}
+
+void Location::setHost(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& host)
+{
+    if (!m_frame)
+        return;
+    KURL url = m_frame->document()->url();
+    url.setHostAndPort(host);
+    setLocation(url.string(), activeWindow, firstWindow);
+}
+
+void Location::setHostname(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& hostname)
+{
+    if (!m_frame)
+        return;
+    KURL url = m_frame->document()->url();
+    url.setHost(hostname);
+    setLocation(url.string(), activeWindow, firstWindow);
+}
+
+void Location::setPort(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& portString)
+{
+    if (!m_frame)
+        return;
+    KURL url = m_frame->document()->url();
+    int port = portString.toInt();
+    if (port < 0 || port > 0xFFFF || portString.isEmpty())
+        url.removePort();
+    else
+        url.setPort(port);
+    setLocation(url.string(), activeWindow, firstWindow);
+}
+
+void Location::setPathname(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& pathname)
+{
+    if (!m_frame)
+        return;
+    KURL url = m_frame->document()->url();
+    url.setPath(pathname);
+    setLocation(url.string(), activeWindow, firstWindow);
+}
+
+void Location::setSearch(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& search)
+{
+    if (!m_frame)
+        return;
+    KURL url = m_frame->document()->url();
+    url.setQuery(search);
+    setLocation(url.string(), activeWindow, firstWindow);
+}
+
+void Location::setHash(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& hash)
+{
+    if (!m_frame)
+        return;
+    KURL url = m_frame->document()->url();
+    String oldFragmentIdentifier = url.fragmentIdentifier();
+    String newFragmentIdentifier = hash;
+    if (hash[0] == '#')
+        newFragmentIdentifier = hash.substring(1);
+    url.setFragmentIdentifier(newFragmentIdentifier);
+    // Note that by parsing the URL and *then* comparing fragments, we are
+    // comparing fragments post-canonicalization, and so this handles the
+    // cases where fragment identifiers are ignored or invalid.
+    if (equalIgnoringNullity(oldFragmentIdentifier, url.fragmentIdentifier()))
+        return;
+    setLocation(url.string(), activeWindow, firstWindow);
+}
+
+void Location::assign(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& url)
+{
+    if (!m_frame)
+        return;
+    setLocation(url, activeWindow, firstWindow);
+}
+
+void Location::replace(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& url)
+{
+    if (!m_frame)
+        return;
+    // Note: We call DOMWindow::setLocation directly here because replace() always operates on the current frame.
+    m_frame->domWindow()->setLocation(url, activeWindow, firstWindow, LockHistoryAndBackForwardList);
+}
+
+void Location::reload(DOMWindow* activeWindow)
+{
+    if (!m_frame)
+        return;
+    if (protocolIsJavaScript(m_frame->document()->url()))
+        return;
+    m_frame->navigationScheduler()->scheduleRefresh();
+}
+
+void Location::setLocation(const String& url, DOMWindow* activeWindow, DOMWindow* firstWindow)
+{
+    ASSERT(m_frame);
+    // We call findFrameForNavigation to handle the case of a seamless iframe correctly.
+    Frame* frame = m_frame->loader()->findFrameForNavigation(String(), activeWindow->document());
+    if (!frame)
+        return;
+    frame->domWindow()->setLocation(url, activeWindow, firstWindow);
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/Location.h b/Source/core/frame/Location.h
new file mode 100644
index 0000000..50b4b23
--- /dev/null
+++ b/Source/core/frame/Location.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2008, 2010 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.
+ * 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.
+ *
+ * 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 Location_h
+#define Location_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/dom/DOMStringList.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class DOMWindow;
+class ExceptionState;
+class Frame;
+class KURL;
+
+class Location : public ScriptWrappable, public RefCounted<Location>, public DOMWindowProperty {
+public:
+    static PassRefPtr<Location> create(Frame* frame) { return adoptRef(new Location(frame)); }
+
+    void setHref(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
+    String href() const;
+
+    void assign(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
+    void replace(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
+    void reload(DOMWindow* activeWindow);
+
+    void setProtocol(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&, ExceptionState&);
+    String protocol() const;
+    void setHost(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
+    String host() const;
+    void setHostname(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
+    String hostname() const;
+    void setPort(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
+    String port() const;
+    void setPathname(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
+    String pathname() const;
+    void setSearch(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
+    String search() const;
+    void setHash(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
+    String hash() const;
+    String origin() const;
+
+    PassRefPtr<DOMStringList> ancestorOrigins() const;
+
+private:
+    explicit Location(Frame*);
+
+    void setLocation(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
+
+    const KURL& url() const;
+};
+
+} // namespace WebCore
+
+#endif // Location_h
diff --git a/Source/core/frame/Location.idl b/Source/core/frame/Location.idl
new file mode 100644
index 0000000..1d1c893
--- /dev/null
+++ b/Source/core/frame/Location.idl
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * 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.
+ *
+ * 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.
+ */
+
+[
+    CheckSecurity
+] interface Location {
+    [SetterCallWith=ActiveWindow&FirstWindow, DoNotCheckSecurityOnSetter, Unforgeable] attribute DOMString href;
+
+    [CallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity, Unforgeable, ReadOnly, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds] void assign([Default=Undefined] optional DOMString url);
+    [CallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity, Unforgeable, ReadOnly, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds] void replace([Default=Undefined] optional DOMString url);
+    [CallWith=ActiveWindow, Unforgeable, ReadOnly] void reload();
+
+    // URI decomposition attributes
+    [SetterCallWith=ActiveWindow&FirstWindow, SetterRaisesException] attribute DOMString protocol;
+    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString host;
+    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString hostname;
+    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString port;
+    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString pathname;
+    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString search;
+    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString hash;
+
+    readonly attribute DOMString origin;
+
+    readonly attribute DOMStringList ancestorOrigins;
+
+    [NotEnumerable, Unforgeable, ReadOnly, ImplementedAs=href] DOMString toString();
+    [NotEnumerable, Custom, Unforgeable, ReadOnly] any valueOf();
+};
+
diff --git a/Source/core/frame/Navigator.cpp b/Source/core/frame/Navigator.cpp
new file mode 100644
index 0000000..7d93cde
--- /dev/null
+++ b/Source/core/frame/Navigator.cpp
@@ -0,0 +1,163 @@
+/*
+ *  Copyright (C) 2000 Harri Porten (porten@kde.org)
+ *  Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
+ *  Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
+ *  Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ *  Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ *  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
+ */
+
+#include "config.h"
+#include "core/frame/Navigator.h"
+
+#include "bindings/v8/ScriptController.h"
+#include "core/dom/Document.h"
+#include "core/frame/NavigatorID.h"
+#include "core/loader/CookieJar.h"
+#include "core/loader/FrameLoader.h"
+#include "core/frame/Frame.h"
+#include "core/page/Page.h"
+#include "core/page/Settings.h"
+#include "core/plugins/DOMMimeTypeArray.h"
+#include "core/plugins/DOMPluginArray.h"
+#include "platform/Language.h"
+
+#ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
+#define WEBCORE_NAVIGATOR_PRODUCT_SUB "20030107"
+#endif // ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
+
+#ifndef WEBCORE_NAVIGATOR_VENDOR
+#define WEBCORE_NAVIGATOR_VENDOR "Google Inc."
+#endif // ifndef WEBCORE_NAVIGATOR_VENDOR
+
+#ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
+#define WEBCORE_NAVIGATOR_VENDOR_SUB ""
+#endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
+
+namespace WebCore {
+
+Navigator::Navigator(Frame* frame)
+    : DOMWindowProperty(frame)
+{
+    ScriptWrappable::init(this);
+}
+
+Navigator::~Navigator()
+{
+}
+
+// If this function returns true, we need to hide the substring "4." that would otherwise
+// appear in the appVersion string. This is to avoid problems with old versions of a
+// library called OpenCube QuickMenu, which as of this writing is still being used on
+// sites such as nwa.com -- the library thinks Safari is Netscape 4 if we don't do this!
+static bool shouldHideFourDot(Frame* frame)
+{
+    const String* sourceURL = frame->script()->sourceURL();
+    if (!sourceURL)
+        return false;
+    if (!(sourceURL->endsWith("/dqm_script.js") || sourceURL->endsWith("/dqm_loader.js") || sourceURL->endsWith("/tdqm_loader.js")))
+        return false;
+    Settings* settings = frame->settings();
+    if (!settings)
+        return false;
+    return settings->needsSiteSpecificQuirks();
+}
+
+String Navigator::appVersion() const
+{
+    if (!m_frame)
+        return String();
+    String appVersion = NavigatorID::appVersion(this);
+    if (shouldHideFourDot(m_frame))
+        appVersion.replace("4.", "4_");
+    return appVersion;
+}
+
+String Navigator::language() const
+{
+    return defaultLanguage();
+}
+
+String Navigator::productSub() const
+{
+    return WEBCORE_NAVIGATOR_PRODUCT_SUB;
+}
+
+String Navigator::vendor() const
+{
+    return WEBCORE_NAVIGATOR_VENDOR;
+}
+
+String Navigator::vendorSub() const
+{
+    return WEBCORE_NAVIGATOR_VENDOR_SUB;
+}
+
+String Navigator::userAgent() const
+{
+    if (!m_frame)
+        return String();
+
+    // If the frame is already detached, FrameLoader::userAgent may malfunction, because it calls a client method
+    // that uses frame's WebView (at least, in Mac WebKit).
+    if (!m_frame->page())
+        return String();
+
+    return m_frame->loader()->userAgent(m_frame->document()->url());
+}
+
+DOMPluginArray* Navigator::plugins() const
+{
+    if (!m_plugins)
+        m_plugins = DOMPluginArray::create(m_frame);
+    return m_plugins.get();
+}
+
+DOMMimeTypeArray* Navigator::mimeTypes() const
+{
+    if (!m_mimeTypes)
+        m_mimeTypes = DOMMimeTypeArray::create(m_frame);
+    return m_mimeTypes.get();
+}
+
+bool Navigator::cookieEnabled() const
+{
+    if (!m_frame)
+        return false;
+
+    if (m_frame->page() && !m_frame->page()->settings().cookieEnabled())
+        return false;
+
+    return cookiesEnabled(m_frame->document());
+}
+
+bool Navigator::javaEnabled() const
+{
+    if (!m_frame || !m_frame->settings())
+        return false;
+
+    if (!m_frame->settings()->isJavaEnabled())
+        return false;
+
+    return true;
+}
+
+void Navigator::getStorageUpdates()
+{
+    // FIXME: Remove this method or rename to yieldForStorageUpdates.
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/Navigator.h b/Source/core/frame/Navigator.h
new file mode 100644
index 0000000..0f289b3
--- /dev/null
+++ b/Source/core/frame/Navigator.h
@@ -0,0 +1,71 @@
+/*
+    Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef Navigator_h
+#define Navigator_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "core/frame/NavigatorBase.h"
+#include "platform/Supplementable.h"
+#include "wtf/Forward.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+class DOMMimeTypeArray;
+class DOMPluginArray;
+class Frame;
+class PluginData;
+
+typedef int ExceptionCode;
+
+class Navigator : public NavigatorBase, public ScriptWrappable, public RefCounted<Navigator>, public DOMWindowProperty, public Supplementable<Navigator> {
+public:
+    static PassRefPtr<Navigator> create(Frame* frame) { return adoptRef(new Navigator(frame)); }
+    virtual ~Navigator();
+
+    String appVersion() const;
+    String language() const;
+    DOMPluginArray* plugins() const;
+    DOMMimeTypeArray* mimeTypes() const;
+    bool cookieEnabled() const;
+    bool javaEnabled() const;
+
+    String productSub() const;
+    String vendor() const;
+    String vendorSub() const;
+
+    virtual String userAgent() const OVERRIDE;
+
+    // Relinquishes the storage lock, if one exists.
+    void getStorageUpdates();
+
+private:
+    explicit Navigator(Frame*);
+
+    mutable RefPtr<DOMPluginArray> m_plugins;
+    mutable RefPtr<DOMMimeTypeArray> m_mimeTypes;
+};
+
+}
+
+#endif
diff --git a/Source/core/page/Navigator.idl b/Source/core/frame/Navigator.idl
similarity index 100%
rename from Source/core/page/Navigator.idl
rename to Source/core/frame/Navigator.idl
diff --git a/Source/core/page/NavigatorBase.h b/Source/core/frame/NavigatorBase.h
similarity index 100%
rename from Source/core/page/NavigatorBase.h
rename to Source/core/frame/NavigatorBase.h
diff --git a/Source/core/frame/NavigatorID.cpp b/Source/core/frame/NavigatorID.cpp
new file mode 100644
index 0000000..1b771dd
--- /dev/null
+++ b/Source/core/frame/NavigatorID.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2013 Samsung Electronics. 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 "NavigatorID.h"
+
+#include "core/frame/NavigatorBase.h"
+
+#if !defined(WEBCORE_NAVIGATOR_PLATFORM) && OS(POSIX) && !OS(MACOSX)
+#include "wtf/StdLibExtras.h"
+#include <sys/utsname.h>
+#endif
+
+#ifndef WEBCORE_NAVIGATOR_PRODUCT
+#define WEBCORE_NAVIGATOR_PRODUCT "Gecko"
+#endif // ifndef WEBCORE_NAVIGATOR_PRODUCT
+
+namespace WebCore {
+
+String NavigatorID::appName(const NavigatorBase*)
+{
+    return "Netscape";
+}
+
+String NavigatorID::appVersion(const NavigatorBase* navigator)
+{
+    // Version is everything in the user agent string past the "Mozilla/" prefix.
+    const String& agent = navigator->userAgent();
+    return agent.substring(agent.find('/') + 1);
+}
+
+String NavigatorID::userAgent(const NavigatorBase* navigator)
+{
+    return navigator->userAgent();
+}
+
+String NavigatorID::platform(const NavigatorBase*)
+{
+#if defined(WEBCORE_NAVIGATOR_PLATFORM)
+    return WEBCORE_NAVIGATOR_PLATFORM;
+#elif OS(MACOSX)
+    // Match Safari and Mozilla on Mac x86.
+    return "MacIntel";
+#elif OS(WIN)
+    // Match Safari and Mozilla on Windows.
+    return "Win32";
+#else // Unix-like systems
+    struct utsname osname;
+    DEFINE_STATIC_LOCAL(String, platformName, (uname(&osname) >= 0 ? String(osname.sysname) + String(" ") + String(osname.machine) : emptyString()));
+    return platformName;
+#endif
+}
+
+String NavigatorID::appCodeName(const NavigatorBase*)
+{
+    return "Mozilla";
+}
+
+String NavigatorID::product(const NavigatorBase*)
+{
+    return WEBCORE_NAVIGATOR_PRODUCT;
+}
+
+} // namespace WebCore
diff --git a/Source/core/page/NavigatorID.h b/Source/core/frame/NavigatorID.h
similarity index 100%
rename from Source/core/page/NavigatorID.h
rename to Source/core/frame/NavigatorID.h
diff --git a/Source/core/page/NavigatorID.idl b/Source/core/frame/NavigatorID.idl
similarity index 100%
rename from Source/core/page/NavigatorID.idl
rename to Source/core/frame/NavigatorID.idl
diff --git a/Source/core/frame/NavigatorOnLine.h b/Source/core/frame/NavigatorOnLine.h
new file mode 100644
index 0000000..5ae204d
--- /dev/null
+++ b/Source/core/frame/NavigatorOnLine.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics. 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 NavigatorOnLine_h
+#define NavigatorOnLine_h
+
+#include "core/page/NetworkStateNotifier.h"
+
+namespace WebCore {
+
+class NavigatorOnLine {
+public:
+    static bool onLine(void*)
+    {
+        return networkStateNotifier().onLine();
+    }
+};
+
+}
+
+#endif // NavigatorOnLine_h
diff --git a/Source/core/page/NavigatorOnLine.idl b/Source/core/frame/NavigatorOnLine.idl
similarity index 100%
rename from Source/core/page/NavigatorOnLine.idl
rename to Source/core/frame/NavigatorOnLine.idl
diff --git a/Source/core/frame/Screen.cpp b/Source/core/frame/Screen.cpp
new file mode 100644
index 0000000..5ee73c2
--- /dev/null
+++ b/Source/core/frame/Screen.cpp
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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/frame/Screen.h"
+
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
+#include "core/page/Page.h"
+#include "core/page/Settings.h"
+#include "core/platform/PlatformScreen.h"
+#include "platform/geometry/FloatRect.h"
+
+namespace WebCore {
+
+Screen::Screen(Frame* frame)
+    : DOMWindowProperty(frame)
+{
+    ScriptWrappable::init(this);
+}
+
+unsigned Screen::height() const
+{
+    if (!m_frame)
+        return 0;
+    Page* page = m_frame->page();
+    if (page && page->settings().reportScreenSizeInPhysicalPixelsQuirk())
+        return lroundf(screenRect(m_frame->view()).height() * page->deviceScaleFactor());
+    return static_cast<unsigned>(screenRect(m_frame->view()).height());
+}
+
+unsigned Screen::width() const
+{
+    if (!m_frame)
+        return 0;
+    Page* page = m_frame->page();
+    if (page && page->settings().reportScreenSizeInPhysicalPixelsQuirk())
+        return lroundf(screenRect(m_frame->view()).width() * page->deviceScaleFactor());
+    return static_cast<unsigned>(screenRect(m_frame->view()).width());
+}
+
+unsigned Screen::colorDepth() const
+{
+    if (!m_frame)
+        return 0;
+    return static_cast<unsigned>(screenDepth(m_frame->view()));
+}
+
+unsigned Screen::pixelDepth() const
+{
+    if (!m_frame)
+        return 0;
+    return static_cast<unsigned>(screenDepth(m_frame->view()));
+}
+
+int Screen::availLeft() const
+{
+    if (!m_frame)
+        return 0;
+    Page* page = m_frame->page();
+    if (page && page->settings().reportScreenSizeInPhysicalPixelsQuirk())
+        return lroundf(screenAvailableRect(m_frame->view()).x() * page->deviceScaleFactor());
+    return static_cast<int>(screenAvailableRect(m_frame->view()).x());
+}
+
+int Screen::availTop() const
+{
+    if (!m_frame)
+        return 0;
+    Page* page = m_frame->page();
+    if (page && page->settings().reportScreenSizeInPhysicalPixelsQuirk())
+        return lroundf(screenAvailableRect(m_frame->view()).y() * page->deviceScaleFactor());
+    return static_cast<int>(screenAvailableRect(m_frame->view()).y());
+}
+
+unsigned Screen::availHeight() const
+{
+    if (!m_frame)
+        return 0;
+    Page* page = m_frame->page();
+    if (page && page->settings().reportScreenSizeInPhysicalPixelsQuirk())
+        return lroundf(screenAvailableRect(m_frame->view()).height() * page->deviceScaleFactor());
+    return static_cast<unsigned>(screenAvailableRect(m_frame->view()).height());
+}
+
+unsigned Screen::availWidth() const
+{
+    if (!m_frame)
+        return 0;
+    Page* page = m_frame->page();
+    if (page && page->settings().reportScreenSizeInPhysicalPixelsQuirk())
+        return lroundf(screenAvailableRect(m_frame->view()).width() * page->deviceScaleFactor());
+    return static_cast<unsigned>(screenAvailableRect(m_frame->view()).width());
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/Screen.h b/Source/core/frame/Screen.h
new file mode 100644
index 0000000..7b2036b
--- /dev/null
+++ b/Source/core/frame/Screen.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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 Screen_h
+#define Screen_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+    class Frame;
+
+    class Screen : public ScriptWrappable, public RefCounted<Screen>, public DOMWindowProperty {
+    public:
+        static PassRefPtr<Screen> create(Frame *frame) { return adoptRef(new Screen(frame)); }
+
+        unsigned height() const;
+        unsigned width() const;
+        unsigned colorDepth() const;
+        unsigned pixelDepth() const;
+        int availLeft() const;
+        int availTop() const;
+        unsigned availHeight() const;
+        unsigned availWidth() const;
+
+    private:
+        explicit Screen(Frame*);
+    };
+
+} // namespace WebCore
+
+#endif // Screen_h
diff --git a/Source/core/page/Screen.idl b/Source/core/frame/Screen.idl
similarity index 100%
rename from Source/core/page/Screen.idl
rename to Source/core/frame/Screen.idl
diff --git a/Source/core/page/SecurityPolicy.idl b/Source/core/frame/SecurityPolicy.idl
similarity index 100%
rename from Source/core/page/SecurityPolicy.idl
rename to Source/core/frame/SecurityPolicy.idl
diff --git a/Source/core/frame/SuspendableTimer.cpp b/Source/core/frame/SuspendableTimer.cpp
new file mode 100644
index 0000000..e3ffcf8
--- /dev/null
+++ b/Source/core/frame/SuspendableTimer.cpp
@@ -0,0 +1,81 @@
+/*
+ * 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 COMPUTER, 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/frame/SuspendableTimer.h"
+
+namespace WebCore {
+
+SuspendableTimer::SuspendableTimer(ExecutionContext* context)
+    : ActiveDOMObject(context)
+    , m_nextFireInterval(0)
+    , m_repeatInterval(0)
+    , m_active(false)
+#if !ASSERT_DISABLED
+    , m_suspended(false)
+#endif
+{
+}
+
+SuspendableTimer::~SuspendableTimer()
+{
+}
+
+bool SuspendableTimer::hasPendingActivity() const
+{
+    return isActive();
+}
+
+void SuspendableTimer::stop()
+{
+    TimerBase::stop();
+}
+
+void SuspendableTimer::suspend()
+{
+#if !ASSERT_DISABLED
+    ASSERT(!m_suspended);
+    m_suspended = true;
+#endif
+    m_active = isActive();
+    if (m_active) {
+        m_nextFireInterval = nextUnalignedFireInterval();
+        m_repeatInterval = repeatInterval();
+        TimerBase::stop();
+    }
+}
+
+void SuspendableTimer::resume()
+{
+#if !ASSERT_DISABLED
+    ASSERT(m_suspended);
+    m_suspended = false;
+#endif
+    if (m_active)
+        start(m_nextFireInterval, m_repeatInterval);
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/SuspendableTimer.h b/Source/core/frame/SuspendableTimer.h
new file mode 100644
index 0000000..3981ab7
--- /dev/null
+++ b/Source/core/frame/SuspendableTimer.h
@@ -0,0 +1,59 @@
+/*
+ * 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 COMPUTER, 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 SuspendableTimer_h
+#define SuspendableTimer_h
+
+#include "core/dom/ActiveDOMObject.h"
+#include "platform/Timer.h"
+
+namespace WebCore {
+
+class SuspendableTimer : public TimerBase, public ActiveDOMObject {
+public:
+    explicit SuspendableTimer(ExecutionContext*);
+    virtual ~SuspendableTimer();
+
+    // ActiveDOMObject
+    virtual bool hasPendingActivity() const;
+    virtual void stop();
+    virtual void suspend();
+    virtual void resume();
+
+private:
+    virtual void fired() = 0;
+
+    double m_nextFireInterval;
+    double m_repeatInterval;
+    bool m_active;
+#if !ASSERT_DISABLED
+    bool m_suspended;
+#endif
+};
+
+} // namespace WebCore
+
+#endif // SuspendableTimer_h
diff --git a/Source/core/page/WebKitPoint.idl b/Source/core/frame/WebKitPoint.idl
similarity index 100%
rename from Source/core/page/WebKitPoint.idl
rename to Source/core/frame/WebKitPoint.idl
diff --git a/Source/core/frame/Window.idl b/Source/core/frame/Window.idl
new file mode 100644
index 0000000..0d8a2e4
--- /dev/null
+++ b/Source/core/frame/Window.idl
@@ -0,0 +1,315 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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,
+ * 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.
+ */
+
+[
+    CheckSecurity,
+    CustomToV8,
+    DoNotGenerateWrap,
+    ImplementedAs=DOMWindow
+] interface Window : EventTarget {
+    // DOM Level 0
+    [Replaceable] readonly attribute Screen screen;
+    [Replaceable] readonly attribute History history;
+    [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, ActivityLogging=GetterForIsolatedWorlds] readonly attribute Navigator navigator;
+    [Replaceable] readonly attribute Navigator clientInformation;
+    [DoNotCheckSecurity, CustomSetter, Unforgeable, Replaceable, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds] readonly attribute Location location;
+    [Custom, MeasureAs=WindowEvent, NotEnumerable, Replaceable] readonly attribute Event event;
+
+    Selection getSelection();
+
+    [CheckSecurityForNode] readonly attribute Element frameElement;
+
+    [DoNotCheckSecurity, CallWith=ExecutionContext] void focus();
+    [DoNotCheckSecurity] void blur();
+    [DoNotCheckSecurity, CallWith=ExecutionContext] void close();
+
+    void print();
+    void stop();
+
+    [Custom] Window open(DOMString url,
+                            DOMString name,
+                            optional DOMString options);
+
+    [Custom] any showModalDialog(DOMString url,
+                                       optional any dialogArgs,
+                                       optional DOMString featureArgs);
+
+    void alert([Default=Undefined] optional DOMString message);
+    boolean confirm([Default=Undefined] optional DOMString message);
+    [TreatReturnedNullStringAs=Null] DOMString prompt([Default=Undefined] optional DOMString message,
+                                                [TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString defaultValue);
+
+    boolean find([Default=Undefined] optional DOMString string,
+                 [Default=Undefined] optional boolean caseSensitive,
+                 [Default=Undefined] optional boolean backwards,
+                 [Default=Undefined] optional boolean wrap,
+                 [Default=Undefined] optional boolean wholeWord,
+                 [Default=Undefined] optional boolean searchInFrames,
+                 [Default=Undefined] optional boolean showDialog);
+
+    [Replaceable] readonly attribute  boolean offscreenBuffering;
+
+    [Replaceable] readonly attribute long outerHeight;
+    [Replaceable] readonly attribute long outerWidth;
+    [Replaceable] readonly attribute long innerHeight;
+    [Replaceable] readonly attribute long innerWidth;
+    [Replaceable] readonly attribute long screenX;
+    [Replaceable] readonly attribute long screenY;
+    [Replaceable] readonly attribute long screenLeft;
+    [Replaceable] readonly attribute long screenTop;
+    [Replaceable] readonly attribute long scrollX;
+    [Replaceable] readonly attribute long scrollY;
+    readonly attribute long pageXOffset;
+    readonly attribute long pageYOffset;
+
+    void scrollBy([Default=Undefined] optional long x, [Default=Undefined] optional long y);
+    void scrollTo([Default=Undefined] optional long x, [Default=Undefined] optional long y);
+    void scroll([Default=Undefined] optional long x, [Default=Undefined] optional long y);
+    void moveBy([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats.
+    void moveTo([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats.
+    void resizeBy([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats.
+    void resizeTo([Default=Undefined] optional float width, [Default=Undefined] optional float height); // FIXME: this should take longs not floats.
+
+    [DoNotCheckSecurity] readonly attribute boolean closed;
+
+    [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute unsigned long length;
+
+    attribute DOMString name;
+
+    attribute DOMString status;
+    attribute DOMString defaultStatus;
+    // This attribute is an alias of defaultStatus and is necessary for legacy uses.
+    attribute DOMString defaultstatus;
+
+    // Self referential attributes
+    [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute Window self;
+    [DoNotCheckSecurity, Unforgeable] readonly attribute Window window;
+    [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute  Window frames;
+
+    [Replaceable, DoNotCheckSecurityOnGetter, CustomSetter] readonly attribute Window opener;
+    [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute Window parent;
+    [DoNotCheckSecurityOnGetter, Unforgeable] readonly attribute Window top;
+
+    // DOM Level 2 AbstractView Interface
+    readonly attribute Document document;
+
+    // CSSOM View Module
+    MediaQueryList matchMedia(DOMString query);
+
+    // styleMedia has been removed from the CSSOM View specification.
+    readonly attribute StyleMedia styleMedia;
+
+    // DOM Level 2 Style Interface
+    [PerWorldBindings] CSSStyleDeclaration getComputedStyle([Default=Undefined] optional Element element,
+                                                              [TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString pseudoElement);
+
+    // WebKit extensions
+    CSSRuleList getMatchedCSSRules([Default=Undefined] optional Element element,
+                                   [TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString pseudoElement);
+
+    [Replaceable] readonly attribute double devicePixelRatio;
+
+    WebKitPoint webkitConvertPointFromPageToNode([Default=Undefined] optional Node node,
+                                                 [Default=Undefined] optional WebKitPoint p);
+    WebKitPoint webkitConvertPointFromNodeToPage([Default=Undefined] optional Node node,
+                                                 [Default=Undefined] optional WebKitPoint p);
+
+    [RuntimeEnabled=ApplicationCache, PerWorldBindings, ActivityLogging=GetterForIsolatedWorlds] readonly attribute ApplicationCache applicationCache;
+
+    [RuntimeEnabled=SessionStorage, PerWorldBindings, ActivityLogging=GetterForIsolatedWorlds, GetterRaisesException] readonly attribute Storage sessionStorage;
+    [RuntimeEnabled=LocalStorage, PerWorldBindings, ActivityLogging=GetterForIsolatedWorlds, GetterRaisesException] readonly attribute Storage localStorage;
+
+    // This is the interface orientation in degrees. Some examples are:
+    //  0 is straight up; -90 is when the device is rotated 90 clockwise;
+    //  90 is when rotated counter clockwise.
+    [Conditional=ORIENTATION_EVENTS] readonly attribute long orientation;
+
+    [Replaceable] readonly attribute Console console;
+
+    // cross-document messaging
+    [DoNotCheckSecurity, Custom, RaisesException] void postMessage(SerializedScriptValue message, DOMString targetOrigin, optional Array messagePorts);
+
+    [Replaceable] readonly attribute Performance performance;
+
+    [MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(RequestAnimationFrameCallback callback);
+    void cancelAnimationFrame(long id);
+    [MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(RequestAnimationFrameCallback callback);
+    [ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id);
+    [ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove this when removing vendor prefix.
+
+    [Replaceable] readonly attribute CSS CSS;
+
+    // Events
+    attribute EventHandler onabort;
+    attribute EventHandler onbeforeunload;
+    attribute EventHandler onblur;
+    attribute EventHandler oncanplay;
+    attribute EventHandler oncanplaythrough;
+    attribute EventHandler onchange;
+    [ActivityLogging=Setter] attribute EventHandler onclick;
+    attribute EventHandler oncontextmenu;
+    [ActivityLogging=Setter] attribute EventHandler ondblclick;
+    [ActivityLogging=Setter] attribute EventHandler ondrag;
+    [ActivityLogging=Setter] attribute EventHandler ondragend;
+    [ActivityLogging=Setter] attribute EventHandler ondragenter;
+    [ActivityLogging=Setter] attribute EventHandler ondragleave;
+    [ActivityLogging=Setter] attribute EventHandler ondragover;
+    [ActivityLogging=Setter] attribute EventHandler ondragstart;
+    [ActivityLogging=Setter] attribute EventHandler ondrop;
+    attribute EventHandler ondurationchange;
+    attribute EventHandler onemptied;
+    attribute EventHandler onended;
+    attribute EventHandler onerror;
+    attribute EventHandler onfocus;
+    attribute EventHandler onhashchange;
+    [ActivityLogging=Setter] attribute EventHandler oninput;
+    attribute EventHandler oninvalid;
+    [ActivityLogging=Setter] attribute EventHandler onkeydown;
+    [ActivityLogging=Setter] attribute EventHandler onkeypress;
+    [ActivityLogging=Setter] attribute EventHandler onkeyup;
+    attribute EventHandler onload;
+    attribute EventHandler onloadeddata;
+    attribute EventHandler onloadedmetadata;
+    attribute EventHandler onloadstart;
+    attribute EventHandler onmessage;
+    [ActivityLogging=Setter] attribute EventHandler onmousedown;
+    [ActivityLogging=Setter] attribute EventHandler onmouseenter;
+    [ActivityLogging=Setter] attribute EventHandler onmouseleave;
+    [ActivityLogging=Setter] attribute EventHandler onmousemove;
+    [ActivityLogging=Setter] attribute EventHandler onmouseout;
+    [ActivityLogging=Setter] attribute EventHandler onmouseover;
+    [ActivityLogging=Setter] attribute EventHandler onmouseup;
+    [ActivityLogging=Setter] attribute EventHandler onmousewheel; // Deprecated in favor of onwheel.
+    [ActivityLogging=Setter] attribute EventHandler onwheel;
+    attribute EventHandler onoffline;
+    attribute EventHandler ononline;
+    attribute EventHandler onpagehide;
+    attribute EventHandler onpageshow;
+    attribute EventHandler onpause;
+    attribute EventHandler onplay;
+    attribute EventHandler onplaying;
+    attribute EventHandler onpopstate;
+    attribute EventHandler onprogress;
+    attribute EventHandler onratechange;
+    attribute EventHandler onresize;
+    attribute EventHandler onscroll;
+    attribute EventHandler onseeked;
+    attribute EventHandler onseeking;
+    attribute EventHandler onselect;
+    attribute EventHandler onstalled;
+    attribute EventHandler onstorage;
+    attribute EventHandler onsubmit;
+    attribute EventHandler onsuspend;
+    attribute EventHandler ontimeupdate;
+    attribute EventHandler onunload;
+    attribute EventHandler onvolumechange;
+    attribute EventHandler onwaiting;
+
+    // Not implemented yet.
+    // attribute EventHandler onafterprint;
+    // attribute EventHandler onbeforeprint;
+    // attribute EventHandler onreadystatechange;
+    // attribute EventHandler onredo;
+    // attribute EventHandler onshow;
+    // attribute EventHandler onundo;
+
+    // Webkit extensions
+    attribute EventHandler onreset;
+    attribute EventHandler onsearch;
+    [RuntimeEnabled=CSSAnimationUnprefixed] attribute EventHandler onanimationend;
+    [RuntimeEnabled=CSSAnimationUnprefixed] attribute EventHandler onanimationiteration;
+    [RuntimeEnabled=CSSAnimationUnprefixed] attribute EventHandler onanimationstart;
+    attribute EventHandler onwebkitanimationend;
+    attribute EventHandler onwebkitanimationiteration;
+    attribute EventHandler onwebkitanimationstart;
+    attribute EventHandler onwebkittransitionend;
+    attribute EventHandler ontransitionend;
+    [Conditional=ORIENTATION_EVENTS] attribute EventHandler onorientationchange;
+    [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
+    [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
+    [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
+    [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
+
+    [RuntimeEnabled=DeviceMotion] attribute EventHandler ondevicemotion;
+    [RuntimeEnabled=DeviceOrientation] attribute EventHandler ondeviceorientation;
+
+    [DeprecateAs=CaptureEvents] void captureEvents();
+    [DeprecateAs=ReleaseEvents] void releaseEvents();
+
+    // Additional constructors.
+    attribute TransitionEventConstructor WebKitTransitionEvent;
+    [RuntimeEnabled=CSSAnimationUnprefixed] attribute WebKitAnimationEventConstructor AnimationEvent;
+    [CustomConstructor] attribute HTMLImageElementConstructorConstructor Image; // Usable with new operator
+    // Mozilla has a separate XMLDocument object for XML documents.
+    // We just use Document for this.
+    attribute DocumentConstructor XMLDocument;
+    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;
+    attribute IDBFactoryConstructor webkitIDBFactory;
+    attribute IDBIndexConstructor webkitIDBIndex;
+    attribute IDBKeyRangeConstructor webkitIDBKeyRange;
+    attribute IDBObjectStoreConstructor webkitIDBObjectStore;
+    attribute IDBRequestConstructor webkitIDBRequest;
+    attribute IDBTransactionConstructor webkitIDBTransaction;
+
+    // Constructors whose name does not match the interface name.
+    // FIXME: Remove these once [ImplementedAs] is used and once constructor names match interface names.
+    [RuntimeEnabled=MediaStream] attribute MediaStreamConstructor webkitMediaStream;
+    [Conditional=WEB_AUDIO, RuntimeEnabled=WebAudio] attribute AudioContextConstructor webkitAudioContext;
+    [Conditional=WEB_AUDIO, RuntimeEnabled=WebAudio] attribute OfflineAudioContextConstructor webkitOfflineAudioContext;
+    [RuntimeEnabled=PeerConnection] attribute RTCPeerConnectionConstructor webkitRTCPeerConnection;
+    [RuntimeEnabled=ScriptedSpeech] attribute SpeechGrammarConstructor webkitSpeechGrammar;
+    [RuntimeEnabled=ScriptedSpeech] attribute SpeechGrammarListConstructor webkitSpeechGrammarList;
+    [RuntimeEnabled=ScriptedSpeech] attribute SpeechRecognitionConstructor webkitSpeechRecognition;
+    [RuntimeEnabled=ScriptedSpeech] attribute SpeechRecognitionErrorConstructor webkitSpeechRecognitionError;
+    [RuntimeEnabled=ScriptedSpeech] attribute SpeechRecognitionEventConstructor webkitSpeechRecognitionEvent;
+    [Conditional=WEB_AUDIO] attribute PannerNodeConstructor webkitAudioPannerNode;
+
+    // Prefixed ShadowRoot constructor should be phased out eventually, but for the moment it must be always exposed.
+    // Unprefixed ShadowRoot constructor should be visible when the feature flag is enabled.
+    // FIXME: When it's ready to remove WebKitShadowRoot, get rid of both constructors from Window.idl and remove
+    // [NoInterfaceObject] from ShadowRoot interface definition.
+    [RuntimeEnabled=ShadowDOM] attribute ShadowRootConstructor ShadowRoot;
+    [MeasureAs=PrefixedShadowRootConstructor] attribute ShadowRootConstructor WebKitShadowRoot;
+
+    // window.toString() requires special handling in V8
+    [DoNotCheckSignature, DoNotCheckSecurity, Custom, NotEnumerable] DOMString toString();
+
+    [ImplementedAs=anonymousIndexedGetter, NotEnumerable] getter Window(unsigned long index);
+    [Custom, NotEnumerable] getter Window (DOMString name);
+};
+
+Window implements ImageBitmapFactories;
+Window implements WindowTimers;
+Window implements WindowBase64;
diff --git a/Source/core/page/WindowBase64.idl b/Source/core/frame/WindowBase64.idl
similarity index 100%
rename from Source/core/page/WindowBase64.idl
rename to Source/core/frame/WindowBase64.idl
diff --git a/Source/core/page/WindowTimers.idl b/Source/core/frame/WindowTimers.idl
similarity index 100%
rename from Source/core/page/WindowTimers.idl
rename to Source/core/frame/WindowTimers.idl
diff --git a/Source/core/frame/animation/AnimationBase.cpp b/Source/core/frame/animation/AnimationBase.cpp
new file mode 100644
index 0000000..4e3356c
--- /dev/null
+++ b/Source/core/frame/animation/AnimationBase.cpp
@@ -0,0 +1,586 @@
+/*
+ * Copyright (C) 2007, 2008, 2009 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.
+ * 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.
+ *
+ * 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/frame/animation/AnimationBase.h"
+
+#include "core/frame/animation/AnimationControllerPrivate.h"
+#include "core/frame/animation/CompositeAnimation.h"
+#include "core/platform/animation/AnimationUtilities.h"
+#include "core/platform/animation/TimingFunction.h"
+#include "core/rendering/RenderBox.h"
+#include <algorithm>
+
+using namespace std;
+
+namespace WebCore {
+
+AnimationBase::AnimationBase(const CSSAnimationData* transition, RenderObject* renderer, CompositeAnimation* compAnim)
+    : m_animState(AnimationStateNew)
+    , m_isAccelerated(false)
+    , m_transformFunctionListValid(false)
+    , m_filterFunctionListsMatch(false)
+    , m_startTime(0)
+    , m_pauseTime(-1)
+    , m_requestedStartTime(0)
+    , m_totalDuration(-1)
+    , m_nextIterationDuration(-1)
+    , m_object(renderer)
+    , m_animation(const_cast<CSSAnimationData*>(transition))
+    , m_compAnim(compAnim)
+{
+    // Compute the total duration
+    if (m_animation->iterationCount() > 0)
+        m_totalDuration = m_animation->duration() * m_animation->iterationCount();
+}
+
+void AnimationBase::setNeedsStyleRecalc(Node* node)
+{
+    if (node)
+        node->setNeedsStyleRecalc(LocalStyleChange);
+}
+
+double AnimationBase::duration() const
+{
+    return m_animation->duration();
+}
+
+bool AnimationBase::playStatePlaying() const
+{
+    return m_animation->playState() == AnimPlayStatePlaying;
+}
+
+void AnimationBase::updateStateMachine(AnimStateInput input, double param)
+{
+    if (!m_compAnim)
+        return;
+
+    // If we get AnimationStateInputRestartAnimation then we force a new animation, regardless of state.
+    if (input == AnimationStateInputMakeNew) {
+        if (m_animState == AnimationStateStartWaitStyleAvailable)
+            m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
+        m_animState = AnimationStateNew;
+        m_startTime = 0;
+        m_pauseTime = -1;
+        m_requestedStartTime = 0;
+        m_nextIterationDuration = -1;
+        endAnimation();
+        return;
+    }
+
+    if (input == AnimationStateInputRestartAnimation) {
+        if (m_animState == AnimationStateStartWaitStyleAvailable)
+            m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
+        m_animState = AnimationStateNew;
+        m_startTime = 0;
+        m_pauseTime = -1;
+        m_requestedStartTime = 0;
+        m_nextIterationDuration = -1;
+        endAnimation();
+
+        if (!paused())
+            updateStateMachine(AnimationStateInputStartAnimation, -1);
+        return;
+    }
+
+    if (input == AnimationStateInputEndAnimation) {
+        if (m_animState == AnimationStateStartWaitStyleAvailable)
+            m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
+        m_animState = AnimationStateDone;
+        endAnimation();
+        return;
+    }
+
+    if (input == AnimationStateInputPauseOverride) {
+        if (m_animState == AnimationStateStartWaitResponse) {
+            // If we are in AnimationStateStartWaitResponse, the animation will get canceled before
+            // we get a response, so move to the next state.
+            endAnimation();
+            updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
+        }
+        return;
+    }
+
+    if (input == AnimationStateInputResumeOverride) {
+        if (m_animState == AnimationStateLooping || m_animState == AnimationStateEnding) {
+            // Start the animation
+            startAnimation(beginAnimationUpdateTime() - m_startTime);
+        }
+        return;
+    }
+
+    // Execute state machine
+    switch (m_animState) {
+        case AnimationStateNew:
+            ASSERT(input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning || input == AnimationStateInputPlayStatePaused);
+            if (input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning) {
+                m_requestedStartTime = beginAnimationUpdateTime();
+                m_animState = AnimationStateStartWaitTimer;
+            }
+            break;
+        case AnimationStateStartWaitTimer:
+            ASSERT(input == AnimationStateInputStartTimerFired || input == AnimationStateInputPlayStatePaused);
+
+            if (input == AnimationStateInputStartTimerFired) {
+                ASSERT(param >= 0);
+                // Start timer has fired, tell the animation to start and wait for it to respond with start time
+                m_animState = AnimationStateStartWaitStyleAvailable;
+                m_compAnim->animationController()->addToAnimationsWaitingForStyle(this);
+
+                // Trigger a render so we can start the animation
+                if (m_object)
+                    m_compAnim->animationController()->addNodeChangeToDispatch(m_object->node());
+            } else {
+                ASSERT(!paused());
+                // We're waiting for the start timer to fire and we got a pause. Cancel the timer, pause and wait
+                m_pauseTime = beginAnimationUpdateTime();
+                m_animState = AnimationStatePausedWaitTimer;
+            }
+            break;
+        case AnimationStateStartWaitStyleAvailable:
+            ASSERT(input == AnimationStateInputStyleAvailable || input == AnimationStateInputPlayStatePaused);
+
+            if (input == AnimationStateInputStyleAvailable) {
+                // Start timer has fired, tell the animation to start and wait for it to respond with start time
+                m_animState = AnimationStateStartWaitResponse;
+
+                overrideAnimations();
+
+                // Start the animation
+                if (overridden()) {
+                    m_animState = AnimationStateStartWaitResponse;
+                    updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
+                } else {
+                    double timeOffset = 0;
+                    // If the value for 'animation-delay' is negative then the animation appears to have started in the past.
+                    if (m_animation->delay() < 0)
+                        timeOffset = -m_animation->delay();
+                    startAnimation(timeOffset);
+                    m_compAnim->animationController()->addToAnimationsWaitingForStartTimeResponse(this, isAccelerated());
+                }
+            } else {
+                // We're waiting for the style to be available and we got a pause. Pause and wait
+                m_pauseTime = beginAnimationUpdateTime();
+                m_animState = AnimationStatePausedWaitStyleAvailable;
+            }
+            break;
+        case AnimationStateStartWaitResponse:
+            ASSERT(input == AnimationStateInputStartTimeSet || input == AnimationStateInputPlayStatePaused);
+
+            if (input == AnimationStateInputStartTimeSet) {
+                ASSERT(param >= 0);
+                // We have a start time, set it, unless the startTime is already set
+                if (m_startTime <= 0) {
+                    m_startTime = param;
+                    // If the value for 'animation-delay' is negative then the animation appears to have started in the past.
+                    if (m_animation->delay() < 0)
+                        m_startTime += m_animation->delay();
+                }
+
+                // Now that we know the start time, fire the start event.
+                onAnimationStart(0); // The elapsedTime is 0.
+
+                // Decide whether to go into looping or ending state
+                goIntoEndingOrLoopingState();
+
+                // Dispatch updateStyleIfNeeded so we can start the animation
+                if (m_object)
+                    m_compAnim->animationController()->addNodeChangeToDispatch(m_object->node());
+            } else {
+                // We are pausing while waiting for a start response. Cancel the animation and wait. When
+                // we unpause, we will act as though the start timer just fired
+                m_pauseTime = beginAnimationUpdateTime();
+                pauseAnimation(beginAnimationUpdateTime() - m_startTime);
+                m_animState = AnimationStatePausedWaitResponse;
+            }
+            break;
+        case AnimationStateLooping:
+            ASSERT(input == AnimationStateInputLoopTimerFired || input == AnimationStateInputPlayStatePaused);
+
+            if (input == AnimationStateInputLoopTimerFired) {
+                ASSERT(param >= 0);
+                // Loop timer fired, loop again or end.
+                onAnimationIteration(param);
+
+                // Decide whether to go into looping or ending state
+                goIntoEndingOrLoopingState();
+            } else {
+                // We are pausing while running. Cancel the animation and wait
+                m_pauseTime = beginAnimationUpdateTime();
+                pauseAnimation(beginAnimationUpdateTime() - m_startTime);
+                m_animState = AnimationStatePausedRun;
+            }
+            break;
+        case AnimationStateEnding:
+#if !LOG_DISABLED
+            if (input != AnimationStateInputEndTimerFired && input != AnimationStateInputPlayStatePaused)
+                LOG_ERROR("State is AnimationStateEnding, but input is not AnimationStateInputEndTimerFired or AnimationStateInputPlayStatePaused. It is %d.", input);
+#endif
+            if (input == AnimationStateInputEndTimerFired) {
+
+                ASSERT(param >= 0);
+                // End timer fired, finish up
+                onAnimationEnd(param);
+
+                m_animState = AnimationStateDone;
+
+                if (m_object) {
+                    if (m_animation->fillsForwards())
+                        m_animState = AnimationStateFillingForwards;
+                    else
+                        resumeOverriddenAnimations();
+
+                    // Fire off another style change so we can set the final value
+                    m_compAnim->animationController()->addNodeChangeToDispatch(m_object->node());
+                }
+            } else {
+                // We are pausing while running. Cancel the animation and wait
+                m_pauseTime = beginAnimationUpdateTime();
+                pauseAnimation(beginAnimationUpdateTime() - m_startTime);
+                m_animState = AnimationStatePausedRun;
+            }
+            // |this| may be deleted here
+            break;
+        case AnimationStatePausedWaitTimer:
+            ASSERT(input == AnimationStateInputPlayStateRunning);
+            ASSERT(paused());
+            // Update the times
+            m_startTime += beginAnimationUpdateTime() - m_pauseTime;
+            m_pauseTime = -1;
+
+            // we were waiting for the start timer to fire, go back and wait again
+            m_animState = AnimationStateNew;
+            updateStateMachine(AnimationStateInputStartAnimation, 0);
+            break;
+        case AnimationStatePausedWaitResponse:
+        case AnimationStatePausedWaitStyleAvailable:
+        case AnimationStatePausedRun:
+            // We treat these two cases the same. The only difference is that, when we are in
+            // AnimationStatePausedWaitResponse, we don't yet have a valid startTime, so we send 0 to startAnimation.
+            // When the AnimationStateInputStartTimeSet comes in and we were in AnimationStatePausedRun, we will notice
+            // that we have already set the startTime and will ignore it.
+            ASSERT(input == AnimationStateInputPlayStateRunning || input == AnimationStateInputStartTimeSet || input == AnimationStateInputStyleAvailable);
+            ASSERT(paused());
+
+            if (input == AnimationStateInputPlayStateRunning) {
+                // Update the times
+                if (m_animState == AnimationStatePausedRun)
+                    m_startTime += beginAnimationUpdateTime() - m_pauseTime;
+                else
+                    m_startTime = 0;
+                m_pauseTime = -1;
+
+                if (m_animState == AnimationStatePausedWaitStyleAvailable)
+                    m_animState = AnimationStateStartWaitStyleAvailable;
+                else {
+                    // We were either running or waiting for a begin time response from the animation.
+                    // Either way we need to restart the animation (possibly with an offset if we
+                    // had already been running) and wait for it to start.
+                    m_animState = AnimationStateStartWaitResponse;
+
+                    // Start the animation
+                    if (overridden()) {
+                        updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
+                    } else {
+                        startAnimation(beginAnimationUpdateTime() - m_startTime);
+                        m_compAnim->animationController()->addToAnimationsWaitingForStartTimeResponse(this, isAccelerated());
+                    }
+                }
+                break;
+            }
+
+            if (input == AnimationStateInputStartTimeSet) {
+                ASSERT(m_animState == AnimationStatePausedWaitResponse);
+
+                // We are paused but we got the callback that notifies us that an accelerated animation started.
+                // We ignore the start time and just move into the paused-run state.
+                m_animState = AnimationStatePausedRun;
+                ASSERT(m_startTime == 0);
+                m_startTime = param;
+                m_pauseTime += m_startTime;
+                break;
+            }
+
+            ASSERT(m_animState == AnimationStatePausedWaitStyleAvailable);
+            // We are paused but we got the callback that notifies us that style has been updated.
+            // We move to the AnimationStatePausedWaitResponse state
+            m_animState = AnimationStatePausedWaitResponse;
+            overrideAnimations();
+            break;
+        case AnimationStateFillingForwards:
+        case AnimationStateDone:
+            // We're done. Stay in this state until we are deleted
+            break;
+    }
+}
+
+void AnimationBase::fireAnimationEventsIfNeeded()
+{
+    if (!m_compAnim)
+        return;
+
+    // If we are waiting for the delay time to expire and it has, go to the next state
+    if (m_animState != AnimationStateStartWaitTimer && m_animState != AnimationStateLooping && m_animState != AnimationStateEnding)
+        return;
+
+    // We have to make sure to keep a ref to the this pointer, because it could get destroyed
+    // during an animation callback that might get called. Since the owner is a CompositeAnimation
+    // and it ref counts this object, we will keep a ref to that instead. That way the AnimationBase
+    // can still access the resources of its CompositeAnimation as needed.
+    RefPtr<AnimationBase> protector(this);
+    RefPtr<CompositeAnimation> compProtector(m_compAnim);
+
+    // Check for start timeout
+    if (m_animState == AnimationStateStartWaitTimer) {
+        if (beginAnimationUpdateTime() - m_requestedStartTime >= m_animation->delay())
+            updateStateMachine(AnimationStateInputStartTimerFired, 0);
+        return;
+    }
+
+    double elapsedDuration = getElapsedTime();
+
+    // Check for end timeout
+    if (m_totalDuration >= 0 && elapsedDuration >= m_totalDuration) {
+        // We may still be in AnimationStateLooping if we've managed to skip a
+        // whole iteration, in which case we should jump to the end state.
+        m_animState = AnimationStateEnding;
+
+        // Fire an end event
+        updateStateMachine(AnimationStateInputEndTimerFired, m_totalDuration);
+    } else {
+        // Check for iteration timeout
+        if (m_nextIterationDuration < 0) {
+            // Hasn't been set yet, set it
+            double durationLeft = m_animation->duration() - fmod(elapsedDuration, m_animation->duration());
+            m_nextIterationDuration = elapsedDuration + durationLeft;
+        }
+
+        if (elapsedDuration >= m_nextIterationDuration) {
+            // Set to the next iteration
+            double previous = m_nextIterationDuration;
+            double durationLeft = m_animation->duration() - fmod(elapsedDuration, m_animation->duration());
+            m_nextIterationDuration = elapsedDuration + durationLeft;
+
+            // Send the event
+            updateStateMachine(AnimationStateInputLoopTimerFired, previous);
+        }
+    }
+}
+
+void AnimationBase::updatePlayState(EAnimPlayState playState)
+{
+    if (!m_compAnim)
+        return;
+
+    // When we get here, we can have one of 4 desired states: running, paused, suspended, paused & suspended.
+    // The state machine can be in one of two states: running, paused.
+    // Set the state machine to the desired state.
+    bool pause = playState == AnimPlayStatePaused || m_compAnim->suspended();
+
+    if (pause == paused() && !isNew())
+        return;
+
+    updateStateMachine(pause ?  AnimationStateInputPlayStatePaused : AnimationStateInputPlayStateRunning, -1);
+}
+
+double AnimationBase::timeToNextService()
+{
+    // Returns the time at which next service is required. -1 means no service is required. 0 means
+    // service is required now, and > 0 means service is required that many seconds in the future.
+    if (paused() || isNew() || m_animState == AnimationStateFillingForwards)
+        return -1;
+
+    if (m_animState == AnimationStateStartWaitTimer) {
+        double timeFromNow = m_animation->delay() - (beginAnimationUpdateTime() - m_requestedStartTime);
+        return max(timeFromNow, 0.0);
+    }
+
+    fireAnimationEventsIfNeeded();
+
+    // In all other cases, we need service right away.
+    return 0;
+}
+
+// Compute the fractional time, taking into account direction.
+// There is no need to worry about iterations, we assume that we would have
+// short circuited above if we were done.
+
+double AnimationBase::fractionalTime(double scale, double elapsedTime, double offset) const
+{
+    double fractionalTime = m_animation->duration() ? (elapsedTime / m_animation->duration()) : 1;
+    // FIXME: startTime can be before the current animation "frame" time. This is to sync with the frame time
+    // concept in AnimationTimeController. So we need to somehow sync the two. Until then, the possible
+    // error is small and will probably not be noticeable. Until we fix this, remove the assert.
+    // https://bugs.webkit.org/show_bug.cgi?id=52037
+    // ASSERT(fractionalTime >= 0);
+    if (fractionalTime < 0)
+        fractionalTime = 0;
+
+    int integralTime = static_cast<int>(fractionalTime);
+    const int integralIterationCount = static_cast<int>(m_animation->iterationCount());
+    const bool iterationCountHasFractional = m_animation->iterationCount() - integralIterationCount;
+    if (m_animation->iterationCount() != CSSAnimationData::IterationCountInfinite && !iterationCountHasFractional)
+        integralTime = min(integralTime, integralIterationCount - 1);
+
+    fractionalTime -= integralTime;
+
+    // Thie method can be called with an elapsedTime which very slightly
+    // exceeds the end of the animation. In this case, clamp the
+    // fractionalTime.
+    if (fractionalTime > 1)
+        fractionalTime = 1;
+    ASSERT(fractionalTime >= 0 && fractionalTime <= 1);
+
+    if (((m_animation->direction() == CSSAnimationData::AnimationDirectionAlternate) && (integralTime & 1))
+        || ((m_animation->direction() == CSSAnimationData::AnimationDirectionAlternateReverse) && !(integralTime & 1))
+        || m_animation->direction() == CSSAnimationData::AnimationDirectionReverse)
+        fractionalTime = 1 - fractionalTime;
+
+    fractionalTime -= offset;
+    // Note that if fractionalTime == 0 here, scale may be infinity, but in
+    // this case we don't need to apply scale anyway.
+    if (scale != 1.0 && fractionalTime) {
+        ASSERT(scale >= 0 && !std::isinf(scale));
+        fractionalTime *= scale;
+    }
+
+    ASSERT(fractionalTime >= 0 && fractionalTime <= 1);
+    return fractionalTime;
+}
+
+double AnimationBase::progress(double scale, double offset, const TimingFunction* timingFunction) const
+{
+    if (preActive())
+        return 0;
+
+    double dur = m_animation->duration();
+    if (m_animation->iterationCount() > 0)
+        dur *= m_animation->iterationCount();
+
+    if (postActive() || !m_animation->duration())
+        return 1.0;
+
+    double elapsedTime = getElapsedTime();
+    if (m_animation->iterationCount() > 0 && elapsedTime >= dur) {
+        const int integralIterationCount = static_cast<int>(m_animation->iterationCount());
+        const bool iterationCountHasFractional = m_animation->iterationCount() - integralIterationCount;
+        return (integralIterationCount % 2 || iterationCountHasFractional) ? 1.0 : 0.0;
+    }
+
+    const double fractionalTime = this->fractionalTime(scale, elapsedTime, offset);
+
+    if (!timingFunction)
+        timingFunction = m_animation->timingFunction();
+
+    return timingFunction->evaluate(fractionalTime, accuracyForDuration(m_animation->duration()));
+}
+
+void AnimationBase::getTimeToNextEvent(double& time, bool& isLooping) const
+{
+    if (postActive()) {
+        time = -1;
+        isLooping = false;
+        return;
+    }
+
+    // Decide when the end or loop event needs to fire
+    const double elapsedDuration = getElapsedTime();
+    double durationLeft = 0;
+    double nextIterationTime = m_totalDuration;
+
+    if (m_totalDuration < 0 || elapsedDuration < m_totalDuration) {
+        durationLeft = m_animation->duration() > 0 ? (m_animation->duration() - fmod(elapsedDuration, m_animation->duration())) : 0;
+        nextIterationTime = elapsedDuration + durationLeft;
+    }
+
+    if (m_totalDuration < 0 || nextIterationTime < m_totalDuration) {
+        // We are not at the end yet
+        ASSERT(nextIterationTime > 0);
+        isLooping = true;
+    } else {
+        // We are at the end
+        isLooping = false;
+    }
+
+    time = durationLeft;
+}
+
+void AnimationBase::goIntoEndingOrLoopingState()
+{
+    double t;
+    bool isLooping;
+    getTimeToNextEvent(t, isLooping);
+    m_animState = isLooping ? AnimationStateLooping : AnimationStateEnding;
+}
+
+void AnimationBase::freezeAtTime(double t)
+{
+    if (!m_compAnim)
+        return;
+
+    if (!m_startTime) {
+        // If we haven't started yet, make it as if we started.
+        m_animState = AnimationStateStartWaitResponse;
+        onAnimationStartResponse(beginAnimationUpdateTime());
+    }
+
+    ASSERT(m_startTime);        // if m_startTime is zero, we haven't started yet, so we'll get a bad pause time.
+    if (t <= m_animation->delay())
+        m_pauseTime = m_startTime;
+    else
+        m_pauseTime = m_startTime + t - m_animation->delay();
+
+    // It is possible that m_isAccelerated is true and m_object->isComposited() is false, because of style change.
+    if (m_object && m_object->isComposited() && isAccelerated())
+        toRenderBoxModelObject(m_object)->suspendAnimations(m_pauseTime);
+}
+
+double AnimationBase::beginAnimationUpdateTime() const
+{
+    if (!m_compAnim)
+        return 0;
+
+    return m_compAnim->animationController()->beginAnimationUpdateTime();
+}
+
+double AnimationBase::getElapsedTime() const
+{
+    ASSERT(!postActive());
+    if (paused())
+        return m_pauseTime - m_startTime;
+    if (m_startTime <= 0)
+        return 0;
+
+    double elapsedTime = beginAnimationUpdateTime() - m_startTime;
+    // It's possible for the start time to be ahead of the last update time
+    // if the compositor has just sent notification for the start of an
+    // accelerated animation.
+    return max(elapsedTime, 0.0);
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/animation/AnimationBase.h b/Source/core/frame/animation/AnimationBase.h
new file mode 100644
index 0000000..ac28753
--- /dev/null
+++ b/Source/core/frame/animation/AnimationBase.h
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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 AnimationBase_h
+#define AnimationBase_h
+
+#include "CSSPropertyNames.h"
+#include "core/platform/animation/CSSAnimationData.h"
+#include "core/rendering/style/RenderStyleConstants.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class AnimationBase;
+class AnimationController;
+class CompositeAnimation;
+class Element;
+class Node;
+class RenderObject;
+class RenderStyle;
+class TimingFunction;
+
+class AnimationBase : public RefCounted<AnimationBase> {
+    friend class CompositeAnimation;
+    friend class CSSPropertyAnimation;
+
+public:
+    AnimationBase(const CSSAnimationData* transition, RenderObject* renderer, CompositeAnimation* compAnim);
+    virtual ~AnimationBase() { }
+
+    RenderObject* renderer() const { return m_object; }
+    void clear()
+    {
+      endAnimation();
+      m_object = 0;
+      m_compAnim = 0;
+    }
+
+    double duration() const;
+
+    // Animations and Transitions go through the states below. When entering the STARTED state
+    // the animation is started. This may or may not require deferred response from the animator.
+    // If so, we stay in this state until that response is received (and it returns the start time).
+    // Otherwise, we use the current time as the start time and go immediately to AnimationStateLooping
+    // or AnimationStateEnding.
+    enum AnimState {
+        AnimationStateNew,                  // animation just created, animation not running yet
+        AnimationStateStartWaitTimer,       // start timer running, waiting for fire
+        AnimationStateStartWaitStyleAvailable,   // waiting for style setup so we can start animations
+        AnimationStateStartWaitResponse,    // animation started, waiting for response
+        AnimationStateLooping,              // response received, animation running, loop timer running, waiting for fire
+        AnimationStateEnding,               // received, animation running, end timer running, waiting for fire
+        AnimationStatePausedWaitTimer,      // in pause mode when animation started
+        AnimationStatePausedWaitStyleAvailable, // in pause mode when waiting for style setup
+        AnimationStatePausedWaitResponse,   // animation paused when in STARTING state
+        AnimationStatePausedRun,            // animation paused when in LOOPING or ENDING state
+        AnimationStateDone,                 // end timer fired, animation finished and removed
+        AnimationStateFillingForwards       // animation has ended and is retaining its final value
+    };
+
+    enum AnimStateInput {
+        AnimationStateInputMakeNew,           // reset back to new from any state
+        AnimationStateInputStartAnimation,    // animation requests a start
+        AnimationStateInputRestartAnimation,  // force a restart from any state
+        AnimationStateInputStartTimerFired,   // start timer fired
+        AnimationStateInputStyleAvailable,    // style is setup, ready to start animating
+        AnimationStateInputStartTimeSet,      // m_startTime was set
+        AnimationStateInputLoopTimerFired,    // loop timer fired
+        AnimationStateInputEndTimerFired,     // end timer fired
+        AnimationStateInputPauseOverride,     // pause an animation due to override
+        AnimationStateInputResumeOverride,    // resume an overridden animation
+        AnimationStateInputPlayStateRunning,  // play state paused -> running
+        AnimationStateInputPlayStatePaused,   // play state running -> paused
+        AnimationStateInputEndAnimation       // force an end from any state
+    };
+
+    // Called when animation is in AnimationStateNew to start animation
+    void updateStateMachine(AnimStateInput, double param);
+
+    // Animation has actually started, at passed time
+    void onAnimationStartResponse(double startTime)
+    {
+        updateStateMachine(AnimationBase::AnimationStateInputStartTimeSet, startTime);
+    }
+
+    // Called to change to or from paused state
+    void updatePlayState(EAnimPlayState);
+    bool playStatePlaying() const;
+
+    bool waitingToStart() const { return m_animState == AnimationStateNew || m_animState == AnimationStateStartWaitTimer; }
+    bool preActive() const
+    {
+        return m_animState == AnimationStateNew || m_animState == AnimationStateStartWaitTimer || m_animState == AnimationStateStartWaitStyleAvailable || m_animState == AnimationStateStartWaitResponse;
+    }
+
+    bool postActive() const { return m_animState == AnimationStateDone; }
+    bool active() const { return !postActive() && !preActive(); }
+    bool running() const { return !isNew() && !postActive(); }
+    bool paused() const { return m_pauseTime >= 0; }
+    bool isNew() const { return m_animState == AnimationStateNew; }
+    bool waitingForStartTime() const { return m_animState == AnimationStateStartWaitResponse; }
+    bool waitingForStyleAvailable() const { return m_animState == AnimationStateStartWaitStyleAvailable; }
+
+    virtual double timeToNextService();
+
+    double progress(double scale, double offset, const TimingFunction*) const;
+
+    virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle* /*currentStyle*/, RenderStyle* /*targetStyle*/, RefPtr<RenderStyle>& /*animatedStyle*/) = 0;
+    virtual void getAnimatedStyle(RefPtr<RenderStyle>& /*animatedStyle*/) = 0;
+
+    virtual bool shouldFireEvents() const { return false; }
+
+    void fireAnimationEventsIfNeeded();
+
+    void setAnimation(const CSSAnimationData* anim) { m_animation = const_cast<CSSAnimationData*>(anim); }
+
+    // Return true if this animation is overridden. This will only be the case for
+    // ImplicitAnimations and is used to determine whether or not we should force
+    // set the start time. If an animation is overridden, it will probably not get
+    // back the AnimationStateInputStartTimeSet input.
+    virtual bool overridden() const { return false; }
+
+    // Does this animation/transition involve the given property?
+    virtual bool affectsProperty(CSSPropertyID /*property*/) const { return false; }
+
+    bool isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, bool isRunningNow) const
+    {
+        if (acceleratedOnly && !m_isAccelerated)
+            return false;
+
+        if (isRunningNow)
+            return (!waitingToStart() && !postActive()) && affectsProperty(property);
+
+        return !postActive() && affectsProperty(property);
+    }
+
+    // FIXME: rename this using the "lists match" terminology.
+    bool isTransformFunctionListValid() const { return m_transformFunctionListValid; }
+    bool filterFunctionListsMatch() const { return m_filterFunctionListsMatch; }
+
+    // Freeze the animation; used by DumpRenderTree.
+    void freezeAtTime(double t);
+
+    double beginAnimationUpdateTime() const;
+
+    double getElapsedTime() const;
+
+    void styleAvailable()
+    {
+        ASSERT(waitingForStyleAvailable());
+        updateStateMachine(AnimationBase::AnimationStateInputStyleAvailable, -1);
+    }
+
+    const CSSAnimationData* animation() const { return m_animation.get(); }
+
+protected:
+    virtual void overrideAnimations() { }
+    virtual void resumeOverriddenAnimations() { }
+
+    CompositeAnimation* compositeAnimation() { return m_compAnim; }
+
+    // These are called when the corresponding timer fires so subclasses can do any extra work
+    virtual void onAnimationStart(double /*elapsedTime*/) { }
+    virtual void onAnimationIteration(double /*elapsedTime*/) { }
+    virtual void onAnimationEnd(double /*elapsedTime*/) { }
+
+    // timeOffset is an offset from the current time when the animation should start. Negative values are OK.
+    virtual void startAnimation(double /*timeOffset*/) { }
+    // timeOffset is the time at which the animation is being paused.
+    virtual void pauseAnimation(double /*timeOffset*/) { }
+    virtual void endAnimation() { }
+
+    void goIntoEndingOrLoopingState();
+
+    bool isAccelerated() const { return m_isAccelerated; }
+
+    static void setNeedsStyleRecalc(Node*);
+
+    void getTimeToNextEvent(double& time, bool& isLooping) const;
+
+    double fractionalTime(double scale, double elapsedTime, double offset) const;
+
+    AnimState m_animState;
+
+    bool m_isAccelerated;
+    bool m_transformFunctionListValid;
+    bool m_filterFunctionListsMatch;
+    double m_startTime;
+    double m_pauseTime;
+    double m_requestedStartTime;
+
+    double m_totalDuration;
+    double m_nextIterationDuration;
+
+    RenderObject* m_object;
+
+    RefPtr<CSSAnimationData> m_animation;
+    CompositeAnimation* m_compAnim;
+};
+
+} // namespace WebCore
+
+#endif // AnimationBase_h
diff --git a/Source/core/frame/animation/AnimationController.cpp b/Source/core/frame/animation/AnimationController.cpp
new file mode 100644
index 0000000..516f527
--- /dev/null
+++ b/Source/core/frame/animation/AnimationController.cpp
@@ -0,0 +1,615 @@
+/*
+ * Copyright (C) 2007, 2008, 2009 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.
+ * 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.
+ *
+ * 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/frame/animation/AnimationController.h"
+
+#include "core/dom/PseudoElement.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/events/TransitionEvent.h"
+#include "core/events/WebKitAnimationEvent.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
+#include "core/page/Page.h"
+#include "core/frame/animation/AnimationBase.h"
+#include "core/frame/animation/AnimationControllerPrivate.h"
+#include "core/frame/animation/CSSPropertyAnimation.h"
+#include "core/frame/animation/CompositeAnimation.h"
+#include "core/rendering/RenderView.h"
+#include "wtf/CurrentTime.h"
+
+namespace WebCore {
+
+static const double cBeginAnimationUpdateTimeNotSet = -1;
+
+AnimationControllerPrivate::AnimationControllerPrivate(Frame* frame)
+    : m_animationTimer(this, &AnimationControllerPrivate::animationTimerFired)
+    , m_updateStyleIfNeededDispatcher(this, &AnimationControllerPrivate::updateStyleIfNeededDispatcherFired)
+    , m_frame(frame)
+    , m_beginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet)
+    , m_animationsWaitingForStyle()
+    , m_animationsWaitingForStartTimeResponse()
+    , m_waitingForAsyncStartNotification(false)
+{
+}
+
+AnimationControllerPrivate::~AnimationControllerPrivate()
+{
+}
+
+PassRefPtr<CompositeAnimation> AnimationControllerPrivate::accessCompositeAnimation(RenderObject* renderer)
+{
+    RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer);
+    if (!animation) {
+        animation = CompositeAnimation::create(this);
+        m_compositeAnimations.set(renderer, animation);
+    }
+    return animation;
+}
+
+bool AnimationControllerPrivate::clear(RenderObject* renderer)
+{
+    // Return false if we didn't do anything OR we are suspended (so we don't try to
+    // do a setNeedsStyleRecalc() when suspended).
+    PassRefPtr<CompositeAnimation> animation = m_compositeAnimations.take(renderer);
+    if (!animation)
+        return false;
+    animation->clearRenderer();
+    return animation->suspended();
+}
+
+void AnimationControllerPrivate::updateAnimations(double& timeToNextService, double& timeToNextEvent, SetNeedsStyleRecalc callSetNeedsStyleRecalc/* = DoNotCallSetNeedsStyleRecalc*/)
+{
+    double minTimeToNextService = -1;
+    double minTimeToNextEvent = -1;
+    bool updateStyleNeeded = false;
+
+    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
+    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
+        CompositeAnimation* compAnim = it->value.get();
+        if (!compAnim->suspended() && compAnim->hasAnimations()) {
+            double t = compAnim->timeToNextService();
+            if (t != -1 && (t < minTimeToNextService || minTimeToNextService == -1))
+                minTimeToNextService = t;
+            double nextEvent = compAnim->timeToNextEvent();
+            if (nextEvent != -1 && (nextEvent < minTimeToNextEvent || minTimeToNextEvent == -1))
+                minTimeToNextEvent = nextEvent;
+            if (callSetNeedsStyleRecalc == CallSetNeedsStyleRecalc) {
+                if (!t) {
+                    Node* node = it->key->node();
+                    node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
+                    updateStyleNeeded = true;
+                }
+            } else if (!minTimeToNextService && !minTimeToNextEvent) {
+                // Found the minimum values and do not need to mark for style recalc.
+                break;
+            }
+        }
+    }
+
+    if (updateStyleNeeded)
+        m_frame->document()->updateStyleIfNeeded();
+
+    timeToNextService = minTimeToNextService;
+    timeToNextEvent = minTimeToNextEvent;
+}
+
+void AnimationControllerPrivate::scheduleServiceForRenderer(RenderObject* renderer)
+{
+    double timeToNextService = -1;
+    double timeToNextEvent = -1;
+
+    RefPtr<CompositeAnimation> compAnim = m_compositeAnimations.get(renderer);
+    if (!compAnim->suspended() && compAnim->hasAnimations()) {
+        timeToNextService = compAnim->timeToNextService();
+        timeToNextEvent = compAnim->timeToNextEvent();
+    }
+
+    if (timeToNextService >= 0)
+        scheduleService(timeToNextService, timeToNextEvent);
+}
+
+void AnimationControllerPrivate::scheduleService()
+{
+    double timeToNextService = -1;
+    double timeToNextEvent = -1;
+    updateAnimations(timeToNextService, timeToNextEvent, DoNotCallSetNeedsStyleRecalc);
+    scheduleService(timeToNextService, timeToNextEvent);
+}
+
+void AnimationControllerPrivate::scheduleService(double timeToNextService, double timeToNextEvent)
+{
+    if (!m_frame->page())
+        return;
+
+    bool visible = m_frame->page()->visibilityState() == WebCore::PageVisibilityStateVisible;
+
+    // This std::max to 1 second limits how often we service animations on background tabs.
+    // Without this, plus and gmail were recalculating style as every 200ms or even more
+    // often, burning CPU needlessly for background tabs.
+    // FIXME: Do we want to fire events at all on background tabs?
+    if (!visible)
+        timeToNextService = std::max(timeToNextEvent, 1.0);
+
+    if (visible && !timeToNextService) {
+        m_frame->document()->view()->scheduleAnimation();
+        if (m_animationTimer.isActive())
+            m_animationTimer.stop();
+        return;
+    }
+
+    if (timeToNextService < 0) {
+        if (m_animationTimer.isActive())
+            m_animationTimer.stop();
+        return;
+    }
+
+    if (m_animationTimer.isActive() && m_animationTimer.nextFireInterval() <= timeToNextService)
+        return;
+
+    m_animationTimer.startOneShot(timeToNextService);
+}
+
+void AnimationControllerPrivate::updateStyleIfNeededDispatcherFired(Timer<AnimationControllerPrivate>*)
+{
+    fireEventsAndUpdateStyle();
+}
+
+void AnimationControllerPrivate::fireEventsAndUpdateStyle()
+{
+    // Protect the frame from getting destroyed in the event handler
+    RefPtr<Frame> protector = m_frame;
+
+    bool updateStyle = !m_eventsToDispatch.isEmpty() || !m_nodeChangesToDispatch.isEmpty();
+
+    // fire all the events
+    Vector<EventToDispatch> eventsToDispatch = m_eventsToDispatch;
+    m_eventsToDispatch.clear();
+    Vector<EventToDispatch>::const_iterator eventsToDispatchEnd = eventsToDispatch.end();
+    for (Vector<EventToDispatch>::const_iterator it = eventsToDispatch.begin(); it != eventsToDispatchEnd; ++it) {
+        Element* element = it->element.get();
+        if (it->eventType == EventTypeNames::transitionend)
+            element->dispatchEvent(TransitionEvent::create(it->eventType, it->name, it->elapsedTime, PseudoElement::pseudoElementNameForEvents(element->pseudoId())));
+        else
+            element->dispatchEvent(WebKitAnimationEvent::create(it->eventType, it->name, it->elapsedTime));
+    }
+
+    // call setChanged on all the elements
+    Vector<RefPtr<Node> >::const_iterator nodeChangesToDispatchEnd = m_nodeChangesToDispatch.end();
+    for (Vector<RefPtr<Node> >::const_iterator it = m_nodeChangesToDispatch.begin(); it != nodeChangesToDispatchEnd; ++it)
+        (*it)->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
+
+    m_nodeChangesToDispatch.clear();
+
+    if (updateStyle && m_frame)
+        m_frame->document()->updateStyleIfNeeded();
+}
+
+void AnimationControllerPrivate::startUpdateStyleIfNeededDispatcher()
+{
+    if (!m_updateStyleIfNeededDispatcher.isActive())
+        m_updateStyleIfNeededDispatcher.startOneShot(0);
+}
+
+void AnimationControllerPrivate::addEventToDispatch(PassRefPtr<Element> element, const AtomicString& eventType, const String& name, double elapsedTime)
+{
+    m_eventsToDispatch.grow(m_eventsToDispatch.size()+1);
+    EventToDispatch& event = m_eventsToDispatch[m_eventsToDispatch.size()-1];
+    event.element = element;
+    event.eventType = eventType;
+    event.name = name;
+    event.elapsedTime = elapsedTime;
+
+    startUpdateStyleIfNeededDispatcher();
+}
+
+void AnimationControllerPrivate::addNodeChangeToDispatch(PassRefPtr<Node> node)
+{
+    if (!node)
+        return;
+
+    m_nodeChangesToDispatch.append(node);
+    startUpdateStyleIfNeededDispatcher();
+}
+
+void AnimationControllerPrivate::serviceAnimations()
+{
+    double timeToNextService = -1;
+    double timeToNextEvent = -1;
+    updateAnimations(timeToNextService, timeToNextEvent, CallSetNeedsStyleRecalc);
+    scheduleService(timeToNextService, timeToNextEvent);
+
+    // Fire events right away, to avoid a flash of unanimated style after an animation completes, and before
+    // the 'end' event fires.
+    fireEventsAndUpdateStyle();
+}
+
+void AnimationControllerPrivate::animationTimerFired(Timer<AnimationControllerPrivate>*)
+{
+    // Make sure animationUpdateTime is updated, so that it is current even if no
+    // styleChange has happened (e.g. accelerated animations)
+    setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
+    serviceAnimations();
+}
+
+bool AnimationControllerPrivate::isRunningAnimationOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const
+{
+    RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer);
+    if (!animation)
+        return false;
+
+    return animation->isAnimatingProperty(property, false, isRunningNow);
+}
+
+bool AnimationControllerPrivate::isRunningAcceleratableAnimationOnRenderer(RenderObject *renderer) const
+{
+    RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer);
+    if (!animation)
+        return false;
+
+    bool acceleratedOnly = false;
+    bool isRunningNow = true;
+    return animation->isAnimatingProperty(CSSPropertyOpacity, acceleratedOnly, isRunningNow)
+        || animation->isAnimatingProperty(CSSPropertyWebkitTransform, acceleratedOnly, isRunningNow)
+        || animation->isAnimatingProperty(CSSPropertyWebkitFilter, acceleratedOnly, isRunningNow);
+}
+
+bool AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const
+{
+    RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer);
+    if (!animation)
+        return false;
+
+    return animation->isAnimatingProperty(property, true, isRunningNow);
+}
+
+void AnimationControllerPrivate::suspendAnimations()
+{
+    suspendAnimationsForDocument(m_frame->document());
+
+    // Traverse subframes
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->animation()->suspendAnimations();
+}
+
+void AnimationControllerPrivate::resumeAnimations()
+{
+    resumeAnimationsForDocument(m_frame->document());
+
+    // Traverse subframes
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        child->animation()->resumeAnimations();
+}
+
+void AnimationControllerPrivate::suspendAnimationsForDocument(Document* document)
+{
+    setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
+
+    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
+    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
+        RenderObject* renderer = it->key;
+        if (renderer->document() == document) {
+            CompositeAnimation* compAnim = it->value.get();
+            compAnim->suspendAnimations();
+        }
+    }
+
+    scheduleService();
+}
+
+void AnimationControllerPrivate::resumeAnimationsForDocument(Document* document)
+{
+    setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
+
+    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
+    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
+        RenderObject* renderer = it->key;
+        if (renderer->document() == document) {
+            CompositeAnimation* compAnim = it->value.get();
+            compAnim->resumeAnimations();
+        }
+    }
+
+    scheduleService();
+}
+
+void AnimationControllerPrivate::pauseAnimationsForTesting(double t)
+{
+    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
+    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
+        it->value->pauseAnimationsForTesting(t);
+        it->key->node()->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
+    }
+}
+
+double AnimationControllerPrivate::beginAnimationUpdateTime()
+{
+    if (m_beginAnimationUpdateTime == cBeginAnimationUpdateTimeNotSet)
+        m_beginAnimationUpdateTime = currentTime();
+    return m_beginAnimationUpdateTime;
+}
+
+void AnimationControllerPrivate::endAnimationUpdate()
+{
+    styleAvailable();
+    if (!m_waitingForAsyncStartNotification)
+        startTimeResponse(beginAnimationUpdateTime());
+}
+
+void AnimationControllerPrivate::receivedStartTimeResponse(double time)
+{
+    m_waitingForAsyncStartNotification = false;
+    startTimeResponse(time);
+}
+
+PassRefPtr<RenderStyle> AnimationControllerPrivate::getAnimatedStyleForRenderer(RenderObject* renderer)
+{
+    if (!renderer)
+        return 0;
+
+    RefPtr<CompositeAnimation> rendererAnimations = m_compositeAnimations.get(renderer);
+    if (!rendererAnimations)
+        return renderer->style();
+
+    RefPtr<RenderStyle> animatingStyle = rendererAnimations->getAnimatedStyle();
+    if (!animatingStyle)
+        animatingStyle = renderer->style();
+
+    return animatingStyle.release();
+}
+
+unsigned AnimationControllerPrivate::numberOfActiveAnimations(Document* document) const
+{
+    unsigned count = 0;
+
+    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
+    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
+        RenderObject* renderer = it->key;
+        CompositeAnimation* compAnim = it->value.get();
+        if (renderer->document() == document)
+            count += compAnim->numberOfActiveAnimations();
+    }
+
+    return count;
+}
+
+void AnimationControllerPrivate::addToAnimationsWaitingForStyle(AnimationBase* animation)
+{
+    // Make sure this animation is not in the start time waiters
+    m_animationsWaitingForStartTimeResponse.remove(animation);
+
+    m_animationsWaitingForStyle.add(animation);
+}
+
+void AnimationControllerPrivate::removeFromAnimationsWaitingForStyle(AnimationBase* animationToRemove)
+{
+    m_animationsWaitingForStyle.remove(animationToRemove);
+}
+
+void AnimationControllerPrivate::styleAvailable()
+{
+    // Go through list of waiters and send them on their way
+    WaitingAnimationsSet::const_iterator it = m_animationsWaitingForStyle.begin();
+    WaitingAnimationsSet::const_iterator end = m_animationsWaitingForStyle.end();
+    for (; it != end; ++it)
+        (*it)->styleAvailable();
+
+    m_animationsWaitingForStyle.clear();
+}
+
+void AnimationControllerPrivate::addToAnimationsWaitingForStartTimeResponse(AnimationBase* animation, bool willGetResponse)
+{
+    // If willGetResponse is true, it means this animation is actually waiting for a response
+    // (which will come in as a call to notifyAnimationStarted()).
+    // In that case we don't need to add it to this list. We just set a waitingForAResponse flag
+    // which says we are waiting for the response. If willGetResponse is false, this animation
+    // is not waiting for a response for itself, but rather for a notifyXXXStarted() call for
+    // another animation to which it will sync.
+    //
+    // When endAnimationUpdate() is called we check to see if the waitingForAResponse flag is
+    // true. If so, we just return and will do our work when the first notifyXXXStarted() call
+    // comes in. If it is false, we will not be getting a notifyXXXStarted() call, so we will
+    // do our work right away. In both cases we call the onAnimationStartResponse() method
+    // on each animation. In the first case we send in the time we got from notifyXXXStarted().
+    // In the second case, we just pass in the beginAnimationUpdateTime().
+    //
+    // This will synchronize all software and accelerated animations started in the same
+    // updateStyleIfNeeded cycle.
+    //
+
+    if (willGetResponse)
+        m_waitingForAsyncStartNotification = true;
+
+    m_animationsWaitingForStartTimeResponse.add(animation);
+}
+
+void AnimationControllerPrivate::removeFromAnimationsWaitingForStartTimeResponse(AnimationBase* animationToRemove)
+{
+    m_animationsWaitingForStartTimeResponse.remove(animationToRemove);
+
+    if (m_animationsWaitingForStartTimeResponse.isEmpty())
+        m_waitingForAsyncStartNotification = false;
+}
+
+void AnimationControllerPrivate::startTimeResponse(double time)
+{
+    // Go through list of waiters and send them on their way
+
+    WaitingAnimationsSet::const_iterator it = m_animationsWaitingForStartTimeResponse.begin();
+    WaitingAnimationsSet::const_iterator end = m_animationsWaitingForStartTimeResponse.end();
+    for (; it != end; ++it)
+        (*it)->onAnimationStartResponse(time);
+
+    m_animationsWaitingForStartTimeResponse.clear();
+    m_waitingForAsyncStartNotification = false;
+}
+
+void AnimationControllerPrivate::animationWillBeRemoved(AnimationBase* animation)
+{
+    removeFromAnimationsWaitingForStyle(animation);
+    removeFromAnimationsWaitingForStartTimeResponse(animation);
+}
+
+AnimationController::AnimationController(Frame* frame)
+    : m_data(adoptPtr(new AnimationControllerPrivate(frame)))
+    , m_beginAnimationUpdateCount(0)
+{
+}
+
+AnimationController::~AnimationController()
+{
+}
+
+void AnimationController::cancelAnimations(RenderObject* renderer)
+{
+    if (!m_data->hasAnimations())
+        return;
+
+    if (m_data->clear(renderer)) {
+        if (Node* node = renderer->node())
+            node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
+    }
+}
+
+PassRefPtr<RenderStyle> AnimationController::updateAnimations(RenderObject* renderer, RenderStyle* newStyle)
+{
+    RenderStyle* oldStyle = renderer->style();
+
+    if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle->animations() && !newStyle->transitions()))
+        return newStyle;
+
+    // Don't run transitions when printing.
+    if (renderer->view()->document().printing())
+        return newStyle;
+
+    // Fetch our current set of implicit animations from a hashtable.  We then compare them
+    // against the animations in the style and make sure we're in sync.  If destination values
+    // have changed, we reset the animation.  We then do a blend to get new values and we return
+    // a new style.
+
+    // We don't support anonymous pseudo elements like :first-line or :first-letter.
+    ASSERT(renderer->node());
+
+    RefPtr<CompositeAnimation> rendererAnimations = m_data->accessCompositeAnimation(renderer);
+    RefPtr<RenderStyle> blendedStyle = rendererAnimations->animate(renderer, oldStyle, newStyle);
+
+    if (renderer->parent() || newStyle->animations() || (oldStyle && oldStyle->animations())) {
+        m_data->scheduleServiceForRenderer(renderer);
+    }
+
+    if (blendedStyle != newStyle) {
+        // If the animations/transitions change opacity or transform, we need to update
+        // the style to impose the stacking rules. Note that this is also
+        // done in StyleResolver::adjustRenderStyle().
+        if (blendedStyle->hasAutoZIndex() && (blendedStyle->opacity() < 1.0f || blendedStyle->hasTransform()))
+            blendedStyle->setZIndex(0);
+    }
+    return blendedStyle.release();
+}
+
+PassRefPtr<RenderStyle> AnimationController::getAnimatedStyleForRenderer(RenderObject* renderer)
+{
+    return m_data->getAnimatedStyleForRenderer(renderer);
+}
+
+void AnimationController::notifyAnimationStarted(RenderObject*, double startTime)
+{
+    m_data->receivedStartTimeResponse(startTime);
+}
+
+void AnimationController::pauseAnimationsForTesting(double t)
+{
+    m_data->pauseAnimationsForTesting(t);
+}
+
+unsigned AnimationController::numberOfActiveAnimations(Document* document) const
+{
+    return m_data->numberOfActiveAnimations(document);
+}
+
+bool AnimationController::isRunningAnimationOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const
+{
+    return m_data->isRunningAnimationOnRenderer(renderer, property, isRunningNow);
+}
+
+bool AnimationController::isRunningAcceleratableAnimationOnRenderer(RenderObject* renderer) const
+{
+    return m_data->isRunningAcceleratableAnimationOnRenderer(renderer);
+}
+
+bool AnimationController::isRunningAcceleratedAnimationOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const
+{
+    return m_data->isRunningAcceleratedAnimationOnRenderer(renderer, property, isRunningNow);
+}
+
+void AnimationController::suspendAnimations()
+{
+    m_data->suspendAnimations();
+}
+
+void AnimationController::resumeAnimations()
+{
+    m_data->resumeAnimations();
+}
+
+void AnimationController::serviceAnimations()
+{
+    m_data->serviceAnimations();
+}
+
+void AnimationController::suspendAnimationsForDocument(Document* document)
+{
+    m_data->suspendAnimationsForDocument(document);
+}
+
+void AnimationController::resumeAnimationsForDocument(Document* document)
+{
+    m_data->resumeAnimationsForDocument(document);
+}
+
+void AnimationController::beginAnimationUpdate()
+{
+    if (!m_beginAnimationUpdateCount)
+        m_data->setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
+    ++m_beginAnimationUpdateCount;
+}
+
+void AnimationController::endAnimationUpdate()
+{
+    ASSERT(m_beginAnimationUpdateCount > 0);
+    --m_beginAnimationUpdateCount;
+    if (!m_beginAnimationUpdateCount)
+        m_data->endAnimationUpdate();
+}
+
+bool AnimationController::supportsAcceleratedAnimationOfProperty(CSSPropertyID property)
+{
+    return CSSPropertyAnimation::animationOfPropertyIsAccelerated(property);
+}
+
+} // namespace WebCore
diff --git a/Source/core/page/animation/AnimationController.h b/Source/core/frame/animation/AnimationController.h
similarity index 100%
rename from Source/core/page/animation/AnimationController.h
rename to Source/core/frame/animation/AnimationController.h
diff --git a/Source/core/frame/animation/AnimationControllerPrivate.h b/Source/core/frame/animation/AnimationControllerPrivate.h
new file mode 100644
index 0000000..959ddeb
--- /dev/null
+++ b/Source/core/frame/animation/AnimationControllerPrivate.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2009 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.
+ * 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.
+ *
+ * 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 AnimationControllerPrivate_h
+#define AnimationControllerPrivate_h
+
+#include "CSSPropertyNames.h"
+#include "platform/Timer.h"
+#include "wtf/HashMap.h"
+#include "wtf/HashSet.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+#include "wtf/Vector.h"
+#include "wtf/text/AtomicString.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class AnimationBase;
+class CompositeAnimation;
+class Document;
+class Element;
+class Frame;
+class Node;
+class RenderObject;
+class RenderStyle;
+
+enum SetNeedsStyleRecalc {
+    DoNotCallSetNeedsStyleRecalc = 0,
+    CallSetNeedsStyleRecalc = 1
+};
+
+class AnimationControllerPrivate {
+    WTF_MAKE_NONCOPYABLE(AnimationControllerPrivate); WTF_MAKE_FAST_ALLOCATED;
+public:
+    AnimationControllerPrivate(Frame*);
+    ~AnimationControllerPrivate();
+
+    void updateAnimations(double& timeToNextService, double& timeToNextEvent, SetNeedsStyleRecalc callSetNeedsStyleRecalc = DoNotCallSetNeedsStyleRecalc);
+    void scheduleService();
+
+    PassRefPtr<CompositeAnimation> accessCompositeAnimation(RenderObject*);
+    bool clear(RenderObject*);
+
+    void updateStyleIfNeededDispatcherFired(Timer<AnimationControllerPrivate>*);
+    void startUpdateStyleIfNeededDispatcher();
+    void addEventToDispatch(PassRefPtr<Element> element, const AtomicString& eventType, const String& name, double elapsedTime);
+    void addNodeChangeToDispatch(PassRefPtr<Node>);
+
+    bool hasAnimations() const { return !m_compositeAnimations.isEmpty(); }
+
+    void suspendAnimations();
+    void resumeAnimations();
+    void serviceAnimations();
+
+    void suspendAnimationsForDocument(Document*);
+    void resumeAnimationsForDocument(Document*);
+
+    bool isRunningAnimationOnRenderer(RenderObject*, CSSPropertyID, bool isRunningNow) const;
+    bool isRunningAcceleratableAnimationOnRenderer(RenderObject*) const;
+    bool isRunningAcceleratedAnimationOnRenderer(RenderObject*, CSSPropertyID, bool isRunningNow) const;
+
+    void pauseAnimationsForTesting(double t);
+    unsigned numberOfActiveAnimations(Document*) const;
+
+    PassRefPtr<RenderStyle> getAnimatedStyleForRenderer(RenderObject* renderer);
+
+    double beginAnimationUpdateTime();
+    void setBeginAnimationUpdateTime(double t) { m_beginAnimationUpdateTime = t; }
+    void endAnimationUpdate();
+    void receivedStartTimeResponse(double);
+
+    void addToAnimationsWaitingForStyle(AnimationBase*);
+    void removeFromAnimationsWaitingForStyle(AnimationBase*);
+
+    void addToAnimationsWaitingForStartTimeResponse(AnimationBase*, bool willGetResponse);
+    void removeFromAnimationsWaitingForStartTimeResponse(AnimationBase*);
+
+    void animationWillBeRemoved(AnimationBase*);
+
+    void scheduleServiceForRenderer(RenderObject*);
+
+private:
+    void animationTimerFired(Timer<AnimationControllerPrivate>*);
+
+    void scheduleService(double timeToNextService, double timeToNextEvent);
+
+    void styleAvailable();
+    void fireEventsAndUpdateStyle();
+    void startTimeResponse(double t);
+
+    typedef HashMap<RenderObject*, RefPtr<CompositeAnimation> > RenderObjectAnimationMap;
+
+    RenderObjectAnimationMap m_compositeAnimations;
+    Timer<AnimationControllerPrivate> m_animationTimer;
+    Timer<AnimationControllerPrivate> m_updateStyleIfNeededDispatcher;
+    Frame* m_frame;
+
+    class EventToDispatch {
+    public:
+        RefPtr<Element> element;
+        AtomicString eventType;
+        String name;
+        double elapsedTime;
+    };
+
+    Vector<EventToDispatch> m_eventsToDispatch;
+    Vector<RefPtr<Node> > m_nodeChangesToDispatch;
+
+    double m_beginAnimationUpdateTime;
+
+    typedef HashSet<RefPtr<AnimationBase> > WaitingAnimationsSet;
+    WaitingAnimationsSet m_animationsWaitingForStyle;
+    WaitingAnimationsSet m_animationsWaitingForStartTimeResponse;
+    bool m_waitingForAsyncStartNotification;
+};
+
+} // namespace WebCore
+
+#endif // AnimationControllerPrivate_h
diff --git a/Source/core/frame/animation/CSSPropertyAnimation.cpp b/Source/core/frame/animation/CSSPropertyAnimation.cpp
new file mode 100644
index 0000000..e33b466
--- /dev/null
+++ b/Source/core/frame/animation/CSSPropertyAnimation.cpp
@@ -0,0 +1,1269 @@
+/*
+ * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Adobe Systems Incorporated. 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.
+ * 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.
+ *
+ * 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/frame/animation/CSSPropertyAnimation.h"
+
+#include <algorithm>
+#include "CSSPropertyNames.h"
+#include "StylePropertyShorthand.h"
+#include "core/animation/css/CSSAnimations.h"
+#include "core/css/CSSCrossfadeValue.h"
+#include "core/css/CSSImageValue.h"
+#include "core/css/CSSPrimitiveValue.h"
+#include "core/fetch/ImageResource.h"
+#include "core/frame/animation/AnimationBase.h"
+#include "core/rendering/ClipPathOperation.h"
+#include "core/rendering/RenderBox.h"
+#include "core/rendering/style/RenderStyle.h"
+#include "core/rendering/style/StyleFetchedImage.h"
+#include "core/rendering/style/StyleGeneratedImage.h"
+#include "platform/FloatConversion.h"
+#include "wtf/Noncopyable.h"
+
+namespace WebCore {
+
+template <typename T>
+static inline T blendFunc(const AnimationBase*, T from, T to, double progress)
+{
+    return blend(from, to, progress);
+}
+
+static inline float blendFunc(const AnimationBase*, float from, float to, double progress)
+{
+    return narrowPrecisionToFloat(from + (to - from) * progress);
+}
+
+static inline Color blendFunc(const AnimationBase*, const Color& from, const Color& to, double progress)
+{
+    return blend(from, to, progress);
+}
+
+static inline Length blendFunc(const AnimationBase*, const Length& from, const Length& to, double progress)
+{
+    return to.blend(from, narrowPrecisionToFloat(progress), ValueRangeAll);
+}
+
+static inline LengthSize blendFunc(const AnimationBase* anim, const LengthSize& from, const LengthSize& to, double progress)
+{
+    return LengthSize(blendFunc(anim, from.width(), to.width(), progress),
+                      blendFunc(anim, from.height(), to.height(), progress));
+}
+
+static inline LengthPoint blendFunc(const AnimationBase* anim, const LengthPoint& from, const LengthPoint& to, double progress)
+{
+    return LengthPoint(blendFunc(anim, from.x(), to.x(), progress), blendFunc(anim, from.y(), to.y(), progress));
+}
+
+static inline IntSize blendFunc(const AnimationBase* anim, const IntSize& from, const IntSize& to, double progress)
+{
+    return IntSize(blendFunc(anim, from.width(), to.width(), progress),
+                   blendFunc(anim, from.height(), to.height(), progress));
+}
+
+static inline ShadowStyle blendFunc(const AnimationBase* anim, ShadowStyle from, ShadowStyle to, double progress)
+{
+    if (from == to)
+        return to;
+
+    double fromVal = from == Normal ? 1 : 0;
+    double toVal = to == Normal ? 1 : 0;
+    double result = blendFunc(anim, fromVal, toVal, progress);
+    return result > 0 ? Normal : Inset;
+}
+
+static inline PassOwnPtr<ShadowData> blendFunc(const AnimationBase* anim, const ShadowData* from, const ShadowData* to, double progress)
+{
+    ASSERT(from && to);
+    if (from->style() != to->style())
+        return to->clone();
+
+    return ShadowData::create(blend(from->location(), to->location(), progress),
+        blend(from->blur(), to->blur(), progress),
+        blend(from->spread(), to->spread(), progress),
+        blendFunc(anim, from->style(), to->style(), progress),
+        blend(from->color(), to->color(), progress));
+}
+
+static inline TransformOperations blendFunc(const AnimationBase* anim, const TransformOperations& from, const TransformOperations& to, double progress)
+{
+    if (anim->isTransformFunctionListValid())
+        return to.blendByMatchingOperations(from, progress);
+    return to.blendByUsingMatrixInterpolation(from, progress);
+}
+
+static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, ClipPathOperation* from, ClipPathOperation* to, double progress)
+{
+    // Other clip-path operations than BasicShapes can not be animated.
+    if (from->getOperationType() != ClipPathOperation::SHAPE || to->getOperationType() != ClipPathOperation::SHAPE)
+        return to;
+
+    const BasicShape* fromShape = static_cast<ShapeClipPathOperation*>(from)->basicShape();
+    const BasicShape* toShape = static_cast<ShapeClipPathOperation*>(to)->basicShape();
+
+    if (!fromShape->canBlend(toShape))
+        return to;
+
+    return ShapeClipPathOperation::create(toShape->blend(fromShape, progress));
+}
+
+static inline PassRefPtr<ShapeValue> blendFunc(const AnimationBase*, ShapeValue* from, ShapeValue* to, double progress)
+{
+    // FIXME Bug 102723: Shape-inside should be able to animate a value of 'outside-shape' when shape-outside is set to a BasicShape
+    if (from->type() != ShapeValue::Shape || to->type() != ShapeValue::Shape)
+        return to;
+
+    const BasicShape* fromShape = from->shape();
+    const BasicShape* toShape = to->shape();
+
+    if (!fromShape->canBlend(toShape))
+        return to;
+
+    return ShapeValue::createShapeValue(toShape->blend(fromShape, progress));
+}
+
+static inline PassRefPtr<FilterOperation> blendFunc(const AnimationBase* anim, FilterOperation* fromOp, FilterOperation* toOp, double progress, bool blendToPassthrough = false)
+{
+    ASSERT(toOp);
+    return toOp->blend(fromOp, progress, blendToPassthrough);
+}
+
+static inline FilterOperations blendFunc(const AnimationBase* anim, const FilterOperations& from, const FilterOperations& to, double progress)
+{
+    FilterOperations result;
+
+    // If we have a filter function list, use that to do a per-function animation.
+    if (anim->filterFunctionListsMatch()) {
+        size_t fromSize = from.operations().size();
+        size_t toSize = to.operations().size();
+        size_t size = max(fromSize, toSize);
+        for (size_t i = 0; i < size; i++) {
+            RefPtr<FilterOperation> fromOp = (i < fromSize) ? from.operations()[i].get() : 0;
+            RefPtr<FilterOperation> toOp = (i < toSize) ? to.operations()[i].get() : 0;
+            RefPtr<FilterOperation> blendedOp = toOp ? blendFunc(anim, fromOp.get(), toOp.get(), progress) : (fromOp ? blendFunc(anim, 0, fromOp.get(), progress, true) : 0);
+            if (blendedOp)
+                result.operations().append(blendedOp);
+            else {
+                RefPtr<FilterOperation> identityOp = PassthroughFilterOperation::create();
+                if (progress > 0.5)
+                    result.operations().append(toOp ? toOp : identityOp);
+                else
+                    result.operations().append(fromOp ? fromOp : identityOp);
+            }
+        }
+    } else {
+        // If the filter function lists don't match, we could try to cross-fade, but don't yet have a way to represent that in CSS.
+        // For now we'll just fail to animate.
+        result = to;
+    }
+
+    return result;
+}
+
+static inline EVisibility blendFunc(const AnimationBase* anim, EVisibility from, EVisibility to, double progress)
+{
+    // Any non-zero result means we consider the object to be visible. Only at 0 do we consider the object to be
+    // invisible. The invisible value we use (HIDDEN vs. COLLAPSE) depends on the specified from/to values.
+    double fromVal = from == VISIBLE ? 1. : 0.;
+    double toVal = to == VISIBLE ? 1. : 0.;
+    if (fromVal == toVal)
+        return to;
+    double result = blendFunc(anim, fromVal, toVal, progress);
+    return result > 0. ? VISIBLE : (to != VISIBLE ? to : from);
+}
+
+static inline LengthBox blendFunc(const AnimationBase* anim, const LengthBox& from, const LengthBox& to, double progress)
+{
+    // Length types have to match to animate
+    if (from.top().type() != to.top().type()
+        || from.right().type() != to.right().type()
+        || from.bottom().type() != to.bottom().type()
+        || from.left().type() != to.left().type())
+        return to;
+
+    LengthBox result(blendFunc(anim, from.top(), to.top(), progress),
+                     blendFunc(anim, from.right(), to.right(), progress),
+                     blendFunc(anim, from.bottom(), to.bottom(), progress),
+                     blendFunc(anim, from.left(), to.left(), progress));
+    return result;
+}
+
+static inline SVGLength blendFunc(const AnimationBase*, const SVGLength& from, const SVGLength& to, double progress)
+{
+    return to.blend(from, narrowPrecisionToFloat(progress));
+}
+
+static inline Vector<SVGLength> blendFunc(const AnimationBase*, const Vector<SVGLength>& from, const Vector<SVGLength>& to, double progress)
+{
+    size_t fromLength = from.size();
+    size_t toLength = to.size();
+    if (!fromLength)
+        return !progress ? from : to;
+    if (!toLength)
+        return progress == 1 ? from : to;
+
+    size_t resultLength = fromLength;
+    if (fromLength != toLength) {
+        if (!(fromLength % toLength))
+            resultLength = fromLength;
+        else if (!(toLength % fromLength))
+            resultLength = toLength;
+        else
+            resultLength = fromLength * toLength;
+    }
+    Vector<SVGLength> result(resultLength);
+    for (size_t i = 0; i < resultLength; ++i)
+        result[i] = to[i % toLength].blend(from[i % fromLength], narrowPrecisionToFloat(progress));
+    return result;
+}
+
+static inline PassRefPtr<StyleImage> crossfadeBlend(const AnimationBase*, StyleFetchedImage* fromStyleImage, StyleFetchedImage* toStyleImage, double progress)
+{
+    // If progress is at one of the extremes, we want getComputedStyle to show the image,
+    // not a completed cross-fade, so we hand back one of the existing images.
+    if (!progress)
+        return fromStyleImage;
+    if (progress == 1)
+        return toStyleImage;
+
+    ImageResource* fromImageResource = static_cast<ImageResource*>(fromStyleImage->data());
+    ImageResource* toImageResource = static_cast<ImageResource*>(toStyleImage->data());
+
+    RefPtr<CSSImageValue> fromImageValue = CSSImageValue::create(fromImageResource->url(), fromStyleImage);
+    RefPtr<CSSImageValue> toImageValue = CSSImageValue::create(toImageResource->url(), toStyleImage);
+    RefPtr<CSSCrossfadeValue> crossfadeValue = CSSCrossfadeValue::create(fromImageValue, toImageValue);
+
+    crossfadeValue->setPercentage(CSSPrimitiveValue::create(progress, CSSPrimitiveValue::CSS_NUMBER));
+
+    return StyleGeneratedImage::create(crossfadeValue.get());
+}
+
+static inline PassRefPtr<StyleImage> blendFunc(const AnimationBase* anim, StyleImage* from, StyleImage* to, double progress)
+{
+    if (!from || !to)
+        return to;
+
+    if (from->isImageResource() && to->isImageResource())
+        return crossfadeBlend(anim, static_cast<StyleFetchedImage*>(from), static_cast<StyleFetchedImage*>(to), progress);
+
+    // FIXME: Support transitioning generated images as well. (gradients, etc.)
+
+    return to;
+}
+
+static inline NinePieceImage blendFunc(const AnimationBase* anim, const NinePieceImage& from, const NinePieceImage& to, double progress)
+{
+    if (!from.hasImage() || !to.hasImage())
+        return to;
+
+    // FIXME (74112): Support transitioning between NinePieceImages that differ by more than image content.
+
+    if (from.imageSlices() != to.imageSlices() || from.borderSlices() != to.borderSlices() || from.outset() != to.outset() || from.fill() != to.fill() || from.horizontalRule() != to.horizontalRule() || from.verticalRule() != to.verticalRule())
+        return to;
+
+    if (from.image()->imageSize(anim->renderer(), 1.0) != to.image()->imageSize(anim->renderer(), 1.0))
+        return to;
+
+    RefPtr<StyleImage> newContentImage = blendFunc(anim, from.image(), to.image(), progress);
+
+    return NinePieceImage(newContentImage, from.imageSlices(), from.fill(), from.borderSlices(), from.outset(), from.horizontalRule(), from.verticalRule());
+}
+
+class AnimationPropertyWrapperBase {
+    WTF_MAKE_NONCOPYABLE(AnimationPropertyWrapperBase);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    AnimationPropertyWrapperBase(CSSPropertyID prop)
+        : m_prop(prop)
+    {
+    }
+
+    virtual ~AnimationPropertyWrapperBase() { }
+
+    virtual bool isShorthandWrapper() const { return false; }
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const = 0;
+    virtual void blend(const AnimationBase*, RenderStyle*, const RenderStyle*, const RenderStyle*, double) const = 0;
+
+    CSSPropertyID property() const { return m_prop; }
+
+    virtual bool animationIsAccelerated() const { return false; }
+
+private:
+    CSSPropertyID m_prop;
+};
+
+static int gPropertyWrapperMap[numCSSProperties];
+static const int cInvalidPropertyWrapperIndex = -1;
+static Vector<AnimationPropertyWrapperBase*>* gPropertyWrappers = 0;
+
+static void addPropertyWrapper(CSSPropertyID propertyID, AnimationPropertyWrapperBase* wrapper)
+{
+    int propIndex = propertyID - firstCSSProperty;
+
+    ASSERT(gPropertyWrapperMap[propIndex] == cInvalidPropertyWrapperIndex);
+
+    unsigned wrapperIndex = gPropertyWrappers->size();
+    gPropertyWrappers->append(wrapper);
+    gPropertyWrapperMap[propIndex] = wrapperIndex;
+}
+
+static AnimationPropertyWrapperBase* wrapperForProperty(CSSPropertyID propertyID)
+{
+    int propIndex = propertyID - firstCSSProperty;
+    if (propIndex >= 0 && propIndex < numCSSProperties) {
+        int wrapperIndex = gPropertyWrapperMap[propIndex];
+        if (wrapperIndex >= 0)
+            return (*gPropertyWrappers)[wrapperIndex];
+    }
+    return 0;
+}
+
+template <typename T>
+class PropertyWrapperGetter : public AnimationPropertyWrapperBase {
+public:
+    PropertyWrapperGetter(CSSPropertyID prop, T (RenderStyle::*getter)() const)
+        : AnimationPropertyWrapperBase(prop)
+        , m_getter(getter)
+    {
+    }
+
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+        // If the style pointers are the same, don't bother doing the test.
+        // If either is null, return false. If both are null, return true.
+        if ((!a && !b) || a == b)
+            return true;
+        if (!a || !b)
+            return false;
+        return (a->*m_getter)() == (b->*m_getter)();
+    }
+
+protected:
+    T (RenderStyle::*m_getter)() const;
+};
+
+template <typename T>
+class PropertyWrapper : public PropertyWrapperGetter<T> {
+public:
+    PropertyWrapper(CSSPropertyID prop, T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T))
+        : PropertyWrapperGetter<T>(prop, getter)
+        , m_setter(setter)
+    {
+    }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<T>::m_getter)(), (b->*PropertyWrapperGetter<T>::m_getter)(), progress));
+    }
+
+protected:
+    void (RenderStyle::*m_setter)(T);
+};
+
+template <typename T>
+class RefCountedPropertyWrapper : public PropertyWrapperGetter<T*> {
+public:
+    RefCountedPropertyWrapper(CSSPropertyID prop, T* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<T>))
+        : PropertyWrapperGetter<T*>(prop, getter)
+        , m_setter(setter)
+    {
+    }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<T*>::m_getter)(), (b->*PropertyWrapperGetter<T*>::m_getter)(), progress));
+    }
+
+protected:
+    void (RenderStyle::*m_setter)(PassRefPtr<T>);
+};
+
+
+class PropertyWrapperClipPath : public RefCountedPropertyWrapper<ClipPathOperation> {
+public:
+    PropertyWrapperClipPath(CSSPropertyID prop, ClipPathOperation* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<ClipPathOperation>))
+        : RefCountedPropertyWrapper<ClipPathOperation>(prop, getter, setter)
+    {
+    }
+};
+
+class PropertyWrapperShape : public RefCountedPropertyWrapper<ShapeValue> {
+public:
+    PropertyWrapperShape(CSSPropertyID prop, ShapeValue* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<ShapeValue>))
+        : RefCountedPropertyWrapper<ShapeValue>(prop, getter, setter)
+    {
+    }
+};
+
+class StyleImagePropertyWrapper : public RefCountedPropertyWrapper<StyleImage> {
+public:
+    StyleImagePropertyWrapper(CSSPropertyID prop, StyleImage* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<StyleImage>))
+        : RefCountedPropertyWrapper<StyleImage>(prop, getter, setter)
+    {
+    }
+
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+       // If the style pointers are the same, don't bother doing the test.
+       // If either is null, return false. If both are null, return true.
+       if (a == b)
+           return true;
+       if (!a || !b)
+            return false;
+
+        StyleImage* imageA = (a->*m_getter)();
+        StyleImage* imageB = (b->*m_getter)();
+        return StyleImage::imagesEquivalent(imageA, imageB);
+    }
+};
+
+class PropertyWrapperColor : public PropertyWrapperGetter<Color> {
+public:
+    PropertyWrapperColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+        : PropertyWrapperGetter<Color>(prop, getter)
+        , m_setter(setter)
+    {
+    }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<Color>::m_getter)(), (b->*PropertyWrapperGetter<Color>::m_getter)(), progress));
+    }
+
+protected:
+    void (RenderStyle::*m_setter)(const Color&);
+};
+
+class PropertyWrapperAcceleratedOpacity : public PropertyWrapper<float> {
+public:
+    PropertyWrapperAcceleratedOpacity()
+        : PropertyWrapper<float>(CSSPropertyOpacity, &RenderStyle::opacity, &RenderStyle::setOpacity)
+    {
+    }
+
+    virtual bool animationIsAccelerated() const { return true; }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        float fromOpacity = a->opacity();
+
+        // This makes sure we put the object being animated into a RenderLayer during the animation
+        dst->setOpacity(blendFunc(anim, (fromOpacity == 1) ? 0.999999f : fromOpacity, b->opacity(), progress));
+    }
+};
+
+class PropertyWrapperAcceleratedTransform : public PropertyWrapper<const TransformOperations&> {
+public:
+    PropertyWrapperAcceleratedTransform()
+        : PropertyWrapper<const TransformOperations&>(CSSPropertyWebkitTransform, &RenderStyle::transform, &RenderStyle::setTransform)
+    {
+    }
+
+    virtual bool animationIsAccelerated() const { return true; }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        dst->setTransform(blendFunc(anim, a->transform(), b->transform(), progress));
+    }
+};
+
+class PropertyWrapperAcceleratedFilter : public PropertyWrapper<const FilterOperations&> {
+public:
+    PropertyWrapperAcceleratedFilter()
+        : PropertyWrapper<const FilterOperations&>(CSSPropertyWebkitFilter, &RenderStyle::filter, &RenderStyle::setFilter)
+    {
+    }
+
+    virtual bool animationIsAccelerated() const { return true; }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        dst->setFilter(blendFunc(anim, a->filter(), b->filter(), progress));
+    }
+};
+
+static inline size_t shadowListLength(const ShadowData* shadow)
+{
+    size_t count;
+    for (count = 0; shadow; shadow = shadow->next())
+        ++count;
+    return count;
+}
+
+static inline const ShadowData* shadowForBlending(const ShadowData* srcShadow, const ShadowData* otherShadow)
+{
+    DEFINE_STATIC_LOCAL(OwnPtr<ShadowData>, defaultShadowData, (ShadowData::create(IntPoint(), 0, 0, Normal, Color::transparent)));
+    DEFINE_STATIC_LOCAL(OwnPtr<ShadowData>, defaultInsetShadowData, (ShadowData::create(IntPoint(), 0, 0, Inset, Color::transparent)));
+
+    if (srcShadow)
+        return srcShadow;
+
+    if (otherShadow->style() == Inset)
+        return defaultInsetShadowData.get();
+
+    return defaultShadowData.get();
+}
+
+class PropertyWrapperShadow : public AnimationPropertyWrapperBase {
+public:
+    PropertyWrapperShadow(CSSPropertyID prop, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassOwnPtr<ShadowData>, bool))
+        : AnimationPropertyWrapperBase(prop)
+        , m_getter(getter)
+        , m_setter(setter)
+    {
+    }
+
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+        const ShadowData* shadowA = (a->*m_getter)();
+        const ShadowData* shadowB = (b->*m_getter)();
+
+        while (true) {
+            // end of both lists
+            if (!shadowA && !shadowB)
+                return true;
+
+            // end of just one of the lists
+            if (!shadowA || !shadowB)
+                return false;
+
+            if (*shadowA != *shadowB)
+                return false;
+
+            shadowA = shadowA->next();
+            shadowB = shadowB->next();
+        }
+
+        return true;
+    }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        const ShadowData* shadowA = (a->*m_getter)();
+        const ShadowData* shadowB = (b->*m_getter)();
+
+        int fromLength = shadowListLength(shadowA);
+        int toLength = shadowListLength(shadowB);
+
+        if (fromLength == toLength || (fromLength <= 1 && toLength <= 1)) {
+            (dst->*m_setter)(blendSimpleOrMatchedShadowLists(anim, progress, shadowA, shadowB), false);
+            return;
+        }
+
+        (dst->*m_setter)(blendMismatchedShadowLists(anim, progress, shadowA, shadowB, fromLength, toLength), false);
+    }
+
+private:
+    PassOwnPtr<ShadowData> blendSimpleOrMatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB) const
+    {
+        OwnPtr<ShadowData> newShadowData;
+        ShadowData* lastShadow = 0;
+
+        while (shadowA || shadowB) {
+            const ShadowData* srcShadow = shadowForBlending(shadowA, shadowB);
+            const ShadowData* dstShadow = shadowForBlending(shadowB, shadowA);
+
+            OwnPtr<ShadowData> blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress);
+            ShadowData* blendedShadowPtr = blendedShadow.get();
+
+            if (!lastShadow)
+                newShadowData = blendedShadow.release();
+            else
+                lastShadow->setNext(blendedShadow.release());
+
+            lastShadow = blendedShadowPtr;
+
+            shadowA = shadowA ? shadowA->next() : 0;
+            shadowB = shadowB ? shadowB->next() : 0;
+        }
+
+        return newShadowData.release();
+    }
+
+    PassOwnPtr<ShadowData> blendMismatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB, int fromLength, int toLength) const
+    {
+        // The shadows in ShadowData are stored in reverse order, so when animating mismatched lists,
+        // reverse them and match from the end.
+        Vector<const ShadowData*, 4> fromShadows(fromLength);
+        for (int i = fromLength - 1; i >= 0; --i) {
+            fromShadows[i] = shadowA;
+            shadowA = shadowA->next();
+        }
+
+        Vector<const ShadowData*, 4> toShadows(toLength);
+        for (int i = toLength - 1; i >= 0; --i) {
+            toShadows[i] = shadowB;
+            shadowB = shadowB->next();
+        }
+
+        OwnPtr<ShadowData> newShadowData;
+
+        int maxLength = max(fromLength, toLength);
+        for (int i = 0; i < maxLength; ++i) {
+            const ShadowData* fromShadow = i < fromLength ? fromShadows[i] : 0;
+            const ShadowData* toShadow = i < toLength ? toShadows[i] : 0;
+
+            const ShadowData* srcShadow = shadowForBlending(fromShadow, toShadow);
+            const ShadowData* dstShadow = shadowForBlending(toShadow, fromShadow);
+
+            OwnPtr<ShadowData> blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress);
+            // Insert at the start of the list to preserve the order.
+            blendedShadow->setNext(newShadowData.release());
+            newShadowData = blendedShadow.release();
+        }
+
+        return newShadowData.release();
+    }
+
+    const ShadowData* (RenderStyle::*m_getter)() const;
+    void (RenderStyle::*m_setter)(PassOwnPtr<ShadowData>, bool);
+};
+
+class PropertyWrapperMaybeInvalidColor : public AnimationPropertyWrapperBase {
+public:
+    PropertyWrapperMaybeInvalidColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+        : AnimationPropertyWrapperBase(prop)
+        , m_getter(getter)
+        , m_setter(setter)
+    {
+    }
+
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+        Color fromColor = (a->*m_getter)();
+        Color toColor = (b->*m_getter)();
+
+        if (!fromColor.isValid() && !toColor.isValid())
+            return true;
+
+        if (!fromColor.isValid())
+            fromColor = a->color();
+        if (!toColor.isValid())
+            toColor = b->color();
+
+        return fromColor == toColor;
+    }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        Color fromColor = (a->*m_getter)();
+        Color toColor = (b->*m_getter)();
+
+        if (!fromColor.isValid() && !toColor.isValid())
+            return;
+
+        if (!fromColor.isValid())
+            fromColor = a->color();
+        if (!toColor.isValid())
+            toColor = b->color();
+        (dst->*m_setter)(blendFunc(anim, fromColor, toColor, progress));
+    }
+
+private:
+    Color (RenderStyle::*m_getter)() const;
+    void (RenderStyle::*m_setter)(const Color&);
+};
+
+
+enum MaybeInvalidColorTag { MaybeInvalidColor };
+class PropertyWrapperVisitedAffectedColor : public AnimationPropertyWrapperBase {
+public:
+    PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
+        Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
+        : AnimationPropertyWrapperBase(prop)
+        , m_wrapper(adoptPtr(new PropertyWrapperColor(prop, getter, setter)))
+        , m_visitedWrapper(adoptPtr(new PropertyWrapperColor(prop, visitedGetter, visitedSetter)))
+    {
+    }
+    PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, MaybeInvalidColorTag, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
+        Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
+        : AnimationPropertyWrapperBase(prop)
+        , m_wrapper(adoptPtr(new PropertyWrapperMaybeInvalidColor(prop, getter, setter)))
+        , m_visitedWrapper(adoptPtr(new PropertyWrapperMaybeInvalidColor(prop, visitedGetter, visitedSetter)))
+    {
+    }
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+        return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
+    }
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        m_wrapper->blend(anim, dst, a, b, progress);
+        m_visitedWrapper->blend(anim, dst, a, b, progress);
+    }
+
+private:
+    OwnPtr<AnimationPropertyWrapperBase> m_wrapper;
+    OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper;
+};
+
+// Wrapper base class for an animatable property in a FillLayer
+class FillLayerAnimationPropertyWrapperBase {
+public:
+    FillLayerAnimationPropertyWrapperBase()
+    {
+    }
+
+    virtual ~FillLayerAnimationPropertyWrapperBase() { }
+
+    virtual bool equals(const FillLayer*, const FillLayer*) const = 0;
+    virtual void blend(const AnimationBase*, FillLayer*, const FillLayer*, const FillLayer*, double) const = 0;
+};
+
+template <typename T>
+class FillLayerPropertyWrapperGetter : public FillLayerAnimationPropertyWrapperBase {
+    WTF_MAKE_NONCOPYABLE(FillLayerPropertyWrapperGetter);
+public:
+    FillLayerPropertyWrapperGetter(T (FillLayer::*getter)() const)
+        : m_getter(getter)
+    {
+    }
+
+    virtual bool equals(const FillLayer* a, const FillLayer* b) const
+    {
+       // If the style pointers are the same, don't bother doing the test.
+       // If either is null, return false. If both are null, return true.
+       if ((!a && !b) || a == b)
+           return true;
+       if (!a || !b)
+            return false;
+        return (a->*m_getter)() == (b->*m_getter)();
+    }
+
+protected:
+    T (FillLayer::*m_getter)() const;
+};
+
+template <typename T>
+class FillLayerPropertyWrapper : public FillLayerPropertyWrapperGetter<T> {
+public:
+    FillLayerPropertyWrapper(T (FillLayer::*getter)() const, void (FillLayer::*setter)(T))
+        : FillLayerPropertyWrapperGetter<T>(getter)
+        , m_setter(setter)
+    {
+    }
+
+    virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const
+    {
+        (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<T>::m_getter)(), progress));
+    }
+
+protected:
+    void (FillLayer::*m_setter)(T);
+};
+
+template <typename T>
+class FillLayerRefCountedPropertyWrapper : public FillLayerPropertyWrapperGetter<T*> {
+public:
+    FillLayerRefCountedPropertyWrapper(T* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<T>))
+        : FillLayerPropertyWrapperGetter<T*>(getter)
+        , m_setter(setter)
+    {
+    }
+
+    virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const
+    {
+        (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T*>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<T*>::m_getter)(), progress));
+    }
+
+protected:
+    void (FillLayer::*m_setter)(PassRefPtr<T>);
+};
+
+class FillLayerStyleImagePropertyWrapper : public FillLayerRefCountedPropertyWrapper<StyleImage> {
+public:
+    FillLayerStyleImagePropertyWrapper(StyleImage* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<StyleImage>))
+        : FillLayerRefCountedPropertyWrapper<StyleImage>(getter, setter)
+    {
+    }
+
+    virtual bool equals(const FillLayer* a, const FillLayer* b) const
+    {
+       // If the style pointers are the same, don't bother doing the test.
+       // If either is null, return false. If both are null, return true.
+       if (a == b)
+           return true;
+       if (!a || !b)
+            return false;
+
+        StyleImage* imageA = (a->*m_getter)();
+        StyleImage* imageB = (b->*m_getter)();
+        return StyleImage::imagesEquivalent(imageA, imageB);
+    }
+};
+
+
+class FillLayersPropertyWrapper : public AnimationPropertyWrapperBase {
+public:
+    typedef const FillLayer* (RenderStyle::*LayersGetter)() const;
+    typedef FillLayer* (RenderStyle::*LayersAccessor)();
+
+    FillLayersPropertyWrapper(CSSPropertyID prop, LayersGetter getter, LayersAccessor accessor)
+        : AnimationPropertyWrapperBase(prop)
+        , m_layersGetter(getter)
+        , m_layersAccessor(accessor)
+    {
+        switch (prop) {
+        case CSSPropertyBackgroundPositionX:
+        case CSSPropertyWebkitMaskPositionX:
+            m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&FillLayer::xPosition, &FillLayer::setXPosition);
+            break;
+        case CSSPropertyBackgroundPositionY:
+        case CSSPropertyWebkitMaskPositionY:
+            m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&FillLayer::yPosition, &FillLayer::setYPosition);
+            break;
+        case CSSPropertyBackgroundSize:
+        case CSSPropertyWebkitBackgroundSize:
+        case CSSPropertyWebkitMaskSize:
+            m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize>(&FillLayer::sizeLength, &FillLayer::setSizeLength);
+            break;
+        case CSSPropertyBackgroundImage:
+            m_fillLayerPropertyWrapper = new FillLayerStyleImagePropertyWrapper(&FillLayer::image, &FillLayer::setImage);
+            break;
+        default:
+            break;
+        }
+    }
+
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+        const FillLayer* fromLayer = (a->*m_layersGetter)();
+        const FillLayer* toLayer = (b->*m_layersGetter)();
+
+        while (fromLayer && toLayer) {
+            if (!m_fillLayerPropertyWrapper->equals(fromLayer, toLayer))
+                return false;
+
+            fromLayer = fromLayer->next();
+            toLayer = toLayer->next();
+        }
+
+        return true;
+    }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        const FillLayer* aLayer = (a->*m_layersGetter)();
+        const FillLayer* bLayer = (b->*m_layersGetter)();
+        FillLayer* dstLayer = (dst->*m_layersAccessor)();
+
+        while (aLayer && bLayer && dstLayer) {
+            m_fillLayerPropertyWrapper->blend(anim, dstLayer, aLayer, bLayer, progress);
+            aLayer = aLayer->next();
+            bLayer = bLayer->next();
+            dstLayer = dstLayer->next();
+        }
+    }
+
+private:
+    FillLayerAnimationPropertyWrapperBase* m_fillLayerPropertyWrapper;
+
+    LayersGetter m_layersGetter;
+    LayersAccessor m_layersAccessor;
+};
+
+class ShorthandPropertyWrapper : public AnimationPropertyWrapperBase {
+public:
+    ShorthandPropertyWrapper(CSSPropertyID property, const StylePropertyShorthand& shorthand)
+        : AnimationPropertyWrapperBase(property)
+    {
+        for (unsigned i = 0; i < shorthand.length(); ++i) {
+            AnimationPropertyWrapperBase* wrapper = wrapperForProperty(shorthand.properties()[i]);
+            if (wrapper)
+                m_propertyWrappers.append(wrapper);
+        }
+    }
+
+    virtual bool isShorthandWrapper() const { return true; }
+
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+        Vector<AnimationPropertyWrapperBase*>::const_iterator end = m_propertyWrappers.end();
+        for (Vector<AnimationPropertyWrapperBase*>::const_iterator it = m_propertyWrappers.begin(); it != end; ++it) {
+            if (!(*it)->equals(a, b))
+                return false;
+        }
+        return true;
+    }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        Vector<AnimationPropertyWrapperBase*>::const_iterator end = m_propertyWrappers.end();
+        for (Vector<AnimationPropertyWrapperBase*>::const_iterator it = m_propertyWrappers.begin(); it != end; ++it)
+            (*it)->blend(anim, dst, a, b, progress);
+    }
+
+    const Vector<AnimationPropertyWrapperBase*> propertyWrappers() const { return m_propertyWrappers; }
+
+private:
+    Vector<AnimationPropertyWrapperBase*> m_propertyWrappers;
+};
+
+class PropertyWrapperFlex : public AnimationPropertyWrapperBase {
+public:
+    PropertyWrapperFlex()
+        : AnimationPropertyWrapperBase(CSSPropertyFlex)
+    {
+    }
+
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+        // If the style pointers are the same, don't bother doing the test.
+        // If either is null, return false. If both are null, return true.
+        if ((!a && !b) || a == b)
+            return true;
+        if (!a || !b)
+            return false;
+
+        return a->flexBasis() == b->flexBasis() && a->flexGrow() == b->flexGrow() && a->flexShrink() == b->flexShrink();
+    }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        dst->setFlexBasis(blendFunc(anim, a->flexBasis(), b->flexBasis(), progress));
+        dst->setFlexGrow(blendFunc(anim, a->flexGrow(), b->flexGrow(), progress));
+        dst->setFlexShrink(blendFunc(anim, a->flexShrink(), b->flexShrink(), progress));
+    }
+};
+
+class PropertyWrapperSVGPaint : public AnimationPropertyWrapperBase {
+public:
+    PropertyWrapperSVGPaint(CSSPropertyID prop, const SVGPaint::SVGPaintType& (RenderStyle::*paintTypeGetter)() const, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+        : AnimationPropertyWrapperBase(prop)
+        , m_paintTypeGetter(paintTypeGetter)
+        , m_getter(getter)
+        , m_setter(setter)
+    {
+    }
+
+    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
+    {
+        if ((a->*m_paintTypeGetter)() != (b->*m_paintTypeGetter)())
+            return false;
+
+        // We only support animations between SVGPaints that are pure Color values.
+        // For everything else we must return true for this method, otherwise
+        // we will try to animate between values forever.
+        if ((a->*m_paintTypeGetter)() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR) {
+            Color fromColor = (a->*m_getter)();
+            Color toColor = (b->*m_getter)();
+
+            if (!fromColor.isValid() && !toColor.isValid())
+                return true;
+
+            if (!fromColor.isValid())
+                fromColor = Color();
+            if (!toColor.isValid())
+                toColor = Color();
+
+            return fromColor == toColor;
+        }
+        return true;
+    }
+
+    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
+    {
+        if ((a->*m_paintTypeGetter)() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR
+            || (b->*m_paintTypeGetter)() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR)
+            return;
+
+        Color fromColor = (a->*m_getter)();
+        Color toColor = (b->*m_getter)();
+
+        if (!fromColor.isValid() && !toColor.isValid())
+            return;
+
+        if (!fromColor.isValid())
+            fromColor = Color();
+        if (!toColor.isValid())
+            toColor = Color();
+        (dst->*m_setter)(blendFunc(anim, fromColor, toColor, progress));
+    }
+
+private:
+    const SVGPaint::SVGPaintType& (RenderStyle::*m_paintTypeGetter)() const;
+    Color (RenderStyle::*m_getter)() const;
+    void (RenderStyle::*m_setter)(const Color&);
+};
+
+static void addShorthandProperties()
+{
+    static const CSSPropertyID animatableShorthandProperties[] = {
+        CSSPropertyBackground, // for background-color, background-position, background-image
+        CSSPropertyBackgroundPosition,
+        CSSPropertyFont, // for font-size, font-weight
+        CSSPropertyWebkitMask, // for mask-position
+        CSSPropertyWebkitMaskPosition,
+        CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft,
+        CSSPropertyBorderColor,
+        CSSPropertyBorderRadius,
+        CSSPropertyBorderWidth,
+        CSSPropertyBorder,
+        CSSPropertyBorderImage,
+        CSSPropertyBorderSpacing,
+        CSSPropertyListStyle, // for list-style-image
+        CSSPropertyMargin,
+        CSSPropertyOutline,
+        CSSPropertyPadding,
+        CSSPropertyWebkitTextStroke,
+        CSSPropertyWebkitColumnRule,
+        CSSPropertyWebkitBorderRadius,
+        CSSPropertyWebkitTransformOrigin
+    };
+
+    for (size_t i = 0; i < WTF_ARRAY_LENGTH(animatableShorthandProperties); ++i) {
+        CSSPropertyID propertyID = animatableShorthandProperties[i];
+        StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
+        if (shorthand.length() > 0)
+            addPropertyWrapper(propertyID, new ShorthandPropertyWrapper(propertyID, shorthand));
+    }
+}
+
+void CSSPropertyAnimation::ensurePropertyMap()
+{
+    // FIXME: This data is never destroyed. Maybe we should ref count it and toss it when the last AnimationController is destroyed?
+    if (gPropertyWrappers)
+        return;
+
+    gPropertyWrappers = new Vector<AnimationPropertyWrapperBase*>();
+
+    // build the list of property wrappers to do the comparisons and blends
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLeft, &RenderStyle::left, &RenderStyle::setLeft));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyRight, &RenderStyle::right, &RenderStyle::setRight));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTop, &RenderStyle::top, &RenderStyle::setTop));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyBottom, &RenderStyle::bottom, &RenderStyle::setBottom));
+
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWidth, &RenderStyle::width, &RenderStyle::setWidth));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinWidth, &RenderStyle::minWidth, &RenderStyle::setMinWidth));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxWidth, &RenderStyle::maxWidth, &RenderStyle::setMaxWidth));
+
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyHeight, &RenderStyle::height, &RenderStyle::setHeight));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinHeight, &RenderStyle::minHeight, &RenderStyle::setMinHeight));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxHeight, &RenderStyle::maxHeight, &RenderStyle::setMaxHeight));
+
+    gPropertyWrappers->append(new PropertyWrapperFlex());
+
+    gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderLeftWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth));
+    gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderRightWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth));
+    gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderTopWidth, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth));
+    gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderBottomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft, &RenderStyle::setMarginLeft));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginRight, &RenderStyle::marginRight, &RenderStyle::setMarginRight));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginTop, &RenderStyle::marginTop, &RenderStyle::setMarginTop));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginBottom, &RenderStyle::marginBottom, &RenderStyle::setMarginBottom));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingLeft, &RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingRight, &RenderStyle::paddingRight, &RenderStyle::setPaddingRight));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom));
+    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkColor, &RenderStyle::setVisitedLinkColor));
+
+    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::visitedLinkBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor));
+
+    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundImage, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
+    gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyListStyleImage, &RenderStyle::listStyleImage, &RenderStyle::setListStyleImage));
+    gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMaskImage, &RenderStyle::maskImage, &RenderStyle::setMaskImage));
+
+    gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource));
+    gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderImageSlice, &RenderStyle::borderImageSlices, &RenderStyle::setBorderImageSlices));
+    gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderImageWidth, &RenderStyle::borderImageWidth, &RenderStyle::setBorderImageWidth));
+    gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderImageOutset, &RenderStyle::borderImageOutset, &RenderStyle::setBorderImageOutset));
+
+    gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource));
+    gPropertyWrappers->append(new PropertyWrapper<const NinePieceImage&>(CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage));
+
+    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
+    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
+    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
+    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
+
+    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
+    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
+    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskSize, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
+
+    gPropertyWrappers->append(new PropertyWrapper<LengthPoint>(CSSPropertyObjectPosition, &RenderStyle::objectPosition, &RenderStyle::setObjectPosition));
+
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFontSize,
+        // Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size
+        // if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same).
+        // FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to
+        // enable text zoom rather than Text Autosizing? See http://crbug.com/227545.
+        &RenderStyle::specifiedFontSize,
+        &RenderStyle::setFontSize));
+    gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWebkitColumnRuleWidth, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth));
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumnGap, &RenderStyle::columnGap, &RenderStyle::setColumnGap));
+    gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWebkitColumnCount, &RenderStyle::columnCount, &RenderStyle::setColumnCount));
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumnWidth, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth));
+    gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorderHorizontalSpacing, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing));
+    gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorderVerticalSpacing, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing));
+    gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyZIndex, &RenderStyle::zIndex, &RenderStyle::setZIndex));
+    gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyOrphans, &RenderStyle::orphans, &RenderStyle::setOrphans));
+    gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWidows, &RenderStyle::widows, &RenderStyle::setWidows));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight, &RenderStyle::setLineHeight));
+    gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset));
+    gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyOutlineWidth, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth));
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyLetterSpacing, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing));
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTextIndent, &RenderStyle::textIndent, &RenderStyle::setTextIndent));
+
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitPerspective, &RenderStyle::perspective, &RenderStyle::setPerspective));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPerspectiveOriginX, &RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPerspectiveOriginY, &RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTransformOriginX, &RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX));
+    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTransformOriginY, &RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY));
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitTransformOriginZ, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ));
+    gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderTopLeftRadius, &RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius));
+    gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderTopRightRadius, &RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius));
+    gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderBottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius));
+    gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius));
+    gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibility, &RenderStyle::visibility, &RenderStyle::setVisibility));
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoomWithoutReturnValue));
+
+    gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip));
+
+    gPropertyWrappers->append(new PropertyWrapperAcceleratedOpacity());
+    gPropertyWrappers->append(new PropertyWrapperAcceleratedTransform());
+    gPropertyWrappers->append(new PropertyWrapperAcceleratedFilter());
+
+    gPropertyWrappers->append(new PropertyWrapperClipPath(CSSPropertyWebkitClipPath, &RenderStyle::clipPath, &RenderStyle::setClipPath));
+
+    gPropertyWrappers->append(new PropertyWrapperShape(CSSPropertyWebkitShapeInside, &RenderStyle::shapeInside, &RenderStyle::setShapeInside));
+
+    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitColumnRuleColor, MaybeInvalidColor, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::visitedLinkColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor));
+    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitTextStrokeColor, MaybeInvalidColor, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::visitedLinkTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor));
+    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderLeftColor, MaybeInvalidColor, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::visitedLinkBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor));
+    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderRightColor, MaybeInvalidColor, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::visitedLinkBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor));
+    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderTopColor, MaybeInvalidColor, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::visitedLinkBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor));
+    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderBottomColor, MaybeInvalidColor, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::visitedLinkBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor));
+    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyOutlineColor, MaybeInvalidColor, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::visitedLinkOutlineColor, &RenderStyle::setVisitedLinkOutlineColor));
+
+    gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyBoxShadow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow));
+    gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyWebkitBoxShadow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow));
+    gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyTextShadow, &RenderStyle::textShadow, &RenderStyle::setTextShadow));
+
+    gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyFill, &RenderStyle::fillPaintType, &RenderStyle::fillPaintColor, &RenderStyle::setFillPaintColor));
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFillOpacity, &RenderStyle::fillOpacity, &RenderStyle::setFillOpacity));
+
+    gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyStroke, &RenderStyle::strokePaintType, &RenderStyle::strokePaintColor, &RenderStyle::setStrokePaintColor));
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeOpacity, &RenderStyle::strokeOpacity, &RenderStyle::setStrokeOpacity));
+    gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyStrokeWidth, &RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth));
+    gPropertyWrappers->append(new PropertyWrapper< Vector<SVGLength> >(CSSPropertyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStrokeDashArray));
+    gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyStrokeDashoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashOffset));
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeMiterlimit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit));
+
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFloodOpacity, &RenderStyle::floodOpacity, &RenderStyle::setFloodOpacity));
+    gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyFloodColor, &RenderStyle::floodColor, &RenderStyle::setFloodColor));
+
+    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStopOpacity, &RenderStyle::stopOpacity, &RenderStyle::setStopOpacity));
+    gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyStopColor, &RenderStyle::stopColor, &RenderStyle::setStopColor));
+
+    gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyLightingColor, &RenderStyle::lightingColor, &RenderStyle::setLightingColor));
+
+    gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyBaselineShift, &RenderStyle::baselineShiftValue, &RenderStyle::setBaselineShiftValue));
+    gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyKerning, &RenderStyle::kerning, &RenderStyle::setKerning));
+
+    // TODO:
+    //
+    //  CSSPropertyVerticalAlign
+    //
+    // Compound properties that have components that should be animatable:
+    //
+    //  CSSPropertyWebkitColumns
+    //  CSSPropertyWebkitBoxReflect
+
+    // Make sure unused slots have a value
+    for (unsigned int i = 0; i < static_cast<unsigned int>(numCSSProperties); ++i)
+        gPropertyWrapperMap[i] = cInvalidPropertyWrapperIndex;
+
+    // First we put the non-shorthand property wrappers into the map, so the shorthand-building
+    // code can find them.
+    size_t n = gPropertyWrappers->size();
+    for (unsigned int i = 0; i < n; ++i) {
+        CSSPropertyID property = (*gPropertyWrappers)[i]->property();
+        ASSERT_WITH_MESSAGE(CSSAnimations::isAnimatableProperty(property), "%s is not whitelisted for animation", getPropertyNameString(property).utf8().data());
+        ASSERT(property - firstCSSProperty < numCSSProperties);
+        gPropertyWrapperMap[property - firstCSSProperty] = i;
+    }
+
+    // Now add the shorthand wrappers.
+    addShorthandProperties();
+}
+
+// Returns true if we need to start animation timers
+bool CSSPropertyAnimation::blendProperties(const AnimationBase* anim, CSSPropertyID prop, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress)
+{
+    ASSERT(prop != CSSPropertyInvalid);
+
+    ensurePropertyMap();
+
+    AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop);
+    if (wrapper) {
+        wrapper->blend(anim, dst, a, b, progress);
+        return !wrapper->animationIsAccelerated() || !anim->isAccelerated();
+    }
+
+    return false;
+}
+
+bool CSSPropertyAnimation::animationOfPropertyIsAccelerated(CSSPropertyID prop)
+{
+    ensurePropertyMap();
+    AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop);
+    return wrapper ? wrapper->animationIsAccelerated() : false;
+}
+
+bool CSSPropertyAnimation::propertiesEqual(CSSPropertyID prop, const RenderStyle* a, const RenderStyle* b)
+{
+    ensurePropertyMap();
+
+    AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop);
+    if (wrapper)
+        return wrapper->equals(a, b);
+    return true;
+}
+
+CSSPropertyID CSSPropertyAnimation::getPropertyAtIndex(int i, bool& isShorthand)
+{
+    ensurePropertyMap();
+
+    if (i < 0 || i >= getNumProperties())
+        return CSSPropertyInvalid;
+
+    AnimationPropertyWrapperBase* wrapper = (*gPropertyWrappers)[i];
+    isShorthand = wrapper->isShorthandWrapper();
+    return wrapper->property();
+}
+
+int CSSPropertyAnimation::getNumProperties()
+{
+    ensurePropertyMap();
+
+    return gPropertyWrappers->size();
+}
+
+}
diff --git a/Source/core/page/animation/CSSPropertyAnimation.h b/Source/core/frame/animation/CSSPropertyAnimation.h
similarity index 100%
rename from Source/core/page/animation/CSSPropertyAnimation.h
rename to Source/core/frame/animation/CSSPropertyAnimation.h
diff --git a/Source/core/frame/animation/CompositeAnimation.cpp b/Source/core/frame/animation/CompositeAnimation.cpp
new file mode 100644
index 0000000..2afc42d
--- /dev/null
+++ b/Source/core/frame/animation/CompositeAnimation.cpp
@@ -0,0 +1,562 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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/frame/animation/CompositeAnimation.h"
+
+#include "CSSPropertyNames.h"
+#include "core/frame/animation/AnimationControllerPrivate.h"
+#include "core/frame/animation/CSSPropertyAnimation.h"
+#include "core/frame/animation/ImplicitAnimation.h"
+#include "core/frame/animation/KeyframeAnimation.h"
+#include "core/rendering/style/RenderStyle.h"
+
+namespace WebCore {
+
+CompositeAnimation::~CompositeAnimation()
+{
+    // Toss the refs to all animations, but make sure we remove them from
+    // any waiting lists first.
+
+    clearRenderer();
+    m_transitions.clear();
+    m_keyframeAnimations.clear();
+}
+
+void CompositeAnimation::clearRenderer()
+{
+    if (!m_transitions.isEmpty()) {
+        // Clear the renderers from all running animations, in case we are in the middle of
+        // an animation callback (see https://bugs.webkit.org/show_bug.cgi?id=22052)
+        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
+        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
+            ImplicitAnimation* transition = it->value.get();
+            animationController()->animationWillBeRemoved(transition);
+            transition->clear();
+        }
+    }
+    if (!m_keyframeAnimations.isEmpty()) {
+        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
+        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
+            KeyframeAnimation* anim = it->value.get();
+            animationController()->animationWillBeRemoved(anim);
+            anim->clear();
+        }
+    }
+}
+
+void CompositeAnimation::updateTransitions(RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle)
+{
+    // If currentStyle is null or there are no old or new transitions, just skip it
+    if (!currentStyle || (!targetStyle->transitions() && m_transitions.isEmpty()))
+        return;
+
+    // Mark all existing transitions as no longer active. We will mark the still active ones
+    // in the next loop and then toss the ones that didn't get marked.
+    CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
+    for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it)
+        it->value->setActive(false);
+
+    RefPtr<RenderStyle> modifiedCurrentStyle;
+
+    // Check to see if we need to update the active transitions
+    if (targetStyle->transitions()) {
+        for (size_t i = 0; i < targetStyle->transitions()->size(); ++i) {
+            const CSSAnimationData* anim = targetStyle->transitions()->animation(i);
+            bool isActiveTransition = anim->duration() || anim->delay() > 0;
+
+            CSSAnimationData::AnimationMode mode = anim->animationMode();
+            if (mode == CSSAnimationData::AnimateNone)
+                continue;
+
+            CSSPropertyID prop = anim->property();
+
+            bool all = mode == CSSAnimationData::AnimateAll;
+
+            // Handle both the 'all' and single property cases. For the single prop case, we make only one pass
+            // through the loop.
+            for (int propertyIndex = 0; propertyIndex < CSSPropertyAnimation::getNumProperties(); ++propertyIndex) {
+                if (all) {
+                    // Get the next property which is not a shorthand.
+                    bool isShorthand;
+                    prop = CSSPropertyAnimation::getPropertyAtIndex(propertyIndex, isShorthand);
+                    if (isShorthand)
+                        continue;
+                }
+
+                // ImplicitAnimations are always hashed by actual properties, never animateAll.
+                ASSERT(prop >= firstCSSProperty && prop < (firstCSSProperty + numCSSProperties));
+
+                // If there is a running animation for this property, the transition is overridden
+                // and we have to use the unanimatedStyle from the animation. We do the test
+                // against the unanimated style here, but we "override" the transition later.
+                RefPtr<KeyframeAnimation> keyframeAnim = getAnimationForProperty(prop);
+                RenderStyle* fromStyle = keyframeAnim ? keyframeAnim->unanimatedStyle() : currentStyle;
+
+                // See if there is a current transition for this prop
+                ImplicitAnimation* implAnim = m_transitions.get(prop);
+                bool equal = true;
+
+                if (implAnim) {
+                    // If we are post active don't bother setting the active flag. This will cause
+                    // this animation to get removed at the end of this function.
+                    if (!implAnim->postActive())
+                        implAnim->setActive(true);
+
+                    // This might be a transition that is just finishing. That would be the case
+                    // if it were postActive. But we still need to check for equality because
+                    // it could be just finishing AND changing to a new goal state.
+                    //
+                    // This implAnim might also not be an already running transition. It might be
+                    // newly added to the list in a previous iteration. This would happen if
+                    // you have both an explicit transition-property and 'all' in the same
+                    // list. In this case, the latter one overrides the earlier one, so we
+                    // behave as though this is a running animation being replaced.
+                    if (!implAnim->isTargetPropertyEqual(prop, targetStyle)) {
+                        // For accelerated animations we need to return a new RenderStyle with the _current_ value
+                        // of the property, so that restarted transitions use the correct starting point.
+                        if (CSSPropertyAnimation::animationOfPropertyIsAccelerated(prop) && implAnim->isAccelerated()) {
+                            if (!modifiedCurrentStyle)
+                                modifiedCurrentStyle = RenderStyle::clone(currentStyle);
+
+                            implAnim->blendPropertyValueInStyle(prop, modifiedCurrentStyle.get());
+                        }
+                        animationController()->animationWillBeRemoved(implAnim);
+                        m_transitions.remove(prop);
+                        equal = false;
+                    }
+                } else {
+                    // We need to start a transition if it is active and the properties don't match
+                    equal = !isActiveTransition || CSSPropertyAnimation::propertiesEqual(prop, fromStyle, targetStyle);
+                }
+
+                // We can be in this loop with an inactive transition (!isActiveTransition). We need
+                // to do that to check to see if we are canceling a transition. But we don't want to
+                // start one of the inactive transitions. So short circuit that here. (See
+                // <https://bugs.webkit.org/show_bug.cgi?id=24787>
+                if (!equal && isActiveTransition) {
+                    // Add the new transition
+                    m_transitions.set(prop, ImplicitAnimation::create(const_cast<CSSAnimationData*>(anim), prop, renderer, this, modifiedCurrentStyle ? modifiedCurrentStyle.get() : fromStyle));
+                }
+
+                // We only need one pass for the single prop case
+                if (!all)
+                    break;
+            }
+        }
+    }
+
+    // Make a list of transitions to be removed
+    Vector<int> toBeRemoved;
+    end = m_transitions.end();
+    for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
+        ImplicitAnimation* anim = it->value.get();
+        if (!anim->active()) {
+            animationController()->animationWillBeRemoved(anim);
+            toBeRemoved.append(anim->animatingProperty());
+        }
+    }
+
+    // Now remove the transitions from the list
+    for (size_t j = 0; j < toBeRemoved.size(); ++j)
+        m_transitions.remove(toBeRemoved[j]);
+}
+
+void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle)
+{
+    // Nothing to do if we don't have any animations, and didn't have any before
+    if (m_keyframeAnimations.isEmpty() && !targetStyle->hasAnimations())
+        return;
+
+    AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end();
+
+    if (currentStyle && currentStyle->hasAnimations() && targetStyle->hasAnimations() && *(currentStyle->animations()) == *(targetStyle->animations())) {
+        // The current and target animations are the same so we just need to toss any
+        // animation which is finished (postActive).
+        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
+            if (it->value->postActive())
+                it->value->setIndex(-1);
+        }
+    } else {
+        // Mark all existing animations as no longer active.
+        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it)
+            it->value->setIndex(-1);
+
+        // Toss the animation order map.
+        m_keyframeAnimationOrderList.clear();
+
+        DEFINE_STATIC_LOCAL(const AtomicString, none, ("none", AtomicString::ConstructFromLiteral));
+
+        // Now mark any still active animations as active and add any new animations.
+        if (targetStyle->animations()) {
+            int numAnims = targetStyle->animations()->size();
+            for (int i = 0; i < numAnims; ++i) {
+                const CSSAnimationData* anim = targetStyle->animations()->animation(i);
+                if (!anim->isValidAnimation())
+                    continue;
+
+                // See if there is a current animation for this name.
+                AtomicString name(anim->name());
+                RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(name);
+                if (keyframeAnim) {
+                    // If this animation is postActive, skip it so it gets removed at the end of this function.
+                    if (keyframeAnim->postActive())
+                        continue;
+
+                    // This one is still active.
+
+                    // Animations match, but play states may differ. Update if needed.
+                    keyframeAnim->updatePlayState(anim->playState());
+
+                    // Set the saved animation to this new one, just in case the play state has changed.
+                    keyframeAnim->setAnimation(anim);
+                    keyframeAnim->setIndex(i);
+                } else if ((anim->duration() || anim->delay()) && anim->iterationCount() && name != none) {
+                    keyframeAnim = KeyframeAnimation::create(const_cast<CSSAnimationData*>(anim), renderer, i, this, targetStyle);
+                    m_keyframeAnimations.set(name, keyframeAnim);
+                }
+
+                // Add this to the animation order map.
+                if (keyframeAnim)
+                    m_keyframeAnimationOrderList.append(name);
+            }
+        }
+    }
+
+    // Make a list of animations to be removed.
+    Vector<AtomicString> animsToBeRemoved;
+    kfend = m_keyframeAnimations.end();
+    for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
+        KeyframeAnimation* keyframeAnim = it->value.get();
+        if (keyframeAnim->index() < 0) {
+            animsToBeRemoved.append(keyframeAnim->name());
+            animationController()->animationWillBeRemoved(keyframeAnim);
+            keyframeAnim->clear();
+        }
+    }
+
+    // Now remove the animations from the list, and keep stale keys out of the order list.
+    if (animsToBeRemoved.size()) {
+        for (size_t j = 0; j < animsToBeRemoved.size(); ++j) {
+            ASSERT(m_keyframeAnimations.contains(animsToBeRemoved[j]));
+            m_keyframeAnimations.remove(animsToBeRemoved[j]);
+        }
+        Vector<AtomicString> newOrderList;
+        for (size_t j = 0; j < m_keyframeAnimationOrderList.size(); ++j) {
+            AtomicString key = m_keyframeAnimationOrderList[j];
+            if (m_keyframeAnimations.contains(key))
+                newOrderList.append(key);
+        }
+        m_keyframeAnimationOrderList.swap(newOrderList);
+    }
+}
+
+PassRefPtr<RenderStyle> CompositeAnimation::animate(RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle)
+{
+    RefPtr<RenderStyle> resultStyle;
+
+    // We don't do any transitions if we don't have a currentStyle (on startup).
+    updateTransitions(renderer, currentStyle, targetStyle);
+    updateKeyframeAnimations(renderer, currentStyle, targetStyle);
+
+    if (currentStyle) {
+        // Now that we have transition objects ready, let them know about the new goal state.  We want them
+        // to fill in a RenderStyle*& only if needed.
+        if (!m_transitions.isEmpty()) {
+            CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
+            for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
+                if (ImplicitAnimation* anim = it->value.get())
+                    anim->animate(this, renderer, currentStyle, targetStyle, resultStyle);
+            }
+        }
+    }
+
+    // Now that we have animation objects ready, let them know about the new goal state.  We want them
+    // to fill in a RenderStyle*& only if needed.
+    for (Vector<AtomicString>::const_iterator it = m_keyframeAnimationOrderList.begin(); it != m_keyframeAnimationOrderList.end(); ++it) {
+        RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(*it);
+        ASSERT(keyframeAnim);
+        keyframeAnim->animate(this, renderer, currentStyle, targetStyle, resultStyle);
+    }
+
+    return resultStyle ? resultStyle.release() : targetStyle;
+}
+
+PassRefPtr<RenderStyle> CompositeAnimation::getAnimatedStyle() const
+{
+    RefPtr<RenderStyle> resultStyle;
+    CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
+    for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
+        if (ImplicitAnimation* implicitAnimation = it->value.get())
+            implicitAnimation->getAnimatedStyle(resultStyle);
+    }
+
+    for (Vector<AtomicString>::const_iterator it = m_keyframeAnimationOrderList.begin(); it != m_keyframeAnimationOrderList.end(); ++it) {
+        RefPtr<KeyframeAnimation> keyframeAnimation = m_keyframeAnimations.get(*it);
+        ASSERT(keyframeAnimation);
+        keyframeAnimation->getAnimatedStyle(resultStyle);
+    }
+
+    return resultStyle;
+}
+
+double CompositeAnimation::timeToNextService() const
+{
+    // Returns the time at which next service is required. -1 means no service is required. 0 means
+    // service is required now, and > 0 means service is required that many seconds in the future.
+    double minT = -1;
+
+    if (!m_transitions.isEmpty()) {
+        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
+        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
+            ImplicitAnimation* transition = it->value.get();
+            double t = transition ? transition->timeToNextService() : -1;
+            if (t < minT || minT == -1)
+                minT = t;
+            if (minT == 0)
+                return 0;
+        }
+    }
+    if (!m_keyframeAnimations.isEmpty()) {
+        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
+        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
+            KeyframeAnimation* animation = it->value.get();
+            double t = animation ? animation->timeToNextService() : -1;
+            if (t < minT || minT == -1)
+                minT = t;
+            if (minT == 0)
+                return 0;
+        }
+    }
+
+    return minT;
+}
+
+double CompositeAnimation::timeToNextEvent() const
+{
+    // Returns the time at which next service to trigger events is required. -1 means no service is required. 0 means
+    // service is required now, and > 0 means service is required that many seconds in the future.
+    double minT = -1;
+
+    if (!m_transitions.isEmpty()) {
+        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
+        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
+            ImplicitAnimation* transition = it->value.get();
+            double t = -1;
+            bool isLooping;
+            if (transition)
+                transition->getTimeToNextEvent(t, isLooping);
+            if (t < minT || minT == -1)
+                minT = t;
+            if (!minT)
+                return 0;
+        }
+    }
+    if (!m_keyframeAnimations.isEmpty()) {
+        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
+        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
+            KeyframeAnimation* animation = it->value.get();
+            double t = -1;
+            bool isLooping;
+            if (animation)
+                animation->getTimeToNextEvent(t, isLooping);
+            if (t < minT || minT == -1)
+                minT = t;
+            if (!minT)
+                return 0;
+        }
+    }
+
+    return minT;
+}
+
+PassRefPtr<KeyframeAnimation> CompositeAnimation::getAnimationForProperty(CSSPropertyID property) const
+{
+    RefPtr<KeyframeAnimation> retval;
+
+    // We want to send back the last animation with the property if there are multiples.
+    // So we need to iterate through all animations
+    if (!m_keyframeAnimations.isEmpty()) {
+        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
+        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
+            RefPtr<KeyframeAnimation> anim = it->value;
+            if (anim->hasAnimationForProperty(property))
+                retval = anim;
+        }
+    }
+
+    return retval;
+}
+
+void CompositeAnimation::suspendAnimations()
+{
+    if (m_suspended)
+        return;
+
+    m_suspended = true;
+
+    if (!m_keyframeAnimations.isEmpty()) {
+        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
+        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
+            if (KeyframeAnimation* anim = it->value.get())
+                anim->updatePlayState(AnimPlayStatePaused);
+        }
+    }
+    if (!m_transitions.isEmpty()) {
+        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
+        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
+            ImplicitAnimation* anim = it->value.get();
+            if (anim && anim->hasStyle())
+                anim->updatePlayState(AnimPlayStatePaused);
+        }
+    }
+}
+
+void CompositeAnimation::resumeAnimations()
+{
+    if (!m_suspended)
+        return;
+
+    m_suspended = false;
+
+    if (!m_keyframeAnimations.isEmpty()) {
+        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
+        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
+            KeyframeAnimation* anim = it->value.get();
+            if (anim && anim->playStatePlaying())
+                anim->updatePlayState(AnimPlayStatePlaying);
+        }
+    }
+
+    if (!m_transitions.isEmpty()) {
+        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
+        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
+            ImplicitAnimation* anim = it->value.get();
+            if (anim && anim->hasStyle())
+                anim->updatePlayState(AnimPlayStatePlaying);
+        }
+    }
+}
+
+void CompositeAnimation::overrideImplicitAnimations(CSSPropertyID property)
+{
+    CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
+    if (!m_transitions.isEmpty()) {
+        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
+            ImplicitAnimation* anim = it->value.get();
+            if (anim && anim->animatingProperty() == property)
+                anim->setOverridden(true);
+        }
+    }
+}
+
+void CompositeAnimation::resumeOverriddenImplicitAnimations(CSSPropertyID property)
+{
+    if (!m_transitions.isEmpty()) {
+        CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
+        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
+            ImplicitAnimation* anim = it->value.get();
+            if (anim && anim->animatingProperty() == property)
+                anim->setOverridden(false);
+        }
+    }
+}
+
+bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, bool isRunningNow) const
+{
+    if (!m_keyframeAnimations.isEmpty()) {
+        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
+        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
+            KeyframeAnimation* anim = it->value.get();
+            if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isRunningNow))
+                return true;
+        }
+    }
+
+    if (!m_transitions.isEmpty()) {
+        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
+        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
+            ImplicitAnimation* anim = it->value.get();
+            if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isRunningNow))
+                return true;
+        }
+    }
+    return false;
+}
+
+void CompositeAnimation::pauseAnimationsForTesting(double t)
+{
+    AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
+    for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
+        RefPtr<KeyframeAnimation> keyframeAnim = it->value;
+        if (!keyframeAnim || !keyframeAnim->running())
+            continue;
+
+        double count = keyframeAnim->m_animation->iterationCount();
+        if ((t >= 0.0) && ((count == CSSAnimationData::IterationCountInfinite) || (t <= count * keyframeAnim->duration())))
+            keyframeAnim->freezeAtTime(t);
+    }
+
+    CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
+    for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
+        RefPtr<ImplicitAnimation> implAnim = it->value;
+
+        if (!implAnim->running())
+            continue;
+
+        if ((t >= 0.0) && (t <= implAnim->duration()))
+            implAnim->freezeAtTime(t);
+    }
+}
+
+unsigned CompositeAnimation::numberOfActiveAnimations() const
+{
+    unsigned count = 0;
+
+    if (!m_keyframeAnimations.isEmpty()) {
+        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
+        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
+            KeyframeAnimation* anim = it->value.get();
+            if (anim->running())
+                ++count;
+        }
+    }
+
+    if (!m_transitions.isEmpty()) {
+        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
+        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
+            ImplicitAnimation* anim = it->value.get();
+            if (anim->running())
+                ++count;
+        }
+    }
+
+    return count;
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/animation/CompositeAnimation.h b/Source/core/frame/animation/CompositeAnimation.h
new file mode 100644
index 0000000..d115548
--- /dev/null
+++ b/Source/core/frame/animation/CompositeAnimation.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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 CompositeAnimation_h
+#define CompositeAnimation_h
+
+#include "core/frame/animation/ImplicitAnimation.h"
+#include "core/frame/animation/KeyframeAnimation.h"
+#include "wtf/HashMap.h"
+
+namespace WebCore {
+
+class AnimationControllerPrivate;
+class AnimationController;
+class RenderObject;
+class RenderStyle;
+
+// A CompositeAnimation represents a collection of animations that are running
+// on a single RenderObject, such as a number of properties transitioning at once.
+class CompositeAnimation : public RefCounted<CompositeAnimation> {
+public:
+    static PassRefPtr<CompositeAnimation> create(AnimationControllerPrivate* animationController)
+    {
+        return adoptRef(new CompositeAnimation(animationController));
+    };
+
+    ~CompositeAnimation();
+
+    void clearRenderer();
+
+    PassRefPtr<RenderStyle> animate(RenderObject*, RenderStyle* currentStyle, RenderStyle* targetStyle);
+    PassRefPtr<RenderStyle> getAnimatedStyle() const;
+
+    double timeToNextService() const;
+    double timeToNextEvent() const;
+
+    AnimationControllerPrivate* animationController() const { return m_animationController; }
+
+    void suspendAnimations();
+    void resumeAnimations();
+    bool suspended() const { return m_suspended; }
+
+    bool hasAnimations() const  { return !m_transitions.isEmpty() || !m_keyframeAnimations.isEmpty(); }
+
+    bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, bool isRunningNow) const;
+
+    PassRefPtr<KeyframeAnimation> getAnimationForProperty(CSSPropertyID) const;
+
+    void overrideImplicitAnimations(CSSPropertyID);
+    void resumeOverriddenImplicitAnimations(CSSPropertyID);
+
+    void pauseAnimationsForTesting(double t);
+    unsigned numberOfActiveAnimations() const;
+
+private:
+    CompositeAnimation(AnimationControllerPrivate* animationController)
+        : m_animationController(animationController)
+        , m_suspended(false)
+    {
+    }
+
+    void updateTransitions(RenderObject*, RenderStyle* currentStyle, RenderStyle* targetStyle);
+    void updateKeyframeAnimations(RenderObject*, RenderStyle* currentStyle, RenderStyle* targetStyle);
+
+    typedef HashMap<int, RefPtr<ImplicitAnimation> > CSSPropertyTransitionsMap;
+    typedef HashMap<AtomicString, RefPtr<KeyframeAnimation> > AnimationNameMap;
+
+    AnimationControllerPrivate* m_animationController;
+    CSSPropertyTransitionsMap m_transitions;
+    AnimationNameMap m_keyframeAnimations;
+    Vector<AtomicString> m_keyframeAnimationOrderList;
+    bool m_suspended;
+};
+
+} // namespace WebCore
+
+#endif // CompositeAnimation_h
diff --git a/Source/core/frame/animation/ImplicitAnimation.cpp b/Source/core/frame/animation/ImplicitAnimation.cpp
new file mode 100644
index 0000000..37c74d0
--- /dev/null
+++ b/Source/core/frame/animation/ImplicitAnimation.cpp
@@ -0,0 +1,290 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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/events/ThreadLocalEventNames.h"
+#include "core/page/UseCounter.h"
+#include "core/frame/animation/AnimationControllerPrivate.h"
+#include "core/frame/animation/CSSPropertyAnimation.h"
+#include "core/frame/animation/CompositeAnimation.h"
+#include "core/frame/animation/ImplicitAnimation.h"
+#include "core/frame/animation/KeyframeAnimation.h"
+#include "core/rendering/RenderBoxModelObject.h"
+#include "public/platform/Platform.h"
+
+namespace WebCore {
+
+ImplicitAnimation::ImplicitAnimation(const CSSAnimationData* transition, CSSPropertyID animatingProperty, RenderObject* renderer, CompositeAnimation* compAnim, RenderStyle* fromStyle)
+    : AnimationBase(transition, renderer, compAnim)
+    , m_transitionProperty(transition->property())
+    , m_animatingProperty(animatingProperty)
+    , m_overridden(false)
+    , m_active(true)
+    , m_fromStyle(fromStyle)
+{
+    ASSERT(animatingProperty != CSSPropertyInvalid);
+    WebKit::Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(m_animatingProperty));
+}
+
+ImplicitAnimation::~ImplicitAnimation()
+{
+    // // Make sure to tell the renderer that we are ending. This will make sure any accelerated animations are removed.
+    if (!postActive())
+        endAnimation();
+}
+
+bool ImplicitAnimation::shouldSendEventForListener(Document::ListenerType inListenerType) const
+{
+    return m_object->document().hasListenerType(inListenerType);
+}
+
+void ImplicitAnimation::animate(CompositeAnimation*, RenderObject*, const RenderStyle*, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle)
+{
+    // If we get this far and the animation is done, it means we are cleaning up a just finished animation.
+    // So just return. Everything is already all cleaned up.
+    if (postActive())
+        return;
+
+    // Reset to start the transition if we are new
+    if (isNew())
+        reset(targetStyle);
+
+    // Run a cycle of animation.
+    // We know we will need a new render style, so make one if needed
+    if (!animatedStyle)
+        animatedStyle = RenderStyle::clone(targetStyle);
+
+    bool needsAnim = CSSPropertyAnimation::blendProperties(this, m_animatingProperty, animatedStyle.get(), m_fromStyle.get(), m_toStyle.get(), progress(1, 0, 0));
+    // FIXME: we also need to detect cases where we have to software animate for other reasons,
+    // such as a child using inheriting the transform. https://bugs.webkit.org/show_bug.cgi?id=23902
+    if (!needsAnim)
+        // If we are running an accelerated animation, set a flag in the style which causes the style
+        // to compare as different to any other style. This ensures that changes to the property
+        // that is animating are correctly detected during the animation (e.g. when a transition
+        // gets interrupted).
+        animatedStyle->setIsRunningAcceleratedAnimation();
+
+    // Fire the start timeout if needed
+    fireAnimationEventsIfNeeded();
+}
+
+void ImplicitAnimation::getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle)
+{
+    if (!animatedStyle)
+        animatedStyle = RenderStyle::clone(m_toStyle.get());
+
+    CSSPropertyAnimation::blendProperties(this, m_animatingProperty, animatedStyle.get(), m_fromStyle.get(), m_toStyle.get(), progress(1, 0, 0));
+}
+
+void ImplicitAnimation::startAnimation(double timeOffset)
+{
+    if (m_object && m_object->isComposited())
+        m_isAccelerated = toRenderBoxModelObject(m_object)->startTransition(timeOffset, m_animatingProperty, m_fromStyle.get(), m_toStyle.get());
+}
+
+void ImplicitAnimation::pauseAnimation(double timeOffset)
+{
+    if (!m_object)
+        return;
+
+    if (m_object && m_object->isComposited() && isAccelerated())
+        toRenderBoxModelObject(m_object)->transitionPaused(timeOffset, m_animatingProperty);
+
+    // Restore the original (unanimated) style
+    if (!paused())
+        setNeedsStyleRecalc(m_object->node());
+}
+
+void ImplicitAnimation::endAnimation()
+{
+    if (m_object && m_object->isComposited() && isAccelerated())
+        toRenderBoxModelObject(m_object)->transitionFinished(m_animatingProperty);
+    m_isAccelerated = false;
+}
+
+void ImplicitAnimation::onAnimationEnd(double elapsedTime)
+{
+    // If we have a keyframe animation on this property, this transition is being overridden. The keyframe
+    // animation keeps an unanimated style in case a transition starts while the keyframe animation is
+    // running. But now that the transition has completed, we need to update this style with its new
+    // destination. If we didn't, the next time through we would think a transition had started
+    // (comparing the old unanimated style with the new final style of the transition).
+    RefPtr<KeyframeAnimation> keyframeAnim = m_compAnim->getAnimationForProperty(m_animatingProperty);
+    if (keyframeAnim)
+        keyframeAnim->setUnanimatedStyle(m_toStyle);
+
+    sendTransitionEvent(EventTypeNames::transitionend, elapsedTime);
+    endAnimation();
+}
+
+bool ImplicitAnimation::sendTransitionEvent(const AtomicString& eventType, double elapsedTime)
+{
+    if (eventType == EventTypeNames::transitionend) {
+        Document::ListenerType listenerType = Document::TRANSITIONEND_LISTENER;
+
+        if (shouldSendEventForListener(listenerType)) {
+            String propertyName = getPropertyNameString(m_animatingProperty);
+
+            // Dispatch the event
+            RefPtr<Element> element = 0;
+            if (m_object->node() && m_object->node()->isElementNode())
+                element = toElement(m_object->node());
+
+            if (!element)
+                return false;
+
+            // Schedule event handling
+            m_compAnim->animationController()->addEventToDispatch(element, eventType, propertyName, elapsedTime);
+
+            // Restore the original (unanimated) style
+            if (eventType == EventTypeNames::transitionend && element->renderer())
+                setNeedsStyleRecalc(element.get());
+
+            return true; // Did dispatch an event
+        }
+    }
+
+    return false; // Didn't dispatch an event
+}
+
+void ImplicitAnimation::reset(RenderStyle* to)
+{
+    ASSERT(to);
+    ASSERT(m_fromStyle);
+
+    m_toStyle = to;
+
+    // Restart the transition
+    if (m_fromStyle && m_toStyle)
+        updateStateMachine(AnimationStateInputRestartAnimation, -1);
+
+    // set the transform animation list
+    validateTransformFunctionList();
+    checkForMatchingFilterFunctionLists();
+}
+
+void ImplicitAnimation::setOverridden(bool b)
+{
+    if (b == m_overridden)
+        return;
+
+    m_overridden = b;
+    updateStateMachine(m_overridden ? AnimationStateInputPauseOverride : AnimationStateInputResumeOverride, -1);
+}
+
+bool ImplicitAnimation::affectsProperty(CSSPropertyID property) const
+{
+    return (m_animatingProperty == property);
+}
+
+bool ImplicitAnimation::isTargetPropertyEqual(CSSPropertyID prop, const RenderStyle* targetStyle)
+{
+    // We can get here for a transition that has not started yet. This would make m_toStyle unset and null.
+    // So we check that here (see <https://bugs.webkit.org/show_bug.cgi?id=26706>)
+    if (!m_toStyle)
+        return false;
+    return CSSPropertyAnimation::propertiesEqual(prop, m_toStyle.get(), targetStyle);
+}
+
+void ImplicitAnimation::blendPropertyValueInStyle(CSSPropertyID prop, RenderStyle* currentStyle)
+{
+    // We should never add a transition with a 0 duration and delay. But if we ever did
+    // it would have a null toStyle. So just in case, let's check that here. (See
+    // <https://bugs.webkit.org/show_bug.cgi?id=24787>
+    if (!m_toStyle)
+        return;
+
+    CSSPropertyAnimation::blendProperties(this, prop, currentStyle, m_fromStyle.get(), m_toStyle.get(), progress(1, 0, 0));
+}
+
+void ImplicitAnimation::validateTransformFunctionList()
+{
+    m_transformFunctionListValid = false;
+
+    if (!m_fromStyle || !m_toStyle)
+        return;
+
+    const TransformOperations* val = &m_fromStyle->transform();
+    const TransformOperations* toVal = &m_toStyle->transform();
+
+    if (val->operations().isEmpty())
+        val = toVal;
+
+    if (val->operations().isEmpty())
+        return;
+
+    // An emtpy transform list matches anything.
+    if (val != toVal && !toVal->operations().isEmpty() && !val->operationsMatch(*toVal))
+        return;
+
+    // Transform lists match.
+    m_transformFunctionListValid = true;
+}
+
+void ImplicitAnimation::checkForMatchingFilterFunctionLists()
+{
+    m_filterFunctionListsMatch = false;
+
+    if (!m_fromStyle || !m_toStyle)
+        return;
+
+    const FilterOperations* val = &m_fromStyle->filter();
+    const FilterOperations* toVal = &m_toStyle->filter();
+
+    if (val->operations().isEmpty())
+        val = toVal;
+
+    if (val->operations().isEmpty())
+        return;
+
+    // An emtpy filter list matches anything.
+    if (val != toVal && !toVal->operations().isEmpty() && !val->operationsMatch(*toVal))
+        return;
+
+    // Filter lists match.
+    m_filterFunctionListsMatch = true;
+}
+
+double ImplicitAnimation::timeToNextService()
+{
+    double t = AnimationBase::timeToNextService();
+    if (t != 0 || preActive())
+        return t;
+
+    // A return value of 0 means we need service. But if this is an accelerated animation we
+    // only need service at the end of the transition.
+    if (CSSPropertyAnimation::animationOfPropertyIsAccelerated(m_animatingProperty) && isAccelerated()) {
+        bool isLooping;
+        getTimeToNextEvent(t, isLooping);
+    }
+
+    return t;
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/animation/ImplicitAnimation.h b/Source/core/frame/animation/ImplicitAnimation.h
new file mode 100644
index 0000000..573bf1c
--- /dev/null
+++ b/Source/core/frame/animation/ImplicitAnimation.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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 ImplicitAnimation_h
+#define ImplicitAnimation_h
+
+#include "CSSPropertyNames.h"
+#include "core/dom/Document.h"
+#include "core/frame/animation/AnimationBase.h"
+
+namespace WebCore {
+
+// An ImplicitAnimation tracks the state of a transition of a specific CSS property
+// for a single RenderObject.
+class ImplicitAnimation : public AnimationBase {
+public:
+    static PassRefPtr<ImplicitAnimation> create(const CSSAnimationData* animation, CSSPropertyID animatingProperty, RenderObject* renderer, CompositeAnimation* compositeAnimation, RenderStyle* fromStyle)
+    {
+        return adoptRef(new ImplicitAnimation(animation, animatingProperty, renderer, compositeAnimation, fromStyle));
+    };
+
+    CSSPropertyID transitionProperty() const { return m_transitionProperty; }
+    CSSPropertyID animatingProperty() const { return m_animatingProperty; }
+
+    virtual void onAnimationEnd(double elapsedTime);
+    virtual void startAnimation(double timeOffset);
+    virtual void pauseAnimation(double /*timeOffset*/);
+    virtual void endAnimation();
+
+    virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle* currentStyle, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle);
+    virtual void getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle);
+    virtual void reset(RenderStyle* to);
+
+    void setOverridden(bool);
+    virtual bool overridden() const { return m_overridden; }
+
+    virtual bool affectsProperty(CSSPropertyID) const;
+
+    bool hasStyle() const { return m_fromStyle && m_toStyle; }
+
+    bool isTargetPropertyEqual(CSSPropertyID, const RenderStyle*);
+
+    void blendPropertyValueInStyle(CSSPropertyID, RenderStyle*);
+
+    virtual double timeToNextService();
+
+    bool active() const { return m_active; }
+    void setActive(bool b) { m_active = b; }
+
+protected:
+    bool shouldSendEventForListener(Document::ListenerType) const;
+    bool sendTransitionEvent(const AtomicString&, double elapsedTime);
+
+    void validateTransformFunctionList();
+    void checkForMatchingFilterFunctionLists();
+
+private:
+    ImplicitAnimation(const CSSAnimationData*, CSSPropertyID, RenderObject*, CompositeAnimation*, RenderStyle*);
+    virtual ~ImplicitAnimation();
+
+    CSSPropertyID m_transitionProperty; // Transition property as specified in the RenderStyle.
+    CSSPropertyID m_animatingProperty; // Specific property for this ImplicitAnimation
+    bool m_overridden;          // true when there is a keyframe animation that overrides the transitioning property
+    bool m_active;              // used for culling the list of transitions
+
+    // The two styles that we are blending.
+    RefPtr<RenderStyle> m_fromStyle;
+    RefPtr<RenderStyle> m_toStyle;
+};
+
+} // namespace WebCore
+
+#endif // ImplicitAnimation_h
diff --git a/Source/core/frame/animation/KeyframeAnimation.cpp b/Source/core/frame/animation/KeyframeAnimation.cpp
new file mode 100644
index 0000000..ad93508
--- /dev/null
+++ b/Source/core/frame/animation/KeyframeAnimation.cpp
@@ -0,0 +1,461 @@
+/*
+ * Copyright (C) 2007, 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.
+ * 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.
+ *
+ * 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/frame/animation/KeyframeAnimation.h"
+
+#include "CSSPropertyNames.h"
+#include "core/css/resolver/StyleResolver.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/page/UseCounter.h"
+#include "core/frame/animation/AnimationControllerPrivate.h"
+#include "core/frame/animation/CSSPropertyAnimation.h"
+#include "core/frame/animation/CompositeAnimation.h"
+#include "core/rendering/RenderBoxModelObject.h"
+#include "core/rendering/style/RenderStyle.h"
+#include "public/platform/Platform.h"
+
+using namespace std;
+
+namespace WebCore {
+
+KeyframeAnimation::KeyframeAnimation(const CSSAnimationData* animation, RenderObject* renderer, int index, CompositeAnimation* compAnim, RenderStyle* unanimatedStyle)
+    : AnimationBase(animation, renderer, compAnim)
+    , m_keyframes(renderer, animation->name())
+    , m_index(index)
+    , m_startEventDispatched(false)
+    , m_unanimatedStyle(unanimatedStyle)
+{
+    // Get the keyframe RenderStyles
+    if (m_object && m_object->node() && m_object->node()->isElementNode())
+        m_object->document().styleResolver()->keyframeStylesForAnimation(toElement(m_object->node()), unanimatedStyle, m_keyframes);
+
+    // Update the m_transformFunctionListValid flag based on whether the function lists in the keyframes match.
+    validateTransformFunctionList();
+    checkForMatchingFilterFunctionLists();
+    HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
+    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it)
+        WebKit::Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(*it));
+}
+
+KeyframeAnimation::~KeyframeAnimation()
+{
+    // Make sure to tell the renderer that we are ending. This will make sure any accelerated animations are removed.
+    if (!postActive())
+        endAnimation();
+}
+
+void KeyframeAnimation::fetchIntervalEndpointsForProperty(CSSPropertyID property, const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& prog) const
+{
+    // Find the first key
+    double elapsedTime = getElapsedTime();
+    if (m_animation->duration() && m_animation->iterationCount() != CSSAnimationData::IterationCountInfinite)
+        elapsedTime = min(elapsedTime, m_animation->duration() * m_animation->iterationCount());
+
+    const double fractionalTime = this->fractionalTime(1, elapsedTime, 0);
+
+    size_t numKeyframes = m_keyframes.size();
+    if (!numKeyframes)
+        return;
+
+    ASSERT(!m_keyframes[0].key());
+    ASSERT(m_keyframes[m_keyframes.size() - 1].key() == 1);
+
+    size_t currentIndex = 0;
+    size_t firstIndex = 0;
+    size_t lastIndex = numKeyframes - 1;
+    size_t distance = numKeyframes;
+
+    // Find keyframe that is closest to elapsed time.
+    while (distance > 1) {
+        currentIndex = (lastIndex + firstIndex) >> 1;
+        double key = m_keyframes[currentIndex].key();
+        distance = lastIndex - currentIndex;
+
+        if (key < fractionalTime) {
+            if (distance < 2)
+                currentIndex++;
+            firstIndex = currentIndex;
+        } else {
+            lastIndex = currentIndex;
+        }
+    }
+
+    int prevIndex = -1;
+    int nextIndex = -1;
+
+    // Iterate forward to find next keyframe that is used to animate CSS property.
+    for (size_t i = currentIndex; i < numKeyframes; ++i) {
+        const KeyframeValue& keyFrame = m_keyframes[i];
+        if (keyFrame.key() > fractionalTime && keyFrame.containsProperty(property)) {
+            nextIndex = i;
+            break;
+        }
+    }
+
+    // Iterate backward to find previous keyframe.
+    for (int i = currentIndex; i >= 0; --i) {
+        const KeyframeValue& keyFrame = m_keyframes[i];
+        if (keyFrame.key() <= fractionalTime && keyFrame.containsProperty(property)) {
+            prevIndex = i;
+            break;
+        }
+    }
+
+    double scale = 1;
+    double offset = 0;
+
+    if (prevIndex == -1)
+        prevIndex = 0;
+
+    if (nextIndex == -1)
+        nextIndex = numKeyframes - 1;
+
+    const KeyframeValue& prevKeyframe = m_keyframes[prevIndex];
+    const KeyframeValue& nextKeyframe = m_keyframes[nextIndex];
+
+    fromStyle = prevKeyframe.style();
+    toStyle = nextKeyframe.style();
+
+    offset = prevKeyframe.key();
+    scale = 1.0 / (nextKeyframe.key() - prevKeyframe.key());
+    // A scale of infinity is handled in AnimationBase::fractionalTime().
+    ASSERT(scale >= 0 && (!std::isinf(scale) || prevIndex == nextIndex));
+
+    // FIXME: This sometimes gets the wrong timing function. See crbug.com/288540.
+    const TimingFunction* timingFunction = KeyframeValue::timingFunction(prevKeyframe.style(), name());
+    prog = progress(scale, offset, timingFunction);
+}
+
+void KeyframeAnimation::animate(CompositeAnimation*, RenderObject*, const RenderStyle*, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle)
+{
+    // Fire the start timeout if needed
+    fireAnimationEventsIfNeeded();
+
+    // If we have not yet started, we will not have a valid start time, so just start the animation if needed.
+    if (isNew() && m_animation->playState() == AnimPlayStatePlaying)
+        updateStateMachine(AnimationStateInputStartAnimation, -1);
+
+    // If we get this far and the animation is done, it means we are cleaning up a just finished animation.
+    // If so, we need to send back the targetStyle.
+    if (postActive()) {
+        if (!animatedStyle)
+            animatedStyle = const_cast<RenderStyle*>(targetStyle);
+        return;
+    }
+
+    // If we are waiting for the start timer, we don't want to change the style yet.
+    // Special case 1 - if the delay time is 0, then we do want to set the first frame of the
+    // animation right away. This avoids a flash when the animation starts.
+    // Special case 2 - if there is a backwards fill mode, then we want to continue
+    // through to the style blend so that we get the fromStyle.
+    if (waitingToStart() && m_animation->delay() > 0 && !m_animation->fillsBackwards())
+        return;
+
+    // If we have no keyframes, don't animate.
+    if (!m_keyframes.size()) {
+        updateStateMachine(AnimationStateInputEndAnimation, -1);
+        return;
+    }
+
+    // Run a cycle of animation.
+    // We know we will need a new render style, so make one if needed.
+    if (!animatedStyle)
+        animatedStyle = RenderStyle::clone(targetStyle);
+
+    // FIXME: we need to be more efficient about determining which keyframes we are animating between.
+    // We should cache the last pair or something.
+    HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
+    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
+        // Get the from/to styles and progress between
+        const RenderStyle* fromStyle = 0;
+        const RenderStyle* toStyle = 0;
+        double progress = 0.0;
+        fetchIntervalEndpointsForProperty(*it, fromStyle, toStyle, progress);
+
+        bool needsAnim = CSSPropertyAnimation::blendProperties(this, *it, animatedStyle.get(), fromStyle, toStyle, progress);
+        if (!needsAnim)
+            // If we are running an accelerated animation, set a flag in the style
+            // to indicate it. This can be used to make sure we get an updated
+            // style for hit testing, etc.
+            animatedStyle->setIsRunningAcceleratedAnimation();
+    }
+}
+
+void KeyframeAnimation::getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle)
+{
+    // If we're in the delay phase and we're not backwards filling, tell the caller
+    // to use the current style.
+    if (waitingToStart() && m_animation->delay() > 0 && !m_animation->fillsBackwards())
+        return;
+
+    if (!m_keyframes.size())
+        return;
+
+    if (!animatedStyle)
+        animatedStyle = RenderStyle::clone(m_object->style());
+
+    HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
+    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
+        // Get the from/to styles and progress between
+        const RenderStyle* fromStyle = 0;
+        const RenderStyle* toStyle = 0;
+        double progress = 0.0;
+        fetchIntervalEndpointsForProperty(*it, fromStyle, toStyle, progress);
+
+        CSSPropertyAnimation::blendProperties(this, *it, animatedStyle.get(), fromStyle, toStyle, progress);
+    }
+}
+
+bool KeyframeAnimation::hasAnimationForProperty(CSSPropertyID property) const
+{
+    return m_keyframes.containsProperty(property);
+}
+
+void KeyframeAnimation::startAnimation(double timeOffset)
+{
+    if (m_object && m_object->isComposited())
+        m_isAccelerated = toRenderBoxModelObject(m_object)->startAnimation(timeOffset, m_animation.get(), m_keyframes);
+}
+
+void KeyframeAnimation::pauseAnimation(double timeOffset)
+{
+    if (!m_object)
+        return;
+
+    if (m_object && m_object->isComposited() && isAccelerated())
+        toRenderBoxModelObject(m_object)->animationPaused(timeOffset, m_keyframes.animationName());
+
+    // Restore the original (unanimated) style
+    if (!paused())
+        setNeedsStyleRecalc(m_object->node());
+}
+
+void KeyframeAnimation::endAnimation()
+{
+    if (!m_object)
+        return;
+
+    if (m_object && m_object->isComposited() && isAccelerated())
+        toRenderBoxModelObject(m_object)->animationFinished(m_keyframes.animationName());
+    m_isAccelerated = false;
+
+    // Restore the original (unanimated) style
+    if (!paused())
+        setNeedsStyleRecalc(m_object->node());
+}
+
+bool KeyframeAnimation::shouldSendEventForListener(Document::ListenerType listenerType) const
+{
+    return m_object->document().hasListenerType(listenerType);
+}
+
+void KeyframeAnimation::onAnimationStart(double elapsedTime)
+{
+    sendAnimationEvent(EventTypeNames::animationstart, elapsedTime);
+}
+
+void KeyframeAnimation::onAnimationIteration(double elapsedTime)
+{
+    sendAnimationEvent(EventTypeNames::animationiteration, elapsedTime);
+}
+
+void KeyframeAnimation::onAnimationEnd(double elapsedTime)
+{
+    sendAnimationEvent(EventTypeNames::animationend, elapsedTime);
+    // End the animation if we don't fill forwards. Forward filling
+    // animations are ended properly in the class destructor.
+    if (!m_animation->fillsForwards())
+        endAnimation();
+}
+
+bool KeyframeAnimation::sendAnimationEvent(const AtomicString& eventType, double elapsedTime)
+{
+    Document::ListenerType listenerType;
+    if (eventType == EventTypeNames::animationiteration)
+        listenerType = Document::ANIMATIONITERATION_LISTENER;
+    else if (eventType == EventTypeNames::animationend)
+        listenerType = Document::ANIMATIONEND_LISTENER;
+    else {
+        ASSERT(eventType == EventTypeNames::animationstart);
+        if (m_startEventDispatched)
+            return false;
+        m_startEventDispatched = true;
+        listenerType = Document::ANIMATIONSTART_LISTENER;
+    }
+
+    if (shouldSendEventForListener(listenerType)) {
+        // Dispatch the event
+        RefPtr<Element> element;
+        if (m_object->node() && m_object->node()->isElementNode())
+            element = toElement(m_object->node());
+
+        if (!element)
+            return false;
+
+        // Schedule event handling
+        m_compAnim->animationController()->addEventToDispatch(element, eventType, m_keyframes.animationName(), elapsedTime);
+
+        // Restore the original (unanimated) style
+        if (eventType == EventTypeNames::animationend && element->renderer())
+            setNeedsStyleRecalc(element.get());
+
+        return true; // Did dispatch an event
+    }
+
+    return false; // Did not dispatch an event
+}
+
+void KeyframeAnimation::overrideAnimations()
+{
+    // This will override implicit animations that match the properties in the keyframe animation
+    HashSet<CSSPropertyID>::const_iterator end = m_keyframes.endProperties();
+    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != end; ++it)
+        compositeAnimation()->overrideImplicitAnimations(*it);
+}
+
+void KeyframeAnimation::resumeOverriddenAnimations()
+{
+    // This will resume overridden implicit animations
+    HashSet<CSSPropertyID>::const_iterator end = m_keyframes.endProperties();
+    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != end; ++it)
+        compositeAnimation()->resumeOverriddenImplicitAnimations(*it);
+}
+
+bool KeyframeAnimation::affectsProperty(CSSPropertyID property) const
+{
+    return m_keyframes.containsProperty(property);
+}
+
+void KeyframeAnimation::validateTransformFunctionList()
+{
+    m_transformFunctionListValid = false;
+
+    if (m_keyframes.size() < 2 || !m_keyframes.containsProperty(CSSPropertyWebkitTransform))
+        return;
+
+    // Empty transforms match anything, so find the first non-empty entry as the reference
+    size_t numKeyframes = m_keyframes.size();
+    size_t firstNonEmptyTransformKeyframeIndex = numKeyframes;
+
+    for (size_t i = 0; i < numKeyframes; ++i) {
+        const KeyframeValue& currentKeyframe = m_keyframes[i];
+        if (currentKeyframe.style()->transform().operations().size()) {
+            firstNonEmptyTransformKeyframeIndex = i;
+            break;
+        }
+    }
+
+    if (firstNonEmptyTransformKeyframeIndex == numKeyframes)
+        return;
+
+    const TransformOperations* firstVal = &m_keyframes[firstNonEmptyTransformKeyframeIndex].style()->transform();
+
+    // See if the keyframes are valid
+    for (size_t i = firstNonEmptyTransformKeyframeIndex + 1; i < numKeyframes; ++i) {
+        const KeyframeValue& currentKeyframe = m_keyframes[i];
+        const TransformOperations* val = &currentKeyframe.style()->transform();
+
+        // An emtpy transform list matches anything.
+        if (val->operations().isEmpty())
+            continue;
+
+        if (!firstVal->operationsMatch(*val))
+            return;
+    }
+
+    // Keyframes are valid
+    m_transformFunctionListValid = true;
+}
+
+void KeyframeAnimation::checkForMatchingFilterFunctionLists()
+{
+    m_filterFunctionListsMatch = false;
+
+    if (m_keyframes.size() < 2 || !m_keyframes.containsProperty(CSSPropertyWebkitFilter))
+        return;
+
+    // Empty filters match anything, so find the first non-empty entry as the reference
+    size_t numKeyframes = m_keyframes.size();
+    size_t firstNonEmptyFilterKeyframeIndex = numKeyframes;
+
+    for (size_t i = 0; i < numKeyframes; ++i) {
+        const KeyframeValue& currentKeyframe = m_keyframes[i];
+        if (currentKeyframe.style()->filter().operations().size()) {
+            firstNonEmptyFilterKeyframeIndex = i;
+            break;
+        }
+    }
+
+    if (firstNonEmptyFilterKeyframeIndex == numKeyframes)
+        return;
+
+    const FilterOperations* firstVal = &m_keyframes[firstNonEmptyFilterKeyframeIndex].style()->filter();
+
+    for (size_t i = firstNonEmptyFilterKeyframeIndex + 1; i < numKeyframes; ++i) {
+        const KeyframeValue& currentKeyframe = m_keyframes[i];
+        const FilterOperations* val = &currentKeyframe.style()->filter();
+
+        // An emtpy filter list matches anything.
+        if (val->operations().isEmpty())
+            continue;
+
+        if (!firstVal->operationsMatch(*val))
+            return;
+    }
+
+    m_filterFunctionListsMatch = true;
+}
+
+double KeyframeAnimation::timeToNextService()
+{
+    double t = AnimationBase::timeToNextService();
+    if (t != 0 || preActive())
+        return t;
+
+    // A return value of 0 means we need service. But if we only have accelerated animations we
+    // only need service at the end of the transition
+    HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
+    bool acceleratedPropertiesOnly = true;
+
+    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
+        if (!CSSPropertyAnimation::animationOfPropertyIsAccelerated(*it) || !isAccelerated()) {
+            acceleratedPropertiesOnly = false;
+            break;
+        }
+    }
+
+    if (acceleratedPropertiesOnly) {
+        bool isLooping;
+        getTimeToNextEvent(t, isLooping);
+    }
+
+    return t;
+}
+
+} // namespace WebCore
diff --git a/Source/core/frame/animation/KeyframeAnimation.h b/Source/core/frame/animation/KeyframeAnimation.h
new file mode 100644
index 0000000..82c198a
--- /dev/null
+++ b/Source/core/frame/animation/KeyframeAnimation.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2007 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.
+ * 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.
+ *
+ * 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 KeyframeAnimation_h
+#define KeyframeAnimation_h
+
+#include "core/dom/Document.h"
+#include "core/frame/animation/AnimationBase.h"
+#include "core/rendering/style/KeyframeList.h"
+
+namespace WebCore {
+
+class RenderStyle;
+
+// A KeyframeAnimation tracks the state of an explicit animation
+// for a single RenderObject.
+class KeyframeAnimation : public AnimationBase {
+public:
+    static PassRefPtr<KeyframeAnimation> create(const CSSAnimationData* animation, RenderObject* renderer, int index, CompositeAnimation* compositeAnimation, RenderStyle* unanimatedStyle)
+    {
+        return adoptRef(new KeyframeAnimation(animation, renderer, index, compositeAnimation, unanimatedStyle));
+    };
+
+    virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle* currentStyle, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle);
+    virtual void getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle);
+
+    const AtomicString& name() const { return m_keyframes.animationName(); }
+    int index() const { return m_index; }
+    void setIndex(int i) { m_index = i; }
+
+    bool hasAnimationForProperty(CSSPropertyID) const;
+
+    void setUnanimatedStyle(PassRefPtr<RenderStyle> style) { m_unanimatedStyle = style; }
+    RenderStyle* unanimatedStyle() const { return m_unanimatedStyle.get(); }
+
+    virtual double timeToNextService();
+
+protected:
+    virtual void onAnimationStart(double elapsedTime);
+    virtual void onAnimationIteration(double elapsedTime);
+    virtual void onAnimationEnd(double elapsedTime);
+    virtual void startAnimation(double timeOffset);
+    virtual void pauseAnimation(double timeOffset);
+    virtual void endAnimation();
+
+    virtual void overrideAnimations();
+    virtual void resumeOverriddenAnimations();
+
+    bool shouldSendEventForListener(Document::ListenerType inListenerType) const;
+    bool sendAnimationEvent(const AtomicString&, double elapsedTime);
+
+    virtual bool affectsProperty(CSSPropertyID) const;
+
+    void validateTransformFunctionList();
+    void checkForMatchingFilterFunctionLists();
+
+private:
+    KeyframeAnimation(const CSSAnimationData* animation, RenderObject*, int index, CompositeAnimation*, RenderStyle* unanimatedStyle);
+    virtual ~KeyframeAnimation();
+
+    // Get the styles for the given property surrounding the current animation time and the progress between them.
+    void fetchIntervalEndpointsForProperty(CSSPropertyID, const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& progress) const;
+
+    // The keyframes that we are blending.
+    KeyframeList m_keyframes;
+
+    // The order in which this animation appears in the animation-name style.
+    int m_index;
+    bool m_startEventDispatched;
+
+    // The style just before we started animation
+    RefPtr<RenderStyle> m_unanimatedStyle;
+};
+
+} // namespace WebCore
+
+#endif // KeyframeAnimation_h
diff --git a/Source/core/generate_test_support_idls.target.darwin-arm.mk b/Source/core/generate_test_support_idls.target.darwin-arm.mk
index c45c6cb..3accd09 100644
--- a/Source/core/generate_test_support_idls.target.darwin-arm.mk
+++ b/Source/core/generate_test_support_idls.target.darwin-arm.mk
@@ -20,7 +20,7 @@
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/page/make_settings.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/page/Settings.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_Settings ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
 
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
@@ -31,9 +31,9 @@
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.idl.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_InternalRuntimeFlags ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.h: $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl ;
 
diff --git a/Source/core/generate_test_support_idls.target.darwin-mips.mk b/Source/core/generate_test_support_idls.target.darwin-mips.mk
index c45c6cb..3accd09 100644
--- a/Source/core/generate_test_support_idls.target.darwin-mips.mk
+++ b/Source/core/generate_test_support_idls.target.darwin-mips.mk
@@ -20,7 +20,7 @@
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/page/make_settings.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/page/Settings.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_Settings ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
 
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
@@ -31,9 +31,9 @@
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.idl.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_InternalRuntimeFlags ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.h: $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl ;
 
diff --git a/Source/core/generate_test_support_idls.target.darwin-x86.mk b/Source/core/generate_test_support_idls.target.darwin-x86.mk
index c45c6cb..3accd09 100644
--- a/Source/core/generate_test_support_idls.target.darwin-x86.mk
+++ b/Source/core/generate_test_support_idls.target.darwin-x86.mk
@@ -20,7 +20,7 @@
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/page/make_settings.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/page/Settings.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_Settings ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
 
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
@@ -31,9 +31,9 @@
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.idl.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_InternalRuntimeFlags ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.h: $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl ;
 
diff --git a/Source/core/generate_test_support_idls.target.linux-arm.mk b/Source/core/generate_test_support_idls.target.linux-arm.mk
index c45c6cb..3accd09 100644
--- a/Source/core/generate_test_support_idls.target.linux-arm.mk
+++ b/Source/core/generate_test_support_idls.target.linux-arm.mk
@@ -20,7 +20,7 @@
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/page/make_settings.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/page/Settings.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_Settings ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
 
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
@@ -31,9 +31,9 @@
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.idl.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_InternalRuntimeFlags ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.h: $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl ;
 
diff --git a/Source/core/generate_test_support_idls.target.linux-mips.mk b/Source/core/generate_test_support_idls.target.linux-mips.mk
index c45c6cb..3accd09 100644
--- a/Source/core/generate_test_support_idls.target.linux-mips.mk
+++ b/Source/core/generate_test_support_idls.target.linux-mips.mk
@@ -20,7 +20,7 @@
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/page/make_settings.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/page/Settings.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_Settings ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
 
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
@@ -31,9 +31,9 @@
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.idl.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_InternalRuntimeFlags ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.h: $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl ;
 
diff --git a/Source/core/generate_test_support_idls.target.linux-x86.mk b/Source/core/generate_test_support_idls.target.linux-x86.mk
index c45c6cb..3accd09 100644
--- a/Source/core/generate_test_support_idls.target.linux-x86.mk
+++ b/Source/core/generate_test_support_idls.target.linux-x86.mk
@@ -20,7 +20,7 @@
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/page/make_settings.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/page/Settings.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_Settings ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SettingsMacros.h" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp" "$(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.h" -- page/make_settings.pl page/Settings.in
 
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.idl: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
 $(gyp_shared_intermediate_dir)/blink/InternalSettingsGenerated.cpp: $(gyp_shared_intermediate_dir)/blink/SettingsMacros.h ;
@@ -31,9 +31,9 @@
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_internal_runtime_flags.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/InternalRuntimeFlags.idl.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_generate_test_support_idls_target_InternalRuntimeFlags ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_internal_runtime_flags.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.h: $(gyp_shared_intermediate_dir)/blink/InternalRuntimeFlags.idl ;
 
diff --git a/Source/core/history/BackForwardController.cpp b/Source/core/history/BackForwardController.cpp
index 45fde04..436e471 100644
--- a/Source/core/history/BackForwardController.cpp
+++ b/Source/core/history/BackForwardController.cpp
@@ -30,7 +30,7 @@
 #include "core/history/HistoryItem.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 
 namespace WebCore {
diff --git a/Source/core/history/HistoryItem.cpp b/Source/core/history/HistoryItem.cpp
index a61fc2c..56dacc9 100644
--- a/Source/core/history/HistoryItem.cpp
+++ b/Source/core/history/HistoryItem.cpp
@@ -47,10 +47,7 @@
 }
 
 HistoryItem::HistoryItem()
-    : m_lastVisitedTime(0)
-    , m_pageScaleFactor(0)
-    , m_isTargetItem(false)
-    , m_visitCount(0)
+    : m_pageScaleFactor(0)
     , m_itemSequenceNumber(generateSequenceNumber())
     , m_documentSequenceNumber(generateSequenceNumber())
 {
@@ -66,14 +63,8 @@
     , m_originalURLString(item.m_originalURLString)
     , m_referrer(item.m_referrer)
     , m_target(item.m_target)
-    , m_parent(item.m_parent)
-    , m_title(item.m_title)
-    , m_displayTitle(item.m_displayTitle)
-    , m_lastVisitedTime(item.m_lastVisitedTime)
     , m_scrollPoint(item.m_scrollPoint)
     , m_pageScaleFactor(item.m_pageScaleFactor)
-    , m_isTargetItem(item.m_isTargetItem)
-    , m_visitCount(item.m_visitCount)
     , m_itemSequenceNumber(item.m_itemSequenceNumber)
     , m_documentSequenceNumber(item.m_documentSequenceNumber)
     , m_formContentType(item.m_formContentType)
@@ -98,23 +89,11 @@
     m_originalURLString = String();
     m_referrer = String();
     m_target = String();
-    m_parent = String();
-    m_title = String();
-    m_displayTitle = String();
-
-    m_lastVisitedTime = 0;
-
-    m_isTargetItem = false;
-    m_visitCount = 0;
-
     m_itemSequenceNumber = generateSequenceNumber();
-
     m_stateObject = 0;
     m_documentSequenceNumber = generateSequenceNumber();
-
     m_formData = 0;
     m_formContentType = String();
-
     clearChildren();
 }
 
@@ -130,21 +109,6 @@
     return m_originalURLString;
 }
 
-const String& HistoryItem::title() const
-{
-    return m_title;
-}
-
-const String& HistoryItem::alternateTitle() const
-{
-    return m_displayTitle;
-}
-
-double HistoryItem::lastVisitedTime() const
-{
-    return m_lastVisitedTime;
-}
-
 KURL HistoryItem::url() const
 {
     return KURL(ParsedURLString, m_urlString);
@@ -165,16 +129,6 @@
     return m_target;
 }
 
-const String& HistoryItem::parent() const
-{
-    return m_parent;
-}
-
-void HistoryItem::setAlternateTitle(const String& alternateTitle)
-{
-    m_displayTitle = alternateTitle;
-}
-
 void HistoryItem::setURLString(const String& urlString)
 {
     if (m_urlString != urlString)
@@ -197,43 +151,11 @@
     m_referrer = referrer;
 }
 
-void HistoryItem::setTitle(const String& title)
-{
-    m_title = title;
-}
-
 void HistoryItem::setTarget(const String& target)
 {
     m_target = target;
 }
 
-void HistoryItem::setParent(const String& parent)
-{
-    m_parent = parent;
-}
-
-void HistoryItem::recordVisitAtTime(double time)
-{
-    m_lastVisitedTime = time;
-    ++m_visitCount;
-}
-
-void HistoryItem::setLastVisitedTime(double time)
-{
-    if (m_lastVisitedTime != time)
-        recordVisitAtTime(time);
-}
-
-int HistoryItem::visitCount() const
-{
-    return m_visitCount;
-}
-
-void HistoryItem::setVisitCount(int count)
-{
-    m_visitCount = count;
-}
-
 const IntPoint& HistoryItem::scrollPoint() const
 {
     return m_scrollPoint;
@@ -275,16 +197,6 @@
     m_documentState.clear();
 }
 
-bool HistoryItem::isTargetItem() const
-{
-    return m_isTargetItem;
-}
-
-void HistoryItem::setIsTargetItem(bool flag)
-{
-    m_isTargetItem = flag;
-}
-
 void HistoryItem::setStateObject(PassRefPtr<SerializedScriptValue> object)
 {
     m_stateObject = object;
@@ -298,11 +210,9 @@
 
 void HistoryItem::setChildItem(PassRefPtr<HistoryItem> child)
 {
-    ASSERT(!child->isTargetItem());
     unsigned size = m_children.size();
     for (unsigned i = 0; i < size; ++i)  {
         if (m_children[i]->target() == child->target()) {
-            child->setIsTargetItem(m_children[i]->isTargetItem());
             m_children[i] = child;
             return;
         }
@@ -340,18 +250,6 @@
     m_children.clear();
 }
 
-bool HistoryItem::isAncestorOf(const HistoryItem* item) const
-{
-    for (size_t i = 0; i < m_children.size(); ++i) {
-        HistoryItem* child = m_children[i].get();
-        if (child == item)
-            return true;
-        if (child->isAncestorOf(item))
-            return true;
-    }
-    return false;
-}
-
 // We do same-document navigation if going to a different item and if either of the following is true:
 // - The other item corresponds to the same document (for history entries created via pushState or fragment changes).
 // - The other item corresponds to the same set of documents, including frames (for history entries created via regular navigation)
diff --git a/Source/core/history/HistoryItem.h b/Source/core/history/HistoryItem.h
index 8ac78ab..15793db 100644
--- a/Source/core/history/HistoryItem.h
+++ b/Source/core/history/HistoryItem.h
@@ -28,7 +28,7 @@
 #define HistoryItem_h
 
 #include "bindings/v8/SerializedScriptValue.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/geometry/IntPoint.h"
 #include "wtf/RefCounted.h"
 #include "wtf/text/WTFString.h"
 
@@ -56,25 +56,15 @@
 
     const String& originalURLString() const;
     const String& urlString() const;
-    const String& title() const;
-
-    double lastVisitedTime() const;
-
-    void setAlternateTitle(const String& alternateTitle);
-    const String& alternateTitle() const;
-
-    const String& parent() const;
     KURL url() const;
     KURL originalURL() const;
+
     const String& referrer() const;
     const String& target() const;
-    bool isTargetItem() const;
 
     FormData* formData();
     String formContentType() const;
 
-    int visitCount() const;
-
     const IntPoint& scrollPoint() const;
     void setScrollPoint(const IntPoint&);
     void clearScrollPoint();
@@ -91,9 +81,6 @@
     void setOriginalURLString(const String&);
     void setReferrer(const String&);
     void setTarget(const String&);
-    void setParent(const String&);
-    void setTitle(const String&);
-    void setIsTargetItem(bool);
 
     void setStateObject(PassRefPtr<SerializedScriptValue> object);
     SerializedScriptValue* stateObject() const { return m_stateObject.get(); }
@@ -108,21 +95,16 @@
     void setFormData(PassRefPtr<FormData>);
     void setFormContentType(const String&);
 
-    void setVisitCount(int);
-
     void addChildItem(PassRefPtr<HistoryItem>);
     void setChildItem(PassRefPtr<HistoryItem>);
     HistoryItem* childItemWithTarget(const String&) const;
     HistoryItem* childItemWithDocumentSequenceNumber(long long number) const;
     const HistoryItemVector& children() const;
     void clearChildren();
-    bool isAncestorOf(const HistoryItem*) const;
 
     bool shouldDoSameDocumentNavigationTo(HistoryItem* otherItem) const;
     bool hasSameFrames(HistoryItem* otherItem) const;
 
-    void setLastVisitedTime(double);
-
     bool isCurrentDocument(Document*) const;
 
 #ifndef NDEBUG
@@ -134,19 +116,12 @@
     HistoryItem();
     explicit HistoryItem(const HistoryItem&);
 
-    void recordVisitAtTime(double);
-
     bool hasSameDocumentTree(HistoryItem* otherItem) const;
 
     String m_urlString;
     String m_originalURLString;
     String m_referrer;
     String m_target;
-    String m_parent;
-    String m_title;
-    String m_displayTitle;
-
-    double m_lastVisitedTime;
 
     IntPoint m_scrollPoint;
     float m_pageScaleFactor;
@@ -154,9 +129,6 @@
 
     HistoryItemVector m_children;
 
-    bool m_isTargetItem;
-    int m_visitCount;
-
     // If two HistoryItems have the same item sequence number, then they are
     // clones of one another.  Traversing history from one such HistoryItem to
     // another is a no-op.  HistoryItem clones are created for parent and
diff --git a/Source/core/html/DOMFormData.h b/Source/core/html/DOMFormData.h
index c522b72..47710db 100644
--- a/Source/core/html/DOMFormData.h
+++ b/Source/core/html/DOMFormData.h
@@ -31,7 +31,7 @@
 #ifndef DOMFormData_h
 #define DOMFormData_h
 
-#include "core/html/FormDataList.h"
+#include "core/platform/network/FormDataList.h"
 #include "wtf/Forward.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
diff --git a/Source/core/html/DOMURL.cpp b/Source/core/html/DOMURL.cpp
deleted file mode 100644
index a7b7f71..0000000
--- a/Source/core/html/DOMURL.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2012 Motorola Mobility Inc.
- *
- * 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/html/DOMURL.h"
-
-#include "core/dom/ScriptExecutionContext.h"
-#include "core/fetch/MemoryCache.h"
-#include "core/fileapi/Blob.h"
-#include "core/fileapi/BlobURL.h"
-#include "core/html/PublicURLManager.h"
-#include "weborigin/KURL.h"
-#include "wtf/MainThread.h"
-
-namespace WebCore {
-
-String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob)
-{
-    if (!scriptExecutionContext || !blob)
-        return String();
-    return createPublicURL(scriptExecutionContext, blob);
-}
-
-String DOMURL::createPublicURL(ScriptExecutionContext* scriptExecutionContext, URLRegistrable* registrable)
-{
-    KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin());
-    if (publicURL.isEmpty())
-        return String();
-
-    scriptExecutionContext->publicURLManager().registerURL(scriptExecutionContext->securityOrigin(), publicURL, registrable);
-
-    return publicURL.string();
-}
-
-void DOMURL::revokeObjectURL(ScriptExecutionContext* scriptExecutionContext, const String& urlString)
-{
-    if (!scriptExecutionContext)
-        return;
-
-    KURL url(KURL(), urlString);
-    MemoryCache::removeURLFromCache(scriptExecutionContext, url);
-    scriptExecutionContext->publicURLManager().revoke(url);
-}
-
-} // namespace WebCore
diff --git a/Source/core/html/DOMURL.h b/Source/core/html/DOMURL.h
deleted file mode 100644
index a3784de..0000000
--- a/Source/core/html/DOMURL.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2012 Motorola Mobility Inc.
- *
- * 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 DOMURL_h
-#define DOMURL_h
-
-#include "wtf/Forward.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class Blob;
-class ScriptExecutionContext;
-class URLRegistrable;
-
-class DOMURL : public RefCounted<DOMURL> {
-
-public:
-    static PassRefPtr<DOMURL> create() { return adoptRef(new DOMURL); }
-
-    static String createObjectURL(ScriptExecutionContext*, Blob*);
-    static void revokeObjectURL(ScriptExecutionContext*, const String&);
-
-    static String createPublicURL(ScriptExecutionContext*, URLRegistrable*);
-};
-
-} // namespace WebCore
-
-#endif // DOMURL_h
diff --git a/Source/core/html/FormAssociatedElement.cpp b/Source/core/html/FormAssociatedElement.cpp
index e800826..b1de0fc 100644
--- a/Source/core/html/FormAssociatedElement.cpp
+++ b/Source/core/html/FormAssociatedElement.cpp
@@ -66,10 +66,10 @@
     return m_validityState.get();
 }
 
-void FormAssociatedElement::didMoveToNewDocument(Document* oldDocument)
+void FormAssociatedElement::didMoveToNewDocument(Document& oldDocument)
 {
     HTMLElement* element = toHTMLElement(this);
-    if (oldDocument && element->fastHasAttribute(formAttr))
+    if (element->fastHasAttribute(formAttr))
         m_formAttributeTargetObserver = nullptr;
 }
 
diff --git a/Source/core/html/FormAssociatedElement.h b/Source/core/html/FormAssociatedElement.h
index 85b5e74..e7d994b 100644
--- a/Source/core/html/FormAssociatedElement.h
+++ b/Source/core/html/FormAssociatedElement.h
@@ -93,7 +93,7 @@
 
     void insertedInto(ContainerNode*);
     void removedFrom(ContainerNode*);
-    void didMoveToNewDocument(Document* oldDocument);
+    void didMoveToNewDocument(Document& oldDocument);
 
     void setForm(HTMLFormElement*);
     void formAttributeChanged();
diff --git a/Source/core/html/FormDataList.cpp b/Source/core/html/FormDataList.cpp
deleted file mode 100644
index 6096a23..0000000
--- a/Source/core/html/FormDataList.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2008 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "core/html/FormDataList.h"
-
-#include "core/platform/text/LineEnding.h"
-
-namespace WebCore {
-
-FormDataList::FormDataList(const WTF::TextEncoding& c)
-    : m_encoding(c)
-{
-}
-
-void FormDataList::appendString(const String& string)
-{
-    CString encodedString = m_encoding.encode(string, WTF::EntitiesForUnencodables);
-    m_items.append(normalizeLineEndingsToCRLF(encodedString));
-}
-
-void FormDataList::appendString(const CString& string)
-{
-    m_items.append(string);
-}
-
-void FormDataList::appendBlob(PassRefPtr<Blob> blob, const String& filename)
-{
-    m_items.append(Item(blob, filename));
-}
-
-} // namespace
diff --git a/Source/core/html/HTMLAllCollection.h b/Source/core/html/HTMLAllCollection.h
index bf6cddf..d5f1106 100644
--- a/Source/core/html/HTMLAllCollection.h
+++ b/Source/core/html/HTMLAllCollection.h
@@ -30,7 +30,7 @@
 
 namespace WebCore {
 
-class HTMLAllCollection : public HTMLCollection {
+class HTMLAllCollection FINAL : public HTMLCollection {
 public:
     static PassRefPtr<HTMLAllCollection> create(Node*, CollectionType);
     virtual ~HTMLAllCollection();
diff --git a/Source/core/html/HTMLAnchorElement.cpp b/Source/core/html/HTMLAnchorElement.cpp
index 994f76c..b29ed18 100644
--- a/Source/core/html/HTMLAnchorElement.cpp
+++ b/Source/core/html/HTMLAnchorElement.cpp
@@ -26,10 +26,10 @@
 
 #include "HTMLNames.h"
 #include "core/dom/Attribute.h"
-#include "core/events/EventNames.h"
+#include "core/editing/FrameSelection.h"
 #include "core/events/KeyboardEvent.h"
 #include "core/events/MouseEvent.h"
-#include "core/editing/FrameSelection.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
@@ -40,15 +40,15 @@
 #include "core/loader/PingLoader.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/HistogramSupport.h"
-#include "core/platform/PlatformMouseEvent.h"
-#include "core/platform/network/DNS.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/rendering/RenderImage.h"
 #include "core/svg/graphics/SVGImage.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/network/DNS.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebPrescientNetworking.h"
 #include "public/platform/WebURL.h"
@@ -92,7 +92,7 @@
     void handleMouseOut(Event* event);
     void handleLeftMouseDown(Event* event);
     void handleGestureTapUnconfirmed(Event*);
-    void handleGestureTapDown(Event*);
+    void handleGestureShowPress(Event*);
     void handleClick(Event* event);
 
     bool shouldPrefetch(const KURL&);
@@ -225,10 +225,10 @@
         if (rendererIsEditable()) {
             // This keeps track of the editable block that the selection was in (if it was in one) just before the link was clicked
             // for the LiveWhenNotFocused editable link behavior
-            if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && toMouseEvent(event)->button() != RightButton && document().frame()) {
+            if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() != RightButton && document().frame()) {
                 setRootEditableElementForSelectionOnMouseDown(document().frame()->selection().rootEditableElement());
                 m_wasShiftKeyDownOnMouseDown = toMouseEvent(event)->shiftKey();
-            } else if (event->type() == eventNames().mouseoverEvent) {
+            } else if (event->type() == EventTypeNames::mouseover) {
                 // These are cleared on mouseover and not mouseout because their values are needed for drag events,
                 // but drag events happen after mouse out events.
                 clearRootEditableElementForSelectionOnMouseDown();
@@ -343,6 +343,26 @@
     setAttribute(hrefAttr, value);
 }
 
+KURL HTMLAnchorElement::url() const
+{
+    return href();
+}
+
+void HTMLAnchorElement::setURL(const KURL& url)
+{
+    setHref(url.string());
+}
+
+String HTMLAnchorElement::input() const
+{
+    return getAttribute(hrefAttr);
+}
+
+void HTMLAnchorElement::setInput(const String& value)
+{
+    setHref(value);
+}
+
 bool HTMLAnchorElement::hasRel(uint32_t relation) const
 {
     return m_linkRelations & relation;
@@ -373,180 +393,12 @@
     return getAttribute(targetAttr);
 }
 
-String HTMLAnchorElement::hash() const
-{
-    String fragmentIdentifier = href().fragmentIdentifier();
-    if (fragmentIdentifier.isEmpty())
-        return emptyString();
-    return AtomicString(String("#" + fragmentIdentifier));
-}
-
-void HTMLAnchorElement::setHash(const String& value)
-{
-    KURL url = href();
-    if (value[0] == '#')
-        url.setFragmentIdentifier(value.substring(1));
-    else
-        url.setFragmentIdentifier(value);
-    setHref(url.string());
-}
-
-String HTMLAnchorElement::host() const
-{
-    const KURL& url = href();
-    if (url.hostEnd() == url.pathStart())
-        return url.host();
-    if (isDefaultPortForProtocol(url.port(), url.protocol()))
-        return url.host();
-    return url.host() + ":" + String::number(url.port());
-}
-
-void HTMLAnchorElement::setHost(const String& value)
-{
-    if (value.isEmpty())
-        return;
-    KURL url = href();
-    if (!url.canSetHostOrPort())
-        return;
-
-    size_t separator = value.find(':');
-    if (!separator)
-        return;
-
-    if (separator == kNotFound)
-        url.setHostAndPort(value);
-    else {
-        unsigned portEnd;
-        unsigned port = parsePortFromStringPosition(value, separator + 1, portEnd);
-        if (!port) {
-            // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes
-            // specifically goes against RFC 3986 (p3.2) and
-            // requires setting the port to "0" if it is set to empty string.
-            url.setHostAndPort(value.substring(0, separator + 1) + "0");
-        } else {
-            if (isDefaultPortForProtocol(port, url.protocol()))
-                url.setHostAndPort(value.substring(0, separator));
-            else
-                url.setHostAndPort(value.substring(0, portEnd));
-        }
-    }
-    setHref(url.string());
-}
-
-String HTMLAnchorElement::hostname() const
-{
-    return href().host();
-}
-
-void HTMLAnchorElement::setHostname(const String& value)
-{
-    // Before setting new value:
-    // Remove all leading U+002F SOLIDUS ("/") characters.
-    unsigned i = 0;
-    unsigned hostLength = value.length();
-    while (value[i] == '/')
-        i++;
-
-    if (i == hostLength)
-        return;
-
-    KURL url = href();
-    if (!url.canSetHostOrPort())
-        return;
-
-    url.setHost(value.substring(i));
-    setHref(url.string());
-}
-
-String HTMLAnchorElement::pathname() const
-{
-    return href().path();
-}
-
-void HTMLAnchorElement::setPathname(const String& value)
-{
-    KURL url = href();
-    if (!url.canSetPathname())
-        return;
-
-    if (value[0] == '/')
-        url.setPath(value);
-    else
-        url.setPath("/" + value);
-
-    setHref(url.string());
-}
-
-String HTMLAnchorElement::port() const
-{
-    if (href().hasPort())
-        return String::number(href().port());
-
-    return emptyString();
-}
-
-void HTMLAnchorElement::setPort(const String& value)
-{
-    KURL url = href();
-    if (!url.canSetHostOrPort())
-        return;
-
-    // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes
-    // specifically goes against RFC 3986 (p3.2) and
-    // requires setting the port to "0" if it is set to empty string.
-    unsigned port = value.toUInt();
-    if (isDefaultPortForProtocol(port, url.protocol()))
-        url.removePort();
-    else
-        url.setPort(port);
-
-    setHref(url.string());
-}
-
-String HTMLAnchorElement::protocol() const
-{
-    return href().protocol() + ":";
-}
-
-void HTMLAnchorElement::setProtocol(const String& value)
-{
-    KURL url = href();
-    url.setProtocol(value);
-    setHref(url.string());
-}
-
-String HTMLAnchorElement::search() const
-{
-    String query = href().query();
-    return query.isEmpty() ? emptyString() : "?" + query;
-}
-
-String HTMLAnchorElement::origin() const
-{
-    RefPtr<SecurityOrigin> origin = SecurityOrigin::create(href());
-    return origin->toString();
-}
-
-void HTMLAnchorElement::setSearch(const String& value)
-{
-    KURL url = href();
-    String newSearch = (value[0] == '?') ? value.substring(1) : value;
-    // Make sure that '#' in the query does not leak to the hash.
-    url.setQuery(newSearch.replaceWithLiteral('#', "%23"));
-
-    setHref(url.string());
-}
 
 String HTMLAnchorElement::text()
 {
     return innerText();
 }
 
-String HTMLAnchorElement::toString() const
-{
-    return href().string();
-}
-
 bool HTMLAnchorElement::isLiveLink() const
 {
     return isLink() && treatLinkAsLiveForEventType(m_wasShiftKeyDownOnMouseDown ? MouseEventWithShiftKey : MouseEventWithoutShiftKey);
@@ -575,6 +427,10 @@
     appendServerMapMousePosition(url, event);
     KURL completedURL = document().completeURL(url.toString());
 
+    // Schedule the ping before the frame load. Prerender in Chrome may kill the renderer as soon as the navigation is
+    // sent out.
+    sendPings(completedURL);
+
     ResourceRequest request(completedURL);
     if (prefetchEventHandler()->hasIssuedPreconnect())
         frame->loader()->client()->dispatchWillRequestAfterPreconnect(request);
@@ -593,8 +449,6 @@
             frameRequest.setShouldSendReferrer(NeverSendReferrer);
         frame->loader()->load(frameRequest);
     }
-
-    sendPings(completedURL);
 }
 
 HTMLAnchorElement::EventType HTMLAnchorElement::eventType(Event* event)
@@ -636,12 +490,12 @@
 
 bool isEnterKeyKeydownEvent(Event* event)
 {
-    return event->type() == eventNames().keydownEvent && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter";
+    return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter";
 }
 
 bool isLinkClick(Event* event)
 {
-    return event->type() == eventNames().clickEvent && (!event->isMouseEvent() || toMouseEvent(event)->button() != RightButton);
+    return event->type() == EventTypeNames::click && (!event->isMouseEvent() || toMouseEvent(event)->button() != RightButton);
 }
 
 bool HTMLAnchorElement::willRespondToMouseClickEvents()
@@ -714,15 +568,15 @@
     if (!shouldPrefetch(m_anchorElement->href()))
         return;
 
-    if (event->type() == eventNames().mouseoverEvent)
+    if (event->type() == EventTypeNames::mouseover)
         handleMouseOver(event);
-    else if (event->type() == eventNames().mouseoutEvent)
+    else if (event->type() == EventTypeNames::mouseout)
         handleMouseOut(event);
-    else if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton)
+    else if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton)
         handleLeftMouseDown(event);
-    else if (event->type() == eventNames().gesturetapdownEvent)
-        handleGestureTapDown(event);
-    else if (event->type() == eventNames().gesturetapunconfirmedEvent)
+    else if (event->type() == EventTypeNames::gestureshowpress)
+        handleGestureShowPress(event);
+    else if (event->type() == EventTypeNames::gesturetapunconfirmed)
         handleGestureTapUnconfirmed(event);
     else if (isLinkClick(event))
         handleClick(event);
@@ -767,7 +621,7 @@
     prefetch(WebKit::WebPreconnectMotivationLinkTapUnconfirmed);
 }
 
-void HTMLAnchorElement::PrefetchEventHandler::handleGestureTapDown(Event* event)
+void HTMLAnchorElement::PrefetchEventHandler::handleGestureShowPress(Event* event)
 {
     m_tapDownTimestamp = event->timeStamp();
 
@@ -810,7 +664,7 @@
     if (m_hadHREFChanged)
         return false;
 
-    if (m_anchorElement->hasEventListeners(eventNames().clickEvent))
+    if (m_anchorElement->hasEventListeners(EventTypeNames::click))
         return false;
 
     if (!url.protocolIsInHTTPFamily())
diff --git a/Source/core/html/HTMLAnchorElement.h b/Source/core/html/HTMLAnchorElement.h
index a3410b5..b832e9c 100644
--- a/Source/core/html/HTMLAnchorElement.h
+++ b/Source/core/html/HTMLAnchorElement.h
@@ -25,8 +25,9 @@
 #define HTMLAnchorElement_h
 
 #include "HTMLNames.h"
+#include "core/dom/DOMURLUtils.h"
 #include "core/html/HTMLElement.h"
-#include "core/platform/LinkHash.h"
+#include "platform/LinkHash.h"
 
 namespace WebCore {
 
@@ -53,7 +54,7 @@
 //     RelationUp          = 0x00020000,
 };
 
-class HTMLAnchorElement : public HTMLElement {
+class HTMLAnchorElement : public HTMLElement, public DOMURLUtils {
 public:
     static PassRefPtr<HTMLAnchorElement> create(Document&);
     static PassRefPtr<HTMLAnchorElement> create(const QualifiedName&, Document&);
@@ -65,33 +66,14 @@
 
     const AtomicString& name() const;
 
-    String hash() const;
-    void setHash(const String&);
+    virtual KURL url() const OVERRIDE;
+    virtual void setURL(const KURL&) OVERRIDE;
 
-    String host() const;
-    void setHost(const String&);
-
-    String hostname() const;
-    void setHostname(const String&);
-
-    String pathname() const;
-    void setPathname(const String&);
-
-    String port() const;
-    void setPort(const String&);
-
-    String protocol() const;
-    void setProtocol(const String&);
-
-    String search() const;
-    void setSearch(const String&);
-
-    String origin() const;
+    virtual String input() const OVERRIDE;
+    virtual void setInput(const String&) OVERRIDE;
 
     String text();
 
-    String toString() const;
-
     bool isLiveLink() const;
 
     virtual bool willRespondToMouseClickEvents() OVERRIDE;
@@ -168,12 +150,13 @@
     return element->hasTagName(HTMLNames::aTag);
 }
 
-inline HTMLAnchorElement* toHTMLAnchorElement(Node* node)
+inline bool isHTMLAnchorElement(const Element& element)
 {
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLAnchorElement(node));
-    return static_cast<HTMLAnchorElement*>(node);
+    return element.hasTagName(HTMLNames::aTag);
 }
 
+DEFINE_NODE_TYPE_CASTS(HTMLAnchorElement, hasTagName(HTMLNames::aTag));
+
 } // namespace WebCore
 
 #endif // HTMLAnchorElement_h
diff --git a/Source/core/html/HTMLAnchorElement.idl b/Source/core/html/HTMLAnchorElement.idl
index e0c7068..88cf2d4 100644
--- a/Source/core/html/HTMLAnchorElement.idl
+++ b/Source/core/html/HTMLAnchorElement.idl
@@ -19,31 +19,20 @@
  */
 
 interface HTMLAnchorElement : HTMLElement {
-    [Reflect] attribute DOMString charset;
-    [Reflect] attribute DOMString coords;
-    [Reflect] attribute DOMString download;
-    [Reflect, URL] attribute DOMString href;
-    [Reflect] attribute DOMString hreflang;
-    [Reflect] attribute DOMString name;
-    [Reflect] attribute DOMString ping;
-    [Reflect] attribute DOMString rel;
-    [Reflect] attribute DOMString rev;
-    [Reflect] attribute DOMString shape;
-    [Reflect] attribute DOMString target;
-    [Reflect] attribute DOMString type;
-
-    [TreatNullAs=NullString] attribute DOMString hash;
-    [TreatNullAs=NullString] attribute DOMString host;
-    [TreatNullAs=NullString] attribute DOMString hostname;
-    [TreatNullAs=NullString] attribute DOMString pathname;
-    [TreatNullAs=NullString] attribute DOMString port;
-    [TreatNullAs=NullString] attribute DOMString protocol;
-    [TreatNullAs=NullString] attribute DOMString search;
-
-    [TreatNullAs=NullString] readonly attribute DOMString origin;
+    [Reflect, TreatNullAs=NullString] attribute DOMString charset;
+    [Reflect, TreatNullAs=NullString] attribute DOMString coords;
+    [Reflect, TreatNullAs=NullString] attribute DOMString download;
+    [Reflect, TreatNullAs=NullString] attribute DOMString hreflang;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString ping;
+    [Reflect, TreatNullAs=NullString] attribute DOMString rel;
+    [Reflect, TreatNullAs=NullString] attribute DOMString rev;
+    [Reflect, TreatNullAs=NullString] attribute DOMString shape;
+    [Reflect, TreatNullAs=NullString] attribute DOMString target;
+    [Reflect, TreatNullAs=NullString] attribute DOMString type;
 
     readonly attribute DOMString text;
-
-    [NotEnumerable] DOMString toString();
 };
 
+// Force rebuild: crbug.com/307023
+HTMLAnchorElement implements URLUtils;
diff --git a/Source/core/html/HTMLAppletElement.cpp b/Source/core/html/HTMLAppletElement.cpp
index 7475688..3664ca1 100644
--- a/Source/core/html/HTMLAppletElement.cpp
+++ b/Source/core/html/HTMLAppletElement.cpp
@@ -28,11 +28,11 @@
 #include "core/html/HTMLParamElement.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/Frame.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
-#include "core/platform/Widget.h"
 #include "core/rendering/RenderApplet.h"
+#include "platform/Widget.h"
 #include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
diff --git a/Source/core/html/HTMLAppletElement.idl b/Source/core/html/HTMLAppletElement.idl
index efb2855..655cd07 100644
--- a/Source/core/html/HTMLAppletElement.idl
+++ b/Source/core/html/HTMLAppletElement.idl
@@ -21,17 +21,17 @@
 [
     CustomLegacyCall
 ] interface HTMLAppletElement : HTMLElement {
-    [Reflect] attribute DOMString align;
-    [Reflect] attribute DOMString alt;
-    [Reflect] attribute DOMString archive;
-    [Reflect] attribute DOMString code;
-    [Reflect] attribute DOMString codeBase;
-    [Reflect] attribute DOMString height;
-    [Reflect] attribute DOMString hspace;
-    [Reflect] attribute DOMString name;
-    [Reflect] attribute DOMString _object;  // "object" is a reserved word
-    [Reflect] attribute DOMString vspace;
-    [Reflect] attribute DOMString width;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString alt;
+    [Reflect, TreatNullAs=NullString] attribute DOMString archive;
+    [Reflect, TreatNullAs=NullString] attribute DOMString code;
+    [Reflect, TreatNullAs=NullString] attribute DOMString codeBase;
+    [Reflect, TreatNullAs=NullString] attribute DOMString height;
+    [Reflect, TreatNullAs=NullString] attribute DOMString hspace;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString _object;  // "object" is a reserved word
+    [Reflect, TreatNullAs=NullString] attribute DOMString vspace;
+    [Reflect, TreatNullAs=NullString] attribute DOMString width;
     [Custom, NotEnumerable] getter boolean (unsigned long index);
     [Custom] setter boolean (unsigned long index, Node value);
     [Custom, NotEnumerable] getter Node (DOMString name);
diff --git a/Source/core/html/HTMLAreaElement.cpp b/Source/core/html/HTMLAreaElement.cpp
index 46ee04a..437c28f 100644
--- a/Source/core/html/HTMLAreaElement.cpp
+++ b/Source/core/html/HTMLAreaElement.cpp
@@ -26,10 +26,10 @@
 #include "core/html/HTMLImageElement.h"
 #include "core/html/HTMLMapElement.h"
 #include "core/platform/graphics/Path.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderImage.h"
 #include "core/rendering/RenderView.h"
+#include "platform/transforms/AffineTransform.h"
 
 using namespace std;
 
diff --git a/Source/core/html/HTMLAreaElement.h b/Source/core/html/HTMLAreaElement.h
index 2fc4ceb..b5f2221 100644
--- a/Source/core/html/HTMLAreaElement.h
+++ b/Source/core/html/HTMLAreaElement.h
@@ -24,7 +24,7 @@
 #define HTMLAreaElement_h
 
 #include "core/html/HTMLAnchorElement.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLAreaElement.idl b/Source/core/html/HTMLAreaElement.idl
index a9c1fa7..1175ec1 100644
--- a/Source/core/html/HTMLAreaElement.idl
+++ b/Source/core/html/HTMLAreaElement.idl
@@ -19,21 +19,13 @@
  */
 
 interface HTMLAreaElement : HTMLElement {
-    [Reflect] attribute DOMString alt;
-    [Reflect] attribute DOMString coords;
-    [Reflect, URL] attribute DOMString href;
+    [Reflect, TreatNullAs=NullString] attribute DOMString alt;
+    [Reflect, TreatNullAs=NullString] attribute DOMString coords;
     [Reflect] attribute boolean noHref;
-    [Reflect] attribute DOMString ping;
-    [Reflect] attribute DOMString shape;
-    [Reflect] attribute DOMString target;
-
-    // IE Extensions
-    readonly attribute DOMString hash;
-    readonly attribute DOMString host;
-    readonly attribute DOMString hostname;
-    readonly attribute DOMString pathname;
-    readonly attribute DOMString port;
-    readonly attribute DOMString protocol;
-    readonly attribute DOMString search;
+    [Reflect, TreatNullAs=NullString] attribute DOMString ping;
+    [Reflect, TreatNullAs=NullString] attribute DOMString shape;
+    [Reflect, TreatNullAs=NullString] attribute DOMString target;
 };
 
+// Force rebuild: crbug.com/307023
+HTMLAreaElement implements URLUtils;
diff --git a/Source/core/html/HTMLAudioElement.idl b/Source/core/html/HTMLAudioElement.idl
index cbed9d6..ffb4769 100644
--- a/Source/core/html/HTMLAudioElement.idl
+++ b/Source/core/html/HTMLAudioElement.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=Media,
+    RuntimeEnabled=Media,
     NamedConstructor=Audio([Default=NullString] optional DOMString src)
 ] interface HTMLAudioElement : HTMLMediaElement {
 };
diff --git a/Source/core/html/HTMLBRElement.idl b/Source/core/html/HTMLBRElement.idl
index c909dc1..7c31dfb 100644
--- a/Source/core/html/HTMLBRElement.idl
+++ b/Source/core/html/HTMLBRElement.idl
@@ -18,6 +18,6 @@
  */
 
 interface HTMLBRElement : HTMLElement {
-    [Reflect] attribute DOMString clear;
+    [Reflect, TreatNullAs=NullString] attribute DOMString clear;
 };
 
diff --git a/Source/core/html/HTMLBaseElement.idl b/Source/core/html/HTMLBaseElement.idl
index 4d9d39f..408e129 100644
--- a/Source/core/html/HTMLBaseElement.idl
+++ b/Source/core/html/HTMLBaseElement.idl
@@ -19,5 +19,5 @@
 
 interface HTMLBaseElement : HTMLElement {
     [TreatNullAs=NullString] attribute DOMString href;
-    [Reflect] attribute DOMString target;
+    [Reflect, TreatNullAs=NullString] attribute DOMString target;
 };
diff --git a/Source/core/html/HTMLBaseFontElement.idl b/Source/core/html/HTMLBaseFontElement.idl
index b885a05..a4910e8 100644
--- a/Source/core/html/HTMLBaseFontElement.idl
+++ b/Source/core/html/HTMLBaseFontElement.idl
@@ -18,7 +18,7 @@
  */
 
 interface HTMLBaseFontElement : HTMLElement {
-    [Reflect] attribute DOMString color;
-    [Reflect] attribute DOMString face;
+    [Reflect, TreatNullAs=NullString] attribute DOMString color;
+    [Reflect, TreatNullAs=NullString] attribute DOMString face;
     [Reflect] attribute long size;
 };
diff --git a/Source/core/html/HTMLBodyElement.cpp b/Source/core/html/HTMLBodyElement.cpp
index ecf3923..0633ec7 100644
--- a/Source/core/html/HTMLBodyElement.cpp
+++ b/Source/core/html/HTMLBodyElement.cpp
@@ -31,11 +31,11 @@
 #include "core/css/CSSParser.h"
 #include "core/css/StylePropertySet.h"
 #include "core/dom/Attribute.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLFrameElementBase.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 
 namespace WebCore {
 
@@ -119,39 +119,39 @@
 
         setNeedsStyleRecalc();
     } else if (name == onloadAttr)
-        document().setWindowAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::load, createAttributeEventListener(document().frame(), name, value));
     else if (name == onbeforeunloadAttr)
-        document().setWindowAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::beforeunload, createAttributeEventListener(document().frame(), name, value));
     else if (name == onunloadAttr)
-        document().setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::unload, createAttributeEventListener(document().frame(), name, value));
     else if (name == onpagehideAttr)
-        document().setWindowAttributeEventListener(eventNames().pagehideEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::pagehide, createAttributeEventListener(document().frame(), name, value));
     else if (name == onpageshowAttr)
-        document().setWindowAttributeEventListener(eventNames().pageshowEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::pageshow, createAttributeEventListener(document().frame(), name, value));
     else if (name == onpopstateAttr)
-        document().setWindowAttributeEventListener(eventNames().popstateEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::popstate, createAttributeEventListener(document().frame(), name, value));
     else if (name == onblurAttr)
-        document().setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::blur, createAttributeEventListener(document().frame(), name, value));
     else if (name == onfocusAttr)
-        document().setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::focus, createAttributeEventListener(document().frame(), name, value));
 #if ENABLE(ORIENTATION_EVENTS)
     else if (name == onorientationchangeAttr)
-        document().setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::orientationchange, createAttributeEventListener(document().frame(), name, value));
 #endif
     else if (name == onhashchangeAttr)
-        document().setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::hashchange, createAttributeEventListener(document().frame(), name, value));
     else if (name == onresizeAttr)
-        document().setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::resize, createAttributeEventListener(document().frame(), name, value));
     else if (name == onscrollAttr)
-        document().setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::scroll, createAttributeEventListener(document().frame(), name, value));
     else if (name == onselectionchangeAttr)
-        document().setAttributeEventListener(eventNames().selectionchangeEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setAttributeEventListener(EventTypeNames::selectionchange, createAttributeEventListener(document().frame(), name, value));
     else if (name == onstorageAttr)
-        document().setWindowAttributeEventListener(eventNames().storageEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::storage, createAttributeEventListener(document().frame(), name, value));
     else if (name == ononlineAttr)
-        document().setWindowAttributeEventListener(eventNames().onlineEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::online, createAttributeEventListener(document().frame(), name, value));
     else if (name == onofflineAttr)
-        document().setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::offline, createAttributeEventListener(document().frame(), name, value));
     else
         HTMLElement::parseAttribute(name, value);
 }
@@ -189,56 +189,6 @@
     return rendererIsEditable() || HTMLElement::supportsFocus();
 }
 
-String HTMLBodyElement::aLink() const
-{
-    return getAttribute(alinkAttr);
-}
-
-void HTMLBodyElement::setALink(const String& value)
-{
-    setAttribute(alinkAttr, value);
-}
-
-String HTMLBodyElement::bgColor() const
-{
-    return getAttribute(bgcolorAttr);
-}
-
-void HTMLBodyElement::setBgColor(const String& value)
-{
-    setAttribute(bgcolorAttr, value);
-}
-
-String HTMLBodyElement::link() const
-{
-    return getAttribute(linkAttr);
-}
-
-void HTMLBodyElement::setLink(const String& value)
-{
-    setAttribute(linkAttr, value);
-}
-
-String HTMLBodyElement::text() const
-{
-    return getAttribute(textAttr);
-}
-
-void HTMLBodyElement::setText(const String& value)
-{
-    setAttribute(textAttr, value);
-}
-
-String HTMLBodyElement::vLink() const
-{
-    return getAttribute(vlinkAttr);
-}
-
-void HTMLBodyElement::setVLink(const String& value)
-{
-    setAttribute(vlinkAttr, value);
-}
-
 static int adjustForZoom(int value, Document* document)
 {
     Frame* frame = document->frame();
@@ -253,8 +203,15 @@
 
 int HTMLBodyElement::scrollLeft()
 {
-    // Update the document's layout.
     Document& document = this->document();
+
+    // FIXME: There are cases where body.scrollLeft is allowed to return
+    // non-zero values in both quirks and strict mode. It happens when
+    // <body> has an overflow that is not the Frame overflow.
+    // http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft
+    if (!document.inQuirksMode())
+        UseCounter::countDeprecation(&document, UseCounter::ScrollLeftBodyNotQuirksMode);
+
     document.updateLayoutIgnorePendingStylesheets();
     FrameView* view = document.view();
     return view ? adjustForZoom(view->scrollX(), &document) : 0;
@@ -263,6 +220,10 @@
 void HTMLBodyElement::setScrollLeft(int scrollLeft)
 {
     Document& document = this->document();
+
+    if (!document.inQuirksMode())
+        UseCounter::countDeprecation(&document, UseCounter::ScrollLeftBodyNotQuirksMode);
+
     document.updateLayoutIgnorePendingStylesheets();
     Frame* frame = document.frame();
     if (!frame)
@@ -275,8 +236,15 @@
 
 int HTMLBodyElement::scrollTop()
 {
-    // Update the document's layout.
     Document& document = this->document();
+
+    // FIXME: There are cases where body.scrollTop is allowed to return
+    // non-zero values in both quirks and strict mode. It happens when
+    // body has a overflow that is not the Frame overflow.
+    // http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop
+    if (!document.inQuirksMode())
+        UseCounter::countDeprecation(&document, UseCounter::ScrollTopBodyNotQuirksMode);
+
     document.updateLayoutIgnorePendingStylesheets();
     FrameView* view = document.view();
     return view ? adjustForZoom(view->scrollY(), &document) : 0;
@@ -285,6 +253,10 @@
 void HTMLBodyElement::setScrollTop(int scrollTop)
 {
     Document& document = this->document();
+
+    if (!document.inQuirksMode())
+        UseCounter::countDeprecation(&document, UseCounter::ScrollTopBodyNotQuirksMode);
+
     document.updateLayoutIgnorePendingStylesheets();
     Frame* frame = document.frame();
     if (!frame)
diff --git a/Source/core/html/HTMLBodyElement.h b/Source/core/html/HTMLBodyElement.h
index fd1a960..4b27a20 100644
--- a/Source/core/html/HTMLBodyElement.h
+++ b/Source/core/html/HTMLBodyElement.h
@@ -36,17 +36,6 @@
     static PassRefPtr<HTMLBodyElement> create(const QualifiedName&, Document&);
     virtual ~HTMLBodyElement();
 
-    String aLink() const;
-    void setALink(const String&);
-    String bgColor() const;
-    void setBgColor(const String&);
-    String link() const;
-    void setLink(const String&);
-    String text() const;
-    void setText(const String&);
-    String vLink() const;
-    void setVLink(const String&);
-
     // Declared virtual in Element
     DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(blur);
     DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(error);
diff --git a/Source/core/html/HTMLBodyElement.idl b/Source/core/html/HTMLBodyElement.idl
index dfbd907..6ecf3d7 100644
--- a/Source/core/html/HTMLBodyElement.idl
+++ b/Source/core/html/HTMLBodyElement.idl
@@ -19,12 +19,12 @@
  */
 
 interface HTMLBodyElement : HTMLElement {
-    [Reflect] attribute DOMString aLink;
-    [Reflect] attribute DOMString background;
-    [Reflect] attribute DOMString bgColor;
-    [Reflect] attribute DOMString link;
-    [Reflect] attribute DOMString text;
-    [Reflect] attribute DOMString vLink;
+    [Reflect, TreatNullAs=NullString] attribute DOMString aLink;
+    [Reflect, TreatNullAs=NullString] attribute DOMString background;
+    [Reflect, TreatNullAs=NullString] attribute DOMString bgColor;
+    [Reflect, TreatNullAs=NullString] attribute DOMString link;
+    [Reflect, TreatNullAs=NullString] attribute DOMString text;
+    [Reflect, TreatNullAs=NullString] attribute DOMString vLink;
 
     // Event handler attributes
     [NotEnumerable] attribute EventHandler onbeforeunload;
diff --git a/Source/core/html/HTMLButtonElement.cpp b/Source/core/html/HTMLButtonElement.cpp
index ee49e25..9956704 100644
--- a/Source/core/html/HTMLButtonElement.cpp
+++ b/Source/core/html/HTMLButtonElement.cpp
@@ -28,10 +28,10 @@
 
 #include "HTMLNames.h"
 #include "core/dom/Attribute.h"
-#include "core/events/EventNames.h"
 #include "core/events/KeyboardEvent.h"
-#include "core/html/FormDataList.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLFormElement.h"
+#include "core/platform/network/FormDataList.h"
 #include "core/rendering/RenderButton.h"
 #include "wtf/StdLibExtras.h"
 
@@ -111,7 +111,7 @@
 
 void HTMLButtonElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().DOMActivateEvent && !isDisabledFormControl()) {
+    if (event->type() == EventTypeNames::DOMActivate && !isDisabledFormControl()) {
         if (form() && m_type == SUBMIT) {
             m_isActivatedSubmit = true;
             form()->prepareForSubmission(event);
@@ -125,12 +125,12 @@
     }
 
     if (event->isKeyboardEvent()) {
-        if (event->type() == eventNames().keydownEvent && toKeyboardEvent(event)->keyIdentifier() == "U+0020") {
+        if (event->type() == EventTypeNames::keydown && toKeyboardEvent(event)->keyIdentifier() == "U+0020") {
             setActive(true, true);
             // No setDefaultHandled() - IE dispatches a keypress in this case.
             return;
         }
-        if (event->type() == eventNames().keypressEvent) {
+        if (event->type() == EventTypeNames::keypress) {
             switch (toKeyboardEvent(event)->charCode()) {
                 case '\r':
                     dispatchSimulatedClick(event);
@@ -142,7 +142,7 @@
                     return;
             }
         }
-        if (event->type() == eventNames().keyupEvent && toKeyboardEvent(event)->keyIdentifier() == "U+0020") {
+        if (event->type() == EventTypeNames::keyup && toKeyboardEvent(event)->keyIdentifier() == "U+0020") {
             if (active())
                 dispatchSimulatedClick(event);
             event->setDefaultHandled();
diff --git a/Source/core/html/HTMLButtonElement.idl b/Source/core/html/HTMLButtonElement.idl
index eb3832f..e1a6b02 100644
--- a/Source/core/html/HTMLButtonElement.idl
+++ b/Source/core/html/HTMLButtonElement.idl
@@ -22,14 +22,14 @@
     [Reflect] attribute boolean autofocus;
     [Reflect] attribute boolean disabled;
     readonly attribute HTMLFormElement form;
-    [Reflect, URL] attribute DOMString formAction;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString formAction;
     [TreatNullAs=NullString] attribute DOMString formEnctype;
     [TreatNullAs=NullString] attribute DOMString formMethod;
     [Reflect] attribute boolean formNoValidate;
-    [Reflect] attribute DOMString formTarget;
-    [Reflect] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString formTarget;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
     [TreatNullAs=NullString] attribute DOMString type;
-    [Reflect] attribute DOMString value;
+    [Reflect, TreatNullAs=NullString] attribute DOMString value;
 
     readonly attribute boolean willValidate;
     readonly attribute ValidityState validity;
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index 32c148c..94f0dc4 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -41,7 +41,7 @@
 #include "core/html/canvas/CanvasRenderingContext2D.h"
 #include "core/html/canvas/WebGLContextAttributes.h"
 #include "core/html/canvas/WebGLRenderingContext.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
 #include "core/platform/HistogramSupport.h"
 #include "core/platform/MIMETypeRegistry.h"
diff --git a/Source/core/html/HTMLCanvasElement.h b/Source/core/html/HTMLCanvasElement.h
index a9daa99..e3e9b14 100644
--- a/Source/core/html/HTMLCanvasElement.h
+++ b/Source/core/html/HTMLCanvasElement.h
@@ -29,8 +29,8 @@
 #define HTMLCanvasElement_h
 
 #include "core/html/HTMLElement.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/Forward.h"
 
 #define DefaultInterpolationQuality InterpolationMedium
diff --git a/Source/core/html/HTMLCanvasElement.idl b/Source/core/html/HTMLCanvasElement.idl
index c095796..78ada4d 100644
--- a/Source/core/html/HTMLCanvasElement.idl
+++ b/Source/core/html/HTMLCanvasElement.idl
@@ -32,6 +32,6 @@
     [Custom, RaisesException] DOMString toDataURL([TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString type);
 
     // The custom binding is needed to handle context creation attributes.
-    [Custom, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] any getContext([Default=Undefined] optional DOMString contextId);
+    [Custom, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds] any getContext([Default=Undefined] optional DOMString contextId);
 };
 
diff --git a/Source/core/html/HTMLDataListElement.cpp b/Source/core/html/HTMLDataListElement.cpp
index 42e2d68..2c609c3 100644
--- a/Source/core/html/HTMLDataListElement.cpp
+++ b/Source/core/html/HTMLDataListElement.cpp
@@ -45,7 +45,7 @@
 
 PassRefPtr<HTMLDataListElement> HTMLDataListElement::create(const QualifiedName& tagName, Document& document)
 {
-    UseCounter::count(&document, UseCounter::DataListElement);
+    UseCounter::count(document, UseCounter::DataListElement);
     return adoptRef(new HTMLDataListElement(tagName, document));
 }
 
diff --git a/Source/core/html/HTMLDataListElement.idl b/Source/core/html/HTMLDataListElement.idl
index f87df9a..93c8663 100644
--- a/Source/core/html/HTMLDataListElement.idl
+++ b/Source/core/html/HTMLDataListElement.idl
@@ -29,7 +29,7 @@
  */
 
 [
-    EnabledAtRuntime=DataListElement
+    RuntimeEnabled=DataListElement
 ] interface HTMLDataListElement : HTMLElement {
     readonly attribute HTMLCollection options;
 };
diff --git a/Source/core/html/HTMLDetailsElement.cpp b/Source/core/html/HTMLDetailsElement.cpp
index 5c987f9..c4fa924 100644
--- a/Source/core/html/HTMLDetailsElement.cpp
+++ b/Source/core/html/HTMLDetailsElement.cpp
@@ -27,8 +27,8 @@
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLSummaryElement.h"
 #include "core/html/shadow/HTMLContentElement.h"
-#include "core/platform/LocalizedStrings.h"
 #include "core/rendering/RenderBlockFlow.h"
+#include "platform/text/PlatformLocale.h"
 
 namespace WebCore {
 
@@ -59,7 +59,7 @@
     DEFINE_STATIC_LOCAL(AtomicString, summarySelector, ("summary:first-of-type", AtomicString::ConstructFromLiteral));
 
     RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(summaryTag, document());
-    defaultSummary->appendChild(Text::create(document(), defaultDetailsSummaryText()));
+    defaultSummary->appendChild(Text::create(document(), locale().queryString(WebKit::WebLocalizedString::DetailsLabel)));
 
     RefPtr<HTMLContentElement> content = HTMLContentElement::create(document());
     content->setAttribute(selectAttr, summarySelector);
@@ -99,7 +99,7 @@
         return HTMLElement::childShouldCreateRenderer(child);
     if (!child.hasTagName(summaryTag))
         return false;
-    return &child == findMainSummary() && HTMLElement::childShouldCreateRenderer(child);
+    return child == findMainSummary() && HTMLElement::childShouldCreateRenderer(child);
 }
 
 void HTMLDetailsElement::toggleOpen()
diff --git a/Source/core/html/HTMLDialogElement.cpp b/Source/core/html/HTMLDialogElement.cpp
index b5a7d65..4a77835 100644
--- a/Source/core/html/HTMLDialogElement.cpp
+++ b/Source/core/html/HTMLDialogElement.cpp
@@ -28,7 +28,9 @@
 
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/page/FrameView.h"
+#include "core/dom/NodeTraversal.h"
+#include "core/html/HTMLFormControlElement.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/style/RenderStyle.h"
 
@@ -41,6 +43,25 @@
     return style->position() == AbsolutePosition && style->hasAutoTopAndBottom();
 }
 
+static void runAutofocus(HTMLDialogElement* dialog)
+{
+    Node* next = 0;
+    for (Node* node = dialog->firstChild(); node; node = next) {
+        if (node->isElementNode() && toElement(node)->isFormControlElement()) {
+            HTMLFormControlElement* control = toHTMLFormControlElement(node);
+            if (control->isAutofocusable()) {
+                control->focus();
+                control->setAutofocused();
+                return;
+            }
+        }
+        if (node->hasTagName(dialogTag))
+            next = NodeTraversal::nextSkippingChildren(node, dialog);
+        else
+            next = NodeTraversal::next(node, dialog);
+    }
+}
+
 HTMLDialogElement::HTMLDialogElement(const QualifiedName& tagName, Document& document)
     : HTMLElement(tagName, document)
     , m_topIsValid(false)
@@ -68,6 +89,8 @@
 
 void HTMLDialogElement::closeDialog(const String& returnValue)
 {
+    if (!fastHasAttribute(openAttr))
+        return;
     setBooleanAttribute(openAttr, false);
     document().removeFromTopLayer(this);
     m_topIsValid = false;
@@ -75,7 +98,7 @@
     if (!returnValue.isNull())
         m_returnValue = returnValue;
 
-    dispatchEvent(Event::create(eventNames().closeEvent));
+    dispatchEvent(Event::create(EventTypeNames::close));
 }
 
 PassRefPtr<RenderStyle> HTMLDialogElement::customStyleForRenderer()
@@ -128,6 +151,8 @@
     }
     document().addToTopLayer(this);
     setBooleanAttribute(openAttr, true);
+
+    runAutofocus(this);
     reposition();
 }
 
@@ -143,7 +168,7 @@
 
 void HTMLDialogElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().cancelEvent) {
+    if (event->type() == EventTypeNames::cancel) {
         closeDialog();
         event->setDefaultHandled();
         return;
diff --git a/Source/core/html/HTMLDialogElement.h b/Source/core/html/HTMLDialogElement.h
index f17bc84..521dc79 100644
--- a/Source/core/html/HTMLDialogElement.h
+++ b/Source/core/html/HTMLDialogElement.h
@@ -39,6 +39,7 @@
     static PassRefPtr<HTMLDialogElement> create(const QualifiedName&, Document&);
 
     void close(const String& returnValue, ExceptionState&);
+    void closeDialog(const String& returnValue = String());
     void show();
     void showModal(ExceptionState&);
 
@@ -53,7 +54,6 @@
     virtual void defaultEventHandler(Event*) OVERRIDE;
     virtual bool shouldBeReparentedUnderRenderView(const RenderStyle*) const OVERRIDE;
 
-    void closeDialog(const String& returnValue = String());
     void reposition();
 
     bool m_topIsValid;
diff --git a/Source/core/html/HTMLDialogElement.idl b/Source/core/html/HTMLDialogElement.idl
index 41732ab..6c2d0c8 100644
--- a/Source/core/html/HTMLDialogElement.idl
+++ b/Source/core/html/HTMLDialogElement.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=DialogElement
+    RuntimeEnabled=DialogElement
 ] interface HTMLDialogElement : HTMLElement {
     [Reflect] attribute boolean open;
     attribute DOMString returnValue;
diff --git a/Source/core/tests/HTMLDimension.cpp b/Source/core/html/HTMLDimensionTest.cpp
similarity index 100%
rename from Source/core/tests/HTMLDimension.cpp
rename to Source/core/html/HTMLDimensionTest.cpp
diff --git a/Source/core/html/HTMLDivElement.idl b/Source/core/html/HTMLDivElement.idl
index 5793564..b2eeb3d 100644
--- a/Source/core/html/HTMLDivElement.idl
+++ b/Source/core/html/HTMLDivElement.idl
@@ -19,6 +19,6 @@
 
 [
 ] interface HTMLDivElement : HTMLElement {
-    [Reflect] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
 };
 
diff --git a/Source/core/html/HTMLDocument.cpp b/Source/core/html/HTMLDocument.cpp
index 26c4671..5e0116b 100644
--- a/Source/core/html/HTMLDocument.cpp
+++ b/Source/core/html/HTMLDocument.cpp
@@ -57,9 +57,9 @@
 #include "bindings/v8/ScriptController.h"
 #include "core/html/HTMLBodyElement.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 
 namespace WebCore {
@@ -130,90 +130,79 @@
     return false;
 }
 
-inline HTMLBodyElement* HTMLDocument::bodyAsHTMLBodyElement() const
+HTMLBodyElement* HTMLDocument::htmlBodyElement() const
 {
-    HTMLElement* element = body();
-    return (element && element->hasTagName(bodyTag)) ? toHTMLBodyElement(element) : 0;
+    HTMLElement* body = this->body();
+    return (body && body->hasTagName(bodyTag)) ? toHTMLBodyElement(body) : 0;
 }
 
-String HTMLDocument::bgColor()
+const AtomicString& HTMLDocument::bodyAttributeValue(const QualifiedName& name) const
 {
-    if (HTMLBodyElement* bodyElement = bodyAsHTMLBodyElement())
-        return bodyElement->bgColor();
-    return String();
+    if (HTMLBodyElement* body = htmlBodyElement())
+        return body->fastGetAttribute(name);
+    return nullAtom;
 }
 
-void HTMLDocument::setBgColor(const String& value)
+void HTMLDocument::setBodyAttribute(const QualifiedName& name, const AtomicString& value)
 {
-    if (HTMLBodyElement* bodyElement = bodyAsHTMLBodyElement())
-        bodyElement->setBgColor(value);
-}
-
-String HTMLDocument::fgColor()
-{
-    if (HTMLBodyElement* bodyElement = bodyAsHTMLBodyElement())
-        return bodyElement->text();
-    return String();
-}
-
-void HTMLDocument::setFgColor(const String& value)
-{
-    if (HTMLBodyElement* bodyElement = bodyAsHTMLBodyElement())
-        bodyElement->setText(value);
-}
-
-String HTMLDocument::alinkColor()
-{
-    if (HTMLBodyElement* bodyElement = bodyAsHTMLBodyElement())
-        return bodyElement->aLink();
-    return String();
-}
-
-void HTMLDocument::setAlinkColor(const String& value)
-{
-    if (HTMLBodyElement* bodyElement = bodyAsHTMLBodyElement()) {
-        // This check is a bit silly, but some benchmarks like to set the
-        // document's link colors over and over to the same value and we
-        // don't want to incur a style update each time.
-        if (bodyElement->aLink() != value)
-            bodyElement->setALink(value);
+    if (HTMLBodyElement* body = htmlBodyElement()) {
+        // FIXME: This check is apparently for benchmarks that set the same value repeatedly.
+        // It's not clear what benchmarks though, it's also not clear why we don't avoid
+        // causing a style recalc when setting the same value to a presentational attribute
+        // in the common case.
+        if (body->fastGetAttribute(name) != value)
+            body->setAttribute(name, value);
     }
 }
 
-String HTMLDocument::linkColor()
+const AtomicString& HTMLDocument::bgColor() const
 {
-    if (HTMLBodyElement* bodyElement = bodyAsHTMLBodyElement())
-        return bodyElement->link();
-    return String();
+    return bodyAttributeValue(bgcolorAttr);
 }
 
-void HTMLDocument::setLinkColor(const String& value)
+void HTMLDocument::setBgColor(const AtomicString& value)
 {
-    if (HTMLBodyElement* bodyElement = bodyAsHTMLBodyElement()) {
-        // This check is a bit silly, but some benchmarks like to set the
-        // document's link colors over and over to the same value and we
-        // don't want to incur a style update each time.
-        if (bodyElement->link() != value)
-            bodyElement->setLink(value);
-    }
+    setBodyAttribute(bgcolorAttr, value);
 }
 
-String HTMLDocument::vlinkColor()
+const AtomicString& HTMLDocument::fgColor() const
 {
-    if (HTMLBodyElement* bodyElement = bodyAsHTMLBodyElement())
-        return bodyElement->vLink();
-    return String();
+    return bodyAttributeValue(textAttr);
 }
 
-void HTMLDocument::setVlinkColor(const String& value)
+void HTMLDocument::setFgColor(const AtomicString& value)
 {
-    if (HTMLBodyElement* bodyElement = bodyAsHTMLBodyElement()) {
-        // This check is a bit silly, but some benchmarks like to set the
-        // document's link colors over and over to the same value and we
-        // don't want to incur a style update each time.
-        if (bodyElement->vLink() != value)
-            bodyElement->setVLink(value);
-    }
+    setBodyAttribute(textAttr, value);
+}
+
+const AtomicString& HTMLDocument::alinkColor() const
+{
+    return bodyAttributeValue(alinkAttr);
+}
+
+void HTMLDocument::setAlinkColor(const AtomicString& value)
+{
+    setBodyAttribute(alinkAttr, value);
+}
+
+const AtomicString& HTMLDocument::linkColor() const
+{
+    return bodyAttributeValue(linkAttr);
+}
+
+void HTMLDocument::setLinkColor(const AtomicString& value)
+{
+    setBodyAttribute(linkAttr, value);
+}
+
+const AtomicString& HTMLDocument::vlinkColor() const
+{
+    return bodyAttributeValue(vlinkAttr);
+}
+
+void HTMLDocument::setVlinkColor(const AtomicString& value)
+{
+    setBodyAttribute(vlinkAttr, value);
 }
 
 // --------------------------------------------------------------------------
diff --git a/Source/core/html/HTMLDocument.h b/Source/core/html/HTMLDocument.h
index 181b942..c37fbf6 100644
--- a/Source/core/html/HTMLDocument.h
+++ b/Source/core/html/HTMLDocument.h
@@ -50,16 +50,16 @@
     Element* activeElement();
     bool hasFocus();
 
-    String bgColor();
-    void setBgColor(const String&);
-    String fgColor();
-    void setFgColor(const String&);
-    String alinkColor();
-    void setAlinkColor(const String&);
-    String linkColor();
-    void setLinkColor(const String&);
-    String vlinkColor();
-    void setVlinkColor(const String&);
+    const AtomicString& bgColor() const;
+    void setBgColor(const AtomicString&);
+    const AtomicString& fgColor() const;
+    void setFgColor(const AtomicString&);
+    const AtomicString& alinkColor() const;
+    void setAlinkColor(const AtomicString&);
+    const AtomicString& linkColor() const;
+    void setLinkColor(const AtomicString&);
+    const AtomicString& vlinkColor() const;
+    void setVlinkColor(const AtomicString&);
 
     void clear();
 
@@ -80,7 +80,11 @@
     HTMLDocument(const DocumentInit&, DocumentClassFlags extendedDocumentClasses = DefaultDocumentClass);
 
 private:
-    HTMLBodyElement* bodyAsHTMLBodyElement() const;
+    HTMLBodyElement* htmlBodyElement() const;
+
+    const AtomicString& bodyAttributeValue(const QualifiedName&) const;
+    void setBodyAttribute(const QualifiedName&, const AtomicString&);
+
     void addItemToMap(HashCountedSet<StringImpl*>&, const AtomicString&);
     void removeItemFromMap(HashCountedSet<StringImpl*>&, const AtomicString&);
 
diff --git a/Source/core/html/HTMLDocument.idl b/Source/core/html/HTMLDocument.idl
index e44baee..764f1af 100644
--- a/Source/core/html/HTMLDocument.idl
+++ b/Source/core/html/HTMLDocument.idl
@@ -18,13 +18,11 @@
  * Boston, MA 02110-1301, USA.
  */
 
-[
-    CustomToV8
-] interface HTMLDocument : Document {
-    [Custom, CustomElementCallbacks=Enable] void open();
+interface HTMLDocument : Document {
+    [Custom, CustomElementCallbacks] void open();
     void close();
-    [Custom, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, CustomElementCallbacks=Enable] void write([Default=Undefined] optional DOMString text);
-    [Custom, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, CustomElementCallbacks=Enable] void writeln([Default=Undefined] optional DOMString text);
+    [Custom, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, CustomElementCallbacks] void write([Default=Undefined] optional DOMString text);
+    [Custom, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, CustomElementCallbacks] void writeln([Default=Undefined] optional DOMString text);
 
     readonly attribute HTMLCollection embeds;
     readonly attribute HTMLCollection plugins;
@@ -39,18 +37,18 @@
     [DeprecateAs=CaptureEvents] void captureEvents();
     [DeprecateAs=ReleaseEvents] void releaseEvents();
 
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString dir;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString designMode;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString designMode;
     readonly attribute DOMString compatMode;
 
     readonly attribute Element activeElement;
     boolean hasFocus();
 
     // Deprecated attributes
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString bgColor;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString fgColor;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString alinkColor;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString linkColor;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString vlinkColor;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString bgColor;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString fgColor;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString alinkColor;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString linkColor;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString vlinkColor;
 };
 
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index ec3daf8..3b74a4e 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -36,13 +36,13 @@
 #include "core/css/CSSValuePool.h"
 #include "core/css/StylePropertySet.h"
 #include "core/dom/DocumentFragment.h"
-#include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/events/KeyboardEvent.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Text.h"
 #include "core/editing/markup.h"
+#include "core/events/EventListener.h"
+#include "core/events/KeyboardEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLBRElement.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLInputElement.h"
@@ -50,11 +50,11 @@
 #include "core/html/HTMLTextFormControlElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
-#include "core/platform/graphics/TextRunIterator.h"
-#include "core/platform/text/BidiResolver.h"
 #include "core/rendering/RenderWordBreak.h"
+#include "platform/graphics/TextRunIterator.h"
+#include "platform/text/BidiResolver.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/text/CString.h"
 
@@ -204,83 +204,83 @@
     typedef HashMap<AtomicString, AtomicString> StringToStringMap;
     DEFINE_STATIC_LOCAL(StringToStringMap, attributeNameToEventNameMap, ());
     if (!attributeNameToEventNameMap.size()) {
-        attributeNameToEventNameMap.set(onanimationstartAttr.localName(), eventNames().animationstartEvent);
-        attributeNameToEventNameMap.set(onanimationiterationAttr.localName(), eventNames().animationiterationEvent);
-        attributeNameToEventNameMap.set(onanimationendAttr.localName(), eventNames().animationendEvent);
-        attributeNameToEventNameMap.set(onclickAttr.localName(), eventNames().clickEvent);
-        attributeNameToEventNameMap.set(oncontextmenuAttr.localName(), eventNames().contextmenuEvent);
-        attributeNameToEventNameMap.set(ondblclickAttr.localName(), eventNames().dblclickEvent);
-        attributeNameToEventNameMap.set(onmousedownAttr.localName(), eventNames().mousedownEvent);
-        attributeNameToEventNameMap.set(onmouseenterAttr.localName(), eventNames().mouseenterEvent);
-        attributeNameToEventNameMap.set(onmouseleaveAttr.localName(), eventNames().mouseleaveEvent);
-        attributeNameToEventNameMap.set(onmousemoveAttr.localName(), eventNames().mousemoveEvent);
-        attributeNameToEventNameMap.set(onmouseoutAttr.localName(), eventNames().mouseoutEvent);
-        attributeNameToEventNameMap.set(onmouseoverAttr.localName(), eventNames().mouseoverEvent);
-        attributeNameToEventNameMap.set(onmouseupAttr.localName(), eventNames().mouseupEvent);
-        attributeNameToEventNameMap.set(onmousewheelAttr.localName(), eventNames().mousewheelEvent);
-        attributeNameToEventNameMap.set(onwheelAttr.localName(), eventNames().wheelEvent);
-        attributeNameToEventNameMap.set(onfocusAttr.localName(), eventNames().focusEvent);
-        attributeNameToEventNameMap.set(onfocusinAttr.localName(), eventNames().focusinEvent);
-        attributeNameToEventNameMap.set(onfocusoutAttr.localName(), eventNames().focusoutEvent);
-        attributeNameToEventNameMap.set(onblurAttr.localName(), eventNames().blurEvent);
-        attributeNameToEventNameMap.set(onkeydownAttr.localName(), eventNames().keydownEvent);
-        attributeNameToEventNameMap.set(onkeypressAttr.localName(), eventNames().keypressEvent);
-        attributeNameToEventNameMap.set(onkeyupAttr.localName(), eventNames().keyupEvent);
-        attributeNameToEventNameMap.set(onscrollAttr.localName(), eventNames().scrollEvent);
-        attributeNameToEventNameMap.set(onbeforecutAttr.localName(), eventNames().beforecutEvent);
-        attributeNameToEventNameMap.set(oncutAttr.localName(), eventNames().cutEvent);
-        attributeNameToEventNameMap.set(onbeforecopyAttr.localName(), eventNames().beforecopyEvent);
-        attributeNameToEventNameMap.set(oncopyAttr.localName(), eventNames().copyEvent);
-        attributeNameToEventNameMap.set(onbeforepasteAttr.localName(), eventNames().beforepasteEvent);
-        attributeNameToEventNameMap.set(onpasteAttr.localName(), eventNames().pasteEvent);
-        attributeNameToEventNameMap.set(ondragenterAttr.localName(), eventNames().dragenterEvent);
-        attributeNameToEventNameMap.set(ondragoverAttr.localName(), eventNames().dragoverEvent);
-        attributeNameToEventNameMap.set(ondragleaveAttr.localName(), eventNames().dragleaveEvent);
-        attributeNameToEventNameMap.set(ondropAttr.localName(), eventNames().dropEvent);
-        attributeNameToEventNameMap.set(ondragstartAttr.localName(), eventNames().dragstartEvent);
-        attributeNameToEventNameMap.set(ondragAttr.localName(), eventNames().dragEvent);
-        attributeNameToEventNameMap.set(ondragendAttr.localName(), eventNames().dragendEvent);
-        attributeNameToEventNameMap.set(onselectstartAttr.localName(), eventNames().selectstartEvent);
-        attributeNameToEventNameMap.set(onsubmitAttr.localName(), eventNames().submitEvent);
-        attributeNameToEventNameMap.set(onerrorAttr.localName(), eventNames().errorEvent);
-        attributeNameToEventNameMap.set(onwebkitanimationstartAttr.localName(), eventNames().webkitAnimationStartEvent);
-        attributeNameToEventNameMap.set(onwebkitanimationiterationAttr.localName(), eventNames().webkitAnimationIterationEvent);
-        attributeNameToEventNameMap.set(onwebkitanimationendAttr.localName(), eventNames().webkitAnimationEndEvent);
-        attributeNameToEventNameMap.set(onwebkittransitionendAttr.localName(), eventNames().webkitTransitionEndEvent);
-        attributeNameToEventNameMap.set(ontransitionendAttr.localName(), eventNames().webkitTransitionEndEvent);
-        attributeNameToEventNameMap.set(oninputAttr.localName(), eventNames().inputEvent);
-        attributeNameToEventNameMap.set(oninvalidAttr.localName(), eventNames().invalidEvent);
-        attributeNameToEventNameMap.set(ontouchstartAttr.localName(), eventNames().touchstartEvent);
-        attributeNameToEventNameMap.set(ontouchmoveAttr.localName(), eventNames().touchmoveEvent);
-        attributeNameToEventNameMap.set(ontouchendAttr.localName(), eventNames().touchendEvent);
-        attributeNameToEventNameMap.set(ontouchcancelAttr.localName(), eventNames().touchcancelEvent);
-        attributeNameToEventNameMap.set(onwebkitfullscreenchangeAttr.localName(), eventNames().webkitfullscreenchangeEvent);
-        attributeNameToEventNameMap.set(onwebkitfullscreenerrorAttr.localName(), eventNames().webkitfullscreenerrorEvent);
-        attributeNameToEventNameMap.set(onabortAttr.localName(), eventNames().abortEvent);
-        attributeNameToEventNameMap.set(oncanplayAttr.localName(), eventNames().canplayEvent);
-        attributeNameToEventNameMap.set(oncanplaythroughAttr.localName(), eventNames().canplaythroughEvent);
-        attributeNameToEventNameMap.set(onchangeAttr.localName(), eventNames().changeEvent);
-        attributeNameToEventNameMap.set(ondurationchangeAttr.localName(), eventNames().durationchangeEvent);
-        attributeNameToEventNameMap.set(onemptiedAttr.localName(), eventNames().emptiedEvent);
-        attributeNameToEventNameMap.set(onendedAttr.localName(), eventNames().endedEvent);
-        attributeNameToEventNameMap.set(onloadeddataAttr.localName(), eventNames().loadeddataEvent);
-        attributeNameToEventNameMap.set(onloadedmetadataAttr.localName(), eventNames().loadedmetadataEvent);
-        attributeNameToEventNameMap.set(onloadstartAttr.localName(), eventNames().loadstartEvent);
-        attributeNameToEventNameMap.set(onpauseAttr.localName(), eventNames().pauseEvent);
-        attributeNameToEventNameMap.set(onplayAttr.localName(), eventNames().playEvent);
-        attributeNameToEventNameMap.set(onplayingAttr.localName(), eventNames().playingEvent);
-        attributeNameToEventNameMap.set(onprogressAttr.localName(), eventNames().progressEvent);
-        attributeNameToEventNameMap.set(onratechangeAttr.localName(), eventNames().ratechangeEvent);
-        attributeNameToEventNameMap.set(onresetAttr.localName(), eventNames().resetEvent);
-        attributeNameToEventNameMap.set(onseekedAttr.localName(), eventNames().seekedEvent);
-        attributeNameToEventNameMap.set(onseekingAttr.localName(), eventNames().seekingEvent);
-        attributeNameToEventNameMap.set(onselectAttr.localName(), eventNames().selectEvent);
-        attributeNameToEventNameMap.set(onstalledAttr.localName(), eventNames().stalledEvent);
-        attributeNameToEventNameMap.set(onsuspendAttr.localName(), eventNames().suspendEvent);
-        attributeNameToEventNameMap.set(ontimeupdateAttr.localName(), eventNames().timeupdateEvent);
-        attributeNameToEventNameMap.set(onvolumechangeAttr.localName(), eventNames().volumechangeEvent);
-        attributeNameToEventNameMap.set(onwaitingAttr.localName(), eventNames().waitingEvent);
-        attributeNameToEventNameMap.set(onloadAttr.localName(), eventNames().loadEvent);
+        attributeNameToEventNameMap.set(onanimationstartAttr.localName(), EventTypeNames::animationstart);
+        attributeNameToEventNameMap.set(onanimationiterationAttr.localName(), EventTypeNames::animationiteration);
+        attributeNameToEventNameMap.set(onanimationendAttr.localName(), EventTypeNames::animationend);
+        attributeNameToEventNameMap.set(onclickAttr.localName(), EventTypeNames::click);
+        attributeNameToEventNameMap.set(oncontextmenuAttr.localName(), EventTypeNames::contextmenu);
+        attributeNameToEventNameMap.set(ondblclickAttr.localName(), EventTypeNames::dblclick);
+        attributeNameToEventNameMap.set(onmousedownAttr.localName(), EventTypeNames::mousedown);
+        attributeNameToEventNameMap.set(onmouseenterAttr.localName(), EventTypeNames::mouseenter);
+        attributeNameToEventNameMap.set(onmouseleaveAttr.localName(), EventTypeNames::mouseleave);
+        attributeNameToEventNameMap.set(onmousemoveAttr.localName(), EventTypeNames::mousemove);
+        attributeNameToEventNameMap.set(onmouseoutAttr.localName(), EventTypeNames::mouseout);
+        attributeNameToEventNameMap.set(onmouseoverAttr.localName(), EventTypeNames::mouseover);
+        attributeNameToEventNameMap.set(onmouseupAttr.localName(), EventTypeNames::mouseup);
+        attributeNameToEventNameMap.set(onmousewheelAttr.localName(), EventTypeNames::mousewheel);
+        attributeNameToEventNameMap.set(onwheelAttr.localName(), EventTypeNames::wheel);
+        attributeNameToEventNameMap.set(onfocusAttr.localName(), EventTypeNames::focus);
+        attributeNameToEventNameMap.set(onfocusinAttr.localName(), EventTypeNames::focusin);
+        attributeNameToEventNameMap.set(onfocusoutAttr.localName(), EventTypeNames::focusout);
+        attributeNameToEventNameMap.set(onblurAttr.localName(), EventTypeNames::blur);
+        attributeNameToEventNameMap.set(onkeydownAttr.localName(), EventTypeNames::keydown);
+        attributeNameToEventNameMap.set(onkeypressAttr.localName(), EventTypeNames::keypress);
+        attributeNameToEventNameMap.set(onkeyupAttr.localName(), EventTypeNames::keyup);
+        attributeNameToEventNameMap.set(onscrollAttr.localName(), EventTypeNames::scroll);
+        attributeNameToEventNameMap.set(onbeforecutAttr.localName(), EventTypeNames::beforecut);
+        attributeNameToEventNameMap.set(oncutAttr.localName(), EventTypeNames::cut);
+        attributeNameToEventNameMap.set(onbeforecopyAttr.localName(), EventTypeNames::beforecopy);
+        attributeNameToEventNameMap.set(oncopyAttr.localName(), EventTypeNames::copy);
+        attributeNameToEventNameMap.set(onbeforepasteAttr.localName(), EventTypeNames::beforepaste);
+        attributeNameToEventNameMap.set(onpasteAttr.localName(), EventTypeNames::paste);
+        attributeNameToEventNameMap.set(ondragenterAttr.localName(), EventTypeNames::dragenter);
+        attributeNameToEventNameMap.set(ondragoverAttr.localName(), EventTypeNames::dragover);
+        attributeNameToEventNameMap.set(ondragleaveAttr.localName(), EventTypeNames::dragleave);
+        attributeNameToEventNameMap.set(ondropAttr.localName(), EventTypeNames::drop);
+        attributeNameToEventNameMap.set(ondragstartAttr.localName(), EventTypeNames::dragstart);
+        attributeNameToEventNameMap.set(ondragAttr.localName(), EventTypeNames::drag);
+        attributeNameToEventNameMap.set(ondragendAttr.localName(), EventTypeNames::dragend);
+        attributeNameToEventNameMap.set(onselectstartAttr.localName(), EventTypeNames::selectstart);
+        attributeNameToEventNameMap.set(onsubmitAttr.localName(), EventTypeNames::submit);
+        attributeNameToEventNameMap.set(onerrorAttr.localName(), EventTypeNames::error);
+        attributeNameToEventNameMap.set(onwebkitanimationstartAttr.localName(), EventTypeNames::webkitAnimationStart);
+        attributeNameToEventNameMap.set(onwebkitanimationiterationAttr.localName(), EventTypeNames::webkitAnimationIteration);
+        attributeNameToEventNameMap.set(onwebkitanimationendAttr.localName(), EventTypeNames::webkitAnimationEnd);
+        attributeNameToEventNameMap.set(onwebkittransitionendAttr.localName(), EventTypeNames::webkitTransitionEnd);
+        attributeNameToEventNameMap.set(ontransitionendAttr.localName(), EventTypeNames::webkitTransitionEnd);
+        attributeNameToEventNameMap.set(oninputAttr.localName(), EventTypeNames::input);
+        attributeNameToEventNameMap.set(oninvalidAttr.localName(), EventTypeNames::invalid);
+        attributeNameToEventNameMap.set(ontouchstartAttr.localName(), EventTypeNames::touchstart);
+        attributeNameToEventNameMap.set(ontouchmoveAttr.localName(), EventTypeNames::touchmove);
+        attributeNameToEventNameMap.set(ontouchendAttr.localName(), EventTypeNames::touchend);
+        attributeNameToEventNameMap.set(ontouchcancelAttr.localName(), EventTypeNames::touchcancel);
+        attributeNameToEventNameMap.set(onwebkitfullscreenchangeAttr.localName(), EventTypeNames::webkitfullscreenchange);
+        attributeNameToEventNameMap.set(onwebkitfullscreenerrorAttr.localName(), EventTypeNames::webkitfullscreenerror);
+        attributeNameToEventNameMap.set(onabortAttr.localName(), EventTypeNames::abort);
+        attributeNameToEventNameMap.set(oncanplayAttr.localName(), EventTypeNames::canplay);
+        attributeNameToEventNameMap.set(oncanplaythroughAttr.localName(), EventTypeNames::canplaythrough);
+        attributeNameToEventNameMap.set(onchangeAttr.localName(), EventTypeNames::change);
+        attributeNameToEventNameMap.set(ondurationchangeAttr.localName(), EventTypeNames::durationchange);
+        attributeNameToEventNameMap.set(onemptiedAttr.localName(), EventTypeNames::emptied);
+        attributeNameToEventNameMap.set(onendedAttr.localName(), EventTypeNames::ended);
+        attributeNameToEventNameMap.set(onloadeddataAttr.localName(), EventTypeNames::loadeddata);
+        attributeNameToEventNameMap.set(onloadedmetadataAttr.localName(), EventTypeNames::loadedmetadata);
+        attributeNameToEventNameMap.set(onloadstartAttr.localName(), EventTypeNames::loadstart);
+        attributeNameToEventNameMap.set(onpauseAttr.localName(), EventTypeNames::pause);
+        attributeNameToEventNameMap.set(onplayAttr.localName(), EventTypeNames::play);
+        attributeNameToEventNameMap.set(onplayingAttr.localName(), EventTypeNames::playing);
+        attributeNameToEventNameMap.set(onprogressAttr.localName(), EventTypeNames::progress);
+        attributeNameToEventNameMap.set(onratechangeAttr.localName(), EventTypeNames::ratechange);
+        attributeNameToEventNameMap.set(onresetAttr.localName(), EventTypeNames::reset);
+        attributeNameToEventNameMap.set(onseekedAttr.localName(), EventTypeNames::seeked);
+        attributeNameToEventNameMap.set(onseekingAttr.localName(), EventTypeNames::seeking);
+        attributeNameToEventNameMap.set(onselectAttr.localName(), EventTypeNames::select);
+        attributeNameToEventNameMap.set(onstalledAttr.localName(), EventTypeNames::stalled);
+        attributeNameToEventNameMap.set(onsuspendAttr.localName(), EventTypeNames::suspend);
+        attributeNameToEventNameMap.set(ontimeupdateAttr.localName(), EventTypeNames::timeupdate);
+        attributeNameToEventNameMap.set(onvolumechangeAttr.localName(), EventTypeNames::volumechange);
+        attributeNameToEventNameMap.set(onwaitingAttr.localName(), EventTypeNames::waiting);
+        attributeNameToEventNameMap.set(onloadAttr.localName(), EventTypeNames::load);
     }
 
     return attributeNameToEventNameMap.get(attrName.localName());
@@ -633,10 +633,10 @@
 
     if (!document().settings() || !document().settings()->spatialNavigationEnabled())
         return false;
-    return hasEventListeners(eventNames().clickEvent)
-        || hasEventListeners(eventNames().keydownEvent)
-        || hasEventListeners(eventNames().keypressEvent)
-        || hasEventListeners(eventNames().keyupEvent);
+    return hasEventListeners(EventTypeNames::click)
+        || hasEventListeners(EventTypeNames::keydown)
+        || hasEventListeners(EventTypeNames::keypress)
+        || hasEventListeners(EventTypeNames::keyup);
 }
 
 bool HTMLElement::supportsFocus() const
@@ -1082,7 +1082,7 @@
 
 void HTMLElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().keypressEvent && event->isKeyboardEvent()) {
+    if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) {
         handleKeypressEvent(toKeyboardEvent(event));
         if (event->defaultHandled())
             return;
diff --git a/Source/core/html/HTMLElement.idl b/Source/core/html/HTMLElement.idl
index d65a413..06ab281 100644
--- a/Source/core/html/HTMLElement.idl
+++ b/Source/core/html/HTMLElement.idl
@@ -21,37 +21,36 @@
 [
     CustomToV8
 ] interface HTMLElement : Element {
-             [Reflect] attribute DOMString title;
-             [Reflect] attribute DOMString lang;
-             attribute boolean             translate;
-             [Reflect] attribute DOMString dir;
+    [Reflect, TreatNullAs=NullString] attribute DOMString title;
+    [Reflect, TreatNullAs=NullString] attribute DOMString lang;
+    attribute boolean             translate;
+    [Reflect, TreatNullAs=NullString] attribute DOMString dir;
 
-             [CustomElementCallbacks=Enable] attribute long              tabIndex;
-             [CustomElementCallbacks=Enable] attribute boolean           draggable;
-             [Reflect] attribute DOMString webkitdropzone;
-             [Reflect] attribute boolean hidden;
-             [Reflect] attribute DOMString accessKey;
+    [CustomElementCallbacks] attribute long              tabIndex;
+    [CustomElementCallbacks] attribute boolean           draggable;
+    [Reflect, TreatNullAs=NullString] attribute DOMString webkitdropzone;
+    [Reflect] attribute boolean hidden;
+    [Reflect, TreatNullAs=NullString] attribute DOMString accessKey;
 
     // Extensions
-             [TreatNullAs=NullString, CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds, SetterRaisesException] attribute DOMString innerHTML;
-             [TreatNullAs=NullString, CustomElementCallbacks=Enable, SetterRaisesException] attribute DOMString innerText;
-             [TreatNullAs=NullString, CustomElementCallbacks=Enable, SetterRaisesException] attribute DOMString outerHTML;
-             [TreatNullAs=NullString, CustomElementCallbacks=Enable, SetterRaisesException] attribute DOMString outerText;
+    [TreatNullAs=NullString, CustomElementCallbacks, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds, SetterRaisesException] attribute DOMString innerHTML;
+    [TreatNullAs=NullString, CustomElementCallbacks, SetterRaisesException] attribute DOMString innerText;
+    [TreatNullAs=NullString, CustomElementCallbacks, SetterRaisesException] attribute DOMString outerHTML;
+    [TreatNullAs=NullString, CustomElementCallbacks, SetterRaisesException] attribute DOMString outerText;
 
-    [RaisesException, CustomElementCallbacks=Enable, MeasureAs=InsertAdjacentElement] Element insertAdjacentElement([Default=Undefined] optional DOMString where,
+    [RaisesException, CustomElementCallbacks, MeasureAs=InsertAdjacentElement] Element insertAdjacentElement([Default=Undefined] optional DOMString where,
                                   [Default=Undefined] optional Element element);
-    [CustomElementCallbacks=Enable, RaisesException] void insertAdjacentHTML([Default=Undefined] optional DOMString where,
+    [CustomElementCallbacks, RaisesException] void insertAdjacentHTML([Default=Undefined] optional DOMString where,
                             [Default=Undefined] optional DOMString html);
     [RaisesException, MeasureAs=InsertAdjacentText] void insertAdjacentText([Default=Undefined] optional DOMString where,
                             [Default=Undefined] optional DOMString text);
 
-    [EnabledAtRuntime=IMEAPI] readonly attribute InputMethodContext inputMethodContext;
+    [RuntimeEnabled=IMEAPI] readonly attribute InputMethodContext inputMethodContext;
 
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable, SetterRaisesException] attribute DOMString contentEditable;
+    [TreatNullAs=NullString, CustomElementCallbacks, SetterRaisesException] attribute DOMString contentEditable;
     readonly attribute boolean isContentEditable;
 
              attribute boolean spellcheck;
 
     void click();
 };
-
diff --git a/Source/core/html/HTMLEmbedElement.idl b/Source/core/html/HTMLEmbedElement.idl
index 98dc854..94888da 100644
--- a/Source/core/html/HTMLEmbedElement.idl
+++ b/Source/core/html/HTMLEmbedElement.idl
@@ -21,12 +21,12 @@
 [
     CustomLegacyCall,
 ] interface HTMLEmbedElement : HTMLElement {
-[Reflect] attribute DOMString align;
-[Reflect] attribute DOMString height;
-[Reflect] attribute DOMString name;
-[Reflect, URL] attribute DOMString src;
-[Reflect] attribute DOMString type;
-[Reflect] attribute DOMString width;
+[Reflect, TreatNullAs=NullString] attribute DOMString align;
+[Reflect, TreatNullAs=NullString] attribute DOMString height;
+[Reflect, TreatNullAs=NullString] attribute DOMString name;
+[Reflect, TreatNullAs=NullString, URL] attribute DOMString src;
+[Reflect, TreatNullAs=NullString] attribute DOMString type;
+[Reflect, TreatNullAs=NullString] attribute DOMString width;
 [Custom, NotEnumerable] getter boolean (unsigned long index);
 [Custom] setter boolean (unsigned long index, Node value);
 [Custom, NotEnumerable] getter Node (DOMString name);
diff --git a/Source/core/html/HTMLFieldSetElement.idl b/Source/core/html/HTMLFieldSetElement.idl
index 4e77da9..4fc3409 100644
--- a/Source/core/html/HTMLFieldSetElement.idl
+++ b/Source/core/html/HTMLFieldSetElement.idl
@@ -20,7 +20,7 @@
 interface HTMLFieldSetElement : HTMLElement {
     [Reflect] attribute boolean disabled;
     readonly attribute HTMLFormElement form;
-    [Reflect] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
 
     readonly attribute DOMString type;
 
diff --git a/Source/core/html/HTMLFontElement.idl b/Source/core/html/HTMLFontElement.idl
index d2da3a9..cdfd429 100644
--- a/Source/core/html/HTMLFontElement.idl
+++ b/Source/core/html/HTMLFontElement.idl
@@ -18,8 +18,8 @@
  */
 
 interface HTMLFontElement : HTMLElement {
-    [Reflect] attribute DOMString color;
-    [Reflect] attribute DOMString face;
-    [Reflect] attribute DOMString size;
+    [Reflect, TreatNullAs=NullString] attribute DOMString color;
+    [Reflect, TreatNullAs=NullString] attribute DOMString face;
+    [Reflect, TreatNullAs=NullString] attribute DOMString size;
 };
 
diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp
index 1d08c08..1548f02 100644
--- a/Source/core/html/HTMLFormControlElement.cpp
+++ b/Source/core/html/HTMLFormControlElement.cpp
@@ -25,9 +25,9 @@
 #include "config.h"
 #include "core/html/HTMLFormControlElement.h"
 
-#include "core/events/Event.h"
-#include "core/events/EventNames.h"
 #include "core/dom/PostAttachCallbacks.h"
+#include "core/events/Event.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLFieldSetElement.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLInputElement.h"
@@ -48,6 +48,7 @@
 HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document& document, HTMLFormElement* form)
     : LabelableElement(tagName, document)
     , m_disabled(false)
+    , m_isAutofilled(false)
     , m_isReadOnly(false)
     , m_isRequired(false)
     , m_valueMatchesRenderer(false)
@@ -121,11 +122,17 @@
     disabledAttributeChanged();
 }
 
+void HTMLFormControlElement::reset()
+{
+    setAutofilled(false);
+    resetImpl();
+}
+
 void HTMLFormControlElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (name == formAttr) {
         formAttributeChanged();
-        UseCounter::count(&document(), UseCounter::FormAttribute);
+        UseCounter::count(document(), UseCounter::FormAttribute);
     } else if (name == disabledAttr) {
         bool oldDisabled = m_disabled;
         m_disabled = !value.isNull();
@@ -145,10 +152,10 @@
         m_isRequired = !value.isNull();
         if (wasRequired != m_isRequired)
             requiredAttributeChanged();
-        UseCounter::count(&document(), UseCounter::RequiredAttribute);
+        UseCounter::count(document(), UseCounter::RequiredAttribute);
     } else if (name == autofocusAttr) {
         HTMLElement::parseAttribute(name, value);
-        UseCounter::count(&document(), UseCounter::AutoFocusAttribute);
+        UseCounter::count(document(), UseCounter::AutoFocusAttribute);
     } else
         HTMLElement::parseAttribute(name, value);
 }
@@ -174,62 +181,76 @@
     setNeedsStyleRecalc();
 }
 
-static bool shouldAutofocus(HTMLFormControlElement* element)
-{
-    if (!element->fastHasAttribute(autofocusAttr))
-        return false;
-    if (!element->renderer())
-        return false;
-    if (element->document().ignoreAutofocus())
-        return false;
-    if (element->document().isSandboxed(SandboxAutomaticFeatures)) {
-        // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
-        element->document().addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Blocked autofocusing on a form control because the form's frame is sandboxed and the 'allow-scripts' permission is not set.");
-        return false;
-    }
-    if (element->hasAutofocused())
-        return false;
-
-    // FIXME: Should this set of hasTagName checks be replaced by a
-    // virtual member function?
-    if (element->hasTagName(inputTag))
-        return !toHTMLInputElement(element)->isInputTypeHidden();
-    if (element->hasTagName(selectTag))
-        return true;
-    if (element->hasTagName(keygenTag))
-        return true;
-    if (element->hasTagName(buttonTag))
-        return true;
-    if (isHTMLTextAreaElement(element))
-        return true;
-
-    return false;
-}
-
 static void focusPostAttach(Node* element)
 {
     toElement(element)->focus();
     element->deref();
 }
 
+bool HTMLFormControlElement::isAutofocusable() const
+{
+    if (!fastHasAttribute(autofocusAttr))
+        return false;
+
+    // FIXME: Should this set of hasTagName checks be replaced by a
+    // virtual member function?
+    if (hasTagName(inputTag))
+        return !toHTMLInputElement(this)->isInputTypeHidden();
+    if (hasTagName(selectTag))
+        return true;
+    if (hasTagName(keygenTag))
+        return true;
+    if (hasTagName(buttonTag))
+        return true;
+    if (isHTMLTextAreaElement(this))
+        return true;
+    return false;
+}
+
+void HTMLFormControlElement::setAutofilled(bool autofilled)
+{
+    if (autofilled == m_isAutofilled)
+        return;
+
+    m_isAutofilled = autofilled;
+    setNeedsStyleRecalc();
+}
+
+static bool shouldAutofocusOnAttach(const HTMLFormControlElement* element)
+{
+    if (!element->isAutofocusable())
+        return false;
+    if (element->hasAutofocused())
+        return false;
+    if (element->document().isSandboxed(SandboxAutomaticFeatures)) {
+        // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
+        element->document().addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Blocked autofocusing on a form control because the form's frame is sandboxed and the 'allow-scripts' permission is not set.");
+        return false;
+    }
+
+    return true;
+}
+
 void HTMLFormControlElement::attach(const AttachContext& context)
 {
     HTMLElement::attach(context);
 
+    if (!renderer())
+        return;
+
     // The call to updateFromElement() needs to go after the call through
     // to the base class's attach() because that can sometimes do a close
     // on the renderer.
-    if (renderer())
-        renderer()->updateFromElement();
+    renderer()->updateFromElement();
 
-    if (shouldAutofocus(this)) {
+    if (shouldAutofocusOnAttach(this)) {
         setAutofocused();
         ref();
         PostAttachCallbacks::queueCallback(focusPostAttach, this);
     }
 }
 
-void HTMLFormControlElement::didMoveToNewDocument(Document* oldDocument)
+void HTMLFormControlElement::didMoveToNewDocument(Document& oldDocument)
 {
     FormAssociatedElement::didMoveToNewDocument(oldDocument);
     HTMLElement::didMoveToNewDocument(oldDocument);
@@ -338,7 +359,7 @@
 
 void HTMLFormControlElement::willCallDefaultEventHandler(const Event& event)
 {
-    if (!event.isKeyboardEvent() || event.type() != eventNames().keydownEvent)
+    if (!event.isKeyboardEvent() || event.type() != EventTypeNames::keydown)
         return;
     if (!m_wasFocusedByMouse)
         return;
@@ -428,9 +449,9 @@
         return false;
     // An event handler can deref this object.
     RefPtr<HTMLFormControlElement> protector(this);
-    RefPtr<Document> originalDocument(&document());
-    bool needsDefaultAction = dispatchEvent(Event::createCancelable(eventNames().invalidEvent));
-    if (needsDefaultAction && unhandledInvalidControls && inDocument() && originalDocument == &document())
+    RefPtr<Document> originalDocument(document());
+    bool needsDefaultAction = dispatchEvent(Event::createCancelable(EventTypeNames::invalid));
+    if (needsDefaultAction && unhandledInvalidControls && inDocument() && originalDocument == document())
         unhandledInvalidControls->append(this);
     return false;
 }
@@ -439,13 +460,13 @@
 {
     // If the following assertion fails, setNeedsValidityCheck() is not called
     // correctly when something which changes validity is updated.
-    ASSERT(m_isValid == validity()->valid());
+    ASSERT(m_isValid == valid());
     return m_isValid;
 }
 
 void HTMLFormControlElement::setNeedsValidityCheck()
 {
-    bool newIsValid = validity()->valid();
+    bool newIsValid = valid();
     if (willValidate() && newIsValid != m_isValid) {
         // Update style for pseudo classes such as :valid :invalid.
         setNeedsStyleRecalc();
diff --git a/Source/core/html/HTMLFormControlElement.h b/Source/core/html/HTMLFormControlElement.h
index 2189f95..f4044b5 100644
--- a/Source/core/html/HTMLFormControlElement.h
+++ b/Source/core/html/HTMLFormControlElement.h
@@ -53,7 +53,7 @@
 
     void ancestorDisabledStateWasChanged();
 
-    virtual void reset() { }
+    void reset();
 
     virtual bool formControlValueMatchesRenderer() const { return m_valueMatchesRenderer; }
     virtual void setFormControlValueMatchesRenderer(bool b) { m_valueMatchesRenderer = b; }
@@ -97,8 +97,12 @@
     bool isReadOnly() const { return m_isReadOnly; }
     bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isReadOnly; }
 
-    bool hasAutofocused() { return m_hasAutofocused; }
+    bool hasAutofocused() const { return m_hasAutofocused; }
     void setAutofocused() { m_hasAutofocused = true; }
+    bool isAutofocusable() const;
+
+    bool isAutofilled() const { return m_isAutofilled; }
+    void setAutofilled(bool = true);
 
     static HTMLFormControlElement* enclosingFormControlElement(Node*);
 
@@ -114,7 +118,7 @@
     virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
     virtual void removedFrom(ContainerNode*) OVERRIDE;
-    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+    virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
 
     virtual bool supportsFocus() const OVERRIDE;
     virtual bool isKeyboardFocusable() const OVERRIDE;
@@ -130,6 +134,8 @@
     void setNeedsWillValidateCheck();
     virtual bool recalcWillValidate() const;
 
+    virtual void resetImpl() { }
+
 private:
     virtual void refFormAssociatedElement() { ref(); }
     virtual void derefFormAssociatedElement() { deref(); }
@@ -146,6 +152,7 @@
 
     OwnPtr<ValidationMessage> m_validationMessage;
     bool m_disabled : 1;
+    bool m_isAutofilled : 1;
     bool m_isReadOnly : 1;
     bool m_isRequired : 1;
     bool m_valueMatchesRenderer : 1;
@@ -161,7 +168,7 @@
     mutable bool m_willValidateInitialized: 1;
     mutable bool m_willValidate : 1;
 
-    // Cache of validity()->valid().
+    // Cache of valid().
     // But "candidate for constraint validation" doesn't affect m_isValid.
     bool m_isValid : 1;
 
diff --git a/Source/core/html/HTMLFormControlElementWithState.cpp b/Source/core/html/HTMLFormControlElementWithState.cpp
index 0b62d22..905fd08 100644
--- a/Source/core/html/HTMLFormControlElementWithState.cpp
+++ b/Source/core/html/HTMLFormControlElementWithState.cpp
@@ -29,7 +29,7 @@
 #include "core/html/forms/FormController.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 
 namespace WebCore {
@@ -77,7 +77,7 @@
 bool HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState() const
 {
     // We don't save/restore control state in a form with autocomplete=off.
-    return attached() && shouldAutocomplete();
+    return confusingAndOftenMisusedAttached() && shouldAutocomplete();
 }
 
 FormControlState HTMLFormControlElementWithState::saveFormControlState() const
diff --git a/Source/core/html/HTMLFormControlsCollection.h b/Source/core/html/HTMLFormControlsCollection.h
index eafaaea..45b286c 100644
--- a/Source/core/html/HTMLFormControlsCollection.h
+++ b/Source/core/html/HTMLFormControlsCollection.h
@@ -36,7 +36,7 @@
 // This class is just a big hack to find form elements even in malformed HTML elements.
 // The famous <table><tr><form><td> problem.
 
-class HTMLFormControlsCollection : public HTMLCollection {
+class HTMLFormControlsCollection FINAL : public HTMLCollection {
 public:
     static PassRefPtr<HTMLFormControlsCollection> create(Node*, CollectionType);
 
@@ -46,9 +46,9 @@
     void namedGetter(const AtomicString& name, bool&, RefPtr<RadioNodeList>&, bool&, RefPtr<Node>&);
 
 private:
-    HTMLFormControlsCollection(Node*);
+    explicit HTMLFormControlsCollection(Node*);
 
-    virtual void updateNameCache() const;
+    virtual void updateNameCache() const OVERRIDE;
 
     const Vector<FormAssociatedElement*>& formControlElements() const;
     const Vector<HTMLImageElement*>& formImageElements() const;
diff --git a/Source/core/html/HTMLFormElement.cpp b/Source/core/html/HTMLFormElement.cpp
index 505a506..2d2877e 100644
--- a/Source/core/html/HTMLFormElement.cpp
+++ b/Source/core/html/HTMLFormElement.cpp
@@ -25,17 +25,19 @@
 #include "config.h"
 #include "core/html/HTMLFormElement.h"
 
+#include <limits>
 #include "HTMLNames.h"
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attribute.h"
-#include "core/events/AutocompleteErrorEvent.h"
 #include "core/dom/Document.h"
 #include "core/dom/ElementTraversal.h"
-#include "core/events/Event.h"
-#include "core/events/EventNames.h"
 #include "core/dom/NamedNodesCollection.h"
+#include "core/events/AutocompleteErrorEvent.h"
+#include "core/events/Event.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLCollection.h"
+#include "core/html/HTMLDialogElement.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLObjectElement.h"
@@ -44,11 +46,11 @@
 #include "core/loader/FormState.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/Frame.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/Frame.h"
 #include "core/page/UseCounter.h"
 #include "core/rendering/RenderTextControl.h"
-#include <limits>
+#include "platform/UserGestureIndicator.h"
 
 using namespace std;
 
@@ -73,13 +75,13 @@
 
 PassRefPtr<HTMLFormElement> HTMLFormElement::create(Document& document)
 {
-    UseCounter::count(&document, UseCounter::FormElement);
+    UseCounter::count(document, UseCounter::FormElement);
     return adoptRef(new HTMLFormElement(formTag, document));
 }
 
 PassRefPtr<HTMLFormElement> HTMLFormElement::create(const QualifiedName& tagName, Document& document)
 {
-    UseCounter::count(&document, UseCounter::FormElement);
+    UseCounter::count(document, UseCounter::FormElement);
     return adoptRef(new HTMLFormElement(tagName, document));
 }
 
@@ -153,7 +155,7 @@
 void HTMLFormElement::handleLocalEvents(Event* event)
 {
     Node* targetNode = event->target()->toNode();
-    if (event->eventPhase() != Event::CAPTURING_PHASE && targetNode && targetNode != this && (event->type() == eventNames().submitEvent || event->type() == eventNames().resetEvent)) {
+    if (event->eventPhase() != Event::CAPTURING_PHASE && targetNode && targetNode != this && (event->type() == EventTypeNames::submit || event->type() == EventTypeNames::reset)) {
         event->stopPropagation();
         return;
     }
@@ -194,9 +196,10 @@
         prepareForSubmission(event);
 }
 
+// FIXME: Consolidate this and similar code in FormSubmission.cpp.
 static inline HTMLFormControlElement* submitElementFromEvent(const Event* event)
 {
-    for (Node* node = event->target()->toNode(); node; node = node->parentNode()) {
+    for (Node* node = event->target()->toNode(); node; node = node->parentOrShadowHostNode()) {
         if (node->isElementNode() && toElement(node)->isFormControlElement())
             return toHTMLFormControlElement(node);
     }
@@ -258,6 +261,7 @@
 
 bool HTMLFormElement::prepareForSubmission(Event* event)
 {
+    RefPtr<HTMLFormElement> protector(this);
     Frame* frame = document().frame();
     if (m_isSubmittingOrPreparingForSubmission || !frame)
         return m_isSubmittingOrPreparingForSubmission;
@@ -276,7 +280,7 @@
     RefPtr<FormState> formState = FormState::create(this, controlNamesAndValues, &document(), NotSubmittedByJavaScript);
     frame->loader()->client()->dispatchWillSendSubmitEvent(formState.release());
 
-    if (dispatchEvent(Event::createCancelableBubble(eventNames().submitEvent)))
+    if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::submit)))
         m_shouldSubmit = true;
 
     m_isSubmittingOrPreparingForSubmission = false;
@@ -294,7 +298,7 @@
 
 void HTMLFormElement::submitFromJavaScript()
 {
-    submit(0, false, ScriptController::processingUserGesture(), SubmittedByJavaScript);
+    submit(0, false, UserGestureIndicator::processingUserGesture(), SubmittedByJavaScript);
 }
 
 void HTMLFormElement::getTextFieldValues(StringPairVector& fieldNamesAndValues) const
@@ -316,6 +320,16 @@
     }
 }
 
+void HTMLFormElement::submitDialog(PassRefPtr<FormSubmission> formSubmission)
+{
+    for (Node* node = this; node; node = node->parentOrShadowHostNode()) {
+        if (node->hasTagName(dialogTag)) {
+            toHTMLDialogElement(node)->closeDialog(formSubmission->result());
+            return;
+        }
+    }
+}
+
 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger formSubmissionTrigger)
 {
     FrameView* view = document().view();
@@ -331,7 +345,7 @@
     m_isSubmittingOrPreparingForSubmission = true;
     m_wasUserSubmitted = processingUserGesture;
 
-    HTMLFormControlElement* firstSuccessfulSubmitButton = 0;
+    RefPtr<HTMLFormControlElement> firstSuccessfulSubmitButton;
     bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
 
     for (unsigned i = 0; i < m_associatedElements.size(); ++i) {
@@ -350,7 +364,12 @@
     if (needButtonActivation && firstSuccessfulSubmitButton)
         firstSuccessfulSubmitButton->setActivatedSubmit(true);
 
-    scheduleFormSubmission(FormSubmission::create(this, m_attributes, event, formSubmissionTrigger));
+
+    RefPtr<FormSubmission> formSubmission = FormSubmission::create(this, m_attributes, event, formSubmissionTrigger);
+    if (formSubmission->method() == FormSubmission::DialogMethod)
+        submitDialog(formSubmission.release());
+    else
+        scheduleFormSubmission(formSubmission.release());
 
     if (needButtonActivation && firstSuccessfulSubmitButton)
         firstSuccessfulSubmitButton->setActivatedSubmit(false);
@@ -392,7 +411,7 @@
 
     m_isInResetFunction = true;
 
-    if (!dispatchEvent(Event::createCancelableBubble(eventNames().resetEvent))) {
+    if (!dispatchEvent(Event::createCancelableBubble(EventTypeNames::reset))) {
         m_isInResetFunction = false;
         return;
     }
@@ -411,7 +430,7 @@
     if (!frame)
         return;
 
-    if (!shouldAutocomplete() || !ScriptController::processingUserGesture()) {
+    if (!shouldAutocomplete() || !UserGestureIndicator::processingUserGesture()) {
         finishRequestAutocomplete(AutocompleteResultErrorDisabled);
         return;
     }
@@ -426,7 +445,7 @@
 {
     RefPtr<Event> event;
     if (result == AutocompleteResultSuccess)
-        event = Event::create(eventNames().autocompleteEvent);
+        event = Event::create(EventTypeNames::autocomplete);
     else if (result == AutocompleteResultErrorDisabled)
         event = AutocompleteErrorEvent::create("disabled");
     else if (result == AutocompleteResultErrorCancel)
@@ -463,9 +482,9 @@
     else if (name == accept_charsetAttr)
         m_attributes.setAcceptCharset(value);
     else if (name == onautocompleteAttr)
-        setAttributeEventListener(eventNames().autocompleteEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::autocomplete, createAttributeEventListener(this, name, value));
     else if (name == onautocompleteerrorAttr)
-        setAttributeEventListener(eventNames().autocompleteerrorEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::autocompleteerror, createAttributeEventListener(this, name, value));
     else
         HTMLElement::parseAttribute(name, value);
 }
@@ -788,7 +807,7 @@
 void HTMLFormElement::setDemoted(bool demoted)
 {
     if (demoted)
-        UseCounter::count(&document(), UseCounter::DemotedFormElement);
+        UseCounter::count(document(), UseCounter::DemotedFormElement);
     m_wasDemoted = demoted;
 }
 
diff --git a/Source/core/html/HTMLFormElement.h b/Source/core/html/HTMLFormElement.h
index f733e71..31a88ab 100644
--- a/Source/core/html/HTMLFormElement.h
+++ b/Source/core/html/HTMLFormElement.h
@@ -141,6 +141,7 @@
 
     virtual void copyNonAttributePropertiesFromElement(const Element&) OVERRIDE;
 
+    void submitDialog(PassRefPtr<FormSubmission>);
     void submit(Event*, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger);
 
     void scheduleFormSubmission(PassRefPtr<FormSubmission>);
diff --git a/Source/core/html/HTMLFormElement.idl b/Source/core/html/HTMLFormElement.idl
index f1bcb0e..a5f89d4 100644
--- a/Source/core/html/HTMLFormElement.idl
+++ b/Source/core/html/HTMLFormElement.idl
@@ -19,15 +19,15 @@
  */
 
 interface HTMLFormElement : HTMLElement {
-    [Reflect=accept_charset] attribute DOMString acceptCharset;
-    [Reflect, URL] attribute DOMString action;
-    [Reflect] attribute DOMString autocomplete;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString enctype;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString encoding;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString method;
-    [Reflect] attribute DOMString name;
+    [Reflect=accept_charset, TreatNullAs=NullString] attribute DOMString acceptCharset;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString action;
+    [Reflect, TreatNullAs=NullString] attribute DOMString autocomplete;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString enctype;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString encoding;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString method;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
     [Reflect] attribute boolean noValidate;
-    [Reflect] attribute DOMString target;
+    [Reflect, TreatNullAs=NullString] attribute DOMString target;
 
     readonly attribute HTMLCollection elements;
     readonly attribute long length;
@@ -35,10 +35,10 @@
     [ImplementedAs=anonymousNamedGetter, OverrideBuiltins, NotEnumerable] getter (NodeList or Node)(DOMString name);
 
     [ImplementedAs=submitFromJavaScript] void submit();
-    [CustomElementCallbacks=Enable] void reset();
+    [CustomElementCallbacks] void reset();
     boolean checkValidity();
 
-    [EnabledAtRuntime=RequestAutocomplete] void requestAutocomplete();
-    [EnabledAtRuntime=RequestAutocomplete, NotEnumerable] attribute EventHandler onautocomplete;
-    [EnabledAtRuntime=RequestAutocomplete, NotEnumerable] attribute EventHandler onautocompleteerror;
+    [RuntimeEnabled=RequestAutocomplete] void requestAutocomplete();
+    [RuntimeEnabled=RequestAutocomplete, NotEnumerable] attribute EventHandler onautocomplete;
+    [RuntimeEnabled=RequestAutocomplete, NotEnumerable] attribute EventHandler onautocompleteerror;
 };
diff --git a/Source/core/html/HTMLFrameElement.idl b/Source/core/html/HTMLFrameElement.idl
index c702fd6..6b9a732 100644
--- a/Source/core/html/HTMLFrameElement.idl
+++ b/Source/core/html/HTMLFrameElement.idl
@@ -20,14 +20,14 @@
 
 interface HTMLFrameElement : HTMLElement {
 
-    [Reflect] attribute DOMString frameBorder;
-    [Reflect] attribute DOMString longDesc;
-    [Reflect] attribute DOMString marginHeight;
-    [Reflect] attribute DOMString marginWidth;
-    [Reflect] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString frameBorder;
+    [Reflect, TreatNullAs=NullString] attribute DOMString longDesc;
+    [Reflect, TreatNullAs=NullString] attribute DOMString marginHeight;
+    [Reflect, TreatNullAs=NullString] attribute DOMString marginWidth;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
     [Reflect] attribute boolean noResize;
-    [Reflect] attribute DOMString scrolling;
-    [Reflect, URL] attribute DOMString src;
+    [Reflect, TreatNullAs=NullString] attribute DOMString scrolling;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString src;
 
     // Introduced in DOM Level 2:
     [CheckSecurityForNode] readonly attribute Document contentDocument;
diff --git a/Source/core/html/HTMLFrameElementBase.cpp b/Source/core/html/HTMLFrameElementBase.cpp
index ac72a37..5c3598b 100644
--- a/Source/core/html/HTMLFrameElementBase.cpp
+++ b/Source/core/html/HTMLFrameElementBase.cpp
@@ -29,12 +29,12 @@
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/loader/FrameLoader.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/rendering/RenderPart.h"
 
@@ -126,10 +126,10 @@
             m_scrolling = ScrollbarAlwaysOff;
         // FIXME: If we are already attached, this has no effect.
     } else if (name == onbeforeloadAttr)
-        setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::beforeload, createAttributeEventListener(this, name, value));
     else if (name == onbeforeunloadAttr) {
         // FIXME: should <frame> elements have beforeunload handlers?
-        setAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::beforeunload, createAttributeEventListener(this, name, value));
     } else
         HTMLFrameOwnerElement::parseAttribute(name, value);
 }
diff --git a/Source/core/html/HTMLFrameElementBase.h b/Source/core/html/HTMLFrameElementBase.h
index a384652..2fa32b9 100644
--- a/Source/core/html/HTMLFrameElementBase.h
+++ b/Source/core/html/HTMLFrameElementBase.h
@@ -25,7 +25,7 @@
 #define HTMLFrameElementBase_h
 
 #include "core/html/HTMLFrameOwnerElement.h"
-#include "core/platform/ScrollTypes.h"
+#include "platform/scroll/ScrollTypes.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLFrameOwnerElement.cpp b/Source/core/html/HTMLFrameOwnerElement.cpp
index 58ef877..184af3a 100644
--- a/Source/core/html/HTMLFrameOwnerElement.cpp
+++ b/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -25,8 +25,8 @@
 #include "core/dom/ExceptionCode.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/RenderPart.h"
 #include "core/svg/SVGDocument.h"
 #include "weborigin/SecurityOrigin.h"
diff --git a/Source/core/html/HTMLFrameSetElement.cpp b/Source/core/html/HTMLFrameSetElement.cpp
index 1a348a3..ff951d8 100644
--- a/Source/core/html/HTMLFrameSetElement.cpp
+++ b/Source/core/html/HTMLFrameSetElement.cpp
@@ -29,13 +29,13 @@
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Document.h"
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
 #include "core/events/MouseEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLCollection.h"
 #include "core/html/HTMLDimension.h"
 #include "core/html/HTMLFrameElement.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderFrameSet.h"
 
 namespace WebCore {
@@ -111,37 +111,37 @@
     } else if (name == bordercolorAttr)
         m_borderColorSet = !value.isEmpty();
     else if (name == onloadAttr)
-        document().setWindowAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::load, createAttributeEventListener(document().frame(), name, value));
     else if (name == onbeforeunloadAttr)
-        document().setWindowAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::beforeunload, createAttributeEventListener(document().frame(), name, value));
     else if (name == onunloadAttr)
-        document().setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::unload, createAttributeEventListener(document().frame(), name, value));
     else if (name == onblurAttr)
-        document().setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::blur, createAttributeEventListener(document().frame(), name, value));
     else if (name == onfocusAttr)
-        document().setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::focus, createAttributeEventListener(document().frame(), name, value));
     else if (name == onfocusinAttr)
-        document().setWindowAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::focusin, createAttributeEventListener(document().frame(), name, value));
     else if (name == onfocusoutAttr)
-        document().setWindowAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::focusout, createAttributeEventListener(document().frame(), name, value));
 #if ENABLE(ORIENTATION_EVENTS)
     else if (name == onorientationchangeAttr)
-        document().setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::orientationchange, createAttributeEventListener(document().frame(), name, value));
 #endif
     else if (name == onhashchangeAttr)
-        document().setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::hashchange, createAttributeEventListener(document().frame(), name, value));
     else if (name == onresizeAttr)
-        document().setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::resize, createAttributeEventListener(document().frame(), name, value));
     else if (name == onscrollAttr)
-        document().setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::scroll, createAttributeEventListener(document().frame(), name, value));
     else if (name == onstorageAttr)
-        document().setWindowAttributeEventListener(eventNames().storageEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::storage, createAttributeEventListener(document().frame(), name, value));
     else if (name == ononlineAttr)
-        document().setWindowAttributeEventListener(eventNames().onlineEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::online, createAttributeEventListener(document().frame(), name, value));
     else if (name == onofflineAttr)
-        document().setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::offline, createAttributeEventListener(document().frame(), name, value));
     else if (name == onpopstateAttr)
-        document().setWindowAttributeEventListener(eventNames().popstateEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::popstate, createAttributeEventListener(document().frame(), name, value));
     else
         HTMLElement::parseAttribute(name, value);
 }
diff --git a/Source/core/html/HTMLFrameSetElement.idl b/Source/core/html/HTMLFrameSetElement.idl
index 0a35684..8a09ca1 100644
--- a/Source/core/html/HTMLFrameSetElement.idl
+++ b/Source/core/html/HTMLFrameSetElement.idl
@@ -20,8 +20,8 @@
 
 interface HTMLFrameSetElement : HTMLElement {
     [ImplementedAs=anonymousNamedGetter, OverrideBuiltins, NotEnumerable] getter Window (DOMString name);
-    [Reflect] attribute DOMString cols;
-    [Reflect] attribute DOMString rows;
+    [Reflect, TreatNullAs=NullString] attribute DOMString cols;
+    [Reflect, TreatNullAs=NullString] attribute DOMString rows;
 
     // Event handler attributes
     [NotEnumerable] attribute EventHandler onbeforeunload;
diff --git a/Source/core/html/HTMLHRElement.idl b/Source/core/html/HTMLHRElement.idl
index babe467..302f7e9 100644
--- a/Source/core/html/HTMLHRElement.idl
+++ b/Source/core/html/HTMLHRElement.idl
@@ -18,9 +18,9 @@
  */
 
 interface HTMLHRElement : HTMLElement {
-    [Reflect] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
     [Reflect] attribute boolean noShade;
-    [Reflect] attribute DOMString size;
-    [Reflect] attribute DOMString width;
+    [Reflect, TreatNullAs=NullString] attribute DOMString size;
+    [Reflect, TreatNullAs=NullString] attribute DOMString width;
 };
 
diff --git a/Source/core/html/HTMLHeadElement.idl b/Source/core/html/HTMLHeadElement.idl
index 6a784bd..5d17741 100644
--- a/Source/core/html/HTMLHeadElement.idl
+++ b/Source/core/html/HTMLHeadElement.idl
@@ -18,6 +18,6 @@
  */
 
 interface HTMLHeadElement : HTMLElement {
-    [Reflect] attribute DOMString profile;
+    [Reflect, TreatNullAs=NullString] attribute DOMString profile;
 };
 
diff --git a/Source/core/html/HTMLHeadingElement.idl b/Source/core/html/HTMLHeadingElement.idl
index 288f439..e339d6e 100644
--- a/Source/core/html/HTMLHeadingElement.idl
+++ b/Source/core/html/HTMLHeadingElement.idl
@@ -18,6 +18,6 @@
  */
 
 interface HTMLHeadingElement : HTMLElement {
-    [Reflect] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
 };
 
diff --git a/Source/core/html/HTMLHtmlElement.cpp b/Source/core/html/HTMLHtmlElement.cpp
index 87d00e9..e949dfe 100644
--- a/Source/core/html/HTMLHtmlElement.cpp
+++ b/Source/core/html/HTMLHtmlElement.cpp
@@ -30,7 +30,7 @@
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/appcache/ApplicationCacheHost.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLHtmlElement.idl b/Source/core/html/HTMLHtmlElement.idl
index 430cdc6..5f6b1a7 100644
--- a/Source/core/html/HTMLHtmlElement.idl
+++ b/Source/core/html/HTMLHtmlElement.idl
@@ -18,7 +18,7 @@
  */
 
 interface HTMLHtmlElement : HTMLElement {
-    [Reflect] attribute DOMString version;
-    [Reflect, URL] attribute DOMString manifest;
+    [Reflect, TreatNullAs=NullString] attribute DOMString version;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString manifest;
 };
 
diff --git a/Source/core/html/HTMLIFrameElement.idl b/Source/core/html/HTMLIFrameElement.idl
index d47b1b7..f879d85 100644
--- a/Source/core/html/HTMLIFrameElement.idl
+++ b/Source/core/html/HTMLIFrameElement.idl
@@ -19,19 +19,19 @@
  */
 
 interface HTMLIFrameElement : HTMLElement {
-    [Reflect] attribute DOMString align;
-    [Reflect] attribute DOMString frameBorder;
-    [Reflect] attribute DOMString height;
-    [Reflect] attribute DOMString longDesc;
-    [Reflect] attribute DOMString marginHeight;
-    [Reflect] attribute DOMString marginWidth;
-    [Reflect] attribute DOMString name;
-    [Reflect] attribute DOMString sandbox;
-    [Reflect, EnabledAtRuntime=SeamlessIFrames] attribute boolean seamless;
-    [Reflect] attribute DOMString scrolling;
-    [Reflect, URL] attribute DOMString src;
-    [Reflect] attribute DOMString srcdoc;
-    [Reflect] attribute DOMString width;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString frameBorder;
+    [Reflect, TreatNullAs=NullString] attribute DOMString height;
+    [Reflect, TreatNullAs=NullString] attribute DOMString longDesc;
+    [Reflect, TreatNullAs=NullString] attribute DOMString marginHeight;
+    [Reflect, TreatNullAs=NullString] attribute DOMString marginWidth;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString sandbox;
+    [Reflect, RuntimeEnabled=SeamlessIFrames] attribute boolean seamless;
+    [Reflect, TreatNullAs=NullString] attribute DOMString scrolling;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString src;
+    [Reflect, TreatNullAs=NullString] attribute DOMString srcdoc;
+    [Reflect, TreatNullAs=NullString] attribute DOMString width;
 
     // Introduced in DOM Level 2:
     [CheckSecurityForNode] readonly attribute Document contentDocument;
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp
index 35a98a4..b3edc69 100644
--- a/Source/core/html/HTMLImageElement.cpp
+++ b/Source/core/html/HTMLImageElement.cpp
@@ -28,7 +28,7 @@
 #include "RuntimeEnabledFeatures.h"
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attribute.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/fetch/ImageResource.h"
 #include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLFormElement.h"
@@ -47,6 +47,7 @@
     , m_imageLoader(this)
     , m_form(form)
     , m_compositeOperator(CompositeSourceOver)
+    , m_imageDevicePixelRatio(1.0f)
 {
     ASSERT(hasTagName(imgTag));
     ScriptWrappable::init(this);
@@ -120,14 +121,21 @@
         if (renderer() && renderer()->isImage())
             toRenderImage(renderer())->updateAltText();
     } else if (name == srcAttr || name == srcsetAttr) {
-        if (RuntimeEnabledFeatures::srcsetEnabled())
-            m_bestFitImageURL = bestFitSourceForImageAttributes(document().devicePixelRatio(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr));
+        if (RuntimeEnabledFeatures::srcsetEnabled()) {
+            ImageCandidate candidate = bestFitSourceForImageAttributes(document().devicePixelRatio(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr));
+            m_bestFitImageURL = candidate.toString();
+            float candidateScaleFactor = candidate.scaleFactor();
+            if (candidateScaleFactor > 0)
+                m_imageDevicePixelRatio = 1 / candidateScaleFactor;
+            if (renderer() && renderer()->isImage())
+                toRenderImage(renderer())->setImageDevicePixelRatio(m_imageDevicePixelRatio);
+        }
         m_imageLoader.updateFromElementIgnoringPreviousError();
     }
     else if (name == usemapAttr)
         setIsLink(!value.isNull());
     else if (name == onbeforeloadAttr)
-        setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::beforeload, createAttributeEventListener(this, name, value));
     else if (name == compositeAttr) {
         // FIXME: images don't support blend modes in their compositing attribute.
         BlendMode blendOp = BlendModeNormal;
@@ -156,6 +164,7 @@
 
     RenderImage* image = new RenderImage(this);
     image->setImageResource(RenderImageResource::create());
+    image->setImageDevicePixelRatio(m_imageDevicePixelRatio);
     return image;
 }
 
@@ -355,7 +364,7 @@
     addSubresourceURL(urls, document().completeURL(getAttribute(usemapAttr)));
 }
 
-void HTMLImageElement::didMoveToNewDocument(Document* oldDocument)
+void HTMLImageElement::didMoveToNewDocument(Document& oldDocument)
 {
     m_imageLoader.elementDidMoveToNewDocument();
     HTMLElement::didMoveToNewDocument(oldDocument);
diff --git a/Source/core/html/HTMLImageElement.h b/Source/core/html/HTMLImageElement.h
index 0f9bc67..5da146d 100644
--- a/Source/core/html/HTMLImageElement.h
+++ b/Source/core/html/HTMLImageElement.h
@@ -84,7 +84,7 @@
 protected:
     HTMLImageElement(const QualifiedName&, Document&, HTMLFormElement* = 0);
 
-    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+    virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
 
 private:
     virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
@@ -115,6 +115,7 @@
     HTMLFormElement* m_form;
     CompositeOperator m_compositeOperator;
     AtomicString m_bestFitImageURL;
+    float m_imageDevicePixelRatio;
 };
 
 inline HTMLImageElement* toHTMLImageElement(Node* node)
diff --git a/Source/core/html/HTMLImageElement.idl b/Source/core/html/HTMLImageElement.idl
index efd1c6a..a7c80e5 100644
--- a/Source/core/html/HTMLImageElement.idl
+++ b/Source/core/html/HTMLImageElement.idl
@@ -20,24 +20,24 @@
 
 [
 ] interface HTMLImageElement : HTMLElement {
-    [Reflect] attribute DOMString name;
-    [Reflect] attribute DOMString align;
-    [Reflect] attribute DOMString alt;
-    [Reflect] attribute DOMString border;
-    [Reflect] attribute DOMString crossOrigin;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString alt;
+    [Reflect, TreatNullAs=NullString] attribute DOMString border;
+    [Reflect, TreatNullAs=NullString] attribute DOMString crossOrigin;
     attribute long height;
     [Reflect] attribute long hspace;
     [Reflect] attribute boolean isMap;
-    [Reflect, URL] attribute DOMString longDesc;
-    [Reflect, URL] attribute DOMString src;
-    [Reflect, EnabledAtRuntime=Srcset] attribute DOMString srcset;
-    [Reflect] attribute DOMString useMap;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString longDesc;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString src;
+    [Reflect, TreatNullAs=NullString, RuntimeEnabled=Srcset] attribute DOMString srcset;
+    [Reflect, TreatNullAs=NullString] attribute DOMString useMap;
     [Reflect] attribute long vspace;
     attribute long width;
 
     // Extensions
     readonly attribute boolean complete;
-    [Reflect,URL] attribute DOMString lowsrc;
+    [Reflect, TreatNullAs=NullString,URL] attribute DOMString lowsrc;
     readonly attribute long naturalHeight;
     readonly attribute long naturalWidth;
     readonly attribute long x;
diff --git a/Source/core/html/HTMLImageLoader.cpp b/Source/core/html/HTMLImageLoader.cpp
index ac015b3..a718ba1 100644
--- a/Source/core/html/HTMLImageLoader.cpp
+++ b/Source/core/html/HTMLImageLoader.cpp
@@ -25,7 +25,7 @@
 #include "HTMLNames.h"
 #include "core/dom/Element.h"
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/fetch/ImageResource.h"
 #include "core/html/HTMLObjectElement.h"
 #include "core/html/HTMLVideoElement.h"
@@ -51,7 +51,7 @@
     bool errorOccurred = image()->errorOccurred();
     if (!errorOccurred && image()->response().httpStatusCode() >= 400)
         errorOccurred = element()->hasTagName(HTMLNames::objectTag); // An <object> considers a 404 to be an error and should fire onerror.
-    element()->dispatchEvent(Event::create(errorOccurred ? eventNames().errorEvent : eventNames().loadEvent));
+    element()->dispatchEvent(Event::create(errorOccurred ? EventTypeNames::error : EventTypeNames::load));
 }
 
 String HTMLImageLoader::sourceURI(const AtomicString& attr) const
diff --git a/Source/core/html/HTMLImportLoader.cpp b/Source/core/html/HTMLImportLoader.cpp
index 283b757..3f8ca2f 100644
--- a/Source/core/html/HTMLImportLoader.cpp
+++ b/Source/core/html/HTMLImportLoader.cpp
@@ -31,13 +31,13 @@
 #include "config.h"
 #include "core/html/HTMLImportLoader.h"
 
-#include "core/dom/CustomElementRegistrationContext.h"
 #include "core/dom/Document.h"
+#include "core/dom/custom/CustomElementRegistrationContext.h"
 #include "core/fetch/ResourceFetcher.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLImportLoaderClient.h"
 #include "core/loader/DocumentWriter.h"
-#include "core/page/ContentSecurityPolicyResponseHeaders.h"
+#include "core/frame/ContentSecurityPolicyResponseHeaders.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLImportsController.cpp b/Source/core/html/HTMLImportsController.cpp
index 7b1b6e2..121e71a 100644
--- a/Source/core/html/HTMLImportsController.cpp
+++ b/Source/core/html/HTMLImportsController.cpp
@@ -43,7 +43,7 @@
     DEFINE_STATIC_LOCAL(const char*, name, ("HTMLImportsController"));
     OwnPtr<HTMLImportsController> controller = adoptPtr(new HTMLImportsController(master));
     master->setImport(controller.get());
-    Supplement<ScriptExecutionContext>::provideTo(master, name, controller.release());
+    DocumentSupplement::provideTo(master, name, controller.release());
 }
 
 HTMLImportsController::HTMLImportsController(Document* master)
diff --git a/Source/core/html/HTMLImportsController.h b/Source/core/html/HTMLImportsController.h
index 0a06c4e..c11ebed 100644
--- a/Source/core/html/HTMLImportsController.h
+++ b/Source/core/html/HTMLImportsController.h
@@ -34,8 +34,8 @@
 #include "core/fetch/RawResource.h"
 #include "core/html/HTMLImport.h"
 #include "core/html/LinkResource.h"
-#include "core/platform/Supplementable.h"
-#include "core/platform/Timer.h"
+#include "platform/Supplementable.h"
+#include "platform/Timer.h"
 #include "wtf/FastAllocBase.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
@@ -43,12 +43,12 @@
 namespace WebCore {
 
 class FetchRequest;
-class ScriptExecutionContext;
+class ExecutionContext;
 class ResourceFetcher;
 class HTMLImportLoader;
 class HTMLImportLoaderClient;
 
-class HTMLImportsController : public HTMLImportRoot, public Supplement<ScriptExecutionContext> {
+class HTMLImportsController : public HTMLImportRoot, public DocumentSupplement {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     static void provideTo(Document*);
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index 6a8d07d..53b676c 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -35,21 +35,20 @@
 #include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/accessibility/AXObjectCache.h"
-#include "core/events/BeforeTextInsertedEvent.h"
 #include "core/dom/Document.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/IdTargetObserver.h"
-#include "core/events/KeyboardEvent.h"
-#include "core/events/MouseEvent.h"
-#include "core/events/ScopedEventQueue.h"
-#include "core/dom/TouchController.h"
-#include "core/events/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/events/BeforeTextInsertedEvent.h"
+#include "core/events/KeyboardEvent.h"
+#include "core/events/MouseEvent.h"
+#include "core/events/ScopedEventQueue.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/events/TouchEvent.h"
 #include "core/fileapi/FileList.h"
 #include "core/html/HTMLCollection.h"
 #include "core/html/HTMLDataListElement.h"
@@ -62,15 +61,15 @@
 #include "core/html/forms/InputType.h"
 #include "core/html/forms/SearchInputType.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/UseCounter.h"
 #include "core/platform/DateTimeChooser.h"
-#include "core/platform/Language.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/PlatformMouseEvent.h"
 #include "core/rendering/RenderTextControlSingleLine.h"
 #include "core/rendering/RenderTheme.h"
+#include "platform/Language.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/MathExtras.h"
 
 using namespace std;
@@ -110,7 +109,6 @@
     , m_hasType(false)
     , m_isActivatedSubmit(false)
     , m_autocomplete(Uninitialized)
-    , m_isAutofilled(false)
     , m_hasNonEmptyList(false)
     , m_stateRestored(false)
     , m_parsingInProgress(createdByParser)
@@ -164,7 +162,7 @@
     if (isRadioButton())
         document().formController()->checkedRadioButtons().removeButton(this);
     if (m_hasTouchEventHandler)
-        TouchController::from(&document())->didRemoveEventTargetNode(&document(), this);
+        document().didRemoveEventTargetNode(this);
 }
 
 const AtomicString& HTMLInputElement::name() const
@@ -421,7 +419,7 @@
 
     m_inputType->destroyShadowSubtree();
 
-    bool wasAttached = attached();
+    bool wasAttached = confusingAndOftenMisusedAttached();
     if (wasAttached)
         detach();
 
@@ -434,11 +432,10 @@
 
     bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler();
     if (hasTouchEventHandler != m_hasTouchEventHandler) {
-        TouchController* controller = TouchController::from(&document());
         if (hasTouchEventHandler)
-            controller->didAddTouchEventHandler(&document(), this);
+            document().didAddTouchEventHandler(this);
         else
-            controller->didRemoveTouchEventHandler(&document(), this);
+            document().didRemoveTouchEventHandler(this);
         m_hasTouchEventHandler = hasTouchEventHandler;
     }
 
@@ -687,7 +684,7 @@
         // FIXME: ignore for the moment
     } else if (name == onsearchAttr) {
         // Search field and slider attributes all just cause updateFromElement to be called through style recalcing.
-        setAttributeEventListener(eventNames().searchEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::search, createAttributeEventListener(this, name, value));
     } else if (name == resultsAttr) {
         int oldResults = m_maxResults;
         m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults) : -1;
@@ -696,32 +693,32 @@
         if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0))
             lazyReattachIfAttached();
         setNeedsStyleRecalc();
-        UseCounter::count(&document(), UseCounter::ResultsAttribute);
+        UseCounter::count(document(), UseCounter::ResultsAttribute);
     } else if (name == incrementalAttr) {
         setNeedsStyleRecalc();
-        UseCounter::count(&document(), UseCounter::IncrementalAttribute);
+        UseCounter::count(document(), UseCounter::IncrementalAttribute);
     } else if (name == minAttr) {
         m_inputTypeView->minOrMaxAttributeChanged();
         m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange();
         setNeedsValidityCheck();
-        UseCounter::count(&document(), UseCounter::MinAttribute);
+        UseCounter::count(document(), UseCounter::MinAttribute);
     } else if (name == maxAttr) {
         m_inputTypeView->minOrMaxAttributeChanged();
         setNeedsValidityCheck();
-        UseCounter::count(&document(), UseCounter::MaxAttribute);
+        UseCounter::count(document(), UseCounter::MaxAttribute);
     } else if (name == multipleAttr) {
         m_inputTypeView->multipleAttributeChanged();
         setNeedsValidityCheck();
     } else if (name == stepAttr) {
         m_inputTypeView->stepAttributeChanged();
         setNeedsValidityCheck();
-        UseCounter::count(&document(), UseCounter::StepAttribute);
+        UseCounter::count(document(), UseCounter::StepAttribute);
     } else if (name == patternAttr) {
         setNeedsValidityCheck();
-        UseCounter::count(&document(), UseCounter::PatternAttribute);
+        UseCounter::count(document(), UseCounter::PatternAttribute);
     } else if (name == precisionAttr) {
         setNeedsValidityCheck();
-        UseCounter::count(&document(), UseCounter::PrecisionAttribute);
+        UseCounter::count(document(), UseCounter::PrecisionAttribute);
     } else if (name == disabledAttr) {
         HTMLTextFormControlElement::parseAttribute(name, value);
         m_inputTypeView->disabledAttributeChanged();
@@ -734,7 +731,7 @@
             resetListAttributeTargetObserver();
             listAttributeTargetChanged();
         }
-        UseCounter::count(&document(), UseCounter::ListAttribute);
+        UseCounter::count(document(), UseCounter::ListAttribute);
     }
 #if ENABLE(INPUT_SPEECH)
     else if (name == webkitspeechAttr) {
@@ -748,13 +745,13 @@
             m_inputType->createShadowSubtree();
             setFormControlValueMatchesRenderer(false);
         }
-        UseCounter::count(&document(), UseCounter::PrefixedSpeechAttribute);
+        UseCounter::count(document(), UseCounter::PrefixedSpeechAttribute);
     } else if (name == onwebkitspeechchangeAttr)
-        setAttributeEventListener(eventNames().webkitspeechchangeEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::webkitspeechchange, createAttributeEventListener(this, name, value));
 #endif
     else if (name == webkitdirectoryAttr) {
         HTMLTextFormControlElement::parseAttribute(name, value);
-        UseCounter::count(&document(), UseCounter::PrefixedDirectoryAttribute);
+        UseCounter::count(document(), UseCounter::PrefixedDirectoryAttribute);
     }
     else
         HTMLTextFormControlElement::parseAttribute(name, value);
@@ -816,7 +813,7 @@
     if (alt.isNull())
         alt = getAttribute(valueAttr);
     if (alt.isEmpty())
-        alt = inputElementAltText();
+        alt = locale().queryString(WebKit::WebLocalizedString::InputElementAltText);
     return alt;
 }
 
@@ -842,12 +839,11 @@
     return m_inputType->isFormDataAppendable() && m_inputType->appendFormData(encoding, multipart);
 }
 
-void HTMLInputElement::reset()
+void HTMLInputElement::resetImpl()
 {
     if (m_inputType->storesValueSeparateFromAttribute())
         setValue(String());
 
-    setAutofilled(false);
     setChecked(hasAttribute(checkedAttr));
     m_reflectsCheckedAttribute = true;
 }
@@ -1095,11 +1091,11 @@
 
 void* HTMLInputElement::preDispatchEventHandler(Event* event)
 {
-    if (event->type() == eventNames().textInputEvent && m_inputTypeView->shouldSubmitImplicitly(event)) {
+    if (event->type() == EventTypeNames::textInput && m_inputTypeView->shouldSubmitImplicitly(event)) {
         event->stopPropagation();
         return 0;
     }
-    if (event->type() != eventNames().clickEvent)
+    if (event->type() != EventTypeNames::click)
         return 0;
     if (!event->isMouseEvent() || toMouseEvent(event)->button() != LeftButton)
         return 0;
@@ -1117,7 +1113,7 @@
 
 void HTMLInputElement::defaultEventHandler(Event* evt)
 {
-    if (evt->isMouseEvent() && evt->type() == eventNames().clickEvent && toMouseEvent(evt)->button() == LeftButton) {
+    if (evt->isMouseEvent() && evt->type() == EventTypeNames::click && toMouseEvent(evt)->button() == LeftButton) {
         m_inputTypeView->handleClickEvent(toMouseEvent(evt));
         if (evt->defaultHandled())
             return;
@@ -1129,7 +1125,7 @@
             return;
     }
 
-    if (evt->isKeyboardEvent() && evt->type() == eventNames().keydownEvent) {
+    if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keydown) {
         m_inputTypeView->handleKeydownEvent(toKeyboardEvent(evt));
         if (evt->defaultHandled())
             return;
@@ -1137,7 +1133,7 @@
 
     // Call the base event handler before any of our own event handling for almost all events in text fields.
     // Makes editing keyboard handling take precedence over the keydown and keypress handling in this function.
-    bool callBaseClassEarly = isTextField() && (evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent);
+    bool callBaseClassEarly = isTextField() && (evt->type() == EventTypeNames::keydown || evt->type() == EventTypeNames::keypress);
     if (callBaseClassEarly) {
         HTMLTextFormControlElement::defaultEventHandler(evt);
         if (evt->defaultHandled())
@@ -1148,7 +1144,7 @@
     // actually submitting the form. For reset inputs, the form is reset. These events are sent when the user clicks
     // on the element, or presses enter while it is the active element. JavaScript code wishing to activate the element
     // must dispatch a DOMActivate event - a click event will not do the job.
-    if (evt->type() == eventNames().DOMActivateEvent) {
+    if (evt->type() == EventTypeNames::DOMActivate) {
         m_inputType->handleDOMActivateEvent(evt);
         if (evt->defaultHandled())
             return;
@@ -1156,13 +1152,13 @@
 
     // Use key press event here since sending simulated mouse events
     // on key down blocks the proper sending of the key press event.
-    if (evt->isKeyboardEvent() && evt->type() == eventNames().keypressEvent) {
+    if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keypress) {
         m_inputTypeView->handleKeypressEvent(toKeyboardEvent(evt));
         if (evt->defaultHandled())
             return;
     }
 
-    if (evt->isKeyboardEvent() && evt->type() == eventNames().keyupEvent) {
+    if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keyup) {
         m_inputTypeView->handleKeyupEvent(toKeyboardEvent(evt));
         if (evt->defaultHandled())
             return;
@@ -1188,7 +1184,7 @@
     if (evt->isBeforeTextInsertedEvent())
         m_inputTypeView->handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(evt));
 
-    if (evt->isMouseEvent() && evt->type() == eventNames().mousedownEvent) {
+    if (evt->isMouseEvent() && evt->type() == EventTypeNames::mousedown) {
         m_inputTypeView->handleMouseDownEvent(toMouseEvent(evt));
         if (evt->defaultHandled())
             return;
@@ -1324,15 +1320,6 @@
     return document().completeURL(fastGetAttribute(srcAttr));
 }
 
-void HTMLInputElement::setAutofilled(bool autofilled)
-{
-    if (autofilled == m_isAutofilled)
-        return;
-
-    m_isAutofilled = autofilled;
-    setNeedsStyleRecalc();
-}
-
 FileList* HTMLInputElement::files()
 {
     return m_inputType->files();
@@ -1416,7 +1403,7 @@
     ASSERT(isSearchField());
     if (m_inputType)
         static_cast<SearchInputType*>(m_inputType.get())->stopSearchEventTimer();
-    dispatchEvent(Event::createBubble(eventNames().searchEvent));
+    dispatchEvent(Event::createBubble(EventTypeNames::search));
 }
 
 void HTMLInputElement::updateClearButtonVisibility()
@@ -1454,20 +1441,18 @@
     resetListAttributeTargetObserver();
 }
 
-void HTMLInputElement::didMoveToNewDocument(Document* oldDocument)
+void HTMLInputElement::didMoveToNewDocument(Document& oldDocument)
 {
     if (hasImageLoader())
         imageLoader()->elementDidMoveToNewDocument();
 
-    if (oldDocument) {
-        if (isRadioButton())
-            oldDocument->formController()->checkedRadioButtons().removeButton(this);
-        if (m_hasTouchEventHandler)
-            TouchController::from(oldDocument)->didRemoveEventTargetNode(oldDocument, this);
-    }
+    if (isRadioButton())
+        oldDocument.formController()->checkedRadioButtons().removeButton(this);
+    if (m_hasTouchEventHandler)
+        oldDocument.didRemoveEventTargetNode(this);
 
     if (m_hasTouchEventHandler)
-        TouchController::from(&document())->didAddTouchEventHandler(&document(), this);
+        document().didAddTouchEventHandler(this);
 
     HTMLTextFormControlElement::didMoveToNewDocument(oldDocument);
 }
@@ -1723,9 +1708,9 @@
     // supposed to be used as a boolean.
     bool hasDeprecatedUsage = !fastGetAttribute(captureAttr).isNull();
     if (hasDeprecatedUsage)
-        UseCounter::countDeprecation(&document(), UseCounter::CaptureAttributeAsEnum);
+        UseCounter::countDeprecation(document(), UseCounter::CaptureAttributeAsEnum);
     else
-        UseCounter::count(&document(), UseCounter::CaptureAttributeAsEnum);
+        UseCounter::count(document(), UseCounter::CaptureAttributeAsEnum);
 
     return true;
 }
diff --git a/Source/core/html/HTMLInputElement.h b/Source/core/html/HTMLInputElement.h
index f2a38c4..884940c 100644
--- a/Source/core/html/HTMLInputElement.h
+++ b/Source/core/html/HTMLInputElement.h
@@ -27,7 +27,7 @@
 
 #include "core/html/HTMLTextFormControlElement.h"
 #include "core/html/forms/StepRange.h"
-#include "core/platform/FileChooser.h"
+#include "platform/FileChooser.h"
 
 namespace WebCore {
 
@@ -209,9 +209,6 @@
 
     bool multiple() const;
 
-    bool isAutofilled() const { return m_isAutofilled; }
-    void setAutofilled(bool = true);
-
     FileList* files();
     void setFiles(PassRefPtr<FileList>);
 
@@ -298,7 +295,7 @@
     virtual void didChangeForm() OVERRIDE;
     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
     virtual void removedFrom(ContainerNode*) OVERRIDE;
-    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+    virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
 
     virtual bool hasCustomFocusLogic() const OVERRIDE;
     virtual bool isKeyboardFocusable() const OVERRIDE;
@@ -335,7 +332,7 @@
 
     virtual bool isSuccessfulSubmitButton() const;
 
-    virtual void reset();
+    virtual void resetImpl() OVERRIDE;
 
     virtual void* preDispatchEventHandler(Event*);
     virtual void postDispatchEventHandler(Event*, void* dataFromPreDispatch);
@@ -392,7 +389,6 @@
     bool m_hasType : 1;
     bool m_isActivatedSubmit : 1;
     unsigned m_autocomplete : 2; // AutoCompleteSetting
-    bool m_isAutofilled : 1;
     bool m_hasNonEmptyList : 1;
     bool m_stateRestored : 1;
     bool m_parsingInProgress : 1;
diff --git a/Source/core/html/HTMLInputElement.idl b/Source/core/html/HTMLInputElement.idl
index fd6151d..20056c3 100644
--- a/Source/core/html/HTMLInputElement.idl
+++ b/Source/core/html/HTMLInputElement.idl
@@ -21,50 +21,50 @@
 
 [
 ] interface HTMLInputElement : HTMLElement {
-    [Reflect] attribute DOMString accept;
-    [Reflect] attribute DOMString alt;
-    [Reflect] attribute DOMString autocomplete;
+    [Reflect, TreatNullAs=NullString] attribute DOMString accept;
+    [Reflect, TreatNullAs=NullString] attribute DOMString alt;
+    [Reflect, TreatNullAs=NullString] attribute DOMString autocomplete;
     [Reflect] attribute boolean autofocus;
     [Reflect=checked] attribute boolean defaultChecked;
     attribute boolean checked;
-    [Reflect] attribute DOMString dirName;
+    [Reflect, TreatNullAs=NullString] attribute DOMString dirName;
     [Reflect] attribute boolean disabled;
     readonly attribute HTMLFormElement form;
     // The 'files' attribute is intentionally not readonly.
     // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22682
     attribute FileList files;
-    [Reflect, URL] attribute DOMString formAction;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString formEnctype;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString formMethod;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString formAction;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString formEnctype;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString formMethod;
     [Reflect] attribute boolean formNoValidate;
-    [Reflect] attribute DOMString formTarget;
-    [CustomElementCallbacks=Enable] attribute unsigned long height;
+    [Reflect, TreatNullAs=NullString] attribute DOMString formTarget;
+    [CustomElementCallbacks] attribute unsigned long height;
     attribute boolean indeterminate;
-    [EnabledAtRuntime=DataListElement] readonly attribute HTMLElement list;
-    [Reflect] attribute DOMString max;
-    [SetterRaisesException, CustomElementCallbacks=Enable] attribute long maxLength;
-    [Reflect] attribute DOMString min;
+    [RuntimeEnabled=DataListElement] readonly attribute HTMLElement list;
+    [Reflect, TreatNullAs=NullString] attribute DOMString max;
+    [SetterRaisesException, CustomElementCallbacks] attribute long maxLength;
+    [Reflect, TreatNullAs=NullString] attribute DOMString min;
     [Reflect] attribute boolean multiple;
-    [Reflect] attribute DOMString name;
-    [Reflect] attribute DOMString pattern;
-    [Reflect] attribute DOMString placeholder;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString pattern;
+    [Reflect, TreatNullAs=NullString] attribute DOMString placeholder;
     [Reflect] attribute boolean readOnly;
     [Reflect] attribute boolean required;
-    [SetterRaisesException, CustomElementCallbacks=Enable] attribute unsigned long size; // Changed string -> long -> unsigned long
-    [Reflect, URL] attribute DOMString src;
-    [Reflect] attribute DOMString step;
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString type; // readonly dropped as part of DOM level 2
-    [TreatNullAs=NullString, CustomElementCallbacks=Enable] attribute DOMString defaultValue;
+    [SetterRaisesException, CustomElementCallbacks] attribute unsigned long size; // Changed string -> long -> unsigned long
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString src;
+    [Reflect, TreatNullAs=NullString] attribute DOMString step;
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString type; // readonly dropped as part of DOM level 2
+    [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString defaultValue;
     // See the discussion in https://bugs.webkit.org/show_bug.cgi?id=100085
-    [TreatNullAs=NullString, SetterRaisesException, CustomElementCallbacks=Enable] attribute DOMString value;
-    [SetterRaisesException, CustomElementCallbacks=Enable] attribute Date valueAsDate;
-    [SetterRaisesException, CustomElementCallbacks=Enable] attribute double valueAsNumber;
-    [EnabledAtRuntime=InputModeAttribute, Reflect] attribute DOMString inputMode;
+    [TreatNullAs=NullString, SetterRaisesException, CustomElementCallbacks] attribute DOMString value;
+    [SetterRaisesException, CustomElementCallbacks] attribute Date valueAsDate;
+    [SetterRaisesException, CustomElementCallbacks] attribute double valueAsNumber;
+    [RuntimeEnabled=InputModeAttribute, Reflect, TreatNullAs=NullString] attribute DOMString inputMode;
 
-    [RaisesException, CustomElementCallbacks=Enable] void stepUp(optional long n);
-    [RaisesException, CustomElementCallbacks=Enable] void stepDown(optional long n);
+    [RaisesException, CustomElementCallbacks] void stepUp(optional long n);
+    [RaisesException, CustomElementCallbacks] void stepDown(optional long n);
 
-    [CustomElementCallbacks=Enable] attribute unsigned long width;
+    [CustomElementCallbacks] attribute unsigned long width;
     readonly attribute boolean willValidate;
     readonly attribute ValidityState validity;
     readonly attribute DOMString validationMessage;
@@ -90,12 +90,12 @@
                            optional DOMString direction);
 
     // Non-standard attributes
-    [Reflect] attribute DOMString align;
-    [Reflect, EnabledAtRuntime=DirectoryUpload] attribute boolean webkitdirectory;
-    [Reflect] attribute DOMString useMap;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
+    [Reflect, RuntimeEnabled=DirectoryUpload] attribute boolean webkitdirectory;
+    [Reflect, TreatNullAs=NullString] attribute DOMString useMap;
     [Reflect] attribute boolean incremental;
-    [Conditional=INPUT_SPEECH, Reflect, EnabledAtRuntime=SpeechInput] attribute boolean webkitSpeech;
-    [Conditional=INPUT_SPEECH, Reflect, EnabledAtRuntime=SpeechInput] attribute boolean webkitGrammar;
+    [Conditional=INPUT_SPEECH, Reflect, RuntimeEnabled=SpeechInput] attribute boolean webkitSpeech;
+    [Conditional=INPUT_SPEECH, Reflect, RuntimeEnabled=SpeechInput] attribute boolean webkitGrammar;
     [Conditional=INPUT_SPEECH, NotEnumerable] attribute EventHandler onwebkitspeechchange;
 
     // See http://www.w3.org/TR/html-media-capture/
diff --git a/Source/core/html/HTMLKeygenElement.cpp b/Source/core/html/HTMLKeygenElement.cpp
index 61a304b..318a904 100644
--- a/Source/core/html/HTMLKeygenElement.cpp
+++ b/Source/core/html/HTMLKeygenElement.cpp
@@ -30,10 +30,10 @@
 #include "core/dom/Document.h"
 #include "core/dom/Text.h"
 #include "core/dom/shadow/ShadowRoot.h"
-#include "core/html/FormDataList.h"
 #include "core/html/HTMLOptionElement.h"
 #include "core/html/HTMLSelectElement.h"
-#include "core/platform/SSLKeyGenerator.h"
+#include "core/platform/network/FormDataList.h"
+#include "platform/SSLKeyGenerator.h"
 #include "wtf/StdLibExtras.h"
 
 using namespace WebCore;
@@ -55,7 +55,7 @@
     DEFINE_STATIC_LOCAL(AtomicString, keygenSelectPseudoId, ("-webkit-keygen-select", AtomicString::ConstructFromLiteral));
 
     Vector<String> keys;
-    getSupportedKeySizes(keys);
+    getSupportedKeySizes(locale(), keys);
 
     // Create a select element with one option element for each key size.
     RefPtr<HTMLSelectElement> select = HTMLSelectElement::create(document());
@@ -97,7 +97,7 @@
     return keygen;
 }
 
-void HTMLKeygenElement::reset()
+void HTMLKeygenElement::resetImpl()
 {
     shadowSelect()->reset();
 }
diff --git a/Source/core/html/HTMLKeygenElement.h b/Source/core/html/HTMLKeygenElement.h
index 69965f6..7637f28 100644
--- a/Source/core/html/HTMLKeygenElement.h
+++ b/Source/core/html/HTMLKeygenElement.h
@@ -55,7 +55,7 @@
     virtual bool isEnumeratable() const OVERRIDE { return true; }
     virtual bool supportLabels() const OVERRIDE { return true; }
 
-    virtual void reset() OVERRIDE;
+    virtual void resetImpl() OVERRIDE;
     virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE { return false; }
 
     virtual void didAddUserAgentShadowRoot(ShadowRoot*) OVERRIDE;
diff --git a/Source/core/html/HTMLKeygenElement.idl b/Source/core/html/HTMLKeygenElement.idl
index c8361d8..b4d67df 100644
--- a/Source/core/html/HTMLKeygenElement.idl
+++ b/Source/core/html/HTMLKeygenElement.idl
@@ -30,11 +30,11 @@
 
 interface HTMLKeygenElement : HTMLElement {
     [Reflect] attribute boolean autofocus;
-    [Reflect] attribute DOMString challenge;
+    [Reflect, TreatNullAs=NullString] attribute DOMString challenge;
     [Reflect] attribute boolean disabled;
     readonly attribute HTMLFormElement form;
-    [Reflect] attribute DOMString keytype;
-    [Reflect] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString keytype;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
 
     readonly attribute DOMString type;
 
diff --git a/Source/core/html/HTMLLIElement.cpp b/Source/core/html/HTMLLIElement.cpp
index fac3830..b6da138 100644
--- a/Source/core/html/HTMLLIElement.cpp
+++ b/Source/core/html/HTMLLIElement.cpp
@@ -86,8 +86,6 @@
 
 void HTMLLIElement::attach(const AttachContext& context)
 {
-    ASSERT(!attached());
-
     HTMLElement::attach(context);
 
     if (renderer() && renderer()->isListItem()) {
diff --git a/Source/core/html/HTMLLIElement.idl b/Source/core/html/HTMLLIElement.idl
index f79f1cb..9d03749 100644
--- a/Source/core/html/HTMLLIElement.idl
+++ b/Source/core/html/HTMLLIElement.idl
@@ -18,7 +18,7 @@
  */
 
 interface HTMLLIElement : HTMLElement {
-    [Reflect] attribute DOMString type;
+    [Reflect, TreatNullAs=NullString] attribute DOMString type;
     [Reflect] attribute long value;
 };
 
diff --git a/Source/core/html/HTMLLabelElement.cpp b/Source/core/html/HTMLLabelElement.cpp
index ad59246..da95f54 100644
--- a/Source/core/html/HTMLLabelElement.cpp
+++ b/Source/core/html/HTMLLabelElement.cpp
@@ -28,7 +28,7 @@
 #include "HTMLNames.h"
 #include "core/dom/ElementTraversal.h"
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/FormAssociatedElement.h"
 
 namespace WebCore {
@@ -121,7 +121,7 @@
 {
     static bool processingClick = false;
 
-    if (evt->type() == eventNames().clickEvent && !processingClick) {
+    if (evt->type() == EventTypeNames::click && !processingClick) {
         RefPtr<HTMLElement> element = control();
 
         // If we can't find a control or if the control received the click
diff --git a/Source/core/html/HTMLLabelElement.idl b/Source/core/html/HTMLLabelElement.idl
index fa37360..d249897 100644
--- a/Source/core/html/HTMLLabelElement.idl
+++ b/Source/core/html/HTMLLabelElement.idl
@@ -20,7 +20,7 @@
 
 interface HTMLLabelElement : HTMLElement {
     readonly attribute HTMLFormElement form;
-    [Reflect=for] attribute DOMString htmlFor;
+    [Reflect=for, TreatNullAs=NullString] attribute DOMString htmlFor;
     readonly attribute HTMLElement control;
 };
 
diff --git a/Source/core/html/HTMLLegendElement.idl b/Source/core/html/HTMLLegendElement.idl
index e8e8871..0e89ec0 100644
--- a/Source/core/html/HTMLLegendElement.idl
+++ b/Source/core/html/HTMLLegendElement.idl
@@ -20,6 +20,6 @@
 
 interface HTMLLegendElement : HTMLElement {
     readonly attribute HTMLFormElement form;
-    [Reflect] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
 };
 
diff --git a/Source/core/html/HTMLLinkElement.cpp b/Source/core/html/HTMLLinkElement.cpp
index 36c67f7..218194c 100644
--- a/Source/core/html/HTMLLinkElement.cpp
+++ b/Source/core/html/HTMLLinkElement.cpp
@@ -43,9 +43,9 @@
 #include "core/html/LinkImport.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "wtf/StdLibExtras.h"
 
 namespace WebCore {
@@ -54,7 +54,7 @@
 
 static LinkEventSender& linkLoadEventSender()
 {
-    DEFINE_STATIC_LOCAL(LinkEventSender, sharedLoadEventSender, (eventNames().loadEvent));
+    DEFINE_STATIC_LOCAL(LinkEventSender, sharedLoadEventSender, (EventTypeNames::load));
     return sharedLoadEventSender;
 }
 
@@ -105,7 +105,7 @@
         if (LinkStyle* link = linkStyle())
             link->setDisabledState(!value.isNull());
     } else if (name == onbeforeloadAttr)
-        setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::beforeload, createAttributeEventListener(this, name, value));
     else {
         if (name == titleAttr) {
             if (LinkStyle* link = linkStyle())
@@ -119,13 +119,13 @@
 bool HTMLLinkElement::shouldLoadLink()
 {
     bool continueLoad = true;
-    RefPtr<Document> originalDocument = &document();
+    RefPtr<Document> originalDocument(document());
     int recursionRank = ++m_beforeLoadRecurseCount;
     if (!dispatchBeforeLoadEvent(getNonEmptyURLAttribute(hrefAttr)))
         continueLoad = false;
 
     // A beforeload handler might have removed us from the document or changed the document.
-    if (continueLoad && (!inDocument() || &document() != originalDocument))
+    if (continueLoad && (!inDocument() || document() != originalDocument))
         continueLoad = false;
 
     // If the beforeload handler recurses into the link element by mutating it, we should only
@@ -223,7 +223,7 @@
     if (m_link)
         m_link->ownerRemoved();
 
-    if (document().renderer())
+    if (document().isActive())
         document().removedStyleSheet(removedSheet.get());
 }
 
@@ -240,32 +240,32 @@
 
 void HTMLLinkElement::linkLoaded()
 {
-    dispatchEvent(Event::create(eventNames().loadEvent));
+    dispatchEvent(Event::create(EventTypeNames::load));
 }
 
 void HTMLLinkElement::linkLoadingErrored()
 {
-    dispatchEvent(Event::create(eventNames().errorEvent));
+    dispatchEvent(Event::create(EventTypeNames::error));
 }
 
 void HTMLLinkElement::didStartLinkPrerender()
 {
-    dispatchEvent(Event::create(eventNames().webkitprerenderstartEvent));
+    dispatchEvent(Event::create(EventTypeNames::webkitprerenderstart));
 }
 
 void HTMLLinkElement::didStopLinkPrerender()
 {
-    dispatchEvent(Event::create(eventNames().webkitprerenderstopEvent));
+    dispatchEvent(Event::create(EventTypeNames::webkitprerenderstop));
 }
 
 void HTMLLinkElement::didSendLoadForLinkPrerender()
 {
-    dispatchEvent(Event::create(eventNames().webkitprerenderloadEvent));
+    dispatchEvent(Event::create(EventTypeNames::webkitprerenderload));
 }
 
 void HTMLLinkElement::didSendDOMContentLoadedForLinkPrerender()
 {
-    dispatchEvent(Event::create(eventNames().webkitprerenderdomcontentloadedEvent));
+    dispatchEvent(Event::create(EventTypeNames::webkitprerenderdomcontentloaded));
 }
 
 bool HTMLLinkElement::sheetLoaded()
diff --git a/Source/core/html/HTMLLinkElement.idl b/Source/core/html/HTMLLinkElement.idl
index 25e900a..fe4700a 100644
--- a/Source/core/html/HTMLLinkElement.idl
+++ b/Source/core/html/HTMLLinkElement.idl
@@ -21,19 +21,19 @@
 
 interface HTMLLinkElement : HTMLElement {
     [Reflect] attribute boolean disabled;
-    [Reflect] attribute DOMString charset;
-    [Reflect, URL] attribute DOMString href;
-    [Reflect] attribute DOMString hreflang;
-    [Reflect] attribute DOMString media;
-    [Reflect] attribute DOMString rel;
-    [Reflect] attribute DOMString rev;
+    [Reflect, TreatNullAs=NullString] attribute DOMString charset;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString href;
+    [Reflect, TreatNullAs=NullString] attribute DOMString hreflang;
+    [Reflect, TreatNullAs=NullString] attribute DOMString media;
+    [Reflect, TreatNullAs=NullString] attribute DOMString rel;
+    [Reflect, TreatNullAs=NullString] attribute DOMString rev;
     [CustomSetter] attribute DOMSettableTokenList sizes;
-    [Reflect] attribute DOMString target;
-    [Reflect] attribute DOMString type;
+    [Reflect, TreatNullAs=NullString] attribute DOMString target;
+    [Reflect, TreatNullAs=NullString] attribute DOMString type;
 
     // DOM Level 2 Style
     readonly attribute StyleSheet sheet;
 
-    [EnabledAtRuntime=HTMLImports] readonly attribute Document import;
+    [RuntimeEnabled=HTMLImports] readonly attribute Document import;
 };
 
diff --git a/Source/core/html/HTMLMapElement.idl b/Source/core/html/HTMLMapElement.idl
index 01dcae0..2eb6f29 100644
--- a/Source/core/html/HTMLMapElement.idl
+++ b/Source/core/html/HTMLMapElement.idl
@@ -20,6 +20,6 @@
 
 interface HTMLMapElement : HTMLElement {
     readonly attribute HTMLCollection areas;
-    [Reflect] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
 };
 
diff --git a/Source/core/html/HTMLMarqueeElement.cpp b/Source/core/html/HTMLMarqueeElement.cpp
index 946593b..2f5078e 100644
--- a/Source/core/html/HTMLMarqueeElement.cpp
+++ b/Source/core/html/HTMLMarqueeElement.cpp
@@ -166,12 +166,7 @@
         setIntegralAttribute(loopAttr, loop);
 }
 
-bool HTMLMarqueeElement::canSuspend() const
-{
-    return true;
-}
-
-void HTMLMarqueeElement::suspend(ReasonForSuspension)
+void HTMLMarqueeElement::suspend()
 {
     if (RenderMarquee* marqueeRenderer = renderMarquee())
         marqueeRenderer->suspend();
diff --git a/Source/core/html/HTMLMarqueeElement.h b/Source/core/html/HTMLMarqueeElement.h
index 9169908..c743d7d 100644
--- a/Source/core/html/HTMLMarqueeElement.h
+++ b/Source/core/html/HTMLMarqueeElement.h
@@ -58,8 +58,7 @@
     virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
 
     // ActiveDOMObject
-    virtual bool canSuspend() const;
-    virtual void suspend(ReasonForSuspension);
+    virtual void suspend();
     virtual void resume();
 
     virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE FINAL;
diff --git a/Source/core/html/HTMLMarqueeElement.idl b/Source/core/html/HTMLMarqueeElement.idl
index b5bda0c..827da3e 100644
--- a/Source/core/html/HTMLMarqueeElement.idl
+++ b/Source/core/html/HTMLMarqueeElement.idl
@@ -21,17 +21,17 @@
     void start();
     void stop();
 
-    [Reflect] attribute DOMString behavior;
-    [Reflect] attribute DOMString bgColor;
-    [Reflect] attribute DOMString direction;
-    [Reflect] attribute DOMString height;
+    [Reflect, TreatNullAs=NullString] attribute DOMString behavior;
+    [Reflect, TreatNullAs=NullString] attribute DOMString bgColor;
+    [Reflect, TreatNullAs=NullString] attribute DOMString direction;
+    [Reflect, TreatNullAs=NullString] attribute DOMString height;
     [Reflect] attribute unsigned long hspace;
     [SetterRaisesException] attribute long loop;
     [SetterRaisesException] attribute long scrollAmount;
     [SetterRaisesException] attribute long scrollDelay;
     [Reflect] attribute boolean trueSpeed;
     [Reflect] attribute unsigned long vspace;
-    [Reflect] attribute DOMString width;
+    [Reflect, TreatNullAs=NullString] attribute DOMString width;
 
     // FIXME: Implement the following event handler attributes
     // https://bugs.webkit.org/show_bug.cgi?id=49788
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 1b1cee7..2194252 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "core/html/HTMLMediaElement.h"
 
+#include <limits>
 #include "HTMLNames.h"
 #include "RuntimeEnabledFeatures.h"
 #include "bindings/v8/ExceptionState.h"
@@ -35,11 +36,11 @@
 #include "core/css/MediaList.h"
 #include "core/css/MediaQueryEvaluator.h"
 #include "core/dom/Attribute.h"
-#include "core/events/Event.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/FullscreenElementStack.h"
 #include "core/dom/shadow/ShadowRoot.h"
+#include "core/events/Event.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLMediaSource.h"
 #include "core/html/HTMLSourceElement.h"
 #include "core/html/HTMLTrackElement.h"
@@ -54,22 +55,23 @@
 #include "core/html/track/TextTrackCueList.h"
 #include "core/html/track/TextTrackList.h"
 #include "core/loader/FrameLoader.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/Frame.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/ContentType.h"
-#include "core/platform/Language.h"
-#include "core/platform/Logging.h"
 #include "core/platform/MIMETypeFromURL.h"
 #include "core/platform/MIMETypeRegistry.h"
-#include "core/platform/NotImplemented.h"
 #include "core/platform/graphics/InbandTextTrackPrivate.h"
 #include "core/platform/graphics/MediaPlayer.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderVideo.h"
 #include "core/rendering/RenderView.h"
 #include "modules/mediastream/MediaStreamRegistry.h"
+#include "platform/ContentType.h"
+#include "platform/Language.h"
+#include "platform/Logging.h"
+#include "platform/NotImplemented.h"
+#include "platform/UserGestureIndicator.h"
 #include "public/platform/Platform.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/CurrentTime.h"
@@ -77,10 +79,9 @@
 #include "wtf/NonCopyingSort.h"
 #include "wtf/Uint8Array.h"
 #include "wtf/text/CString.h"
-#include <limits>
 
 #if ENABLE(WEB_AUDIO)
-#include "core/platform/audio/AudioSourceProvider.h"
+#include "platform/audio/AudioSourceProvider.h"
 #include "modules/webaudio/MediaElementAudioSourceNode.h"
 #endif
 
@@ -249,7 +250,6 @@
     , m_asyncEventQueue(GenericEventQueue::create(this))
     , m_playbackRate(1.0f)
     , m_defaultPlaybackRate(1.0f)
-    , m_webkitPreservesPitch(true)
     , m_networkState(NETWORK_EMPTY)
     , m_readyState(HAVE_NOTHING)
     , m_readyStateMaximum(HAVE_NOTHING)
@@ -282,7 +282,6 @@
     , m_pausedInternal(false)
     , m_sendProgressEvents(true)
     , m_closedCaptionsVisible(false)
-    , m_dispatchingCanPlayEvent(false)
     , m_loadInitiatedByUserGesture(false)
     , m_completelyLoaded(false)
     , m_havePreparedToPlay(false)
@@ -331,8 +330,10 @@
             m_textTracks->item(i)->clearClient();
     }
 
-    if (m_mediaController)
+    if (m_mediaController) {
         m_mediaController->removeMediaElement(this);
+        m_mediaController = 0;
+    }
 
     closeMediaSource();
 
@@ -364,19 +365,22 @@
     document().decrementLoadEventDelayCount();
 }
 
-void HTMLMediaElement::didMoveToNewDocument(Document* oldDocument)
+void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument)
 {
     LOG(Media, "HTMLMediaElement::didMoveToNewDocument");
 
     if (m_shouldDelayLoadEvent) {
-        if (oldDocument)
-            oldDocument->decrementLoadEventDelayCount();
         document().incrementLoadEventDelayCount();
+        // Note: Keeping the load event delay count increment on oldDocument that was added
+        // when m_shouldDelayLoadEvent was set so that destruction of m_player can not
+        // cause load event dispatching in oldDocument.
+    } else {
+        // Incrementing the load event delay count so that destruction of m_player can not
+        // cause load event dispatching in oldDocument.
+        oldDocument.incrementLoadEventDelayCount();
     }
 
-    if (oldDocument)
-        removeElementFromDocumentMap(this, oldDocument);
-
+    removeElementFromDocumentMap(this, &oldDocument);
     addElementToDocumentMap(this, &document());
 
     // FIXME: This is a temporary fix to prevent this object from causing the
@@ -386,6 +390,10 @@
     // document changes so that playback can be resumed properly.
     userCancelledLoad();
 
+    // Decrement the load event delay count on oldDocument now that m_player has been destroyed
+    // and there is no risk of dispatching a load event from within the destructor.
+    oldDocument.decrementLoadEventDelayCount();
+
     HTMLElement::didMoveToNewDocument(oldDocument);
 }
 
@@ -436,51 +444,51 @@
     } else if (name == mediagroupAttr)
         setMediaGroup(value);
     else if (name == onabortAttr)
-        setAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::abort, createAttributeEventListener(this, name, value));
     else if (name == onbeforeloadAttr)
-        setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::beforeload, createAttributeEventListener(this, name, value));
     else if (name == oncanplayAttr)
-        setAttributeEventListener(eventNames().canplayEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::canplay, createAttributeEventListener(this, name, value));
     else if (name == oncanplaythroughAttr)
-        setAttributeEventListener(eventNames().canplaythroughEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::canplaythrough, createAttributeEventListener(this, name, value));
     else if (name == ondurationchangeAttr)
-        setAttributeEventListener(eventNames().durationchangeEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::durationchange, createAttributeEventListener(this, name, value));
     else if (name == onemptiedAttr)
-        setAttributeEventListener(eventNames().emptiedEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::emptied, createAttributeEventListener(this, name, value));
     else if (name == onendedAttr)
-        setAttributeEventListener(eventNames().endedEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::ended, createAttributeEventListener(this, name, value));
     else if (name == onerrorAttr)
-        setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::error, createAttributeEventListener(this, name, value));
     else if (name == onloadeddataAttr)
-        setAttributeEventListener(eventNames().loadeddataEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::loadeddata, createAttributeEventListener(this, name, value));
     else if (name == onloadedmetadataAttr)
-        setAttributeEventListener(eventNames().loadedmetadataEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::loadedmetadata, createAttributeEventListener(this, name, value));
     else if (name == onloadstartAttr)
-        setAttributeEventListener(eventNames().loadstartEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::loadstart, createAttributeEventListener(this, name, value));
     else if (name == onpauseAttr)
-        setAttributeEventListener(eventNames().pauseEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::pause, createAttributeEventListener(this, name, value));
     else if (name == onplayAttr)
-        setAttributeEventListener(eventNames().playEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::play, createAttributeEventListener(this, name, value));
     else if (name == onplayingAttr)
-        setAttributeEventListener(eventNames().playingEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::playing, createAttributeEventListener(this, name, value));
     else if (name == onprogressAttr)
-        setAttributeEventListener(eventNames().progressEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::progress, createAttributeEventListener(this, name, value));
     else if (name == onratechangeAttr)
-        setAttributeEventListener(eventNames().ratechangeEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::ratechange, createAttributeEventListener(this, name, value));
     else if (name == onseekedAttr)
-        setAttributeEventListener(eventNames().seekedEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::seeked, createAttributeEventListener(this, name, value));
     else if (name == onseekingAttr)
-        setAttributeEventListener(eventNames().seekingEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::seeking, createAttributeEventListener(this, name, value));
     else if (name == onstalledAttr)
-        setAttributeEventListener(eventNames().stalledEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::stalled, createAttributeEventListener(this, name, value));
     else if (name == onsuspendAttr)
-        setAttributeEventListener(eventNames().suspendEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::suspend, createAttributeEventListener(this, name, value));
     else if (name == ontimeupdateAttr)
-        setAttributeEventListener(eventNames().timeupdateEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::timeupdate, createAttributeEventListener(this, name, value));
     else if (name == onvolumechangeAttr)
-        setAttributeEventListener(eventNames().volumechangeEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::volumechange, createAttributeEventListener(this, name, value));
     else if (name == onwaitingAttr)
-        setAttributeEventListener(eventNames().waitingEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::waiting, createAttributeEventListener(this, name, value));
     else
         HTMLElement::parseAttribute(name, value);
 }
@@ -548,8 +556,6 @@
 
 void HTMLMediaElement::attach(const AttachContext& context)
 {
-    ASSERT(!attached());
-
     HTMLElement::attach(context);
 
     if (renderer())
@@ -655,10 +661,10 @@
 
     LOG(Media, "HTMLMediaElement::load()");
 
-    if (userGestureRequiredForLoad() && !ScriptController::processingUserGesture())
+    if (userGestureRequiredForLoad() && !UserGestureIndicator::processingUserGesture())
         return;
 
-    m_loadInitiatedByUserGesture = ScriptController::processingUserGesture();
+    m_loadInitiatedByUserGesture = UserGestureIndicator::processingUserGesture();
     if (m_loadInitiatedByUserGesture)
         removeBehaviorsRestrictionsAfterFirstUserGesture();
     prepareForLoad();
@@ -691,7 +697,7 @@
     // 3 - If the media element's networkState is set to NETWORK_LOADING or NETWORK_IDLE, queue
     // a task to fire a simple event named abort at the media element.
     if (m_networkState == NETWORK_LOADING || m_networkState == NETWORK_IDLE)
-        scheduleEvent(eventNames().abortEvent);
+        scheduleEvent(EventTypeNames::abort);
 
     closeMediaSource();
 
@@ -706,7 +712,7 @@
         m_paused = true;
         m_seeking = false;
         invalidateCachedTime();
-        scheduleEvent(eventNames().emptiedEvent);
+        scheduleEvent(EventTypeNames::emptied);
         updateMediaController();
         if (RuntimeEnabledFeatures::videoTrackEnabled())
             updateActiveTextTrackCues(0);
@@ -810,7 +816,7 @@
     m_networkState = NETWORK_LOADING;
 
     // 5 - Queue a task to fire a simple event named loadstart at the media element.
-    scheduleEvent(eventNames().loadstartEvent);
+    scheduleEvent(EventTypeNames::loadstart);
 
     // 6 - If mode is attribute, then run these substeps
     if (mode == attribute) {
@@ -1042,16 +1048,8 @@
             activeSetChanged = true;
     }
 
-    if (!activeSetChanged) {
-        // Even though the active set has not changed, it is possible that the
-        // the mode of a track has changed from 'hidden' to 'showing' and the
-        // cues have not yet been rendered.
-        // Note: don't call updateTextTrackDisplay() unless we have controls because it will
-        // create them.
-        if (hasMediaControls())
-            updateTextTrackDisplay();
+    if (!activeSetChanged)
         return;
-    }
 
     // 7 - If the time was reached through the usual monotonic increase of the
     // current playback position during normal playback, and there are cues in
@@ -1132,18 +1130,18 @@
         // correctly identifies the type of the event, if the startTime is
         // less than the endTime in the cue.
         if (eventTasks[i].second->startTime() >= eventTasks[i].second->endTime()) {
-            event = Event::create(eventNames().enterEvent);
+            event = Event::create(EventTypeNames::enter);
             event->setTarget(eventTasks[i].second);
             m_asyncEventQueue->enqueueEvent(event.release());
 
-            event = Event::create(eventNames().exitEvent);
+            event = Event::create(EventTypeNames::exit);
             event->setTarget(eventTasks[i].second);
             m_asyncEventQueue->enqueueEvent(event.release());
         } else {
             if (eventTasks[i].first == eventTasks[i].second->startTime())
-                event = Event::create(eventNames().enterEvent);
+                event = Event::create(EventTypeNames::enter);
             else
-                event = Event::create(eventNames().exitEvent);
+                event = Event::create(EventTypeNames::exit);
 
             event->setTarget(eventTasks[i].second);
             m_asyncEventQueue->enqueueEvent(event.release());
@@ -1157,7 +1155,7 @@
     // 15 - For each text track in affected tracks, in the list order, queue a
     // task to fire a simple event named cuechange at the TextTrack object, and, ...
     for (size_t i = 0; i < affectedTracks.size(); ++i) {
-        RefPtr<Event> event = Event::create(eventNames().cuechangeEvent);
+        RefPtr<Event> event = Event::create(EventTypeNames::cuechange);
         event->setTarget(affectedTracks[i]);
 
         m_asyncEventQueue->enqueueEvent(event.release());
@@ -1165,7 +1163,7 @@
         // ... if the text track has a corresponding track element, to then fire a
         // simple event named cuechange at the track element as well.
         if (affectedTracks[i]->trackType() == TextTrack::TrackElement) {
-            RefPtr<Event> event = Event::create(eventNames().cuechangeEvent);
+            RefPtr<Event> event = Event::create(EventTypeNames::cuechange);
             HTMLTrackElement* trackElement = static_cast<LoadableTextTrack*>(affectedTracks[i])->trackElement();
             ASSERT(trackElement);
             event->setTarget(trackElement);
@@ -1245,15 +1243,14 @@
 
                 // If this is the first added track, create the list of text tracks.
                 if (!m_textTracks)
-                  m_textTracks = TextTrackList::create(this, ActiveDOMObject::scriptExecutionContext());
+                    m_textTracks = TextTrackList::create(this, ActiveDOMObject::executionContext());
             }
             break;
         }
     } else if (track->trackType() == TextTrack::AddTrack && track->mode() != TextTrack::disabledKeyword())
         textTrackAddCues(track, track->cues());
 
-    configureTextTrackDisplay();
-    updateActiveTextTrackCues(currentTime());
+    configureTextTrackDisplay(AssumeVisibleChange);
 }
 
 void HTMLMediaElement::textTrackKindChanged(TextTrack* track)
@@ -1404,7 +1401,7 @@
     m_networkState = NETWORK_NO_SOURCE;
 
     // 7 - Queue a task to fire a simple event named error at the media element.
-    scheduleEvent(eventNames().errorEvent);
+    scheduleEvent(EventTypeNames::error);
 
     closeMediaSource();
 
@@ -1433,14 +1430,14 @@
     m_error = err;
 
     // 3 - Queue a task to fire a simple event named error at the media element.
-    scheduleEvent(eventNames().errorEvent);
+    scheduleEvent(EventTypeNames::error);
 
     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.
     m_networkState = NETWORK_EMPTY;
-    scheduleEvent(eventNames().emptiedEvent);
+    scheduleEvent(EventTypeNames::emptied);
 
     // 5 - Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
     setShouldDelayLoadEvent(false);
@@ -1551,8 +1548,8 @@
 
     // Schedule one last progress event so we guarantee that at least one is fired
     // for files that load very quickly.
-    scheduleEvent(eventNames().progressEvent);
-    scheduleEvent(eventNames().suspendEvent);
+    scheduleEvent(EventTypeNames::progress);
+    scheduleEvent(EventTypeNames::suspend);
     m_networkState = NETWORK_IDLE;
 }
 
@@ -1600,7 +1597,7 @@
         // it started seeking, but seeking caused its readyState attribute to change to a value
         // lower than HAVE_FUTURE_DATA, then a waiting will be fired at the element.
         if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA)
-            scheduleEvent(eventNames().waitingEvent);
+            scheduleEvent(EventTypeNames::waiting);
 
         // 4.8.10.9 steps 12-14
         if (m_readyState >= HAVE_CURRENT_DATA)
@@ -1609,14 +1606,14 @@
         if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) {
             // 4.8.10.8
             scheduleTimeupdateEvent(false);
-            scheduleEvent(eventNames().waitingEvent);
+            scheduleEvent(EventTypeNames::waiting);
         }
     }
 
     if (m_readyState >= HAVE_METADATA && oldState < HAVE_METADATA) {
         prepareMediaFragmentURI();
-        scheduleEvent(eventNames().durationchangeEvent);
-        scheduleEvent(eventNames().loadedmetadataEvent);
+        scheduleEvent(EventTypeNames::durationchange);
+        scheduleEvent(EventTypeNames::loadedmetadata);
         if (hasMediaControls())
             mediaControls()->loadedMetadata();
         if (renderer())
@@ -1628,33 +1625,33 @@
     if (m_readyState >= HAVE_CURRENT_DATA && oldState < HAVE_CURRENT_DATA && !m_haveFiredLoadedData) {
         m_haveFiredLoadedData = true;
         shouldUpdateDisplayState = true;
-        scheduleEvent(eventNames().loadeddataEvent);
+        scheduleEvent(EventTypeNames::loadeddata);
         setShouldDelayLoadEvent(false);
         applyMediaFragmentURI();
     }
 
     bool isPotentiallyPlaying = potentiallyPlaying();
     if (m_readyState == HAVE_FUTURE_DATA && oldState <= HAVE_CURRENT_DATA && tracksAreReady) {
-        scheduleEvent(eventNames().canplayEvent);
+        scheduleEvent(EventTypeNames::canplay);
         if (isPotentiallyPlaying)
-            scheduleEvent(eventNames().playingEvent);
+            scheduleEvent(EventTypeNames::playing);
         shouldUpdateDisplayState = true;
     }
 
     if (m_readyState == HAVE_ENOUGH_DATA && oldState < HAVE_ENOUGH_DATA && tracksAreReady) {
         if (oldState <= HAVE_CURRENT_DATA)
-            scheduleEvent(eventNames().canplayEvent);
+            scheduleEvent(EventTypeNames::canplay);
 
-        scheduleEvent(eventNames().canplaythroughEvent);
+        scheduleEvent(EventTypeNames::canplaythrough);
 
         if (isPotentiallyPlaying && oldState <= HAVE_CURRENT_DATA)
-            scheduleEvent(eventNames().playingEvent);
+            scheduleEvent(EventTypeNames::playing);
 
         if (m_autoplaying && m_paused && autoplay() && !document().isSandboxed(SandboxAutomaticFeatures) && !userGestureRequiredForRateChange()) {
             m_paused = false;
             invalidateCachedTime();
-            scheduleEvent(eventNames().playEvent);
-            scheduleEvent(eventNames().playingEvent);
+            scheduleEvent(EventTypeNames::play);
+            scheduleEvent(EventTypeNames::playing);
         }
 
         shouldUpdateDisplayState = true;
@@ -1682,7 +1679,7 @@
     initializer.bubbles = false;
     initializer.cancelable = false;
 
-    RefPtr<Event> event = MediaKeyEvent::create(eventNames().webkitkeyaddedEvent, initializer);
+    RefPtr<Event> event = MediaKeyEvent::create(EventTypeNames::webkitkeyadded, initializer);
     event->setTarget(this);
     m_asyncEventQueue->enqueueEvent(event.release());
 }
@@ -1719,7 +1716,7 @@
     initializer.bubbles = false;
     initializer.cancelable = false;
 
-    RefPtr<Event> event = MediaKeyEvent::create(eventNames().webkitkeyerrorEvent, initializer);
+    RefPtr<Event> event = MediaKeyEvent::create(EventTypeNames::webkitkeyerror, initializer);
     event->setTarget(this);
     m_asyncEventQueue->enqueueEvent(event.release());
 }
@@ -1734,16 +1731,16 @@
     initializer.bubbles = false;
     initializer.cancelable = false;
 
-    RefPtr<Event> event = MediaKeyEvent::create(eventNames().webkitkeymessageEvent, initializer);
+    RefPtr<Event> event = MediaKeyEvent::create(EventTypeNames::webkitkeymessage, initializer);
     event->setTarget(this);
     m_asyncEventQueue->enqueueEvent(event.release());
 }
 
 bool HTMLMediaElement::mediaPlayerKeyNeeded(const String& keySystem, const String& sessionId, const unsigned char* initData, unsigned initDataLength)
 {
-    if (!hasEventListeners(eventNames().webkitneedkeyEvent)) {
+    if (!hasEventListeners(EventTypeNames::webkitneedkey)) {
         m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED);
-        scheduleEvent(eventNames().errorEvent);
+        scheduleEvent(EventTypeNames::error);
         return false;
     }
 
@@ -1754,7 +1751,7 @@
     initializer.bubbles = false;
     initializer.cancelable = false;
 
-    RefPtr<Event> event = MediaKeyEvent::create(eventNames().webkitneedkeyEvent, initializer);
+    RefPtr<Event> event = MediaKeyEvent::create(EventTypeNames::webkitneedkey, initializer);
     event->setTarget(this);
     m_asyncEventQueue->enqueueEvent(event.release());
     return true;
@@ -1765,7 +1762,7 @@
 {
     if (!hasEventListeners("webkitneedkey")) {
         m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED);
-        scheduleEvent(eventNames().errorEvent);
+        scheduleEvent(EventTypeNames::error);
         return false;
     }
 
@@ -1774,7 +1771,7 @@
     initializer.bubbles = false;
     initializer.cancelable = false;
 
-    RefPtr<Event> event = MediaKeyNeededEvent::create(eventNames().webkitneedkeyEvent, initializer);
+    RefPtr<Event> event = MediaKeyNeededEvent::create(EventTypeNames::webkitneedkey, initializer);
     event->setTarget(this);
     m_asyncEventQueue->enqueueEvent(event.release());
 
@@ -1804,7 +1801,7 @@
     double timedelta = time - m_previousProgressTime;
 
     if (m_player->didLoadingProgress()) {
-        scheduleEvent(eventNames().progressEvent);
+        scheduleEvent(EventTypeNames::progress);
         m_previousProgressTime = time;
         m_sentStalledEvent = false;
         if (renderer())
@@ -1812,7 +1809,7 @@
         if (hasMediaControls())
             mediaControls()->bufferingProgressed();
     } else if (timedelta > 3.0 && !m_sentStalledEvent) {
-        scheduleEvent(eventNames().stalledEvent);
+        scheduleEvent(EventTypeNames::stalled);
         m_sentStalledEvent = true;
         setShouldDelayLoadEvent(false);
     }
@@ -1906,11 +1903,11 @@
 
     if (noSeekRequired) {
         if (time == now) {
-            scheduleEvent(eventNames().seekingEvent);
+            scheduleEvent(EventTypeNames::seeking);
             // FIXME: There must be a stable state before timeupdate+seeked are dispatched and seeking
             // is reset to false. See http://crbug.com/266631
             scheduleTimeupdateEvent(false);
-            scheduleEvent(eventNames().seekedEvent);
+            scheduleEvent(EventTypeNames::seeked);
         }
         m_seeking = false;
         return;
@@ -1925,7 +1922,7 @@
     m_sentEndEvent = false;
 
     // 8 - Queue a task to fire a simple event named seeking at the element.
-    scheduleEvent(eventNames().seekingEvent);
+    scheduleEvent(EventTypeNames::seeking);
 
     // 9 - Set the current playback position to the given new playback position
     m_player->seek(time);
@@ -1946,7 +1943,7 @@
     scheduleTimeupdateEvent(false);
 
     // 14 - Queue a task to fire a simple event named seeked at the element.
-    scheduleEvent(eventNames().seekedEvent);
+    scheduleEvent(EventTypeNames::seeked);
 
     setDisplayMode(Video);
 }
@@ -2071,7 +2068,7 @@
 {
     if (m_defaultPlaybackRate != rate) {
         m_defaultPlaybackRate = rate;
-        scheduleEvent(eventNames().ratechangeEvent);
+        scheduleEvent(EventTypeNames::ratechange);
     }
 }
 
@@ -2087,7 +2084,7 @@
     if (m_playbackRate != rate) {
         m_playbackRate = rate;
         invalidateCachedTime();
-        scheduleEvent(eventNames().ratechangeEvent);
+        scheduleEvent(EventTypeNames::ratechange);
     }
 
     if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_mediaController)
@@ -2101,19 +2098,6 @@
         m_player->setRate(effectiveRate);
 }
 
-bool HTMLMediaElement::webkitPreservesPitch() const
-{
-    return m_webkitPreservesPitch;
-}
-
-void HTMLMediaElement::setWebkitPreservesPitch(bool preservesPitch)
-{
-    LOG(Media, "HTMLMediaElement::setWebkitPreservesPitch(%s)", boolString(preservesPitch));
-
-    m_webkitPreservesPitch = preservesPitch;
-    notImplemented();
-}
-
 bool HTMLMediaElement::ended() const
 {
     // 4.8.10.8 Playing the media resource
@@ -2161,21 +2145,11 @@
 {
     LOG(Media, "HTMLMediaElement::play()");
 
-    if (userGestureRequiredForRateChange() && !ScriptController::processingUserGesture())
+    if (userGestureRequiredForRateChange() && !UserGestureIndicator::processingUserGesture())
         return;
-    if (ScriptController::processingUserGesture())
+    if (UserGestureIndicator::processingUserGesture())
         removeBehaviorsRestrictionsAfterFirstUserGesture();
 
-    Settings* settings = document().settings();
-    if (settings && settings->needsSiteSpecificQuirks() && m_dispatchingCanPlayEvent && !m_loadInitiatedByUserGesture) {
-        // It should be impossible to be processing the canplay event while handling a user gesture
-        // since it is dispatched asynchronously.
-        ASSERT(!ScriptController::processingUserGesture());
-        String host = document().baseURL().host();
-        if (host.endsWith(".npr.org", false) || equalIgnoringCase(host, "npr.org"))
-            return;
-    }
-
     playInternal();
 }
 
@@ -2196,12 +2170,12 @@
     if (m_paused) {
         m_paused = false;
         invalidateCachedTime();
-        scheduleEvent(eventNames().playEvent);
+        scheduleEvent(EventTypeNames::play);
 
         if (m_readyState <= HAVE_CURRENT_DATA)
-            scheduleEvent(eventNames().waitingEvent);
+            scheduleEvent(EventTypeNames::waiting);
         else if (m_readyState >= HAVE_FUTURE_DATA)
-            scheduleEvent(eventNames().playingEvent);
+            scheduleEvent(EventTypeNames::playing);
     }
     m_autoplaying = false;
 
@@ -2213,7 +2187,7 @@
 {
     LOG(Media, "HTMLMediaElement::pause()");
 
-    if (userGestureRequiredForRateChange() && !ScriptController::processingUserGesture())
+    if (userGestureRequiredForRateChange() && !UserGestureIndicator::processingUserGesture())
         return;
 
     pauseInternal();
@@ -2233,7 +2207,7 @@
     if (!m_paused) {
         m_paused = true;
         scheduleTimeupdateEvent(false);
-        scheduleEvent(eventNames().pauseEvent);
+        scheduleEvent(EventTypeNames::pause);
     }
 
     updatePlayState();
@@ -2379,7 +2353,7 @@
     if (m_volume != vol) {
         m_volume = vol;
         updateVolume();
-        scheduleEvent(eventNames().volumechangeEvent);
+        scheduleEvent(EventTypeNames::volumechange);
     }
 }
 
@@ -2399,7 +2373,7 @@
             if (hasMediaControls())
                 mediaControls()->changedMute();
         }
-        scheduleEvent(eventNames().volumechangeEvent);
+        scheduleEvent(EventTypeNames::volumechange);
     }
 }
 
@@ -2494,7 +2468,7 @@
     // event at a given time so filter here
     double movieTime = currentTime();
     if (movieTime != m_lastTimeUpdateEventMovieTime) {
-        scheduleEvent(eventNames().timeupdateEvent);
+        scheduleEvent(EventTypeNames::timeupdate);
         m_lastTimeUpdateEventWallTime = now;
         m_lastTimeUpdateEventMovieTime = movieTime;
     }
@@ -2531,7 +2505,7 @@
 
     // 4.8.10.12.2 Sourcing in-band text tracks
     // 1. Associate the relevant data with a new text track and its corresponding new TextTrack object.
-    RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(ActiveDOMObject::scriptExecutionContext(), this, prpTrack);
+    RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(ActiveDOMObject::executionContext(), this, prpTrack);
 
     // 2. Set the new text track's kind, label, and language based on the semantics of the relevant data,
     // as defined by the relevant specification. If there is no label in that data, then the label must
@@ -2634,7 +2608,7 @@
 
     // 5. Create a new text track corresponding to the new object, and set its text track kind to kind, its text
     // track label to label, its text track language to language...
-    RefPtr<TextTrack> textTrack = TextTrack::create(ActiveDOMObject::scriptExecutionContext(), this, kind, label, language);
+    RefPtr<TextTrack> textTrack = TextTrack::create(ActiveDOMObject::executionContext(), this, kind, label, language);
 
     // Note, due to side effects when changing track parameters, we have to
     // first append the track to the text track list.
@@ -2657,7 +2631,7 @@
         return 0;
 
     if (!m_textTracks)
-        m_textTracks = TextTrackList::create(this, ActiveDOMObject::scriptExecutionContext());
+        m_textTracks = TextTrackList::create(this, ActiveDOMObject::executionContext());
 
     return m_textTracks.get();
 }
@@ -3131,12 +3105,12 @@
             if (!m_mediaController && !m_paused) {
                 // changes paused to true and fires a simple event named pause at the media element.
                 m_paused = true;
-                scheduleEvent(eventNames().pauseEvent);
+                scheduleEvent(EventTypeNames::pause);
             }
             // Queue a task to fire a simple event named ended at the media element.
             if (!m_sentEndEvent) {
                 m_sentEndEvent = true;
-                scheduleEvent(eventNames().endedEvent);
+                scheduleEvent(EventTypeNames::ended);
             }
             // If the media element has a current media controller, then report the controller state
             // for the media element's current media controller.
@@ -3164,7 +3138,7 @@
         return;
 
     m_duration = duration;
-    scheduleEvent(eventNames().durationchangeEvent);
+    scheduleEvent(EventTypeNames::durationchange);
 
     if (hasMediaControls())
         mediaControls()->reset();
@@ -3188,6 +3162,12 @@
         playInternal();
 }
 
+void HTMLMediaElement::mediaPlayerRequestFullscreen()
+{
+    LOG(Media, "HTMLMediaElement::mediaPlayerRequestFullscreen");
+    enterFullscreen();
+}
+
 void HTMLMediaElement::mediaPlayerRequestSeek(double time)
 {
     // The player is the source of this seek request.
@@ -3432,7 +3412,7 @@
     m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED);
 
     // 3 - Queue a task to fire a simple event named error at the media element.
-    scheduleEvent(eventNames().abortEvent);
+    scheduleEvent(EventTypeNames::abort);
 
     closeMediaSource();
 
@@ -3442,7 +3422,7 @@
     // attribute to the NETWORK_IDLE value.
     if (m_readyState == HAVE_NOTHING) {
         m_networkState = NETWORK_EMPTY;
-        scheduleEvent(eventNames().emptiedEvent);
+        scheduleEvent(EventTypeNames::emptied);
     }
     else
         m_networkState = NETWORK_IDLE;
@@ -3478,12 +3458,7 @@
     m_loadState = WaitingForSource;
 
     if (m_textTracks)
-        configureTextTrackDisplay();
-}
-
-bool HTMLMediaElement::canSuspend() const
-{
-    return true;
+        configureTextTrackDisplay(AssumeNoVisibleChange);
 }
 
 void HTMLMediaElement::stop()
@@ -3506,47 +3481,18 @@
     m_asyncEventQueue->close();
 }
 
-void HTMLMediaElement::suspend(ReasonForSuspension why)
-{
-    LOG(Media, "HTMLMediaElement::suspend");
-
-    switch (why)
-    {
-        case DocumentWillBecomeInactive:
-            stop();
-            break;
-        case JavaScriptDebuggerPaused:
-        case WillDeferLoading:
-            // Do nothing, we don't pause media playback in these cases.
-            break;
-    }
-}
-
-void HTMLMediaElement::resume()
-{
-    LOG(Media, "HTMLMediaElement::resume");
-
-    m_inActiveDocument = true;
-    setPausedInternal(false);
-
-    if (m_error && m_error->code() == MediaError::MEDIA_ERR_ABORTED) {
-        // Restart the load if it was aborted in the middle by moving the document to the page cache.
-        // m_error is only left at MEDIA_ERR_ABORTED when the document becomes inactive (it is set to
-        //  MEDIA_ERR_ABORTED while the abortEvent is being sent, but cleared immediately afterwards).
-        // This behavior is not specified but it seems like a sensible thing to do.
-        // As it is not safe to immedately start loading now, let's schedule a load.
-        scheduleDelayedAction(LoadMediaResource);
-    }
-
-    if (renderer())
-        renderer()->updateFromElement();
-}
-
 bool HTMLMediaElement::hasPendingActivity() const
 {
     return (hasAudio() && isPlaying()) || m_asyncEventQueue->hasPendingEvents();
 }
 
+void HTMLMediaElement::contextDestroyed()
+{
+    if (m_mediaController)
+        m_mediaController->clearExecutionContext();
+    ActiveDOMObject::contextDestroyed();
+}
+
 bool HTMLMediaElement::isFullscreen() const
 {
     return FullscreenElementStack::isActiveFullScreenElement(this);
@@ -3637,22 +3583,6 @@
     }
 }
 
-void HTMLMediaElement::setWebkitClosedCaptionsVisible(bool visible)
-{
-    setClosedCaptionsVisible(visible);
-}
-
-bool HTMLMediaElement::webkitClosedCaptionsVisible() const
-{
-    return closedCaptionsVisible();
-}
-
-
-bool HTMLMediaElement::webkitHasClosedCaptions() const
-{
-    return hasClosedCaptions();
-}
-
 unsigned HTMLMediaElement::webkitAudioDecodedByteCount() const
 {
     if (!m_player)
@@ -3739,7 +3669,7 @@
     mediaControls()->show();
 }
 
-void HTMLMediaElement::configureTextTrackDisplay()
+void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assumption)
 {
     ASSERT(m_textTracks);
     LOG(Media, "HTMLMediaElement::configureTextTrackDisplay");
@@ -3755,8 +3685,11 @@
         }
     }
 
-    if (m_haveVisibleTextTrack == haveVisibleTextTrack)
+    if (assumption == AssumeNoVisibleChange
+        && m_haveVisibleTextTrack == haveVisibleTextTrack) {
+        updateActiveTextTrackCues(currentTime());
         return;
+    }
     m_haveVisibleTextTrack = haveVisibleTextTrack;
     m_closedCaptionsVisible = m_haveVisibleTextTrack;
 
@@ -3767,8 +3700,10 @@
 
     mediaControls()->changedClosedCaptionsVisibility();
 
-    if (RuntimeEnabledFeatures::videoTrackEnabled())
+    if (RuntimeEnabledFeatures::videoTrackEnabled()) {
+        updateActiveTextTrackCues(currentTime());
         updateTextTrackDisplay();
+    }
 }
 
 void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured()
@@ -3794,7 +3729,7 @@
 
 void* HTMLMediaElement::preDispatchEventHandler(Event* event)
 {
-    if (event && event->type() == eventNames().webkitfullscreenchangeEvent)
+    if (event && event->type() == EventTypeNames::webkitfullscreenchange)
         configureMediaControls();
 
     return 0;
@@ -3879,7 +3814,7 @@
     }
 
     // Otherwise, let controller be a newly created MediaController.
-    setController(MediaController::create(Node::scriptExecutionContext()));
+    setController(MediaController::create(Node::executionContext()));
 }
 
 MediaController* HTMLMediaElement::controller() const
@@ -3907,24 +3842,6 @@
         m_mediaController->reportControllerState();
 }
 
-bool HTMLMediaElement::dispatchEvent(PassRefPtr<Event> event)
-{
-    bool dispatchResult;
-    bool isCanPlayEvent;
-
-    isCanPlayEvent = (event->type() == eventNames().canplayEvent);
-
-    if (isCanPlayEvent)
-        m_dispatchingCanPlayEvent = true;
-
-    dispatchResult = HTMLElement::dispatchEvent(event);
-
-    if (isCanPlayEvent)
-        m_dispatchingCanPlayEvent = false;
-
-    return dispatchResult;
-}
-
 bool HTMLMediaElement::isBlocked() const
 {
     // A media element is a blocked media element if its readyState attribute is in the
diff --git a/Source/core/html/HTMLMediaElement.h b/Source/core/html/HTMLMediaElement.h
index d00b286..ef7c525 100644
--- a/Source/core/html/HTMLMediaElement.h
+++ b/Source/core/html/HTMLMediaElement.h
@@ -32,8 +32,8 @@
 #include "core/html/MediaControllerInterface.h"
 #include "core/html/track/TextTrack.h"
 #include "core/html/track/TextTrackCue.h"
-#include "core/platform/PODIntervalTree.h"
 #include "core/platform/graphics/MediaPlayer.h"
+#include "platform/PODIntervalTree.h"
 #include "public/platform/WebMimeRegistry.h"
 
 namespace WebKit { class WebLayer; }
@@ -132,8 +132,6 @@
     double playbackRate() const;
     void setPlaybackRate(double);
     void updatePlaybackRate();
-    bool webkitPreservesPitch() const;
-    void setWebkitPreservesPitch(bool);
     PassRefPtr<TimeRanges> played();
     PassRefPtr<TimeRanges> seekable() const;
     bool ended() const;
@@ -144,11 +142,6 @@
     void play();
     void pause();
 
-// captions
-    bool webkitHasClosedCaptions() const;
-    bool webkitClosedCaptionsVisible() const;
-    void setWebkitClosedCaptionsVisible(bool);
-
 // Statistics
     unsigned webkitAudioDecodedByteCount() const;
     unsigned webkitVideoDecodedByteCount() const;
@@ -232,7 +225,11 @@
     void configureTextTrackGroup(const TrackGroup&);
 
     bool textTracksAreReady() const;
-    void configureTextTrackDisplay();
+    enum VisibilityChangeAssumption {
+        AssumeNoVisibleChange,
+        AssumeVisibleChange
+    };
+    void configureTextTrackDisplay(VisibilityChangeAssumption);
     void updateTextTrackDisplay();
 
     // TextTrackClient
@@ -249,7 +246,7 @@
     // causes an ambiguity error at compile time. This class's constructor
     // ensures that both implementations return document, so return the result
     // of one of them here.
-    virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE { return HTMLElement::scriptExecutionContext(); }
+    virtual ExecutionContext* executionContext() const OVERRIDE { return HTMLElement::executionContext(); }
 
     bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSingleSecurityOrigin(); }
 
@@ -268,7 +265,9 @@
 
     bool isPlaying() const { return m_playing; }
 
-    virtual bool hasPendingActivity() const;
+    // ActiveDOMObject functions.
+    virtual bool hasPendingActivity() const OVERRIDE;
+    virtual void contextDestroyed() OVERRIDE;
 
 #if ENABLE(WEB_AUDIO)
     MediaElementAudioSourceNode* audioSourceNode() { return m_audioSourceNode; }
@@ -286,8 +285,6 @@
     MediaController* controller() const;
     void setController(PassRefPtr<MediaController>);
 
-    virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE;
-
 protected:
     HTMLMediaElement(const QualifiedName&, Document&, bool);
     virtual ~HTMLMediaElement();
@@ -297,7 +294,7 @@
     virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
     virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
 
-    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+    virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
 
     enum DisplayMode { Unknown, None, Poster, PosterWaitingForVideo, Video };
     DisplayMode displayMode() const { return m_displayMode; }
@@ -347,9 +344,6 @@
     virtual void willStopBeingFullscreenElement();
 
     // ActiveDOMObject functions.
-    virtual bool canSuspend() const;
-    virtual void suspend(ReasonForSuspension);
-    virtual void resume();
     virtual void stop();
 
     virtual void updateDisplayState() { }
@@ -362,6 +356,7 @@
     virtual void mediaPlayerTimeChanged() OVERRIDE;
     virtual void mediaPlayerDurationChanged() OVERRIDE;
     virtual void mediaPlayerPlaybackStateChanged() OVERRIDE;
+    virtual void mediaPlayerRequestFullscreen() OVERRIDE;
     virtual void mediaPlayerRequestSeek(double) OVERRIDE;
     virtual void mediaPlayerRepaint() OVERRIDE;
     virtual void mediaPlayerSizeChanged() OVERRIDE;
@@ -473,7 +468,6 @@
 
     double m_playbackRate;
     double m_defaultPlaybackRate;
-    bool m_webkitPreservesPitch;
     NetworkState m_networkState;
     ReadyState m_readyState;
     ReadyState m_readyStateMaximum;
@@ -545,7 +539,6 @@
 
     bool m_closedCaptionsVisible : 1;
 
-    bool m_dispatchingCanPlayEvent : 1;
     bool m_loadInitiatedByUserGesture : 1;
     bool m_completelyLoaded : 1;
     bool m_havePreparedToPlay : 1;
diff --git a/Source/core/html/HTMLMediaElement.idl b/Source/core/html/HTMLMediaElement.idl
index 3cf9793..3eb7acf 100644
--- a/Source/core/html/HTMLMediaElement.idl
+++ b/Source/core/html/HTMLMediaElement.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=Media,
+    RuntimeEnabled=Media,
     ActiveDOMObject
 ] interface HTMLMediaElement : HTMLElement {
 
@@ -32,7 +32,7 @@
 readonly attribute MediaError error;
 
 // network state
-[Reflect, URL] attribute DOMString src;
+[Reflect, TreatNullAs=NullString, URL] attribute DOMString src;
 [URL] readonly attribute DOMString currentSrc;
 
 const unsigned short NETWORK_EMPTY = 0;
@@ -44,7 +44,7 @@
 
 readonly attribute TimeRanges buffered;
 void load();
-    DOMString canPlayType([Default=Undefined] optional DOMString type, [Default=Undefined, TreatNullAs=NullString, TreatUndefinedAs=NullString] optional DOMString keySystem);
+DOMString canPlayType([Default=Undefined] optional DOMString type, [Default=Undefined, TreatNullAs=NullString, TreatUndefinedAs=NullString] optional DOMString keySystem);
 
 // ready state
 const unsigned short HAVE_NOTHING = 0;
@@ -71,37 +71,35 @@
 void play();
 void pause();
 
+// media controller
+[Reflect, TreatNullAs=NullString] attribute DOMString mediaGroup;
+[CustomSetter] attribute MediaController controller;
+
 // controls
 attribute boolean controls;
 [SetterRaisesException] attribute double volume;
 attribute boolean muted;
 [Reflect=muted] attribute boolean defaultMuted;
 
-// WebKit extensions
-attribute boolean webkitPreservesPitch;
+// tracks
+[RuntimeEnabled=VideoTrack] readonly attribute TextTrackList textTracks;
+[RuntimeEnabled=VideoTrack, RaisesException] TextTrack addTextTrack(DOMString kind, optional DOMString label, optional DOMString language);
 
-readonly attribute boolean webkitHasClosedCaptions;
-attribute boolean webkitClosedCaptionsVisible;
+// WebKit extensions
 
 // The number of bytes consumed by the media decoder.
 readonly attribute unsigned long webkitAudioDecodedByteCount;
 readonly attribute unsigned long webkitVideoDecodedByteCount;
 
 // FIXME: add DeprecateAs=PrefixedMediaGenerateKeyRequest when MediaKeys is ready.
-[EnabledAtRuntime=PrefixedEncryptedMedia, RaisesException] void webkitGenerateKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, optional Uint8Array initData);
-[EnabledAtRuntime=PrefixedEncryptedMedia, RaisesException] void webkitAddKey([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, Uint8Array key, optional Uint8Array initData, [Default=NullString] optional DOMString sessionId);
-[EnabledAtRuntime=PrefixedEncryptedMedia, RaisesException] void webkitCancelKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, [Default=NullString] optional DOMString sessionId);
+[RuntimeEnabled=PrefixedEncryptedMedia, RaisesException] void webkitGenerateKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, optional Uint8Array initData);
+[RuntimeEnabled=PrefixedEncryptedMedia, RaisesException] void webkitAddKey([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, Uint8Array key, optional Uint8Array initData, [Default=NullString] optional DOMString sessionId);
+[RuntimeEnabled=PrefixedEncryptedMedia, RaisesException] void webkitCancelKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, [Default=NullString] optional DOMString sessionId);
 
-[EnabledAtRuntime=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeyadded;
-[EnabledAtRuntime=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeyerror;
-[EnabledAtRuntime=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeymessage;
-[EnabledAtRuntime=PrefixedEncryptedMedia] attribute EventHandler onwebkitneedkey;
+[RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeyadded;
+[RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeyerror;
+[RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitkeymessage;
+[RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitneedkey;
 
-[EnabledAtRuntime=EncryptedMedia, Conditional=ENCRYPTED_MEDIA_V2] attribute MediaKeys mediaKeys;
-
-[EnabledAtRuntime=VideoTrack, RaisesException] TextTrack addTextTrack(DOMString kind, optional DOMString label, optional DOMString language);
-[EnabledAtRuntime=VideoTrack] readonly attribute TextTrackList textTracks;
-
-[Reflect, TreatNullAs=NullString] attribute DOMString mediaGroup;
-[CustomSetter] attribute MediaController controller;
+[RuntimeEnabled=EncryptedMedia, Conditional=ENCRYPTED_MEDIA_V2] attribute MediaKeys mediaKeys;
 };
diff --git a/Source/core/html/HTMLMetaElement-in.cpp b/Source/core/html/HTMLMetaElement-in.cpp
new file mode 100644
index 0000000..c32724e
--- /dev/null
+++ b/Source/core/html/HTMLMetaElement-in.cpp
@@ -0,0 +1,496 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2010 Apple Inc. 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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "core/html/HTMLMetaElement.h"
+
+#include "HTMLNames.h"
+#include "core/dom/Document.h"
+#include "core/page/Settings.h"
+
+namespace WebCore {
+
+#define DEFINE_ARRAY_FOR_MATCHING(name, source, maxMatchLength) \
+const UChar* name; \
+const unsigned uMaxMatchLength = maxMatchLength; \
+UChar characterBuffer[uMaxMatchLength]; \
+if (!source.is8Bit()) { \
+    name = source.characters16(); \
+} else { \
+    unsigned bufferLength = std::min(uMaxMatchLength, source.length()); \
+    const LChar* characters8 = source.characters8(); \
+    for (unsigned i = 0; i < bufferLength; ++i) \
+        characterBuffer[i] = characters8[i]; \
+    name = characterBuffer; \
+}
+
+using namespace HTMLNames;
+
+inline HTMLMetaElement::HTMLMetaElement(const QualifiedName& tagName, Document& document)
+    : HTMLElement(tagName, document)
+{
+    ASSERT(hasTagName(metaTag));
+    ScriptWrappable::init(this);
+}
+
+PassRefPtr<HTMLMetaElement> HTMLMetaElement::create(Document& document)
+{
+    return adoptRef(new HTMLMetaElement(metaTag, document));
+}
+
+PassRefPtr<HTMLMetaElement> HTMLMetaElement::create(const QualifiedName& tagName, Document& document)
+{
+    return adoptRef(new HTMLMetaElement(tagName, document));
+}
+
+static bool isInvalidSeparator(UChar c)
+{
+    return c == ';';
+}
+
+// Though isspace() considers \t and \v to be whitespace, Win IE doesn't.
+static bool isSeparator(UChar c)
+{
+    return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '=' || c == ',' || c == '\0';
+}
+
+void HTMLMetaElement::parseContentAttribute(const String& content, KeyValuePairCallback callback, void* data)
+{
+    bool error = false;
+
+    // Tread lightly in this code -- it was specifically designed to mimic Win IE's parsing behavior.
+    int keyBegin, keyEnd;
+    int valueBegin, valueEnd;
+
+    int i = 0;
+    int length = content.length();
+    String buffer = content.lower();
+    while (i < length) {
+        // skip to first non-separator, but don't skip past the end of the string
+        while (isSeparator(buffer[i])) {
+            if (i >= length)
+                break;
+            i++;
+        }
+        keyBegin = i;
+
+        // skip to first separator
+        while (!isSeparator(buffer[i])) {
+            error |= isInvalidSeparator(buffer[i]);
+            i++;
+        }
+        keyEnd = i;
+
+        // skip to first '=', but don't skip past a ',' or the end of the string
+        while (buffer[i] != '=') {
+            error |= isInvalidSeparator(buffer[i]);
+            if (buffer[i] == ',' || i >= length)
+                break;
+            i++;
+        }
+
+        // skip to first non-separator, but don't skip past a ',' or the end of the string
+        while (isSeparator(buffer[i])) {
+            if (buffer[i] == ',' || i >= length)
+                break;
+            i++;
+        }
+        valueBegin = i;
+
+        // skip to first separator
+        while (!isSeparator(buffer[i])) {
+            error |= isInvalidSeparator(buffer[i]);
+            i++;
+        }
+        valueEnd = i;
+
+        ASSERT_WITH_SECURITY_IMPLICATION(i <= length);
+
+        String keyString = buffer.substring(keyBegin, keyEnd - keyBegin);
+        String valueString = buffer.substring(valueBegin, valueEnd - valueBegin);
+        (this->*callback)(keyString, valueString, data);
+    }
+    if (error) {
+        String message = "Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead.";
+        document().addConsoleMessage(RenderingMessageSource, WarningMessageLevel, message);
+    }
+}
+
+static inline float clampLengthValue(float value)
+{
+    // Limits as defined in the css-device-adapt spec.
+    if (value != ViewportDescription::ValueAuto)
+        return std::min(float(10000), std::max(value, float(1)));
+    return value;
+}
+
+static inline float clampScaleValue(float value)
+{
+    // Limits as defined in the css-device-adapt spec.
+    if (value != ViewportDescription::ValueAuto)
+        return std::min(float(10), std::max(value, float(0.1)));
+    return value;
+}
+
+float HTMLMetaElement::parsePositiveNumber(const String& keyString, const String& valueString, bool* ok)
+{
+    size_t parsedLength;
+    float value;
+    if (valueString.is8Bit())
+        value = charactersToFloat(valueString.characters8(), valueString.length(), parsedLength);
+    else
+        value = charactersToFloat(valueString.characters16(), valueString.length(), parsedLength);
+    if (!parsedLength) {
+        reportViewportWarning(UnrecognizedViewportArgumentValueError, valueString, keyString);
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    if (parsedLength < valueString.length())
+        reportViewportWarning(TruncatedViewportArgumentValueError, valueString, keyString);
+    if (ok)
+        *ok = true;
+    return value;
+}
+
+Length HTMLMetaElement::parseViewportValueAsLength(const String& keyString, const String& valueString)
+{
+    // 1) Non-negative number values are translated to px lengths.
+    // 2) Negative number values are translated to auto.
+    // 3) device-width and device-height are used as keywords.
+    // 4) Other keywords and unknown values translate to 0.0.
+
+    unsigned length = valueString.length();
+    DEFINE_ARRAY_FOR_MATCHING(characters, valueString, 13);
+    SWITCH(characters, length) {
+        CASE("device-width") {
+            return Length(100, ViewportPercentageWidth);
+        }
+        CASE("device-height") {
+            return Length(100, ViewportPercentageHeight);
+        }
+    }
+
+    float value = parsePositiveNumber(keyString, valueString);
+
+    if (value < 0)
+        return Length(); // auto
+
+    if (!value && document().settings() && document().settings()->viewportMetaZeroValuesQuirk()) {
+        if (keyString == "width")
+            return Length(100, ViewportPercentageWidth);
+        if (keyString == "height")
+            return Length(100, ViewportPercentageHeight);
+    }
+
+    return Length(clampLengthValue(value), Fixed);
+}
+
+float HTMLMetaElement::parseViewportValueAsZoom(const String& keyString, const String& valueString)
+{
+    // 1) Non-negative number values are translated to <number> values.
+    // 2) Negative number values are translated to auto.
+    // 3) yes is translated to 1.0.
+    // 4) device-width and device-height are translated to 10.0.
+    // 5) no and unknown values are translated to 0.0
+
+    unsigned length = valueString.length();
+    DEFINE_ARRAY_FOR_MATCHING(characters, valueString, 13);
+    SWITCH(characters, length) {
+        CASE("yes") {
+            return 1;
+        }
+        CASE("no") {
+            return 0;
+        }
+        CASE("device-width") {
+            return 10;
+        }
+        CASE("device-height") {
+            return 10;
+        }
+    }
+
+    float value = parsePositiveNumber(keyString, valueString);
+
+    if (value < 0)
+        return ViewportDescription::ValueAuto;
+
+    if (value > 10.0)
+        reportViewportWarning(MaximumScaleTooLargeError, String(), String());
+
+    if (!value && document().settings() && document().settings()->viewportMetaZeroValuesQuirk())
+        return ViewportDescription::ValueAuto;
+
+    return clampScaleValue(value);
+}
+
+float HTMLMetaElement::parseViewportValueAsUserZoom(const String& keyString, const String& valueString)
+{
+    // yes and no are used as keywords.
+    // Numbers >= 1, numbers <= -1, device-width and device-height are mapped to yes.
+    // Numbers in the range <-1, 1>, and unknown values, are mapped to no.
+
+    unsigned length = valueString.length();
+    DEFINE_ARRAY_FOR_MATCHING(characters, valueString, 13);
+    SWITCH(characters, length) {
+        CASE("yes") {
+            return 1;
+        }
+        CASE("no") {
+            return 0;
+        }
+        CASE("device-width") {
+            return 1;
+        }
+        CASE("device-height") {
+            return 1;
+        }
+    }
+
+    float value = parsePositiveNumber(keyString, valueString);
+    if (fabs(value) < 1)
+        return 0;
+
+    return 1;
+}
+
+float HTMLMetaElement::parseViewportValueAsDPI(const String& keyString, const String& valueString)
+{
+    unsigned length = valueString.length();
+    DEFINE_ARRAY_FOR_MATCHING(characters, valueString, 10);
+    SWITCH(characters, length) {
+        CASE("device-dpi") {
+            return ViewportDescription::ValueDeviceDPI;
+        }
+        CASE("low-dpi") {
+            return ViewportDescription::ValueLowDPI;
+        }
+        CASE("medium-dpi") {
+            return ViewportDescription::ValueMediumDPI;
+        }
+        CASE("high-dpi") {
+            return ViewportDescription::ValueHighDPI;
+        }
+    }
+
+    bool ok;
+    float value = parsePositiveNumber(keyString, valueString, &ok);
+    if (!ok || value < 70 || value > 400)
+        return ViewportDescription::ValueAuto;
+
+    return value;
+}
+
+void HTMLMetaElement::processViewportKeyValuePair(const String& keyString, const String& valueString, void* data)
+{
+    ViewportDescription* description = static_cast<ViewportDescription*>(data);
+
+    unsigned length = keyString.length();
+
+    DEFINE_ARRAY_FOR_MATCHING(characters, keyString, 17);
+    SWITCH(characters, length) {
+        CASE("width") {
+            const Length& width = parseViewportValueAsLength(keyString, valueString);
+            if (width.isAuto())
+                return;
+            description->minWidth = Length(ExtendToZoom);
+            description->maxWidth = width;
+            return;
+        }
+        CASE("height") {
+            const Length& height = parseViewportValueAsLength(keyString, valueString);
+            if (height.isAuto())
+                return;
+            description->minHeight = Length(ExtendToZoom);
+            description->maxHeight = height;
+            return;
+        }
+        CASE("initial-scale") {
+            description->zoom = parseViewportValueAsZoom(keyString, valueString);
+            return;
+        }
+        CASE("minimum-scale") {
+            description->minZoom = parseViewportValueAsZoom(keyString, valueString);
+            return;
+        }
+        CASE("maximum-scale") {
+            description->maxZoom = parseViewportValueAsZoom(keyString, valueString);
+            return;
+        }
+        CASE("user-scalable") {
+            description->userZoom = parseViewportValueAsUserZoom(keyString, valueString);
+            return;
+        }
+        CASE("target-densitydpi") {
+            description->deprecatedTargetDensityDPI = parseViewportValueAsDPI(keyString, valueString);
+            reportViewportWarning(TargetDensityDpiUnsupported, String(), String());
+            return;
+        }
+    }
+    reportViewportWarning(UnrecognizedViewportArgumentKeyError, keyString, String());
+}
+
+static const char* viewportErrorMessageTemplate(ViewportErrorCode errorCode)
+{
+    static const char* const errors[] = {
+        "The key \"%replacement1\" is not recognized and ignored.",
+        "The value \"%replacement1\" for key \"%replacement2\" is invalid, and has been ignored.",
+        "The value \"%replacement1\" for key \"%replacement2\" was truncated to its numeric prefix.",
+        "The value for key \"maximum-scale\" is out of bounds and the value has been clamped.",
+        "The key \"target-densitydpi\" is not supported.",
+    };
+
+    return errors[errorCode];
+}
+
+static MessageLevel viewportErrorMessageLevel(ViewportErrorCode errorCode)
+{
+    switch (errorCode) {
+    case TruncatedViewportArgumentValueError:
+    case TargetDensityDpiUnsupported:
+        return WarningMessageLevel;
+    case UnrecognizedViewportArgumentKeyError:
+    case UnrecognizedViewportArgumentValueError:
+    case MaximumScaleTooLargeError:
+        return ErrorMessageLevel;
+    }
+
+    ASSERT_NOT_REACHED();
+    return ErrorMessageLevel;
+}
+
+void HTMLMetaElement::reportViewportWarning(ViewportErrorCode errorCode, const String& replacement1, const String& replacement2)
+{
+    if (!document().frame())
+        return;
+
+    String message = viewportErrorMessageTemplate(errorCode);
+    if (!replacement1.isNull())
+        message.replace("%replacement1", replacement1);
+    if (!replacement2.isNull())
+        message.replace("%replacement2", replacement2);
+
+    // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
+    document().addConsoleMessage(RenderingMessageSource, viewportErrorMessageLevel(errorCode), message);
+}
+
+void HTMLMetaElement::processViewportContentAttribute(const String& content, ViewportDescription::Type origin)
+{
+    ASSERT(!content.isNull());
+
+    if (!document().settings() || !document().shouldOverrideLegacyViewport(origin))
+        return;
+
+    ViewportDescription newDescriptionFromLegacyTag(origin);
+    parseContentAttribute(content, &HTMLMetaElement::processViewportKeyValuePair, (void*)&newDescriptionFromLegacyTag);
+
+    if (newDescriptionFromLegacyTag.minZoom == ViewportDescription::ValueAuto)
+        newDescriptionFromLegacyTag.minZoom = 0.25;
+
+    if (newDescriptionFromLegacyTag.maxZoom == ViewportDescription::ValueAuto) {
+        newDescriptionFromLegacyTag.maxZoom = 5;
+        newDescriptionFromLegacyTag.minZoom = std::min(newDescriptionFromLegacyTag.minZoom, float(5));
+    }
+
+    const Settings* settings = document().settings();
+
+    if (newDescriptionFromLegacyTag.maxWidth.isAuto()) {
+        if (newDescriptionFromLegacyTag.zoom == ViewportDescription::ValueAuto) {
+            newDescriptionFromLegacyTag.minWidth = Length(ExtendToZoom);
+            newDescriptionFromLegacyTag.maxWidth = Length(settings->layoutFallbackWidth(), Fixed);
+        } else if (newDescriptionFromLegacyTag.maxHeight.isAuto()) {
+            newDescriptionFromLegacyTag.minWidth = Length(ExtendToZoom);
+            newDescriptionFromLegacyTag.maxWidth = Length(ExtendToZoom);
+        }
+    }
+
+    document().setViewportDescription(newDescriptionFromLegacyTag);
+}
+
+
+void HTMLMetaElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
+{
+    if (name == http_equivAttr || name == contentAttr) {
+        process();
+        return;
+    }
+
+    if (name != nameAttr)
+        HTMLElement::parseAttribute(name, value);
+}
+
+Node::InsertionNotificationRequest HTMLMetaElement::insertedInto(ContainerNode* insertionPoint)
+{
+    HTMLElement::insertedInto(insertionPoint);
+    if (insertionPoint->inDocument())
+        process();
+    return InsertionDone;
+}
+
+void HTMLMetaElement::process()
+{
+    if (!inDocument())
+        return;
+
+    // All below situations require a content attribute (which can be the empty string).
+    const AtomicString& contentValue = fastGetAttribute(contentAttr);
+    if (contentValue.isNull())
+        return;
+
+    const AtomicString& nameValue = fastGetAttribute(nameAttr);
+    if (nameValue.isNull()) {
+        // Get the document to process the tag, but only if we're actually part of DOM
+        // tree (changing a meta tag while it's not in the tree shouldn't have any effect
+        // on the document).
+        const AtomicString& httpEquivValue = fastGetAttribute(http_equivAttr);
+        if (!httpEquivValue.isNull())
+            document().processHttpEquiv(httpEquivValue, contentValue);
+        return;
+    }
+
+    if (equalIgnoringCase(nameValue, "viewport"))
+        processViewportContentAttribute(contentValue, ViewportDescription::ViewportMeta);
+    else if (equalIgnoringCase(nameValue, "referrer"))
+        document().processReferrerPolicy(contentValue);
+    else if (equalIgnoringCase(nameValue, "handheldfriendly") && equalIgnoringCase(contentValue, "true"))
+        processViewportContentAttribute("width=device-width", ViewportDescription::HandheldFriendlyMeta);
+    else if (equalIgnoringCase(nameValue, "mobileoptimized"))
+        processViewportContentAttribute("width=device-width, initial-scale=1", ViewportDescription::MobileOptimizedMeta);
+}
+
+String HTMLMetaElement::content() const
+{
+    return getAttribute(contentAttr);
+}
+
+String HTMLMetaElement::httpEquiv() const
+{
+    return getAttribute(http_equivAttr);
+}
+
+String HTMLMetaElement::name() const
+{
+    return getNameAttribute();
+}
+
+}
diff --git a/Source/core/html/HTMLMetaElement.cpp b/Source/core/html/HTMLMetaElement.cpp
deleted file mode 100644
index 4218d13..0000000
--- a/Source/core/html/HTMLMetaElement.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- *           (C) 1999 Antti Koivisto (koivisto@kde.org)
- *           (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2010 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/html/HTMLMetaElement.h"
-
-#include "HTMLNames.h"
-#include "core/dom/Document.h"
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-inline HTMLMetaElement::HTMLMetaElement(const QualifiedName& tagName, Document& document)
-    : HTMLElement(tagName, document)
-{
-    ASSERT(hasTagName(metaTag));
-    ScriptWrappable::init(this);
-}
-
-PassRefPtr<HTMLMetaElement> HTMLMetaElement::create(Document& document)
-{
-    return adoptRef(new HTMLMetaElement(metaTag, document));
-}
-
-PassRefPtr<HTMLMetaElement> HTMLMetaElement::create(const QualifiedName& tagName, Document& document)
-{
-    return adoptRef(new HTMLMetaElement(tagName, document));
-}
-
-void HTMLMetaElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
-{
-    if (name == http_equivAttr)
-        process();
-    else if (name == contentAttr)
-        process();
-    else if (name == nameAttr) {
-        // Do nothing
-    } else
-        HTMLElement::parseAttribute(name, value);
-}
-
-Node::InsertionNotificationRequest HTMLMetaElement::insertedInto(ContainerNode* insertionPoint)
-{
-    HTMLElement::insertedInto(insertionPoint);
-    if (insertionPoint->inDocument())
-        process();
-    return InsertionDone;
-}
-
-void HTMLMetaElement::process()
-{
-    if (!inDocument())
-        return;
-
-    const AtomicString& contentValue = fastGetAttribute(contentAttr);
-    if (contentValue.isNull())
-        return;
-
-    if (equalIgnoringCase(name(), "viewport"))
-        document().processViewport(contentValue, ViewportArguments::ViewportMeta);
-    else if (equalIgnoringCase(name(), "referrer"))
-        document().processReferrerPolicy(contentValue);
-    else if (equalIgnoringCase(name(), "handheldfriendly") && equalIgnoringCase(contentValue, "true"))
-        document().processViewport("width=device-width", ViewportArguments::HandheldFriendlyMeta);
-    else if (equalIgnoringCase(name(), "mobileoptimized"))
-        document().processViewport("width=device-width, initial-scale=1", ViewportArguments::MobileOptimizedMeta);
-
-    // Get the document to process the tag, but only if we're actually part of DOM tree (changing a meta tag while
-    // it's not in the tree shouldn't have any effect on the document)
-    const AtomicString& httpEquivValue = fastGetAttribute(http_equivAttr);
-    if (!httpEquivValue.isNull())
-        document().processHttpEquiv(httpEquivValue, contentValue);
-}
-
-String HTMLMetaElement::content() const
-{
-    return getAttribute(contentAttr);
-}
-
-String HTMLMetaElement::httpEquiv() const
-{
-    return getAttribute(http_equivAttr);
-}
-
-String HTMLMetaElement::name() const
-{
-    return getNameAttribute();
-}
-
-}
diff --git a/Source/core/html/HTMLMetaElement.h b/Source/core/html/HTMLMetaElement.h
index 4d2db88..c0ece4f 100644
--- a/Source/core/html/HTMLMetaElement.h
+++ b/Source/core/html/HTMLMetaElement.h
@@ -27,6 +27,14 @@
 
 namespace WebCore {
 
+enum ViewportErrorCode {
+    UnrecognizedViewportArgumentKeyError,
+    UnrecognizedViewportArgumentValueError,
+    TruncatedViewportArgumentValueError,
+    MaximumScaleTooLargeError,
+    TargetDensityDpiUnsupported
+};
+
 class HTMLMetaElement FINAL : public HTMLElement {
 public:
     static PassRefPtr<HTMLMetaElement> create(Document&);
@@ -39,10 +47,24 @@
 private:
     HTMLMetaElement(const QualifiedName&, Document&);
 
+    typedef void (HTMLMetaElement::*KeyValuePairCallback)(const String& key, const String& value, void* data);
+    void processViewportKeyValuePair(const String& key, const String& value, void* data);
+    void parseContentAttribute(const String& content, KeyValuePairCallback, void* data);
+
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
 
+    float parsePositiveNumber(const String& key, const String& value, bool* ok = 0);
+
+    Length parseViewportValueAsLength(const String& key, const String& value);
+    float parseViewportValueAsZoom(const String& key, const String& value);
+    float parseViewportValueAsUserZoom(const String& key, const String& value);
+    float parseViewportValueAsDPI(const String& key, const String& value);
+
+    void reportViewportWarning(ViewportErrorCode, const String& replacement1, const String& replacement2);
+
     void process();
+    void processViewportContentAttribute(const String& content, ViewportDescription::Type origin);
 };
 
 inline HTMLMetaElement* toHTMLMetaElement(Node* node)
diff --git a/Source/core/html/HTMLMetaElement.idl b/Source/core/html/HTMLMetaElement.idl
index 4f7e9cd..8149993 100644
--- a/Source/core/html/HTMLMetaElement.idl
+++ b/Source/core/html/HTMLMetaElement.idl
@@ -18,9 +18,9 @@
  */
 
 interface HTMLMetaElement : HTMLElement {
-    [Reflect] attribute DOMString content;
-    [Reflect=http_equiv] attribute DOMString httpEquiv;
-    [Reflect] attribute DOMString name;
-    [Reflect] attribute DOMString scheme;
+    [Reflect, TreatNullAs=NullString] attribute DOMString content;
+    [Reflect=http_equiv, TreatNullAs=NullString] attribute DOMString httpEquiv;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString scheme;
 };
 
diff --git a/Source/core/html/HTMLModElement.idl b/Source/core/html/HTMLModElement.idl
index ccb8da4..df151a0 100644
--- a/Source/core/html/HTMLModElement.idl
+++ b/Source/core/html/HTMLModElement.idl
@@ -18,7 +18,7 @@
  */
 
 interface HTMLModElement : HTMLElement {
-    [Reflect, URL] attribute DOMString cite;
-    [Reflect] attribute DOMString dateTime;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString cite;
+    [Reflect, TreatNullAs=NullString] attribute DOMString dateTime;
 };
 
diff --git a/Source/core/html/HTMLNameCollection.h b/Source/core/html/HTMLNameCollection.h
index a13039d..435d439 100644
--- a/Source/core/html/HTMLNameCollection.h
+++ b/Source/core/html/HTMLNameCollection.h
@@ -31,7 +31,7 @@
 
 class Document;
 
-class HTMLNameCollection : public HTMLCollection {
+class HTMLNameCollection FINAL : public HTMLCollection {
 public:
     static PassRefPtr<HTMLNameCollection> create(Node* document, CollectionType type, const AtomicString& name)
     {
diff --git a/Source/core/html/HTMLOListElement.idl b/Source/core/html/HTMLOListElement.idl
index 1e51615..0168f6d 100644
--- a/Source/core/html/HTMLOListElement.idl
+++ b/Source/core/html/HTMLOListElement.idl
@@ -21,6 +21,6 @@
     [Reflect] attribute boolean compact;
     attribute long start;
     [Reflect] attribute boolean reversed;
-    [Reflect] attribute DOMString type;
+    [Reflect, TreatNullAs=NullString] attribute DOMString type;
 };
 
diff --git a/Source/core/html/HTMLObjectElement.cpp b/Source/core/html/HTMLObjectElement.cpp
index eb9f93f..8e7e0da 100644
--- a/Source/core/html/HTMLObjectElement.cpp
+++ b/Source/core/html/HTMLObjectElement.cpp
@@ -28,22 +28,21 @@
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/ElementTraversal.h"
-#include "core/events/EventNames.h"
 #include "core/dom/NodeList.h"
 #include "core/dom/Text.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/fetch/ImageResource.h"
-#include "core/html/FormDataList.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLImageLoader.h"
 #include "core/html/HTMLMetaElement.h"
 #include "core/html/HTMLParamElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/MIMETypeRegistry.h"
-#include "core/platform/Widget.h"
+#include "core/platform/network/FormDataList.h"
 #include "core/plugins/PluginView.h"
 #include "core/rendering/RenderEmbeddedObject.h"
+#include "platform/Widget.h"
 
 namespace WebCore {
 
@@ -115,7 +114,7 @@
         if (renderer())
             setNeedsWidgetUpdate(true);
     } else if (name == onbeforeloadAttr)
-        setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::beforeload, createAttributeEventListener(this, name, value));
     else
         HTMLPlugInImageElement::parseAttribute(name, value);
 }
@@ -230,8 +229,8 @@
     // 'generator' meta tag is present. Only apply this quirk if there is no
     // fallback content, which ensures the quirk will disable itself if Wiki
     // Server is updated to generate an alternate embed tag as fallback content.
-    if (!document().page()
-        || !document().page()->settings().needsSiteSpecificQuirks()
+    if (!document().settings()
+        || !document().settings()->needsSiteSpecificQuirks()
         || hasFallbackContent()
         || !equalIgnoringCase(classId(), "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"))
         return false;
@@ -482,7 +481,7 @@
         addSubresourceURL(urls, document().completeURL(useMap));
 }
 
-void HTMLObjectElement::didMoveToNewDocument(Document* oldDocument)
+void HTMLObjectElement::didMoveToNewDocument(Document& oldDocument)
 {
     FormAssociatedElement::didMoveToNewDocument(oldDocument);
     HTMLPlugInImageElement::didMoveToNewDocument(oldDocument);
diff --git a/Source/core/html/HTMLObjectElement.h b/Source/core/html/HTMLObjectElement.h
index 99a12ba..a7aa865 100644
--- a/Source/core/html/HTMLObjectElement.h
+++ b/Source/core/html/HTMLObjectElement.h
@@ -76,7 +76,7 @@
     virtual void removedFrom(ContainerNode*) OVERRIDE;
 
     virtual bool rendererIsNeeded(const RenderStyle&);
-    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+    virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
 
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
diff --git a/Source/core/html/HTMLObjectElement.idl b/Source/core/html/HTMLObjectElement.idl
index 8c33b24..e117c52 100644
--- a/Source/core/html/HTMLObjectElement.idl
+++ b/Source/core/html/HTMLObjectElement.idl
@@ -22,22 +22,22 @@
     CustomLegacyCall
 ] interface HTMLObjectElement : HTMLElement {
     readonly attribute HTMLFormElement form;
-    [Reflect] attribute DOMString code;
-    [Reflect] attribute DOMString align;
-    [Reflect] attribute DOMString archive;
-    [Reflect] attribute DOMString border;
-    [Reflect] attribute DOMString codeBase;
-    [Reflect] attribute DOMString codeType;
-    [Reflect, URL] attribute DOMString data;
+    [Reflect, TreatNullAs=NullString] attribute DOMString code;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString archive;
+    [Reflect, TreatNullAs=NullString] attribute DOMString border;
+    [Reflect, TreatNullAs=NullString] attribute DOMString codeBase;
+    [Reflect, TreatNullAs=NullString] attribute DOMString codeType;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString data;
     [Reflect] attribute boolean declare;
-    [Reflect] attribute DOMString height;
+    [Reflect, TreatNullAs=NullString] attribute DOMString height;
     [Reflect] attribute long hspace;
-    [Reflect] attribute DOMString name;
-    [Reflect] attribute DOMString standby;
-    [Reflect] attribute DOMString type;
-    [Reflect] attribute DOMString useMap;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString standby;
+    [Reflect, TreatNullAs=NullString] attribute DOMString type;
+    [Reflect, TreatNullAs=NullString] attribute DOMString useMap;
     [Reflect] attribute long vspace;
-    [Reflect] attribute DOMString width;
+    [Reflect, TreatNullAs=NullString] attribute DOMString width;
     readonly attribute boolean willValidate;
     readonly attribute ValidityState validity;
     readonly attribute DOMString validationMessage;
diff --git a/Source/core/html/HTMLOptGroupElement.cpp b/Source/core/html/HTMLOptGroupElement.cpp
index e7823e2..5bd6874 100644
--- a/Source/core/html/HTMLOptGroupElement.cpp
+++ b/Source/core/html/HTMLOptGroupElement.cpp
@@ -125,7 +125,7 @@
 
 String HTMLOptGroupElement::groupLabelText() const
 {
-    String itemText = document().displayStringModifiedByEncoding(getAttribute(labelAttr));
+    String itemText = getAttribute(labelAttr);
 
     // In WinIE, leading and trailing whitespace is ignored in options and optgroups. We match this behavior.
     itemText = itemText.stripWhiteSpace();
diff --git a/Source/core/html/HTMLOptGroupElement.idl b/Source/core/html/HTMLOptGroupElement.idl
index 26a782f..d95f738 100644
--- a/Source/core/html/HTMLOptGroupElement.idl
+++ b/Source/core/html/HTMLOptGroupElement.idl
@@ -19,6 +19,6 @@
 
 interface HTMLOptGroupElement : HTMLElement {
     [Reflect] attribute boolean disabled;
-    [Reflect] attribute DOMString label;
+    [Reflect, TreatNullAs=NullString] attribute DOMString label;
 };
 
diff --git a/Source/core/html/HTMLOptionElement.cpp b/Source/core/html/HTMLOptionElement.cpp
index dbe4d00..85dffe1 100644
--- a/Source/core/html/HTMLOptionElement.cpp
+++ b/Source/core/html/HTMLOptionElement.cpp
@@ -123,9 +123,7 @@
     if (text.isEmpty())
         text = collectOptionInnerText();
 
-    // FIXME: Is displayStringModifiedByEncoding helpful here?
-    // If it's correct here, then isn't it needed in the value and label functions too?
-    return document.displayStringModifiedByEncoding(text).stripWhiteSpace(isHTMLSpace<UChar>).simplifyWhiteSpace(isHTMLSpace<UChar>);
+    return text.stripWhiteSpace(isHTMLSpace<UChar>).simplifyWhiteSpace(isHTMLSpace<UChar>);
 }
 
 void HTMLOptionElement::setText(const String &text, ExceptionState& es)
diff --git a/Source/core/html/HTMLOptionsCollection.h b/Source/core/html/HTMLOptionsCollection.h
index 52aa857..fe5ad5d 100644
--- a/Source/core/html/HTMLOptionsCollection.h
+++ b/Source/core/html/HTMLOptionsCollection.h
@@ -32,7 +32,7 @@
 class HTMLOptionElement;
 class HTMLSelectElement;
 
-class HTMLOptionsCollection : public HTMLCollection {
+class HTMLOptionsCollection FINAL : public HTMLCollection {
 public:
     static PassRefPtr<HTMLOptionsCollection> create(Node*, CollectionType);
 
@@ -50,7 +50,7 @@
     bool anonymousIndexedSetterRemove(unsigned, ExceptionState&);
 
 private:
-    HTMLOptionsCollection(Node*);
+    explicit HTMLOptionsCollection(Node*);
 };
 
 } //namespace
diff --git a/Source/core/html/HTMLOutputElement.cpp b/Source/core/html/HTMLOutputElement.cpp
index 4990e99..38de4bf 100644
--- a/Source/core/html/HTMLOutputElement.cpp
+++ b/Source/core/html/HTMLOutputElement.cpp
@@ -93,7 +93,7 @@
         m_defaultValue = textContent();
 }
 
-void HTMLOutputElement::reset()
+void HTMLOutputElement::resetImpl()
 {
     // The reset algorithm for output elements is to set the element's
     // value mode flag to "default" and then to set the element's textContent
diff --git a/Source/core/html/HTMLOutputElement.h b/Source/core/html/HTMLOutputElement.h
index 9f198f4..75ac553 100644
--- a/Source/core/html/HTMLOutputElement.h
+++ b/Source/core/html/HTMLOutputElement.h
@@ -60,7 +60,7 @@
     virtual bool supportLabels() const OVERRIDE { return true; }
     virtual bool supportsFocus() const;
     virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
-    virtual void reset();
+    virtual void resetImpl() OVERRIDE;
 
     void setTextContentInternal(const String&);
 
diff --git a/Source/core/html/HTMLOutputElement.idl b/Source/core/html/HTMLOutputElement.idl
index 7edaca2..fe3068b 100644
--- a/Source/core/html/HTMLOutputElement.idl
+++ b/Source/core/html/HTMLOutputElement.idl
@@ -25,7 +25,7 @@
 interface HTMLOutputElement : HTMLElement {
     readonly attribute DOMSettableTokenList htmlFor;
     readonly attribute HTMLFormElement form;
-    [Reflect] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
 
     readonly attribute DOMString type;
     [TreatNullAs=NullString] attribute DOMString defaultValue;
diff --git a/Source/core/html/HTMLParagraphElement.idl b/Source/core/html/HTMLParagraphElement.idl
index e6bd9e8..55787c3 100644
--- a/Source/core/html/HTMLParagraphElement.idl
+++ b/Source/core/html/HTMLParagraphElement.idl
@@ -18,6 +18,6 @@
  */
 
 interface HTMLParagraphElement : HTMLElement {
-    [Reflect] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
 };
 
diff --git a/Source/core/html/HTMLParamElement.idl b/Source/core/html/HTMLParamElement.idl
index fea2594..2de4b20 100644
--- a/Source/core/html/HTMLParamElement.idl
+++ b/Source/core/html/HTMLParamElement.idl
@@ -18,9 +18,9 @@
  */
 
 interface HTMLParamElement : HTMLElement {
-    [Reflect] attribute DOMString name;
-    [Reflect] attribute DOMString type;
-    [Reflect] attribute DOMString value;
-    [Reflect] attribute DOMString valueType;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString type;
+    [Reflect, TreatNullAs=NullString] attribute DOMString value;
+    [Reflect, TreatNullAs=NullString] attribute DOMString valueType;
 };
 
diff --git a/Source/core/html/HTMLPlugInElement.cpp b/Source/core/html/HTMLPlugInElement.cpp
index 9af98d1..e7550e9 100644
--- a/Source/core/html/HTMLPlugInElement.cpp
+++ b/Source/core/html/HTMLPlugInElement.cpp
@@ -30,11 +30,11 @@
 #include "core/dom/Document.h"
 #include "core/events/Event.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/platform/Widget.h"
+#include "core/frame/Frame.h"
 #include "core/plugins/PluginView.h"
 #include "core/rendering/RenderEmbeddedObject.h"
 #include "core/rendering/RenderWidget.h"
+#include "platform/Widget.h"
 #include "wtf/UnusedParam.h"
 
 
@@ -53,7 +53,7 @@
 
 HTMLPlugInElement::~HTMLPlugInElement()
 {
-    ASSERT(!m_instance); // cleared in detach()
+    ASSERT(!m_pluginWrapper); // cleared in detach()
 
     if (m_NPObject) {
         _NPN_ReleaseObject(m_NPObject);
@@ -90,7 +90,7 @@
 
 void HTMLPlugInElement::detach(const AttachContext& context)
 {
-    m_instance.clear();
+    resetInstance();
 
     if (m_isCapturingMouseEvents) {
         if (Frame* frame = document().frame())
@@ -108,10 +108,10 @@
 
 void HTMLPlugInElement::resetInstance()
 {
-    m_instance.clear();
+    m_pluginWrapper.clear();
 }
 
-PassScriptInstance HTMLPlugInElement::getInstance()
+SharedPersistent<v8::Object>* HTMLPlugInElement::pluginWrapper()
 {
     Frame* frame = document().frame();
     if (!frame)
@@ -119,13 +119,11 @@
 
     // If the host dynamically turns off JavaScript (or Java) we will still return
     // the cached allocated Bindings::Instance.  Not supporting this edge-case is OK.
-    if (m_instance)
-        return m_instance;
-
-    if (Widget* widget = pluginWidget())
-        m_instance = frame->script()->createScriptInstanceForWidget(widget);
-
-    return m_instance;
+    if (!m_pluginWrapper) {
+        if (Widget* widget = pluginWidget())
+            m_pluginWrapper = frame->script()->createPluginWrapper(widget);
+    }
+    return m_pluginWrapper.get();
 }
 
 bool HTMLPlugInElement::dispatchBeforeLoadEvent(const String& sourceURL)
diff --git a/Source/core/html/HTMLPlugInElement.h b/Source/core/html/HTMLPlugInElement.h
index 0647dfd..8e4ac08 100644
--- a/Source/core/html/HTMLPlugInElement.h
+++ b/Source/core/html/HTMLPlugInElement.h
@@ -23,10 +23,9 @@
 #ifndef HTMLPlugInElement_h
 #define HTMLPlugInElement_h
 
+#include "bindings/v8/SharedPersistent.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 
-#include "bindings/v8/ScriptInstance.h"
-
 struct NPObject;
 
 namespace WebCore {
@@ -41,7 +40,7 @@
 
     void resetInstance();
 
-    PassScriptInstance getInstance();
+    SharedPersistent<v8::Object>* pluginWrapper();
 
     Widget* pluginWidget() const;
 
@@ -96,7 +95,7 @@
     virtual bool isKeyboardFocusable() const OVERRIDE;
     virtual bool isPluginElement() const;
 
-    mutable ScriptInstance m_instance;
+    mutable RefPtr<SharedPersistent<v8::Object> > m_pluginWrapper;
     NPObject* m_NPObject;
     bool m_isCapturingMouseEvents;
     bool m_inBeforeLoadEventHandler;
diff --git a/Source/core/html/HTMLPlugInImageElement.cpp b/Source/core/html/HTMLPlugInImageElement.cpp
index 51e2342..a7b5bbd 100644
--- a/Source/core/html/HTMLPlugInImageElement.cpp
+++ b/Source/core/html/HTMLPlugInImageElement.cpp
@@ -21,23 +21,23 @@
 #include "config.h"
 #include "core/html/HTMLPlugInImageElement.h"
 
-#include "bindings/v8/ScriptController.h"
 #include "core/dom/PostAttachCallbacks.h"
 #include "core/html/HTMLImageLoader.h"
 #include "core/html/PluginDocument.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/Frame.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/Logging.h"
+#include "platform/Logging.h"
 #include "core/platform/MIMETypeFromURL.h"
 #include "core/platform/MIMETypeRegistry.h"
 #include "core/platform/graphics/Image.h"
 #include "core/plugins/PluginData.h"
 #include "core/rendering/RenderEmbeddedObject.h"
 #include "core/rendering/RenderImage.h"
+#include "platform/UserGestureIndicator.h"
 #include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
@@ -61,7 +61,7 @@
     // the same codepath in this class.
     , m_needsWidgetUpdate(!createdByParser)
     , m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPreferPlugInsForImages)
-    , m_createdDuringUserGesture(ScriptController::processingUserGesture())
+    , m_createdDuringUserGesture(UserGestureIndicator::processingUserGesture())
 {
     setHasCustomStyleCallbacks();
 }
@@ -171,7 +171,7 @@
     // FIXME: Because of the insanity that is HTMLPlugInImageElement::recalcStyle,
     // we can end up detaching during an attach() call, before we even have a
     // renderer.  In that case, don't mark the widget for update.
-    if (attached() && renderer() && !useFallbackContent())
+    if (confusingAndOftenMisusedAttached() && renderer() && !useFallbackContent())
         // Update the widget the next time we attach (detaching destroys the plugin).
         setNeedsWidgetUpdate(true);
     HTMLPlugInElement::detach(context);
@@ -201,7 +201,7 @@
         setNeedsStyleRecalc();
 }
 
-void HTMLPlugInImageElement::didMoveToNewDocument(Document* oldDocument)
+void HTMLPlugInImageElement::didMoveToNewDocument(Document& oldDocument)
 {
     if (m_imageLoader)
         m_imageLoader->elementDidMoveToNewDocument();
diff --git a/Source/core/html/HTMLPlugInImageElement.h b/Source/core/html/HTMLPlugInImageElement.h
index f994810..7f161fd 100644
--- a/Source/core/html/HTMLPlugInImageElement.h
+++ b/Source/core/html/HTMLPlugInImageElement.h
@@ -91,7 +91,7 @@
     bool allowedToLoadFrameURL(const String& url);
     bool wouldLoadAsNetscapePlugin(const String& url, const String& serviceType);
 
-    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+    virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
 
     bool requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues);
     bool shouldUsePlugin(const KURL&, const String& mimeType, bool hasFallback, bool& useFallback);
diff --git a/Source/core/html/HTMLQuoteElement.idl b/Source/core/html/HTMLQuoteElement.idl
index c53a1a2..8727532 100644
--- a/Source/core/html/HTMLQuoteElement.idl
+++ b/Source/core/html/HTMLQuoteElement.idl
@@ -18,5 +18,5 @@
  */
 
 interface HTMLQuoteElement : HTMLElement {
-    [Reflect, URL] attribute DOMString cite;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString cite;
 };
diff --git a/Source/core/html/HTMLScriptElement.cpp b/Source/core/html/HTMLScriptElement.cpp
index 27d1e48..712f224 100644
--- a/Source/core/html/HTMLScriptElement.cpp
+++ b/Source/core/html/HTMLScriptElement.cpp
@@ -28,10 +28,10 @@
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
-#include "core/events/Event.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ScriptLoader.h"
 #include "core/dom/Text.h"
+#include "core/events/Event.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -68,7 +68,7 @@
     else if (name == asyncAttr)
         m_loader->handleAsyncAttribute();
     else if (name == onbeforeloadAttr)
-        setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::beforeload, createAttributeEventListener(this, name, value));
     else
         HTMLElement::parseAttribute(name, value);
 }
@@ -168,7 +168,7 @@
 void HTMLScriptElement::dispatchLoadEvent()
 {
     ASSERT(!m_loader->haveFiredLoadEvent());
-    dispatchEvent(Event::create(eventNames().loadEvent));
+    dispatchEvent(Event::create(EventTypeNames::load));
 }
 
 PassRefPtr<Element> HTMLScriptElement::cloneElementWithoutAttributesAndChildren()
diff --git a/Source/core/html/HTMLScriptElement.idl b/Source/core/html/HTMLScriptElement.idl
index ef68a4d..c1a6440 100644
--- a/Source/core/html/HTMLScriptElement.idl
+++ b/Source/core/html/HTMLScriptElement.idl
@@ -19,13 +19,13 @@
 
 interface HTMLScriptElement : HTMLElement {
     [TreatNullAs=NullString] attribute DOMString text;
-    [Reflect=for] attribute DOMString htmlFor;
-    [Reflect] attribute DOMString event;
-    [Reflect] attribute DOMString charset;
+    [Reflect=for, TreatNullAs=NullString] attribute DOMString htmlFor;
+    [Reflect, TreatNullAs=NullString] attribute DOMString event;
+    [Reflect, TreatNullAs=NullString] attribute DOMString charset;
     attribute boolean async;
     [Reflect] attribute boolean defer;
-    [Reflect, URL] attribute DOMString src;
-    [Reflect] attribute DOMString type;
-    [Reflect] attribute DOMString crossOrigin;
-    [Reflect, EnabledAtRuntime=ExperimentalContentSecurityPolicyFeatures] attribute DOMString nonce;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString src;
+    [Reflect, TreatNullAs=NullString] attribute DOMString type;
+    [Reflect, TreatNullAs=NullString] attribute DOMString crossOrigin;
+    [Reflect, TreatNullAs=NullString, RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute DOMString nonce;
 };
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp
index 5cbf562..7324057 100644
--- a/Source/core/html/HTMLSelectElement.cpp
+++ b/Source/core/html/HTMLSelectElement.cpp
@@ -34,25 +34,25 @@
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/ElementTraversal.h"
-#include "core/events/EventNames.h"
+#include "core/dom/NodeTraversal.h"
 #include "core/events/KeyboardEvent.h"
 #include "core/events/MouseEvent.h"
-#include "core/dom/NodeTraversal.h"
-#include "core/html/FormDataList.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLOptGroupElement.h"
 #include "core/html/HTMLOptionElement.h"
 #include "core/html/HTMLOptionsCollection.h"
 #include "core/html/forms/FormController.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/SpatialNavigation.h"
-#include "core/platform/PlatformMouseEvent.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "core/platform/network/FormDataList.h"
 #include "core/rendering/RenderListBox.h"
 #include "core/rendering/RenderMenuList.h"
 #include "core/rendering/RenderTheme.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/text/PlatformLocale.h"
 
 using namespace std;
 using namespace WTF::Unicode;
@@ -304,7 +304,7 @@
 
         m_size = size;
         setNeedsValidityCheck();
-        if (m_size != oldSize && attached()) {
+        if (m_size != oldSize && confusingAndOftenMisusedAttached()) {
             lazyReattach();
             setRecalcListItems();
         }
@@ -1027,7 +1027,7 @@
     return successful;
 }
 
-void HTMLSelectElement::reset()
+void HTMLSelectElement::resetImpl()
 {
     HTMLOptionElement* firstOption = 0;
     HTMLOptionElement* selectedOption = 0;
@@ -1093,7 +1093,7 @@
 {
     RenderTheme& renderTheme = RenderTheme::theme();
 
-    if (event->type() == eventNames().keydownEvent) {
+    if (event->type() == EventTypeNames::keydown) {
         if (!renderer() || !event->isKeyboardEvent())
             return;
 
@@ -1137,7 +1137,7 @@
 
     // Use key press event here since sending simulated mouse events
     // on key down blocks the proper sending of the key press event.
-    if (event->type() == eventNames().keypressEvent) {
+    if (event->type() == EventTypeNames::keypress) {
         if (!renderer() || !event->isKeyboardEvent())
             return;
 
@@ -1198,7 +1198,7 @@
             event->setDefaultHandled();
     }
 
-    if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
+    if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
         focus();
         if (renderer() && renderer()->isMenuList()) {
             if (RenderMenuList* menuList = toRenderMenuList(renderer())) {
@@ -1218,7 +1218,7 @@
         event->setDefaultHandled();
     }
 
-    if (event->type() == eventNames().blurEvent) {
+    if (event->type() == EventTypeNames::blur) {
         if (RenderMenuList* menuList = toRenderMenuList(renderer())) {
             if (menuList->popupIsVisible())
                 menuList->hidePopup();
@@ -1279,7 +1279,7 @@
 {
     const Vector<HTMLElement*>& listItems = this->listItems();
 
-    if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
+    if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
         focus();
         // Calling focus() may cause us to lose our renderer, in which case do not want to handle the event.
         if (!renderer())
@@ -1302,7 +1302,7 @@
 
             event->setDefaultHandled();
         }
-    } else if (event->type() == eventNames().mousemoveEvent && event->isMouseEvent() && !toRenderBox(renderer())->canBeScrolledAndHasScrollableArea()) {
+    } else if (event->type() == EventTypeNames::mousemove && event->isMouseEvent() && !toRenderBox(renderer())->canBeScrolledAndHasScrollableArea()) {
         MouseEvent* mouseEvent = toMouseEvent(event);
         if (mouseEvent->button() != LeftButton || !mouseEvent->buttonDown())
             return;
@@ -1326,7 +1326,7 @@
             }
             event->setDefaultHandled();
         }
-    } else if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton && renderer() && !toRenderBox(renderer())->autoscrollInProgress()) {
+    } else if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton && renderer() && !toRenderBox(renderer())->autoscrollInProgress()) {
         // We didn't start this click/drag on any options.
         if (m_lastOnChangeSelection.isEmpty())
             return;
@@ -1334,7 +1334,7 @@
         // click. For drag selection, onChange will fire when the autoscroll
         // timer stops.
         listBoxOnChange();
-    } else if (event->type() == eventNames().keydownEvent) {
+    } else if (event->type() == EventTypeNames::keydown) {
         if (!event->isKeyboardEvent())
             return;
         const String& keyIdentifier = toKeyboardEvent(event)->keyIdentifier();
@@ -1417,7 +1417,7 @@
 
             event->setDefaultHandled();
         }
-    } else if (event->type() == eventNames().keypressEvent) {
+    } else if (event->type() == EventTypeNames::keypress) {
         if (!event->isKeyboardEvent())
             return;
         int keyCode = toKeyboardEvent(event)->keyCode();
@@ -1453,7 +1453,7 @@
     if (event->defaultHandled())
         return;
 
-    if (event->type() == eventNames().keypressEvent && event->isKeyboardEvent()) {
+    if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) {
         KeyboardEvent* keyboardEvent = toKeyboardEvent(event);
         if (!keyboardEvent->ctrlKey() && !keyboardEvent->altKey() && !keyboardEvent->metaKey() && isPrintableChar(keyboardEvent->charCode())) {
             typeAheadFind(keyboardEvent);
diff --git a/Source/core/html/HTMLSelectElement.h b/Source/core/html/HTMLSelectElement.h
index 34cd873..3043062 100644
--- a/Source/core/html/HTMLSelectElement.h
+++ b/Source/core/html/HTMLSelectElement.h
@@ -51,7 +51,7 @@
     virtual String validationMessage() const OVERRIDE;
     virtual bool valueMissing() const OVERRIDE;
 
-    virtual void reset() OVERRIDE;
+    virtual void resetImpl() OVERRIDE;
 
     unsigned length() const;
 
diff --git a/Source/core/html/HTMLSelectElement.idl b/Source/core/html/HTMLSelectElement.idl
index 8c92af5..477af63 100644
--- a/Source/core/html/HTMLSelectElement.idl
+++ b/Source/core/html/HTMLSelectElement.idl
@@ -24,7 +24,7 @@
     [Reflect] attribute boolean disabled;
     readonly attribute HTMLFormElement form;
     attribute boolean multiple;
-    [Reflect] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
     [Reflect] attribute boolean required;
     attribute long size;
 
diff --git a/Source/core/html/HTMLSourceElement.cpp b/Source/core/html/HTMLSourceElement.cpp
index ec03337..b060275 100644
--- a/Source/core/html/HTMLSourceElement.cpp
+++ b/Source/core/html/HTMLSourceElement.cpp
@@ -28,9 +28,9 @@
 
 #include "HTMLNames.h"
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLMediaElement.h"
-#include "core/platform/Logging.h"
+#include "platform/Logging.h"
 
 using namespace std;
 
@@ -114,7 +114,7 @@
 void HTMLSourceElement::errorEventTimerFired(Timer<HTMLSourceElement>*)
 {
     LOG(Media, "HTMLSourceElement::errorEventTimerFired - %p", this);
-    dispatchEvent(Event::createCancelable(eventNames().errorEvent));
+    dispatchEvent(Event::createCancelable(EventTypeNames::error));
 }
 
 bool HTMLSourceElement::isURLAttribute(const Attribute& attribute) const
diff --git a/Source/core/html/HTMLSourceElement.h b/Source/core/html/HTMLSourceElement.h
index 02378cc..aaf1535 100644
--- a/Source/core/html/HTMLSourceElement.h
+++ b/Source/core/html/HTMLSourceElement.h
@@ -27,7 +27,7 @@
 #define HTMLSourceElement_h
 
 #include "core/html/HTMLElement.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/HTMLSourceElement.idl b/Source/core/html/HTMLSourceElement.idl
index 5adb052..e64d1da 100644
--- a/Source/core/html/HTMLSourceElement.idl
+++ b/Source/core/html/HTMLSourceElement.idl
@@ -24,9 +24,9 @@
  */
 
 [
-    EnabledAtRuntime=Media
+    RuntimeEnabled=Media
 ] interface HTMLSourceElement : HTMLElement {
-[Reflect, URL] attribute DOMString src;
+[Reflect, TreatNullAs=NullString, URL] attribute DOMString src;
     attribute DOMString type;
     attribute DOMString media;
 };
diff --git a/Source/core/html/HTMLStyleElement.cpp b/Source/core/html/HTMLStyleElement.cpp
index d877c24..f44bebe 100644
--- a/Source/core/html/HTMLStyleElement.cpp
+++ b/Source/core/html/HTMLStyleElement.cpp
@@ -40,7 +40,7 @@
 
 static StyleEventSender& styleLoadEventSender()
 {
-    DEFINE_STATIC_LOCAL(StyleEventSender, sharedLoadEventSender, (eventNames().loadEvent));
+    DEFINE_STATIC_LOCAL(StyleEventSender, sharedLoadEventSender, (EventTypeNames::load));
     return sharedLoadEventSender;
 }
 
@@ -75,7 +75,7 @@
         m_sheet->setTitle(value);
     } else if (name == scopedAttr && ContextFeatures::styleScopedEnabled(&document())) {
         scopedAttributeChanged(!value.isNull());
-    } else if (name == mediaAttr && inDocument() && document().renderer() && m_sheet) {
+    } else if (name == mediaAttr && inDocument() && document().isActive() && m_sheet) {
         m_sheet->setMediaQueries(MediaQuerySet::create(value));
         // FIXME: This shold be RecalcStyleDeferred.
         document().modifiedStyleSheet(m_sheet.get(), RecalcStyleImmediately);
@@ -256,7 +256,7 @@
 void HTMLStyleElement::dispatchPendingEvent(StyleEventSender* eventSender)
 {
     ASSERT_UNUSED(eventSender, eventSender == &styleLoadEventSender());
-    dispatchEvent(Event::create(m_loadedSheet ? eventNames().loadEvent : eventNames().errorEvent));
+    dispatchEvent(Event::create(m_loadedSheet ? EventTypeNames::load : EventTypeNames::error));
 }
 
 void HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources(bool errorOccurred)
diff --git a/Source/core/html/HTMLStyleElement.idl b/Source/core/html/HTMLStyleElement.idl
index a5fd4f3..55d12f2 100644
--- a/Source/core/html/HTMLStyleElement.idl
+++ b/Source/core/html/HTMLStyleElement.idl
@@ -20,9 +20,9 @@
 
 interface HTMLStyleElement : HTMLElement {
     attribute boolean disabled;
-    [EnabledAtRuntime=StyleScoped] attribute boolean scoped;
-    [Reflect] attribute DOMString media;
-    [Reflect] attribute DOMString type;
+    [RuntimeEnabled=StyleScoped] attribute boolean scoped;
+    [Reflect, TreatNullAs=NullString] attribute DOMString media;
+    [Reflect, TreatNullAs=NullString] attribute DOMString type;
 
     // DOM Level 2 Style
     readonly attribute StyleSheet sheet;
diff --git a/Source/core/html/HTMLSummaryElement.cpp b/Source/core/html/HTMLSummaryElement.cpp
index f15a72b..379b4a5 100644
--- a/Source/core/html/HTMLSummaryElement.cpp
+++ b/Source/core/html/HTMLSummaryElement.cpp
@@ -94,7 +94,7 @@
 void HTMLSummaryElement::defaultEventHandler(Event* event)
 {
     if (isMainSummary() && renderer()) {
-        if (event->type() == eventNames().DOMActivateEvent && !isClickableControl(event->target()->toNode())) {
+        if (event->type() == EventTypeNames::DOMActivate && !isClickableControl(event->target()->toNode())) {
             if (HTMLDetailsElement* details = detailsElement())
                 details->toggleOpen();
             event->setDefaultHandled();
@@ -102,12 +102,12 @@
         }
 
         if (event->isKeyboardEvent()) {
-            if (event->type() == eventNames().keydownEvent && toKeyboardEvent(event)->keyIdentifier() == "U+0020") {
+            if (event->type() == EventTypeNames::keydown && toKeyboardEvent(event)->keyIdentifier() == "U+0020") {
                 setActive(true, true);
                 // No setDefaultHandled() - IE dispatches a keypress in this case.
                 return;
             }
-            if (event->type() == eventNames().keypressEvent) {
+            if (event->type() == EventTypeNames::keypress) {
                 switch (toKeyboardEvent(event)->charCode()) {
                 case '\r':
                     dispatchSimulatedClick(event);
@@ -119,7 +119,7 @@
                     return;
                 }
             }
-            if (event->type() == eventNames().keyupEvent && toKeyboardEvent(event)->keyIdentifier() == "U+0020") {
+            if (event->type() == EventTypeNames::keyup && toKeyboardEvent(event)->keyIdentifier() == "U+0020") {
                 if (active())
                     dispatchSimulatedClick(event);
                 event->setDefaultHandled();
diff --git a/Source/core/html/HTMLTableCaptionElement.idl b/Source/core/html/HTMLTableCaptionElement.idl
index e29f097..b7b55d7 100644
--- a/Source/core/html/HTMLTableCaptionElement.idl
+++ b/Source/core/html/HTMLTableCaptionElement.idl
@@ -19,6 +19,6 @@
  */
 
 interface HTMLTableCaptionElement : HTMLElement {
-    [Reflect] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
 };
 
diff --git a/Source/core/html/HTMLTableCellElement.idl b/Source/core/html/HTMLTableCellElement.idl
index 3b949f3..a52f05c 100644
--- a/Source/core/html/HTMLTableCellElement.idl
+++ b/Source/core/html/HTMLTableCellElement.idl
@@ -20,19 +20,19 @@
 
 interface HTMLTableCellElement : HTMLElement {
     readonly attribute long cellIndex;
-    [Reflect] attribute DOMString abbr;
-    [Reflect] attribute DOMString align;
-    [Reflect] attribute DOMString axis;
-    [Reflect] attribute DOMString bgColor;
-    [Reflect=char] attribute DOMString ch;
-    [Reflect=charoff] attribute DOMString chOff;
+    [Reflect, TreatNullAs=NullString] attribute DOMString abbr;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString axis;
+    [Reflect, TreatNullAs=NullString] attribute DOMString bgColor;
+    [Reflect=char, TreatNullAs=NullString] attribute DOMString ch;
+    [Reflect=charoff, TreatNullAs=NullString] attribute DOMString chOff;
     attribute long colSpan;
-    [Reflect] attribute DOMString headers;
-    [Reflect] attribute DOMString height;
+    [Reflect, TreatNullAs=NullString] attribute DOMString headers;
+    [Reflect, TreatNullAs=NullString] attribute DOMString height;
     [Reflect] attribute boolean noWrap;
     attribute long rowSpan;
-    [Reflect] attribute DOMString scope;
-    [Reflect] attribute DOMString vAlign;
-    [Reflect] attribute DOMString width;
+    [Reflect, TreatNullAs=NullString] attribute DOMString scope;
+    [Reflect, TreatNullAs=NullString] attribute DOMString vAlign;
+    [Reflect, TreatNullAs=NullString] attribute DOMString width;
 };
 
diff --git a/Source/core/html/HTMLTableColElement.idl b/Source/core/html/HTMLTableColElement.idl
index 725e05d..748711f 100644
--- a/Source/core/html/HTMLTableColElement.idl
+++ b/Source/core/html/HTMLTableColElement.idl
@@ -19,11 +19,11 @@
  */
 
 interface HTMLTableColElement : HTMLElement {
-    [Reflect] attribute DOMString align;
-    [Reflect=char] attribute DOMString ch;
-    [Reflect=charoff] attribute DOMString chOff;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
+    [Reflect=char, TreatNullAs=NullString] attribute DOMString ch;
+    [Reflect=charoff, TreatNullAs=NullString] attribute DOMString chOff;
     attribute long span;
-    [Reflect] attribute DOMString vAlign;
-    [Reflect] attribute DOMString width;
+    [Reflect, TreatNullAs=NullString] attribute DOMString vAlign;
+    [Reflect, TreatNullAs=NullString] attribute DOMString width;
 };
 
diff --git a/Source/core/html/HTMLTableElement.idl b/Source/core/html/HTMLTableElement.idl
index 1881de3..cd247d6 100644
--- a/Source/core/html/HTMLTableElement.idl
+++ b/Source/core/html/HTMLTableElement.idl
@@ -25,17 +25,17 @@
 
     readonly attribute HTMLCollection rows;
     readonly attribute HTMLCollection tBodies;
-    [Reflect] attribute DOMString align;
-    [Reflect] attribute DOMString bgColor;
-    [Reflect] attribute DOMString border;
-    [Reflect] attribute DOMString cellPadding;
-    [Reflect] attribute DOMString cellSpacing;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString bgColor;
+    [Reflect, TreatNullAs=NullString] attribute DOMString border;
+    [Reflect, TreatNullAs=NullString] attribute DOMString cellPadding;
+    [Reflect, TreatNullAs=NullString] attribute DOMString cellSpacing;
 
-    [Reflect] attribute DOMString frame;
+    [Reflect, TreatNullAs=NullString] attribute DOMString frame;
 
-    [Reflect] attribute DOMString rules;
-    [Reflect] attribute DOMString summary;
-    [Reflect] attribute DOMString width;
+    [Reflect, TreatNullAs=NullString] attribute DOMString rules;
+    [Reflect, TreatNullAs=NullString] attribute DOMString summary;
+    [Reflect, TreatNullAs=NullString] attribute DOMString width;
 
     HTMLElement createTHead();
     void deleteTHead();
diff --git a/Source/core/html/HTMLTableRowElement.idl b/Source/core/html/HTMLTableRowElement.idl
index a56f70a..1b2d27d 100644
--- a/Source/core/html/HTMLTableRowElement.idl
+++ b/Source/core/html/HTMLTableRowElement.idl
@@ -22,11 +22,11 @@
     readonly attribute long rowIndex;
     readonly attribute long sectionRowIndex;
     readonly attribute HTMLCollection cells;
-    [Reflect] attribute DOMString align;
-    [Reflect] attribute DOMString bgColor;
-    [Reflect=char] attribute DOMString ch;
-    [Reflect=charoff] attribute DOMString chOff;
-    [Reflect] attribute DOMString vAlign;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
+    [Reflect, TreatNullAs=NullString] attribute DOMString bgColor;
+    [Reflect=char, TreatNullAs=NullString] attribute DOMString ch;
+    [Reflect=charoff, TreatNullAs=NullString] attribute DOMString chOff;
+    [Reflect, TreatNullAs=NullString] attribute DOMString vAlign;
     [RaisesException] HTMLElement insertCell([Default=Undefined] optional long index);
     [RaisesException] void deleteCell([Default=Undefined] optional long index);
 };
diff --git a/Source/core/html/HTMLTableRowsCollection.h b/Source/core/html/HTMLTableRowsCollection.h
index e92500e..d643d43 100644
--- a/Source/core/html/HTMLTableRowsCollection.h
+++ b/Source/core/html/HTMLTableRowsCollection.h
@@ -36,7 +36,7 @@
 class HTMLTableElement;
 class HTMLTableRowElement;
 
-class HTMLTableRowsCollection : public HTMLCollection {
+class HTMLTableRowsCollection FINAL : public HTMLCollection {
 public:
     static PassRefPtr<HTMLTableRowsCollection> create(Node*, CollectionType);
 
@@ -44,7 +44,7 @@
     static HTMLTableRowElement* lastRow(HTMLTableElement*);
 
 private:
-    HTMLTableRowsCollection(Node*);
+    explicit HTMLTableRowsCollection(Node*);
 
     virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE;
 };
diff --git a/Source/core/html/HTMLTableSectionElement.idl b/Source/core/html/HTMLTableSectionElement.idl
index 3126d77..c46e724 100644
--- a/Source/core/html/HTMLTableSectionElement.idl
+++ b/Source/core/html/HTMLTableSectionElement.idl
@@ -19,10 +19,10 @@
  */
 
 interface HTMLTableSectionElement : HTMLElement {
-    [Reflect] attribute DOMString align;
-    [Reflect=char] attribute DOMString ch;
-    [Reflect=charoff] attribute DOMString chOff;
-    [Reflect] attribute DOMString vAlign;
+    [Reflect, TreatNullAs=NullString] attribute DOMString align;
+    [Reflect=char, TreatNullAs=NullString] attribute DOMString ch;
+    [Reflect=charoff, TreatNullAs=NullString] attribute DOMString chOff;
+    [Reflect, TreatNullAs=NullString] attribute DOMString vAlign;
     readonly attribute HTMLCollection rows;
     [RaisesException] HTMLElement insertRow([Default=Undefined] optional long index);
     [RaisesException] void deleteRow([Default=Undefined] optional long index);
diff --git a/Source/core/html/HTMLTemplateElement.cpp b/Source/core/html/HTMLTemplateElement.cpp
index 52e614e..46e26e8 100644
--- a/Source/core/html/HTMLTemplateElement.cpp
+++ b/Source/core/html/HTMLTemplateElement.cpp
@@ -75,7 +75,7 @@
     return clone.release();
 }
 
-void HTMLTemplateElement::didMoveToNewDocument(Document* oldDocument)
+void HTMLTemplateElement::didMoveToNewDocument(Document& oldDocument)
 {
     HTMLElement::didMoveToNewDocument(oldDocument);
     if (!m_content)
diff --git a/Source/core/html/HTMLTemplateElement.h b/Source/core/html/HTMLTemplateElement.h
index 82a4846..883e85c 100644
--- a/Source/core/html/HTMLTemplateElement.h
+++ b/Source/core/html/HTMLTemplateElement.h
@@ -47,7 +47,7 @@
 
 private:
     virtual PassRefPtr<Node> cloneNode(bool deep = true) OVERRIDE;
-    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+    virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
 
     HTMLTemplateElement(const QualifiedName&, Document&);
 
diff --git a/Source/core/html/HTMLTextAreaElement.cpp b/Source/core/html/HTMLTextAreaElement.cpp
index 35486bf..3f3274e 100644
--- a/Source/core/html/HTMLTextAreaElement.cpp
+++ b/Source/core/html/HTMLTextAreaElement.cpp
@@ -30,24 +30,23 @@
 #include "HTMLNames.h"
 #include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/events/BeforeTextInsertedEvent.h"
 #include "core/dom/Document.h"
-#include "core/events/Event.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/Text.h"
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/TextIterator.h"
-#include "core/html/FormDataList.h"
+#include "core/events/BeforeTextInsertedEvent.h"
+#include "core/events/Event.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/forms/FormController.h"
 #include "core/html/shadow/ShadowElementNames.h"
 #include "core/html/shadow/TextControlInnerElements.h"
-#include "core/page/Frame.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "core/frame/Frame.h"
+#include "core/platform/network/FormDataList.h"
 #include "core/rendering/RenderTextControlMultiLine.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/text/StringBuilder.h"
 
@@ -223,7 +222,7 @@
     return true;
 }
 
-void HTMLTextAreaElement::reset()
+void HTMLTextAreaElement::resetImpl()
 {
     setNonDirtyValue(defaultValue());
 }
@@ -260,7 +259,7 @@
 
 void HTMLTextAreaElement::defaultEventHandler(Event* event)
 {
-    if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->hasInterface(eventNames().interfaceForWheelEvent) || event->type() == eventNames().blurEvent))
+    if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->hasInterface(EventNames::WheelEvent) || event->type() == EventTypeNames::blur))
         forwardEvent(event);
     else if (renderer() && event->isBeforeTextInsertedEvent())
         handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(event));
diff --git a/Source/core/html/HTMLTextAreaElement.h b/Source/core/html/HTMLTextAreaElement.h
index 7a35eb6..b2f6738 100644
--- a/Source/core/html/HTMLTextAreaElement.h
+++ b/Source/core/html/HTMLTextAreaElement.h
@@ -105,7 +105,7 @@
     virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
     virtual RenderObject* createRenderer(RenderStyle*);
     virtual bool appendFormData(FormDataList&, bool);
-    virtual void reset();
+    virtual void resetImpl() OVERRIDE;
     virtual bool hasCustomFocusLogic() const OVERRIDE;
     virtual bool shouldShowFocusRingOnMouseFocus() const OVERRIDE;
     virtual bool isKeyboardFocusable() const OVERRIDE;
diff --git a/Source/core/html/HTMLTextAreaElement.idl b/Source/core/html/HTMLTextAreaElement.idl
index 51c8419..fc3b1ff 100644
--- a/Source/core/html/HTMLTextAreaElement.idl
+++ b/Source/core/html/HTMLTextAreaElement.idl
@@ -22,17 +22,17 @@
 interface HTMLTextAreaElement : HTMLElement {
     [Reflect] attribute boolean autofocus;
     attribute long cols;
-    [Reflect] attribute DOMString dirName;
+    [Reflect, TreatNullAs=NullString] attribute DOMString dirName;
     [Reflect] attribute boolean disabled;
     readonly attribute HTMLFormElement form;
     [SetterRaisesException] attribute long maxLength;
-    [Reflect] attribute DOMString name;
-    [Reflect] attribute DOMString placeholder;
+    [Reflect, TreatNullAs=NullString] attribute DOMString name;
+    [Reflect, TreatNullAs=NullString] attribute DOMString placeholder;
     [Reflect] attribute boolean readOnly;
     [Reflect] attribute boolean required;
     attribute long rows;
-    [Reflect] attribute DOMString wrap;
-    [EnabledAtRuntime=InputModeAttribute, Reflect] attribute DOMString inputMode;
+    [Reflect, TreatNullAs=NullString] attribute DOMString wrap;
+    [RuntimeEnabled=InputModeAttribute, Reflect, TreatNullAs=NullString] attribute DOMString inputMode;
 
     readonly attribute DOMString type;
     [TreatNullAs=NullString] attribute DOMString defaultValue;
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp
index 40ef6c6..e8d07be 100644
--- a/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/Source/core/html/HTMLTextFormControlElement.cpp
@@ -30,16 +30,16 @@
 #include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Document.h"
-#include "core/events/Event.h"
-#include "core/events/EventNames.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Text.h"
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/TextIterator.h"
+#include "core/events/Event.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLBRElement.h"
 #include "core/html/shadow/ShadowElementNames.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/UseCounter.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/RenderTheme.h"
@@ -91,7 +91,7 @@
 
 void HTMLTextFormControlElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().webkitEditableContentChangedEvent && renderer() && renderer()->isTextControl()) {
+    if (event->type() == EventTypeNames::webkitEditableContentChanged && renderer() && renderer()->isTextControl()) {
         m_lastChangeWasUserEdit = true;
         subtreeHasChanged();
         return;
@@ -102,7 +102,7 @@
 
 void HTMLTextFormControlElement::forwardEvent(Event* event)
 {
-    if (event->type() == eventNames().blurEvent || event->type() == eventNames().focusEvent)
+    if (event->type() == EventTypeNames::blur || event->type() == EventTypeNames::focus)
         return;
     innerTextElement()->defaultEventHandler(event);
 }
@@ -482,7 +482,7 @@
 
     if (Frame* frame = document().frame()) {
         if (frame->selection().isRange() && userTriggered)
-            dispatchEvent(Event::createBubble(eventNames().selectEvent));
+            dispatchEvent(Event::createBubble(EventTypeNames::select));
     }
 }
 
@@ -490,7 +490,7 @@
 {
     if (name == placeholderAttr) {
         updatePlaceholderVisibility(true);
-        UseCounter::count(&document(), UseCounter::PlaceholderAttribute);
+        UseCounter::count(document(), UseCounter::PlaceholderAttribute);
     } else
         HTMLFormControlElementWithState::parseAttribute(name, value);
 }
diff --git a/Source/core/html/HTMLTrackElement.cpp b/Source/core/html/HTMLTrackElement.cpp
index 2a7e716..02c8751 100644
--- a/Source/core/html/HTMLTrackElement.cpp
+++ b/Source/core/html/HTMLTrackElement.cpp
@@ -30,9 +30,9 @@
 #include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/events/Event.h"
 #include "core/html/HTMLMediaElement.h"
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "RuntimeEnabledFeatures.h"
-#include "core/platform/Logging.h"
+#include "platform/Logging.h"
 
 using namespace std;
 
@@ -274,7 +274,7 @@
 
     if (status == Failure) {
         setReadyState(HTMLTrackElement::TRACK_ERROR);
-        dispatchEvent(Event::create(eventNames().errorEvent), IGNORE_EXCEPTION);
+        dispatchEvent(Event::create(EventTypeNames::error), IGNORE_EXCEPTION);
         return;
     }
 
@@ -285,7 +285,7 @@
 
     //     2. If the file was successfully processed, fire a simple event named load at the
     //        track element.
-    dispatchEvent(Event::create(eventNames().loadEvent), IGNORE_EXCEPTION);
+    dispatchEvent(Event::create(EventTypeNames::load), IGNORE_EXCEPTION);
 }
 
 // NOTE: The values in the TextTrack::ReadinessState enum must stay in sync with those in HTMLTrackElement::ReadyState.
diff --git a/Source/core/html/HTMLTrackElement.idl b/Source/core/html/HTMLTrackElement.idl
index 9c4e1bf..6a0b1c7 100644
--- a/Source/core/html/HTMLTrackElement.idl
+++ b/Source/core/html/HTMLTrackElement.idl
@@ -24,10 +24,10 @@
  */
 
 [
-    EnabledAtRuntime=VideoTrack
+    RuntimeEnabled=VideoTrack
 ] interface HTMLTrackElement : HTMLElement {
     attribute DOMString kind;
-    [Reflect, URL] attribute DOMString src;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString src;
     attribute DOMString srclang;
     attribute DOMString label;
     [Reflect] attribute boolean default;
diff --git a/Source/core/html/HTMLUListElement.idl b/Source/core/html/HTMLUListElement.idl
index e40350d..1dc6b6d 100644
--- a/Source/core/html/HTMLUListElement.idl
+++ b/Source/core/html/HTMLUListElement.idl
@@ -19,6 +19,6 @@
 
 interface HTMLUListElement : HTMLElement {
     [Reflect] attribute boolean compact;
-    [Reflect] attribute DOMString type;
+    [Reflect, TreatNullAs=NullString] attribute DOMString type;
 };
 
diff --git a/Source/core/html/HTMLVideoElement.cpp b/Source/core/html/HTMLVideoElement.cpp
index 9b895cc..5bea976 100644
--- a/Source/core/html/HTMLVideoElement.cpp
+++ b/Source/core/html/HTMLVideoElement.cpp
@@ -29,7 +29,6 @@
 #include "CSSPropertyNames.h"
 #include "HTMLNames.h"
 #include "bindings/v8/ExceptionState.h"
-#include "bindings/v8/ScriptController.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
@@ -38,6 +37,7 @@
 #include "core/page/Settings.h"
 #include "core/rendering/RenderImage.h"
 #include "core/rendering/RenderVideo.h"
+#include "platform/UserGestureIndicator.h"
 
 namespace WebCore {
 
@@ -226,7 +226,7 @@
 
     // Generate an exception if this isn't called in response to a user gesture, or if the
     // element does not support fullscreen.
-    if ((userGestureRequiredForFullscreen() && !ScriptController::processingUserGesture()) || !supportsFullscreen()) {
+    if ((userGestureRequiredForFullscreen() && !UserGestureIndicator::processingUserGesture()) || !supportsFullscreen()) {
         es.throwUninformativeAndGenericDOMException(InvalidStateError);
         return;
     }
@@ -250,7 +250,7 @@
     return isFullscreen();
 }
 
-void HTMLVideoElement::didMoveToNewDocument(Document* oldDocument)
+void HTMLVideoElement::didMoveToNewDocument(Document& oldDocument)
 {
     if (m_imageLoader)
         m_imageLoader->elementDidMoveToNewDocument();
diff --git a/Source/core/html/HTMLVideoElement.h b/Source/core/html/HTMLVideoElement.h
index c939330..f9537c8 100644
--- a/Source/core/html/HTMLVideoElement.h
+++ b/Source/core/html/HTMLVideoElement.h
@@ -87,7 +87,7 @@
 
     virtual bool hasAvailableVideoFrame() const;
     virtual void updateDisplayState();
-    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+    virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
     virtual void setDisplayMode(DisplayMode);
 
     OwnPtr<HTMLImageLoader> m_imageLoader;
diff --git a/Source/core/html/HTMLVideoElement.idl b/Source/core/html/HTMLVideoElement.idl
index 2b2ab0d..01e7df3 100644
--- a/Source/core/html/HTMLVideoElement.idl
+++ b/Source/core/html/HTMLVideoElement.idl
@@ -24,22 +24,22 @@
  */
 
 [
-    EnabledAtRuntime=Media
+    RuntimeEnabled=Media
 ] interface HTMLVideoElement : HTMLMediaElement {
     [Reflect] attribute unsigned long width;
     [Reflect] attribute unsigned long height;
     readonly attribute unsigned long videoWidth;
     readonly attribute unsigned long videoHeight;
-    [Reflect, URL] attribute DOMString poster;
+    [Reflect, TreatNullAs=NullString, URL] attribute DOMString poster;
 
     readonly attribute boolean webkitSupportsFullscreen;
     readonly attribute boolean webkitDisplayingFullscreen;
 
-    [RaisesException, PerWorldBindings, ActivityLog=Access] void webkitEnterFullscreen();
+    [RaisesException, PerWorldBindings, ActivityLogging=Access] void webkitEnterFullscreen();
     void webkitExitFullscreen();
 
     // Note the different capitalization of the "S" in FullScreen.
-    [RaisesException, PerWorldBindings, ActivityLog=Access] void webkitEnterFullScreen();
+    [RaisesException, PerWorldBindings, ActivityLogging=Access] void webkitEnterFullScreen();
     void webkitExitFullScreen();
 
     // The number of frames that have been decoded and made available for
diff --git a/Source/core/html/ImageData.h b/Source/core/html/ImageData.h
index 0032ebb..5015885 100644
--- a/Source/core/html/ImageData.h
+++ b/Source/core/html/ImageData.h
@@ -30,7 +30,7 @@
 #define ImageData_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Uint8ClampedArray.h"
diff --git a/Source/core/html/ImageDocument.cpp b/Source/core/html/ImageDocument.cpp
index ce7d501..326fdd2 100644
--- a/Source/core/html/ImageDocument.cpp
+++ b/Source/core/html/ImageDocument.cpp
@@ -27,10 +27,10 @@
 
 #include "HTMLNames.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
-#include "core/events/MouseEvent.h"
 #include "core/dom/RawDataDocumentParser.h"
+#include "core/events/EventListener.h"
+#include "core/events/MouseEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/fetch/ImageResource.h"
 #include "core/html/HTMLBodyElement.h"
 #include "core/html/HTMLHeadElement.h"
@@ -40,11 +40,11 @@
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/LocalizedStrings.h"
+#include "wtf/text/StringBuilder.h"
 
 using std::min;
 
@@ -71,7 +71,7 @@
     {
     }
 
-    virtual void handleEvent(ScriptExecutionContext*, Event*);
+    virtual void handleEvent(ExecutionContext*, Event*);
 
     ImageDocument* m_doc;
 };
@@ -106,6 +106,20 @@
     return frame ? frame->pageZoomFactor() : 1;
 }
 
+static String imageTitle(const String& filename, const IntSize& size)
+{
+    StringBuilder result;
+    result.append(filename);
+    result.append(" (");
+    // FIXME: Localize numbers. Safari/OSX shows localized numbers with group
+    // separaters. For example, "1,920x1,080".
+    result.append(String::number(size.width()));
+    result.append(static_cast<UChar>(0xD7)); // U+00D7 (multiplication sign)
+    result.append(String::number(size.height()));
+    result.append(')');
+    return result.toString();
+}
+
 size_t ImageDocumentParser::appendBytes(const char* data, size_t length)
 {
     if (!length)
@@ -202,7 +216,7 @@
 
 float ImageDocument::scale() const
 {
-    if (!m_imageElement || &m_imageElement->document() != this)
+    if (!m_imageElement || m_imageElement->document() != this)
         return 1.0f;
 
     FrameView* view = frame()->view();
@@ -220,7 +234,7 @@
 
 void ImageDocument::resizeImageToFit()
 {
-    if (!m_imageElement || &m_imageElement->document() != this || pageZoomFactor(this) > 1)
+    if (!m_imageElement || m_imageElement->document() != this || pageZoomFactor(this) > 1)
         return;
 
     LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m_imageElement->renderer(), pageZoomFactor(this));
@@ -275,7 +289,7 @@
 
 void ImageDocument::restoreImageSize()
 {
-    if (!m_imageElement || !m_imageSizeIsKnown || &m_imageElement->document() != this || pageZoomFactor(this) < 1)
+    if (!m_imageElement || !m_imageSizeIsKnown || m_imageElement->document() != this || pageZoomFactor(this) < 1)
         return;
 
     LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m_imageElement->renderer(), 1.0f);
@@ -292,7 +306,7 @@
 
 bool ImageDocument::imageFitsInWindow() const
 {
-    if (!m_imageElement || &m_imageElement->document() != this)
+    if (!m_imageElement || m_imageElement->document() != this)
         return true;
 
     FrameView* view = frame()->view();
@@ -307,7 +321,7 @@
 
 void ImageDocument::windowSizeChanged()
 {
-    if (!m_imageElement || !m_imageSizeIsKnown || &m_imageElement->document() != this)
+    if (!m_imageElement || !m_imageSizeIsKnown || m_imageElement->document() != this)
         return;
 
     bool fitsInWindow = imageFitsInWindow();
@@ -348,7 +362,7 @@
 
 bool ImageDocument::shouldShrinkToFit() const
 {
-    return frame()->page()->settings().shrinksStandaloneImagesToFit() && frame()->page()->mainFrame() == frame();
+    return frame()->settings()->shrinksStandaloneImagesToFit() && frame()->page()->mainFrame() == frame();
 }
 
 void ImageDocument::dispose()
@@ -359,11 +373,11 @@
 
 // --------
 
-void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event)
+void ImageEventListener::handleEvent(ExecutionContext*, Event* event)
 {
-    if (event->type() == eventNames().resizeEvent)
+    if (event->type() == EventTypeNames::resize)
         m_doc->windowSizeChanged();
-    else if (event->type() == eventNames().clickEvent && event->isMouseEvent()) {
+    else if (event->type() == EventTypeNames::click && event->isMouseEvent()) {
         MouseEvent* mouseEvent = toMouseEvent(event);
         m_doc->imageClicked(mouseEvent->x(), mouseEvent->y());
     }
diff --git a/Source/core/html/LabelsNodeList.cpp b/Source/core/html/LabelsNodeList.cpp
index a822c47..a3a6579 100644
--- a/Source/core/html/LabelsNodeList.cpp
+++ b/Source/core/html/LabelsNodeList.cpp
@@ -33,8 +33,8 @@
 
 using namespace HTMLNames;
 
-LabelsNodeList::LabelsNodeList(Node* forNode)
-    : LiveNodeList(forNode, LabelsNodeListType, InvalidateOnForAttrChange, NodeListIsRootedAtDocument)
+LabelsNodeList::LabelsNodeList(Node* ownerNode)
+    : LiveNodeList(ownerNode, LabelsNodeListType, InvalidateOnForAttrChange, NodeListIsRootedAtDocument)
 {
 }
 
diff --git a/Source/core/html/LabelsNodeList.h b/Source/core/html/LabelsNodeList.h
index 83339a4..0e5b125 100644
--- a/Source/core/html/LabelsNodeList.h
+++ b/Source/core/html/LabelsNodeList.h
@@ -30,17 +30,18 @@
 
 namespace WebCore {
 
-class LabelsNodeList : public LiveNodeList {
+class LabelsNodeList FINAL : public LiveNodeList {
 public:
-    static PassRefPtr<LabelsNodeList> create(Node* forNode, CollectionType type, const AtomicString&)
+    static PassRefPtr<LabelsNodeList> create(Node* ownerNode, CollectionType type, const AtomicString&)
     {
         ASSERT_UNUSED(type, type == LabelsNodeListType);
-        return adoptRef(new LabelsNodeList(forNode));
+        return adoptRef(new LabelsNodeList(ownerNode));
     }
-    ~LabelsNodeList();
+
+    virtual ~LabelsNodeList();
 
 protected:
-    LabelsNodeList(Node* forNode);
+    explicit LabelsNodeList(Node*);
 
     virtual bool nodeMatches(Element*) const;
 };
diff --git a/Source/core/html/LinkRelAttributeTest.cpp b/Source/core/html/LinkRelAttributeTest.cpp
new file mode 100644
index 0000000..a395a4d
--- /dev/null
+++ b/Source/core/html/LinkRelAttributeTest.cpp
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/html/LinkRelAttribute.h"
+
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+
+namespace {
+
+static inline void testLinkRelAttribute(String value, bool isStyleSheet, IconType iconType, bool isAlternate, bool isDNSPrefetch, bool isLinkSubresource, bool isLinkPrerender, bool isImport = false)
+{
+    LinkRelAttribute linkRelAttribute(value);
+    ASSERT_EQ(isStyleSheet, linkRelAttribute.isStyleSheet()) << value.utf8().data();
+    ASSERT_EQ(iconType, linkRelAttribute.iconType()) << value.utf8().data();
+    ASSERT_EQ(isAlternate, linkRelAttribute.isAlternate()) << value.utf8().data();
+    ASSERT_EQ(isDNSPrefetch, linkRelAttribute.isDNSPrefetch()) << value.utf8().data();
+    ASSERT_EQ(isLinkSubresource, linkRelAttribute.isLinkSubresource()) << value.utf8().data();
+    ASSERT_EQ(isLinkPrerender, linkRelAttribute.isLinkPrerender()) << value.utf8().data();
+    ASSERT_EQ(isImport, linkRelAttribute.isImport()) << value.utf8().data();
+}
+
+TEST(CoreLinkRelAttribute, Constructor)
+{
+    testLinkRelAttribute("stylesheet", true, InvalidIcon, false, false, false, false);
+    testLinkRelAttribute("sTyLeShEeT", true, InvalidIcon, false, false, false, false);
+
+    testLinkRelAttribute("icon", false, Favicon, false, false, false, false);
+    testLinkRelAttribute("iCoN", false, Favicon, false, false, false, false);
+    testLinkRelAttribute("shortcut icon", false, Favicon, false, false, false, false);
+    testLinkRelAttribute("sHoRtCuT iCoN", false, Favicon, false, false, false, false);
+
+#if ENABLE(TOUCH_ICON_LOADING)
+    testLinkRelAttribute("apple-touch-icon", false, TouchIcon, false, false, false, false);
+    testLinkRelAttribute("aPpLe-tOuCh-IcOn", false, TouchIcon, false, false, false, false);
+
+    testLinkRelAttribute("apple-touch-icon-precomposed", false, TouchPrecomposedIcon, false, false, false, false);
+    testLinkRelAttribute("aPpLe-tOuCh-IcOn-pReCoMpOsEd", false, TouchPrecomposedIcon, false, false, false, false);
+#endif
+
+    testLinkRelAttribute("dns-prefetch", false, InvalidIcon, false, true, false, false);
+    testLinkRelAttribute("dNs-pReFeTcH", false, InvalidIcon, false, true, false, false);
+
+    testLinkRelAttribute("alternate stylesheet", true, InvalidIcon, true, false, false, false);
+    testLinkRelAttribute("stylesheet alternate", true, InvalidIcon, true, false, false, false);
+    testLinkRelAttribute("aLtErNaTe sTyLeShEeT", true, InvalidIcon, true, false, false, false);
+    testLinkRelAttribute("sTyLeShEeT aLtErNaTe", true, InvalidIcon, true, false, false, false);
+
+    testLinkRelAttribute("stylesheet icon prerender aLtErNaTe", true, Favicon, true, false, false, true);
+    testLinkRelAttribute("alternate subresource", false, InvalidIcon, true, false, true, false);
+    testLinkRelAttribute("alternate icon stylesheet", true, Favicon, true, false, false, false);
+
+    testLinkRelAttribute("import", false, InvalidIcon, false, false, false, false, true);
+    // "import" is mutually exclusive and "stylesheet" wins when they conflict.
+    testLinkRelAttribute("stylesheet import", true, InvalidIcon, false, false, false, false, false);
+}
+
+} // namespace
diff --git a/Source/core/html/MediaController.cpp b/Source/core/html/MediaController.cpp
index 82f565c..5d26a40 100644
--- a/Source/core/html/MediaController.cpp
+++ b/Source/core/html/MediaController.cpp
@@ -39,12 +39,12 @@
 using namespace WebCore;
 using namespace std;
 
-PassRefPtr<MediaController> MediaController::create(ScriptExecutionContext* context)
+PassRefPtr<MediaController> MediaController::create(ExecutionContext* context)
 {
     return adoptRef(new MediaController(context));
 }
 
-MediaController::MediaController(ScriptExecutionContext* context)
+MediaController::MediaController(ExecutionContext* context)
     : m_paused(false)
     , m_defaultPlaybackRate(1)
     , m_volume(1)
@@ -56,7 +56,7 @@
     , m_clearPositionTimer(this, &MediaController::clearPositionTimerFired)
     , m_closedCaptionsVisible(false)
     , m_clock(Clock::create())
-    , m_scriptExecutionContext(context)
+    , m_executionContext(context)
     , m_timeupdateTimer(this, &MediaController::timeupdateTimerFired)
     , m_previousTimeupdateTime(0)
 {
@@ -188,7 +188,7 @@
     // the user agent must change the MediaController into a playing media controller,
     m_paused = false;
     // queue a task to fire a simple event named play at the MediaController,
-    scheduleEvent(eventNames().playEvent);
+    scheduleEvent(EventTypeNames::play);
     // and then report the controller state of the MediaController.
     reportControllerState();
 }
@@ -213,7 +213,7 @@
     // then the user agent must change the MediaController into a paused media controller,
     m_paused = true;
     // queue a task to fire a simple event named pause at the MediaController,
-    scheduleEvent(eventNames().pauseEvent);
+    scheduleEvent(EventTypeNames::pause);
     // and then report the controller state of the MediaController.
     reportControllerState();
 }
@@ -228,7 +228,7 @@
     m_defaultPlaybackRate = rate;
 
     // then queue a task to fire a simple event named ratechange at the MediaController.
-    scheduleEvent(eventNames().ratechangeEvent);
+    scheduleEvent(EventTypeNames::ratechange);
 }
 
 double MediaController::playbackRate() const
@@ -249,7 +249,7 @@
         m_mediaElements[index]->updatePlaybackRate();
 
     // then queue a task to fire a simple event named ratechange at the MediaController.
-    scheduleEvent(eventNames().ratechangeEvent);
+    scheduleEvent(EventTypeNames::ratechange);
 }
 
 void MediaController::setVolume(double level, ExceptionState& es)
@@ -269,7 +269,7 @@
     m_volume = level;
 
     // and queue a task to fire a simple event named volumechange at the MediaController.
-    scheduleEvent(eventNames().volumechangeEvent);
+    scheduleEvent(EventTypeNames::volumechange);
 
     for (size_t index = 0; index < m_mediaElements.size(); ++index)
         m_mediaElements[index]->updateVolume();
@@ -285,7 +285,7 @@
     m_muted = flag;
 
     // and queue a task to fire a simple event named volumechange at the MediaController.
-    scheduleEvent(eventNames().volumechangeEvent);
+    scheduleEvent(EventTypeNames::volumechange);
 
     for (size_t index = 0; index < m_mediaElements.size(); ++index)
         m_mediaElements[index]->updateVolume();
@@ -334,15 +334,15 @@
 {
     switch (state) {
     case MediaControllerInterface::HAVE_NOTHING:
-        return eventNames().emptiedEvent;
+        return EventTypeNames::emptied;
     case MediaControllerInterface::HAVE_METADATA:
-        return eventNames().loadedmetadataEvent;
+        return EventTypeNames::loadedmetadata;
     case MediaControllerInterface::HAVE_CURRENT_DATA:
-        return eventNames().loadeddataEvent;
+        return EventTypeNames::loadeddata;
     case MediaControllerInterface::HAVE_FUTURE_DATA:
-        return eventNames().canplayEvent;
+        return EventTypeNames::canplay;
     case MediaControllerInterface::HAVE_ENOUGH_DATA:
-        return eventNames().canplaythroughEvent;
+        return EventTypeNames::canplaythrough;
     default:
         ASSERT_NOT_REACHED();
         return nullAtom;
@@ -433,7 +433,7 @@
             m_paused = true;
 
             // and then fires a simple event named pause at the MediaController object.
-            scheduleEvent(eventNames().pauseEvent);
+            scheduleEvent(EventTypeNames::pause);
         }
     }
 
@@ -443,17 +443,17 @@
     AtomicString eventName;
     switch (newPlaybackState) {
     case WAITING:
-        eventName = eventNames().waitingEvent;
+        eventName = EventTypeNames::waiting;
         m_clock->stop();
         m_timeupdateTimer.stop();
         break;
     case ENDED:
-        eventName = eventNames().endedEvent;
+        eventName = EventTypeNames::ended;
         m_clock->stop();
         m_timeupdateTimer.stop();
         break;
     case PLAYING:
-        eventName = eventNames().playingEvent;
+        eventName = EventTypeNames::playing;
         m_clock->start();
         startTimeupdateTimer();
         break;
@@ -629,7 +629,7 @@
 
 const AtomicString& MediaController::interfaceName() const
 {
-    return eventNames().interfaceForMediaController;
+    return EventTargetNames::MediaController;
 }
 
 // The spec says to fire periodic timeupdate events (those sent while playing) every
@@ -657,6 +657,6 @@
     if (timedelta < maxTimeupdateEventFrequency)
         return;
 
-    scheduleEvent(eventNames().timeupdateEvent);
+    scheduleEvent(EventTypeNames::timeupdate);
     m_previousTimeupdateTime = now;
 }
diff --git a/Source/core/html/MediaController.h b/Source/core/html/MediaController.h
index c34b594..5379ab4 100644
--- a/Source/core/html/MediaController.h
+++ b/Source/core/html/MediaController.h
@@ -30,7 +30,7 @@
 #include "core/events/Event.h"
 #include "core/events/EventTarget.h"
 #include "core/html/MediaControllerInterface.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/Vector.h"
@@ -41,11 +41,11 @@
 class Event;
 class ExceptionState;
 class HTMLMediaElement;
-class ScriptExecutionContext;
+class ExecutionContext;
 
-class MediaController : public RefCounted<MediaController>, public ScriptWrappable, public MediaControllerInterface, public EventTarget {
+class MediaController : public RefCounted<MediaController>, public ScriptWrappable, public MediaControllerInterface, public EventTargetWithInlineData {
 public:
-    static PassRefPtr<MediaController> create(ScriptExecutionContext*);
+    static PassRefPtr<MediaController> create(ExecutionContext*);
     virtual ~MediaController();
 
     void addMediaElement(HTMLMediaElement*);
@@ -103,12 +103,14 @@
 
     bool isBlocked() const;
 
+    void clearExecutionContext() { m_executionContext = 0; }
+
     // EventTarget
     using RefCounted<MediaController>::ref;
     using RefCounted<MediaController>::deref;
 
 private:
-    MediaController(ScriptExecutionContext*);
+    MediaController(ExecutionContext*);
     void reportControllerState();
     void updateReadyState();
     void updatePlaybackState();
@@ -123,13 +125,10 @@
     void startTimeupdateTimer();
 
     // EventTarget
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
-    virtual const AtomicString& interfaceName() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; };
-    virtual EventTargetData* eventTargetData() { return &m_eventTargetData; }
-    virtual EventTargetData* ensureEventTargetData() { return &m_eventTargetData; }
-    EventTargetData m_eventTargetData;
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE { return m_executionContext; }
 
     friend class HTMLMediaElement;
     friend class MediaControllerEventListener;
@@ -146,8 +145,8 @@
     mutable Timer<MediaController> m_clearPositionTimer;
     String m_mediaGroup;
     bool m_closedCaptionsVisible;
-    PassRefPtr<Clock> m_clock;
-    ScriptExecutionContext* m_scriptExecutionContext;
+    OwnPtr<Clock> m_clock;
+    ExecutionContext* m_executionContext;
     Timer<MediaController> m_timeupdateTimer;
     double m_previousTimeupdateTime;
 };
diff --git a/Source/core/html/MediaController.idl b/Source/core/html/MediaController.idl
index 81171ec..254bbc2 100644
--- a/Source/core/html/MediaController.idl
+++ b/Source/core/html/MediaController.idl
@@ -24,9 +24,9 @@
  */
 
 [
-    EnabledAtRuntime=Media,
+    RuntimeEnabled=Media,
     Constructor,
-    ConstructorCallWith=ScriptExecutionContext
+    ConstructorCallWith=ExecutionContext
 ] interface MediaController : EventTarget {
     readonly attribute TimeRanges buffered;
     readonly attribute TimeRanges seekable;
diff --git a/Source/core/html/MediaDocument.cpp b/Source/core/html/MediaDocument.cpp
index 393dcbe..8468527 100644
--- a/Source/core/html/MediaDocument.cpp
+++ b/Source/core/html/MediaDocument.cpp
@@ -29,10 +29,10 @@
 
 #include "HTMLNames.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/events/EventNames.h"
-#include "core/events/KeyboardEvent.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/RawDataDocumentParser.h"
+#include "core/events/KeyboardEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLBodyElement.h"
 #include "core/html/HTMLHeadElement.h"
 #include "core/html/HTMLHtmlElement.h"
@@ -41,7 +41,7 @@
 #include "core/html/HTMLVideoElement.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/platform/chromium/KeyboardCodes.h"
 
 namespace WebCore {
@@ -148,7 +148,7 @@
     if (!targetNode)
         return;
 
-    if (event->type() == eventNames().keydownEvent && event->isKeyboardEvent()) {
+    if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) {
         HTMLVideoElement* video = descendentVideoElement(targetNode);
         if (!video)
             return;
diff --git a/Source/core/html/MediaError.idl b/Source/core/html/MediaError.idl
index 376159d..0b6d3a0 100644
--- a/Source/core/html/MediaError.idl
+++ b/Source/core/html/MediaError.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=Media
+    RuntimeEnabled=Media
 ] interface MediaError {
       const unsigned short MEDIA_ERR_ABORTED = 1;
       const unsigned short MEDIA_ERR_NETWORK = 2;
diff --git a/Source/core/html/MediaKeyError.idl b/Source/core/html/MediaKeyError.idl
index ea442f8..58fddc8 100644
--- a/Source/core/html/MediaKeyError.idl
+++ b/Source/core/html/MediaKeyError.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=EncryptedMediaAnyVersion
+    RuntimeEnabled=EncryptedMediaAnyVersion
 ] interface MediaKeyError {
     const unsigned short MEDIA_KEYERR_UNKNOWN = 1;
     const unsigned short MEDIA_KEYERR_CLIENT = 2;
@@ -33,5 +33,5 @@
     const unsigned short MEDIA_KEYERR_HARDWARECHANGE = 5;
     const unsigned short MEDIA_KEYERR_DOMAIN = 6;
     readonly attribute unsigned short code;
-    [Conditional=ENCRYPTED_MEDIA_V2, EnabledAtRuntime=EncryptedMedia] readonly attribute unsigned long systemCode;
+    [Conditional=ENCRYPTED_MEDIA_V2, RuntimeEnabled=EncryptedMedia] readonly attribute unsigned long systemCode;
 };
diff --git a/Source/core/html/MediaKeyEvent.cpp b/Source/core/html/MediaKeyEvent.cpp
index bd987ee..38f02b7 100644
--- a/Source/core/html/MediaKeyEvent.cpp
+++ b/Source/core/html/MediaKeyEvent.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/html/MediaKeyEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "wtf/Uint8Array.h"
 
 namespace WebCore {
@@ -60,7 +60,7 @@
 
 const AtomicString& MediaKeyEvent::interfaceName() const
 {
-    return eventNames().interfaceForMediaKeyEvent;
+    return EventNames::MediaKeyEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/html/MediaKeyEvent.idl b/Source/core/html/MediaKeyEvent.idl
index 9586e06..c1e08c2 100644
--- a/Source/core/html/MediaKeyEvent.idl
+++ b/Source/core/html/MediaKeyEvent.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=PrefixedEncryptedMedia,
+    RuntimeEnabled=PrefixedEncryptedMedia,
     ConstructorTemplate=Event
 ] interface MediaKeyEvent : Event {
     [InitializedByEventConstructor] readonly attribute DOMString keySystem;
diff --git a/Source/core/html/PluginDocument.cpp b/Source/core/html/PluginDocument.cpp
index 2f8ae7e..04511b5 100644
--- a/Source/core/html/PluginDocument.cpp
+++ b/Source/core/html/PluginDocument.cpp
@@ -34,8 +34,8 @@
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/plugins/PluginView.h"
 #include "core/rendering/RenderEmbeddedObject.h"
 
diff --git a/Source/core/html/PublicURLManager.cpp b/Source/core/html/PublicURLManager.cpp
index 0135038..77d8da9 100644
--- a/Source/core/html/PublicURLManager.cpp
+++ b/Source/core/html/PublicURLManager.cpp
@@ -33,14 +33,14 @@
 
 namespace WebCore {
 
-PassOwnPtr<PublicURLManager> PublicURLManager::create(ScriptExecutionContext* context)
+PassOwnPtr<PublicURLManager> PublicURLManager::create(ExecutionContext* context)
 {
     OwnPtr<PublicURLManager> publicURLManager(adoptPtr(new PublicURLManager(context)));
     publicURLManager->suspendIfNeeded();
     return publicURLManager.release();
 }
 
-PublicURLManager::PublicURLManager(ScriptExecutionContext* context)
+PublicURLManager::PublicURLManager(ExecutionContext* context)
     : ActiveDOMObject(context)
     , m_isStopped(false)
 {
diff --git a/Source/core/html/PublicURLManager.h b/Source/core/html/PublicURLManager.h
index 7b9f2f7..0884877 100644
--- a/Source/core/html/PublicURLManager.h
+++ b/Source/core/html/PublicURLManager.h
@@ -35,7 +35,7 @@
 namespace WebCore {
 
 class KURL;
-class ScriptExecutionContext;
+class ExecutionContext;
 class SecurityOrigin;
 class URLRegistry;
 class URLRegistrable;
@@ -43,7 +43,7 @@
 class PublicURLManager : public ActiveDOMObject {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<PublicURLManager> create(ScriptExecutionContext*);
+    static PassOwnPtr<PublicURLManager> create(ExecutionContext*);
 
     void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*);
     void revoke(const KURL&);
@@ -52,7 +52,7 @@
     virtual void stop() OVERRIDE;
 
 private:
-    PublicURLManager(ScriptExecutionContext*);
+    PublicURLManager(ExecutionContext*);
 
     typedef HashSet<String> URLSet;
     typedef HashMap<URLRegistry*, URLSet > RegistryURLMap;
diff --git a/Source/core/html/RadioNodeList.h b/Source/core/html/RadioNodeList.h
index d0bdbf3..b735b0c 100644
--- a/Source/core/html/RadioNodeList.h
+++ b/Source/core/html/RadioNodeList.h
@@ -32,26 +32,25 @@
 
 namespace WebCore {
 
-class RadioNodeList : public LiveNodeList {
+class RadioNodeList FINAL : public LiveNodeList {
 public:
-    static PassRefPtr<RadioNodeList> create(Node* rootNode, CollectionType type, const AtomicString& name)
+    static PassRefPtr<RadioNodeList> create(Node* ownerNode, CollectionType type, const AtomicString& name)
     {
         ASSERT_UNUSED(type, type == RadioNodeListType);
-        return adoptRef(new RadioNodeList(rootNode, name));
+        return adoptRef(new RadioNodeList(ownerNode, name));
     }
 
-    ~RadioNodeList();
+    virtual ~RadioNodeList();
 
     String value() const;
     void setValue(const String&);
 
-protected:
-    virtual bool nodeMatches(Element*) const;
-
 private:
     RadioNodeList(Node*, const AtomicString& name);
     bool checkElementMatchesRadioNodeListFilter(Element*) const;
 
+    virtual bool nodeMatches(Element*) const OVERRIDE;
+
     AtomicString m_name;
 };
 
diff --git a/Source/core/html/TimeRanges.idl b/Source/core/html/TimeRanges.idl
index 3aa6b88..e6e6e95 100644
--- a/Source/core/html/TimeRanges.idl
+++ b/Source/core/html/TimeRanges.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=Media
+    RuntimeEnabled=Media
 ] interface TimeRanges {
     readonly attribute unsigned long length;
     [RaisesException] double start(unsigned long index);
diff --git a/Source/core/html/URL.idl b/Source/core/html/URL.idl
deleted file mode 100644
index 265f371..0000000
--- a/Source/core/html/URL.idl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2012 Motorola Mobility Inc.
- *
- * 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.
- */
-
-[
-    GlobalContext=Window&WorkerGlobalScope,
-    Constructor,
-    ImplementedAs=DOMURL
-] interface URL {
-    [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(Blob? blob);
-    [CallWith=ScriptExecutionContext] static void revokeObjectURL(DOMString url);
-};
diff --git a/Source/core/html/canvas/CanvasPathMethods.cpp b/Source/core/html/canvas/CanvasPathMethods.cpp
index 7de92cd..c7144f6 100644
--- a/Source/core/html/canvas/CanvasPathMethods.cpp
+++ b/Source/core/html/canvas/CanvasPathMethods.cpp
@@ -37,8 +37,8 @@
 
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/MathExtras.h"
 
 namespace WebCore {
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index 2bb4d8c..3be4886 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -55,15 +55,16 @@
 #include "core/html/canvas/CanvasPattern.h"
 #include "core/html/canvas/CanvasStyle.h"
 #include "core/html/canvas/DOMPath.h"
-#include "core/page/ImageBitmap.h"
+#include "core/frame/ImageBitmap.h"
 #include "core/platform/graphics/DrawLooper.h"
-#include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
-#include "core/platform/graphics/TextRun.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "core/rendering/RenderImage.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderTheme.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/graphics/TextRun.h"
+#include "platform/transforms/AffineTransform.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/CheckedArithmetic.h"
 #include "wtf/MathExtras.h"
@@ -596,6 +597,11 @@
     c->setCompositeOperation(op, blendMode);
 }
 
+void CanvasRenderingContext2D::setCurrentTransform(const SVGMatrix& matrix)
+{
+    setTransform(matrix.a(), matrix.b(), matrix.c(), matrix.d(), matrix.e(), matrix.f());
+}
+
 void CanvasRenderingContext2D::scale(float sx, float sy)
 {
     GraphicsContext* c = drawingContext();
@@ -698,12 +704,12 @@
 
     realizeSaves();
 
+    modifiableState().m_transform = newTransform;
     if (!newTransform.isInvertible()) {
         modifiableState().m_invertibleCTM = false;
         return;
     }
 
-    modifiableState().m_transform = newTransform;
     c->concatCTM(transform);
     m_path.transform(transform.inverse());
 }
@@ -1207,11 +1213,22 @@
     return alphaChannel(state().m_shadowColor) && (state().m_shadowBlur || !state().m_shadowOffset.isZero());
 }
 
-static LayoutSize sizeFor(HTMLImageElement* image)
+enum ImageSizeType {
+    ImageSizeAfterDevicePixelRatio,
+    ImageSizeBeforeDevicePixelRatio
+};
+
+static LayoutSize sizeFor(HTMLImageElement* image, ImageSizeType sizeType)
 {
-    if (ImageResource* cachedImage = image->cachedImage())
-        return cachedImage->imageSizeForRenderer(image->renderer(), 1.0f); // FIXME: Not sure about this.
-    return IntSize();
+    LayoutSize size;
+    ImageResource* cachedImage = image->cachedImage();
+    if (cachedImage) {
+        size = cachedImage->imageSizeForRenderer(image->renderer(), 1.0f); // FIXME: Not sure about this.
+
+        if (sizeType == ImageSizeAfterDevicePixelRatio && image->renderer() && image->renderer()->isRenderImage() && cachedImage->image() && !cachedImage->image()->hasRelativeWidth())
+            size.scale(toRenderImage(image->renderer())->imageDevicePixelRatio());
+    }
+    return size;
 }
 
 static IntSize sizeFor(HTMLVideoElement* video)
@@ -1362,8 +1379,8 @@
         es.throwUninformativeAndGenericDOMException(TypeMismatchError);
         return;
     }
-    LayoutSize size = sizeFor(image);
-    drawImage(image, x, y, size.width(), size.height(), es);
+    LayoutSize destRectSize = sizeFor(image, ImageSizeAfterDevicePixelRatio);
+    drawImage(image, x, y, destRectSize.width(), destRectSize.height(), es);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image,
@@ -1373,8 +1390,8 @@
         es.throwUninformativeAndGenericDOMException(TypeMismatchError);
         return;
     }
-    LayoutSize size = sizeFor(image);
-    drawImage(image, FloatRect(0, 0, size.width(), size.height()), FloatRect(x, y, width, height), es);
+    LayoutSize sourceRectSize = sizeFor(image, ImageSizeBeforeDevicePixelRatio);
+    drawImage(image, FloatRect(0, 0, sourceRectSize.width(), sourceRectSize.height()), FloatRect(x, y, width, height), es);
 }
 
 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image,
@@ -1404,7 +1421,7 @@
     if (!cachedImage || !image->complete())
         return;
 
-    LayoutSize size = sizeFor(image);
+    LayoutSize size = sizeFor(image, ImageSizeBeforeDevicePixelRatio);
     if (!size.width() || !size.height()) {
         es.throwUninformativeAndGenericDOMException(InvalidStateError);
         return;
@@ -1660,7 +1677,7 @@
 {
     ASSERT(isFullCanvasCompositeMode(op));
 
-    drawingContext()->beginTransparencyLayer(1, op);
+    drawingContext()->beginLayer(1, op);
     drawImageToContext(image, drawingContext(), dest, src, CompositeSourceOver);
     drawingContext()->endLayer();
 }
@@ -1681,7 +1698,7 @@
 
     GraphicsContext* c = drawingContext();
     ASSERT(c);
-    c->beginTransparencyLayer(1, state().m_globalComposite);
+    c->beginLayer(1, state().m_globalComposite);
     CompositeOperator previousOperator = c->compositeOperation();
     c->setCompositeOperation(CompositeSourceOver);
     fillPrimitive(area, c);
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.h b/Source/core/html/canvas/CanvasRenderingContext2D.h
index a3f8eb1..0897424 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.h
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.h
@@ -30,12 +30,13 @@
 #include "core/html/canvas/CanvasPathMethods.h"
 #include "core/html/canvas/CanvasRenderingContext.h"
 #include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/GraphicsTypes.h"
 #include "core/platform/graphics/ImageBuffer.h"
 #include "core/platform/graphics/Path.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "core/svg/SVGMatrix.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/HashMap.h"
 #include "wtf/Vector.h"
 #include "wtf/text/WTFString.h"
@@ -117,6 +118,12 @@
     void save() { ++m_unrealizedSaveCount; }
     void restore();
 
+    SVGMatrix currentTransform() const
+    {
+        return SVGMatrix(state().m_transform);
+    }
+    void setCurrentTransform(const SVGMatrix&);
+
     void scale(float sx, float sy);
     void rotate(float angleInRadians);
     void translate(float tx, float ty);
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.idl b/Source/core/html/canvas/CanvasRenderingContext2D.idl
index e62de80..52b20e2 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.idl
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.idl
@@ -30,6 +30,7 @@
     void save();
     void restore();
 
+    [RuntimeEnabled=ExperimentalCanvasFeatures, Immutable] attribute SVGMatrix currentTransform;
     void scale(float sx, float sy);
     void rotate(float angle);
     void translate(float tx, float ty);
@@ -128,9 +129,9 @@
     [RaisesException] void drawImage(HTMLVideoElement? video, float x, float y);
     [RaisesException] void drawImage(HTMLVideoElement? video, float x, float y, float width, float height);
     [RaisesException] void drawImage(HTMLVideoElement? video, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh);
-    [EnabledAtRuntime=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap? imageBitmap, float x, float y);
-    [EnabledAtRuntime=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap? imageBitmap, float x, float y, float width, float height);
-    [EnabledAtRuntime=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap? imageBitmap, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh);
+    [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap? imageBitmap, float x, float y);
+    [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap? imageBitmap, float x, float y, float width, float height);
+    [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap? imageBitmap, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh);
 
     void drawImageFromRect(HTMLImageElement image,
                            optional float sx, optional float sy, optional float sw, optional float sh,
@@ -162,8 +163,8 @@
     [RaisesException] ImageData webkitGetImageDataHD(float sx, float sy, float sw, float sh);
 
     // Focus rings
-    [EnabledAtRuntime=ExperimentalCanvasFeatures] void drawSystemFocusRing(Element element);
-    [EnabledAtRuntime=ExperimentalCanvasFeatures] boolean drawCustomFocusRing(Element element);
+    [RuntimeEnabled=ExperimentalCanvasFeatures] void drawSystemFocusRing(Element element);
+    [RuntimeEnabled=ExperimentalCanvasFeatures] boolean drawCustomFocusRing(Element element);
 
     readonly attribute float webkitBackingStorePixelRatio;
 
diff --git a/Source/core/html/canvas/Path.idl b/Source/core/html/canvas/Path.idl
index ce19874..66435a5 100644
--- a/Source/core/html/canvas/Path.idl
+++ b/Source/core/html/canvas/Path.idl
@@ -27,7 +27,7 @@
  */
 
 [
-    EnabledAtRuntime=ExperimentalCanvasFeatures,
+    RuntimeEnabled=ExperimentalCanvasFeatures,
     Constructor,
     Constructor(Path path),
     Constructor(DOMString text),
diff --git a/Source/core/html/canvas/WebGLContextEvent.cpp b/Source/core/html/canvas/WebGLContextEvent.cpp
index d8d7cbd..7f4cf7c 100644
--- a/Source/core/html/canvas/WebGLContextEvent.cpp
+++ b/Source/core/html/canvas/WebGLContextEvent.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/html/canvas/WebGLContextEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -59,7 +59,7 @@
 
 const AtomicString& WebGLContextEvent::interfaceName() const
 {
-    return eventNames().interfaceForWebGLContextEvent;
+    return EventNames::WebGLContextEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/html/canvas/WebGLFramebuffer.cpp b/Source/core/html/canvas/WebGLFramebuffer.cpp
index 41f7d82..7b1081c 100644
--- a/Source/core/html/canvas/WebGLFramebuffer.cpp
+++ b/Source/core/html/canvas/WebGLFramebuffer.cpp
@@ -28,7 +28,7 @@
 #include "core/html/canvas/WebGLFramebuffer.h"
 
 #include "core/html/canvas/WebGLRenderingContext.h"
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
 #include "core/platform/graphics/Extensions3D.h"
 
 namespace WebCore {
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp
index 715e1d8..299871d 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContext.cpp
@@ -68,18 +68,18 @@
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/NotImplemented.h"
 #include "core/platform/graphics/Extensions3D.h"
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/platform/graphics/gpu/DrawingBuffer.h"
 #include "core/rendering/RenderBox.h"
+#include "platform/NotImplemented.h"
+#include "platform/geometry/IntSize.h"
 
-#include "wtf/OwnArrayPtr.h"
-#include "wtf/PassOwnArrayPtr.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
 #include "wtf/Uint32Array.h"
 #include "wtf/text/StringBuilder.h"
 
@@ -525,7 +525,7 @@
     // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in
     // particular, if WebGL contexts were lost one or more times via the GL_ARB_robustness extension.
     if (!frame->loader()->client()->allowWebGL(settings && settings->webGLEnabled())) {
-        canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Web page was not allowed to create a WebGL context."));
+        canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Web page was not allowed to create a WebGL context."));
         return nullptr;
     }
 
@@ -540,7 +540,7 @@
     RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attributes));
 
     if (!context || !context->makeContextCurrent()) {
-        canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context."));
+        canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Could not create a WebGL context."));
         return nullptr;
     }
 
@@ -552,7 +552,7 @@
     renderingContext->suspendIfNeeded();
 
     if (renderingContext->m_drawingBuffer->isZeroSized()) {
-        canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context."));
+        canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Could not create a WebGL context."));
         return nullptr;
     }
 
@@ -5338,7 +5338,7 @@
 
 void WebGLRenderingContext::dispatchContextLostEvent(Timer<WebGLRenderingContext>*)
 {
-    RefPtr<WebGLContextEvent> event = WebGLContextEvent::create(eventNames().webglcontextlostEvent, false, true, "");
+    RefPtr<WebGLContextEvent> event = WebGLContextEvent::create(EventTypeNames::webglcontextlost, false, true, "");
     canvas()->dispatchEvent(event);
     m_restoreAllowed = event->defaultPrevented();
     deactivateContext(this, m_contextLostMode != RealLostContext && m_restoreAllowed);
@@ -5401,7 +5401,7 @@
 
     setupFlags();
     initializeNewContext();
-    canvas()->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextrestoredEvent, false, true, ""));
+    canvas()->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextrestored, false, true, ""));
 }
 
 String WebGLRenderingContext::ensureNotNull(const String& text) const
diff --git a/Source/core/html/canvas/WebGLRenderingContext.h b/Source/core/html/canvas/WebGLRenderingContext.h
index ab2cd65..3f24f1f 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.h
+++ b/Source/core/html/canvas/WebGLRenderingContext.h
@@ -30,13 +30,13 @@
 #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"
+#include "platform/Timer.h"
 
 #include "wtf/Float32Array.h"
 #include "wtf/Int32Array.h"
-#include "wtf/OwnArrayPtr.h"
+#include "wtf/OwnPtr.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebKit { class WebLayer; }
@@ -459,7 +459,7 @@
         ImageBuffer* imageBuffer(const IntSize& size);
     private:
         void bubbleToFront(int idx);
-        OwnArrayPtr<OwnPtr<ImageBuffer> > m_buffers;
+        OwnPtr<OwnPtr<ImageBuffer>[]> m_buffers;
         int m_capacity;
     };
     LRUImageBufferCache m_videoCache;
diff --git a/Source/core/html/forms/BaseCheckableInputType.cpp b/Source/core/html/forms/BaseCheckableInputType.cpp
index 70abbd3..6bae65d 100644
--- a/Source/core/html/forms/BaseCheckableInputType.cpp
+++ b/Source/core/html/forms/BaseCheckableInputType.cpp
@@ -34,9 +34,9 @@
 
 #include "HTMLNames.h"
 #include "core/events/KeyboardEvent.h"
-#include "core/html/FormDataList.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/FormController.h"
+#include "core/platform/network/FormDataList.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp b/Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp
index 431d632..f6ff191 100644
--- a/Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp
+++ b/Source/core/html/forms/BaseChooserOnlyDateAndTimeInputType.cpp
@@ -28,12 +28,12 @@
 #include "core/html/forms/BaseChooserOnlyDateAndTimeInputType.h"
 
 #include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "bindings/v8/ScriptController.h"
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/page/Chrome.h"
 #include "core/page/Page.h"
+#include "platform/UserGestureIndicator.h"
 
 namespace WebCore {
 
@@ -44,7 +44,7 @@
 
 void BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent(Event*)
 {
-    if (element()->isDisabledOrReadOnly() || !element()->renderer() || !ScriptController::processingUserGesture() || element()->hasAuthorShadowRoot())
+    if (element()->isDisabledOrReadOnly() || !element()->renderer() || !UserGestureIndicator::processingUserGesture() || element()->hasAuthorShadowRoot())
         return;
 
     if (m_dateTimeChooser)
diff --git a/Source/core/html/forms/BaseDateAndTimeInputType.cpp b/Source/core/html/forms/BaseDateAndTimeInputType.cpp
index cd30e72..5c10876 100644
--- a/Source/core/html/forms/BaseDateAndTimeInputType.cpp
+++ b/Source/core/html/forms/BaseDateAndTimeInputType.cpp
@@ -31,13 +31,13 @@
 #include "config.h"
 #include "core/html/forms/BaseDateAndTimeInputType.h"
 
+#include <limits>
 #include "core/html/HTMLInputElement.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/DateMath.h"
 #include "wtf/MathExtras.h"
 #include "wtf/text/WTFString.h"
-#include <limits>
 
 namespace WebCore {
 
diff --git a/Source/core/html/forms/BaseDateAndTimeInputType.h b/Source/core/html/forms/BaseDateAndTimeInputType.h
index 5e076e9..9261005 100644
--- a/Source/core/html/forms/BaseDateAndTimeInputType.h
+++ b/Source/core/html/forms/BaseDateAndTimeInputType.h
@@ -32,7 +32,7 @@
 #define BaseDateAndTimeInputType_h
 
 #include "core/html/forms/InputType.h"
-#include "core/platform/DateComponents.h"
+#include "platform/DateComponents.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/forms/BaseMultipleFieldsDateAndTimeInputType.cpp b/Source/core/html/forms/BaseMultipleFieldsDateAndTimeInputType.cpp
index 99bc8f3..abd1ccf 100644
--- a/Source/core/html/forms/BaseMultipleFieldsDateAndTimeInputType.cpp
+++ b/Source/core/html/forms/BaseMultipleFieldsDateAndTimeInputType.cpp
@@ -34,8 +34,8 @@
 
 #include "CSSValueKeywords.h"
 #include "RuntimeEnabledFeatures.h"
-#include "core/events/KeyboardEvent.h"
 #include "core/dom/shadow/ShadowRoot.h"
+#include "core/events/KeyboardEvent.h"
 #include "core/html/HTMLDataListElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLOptionElement.h"
@@ -45,11 +45,10 @@
 #include "core/html/shadow/ShadowElementNames.h"
 #include "core/page/FocusController.h"
 #include "core/page/Page.h"
-#include "core/platform/DateComponents.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/text/DateTimeFormat.h"
-#include "core/platform/text/PlatformLocale.h"
 #include "core/rendering/RenderTheme.h"
+#include "platform/DateComponents.h"
+#include "platform/text/DateTimeFormat.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/DateMath.h"
 
 namespace WebCore {
diff --git a/Source/core/html/forms/CheckboxInputType.cpp b/Source/core/html/forms/CheckboxInputType.cpp
index 83d653d..8fe408c 100644
--- a/Source/core/html/forms/CheckboxInputType.cpp
+++ b/Source/core/html/forms/CheckboxInputType.cpp
@@ -35,7 +35,7 @@
 #include "core/events/KeyboardEvent.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/InputTypeNames.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/html/forms/ColorInputType.cpp b/Source/core/html/forms/ColorInputType.cpp
index 18eea43..9744894 100644
--- a/Source/core/html/forms/ColorInputType.cpp
+++ b/Source/core/html/forms/ColorInputType.cpp
@@ -45,6 +45,7 @@
 #include "core/page/Chrome.h"
 #include "core/platform/graphics/Color.h"
 #include "core/rendering/RenderView.h"
+#include "platform/UserGestureIndicator.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/WTFString.h"
 
@@ -146,7 +147,7 @@
     if (element()->isDisabledFormControl() || !element()->renderer())
         return;
 
-    if (!ScriptController::processingUserGesture())
+    if (!UserGestureIndicator::processingUserGesture())
         return;
 
     Chrome* chrome = this->chrome();
diff --git a/Source/core/html/forms/DateInputType.cpp b/Source/core/html/forms/DateInputType.cpp
index 00ac554..9ffc943 100644
--- a/Source/core/html/forms/DateInputType.cpp
+++ b/Source/core/html/forms/DateInputType.cpp
@@ -35,13 +35,13 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/DateTimeFieldsState.h"
 #include "core/html/forms/InputTypeNames.h"
-#include "core/platform/DateComponents.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "platform/DateComponents.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
+using WebKit::WebLocalizedString;
 using namespace HTMLNames;
 
 static const int dateDefaultStep = 1;
@@ -119,9 +119,9 @@
         layoutParameters.minimum = DateComponents();
     if (!parseToDateComponents(element()->fastGetAttribute(maxAttr), &layoutParameters.maximum))
         layoutParameters.maximum = DateComponents();
-    layoutParameters.placeholderForDay = placeholderForDayOfMonthField();
-    layoutParameters.placeholderForMonth = placeholderForMonthField();
-    layoutParameters.placeholderForYear = placeholderForYearField();
+    layoutParameters.placeholderForDay = locale().queryString(WebLocalizedString::PlaceholderForDayOfMonthField);
+    layoutParameters.placeholderForMonth = locale().queryString(WebLocalizedString::PlaceholderForMonthField);
+    layoutParameters.placeholderForYear = locale().queryString(WebLocalizedString::PlaceholderForYearField);
 }
 
 bool DateInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, bool hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const
diff --git a/Source/core/html/forms/DateTimeLocalInputType.cpp b/Source/core/html/forms/DateTimeLocalInputType.cpp
index 420a9cf..c86174e 100644
--- a/Source/core/html/forms/DateTimeLocalInputType.cpp
+++ b/Source/core/html/forms/DateTimeLocalInputType.cpp
@@ -36,14 +36,14 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/DateTimeFieldsState.h"
 #include "core/html/forms/InputTypeNames.h"
-#include "core/platform/DateComponents.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "platform/DateComponents.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
+using WebKit::WebLocalizedString;
 using namespace HTMLNames;
 
 static const int dateTimeLocalDefaultStep = 60;
@@ -162,9 +162,9 @@
         layoutParameters.minimum = DateComponents();
     if (!parseToDateComponents(element()->fastGetAttribute(maxAttr), &layoutParameters.maximum))
         layoutParameters.maximum = DateComponents();
-    layoutParameters.placeholderForDay = placeholderForDayOfMonthField();
-    layoutParameters.placeholderForMonth = placeholderForMonthField();
-    layoutParameters.placeholderForYear = placeholderForYearField();
+    layoutParameters.placeholderForDay = locale().queryString(WebLocalizedString::PlaceholderForDayOfMonthField);
+    layoutParameters.placeholderForMonth = locale().queryString(WebLocalizedString::PlaceholderForMonthField);
+    layoutParameters.placeholderForYear = locale().queryString(WebLocalizedString::PlaceholderForYearField);
 }
 
 bool DateTimeLocalInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, bool hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const
diff --git a/Source/core/html/forms/EmailInputType.cpp b/Source/core/html/forms/EmailInputType.cpp
index e933396..fc846f8 100644
--- a/Source/core/html/forms/EmailInputType.cpp
+++ b/Source/core/html/forms/EmailInputType.cpp
@@ -24,17 +24,17 @@
 #include "config.h"
 #include "core/html/forms/EmailInputType.h"
 
+#include <unicode/uidna.h>
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/InputTypeNames.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/platform/text/PlatformLocale.h"
 #include "core/platform/text/RegularExpression.h"
+#include "platform/text/PlatformLocale.h"
 #include "public/platform/Platform.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/StringBuilder.h"
-#include <unicode/uidna.h>
 
 namespace WebCore {
 
diff --git a/Source/core/html/forms/FileInputType.cpp b/Source/core/html/forms/FileInputType.cpp
index 72c2742..52f9beb 100644
--- a/Source/core/html/forms/FileInputType.cpp
+++ b/Source/core/html/forms/FileInputType.cpp
@@ -25,21 +25,20 @@
 #include "HTMLNames.h"
 #include "RuntimeEnabledFeatures.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "bindings/v8/ScriptController.h"
-#include "core/events/Event.h"
 #include "core/dom/shadow/ShadowRoot.h"
+#include "core/events/Event.h"
 #include "core/fileapi/File.h"
 #include "core/fileapi/FileList.h"
-#include "core/html/FormDataList.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/FormController.h"
 #include "core/html/forms/InputTypeNames.h"
 #include "core/page/Chrome.h"
 #include "core/platform/DragData.h"
-#include "core/platform/FileSystem.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "core/platform/network/FormDataList.h"
 #include "core/rendering/RenderFileUploadControl.h"
+#include "platform/FileMetadata.h"
+#include "platform/UserGestureIndicator.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/WTFString.h"
@@ -141,7 +140,7 @@
     if (element()->isDisabledFormControl())
         return;
 
-    if (!ScriptController::processingUserGesture())
+    if (!UserGestureIndicator::processingUserGesture())
         return;
 
     if (Chrome* chrome = this->chrome()) {
@@ -250,7 +249,7 @@
     ASSERT(element()->shadow());
     RefPtr<HTMLInputElement> button = HTMLInputElement::create(inputTag, element()->document(), 0, false);
     button->setType(InputTypeNames::button());
-    button->setAttribute(valueAttr, element()->multiple() ? fileButtonChooseMultipleFilesLabel() : fileButtonChooseFileLabel());
+    button->setAttribute(valueAttr, locale().queryString(element()->multiple() ? WebLocalizedString::FileButtonChooseMultipleFilesLabel : WebLocalizedString::FileButtonChooseFileLabel));
     button->setPart(AtomicString("-webkit-file-upload-button", AtomicString::ConstructFromLiteral));
     element()->userAgentShadowRoot()->appendChild(button.release());
 }
@@ -266,7 +265,7 @@
 {
     ASSERT(element()->shadow());
     if (Element* button = toElement(element()->userAgentShadowRoot()->firstChild()))
-        button->setAttribute(valueAttr, element()->multiple() ? fileButtonChooseMultipleFilesLabel() : fileButtonChooseFileLabel());
+        button->setAttribute(valueAttr, locale().queryString(element()->multiple() ? WebLocalizedString::FileButtonChooseMultipleFilesLabel : WebLocalizedString::FileButtonChooseFileLabel));
 }
 
 void FileInputType::setFiles(PassRefPtr<FileList> files)
@@ -367,9 +366,7 @@
     FileList* fileList = m_fileList.get();
     unsigned listSize = fileList->length();
     if (!listSize) {
-        if (element()->multiple())
-            return fileButtonNoFilesSelectedLabel();
-        return fileButtonNoFileSelectedLabel();
+        return locale().queryString(WebLocalizedString::FileButtonNoFileSelectedLabel);
     }
 
     StringBuilder names;
diff --git a/Source/core/html/forms/FileInputType.h b/Source/core/html/forms/FileInputType.h
index f96f5c4..8a30065 100644
--- a/Source/core/html/forms/FileInputType.h
+++ b/Source/core/html/forms/FileInputType.h
@@ -33,7 +33,7 @@
 #define FileInputType_h
 
 #include "core/html/forms/BaseClickableWithKeyInputType.h"
-#include "core/platform/FileChooser.h"
+#include "platform/FileChooser.h"
 #include "wtf/RefPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/html/forms/FormController.cpp b/Source/core/html/forms/FormController.cpp
index bcf7b27..55a3414 100644
--- a/Source/core/html/forms/FormController.cpp
+++ b/Source/core/html/forms/FormController.cpp
@@ -24,7 +24,7 @@
 #include "core/html/HTMLFormControlElementWithState.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLInputElement.h"
-#include "core/platform/FileChooser.h"
+#include "platform/FileChooser.h"
 #include "wtf/Deque.h"
 #include "wtf/HashTableDeletedValueType.h"
 #include "wtf/text/StringBuilder.h"
diff --git a/Source/core/html/forms/HiddenInputType.cpp b/Source/core/html/forms/HiddenInputType.cpp
index 512522e..2ce1087 100644
--- a/Source/core/html/forms/HiddenInputType.cpp
+++ b/Source/core/html/forms/HiddenInputType.cpp
@@ -33,10 +33,10 @@
 #include "core/html/forms/HiddenInputType.h"
 
 #include "HTMLNames.h"
-#include "core/html/FormDataList.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/FormController.h"
 #include "core/html/forms/InputTypeNames.h"
+#include "core/platform/network/FormDataList.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/html/forms/ImageInputType.cpp b/Source/core/html/forms/ImageInputType.cpp
index 10d3d6d..d915f28 100644
--- a/Source/core/html/forms/ImageInputType.cpp
+++ b/Source/core/html/forms/ImageInputType.cpp
@@ -26,12 +26,12 @@
 #include "HTMLNames.h"
 #include "core/events/MouseEvent.h"
 #include "core/fetch/ImageResource.h"
-#include "core/html/FormDataList.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLImageLoader.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/InputTypeNames.h"
 #include "core/html/parser/HTMLParserIdioms.h"
+#include "core/platform/network/FormDataList.h"
 #include "core/rendering/RenderImage.h"
 #include "wtf/PassOwnPtr.h"
 
diff --git a/Source/core/html/forms/ImageInputType.h b/Source/core/html/forms/ImageInputType.h
index c3a5d76..06f0d29 100644
--- a/Source/core/html/forms/ImageInputType.h
+++ b/Source/core/html/forms/ImageInputType.h
@@ -34,7 +34,7 @@
 #define ImageInputType_h
 
 #include "core/html/forms/BaseButtonInputType.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/geometry/IntPoint.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/forms/InputType.cpp b/Source/core/html/forms/InputType.cpp
index 2155c6c..6123015 100644
--- a/Source/core/html/forms/InputType.cpp
+++ b/Source/core/html/forms/InputType.cpp
@@ -30,12 +30,11 @@
 
 #include "RuntimeEnabledFeatures.h"
 #include "core/accessibility/AXObjectCache.h"
-#include "core/events/KeyboardEvent.h"
 #include "core/dom/NodeRenderStyle.h"
-#include "core/events/ScopedEventQueue.h"
 #include "core/dom/shadow/ShadowRoot.h"
+#include "core/events/KeyboardEvent.h"
+#include "core/events/ScopedEventQueue.h"
 #include "core/fileapi/FileList.h"
-#include "core/html/FormDataList.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/ButtonInputType.h"
 #include "core/html/forms/CheckboxInputType.h"
@@ -64,10 +63,10 @@
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/html/shadow/HTMLShadowElement.h"
 #include "core/page/Page.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/text/PlatformLocale.h"
-#include "core/platform/text/TextBreakIterator.h"
+#include "core/platform/network/FormDataList.h"
 #include "core/rendering/RenderTheme.h"
+#include "platform/text/PlatformLocale.h"
+#include "platform/text/TextBreakIterator.h"
 
 namespace WebCore {
 
@@ -420,7 +419,7 @@
 
 bool InputType::shouldSubmitImplicitly(Event* event)
 {
-    return event->isKeyboardEvent() && event->type() == eventNames().keypressEvent && toKeyboardEvent(event)->charCode() == '\r';
+    return event->isKeyboardEvent() && event->type() == EventTypeNames::keypress && toKeyboardEvent(event)->charCode() == '\r';
 }
 
 void InputType::createShadowSubtree()
@@ -429,20 +428,8 @@
 
 void InputType::destroyShadowSubtree()
 {
-    ShadowRoot* root = element()->userAgentShadowRoot();
-    if (!root)
-        return;
-
-    root->removeChildren();
-
-    // It's ok to clear contents of all other UA ShadowRoots because they must
-    // have been created by InputFieldPasswordGeneratorButtonElement.
-    // FIXME: Remove the PasswordGeneratorButtonElement's shadow root and then
-    // remove this loop.
-    while ((root = root->youngerShadowRoot()) && root->type() == ShadowRoot::UserAgentShadowRoot) {
+    if (ShadowRoot* root = element()->userAgentShadowRoot())
         root->removeChildren();
-        root->appendChild(HTMLShadowElement::create(shadowTag, element()->document()));
-    }
 }
 
 Decimal InputType::parseToNumber(const String&, const Decimal& defaultValue) const
@@ -1004,7 +991,7 @@
 {
     if (RenderStyle* style = element()->renderStyle()) {
         if (style->visibility() != HIDDEN)
-            UseCounter::count(&element()->document(), feature);
+            UseCounter::count(element()->document(), feature);
     }
 }
 
diff --git a/Source/core/html/forms/MonthInputType.cpp b/Source/core/html/forms/MonthInputType.cpp
index 390a94b..1294ebd 100644
--- a/Source/core/html/forms/MonthInputType.cpp
+++ b/Source/core/html/forms/MonthInputType.cpp
@@ -35,8 +35,8 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/DateTimeFieldsState.h"
 #include "core/html/forms/InputTypeNames.h"
-#include "core/platform/DateComponents.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "platform/DateComponents.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/DateMath.h"
 #include "wtf/MathExtras.h"
diff --git a/Source/core/html/forms/NumberInputType.cpp b/Source/core/html/forms/NumberInputType.cpp
index 3fa5c6f..925e86c 100644
--- a/Source/core/html/forms/NumberInputType.cpp
+++ b/Source/core/html/forms/NumberInputType.cpp
@@ -32,6 +32,7 @@
 #include "config.h"
 #include "core/html/forms/NumberInputType.h"
 
+#include <limits>
 #include "HTMLNames.h"
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
@@ -39,11 +40,10 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/InputTypeNames.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/platform/text/PlatformLocale.h"
 #include "core/rendering/RenderTextControl.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/MathExtras.h"
 #include "wtf/PassOwnPtr.h"
-#include <limits>
 
 namespace WebCore {
 
diff --git a/Source/core/html/forms/PasswordInputType.cpp b/Source/core/html/forms/PasswordInputType.cpp
index f5b84a2..706033e 100644
--- a/Source/core/html/forms/PasswordInputType.cpp
+++ b/Source/core/html/forms/PasswordInputType.cpp
@@ -32,6 +32,9 @@
 #include "config.h"
 #include "core/html/forms/PasswordInputType.h"
 
+#include "CSSPropertyNames.h"
+#include "CSSValueKeywords.h"
+#include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/FormController.h"
 #include "core/html/forms/InputTypeNames.h"
@@ -68,10 +71,19 @@
 void PasswordInputType::createShadowSubtree()
 {
     BaseTextInputType::createShadowSubtree();
-    if (isPasswordGenerationEnabled()) {
-        m_generatorButton = PasswordGeneratorButtonElement::create(element()->document());
-        m_generatorButton->decorate(element());
-    }
+    if (!isPasswordGenerationEnabled())
+        return;
+    ShadowRoot* root = element()->userAgentShadowRoot();
+    RefPtr<HTMLDivElement> wrapper = HTMLDivElement::create(element()->document());
+    wrapper->setInlineStyleProperty(CSSPropertyDisplay, CSSValueFlex);
+    wrapper->setInlineStyleProperty(CSSPropertyAlignItems, CSSValueCenter);
+    ASSERT(root->childNodeCount() == 1);
+    root->firstElementChild()->setInlineStyleProperty(CSSPropertyFlexGrow, 1.0, CSSPrimitiveValue::CSS_NUMBER);
+    wrapper->appendChild(root->firstElementChild());
+    m_generatorButton = PasswordGeneratorButtonElement::create(element()->document());
+    m_generatorButton->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
+    wrapper->appendChild(m_generatorButton.get());
+    element()->userAgentShadowRoot()->appendChild(wrapper);
 }
 
 void PasswordInputType::destroyShadowSubtree()
diff --git a/Source/core/html/forms/RadioInputType.cpp b/Source/core/html/forms/RadioInputType.cpp
index 0540cf0..b6045b2 100644
--- a/Source/core/html/forms/RadioInputType.cpp
+++ b/Source/core/html/forms/RadioInputType.cpp
@@ -23,13 +23,13 @@
 #include "core/html/forms/RadioInputType.h"
 
 #include "HTMLNames.h"
+#include "core/dom/NodeTraversal.h"
 #include "core/events/KeyboardEvent.h"
 #include "core/events/MouseEvent.h"
-#include "core/dom/NodeTraversal.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/InputTypeNames.h"
 #include "core/page/SpatialNavigation.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/html/forms/RangeInputType.cpp b/Source/core/html/forms/RangeInputType.cpp
index 125eb3d..17f9197 100644
--- a/Source/core/html/forms/RangeInputType.cpp
+++ b/Source/core/html/forms/RangeInputType.cpp
@@ -51,8 +51,8 @@
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/html/shadow/ShadowElementNames.h"
 #include "core/html/shadow/SliderThumbElement.h"
-#include "core/platform/PlatformMouseEvent.h"
 #include "core/rendering/RenderSlider.h"
+#include "platform/PlatformMouseEvent.h"
 #include "wtf/MathExtras.h"
 #include "wtf/NonCopyingSort.h"
 #include "wtf/PassOwnPtr.h"
@@ -164,7 +164,7 @@
     if (element()->isDisabledOrReadOnly())
         return;
 
-    if (event->type() == eventNames().touchendEvent) {
+    if (event->type() == EventTypeNames::touchend) {
         event->setDefaultHandled();
         return;
     }
diff --git a/Source/core/html/forms/ResetInputType.cpp b/Source/core/html/forms/ResetInputType.cpp
index b6209dd..7ee95f7 100644
--- a/Source/core/html/forms/ResetInputType.cpp
+++ b/Source/core/html/forms/ResetInputType.cpp
@@ -36,7 +36,7 @@
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/InputTypeNames.h"
-#include "core/platform/LocalizedStrings.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
@@ -66,7 +66,7 @@
 
 String ResetInputType::defaultValue() const
 {
-    return resetButtonDefaultLabel();
+    return locale().queryString(WebKit::WebLocalizedString::ResetButtonDefaultLabel);
 }
 
 bool ResetInputType::isTextButton() const
diff --git a/Source/core/html/forms/SearchInputType.h b/Source/core/html/forms/SearchInputType.h
index f2aa7fd..d1a5e2f 100644
--- a/Source/core/html/forms/SearchInputType.h
+++ b/Source/core/html/forms/SearchInputType.h
@@ -32,7 +32,7 @@
 #define SearchInputType_h
 
 #include "core/html/forms/BaseTextInputType.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/forms/StepRange.h b/Source/core/html/forms/StepRange.h
index 0b04444..a31e264 100644
--- a/Source/core/html/forms/StepRange.h
+++ b/Source/core/html/forms/StepRange.h
@@ -21,7 +21,7 @@
 #ifndef StepRange_h
 #define StepRange_h
 
-#include "core/platform/Decimal.h"
+#include "platform/Decimal.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
diff --git a/Source/core/html/forms/SubmitInputType.cpp b/Source/core/html/forms/SubmitInputType.cpp
index f1272c1..dd3069c 100644
--- a/Source/core/html/forms/SubmitInputType.cpp
+++ b/Source/core/html/forms/SubmitInputType.cpp
@@ -33,11 +33,11 @@
 #include "core/html/forms/SubmitInputType.h"
 
 #include "core/events/Event.h"
-#include "core/html/FormDataList.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/InputTypeNames.h"
-#include "core/platform/LocalizedStrings.h"
+#include "core/platform/network/FormDataList.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
@@ -83,7 +83,7 @@
 
 String SubmitInputType::defaultValue() const
 {
-    return submitButtonDefaultLabel();
+    return locale().queryString(WebKit::WebLocalizedString::SubmitButtonDefaultLabel);
 }
 
 bool SubmitInputType::isSubmitButton() const
diff --git a/Source/core/html/forms/TextFieldInputType.cpp b/Source/core/html/forms/TextFieldInputType.cpp
index 5286513..407d703 100644
--- a/Source/core/html/forms/TextFieldInputType.cpp
+++ b/Source/core/html/forms/TextFieldInputType.cpp
@@ -42,13 +42,13 @@
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/TextIterator.h"
-#include "core/html/FormDataList.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/shadow/ShadowElementNames.h"
 #include "core/html/shadow/TextControlInnerElements.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
+#include "core/platform/network/FormDataList.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderTextControlSingleLine.h"
 #include "core/rendering/RenderTheme.h"
@@ -181,18 +181,20 @@
             return;
     }
 
-    if (element()->renderer() && (event->isMouseEvent() || event->isDragEvent() || event->hasInterface(eventNames().interfaceForWheelEvent) || event->type() == eventNames().blurEvent || event->type() == eventNames().focusEvent)) {
+    if (element()->renderer() && (event->isMouseEvent() || event->isDragEvent() || event->hasInterface(EventNames::WheelEvent) || event->type() == EventTypeNames::blur || event->type() == EventTypeNames::focus)) {
         RenderTextControlSingleLine* renderTextControl = toRenderTextControlSingleLine(element()->renderer());
-        if (event->type() == eventNames().blurEvent) {
+        if (event->type() == EventTypeNames::blur) {
             if (RenderBox* innerTextRenderer = innerTextElement()->renderBox()) {
+                // FIXME: This class has no need to know about RenderLayer!
                 if (RenderLayer* innerLayer = innerTextRenderer->layer()) {
-                    IntSize scrollOffset(!renderTextControl->style()->isLeftToRightDirection() ? innerLayer->scrollWidth() : 0, 0);
-                    innerLayer->scrollToOffset(scrollOffset, ScrollOffsetClamped);
+                    RenderLayerScrollableArea* innerScrollableArea = innerLayer->scrollableArea();
+                    IntSize scrollOffset(!renderTextControl->style()->isLeftToRightDirection() ? innerScrollableArea->scrollWidth() : 0, 0);
+                    innerScrollableArea->scrollToOffset(scrollOffset, ScrollOffsetClamped);
                 }
             }
 
             renderTextControl->capsLockStateMayHaveChanged();
-        } else if (event->type() == eventNames().focusEvent) {
+        } else if (event->type() == EventTypeNames::focus) {
             renderTextControl->capsLockStateMayHaveChanged();
         }
 
@@ -214,7 +216,7 @@
 
 bool TextFieldInputType::shouldSubmitImplicitly(Event* event)
 {
-    return (event->type() == eventNames().textInputEvent && event->hasInterface(eventNames().interfaceForTextEvent) && toTextEvent(event)->data() == "\n") || InputType::shouldSubmitImplicitly(event);
+    return (event->type() == EventTypeNames::textInput && event->hasInterface(EventNames::TextEvent) && toTextEvent(event)->data() == "\n") || InputType::shouldSubmitImplicitly(event);
 }
 
 RenderObject* TextFieldInputType::createRenderer(RenderStyle*) const
diff --git a/Source/core/html/forms/TimeInputType.cpp b/Source/core/html/forms/TimeInputType.cpp
index 08ee92d..36d2b02 100644
--- a/Source/core/html/forms/TimeInputType.cpp
+++ b/Source/core/html/forms/TimeInputType.cpp
@@ -35,8 +35,8 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/DateTimeFieldsState.h"
 #include "core/html/forms/InputTypeNames.h"
-#include "core/platform/DateComponents.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "platform/DateComponents.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/DateMath.h"
 #include "wtf/MathExtras.h"
diff --git a/Source/core/html/forms/URLInputType.cpp b/Source/core/html/forms/URLInputType.cpp
index a97a70e..c58107e 100644
--- a/Source/core/html/forms/URLInputType.cpp
+++ b/Source/core/html/forms/URLInputType.cpp
@@ -33,7 +33,7 @@
 
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/InputTypeNames.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/html/forms/WeekInputType.cpp b/Source/core/html/forms/WeekInputType.cpp
index dd1cc4d..7a9f36c 100644
--- a/Source/core/html/forms/WeekInputType.cpp
+++ b/Source/core/html/forms/WeekInputType.cpp
@@ -35,8 +35,8 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/forms/DateTimeFieldsState.h"
 #include "core/html/forms/InputTypeNames.h"
-#include "core/platform/DateComponents.h"
-#include "core/platform/LocalizedStrings.h"
+#include "platform/DateComponents.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/WTFString.h"
 
@@ -108,7 +108,7 @@
 
 void WeekInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents&) const
 {
-    layoutParameters.dateTimeFormat = weekFormatInLDML();
+    layoutParameters.dateTimeFormat = locale().weekFormatInLDML();
     layoutParameters.fallbackDateTimeFormat = "yyyy-'W'ww";
     if (!parseToDateComponents(element()->fastGetAttribute(minAttr), &layoutParameters.minimum))
         layoutParameters.minimum = DateComponents();
diff --git a/Source/core/html/ime/Composition.cpp b/Source/core/html/ime/Composition.cpp
index 9b40000..17250b3 100644
--- a/Source/core/html/ime/Composition.cpp
+++ b/Source/core/html/ime/Composition.cpp
@@ -31,27 +31,53 @@
 #include "config.h"
 #include "core/html/ime/Composition.h"
 
+#include "core/html/ime/InputMethodContext.h"
+
 namespace WebCore {
 
 Composition::~Composition()
 {
 }
 
-PassRefPtr<Composition> Composition::create()
+void Composition::ref()
 {
-    return adoptRef(new Composition());
+    m_inputMethodContext->ref();
 }
 
-Composition::Composition()
-    : m_selectionStart(0)
-    , m_selectionEnd(0)
+void Composition::deref()
+{
+    m_inputMethodContext->deref();
+}
+
+PassOwnPtr<Composition> Composition::create(InputMethodContext* context)
+{
+    return adoptPtr(new Composition(context));
+}
+
+Composition::Composition(InputMethodContext* context)
+    : m_inputMethodContext(context)
 {
     ScriptWrappable::init(this);
 }
 
+String Composition::text() const
+{
+    return m_inputMethodContext->compositionText();
+}
+
+int Composition::selectionStart() const
+{
+    return m_inputMethodContext->selectionStart();
+}
+
+int Composition::selectionEnd() const
+{
+    return m_inputMethodContext->selectionEnd();
+}
+
 const Vector<unsigned>& Composition::getSegments() const
 {
-    return m_segments;
+    return m_inputMethodContext->segments();
 }
 
 } // namespace WebCore
diff --git a/Source/core/html/ime/Composition.h b/Source/core/html/ime/Composition.h
index a180c86..4305466 100644
--- a/Source/core/html/ime/Composition.h
+++ b/Source/core/html/ime/Composition.h
@@ -32,36 +32,30 @@
 #define Composition_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
+#include "wtf/PassOwnPtr.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
-class Composition : public RefCounted<Composition>, public ScriptWrappable {
+class InputMethodContext;
+
+class Composition : public ScriptWrappable {
 public:
-    static PassRefPtr<Composition> create();
+    static PassOwnPtr<Composition> create(InputMethodContext*);
     ~Composition();
 
-    String text() const { return m_text; }
-    void setText(const String& text) { m_text = text; }
+    void ref();
+    void deref();
 
-    int selectionStart() const { return m_selectionStart; }
-    void setSelectionStart(int selectionStart) { selectionStart = m_selectionStart; }
-
-    int selectionEnd() const { return m_selectionEnd; }
-    void setSelectionEnd(int selectionEnd) { selectionEnd = m_selectionEnd; }
-
+    String text() const;
+    int selectionStart() const;
+    int selectionEnd() const;
     const Vector<unsigned>& getSegments() const;
 
 private:
-    Composition();
+    explicit Composition(InputMethodContext*);
 
-    String m_text;
-    int m_selectionStart;
-    int m_selectionEnd;
-    Vector<unsigned> m_segments;
+    InputMethodContext* m_inputMethodContext;
 };
 
 } // namespace WebCore
diff --git a/Source/core/html/ime/InputMethodContext.cpp b/Source/core/html/ime/InputMethodContext.cpp
index 8756006..cb57c90 100644
--- a/Source/core/html/ime/InputMethodContext.cpp
+++ b/Source/core/html/ime/InputMethodContext.cpp
@@ -31,9 +31,10 @@
 #include "config.h"
 #include "core/html/ime/InputMethodContext.h"
 
+#include "core/dom/Text.h"
 #include "core/editing/InputMethodController.h"
 #include "core/html/ime/Composition.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
@@ -43,8 +44,7 @@
 }
 
 InputMethodContext::InputMethodContext(HTMLElement* element)
-    : m_composition(0)
-    , m_element(element)
+    : m_element(element)
 {
     ScriptWrappable::init(this);
 }
@@ -53,10 +53,10 @@
 {
 }
 
-Composition* InputMethodContext::composition() const
+Composition* InputMethodContext::composition()
 {
-    // FIXME: Implement this. This should lazily update the composition object
-    // here.
+    if (!m_composition)
+        m_composition = Composition::create(this);
     return m_composition.get();
 }
 
@@ -73,15 +73,8 @@
 
 void InputMethodContext::confirmComposition()
 {
-    Frame* frame = m_element->document().frame();
-    if (!frame)
-        return;
-
-    const Element* element = frame->document()->focusedElement();
-    if (!element || !element->isHTMLElement() || m_element != toHTMLElement(element))
-        return;
-
-    frame->inputMethodController().confirmCompositionAndResetState();
+    if (hasFocus())
+        inputMethodController().confirmCompositionAndResetState();
 }
 
 void InputMethodContext::setCaretRectangle(Node* anchor, int x, int y, int w, int h)
@@ -94,4 +87,81 @@
     // FIXME: Implement this.
 }
 
+bool InputMethodContext::hasFocus() const
+{
+    Frame* frame = m_element->document().frame();
+    if (!frame)
+        return false;
+
+    const Element* element = frame->document()->focusedElement();
+    return element && element->isHTMLElement() && m_element == toHTMLElement(element);
+}
+
+String InputMethodContext::compositionText() const
+{
+    if (!hasFocus())
+        return emptyString();
+
+    Text* text = inputMethodController().compositionNode();
+    return text ? text->wholeText() : emptyString();
+}
+
+CompositionUnderline InputMethodContext::selectedSegment() const
+{
+    CompositionUnderline underline;
+    if (!hasFocus())
+        return underline;
+
+    const InputMethodController& controller = inputMethodController();
+    if (!controller.hasComposition())
+        return underline;
+
+    Vector<CompositionUnderline> underlines = controller.customCompositionUnderlines();
+    for (size_t i = 0; i < underlines.size(); ++i) {
+        if (underlines[i].thick)
+            return underlines[i];
+    }
+
+    // When no underline information is available while composition exists,
+    // build a CompositionUnderline whose element is the whole composition.
+    underline.endOffset = controller.compositionEnd() - controller.compositionStart();
+    return underline;
+
+}
+
+int InputMethodContext::selectionStart() const
+{
+    return selectedSegment().startOffset;
+}
+
+int InputMethodContext::selectionEnd() const
+{
+    return selectedSegment().endOffset;
+}
+
+const Vector<unsigned>& InputMethodContext::segments()
+{
+    m_segments.clear();
+    if (!hasFocus())
+        return m_segments;
+    const InputMethodController& controller = inputMethodController();
+    if (!controller.hasComposition())
+        return m_segments;
+
+    Vector<CompositionUnderline> underlines = controller.customCompositionUnderlines();
+    if (!underlines.size()) {
+        m_segments.append(0);
+    } else {
+        for (size_t i = 0; i < underlines.size(); ++i)
+            m_segments.append(underlines[i].startOffset);
+    }
+
+    return m_segments;
+}
+
+InputMethodController& InputMethodContext::inputMethodController() const
+{
+    return m_element->document().frame()->inputMethodController();
+}
+
 } // namespace WebCore
diff --git a/Source/core/html/ime/InputMethodContext.h b/Source/core/html/ime/InputMethodContext.h
index e75be39..c8b88b7 100644
--- a/Source/core/html/ime/InputMethodContext.h
+++ b/Source/core/html/ime/InputMethodContext.h
@@ -32,6 +32,7 @@
 #define InputMethodContext_h
 
 #include "bindings/v8/ScriptWrappable.h"
+#include "core/editing/CompositionUnderline.h"
 #include "core/html/HTMLElement.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
@@ -40,6 +41,7 @@
 namespace WebCore {
 
 class Composition;
+class InputMethodController;
 class Node;
 
 class InputMethodContext : public ScriptWrappable {
@@ -50,17 +52,27 @@
     void ref() { m_element->ref(); }
     void deref() { m_element->deref(); }
 
-    Composition* composition() const;
+    Composition* composition();
     String locale() const;
     HTMLElement* target() const;
     void confirmComposition();
     void setCaretRectangle(Node* anchor, int x, int y, int w, int h);
     void setExclusionRectangle(Node* anchor, int x, int y, int w, int h);
 
+    String compositionText() const;
+    int selectionStart() const;
+    int selectionEnd() const;
+    const Vector<unsigned>& segments();
+
 private:
     InputMethodContext(HTMLElement*);
-    RefPtr<Composition> m_composition;
+    bool hasFocus() const;
+    CompositionUnderline selectedSegment() const;
+    InputMethodController& inputMethodController() const;
+
     HTMLElement* m_element;
+    OwnPtr<Composition> m_composition;
+    Vector<unsigned> m_segments;
 };
 
 } // namespace WebCore
diff --git a/Source/core/html/parser/BackgroundHTMLInputStream.h b/Source/core/html/parser/BackgroundHTMLInputStream.h
index 3ffc16c..e036dea 100644
--- a/Source/core/html/parser/BackgroundHTMLInputStream.h
+++ b/Source/core/html/parser/BackgroundHTMLInputStream.h
@@ -26,7 +26,7 @@
 #ifndef BackgroundHTMLInputStream_h
 #define BackgroundHTMLInputStream_h
 
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 #include "wtf/Vector.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/html/parser/BackgroundHTMLParser.cpp b/Source/core/html/parser/BackgroundHTMLParser.cpp
index 23747ed..b04ebab 100644
--- a/Source/core/html/parser/BackgroundHTMLParser.cpp
+++ b/Source/core/html/parser/BackgroundHTMLParser.cpp
@@ -69,6 +69,12 @@
         ASSERT(preloads[i]->isSafeToSendToAnotherThread());
 }
 
+static void checkThatXSSInfosAreSafeToSendToAnotherThread(const XSSInfoStream& infos)
+{
+    for (size_t i = 0; i < infos.size(); ++i)
+        ASSERT(infos[i]->isSafeToSendToAnotherThread());
+}
+
 #endif
 
 BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser> > reference, PassOwnPtr<Configuration> config)
@@ -185,6 +191,7 @@
 #ifndef NDEBUG
     checkThatTokensAreSafeToSendToAnotherThread(m_pendingTokens.get());
     checkThatPreloadsAreSafeToSendToAnotherThread(m_pendingPreloads);
+    checkThatXSSInfosAreSafeToSendToAnotherThread(m_pendingXSSInfos);
 #endif
 
     OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentParser::ParsedChunk);
diff --git a/Source/core/html/parser/CSSPreloadScanner.cpp b/Source/core/html/parser/CSSPreloadScanner.cpp
index af3ff09..b3f1454 100644
--- a/Source/core/html/parser/CSSPreloadScanner.cpp
+++ b/Source/core/html/parser/CSSPreloadScanner.cpp
@@ -31,7 +31,7 @@
 #include "FetchInitiatorTypeNames.h"
 #include "core/html/parser/HTMLIdentifier.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLConstructionSite.cpp b/Source/core/html/parser/HTMLConstructionSite.cpp
index 169f067..2674bf7 100644
--- a/Source/core/html/parser/HTMLConstructionSite.cpp
+++ b/Source/core/html/parser/HTMLConstructionSite.cpp
@@ -46,8 +46,9 @@
 #include "core/html/parser/HTMLToken.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
-#include "core/platform/NotImplemented.h"
+#include "core/frame/Frame.h"
+#include "platform/NotImplemented.h"
+#include "platform/text/TextBreakIterator.h"
 #include <limits>
 
 namespace WebCore {
@@ -82,6 +83,11 @@
         && !node->hasTagName(SVGNames::scriptTag);
 }
 
+static unsigned textLengthLimitForContainer(const ContainerNode* node)
+{
+    return shouldUseLengthLimit(node) ? Text::defaultLengthLimit : std::numeric_limits<unsigned>::max();
+}
+
 static inline bool isAllWhitespace(const String& string)
 {
     return string.isAllSpecialCharacters<isHTMLSpace<UChar> >();
@@ -134,13 +140,12 @@
 {
     ASSERT(task.operation == HTMLConstructionSiteTask::TakeAllChildren);
 
-    task.parent->takeAllChildrenFrom(task.oldParent());
-    // Notice that we don't need to manually attach the moved children
-    // because takeAllChildrenFrom does that work for us.
+    task.parent->parserTakeAllChildrenFrom(task.oldParent());
 }
 
-static inline void executeTask(HTMLConstructionSiteTask& task)
+void HTMLConstructionSite::executeTask(HTMLConstructionSiteTask& task)
 {
+    ASSERT(m_taskQueue.isEmpty());
     if (task.operation == HTMLConstructionSiteTask::Insert)
         return executeInsertTask(task);
 
@@ -158,6 +163,50 @@
     ASSERT_NOT_REACHED();
 }
 
+// This is only needed for TextDocuments where we might have text nodes
+// approaching the default length limit (~64k) and we don't want to
+// break a text node in the middle of a combining character.
+static unsigned findBreakIndexBetween(const String& string, unsigned currentPosition, unsigned proposedBreakIndex)
+{
+    ASSERT(currentPosition < proposedBreakIndex);
+    ASSERT(proposedBreakIndex <= string.length());
+    // The end of the string is always a valid break.
+    if (proposedBreakIndex == string.length())
+        return proposedBreakIndex;
+
+    // Latin-1 does not have breakable boundaries. If we ever moved to a differnet 8-bit encoding this could be wrong.
+    if (string.is8Bit())
+        return proposedBreakIndex;
+
+    const UChar* breakSearchCharacters = string.characters16() + currentPosition;
+    // We need at least two characters look-ahead to account for UTF-16 surrogates, but can't search off the end of the buffer!
+    unsigned breakSearchLength = std::min(proposedBreakIndex - currentPosition + 2, string.length() - currentPosition);
+    NonSharedCharacterBreakIterator it(breakSearchCharacters, breakSearchLength);
+
+    if (it.isBreak(proposedBreakIndex - currentPosition))
+        return proposedBreakIndex;
+
+    int adjustedBreakIndexInSubstring = it.preceding(proposedBreakIndex - currentPosition);
+    if (adjustedBreakIndexInSubstring > 0)
+        return currentPosition + adjustedBreakIndexInSubstring;
+    // We failed to find a breakable point, let the caller figure out what to do.
+    return 0;
+}
+
+static String atomizeIfAllWhitespace(const String& string, WhitespaceMode whitespaceMode)
+{
+    // Strings composed entirely of whitespace are likely to be repeated.
+    // Turn them into AtomicString so we share a single string for each.
+    if (whitespaceMode == AllWhitespace || (whitespaceMode == WhitespaceUnknown && isAllWhitespace(string)))
+        return AtomicString(string).string();
+    return string;
+}
+
+void HTMLConstructionSite::queueTask(const HTMLConstructionSiteTask& task)
+{
+    m_taskQueue.append(task);
+}
+
 void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtr<Node> prpChild, bool selfClosing)
 {
     ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) || !prpChild.get()->isElementNode() || !toScriptLoaderIfPossible(toElement(prpChild.get())));
@@ -178,7 +227,7 @@
         task.parent = task.parent->parentNode();
 
     ASSERT(task.parent);
-    m_taskQueue.append(task);
+    queueTask(task);
 }
 
 void HTMLConstructionSite::executeQueuedTasks()
@@ -222,6 +271,9 @@
 
 HTMLConstructionSite::~HTMLConstructionSite()
 {
+    // Depending on why we're being destroyed it might be OK
+    // to forget queued tasks, but currently we don't expect to.
+    ASSERT(m_taskQueue.isEmpty());
 }
 
 void HTMLConstructionSite::detach()
@@ -392,8 +444,15 @@
     setCompatibilityMode(Document::NoQuirksMode);
 }
 
+void HTMLConstructionSite::processEndOfFile()
+{
+    ASSERT(currentNode());
+    openElements()->popAll();
+}
+
 void HTMLConstructionSite::finishedParsing()
 {
+    ASSERT(m_taskQueue.isEmpty());
     m_document->finishedParsing();
 }
 
@@ -525,48 +584,64 @@
         m_openElements.push(HTMLStackItem::create(element.release(), token, namespaceURI));
 }
 
-void HTMLConstructionSite::insertTextNode(const String& characters, WhitespaceMode whitespaceMode)
+void HTMLConstructionSite::insertTextNode(const String& string, WhitespaceMode whitespaceMode)
 {
-    HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert);
-    task.parent = currentNode();
+    HTMLConstructionSiteTask protoTask(HTMLConstructionSiteTask::Insert);
+    protoTask.parent = currentNode();
 
     if (shouldFosterParent())
-        findFosterSite(task);
+        findFosterSite(protoTask);
 
-    if (task.parent->hasTagName(templateTag))
-        task.parent = toHTMLTemplateElement(task.parent.get())->content();
+    // FIXME: This probably doesn't need to be done both here and in insert(Task).
+    if (protoTask.parent->hasTagName(templateTag))
+        protoTask.parent = toHTMLTemplateElement(protoTask.parent.get())->content();
 
-    // Strings composed entirely of whitespace are likely to be repeated.
-    // Turn them into AtomicString so we share a single string for each.
-    bool shouldUseAtomicString = whitespaceMode == AllWhitespace
-        || (whitespaceMode == WhitespaceUnknown && isAllWhitespace(characters));
-
+    // Splitting text nodes into smaller chunks contradicts HTML5 spec, but is necessary
+    // for performance, see: https://bugs.webkit.org/show_bug.cgi?id=55898
+    unsigned lengthLimit = textLengthLimitForContainer(protoTask.parent.get());
     unsigned currentPosition = 0;
-    unsigned lengthLimit = shouldUseLengthLimit(task.parent.get()) ? Text::defaultLengthLimit : std::numeric_limits<unsigned>::max();
 
-    // FIXME: Splitting text nodes into smaller chunks contradicts HTML5 spec, but is currently necessary
-    // for performance, see <https://bugs.webkit.org/show_bug.cgi?id=55898>.
-
-    Node* previousChild = task.nextChild ? task.nextChild->previousSibling() : task.parent->lastChild();
+    // Merge text nodes into previous ones if possible:
+    // http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#insert-a-character
+    Node* previousChild = protoTask.nextChild ? protoTask.nextChild->previousSibling() : protoTask.parent->lastChild();
     if (previousChild && previousChild->isTextNode()) {
-        // FIXME: We're only supposed to append to this text node if it
-        // was the last text node inserted by the parser.
-        currentPosition = toCharacterData(previousChild)->parserAppendData(characters, 0, lengthLimit);
+        Text* previousText = toText(previousChild);
+        unsigned appendLengthLimit = lengthLimit - previousText->length();
+
+        unsigned proposedBreakIndex = std::min(currentPosition + appendLengthLimit, string.length());
+        unsigned breakIndex = findBreakIndexBetween(string, currentPosition, proposedBreakIndex);
+        ASSERT(breakIndex <= string.length());
+        // If we didn't find a breable piece to append, forget it.
+        if (breakIndex) {
+            String substring = string.substring(currentPosition, breakIndex - currentPosition);
+            substring = atomizeIfAllWhitespace(substring, whitespaceMode);
+            previousText->parserAppendData(substring);
+            currentPosition += substring.length();
+        }
     }
 
-    while (currentPosition < characters.length()) {
-        RefPtr<Text> textNode = Text::createWithLengthLimit(task.parent->document(), shouldUseAtomicString ? AtomicString(characters).string() : characters, currentPosition, lengthLimit);
-        // If we have a whole string of unbreakable characters the above could lead to an infinite loop. Exceeding the length limit is the lesser evil.
-        if (!textNode->length()) {
-            String substring = characters.substring(currentPosition);
-            textNode = Text::create(task.parent->document(), shouldUseAtomicString ? AtomicString(substring).string() : substring);
-        }
+    while (currentPosition < string.length()) {
+        unsigned proposedBreakIndex = std::min(currentPosition + lengthLimit, string.length());
+        unsigned breakIndex = findBreakIndexBetween(string, currentPosition, proposedBreakIndex);
+        // We failed to find a breakable boudary between the minimum and the proposed, just give up and break at the proposed index.
+        // We could go searching after the proposed index, but current callers are attempting to break after 65k chars!
+        // 65k of unbreakable characters isn't worth trying to handle "correctly".
+        if (!breakIndex)
+            breakIndex = proposedBreakIndex;
+        ASSERT(breakIndex <= string.length());
+        String substring = string.substring(currentPosition, breakIndex - currentPosition);
+        substring = atomizeIfAllWhitespace(substring, whitespaceMode);
 
-        currentPosition += textNode->length();
-        ASSERT(currentPosition <= characters.length());
-        task.child = textNode.release();
+        HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert);
+        task.parent = protoTask.parent;
+        task.nextChild = protoTask.nextChild;
+        task.child = Text::create(task.parent->document(), substring);
+        queueTask(task);
 
-        executeTask(task);
+        ASSERT(breakIndex > currentPosition);
+        ASSERT(breakIndex - currentPosition == substring.length());
+        ASSERT(toText(task.child.get())->length() == substring.length());
+        currentPosition = breakIndex;
     }
 }
 
@@ -575,7 +650,7 @@
     HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Reparent);
     task.parent = newParent->node();
     task.child = child->node();
-    m_taskQueue.append(task);
+    queueTask(task);
 }
 
 void HTMLConstructionSite::reparent(HTMLElementStack::ElementRecord* newParent, HTMLStackItem* child)
@@ -583,7 +658,7 @@
     HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Reparent);
     task.parent = newParent->node();
     task.child = child->node();
-    m_taskQueue.append(task);
+    queueTask(task);
 }
 
 void HTMLConstructionSite::insertAlreadyParsedChild(HTMLStackItem* newParent, HTMLElementStack::ElementRecord* child)
@@ -596,7 +671,7 @@
     HTMLConstructionSiteTask task(HTMLConstructionSiteTask::InsertAlreadyParsedChild);
     task.parent = newParent->node();
     task.child = child->node();
-    m_taskQueue.append(task);
+    queueTask(task);
 }
 
 void HTMLConstructionSite::takeAllChildren(HTMLStackItem* newParent, HTMLElementStack::ElementRecord* oldParent)
@@ -604,7 +679,7 @@
     HTMLConstructionSiteTask task(HTMLConstructionSiteTask::TakeAllChildren);
     task.parent = newParent->node();
     task.child = oldParent->node();
-    m_taskQueue.append(task);
+    queueTask(task);
 }
 
 PassRefPtr<Element> HTMLConstructionSite::createElement(AtomicHTMLToken* token, const AtomicString& namespaceURI)
@@ -746,8 +821,7 @@
     findFosterSite(task);
     task.child = node;
     ASSERT(task.parent);
-
-    m_taskQueue.append(task);
+    queueTask(task);
 }
 
 }
diff --git a/Source/core/html/parser/HTMLConstructionSite.h b/Source/core/html/parser/HTMLConstructionSite.h
index ba03ce7..cac778c 100644
--- a/Source/core/html/parser/HTMLConstructionSite.h
+++ b/Source/core/html/parser/HTMLConstructionSite.h
@@ -34,13 +34,14 @@
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
+#include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
 struct HTMLConstructionSiteTask {
     enum Operation {
         Insert,
-        InsertAlreadyParsedChild,
+        InsertAlreadyParsedChild, // Insert w/o calling begin/end parsing.
         Reparent,
         TakeAllChildren,
     };
@@ -74,10 +75,12 @@
 
 namespace WebCore {
 
+// Note: These are intentionally ordered so that when we concatonate
+// strings and whitespaces the resulting whitespace is ws = min(ws1, ws2).
 enum WhitespaceMode {
-    AllWhitespace,
+    WhitespaceUnknown,
     NotAllWhitespace,
-    WhitespaceUnknown
+    AllWhitespace,
 };
 
 class AtomicHTMLToken;
@@ -96,6 +99,7 @@
     void executeQueuedTasks();
 
     void setDefaultCompatibilityMode();
+    void processEndOfFile();
     void finishedParsing();
 
     void insertDoctype(AtomicHTMLToken*);
@@ -195,6 +199,9 @@
     void mergeAttributesFromTokenIntoElement(AtomicHTMLToken*, Element*);
     void dispatchDocumentElementAvailableIfNeeded();
 
+    void executeTask(HTMLConstructionSiteTask&);
+    void queueTask(const HTMLConstructionSiteTask&);
+
     Document* m_document;
 
     // This is the root ContainerNode to which the parser attaches all newly
diff --git a/Source/core/html/parser/HTMLDocumentParser.cpp b/Source/core/html/parser/HTMLDocumentParser.cpp
index e377ee6..3a00763 100644
--- a/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -41,8 +41,8 @@
 #include "core/html/parser/HTMLTokenizer.h"
 #include "core/html/parser/HTMLTreeBuilder.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/page/Frame.h"
-#include "core/platform/chromium/TraceEvent.h"
+#include "core/frame/Frame.h"
+#include "platform/TraceEvent.h"
 #include "wtf/Functional.h"
 
 namespace WebCore {
@@ -299,6 +299,8 @@
 
 void HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk> chunk)
 {
+    TRACE_EVENT0("webkit", "HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser");
+
     // alert(), runModalDialog, and the JavaScript Debugger all run nested event loops
     // which can cause this method to be re-entered. We detect re-entry using
     // hasActiveParser(), save the chunk as a speculation, and return.
@@ -378,6 +380,8 @@
 
 void HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk> popChunk)
 {
+    TRACE_EVENT0("webkit", "HTMLDocumentParser::processParsedChunkFromBackgroundParser");
+
     ASSERT_WITH_SECURITY_IMPLICATION(!document()->activeParserCount());
     ASSERT(!isParsingFragment());
     ASSERT(!isWaitingForScripts());
diff --git a/Source/core/html/parser/HTMLDocumentParser.h b/Source/core/html/parser/HTMLDocumentParser.h
index 4b3be11..b41beae 100644
--- a/Source/core/html/parser/HTMLDocumentParser.h
+++ b/Source/core/html/parser/HTMLDocumentParser.h
@@ -41,7 +41,7 @@
 #include "core/html/parser/HTMLTreeBuilderSimulator.h"
 #include "core/html/parser/XSSAuditor.h"
 #include "core/html/parser/XSSAuditorDelegate.h"
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 #include "wtf/Deque.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/WeakPtr.h"
diff --git a/Source/core/html/parser/HTMLEntityParser.h b/Source/core/html/parser/HTMLEntityParser.h
index 12499c7..ed5d7e6 100644
--- a/Source/core/html/parser/HTMLEntityParser.h
+++ b/Source/core/html/parser/HTMLEntityParser.h
@@ -27,7 +27,7 @@
 #ifndef HTMLEntityParser_h
 #define HTMLEntityParser_h
 
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLInputStream.h b/Source/core/html/parser/HTMLInputStream.h
index c7acd97..a121b13 100644
--- a/Source/core/html/parser/HTMLInputStream.h
+++ b/Source/core/html/parser/HTMLInputStream.h
@@ -27,7 +27,7 @@
 #define HTMLInputStream_h
 
 #include "core/html/parser/InputStreamPreprocessor.h"
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLMetaCharsetParser.h b/Source/core/html/parser/HTMLMetaCharsetParser.h
index 5ee8862..3393fca 100644
--- a/Source/core/html/parser/HTMLMetaCharsetParser.h
+++ b/Source/core/html/parser/HTMLMetaCharsetParser.h
@@ -27,7 +27,7 @@
 #define HTMLMetaCharsetParser_h
 
 #include "core/html/parser/HTMLToken.h"
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/text/TextCodec.h"
 #include "wtf/text/TextEncoding.h"
diff --git a/Source/core/html/parser/HTMLParserIdioms.cpp b/Source/core/html/parser/HTMLParserIdioms.cpp
index 493627c..b635e62 100644
--- a/Source/core/html/parser/HTMLParserIdioms.cpp
+++ b/Source/core/html/parser/HTMLParserIdioms.cpp
@@ -28,7 +28,7 @@
 #include <limits>
 #include "core/dom/QualifiedName.h"
 #include "core/html/parser/HTMLIdentifier.h"
-#include "core/platform/Decimal.h"
+#include "platform/Decimal.h"
 #include "wtf/MathExtras.h"
 #include "wtf/text/AtomicString.h"
 #include "wtf/text/StringBuilder.h"
diff --git a/Source/core/html/parser/HTMLParserOptions.cpp b/Source/core/html/parser/HTMLParserOptions.cpp
index 3ed0490..7de381b 100644
--- a/Source/core/html/parser/HTMLParserOptions.cpp
+++ b/Source/core/html/parser/HTMLParserOptions.cpp
@@ -29,7 +29,7 @@
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/Document.h"
 #include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
 
 namespace WebCore {
diff --git a/Source/core/html/parser/HTMLParserScheduler.cpp b/Source/core/html/parser/HTMLParserScheduler.cpp
index b5b3889..c746284 100644
--- a/Source/core/html/parser/HTMLParserScheduler.cpp
+++ b/Source/core/html/parser/HTMLParserScheduler.cpp
@@ -28,7 +28,7 @@
 
 #include "core/dom/Document.h"
 #include "core/html/parser/HTMLDocumentParser.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLParserScheduler.h b/Source/core/html/parser/HTMLParserScheduler.h
index 01624b7..e8bfe49 100644
--- a/Source/core/html/parser/HTMLParserScheduler.h
+++ b/Source/core/html/parser/HTMLParserScheduler.h
@@ -27,7 +27,7 @@
 #define HTMLParserScheduler_h
 
 #include "core/html/parser/NestingLevelIncrementer.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/html/parser/HTMLParserThread.cpp b/Source/core/html/parser/HTMLParserThread.cpp
index 0ddc058..182d2a7 100644
--- a/Source/core/html/parser/HTMLParserThread.cpp
+++ b/Source/core/html/parser/HTMLParserThread.cpp
@@ -31,9 +31,9 @@
 #include "config.h"
 #include "core/html/parser/HTMLParserThread.h"
 
-#include "core/platform/Task.h"
-#include "wtf/PassOwnPtr.h"
+#include "platform/Task.h"
 #include "public/platform/Platform.h"
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLPreloadScanner.cpp b/Source/core/html/parser/HTMLPreloadScanner.cpp
index e4a3abb..a6c98ea 100644
--- a/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -35,7 +35,7 @@
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/html/parser/HTMLSrcsetParser.h"
 #include "core/html/parser/HTMLTokenizer.h"
-#include "core/platform/chromium/TraceEvent.h"
+#include "platform/TraceEvent.h"
 #include "wtf/MainThread.h"
 
 namespace WebCore {
diff --git a/Source/core/html/parser/HTMLPreloadScanner.h b/Source/core/html/parser/HTMLPreloadScanner.h
index 50366d1..956d30b 100644
--- a/Source/core/html/parser/HTMLPreloadScanner.h
+++ b/Source/core/html/parser/HTMLPreloadScanner.h
@@ -30,7 +30,7 @@
 #include "core/html/parser/CSSPreloadScanner.h"
 #include "core/html/parser/CompactHTMLToken.h"
 #include "core/html/parser/HTMLToken.h"
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
diff --git a/Source/core/html/parser/HTMLScriptRunner.cpp b/Source/core/html/parser/HTMLScriptRunner.cpp
index ea8411c..c8b9c6c 100644
--- a/Source/core/html/parser/HTMLScriptRunner.cpp
+++ b/Source/core/html/parser/HTMLScriptRunner.cpp
@@ -36,8 +36,8 @@
 #include "core/html/parser/HTMLInputStream.h"
 #include "core/html/parser/HTMLScriptRunnerHost.h"
 #include "core/html/parser/NestingLevelIncrementer.h"
-#include "core/page/Frame.h"
-#include "core/platform/NotImplemented.h"
+#include "core/frame/Frame.h"
+#include "platform/NotImplemented.h"
 
 namespace WebCore {
 
@@ -81,7 +81,7 @@
 
 inline PassRefPtr<Event> createScriptLoadEvent()
 {
-    return Event::create(eventNames().loadEvent);
+    return Event::create(EventTypeNames::load);
 }
 
 ScriptSourceCode HTMLScriptRunner::sourceFromPendingScript(const PendingScript& script, bool& errorOccurred) const
diff --git a/Source/core/html/parser/HTMLSourceTracker.h b/Source/core/html/parser/HTMLSourceTracker.h
index 63fec2b..083e6a9 100644
--- a/Source/core/html/parser/HTMLSourceTracker.h
+++ b/Source/core/html/parser/HTMLSourceTracker.h
@@ -27,7 +27,7 @@
 #define HTMLSourceTracker_h
 
 #include "core/html/parser/HTMLToken.h"
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLSrcsetParser.cpp b/Source/core/html/parser/HTMLSrcsetParser.cpp
index 40c95a1..815b556 100644
--- a/Source/core/html/parser/HTMLSrcsetParser.cpp
+++ b/Source/core/html/parser/HTMLSrcsetParser.cpp
@@ -154,10 +154,13 @@
     return pickBestImageCandidate(deviceScaleFactor, imageCandidates);
 }
 
-String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& srcsetAttribute)
+ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& srcsetAttribute)
 {
-    if (srcsetAttribute.isNull())
-        return srcAttribute;
+    if (srcsetAttribute.isNull()) {
+        if (srcAttribute.isNull())
+            return ImageCandidate();
+        return ImageCandidate(srcAttribute, 0, srcAttribute.length(), 1);
+    }
 
     Vector<ImageCandidate> imageCandidates;
 
@@ -166,7 +169,7 @@
     if (!srcAttribute.isEmpty())
         imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.length(), 1.0));
 
-    return pickBestImageCandidate(deviceScaleFactor, imageCandidates).toString();
+    return pickBestImageCandidate(deviceScaleFactor, imageCandidates);
 }
 
 String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, ImageCandidate& srcsetImageCandidate)
diff --git a/Source/core/html/parser/HTMLSrcsetParser.h b/Source/core/html/parser/HTMLSrcsetParser.h
index bb53cb8..8964ffb 100644
--- a/Source/core/html/parser/HTMLSrcsetParser.h
+++ b/Source/core/html/parser/HTMLSrcsetParser.h
@@ -70,7 +70,7 @@
 
 ImageCandidate bestFitSourceForSrcsetAttribute(float deviceScaleFactor, const String& srcsetAttribute);
 
-String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& srcsetAttribute);
+ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& srcsetAttribute);
 
 String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, ImageCandidate& srcsetImageCandidate);
 
diff --git a/Source/core/html/parser/HTMLTokenizer.cpp b/Source/core/html/parser/HTMLTokenizer.cpp
index c78cd59..d6258b1 100644
--- a/Source/core/html/parser/HTMLTokenizer.cpp
+++ b/Source/core/html/parser/HTMLTokenizer.cpp
@@ -32,7 +32,7 @@
 #include "core/html/parser/HTMLEntityParser.h"
 #include "core/html/parser/HTMLToken.h"
 #include "core/html/parser/HTMLTreeBuilder.h"
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
 #include "core/xml/parser/MarkupTokenizerInlines.h"
 #include "wtf/ASCIICType.h"
 #include "wtf/text/AtomicString.h"
diff --git a/Source/core/html/parser/HTMLTokenizer.h b/Source/core/html/parser/HTMLTokenizer.h
index bbfa0f2..aa7c059 100644
--- a/Source/core/html/parser/HTMLTokenizer.h
+++ b/Source/core/html/parser/HTMLTokenizer.h
@@ -30,7 +30,7 @@
 #include "core/html/parser/HTMLParserOptions.h"
 #include "core/html/parser/HTMLToken.h"
 #include "core/html/parser/InputStreamPreprocessor.h"
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/parser/HTMLTreeBuilder.cpp b/Source/core/html/parser/HTMLTreeBuilder.cpp
index ac516a2..f9252ed 100644
--- a/Source/core/html/parser/HTMLTreeBuilder.cpp
+++ b/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -46,8 +46,8 @@
 #include "core/html/parser/HTMLStackItem.h"
 #include "core/html/parser/HTMLToken.h"
 #include "core/html/parser/HTMLTokenizer.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/MainThread.h"
 #include "wtf/unicode/CharacterNames.h"
 
@@ -390,31 +390,31 @@
 
 void HTMLTreeBuilder::processToken(AtomicHTMLToken* token)
 {
+    if (token->type() == HTMLToken::Character) {
+        processCharacter(token);
+        return;
+    }
+
+    m_shouldSkipLeadingNewline = false;
+
     switch (token->type()) {
     case HTMLToken::Uninitialized:
+    case HTMLToken::Character:
         ASSERT_NOT_REACHED();
         break;
     case HTMLToken::DOCTYPE:
-        m_shouldSkipLeadingNewline = false;
         processDoctypeToken(token);
         break;
     case HTMLToken::StartTag:
-        m_shouldSkipLeadingNewline = false;
         processStartTag(token);
         break;
     case HTMLToken::EndTag:
-        m_shouldSkipLeadingNewline = false;
         processEndTag(token);
         break;
     case HTMLToken::Comment:
-        m_shouldSkipLeadingNewline = false;
         processComment(token);
-        return;
-    case HTMLToken::Character:
-        processCharacter(token);
         break;
     case HTMLToken::EndOfFile:
-        m_shouldSkipLeadingNewline = false;
         processEndOfFile(token);
         break;
     }
@@ -501,7 +501,7 @@
     if (promptAttribute)
         processFakeCharacters(promptAttribute->value());
     else
-        processFakeCharacters(searchableIndexIntroduction());
+        processFakeCharacters(Locale::defaultLocale()->queryString(WebKit::WebLocalizedString::SearchableIndexIntroduction));
     processFakeStartTag(inputTag, attributesForIsindexInput(token));
     notImplemented(); // This second set of characters may be needed by non-english locales.
     processFakeEndTag(labelTag);
@@ -1144,6 +1144,7 @@
             || token->name() == noframesTag
             || token->name() == scriptTag
             || token->name() == styleTag
+            || token->name() == templateTag
             || token->name() == titleTag) {
             parseError(token);
             ASSERT(m_tree.head());
@@ -1604,13 +1605,21 @@
     while (1) {
         RefPtr<HTMLStackItem> item = nodeRecord->stackItem();
         if (item->node() == m_tree.openElements()->rootNode()) {
-            ASSERT(isParsingFragment());
             last = true;
-            item = HTMLStackItem::create(m_fragmentContext.contextElement(), HTMLStackItem::ItemForContextElement);
+            if (isParsingFragment())
+                item = HTMLStackItem::create(m_fragmentContext.contextElement(), HTMLStackItem::ItemForContextElement);
         }
         if (item->hasTagName(templateTag))
             return setInsertionMode(m_templateInsertionModes.last());
         if (item->hasTagName(selectTag)) {
+            if (!last) {
+                while (item->node() != m_tree.openElements()->rootNode() && !item->hasTagName(templateTag)) {
+                    nodeRecord = nodeRecord->next();
+                    item = nodeRecord->stackItem();
+                    if (isHTMLTableElement(item->node()))
+                        return setInsertionMode(InSelectInTableMode);
+                }
+            }
             return setInsertionMode(InSelectMode);
         }
         if (item->hasTagName(tdTag) || item->hasTagName(thTag))
@@ -1637,6 +1646,9 @@
             return setInsertionMode(InFramesetMode);
         }
         if (isHTMLHtmlElement(item->node())) {
+            if (m_tree.headStackItem())
+                return setInsertionMode(AfterHeadMode);
+
             ASSERT(isParsingFragment());
             return setInsertionMode(BeforeHeadMode);
         }
@@ -2514,8 +2526,7 @@
             return;
         break;
     }
-    ASSERT(m_tree.currentNode());
-    m_tree.openElements()->popAll();
+    m_tree.processEndOfFile();
 }
 
 void HTMLTreeBuilder::defaultForInitial()
@@ -2817,4 +2828,4 @@
 {
 }
 
-}
+} // namespace WebCore
diff --git a/Source/core/html/parser/InputStreamPreprocessor.h b/Source/core/html/parser/InputStreamPreprocessor.h
index 842e948..a411d52 100644
--- a/Source/core/html/parser/InputStreamPreprocessor.h
+++ b/Source/core/html/parser/InputStreamPreprocessor.h
@@ -28,7 +28,7 @@
 #ifndef InputStreamPreprocessor_h
 #define InputStreamPreprocessor_h
 
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 #include "wtf/Noncopyable.h"
 
 namespace WebCore {
diff --git a/Source/core/html/parser/XSSAuditor.cpp b/Source/core/html/parser/XSSAuditor.cpp
index 3cb8c12..948a24f 100644
--- a/Source/core/html/parser/XSSAuditor.cpp
+++ b/Source/core/html/parser/XSSAuditor.cpp
@@ -37,12 +37,12 @@
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/html/parser/XSSAuditorDelegate.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/Frame.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
-#include "core/platform/JSONValues.h"
 #include "core/platform/network/FormData.h"
-#include "core/platform/text/DecodeEscapeSequences.h"
+#include "platform/JSONValues.h"
+#include "platform/text/DecodeEscapeSequences.h"
 #include "weborigin/KURL.h"
 #include "wtf/MainThread.h"
 #include "wtf/text/TextEncoding.h"
@@ -170,12 +170,12 @@
     return workingString;
 }
 
-static ContentSecurityPolicy::ReflectedXSSDisposition combineXSSProtectionHeaderAndCSP(ContentSecurityPolicy::ReflectedXSSDisposition xssProtection, ContentSecurityPolicy::ReflectedXSSDisposition reflectedXSS)
+static ReflectedXSSDisposition combineXSSProtectionHeaderAndCSP(ReflectedXSSDisposition xssProtection, ReflectedXSSDisposition reflectedXSS)
 {
-    ContentSecurityPolicy::ReflectedXSSDisposition result = std::max(xssProtection, reflectedXSS);
+    ReflectedXSSDisposition result = std::max(xssProtection, reflectedXSS);
 
-    if (result == ContentSecurityPolicy::ReflectedXSSInvalid || result == ContentSecurityPolicy::FilterReflectedXSS || result == ContentSecurityPolicy::ReflectedXSSUnset)
-        return ContentSecurityPolicy::FilterReflectedXSS;
+    if (result == ReflectedXSSInvalid || result == FilterReflectedXSS || result == ReflectedXSSUnset)
+        return FilterReflectedXSS;
 
     return result;
 }
@@ -198,7 +198,7 @@
 
 XSSAuditor::XSSAuditor()
     : m_isEnabled(false)
-    , m_xssProtection(ContentSecurityPolicy::FilterReflectedXSS)
+    , m_xssProtection(FilterReflectedXSS)
     , m_didSendValidCSPHeader(false)
     , m_didSendValidXSSProtectionHeader(false)
     , m_state(Uninitialized)
@@ -214,7 +214,7 @@
 {
     ASSERT(isMainThread());
     ASSERT(m_state == Uninitialized);
-    m_state = Initialized;
+    m_state = FilteringTokens;
     // When parsing a fragment, we don't enable the XSS auditor because it's
     // too much overhead.
     ASSERT(!m_isEnabled);
@@ -226,10 +226,9 @@
     const int suffixTreeDepth = 5;
 
     ASSERT(isMainThread());
-    if (m_state == Initialized)
+    if (m_state != Uninitialized)
         return;
-    ASSERT(m_state == Uninitialized);
-    m_state = Initialized;
+    m_state = FilteringTokens;
 
     if (Settings* settings = document->settings())
         m_isEnabled = settings->xssAuditorEnabled();
@@ -274,21 +273,21 @@
         KURL xssProtectionReportURL;
 
         // Process the X-XSS-Protection header, then mix in the CSP header's value.
-        ContentSecurityPolicy::ReflectedXSSDisposition xssProtectionHeader = parseXSSProtectionHeader(headerValue, errorDetails, errorPosition, reportURL);
-        m_didSendValidXSSProtectionHeader = xssProtectionHeader != ContentSecurityPolicy::ReflectedXSSUnset && xssProtectionHeader != ContentSecurityPolicy::ReflectedXSSInvalid;
-        if ((xssProtectionHeader == ContentSecurityPolicy::FilterReflectedXSS || xssProtectionHeader == ContentSecurityPolicy::BlockReflectedXSS) && !reportURL.isEmpty()) {
+        ReflectedXSSDisposition xssProtectionHeader = parseXSSProtectionHeader(headerValue, errorDetails, errorPosition, reportURL);
+        m_didSendValidXSSProtectionHeader = xssProtectionHeader != ReflectedXSSUnset && xssProtectionHeader != ReflectedXSSInvalid;
+        if ((xssProtectionHeader == FilterReflectedXSS || xssProtectionHeader == BlockReflectedXSS) && !reportURL.isEmpty()) {
             xssProtectionReportURL = document->completeURL(reportURL);
             if (MixedContentChecker::isMixedContent(document->securityOrigin(), xssProtectionReportURL)) {
                 errorDetails = "insecure reporting URL for secure page";
-                xssProtectionHeader = ContentSecurityPolicy::ReflectedXSSInvalid;
+                xssProtectionHeader = ReflectedXSSInvalid;
                 xssProtectionReportURL = KURL();
             }
         }
-        if (xssProtectionHeader == ContentSecurityPolicy::ReflectedXSSInvalid)
+        if (xssProtectionHeader == ReflectedXSSInvalid)
             document->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Error parsing header X-XSS-Protection: " + headerValue + ": "  + errorDetails + " at character position " + String::format("%u", errorPosition) + ". The default protections will be applied.");
 
-        ContentSecurityPolicy::ReflectedXSSDisposition cspHeader = document->contentSecurityPolicy()->reflectedXSSDisposition();
-        m_didSendValidCSPHeader = cspHeader != ContentSecurityPolicy::ReflectedXSSUnset && cspHeader != ContentSecurityPolicy::ReflectedXSSInvalid;
+        ReflectedXSSDisposition cspHeader = document->contentSecurityPolicy()->reflectedXSSDisposition();
+        m_didSendValidCSPHeader = cspHeader != ReflectedXSSUnset && cspHeader != ReflectedXSSInvalid;
 
         m_xssProtection = combineXSSProtectionHeaderAndCSP(xssProtectionHeader, cspHeader);
         // FIXME: Combine the two report URLs in some reasonable way.
@@ -315,8 +314,8 @@
 
 PassOwnPtr<XSSInfo> XSSAuditor::filterToken(const FilterTokenRequest& request)
 {
-    ASSERT(m_state == Initialized);
-    if (!m_isEnabled || m_xssProtection == ContentSecurityPolicy::AllowReflectedXSS)
+    ASSERT(m_state != Uninitialized);
+    if (!m_isEnabled || m_xssProtection == AllowReflectedXSS)
         return nullptr;
 
     bool didBlockScript = false;
@@ -330,8 +329,8 @@
     }
 
     if (didBlockScript) {
-        bool didBlockEntirePage = (m_xssProtection == ContentSecurityPolicy::BlockReflectedXSS);
-        OwnPtr<XSSInfo> xssInfo = XSSInfo::create(didBlockEntirePage, m_didSendValidXSSProtectionHeader, m_didSendValidCSPHeader);
+        bool didBlockEntirePage = (m_xssProtection == BlockReflectedXSS);
+        OwnPtr<XSSInfo> xssInfo = XSSInfo::create(m_documentURL, didBlockEntirePage, m_didSendValidXSSProtectionHeader, m_didSendValidCSPHeader);
         return xssInfo.release();
     }
     return nullptr;
@@ -339,6 +338,7 @@
 
 bool XSSAuditor::filterStartToken(const FilterTokenRequest& request)
 {
+    m_state = FilteringTokens;
     bool didBlockScript = eraseDangerousAttributesIfInjected(request);
 
     if (hasName(request.token, scriptTag)) {
@@ -372,6 +372,7 @@
 void XSSAuditor::filterEndToken(const FilterTokenRequest& request)
 {
     ASSERT(m_scriptTagNestingLevel);
+    m_state = FilteringTokens;
     if (hasName(request.token, scriptTag)) {
         m_scriptTagNestingLevel--;
         ASSERT(request.shouldAllowCDATA || !m_scriptTagNestingLevel);
@@ -381,11 +382,19 @@
 bool XSSAuditor::filterCharacterToken(const FilterTokenRequest& request)
 {
     ASSERT(m_scriptTagNestingLevel);
-    if (m_scriptTagFoundInRequest && isContainedInRequest(decodedSnippetForJavaScript(request))) {
+    ASSERT(m_state != Uninitialized);
+    if (m_state == PermittingAdjacentCharacterTokens)
+        return false;
+
+    if ((m_state == SuppressingAdjacentCharacterTokens)
+        || (m_scriptTagFoundInRequest && isContainedInRequest(decodedSnippetForJavaScript(request)))) {
         request.token.eraseCharacters();
         request.token.appendToCharacter(' '); // Technically, character tokens can't be empty.
+        m_state = SuppressingAdjacentCharacterTokens;
         return true;
     }
+
+    m_state = PermittingAdjacentCharacterTokens;
     return false;
 }
 
diff --git a/Source/core/html/parser/XSSAuditor.h b/Source/core/html/parser/XSSAuditor.h
index 5249479..f2f4ae2 100644
--- a/Source/core/html/parser/XSSAuditor.h
+++ b/Source/core/html/parser/XSSAuditor.h
@@ -27,8 +27,8 @@
 #define XSSAuditor_h
 
 #include "core/html/parser/HTMLToken.h"
-#include "core/platform/network/HTTPParsers.h"
-#include "core/platform/text/SuffixTree.h"
+#include "platform/network/HTTPParsers.h"
+#include "platform/text/SuffixTree.h"
 #include "weborigin/KURL.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/TextEncoding.h"
@@ -69,7 +69,9 @@
 
     enum State {
         Uninitialized,
-        Initialized
+        FilteringTokens,
+        PermittingAdjacentCharacterTokens,
+        SuppressingAdjacentCharacterTokens
     };
 
     enum AttributeKind {
@@ -107,7 +109,7 @@
     KURL m_documentURL;
     bool m_isEnabled;
 
-    ContentSecurityPolicy::ReflectedXSSDisposition m_xssProtection;
+    ReflectedXSSDisposition m_xssProtection;
     bool m_didSendValidCSPHeader;
     bool m_didSendValidXSSProtectionHeader;
 
diff --git a/Source/core/html/parser/XSSAuditorDelegate.cpp b/Source/core/html/parser/XSSAuditorDelegate.cpp
index f75adb5..f59b7c8 100644
--- a/Source/core/html/parser/XSSAuditorDelegate.cpp
+++ b/Source/core/html/parser/XSSAuditorDelegate.cpp
@@ -31,14 +31,40 @@
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/loader/PingLoader.h"
-#include "core/page/Frame.h"
-#include "core/platform/JSONValues.h"
+#include "core/frame/Frame.h"
 #include "core/platform/network/FormData.h"
+#include "platform/JSONValues.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
 
+String XSSInfo::buildConsoleError() const
+{
+    StringBuilder message;
+    message.append("The XSS Auditor ");
+    message.append(m_didBlockEntirePage ? "blocked access to" : "refused to execute a script in");
+    message.append(" '");
+    message.append(m_originalURL);
+    message.append("' because ");
+    message.append(m_didBlockEntirePage ? "the source code of a script" : "its source code");
+    message.append(" was found within the request.");
+
+    if (m_didSendCSPHeader)
+        message.append(" The server sent a 'Content-Security-Policy' header requesting this behavior.");
+    else if (m_didSendXSSProtectionHeader)
+        message.append(" The server sent an 'X-XSS-Protection' header requesting this behavior.");
+    else
+        message.append(" The auditor was enabled as the server sent neither an 'X-XSS-Protection' nor 'Content-Security-Policy' header.");
+
+    return message.toString();
+}
+
+bool XSSInfo::isSafeToSendToAnotherThread() const
+{
+    return m_originalURL.isSafeToSendToAnotherThread();
+}
+
 XSSAuditorDelegate::XSSAuditorDelegate(Document* document)
     : m_document(document)
     , m_didSendNotifications(false)
@@ -47,28 +73,7 @@
     ASSERT(m_document);
 }
 
-static inline String buildConsoleError(const XSSInfo& xssInfo, const String& url)
-{
-    StringBuilder message;
-    message.append("The XSS Auditor ");
-    message.append(xssInfo.m_didBlockEntirePage ? "blocked access to" : "refused to execute a script in");
-    message.append(" '");
-    message.append(url);
-    message.append("' because ");
-    message.append(xssInfo.m_didBlockEntirePage ? "the source code of a script" : "its source code");
-    message.append(" was found within the request.");
-
-    if (xssInfo.m_didSendCSPHeader)
-        message.append(" The server sent a 'Content-Security-Policy' header requesting this behavior.");
-    else if (xssInfo.m_didSendXSSProtectionHeader)
-        message.append(" The server sent an 'X-XSS-Protection' header requesting this behavior.");
-    else
-        message.append(" The auditor was enabled as the server sent neither an 'X-XSS-Protection' nor 'Content-Security-Policy' header.");
-
-    return message.toString();
-}
-
-PassRefPtr<FormData> XSSAuditorDelegate::generateViolationReport()
+PassRefPtr<FormData> XSSAuditorDelegate::generateViolationReport(const XSSInfo& xssInfo)
 {
     ASSERT(isMainThread());
 
@@ -80,7 +85,7 @@
     }
 
     RefPtr<JSONObject> reportDetails = JSONObject::create();
-    reportDetails->setString("request-url", m_document->url().string());
+    reportDetails->setString("request-url", xssInfo.m_originalURL);
     reportDetails->setString("request-body", httpBody);
 
     RefPtr<JSONObject> reportObject = JSONObject::create();
@@ -93,7 +98,7 @@
 {
     ASSERT(isMainThread());
 
-    m_document->addConsoleMessage(JSMessageSource, ErrorMessageLevel, buildConsoleError(xssInfo, m_document->url().string()));
+    m_document->addConsoleMessage(JSMessageSource, ErrorMessageLevel, xssInfo.buildConsoleError());
 
     // stopAllLoaders can detach the Frame, so protect it.
     RefPtr<Frame> protect(m_document->frame());
@@ -107,7 +112,7 @@
         frameLoader->client()->didDetectXSS(m_document->url(), xssInfo.m_didBlockEntirePage);
 
         if (!m_reportURL.isEmpty())
-            PingLoader::sendViolationReport(m_document->frame(), m_reportURL, generateViolationReport(), PingLoader::XSSAuditorViolationReport);
+            PingLoader::sendViolationReport(m_document->frame(), m_reportURL, generateViolationReport(xssInfo), PingLoader::XSSAuditorViolationReport);
     }
 
     if (xssInfo.m_didBlockEntirePage)
diff --git a/Source/core/html/parser/XSSAuditorDelegate.h b/Source/core/html/parser/XSSAuditorDelegate.h
index 896ef26..fbd0577 100644
--- a/Source/core/html/parser/XSSAuditorDelegate.h
+++ b/Source/core/html/parser/XSSAuditorDelegate.h
@@ -31,6 +31,7 @@
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/text/TextPosition.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
@@ -39,19 +40,24 @@
 
 class XSSInfo {
 public:
-    static PassOwnPtr<XSSInfo> create(bool didBlockEntirePage, bool didSendXSSProtectionHeader, bool didSendCSPHeader)
+    static PassOwnPtr<XSSInfo> create(const String& originalURL, bool didBlockEntirePage, bool didSendXSSProtectionHeader, bool didSendCSPHeader)
     {
-        return adoptPtr(new XSSInfo(didBlockEntirePage, didSendXSSProtectionHeader, didSendCSPHeader));
+        return adoptPtr(new XSSInfo(originalURL, didBlockEntirePage, didSendXSSProtectionHeader, didSendCSPHeader));
     }
 
+    String buildConsoleError() const;
+    bool isSafeToSendToAnotherThread() const;
+
+    String m_originalURL;
     bool m_didBlockEntirePage;
     bool m_didSendXSSProtectionHeader;
     bool m_didSendCSPHeader;
     TextPosition m_textPosition;
 
 private:
-    XSSInfo(bool didBlockEntirePage, bool didSendXSSProtectionHeader, bool didSendCSPHeader)
-        : m_didBlockEntirePage(didBlockEntirePage)
+    XSSInfo(const String& originalURL, bool didBlockEntirePage, bool didSendXSSProtectionHeader, bool didSendCSPHeader)
+        : m_originalURL(originalURL.isolatedCopy())
+        , m_didBlockEntirePage(didBlockEntirePage)
         , m_didSendXSSProtectionHeader(didSendXSSProtectionHeader)
         , m_didSendCSPHeader(didSendCSPHeader)
     { }
@@ -66,7 +72,7 @@
     void setReportURL(const KURL& url) { m_reportURL = url; }
 
 private:
-    PassRefPtr<FormData> generateViolationReport();
+    PassRefPtr<FormData> generateViolationReport(const XSSInfo&);
 
     Document* m_document;
     bool m_didSendNotifications;
diff --git a/Source/core/html/shadow/ClearButtonElement.cpp b/Source/core/html/shadow/ClearButtonElement.cpp
index e608999..dce827a 100644
--- a/Source/core/html/shadow/ClearButtonElement.cpp
+++ b/Source/core/html/shadow/ClearButtonElement.cpp
@@ -29,7 +29,7 @@
 #include "core/events/MouseEvent.h"
 #include "core/html/shadow/ShadowElementNames.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderView.h"
 
 namespace WebCore {
@@ -85,7 +85,7 @@
         return;
     }
 
-    if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
+    if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
         if (renderer() && renderer()->visibleToHitTesting()) {
             if (Frame* frame = document().frame()) {
                 frame->eventHandler()->setCapturingMouseEventsNode(this);
@@ -95,7 +95,7 @@
         m_clearButtonOwner->focusAndSelectClearButtonOwner();
         event->setDefaultHandled();
     }
-    if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
+    if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
         if (m_capturing) {
             if (Frame* frame = document().frame()) {
                 frame->eventHandler()->setCapturingMouseEventsNode(0);
diff --git a/Source/core/html/shadow/DateTimeEditElement.cpp b/Source/core/html/shadow/DateTimeEditElement.cpp
index 6f799a9..197da71 100644
--- a/Source/core/html/shadow/DateTimeEditElement.cpp
+++ b/Source/core/html/shadow/DateTimeEditElement.cpp
@@ -29,17 +29,17 @@
 
 #include "HTMLNames.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/events/MouseEvent.h"
 #include "core/dom/Text.h"
+#include "core/events/MouseEvent.h"
 #include "core/html/forms/DateTimeFieldsState.h"
 #include "core/html/shadow/DateTimeFieldElements.h"
 #include "core/html/shadow/ShadowElementNames.h"
-#include "core/platform/DateComponents.h"
 #include "core/platform/graphics/FontCache.h"
-#include "core/platform/text/DateTimeFormat.h"
-#include "core/platform/text/PlatformLocale.h"
 #include "core/rendering/style/RenderStyle.h"
 #include "core/rendering/style/StyleInheritedData.h"
+#include "platform/DateComponents.h"
+#include "platform/text/DateTimeFormat.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/DateMath.h"
 
 namespace WebCore {
diff --git a/Source/core/html/shadow/DateTimeEditElement.h b/Source/core/html/shadow/DateTimeEditElement.h
index f6a54d7..70bf479 100644
--- a/Source/core/html/shadow/DateTimeEditElement.h
+++ b/Source/core/html/shadow/DateTimeEditElement.h
@@ -29,7 +29,7 @@
 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
 #include "core/html/forms/StepRange.h"
 #include "core/html/shadow/DateTimeFieldElement.h"
-#include "core/platform/DateComponents.h"
+#include "platform/DateComponents.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/DateTimeFieldElement.cpp b/Source/core/html/shadow/DateTimeFieldElement.cpp
index 29217a2..3c2f276 100644
--- a/Source/core/html/shadow/DateTimeFieldElement.cpp
+++ b/Source/core/html/shadow/DateTimeFieldElement.cpp
@@ -28,16 +28,20 @@
 #include "core/html/shadow/DateTimeFieldElement.h"
 
 #include "HTMLNames.h"
-#include "core/events/KeyboardEvent.h"
 #include "core/dom/Text.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "core/events/KeyboardEvent.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
 using namespace HTMLNames;
 
+static String emptyValueAXText()
+{
+    return Locale::defaultLocale()->queryString(WebKit::WebLocalizedString::AXDateTimeFieldEmptyValueText);
+}
+
 DateTimeFieldElement::FieldOwner::~FieldOwner()
 {
 }
@@ -50,10 +54,10 @@
 
 void DateTimeFieldElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().blurEvent)
+    if (event->type() == EventTypeNames::blur)
         didBlur();
 
-    if (event->type() == eventNames().focusEvent)
+    if (event->type() == EventTypeNames::focus)
         didFocus();
 
     if (event->isKeyboardEvent()) {
@@ -73,7 +77,7 @@
 
 void DateTimeFieldElement::defaultKeyboardEventHandler(KeyboardEvent* keyboardEvent)
 {
-    if (keyboardEvent->type() != eventNames().keydownEvent)
+    if (keyboardEvent->type() != EventTypeNames::keydown)
         return;
 
     if (isDisabled() || isFieldOwnerDisabled())
@@ -148,7 +152,7 @@
 {
     // On accessibility, DateTimeFieldElement acts like spin button.
     setAttribute(roleAttr, AtomicString("spinbutton", AtomicString::ConstructFromLiteral));
-    setAttribute(aria_valuetextAttr, AXDateTimeFieldEmptyValueText());
+    setAttribute(aria_valuetextAttr, emptyValueAXText());
     setAttribute(aria_valueminAttr, String::number(axMinimum));
     setAttribute(aria_valuemaxAttr, String::number(axMaximum));
 
@@ -219,7 +223,7 @@
         setAttribute(aria_valuetextAttr, newVisibleValue);
         setAttribute(aria_valuenowAttr, String::number(valueForARIAValueNow()));
     } else {
-        setAttribute(aria_valuetextAttr, AXDateTimeFieldEmptyValueText());
+        setAttribute(aria_valuetextAttr, emptyValueAXText());
         removeAttribute(aria_valuenowAttr);
     }
 
diff --git a/Source/core/html/shadow/DateTimeFieldElements.cpp b/Source/core/html/shadow/DateTimeFieldElements.cpp
index 4fc9f6e..c7d6b87 100644
--- a/Source/core/html/shadow/DateTimeFieldElements.cpp
+++ b/Source/core/html/shadow/DateTimeFieldElements.cpp
@@ -28,13 +28,20 @@
 #include "core/html/shadow/DateTimeFieldElements.h"
 
 #include "core/html/forms/DateTimeFieldsState.h"
-#include "core/platform/DateComponents.h"
-#include "core/platform/LocalizedStrings.h"
+#include "platform/DateComponents.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/DateMath.h"
 
 namespace WebCore {
 
+using WebKit::WebLocalizedString;
+
+static String queryString(WebLocalizedString::Name name)
+{
+    return Locale::defaultLocale()->queryString(name);
+}
+
 DateTimeAMPMFieldElement::DateTimeAMPMFieldElement(Document& document, FieldOwner& fieldOwner, const Vector<String>& ampmLabels)
     : DateTimeSymbolicFieldElement(document, fieldOwner, ampmLabels, 0, 1)
 {
@@ -44,7 +51,7 @@
 {
     DEFINE_STATIC_LOCAL(AtomicString, ampmPsuedoId, ("-webkit-datetime-edit-ampm-field", AtomicString::ConstructFromLiteral));
     RefPtr<DateTimeAMPMFieldElement> field = adoptRef(new DateTimeAMPMFieldElement(document, fieldOwner, ampmLabels));
-    field->initialize(ampmPsuedoId, AXAMPMFieldText());
+    field->initialize(ampmPsuedoId, queryString(WebLocalizedString::AXAMPMFieldText));
     return field.release();
 }
 
@@ -80,7 +87,7 @@
 {
     DEFINE_STATIC_LOCAL(AtomicString, dayPsuedoId, ("-webkit-datetime-edit-day-field", AtomicString::ConstructFromLiteral));
     RefPtr<DateTimeDayFieldElement> field = adoptRef(new DateTimeDayFieldElement(document, fieldOwner, placeholder.isEmpty() ? "--" : placeholder, range));
-    field->initialize(dayPsuedoId, AXDayOfMonthFieldText());
+    field->initialize(dayPsuedoId, queryString(WebLocalizedString::AXDayOfMonthFieldText));
     return field.release();
 }
 
@@ -120,7 +127,7 @@
 void DateTimeHourFieldElementBase::initialize()
 {
     DEFINE_STATIC_LOCAL(AtomicString, hourPsuedoId, ("-webkit-datetime-edit-hour-field", AtomicString::ConstructFromLiteral));
-    DateTimeNumericFieldElement::initialize(hourPsuedoId, AXHourFieldText());
+    DateTimeNumericFieldElement::initialize(hourPsuedoId, queryString(WebLocalizedString::AXHourFieldText));
 }
 
 void DateTimeHourFieldElementBase::setValueAsDate(const DateComponents& date)
@@ -323,7 +330,7 @@
 {
     DEFINE_STATIC_LOCAL(AtomicString, millisecondPsuedoId, ("-webkit-datetime-edit-millisecond-field", AtomicString::ConstructFromLiteral));
     RefPtr<DateTimeMillisecondFieldElement> field = adoptRef(new DateTimeMillisecondFieldElement(document, fieldOwner, range, step));
-    field->initialize(millisecondPsuedoId, AXMillisecondFieldText());
+    field->initialize(millisecondPsuedoId, queryString(WebLocalizedString::AXMillisecondFieldText));
     return field.release();
 }
 
@@ -364,7 +371,7 @@
 {
     DEFINE_STATIC_LOCAL(AtomicString, minutePsuedoId, ("-webkit-datetime-edit-minute-field", AtomicString::ConstructFromLiteral));
     RefPtr<DateTimeMinuteFieldElement> field = adoptRef(new DateTimeMinuteFieldElement(document, fieldOwner, range, step));
-    field->initialize(minutePsuedoId, AXMinuteFieldText());
+    field->initialize(minutePsuedoId, queryString(WebLocalizedString::AXMinuteFieldText));
     return field.release();
 }
 
@@ -405,7 +412,7 @@
 {
     DEFINE_STATIC_LOCAL(AtomicString, monthPsuedoId, ("-webkit-datetime-edit-month-field", AtomicString::ConstructFromLiteral));
     RefPtr<DateTimeMonthFieldElement> field = adoptRef(new DateTimeMonthFieldElement(document, fieldOwner, placeholder.isEmpty() ? "--" : placeholder, range));
-    field->initialize(monthPsuedoId, AXMonthFieldText());
+    field->initialize(monthPsuedoId, queryString(WebLocalizedString::AXMonthFieldText));
     return field.release();
 }
 
@@ -446,7 +453,7 @@
 {
     DEFINE_STATIC_LOCAL(AtomicString, secondPsuedoId, ("-webkit-datetime-edit-second-field", AtomicString::ConstructFromLiteral));
     RefPtr<DateTimeSecondFieldElement> field = adoptRef(new DateTimeSecondFieldElement(document, fieldOwner, range, step));
-    field->initialize(secondPsuedoId, AXSecondFieldText());
+    field->initialize(secondPsuedoId, queryString(WebLocalizedString::AXSecondFieldText));
     return field.release();
 }
 
@@ -487,7 +494,7 @@
 {
     DEFINE_STATIC_LOCAL(AtomicString, monthPsuedoId, ("-webkit-datetime-edit-month-field", AtomicString::ConstructFromLiteral));
     RefPtr<DateTimeSymbolicMonthFieldElement> field = adoptRef(new DateTimeSymbolicMonthFieldElement(document, fieldOwner, labels, minimum, maximum));
-    field->initialize(monthPsuedoId, AXMonthFieldText());
+    field->initialize(monthPsuedoId, queryString(WebLocalizedString::AXMonthFieldText));
     return field.release();
 }
 
@@ -531,7 +538,7 @@
 {
     DEFINE_STATIC_LOCAL(AtomicString, weekPsuedoId, ("-webkit-datetime-edit-week-field", AtomicString::ConstructFromLiteral));
     RefPtr<DateTimeWeekFieldElement> field = adoptRef(new DateTimeWeekFieldElement(document, fieldOwner, range));
-    field->initialize(weekPsuedoId, AXWeekOfYearFieldText());
+    field->initialize(weekPsuedoId, queryString(WebLocalizedString::AXWeekOfYearFieldText));
     return field.release();
 }
 
@@ -576,7 +583,7 @@
 {
     DEFINE_STATIC_LOCAL(AtomicString, yearPsuedoId, ("-webkit-datetime-edit-year-field", AtomicString::ConstructFromLiteral));
     RefPtr<DateTimeYearFieldElement> field = adoptRef(new DateTimeYearFieldElement(document, fieldOwner, parameters));
-    field->initialize(yearPsuedoId, AXYearFieldText());
+    field->initialize(yearPsuedoId, queryString(WebLocalizedString::AXYearFieldText));
     return field.release();
 }
 
diff --git a/Source/core/html/shadow/DateTimeNumericFieldElement.cpp b/Source/core/html/shadow/DateTimeNumericFieldElement.cpp
index d8ff016..9357c5f 100644
--- a/Source/core/html/shadow/DateTimeNumericFieldElement.cpp
+++ b/Source/core/html/shadow/DateTimeNumericFieldElement.cpp
@@ -31,7 +31,7 @@
 #include "CSSValueKeywords.h"
 #include "core/events/KeyboardEvent.h"
 #include "core/platform/graphics/Font.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "platform/text/PlatformLocale.h"
 #include "wtf/text/StringBuilder.h"
 
 using namespace WTF::Unicode;
@@ -117,7 +117,7 @@
 void DateTimeNumericFieldElement::handleKeyboardEvent(KeyboardEvent* keyboardEvent)
 {
     ASSERT(!isDisabled());
-    if (keyboardEvent->type() != eventNames().keypressEvent)
+    if (keyboardEvent->type() != EventTypeNames::keypress)
         return;
 
     UChar charCode = static_cast<UChar>(keyboardEvent->charCode());
diff --git a/Source/core/html/shadow/DateTimeSymbolicFieldElement.cpp b/Source/core/html/shadow/DateTimeSymbolicFieldElement.cpp
index 0ff04ac..aa7965b 100644
--- a/Source/core/html/shadow/DateTimeSymbolicFieldElement.cpp
+++ b/Source/core/html/shadow/DateTimeSymbolicFieldElement.cpp
@@ -29,7 +29,7 @@
 
 #include "core/events/KeyboardEvent.h"
 #include "core/platform/graphics/Font.h"
-#include "core/platform/text/TextBreakIterator.h"
+#include "platform/text/TextBreakIterator.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/unicode/Unicode.h"
 
@@ -72,7 +72,7 @@
 
 void DateTimeSymbolicFieldElement::handleKeyboardEvent(KeyboardEvent* keyboardEvent)
 {
-    if (keyboardEvent->type() != eventNames().keypressEvent)
+    if (keyboardEvent->type() != EventTypeNames::keypress)
         return;
 
     const UChar charCode = WTF::Unicode::toLower(keyboardEvent->charCode());
diff --git a/Source/core/html/shadow/HTMLContentElement.idl b/Source/core/html/shadow/HTMLContentElement.idl
index 77095c2..ab59342 100644
--- a/Source/core/html/shadow/HTMLContentElement.idl
+++ b/Source/core/html/shadow/HTMLContentElement.idl
@@ -26,7 +26,7 @@
 
 [
 ] interface HTMLContentElement : HTMLElement {
-    [Reflect] attribute DOMString select;
+    [Reflect, TreatNullAs=NullString] attribute DOMString select;
     attribute boolean resetStyleInheritance;
     NodeList getDistributedNodes();
 };
diff --git a/Source/core/html/shadow/MediaControlElementTypes.cpp b/Source/core/html/shadow/MediaControlElementTypes.cpp
index 29d161e..eca65c9 100644
--- a/Source/core/html/shadow/MediaControlElementTypes.cpp
+++ b/Source/core/html/shadow/MediaControlElementTypes.cpp
@@ -143,7 +143,7 @@
 
 void MediaControlMuteButtonElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().clickEvent) {
+    if (event->type() == EventTypeNames::click) {
         mediaController()->setMuted(!mediaController()->muted());
         event->setDefaultHandled();
     }
@@ -175,12 +175,12 @@
     if (event->isMouseEvent() && toMouseEvent(event)->button())
         return;
 
-    if (!attached())
+    if (!inDocument() || !document().isActive())
         return;
 
     MediaControlInputElement::defaultEventHandler(event);
 
-    if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent)
+    if (event->type() == EventTypeNames::mouseover || event->type() == EventTypeNames::mouseout || event->type() == EventTypeNames::mousemove)
         return;
 
     double volume = value().toDouble();
@@ -192,7 +192,7 @@
 
 bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents()
 {
-    if (!attached())
+    if (!inDocument() || !document().isActive())
         return false;
 
     return MediaControlInputElement::willRespondToMouseMoveEvents();
@@ -200,7 +200,7 @@
 
 bool MediaControlVolumeSliderElement::willRespondToMouseClickEvents()
 {
-    if (!attached())
+    if (!inDocument() || !document().isActive())
         return false;
 
     return MediaControlInputElement::willRespondToMouseClickEvents();
diff --git a/Source/core/html/shadow/MediaControlElements.cpp b/Source/core/html/shadow/MediaControlElements.cpp
index 93e81e9..8bcb996 100644
--- a/Source/core/html/shadow/MediaControlElements.cpp
+++ b/Source/core/html/shadow/MediaControlElements.cpp
@@ -32,15 +32,15 @@
 
 #include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/DOMTokenList.h"
-#include "core/events/EventNames.h"
 #include "core/dom/FullscreenElementStack.h"
 #include "core/events/MouseEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/html/shadow/MediaControls.h"
 #include "core/html/track/TextTrack.h"
 #include "core/html/track/TextTrackRegionList.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/rendering/RenderMediaControlElements.h"
@@ -217,12 +217,12 @@
 
     if (event->isMouseEvent()) {
         LayoutPoint location = toMouseEvent(event)->absoluteLocation();
-        if (event->type() == eventNames().mousedownEvent && event->target() == this) {
+        if (event->type() == EventTypeNames::mousedown && event->target() == this) {
             startDrag(location);
             event->setDefaultHandled();
-        } else if (event->type() == eventNames().mousemoveEvent && m_isBeingDragged)
+        } else if (event->type() == EventTypeNames::mousemove && m_isBeingDragged)
             continueDrag(location);
-        else if (event->type() == eventNames().mouseupEvent && m_isBeingDragged) {
+        else if (event->type() == EventTypeNames::mouseup && m_isBeingDragged) {
             continueDrag(location);
             endDrag();
             event->setDefaultHandled();
@@ -304,7 +304,7 @@
 
 void MediaControlPanelMuteButtonElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().mouseoverEvent)
+    if (event->type() == EventTypeNames::mouseover)
         m_controls->showVolumeSlider();
 
     MediaControlMuteButtonElement::defaultEventHandler(event);
@@ -354,7 +354,7 @@
 
 void MediaControlPlayButtonElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().clickEvent) {
+    if (event->type() == EventTypeNames::click) {
         if (mediaController()->canPlay())
             mediaController()->play();
         else
@@ -393,7 +393,7 @@
 
 void MediaControlOverlayPlayButtonElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().clickEvent && mediaController()->canPlay()) {
+    if (event->type() == EventTypeNames::click && mediaController()->canPlay()) {
         mediaController()->play();
         updateDisplayType();
         event->setDefaultHandled();
@@ -444,7 +444,7 @@
 
 void MediaControlToggleClosedCaptionsButtonElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().clickEvent) {
+    if (event->type() == EventTypeNames::click) {
         mediaController()->setClosedCaptionsVisible(!mediaController()->closedCaptionsVisible());
         setChecked(mediaController()->closedCaptionsVisible());
         updateDisplayType();
@@ -485,22 +485,22 @@
     if (event->isMouseEvent() && toMouseEvent(event)->button())
         return;
 
-    if (!attached())
+    if (!inDocument() || !document().isActive())
         return;
 
-    if (event->type() == eventNames().mousedownEvent)
+    if (event->type() == EventTypeNames::mousedown)
         mediaController()->beginScrubbing();
 
-    if (event->type() == eventNames().mouseupEvent)
+    if (event->type() == EventTypeNames::mouseup)
         mediaController()->endScrubbing();
 
     MediaControlInputElement::defaultEventHandler(event);
 
-    if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent)
+    if (event->type() == EventTypeNames::mouseover || event->type() == EventTypeNames::mouseout || event->type() == EventTypeNames::mousemove)
         return;
 
     double time = value().toDouble();
-    if (event->type() == eventNames().inputEvent && time != mediaController()->currentTime())
+    if (event->type() == EventTypeNames::input && time != mediaController()->currentTime())
         mediaController()->setCurrentTime(time, IGNORE_EXCEPTION);
 
     RenderSlider* slider = toRenderSlider(renderer());
@@ -510,10 +510,7 @@
 
 bool MediaControlTimelineElement::willRespondToMouseClickEvents()
 {
-    if (!attached())
-        return false;
-
-    return true;
+    return inDocument() && document().isActive();
 }
 
 void MediaControlTimelineElement::setPosition(double currentTime)
@@ -574,7 +571,7 @@
 
 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().clickEvent) {
+    if (event->type() == EventTypeNames::click) {
         // Only use the new full screen API if the fullScreenEnabled setting has
         // been explicitly enabled. Otherwise, use the old fullscreen API. This
         // allows apps which embed a WebView to retain the existing full screen
diff --git a/Source/core/html/shadow/MediaControls.cpp b/Source/core/html/shadow/MediaControls.cpp
index e86861e..45559d9 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -268,7 +268,7 @@
 {
     HTMLDivElement::defaultEventHandler(event);
 
-    if (event->type() == eventNames().mouseoverEvent) {
+    if (event->type() == EventTypeNames::mouseover) {
         if (!containsRelatedTarget(event)) {
             m_isMouseOverControls = true;
             if (!m_mediaController->canPlay()) {
@@ -280,7 +280,7 @@
         return;
     }
 
-    if (event->type() == eventNames().mouseoutEvent) {
+    if (event->type() == EventTypeNames::mouseout) {
         if (!containsRelatedTarget(event)) {
             m_isMouseOverControls = false;
             stopHideFullscreenControlsTimer();
@@ -288,7 +288,7 @@
         return;
     }
 
-    if (event->type() == eventNames().mousemoveEvent) {
+    if (event->type() == EventTypeNames::mousemove) {
         if (m_isFullscreen) {
             // When we get a mouse move in fullscreen mode, show the media controls, and start a timer
             // that will hide the media controls after a 3 seconds without a mouse move.
diff --git a/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp b/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp
index 7050eb4..7cbba45 100644
--- a/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp
+++ b/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp
@@ -31,15 +31,10 @@
 #include "config.h"
 #include "core/html/shadow/PasswordGeneratorButtonElement.h"
 
-#include "CSSPropertyNames.h"
-#include "CSSValueKeywords.h"
 #include "core/events/Event.h"
 #include "core/dom/NodeRenderStyle.h"
-#include "core/dom/shadow/ElementShadow.h"
-#include "core/dom/shadow/ShadowRoot.h"
 #include "core/fetch/ImageResource.h"
 #include "core/html/HTMLInputElement.h"
-#include "core/html/shadow/HTMLShadowElement.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
 #include "core/page/Page.h"
@@ -59,47 +54,6 @@
     setHasCustomStyleCallbacks();
 }
 
-static void getDecorationRootAndDecoratedRoot(HTMLInputElement* input, ShadowRoot*& decorationRoot, ShadowRoot*& decoratedRoot)
-{
-    ShadowRoot* existingRoot = input->youngestShadowRoot();
-    ShadowRoot* newRoot = 0;
-    while (existingRoot->childNodeCount() == 1 && existingRoot->firstChild()->hasTagName(shadowTag)) {
-        newRoot = existingRoot;
-        existingRoot = existingRoot->olderShadowRoot();
-        ASSERT(existingRoot);
-    }
-    if (newRoot) {
-        newRoot->removeChild(newRoot->firstChild());
-    } else {
-        // FIXME: This interacts really badly with author shadow roots because now
-        // we can interleave user agent and author shadow roots on the element meaning
-        // input.shadowRoot may be inaccessible if the browser has decided to decorate
-        // the input.
-        newRoot = input->ensureShadow()->addShadowRoot(input, ShadowRoot::UserAgentShadowRoot);
-    }
-    decorationRoot = newRoot;
-    decoratedRoot = existingRoot;
-}
-
-void PasswordGeneratorButtonElement::decorate(HTMLInputElement* input)
-{
-    ASSERT(input);
-    ShadowRoot* existingRoot;
-    ShadowRoot* decorationRoot;
-    getDecorationRootAndDecoratedRoot(input, decorationRoot, existingRoot);
-    ASSERT(decorationRoot);
-    ASSERT(existingRoot);
-    RefPtr<HTMLDivElement> box = HTMLDivElement::create(input->document());
-    decorationRoot->appendChild(box);
-    box->setInlineStyleProperty(CSSPropertyDisplay, CSSValueFlex);
-    box->setInlineStyleProperty(CSSPropertyAlignItems, CSSValueCenter);
-    ASSERT(existingRoot->childNodeCount() == 1);
-    toHTMLElement(existingRoot->firstChild())->setInlineStyleProperty(CSSPropertyFlexGrow, 1.0, CSSPrimitiveValue::CSS_NUMBER);
-    box->appendChild(HTMLShadowElement::create(HTMLNames::shadowTag, input->document()));
-    setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
-    box->appendChild(this);
-}
-
 inline HTMLInputElement* PasswordGeneratorButtonElement::hostInput()
 {
     // PasswordGeneratorButtonElement is created only by C++ code, and it is always
@@ -170,18 +124,18 @@
     }
 
     RefPtr<PasswordGeneratorButtonElement> protector(this);
-    if (event->type() == eventNames().clickEvent) {
+    if (event->type() == EventTypeNames::click) {
         if (Page* page = document().page())
             page->chrome().client().openPasswordGenerator(input.get());
         event->setDefaultHandled();
     }
 
-    if (event->type() == eventNames().mouseoverEvent) {
+    if (event->type() == EventTypeNames::mouseover) {
         m_isInHoverState = true;
         updateImage();
     }
 
-    if (event->type() == eventNames().mouseoutEvent) {
+    if (event->type() == EventTypeNames::mouseout) {
         m_isInHoverState = false;
         updateImage();
     }
diff --git a/Source/core/html/shadow/PickerIndicatorElement.cpp b/Source/core/html/shadow/PickerIndicatorElement.cpp
index 71fabda..ffdc6dd 100644
--- a/Source/core/html/shadow/PickerIndicatorElement.cpp
+++ b/Source/core/html/shadow/PickerIndicatorElement.cpp
@@ -76,7 +76,7 @@
     if (!m_pickerIndicatorOwner || m_pickerIndicatorOwner->isPickerIndicatorOwnerDisabledOrReadOnly())
         return;
 
-    if (event->type() == eventNames().clickEvent) {
+    if (event->type() == EventTypeNames::click) {
         openPopup();
         event->setDefaultHandled();
     }
diff --git a/Source/core/html/shadow/SliderThumbElement.cpp b/Source/core/html/shadow/SliderThumbElement.cpp
index 8e794d4..cfc5578 100644
--- a/Source/core/html/shadow/SliderThumbElement.cpp
+++ b/Source/core/html/shadow/SliderThumbElement.cpp
@@ -41,7 +41,7 @@
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/html/shadow/ShadowElementNames.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderFlexibleBox.h"
 #include "core/rendering/RenderSlider.h"
 #include "core/rendering/RenderTheme.h"
@@ -244,6 +244,7 @@
 
 void SliderThumbElement::dragFrom(const LayoutPoint& point)
 {
+    RefPtr<SliderThumbElement> protector(this);
     setPositionFromPoint(point);
     startDragging();
 }
@@ -352,13 +353,13 @@
     // We intentionally do not call event->setDefaultHandled() here because
     // MediaControlTimelineElement::defaultEventHandler() wants to handle these
     // mouse events.
-    if (eventType == eventNames().mousedownEvent && isLeftButton) {
+    if (eventType == EventTypeNames::mousedown && isLeftButton) {
         startDragging();
         return;
-    } else if (eventType == eventNames().mouseupEvent && isLeftButton) {
+    } else if (eventType == EventTypeNames::mouseup && isLeftButton) {
         stopDragging();
         return;
-    } else if (eventType == eventNames().mousemoveEvent) {
+    } else if (eventType == EventTypeNames::mousemove) {
         if (m_inDragMode)
             setPositionFromPoint(mouseEvent->absoluteLocation());
         return;
diff --git a/Source/core/html/shadow/SpinButtonElement.cpp b/Source/core/html/shadow/SpinButtonElement.cpp
index 7a0fbcd..0b30118 100644
--- a/Source/core/html/shadow/SpinButtonElement.cpp
+++ b/Source/core/html/shadow/SpinButtonElement.cpp
@@ -28,13 +28,13 @@
 #include "core/html/shadow/SpinButtonElement.h"
 
 #include "HTMLNames.h"
-#include "core/events/EventNames.h"
 #include "core/events/MouseEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/events/WheelEvent.h"
 #include "core/html/shadow/ShadowElementNames.h"
 #include "core/page/Chrome.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/platform/ScrollbarTheme.h"
 #include "core/rendering/RenderBox.h"
@@ -90,7 +90,7 @@
 
     MouseEvent* mouseEvent = toMouseEvent(event);
     IntPoint local = roundedIntPoint(box->absoluteToLocal(mouseEvent->absoluteLocation(), UseTransforms));
-    if (mouseEvent->type() == eventNames().mousedownEvent && mouseEvent->button() == LeftButton) {
+    if (mouseEvent->type() == EventTypeNames::mousedown && mouseEvent->button() == LeftButton) {
         if (box->pixelSnappedBorderBoxRect().contains(local)) {
             // The following functions of HTMLInputElement may run JavaScript
             // code which detaches this shadow node. We need to take a reference
@@ -111,9 +111,9 @@
             }
             event->setDefaultHandled();
         }
-    } else if (mouseEvent->type() == eventNames().mouseupEvent && mouseEvent->button() == LeftButton)
+    } else if (mouseEvent->type() == EventTypeNames::mouseup && mouseEvent->button() == LeftButton)
         stopRepeatingTimer();
-    else if (event->type() == eventNames().mousemoveEvent) {
+    else if (event->type() == EventTypeNames::mousemove) {
         if (box->pixelSnappedBorderBoxRect().contains(local)) {
             if (!m_capturing) {
                 if (Frame* frame = document().frame()) {
@@ -148,7 +148,7 @@
     if (!renderBox())
         return;
 
-    if (!event->hasInterface(eventNames().interfaceForWheelEvent))
+    if (!event->hasInterface(EventNames::WheelEvent))
         return;
 
     if (!m_spinButtonOwner)
@@ -157,7 +157,7 @@
     if (!m_spinButtonOwner->shouldSpinButtonRespondToWheelEvents())
         return;
 
-    doStepAction(static_cast<WheelEvent*>(event)->wheelDeltaY());
+    doStepAction(toWheelEvent(event)->wheelDeltaY());
     event->setDefaultHandled();
 }
 
diff --git a/Source/core/html/shadow/SpinButtonElement.h b/Source/core/html/shadow/SpinButtonElement.h
index a749036..4cce722 100644
--- a/Source/core/html/shadow/SpinButtonElement.h
+++ b/Source/core/html/shadow/SpinButtonElement.h
@@ -29,7 +29,7 @@
 
 #include "core/html/HTMLDivElement.h"
 #include "core/page/PopupOpeningObserver.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 
 namespace WebCore {
 
diff --git a/Source/core/html/shadow/TextControlInnerElements.cpp b/Source/core/html/shadow/TextControlInnerElements.cpp
index 88f9326..ab08a53 100644
--- a/Source/core/html/shadow/TextControlInnerElements.cpp
+++ b/Source/core/html/shadow/TextControlInnerElements.cpp
@@ -28,21 +28,21 @@
 #include "core/html/shadow/TextControlInnerElements.h"
 
 #include "HTMLNames.h"
-#include "bindings/v8/ScriptController.h"
 #include "core/dom/Document.h"
-#include "core/events/EventNames.h"
-#include "core/events/MouseEvent.h"
 #include "core/dom/NodeRenderStyle.h"
+#include "core/events/MouseEvent.h"
 #include "core/events/TextEvent.h"
 #include "core/events/TextEventInputType.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLInputElement.h"
 #include "core/html/shadow/ShadowElementNames.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/SpeechInput.h"
-#include "core/page/SpeechInputEvent.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderTextControlSingleLine.h"
 #include "core/rendering/RenderView.h"
+#include "core/speech/SpeechInput.h"
+#include "core/speech/SpeechInputEvent.h"
+#include "platform/UserGestureIndicator.h"
 
 namespace WebCore {
 
@@ -119,7 +119,7 @@
     // FIXME: In the future, we should add a way to have default event listeners.
     // Then we would add one to the text field's inner div, and we wouldn't need this subclass.
     // Or possibly we could just use a normal event listener.
-    if (event->isBeforeTextInsertedEvent() || event->type() == eventNames().webkitEditableContentChangedEvent) {
+    if (event->isBeforeTextInsertedEvent() || event->type() == EventTypeNames::webkitEditableContentChanged) {
         Element* shadowAncestor = shadowHost();
         // A TextControlInnerTextElement can have no host if its been detached,
         // but kept alive by an EditCommand. In this case, an undo/redo can
@@ -180,7 +180,7 @@
 {
     // On mousedown, focus the search field
     HTMLInputElement* input = toHTMLInputElement(shadowHost());
-    if (input && event->type() == eventNames().mousedownEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
+    if (input && event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
         input->focus();
         input->select();
         event->setDefaultHandled();
@@ -231,7 +231,7 @@
         return;
     }
 
-    if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
+    if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
         if (renderer() && renderer()->visibleToHitTesting()) {
             if (Frame* frame = document().frame()) {
                 frame->eventHandler()->setCapturingMouseEventsNode(this);
@@ -242,7 +242,7 @@
         input->select();
         event->setDefaultHandled();
     }
-    if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
+    if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
         if (m_capturing) {
             if (Frame* frame = document().frame()) {
                 frame->eventHandler()->setCapturingMouseEventsNode(0);
@@ -303,7 +303,7 @@
 void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
 {
     // For privacy reasons, only allow clicks directly coming from the user.
-    if (!ScriptController::processingUserGesture()) {
+    if (!UserGestureIndicator::processingUserGesture()) {
         HTMLDivElement::defaultEventHandler(event);
         return;
     }
@@ -320,7 +320,7 @@
     }
 
     // On mouse down, select the text and set focus.
-    if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
+    if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
         if (renderer() && renderer()->visibleToHitTesting()) {
             if (Frame* frame = document().frame()) {
                 frame->eventHandler()->setCapturingMouseEventsNode(this);
@@ -333,7 +333,7 @@
         event->setDefaultHandled();
     }
     // On mouse up, release capture cleanly.
-    if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
+    if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
         if (m_capturing && renderer() && renderer()->visibleToHitTesting()) {
             if (Frame* frame = document().frame()) {
                 frame->eventHandler()->setCapturingMouseEventsNode(0);
@@ -342,7 +342,7 @@
         }
     }
 
-    if (event->type() == eventNames().clickEvent && m_listenerId) {
+    if (event->type() == EventTypeNames::click && m_listenerId) {
         switch (m_state) {
         case Idle:
             startSpeechInput();
@@ -415,7 +415,7 @@
 
     // This event is sent after the text event so the website can perform actions using the input field content immediately.
     // It provides alternative recognition hypotheses and notifies that the results come from speech input.
-    input->dispatchEvent(SpeechInputEvent::create(eventNames().webkitspeechchangeEvent, results));
+    input->dispatchEvent(SpeechInputEvent::create(EventTypeNames::webkitspeechchange, results));
 
     // Check before accessing the renderer as the above event could have potentially turned off
     // speech in the input element, hence removing this button and renderer from the hierarchy.
diff --git a/Source/core/html/shadow/TextControlInnerElements.h b/Source/core/html/shadow/TextControlInnerElements.h
index 5843c4d..e21f5b7 100644
--- a/Source/core/html/shadow/TextControlInnerElements.h
+++ b/Source/core/html/shadow/TextControlInnerElements.h
@@ -28,7 +28,7 @@
 #define TextControlInnerElements_h
 
 #include "core/html/HTMLDivElement.h"
-#include "core/page/SpeechInputListener.h"
+#include "core/speech/SpeechInputListener.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
diff --git a/Source/core/html/track/InbandTextTrack.cpp b/Source/core/html/track/InbandTextTrack.cpp
index 95f629d..96b9153 100644
--- a/Source/core/html/track/InbandTextTrack.cpp
+++ b/Source/core/html/track/InbandTextTrack.cpp
@@ -27,20 +27,20 @@
 #include "core/html/track/InbandTextTrack.h"
 
 #include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/html/track/TextTrackCueGeneric.h"
-#include "core/platform/Logging.h"
+#include "core/html/track/TextTrackCue.h"
 #include "core/platform/graphics/InbandTextTrackPrivate.h"
+#include "platform/Logging.h"
 #include "wtf/UnusedParam.h"
 #include <math.h>
 
 namespace WebCore {
 
-PassRefPtr<InbandTextTrack> InbandTextTrack::create(ScriptExecutionContext* context, TextTrackClient* client, PassRefPtr<InbandTextTrackPrivate> playerPrivate)
+PassRefPtr<InbandTextTrack> InbandTextTrack::create(ExecutionContext* context, TextTrackClient* client, PassRefPtr<InbandTextTrackPrivate> playerPrivate)
 {
     return adoptRef(new InbandTextTrack(context, client, playerPrivate));
 }
 
-InbandTextTrack::InbandTextTrack(ScriptExecutionContext* context, TextTrackClient* client, PassRefPtr<InbandTextTrackPrivate> tracksPrivate)
+InbandTextTrack::InbandTextTrack(ExecutionContext* context, TextTrackClient* client, PassRefPtr<InbandTextTrackPrivate> tracksPrivate)
     : TextTrack(context, client, emptyString(), tracksPrivate->label(), tracksPrivate->language(), InBand)
     , m_private(tracksPrivate)
 {
@@ -138,52 +138,12 @@
     clearClient();
 }
 
-void InbandTextTrack::addGenericCue(InbandTextTrackPrivate* trackPrivate, GenericCueData* cueData)
-{
-    UNUSED_PARAM(trackPrivate);
-    ASSERT(trackPrivate == m_private);
-
-    RefPtr<TextTrackCueGeneric> cue = TextTrackCueGeneric::create(scriptExecutionContext(), cueData->startTime(), cueData->endTime(), cueData->content());
-
-    cue->setId(cueData->id());
-    cue->setBaseFontSizeRelativeToVideoHeight(cueData->baseFontSize());
-    cue->setFontSizeMultiplier(cueData->relativeFontSize());
-    cue->setFontName(cueData->fontName());
-
-    if (cueData->position() > 0)
-        cue->setPosition(lround(cueData->position()), IGNORE_EXCEPTION);
-    if (cueData->line() > 0)
-        cue->setLine(lround(cueData->line()), IGNORE_EXCEPTION);
-    if (cueData->size() > 0)
-        cue->setSize(lround(cueData->size()), IGNORE_EXCEPTION);
-    if (cueData->backgroundColor().isValid())
-        cue->setBackgroundColor(cueData->backgroundColor().rgb());
-    if (cueData->foregroundColor().isValid())
-        cue->setForegroundColor(cueData->foregroundColor().rgb());
-
-    if (cueData->align() == GenericCueData::Start)
-        cue->setAlign("start", IGNORE_EXCEPTION);
-    else if (cueData->align() == GenericCueData::Middle)
-        cue->setAlign("middle", IGNORE_EXCEPTION);
-    else if (cueData->align() == GenericCueData::End)
-        cue->setAlign("end", IGNORE_EXCEPTION);
-    cue->setSnapToLines(false);
-
-    if (hasCue(cue.get())) {
-        LOG(Media, "InbandTextTrack::addGenericCue ignoring already added cue: start=%.2f, end=%.2f, content=\"%s\"\n",
-            cueData->startTime(), cueData->endTime(), cueData->content().utf8().data());
-        return;
-    }
-
-    addCue(cue);
-}
-
 void InbandTextTrack::addWebVTTCue(InbandTextTrackPrivate* trackPrivate, double start, double end, const String& id, const String& content, const String& settings)
 {
     UNUSED_PARAM(trackPrivate);
     ASSERT(trackPrivate == m_private);
 
-    RefPtr<TextTrackCue> cue = TextTrackCue::create(scriptExecutionContext(), start, end, content);
+    RefPtr<TextTrackCue> cue = TextTrackCue::create(executionContext(), start, end, content);
     cue->setId(id);
     cue->setCueSettings(settings);
 
diff --git a/Source/core/html/track/InbandTextTrack.h b/Source/core/html/track/InbandTextTrack.h
index 5707249..34054bd 100644
--- a/Source/core/html/track/InbandTextTrack.h
+++ b/Source/core/html/track/InbandTextTrack.h
@@ -39,7 +39,7 @@
 
 class InbandTextTrack : public TextTrack, public InbandTextTrackPrivateClient {
 public:
-    static PassRefPtr<InbandTextTrack> create(ScriptExecutionContext*, TextTrackClient*, PassRefPtr<InbandTextTrackPrivate>);
+    static PassRefPtr<InbandTextTrack> create(ExecutionContext*, TextTrackClient*, PassRefPtr<InbandTextTrackPrivate>);
     virtual ~InbandTextTrack();
 
     virtual bool isClosedCaptions() const OVERRIDE;
@@ -51,9 +51,8 @@
     void trackRemoved();
 
 private:
-    InbandTextTrack(ScriptExecutionContext*, TextTrackClient*, PassRefPtr<InbandTextTrackPrivate>);
+    InbandTextTrack(ExecutionContext*, TextTrackClient*, PassRefPtr<InbandTextTrackPrivate>);
 
-    virtual void addGenericCue(InbandTextTrackPrivate*, GenericCueData*) OVERRIDE;
     virtual void addWebVTTCue(InbandTextTrackPrivate*, double, double, const String&, const String&, const String&) OVERRIDE;
 
     RefPtr<InbandTextTrackPrivate> m_private;
diff --git a/Source/core/html/track/LoadableTextTrack.cpp b/Source/core/html/track/LoadableTextTrack.cpp
index 9ccb64b..60a9f69 100644
--- a/Source/core/html/track/LoadableTextTrack.cpp
+++ b/Source/core/html/track/LoadableTextTrack.cpp
@@ -89,7 +89,7 @@
     // 4. Download: If URL is not the empty string, perform a potentially CORS-enabled fetch of URL, with the
     // mode being the state of the media element's crossorigin content attribute, the origin being the
     // origin of the media element's Document, and the default origin behaviour set to fail.
-    m_loader = TextTrackLoader::create(this, static_cast<ScriptExecutionContext*>(&m_trackElement->document()));
+    m_loader = TextTrackLoader::create(this, static_cast<ExecutionContext*>(&m_trackElement->document()));
     if (!m_loader->load(m_url, m_trackElement->mediaElementCrossOriginAttribute()))
         m_trackElement->didCompleteLoad(this, HTMLTrackElement::Failure);
 }
diff --git a/Source/core/html/track/TextTrack.cpp b/Source/core/html/track/TextTrack.cpp
index 70fed99..5335264 100644
--- a/Source/core/html/track/TextTrack.cpp
+++ b/Source/core/html/track/TextTrack.cpp
@@ -92,7 +92,7 @@
     return ended;
 }
 
-TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, const AtomicString& kind, const AtomicString& label, const AtomicString& language, TextTrackType type)
+TextTrack::TextTrack(ExecutionContext* context, TextTrackClient* client, const AtomicString& kind, const AtomicString& label, const AtomicString& language, TextTrackType type)
     : TrackBase(context, TrackBase::TextTrack)
     , m_cues(0)
 #if ENABLE(WEBVTT_REGIONS)
diff --git a/Source/core/html/track/TextTrack.h b/Source/core/html/track/TextTrack.h
index c16b447..636e798 100644
--- a/Source/core/html/track/TextTrack.h
+++ b/Source/core/html/track/TextTrack.h
@@ -56,7 +56,7 @@
 
 class TextTrack : public TrackBase, public ScriptWrappable {
 public:
-    static PassRefPtr<TextTrack> create(ScriptExecutionContext* context, TextTrackClient* client, const AtomicString& kind, const AtomicString& label, const AtomicString& language)
+    static PassRefPtr<TextTrack> create(ExecutionContext* context, TextTrackClient* client, const AtomicString& kind, const AtomicString& label, const AtomicString& language)
     {
         return adoptRef(new TextTrack(context, client, kind, label, language, AddTrack));
     }
@@ -137,7 +137,7 @@
     void removeAllCues();
 
 protected:
-    TextTrack(ScriptExecutionContext*, TextTrackClient*, const AtomicString& kind, const AtomicString& label, const AtomicString& language, TextTrackType);
+    TextTrack(ExecutionContext*, TextTrackClient*, const AtomicString& kind, const AtomicString& label, const AtomicString& language, TextTrackType);
 #if ENABLE(WEBVTT_REGIONS)
     TextTrackRegionList* regionList();
 #endif
diff --git a/Source/core/html/track/TextTrack.idl b/Source/core/html/track/TextTrack.idl
index 1067901..cd2ebeb 100644
--- a/Source/core/html/track/TextTrack.idl
+++ b/Source/core/html/track/TextTrack.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=VideoTrack
+    RuntimeEnabled=VideoTrack
 ] interface TextTrack : EventTarget {
     readonly attribute DOMString kind;
     readonly attribute DOMString label;
diff --git a/Source/core/html/track/TextTrackCue.cpp b/Source/core/html/track/TextTrackCue.cpp
index f80d78c..bfce2e5 100644
--- a/Source/core/html/track/TextTrackCue.cpp
+++ b/Source/core/html/track/TextTrackCue.cpp
@@ -55,6 +55,18 @@
 static const int undefinedPosition = -1;
 static const int autoSize = 0;
 
+static const CSSValueID displayWritingModeMap[] = {
+    CSSValueHorizontalTb, CSSValueVerticalRl, CSSValueVerticalLr
+};
+COMPILE_ASSERT(WTF_ARRAY_LENGTH(displayWritingModeMap) == TextTrackCue::NumberOfWritingDirections,
+    displayWritingModeMap_has_wrong_size);
+
+static const CSSValueID displayAlignmentMap[] = {
+    CSSValueStart, CSSValueCenter, CSSValueEnd, CSSValueLeft, CSSValueRight
+};
+COMPILE_ASSERT(WTF_ARRAY_LENGTH(displayAlignmentMap) == TextTrackCue::NumberOfAlignments,
+    displayAlignmentMap_has_wrong_size);
+
 static const String& startKeyword()
 {
     DEFINE_STATIC_LOCAL(const String, start, ("start"));
@@ -73,6 +85,18 @@
     return end;
 }
 
+static const String& leftKeyword()
+{
+    DEFINE_STATIC_LOCAL(const String, left, ("left"));
+    return left;
+}
+
+static const String& rightKeyword()
+{
+    DEFINE_STATIC_LOCAL(const String, right, ("right"));
+    return right;
+}
+
 static const String& horizontalKeyword()
 {
     return emptyString();
@@ -149,12 +173,7 @@
     // be set to the value in the second cell of the row of the table below
     // whose first cell is the value of the corresponding cue's text track cue
     // alignment:
-    if (m_cue->align() == startKeyword())
-        setInlineStyleProperty(CSSPropertyTextAlign, CSSValueStart);
-    else if (m_cue->align() == endKeyword())
-        setInlineStyleProperty(CSSPropertyTextAlign, CSSValueEnd);
-    else
-        setInlineStyleProperty(CSSPropertyTextAlign, CSSValueCenter);
+    setInlineStyleProperty(CSSPropertyTextAlign, m_cue->getCSSAlignment());
 
     if (!m_cue->snapToLines()) {
         // 10.13.1 Set up x and y:
@@ -187,7 +206,7 @@
 
 // ----------------------------
 
-TextTrackCue::TextTrackCue(ScriptExecutionContext* context, double start, double end, const String& content)
+TextTrackCue::TextTrackCue(ExecutionContext* context, double start, double end, const String& content)
     : m_startTime(start)
     , m_endTime(end)
     , m_content(content)
@@ -200,7 +219,7 @@
     , m_cueAlignment(Middle)
     , m_webVTTNodeTree(0)
     , m_track(0)
-    , m_scriptExecutionContext(context)
+    , m_executionContext(context)
     , m_isActive(false)
     , m_pauseOnExit(false)
     , m_snapToLines(true)
@@ -208,17 +227,8 @@
     , m_displayTreeShouldChange(true)
     , m_displayDirection(CSSValueLtr)
 {
-    ASSERT(m_scriptExecutionContext->isDocument());
+    ASSERT(m_executionContext->isDocument());
     ScriptWrappable::init(this);
-
-    // 4. If the text track cue writing direction is horizontal, then let
-    // writing-mode be 'horizontal-tb'. Otherwise, if the text track cue writing
-    // direction is vertical growing left, then let writing-mode be
-    // 'vertical-rl'. Otherwise, the text track cue writing direction is
-    // vertical growing right; let writing-mode be 'vertical-lr'.
-    m_displayWritingModeMap[Horizontal] = CSSValueHorizontalTb;
-    m_displayWritingModeMap[VerticalGrowingLeft] = CSSValueVerticalRl;
-    m_displayWritingModeMap[VerticalGrowingRight] = CSSValueVerticalLr;
 }
 
 TextTrackCue::~TextTrackCue()
@@ -435,6 +445,10 @@
         return middleKeyword();
     case End:
         return endKeyword();
+    case Left:
+        return leftKeyword();
+    case Right:
+        return rightKeyword();
     default:
         ASSERT_NOT_REACHED();
         return emptyString();
@@ -456,6 +470,10 @@
         alignment = Middle;
     else if (value == endKeyword())
         alignment = End;
+    else if (value == leftKeyword())
+        alignment = Left;
+    else if (value == rightKeyword())
+        alignment = Right;
     else
         es.throwUninformativeAndGenericDOMException(SyntaxError);
 
@@ -496,7 +514,7 @@
 void TextTrackCue::createWebVTTNodeTree()
 {
     if (!m_webVTTNodeTree)
-        m_webVTTNodeTree = WebVTTParser::create(0, m_scriptExecutionContext)->createDocumentFragmentFromCueText(m_content);
+        m_webVTTNodeTree = WebVTTParser::create(0, m_executionContext)->createDocumentFragmentFromCueText(m_content);
 }
 
 void TextTrackCue::copyWebVTTNodeToDOMTree(ContainerNode* webVTTNode, ContainerNode* parent)
@@ -658,64 +676,97 @@
     // vertical growing left, then let block-flow be 'lr'. Otherwise, the text
     // track cue writing direction is vertical growing right; let block-flow be
     // 'rl'.
-    m_displayWritingMode = m_displayWritingModeMap[m_writingDirection];
+
+    // The above step is done through the writing direction static map.
 
     // 10.5 Determine the value of maximum size for cue as per the appropriate
     // rules from the following list:
     int maximumSize = m_textPosition;
     if ((m_writingDirection == Horizontal && m_cueAlignment == Start && m_displayDirection == CSSValueLtr)
             || (m_writingDirection == Horizontal && m_cueAlignment == End && m_displayDirection == CSSValueRtl)
-            || (m_writingDirection == VerticalGrowingLeft && m_cueAlignment == Start)
-            || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == Start)) {
+            || (m_writingDirection == Horizontal && m_cueAlignment == Left)
+            || (m_writingDirection == VerticalGrowingLeft && (m_cueAlignment == Start || m_cueAlignment == Left))
+            || (m_writingDirection == VerticalGrowingRight && (m_cueAlignment == Start || m_cueAlignment == Left))) {
         maximumSize = 100 - m_textPosition;
     } else if ((m_writingDirection == Horizontal && m_cueAlignment == End && m_displayDirection == CSSValueLtr)
             || (m_writingDirection == Horizontal && m_cueAlignment == Start && m_displayDirection == CSSValueRtl)
-            || (m_writingDirection == VerticalGrowingLeft && m_cueAlignment == End)
-            || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == End)) {
+            || (m_writingDirection == Horizontal && m_cueAlignment == Right)
+            || (m_writingDirection == VerticalGrowingLeft && (m_cueAlignment == End || m_cueAlignment == Right))
+            || (m_writingDirection == VerticalGrowingRight && (m_cueAlignment == End || m_cueAlignment == Right))) {
         maximumSize = m_textPosition;
     } else if (m_cueAlignment == Middle) {
         maximumSize = m_textPosition <= 50 ? m_textPosition : (100 - m_textPosition);
         maximumSize = maximumSize * 2;
+    } else {
+        ASSERT_NOT_REACHED();
     }
 
     // 10.6 If the text track cue size is less than maximum size, then let size
     // be text track cue size. Otherwise, let size be maximum size.
     m_displaySize = std::min(m_cueSize, maximumSize);
 
+    // FIXME: Understand why step 10.7 is missing (just a copy/paste error?)
+    // Could be done within a spec implementation check - http://crbug.com/301580
+
     // 10.8 Determine the value of x-position or y-position for cue as per the
     // appropriate rules from the following list:
     if (m_writingDirection == Horizontal) {
-        if (m_cueAlignment == Start) {
+        switch (m_cueAlignment) {
+        case Start:
             if (m_displayDirection == CSSValueLtr)
                 m_displayPosition.first = m_textPosition;
             else
                 m_displayPosition.first = 100 - m_textPosition - m_displaySize;
-        } else if (m_cueAlignment == End) {
+            break;
+        case End:
             if (m_displayDirection == CSSValueRtl)
                 m_displayPosition.first = 100 - m_textPosition;
             else
                 m_displayPosition.first = m_textPosition - m_displaySize;
+            break;
+        case Left:
+            if (m_displayDirection == CSSValueLtr)
+                m_displayPosition.first = m_textPosition;
+            else
+                m_displayPosition.first = 100 - m_textPosition;
+            break;
+        case Right:
+            if (m_displayDirection == CSSValueLtr)
+                m_displayPosition.first = m_textPosition - m_displaySize;
+            else
+                m_displayPosition.first = 100 - m_textPosition - m_displaySize;
+            break;
+        case Middle:
+            if (m_displayDirection == CSSValueLtr)
+                m_displayPosition.first = m_textPosition - m_displaySize / 2;
+            else
+                m_displayPosition.first = 100 - m_textPosition - m_displaySize / 2;
+            break;
+        case NumberOfAlignments:
+            ASSERT_NOT_REACHED();
+        }
+    } else {
+        // Cases for m_writingDirection being VerticalGrowing{Left|Right}
+        switch (m_cueAlignment) {
+        case Start:
+        case Left:
+            m_displayPosition.second = m_textPosition;
+            break;
+        case End:
+        case Right:
+            m_displayPosition.second = m_textPosition - m_displaySize;
+            break;
+        case Middle:
+            m_displayPosition.second = m_textPosition - m_displaySize / 2;
+            break;
+        case NumberOfAlignments:
+            ASSERT_NOT_REACHED();
         }
     }
 
-    if ((m_writingDirection == VerticalGrowingLeft && m_cueAlignment == Start)
-            || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == Start)) {
-        m_displayPosition.second = m_textPosition;
-    } else if ((m_writingDirection == VerticalGrowingLeft && m_cueAlignment == End)
-            || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == End)) {
-        m_displayPosition.second = 100 - m_textPosition;
-    }
-
-    if (m_writingDirection == Horizontal && m_cueAlignment == Middle) {
-        if (m_displayDirection == CSSValueLtr)
-            m_displayPosition.first = m_textPosition - m_displaySize / 2;
-        else
-           m_displayPosition.first = 100 - m_textPosition - m_displaySize / 2;
-    }
-
-    if ((m_writingDirection == VerticalGrowingLeft && m_cueAlignment == Middle)
-        || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == Middle))
-        m_displayPosition.second = m_textPosition - m_displaySize / 2;
+    // A text track cue has a text track cue computed line position whose value
+    // is defined in terms of the other aspects of the cue.
+    m_computedLinePosition = calculateComputedLinePosition();
 
     // 10.9 Determine the value of whichever of x-position or y-position is not
     // yet calculated for cue as per the appropriate rules from the following
@@ -732,10 +783,6 @@
 
     if (!m_snapToLines && (m_writingDirection == VerticalGrowingLeft || m_writingDirection == VerticalGrowingRight))
         m_displayPosition.first = m_computedLinePosition;
-
-    // A text track cue has a text track cue computed line position whose value
-    // is defined in terms of the other aspects of the cue.
-    m_computedLinePosition = calculateComputedLinePosition();
 }
 
 void TextTrackCue::markFutureAndPastNodes(ContainerNode* root, double previousTimestamp, double movieTime)
@@ -751,7 +798,7 @@
         if (child->nodeName() == timestampTag) {
             unsigned position = 0;
             String timestamp = child->nodeValue();
-            double currentTimestamp = WebVTTParser::create(0, m_scriptExecutionContext)->collectTimeStamp(timestamp, &position);
+            double currentTimestamp = WebVTTParser::create(0, m_executionContext)->collectTimeStamp(timestamp, &position);
             ASSERT(currentTimestamp != -1);
 
             if (currentTimestamp > movieTime)
@@ -1094,6 +1141,14 @@
             // 3. If value is a case-sensitive match for the string "end", then let cue's text track cue alignment be end alignment.
             else if (cueAlignment == endKeyword())
                 m_cueAlignment = End;
+
+            // 4. If value is a case-sensitive match for the string "left", then let cue's text track cue alignment be left alignment.
+            else if (cueAlignment == leftKeyword())
+                m_cueAlignment = Left;
+
+            // 5. If value is a case-sensitive match for the string "right", then let cue's text track cue alignment be right alignment.
+            else if (cueAlignment == rightKeyword())
+                m_cueAlignment = Right;
             }
             break;
 #if ENABLE(WEBVTT_REGIONS)
@@ -1120,6 +1175,11 @@
 #endif
 }
 
+CSSValueID TextTrackCue::getCSSAlignment() const
+{
+    return displayAlignmentMap[m_cueAlignment];
+}
+
 CSSValueID TextTrackCue::getCSSWritingDirection() const
 {
     return m_displayDirection;
@@ -1127,7 +1187,7 @@
 
 CSSValueID TextTrackCue::getCSSWritingMode() const
 {
-    return m_displayWritingMode;
+    return displayWritingModeMap[m_writingDirection];
 }
 
 int TextTrackCue::getCSSSize() const
@@ -1145,22 +1205,12 @@
 
 const AtomicString& TextTrackCue::interfaceName() const
 {
-    return eventNames().interfaceForTextTrackCue;
+    return EventTargetNames::TextTrackCue;
 }
 
-ScriptExecutionContext* TextTrackCue::scriptExecutionContext() const
+ExecutionContext* TextTrackCue::executionContext() const
 {
-    return m_scriptExecutionContext;
-}
-
-EventTargetData* TextTrackCue::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* TextTrackCue::ensureEventTargetData()
-{
-    return &m_eventTargetData;
+    return m_executionContext;
 }
 
 bool TextTrackCue::operator==(const TextTrackCue& cue) const
diff --git a/Source/core/html/track/TextTrackCue.h b/Source/core/html/track/TextTrackCue.h
index 92047be..eabb5cb 100644
--- a/Source/core/html/track/TextTrackCue.h
+++ b/Source/core/html/track/TextTrackCue.h
@@ -41,7 +41,7 @@
 
 class DocumentFragment;
 class ExceptionState;
-class ScriptExecutionContext;
+class ExecutionContext;
 class TextTrack;
 class TextTrackCue;
 
@@ -69,9 +69,9 @@
 
 // ----------------------------
 
-class TextTrackCue : public RefCounted<TextTrackCue>, public ScriptWrappable, public EventTarget {
+class TextTrackCue : public RefCounted<TextTrackCue>, public ScriptWrappable, public EventTargetWithInlineData {
 public:
-    static PassRefPtr<TextTrackCue> create(ScriptExecutionContext* context, double start, double end, const String& content)
+    static PassRefPtr<TextTrackCue> create(ExecutionContext* context, double start, double end, const String& content)
     {
         return adoptRef(new TextTrackCue(context, start, end, content));
     }
@@ -150,17 +150,18 @@
 
     int calculateComputedLinePosition();
 
-    virtual const AtomicString& interfaceName() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const;
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
 
     std::pair<double, double> getCSSPosition() const;
 
+    CSSValueID getCSSAlignment() const;
     int getCSSSize() const;
     CSSValueID getCSSWritingDirection() const;
     CSSValueID getCSSWritingMode() const;
 
     enum WritingDirection {
-        Horizontal,
+        Horizontal = 0,
         VerticalGrowingLeft,
         VerticalGrowingRight,
         NumberOfWritingDirections
@@ -168,9 +169,12 @@
     WritingDirection getWritingDirection() const { return m_writingDirection; }
 
     enum CueAlignment {
-        Start,
+        Start = 0,
         Middle,
-        End
+        End,
+        Left,
+        Right,
+        NumberOfAlignments
     };
     CueAlignment getAlignment() const { return m_cueAlignment; }
 
@@ -195,12 +199,9 @@
     using RefCounted<TextTrackCue>::deref;
 
 protected:
-    virtual EventTargetData* eventTargetData();
-    virtual EventTargetData* ensureEventTargetData();
+    TextTrackCue(ExecutionContext*, double start, double end, const String& content);
 
-    TextTrackCue(ScriptExecutionContext*, double start, double end, const String& content);
-
-    Document* ownerDocument() { return toDocument(m_scriptExecutionContext); }
+    Document* ownerDocument() { return toDocument(m_executionContext); }
 
     virtual PassRefPtr<TextTrackCueBox> createDisplayTree();
     PassRefPtr<TextTrackCueBox> displayTreeInternal();
@@ -218,8 +219,8 @@
     void cueWillChange();
     void cueDidChange();
 
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
 
     enum CueSetting {
         None,
@@ -252,8 +253,7 @@
     RefPtr<DocumentFragment> m_webVTTNodeTree;
     TextTrack* m_track;
 
-    EventTargetData m_eventTargetData;
-    ScriptExecutionContext* m_scriptExecutionContext;
+    ExecutionContext* m_executionContext;
 
     bool m_isActive;
     bool m_pauseOnExit;
@@ -266,9 +266,6 @@
 
     CSSValueID m_displayDirection;
 
-    CSSValueID m_displayWritingModeMap[NumberOfWritingDirections];
-    CSSValueID m_displayWritingMode;
-
     int m_displaySize;
 
     std::pair<float, float> m_displayPosition;
diff --git a/Source/core/html/track/TextTrackCue.idl b/Source/core/html/track/TextTrackCue.idl
index e64d8a3..6624c17 100644
--- a/Source/core/html/track/TextTrackCue.idl
+++ b/Source/core/html/track/TextTrackCue.idl
@@ -24,9 +24,9 @@
  */
 
 [
-    EnabledAtRuntime=VideoTrack,
+    RuntimeEnabled=VideoTrack,
     Constructor(double startTime, double endTime, DOMString text),
-    ConstructorCallWith=ScriptExecutionContext
+    ConstructorCallWith=ExecutionContext
 ] interface TextTrackCue : EventTarget {
     readonly attribute TextTrack track;
 
diff --git a/Source/core/html/track/TextTrackCueGeneric.cpp b/Source/core/html/track/TextTrackCueGeneric.cpp
deleted file mode 100644
index b80e67b..0000000
--- a/Source/core/html/track/TextTrackCueGeneric.cpp
+++ /dev/null
@@ -1,168 +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 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,
- * 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/html/track/TextTrackCueGeneric.h"
-
-#include "CSSPropertyNames.h"
-#include "CSSValueKeywords.h"
-#include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/html/HTMLDivElement.h"
-#include "core/html/track/TextTrackCue.h"
-
-namespace WebCore {
-
-class TextTrackCueGenericBoxElement FINAL : public TextTrackCueBox {
-public:
-    static PassRefPtr<TextTrackCueGenericBoxElement> create(Document& document, TextTrackCueGeneric* cue)
-    {
-        return adoptRef(new TextTrackCueGenericBoxElement(document, cue));
-    }
-
-    virtual void applyCSSProperties(const IntSize&) OVERRIDE;
-
-private:
-    TextTrackCueGenericBoxElement(Document&, TextTrackCue*);
-};
-
-TextTrackCueGenericBoxElement::TextTrackCueGenericBoxElement(Document& document, TextTrackCue* cue)
-    : TextTrackCueBox(document, cue)
-{
-}
-
-void TextTrackCueGenericBoxElement::applyCSSProperties(const IntSize& videoSize)
-{
-    setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute);
-    setInlineStyleProperty(CSSPropertyUnicodeBidi, CSSValueWebkitPlaintext);
-
-    TextTrackCueGeneric* cue = static_cast<TextTrackCueGeneric*>(getCue());
-
-    float size = static_cast<float>(cue->getCSSSize());
-    if (cue->useDefaultPosition()) {
-        setInlineStyleProperty(CSSPropertyBottom, 0.0, CSSPrimitiveValue::CSS_PX);
-        setInlineStyleProperty(CSSPropertyMarginBottom, 1.0, CSSPrimitiveValue::CSS_PERCENTAGE);
-    } else {
-        setInlineStyleProperty(CSSPropertyLeft, static_cast<float>(cue->position()), CSSPrimitiveValue::CSS_PERCENTAGE);
-        setInlineStyleProperty(CSSPropertyTop, static_cast<float>(cue->line()), CSSPrimitiveValue::CSS_PERCENTAGE);
-
-        if (cue->getWritingDirection() == TextTrackCue::Horizontal)
-            setInlineStyleProperty(CSSPropertyWidth, size, CSSPrimitiveValue::CSS_PERCENTAGE);
-        else
-            setInlineStyleProperty(CSSPropertyHeight, size,  CSSPrimitiveValue::CSS_PERCENTAGE);
-    }
-
-    if (cue->foregroundColor().isValid())
-        setInlineStyleProperty(CSSPropertyColor, cue->foregroundColor().serialized());
-
-    if (cue->backgroundColor().isValid())
-        cue->element()->setInlineStyleProperty(CSSPropertyBackgroundColor, cue->backgroundColor().serialized());
-
-    if (cue->getWritingDirection() == TextTrackCue::Horizontal)
-        setInlineStyleProperty(CSSPropertyHeight, CSSValueAuto);
-    else
-        setInlineStyleProperty(CSSPropertyWidth, CSSValueAuto);
-
-    if (cue->baseFontSizeRelativeToVideoHeight()) {
-        double fontSize = videoSize.height() * cue->baseFontSizeRelativeToVideoHeight() / 100;
-        if (cue->fontSizeMultiplier())
-            fontSize *= cue->fontSizeMultiplier() / 100;
-        setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue::CSS_PX);
-    }
-
-    if (cue->getAlignment() == TextTrackCue::Middle)
-        setInlineStyleProperty(CSSPropertyTextAlign, CSSValueCenter);
-    else if (cue->getAlignment() == TextTrackCue::End)
-        setInlineStyleProperty(CSSPropertyTextAlign, CSSValueEnd);
-    else
-        setInlineStyleProperty(CSSPropertyTextAlign, CSSValueStart);
-
-    setInlineStyleProperty(CSSPropertyWebkitWritingMode, cue->getCSSWritingMode(), false);
-    setInlineStyleProperty(CSSPropertyWhiteSpace, CSSValuePreWrap);
-    setInlineStyleProperty(CSSPropertyWordBreak, CSSValueNormal);
-}
-
-TextTrackCueGeneric::TextTrackCueGeneric(ScriptExecutionContext* context, double start, double end, const String& content)
-    : TextTrackCue(context, start, end, content)
-    , m_baseFontSizeRelativeToVideoHeight(0)
-    , m_fontSizeMultiplier(0)
-    , m_defaultPosition(true)
-{
-}
-
-PassRefPtr<TextTrackCueBox> TextTrackCueGeneric::createDisplayTree()
-{
-    ASSERT(ownerDocument());
-    return TextTrackCueGenericBoxElement::create(*ownerDocument(), this);
-}
-
-void TextTrackCueGeneric::setLine(int line, ExceptionState& es)
-{
-    m_defaultPosition = false;
-    TextTrackCue::setLine(line, es);
-}
-
-void TextTrackCueGeneric::setPosition(int position, ExceptionState& es)
-{
-    m_defaultPosition = false;
-    TextTrackCue::setPosition(position, es);
-}
-
-void TextTrackCueGeneric::videoSizeDidChange(const IntSize& videoSize)
-{
-    if (!hasDisplayTree())
-        return;
-
-    if (baseFontSizeRelativeToVideoHeight()) {
-        double fontSize = videoSize.height() * baseFontSizeRelativeToVideoHeight() / 100;
-        if (fontSizeMultiplier())
-            fontSize *= fontSizeMultiplier() / 100;
-        displayTreeInternal()->setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue::CSS_PX);
-    }
-
-}
-
-bool TextTrackCueGeneric::operator==(const TextTrackCue& cue) const
-{
-    if (cue.cueType() != TextTrackCue::Generic)
-        return false;
-
-    const TextTrackCueGeneric* other = static_cast<const TextTrackCueGeneric*>(&cue);
-
-    if (m_baseFontSizeRelativeToVideoHeight != other->baseFontSizeRelativeToVideoHeight())
-        return false;
-    if (m_fontSizeMultiplier != other->fontSizeMultiplier())
-        return false;
-    if (m_fontName != other->fontName())
-        return false;
-    if (m_foregroundColor != other->foregroundColor())
-        return false;
-    if (m_backgroundColor != other->backgroundColor())
-        return false;
-
-    return TextTrackCue::operator==(cue);
-}
-
-} // namespace WebCore
-
diff --git a/Source/core/html/track/TextTrackCueGeneric.h b/Source/core/html/track/TextTrackCueGeneric.h
deleted file mode 100644
index a62611a..0000000
--- a/Source/core/html/track/TextTrackCueGeneric.h
+++ /dev/null
@@ -1,93 +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 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,
- * 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 TextTrackCueGeneric_h
-#define TextTrackCueGeneric_h
-
-#include "core/html/track/TextTrackCue.h"
-#include "core/platform/graphics/Color.h"
-
-namespace WebCore {
-
-class ExceptionState;
-class GenericCueData;
-
-// A "generic" cue is a non-WebVTT cue, so it is not positioned/sized with the WebVTT logic.
-class TextTrackCueGeneric : public TextTrackCue {
-public:
-    static PassRefPtr<TextTrackCueGeneric> create(ScriptExecutionContext* context, double start, double end, const String& content)
-    {
-        return adoptRef(new TextTrackCueGeneric(context, start, end, content));
-    }
-
-    virtual ~TextTrackCueGeneric() { }
-
-    virtual PassRefPtr<TextTrackCueBox> createDisplayTree() OVERRIDE;
-
-    virtual void setLine(int, ExceptionState&) OVERRIDE;
-    virtual void setPosition(int, ExceptionState&) OVERRIDE;
-
-    bool useDefaultPosition() const { return m_defaultPosition; }
-
-    double baseFontSizeRelativeToVideoHeight() const { return m_baseFontSizeRelativeToVideoHeight; }
-    void setBaseFontSizeRelativeToVideoHeight(double size) { m_baseFontSizeRelativeToVideoHeight = size; }
-
-    double fontSizeMultiplier() const { return m_fontSizeMultiplier; }
-    void setFontSizeMultiplier(double size) { m_fontSizeMultiplier = size; }
-
-    String fontName() const { return m_fontName; }
-    void setFontName(String name) { m_fontName = name; }
-
-    Color foregroundColor() const { return m_foregroundColor; }
-
-    void setForegroundColor(RGBA32 color) { m_foregroundColor.setRGB(color); }
-
-    Color backgroundColor() const { return m_backgroundColor; }
-    void setBackgroundColor(RGBA32 color) { m_backgroundColor.setRGB(color); }
-
-    virtual void videoSizeDidChange(const IntSize&);
-
-    virtual bool operator==(const TextTrackCue&) const OVERRIDE;
-    virtual bool operator!=(const TextTrackCue& cue) const OVERRIDE
-    {
-        return !(*this == cue);
-    }
-
-    virtual TextTrackCue::CueType cueType() const OVERRIDE { return TextTrackCue::Generic; }
-
-private:
-    TextTrackCueGeneric(ScriptExecutionContext*, double start, double end, const String&);
-
-    Color m_foregroundColor;
-    Color m_backgroundColor;
-    double m_baseFontSizeRelativeToVideoHeight;
-    double m_fontSizeMultiplier;
-    String m_fontName;
-    bool m_defaultPosition;
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/html/track/TextTrackCueList.idl b/Source/core/html/track/TextTrackCueList.idl
index 4f28935..a71d687 100644
--- a/Source/core/html/track/TextTrackCueList.idl
+++ b/Source/core/html/track/TextTrackCueList.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=VideoTrack
+    RuntimeEnabled=VideoTrack
 ] interface TextTrackCueList {
     readonly attribute unsigned long length;
     getter TextTrackCue item(unsigned long index);
diff --git a/Source/core/html/track/TextTrackList.cpp b/Source/core/html/track/TextTrackList.cpp
index 0bff78f..e945734 100644
--- a/Source/core/html/track/TextTrackList.cpp
+++ b/Source/core/html/track/TextTrackList.cpp
@@ -27,7 +27,7 @@
 #include "core/html/track/TextTrackList.h"
 
 #include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/track/InbandTextTrack.h"
 #include "core/html/track/LoadableTextTrack.h"
@@ -36,7 +36,7 @@
 
 using namespace WebCore;
 
-TextTrackList::TextTrackList(HTMLMediaElement* owner, ScriptExecutionContext* context)
+TextTrackList::TextTrackList(HTMLMediaElement* owner, ExecutionContext* context)
     : m_context(context)
     , m_owner(owner)
     , m_pendingEventTimer(this, &TextTrackList::asyncEventTimerFired)
@@ -232,7 +232,7 @@
 
 const AtomicString& TextTrackList::interfaceName() const
 {
-    return eventNames().interfaceForTextTrackList;
+    return EventTargetNames::TextTrackList;
 }
 
 void TextTrackList::scheduleAddTrackEvent(PassRefPtr<TextTrack> track)
@@ -250,7 +250,7 @@
     initializer.bubbles = false;
     initializer.cancelable = false;
 
-    m_pendingEvents.append(TrackEvent::create(eventNames().addtrackEvent, initializer));
+    m_pendingEvents.append(TrackEvent::create(EventTypeNames::addtrack, initializer));
     if (!m_pendingEventTimer.isActive())
         m_pendingEventTimer.startOneShot(0);
 }
diff --git a/Source/core/html/track/TextTrackList.h b/Source/core/html/track/TextTrackList.h
index 8a9e876..fef51cd 100644
--- a/Source/core/html/track/TextTrackList.h
+++ b/Source/core/html/track/TextTrackList.h
@@ -29,7 +29,7 @@
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/events/EventListener.h"
 #include "core/events/EventTarget.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/Vector.h"
@@ -40,9 +40,9 @@
 class TextTrack;
 class TextTrackList;
 
-class TextTrackList : public RefCounted<TextTrackList>, public ScriptWrappable, public EventTarget {
+class TextTrackList : public RefCounted<TextTrackList>, public ScriptWrappable, public EventTargetWithInlineData {
 public:
-    static PassRefPtr<TextTrackList> create(HTMLMediaElement* owner, ScriptExecutionContext* context)
+    static PassRefPtr<TextTrackList> create(HTMLMediaElement* owner, ExecutionContext* context)
     {
         return adoptRef(new TextTrackList(owner, context));
     }
@@ -58,10 +58,10 @@
     void remove(TextTrack*);
 
     // EventTarget
-    virtual const AtomicString& interfaceName() const;
+    virtual const AtomicString& interfaceName() const OVERRIDE;
     using RefCounted<TextTrackList>::ref;
     using RefCounted<TextTrackList>::deref;
-    virtual ScriptExecutionContext* scriptExecutionContext() const { return m_context; }
+    virtual ExecutionContext* executionContext() const OVERRIDE { return m_context; }
 
     DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack);
 
@@ -71,26 +71,23 @@
     bool isFiringEventListeners() { return m_dispatchingEvents; }
 
 private:
-    TextTrackList(HTMLMediaElement*, ScriptExecutionContext*);
+    TextTrackList(HTMLMediaElement*, ExecutionContext*);
 
     // EventTarget
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
-    virtual EventTargetData* eventTargetData() { return &m_eventTargetData; }
-    virtual EventTargetData* ensureEventTargetData() { return &m_eventTargetData; }
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
 
     void scheduleAddTrackEvent(PassRefPtr<TextTrack>);
     void asyncEventTimerFired(Timer<TextTrackList>*);
 
     void invalidateTrackIndexesAfterTrack(TextTrack*);
 
-    ScriptExecutionContext* m_context;
+    ExecutionContext* m_context;
     HTMLMediaElement* m_owner;
 
     Vector<RefPtr<Event> > m_pendingEvents;
     Timer<TextTrackList> m_pendingEventTimer;
 
-    EventTargetData m_eventTargetData;
     Vector<RefPtr<TextTrack> > m_addTrackTracks;
     Vector<RefPtr<TextTrack> > m_elementTracks;
     Vector<RefPtr<TextTrack> > m_inbandTracks;
diff --git a/Source/core/html/track/TextTrackList.idl b/Source/core/html/track/TextTrackList.idl
index bdfcc74..236029e 100644
--- a/Source/core/html/track/TextTrackList.idl
+++ b/Source/core/html/track/TextTrackList.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=VideoTrack,
+    RuntimeEnabled=VideoTrack,
     GenerateIsReachable=owner
 ] interface TextTrackList : EventTarget {
     readonly attribute unsigned long length;
diff --git a/Source/core/html/track/TextTrackRegion.cpp b/Source/core/html/track/TextTrackRegion.cpp
index cb7181e..eaae93f 100644
--- a/Source/core/html/track/TextTrackRegion.cpp
+++ b/Source/core/html/track/TextTrackRegion.cpp
@@ -40,7 +40,7 @@
 #include "core/dom/DOMTokenList.h"
 #include "core/html/HTMLDivElement.h"
 #include "core/html/track/WebVTTParser.h"
-#include "core/platform/Logging.h"
+#include "platform/Logging.h"
 #include "core/rendering/RenderInline.h"
 #include "core/rendering/RenderObject.h"
 #include "wtf/MathExtras.h"
@@ -70,7 +70,7 @@
 // Default scrolling animation time period (s).
 static const float scrollTime = 0.433;
 
-TextTrackRegion::TextTrackRegion(ScriptExecutionContext* context)
+TextTrackRegion::TextTrackRegion(ExecutionContext* context)
     : ContextLifecycleObserver(context)
     , m_id(emptyString())
     , m_width(defaultWidth)
diff --git a/Source/core/html/track/TextTrackRegion.h b/Source/core/html/track/TextTrackRegion.h
index f0642fb..5760063 100644
--- a/Source/core/html/track/TextTrackRegion.h
+++ b/Source/core/html/track/TextTrackRegion.h
@@ -36,7 +36,7 @@
 #include "core/dom/ContextLifecycleObserver.h"
 #include "core/dom/Document.h"
 #include "core/html/track/TextTrack.h"
-#include "core/platform/graphics/FloatPoint.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefCounted.h"
 
@@ -48,7 +48,7 @@
 
 class TextTrackRegion : public RefCounted<TextTrackRegion>, public ContextLifecycleObserver {
 public:
-    static PassRefPtr<TextTrackRegion> create(ScriptExecutionContext* context)
+    static PassRefPtr<TextTrackRegion> create(ExecutionContext* context)
     {
         return adoptRef(new TextTrackRegion(context));
     }
@@ -96,8 +96,8 @@
     void willRemoveTextTrackCueBox(TextTrackCueBox*);
 
 private:
-    TextTrackRegion(ScriptExecutionContext*);
-    Document* ownerDocument() { return toDocument(m_scriptExecutionContext); }
+    TextTrackRegion(ExecutionContext*);
+    Document* ownerDocument() { return toDocument(m_executionContext); }
 
     void prepareRegionDisplayTree();
 
diff --git a/Source/core/html/track/TextTrackRegion.idl b/Source/core/html/track/TextTrackRegion.idl
index 62ca08e..77ca009 100644
--- a/Source/core/html/track/TextTrackRegion.idl
+++ b/Source/core/html/track/TextTrackRegion.idl
@@ -26,8 +26,8 @@
 [
     Conditional=WEBVTT_REGIONS,
     Constructor(),
-    EnabledAtRuntime=VideoTrack,
-    ConstructorCallWith=ScriptExecutionContext
+    RuntimeEnabled=VideoTrack,
+    ConstructorCallWith=ExecutionContext
 ] interface TextTrackRegion {
     readonly attribute TextTrack track;
 
diff --git a/Source/core/html/track/TextTrackRegionList.idl b/Source/core/html/track/TextTrackRegionList.idl
index 844cd9d..7ea57b5 100644
--- a/Source/core/html/track/TextTrackRegionList.idl
+++ b/Source/core/html/track/TextTrackRegionList.idl
@@ -26,7 +26,7 @@
 [
     NoInterfaceObject,
     Conditional=WEBVTT_REGIONS,
-    EnabledAtRuntime=VideoTrack
+    RuntimeEnabled=VideoTrack
 ] interface TextTrackRegionList {
     readonly attribute unsigned long length;
     getter TextTrackRegion item(unsigned long index);
diff --git a/Source/core/html/track/TrackBase.cpp b/Source/core/html/track/TrackBase.cpp
index e76de17..df29213 100644
--- a/Source/core/html/track/TrackBase.cpp
+++ b/Source/core/html/track/TrackBase.cpp
@@ -28,8 +28,8 @@
 
 namespace WebCore {
 
-TrackBase::TrackBase(ScriptExecutionContext* context, Type type)
-    : m_scriptExecutionContext(context)
+TrackBase::TrackBase(ExecutionContext* context, Type type)
+    : m_executionContext(context)
 {
     ASSERT(type != BaseTrack);
     m_type = type;
@@ -41,22 +41,12 @@
 
 const AtomicString& TrackBase::interfaceName() const
 {
-    return eventNames().interfaceForTextTrack;
+    return EventTargetNames::TextTrack;
 }
 
-ScriptExecutionContext* TrackBase::scriptExecutionContext() const
+ExecutionContext* TrackBase::executionContext() const
 {
-    return m_scriptExecutionContext;
-}
-
-EventTargetData* TrackBase::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* TrackBase::ensureEventTargetData()
-{
-    return &m_eventTargetData;
+    return m_executionContext;
 }
 
 } // namespace WebCore
diff --git a/Source/core/html/track/TrackBase.h b/Source/core/html/track/TrackBase.h
index 41e5a5b..8df947a 100644
--- a/Source/core/html/track/TrackBase.h
+++ b/Source/core/html/track/TrackBase.h
@@ -31,35 +31,31 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
+class ExecutionContext;
 
-class TrackBase : public RefCounted<TrackBase>, public EventTarget {
+class TrackBase : public RefCounted<TrackBase>, public EventTargetWithInlineData {
 public:
     virtual ~TrackBase();
 
     enum Type { BaseTrack, TextTrack, AudioTrack, VideoTrack };
     Type type() const { return m_type; }
 
-    virtual const AtomicString& interfaceName() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const;
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
 
     using RefCounted<TrackBase>::ref;
     using RefCounted<TrackBase>::deref;
 
 protected:
-    TrackBase(ScriptExecutionContext*, Type);
-
-    virtual EventTargetData* eventTargetData();
-    virtual EventTargetData* ensureEventTargetData();
+    TrackBase(ExecutionContext*, Type);
 
 private:
     Type m_type;
 
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
 
-    ScriptExecutionContext* m_scriptExecutionContext;
-    EventTargetData m_eventTargetData;
+    ExecutionContext* m_executionContext;
 };
 
 } // namespace WebCore
diff --git a/Source/core/html/track/TrackEvent.cpp b/Source/core/html/track/TrackEvent.cpp
index 262be3a..39d70bd 100644
--- a/Source/core/html/track/TrackEvent.cpp
+++ b/Source/core/html/track/TrackEvent.cpp
@@ -27,7 +27,7 @@
 
 #include "core/html/track/TrackEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -54,7 +54,7 @@
 
 const AtomicString& TrackEvent::interfaceName() const
 {
-    return eventNames().interfaceForTrackEvent;
+    return EventNames::TrackEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/html/track/TrackEvent.idl b/Source/core/html/track/TrackEvent.idl
index c1dc03e..3a164cd 100644
--- a/Source/core/html/track/TrackEvent.idl
+++ b/Source/core/html/track/TrackEvent.idl
@@ -24,7 +24,7 @@
  */
 
 [
-    EnabledAtRuntime=VideoTrack,
+    RuntimeEnabled=VideoTrack,
     ConstructorTemplate=Event
 ] interface TrackEvent : Event {
     [InitializedByEventConstructor, CustomGetter] readonly attribute object track;
diff --git a/Source/core/html/track/WebVTTParser.cpp b/Source/core/html/track/WebVTTParser.cpp
index e249da4..6b77846 100644
--- a/Source/core/html/track/WebVTTParser.cpp
+++ b/Source/core/html/track/WebVTTParser.cpp
@@ -34,7 +34,7 @@
 #include "core/dom/ProcessingInstruction.h"
 #include "core/dom/Text.h"
 #include "core/html/track/WebVTTElement.h"
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
@@ -112,8 +112,8 @@
 }
 #endif
 
-WebVTTParser::WebVTTParser(WebVTTParserClient* client, ScriptExecutionContext* context)
-    : m_scriptExecutionContext(context)
+WebVTTParser::WebVTTParser(WebVTTParserClient* client, ExecutionContext* context)
+    : m_executionContext(context)
     , m_state(Initial)
     , m_currentStartTime(0)
     , m_currentEndTime(0)
@@ -328,8 +328,8 @@
     // 4.8.10.13.4 WebVTT cue text parsing rules and
     // 4.8.10.13.5 WebVTT cue text DOM construction rules.
 
-    ASSERT(m_scriptExecutionContext->isDocument());
-    Document* document = toDocument(m_scriptExecutionContext);
+    ASSERT(m_executionContext->isDocument());
+    Document* document = toDocument(m_executionContext);
     ASSERT(document);
 
     RefPtr<DocumentFragment> fragment = DocumentFragment::create(*document);
@@ -356,7 +356,7 @@
     if (!m_currentContent.length())
         return;
 
-    RefPtr<TextTrackCue> cue = TextTrackCue::create(m_scriptExecutionContext, m_currentStartTime, m_currentEndTime, m_currentContent.toString());
+    RefPtr<TextTrackCue> cue = TextTrackCue::create(m_executionContext, m_currentStartTime, m_currentEndTime, m_currentContent.toString());
     cue->setId(m_currentId);
     cue->setCueSettings(m_currentSettings);
 
@@ -380,7 +380,7 @@
     if (!m_currentHeaderValue.length())
         return;
 
-    RefPtr<TextTrackRegion> region = TextTrackRegion::create(m_scriptExecutionContext);
+    RefPtr<TextTrackRegion> region = TextTrackRegion::create(m_executionContext);
     region->setRegionSettings(m_currentHeaderValue);
 
     // 15.5.10 If the text track list of regions regions contains a region
diff --git a/Source/core/html/track/WebVTTParser.h b/Source/core/html/track/WebVTTParser.h
index c717e57..e566e2e 100644
--- a/Source/core/html/track/WebVTTParser.h
+++ b/Source/core/html/track/WebVTTParser.h
@@ -72,7 +72,7 @@
         BadCue
     };
 
-    static PassOwnPtr<WebVTTParser> create(WebVTTParserClient* client, ScriptExecutionContext* context)
+    static PassOwnPtr<WebVTTParser> create(WebVTTParserClient* client, ExecutionContext* context)
     {
         return adoptPtr(new WebVTTParser(client, context));
     }
@@ -119,9 +119,9 @@
     double collectTimeStamp(const String&, unsigned*);
 
 protected:
-    WebVTTParser(WebVTTParserClient*, ScriptExecutionContext*);
+    WebVTTParser(WebVTTParserClient*, ExecutionContext*);
 
-    ScriptExecutionContext* m_scriptExecutionContext;
+    ExecutionContext* m_executionContext;
     ParseState m_state;
 
 private:
diff --git a/Source/core/injected_canvas_script_source.target.darwin-arm.mk b/Source/core/injected_canvas_script_source.target.darwin-arm.mk
index 12a7eb8..5f7b331 100644
--- a/Source/core/injected_canvas_script_source.target.darwin-arm.mk
+++ b/Source/core/injected_canvas_script_source.target.darwin-arm.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h from inspector/InjectedScriptCanvasModuleSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
 
 
 
diff --git a/Source/core/injected_canvas_script_source.target.darwin-mips.mk b/Source/core/injected_canvas_script_source.target.darwin-mips.mk
index 12a7eb8..5f7b331 100644
--- a/Source/core/injected_canvas_script_source.target.darwin-mips.mk
+++ b/Source/core/injected_canvas_script_source.target.darwin-mips.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h from inspector/InjectedScriptCanvasModuleSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
 
 
 
diff --git a/Source/core/injected_canvas_script_source.target.darwin-x86.mk b/Source/core/injected_canvas_script_source.target.darwin-x86.mk
index 12a7eb8..5f7b331 100644
--- a/Source/core/injected_canvas_script_source.target.darwin-x86.mk
+++ b/Source/core/injected_canvas_script_source.target.darwin-x86.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h from inspector/InjectedScriptCanvasModuleSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
 
 
 
diff --git a/Source/core/injected_canvas_script_source.target.linux-arm.mk b/Source/core/injected_canvas_script_source.target.linux-arm.mk
index 12a7eb8..5f7b331 100644
--- a/Source/core/injected_canvas_script_source.target.linux-arm.mk
+++ b/Source/core/injected_canvas_script_source.target.linux-arm.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h from inspector/InjectedScriptCanvasModuleSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
 
 
 
diff --git a/Source/core/injected_canvas_script_source.target.linux-mips.mk b/Source/core/injected_canvas_script_source.target.linux-mips.mk
index 12a7eb8..5f7b331 100644
--- a/Source/core/injected_canvas_script_source.target.linux-mips.mk
+++ b/Source/core/injected_canvas_script_source.target.linux-mips.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h from inspector/InjectedScriptCanvasModuleSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
 
 
 
diff --git a/Source/core/injected_canvas_script_source.target.linux-x86.mk b/Source/core/injected_canvas_script_source.target.linux-x86.mk
index 12a7eb8..5f7b331 100644
--- a/Source/core/injected_canvas_script_source.target.linux-x86.mk
+++ b/Source/core/injected_canvas_script_source.target.linux-x86.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h from inspector/InjectedScriptCanvasModuleSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptCanvasModuleSource_js inspector/InjectedScriptCanvasModuleSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptCanvasModuleSource.h"
 
 
 
diff --git a/Source/core/injected_script_source.target.darwin-arm.mk b/Source/core/injected_script_source.target.darwin-arm.mk
index 4313399..3643178 100644
--- a/Source/core/injected_script_source.target.darwin-arm.mk
+++ b/Source/core/injected_script_source.target.darwin-arm.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h from inspector/InjectedScriptSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
 
 
 
diff --git a/Source/core/injected_script_source.target.darwin-mips.mk b/Source/core/injected_script_source.target.darwin-mips.mk
index 4313399..3643178 100644
--- a/Source/core/injected_script_source.target.darwin-mips.mk
+++ b/Source/core/injected_script_source.target.darwin-mips.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h from inspector/InjectedScriptSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
 
 
 
diff --git a/Source/core/injected_script_source.target.darwin-x86.mk b/Source/core/injected_script_source.target.darwin-x86.mk
index 4313399..3643178 100644
--- a/Source/core/injected_script_source.target.darwin-x86.mk
+++ b/Source/core/injected_script_source.target.darwin-x86.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h from inspector/InjectedScriptSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
 
 
 
diff --git a/Source/core/injected_script_source.target.linux-arm.mk b/Source/core/injected_script_source.target.linux-arm.mk
index 4313399..3643178 100644
--- a/Source/core/injected_script_source.target.linux-arm.mk
+++ b/Source/core/injected_script_source.target.linux-arm.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h from inspector/InjectedScriptSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
 
 
 
diff --git a/Source/core/injected_script_source.target.linux-mips.mk b/Source/core/injected_script_source.target.linux-mips.mk
index 4313399..3643178 100644
--- a/Source/core/injected_script_source.target.linux-mips.mk
+++ b/Source/core/injected_script_source.target.linux-mips.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h from inspector/InjectedScriptSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
 
 
 
diff --git a/Source/core/injected_script_source.target.linux-x86.mk b/Source/core/injected_script_source.target.linux-x86.mk
index 4313399..3643178 100644
--- a/Source/core/injected_script_source.target.linux-x86.mk
+++ b/Source/core/injected_script_source.target.linux-x86.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h from inspector/InjectedScriptSource.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InjectedScriptSource_js inspector/InjectedScriptSource.js "$(gyp_shared_intermediate_dir)/blink/InjectedScriptSource.h"
 
 
 
diff --git a/Source/core/inspector/CodeGeneratorInspectorStrings.py b/Source/core/inspector/CodeGeneratorInspectorStrings.py
index b7e7422..e0f5262 100644
--- a/Source/core/inspector/CodeGeneratorInspectorStrings.py
+++ b/Source/core/inspector/CodeGeneratorInspectorStrings.py
@@ -101,7 +101,7 @@
 #define InspectorFrontend_h
 
 #include "InspectorTypeBuilder.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/text/WTFString.h"
 
@@ -214,7 +214,7 @@
 #include "core/inspector/InspectorAgent.h"
 #include "core/inspector/InspectorFrontendChannel.h"
 #include "core/inspector/JSONParser.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/WTFString.h"
 
@@ -516,7 +516,7 @@
 #include "InspectorFrontend.h"
 
 #include "core/inspector/InspectorFrontendChannel.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/WTFString.h"
 
@@ -537,7 +537,7 @@
 #ifndef InspectorTypeBuilder_h
 #define InspectorTypeBuilder_h
 
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/Assertions.h"
 #include "wtf/PassRefPtr.h"
 
diff --git a/Source/core/inspector/ConsoleMessage.cpp b/Source/core/inspector/ConsoleMessage.cpp
index 0de574d..6e3d905 100644
--- a/Source/core/inspector/ConsoleMessage.cpp
+++ b/Source/core/inspector/ConsoleMessage.cpp
@@ -123,7 +123,7 @@
         return;
 
     if (state)
-        m_callStack = createScriptCallStackForConsole(state);
+        m_callStack = createScriptCallStackForConsole();
     else if (canGenerateCallStack)
         m_callStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
     else
diff --git a/Source/core/inspector/ConsoleMessage.h b/Source/core/inspector/ConsoleMessage.h
index 78f4f9f..f487f74 100644
--- a/Source/core/inspector/ConsoleMessage.h
+++ b/Source/core/inspector/ConsoleMessage.h
@@ -34,7 +34,7 @@
 #include "InspectorFrontend.h"
 #include "bindings/v8/ScriptState.h"
 #include "core/inspector/ConsoleAPITypes.h"
-#include "core/page/ConsoleTypes.h"
+#include "core/frame/ConsoleTypes.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
diff --git a/Source/core/inspector/ContentSearchUtils.cpp b/Source/core/inspector/ContentSearchUtils.cpp
index da62f3b..7797e40 100644
--- a/Source/core/inspector/ContentSearchUtils.cpp
+++ b/Source/core/inspector/ContentSearchUtils.cpp
@@ -132,68 +132,51 @@
     ASSERT(name.find("=") == kNotFound);
     if (deprecated)
         *deprecated = false;
-
-    const unsigned limitSearchLength = 1000; // limit to 1000 last characters.
-    unsigned length = content.length();
-    unsigned nameLength = name.length();
-    unsigned stop = length > limitSearchLength ? length - limitSearchLength : 0;
-
-    size_t pos = length;
-    size_t equalSignPos = 0;
-    size_t closingCommentPos = 0;
-    while (true) {
-        pos = content.reverseFind(name, pos, stop);
-        if (pos == kNotFound)
-            return String();
-
-        // Check for a /\/[\/*][@#][ \t]/ regexp (length of 4) before found name.
-        if (pos < stop + 4)
-            return String();
-        pos -= 4;
-        if (content[pos] != '/')
-            continue;
-        if ((content[pos + 1] != '/' || commentType != JavaScriptMagicComment)
-            && (content[pos + 1] != '*' || commentType != CSSMagicComment))
-            continue;
-        if (content[pos + 2] != '#' && content[pos + 2] != '@')
-            continue;
-        if (content[pos + 3] != ' ' && content[pos + 3] != '\t')
-            continue;
-        equalSignPos = pos + 4 + nameLength;
-        if (equalSignPos < length && content[equalSignPos] != '=')
-            continue;
-        if (commentType == CSSMagicComment) {
-            closingCommentPos = content.find("*/", equalSignPos + 1);
-            if (closingCommentPos == kNotFound)
-                return String();
-            if (!content.substring(closingCommentPos + 2).containsOnlyWhitespace())
-                return String();
-        }
-
+    String pattern;
+    String deprecatedPattern;
+    switch (commentType) {
+    case JavaScriptMagicComment:
+        pattern = "//#[\040\t]" + createSearchRegexSource(name) + "=[\040\t]*([^\\s\'\"]*)[\040\t]*$";
+        deprecatedPattern = "//@[\040\t]" + createSearchRegexSource(name) + "=[\040\t]*([^\\s\'\"]*)[\040\t]*$";
         break;
+    case CSSMagicComment:
+        pattern = "/\\*#[\040\t]" + createSearchRegexSource(name) + "=[\040\t]*([^\\s]*)[\040\t]*\\*/[\040\t]*$";
+        deprecatedPattern = "/\\*@[\040\t]" + createSearchRegexSource(name) + "=[\040\t]*([^\\s]*)[\040\t]*\\*/[\040\t]*$";
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        return String();
     }
+    RegularExpression regex(pattern, TextCaseSensitive, MultilineEnabled);
+    RegularExpression deprecatedRegex(deprecatedPattern, TextCaseSensitive, MultilineEnabled);
 
-    if (pos < stop)
+    int matchLength;
+    int offset = regex.match(content, 0, &matchLength);
+    if (offset == -1) {
+        offset = deprecatedRegex.match(content, 0, &matchLength);
+        if (offset != -1 && deprecated)
+            *deprecated = true;
+    }
+    if (offset == -1)
         return String();
 
-    if (deprecated && content[pos + 2] == '@')
-        *deprecated = true;
+    String match = content.substring(offset, matchLength);
+    size_t separator = match.find("=");
+    ASSERT(separator != kNotFound);
+    match = match.substring(separator + 1);
 
-    ASSERT(equalSignPos);
-    ASSERT(commentType != CSSMagicComment || closingCommentPos);
-    size_t urlPos = equalSignPos + 1;
-    String match = commentType == CSSMagicComment
-        ? content.substring(urlPos, closingCommentPos - urlPos)
-        : content.substring(urlPos);
-    match = match.stripWhiteSpace();
-
-    String disallowedChars("\"' \t\n\r");
-    for (unsigned i = 0; i < match.length(); ++i) {
-        if (disallowedChars.find(match[i]) != kNotFound)
-            return String();
+    switch (commentType) {
+    case JavaScriptMagicComment:
+        return match.stripWhiteSpace();
+    case CSSMagicComment: {
+        size_t lastStarIndex = match.reverseFind('*');
+        ASSERT(lastStarIndex != kNotFound);
+        return match.substring(0, lastStarIndex).stripWhiteSpace();
     }
-
-    return match;
+    default:
+        ASSERT_NOT_REACHED();
+        return String();
+    }
 }
 
 String findSourceURL(const String& content, MagicCommentType commentType, bool* deprecated)
diff --git a/Source/core/inspector/DEPS b/Source/core/inspector/DEPS
new file mode 100644
index 0000000..e17e3a3
--- /dev/null
+++ b/Source/core/inspector/DEPS
@@ -0,0 +1,6 @@
+include_rules = [
+    # In order to link modules as a separate dylib, we'll need to sort out
+    # how to deal with the inspector's dependencies. Perhaps we'll want to
+    # move the inspector code out of blink_core.so?
+    "+modules",
+]
diff --git a/Source/core/inspector/DOMPatchSupport.cpp b/Source/core/inspector/DOMPatchSupport.cpp
index 5fed805..3f62a6f 100644
--- a/Source/core/inspector/DOMPatchSupport.cpp
+++ b/Source/core/inspector/DOMPatchSupport.cpp
@@ -138,8 +138,7 @@
         oldList.append(createDigest(child, 0));
 
     // Compose the new list.
-    String markupCopy = markup;
-    markupCopy.makeLower();
+    String markupCopy = markup.lower();
     Vector<OwnPtr<Digest> > newList;
     for (Node* child = parentNode->firstChild(); child != node; child = child->nextSibling())
         newList.append(createDigest(child, 0));
diff --git a/Source/core/inspector/InjectedScript.cpp b/Source/core/inspector/InjectedScript.cpp
index 98394a7..9d46e69 100644
--- a/Source/core/inspector/InjectedScript.cpp
+++ b/Source/core/inspector/InjectedScript.cpp
@@ -35,7 +35,7 @@
 
 #include "bindings/v8/ScriptFunctionCall.h"
 #include "core/inspector/InjectedScriptHost.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/text/WTFString.h"
 
 using WebCore::TypeBuilder::Array;
@@ -296,7 +296,7 @@
     return resultValue;
 }
 
-ScriptValue InjectedScript::findCallframeById(ErrorString* errorString, const ScriptValue& topCallFrame, const String& callFrameId)
+ScriptValue InjectedScript::findCallFrameById(ErrorString* errorString, const ScriptValue& topCallFrame, const String& callFrameId)
 {
     ScriptFunctionCall function(injectedScriptObject(), "callFrameForId");
     function.appendArgument(topCallFrame);
diff --git a/Source/core/inspector/InjectedScript.h b/Source/core/inspector/InjectedScript.h
index 81a1379..05cfcf3 100644
--- a/Source/core/inspector/InjectedScript.h
+++ b/Source/core/inspector/InjectedScript.h
@@ -91,7 +91,7 @@
     PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const ScriptValue& table, const ScriptValue& columns) const;
     PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapNode(Node*, const String& groupName);
     ScriptValue findObjectById(const String& objectId) const;
-    ScriptValue findCallframeById(ErrorString*, const ScriptValue& topCallFrame, const String& callFrameId);
+    ScriptValue findCallFrameById(ErrorString*, const ScriptValue& topCallFrame, const String& callFrameId);
 
     void inspectNode(Node*);
     void releaseObjectGroup(const String&);
diff --git a/Source/core/inspector/InjectedScriptBase.cpp b/Source/core/inspector/InjectedScriptBase.cpp
index 2f246a8..b625fce 100644
--- a/Source/core/inspector/InjectedScriptBase.cpp
+++ b/Source/core/inspector/InjectedScriptBase.cpp
@@ -35,7 +35,7 @@
 
 #include "bindings/v8/ScriptFunctionCall.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/text/WTFString.h"
 
 using WebCore::TypeBuilder::Runtime::RemoteObject;
@@ -73,8 +73,8 @@
 
 ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(ScriptFunctionCall& function, bool& hadException) const
 {
-    ScriptExecutionContext* scriptExecutionContext = m_injectedScriptObject.scriptState()->scriptExecutionContext();
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFunction(scriptExecutionContext, name(), 1);
+    ExecutionContext* executionContext = m_injectedScriptObject.scriptState()->executionContext();
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willCallFunction(executionContext, name(), 1);
 
     ScriptState* scriptState = m_injectedScriptObject.scriptState();
     bool evalIsDisabled = false;
diff --git a/Source/core/inspector/InjectedScriptHost.cpp b/Source/core/inspector/InjectedScriptHost.cpp
index 5f06de1..8354958 100644
--- a/Source/core/inspector/InjectedScriptHost.cpp
+++ b/Source/core/inspector/InjectedScriptHost.cpp
@@ -38,7 +38,7 @@
 #include "core/inspector/InspectorDatabaseAgent.h"
 #include "core/inspector/InspectorDebuggerAgent.h"
 #include "core/inspector/InstrumentingAgents.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 
 #include "wtf/RefPtr.h"
 #include "wtf/text/StringBuilder.h"
diff --git a/Source/core/inspector/InjectedScriptManager.cpp b/Source/core/inspector/InjectedScriptManager.cpp
index d7cec01..e425ee1 100644
--- a/Source/core/inspector/InjectedScriptManager.cpp
+++ b/Source/core/inspector/InjectedScriptManager.cpp
@@ -36,7 +36,7 @@
 #include "core/inspector/InjectedScript.h"
 #include "core/inspector/InjectedScriptHost.h"
 #include "core/inspector/JSONParser.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
@@ -149,8 +149,13 @@
 
 void InjectedScriptManager::releaseObjectGroup(const String& objectGroup)
 {
-    for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != m_idToInjectedScript.end(); ++it)
-        it->value.releaseObjectGroup(objectGroup);
+    Vector<int> keys;
+    keys.appendRange(m_idToInjectedScript.keys().begin(), m_idToInjectedScript.keys().end());
+    for (Vector<int>::iterator k = keys.begin(); k != keys.end(); ++k) {
+        IdToInjectedScriptMap::iterator s = m_idToInjectedScript.find(*k);
+        if (s != m_idToInjectedScript.end())
+            s->value.releaseObjectGroup(objectGroup); // m_idToInjectedScript may change here.
+    }
 }
 
 String InjectedScriptManager::injectedScriptSource()
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js
index f38edb6..de59c3c 100644
--- a/Source/core/inspector/InjectedScriptSource.js
+++ b/Source/core/inspector/InjectedScriptSource.js
@@ -54,6 +54,16 @@
 }
 
 /**
+ * @param {*} obj
+ * @return {string}
+ */
+function toString(obj)
+{
+    // We don't use String(obj) because it could be overriden.
+    return "" + obj;
+}
+
+/**
  * Please use this bind, not the one from Function.prototype
  * @param {function(...)} func
  * @param {Object} thisObject
@@ -140,7 +150,7 @@
         if (this.isPrimitiveValue(object))
             result.value = object;
         else
-            result.description = this._toString(object);
+            result.description = toString(object);
         return /** @type {!RuntimeAgent.RemoteObject} */ (result);
     },
 
@@ -160,7 +170,7 @@
         if (InjectedScriptHost.type(columns) == "array") {
             columnNames = [];
             for (var i = 0; i < columns.length; ++i)
-                columnNames.push(String(columns[i]));
+                columnNames.push(toString(columns[i]));
         }
         return this._wrapObject(table, "console", false, true, columnNames, true);
     },
@@ -340,7 +350,7 @@
                     value: this._wrapObject(property.value, objectGroupName)
                 };
                 descriptors.push(descriptor);
-            } 
+            }
         }
         return descriptors;
     },
@@ -416,7 +426,7 @@
                             continue;
                         try {
                             descriptor = { name: name, value: o[name], writable: false, configurable: false, enumerable: false};
-                            if (o === object) 
+                            if (o === object)
                                 descriptor.isOwn = true;
                             descriptors.push(descriptor);
                         } catch (e) {
@@ -433,7 +443,7 @@
                 }
 
                 descriptor.name = name;
-                if (o === object) 
+                if (o === object)
                     descriptor.isOwn = true;
                 descriptors.push(descriptor);
             }
@@ -480,7 +490,7 @@
                 try {
                     resolvedCallArgument = this._resolveCallArgument(args[i]);
                 } catch (e) {
-                    return String(e);
+                    return toString(e);
                 }
                 resolvedArgs.push(resolvedCallArgument)
             }
@@ -498,7 +508,7 @@
             return this._createThrownValue(e, objectGroup);
         }
     },
-    
+
     /**
      * Resolves a value from CallArgument description.
      * @param {RuntimeAgent.CallArgument} callArgumentJson
@@ -552,7 +562,7 @@
     {
         var remoteObject = this._wrapObject(value, objectGroup);
         try {
-            remoteObject.description = this._toString(value);
+            remoteObject.description = toString(value);
         } catch (e) {}
         return { wasThrown: true,
                  result: remoteObject };
@@ -636,7 +646,7 @@
             return "Could not find call frame with given id";
         var result = callFrame.restart();
         if (result === false)
-            result = "Restart frame is not supported"; 
+            result = "Restart frame is not supported";
         return result;
     },
 
@@ -663,23 +673,23 @@
      * @param {string|boolean} functionObjectId or false
      * @param {number} scopeNumber
      * @param {string} variableName
-     * @param {string} newValueJsonString RuntimeAgent.CallArgument structure serialized as string 
-     * @return {string|undefined} undefined if success or an error message 
+     * @param {string} newValueJsonString RuntimeAgent.CallArgument structure serialized as string
+     * @return {string|undefined} undefined if success or an error message
      */
     setVariableValue: function(topCallFrame, callFrameId, functionObjectId, scopeNumber, variableName, newValueJsonString)
-    {   
+    {
         var setter;
         if (typeof callFrameId === "string") {
             var callFrame = this.callFrameForId(topCallFrame, callFrameId);
             if (!callFrame)
                 return "Could not find call frame with given id";
-            setter = callFrame.setVariableValue.bind(callFrame);    
+            setter = callFrame.setVariableValue.bind(callFrame);
         } else {
             var parsedFunctionId = this._parseObjectId(/** @type {string} */ (functionObjectId));
             var func = this._objectForId(parsedFunctionId);
             if (typeof func !== "function")
                 return "Cannot resolve function by id.";
-            setter = InjectedScriptHost.setFunctionVariableValue.bind(InjectedScriptHost, func); 
+            setter = InjectedScriptHost.setFunctionVariableValue.bind(InjectedScriptHost, func);
         }
         var newValueJson;
         try {
@@ -691,7 +701,7 @@
         try {
             resolvedValue = this._resolveCallArgument(newValueJson);
         } catch (e) {
-            return String(e);
+            return toString(e);
         }
         try {
             setter(scopeNumber, variableName, resolvedValue);
@@ -750,7 +760,7 @@
     /**
      * @param {string} name
      * @return {Object}
-     */ 
+     */
     module: function(name)
     {
         return this._modules[name];
@@ -760,7 +770,7 @@
      * @param {string} name
      * @param {string} source
      * @return {Object}
-     */ 
+     */
     injectModule: function(name, source)
     {
         delete this._modules[name];
@@ -838,10 +848,10 @@
         var subtype = this._subtype(obj);
 
         if (subtype === "regexp")
-            return this._toString(obj);
+            return toString(obj);
 
         if (subtype === "date")
-            return this._toString(obj);
+            return toString(obj);
 
         if (subtype === "node") {
             var description = obj.nodeName.toLowerCase();
@@ -867,7 +877,7 @@
 
         // NodeList in JSC is a function, check for array prior to this.
         if (typeof obj === "function")
-            return this._toString(obj);
+            return toString(obj);
 
         if (className === "Object") {
             // In Chromium DOM wrapper prototypes will have Object as their constructor name,
@@ -877,16 +887,6 @@
                 return constructorName;
         }
         return className;
-    },
-
-    /**
-     * @param {*} obj
-     * @return {string}
-     */
-    _toString: function(obj)
-    {
-        // We don't use String(obj) because inspectedWindow.String is undefined if owning frame navigated to another page.
-        return "" + obj;
     }
 }
 
@@ -919,7 +919,7 @@
 
         // Provide user-friendly number values.
         if (this.type === "number")
-            this.description = object + "";
+            this.description = toString(object);
         return;
     }
 
@@ -986,29 +986,30 @@
                     continue;
 
                 var descriptor = Object.getOwnPropertyDescriptor(object, name);
-                if (!("value" in descriptor) || !descriptor.enumerable) {
+                if (!descriptor.enumerable) {
                     preview.lossless = false;
                     continue;
                 }
+                if (!("value" in descriptor)) {
+                    this._appendPropertyPreview(preview, { name: name, type: "accessor" }, propertiesThreshold);
+                    continue;
+                }
 
                 var value = descriptor.value;
                 if (value === null) {
                     this._appendPropertyPreview(preview, { name: name, type: "object", value: "null" }, propertiesThreshold);
                     continue;
                 }
-    
+
                 const maxLength = 100;
                 var type = typeof value;
 
                 if (InjectedScript.primitiveTypes[type]) {
-                    if (type === "string") {
-                        if (value.length > maxLength) {
-                            value = this._abbreviateString(value, maxLength, true);
-                            preview.lossless = false;
-                        }
-                        value = value.replace(/\n/g, "\u21B5");
+                    if (type === "string" && value.length > maxLength) {
+                        value = this._abbreviateString(value, maxLength, true);
+                        preview.lossless = false;
                     }
-                    this._appendPropertyPreview(preview, { name: name, type: type, value: value + "" }, propertiesThreshold);
+                    this._appendPropertyPreview(preview, { name: name, type: type, value: toString(value) }, propertiesThreshold);
                     continue;
                 }
 
@@ -1080,7 +1081,7 @@
 {
     this.callFrameId = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}";
     this.functionName = (callFrame.type === "function" ? callFrame.functionName : "");
-    this.location = { scriptId: String(callFrame.sourceID), lineNumber: callFrame.line, columnNumber: callFrame.column };
+    this.location = { scriptId: toString(callFrame.sourceID), lineNumber: callFrame.line, columnNumber: callFrame.column };
     this.scopeChain = this._wrapScopeChain(callFrame);
     this.this = injectedScript._wrapObject(callFrame.thisObject, "backtrace");
 }
@@ -1331,7 +1332,7 @@
     {
         if (injectedScript._subtype(object) === "node")
             object = object.outerHTML;
-        var string = object + "";
+        var string = toString(object);
         var hints = { copyToClipboard: true };
         var remoteObject = injectedScript._wrapObject(string, "")
         InjectedScriptHost.inspect(remoteObject, hints);
diff --git a/Source/core/inspector/InspectorAgent.cpp b/Source/core/inspector/InspectorAgent.cpp
index e988353..ff1aaca 100644
--- a/Source/core/inspector/InspectorAgent.cpp
+++ b/Source/core/inspector/InspectorAgent.cpp
@@ -41,9 +41,9 @@
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/text/StringBuilder.h"
 
@@ -86,7 +86,7 @@
     scriptSource.append("(");
     scriptSource.appendNumber(injectedScriptId);
     scriptSource.append(")");
-    frame->script()->executeScript(scriptSource.toString());
+    frame->script()->executeScriptInMainWorld(scriptSource.toString());
 }
 
 void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
diff --git a/Source/core/inspector/InspectorApplicationCacheAgent.cpp b/Source/core/inspector/InspectorApplicationCacheAgent.cpp
index c68e979..968b913 100644
--- a/Source/core/inspector/InspectorApplicationCacheAgent.cpp
+++ b/Source/core/inspector/InspectorApplicationCacheAgent.cpp
@@ -33,8 +33,8 @@
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/appcache/ApplicationCacheHost.h"
-#include "core/page/Frame.h"
-#include "core/platform/network/NetworkStateNotifier.h"
+#include "core/frame/Frame.h"
+#include "core/page/NetworkStateNotifier.h"
 #include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
@@ -75,7 +75,7 @@
     m_instrumentingAgents->setInspectorApplicationCacheAgent(this);
 
     // We need to pass initial navigator.onOnline.
-    networkStateChanged();
+    networkStateChanged(networkStateNotifier().onLine());
 }
 
 void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame)
@@ -92,10 +92,9 @@
     m_frontend->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manifestURL, static_cast<int>(status));
 }
 
-void InspectorApplicationCacheAgent::networkStateChanged()
+void InspectorApplicationCacheAgent::networkStateChanged(bool online)
 {
-    bool isNowOnline = networkStateNotifier().onLine();
-    m_frontend->networkStateUpdated(isNowOnline);
+    m_frontend->networkStateUpdated(online);
 }
 
 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest> >& result)
diff --git a/Source/core/inspector/InspectorApplicationCacheAgent.h b/Source/core/inspector/InspectorApplicationCacheAgent.h
index cba2125..8b9b9d5 100644
--- a/Source/core/inspector/InspectorApplicationCacheAgent.h
+++ b/Source/core/inspector/InspectorApplicationCacheAgent.h
@@ -56,7 +56,7 @@
 
     // InspectorInstrumentation API
     void updateApplicationCacheStatus(Frame*);
-    void networkStateChanged();
+    void networkStateChanged(bool online);
 
     // ApplicationCache API for InspectorFrontend
     virtual void enable(ErrorString*);
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp
index ee326aa..75a4b93 100644
--- a/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/Source/core/inspector/InspectorCSSAgent.cpp
@@ -62,17 +62,17 @@
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/platform/JSONValues.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/GlyphBuffer.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/platform/graphics/WidthIterator.h"
 #include "core/rendering/InlineTextBox.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderRegion.h"
 #include "core/rendering/RenderText.h"
 #include "core/rendering/RenderTextFragment.h"
+#include "platform/JSONValues.h"
+#include "platform/graphics/TextRun.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/HashSet.h"
 #include "wtf/Vector.h"
@@ -298,7 +298,7 @@
     for (size_t i = 0; i < styleSheets.size(); ++i) {
         InspectorStyleSheet* styleSheet = styleSheets.at(i);
         Document* document = styleSheet->ownerDocument();
-        FetchRequest request(ResourceRequest(styleSheet->finalURL()), FetchInitiatorTypeNames::inspector);
+        FetchRequest request(ResourceRequest(styleSheet->finalURL()), FetchInitiatorTypeNames::internal);
         ResourcePtr<Resource> resource = document->fetcher()->fetchCSSStyleSheet(request);
         resource->addClient(this);
     }
diff --git a/Source/core/inspector/InspectorCSSAgent.h b/Source/core/inspector/InspectorCSSAgent.h
index 207c787..ea13a40 100644
--- a/Source/core/inspector/InspectorCSSAgent.h
+++ b/Source/core/inspector/InspectorCSSAgent.h
@@ -30,8 +30,8 @@
 #include "core/inspector/InspectorBaseAgent.h"
 #include "core/inspector/InspectorDOMAgent.h"
 #include "core/inspector/InspectorStyleSheet.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/platform/JSONValues.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "platform/JSONValues.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
 #include "wtf/PassRefPtr.h"
diff --git a/Source/core/inspector/InspectorCanvasAgent.cpp b/Source/core/inspector/InspectorCanvasAgent.cpp
index 294770e..4d630d3 100644
--- a/Source/core/inspector/InspectorCanvasAgent.cpp
+++ b/Source/core/inspector/InspectorCanvasAgent.cpp
@@ -45,8 +45,8 @@
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
 
 using WebCore::TypeBuilder::Array;
 using WebCore::TypeBuilder::Canvas::ResourceId;
diff --git a/Source/core/inspector/InspectorClient.cpp b/Source/core/inspector/InspectorClient.cpp
index 1e4c29d..58a2cdb 100644
--- a/Source/core/inspector/InspectorClient.cpp
+++ b/Source/core/inspector/InspectorClient.cpp
@@ -33,7 +33,7 @@
 
 #include "bindings/v8/ScriptController.h"
 #include "bindings/v8/ScriptSourceCode.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 
 namespace WebCore {
@@ -50,11 +50,7 @@
     ScriptController* scriptController = frame->script();
     if (!scriptController)
         return false;
-
-    String dispatchToFrontend = "InspectorFrontendAPI.dispatchMessageAsync(" + message + ");";
-
-    // FIXME: This should execute the script in the appropriate world.
-    scriptController->executeScriptInMainWorld(ScriptSourceCode(dispatchToFrontend));
+    scriptController->executeScriptInMainWorld("InspectorFrontendAPI.dispatchMessageAsync(" + message + ");", ScriptController::ExecuteScriptWhenScriptsDisabled);
     return true;
 }
 
diff --git a/Source/core/inspector/InspectorClient.h b/Source/core/inspector/InspectorClient.h
index da449a3..6fd9c61 100644
--- a/Source/core/inspector/InspectorClient.h
+++ b/Source/core/inspector/InspectorClient.h
@@ -51,8 +51,7 @@
         unsigned char flags);
     virtual void setTraceEventCallback(TraceEventCallback) { }
 
-    virtual void overrideDeviceMetrics(int /*width*/, int /*height*/, float /*fontScaleFactor*/, bool /*fitWindow*/) { }
-    virtual void autoZoomPageToFitWidth() { }
+    virtual void overrideDeviceMetrics(int /*width*/, int /*height*/, float /*deviceScaleFactor*/, bool /*fitWindow*/) { }
 
     virtual bool overridesShowPaintRects() { return false; }
     virtual void setShowPaintRects(bool) { }
diff --git a/Source/core/inspector/InspectorConsoleAgent.cpp b/Source/core/inspector/InspectorConsoleAgent.cpp
index 8ad03e4..ed80cf2 100644
--- a/Source/core/inspector/InspectorConsoleAgent.cpp
+++ b/Source/core/inspector/InspectorConsoleAgent.cpp
@@ -41,10 +41,10 @@
 #include "core/inspector/ScriptCallFrame.h"
 #include "core/inspector/ScriptCallStack.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
-#include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceResponse.h"
+#include "platform/network/ResourceError.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
@@ -193,7 +193,7 @@
     return result;
 }
 
-void InspectorConsoleAgent::consoleTime(ScriptExecutionContext*, const String& title)
+void InspectorConsoleAgent::consoleTime(ExecutionContext*, const String& title)
 {
     // Follow Firebug's behavior of requiring a title that is not null or
     // undefined for timing functions
@@ -203,7 +203,7 @@
     m_times.add(title, monotonicallyIncreasingTime());
 }
 
-void InspectorConsoleAgent::consoleTimeEnd(ScriptExecutionContext*, const String& title, ScriptState* state)
+void InspectorConsoleAgent::consoleTimeEnd(ExecutionContext*, const String& title, ScriptState* state)
 {
     // Follow Firebug's behavior of requiring a title that is not null or
     // undefined for timing functions
@@ -222,19 +222,19 @@
     addMessageToConsole(ConsoleAPIMessageSource, LogMessageType, DebugMessageLevel, message, String(), 0, 0, state);
 }
 
-void InspectorConsoleAgent::consoleTimeline(ScriptExecutionContext* context, const String& title, ScriptState* state)
+void InspectorConsoleAgent::consoleTimeline(ExecutionContext* context, const String& title, ScriptState* state)
 {
     m_timelineAgent->consoleTimeline(context, title, state);
 }
 
-void InspectorConsoleAgent::consoleTimelineEnd(ScriptExecutionContext* context, const String& title, ScriptState* state)
+void InspectorConsoleAgent::consoleTimelineEnd(ExecutionContext* context, const String& title, ScriptState* state)
 {
     m_timelineAgent->consoleTimelineEnd(context, title, state);
 }
 
 void InspectorConsoleAgent::consoleCount(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
 {
-    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(state));
+    RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole());
     const ScriptCallFrame& lastCaller = callStack->at(0);
     // Follow Firebug's behavior of counting with null and undefined title in
     // the same bucket as no argument
diff --git a/Source/core/inspector/InspectorConsoleAgent.h b/Source/core/inspector/InspectorConsoleAgent.h
index a76b1b6..3242317 100644
--- a/Source/core/inspector/InspectorConsoleAgent.h
+++ b/Source/core/inspector/InspectorConsoleAgent.h
@@ -30,7 +30,7 @@
 #include "bindings/v8/ScriptString.h"
 #include "core/inspector/ConsoleAPITypes.h"
 #include "core/inspector/InspectorBaseAgent.h"
-#include "core/page/ConsoleTypes.h"
+#include "core/frame/ConsoleTypes.h"
 #include "wtf/Forward.h"
 #include "wtf/HashMap.h"
 #include "wtf/Noncopyable.h"
@@ -81,10 +81,10 @@
 
     Vector<unsigned> consoleMessageArgumentCounts();
 
-    void consoleTime(ScriptExecutionContext*, const String& title);
-    void consoleTimeEnd(ScriptExecutionContext*, const String& title, ScriptState*);
-    void consoleTimeline(ScriptExecutionContext*, const String& title, ScriptState*);
-    void consoleTimelineEnd(ScriptExecutionContext*, const String& title, ScriptState*);
+    void consoleTime(ExecutionContext*, const String& title);
+    void consoleTimeEnd(ExecutionContext*, const String& title, ScriptState*);
+    void consoleTimeline(ExecutionContext*, const String& title, ScriptState*);
+    void consoleTimelineEnd(ExecutionContext*, const String& title, ScriptState*);
 
     void consoleCount(ScriptState*, PassRefPtr<ScriptArguments>);
 
diff --git a/Source/core/inspector/InspectorController.cpp b/Source/core/inspector/InspectorController.cpp
index 963282e..b72828e 100644
--- a/Source/core/inspector/InspectorController.cpp
+++ b/Source/core/inspector/InspectorController.cpp
@@ -68,7 +68,7 @@
 #include "core/inspector/PageDebuggerAgent.h"
 #include "core/inspector/PageRuntimeAgent.h"
 #include "core/page/Page.h"
-#include "core/platform/PlatformMouseEvent.h"
+#include "platform/PlatformMouseEvent.h"
 
 namespace WebCore {
 
diff --git a/Source/core/inspector/InspectorCounters.cpp b/Source/core/inspector/InspectorCounters.cpp
index 5082e09..54f928a 100644
--- a/Source/core/inspector/InspectorCounters.cpp
+++ b/Source/core/inspector/InspectorCounters.cpp
@@ -42,21 +42,5 @@
     return s_counters[type];
 }
 
-ThreadLocalInspectorCounters::ThreadLocalInspectorCounters()
-{
-    for (size_t i = 0; i < CounterTypeLength; i++)
-        m_counters[i] = 0;
-}
-
-int ThreadLocalInspectorCounters::counterValue(CounterType type)
-{
-    return m_counters[type];
-}
-
-ThreadLocalInspectorCounters& ThreadLocalInspectorCounters::current()
-{
-    return threadGlobalData().inspectorCounters();
-}
-
 } // namespace WebCore
 
diff --git a/Source/core/inspector/InspectorCounters.h b/Source/core/inspector/InspectorCounters.h
index 893f941..93e8284 100644
--- a/Source/core/inspector/InspectorCounters.h
+++ b/Source/core/inspector/InspectorCounters.h
@@ -68,34 +68,6 @@
     static int s_counters[CounterTypeLength];
 };
 
-
-class ThreadLocalInspectorCounters {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    enum CounterType {
-        JSEventListenerCounter,
-        CounterTypeLength
-    };
-    ThreadLocalInspectorCounters();
-
-    inline void incrementCounter(CounterType type)
-    {
-        ++m_counters[type];
-    }
-
-    inline void decrementCounter(CounterType type)
-    {
-        --m_counters[type];
-    }
-
-    int counterValue(CounterType);
-
-    static ThreadLocalInspectorCounters& current();
-
-private:
-    int m_counters[CounterTypeLength];
-};
-
 } // namespace WebCore
 
 #endif // !defined(InspectorCounters_h)
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index c9783be..3973262 100644
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -68,16 +68,16 @@
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
 #include "core/page/Page.h"
-#include "core/platform/PlatformGestureEvent.h"
-#include "core/platform/PlatformMouseEvent.h"
-#include "core/platform/PlatformTouchEvent.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderView.h"
 #include "core/xml/DocumentXPathEvaluator.h"
 #include "core/xml/XPathResult.h"
+#include "platform/PlatformGestureEvent.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/PlatformTouchEvent.h"
 #include "wtf/HashSet.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/OwnPtr.h"
@@ -158,7 +158,7 @@
     HitTestRequest request(hitType);
     HitTestResult result(frame->view()->windowToContents(point));
     frame->contentRenderer()->hitTest(request, result);
-    Node* node = result.innerNode();
+    Node* node = result.innerPossiblyPseudoNode();
     while (node && node->nodeType() == Node::TEXT_NODE)
         node = node->parentNode();
     return node;
@@ -523,7 +523,7 @@
     Document* document = assertDocument(errorString, documentNodeId);
     if (!document)
         return 0;
-    if (&nodeToPush->document() != document) {
+    if (nodeToPush->document() != document) {
         *errorString = "Node is not part of the document with given id";
         return 0;
     }
@@ -1143,6 +1143,7 @@
 {
     if (m_searchingForNode == searchMode)
         return;
+
     m_searchingForNode = searchMode;
     m_overlay->setInspectModeEnabled(searchMode != NotSearching);
     if (searchMode != NotSearching) {
@@ -1178,6 +1179,8 @@
 
 void InspectorDOMAgent::setInspectModeEnabled(ErrorString* errorString, bool enabled, const bool* inspectShadowDOM, const RefPtr<JSONObject>* highlightConfig)
 {
+    if (enabled && !pushDocumentUponHandlelessOperation(errorString))
+        return;
     SearchMode searchMode = enabled ? (inspectShadowDOM && *inspectShadowDOM ? SearchingForShadow : SearchingForNormal) : NotSearching;
     setSearchingForNode(errorString, searchMode, highlightConfig ? highlightConfig->get() : 0);
 }
@@ -1375,13 +1378,8 @@
 
 void InspectorDOMAgent::getNodeForLocation(ErrorString* errorString, int x, int y, int* nodeId)
 {
-    // This call operates no handles, it could emerge before getDocument.
-    if (!m_documentNodeToIdMap.contains(m_document)) {
-        RefPtr<TypeBuilder::DOM::Node> root;
-        getDocument(errorString, root);
-        if (!errorString->isEmpty())
-            return;
-    }
+    if (!pushDocumentUponHandlelessOperation(errorString))
+        return;
 
     Node* node = hoveredNodeForPoint(m_document->frame(), IntPoint(x, y), false);
     if (!node) {
@@ -2012,5 +2010,15 @@
     return injectedScript.wrapNode(node, objectGroup);
 }
 
+bool InspectorDOMAgent::pushDocumentUponHandlelessOperation(ErrorString* errorString)
+{
+    if (!m_documentNodeToIdMap.contains(m_document)) {
+        RefPtr<TypeBuilder::DOM::Node> root;
+        getDocument(errorString, root);
+        return errorString->isEmpty();
+    }
+    return true;
+}
+
 } // namespace WebCore
 
diff --git a/Source/core/inspector/InspectorDOMAgent.h b/Source/core/inspector/InspectorDOMAgent.h
index 7ee0b45..42cf30c 100644
--- a/Source/core/inspector/InspectorDOMAgent.h
+++ b/Source/core/inspector/InspectorDOMAgent.h
@@ -34,8 +34,8 @@
 #include "core/inspector/InjectedScript.h"
 #include "core/inspector/InjectedScriptManager.h"
 #include "core/inspector/InspectorBaseAgent.h"
-#include "core/platform/JSONValues.h"
 #include "core/rendering/RenderLayer.h"
+#include "platform/JSONValues.h"
 
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
@@ -246,6 +246,8 @@
 
     void innerHighlightQuad(PassOwnPtr<FloatQuad>, const RefPtr<JSONObject>* color, const RefPtr<JSONObject>* outlineColor);
 
+    bool pushDocumentUponHandlelessOperation(ErrorString*);
+
     InspectorPageAgent* m_pageAgent;
     InjectedScriptManager* m_injectedScriptManager;
     InspectorOverlay* m_overlay;
diff --git a/Source/core/inspector/InspectorDOMDebuggerAgent.cpp b/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
index 055bdaf..d8c4870 100644
--- a/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
+++ b/Source/core/inspector/InspectorDOMDebuggerAgent.cpp
@@ -37,7 +37,7 @@
 #include "core/inspector/InspectorDebuggerAgent.h"
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/text/WTFString.h"
 
 namespace {
@@ -407,17 +407,17 @@
     return eventData.release();
 }
 
-void InspectorDOMDebuggerAgent::didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot)
+void InspectorDOMDebuggerAgent::didInstallTimer(ExecutionContext* context, int timerId, int timeout, bool singleShot)
 {
     pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(false, setTimerEventName), true);
 }
 
-void InspectorDOMDebuggerAgent::didRemoveTimer(ScriptExecutionContext* context, int timerId)
+void InspectorDOMDebuggerAgent::didRemoveTimer(ExecutionContext* context, int timerId)
 {
     pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(false, clearTimerEventName), true);
 }
 
-void InspectorDOMDebuggerAgent::willFireTimer(ScriptExecutionContext* context, int timerId)
+void InspectorDOMDebuggerAgent::willFireTimer(ExecutionContext* context, int timerId)
 {
     pauseOnNativeEventIfNeeded(preparePauseOnNativeEventData(false, timerFiredEventName), false);
 }
diff --git a/Source/core/inspector/InspectorDOMDebuggerAgent.h b/Source/core/inspector/InspectorDOMDebuggerAgent.h
index b1b9171..2b0b87b 100644
--- a/Source/core/inspector/InspectorDOMDebuggerAgent.h
+++ b/Source/core/inspector/InspectorDOMDebuggerAgent.h
@@ -77,9 +77,9 @@
     void didRemoveDOMNode(Node*);
     void willModifyDOMAttr(Element*, const AtomicString&, const AtomicString&);
     void willSendXMLHttpRequest(const String& url);
-    void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot);
-    void didRemoveTimer(ScriptExecutionContext*, int timerId);
-    void willFireTimer(ScriptExecutionContext*, int timerId);
+    void didInstallTimer(ExecutionContext*, int timerId, int timeout, bool singleShot);
+    void didRemoveTimer(ExecutionContext*, int timerId);
+    void willFireTimer(ExecutionContext*, int timerId);
     void didRequestAnimationFrame(Document*, int callbackId);
     void didCancelAnimationFrame(Document*, int callbackId);
     void willFireAnimationFrame(Document*, int callbackId);
diff --git a/Source/core/inspector/InspectorDOMStorageAgent.cpp b/Source/core/inspector/InspectorDOMStorageAgent.cpp
index 4420d1b..63c9186 100644
--- a/Source/core/inspector/InspectorDOMStorageAgent.cpp
+++ b/Source/core/inspector/InspectorDOMStorageAgent.cpp
@@ -38,14 +38,14 @@
 #include "core/inspector/InspectorPageAgent.h"
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/PageGroup.h"
-#include "core/platform/JSONValues.h"
 #include "core/storage/Storage.h"
 #include "core/storage/StorageArea.h"
 #include "core/storage/StorageNamespace.h"
+#include "platform/JSONValues.h"
 #include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
diff --git a/Source/core/inspector/InspectorDatabaseAgent.cpp b/Source/core/inspector/InspectorDatabaseAgent.cpp
index 22ead3e..1f61dbe 100644
--- a/Source/core/inspector/InspectorDatabaseAgent.cpp
+++ b/Source/core/inspector/InspectorDatabaseAgent.cpp
@@ -36,10 +36,8 @@
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
-#include "core/platform/JSONValues.h"
-#include "core/platform/sql/SQLValue.h"
 #include "modules/webdatabase/Database.h"
 #include "modules/webdatabase/SQLError.h"
 #include "modules/webdatabase/SQLResultSet.h"
@@ -49,6 +47,8 @@
 #include "modules/webdatabase/SQLTransaction.h"
 #include "modules/webdatabase/SQLTransactionCallback.h"
 #include "modules/webdatabase/SQLTransactionErrorCallback.h"
+#include "modules/webdatabase/sqlite/SQLValue.h"
+#include "platform/JSONValues.h"
 #include "wtf/Vector.h"
 
 typedef WebCore::InspectorBackendDispatcher::DatabaseCommandHandler::ExecuteSQLCallback ExecuteSQLCallback;
diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp
index 78c91aa..693985c 100644
--- a/Source/core/inspector/InspectorDebuggerAgent.cpp
+++ b/Source/core/inspector/InspectorDebuggerAgent.cpp
@@ -44,8 +44,8 @@
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/inspector/ScriptArguments.h"
 #include "core/inspector/ScriptCallStack.h"
-#include "core/platform/JSONValues.h"
 #include "core/platform/text/RegularExpression.h"
+#include "platform/JSONValues.h"
 #include "wtf/text/WTFString.h"
 
 using WebCore::TypeBuilder::Array;
@@ -675,25 +675,29 @@
     scriptDebugServer().continueProgram();
 }
 
+ScriptValue InspectorDebuggerAgent::resolveCallFrame(ErrorString* errorString, const String* callFrameId)
+{
+    if (!callFrameId)
+        return ScriptValue();
+    if (!isPaused() || m_currentCallStack.isNull()) {
+        *errorString = "Attempt to access callframe when debugger is not on pause";
+        return ScriptValue();
+    }
+    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(*callFrameId);
+    if (injectedScript.hasNoValue()) {
+        *errorString = "Inspected frame has gone";
+        return ScriptValue();
+    }
+    return injectedScript.findCallFrameById(errorString, m_currentCallStack, *callFrameId);
+}
+
 void InspectorDebuggerAgent::stepOver(ErrorString* errorString, const String* callFrameId)
 {
     if (!assertPaused(errorString))
         return;
-    ScriptValue frame;
-    if (callFrameId) {
-        if (m_currentCallStack.isNull()) {
-            *errorString = "Attempt to access callframe when debugger is not on pause";
-            return;
-        }
-        InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(*callFrameId);
-        if (injectedScript.hasNoValue()) {
-            *errorString = "Inspected frame has gone";
-            return;
-        }
-        frame = injectedScript.findCallframeById(errorString, m_currentCallStack, *callFrameId);
-        if (!errorString->isEmpty())
-            return;
-    }
+    ScriptValue frame = resolveCallFrame(errorString, callFrameId);
+    if (!errorString->isEmpty())
+        return;
     m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup);
     scriptDebugServer().stepOverStatement(frame);
 }
@@ -708,12 +712,15 @@
         m_listener->stepInto();
 }
 
-void InspectorDebuggerAgent::stepOut(ErrorString* errorString)
+void InspectorDebuggerAgent::stepOut(ErrorString* errorString, const String* callFrameId)
 {
     if (!assertPaused(errorString))
         return;
+    ScriptValue frame = resolveCallFrame(errorString, callFrameId);
+    if (!errorString->isEmpty())
+        return;
     m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup);
-    scriptDebugServer().stepOutOfFunction();
+    scriptDebugServer().stepOutOfFunction(frame);
 }
 
 void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, const String& stringPauseState)
diff --git a/Source/core/inspector/InspectorDebuggerAgent.h b/Source/core/inspector/InspectorDebuggerAgent.h
index d1018f2..7e56ce6 100644
--- a/Source/core/inspector/InspectorDebuggerAgent.h
+++ b/Source/core/inspector/InspectorDebuggerAgent.h
@@ -37,7 +37,7 @@
 #include "core/inspector/InspectorBaseAgent.h"
 #include "core/inspector/ScriptBreakpoint.h"
 #include "core/inspector/ScriptDebugListener.h"
-#include "core/page/ConsoleTypes.h"
+#include "core/frame/ConsoleTypes.h"
 #include "wtf/Forward.h"
 #include "wtf/HashMap.h"
 #include "wtf/PassRefPtr.h"
@@ -108,7 +108,7 @@
     virtual void resume(ErrorString*);
     virtual void stepOver(ErrorString*, const String* callFrameId);
     virtual void stepInto(ErrorString*);
-    virtual void stepOut(ErrorString*);
+    virtual void stepOut(ErrorString*, const String* callFrameId);
     virtual void setPauseOnExceptions(ErrorString*, const String& pauseState);
     virtual void evaluateOnCallFrame(ErrorString*,
                              const String& callFrameId,
@@ -192,6 +192,8 @@
 
     String scriptURL(JavaScriptCallFrame*);
 
+    ScriptValue resolveCallFrame(ErrorString*, const String* callFrameId);
+
     typedef HashMap<String, Script> ScriptsMap;
     typedef HashMap<String, Vector<String> > BreakpointIdToDebugServerBreakpointIdsMap;
     typedef HashMap<String, std::pair<String, BreakpointSource> > DebugServerBreakpointToBreakpointIdAndSourceMap;
diff --git a/Source/core/inspector/InspectorFileSystemAgent.cpp b/Source/core/inspector/InspectorFileSystemAgent.cpp
index 73ae624..bd76696 100644
--- a/Source/core/inspector/InspectorFileSystemAgent.cpp
+++ b/Source/core/inspector/InspectorFileSystemAgent.cpp
@@ -42,7 +42,7 @@
 #include "core/html/VoidCallback.h"
 #include "core/inspector/InspectorPageAgent.h"
 #include "core/inspector/InspectorState.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/platform/MIMETypeRegistry.h"
 #include "modules/filesystem/DOMFileSystem.h"
 #include "modules/filesystem/DirectoryEntry.h"
@@ -121,7 +121,7 @@
         return adoptRef(new FileSystemRootRequest(requestCallback, type));
     }
 
-    void start(ScriptExecutionContext*);
+    void start(ExecutionContext*);
 
 private:
     bool didHitError(FileError* error)
@@ -145,25 +145,27 @@
     String m_type;
 };
 
-void FileSystemRootRequest::start(ScriptExecutionContext* scriptExecutionContext)
+void FileSystemRootRequest::start(ExecutionContext* executionContext)
 {
-    ASSERT(scriptExecutionContext);
+    ASSERT(executionContext);
 
     RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &FileSystemRootRequest::didHitError);
+
     FileSystemType type;
-    if (m_type == DOMFileSystemBase::persistentPathPrefix)
-        type = FileSystemTypePersistent;
-    else if (m_type == DOMFileSystemBase::temporaryPathPrefix)
-        type = FileSystemTypeTemporary;
-    else {
+    if (!DOMFileSystemBase::pathPrefixToFileSystemType(m_type, type)) {
+        errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get());
+        return;
+    }
+
+    KURL rootURL = DOMFileSystemBase::createFileSystemRootURL(executionContext->securityOrigin()->toString(), type);
+    if (!rootURL.isValid()) {
         errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get());
         return;
     }
 
     RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &FileSystemRootRequest::didGetEntry);
-    OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, type, "/");
-
-    LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
+    OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, executionContext);
+    LocalFileSystem::from(executionContext)->resolveURL(executionContext, rootURL, fileSystemCallbacks.release());
 }
 
 bool FileSystemRootRequest::didGetEntry(Entry* entry)
@@ -189,7 +191,7 @@
         reportResult(FileError::ABORT_ERR);
     }
 
-    void start(ScriptExecutionContext*);
+    void start(ExecutionContext*);
 
 private:
     bool didHitError(FileError* error)
@@ -218,22 +220,16 @@
     RefPtr<DirectoryReader> m_directoryReader;
 };
 
-void DirectoryContentRequest::start(ScriptExecutionContext* scriptExecutionContext)
+void DirectoryContentRequest::start(ExecutionContext* executionContext)
 {
-    ASSERT(scriptExecutionContext);
+    ASSERT(executionContext);
 
     RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &DirectoryContentRequest::didHitError);
-    FileSystemType type;
-    String path;
-    if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) {
-        errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get());
-        return;
-    }
-
     RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &DirectoryContentRequest::didGetEntry);
-    OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, type, path);
 
-    LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
+    OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, executionContext);
+
+    LocalFileSystem::from(executionContext)->resolveURL(executionContext, m_url, fileSystemCallbacks.release());
 }
 
 bool DirectoryContentRequest::didGetEntry(Entry* entry)
@@ -251,7 +247,7 @@
 
 void DirectoryContentRequest::readDirectoryEntries()
 {
-    if (!m_directoryReader->filesystem()->scriptExecutionContext()) {
+    if (!m_directoryReader->filesystem()->executionContext()) {
         reportResult(FileError::ABORT_ERR);
         return;
     }
@@ -316,7 +312,7 @@
         reportResult(FileError::ABORT_ERR);
     }
 
-    void start(ScriptExecutionContext*);
+    void start(ExecutionContext*);
 
 private:
     bool didHitError(FileError* error)
@@ -339,30 +335,22 @@
 
     RefPtr<RequestMetadataCallback> m_requestCallback;
     KURL m_url;
-    String m_path;
     bool m_isDirectory;
 };
 
-void MetadataRequest::start(ScriptExecutionContext* scriptExecutionContext)
+void MetadataRequest::start(ExecutionContext* executionContext)
 {
-    ASSERT(scriptExecutionContext);
+    ASSERT(executionContext);
 
     RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &MetadataRequest::didHitError);
-
-    FileSystemType type;
-    if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, m_path)) {
-        errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get());
-        return;
-    }
-
     RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &MetadataRequest::didGetEntry);
-    OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, type, m_path);
-    LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
+    OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, executionContext);
+    LocalFileSystem::from(executionContext)->resolveURL(executionContext, m_url, fileSystemCallbacks.release());
 }
 
 bool MetadataRequest::didGetEntry(Entry* entry)
 {
-    if (!entry->filesystem()->scriptExecutionContext()) {
+    if (!entry->filesystem()->executionContext()) {
         reportResult(FileError::ABORT_ERR);
         return true;
     }
@@ -397,18 +385,18 @@
         reportResult(FileError::ABORT_ERR);
     }
 
-    void start(ScriptExecutionContext*);
+    void start(ExecutionContext*);
 
     virtual bool operator==(const EventListener& other) OVERRIDE
     {
         return this == &other;
     }
 
-    virtual void handleEvent(ScriptExecutionContext*, Event* event) OVERRIDE
+    virtual void handleEvent(ExecutionContext*, Event* event) OVERRIDE
     {
-        if (event->type() == eventNames().loadEvent)
+        if (event->type() == EventTypeNames::load)
             didRead();
-        else if (event->type() == eventNames().errorEvent)
+        else if (event->type() == EventTypeNames::error)
             didHitError(m_reader->error().get());
     }
 
@@ -448,23 +436,15 @@
     RefPtr<FileReader> m_reader;
 };
 
-void FileContentRequest::start(ScriptExecutionContext* scriptExecutionContext)
+void FileContentRequest::start(ExecutionContext* executionContext)
 {
-    ASSERT(scriptExecutionContext);
+    ASSERT(executionContext);
 
     RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &FileContentRequest::didHitError);
-
-    FileSystemType type;
-    String path;
-    if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) {
-        errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get());
-        return;
-    }
-
     RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &FileContentRequest::didGetEntry);
-    OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, type, path);
 
-    LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
+    OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, executionContext);
+    LocalFileSystem::from(executionContext)->resolveURL(executionContext, m_url, fileSystemCallbacks.release());
 }
 
 bool FileContentRequest::didGetEntry(Entry* entry)
@@ -474,7 +454,7 @@
         return true;
     }
 
-    if (!entry->filesystem()->scriptExecutionContext()) {
+    if (!entry->filesystem()->executionContext()) {
         reportResult(FileError::ABORT_ERR);
         return true;
     }
@@ -483,7 +463,7 @@
     RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &FileContentRequest::didHitError);
     static_cast<FileEntry*>(entry)->file(successCallback, errorCallback);
 
-    m_reader = FileReader::create(entry->filesystem()->scriptExecutionContext());
+    m_reader = FileReader::create(entry->filesystem()->executionContext());
     m_mimeType = MIMETypeRegistry::getMIMETypeForPath(entry->name());
 
     return true;
@@ -512,7 +492,7 @@
     RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType, m_charset, true);
     String result = decoder->decode(static_cast<char*>(buffer->data()), buffer->byteLength());
     result.append(decoder->flush());
-    m_charset = decoder->encoding().domName();
+    m_charset = decoder->encoding().name();
     reportResult(static_cast<FileError::ErrorCode>(0), &result, &m_charset);
 }
 
@@ -533,7 +513,7 @@
         return didDeleteEntry();
     }
 
-    void start(ScriptExecutionContext*);
+    void start(ExecutionContext*);
 
 private:
     bool didHitError(FileError* error)
@@ -558,9 +538,9 @@
     KURL m_url;
 };
 
-void DeleteEntryRequest::start(ScriptExecutionContext* scriptExecutionContext)
+void DeleteEntryRequest::start(ExecutionContext* executionContext)
 {
-    ASSERT(scriptExecutionContext);
+    ASSERT(executionContext);
 
     RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallback>::create(this, &DeleteEntryRequest::didHitError);
 
@@ -573,11 +553,11 @@
 
     if (path == "/") {
         OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = VoidCallbacks::create(this, errorCallback, 0);
-        LocalFileSystem::from(scriptExecutionContext)->deleteFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
+        LocalFileSystem::from(executionContext)->deleteFileSystem(executionContext, type, fileSystemCallbacks.release());
     } else {
         RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallback>::create(this, &DeleteEntryRequest::didGetEntry);
-        OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, scriptExecutionContext, type, path);
-        LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutionContext, type, fileSystemCallbacks.release());
+        OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::create(successCallback, errorCallback, executionContext);
+        LocalFileSystem::from(executionContext)->resolveURL(executionContext, m_url, fileSystemCallbacks.release());
     }
 }
 
@@ -631,11 +611,11 @@
     if (!assertEnabled(error))
         return;
 
-    ScriptExecutionContext* scriptExecutionContext = assertScriptExecutionContextForOrigin(error, SecurityOrigin::createFromString(origin).get());
-    if (!scriptExecutionContext)
+    ExecutionContext* executionContext = assertExecutionContextForOrigin(error, SecurityOrigin::createFromString(origin).get());
+    if (!executionContext)
         return;
 
-    FileSystemRootRequest::create(requestCallback, type)->start(scriptExecutionContext);
+    FileSystemRootRequest::create(requestCallback, type)->start(executionContext);
 }
 
 void InspectorFileSystemAgent::requestDirectoryContent(ErrorString* error, const String& url, PassRefPtr<RequestDirectoryContentCallback> requestCallback)
@@ -643,11 +623,11 @@
     if (!assertEnabled(error))
         return;
 
-    ScriptExecutionContext* scriptExecutionContext = assertScriptExecutionContextForOrigin(error, SecurityOrigin::createFromString(url).get());
-    if (!scriptExecutionContext)
+    ExecutionContext* executionContext = assertExecutionContextForOrigin(error, SecurityOrigin::createFromString(url).get());
+    if (!executionContext)
         return;
 
-    DirectoryContentRequest::create(requestCallback, url)->start(scriptExecutionContext);
+    DirectoryContentRequest::create(requestCallback, url)->start(executionContext);
 }
 
 void InspectorFileSystemAgent::requestMetadata(ErrorString* error, const String& url, PassRefPtr<RequestMetadataCallback> requestCallback)
@@ -655,11 +635,11 @@
     if (!assertEnabled(error))
         return;
 
-    ScriptExecutionContext* scriptExecutionContext = assertScriptExecutionContextForOrigin(error, SecurityOrigin::createFromString(url).get());
-    if (!scriptExecutionContext)
+    ExecutionContext* executionContext = assertExecutionContextForOrigin(error, SecurityOrigin::createFromString(url).get());
+    if (!executionContext)
         return;
 
-    MetadataRequest::create(requestCallback, url)->start(scriptExecutionContext);
+    MetadataRequest::create(requestCallback, url)->start(executionContext);
 }
 
 void InspectorFileSystemAgent::requestFileContent(ErrorString* error, const String& url, bool readAsText, const int* start, const int* end, const String* charset, PassRefPtr<RequestFileContentCallback> requestCallback)
@@ -667,13 +647,13 @@
     if (!assertEnabled(error))
         return;
 
-    ScriptExecutionContext* scriptExecutionContext = assertScriptExecutionContextForOrigin(error, SecurityOrigin::createFromString(url).get());
-    if (!scriptExecutionContext)
+    ExecutionContext* executionContext = assertExecutionContextForOrigin(error, SecurityOrigin::createFromString(url).get());
+    if (!executionContext)
         return;
 
     long long startPosition = start ? *start : 0;
     long long endPosition = end ? *end : std::numeric_limits<long long>::max();
-    FileContentRequest::create(requestCallback, url, readAsText, startPosition, endPosition, charset ? *charset : "")->start(scriptExecutionContext);
+    FileContentRequest::create(requestCallback, url, readAsText, startPosition, endPosition, charset ? *charset : "")->start(executionContext);
 }
 
 void InspectorFileSystemAgent::deleteEntry(ErrorString* error, const String& urlString, PassRefPtr<DeleteEntryCallback> requestCallback)
@@ -683,11 +663,11 @@
 
     KURL url(ParsedURLString, urlString);
 
-    ScriptExecutionContext* scriptExecutionContext = assertScriptExecutionContextForOrigin(error, SecurityOrigin::create(url).get());
-    if (!scriptExecutionContext)
+    ExecutionContext* executionContext = assertExecutionContextForOrigin(error, SecurityOrigin::create(url).get());
+    if (!executionContext)
         return;
 
-    DeleteEntryRequest::create(requestCallback, url)->start(scriptExecutionContext);
+    DeleteEntryRequest::create(requestCallback, url)->start(executionContext);
 }
 
 void InspectorFileSystemAgent::clearFrontend()
@@ -720,7 +700,7 @@
     return true;
 }
 
-ScriptExecutionContext* InspectorFileSystemAgent::assertScriptExecutionContextForOrigin(ErrorString* error, SecurityOrigin* origin)
+ExecutionContext* InspectorFileSystemAgent::assertExecutionContextForOrigin(ErrorString* error, SecurityOrigin* origin)
 {
     for (Frame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
         if (frame->document() && frame->document()->securityOrigin()->isSameSchemeHostPort(origin))
diff --git a/Source/core/inspector/InspectorFileSystemAgent.h b/Source/core/inspector/InspectorFileSystemAgent.h
index e6bd23c..24e68ab 100644
--- a/Source/core/inspector/InspectorFileSystemAgent.h
+++ b/Source/core/inspector/InspectorFileSystemAgent.h
@@ -38,7 +38,7 @@
 namespace WebCore {
 
 class InspectorPageAgent;
-class ScriptExecutionContext;
+class ExecutionContext;
 class SecurityOrigin;
 
 class InspectorFileSystemAgent : public InspectorBaseAgent<InspectorFileSystemAgent>, public InspectorBackendDispatcher::FileSystemCommandHandler {
@@ -61,7 +61,7 @@
 private:
     InspectorFileSystemAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorCompositeState*);
     bool assertEnabled(ErrorString*);
-    ScriptExecutionContext* assertScriptExecutionContextForOrigin(ErrorString*, SecurityOrigin*);
+    ExecutionContext* assertExecutionContextForOrigin(ErrorString*, SecurityOrigin*);
 
     InspectorPageAgent* m_pageAgent;
     bool m_enabled;
diff --git a/Source/core/inspector/InspectorFrontendHost.cpp b/Source/core/inspector/InspectorFrontendHost.cpp
index a8e0d6b..d0bf154 100644
--- a/Source/core/inspector/InspectorFrontendHost.cpp
+++ b/Source/core/inspector/InspectorFrontendHost.cpp
@@ -31,7 +31,6 @@
 #include "core/inspector/InspectorFrontendHost.h"
 
 #include "bindings/v8/ScriptFunctionCall.h"
-#include "core/dom/UserGestureIndicator.h"
 #include "core/fetch/ResourceFetcher.h"
 #include "core/fetch/TextResourceDecoder.h"
 #include "core/inspector/InspectorController.h"
@@ -39,18 +38,19 @@
 #include "core/loader/FrameLoader.h"
 #include "core/page/ContextMenuController.h"
 #include "core/page/ContextMenuProvider.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/platform/ContextMenu.h"
 #include "core/platform/ContextMenuItem.h"
-#include "core/platform/JSONValues.h"
 #include "core/platform/Pasteboard.h"
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
 #include "core/rendering/RenderTheme.h"
 #include "modules/filesystem/DOMFileSystem.h"
+#include "platform/JSONValues.h"
+#include "platform/SharedBuffer.h"
+#include "platform/UserGestureIndicator.h"
+#include "platform/network/ResourceError.h"
 
 namespace WebCore {
 
@@ -135,14 +135,11 @@
     m_frontendPage = 0;
 }
 
-void InspectorFrontendHost::loaded()
-{
-}
-
 void InspectorFrontendHost::closeWindow()
 {
     if (m_client) {
         RefPtr<JSONObject> message = JSONObject::create();
+        message->setNumber("id", 0);
         message->setString("method", "closeWindow");
         sendMessageToEmbedder(message->toJSONString());
         disconnectClient(); // Disconnect from client.
@@ -160,34 +157,16 @@
         m_client->inspectedURLChanged(newURL);
 }
 
-void InspectorFrontendHost::setAttachedWindowHeight(unsigned height)
-{
-}
-
 void InspectorFrontendHost::setInjectedScriptForOrigin(const String& origin, const String& script)
 {
     m_frontendPage->inspectorController().setInjectedScriptForOrigin(origin, script);
 }
 
-String InspectorFrontendHost::localizedStringsURL()
-{
-    return "";
-}
-
 void InspectorFrontendHost::copyText(const String& text)
 {
     Pasteboard::generalPasteboard()->writePlainText(text, Pasteboard::CannotSmartReplace);
 }
 
-bool InspectorFrontendHost::canSave()
-{
-    return true;
-}
-
-void InspectorFrontendHost::close(const String&)
-{
-}
-
 void InspectorFrontendHost::sendMessageToBackend(const String& message)
 {
     if (m_client)
@@ -217,23 +196,6 @@
     m_menuProvider = menuProvider.get();
 }
 
-String InspectorFrontendHost::loadResourceSynchronously(const String& url)
-{
-    FetchRequest request(url, FetchInitiatorInfo());
-    ResourcePtr<Resource> resource = m_frontendPage->mainFrame()->document()->fetcher()->fetchSynchronously(request);
-    if (!resource)
-        return emptyString();
-    WTF::TextEncoding textEncoding(resource->response().textEncodingName());
-    bool useDetector = false;
-    if (!textEncoding.isValid()) {
-        textEncoding = UTF8Encoding();
-        useDetector = true;
-    }
-    RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/plain", textEncoding, useDetector);
-    SharedBuffer* data = resource->resourceBuffer();
-    return decoder->decode(data->data(), data->size()) + decoder->flush();
-}
-
 String InspectorFrontendHost::getSelectionBackgroundColor()
 {
     Color color = RenderTheme::theme().activeSelectionBackgroundColor();
@@ -246,14 +208,9 @@
     return color.isValid() ? color.serialized() : "";
 }
 
-bool InspectorFrontendHost::supportsFileSystems()
-{
-    return true;
-}
-
 PassRefPtr<DOMFileSystem> InspectorFrontendHost::isolatedFileSystem(const String& fileSystemName, const String& rootURL)
 {
-    ScriptExecutionContext* context = m_frontendPage->mainFrame()->document();
+    ExecutionContext* context = m_frontendPage->mainFrame()->document();
     return DOMFileSystem::create(context, fileSystemName, FileSystemTypeIsolated, KURL(ParsedURLString, rootURL));
 }
 
@@ -262,19 +219,4 @@
     return m_client && m_client->isUnderTest();
 }
 
-bool InspectorFrontendHost::canSaveAs()
-{
-    return false;
-}
-
-bool InspectorFrontendHost::canInspectWorkers()
-{
-    return false;
-}
-
-String InspectorFrontendHost::hiddenPanels()
-{
-    return "";
-}
-
 } // namespace WebCore
diff --git a/Source/core/inspector/InspectorFrontendHost.h b/Source/core/inspector/InspectorFrontendHost.h
index 4c955c3..47e8f48 100644
--- a/Source/core/inspector/InspectorFrontendHost.h
+++ b/Source/core/inspector/InspectorFrontendHost.h
@@ -58,18 +58,15 @@
     void setZoomFactor(float);
     void inspectedURLChanged(const String&);
 
-    void setAttachedWindowHeight(unsigned);
     void setInjectedScriptForOrigin(const String& origin, const String& script);
 
     void copyText(const String& text);
-    void close(const String& url);
 
     // Called from [Custom] implementations.
     void showContextMenu(Event*, const Vector<ContextMenuItem>& items);
     void sendMessageToBackend(const String& message);
     void sendMessageToEmbedder(const String& message);
 
-    String loadResourceSynchronously(const String& url);
     String getSelectionBackgroundColor();
     String getSelectionForegroundColor();
 
@@ -77,15 +74,6 @@
 
     bool isUnderTest();
 
-    // Deprecated but should stay around for a while as old front-ends may use them.
-    bool canInspectWorkers();
-    bool canSaveAs();
-    bool canSave();
-    bool supportsFileSystems();
-    void loaded();
-    String hiddenPanels();
-    String localizedStringsURL();
-
 private:
     friend class FrontendMenuProvider;
     InspectorFrontendHost(InspectorFrontendClient* client, Page* frontendPage);
diff --git a/Source/core/inspector/InspectorFrontendHost.idl b/Source/core/inspector/InspectorFrontendHost.idl
index 678a36c..d753646 100644
--- a/Source/core/inspector/InspectorFrontendHost.idl
+++ b/Source/core/inspector/InspectorFrontendHost.idl
@@ -37,11 +37,9 @@
     void setZoomFactor(float zoom);
     void inspectedURLChanged(DOMString newURL);
 
-    void setAttachedWindowHeight(unsigned long height);
     void setInjectedScriptForOrigin(DOMString origin, DOMString script);
 
     void copyText(DOMString text);
-    void close(DOMString url);
 
     [Custom] DOMString platform();
     [Custom] DOMString port();
@@ -53,20 +51,10 @@
     [Custom] void recordPanelShown(unsigned long panelCode);
     [Custom] void recordSettingChanged(unsigned long settingChanged);
 
-    DOMString loadResourceSynchronously(DOMString url);
     DOMString getSelectionBackgroundColor();
     DOMString getSelectionForegroundColor();
 
     DOMFileSystem isolatedFileSystem(DOMString fileSystemId, DOMString registeredName);
 
     boolean isUnderTest();
-
-    // Deprecated
-    boolean canInspectWorkers();
-    boolean canSaveAs();
-    boolean canSave();
-    boolean supportsFileSystems();
-    void loaded();
-    DOMString hiddenPanels();
-    DOMString localizedStringsURL();
 };
diff --git a/Source/core/inspector/InspectorHeapProfilerAgent.cpp b/Source/core/inspector/InspectorHeapProfilerAgent.cpp
index b8c9e1b..6356654 100644
--- a/Source/core/inspector/InspectorHeapProfilerAgent.cpp
+++ b/Source/core/inspector/InspectorHeapProfilerAgent.cpp
@@ -35,13 +35,13 @@
 #include "core/inspector/InjectedScript.h"
 #include "core/inspector/InjectedScriptHost.h"
 #include "core/inspector/InspectorState.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/CurrentTime.h"
 
 namespace WebCore {
 
 namespace HeapProfilerAgentState {
-static const char profileHeadersRequested[] = "profileHeadersRequested";
+static const char heapProfilerEnabled[] = "heapProfilerEnabled";
 }
 
 class InspectorHeapProfilerAgent::HeapStatsUpdateTask {
@@ -86,7 +86,7 @@
     stopTrackingHeapObjects(0);
     if (!m_frontend)
         return;
-    if (!m_state->getBoolean(HeapProfilerAgentState::profileHeadersRequested))
+    if (!m_state->getBoolean(HeapProfilerAgentState::heapProfilerEnabled))
         return;
     if (m_snapshots.isEmpty())
         m_frontend->resetProfiles();
@@ -99,9 +99,10 @@
 
 void InspectorHeapProfilerAgent::clearFrontend()
 {
-    stopTrackingHeapObjects(0);
-    m_state->setBoolean(HeapProfilerAgentState::profileHeadersRequested, false);
     m_frontend = 0;
+    ErrorString error;
+    clearProfiles(&error);
+    disable(&error);
 }
 
 void InspectorHeapProfilerAgent::restore()
@@ -196,14 +197,17 @@
     m_heapStatsUpdateTask.clear();
 }
 
-void InspectorHeapProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::HeapProfiler::ProfileHeader> >& headers)
+void InspectorHeapProfilerAgent::enable(ErrorString*)
 {
-    m_state->setBoolean(HeapProfilerAgentState::profileHeadersRequested, true);
-    headers = TypeBuilder::Array<TypeBuilder::HeapProfiler::ProfileHeader>::create();
+    m_state->setBoolean(HeapProfilerAgentState::heapProfilerEnabled, true);
+}
 
-    IdToHeapSnapshotMap::iterator snapshotsEnd = m_snapshots.end();
-    for (IdToHeapSnapshotMap::iterator it = m_snapshots.begin(); it != snapshotsEnd; ++it)
-        headers->addItem(createSnapshotHeader(*it->value));
+void InspectorHeapProfilerAgent::disable(ErrorString* error)
+{
+    stopTrackingHeapObjects(error);
+    if (!error->isEmpty())
+        return;
+    m_state->setBoolean(HeapProfilerAgentState::heapProfilerEnabled, false);
 }
 
 void InspectorHeapProfilerAgent::getHeapSnapshot(ErrorString* errorString, int rawUid)
@@ -213,7 +217,7 @@
         OutputStream(InspectorFrontend::HeapProfiler* frontend, unsigned uid)
             : m_frontend(frontend), m_uid(uid) { }
         void Write(const String& chunk) { m_frontend->addHeapSnapshotChunk(m_uid, chunk); }
-        void Close() { m_frontend->finishHeapSnapshot(m_uid); }
+        void Close() { }
     private:
         InspectorFrontend::HeapProfiler* m_frontend;
         int m_uid;
diff --git a/Source/core/inspector/InspectorHeapProfilerAgent.h b/Source/core/inspector/InspectorHeapProfilerAgent.h
index f4c19ed..eca5f02 100644
--- a/Source/core/inspector/InspectorHeapProfilerAgent.h
+++ b/Source/core/inspector/InspectorHeapProfilerAgent.h
@@ -57,7 +57,8 @@
     virtual void collectGarbage(ErrorString*);
     virtual void clearProfiles(ErrorString*);
 
-    virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::HeapProfiler::ProfileHeader> >&);
+    virtual void enable(ErrorString*);
+    virtual void disable(ErrorString*);
     virtual void getHeapSnapshot(ErrorString*, int uid);
     virtual void removeProfile(ErrorString*, int uid);
     virtual void startTrackingHeapObjects(ErrorString*);
diff --git a/Source/core/inspector/InspectorIndexedDBAgent.cpp b/Source/core/inspector/InspectorIndexedDBAgent.cpp
index 27195b4..7689a75 100644
--- a/Source/core/inspector/InspectorIndexedDBAgent.cpp
+++ b/Source/core/inspector/InspectorIndexedDBAgent.cpp
@@ -41,8 +41,7 @@
 #include "core/inspector/InjectedScript.h"
 #include "core/inspector/InspectorPageAgent.h"
 #include "core/inspector/InspectorState.h"
-#include "core/page/Frame.h"
-#include "core/platform/JSONValues.h"
+#include "core/frame/Frame.h"
 #include "modules/indexeddb/DOMWindowIndexedDatabase.h"
 #include "modules/indexeddb/IDBCursor.h"
 #include "modules/indexeddb/IDBCursorWithValue.h"
@@ -58,6 +57,7 @@
 #include "modules/indexeddb/IDBPendingTransactionMonitor.h"
 #include "modules/indexeddb/IDBRequest.h"
 #include "modules/indexeddb/IDBTransaction.h"
+#include "platform/JSONValues.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/Vector.h"
 
@@ -99,11 +99,11 @@
         return this == &other;
     }
 
-    virtual void handleEvent(ScriptExecutionContext*, Event* event) OVERRIDE
+    virtual void handleEvent(ExecutionContext*, Event* event) OVERRIDE
     {
         if (!m_requestCallback->isActive())
             return;
-        if (event->type() != eventNames().successEvent) {
+        if (event->type() != EventTypeNames::success) {
             m_requestCallback->sendFailure("Unexpected event type.");
             return;
         }
@@ -138,15 +138,15 @@
 
 class ExecutableWithDatabase : public RefCounted<ExecutableWithDatabase> {
 public:
-    ExecutableWithDatabase(ScriptExecutionContext* context)
+    ExecutableWithDatabase(ExecutionContext* context)
         : m_context(context) { }
     virtual ~ExecutableWithDatabase() { };
     void start(IDBFactory*, SecurityOrigin*, const String& databaseName);
     virtual void execute(PassRefPtr<IDBDatabase>) = 0;
     virtual RequestCallback* requestCallback() = 0;
-    ScriptExecutionContext* context() { return m_context; };
+    ExecutionContext* context() { return m_context; };
 private:
-    ScriptExecutionContext* m_context;
+    ExecutionContext* m_context;
 };
 
 class OpenDatabaseCallback : public EventListener {
@@ -163,9 +163,9 @@
         return this == &other;
     }
 
-    virtual void handleEvent(ScriptExecutionContext*, Event* event) OVERRIDE
+    virtual void handleEvent(ExecutionContext*, Event* event) OVERRIDE
     {
-        if (event->type() != eventNames().successEvent) {
+        if (event->type() != EventTypeNames::success) {
             m_executableWithDatabase->requestCallback()->sendFailure("Unexpected event type.");
             return;
         }
@@ -204,13 +204,13 @@
         requestCallback()->sendFailure("Could not open database.");
         return;
     }
-    idbOpenDBRequest->addEventListener(eventNames().successEvent, callback, false);
+    idbOpenDBRequest->addEventListener(EventTypeNames::success, callback, false);
 }
 
-static PassRefPtr<IDBTransaction> transactionForDatabase(ScriptExecutionContext* scriptExecutionContext, IDBDatabase* idbDatabase, const String& objectStoreName, const String& mode = IDBTransaction::modeReadOnly())
+static PassRefPtr<IDBTransaction> transactionForDatabase(ExecutionContext* executionContext, IDBDatabase* idbDatabase, const String& objectStoreName, const String& mode = IDBTransaction::modeReadOnly())
 {
     TrackExceptionState es;
-    RefPtr<IDBTransaction> idbTransaction = idbDatabase->transaction(scriptExecutionContext, objectStoreName, mode, es);
+    RefPtr<IDBTransaction> idbTransaction = idbDatabase->transaction(executionContext, objectStoreName, mode, es);
     if (es.hadException())
         return 0;
     return idbTransaction;
@@ -263,7 +263,7 @@
 
 class DatabaseLoader : public ExecutableWithDatabase {
 public:
-    static PassRefPtr<DatabaseLoader> create(ScriptExecutionContext* context, PassRefPtr<RequestDatabaseCallback> requestCallback)
+    static PassRefPtr<DatabaseLoader> create(ExecutionContext* context, PassRefPtr<RequestDatabaseCallback> requestCallback)
     {
         return adoptRef(new DatabaseLoader(context, requestCallback));
     }
@@ -314,7 +314,7 @@
 
     virtual RequestCallback* requestCallback() { return m_requestCallback.get(); }
 private:
-    DatabaseLoader(ScriptExecutionContext* context, PassRefPtr<RequestDatabaseCallback> requestCallback)
+    DatabaseLoader(ExecutionContext* context, PassRefPtr<RequestDatabaseCallback> requestCallback)
         : ExecutableWithDatabase(context)
         , m_requestCallback(requestCallback) { }
     RefPtr<RequestDatabaseCallback> m_requestCallback;
@@ -407,9 +407,9 @@
         return this == &other;
     }
 
-    virtual void handleEvent(ScriptExecutionContext* context, Event* event) OVERRIDE
+    virtual void handleEvent(ExecutionContext* context, Event* event) OVERRIDE
     {
-        if (event->type() != eventNames().successEvent) {
+        if (event->type() != EventTypeNames::success) {
             m_requestCallback->sendFailure("Unexpected event type.");
             return;
         }
@@ -487,7 +487,7 @@
 
 class DataLoader : public ExecutableWithDatabase {
 public:
-    static PassRefPtr<DataLoader> create(ScriptExecutionContext* context, PassRefPtr<RequestDataCallback> requestCallback, const InjectedScript& injectedScript, const String& objectStoreName, const String& indexName, PassRefPtr<IDBKeyRange> idbKeyRange, int skipCount, unsigned pageSize)
+    static PassRefPtr<DataLoader> create(ExecutionContext* context, PassRefPtr<RequestDataCallback> requestCallback, const InjectedScript& injectedScript, const String& objectStoreName, const String& indexName, PassRefPtr<IDBKeyRange> idbKeyRange, int skipCount, unsigned pageSize)
     {
         return adoptRef(new DataLoader(context, requestCallback, injectedScript, objectStoreName, indexName, idbKeyRange, skipCount, pageSize));
     }
@@ -524,12 +524,12 @@
         } else {
             idbRequest = idbObjectStore->openCursor(context(), PassRefPtr<IDBKeyRange>(m_idbKeyRange), IndexedDB::CursorNext);
         }
-        idbRequest->addEventListener(eventNames().successEvent, openCursorCallback, false);
+        idbRequest->addEventListener(EventTypeNames::success, openCursorCallback, false);
     }
 
     virtual RequestCallback* requestCallback() { return m_requestCallback.get(); }
-    DataLoader(ScriptExecutionContext* scriptExecutionContext, PassRefPtr<RequestDataCallback> requestCallback, const InjectedScript& injectedScript, const String& objectStoreName, const String& indexName, PassRefPtr<IDBKeyRange> idbKeyRange, int skipCount, unsigned pageSize)
-        : ExecutableWithDatabase(scriptExecutionContext)
+    DataLoader(ExecutionContext* executionContext, PassRefPtr<RequestDataCallback> requestCallback, const InjectedScript& injectedScript, const String& objectStoreName, const String& indexName, PassRefPtr<IDBKeyRange> idbKeyRange, int skipCount, unsigned pageSize)
+        : ExecutableWithDatabase(executionContext)
         , m_requestCallback(requestCallback)
         , m_injectedScript(injectedScript)
         , m_objectStoreName(objectStoreName)
@@ -629,7 +629,7 @@
         requestCallback->sendFailure("Could not obtain database names.");
         return;
     }
-    idbRequest->addEventListener(eventNames().successEvent, GetDatabaseNamesCallback::create(requestCallback, document->securityOrigin()->toRawString()), false);
+    idbRequest->addEventListener(EventTypeNames::success, GetDatabaseNamesCallback::create(requestCallback, document->securityOrigin()->toRawString()), false);
 }
 
 void InspectorIndexedDBAgent::requestDatabase(ErrorString* errorString, const String& securityOrigin, const String& databaseName, PassRefPtr<RequestDatabaseCallback> requestCallback)
@@ -695,11 +695,11 @@
         return this == &other;
     }
 
-    virtual void handleEvent(ScriptExecutionContext*, Event* event) OVERRIDE
+    virtual void handleEvent(ExecutionContext*, Event* event) OVERRIDE
     {
         if (!m_requestCallback->isActive())
             return;
-        if (event->type() != eventNames().completeEvent) {
+        if (event->type() != EventTypeNames::complete) {
             m_requestCallback->sendFailure("Unexpected event type.");
             return;
         }
@@ -719,12 +719,12 @@
 
 class ClearObjectStore : public ExecutableWithDatabase {
 public:
-    static PassRefPtr<ClearObjectStore> create(ScriptExecutionContext* context, const String& objectStoreName, PassRefPtr<ClearObjectStoreCallback> requestCallback)
+    static PassRefPtr<ClearObjectStore> create(ExecutionContext* context, const String& objectStoreName, PassRefPtr<ClearObjectStoreCallback> requestCallback)
     {
         return adoptRef(new ClearObjectStore(context, objectStoreName, requestCallback));
     }
 
-    ClearObjectStore(ScriptExecutionContext* context, const String& objectStoreName, PassRefPtr<ClearObjectStoreCallback> requestCallback)
+    ClearObjectStore(ExecutionContext* context, const String& objectStoreName, PassRefPtr<ClearObjectStoreCallback> requestCallback)
         : ExecutableWithDatabase(context)
         , m_objectStoreName(objectStoreName)
         , m_requestCallback(requestCallback)
@@ -755,7 +755,7 @@
             m_requestCallback->sendFailure(String::format("Could not clear object store '%s': %d", m_objectStoreName.utf8().data(), ec));
             return;
         }
-        idbTransaction->addEventListener(eventNames().completeEvent, ClearObjectStoreListener::create(m_requestCallback), false);
+        idbTransaction->addEventListener(EventTypeNames::complete, ClearObjectStoreListener::create(m_requestCallback), false);
     }
 
     virtual RequestCallback* requestCallback() { return m_requestCallback.get(); }
diff --git a/Source/core/inspector/InspectorInputAgent.cpp b/Source/core/inspector/InspectorInputAgent.cpp
index 4af9187..ab23f6e 100644
--- a/Source/core/inspector/InspectorInputAgent.cpp
+++ b/Source/core/inspector/InspectorInputAgent.cpp
@@ -34,18 +34,17 @@
 #include "core/inspector/InspectorClient.h"
 #include "core/page/Chrome.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
-#include "core/platform/JSONValues.h"
-#include "core/platform/PlatformEvent.h"
-#include "core/platform/PlatformKeyboardEvent.h"
-#include "core/platform/PlatformMouseEvent.h"
-#include "core/platform/PlatformTouchEvent.h"
-#include "core/platform/PlatformTouchPoint.h"
-#include "core/platform/graphics/IntPoint.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/JSONValues.h"
+#include "platform/PlatformKeyboardEvent.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/PlatformTouchEvent.h"
+#include "platform/PlatformTouchPoint.h"
+#include "platform/geometry/IntPoint.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/inspector/InspectorInstrumentation.cpp b/Source/core/inspector/InspectorInstrumentation.cpp
index c3d4718..49729a2 100644
--- a/Source/core/inspector/InspectorInstrumentation.cpp
+++ b/Source/core/inspector/InspectorInstrumentation.cpp
@@ -160,22 +160,22 @@
     return source;
 }
 
-bool canvasAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
+bool canvasAgentEnabled(ExecutionContext* executionContext)
 {
-    InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(scriptExecutionContext);
+    InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(executionContext);
     return instrumentingAgents && instrumentingAgents->inspectorCanvasAgent();
 }
 
-bool consoleAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
+bool consoleAgentEnabled(ExecutionContext* executionContext)
 {
-    InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(scriptExecutionContext);
+    InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(executionContext);
     InspectorConsoleAgent* consoleAgent = instrumentingAgents ? instrumentingAgents->inspectorConsoleAgent() : 0;
     return consoleAgent && consoleAgent->enabled();
 }
 
-bool timelineAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
+bool timelineAgentEnabled(ExecutionContext* executionContext)
 {
-    InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(scriptExecutionContext);
+    InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(executionContext);
     return instrumentingAgents && instrumentingAgents->inspectorTimelineAgent();
 }
 
@@ -226,7 +226,7 @@
     return instrumentationForWorkerGlobalScope(workerGlobalScope);
 }
 
-InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ScriptExecutionContext* context)
+InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ExecutionContext* context)
 {
     if (context->isWorkerGlobalScope())
         return instrumentationForWorkerGlobalScope(toWorkerGlobalScope(context));
diff --git a/Source/core/inspector/InspectorInstrumentation.h b/Source/core/inspector/InspectorInstrumentation.h
index bd16823..7adf073 100644
--- a/Source/core/inspector/InspectorInstrumentation.h
+++ b/Source/core/inspector/InspectorInstrumentation.h
@@ -35,10 +35,10 @@
 #include "core/css/CSSSelector.h"
 #include "core/css/CSSStyleSheet.h"
 #include "core/dom/Element.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/events/EventContext.h"
-#include "core/dom/ScriptExecutionContext.h"
 #include "core/inspector/ConsoleAPITypes.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/platform/network/FormData.h"
 #include "core/rendering/HitTestResult.h"
@@ -60,7 +60,7 @@
 class InspectorTimelineAgent;
 class InstrumentingAgents;
 class RenderLayer;
-class ScriptExecutionContext;
+class ExecutionContext;
 class ThreadableLoaderClient;
 class WorkerGlobalScope;
 class WorkerGlobalScopeProxy;
@@ -106,14 +106,14 @@
 // Called from generated instrumentation code.
 InstrumentingAgents* instrumentingAgentsFor(Page*);
 InstrumentingAgents* instrumentingAgentsFor(Frame*);
-InstrumentingAgents* instrumentingAgentsFor(ScriptExecutionContext*);
+InstrumentingAgents* instrumentingAgentsFor(ExecutionContext*);
 InstrumentingAgents* instrumentingAgentsFor(Document*);
 InstrumentingAgents* instrumentingAgentsFor(RenderObject*);
 InstrumentingAgents* instrumentingAgentsFor(Element*);
 InstrumentingAgents* instrumentingAgentsFor(WorkerGlobalScope*);
 
 // Helper for the one above.
-InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ScriptExecutionContext*);
+InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ExecutionContext*);
 
 }  // namespace InspectorInstrumentation
 
@@ -138,7 +138,7 @@
 
 namespace InspectorInstrumentation {
 
-inline InstrumentingAgents* instrumentingAgentsFor(ScriptExecutionContext* context)
+inline InstrumentingAgents* instrumentingAgentsFor(ExecutionContext* context)
 {
     if (!context)
         return 0;
diff --git a/Source/core/inspector/InspectorInstrumentation.idl b/Source/core/inspector/InspectorInstrumentation.idl
index 578c857..141ff61 100644
--- a/Source/core/inspector/InspectorInstrumentation.idl
+++ b/Source/core/inspector/InspectorInstrumentation.idl
@@ -119,7 +119,7 @@
     void didChangeRegionOverset([Keep] Document*, NamedFlow*);
 
     [DOMDebugger, Inline=FastReturn]
-    void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url);
+    void willSendXMLHttpRequest(ExecutionContext*, const String& url);
 
     [DOMDebugger, Inline=FastReturn]
     void didFireWebGLError(Element*, const String& errorName);
@@ -134,19 +134,19 @@
     void didScheduleResourceRequest([Keep] Document*, const String& url);
 
     [DOMDebugger, Timeline, Inline=FastReturn]
-    void didInstallTimer([Keep] ScriptExecutionContext*, int timerId, int timeout, bool singleShot);
+    void didInstallTimer([Keep] ExecutionContext*, int timerId, int timeout, bool singleShot);
 
     [DOMDebugger, Timeline, Inline=FastReturn]
-    void didRemoveTimer([Keep] ScriptExecutionContext*, int timerId);
+    void didRemoveTimer([Keep] ExecutionContext*, int timerId);
 
     [Timeline, Inline=FastReturn]
-    InspectorInstrumentationCookie willCallFunction([Keep] ScriptExecutionContext*, const String& scriptName, int scriptLine);
+    InspectorInstrumentationCookie willCallFunction([Keep] ExecutionContext*, const String& scriptName, int scriptLine);
 
     [Timeline, Inline=FastReturn]
     void didCallFunction(const InspectorInstrumentationCookie&);
 
     [Timeline, Inline=FastReturn]
-    InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent([Keep] ScriptExecutionContext*, XMLHttpRequest*);
+    InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent([Keep] ExecutionContext*, XMLHttpRequest*);
 
     [Timeline, Inline=FastReturn]
     void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&);
@@ -158,7 +158,7 @@
     void didDispatchEvent(const InspectorInstrumentationCookie&);
 
     [DOMDebugger, Inline=FastReturn]
-    InspectorInstrumentationCookie willHandleEvent(ScriptExecutionContext*, Event*);
+    InspectorInstrumentationCookie willHandleEvent(ExecutionContext*, Event*);
 
     [Debugger, Inline=FastReturn]
     void didHandleEvent(const InspectorInstrumentationCookie&);
@@ -182,7 +182,7 @@
     void didCreateIsolatedContext([Keep] Frame*, ScriptState*, SecurityOrigin*);
 
     [DOMDebugger, Timeline, Inline=FastReturn]
-    InspectorInstrumentationCookie willFireTimer([Keep] ScriptExecutionContext*, int timerId);
+    InspectorInstrumentationCookie willFireTimer([Keep] ExecutionContext*, int timerId);
 
     [Debugger, Timeline, Inline=FastReturn]
     void didFireTimer(const InspectorInstrumentationCookie&);
@@ -203,7 +203,7 @@
     void didResizeMainFrame(Page*);
 
     [Timeline, Inline=FastReturn]
-    InspectorInstrumentationCookie willDispatchXHRLoadEvent([Keep] ScriptExecutionContext*, XMLHttpRequest*);
+    InspectorInstrumentationCookie willDispatchXHRLoadEvent([Keep] ExecutionContext*, XMLHttpRequest*);
 
     [Timeline, Inline=FastReturn]
     void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&);
@@ -217,7 +217,7 @@
     [Timeline, Inline=FastReturn]
     void willPaint([Keep] RenderObject*);
 
-    [Timeline, Page, Inline=FastReturn]
+    [Timeline, Page, LayerTree, Inline=FastReturn]
     void didPaint([Keep] RenderObject*, GraphicsContext*, const LayoutRect&);
 
     [Timeline, Inline=FastReturn]
@@ -242,12 +242,6 @@
     void applyUserAgentOverride(Frame*, String* userAgent);
 
     [Page, Inline=FastReturn]
-    void applyScreenWidthOverride(Frame*, long* width);
-
-    [Page, Inline=FastReturn]
-    void applyScreenHeightOverride(Frame*, long* height);
-
-    [Page, Inline=FastReturn]
     void applyEmulatedMedia(Frame*, String* media);
 
     [Timeline, Resource]
@@ -292,28 +286,28 @@
     void didFailLoading(Frame* frame, unsigned long identifier, DocumentLoader*, const ResourceError&);
 
     [Resource]
-    void documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext*, unsigned long identifier, ThreadableLoaderClient* client);
+    void documentThreadableLoaderStartedLoadingForClient(ExecutionContext*, unsigned long identifier, ThreadableLoaderClient* client);
 
     [Resource]
-    void willLoadXHR(ScriptExecutionContext*, ThreadableLoaderClient* client, const String& method, const KURL& url, bool async, PassRefPtr<FormData>, const HTTPHeaderMap& headers, bool includeCredentials);
+    void willLoadXHR(ExecutionContext*, ThreadableLoaderClient* client, const String& method, const KURL& url, bool async, PassRefPtr<FormData>, const HTTPHeaderMap& headers, bool includeCredentials);
 
     [Resource]
-    void didFailXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient* client);
+    void didFailXHRLoading(ExecutionContext*, ThreadableLoaderClient* client);
 
     [Console, Resource]
-    void didFinishXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient* client, unsigned long identifier, ScriptString sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
+    void didFinishXHRLoading(ExecutionContext*, ThreadableLoaderClient* client, unsigned long identifier, ScriptString sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
 
     [Resource]
-    void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier);
+    void didReceiveXHRResponse(ExecutionContext*, unsigned long identifier);
 
     [Resource]
-    void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString);
+    void scriptImported(ExecutionContext*, unsigned long identifier, const String& sourceString);
 
     [Debugger]
-    void scriptExecutionBlockedByCSP(ScriptExecutionContext*, const String& directiveText);
+    void scriptExecutionBlockedByCSP(ExecutionContext*, const String& directiveText);
 
     [Resource]
-    void didReceiveScriptResponse(ScriptExecutionContext*, unsigned long identifier);
+    void didReceiveScriptResponse(ExecutionContext*, unsigned long identifier);
 
     [Timeline, Inspector, DOM, Page]
     void domContentLoadedEventFired([Keep] Frame*);
@@ -382,13 +376,13 @@
     void didDispatchDOMStorageEvent(Page* page, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin);
 
     [Worker]
-    void didStartWorkerGlobalScope(ScriptExecutionContext*, WorkerGlobalScopeProxy* proxy, const KURL& url);
+    void didStartWorkerGlobalScope(ExecutionContext*, WorkerGlobalScopeProxy* proxy, const KURL& url);
 
     [WorkerRuntime]
     void willEvaluateWorkerScript([Keep] WorkerGlobalScope* context, int workerThreadStartMode);
 
     [Worker]
-    void workerGlobalScopeTerminated(ScriptExecutionContext*, WorkerGlobalScopeProxy* proxy);
+    void workerGlobalScopeTerminated(ExecutionContext*, WorkerGlobalScopeProxy* proxy);
 
     [Profiler, Timeline]
     void willProcessTask(WorkerGlobalScope* context);
@@ -424,7 +418,7 @@
     void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage);
 
     [ApplicationCache, Inline=FastReturn]
-    void networkStateChanged(Page*);
+    void networkStateChanged(Page*, bool online);
 
     [ApplicationCache, Inline=FastReturn]
     void updateApplicationCacheStatus([Keep] Frame*);
@@ -448,35 +442,35 @@
     // FIXME: Convert to ScriptArguments to match non-worker context.
     // Use the same implementation as above as a similar method dispatched on Page.
     [Console]
-    void addMessageToConsole(ScriptExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack, unsigned long requestIdentifier = 0);
+    void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack, unsigned long requestIdentifier = 0);
 
     // Use the same implementation as above as a similar method dispatched on Page.
     [Console]
-    void addMessageToConsole(ScriptExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptId, unsigned lineNumber, unsigned columnNumber, ScriptState* state, unsigned long requestIdentifier = 0);
+    void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, const String& scriptId, unsigned lineNumber, unsigned columnNumber, ScriptState* state, unsigned long requestIdentifier = 0);
 
     [Console, Debugger]
-    void addMessageToConsole(ScriptExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, ScriptState* state, PassRefPtr<ScriptArguments> arguments, unsigned long requestIdentifier = 0);
+    void addMessageToConsole(ExecutionContext* context, MessageSource source, MessageType type, MessageLevel level, const String& message, ScriptState* state, PassRefPtr<ScriptArguments> arguments, unsigned long requestIdentifier = 0);
 
     [Console]
-    void consoleCount(ScriptExecutionContext* context, ScriptState* state, PassRefPtr<ScriptArguments> arguments);
+    void consoleCount(ExecutionContext* context, ScriptState* state, PassRefPtr<ScriptArguments> arguments);
 
     [Timeline, Console]
-    void consoleTime([Keep] ScriptExecutionContext* context, const String& title);
+    void consoleTime([Keep] ExecutionContext* context, const String& title);
 
     [Console, Timeline]
-    void consoleTimeEnd([Keep] ScriptExecutionContext* context, const String& title, ScriptState* state);
+    void consoleTimeEnd([Keep] ExecutionContext* context, const String& title, ScriptState* state);
 
     [Timeline, Inline=FastReturn]
-    void consoleTimeStamp([Keep] ScriptExecutionContext* context, const String& title);
+    void consoleTimeStamp([Keep] ExecutionContext* context, const String& title);
 
     [Console, Inline=FastReturn]
-    void consoleTimeline([Keep] ScriptExecutionContext* context, const String& title, ScriptState* state);
+    void consoleTimeline([Keep] ExecutionContext* context, const String& title, ScriptState* state);
 
     [Console, Inline=FastReturn]
-    void consoleTimelineEnd([Keep] ScriptExecutionContext* context, const String& title, ScriptState* state);
+    void consoleTimelineEnd([Keep] ExecutionContext* context, const String& title, ScriptState* state);
 
     [Profiler]
-    void addProfile(ScriptExecutionContext* context, PassRefPtr<ScriptProfile> profile, PassRefPtr<ScriptCallStack> callStack);
+    void addProfile(ExecutionContext* context, PassRefPtr<ScriptProfile> profile, PassRefPtr<ScriptCallStack> callStack);
 }
 
 interface InspectorDatabaseInstrumentation {
@@ -484,21 +478,15 @@
 #include "modules/webdatabase/Database.h"
 
     [Database]
-    void didOpenDatabase(ScriptExecutionContext* context, PassRefPtr<Database> database, const String& domain, const String& name, const String& version);
+    void didOpenDatabase(ExecutionContext* context, PassRefPtr<Database> database, const String& domain, const String& name, const String& version);
 }
 
 interface InspectorOverrides {
     [CSS, Inline=FastReturn]
     bool forcePseudoState([Keep] Element* element, CSSSelector::PseudoType pseudoState);
 
-    [Page, Inline=FastReturn]
-    bool shouldApplyScreenWidthOverride(Frame* frame);
-
-    [Page, Inline=FastReturn]
-    bool shouldApplyScreenHeightOverride(Frame* frame);
-
     [Worker, Inline=FastReturn]
-    bool shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext* context);
+    bool shouldPauseDedicatedWorkerOnStart(ExecutionContext* context);
 
     [Page, Inline=FastReturn]
     GeolocationPosition* overrideGeolocationPosition(Page* page, [DefaultReturn] GeolocationPosition* position);
@@ -507,7 +495,7 @@
     DeviceOrientationData* overrideDeviceOrientation(Page* page, [DefaultReturn] DeviceOrientationData* deviceOrientation);
 
     [Profiler]
-    String getCurrentUserInitiatedProfileName(ScriptExecutionContext* context, bool incrementProfileNumber);
+    String getCurrentUserInitiatedProfileName(ExecutionContext* context, bool incrementProfileNumber);
 }
 
 
diff --git a/Source/core/inspector/InspectorInstrumentationCustomInl.h b/Source/core/inspector/InspectorInstrumentationCustomInl.h
index 49dcdb7..8849062 100644
--- a/Source/core/inspector/InspectorInstrumentationCustomInl.h
+++ b/Source/core/inspector/InspectorInstrumentationCustomInl.h
@@ -41,9 +41,9 @@
 PassOwnPtr<ScriptSourceCode> preprocessImpl(InstrumentingAgents*, Frame*, const ScriptSourceCode&);
 String preprocessEventListenerImpl(InstrumentingAgents*, Frame*, const String& source, const String& url, const String& functionName);
 
-bool canvasAgentEnabled(ScriptExecutionContext*);
-bool consoleAgentEnabled(ScriptExecutionContext*);
-bool timelineAgentEnabled(ScriptExecutionContext*);
+bool canvasAgentEnabled(ExecutionContext*);
+bool consoleAgentEnabled(ExecutionContext*);
+bool timelineAgentEnabled(ExecutionContext*);
 
 inline bool profilerEnabled(WorkerGlobalScope* scope)
 {
diff --git a/Source/core/inspector/InspectorLayerTreeAgent.cpp b/Source/core/inspector/InspectorLayerTreeAgent.cpp
index 5f92bb0..2f4d146 100644
--- a/Source/core/inspector/InspectorLayerTreeAgent.cpp
+++ b/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -39,14 +39,14 @@
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/RenderLayer.h"
-#include "core/rendering/RenderLayerBacking.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderView.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/transforms/TransformationMatrix.h"
 #include "public/platform/WebCompositingReasons.h"
 #include "public/platform/WebLayer.h"
 
@@ -56,10 +56,15 @@
 static const char layerTreeAgentEnabled[] = "layerTreeAgentEnabled";
 };
 
+inline String idForLayer(GraphicsLayer* graphicsLayer)
+{
+    return String::number(graphicsLayer->platformLayer()->id());
+}
+
 static PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(GraphicsLayer* graphicsLayer, int nodeId)
 {
     RefPtr<TypeBuilder::LayerTree::Layer> layerObject = TypeBuilder::LayerTree::Layer::create()
-        .setLayerId(String::number(graphicsLayer->platformLayer()->id()))
+        .setLayerId(idForLayer(graphicsLayer))
         .setOffsetX(graphicsLayer->position().x())
         .setOffsetY(graphicsLayer->position().y())
         .setWidth(graphicsLayer->size().width())
@@ -73,7 +78,7 @@
     if (!parent)
         parent = graphicsLayer->replicatedLayer();
     if (parent)
-        layerObject->setParentLayerId(String::number(parent->platformLayer()->id()));
+        layerObject->setParentLayerId(idForLayer(parent));
     if (!graphicsLayer->contentsAreVisible())
         layerObject->setInvisible(true);
     const TransformationMatrix& transform = graphicsLayer->transform();
@@ -150,6 +155,22 @@
     m_frontend->layerTreeDidChange();
 }
 
+void InspectorLayerTreeAgent::didPaint(RenderObject* renderer, GraphicsContext*, const LayoutRect& rect)
+{
+    RenderLayer* renderLayer = toRenderLayerModelObject(renderer)->layer();
+    CompositedLayerMapping* compositedLayerMapping = renderLayer->compositedLayerMapping();
+    // Should only happen for FrameView paints when compositing is off. Consider different instrumentation method for that.
+    if (!compositedLayerMapping)
+        return;
+    GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer();
+    RefPtr<TypeBuilder::DOM::Rect> domRect = TypeBuilder::DOM::Rect::create()
+        .setX(rect.x())
+        .setY(rect.y())
+        .setWidth(rect.width())
+        .setHeight(rect.height());
+    m_frontend->layerPainted(idForLayer(graphicsLayer), domRect.release());
+}
+
 void InspectorLayerTreeAgent::getLayers(ErrorString* errorString, const int* nodeId, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >& layers)
 {
     LayerIdToNodeIdMap layerIdToNodeIdMap;
@@ -176,7 +197,7 @@
         return;
     }
     RenderLayer* enclosingLayer = renderer->enclosingLayer();
-    GraphicsLayer* enclosingGraphicsLayer = enclosingLayer->enclosingCompositingLayer()->backing()->childForSuperlayers();
+    GraphicsLayer* enclosingGraphicsLayer = enclosingLayer->enclosingCompositingLayer()->compositedLayerMapping()->childForSuperlayers();
     buildLayerIdToNodeIdMap(errorString, enclosingLayer, layerIdToNodeIdMap);
     gatherGraphicsLayers(enclosingGraphicsLayer, layerIdToNodeIdMap, layers);
 }
@@ -185,7 +206,7 @@
 {
     if (root->isComposited()) {
         if (Node* node = root->renderer()->generatingNode()) {
-            GraphicsLayer* graphicsLayer = root->backing()->childForSuperlayers();
+            GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->childForSuperlayers();
             layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNode(errorString, node));
         }
     }
diff --git a/Source/core/inspector/InspectorLayerTreeAgent.h b/Source/core/inspector/InspectorLayerTreeAgent.h
index 9db42fd..0640922 100644
--- a/Source/core/inspector/InspectorLayerTreeAgent.h
+++ b/Source/core/inspector/InspectorLayerTreeAgent.h
@@ -60,7 +60,9 @@
     virtual void clearFrontend();
     virtual void restore();
 
+    // Called from InspectorInstrumentation
     void layerTreeDidChange();
+    void didPaint(RenderObject*, GraphicsContext*, const LayoutRect&);
 
     // Called from the front-end.
     virtual void enable(ErrorString*);
diff --git a/Source/core/inspector/InspectorMemoryAgent.cpp b/Source/core/inspector/InspectorMemoryAgent.cpp
index 33fc481..15270d2 100644
--- a/Source/core/inspector/InspectorMemoryAgent.cpp
+++ b/Source/core/inspector/InspectorMemoryAgent.cpp
@@ -46,7 +46,7 @@
 {
     *documents = InspectorCounters::counterValue(InspectorCounters::DocumentCounter);
     *nodes = InspectorCounters::counterValue(InspectorCounters::NodeCounter);
-    *jsEventListeners = ThreadLocalInspectorCounters::current().counterValue(ThreadLocalInspectorCounters::JSEventListenerCounter);
+    *jsEventListeners = InspectorCounters::counterValue(InspectorCounters::JSEventListenerCounter);
 }
 
 InspectorMemoryAgent::InspectorMemoryAgent(InstrumentingAgents* instrumentingAgents, InspectorCompositeState* state)
diff --git a/Source/core/inspector/InspectorMemoryAgent.h b/Source/core/inspector/InspectorMemoryAgent.h
index 1aa511f..76c432f 100644
--- a/Source/core/inspector/InspectorMemoryAgent.h
+++ b/Source/core/inspector/InspectorMemoryAgent.h
@@ -60,8 +60,6 @@
 private:
     InspectorMemoryAgent(InstrumentingAgents*, InspectorCompositeState*);
 
-    PassRefPtr<JSONObject> getProcessMemoryDistributionImpl(bool reportGraph, HashMap<String, size_t>* memoryInfo);
-
     InspectorFrontend::Memory* m_frontend;
 };
 
diff --git a/Source/core/inspector/InspectorOverlay.cpp b/Source/core/inspector/InspectorOverlay.cpp
index 6811ffd..a9cc5b8 100644
--- a/Source/core/inspector/InspectorOverlay.cpp
+++ b/Source/core/inspector/InspectorOverlay.cpp
@@ -42,17 +42,17 @@
 #include "core/loader/EmptyClients.h"
 #include "core/page/Chrome.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/JSONValues.h"
-#include "core/platform/PlatformMouseEvent.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/rendering/RenderBoxModelObject.h"
 #include "core/rendering/RenderInline.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/style/RenderStyleConstants.h"
+#include "platform/JSONValues.h"
+#include "platform/PlatformMouseEvent.h"
 #include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
@@ -427,6 +427,8 @@
         return;
     IntRect viewRect = view->visibleContentRect();
     FrameView* overlayView = overlayPage()->mainFrame()->view();
+
+    // Include scrollbars to avoid masking them by the gutter.
     IntSize frameViewFullSize = view->visibleContentRect(ScrollableArea::IncludeScrollbars).size();
     IntSize size = m_size.isEmpty() ? frameViewFullSize : m_size;
     size.scale(m_page->pageScaleFactor());
@@ -435,7 +437,6 @@
     // Clear canvas and paint things.
     reset(size, m_size.isEmpty() ? IntSize() : frameViewFullSize, viewRect.x(), viewRect.y());
 
-    // Include scrollbars to avoid masking them by the gutter.
     drawGutter();
     drawNodeHighlight();
     drawQuadHighlight();
@@ -558,9 +559,9 @@
         }
         if (pseudoElement) {
             if (pseudoElement->pseudoId() == BEFORE)
-                classNames.append(":before");
+                classNames.append("::before");
             else if (pseudoElement->pseudoId() == AFTER)
-                classNames.append(":after");
+                classNames.append("::after");
         }
         if (!classNames.isEmpty())
             elementInfo->setString("className", classNames.toString());
@@ -602,8 +603,9 @@
 void InspectorOverlay::drawOverridesMessage()
 {
     RefPtr<JSONObject> data = JSONObject::create();
-    if (!m_drawViewSize)
-        data->setNumber("overrides", m_overrides);
+    if (m_drawViewSize || m_highlightNode || m_highlightQuad)
+        data->setBoolean("hidden", true);
+    data->setNumber("overrides", m_overrides);
     data->setNumber("topOffset", m_overridesTopOffset);
     evaluateInOverlay("drawOverridesMessage", data.release());
 }
@@ -685,7 +687,7 @@
     RefPtr<JSONArray> command = JSONArray::create();
     command->pushString(method);
     command->pushString(argument);
-    overlayPage()->mainFrame()->script()->executeScriptInMainWorld(ScriptSourceCode("dispatch(" + command->toJSONString() + ")"));
+    overlayPage()->mainFrame()->script()->executeScriptInMainWorld("dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhenScriptsDisabled);
 }
 
 void InspectorOverlay::evaluateInOverlay(const String& method, PassRefPtr<JSONValue> argument)
@@ -693,7 +695,7 @@
     RefPtr<JSONArray> command = JSONArray::create();
     command->pushString(method);
     command->pushValue(argument);
-    overlayPage()->mainFrame()->script()->executeScriptInMainWorld(ScriptSourceCode("dispatch(" + command->toJSONString() + ")"));
+    overlayPage()->mainFrame()->script()->executeScriptInMainWorld("dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhenScriptsDisabled);
 }
 
 void InspectorOverlay::onTimer(Timer<InspectorOverlay>*)
diff --git a/Source/core/inspector/InspectorOverlay.h b/Source/core/inspector/InspectorOverlay.h
index 1517c45..303472e 100644
--- a/Source/core/inspector/InspectorOverlay.h
+++ b/Source/core/inspector/InspectorOverlay.h
@@ -30,9 +30,9 @@
 #define InspectorOverlay_h
 
 #include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/LayoutRect.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/inspector/InspectorOverlayPage.html b/Source/core/inspector/InspectorOverlayPage.html
index fc150af..adadeea 100644
--- a/Source/core/inspector/InspectorOverlayPage.html
+++ b/Source/core/inspector/InspectorOverlayPage.html
@@ -447,11 +447,13 @@
 function drawOverridesMessage(data)
 {
     overridesContainer.style.top = data.topOffset + "px";
-    var overrides = data.overrides;
     overridesMessageElement.textContent = "";
-    if (!overrides) {
-        overridesContainer.classList.add("hidden");
+
+    var overrides = data.overrides;
+    if (!overrides)
         document.body.classList.remove("touch");
+    if (!overrides || data.hidden) {
+        overridesContainer.classList.add("hidden");
         return;
     }
 
diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp
index 00bef93..3a5b287 100644
--- a/Source/core/inspector/InspectorPageAgent.cpp
+++ b/Source/core/inspector/InspectorPageAgent.cpp
@@ -36,9 +36,7 @@
 #include "bindings/v8/DOMWrapperWorld.h"
 #include "bindings/v8/ScriptController.h"
 #include "core/dom/DOMImplementation.h"
-#include "core/dom/DeviceOrientationController.h"
 #include "core/dom/Document.h"
-#include "core/dom/UserGestureIndicator.h"
 #include "core/fetch/CSSStyleSheetResource.h"
 #include "core/fetch/FontResource.h"
 #include "core/fetch/ImageResource.h"
@@ -61,15 +59,17 @@
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoadRequest.h"
 #include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/PageConsole.h"
 #include "core/page/Settings.h"
 #include "core/platform/Cookie.h"
-#include "core/platform/JSONValues.h"
 #include "core/platform/text/RegularExpression.h"
+#include "modules/device_orientation/NewDeviceOrientationController.h"
 #include "modules/geolocation/GeolocationController.h"
+#include "platform/JSONValues.h"
+#include "platform/UserGestureIndicator.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/ListHashSet.h"
@@ -85,7 +85,7 @@
 static const char pageAgentScriptsToEvaluateOnLoad[] = "pageAgentScriptsToEvaluateOnLoad";
 static const char pageAgentScreenWidthOverride[] = "pageAgentScreenWidthOverride";
 static const char pageAgentScreenHeightOverride[] = "pageAgentScreenHeightOverride";
-static const char pageAgentFontScaleFactorOverride[] = "pageAgentFontScaleFactorOverride";
+static const char pageAgentDeviceScaleFactorOverride[] = "pageAgentDeviceScaleFactorOverride";
 static const char pageAgentFitWindow[] = "pageAgentFitWindow";
 static const char pageAgentShowFPSCounter[] = "pageAgentShowFPSCounter";
 static const char pageAgentContinuousPaintingEnabled[] = "pageAgentContinuousPaintingEnabled";
@@ -317,7 +317,6 @@
     , m_overlay(overlay)
     , m_lastScriptIdentifier(0)
     , m_enabled(false)
-    , m_isFirstLayoutAfterOnLoad(false)
     , m_geolocationOverridden(false)
     , m_ignoreScriptsEnabledNotification(false)
     , m_didForceCompositingMode(false)
@@ -361,9 +360,9 @@
 
         int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
         int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
-        double currentFontScaleFactor = m_state->getDouble(PageAgentState::pageAgentFontScaleFactorOverride);
+        double currentDeviceScaleFactor = m_state->getDouble(PageAgentState::pageAgentDeviceScaleFactorOverride);
         bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFitWindow);
-        updateViewMetrics(currentWidth, currentHeight, currentFontScaleFactor, currentFitWindow);
+        updateViewMetrics(currentWidth, currentHeight, currentDeviceScaleFactor, currentFitWindow);
         updateTouchEventEmulationInPage(m_state->getBoolean(PageAgentState::touchEventEmulationEnabled));
     }
 }
@@ -406,7 +405,7 @@
     updateViewMetrics(0, 0, 1, false);
     m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, 0);
     m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, 0);
-    m_state->setDouble(PageAgentState::pageAgentFontScaleFactorOverride, 1);
+    m_state->setDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, 1);
     m_state->setBoolean(PageAgentState::pageAgentFitWindow, false);
 }
 
@@ -660,7 +659,7 @@
     DOMPatchSupport::patchDocument(*document, html);
 }
 
-void InspectorPageAgent::setDeviceMetricsOverride(ErrorString* errorString, int width, int height, double fontScaleFactor, bool fitWindow)
+void InspectorPageAgent::setDeviceMetricsOverride(ErrorString* errorString, int width, int height, double deviceScaleFactor, bool fitWindow)
 {
     const static long maxDimension = 10000000;
 
@@ -674,31 +673,31 @@
         return;
     }
 
-    if (fontScaleFactor <= 0) {
-        *errorString = "fontScaleFactor must be positive";
+    if (deviceScaleFactor <= 0) {
+        *errorString = "deviceScaleFactor must be positive";
         return;
     }
 
-    if (!deviceMetricsChanged(width, height, fontScaleFactor, fitWindow))
+    if (!deviceMetricsChanged(width, height, deviceScaleFactor, fitWindow))
         return;
 
     m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, width);
     m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, height);
-    m_state->setDouble(PageAgentState::pageAgentFontScaleFactorOverride, fontScaleFactor);
+    m_state->setDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, deviceScaleFactor);
     m_state->setBoolean(PageAgentState::pageAgentFitWindow, fitWindow);
 
-    updateViewMetrics(width, height, fontScaleFactor, fitWindow);
+    updateViewMetrics(width, height, deviceScaleFactor, fitWindow);
 }
 
-bool InspectorPageAgent::deviceMetricsChanged(int width, int height, double fontScaleFactor, bool fitWindow)
+bool InspectorPageAgent::deviceMetricsChanged(int width, int height, double deviceScaleFactor, bool fitWindow)
 {
     // These two always fit an int.
     int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
     int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
-    double currentFontScaleFactor = m_state->getDouble(PageAgentState::pageAgentFontScaleFactorOverride, 1);
+    double currentDeviceScaleFactor = m_state->getDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, 1);
     bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFitWindow);
 
-    return width != currentWidth || height != currentHeight || fontScaleFactor != currentFontScaleFactor || fitWindow != currentFitWindow;
+    return width != currentWidth || height != currentHeight || deviceScaleFactor != currentDeviceScaleFactor || fitWindow != currentFitWindow;
 }
 
 void InspectorPageAgent::setShowPaintRects(ErrorString*, bool show)
@@ -718,16 +717,19 @@
 
 void InspectorPageAgent::setShowFPSCounter(ErrorString*, bool show)
 {
+    // FIXME: allow metrics override, fps counter and continuous painting at the same time: crbug.com/299837.
+    bool viewMetricsOverride = m_state->getLong(PageAgentState::pageAgentScreenWidthOverride);
     m_state->setBoolean(PageAgentState::pageAgentShowFPSCounter, show);
-    m_client->setShowFPSCounter(show);
+    m_client->setShowFPSCounter(show && !viewMetricsOverride);
 
     updateOverridesTopOffset();
 }
 
 void InspectorPageAgent::setContinuousPaintingEnabled(ErrorString*, bool enabled)
 {
+    bool viewMetricsOverride = m_state->getLong(PageAgentState::pageAgentScreenWidthOverride);
     m_state->setBoolean(PageAgentState::pageAgentContinuousPaintingEnabled, enabled);
-    m_client->setContinuousPaintingEnabled(enabled);
+    m_client->setContinuousPaintingEnabled(enabled && !viewMetricsOverride);
 
     updateOverridesTopOffset();
 }
@@ -791,11 +793,11 @@
         for (JSONObject::const_iterator it = scripts->begin(); it != end; ++it) {
             String scriptText;
             if (it->value->asString(&scriptText))
-                frame->script()->executeScript(scriptText);
+                frame->script()->executeScriptInMainWorld(scriptText);
         }
     }
     if (!m_scriptToEvaluateOnLoadOnce.isEmpty())
-        frame->script()->executeScript(m_scriptToEvaluateOnLoadOnce);
+        frame->script()->executeScriptInMainWorld(m_scriptToEvaluateOnLoadOnce);
 }
 
 void InspectorPageAgent::domContentLoadedEventFired(Frame* frame)
@@ -803,7 +805,6 @@
     if (frame->page()->mainFrame() != frame)
         return;
 
-    m_isFirstLayoutAfterOnLoad = true;
     m_frontend->domContentEventFired(currentTime());
     if (m_state->getBoolean(PageAgentState::forceCompositingMode))
         setForceCompositingMode(0, true);
@@ -972,34 +973,6 @@
     m_frontend->javascriptDialogClosed();
 }
 
-void InspectorPageAgent::applyScreenWidthOverride(long* width)
-{
-    long widthOverride = m_state->getLong(PageAgentState::pageAgentScreenWidthOverride);
-    if (widthOverride)
-        *width = widthOverride;
-}
-
-bool InspectorPageAgent::shouldApplyScreenWidthOverride()
-{
-    long width = 0;
-    applyScreenWidthOverride(&width);
-    return !!width;
-}
-
-void InspectorPageAgent::applyScreenHeightOverride(long* height)
-{
-    long heightOverride = m_state->getLong(PageAgentState::pageAgentScreenHeightOverride);
-    if (heightOverride)
-        *height = heightOverride;
-}
-
-bool InspectorPageAgent::shouldApplyScreenHeightOverride()
-{
-    long height = 0;
-    applyScreenHeightOverride(&height);
-    return !!height;
-}
-
 void InspectorPageAgent::didPaint(RenderObject*, GraphicsContext* context, const LayoutRect& rect)
 {
     if (!m_enabled || m_client->overridesShowPaintRects() || !m_state->getBoolean(PageAgentState::pageAgentShowPaintRects))
@@ -1019,20 +992,8 @@
 
 void InspectorPageAgent::didLayout(RenderObject*)
 {
-    bool isFirstLayout = m_isFirstLayoutAfterOnLoad;
-    if (isFirstLayout)
-        m_isFirstLayoutAfterOnLoad = false;
-
     if (!m_enabled)
         return;
-
-    if (isFirstLayout) {
-        int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
-        int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
-
-        if (currentWidth && currentHeight)
-            m_client->autoZoomPageToFitWidth();
-    }
     m_overlay->update();
 }
 
@@ -1116,15 +1077,21 @@
     return result;
 }
 
-void InspectorPageAgent::updateViewMetrics(int width, int height, double fontScaleFactor, bool fitWindow)
+void InspectorPageAgent::updateViewMetrics(int width, int height, double deviceScaleFactor, bool fitWindow)
 {
-    m_client->overrideDeviceMetrics(width, height, static_cast<float>(fontScaleFactor), fitWindow);
+    m_client->overrideDeviceMetrics(width, height, static_cast<float>(deviceScaleFactor), fitWindow);
 
     Document* document = mainFrame()->document();
     if (document)
         document->styleResolverChanged(RecalcStyleImmediately);
     InspectorInstrumentation::mediaQueryResultChanged(document);
     m_overlay->setOverride(InspectorOverlay::DeviceMetricsOverride, width && height);
+
+    // FIXME: allow metrics override, fps counter and continuous painting at the same time: crbug.com/299837.
+    bool override = width && height;
+    m_client->setShowFPSCounter(m_state->getBoolean(PageAgentState::pageAgentShowFPSCounter) && !override);
+    m_client->setContinuousPaintingEnabled(m_state->getBoolean(PageAgentState::pageAgentContinuousPaintingEnabled) && !override);
+    updateOverridesTopOffset();
 }
 
 void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled)
@@ -1144,7 +1111,10 @@
         topOffset = continousPaintingGraphHeight;
     else if (m_state->getBoolean(PageAgentState::pageAgentShowFPSCounter))
         topOffset = fpsGraphHeight;
-    m_overlay->setOverridesTopOffset(topOffset);
+    // FIXME: allow metrics override, fps counter and continuous painting at the same time: crbug.com/299837.
+    bool setOffset = false;
+    if (setOffset)
+        m_overlay->setOverridesTopOffset(topOffset);
 }
 
 void InspectorPageAgent::setGeolocationOverride(ErrorString* error, const double* latitude, const double* longitude, const double* accuracy)
@@ -1194,7 +1164,7 @@
 
 void InspectorPageAgent::setDeviceOrientationOverride(ErrorString* error, double alpha, double beta, double gamma)
 {
-    DeviceOrientationController* controller = DeviceOrientationController::from(m_page);
+    NewDeviceOrientationController* controller = NewDeviceOrientationController::from(mainFrame()->document());
     if (!controller) {
         *error = "Internal error: unable to override device orientation";
         return;
diff --git a/Source/core/inspector/InspectorPageAgent.h b/Source/core/inspector/InspectorPageAgent.h
index b1dd8ac..49679d6 100644
--- a/Source/core/inspector/InspectorPageAgent.h
+++ b/Source/core/inspector/InspectorPageAgent.h
@@ -101,7 +101,7 @@
     virtual void searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> >&);
     virtual void searchInResources(ErrorString*, const String&, const bool* caseSensitive, const bool* isRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchResult> >&);
     virtual void setDocumentContent(ErrorString*, const String& frameId, const String& html);
-    virtual void setDeviceMetricsOverride(ErrorString*, int width, int height, double fontScaleFactor, bool fitWindow);
+    virtual void setDeviceMetricsOverride(ErrorString*, int width, int height, double deviceScaleFactor, bool fitWindow);
     virtual void setShowPaintRects(ErrorString*, bool show);
     virtual void setShowDebugBorders(ErrorString*, bool show);
     virtual void setShowFPSCounter(ErrorString*, bool show);
@@ -203,7 +203,6 @@
     HashMap<String, Frame*> m_identifierToFrame;
     HashMap<DocumentLoader*, String> m_loaderToIdentifier;
     bool m_enabled;
-    bool m_isFirstLayoutAfterOnLoad;
     bool m_geolocationOverridden;
     bool m_ignoreScriptsEnabledNotification;
     bool m_didForceCompositingMode;
diff --git a/Source/core/inspector/InspectorProfilerAgent.cpp b/Source/core/inspector/InspectorProfilerAgent.cpp
index 1eeca34..f9ec494 100644
--- a/Source/core/inspector/InspectorProfilerAgent.cpp
+++ b/Source/core/inspector/InspectorProfilerAgent.cpp
@@ -40,7 +40,7 @@
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/inspector/ScriptCallStack.h"
 #include "core/inspector/ScriptProfile.h"
-#include "core/page/ConsoleTypes.h"
+#include "core/frame/ConsoleTypes.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/text/StringConcatenate.h"
 
@@ -50,7 +50,6 @@
 static const char samplingInterval[] = "samplingInterval";
 static const char userInitiatedProfiling[] = "userInitiatedProfiling";
 static const char profilerEnabled[] = "profilerEnabled";
-static const char profileHeadersRequested[] = "profileHeadersRequested";
 }
 
 static const char* const CPUProfileType = "CPU";
@@ -81,7 +80,7 @@
 {
     RefPtr<ScriptProfile> profile = prpProfile;
     m_profiles.add(profile->uid(), profile);
-    if (m_frontend && m_state->getBoolean(ProfilerAgentState::profileHeadersRequested))
+    if (m_frontend && m_state->getBoolean(ProfilerAgentState::profilerEnabled))
         m_frontend->addProfileHeader(createProfileHeader(*profile));
     addProfileFinishedMessageToConsole(profile, lineNumber, sourceURL);
 }
@@ -124,7 +123,6 @@
 {
     m_instrumentingAgents->setInspectorProfilerAgent(0);
     m_state->setBoolean(ProfilerAgentState::profilerEnabled, false);
-    m_state->setBoolean(ProfilerAgentState::profileHeadersRequested, false);
 }
 
 bool InspectorProfilerAgent::enabled()
@@ -150,16 +148,6 @@
     return "Profile " + String::number(m_currentUserInitiatedProfileNumber);
 }
 
-void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader> >& headers)
-{
-    m_state->setBoolean(ProfilerAgentState::profileHeadersRequested, true);
-    headers = TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader>::create();
-
-    ProfilesMap::iterator profilesEnd = m_profiles.end();
-    for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it)
-        headers->addItem(createProfileHeader(*it->value));
-}
-
 void InspectorProfilerAgent::getCPUProfile(ErrorString* errorString, int rawUid, RefPtr<TypeBuilder::Profiler::CPUProfile>& profileObject)
 {
     unsigned uid = static_cast<unsigned>(rawUid);
@@ -198,7 +186,7 @@
 {
     if (!m_frontend)
         return;
-    if (!m_state->getBoolean(ProfilerAgentState::profileHeadersRequested))
+    if (!m_state->getBoolean(ProfilerAgentState::profilerEnabled))
         return;
     if (m_profiles.isEmpty())
         m_frontend->resetProfiles();
@@ -212,8 +200,8 @@
 void InspectorProfilerAgent::clearFrontend()
 {
     m_frontend = 0;
-    stop();
     ErrorString error;
+    clearProfiles(&error);
     disable(&error);
 }
 
diff --git a/Source/core/inspector/InspectorProfilerAgent.h b/Source/core/inspector/InspectorProfilerAgent.h
index 1f9c2a0..2c0ed70 100644
--- a/Source/core/inspector/InspectorProfilerAgent.h
+++ b/Source/core/inspector/InspectorProfilerAgent.h
@@ -67,7 +67,6 @@
 
     bool enabled();
     String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
-    virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader> >&);
     virtual void getCPUProfile(ErrorString*, int uid, RefPtr<TypeBuilder::Profiler::CPUProfile>&);
     virtual void removeProfile(ErrorString*, const String& type, int uid);
 
diff --git a/Source/core/inspector/InspectorResourceAgent.cpp b/Source/core/inspector/InspectorResourceAgent.cpp
index 643b99c..0bd9426 100644
--- a/Source/core/inspector/InspectorResourceAgent.cpp
+++ b/Source/core/inspector/InspectorResourceAgent.cpp
@@ -55,17 +55,17 @@
 #include "core/loader/FrameLoader.h"
 #include "core/loader/ThreadableLoader.h"
 #include "core/loader/ThreadableLoaderClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
-#include "core/platform/JSONValues.h"
-#include "core/platform/network/HTTPHeaderMap.h"
-#include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
 #include "core/xml/XMLHttpRequest.h"
 #include "modules/websockets/WebSocketFrame.h"
 #include "modules/websockets/WebSocketHandshakeRequest.h"
 #include "modules/websockets/WebSocketHandshakeResponse.h"
+#include "platform/JSONValues.h"
+#include "platform/network/HTTPHeaderMap.h"
+#include "platform/network/ResourceError.h"
 #include "weborigin/KURL.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/RefPtr.h"
@@ -287,7 +287,8 @@
 
 void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& initiatorInfo)
 {
-    if (initiatorInfo.name == FetchInitiatorTypeNames::inspector)
+    // Ignore the request initiated internally.
+    if (initiatorInfo.name == FetchInitiatorTypeNames::internal)
         return;
     String requestId = IdentifiersFactory::requestId(identifier);
     m_resourcesData->resourceCreated(requestId, m_pageAgent->loaderId(loader));
diff --git a/Source/core/inspector/InspectorRuntimeAgent.cpp b/Source/core/inspector/InspectorRuntimeAgent.cpp
index 2568d13..fcb3a27 100644
--- a/Source/core/inspector/InspectorRuntimeAgent.cpp
+++ b/Source/core/inspector/InspectorRuntimeAgent.cpp
@@ -33,7 +33,7 @@
 
 #include "core/inspector/InjectedScript.h"
 #include "core/inspector/InjectedScriptManager.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 
 
 #include "bindings/v8/ScriptDebugServer.h"
diff --git a/Source/core/inspector/InspectorState.h b/Source/core/inspector/InspectorState.h
index 0679736..65dcc0f 100644
--- a/Source/core/inspector/InspectorState.h
+++ b/Source/core/inspector/InspectorState.h
@@ -32,7 +32,7 @@
 #define InspectorState_h
 
 
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/HashMap.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/inspector/InspectorStyleSheet.cpp b/Source/core/inspector/InspectorStyleSheet.cpp
index 54e9ee3..43ec8f3 100644
--- a/Source/core/inspector/InspectorStyleSheet.cpp
+++ b/Source/core/inspector/InspectorStyleSheet.cpp
@@ -53,8 +53,8 @@
 #include "core/inspector/InspectorResourceAgent.h"
 #include "core/page/Page.h"
 #include "core/page/PageConsole.h"
-#include "core/platform/JSONValues.h"
 #include "core/platform/text/RegularExpression.h"
+#include "platform/JSONValues.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/inspector/InspectorStyleSheet.h b/Source/core/inspector/InspectorStyleSheet.h
index 69d43a9..ccab1bf 100644
--- a/Source/core/inspector/InspectorStyleSheet.h
+++ b/Source/core/inspector/InspectorStyleSheet.h
@@ -29,7 +29,7 @@
 #include "core/css/CSSPropertySourceData.h"
 #include "core/css/CSSStyleDeclaration.h"
 #include "core/inspector/InspectorStyleTextEditor.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/HashMap.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/inspector/InspectorTimelineAgent.cpp b/Source/core/inspector/InspectorTimelineAgent.cpp
index 411818e..80ede35 100644
--- a/Source/core/inspector/InspectorTimelineAgent.cpp
+++ b/Source/core/inspector/InspectorTimelineAgent.cpp
@@ -45,17 +45,17 @@
 #include "core/inspector/TimelineRecordFactory.h"
 #include "core/inspector/TimelineTraceEventProcessor.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/PageConsole.h"
 #include "core/platform/MemoryUsageSupport.h"
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/graphics/chromium/DeferredImageDecoder.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderView.h"
 #include "core/xml/XMLHttpRequest.h"
+#include "platform/TraceEvent.h"
 
 #include "wtf/CurrentTime.h"
 
@@ -67,7 +67,6 @@
 static const char startedFromProtocol[] = "startedFromProtocol";
 static const char timelineMaxCallStackDepth[] = "timelineMaxCallStackDepth";
 static const char includeDomCounters[] = "includeDomCounters";
-static const char includeNativeMemoryStatistics[] = "includeNativeMemoryStatistics";
 static const char bufferEvents[] = "bufferEvents";
 }
 
@@ -133,7 +132,7 @@
 const char InternalEventCategory[] = "instrumentation";
 }
 
-static Frame* frameForScriptExecutionContext(ScriptExecutionContext* context)
+static Frame* frameForExecutionContext(ExecutionContext* context)
 {
     Frame* frame = 0;
     if (context->isDocument())
@@ -226,7 +225,7 @@
     m_state->setBoolean(TimelineAgentState::enabled, false);
 }
 
-void InspectorTimelineAgent::start(ErrorString* errorString, const int* maxCallStackDepth, const bool* bufferEvents, const bool* includeDomCounters, const bool* includeNativeMemoryStatistics)
+void InspectorTimelineAgent::start(ErrorString* errorString, const int* maxCallStackDepth, const bool* bufferEvents, const bool* includeDomCounters)
 {
     if (!m_frontend)
         return;
@@ -248,7 +247,6 @@
 
     m_state->setLong(TimelineAgentState::timelineMaxCallStackDepth, m_maxCallStackDepth);
     m_state->setBoolean(TimelineAgentState::includeDomCounters, includeDomCounters && *includeDomCounters);
-    m_state->setBoolean(TimelineAgentState::includeNativeMemoryStatistics, includeNativeMemoryStatistics && *includeNativeMemoryStatistics);
     m_state->setBoolean(TimelineAgentState::bufferEvents, bufferEvents && *bufferEvents);
 
     innerStart();
@@ -320,9 +318,9 @@
     m_pendingFrameRecord.clear();
 }
 
-bool InspectorTimelineAgent::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine)
+bool InspectorTimelineAgent::willCallFunction(ExecutionContext* context, const String& scriptName, int scriptLine)
 {
-    pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall, true, frameForScriptExecutionContext(context));
+    pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall, true, frameForExecutionContext(context));
     return true;
 }
 
@@ -517,19 +515,19 @@
     }
 }
 
-void InspectorTimelineAgent::didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot)
+void InspectorTimelineAgent::didInstallTimer(ExecutionContext* context, int timerId, int timeout, bool singleShot)
 {
-    appendRecord(TimelineRecordFactory::createTimerInstallData(timerId, timeout, singleShot), TimelineRecordType::TimerInstall, true, frameForScriptExecutionContext(context));
+    appendRecord(TimelineRecordFactory::createTimerInstallData(timerId, timeout, singleShot), TimelineRecordType::TimerInstall, true, frameForExecutionContext(context));
 }
 
-void InspectorTimelineAgent::didRemoveTimer(ScriptExecutionContext* context, int timerId)
+void InspectorTimelineAgent::didRemoveTimer(ExecutionContext* context, int timerId)
 {
-    appendRecord(TimelineRecordFactory::createGenericTimerData(timerId), TimelineRecordType::TimerRemove, true, frameForScriptExecutionContext(context));
+    appendRecord(TimelineRecordFactory::createGenericTimerData(timerId), TimelineRecordType::TimerRemove, true, frameForExecutionContext(context));
 }
 
-bool InspectorTimelineAgent::willFireTimer(ScriptExecutionContext* context, int timerId)
+bool InspectorTimelineAgent::willFireTimer(ExecutionContext* context, int timerId)
 {
-    pushCurrentRecord(TimelineRecordFactory::createGenericTimerData(timerId), TimelineRecordType::TimerFire, false, frameForScriptExecutionContext(context));
+    pushCurrentRecord(TimelineRecordFactory::createGenericTimerData(timerId), TimelineRecordType::TimerFire, false, frameForExecutionContext(context));
     return true;
 }
 
@@ -538,11 +536,11 @@
     didCompleteCurrentRecord(TimelineRecordType::TimerFire);
 }
 
-bool InspectorTimelineAgent::willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext* context, XMLHttpRequest* request)
+bool InspectorTimelineAgent::willDispatchXHRReadyStateChangeEvent(ExecutionContext* context, XMLHttpRequest* request)
 {
-    if (!request->hasEventListeners(eventNames().readystatechangeEvent))
+    if (!request->hasEventListeners(EventTypeNames::readystatechange))
         return false;
-    pushCurrentRecord(TimelineRecordFactory::createXHRReadyStateChangeData(request->url().string(), request->readyState()), TimelineRecordType::XHRReadyStateChange, false, frameForScriptExecutionContext(context));
+    pushCurrentRecord(TimelineRecordFactory::createXHRReadyStateChangeData(request->url().string(), request->readyState()), TimelineRecordType::XHRReadyStateChange, false, frameForExecutionContext(context));
     return true;
 }
 
@@ -551,11 +549,11 @@
     didCompleteCurrentRecord(TimelineRecordType::XHRReadyStateChange);
 }
 
-bool InspectorTimelineAgent::willDispatchXHRLoadEvent(ScriptExecutionContext* context, XMLHttpRequest* request)
+bool InspectorTimelineAgent::willDispatchXHRLoadEvent(ExecutionContext* context, XMLHttpRequest* request)
 {
-    if (!request->hasEventListeners(eventNames().loadEvent))
+    if (!request->hasEventListeners(EventTypeNames::load))
         return false;
-    pushCurrentRecord(TimelineRecordFactory::createXHRLoadData(request->url().string()), TimelineRecordType::XHRLoad, true, frameForScriptExecutionContext(context));
+    pushCurrentRecord(TimelineRecordFactory::createXHRLoadData(request->url().string()), TimelineRecordType::XHRLoad, true, frameForExecutionContext(context));
     return true;
 }
 
@@ -630,22 +628,22 @@
     didFinishLoadingResource(identifier, true, 0, loader->frame());
 }
 
-void InspectorTimelineAgent::consoleTimeStamp(ScriptExecutionContext* context, const String& title)
+void InspectorTimelineAgent::consoleTimeStamp(ExecutionContext* context, const String& title)
 {
-    appendRecord(TimelineRecordFactory::createTimeStampData(title), TimelineRecordType::TimeStamp, true, frameForScriptExecutionContext(context));
+    appendRecord(TimelineRecordFactory::createTimeStampData(title), TimelineRecordType::TimeStamp, true, frameForExecutionContext(context));
 }
 
-void InspectorTimelineAgent::consoleTime(ScriptExecutionContext* context, const String& message)
+void InspectorTimelineAgent::consoleTime(ExecutionContext* context, const String& message)
 {
-    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::Time, true, frameForScriptExecutionContext(context));
+    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::Time, true, frameForExecutionContext(context));
 }
 
-void InspectorTimelineAgent::consoleTimeEnd(ScriptExecutionContext* context, const String& message, ScriptState*)
+void InspectorTimelineAgent::consoleTimeEnd(ExecutionContext* context, const String& message, ScriptState*)
 {
-    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeEnd, true, frameForScriptExecutionContext(context));
+    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeEnd, true, frameForExecutionContext(context));
 }
 
-void InspectorTimelineAgent::consoleTimeline(ScriptExecutionContext* context, const String& title, ScriptState* state)
+void InspectorTimelineAgent::consoleTimeline(ExecutionContext* context, const String& title, ScriptState* state)
 {
     if (!m_state->getBoolean(TimelineAgentState::enabled))
         return;
@@ -658,10 +656,10 @@
         bool fromConsole = true;
         m_frontend->started(&fromConsole);
     }
-    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeStamp, true, frameForScriptExecutionContext(context));
+    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeStamp, true, frameForExecutionContext(context));
 }
 
-void InspectorTimelineAgent::consoleTimelineEnd(ScriptExecutionContext* context, const String& title, ScriptState* state)
+void InspectorTimelineAgent::consoleTimelineEnd(ExecutionContext* context, const String& title, ScriptState* state)
 {
     if (!m_state->getBoolean(TimelineAgentState::enabled))
         return;
@@ -674,7 +672,7 @@
     }
 
     String message = String::format("Timeline '%s' finished.", title.utf8().data());
-    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeStamp, true, frameForScriptExecutionContext(context));
+    appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeStamp, true, frameForExecutionContext(context));
     m_consoleTimelines.remove(index);
     if (!m_consoleTimelines.size() && isStarted() && !m_state->getBoolean(TimelineAgentState::startedFromProtocol))
         innerStop(true);
@@ -782,11 +780,12 @@
     if (m_state->getBoolean(TimelineAgentState::includeDomCounters)) {
         int documentCount = 0;
         int nodeCount = 0;
+        int listenerCount = 0;
         if (m_inspectorType == PageInspector) {
             documentCount = InspectorCounters::counterValue(InspectorCounters::DocumentCounter);
             nodeCount = InspectorCounters::counterValue(InspectorCounters::NodeCounter);
+            listenerCount = InspectorCounters::counterValue(InspectorCounters::JSEventListenerCounter);
         }
-        int listenerCount = ThreadLocalInspectorCounters::current().counterValue(ThreadLocalInspectorCounters::JSEventListenerCounter);
         RefPtr<TypeBuilder::Timeline::DOMCounters> counters = TypeBuilder::Timeline::DOMCounters::create()
             .setDocuments(documentCount)
             .setNodes(nodeCount)
diff --git a/Source/core/inspector/InspectorTimelineAgent.h b/Source/core/inspector/InspectorTimelineAgent.h
index 1f2d8f2..a792337 100644
--- a/Source/core/inspector/InspectorTimelineAgent.h
+++ b/Source/core/inspector/InspectorTimelineAgent.h
@@ -37,9 +37,9 @@
 #include "core/events/EventContext.h"
 #include "core/inspector/InspectorBaseAgent.h"
 #include "core/inspector/ScriptGCEventListener.h"
-#include "core/platform/JSONValues.h"
 #include "core/platform/PlatformInstrumentation.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/JSONValues.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/WeakPtr.h"
@@ -70,7 +70,7 @@
 class ResourceResponse;
 class ScriptArguments;
 class ScriptCallStack;
-class ScriptExecutionContext;
+class ExecutionContext;
 class ScriptState;
 class TimelineTraceEventProcessor;
 class WebSocketHandshakeRequest;
@@ -120,7 +120,7 @@
 
     virtual void enable(ErrorString*);
     virtual void disable(ErrorString*);
-    virtual void start(ErrorString*, const int* maxCallStackDepth, const bool* bufferEvents, const bool* includeDomCounters, const bool* includeNativeMemoryStatistics);
+    virtual void start(ErrorString*, const int* maxCallStackDepth, const bool* bufferEvents, const bool* includeDomCounters);
     virtual void stop(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Timeline::TimelineEvent> >& events);
 
     void setLayerTreeId(int layerTreeId) { m_layerTreeId = layerTreeId; }
@@ -130,7 +130,7 @@
     void didCommitLoad();
 
     // Methods called from WebCore.
-    bool willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine);
+    bool willCallFunction(ExecutionContext*, const String& scriptName, int scriptLine);
     void didCallFunction();
 
     bool willDispatchEvent(Document* document, const Event& event, DOMWindow* window, Node* node, const EventPath& eventPath);
@@ -165,27 +165,27 @@
     bool willWriteHTML(Document*, unsigned startLine);
     void didWriteHTML(unsigned endLine);
 
-    void didInstallTimer(ScriptExecutionContext* context, int timerId, int timeout, bool singleShot);
-    void didRemoveTimer(ScriptExecutionContext* context, int timerId);
-    bool willFireTimer(ScriptExecutionContext* context, int timerId);
+    void didInstallTimer(ExecutionContext*, int timerId, int timeout, bool singleShot);
+    void didRemoveTimer(ExecutionContext*, int timerId);
+    bool willFireTimer(ExecutionContext*, int timerId);
     void didFireTimer();
 
-    bool willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext* context, XMLHttpRequest* request);
+    bool willDispatchXHRReadyStateChangeEvent(ExecutionContext*, XMLHttpRequest*);
     void didDispatchXHRReadyStateChangeEvent();
-    bool willDispatchXHRLoadEvent(ScriptExecutionContext* context, XMLHttpRequest* request);
+    bool willDispatchXHRLoadEvent(ExecutionContext*, XMLHttpRequest*);
     void didDispatchXHRLoadEvent();
 
     bool willEvaluateScript(Frame*, const String&, int);
     void didEvaluateScript();
 
-    void consoleTimeStamp(ScriptExecutionContext*, const String& title);
+    void consoleTimeStamp(ExecutionContext*, const String& title);
     void domContentLoadedEventFired(Frame*);
     void loadEventFired(Frame*);
 
-    void consoleTime(ScriptExecutionContext*, const String&);
-    void consoleTimeEnd(ScriptExecutionContext*, const String&, ScriptState*);
-    void consoleTimeline(ScriptExecutionContext*, const String& title, ScriptState*);
-    void consoleTimelineEnd(ScriptExecutionContext*, const String& title, ScriptState*);
+    void consoleTime(ExecutionContext*, const String&);
+    void consoleTimeEnd(ExecutionContext*, const String&, ScriptState*);
+    void consoleTimeline(ExecutionContext*, const String& title, ScriptState*);
+    void consoleTimelineEnd(ExecutionContext*, const String& title, ScriptState*);
 
     void didScheduleResourceRequest(Document*, const String& url);
     void willSendRequest(unsigned long, DocumentLoader*, const ResourceRequest&, const ResourceResponse&, const FetchInitiatorInfo&);
diff --git a/Source/core/inspector/InspectorWorkerAgent.cpp b/Source/core/inspector/InspectorWorkerAgent.cpp
index 4665d47..c2cffe3 100644
--- a/Source/core/inspector/InspectorWorkerAgent.cpp
+++ b/Source/core/inspector/InspectorWorkerAgent.cpp
@@ -36,8 +36,8 @@
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/inspector/JSONParser.h"
-#include "core/platform/JSONValues.h"
 #include "core/workers/WorkerGlobalScopeProxy.h"
+#include "platform/JSONValues.h"
 #include "weborigin/KURL.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/inspector/JSONParser.cpp b/Source/core/inspector/JSONParser.cpp
index bf364db..58adb02 100644
--- a/Source/core/inspector/JSONParser.cpp
+++ b/Source/core/inspector/JSONParser.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/inspector/JSONParser.h"
 
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
@@ -271,7 +271,7 @@
 bool decodeString(const CharType* start, const CharType* end, StringBuilder* output)
 {
     while (start < end) {
-        CharType c = *start++;
+        UChar c = *start++;
         if ('\\' != c) {
             output->append(c);
             continue;
diff --git a/Source/core/inspector/NetworkResourcesData.cpp b/Source/core/inspector/NetworkResourcesData.cpp
index 7ba8df6..d387135 100644
--- a/Source/core/inspector/NetworkResourcesData.cpp
+++ b/Source/core/inspector/NetworkResourcesData.cpp
@@ -32,7 +32,7 @@
 #include "core/dom/DOMImplementation.h"
 #include "core/fetch/Resource.h"
 #include "core/fetch/TextResourceDecoder.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/network/ResourceResponse.h"
 
 namespace {
diff --git a/Source/core/inspector/NetworkResourcesData.h b/Source/core/inspector/NetworkResourcesData.h
index 52b1cfa..f7c85e5 100644
--- a/Source/core/inspector/NetworkResourcesData.h
+++ b/Source/core/inspector/NetworkResourcesData.h
@@ -31,7 +31,7 @@
 
 #include "core/fetch/TextResourceDecoder.h"
 #include "core/inspector/InspectorPageAgent.h"
-#include "core/platform/network/HTTPHeaderMap.h"
+#include "platform/network/HTTPHeaderMap.h"
 #include "weborigin/KURL.h"
 #include "wtf/Deque.h"
 #include "wtf/HashMap.h"
diff --git a/Source/core/inspector/PageDebuggerAgent.cpp b/Source/core/inspector/PageDebuggerAgent.cpp
index f7410c9..145eb0c 100644
--- a/Source/core/inspector/PageDebuggerAgent.cpp
+++ b/Source/core/inspector/PageDebuggerAgent.cpp
@@ -39,7 +39,7 @@
 #include "core/inspector/InspectorPageAgent.h"
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/PageConsole.h"
 
diff --git a/Source/core/inspector/PageRuntimeAgent.cpp b/Source/core/inspector/PageRuntimeAgent.cpp
index c6e81e5..aa8bac6 100644
--- a/Source/core/inspector/PageRuntimeAgent.cpp
+++ b/Source/core/inspector/PageRuntimeAgent.cpp
@@ -38,7 +38,7 @@
 #include "core/inspector/InspectorPageAgent.h"
 #include "core/inspector/InspectorState.h"
 #include "core/inspector/InstrumentingAgents.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/PageConsole.h"
 #include "weborigin/SecurityOrigin.h"
diff --git a/Source/core/inspector/ScriptProfile.cpp b/Source/core/inspector/ScriptProfile.cpp
index 7894f80..e77883e 100644
--- a/Source/core/inspector/ScriptProfile.cpp
+++ b/Source/core/inspector/ScriptProfile.cpp
@@ -85,6 +85,7 @@
         .setScriptId(String::number(node->GetScriptId()))
         .setUrl(toWebCoreString(node->GetScriptResourceName()))
         .setLineNumber(node->GetLineNumber())
+        .setColumnNumber(node->GetColumnNumber())
         .setHitCount(node->GetHitCount())
         .setCallUID(node->GetCallUid())
         .setChildren(children.release())
diff --git a/Source/core/inspector/TimelineRecordFactory.cpp b/Source/core/inspector/TimelineRecordFactory.cpp
index 6a31dc6..57a539e 100644
--- a/Source/core/inspector/TimelineRecordFactory.cpp
+++ b/Source/core/inspector/TimelineRecordFactory.cpp
@@ -34,11 +34,11 @@
 #include "bindings/v8/ScriptCallStackFactory.h"
 #include "core/events/Event.h"
 #include "core/inspector/ScriptCallStack.h"
-#include "core/platform/JSONValues.h"
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/LayoutRect.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
+#include "platform/JSONValues.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/CurrentTime.h"
 
 namespace WebCore {
diff --git a/Source/core/inspector/TimelineRecordFactory.h b/Source/core/inspector/TimelineRecordFactory.h
index bb2df6a..9c91f3d 100644
--- a/Source/core/inspector/TimelineRecordFactory.h
+++ b/Source/core/inspector/TimelineRecordFactory.h
@@ -31,7 +31,7 @@
 #ifndef TimelineRecordFactory_h
 #define TimelineRecordFactory_h
 
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "weborigin/KURL.h"
 #include "wtf/Forward.h"
 #include "wtf/text/WTFString.h"
diff --git a/Source/core/inspector/TimelineTraceEventProcessor.h b/Source/core/inspector/TimelineTraceEventProcessor.h
index 485f0be..8171fba 100644
--- a/Source/core/inspector/TimelineTraceEventProcessor.h
+++ b/Source/core/inspector/TimelineTraceEventProcessor.h
@@ -33,7 +33,7 @@
 
 
 #include "core/inspector/InspectorTimelineAgent.h"
-#include "core/platform/JSONValues.h"
+#include "platform/JSONValues.h"
 #include "wtf/HashMap.h"
 #include "wtf/Threading.h"
 #include "wtf/ThreadingPrimitives.h"
diff --git a/Source/core/inspector_overlay_page.target.darwin-arm.mk b/Source/core/inspector_overlay_page.target.darwin-arm.mk
index fcef9cd..d871016 100644
--- a/Source/core/inspector_overlay_page.target.darwin-arm.mk
+++ b/Source/core/inspector_overlay_page.target.darwin-arm.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h from inspector/InspectorOverlayPage.html ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
 
 
 
diff --git a/Source/core/inspector_overlay_page.target.darwin-mips.mk b/Source/core/inspector_overlay_page.target.darwin-mips.mk
index fcef9cd..d871016 100644
--- a/Source/core/inspector_overlay_page.target.darwin-mips.mk
+++ b/Source/core/inspector_overlay_page.target.darwin-mips.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h from inspector/InspectorOverlayPage.html ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
 
 
 
diff --git a/Source/core/inspector_overlay_page.target.darwin-x86.mk b/Source/core/inspector_overlay_page.target.darwin-x86.mk
index fcef9cd..d871016 100644
--- a/Source/core/inspector_overlay_page.target.darwin-x86.mk
+++ b/Source/core/inspector_overlay_page.target.darwin-x86.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h from inspector/InspectorOverlayPage.html ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
 
 
 
diff --git a/Source/core/inspector_overlay_page.target.linux-arm.mk b/Source/core/inspector_overlay_page.target.linux-arm.mk
index fcef9cd..d871016 100644
--- a/Source/core/inspector_overlay_page.target.linux-arm.mk
+++ b/Source/core/inspector_overlay_page.target.linux-arm.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h from inspector/InspectorOverlayPage.html ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
 
 
 
diff --git a/Source/core/inspector_overlay_page.target.linux-mips.mk b/Source/core/inspector_overlay_page.target.linux-mips.mk
index fcef9cd..d871016 100644
--- a/Source/core/inspector_overlay_page.target.linux-mips.mk
+++ b/Source/core/inspector_overlay_page.target.linux-mips.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h from inspector/InspectorOverlayPage.html ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
 
 
 
diff --git a/Source/core/inspector_overlay_page.target.linux-x86.mk b/Source/core/inspector_overlay_page.target.linux-x86.mk
index fcef9cd..d871016 100644
--- a/Source/core/inspector_overlay_page.target.linux-x86.mk
+++ b/Source/core/inspector_overlay_page.target.linux-x86.mk
@@ -18,9 +18,9 @@
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/xxd.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/inspector/InspectorOverlayPage.html $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating $(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h from inspector/InspectorOverlayPage.html ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl InspectorOverlayPage_html inspector/InspectorOverlayPage.html "$(gyp_shared_intermediate_dir)/blink/InspectorOverlayPage.h"
 
 
 
diff --git a/Source/core/loader/CookieJar.cpp b/Source/core/loader/CookieJar.cpp
index 9d6821a..79d6b54 100644
--- a/Source/core/loader/CookieJar.cpp
+++ b/Source/core/loader/CookieJar.cpp
@@ -33,7 +33,7 @@
 
 #include "core/dom/Document.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/platform/Cookie.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCookie.h"
diff --git a/Source/core/loader/DocumentLoader.cpp b/Source/core/loader/DocumentLoader.cpp
index fac3be3..c0c2654 100644
--- a/Source/core/loader/DocumentLoader.cpp
+++ b/Source/core/loader/DocumentLoader.cpp
@@ -31,7 +31,6 @@
 #include "core/loader/DocumentLoader.h"
 
 #include "FetchInitiatorTypeNames.h"
-#include "bindings/v8/ScriptController.h"
 #include "core/dom/DOMImplementation.h"
 #include "core/dom/Document.h"
 #include "core/dom/DocumentParser.h"
@@ -51,13 +50,15 @@
 #include "core/loader/appcache/ApplicationCacheHost.h"
 #include "core/loader/archive/ArchiveResourceCollection.h"
 #include "core/loader/archive/MHTMLArchive.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/Logging.h"
 #include "core/plugins/PluginData.h"
+#include "platform/Logging.h"
+#include "platform/UserGestureIndicator.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebMimeRegistry.h"
 #include "weborigin/SchemeRegistry.h"
@@ -381,7 +382,7 @@
         return true;
     if (policy == NavigationPolicyIgnore)
         return false;
-    if (!DOMWindow::allowPopUp(m_frame) && !ScriptController::processingUserGesture())
+    if (!DOMWindow::allowPopUp(m_frame) && !UserGestureIndicator::processingUserGesture())
         return false;
     frameLoader()->client()->loadURLExternally(request, policy);
     return false;
@@ -515,7 +516,7 @@
             frame()->document()->addConsoleMessageWithRequestIdentifier(SecurityMessageSource, ErrorMessageLevel, message, identifier);
             frame()->document()->enforceSandboxFlags(SandboxOrigin);
             if (HTMLFrameOwnerElement* ownerElement = frame()->ownerElement())
-                ownerElement->dispatchEvent(Event::create(eventNames().loadEvent));
+                ownerElement->dispatchEvent(Event::create(EventTypeNames::load));
 
             // The load event might have detached this frame. In that case, the load will already have been cancelled during detach.
             if (frameLoader())
@@ -758,17 +759,6 @@
     return true;
 }
 
-KURL DocumentLoader::urlForHistory() const
-{
-    // Return the URL to be used for history and B/F list.
-    // Returns nil for WebDataProtocol URLs that aren't alternates
-    // for unreachable URLs, because these can't be stored in history.
-    if (m_substituteData.isValid())
-        return unreachableURL();
-
-    return m_originalRequestCopy.url();
-}
-
 const KURL& DocumentLoader::originalURL() const
 {
     return m_originalRequestCopy.url();
@@ -909,7 +899,7 @@
         options = ClearWindowProperties | ClearScriptObjects;
     frame->loader()->clear(options);
 
-    if (frame->document() && frame->document()->attached())
+    if (frame->document())
         frame->document()->prepareForDestruction();
 
     if (!shouldReuseDefaultView)
diff --git a/Source/core/loader/DocumentLoader.h b/Source/core/loader/DocumentLoader.h
index 7fe971f..89eee23 100644
--- a/Source/core/loader/DocumentLoader.h
+++ b/Source/core/loader/DocumentLoader.h
@@ -37,10 +37,10 @@
 #include "core/loader/DocumentWriter.h"
 #include "core/loader/NavigationAction.h"
 #include "core/loader/SubstituteData.h"
-#include "core/platform/Timer.h"
-#include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
+#include "platform/Timer.h"
+#include "platform/network/ResourceError.h"
 #include "wtf/HashSet.h"
 #include "wtf/RefPtr.h"
 
@@ -131,8 +131,6 @@
 
         void setOverrideEncoding(const String& encoding) { m_overrideEncoding = encoding; }
 
-        KURL urlForHistory() const;
-
         void setDefersLoading(bool);
 
         void startLoadingMainResource();
diff --git a/Source/core/loader/DocumentThreadableLoader.cpp b/Source/core/loader/DocumentThreadableLoader.cpp
index c12ac96..b644083 100644
--- a/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/Source/core/loader/DocumentThreadableLoader.cpp
@@ -43,11 +43,11 @@
 #include "core/loader/DocumentThreadableLoaderClient.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/ThreadableLoaderClient.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/Frame.h"
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/network/ResourceError.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/Frame.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/network/ResourceRequest.h"
+#include "platform/network/ResourceError.h"
 #include "weborigin/SchemeRegistry.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/Assertions.h"
diff --git a/Source/core/loader/DocumentThreadableLoader.h b/Source/core/loader/DocumentThreadableLoader.h
index df0e851..77139bd 100644
--- a/Source/core/loader/DocumentThreadableLoader.h
+++ b/Source/core/loader/DocumentThreadableLoader.h
@@ -35,8 +35,8 @@
 #include "core/fetch/RawResource.h"
 #include "core/fetch/ResourcePtr.h"
 #include "core/loader/ThreadableLoader.h"
-#include "core/platform/Timer.h"
-#include "core/platform/network/ResourceError.h"
+#include "platform/Timer.h"
+#include "platform/network/ResourceError.h"
 #include "wtf/Forward.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassRefPtr.h"
diff --git a/Source/core/loader/DocumentWriter.cpp b/Source/core/loader/DocumentWriter.cpp
index 61e19f1..1134cc8 100644
--- a/Source/core/loader/DocumentWriter.cpp
+++ b/Source/core/loader/DocumentWriter.cpp
@@ -34,9 +34,9 @@
 #include "core/fetch/TextResourceDecoder.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderStateMachine.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Settings.h"
 #include "weborigin/KURL.h"
 #include "weborigin/SecurityOrigin.h"
diff --git a/Source/core/loader/EmptyClients.cpp b/Source/core/loader/EmptyClients.cpp
index cacba5b..6fdde41 100644
--- a/Source/core/loader/EmptyClients.cpp
+++ b/Source/core/loader/EmptyClients.cpp
@@ -31,10 +31,12 @@
 #include "core/html/HTMLFormElement.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FormState.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/platform/ColorChooser.h"
 #include "core/platform/DateTimeChooser.h"
-#include "core/platform/FileChooser.h"
+#include "platform/FileChooser.h"
+#include "public/platform/WebServiceWorkerProvider.h"
+#include "public/platform/WebServiceWorkerProviderClient.h"
 
 namespace WebCore {
 
@@ -140,4 +142,9 @@
 {
 }
 
+PassOwnPtr<WebKit::WebServiceWorkerProvider> EmptyFrameLoaderClient::createServiceWorkerProvider(PassOwnPtr<WebKit::WebServiceWorkerProviderClient>)
+{
+    return nullptr;
+}
+
 }
diff --git a/Source/core/loader/EmptyClients.h b/Source/core/loader/EmptyClients.h
index ed1cb5a..474b26b 100644
--- a/Source/core/loader/EmptyClients.h
+++ b/Source/core/loader/EmptyClients.h
@@ -29,7 +29,6 @@
 #ifndef EmptyClients_h
 #define EmptyClients_h
 
-#include "core/dom/DeviceOrientationClient.h"
 #include "core/history/BackForwardClient.h"
 #include "core/inspector/InspectorClient.h"
 #include "core/loader/FrameLoaderClient.h"
@@ -40,9 +39,9 @@
 #include "core/page/FocusDirection.h"
 #include "core/page/Page.h"
 #include "core/platform/DragImage.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/network/ResourceError.h"
-#include "core/platform/text/TextCheckerClient.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/network/ResourceError.h"
+#include "platform/text/TextCheckerClient.h"
 #include "public/platform/WebScreenInfo.h"
 #include "wtf/Forward.h"
 
@@ -206,7 +205,7 @@
     virtual void dispatchDidFailLoad(const ResourceError&) OVERRIDE { }
     virtual void dispatchDidFinishDocumentLoad() OVERRIDE { }
     virtual void dispatchDidFinishLoad() OVERRIDE { }
-    virtual void dispatchDidLayout(LayoutMilestones) OVERRIDE { }
+    virtual void dispatchDidFirstVisuallyNonEmptyLayout() OVERRIDE { }
 
     virtual NavigationPolicy decidePolicyForNavigation(const ResourceRequest&, DocumentLoader*, NavigationPolicy) OVERRIDE;
 
@@ -232,6 +231,7 @@
     virtual void didRunInsecureContent(SecurityOrigin*, const KURL&) OVERRIDE { }
     virtual void didDetectXSS(const KURL&, bool) OVERRIDE { }
     virtual void didDispatchPingLoader(const KURL&) OVERRIDE { }
+    virtual void selectorMatchChanged(const Vector<String>&, const Vector<String>&) OVERRIDE { }
     virtual PassRefPtr<Frame> createFrame(const KURL&, const String&, const String&, HTMLFrameOwnerElement*) OVERRIDE;
     virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) OVERRIDE;
     virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) OVERRIDE;
@@ -248,7 +248,7 @@
     virtual WebKit::WebCookieJar* cookieJar() const { return 0; }
 
     virtual void didRequestAutocomplete(PassRefPtr<FormState>) OVERRIDE;
-    virtual WebKit::WebServiceWorkerRegistry* serviceWorkerRegistry() OVERRIDE { return 0; }
+    virtual PassOwnPtr<WebKit::WebServiceWorkerProvider> createServiceWorkerProvider(PassOwnPtr<WebKit::WebServiceWorkerProviderClient>) OVERRIDE;
 };
 
 class EmptyTextCheckerClient : public TextCheckerClient {
@@ -266,25 +266,14 @@
     EmptyEditorClient() { }
     virtual ~EmptyEditorClient() { }
 
-    virtual bool shouldDeleteRange(Range*) OVERRIDE { return false; }
     virtual bool smartInsertDeleteEnabled() OVERRIDE { return false; }
     virtual bool isSelectTrailingWhitespaceEnabled() OVERRIDE { return false; }
     virtual bool isContinuousSpellCheckingEnabled() OVERRIDE { return false; }
     virtual void toggleContinuousSpellChecking() OVERRIDE { }
     virtual bool isGrammarCheckingEnabled() OVERRIDE { return false; }
 
-    virtual bool shouldBeginEditing(Range*) OVERRIDE { return false; }
-    virtual bool shouldEndEditing(Range*) OVERRIDE { return false; }
-    virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction) OVERRIDE { return false; }
-    virtual bool shouldInsertText(const String&, Range*, EditorInsertAction) OVERRIDE { return false; }
-    virtual bool shouldChangeSelectedRange(Range*, Range*, EAffinity, bool) OVERRIDE { return false; }
-
-    virtual bool shouldApplyStyle(StylePropertySet*, Range*) OVERRIDE { return false; }
-
-    virtual void didBeginEditing() OVERRIDE { }
     virtual void respondToChangedContents() OVERRIDE { }
     virtual void respondToChangedSelection(Frame*) OVERRIDE { }
-    virtual void didEndEditing() OVERRIDE { }
     virtual void didCancelCompositionOnSelectionChange() OVERRIDE { }
 
     virtual void registerUndoStep(PassRefPtr<UndoStep>) OVERRIDE;
@@ -345,19 +334,6 @@
     virtual void hideHighlight() OVERRIDE { }
 };
 
-class EmptyDeviceClient : public DeviceClient {
-public:
-    virtual void startUpdating() OVERRIDE { }
-    virtual void stopUpdating() OVERRIDE { }
-};
-
-class EmptyDeviceOrientationClient : public DeviceOrientationClient {
-public:
-    virtual void setController(DeviceOrientationController*) OVERRIDE { }
-    virtual DeviceOrientationData* lastOrientation() const OVERRIDE { return 0; }
-    virtual void deviceOrientationControllerDestroyed() OVERRIDE { }
-};
-
 class EmptyBackForwardClient : public BackForwardClient {
 public:
     virtual void didAddItem() OVERRIDE { }
diff --git a/Source/core/loader/FormSubmission.cpp b/Source/core/loader/FormSubmission.cpp
index 3ecd221..56e8919 100644
--- a/Source/core/loader/FormSubmission.cpp
+++ b/Source/core/loader/FormSubmission.cpp
@@ -32,6 +32,7 @@
 #include "core/loader/FormSubmission.h"
 
 #include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
 #include "core/dom/Document.h"
 #include "core/events/Event.h"
 #include "core/html/DOMFormData.h"
@@ -103,7 +104,11 @@
 
 FormSubmission::Method FormSubmission::Attributes::parseMethodType(const String& type)
 {
-    return equalIgnoringCase(type, "post") ? FormSubmission::PostMethod : FormSubmission::GetMethod;
+    if (equalIgnoringCase(type, "post"))
+        return FormSubmission::PostMethod;
+    if (RuntimeEnabledFeatures::dialogElementEnabled() && equalIgnoringCase(type, "dialog"))
+        return FormSubmission::DialogMethod;
+    return FormSubmission::GetMethod;
 }
 
 void FormSubmission::Attributes::updateMethodType(const String& type)
@@ -111,6 +116,20 @@
     m_method = parseMethodType(type);
 }
 
+String FormSubmission::Attributes::methodString(Method method)
+{
+    switch (method) {
+    case GetMethod:
+        return "get";
+    case PostMethod:
+        return "post";
+    case DialogMethod:
+        return "dialog";
+    }
+    ASSERT_NOT_REACHED();
+    return emptyString();
+}
+
 void FormSubmission::Attributes::copyFrom(const Attributes& other)
 {
     m_method = other.m_method;
@@ -134,13 +153,19 @@
 {
 }
 
+inline FormSubmission::FormSubmission(const String& result)
+    : m_method(DialogMethod)
+    , m_result(result)
+{
+}
+
 PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const Attributes& attributes, PassRefPtr<Event> event, FormSubmissionTrigger trigger)
 {
     ASSERT(form);
 
     HTMLFormControlElement* submitButton = 0;
     if (event && event->target()) {
-        for (Node* node = event->target()->toNode(); node; node = node->parentNode()) {
+        for (Node* node = event->target()->toNode(); node; node = node->parentOrShadowHostNode()) {
             if (node->isElementNode() && toElement(node)->isFormControlElement()) {
                 submitButton = toHTMLFormControlElement(node);
                 break;
@@ -152,16 +177,19 @@
     copiedAttributes.copyFrom(attributes);
     if (submitButton) {
         String attributeValue;
-        if (!(attributeValue = submitButton->getAttribute(formactionAttr)).isNull())
+        if (!(attributeValue = submitButton->fastGetAttribute(formactionAttr)).isNull())
             copiedAttributes.parseAction(attributeValue);
-        if (!(attributeValue = submitButton->getAttribute(formenctypeAttr)).isNull())
+        if (!(attributeValue = submitButton->fastGetAttribute(formenctypeAttr)).isNull())
             copiedAttributes.updateEncodingType(attributeValue);
-        if (!(attributeValue = submitButton->getAttribute(formmethodAttr)).isNull())
+        if (!(attributeValue = submitButton->fastGetAttribute(formmethodAttr)).isNull())
             copiedAttributes.updateMethodType(attributeValue);
-        if (!(attributeValue = submitButton->getAttribute(formtargetAttr)).isNull())
+        if (!(attributeValue = submitButton->fastGetAttribute(formtargetAttr)).isNull())
             copiedAttributes.setTarget(attributeValue);
     }
 
+    if (copiedAttributes.method() == DialogMethod)
+        return adoptRef(new FormSubmission(submitButton->fastGetAttribute(valueAttr)));
+
     Document& document = form->document();
     KURL actionURL = document.completeURL(copiedAttributes.action().isEmpty() ? document.url().string() : copiedAttributes.action());
     bool isMailtoForm = actionURL.protocolIs("mailto");
@@ -175,8 +203,7 @@
             isMultiPartForm = false;
         }
     }
-
-    WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBuilder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), &document);
+    WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBuilder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document.inputEncoding(), document.defaultCharset());
     RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingForFormSubmission());
     Vector<pair<String, String> > formValues;
 
@@ -199,7 +226,7 @@
     String boundary;
 
     if (isMultiPartForm) {
-        formData = FormData::createMultiPart(*(static_cast<FormDataList*>(domFormData.get())), domFormData->encoding(), &document);
+        formData = FormData::createMultiPart(*(static_cast<FormDataList*>(domFormData.get())), domFormData->encoding());
         boundary = formData->boundary().data();
     } else {
         formData = FormData::create(*(static_cast<FormDataList*>(domFormData.get())), domFormData->encoding(), attributes.method() == GetMethod ? FormData::FormURLEncoded : FormData::parseEncodingType(encodingType));
diff --git a/Source/core/loader/FormSubmission.h b/Source/core/loader/FormSubmission.h
index 8731bac..6a537c1 100644
--- a/Source/core/loader/FormSubmission.h
+++ b/Source/core/loader/FormSubmission.h
@@ -48,7 +48,7 @@
 
 class FormSubmission : public RefCounted<FormSubmission> {
 public:
-    enum Method { GetMethod, PostMethod };
+    enum Method { GetMethod, PostMethod, DialogMethod };
 
     class Attributes {
         WTF_MAKE_NONCOPYABLE(Attributes);
@@ -63,7 +63,7 @@
         Method method() const { return m_method; }
         static Method parseMethodType(const String&);
         void updateMethodType(const String&);
-        static String methodString(Method method) { return method == PostMethod ? "post" : "get"; }
+        static String methodString(Method);
 
         const String& action() const { return m_action; }
         void parseAction(const String&);
@@ -112,8 +112,12 @@
     const String& origin() const { return m_origin; }
     void setOrigin(const String& origin) { m_origin = origin; }
 
+    const String& result() const { return m_result; }
+
 private:
     FormSubmission(Method, const KURL& action, const String& target, const String& contentType, PassRefPtr<FormState>, PassRefPtr<FormData>, const String& boundary, PassRefPtr<Event>);
+    // FormSubmission for DialogMethod
+    FormSubmission(const String& result);
 
     // FIXME: Hold an instance of Attributes instead of individual members.
     Method m_method;
@@ -126,6 +130,7 @@
     RefPtr<Event> m_event;
     String m_referrer;
     String m_origin;
+    String m_result;
 };
 
 }
diff --git a/Source/core/loader/FrameFetchContext.cpp b/Source/core/loader/FrameFetchContext.cpp
index 387f13a..68bf77d 100644
--- a/Source/core/loader/FrameFetchContext.cpp
+++ b/Source/core/loader/FrameFetchContext.cpp
@@ -36,7 +36,7 @@
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/loader/ProgressTracker.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "weborigin/SecurityPolicy.h"
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index c48629d..d9261ee 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -41,10 +41,10 @@
 #include "bindings/v8/SerializedScriptValue.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
-#include "core/events/Event.h"
-#include "core/events/EventNames.h"
-#include "core/events/PageTransitionEvent.h"
 #include "core/editing/Editor.h"
+#include "core/events/Event.h"
+#include "core/events/PageTransitionEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/fetch/FetchContext.h"
 #include "core/fetch/ResourceFetcher.h"
 #include "core/fetch/ResourceLoader.h"
@@ -68,23 +68,24 @@
 #include "core/loader/appcache/ApplicationCacheHost.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/ContentSecurityPolicyResponseHeaders.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicyResponseHeaders.h"
+#include "core/frame/DOMWindow.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/page/WindowFeatures.h"
-#include "core/platform/Logging.h"
 #include "core/platform/ScrollAnimator.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/network/HTTPParsers.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/xml/parser/XMLDocumentParser.h"
 #include "modules/webdatabase/DatabaseManager.h"
+#include "platform/Logging.h"
+#include "platform/UserGestureIndicator.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/network/HTTPParsers.h"
 #include "weborigin/SecurityOrigin.h"
 #include "weborigin/SecurityPolicy.h"
 #include "wtf/TemporaryChange.h"
@@ -235,7 +236,7 @@
 
 bool FrameLoader::closeURL()
 {
-    history()->saveDocumentState();
+    history()->saveDocumentAndScrollState();
 
     // Should only send the pagehide event here if the current document exists.
     if (m_frame->document())
@@ -268,11 +269,8 @@
 
     m_frame->editor().clear();
     m_frame->document()->cancelParsing();
-    m_frame->document()->stopActiveDOMObjects();
-    if (m_frame->document()->attached()) {
-        m_frame->document()->prepareForDestruction();
-        m_frame->document()->removeFocusedElementOfSubtree(m_frame->document());
-    }
+    m_frame->document()->prepareForDestruction();
+    m_frame->document()->removeFocusedElementOfSubtree(m_frame->document());
 
     // Do this after detaching the document so that the unload event works.
     if (options & ClearWindowProperties) {
@@ -436,7 +434,6 @@
 
     // OK, completed.
     m_isComplete = true;
-    m_requestedHistoryItem = 0;
     m_frame->document()->setReadyState(Document::Complete);
     if (m_frame->document()->loadEventStillNeeded())
         m_frame->document()->implicitClose();
@@ -526,7 +523,7 @@
     return allowed;
 }
 
-void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocumentNavigationSource sameDocumentNavigationSource, PassRefPtr<SerializedScriptValue> data, const String& title, UpdateBackForwardListPolicy updateBackForwardList)
+void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocumentNavigationSource sameDocumentNavigationSource, PassRefPtr<SerializedScriptValue> data, UpdateBackForwardListPolicy updateBackForwardList)
 {
     // Update the data source's request with the new URL to fake the URL change
     KURL oldURL = m_frame->document()->url();
@@ -543,9 +540,9 @@
     if (sameDocumentNavigationSource == SameDocumentNavigationDefault)
         history()->updateForSameDocumentNavigation();
     else if (sameDocumentNavigationSource == SameDocumentNavigationPushState)
-        history()->pushState(data, title, newURL.string());
+        history()->pushState(data, newURL.string());
     else if (sameDocumentNavigationSource == SameDocumentNavigationReplaceState)
-        history()->replaceState(data, title, newURL.string());
+        history()->replaceState(data, newURL.string());
     else
         ASSERT_NOT_REACHED();
 
@@ -582,7 +579,7 @@
     m_documentLoader->setIsClientRedirect((m_startingClientRedirect && !isNewNavigation) || !UserGestureIndicator::processingUserGesture());
     m_documentLoader->setReplacesCurrentHistoryItem(!isNewNavigation);
     UpdateBackForwardListPolicy updateBackForwardList = isNewNavigation && !shouldTreatURLAsSameAsCurrent(url) && !stateObject ? UpdateBackForwardList : DoNotUpdateBackForwardList;
-    updateForSameDocumentNavigation(url, SameDocumentNavigationDefault, 0, String(), updateBackForwardList);
+    updateForSameDocumentNavigation(url, SameDocumentNavigationDefault, 0, updateBackForwardList);
 
     // It's important to model this as a load that starts and immediately finishes.
     // Otherwise, the parent frame may think we never finished loading.
@@ -654,7 +651,7 @@
     // If this is a child frame and the form submission was triggered by a script, lock the back/forward list
     // to match IE and Opera.
     // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this.
-    if (!m_frame->tree()->parent() || ScriptController::processingUserGesture())
+    if (!m_frame->tree()->parent() || UserGestureIndicator::processingUserGesture())
         return false;
     return request.formState() && request.formState()->formSubmissionTrigger() == SubmittedByJavaScript;
 }
@@ -663,6 +660,8 @@
 {
     if (m_frame->tree()->parent() && !m_stateMachine.startedFirstRealLoad())
         return FrameLoadTypeInitialInChildFrame;
+    if (!m_frame->tree()->parent() && !history()->currentItem())
+        return FrameLoadTypeStandard;
     if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData)
         return FrameLoadTypeReload;
     if (request.lockBackForwardList() || isScriptTriggeredFormSubmissionInChildFrame(request))
@@ -784,7 +783,6 @@
 
     if (m_state == FrameStateProvisional)
         insertDummyHistoryItem();
-    frame()->loader()->history()->saveDocumentAndScrollState();
 
     ResourceRequest request = documentLoader->request();
     // FIXME: We need to reset cache policy to prevent it from being incorrectly propagted to the reload.
@@ -1037,10 +1035,6 @@
         return;
 
     m_progressTracker->progressCompleted();
-    if (Page* page = m_frame->page()) {
-        if (m_frame == page->mainFrame())
-            page->resetRelevantPaintedObjectCounter();
-    }
 
     const ResourceError& error = m_documentLoader->mainDocumentError();
     if (!error.isNull())
@@ -1050,11 +1044,6 @@
     m_loadType = FrameLoadTypeStandard;
 }
 
-void FrameLoader::didLayout(LayoutMilestones milestones)
-{
-    m_client->dispatchDidLayout(milestones);
-}
-
 void FrameLoader::didFirstLayout()
 {
     if (m_frame->page() && isBackForwardLoadType(m_loadType))
@@ -1133,7 +1122,6 @@
     // stopAllLoaders can detach the Frame, so protect it.
     RefPtr<Frame> protect(m_frame);
     stopAllLoaders();
-    m_frame->document()->stopActiveDOMObjects();
     detachFromParent();
 }
 
@@ -1143,7 +1131,6 @@
     RefPtr<Frame> protect(m_frame);
 
     closeURL();
-    history()->saveScrollPositionAndViewStateToItem(history()->currentItem());
     detachChildren();
     // stopAllLoaders() needs to be called after detachChildren(), because detachedChildren()
     // will trigger the unload event handlers of any child frames, and those event
@@ -1350,10 +1337,19 @@
     if (!m_stateMachine.startedFirstRealLoad())
         m_stateMachine.advanceTo(FrameLoaderStateMachine::StartedFirstRealLoad);
 
+    // The current load should replace the history item if it is the first real
+    // load of the frame. FrameLoadTypeRedirectWithLockedBackForwardList is a
+    // proxy for history()->currentItemShouldBeReplaced().
+    bool replacesCurrentHistoryItem = false;
+    if (type == FrameLoadTypeRedirectWithLockedBackForwardList
+        || !m_stateMachine.committedFirstRealDocumentLoad()) {
+        replacesCurrentHistoryItem = true;
+    }
+
     m_policyDocumentLoader = m_client->createDocumentLoader(request, substituteData.isValid() ? substituteData : defaultSubstituteDataForURL(request.url()));
     m_policyDocumentLoader->setFrame(m_frame);
     m_policyDocumentLoader->setTriggeringAction(action);
-    m_policyDocumentLoader->setReplacesCurrentHistoryItem(type == FrameLoadTypeRedirectWithLockedBackForwardList);
+    m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistoryItem);
     m_policyDocumentLoader->setIsClientRedirect(m_startingClientRedirect);
 
     if (Frame* parent = m_frame->tree()->parent())
@@ -1456,7 +1452,7 @@
 
 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, const KURL& url, unsigned long requestIdentifier)
 {
-    UseCounter::count(m_frame->document(), UseCounter::XFrameOptions);
+    UseCounter::count(m_frame->domWindow(), UseCounter::XFrameOptions);
 
     Frame* topFrame = m_frame->tree()->top();
     if (m_frame == topFrame)
@@ -1466,14 +1462,14 @@
 
     switch (disposition) {
     case XFrameOptionsSameOrigin: {
-        UseCounter::count(m_frame->document(), UseCounter::XFrameOptionsSameOrigin);
+        UseCounter::count(m_frame->domWindow(), UseCounter::XFrameOptionsSameOrigin);
         RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url);
         if (!origin->isSameSchemeHostPort(topFrame->document()->securityOrigin()))
             return true;
         for (Frame* frame = m_frame->tree()->parent(); frame; frame = frame->tree()->parent()) {
             if (!origin->isSameSchemeHostPort(frame->document()->securityOrigin())) {
-                UseCounter::count(m_frame->document(), UseCounter::XFrameOptionsSameOriginWithBadAncestorChain);
-                break;
+                UseCounter::count(m_frame->domWindow(), UseCounter::XFrameOptionsSameOriginWithBadAncestorChain);
+                return true;
             }
         }
         return false;
@@ -1544,7 +1540,6 @@
 
 void FrameLoader::loadHistoryItem(HistoryItem* item)
 {
-    m_requestedHistoryItem = item;
     HistoryItem* currentItem = history()->currentItem();
 
     if (currentItem && item->shouldDoSameDocumentNavigationTo(currentItem)) {
diff --git a/Source/core/loader/FrameLoader.h b/Source/core/loader/FrameLoader.h
index 9887942..e1701eb 100644
--- a/Source/core/loader/FrameLoader.h
+++ b/Source/core/loader/FrameLoader.h
@@ -40,8 +40,7 @@
 #include "core/loader/FrameLoaderTypes.h"
 #include "core/loader/HistoryController.h"
 #include "core/loader/MixedContentChecker.h"
-#include "core/page/LayoutMilestones.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/Forward.h"
 #include "wtf/HashSet.h"
 #include "wtf/OwnPtr.h"
@@ -94,8 +93,6 @@
     void reload(ReloadPolicy = NormalReload, const KURL& overrideURL = KURL(), const String& overrideEncoding = String());
     void loadHistoryItem(HistoryItem*); // The entry point for all back/forward loads
 
-    HistoryItem* requestedHistoryItem() const { return m_requestedHistoryItem.get(); }
-
     static void reportLocalLoadFailed(Frame*, const String& url);
 
     // FIXME: These are all functions which stop loads. We have too many.
@@ -144,7 +141,6 @@
 
     CachePolicy subresourceCachePolicy() const;
 
-    void didLayout(LayoutMilestones);
     void didFirstLayout();
 
     void checkLoadComplete(DocumentLoader*);
@@ -214,7 +210,7 @@
         UpdateBackForwardList,
         DoNotUpdateBackForwardList
     };
-    void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSource, PassRefPtr<SerializedScriptValue>, const String& title, UpdateBackForwardListPolicy);
+    void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSource, PassRefPtr<SerializedScriptValue>, UpdateBackForwardListPolicy);
 
 private:
     bool allChildrenAreComplete() const; // immediate children, not all descendants
@@ -304,8 +300,6 @@
     bool m_startingClientRedirect;
 
     SandboxFlags m_forcedSandboxFlags;
-
-    RefPtr<HistoryItem> m_requestedHistoryItem;
 };
 
 } // namespace WebCore
diff --git a/Source/core/loader/FrameLoaderClient.h b/Source/core/loader/FrameLoaderClient.h
index 42aee86..5e2bd78 100644
--- a/Source/core/loader/FrameLoaderClient.h
+++ b/Source/core/loader/FrameLoaderClient.h
@@ -33,7 +33,6 @@
 #include "core/dom/IconURL.h"
 #include "core/loader/FrameLoaderTypes.h"
 #include "core/loader/NavigationPolicy.h"
-#include "core/page/LayoutMilestones.h"
 #include "core/platform/network/ResourceLoadPriority.h"
 #include "wtf/Forward.h"
 #include "wtf/Vector.h"
@@ -47,7 +46,8 @@
 
 namespace WebKit {
 class WebCookieJar;
-class WebServiceWorkerRegistry;
+class WebServiceWorkerProvider;
+class WebServiceWorkerProviderClient;
 }
 
 namespace WebCore {
@@ -111,8 +111,7 @@
         virtual void dispatchDidFailLoad(const ResourceError&) = 0;
         virtual void dispatchDidFinishDocumentLoad() = 0;
         virtual void dispatchDidFinishLoad() = 0;
-
-        virtual void dispatchDidLayout(LayoutMilestones) { }
+        virtual void dispatchDidFirstVisuallyNonEmptyLayout() = 0;
 
         virtual NavigationPolicy decidePolicyForNavigation(const ResourceRequest&, DocumentLoader*, NavigationPolicy) = 0;
 
@@ -151,6 +150,10 @@
         virtual void didDetectXSS(const KURL&, bool didBlockEntirePage) = 0;
         virtual void didDispatchPingLoader(const KURL&) = 0;
 
+        // Transmits the change in the set of watched CSS selectors property
+        // that match any element on the frame.
+        virtual void selectorMatchChanged(const Vector<String>& addedSelectors, const Vector<String>& removedSelectors) = 0;
+
         virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&) = 0;
 
         virtual String userAgent(const KURL&) = 0;
@@ -216,9 +219,11 @@
 
         virtual void dispatchDidChangeResourcePriority(unsigned long /*identifier*/, ResourceLoadPriority) { }
 
-        virtual WebKit::WebServiceWorkerRegistry* serviceWorkerRegistry() = 0;
+        virtual PassOwnPtr<WebKit::WebServiceWorkerProvider> createServiceWorkerProvider(PassOwnPtr<WebKit::WebServiceWorkerProviderClient>) = 0;
 
         virtual void didStopAllLoaders() { }
+
+        virtual bool isFrameLoaderClientImpl() const { return false; }
     };
 
 } // namespace WebCore
diff --git a/Source/core/loader/HistoryController.cpp b/Source/core/loader/HistoryController.cpp
index be314f5..443a675 100644
--- a/Source/core/loader/HistoryController.cpp
+++ b/Source/core/loader/HistoryController.cpp
@@ -39,12 +39,12 @@
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/loader/FrameLoaderStateMachine.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/platform/Logging.h"
+#include "platform/Logging.h"
 #include "wtf/text/CString.h"
 
 namespace WebCore {
@@ -59,18 +59,6 @@
 {
 }
 
-void HistoryController::saveScrollPositionAndViewStateToItem(HistoryItem* item)
-{
-    if (!item || !m_frame->view())
-        return;
-
-    item->setScrollPoint(m_frame->view()->scrollPosition());
-
-    Page* page = m_frame->page();
-    if (page && page->mainFrame() == m_frame)
-        item->setPageScaleFactor(page->pageScaleFactor());
-}
-
 void HistoryController::clearScrollPositionAndViewState()
 {
     if (!m_currentItem)
@@ -93,17 +81,7 @@
 */
 void HistoryController::restoreScrollPositionAndViewState()
 {
-    if (!m_frame->loader()->stateMachine()->committedFirstRealDocumentLoad())
-        return;
-
-    ASSERT(m_currentItem);
-
-    // FIXME: As the ASSERT attests, it seems we should always have a currentItem here.
-    // One counterexample is <rdar://problem/4917290>
-    // For now, to cover this issue in release builds, there is no technical harm to returning
-    // early and from a user standpoint - as in the above radar - the previous page load failed
-    // so there *is* no scroll or view state to restore!
-    if (!m_currentItem)
+    if (!m_currentItem || !m_frame->loader()->stateMachine()->committedFirstRealDocumentLoad())
         return;
 
     if (FrameView* view = m_frame->view()) {
@@ -124,10 +102,10 @@
 
 void HistoryController::updateBackForwardListForFragmentScroll()
 {
-    updateBackForwardListClippedAtTarget(false);
+    createNewBackForwardItem(false);
 }
 
-void HistoryController::saveDocumentState()
+void HistoryController::saveDocumentAndScrollState()
 {
     if (!m_currentItem)
         return;
@@ -135,62 +113,25 @@
     Document* document = m_frame->document();
     ASSERT(document);
 
-    if (m_currentItem->isCurrentDocument(document) && document->attached()) {
+    if (m_currentItem->isCurrentDocument(document) && document->isActive()) {
         LOG(Loading, "WebCoreLoading %s: saving form state to %p", m_frame->tree()->uniqueName().string().utf8().data(), m_currentItem.get());
         m_currentItem->setDocumentState(document->formElementsState());
     }
-}
 
-// Walk the frame tree, telling all frames to save their form state into their current
-// history item.
-void HistoryController::saveDocumentAndScrollState()
-{
-    for (Frame* frame = m_frame; frame; frame = frame->tree()->traverseNext(m_frame)) {
-        frame->loader()->history()->saveDocumentState();
-        frame->loader()->history()->saveScrollPositionAndViewStateToItem(frame->loader()->history()->currentItem());
-    }
-}
+    if (!m_frame->view())
+        return;
 
-static inline bool isAssociatedToRequestedHistoryItem(const HistoryItem* current, Frame* frame, const HistoryItem* requested)
-{
-    if (requested == current)
-        return true;
-    if (requested)
-        return false;
-    while ((frame = frame->tree()->parent())) {
-        requested = frame->loader()->requestedHistoryItem();
-        if (!requested)
-            continue;
-        if (requested->isAncestorOf(current))
-            return true;
-    }
-    return false;
+    m_currentItem->setScrollPoint(m_frame->view()->scrollPosition());
+
+    Page* page = m_frame->page();
+    if (page && page->mainFrame() == m_frame)
+        m_currentItem->setPageScaleFactor(page->pageScaleFactor());
 }
 
 void HistoryController::restoreDocumentState()
 {
-    Document* doc = m_frame->document();
-
-    HistoryItem* itemToRestore = 0;
-
-    switch (m_frame->loader()->loadType()) {
-        case FrameLoadTypeReload:
-        case FrameLoadTypeReloadFromOrigin:
-        case FrameLoadTypeSame:
-            break;
-        case FrameLoadTypeBackForward:
-        case FrameLoadTypeRedirectWithLockedBackForwardList:
-        case FrameLoadTypeInitialInChildFrame:
-        case FrameLoadTypeStandard:
-            itemToRestore = m_currentItem.get();
-    }
-
-    if (!itemToRestore)
-        return;
-    if (isAssociatedToRequestedHistoryItem(itemToRestore, m_frame, m_frame->loader()->requestedHistoryItem()) && !m_frame->loader()->documentLoader()->isClientRedirect()) {
-        LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame->tree()->uniqueName().string().utf8().data(), itemToRestore);
-        doc->setStateForNewFormElements(itemToRestore->documentState());
-    }
+    if (m_currentItem && m_frame->loader()->loadType() == FrameLoadTypeBackForward)
+        m_frame->document()->setStateForNewFormElements(m_currentItem->documentState());
 }
 
 bool HistoryController::shouldStopLoadingForHistoryItem(HistoryItem* targetItem) const
@@ -243,35 +184,6 @@
     }
 }
 
-void HistoryController::updateForBackForwardNavigation()
-{
-#if !LOG_DISABLED
-    LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame->document()->title().utf8().data());
-#endif
-
-    saveScrollPositionAndViewStateToItem(m_previousItem.get());
-
-    // When traversing history, we may end up redirecting to a different URL
-    // this time (e.g., due to cookies).  See http://webkit.org/b/49654.
-    updateCurrentItem();
-}
-
-void HistoryController::updateForReload()
-{
-#if !LOG_DISABLED
-    LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame->document()->title().utf8().data());
-#endif
-
-    if (m_currentItem) {
-        if (m_frame->loader()->loadType() == FrameLoadTypeReload || m_frame->loader()->loadType() == FrameLoadTypeReloadFromOrigin)
-            saveScrollPositionAndViewStateToItem(m_currentItem.get());
-    }
-
-    // When reloading the page, we may end up redirecting to a different URL
-    // this time (e.g., due to cookies).  See http://webkit.org/b/4072.
-    updateCurrentItem();
-}
-
 // There are 2 things you might think of as "history", all of which are handled by these functions.
 //
 //     1) Back/forward: The m_currentItem is part of this mechanism.
@@ -280,23 +192,7 @@
 void HistoryController::updateForStandardLoad()
 {
     LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", m_frame->loader()->documentLoader()->url().string().ascii().data());
-
-    if (!m_frame->loader()->documentLoader()->urlForHistory().isEmpty())
-        updateBackForwardListClippedAtTarget(true);
-}
-
-void HistoryController::updateForRedirectWithLockedBackForwardList()
-{
-#if !LOG_DISABLED
-    LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->document()->title().utf8().data());
-#endif
-
-    if (!m_currentItem && !m_frame->tree()->parent()) {
-        if (!m_frame->loader()->documentLoader()->urlForHistory().isEmpty())
-            updateBackForwardListClippedAtTarget(true);
-    }
-    // The client redirect replaces the current history item.
-    updateCurrentItem();
+    createNewBackForwardItem(true);
 }
 
 void HistoryController::updateForInitialLoadInChildFrame()
@@ -314,7 +210,7 @@
         LOG(History, "WebCoreHistory: Updating History for commit in frame %s", m_frame->document()->title().utf8().data());
 #endif
     FrameLoadType type = frameLoader->loadType();
-    if (isBackForwardLoadType(type) || (isReloadTypeWithProvisionalItem(type) && !frameLoader->documentLoader()->unreachableURL().isEmpty())) {
+    if (isBackForwardLoadType(type)) {
         // Once committed, we want to use current item for saving DocState, and
         // the provisional item for restoring state.
         // Note previousItem must be set before we close the URL, which will
@@ -332,32 +228,12 @@
         page->mainFrame()->loader()->history()->recursiveUpdateForCommit();
     }
 
-    switch (type) {
-    case FrameLoadTypeBackForward:
-        updateForBackForwardNavigation();
-        return;
-    case FrameLoadTypeReload:
-    case FrameLoadTypeReloadFromOrigin:
-    case FrameLoadTypeSame:
-        updateForReload();
-        return;
-    case FrameLoadTypeStandard:
+    if (type == FrameLoadTypeStandard)
         updateForStandardLoad();
-        return;
-    case FrameLoadTypeRedirectWithLockedBackForwardList:
-        updateForRedirectWithLockedBackForwardList();
-        return;
-    case FrameLoadTypeInitialInChildFrame:
+    else if (type == FrameLoadTypeInitialInChildFrame)
         updateForInitialLoadInChildFrame();
-        return;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-}
-
-bool HistoryController::isReloadTypeWithProvisionalItem(FrameLoadType type)
-{
-    return (type == FrameLoadTypeReload || type == FrameLoadTypeReloadFromOrigin) && m_provisionalItem;
+    else
+        updateWithoutCreatingNewBackForwardItem();
 }
 
 void HistoryController::recursiveUpdateForCommit()
@@ -371,9 +247,6 @@
     // (a matching URL and frame tree snapshot), just restore the scroll position.
     // Save form state
     if (m_currentItem && itemsAreClones(m_currentItem.get(), m_provisionalItem.get())) {
-        saveDocumentState();
-        saveScrollPositionAndViewStateToItem(m_currentItem.get());
-
         if (FrameView* view = m_frame->view())
             view->setWasScrolledByUser(false);
 
@@ -382,9 +255,6 @@
         m_currentItem = m_provisionalItem;
         m_provisionalItem = 0;
 
-        // Restore form state (works from currentItem)
-        restoreDocumentState();
-
         // Restore the scroll position (we choose to do this rather than going back to the anchor point)
         restoreScrollPositionAndViewState();
     }
@@ -437,12 +307,6 @@
     m_currentItem = item;
 }
 
-void HistoryController::setCurrentItemTitle(const String& title)
-{
-    if (m_currentItem)
-        m_currentItem->setTitle(title);
-}
-
 bool HistoryController::currentItemShouldBeReplaced() const
 {
     // From the HTML5 spec for location.assign():
@@ -490,9 +354,6 @@
 
     item->setURL(url);
     item->setTarget(m_frame->tree()->uniqueName());
-    item->setParent(parent);
-    // FIXME: should store title directionality in history as well.
-    item->setTitle(m_frame->document()->title());
     item->setOriginalURLString(originalURL.string());
 
     // Save form state if this is a POST
@@ -514,12 +375,8 @@
 PassRefPtr<HistoryItem> HistoryController::createItemTree(Frame* targetFrame, bool clipAtTarget)
 {
     RefPtr<HistoryItem> bfItem = createItem();
-    saveScrollPositionAndViewStateToItem(m_previousItem.get());
 
     if (!clipAtTarget || m_frame != targetFrame) {
-        // save frame state for items that aren't loading (khtml doesn't save those)
-        saveDocumentState();
-
         // clipAtTarget is false for navigations within the same document, so
         // we should copy the documentSequenceNumber over to the newly create
         // item.  Non-target items are just clones, and they should therefore
@@ -539,9 +396,6 @@
                 bfItem->addChildItem(childLoader->history()->createItemTree(targetFrame, clipAtTarget));
         }
     }
-    // FIXME: Eliminate the isTargetItem flag in favor of itemSequenceNumber.
-    if (m_frame == targetFrame)
-        bfItem->setIsTargetItem(true);
     return bfItem;
 }
 
@@ -632,7 +486,7 @@
     return true;
 }
 
-void HistoryController::updateBackForwardListClippedAtTarget(bool doClip)
+void HistoryController::createNewBackForwardItem(bool doClip)
 {
     // In the case of saving state about a page with frames, we store a tree of items that mirrors the frame tree.
     // The item that was the target of the user's navigation is designated as the "targetItem".
@@ -643,7 +497,7 @@
     if (!page)
         return;
 
-    if (m_frame->loader()->documentLoader()->urlForHistory().isEmpty())
+    if (m_frame->loader()->documentLoader()->originalRequest().url().isEmpty() && m_frame->loader()->documentLoader()->unreachableURL().isEmpty())
         return;
 
     Frame* mainFrame = page->mainFrame();
@@ -654,7 +508,7 @@
     page->backForward().addItem(topItem.release());
 }
 
-void HistoryController::updateCurrentItem()
+void HistoryController::updateWithoutCreatingNewBackForwardItem()
 {
     if (!m_currentItem)
         return;
@@ -665,21 +519,15 @@
         return;
 
     if (m_currentItem->url() != documentLoader->url()) {
-        // We ended up on a completely different URL this time, so the HistoryItem
-        // needs to be re-initialized.  Preserve the isTargetItem flag as it is a
-        // property of how this HistoryItem was originally created and is not
-        // dependent on the document.
-        bool isTargetItem = m_currentItem->isTargetItem();
         m_currentItem->reset();
         initializeItem(m_currentItem.get());
-        m_currentItem->setIsTargetItem(isTargetItem);
     } else {
         // Even if the final URL didn't change, the form data may have changed.
         m_currentItem->setFormInfoFromRequest(documentLoader->request());
     }
 }
 
-void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString)
+void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, const String& urlString)
 {
     if (!m_currentItem)
         return;
@@ -692,20 +540,18 @@
 
     // Override data in the current item (created by createItemTree) to reflect
     // the pushState() arguments.
-    m_currentItem->setTitle(title);
     m_currentItem->setStateObject(stateObject);
     m_currentItem->setURLString(urlString);
     page->backForward().addItem(topItem.release());
 }
 
-void HistoryController::replaceState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString)
+void HistoryController::replaceState(PassRefPtr<SerializedScriptValue> stateObject, const String& urlString)
 {
     if (!m_currentItem)
         return;
 
     if (!urlString.isEmpty())
         m_currentItem->setURLString(urlString);
-    m_currentItem->setTitle(title);
     m_currentItem->setStateObject(stateObject);
     m_currentItem->setFormData(0);
     m_currentItem->setFormContentType(String());
diff --git a/Source/core/loader/HistoryController.h b/Source/core/loader/HistoryController.h
index a5f85b8..d5262c3 100644
--- a/Source/core/loader/HistoryController.h
+++ b/Source/core/loader/HistoryController.h
@@ -47,13 +47,11 @@
     explicit HistoryController(Frame*);
     ~HistoryController();
 
-    void saveScrollPositionAndViewStateToItem(HistoryItem*);
     void clearScrollPositionAndViewState();
     void restoreScrollPositionAndViewState();
 
     void updateBackForwardListForFragmentScroll();
 
-    void saveDocumentState();
     void saveDocumentAndScrollState();
     void restoreDocumentState();
 
@@ -62,7 +60,6 @@
 
     HistoryItem* currentItem() const { return m_currentItem.get(); }
     void setCurrentItem(HistoryItem*);
-    void setCurrentItemTitle(const String&);
     bool currentItemShouldBeReplaced() const;
 
     HistoryItem* previousItem() const { return m_previousItem.get(); }
@@ -70,8 +67,8 @@
     HistoryItem* provisionalItem() const { return m_provisionalItem.get(); }
     void setProvisionalItem(HistoryItem*);
 
-    void pushState(PassRefPtr<SerializedScriptValue>, const String& title, const String& url);
-    void replaceState(PassRefPtr<SerializedScriptValue>, const String& title, const String& url);
+    void pushState(PassRefPtr<SerializedScriptValue>, const String& url);
+    void replaceState(PassRefPtr<SerializedScriptValue>, const String& url);
 
     void setDefersLoading(bool);
 
@@ -84,21 +81,18 @@
     PassRefPtr<HistoryItem> createItem();
     PassRefPtr<HistoryItem> createItemTree(Frame* targetFrame, bool clipAtTarget);
 
-    void updateForBackForwardNavigation();
-    void updateForReload();
     void updateForStandardLoad();
-    void updateForRedirectWithLockedBackForwardList();
     void updateForInitialLoadInChildFrame();
 
     void recursiveSetProvisionalItem(HistoryItem*, HistoryItem*);
     void recursiveGoToItem(HistoryItem*, HistoryItem*);
-    bool isReloadTypeWithProvisionalItem(FrameLoadType);
     void recursiveUpdateForCommit();
     void recursiveUpdateForSameDocumentNavigation();
     bool itemsAreClones(HistoryItem*, HistoryItem*) const;
     bool currentFramesMatchItem(HistoryItem*) const;
-    void updateBackForwardListClippedAtTarget(bool doClip);
-    void updateCurrentItem();
+
+    void createNewBackForwardItem(bool doClip);
+    void updateWithoutCreatingNewBackForwardItem();
 
     Frame* m_frame;
 
diff --git a/Source/core/loader/IconController.cpp b/Source/core/loader/IconController.cpp
index b112bc4..ed5189e 100644
--- a/Source/core/loader/IconController.cpp
+++ b/Source/core/loader/IconController.cpp
@@ -37,7 +37,7 @@
 
 #include "core/dom/Document.h"
 #include "core/dom/IconURL.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/ImageLoader.cpp b/Source/core/loader/ImageLoader.cpp
index bf7b3a0..c0b01f4 100644
--- a/Source/core/loader/ImageLoader.cpp
+++ b/Source/core/loader/ImageLoader.cpp
@@ -42,19 +42,19 @@
 
 static ImageEventSender& beforeLoadEventSender()
 {
-    DEFINE_STATIC_LOCAL(ImageEventSender, sender, (eventNames().beforeloadEvent));
+    DEFINE_STATIC_LOCAL(ImageEventSender, sender, (EventTypeNames::beforeload));
     return sender;
 }
 
 static ImageEventSender& loadEventSender()
 {
-    DEFINE_STATIC_LOCAL(ImageEventSender, sender, (eventNames().loadEvent));
+    DEFINE_STATIC_LOCAL(ImageEventSender, sender, (EventTypeNames::load));
     return sender;
 }
 
 static ImageEventSender& errorEventSender()
 {
-    DEFINE_STATIC_LOCAL(ImageEventSender, sender, (eventNames().errorEvent));
+    DEFINE_STATIC_LOCAL(ImageEventSender, sender, (EventTypeNames::error));
     return sender;
 }
 
@@ -141,10 +141,10 @@
 
 void ImageLoader::updateFromElement()
 {
-    // If we're not making renderers for the page, then don't load images.  We don't want to slow
-    // down the raw HTML parsing case by loading images we don't intend to display.
+    // Don't load images for inactive documents. We don't want to slow down the
+    // raw HTML parsing case by loading images we don't intend to display.
     Document& document = m_element->document();
-    if (!document.renderer())
+    if (!document.isActive())
         return;
 
     AtomicString attr = m_element->imageSourceURL();
@@ -363,11 +363,11 @@
 {
     ASSERT(eventSender == &beforeLoadEventSender() || eventSender == &loadEventSender() || eventSender == &errorEventSender());
     const AtomicString& eventType = eventSender->eventType();
-    if (eventType == eventNames().beforeloadEvent)
+    if (eventType == EventTypeNames::beforeload)
         dispatchPendingBeforeLoadEvent();
-    if (eventType == eventNames().loadEvent)
+    if (eventType == EventTypeNames::load)
         dispatchPendingLoadEvent();
-    if (eventType == eventNames().errorEvent)
+    if (eventType == EventTypeNames::error)
         dispatchPendingErrorEvent();
 }
 
@@ -377,7 +377,7 @@
         return;
     if (!m_image)
         return;
-    if (!m_element->document().attached())
+    if (!m_element->document().frame())
         return;
     m_hasPendingBeforeLoadEvent = false;
     if (m_element->dispatchBeforeLoadEvent(m_image->url().string())) {
@@ -407,7 +407,7 @@
     if (!m_image)
         return;
     m_hasPendingLoadEvent = false;
-    if (element()->document().attached())
+    if (element()->document().frame())
         dispatchLoadEvent();
 
     // Only consider updating the protection ref-count of the Element immediately before returning
@@ -420,8 +420,8 @@
     if (!m_hasPendingErrorEvent)
         return;
     m_hasPendingErrorEvent = false;
-    if (element()->document().attached())
-        element()->dispatchEvent(Event::create(eventNames().errorEvent));
+    if (element()->document().frame())
+        element()->dispatchEvent(Event::create(EventTypeNames::error));
 
     // Only consider updating the protection ref-count of the Element immediately before returning
     // from this function as doing so might result in the destruction of this ImageLoader.
diff --git a/Source/core/loader/LinkLoader.cpp b/Source/core/loader/LinkLoader.cpp
index 2e49672..359f0b3 100644
--- a/Source/core/loader/LinkLoader.cpp
+++ b/Source/core/loader/LinkLoader.cpp
@@ -39,8 +39,8 @@
 #include "core/html/LinkRelAttribute.h"
 #include "core/loader/Prerenderer.h"
 #include "core/page/Settings.h"
-#include "core/platform/PrerenderHandle.h"
-#include "core/platform/network/DNS.h"
+#include "core/platform/Prerender.h"
+#include "platform/network/DNS.h"
 
 namespace WebCore {
 
@@ -55,8 +55,8 @@
 {
     if (m_cachedLinkResource)
         m_cachedLinkResource->removeClient(this);
-    if (m_prerenderHandle)
-        m_prerenderHandle->removeClient();
+    if (m_prerender)
+        m_prerender->removeClient();
 }
 
 void LinkLoader::linkLoadTimerFired(Timer<LinkLoader>* timer)
@@ -129,15 +129,17 @@
     }
 
     if (relAttribute.isLinkPrerender()) {
-        if (!m_prerenderHandle) {
-            m_prerenderHandle = document.prerenderer()->render(this, href);
-        } else if (m_prerenderHandle->url() != href) {
-            m_prerenderHandle->cancel();
-            m_prerenderHandle = document.prerenderer()->render(this, href);
+        if (!m_prerender) {
+            m_prerender = Prerenderer::from(&document)->render(this, href);
+        } else if (m_prerender->url() != href) {
+            m_prerender->cancel();
+            m_prerender->removeClient();
+            m_prerender = Prerenderer::from(&document)->render(this, href);
         }
-    } else if (m_prerenderHandle) {
-        m_prerenderHandle->cancel();
-        m_prerenderHandle = 0;
+    } else if (m_prerender) {
+        m_prerender->cancel();
+        m_prerender->removeClient();
+        m_prerender = 0;
     }
     return true;
 }
@@ -146,10 +148,10 @@
 {
     // Only prerenders need treatment here; other links either use the Resource interface, or are notionally
     // atomic (dns prefetch).
-    if (m_prerenderHandle) {
-        m_prerenderHandle->cancel();
-        m_prerenderHandle->removeClient();
-        m_prerenderHandle.clear();
+    if (m_prerender) {
+        m_prerender->cancel();
+        m_prerender->removeClient();
+        m_prerender.clear();
     }
 }
 
diff --git a/Source/core/loader/LinkLoader.h b/Source/core/loader/LinkLoader.h
index b020860..7b6c19a 100644
--- a/Source/core/loader/LinkLoader.h
+++ b/Source/core/loader/LinkLoader.h
@@ -36,13 +36,14 @@
 #include "core/fetch/ResourcePtr.h"
 #include "core/loader/LinkLoaderClient.h"
 #include "core/platform/PrerenderClient.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/RefPtr.h"
 
 namespace WebCore {
 
+class Document;
 class LinkRelAttribute;
-class PrerenderHandle;
+class Prerender;
 
 // The LinkLoader can load link rel types icon, dns-prefetch, subresource, prefetch and prerender.
 class LinkLoader : public ResourceClient, public PrerenderClient {
@@ -73,7 +74,7 @@
     Timer<LinkLoader> m_linkLoadTimer;
     Timer<LinkLoader> m_linkLoadingErrorTimer;
 
-    RefPtr<PrerenderHandle> m_prerenderHandle;
+    RefPtr<Prerender> m_prerender;
 };
 
 }
diff --git a/Source/core/loader/MixedContentChecker.cpp b/Source/core/loader/MixedContentChecker.cpp
index ac812e0..80ab42e 100644
--- a/Source/core/loader/MixedContentChecker.cpp
+++ b/Source/core/loader/MixedContentChecker.cpp
@@ -32,7 +32,7 @@
 #include "core/dom/Document.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/text/WTFString.h"
@@ -92,7 +92,8 @@
 void MixedContentChecker::logWarning(bool allowed, const String& action, const KURL& target) const
 {
     String message = String(allowed ? "" : "[blocked] ") + "The page at '" + m_frame->document()->url().elidedString() + "' was loaded over HTTPS, but " + action + " insecure content from '" + target.elidedString() + "': this content should also be loaded over HTTPS.\n";
-    m_frame->document()->addConsoleMessage(SecurityMessageSource, WarningMessageLevel, message);
+    MessageLevel messageLevel = allowed ? WarningMessageLevel : ErrorMessageLevel;
+    m_frame->document()->addConsoleMessage(SecurityMessageSource, messageLevel, message);
 }
 
 } // namespace WebCore
diff --git a/Source/core/loader/NavigationScheduler.cpp b/Source/core/loader/NavigationScheduler.cpp
index 74bf43d..a5f9909 100644
--- a/Source/core/loader/NavigationScheduler.cpp
+++ b/Source/core/loader/NavigationScheduler.cpp
@@ -34,7 +34,6 @@
 
 #include "bindings/v8/ScriptController.h"
 #include "core/events/Event.h"
-#include "core/dom/UserGestureIndicator.h"
 #include "core/history/BackForwardController.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/inspector/InspectorInstrumentation.h"
@@ -44,8 +43,9 @@
 #include "core/loader/FrameLoadRequest.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderStateMachine.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
+#include "platform/UserGestureIndicator.h"
 #include "wtf/CurrentTime.h"
 
 namespace WebCore {
@@ -59,7 +59,7 @@
         : m_delay(delay)
         , m_lockBackForwardList(lockBackForwardList)
         , m_isLocationChange(isLocationChange)
-        , m_wasUserGesture(ScriptController::processingUserGesture())
+        , m_wasUserGesture(UserGestureIndicator::processingUserGesture())
     {
         if (m_wasUserGesture)
             m_userGestureToken = UserGestureIndicator::currentToken();
@@ -303,7 +303,7 @@
 {
     // Non-user navigation before the page has finished firing onload should not create a new back/forward item.
     // See https://webkit.org/b/42861 for the original motivation for this.
-    if (!ScriptController::processingUserGesture() && !targetFrame->document()->loadEventFinished())
+    if (!UserGestureIndicator::processingUserGesture() && !targetFrame->document()->loadEventFinished())
         return true;
 
     // Navigation of a subframe during loading of an ancestor frame does not create a new back/forward item.
diff --git a/Source/core/loader/NavigationScheduler.h b/Source/core/loader/NavigationScheduler.h
index 07b610d..cc5059a 100644
--- a/Source/core/loader/NavigationScheduler.h
+++ b/Source/core/loader/NavigationScheduler.h
@@ -31,7 +31,7 @@
 #ifndef NavigationScheduler_h
 #define NavigationScheduler_h
 
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/Forward.h"
 #include "wtf/HashMap.h"
 #include "wtf/Noncopyable.h"
diff --git a/Source/core/loader/PingLoader.cpp b/Source/core/loader/PingLoader.cpp
index b9253d1..fc03f23 100644
--- a/Source/core/loader/PingLoader.cpp
+++ b/Source/core/loader/PingLoader.cpp
@@ -37,7 +37,7 @@
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/loader/UniqueIdentifier.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/platform/chromium/support/WrappedResourceRequest.h"
 #include "core/platform/network/FormData.h"
 #include "core/platform/network/ResourceRequest.h"
diff --git a/Source/core/loader/PingLoader.h b/Source/core/loader/PingLoader.h
index 80f7070..45ef227 100644
--- a/Source/core/loader/PingLoader.h
+++ b/Source/core/loader/PingLoader.h
@@ -33,7 +33,7 @@
 #define PingLoader_h
 
 #include "core/fetch/ResourceLoaderOptions.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "public/platform/WebURLLoaderClient.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/loader/Prerenderer.cpp b/Source/core/loader/Prerenderer.cpp
index 75f454d..d053ffa 100644
--- a/Source/core/loader/Prerenderer.cpp
+++ b/Source/core/loader/Prerenderer.cpp
@@ -35,8 +35,8 @@
 #include "core/dom/Document.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/PrerendererClient.h"
-#include "core/page/Frame.h"
-#include "core/platform/PrerenderHandle.h"
+#include "core/frame/Frame.h"
+#include "core/platform/Prerender.h"
 #include "weborigin/ReferrerPolicy.h"
 #include "weborigin/SecurityPolicy.h"
 
@@ -47,16 +47,8 @@
 
 namespace WebCore {
 
-// static
-PassOwnPtr<Prerenderer> Prerenderer::create(Document* document)
-{
-    Prerenderer* prerenderer = new Prerenderer(document);
-    prerenderer->suspendIfNeeded();
-    return adoptPtr(prerenderer);
-}
-
 Prerenderer::Prerenderer(Document* document)
-    : ActiveDOMObject(document)
+    : DocumentLifecycleObserver(document)
     , m_initializedClient(false)
     , m_client(0)
 {
@@ -66,7 +58,22 @@
 {
 }
 
-PassRefPtr<PrerenderHandle> Prerenderer::render(PrerenderClient* prerenderClient, const KURL& url)
+const char* Prerenderer::supplementName()
+{
+    return "Prerenderer";
+}
+
+Prerenderer* Prerenderer::from(Document* document)
+{
+    Prerenderer* prerenderer = static_cast<Prerenderer*>(DocumentSupplement::from(document, supplementName()));
+    if (!prerenderer) {
+        prerenderer = new Prerenderer(document);
+        DocumentSupplement::provideTo(document, supplementName(), adoptPtr(prerenderer));
+    }
+    return prerenderer;
+}
+
+PassRefPtr<Prerender> Prerenderer::render(PrerenderClient* prerenderClient, const KURL& url)
 {
     // Prerenders are unlike requests in most ways (for instance, they pass down fragments, and they don't return data),
     // but they do have referrers.
@@ -77,57 +84,30 @@
 
     const String referrer = SecurityPolicy::generateReferrerHeader(referrerPolicy, url, document()->frame()->loader()->outgoingReferrer());
 
-    RefPtr<PrerenderHandle> prerenderHandle = PrerenderHandle::create(prerenderClient, url, referrer, referrerPolicy);
+    RefPtr<Prerender> prerender = Prerender::create(prerenderClient, url, referrer, referrerPolicy);
 
     if (client())
-        client()->willAddPrerender(prerenderHandle.get());
-    prerenderHandle->add();
+        client()->willAddPrerender(prerender.get());
+    prerender->add();
 
-    // FIXME: This handle isn't released until page unload, but it may be canceled before then. It should be released in that case.
-    m_activeHandles.append(prerenderHandle);
-    return prerenderHandle;
+    // FIXME: This prerender isn't released until page unload, but it may be canceled before then. It should be released in that case.
+    m_activePrerenders.append(prerender);
+    return prerender;
 }
 
-void Prerenderer::stop()
+void Prerenderer::documentWasDetached()
 {
-    while (!m_activeHandles.isEmpty()) {
-        RefPtr<PrerenderHandle> handle = m_activeHandles[0].release();
-        m_activeHandles.remove(0);
-        handle->abandon();
-    }
-    while (!m_suspendedHandles.isEmpty()) {
-        RefPtr<PrerenderHandle> handle = m_suspendedHandles[0].release();
-        m_suspendedHandles.remove(0);
-        handle->abandon();
-    }
-}
-
-void Prerenderer::suspend(ReasonForSuspension reason)
-{
-    if (reason == DocumentWillBecomeInactive) {
-        while (!m_activeHandles.isEmpty()) {
-            RefPtr<PrerenderHandle> handle = m_activeHandles[0].release();
-            m_activeHandles.remove(0);
-            handle->suspend();
-            m_suspendedHandles.append(handle);
-        }
-    }
-}
-
-void Prerenderer::resume()
-{
-    while (!m_suspendedHandles.isEmpty()) {
-        RefPtr<PrerenderHandle> handle = m_suspendedHandles[0].release();
-        m_suspendedHandles.remove(0);
-        handle->resume();
-        m_activeHandles.append(handle);
+    while (!m_activePrerenders.isEmpty()) {
+        RefPtr<Prerender> prerender = m_activePrerenders[0].release();
+        m_activePrerenders.remove(0);
+        prerender->abandon();
     }
 }
 
 Document* Prerenderer::document()
 {
-    ASSERT(scriptExecutionContext()->isDocument());
-    return toDocument(scriptExecutionContext());
+    ASSERT(executionContext()->isDocument());
+    return toDocument(executionContext());
 }
 
 PrerendererClient* Prerenderer::client()
diff --git a/Source/core/loader/Prerenderer.h b/Source/core/loader/Prerenderer.h
index a754565..e5fd35a 100644
--- a/Source/core/loader/Prerenderer.h
+++ b/Source/core/loader/Prerenderer.h
@@ -32,7 +32,9 @@
 #ifndef Prerenderer_h
 #define Prerenderer_h
 
-#include "core/dom/ActiveDOMObject.h"
+#include "core/dom/DocumentLifecycleObserver.h"
+#include "core/dom/DocumentSupplementable.h"
+#include "platform/Supplementable.h"
 #include "weborigin/KURL.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
@@ -41,29 +43,26 @@
 
 namespace WebCore {
 
-class Document;
 class PrerenderClient;
-class PrerenderHandle;
+class Prerender;
 class PrerendererClient;
 class Page;
 
-class Prerenderer : public ActiveDOMObject {
+class Prerenderer : public DocumentLifecycleObserver, public DocumentSupplement {
     WTF_MAKE_NONCOPYABLE(Prerenderer);
 public:
     virtual ~Prerenderer();
 
-    PassRefPtr<PrerenderHandle> render(PrerenderClient*, const KURL&);
+    PassRefPtr<Prerender> render(PrerenderClient*, const KURL&);
 
-    static PassOwnPtr<Prerenderer> create(Document*);
+    static const char* supplementName();
+    static Prerenderer* from(Document*);
 
-    // From ActiveDOMObject:
-    virtual bool canSuspend() const OVERRIDE { return true; }
-    virtual void stop() OVERRIDE;
-    virtual void suspend(ReasonForSuspension) OVERRIDE;
-    virtual void resume() OVERRIDE;
+    // From DocumentLifecycleObserver:
+    virtual void documentWasDetached() OVERRIDE;
 
 private:
-    typedef Vector<RefPtr<PrerenderHandle> > HandleVector;
+    typedef Vector<RefPtr<Prerender> > PrerenderVector;
     typedef Vector<KURL> KURLVector;
 
     explicit Prerenderer(Document*);
@@ -73,8 +72,7 @@
 
     bool m_initializedClient;
     PrerendererClient* m_client;
-    HandleVector m_activeHandles;
-    HandleVector m_suspendedHandles;
+    PrerenderVector m_activePrerenders;
 };
 
 }
diff --git a/Source/core/loader/PrerendererClient.cpp b/Source/core/loader/PrerendererClient.cpp
index e7149fb..e19e725 100644
--- a/Source/core/loader/PrerendererClient.cpp
+++ b/Source/core/loader/PrerendererClient.cpp
@@ -33,7 +33,7 @@
 #include "core/loader/PrerendererClient.h"
 
 #include "core/page/Page.h"
-#include "core/platform/Supplementable.h"
+#include "platform/Supplementable.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/PrerendererClient.h b/Source/core/loader/PrerendererClient.h
index 4a9eafe..4c6a195 100644
--- a/Source/core/loader/PrerendererClient.h
+++ b/Source/core/loader/PrerendererClient.h
@@ -32,19 +32,19 @@
 #ifndef PrerendererClient_h
 #define PrerendererClient_h
 
-#include "core/platform/Supplementable.h"
+#include "platform/Supplementable.h"
 
 namespace WebCore {
 
 class Document;
 class Page;
-class PrerenderHandle;
+class Prerender;
 
 class PrerendererClient : public Supplement<Page> {
 public:
     virtual ~PrerendererClient() { }
 
-    virtual void willAddPrerender(PrerenderHandle*) = 0;
+    virtual void willAddPrerender(Prerender*) = 0;
 
     static const char* supplementName();
     static PrerendererClient* from(Page*);
diff --git a/Source/core/loader/ProgressTracker.cpp b/Source/core/loader/ProgressTracker.cpp
index 2daa653..3f4c972 100644
--- a/Source/core/loader/ProgressTracker.cpp
+++ b/Source/core/loader/ProgressTracker.cpp
@@ -29,9 +29,9 @@
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
-#include "core/platform/Logging.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
+#include "platform/Logging.h"
 #include "core/platform/network/ResourceResponse.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/text/CString.h"
diff --git a/Source/core/loader/SubstituteData.h b/Source/core/loader/SubstituteData.h
index ad6f2b7..1fff159 100644
--- a/Source/core/loader/SubstituteData.h
+++ b/Source/core/loader/SubstituteData.h
@@ -26,7 +26,7 @@
 #ifndef SubstituteData_h
 #define SubstituteData_h
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "weborigin/KURL.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/loader/TextResourceDecoderBuilder.cpp b/Source/core/loader/TextResourceDecoderBuilder.cpp
index 1ad3782..9dffcf5 100644
--- a/Source/core/loader/TextResourceDecoderBuilder.cpp
+++ b/Source/core/loader/TextResourceDecoderBuilder.cpp
@@ -32,7 +32,7 @@
 #include "core/loader/TextResourceDecoderBuilder.h"
 
 #include "core/dom/Document.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Settings.h"
 #include "weborigin/SecurityOrigin.h"
 
diff --git a/Source/core/loader/TextTrackLoader.cpp b/Source/core/loader/TextTrackLoader.cpp
index 7e6fd86..9e00e92 100644
--- a/Source/core/loader/TextTrackLoader.cpp
+++ b/Source/core/loader/TextTrackLoader.cpp
@@ -34,15 +34,15 @@
 #include "core/fetch/ResourceFetcher.h"
 #include "core/fetch/TextTrackResource.h"
 #include "core/html/track/WebVTTParser.h"
-#include "core/platform/Logging.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/Logging.h"
+#include "platform/SharedBuffer.h"
 #include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
-TextTrackLoader::TextTrackLoader(TextTrackLoaderClient* client, ScriptExecutionContext* context)
+TextTrackLoader::TextTrackLoader(TextTrackLoaderClient* client, ExecutionContext* context)
     : m_client(client)
-    , m_scriptExecutionContext(context)
+    , m_executionContext(context)
     , m_cueLoadTimer(this, &TextTrackLoader::cueLoadTimerFired)
     , m_state(Idle)
     , m_parseOffset(0)
@@ -89,7 +89,7 @@
         return;
 
     if (!m_cueParser)
-        m_cueParser = WebVTTParser::create(this, m_scriptExecutionContext);
+        m_cueParser = WebVTTParser::create(this, m_executionContext);
 
     const char* data;
     unsigned length;
@@ -114,7 +114,7 @@
 void TextTrackLoader::corsPolicyPreventedLoad()
 {
     DEFINE_STATIC_LOCAL(String, consoleMessage, ("Cross-origin text track load denied by Cross-Origin Resource Sharing policy."));
-    Document* document = toDocument(m_scriptExecutionContext);
+    Document* document = toDocument(m_executionContext);
     document->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, consoleMessage);
     m_state = Failed;
 }
@@ -123,7 +123,7 @@
 {
     ASSERT(m_cachedCueData == resource);
 
-    Document* document = toDocument(m_scriptExecutionContext);
+    Document* document = toDocument(m_executionContext);
     if (!m_crossOriginMode.isNull()
         && !document->securityOrigin()->canRequest(resource->response().url())
         && !resource->passesAccessControlCheck(document->securityOrigin())) {
@@ -150,8 +150,8 @@
     if (!m_client->shouldLoadCues(this))
         return false;
 
-    ASSERT(m_scriptExecutionContext->isDocument());
-    Document* document = toDocument(m_scriptExecutionContext);
+    ASSERT(m_executionContext->isDocument());
+    Document* document = toDocument(m_executionContext);
     FetchRequest cueRequest(ResourceRequest(document->completeURL(url)), FetchInitiatorTypeNames::texttrack);
 
     if (!crossOriginMode.isNull()) {
diff --git a/Source/core/loader/TextTrackLoader.h b/Source/core/loader/TextTrackLoader.h
index 4eb68a8..f76a67b 100644
--- a/Source/core/loader/TextTrackLoader.h
+++ b/Source/core/loader/TextTrackLoader.h
@@ -30,14 +30,14 @@
 #include "core/fetch/ResourcePtr.h"
 #include "core/fetch/TextTrackResource.h"
 #include "core/html/track/WebVTTParser.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/OwnPtr.h"
 
 namespace WebCore {
 
 class Document;
 class TextTrackLoader;
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class TextTrackLoaderClient {
 public:
@@ -56,7 +56,7 @@
     WTF_MAKE_NONCOPYABLE(TextTrackLoader);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<TextTrackLoader> create(TextTrackLoaderClient* client, ScriptExecutionContext* context)
+    static PassOwnPtr<TextTrackLoader> create(TextTrackLoaderClient* client, ExecutionContext* context)
     {
         return adoptPtr(new TextTrackLoader(client, context));
     }
@@ -85,7 +85,7 @@
 #endif
     virtual void fileFailedToParse();
 
-    TextTrackLoader(TextTrackLoaderClient*, ScriptExecutionContext*);
+    TextTrackLoader(TextTrackLoaderClient*, ExecutionContext*);
 
     void processNewCueData(Resource*);
     void cueLoadTimerFired(Timer<TextTrackLoader>*);
@@ -94,7 +94,7 @@
     TextTrackLoaderClient* m_client;
     OwnPtr<WebVTTParser> m_cueParser;
     ResourcePtr<TextTrackResource> m_cachedCueData;
-    ScriptExecutionContext* m_scriptExecutionContext;
+    ExecutionContext* m_executionContext;
     Timer<TextTrackLoader> m_cueLoadTimer;
     String m_crossOriginMode;
     State m_state;
diff --git a/Source/core/loader/ThreadableLoader.cpp b/Source/core/loader/ThreadableLoader.cpp
index 50279cb..476f915 100644
--- a/Source/core/loader/ThreadableLoader.cpp
+++ b/Source/core/loader/ThreadableLoader.cpp
@@ -32,7 +32,7 @@
 #include "core/loader/ThreadableLoader.h"
 
 #include "core/dom/Document.h"
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/loader/DocumentThreadableLoader.h"
 #include "core/loader/WorkerThreadableLoader.h"
 #include "core/workers/WorkerGlobalScope.h"
@@ -40,7 +40,7 @@
 
 namespace WebCore {
 
-PassRefPtr<ThreadableLoader> ThreadableLoader::create(ScriptExecutionContext* context, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options)
+PassRefPtr<ThreadableLoader> ThreadableLoader::create(ExecutionContext* context, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options)
 {
     ASSERT(client);
     ASSERT(context);
@@ -51,7 +51,7 @@
     return DocumentThreadableLoader::create(toDocument(context), client, request, options);
 }
 
-void ThreadableLoader::loadResourceSynchronously(ScriptExecutionContext* context, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options)
+void ThreadableLoader::loadResourceSynchronously(ExecutionContext* context, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options)
 {
     ASSERT(context);
 
diff --git a/Source/core/loader/ThreadableLoader.h b/Source/core/loader/ThreadableLoader.h
index a2afdd1..71316ae 100644
--- a/Source/core/loader/ThreadableLoader.h
+++ b/Source/core/loader/ThreadableLoader.h
@@ -42,7 +42,7 @@
     class ResourceError;
     class ResourceRequest;
     class ResourceResponse;
-    class ScriptExecutionContext;
+    class ExecutionContext;
     class ThreadableLoaderClient;
 
     enum CrossOriginRequestPolicy {
@@ -82,8 +82,8 @@
     class ThreadableLoader {
         WTF_MAKE_NONCOPYABLE(ThreadableLoader);
     public:
-        static void loadResourceSynchronously(ScriptExecutionContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
-        static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&);
+        static void loadResourceSynchronously(ExecutionContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
+        static PassRefPtr<ThreadableLoader> create(ExecutionContext*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&);
 
         virtual void cancel() = 0;
         void ref() { refThreadableLoader(); }
diff --git a/Source/core/loader/WorkerThreadableLoader.cpp b/Source/core/loader/WorkerThreadableLoader.cpp
index d76b724..4b05e57 100644
--- a/Source/core/loader/WorkerThreadableLoader.cpp
+++ b/Source/core/loader/WorkerThreadableLoader.cpp
@@ -36,12 +36,12 @@
 #include "core/dom/Document.h"
 #include "core/loader/DocumentThreadableLoader.h"
 #include "core/loader/ThreadableLoader.h"
-#include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
 #include "core/workers/WorkerGlobalScope.h"
 #include "core/workers/WorkerLoaderProxy.h"
 #include "core/workers/WorkerThread.h"
+#include "platform/network/ResourceError.h"
 #include "wtf/MainThread.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/Vector.h"
@@ -102,7 +102,7 @@
 {
 }
 
-void WorkerThreadableLoader::MainThreadBridge::mainThreadCreateLoader(ScriptExecutionContext* context, MainThreadBridge* thisPtr, PassOwnPtr<CrossThreadResourceRequestData> requestData, ThreadableLoaderOptions options, const String& outgoingReferrer)
+void WorkerThreadableLoader::MainThreadBridge::mainThreadCreateLoader(ExecutionContext* context, MainThreadBridge* thisPtr, PassOwnPtr<CrossThreadResourceRequestData> requestData, ThreadableLoaderOptions options, const String& outgoingReferrer)
 {
     ASSERT(isMainThread());
     Document* document = toDocument(context);
@@ -117,7 +117,7 @@
     ASSERT(thisPtr->m_mainThreadLoader);
 }
 
-void WorkerThreadableLoader::MainThreadBridge::mainThreadDestroy(ScriptExecutionContext* context, MainThreadBridge* thisPtr)
+void WorkerThreadableLoader::MainThreadBridge::mainThreadDestroy(ExecutionContext* context, MainThreadBridge* thisPtr)
 {
     ASSERT(isMainThread());
     ASSERT_UNUSED(context, context->isDocument());
@@ -134,7 +134,7 @@
         createCallbackTask(&MainThreadBridge::mainThreadDestroy, AllowCrossThreadAccess(this)));
 }
 
-void WorkerThreadableLoader::MainThreadBridge::mainThreadCancel(ScriptExecutionContext* context, MainThreadBridge* thisPtr)
+void WorkerThreadableLoader::MainThreadBridge::mainThreadCancel(ExecutionContext* context, MainThreadBridge* thisPtr)
 {
     ASSERT(isMainThread());
     ASSERT_UNUSED(context, context->isDocument());
@@ -165,7 +165,7 @@
     m_workerClientWrapper->clearClient();
 }
 
-static void workerGlobalScopeDidSendData(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
+static void workerGlobalScopeDidSendData(ExecutionContext* context, PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
 {
     ASSERT_UNUSED(context, context->isWorkerGlobalScope());
     workerClientWrapper->didSendData(bytesSent, totalBytesToBeSent);
@@ -176,7 +176,7 @@
     m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidSendData, m_workerClientWrapper, bytesSent, totalBytesToBeSent), m_taskMode);
 }
 
-static void workerGlobalScopeDidReceiveResponse(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier, PassOwnPtr<CrossThreadResourceResponseData> responseData)
+static void workerGlobalScopeDidReceiveResponse(ExecutionContext* context, PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier, PassOwnPtr<CrossThreadResourceResponseData> responseData)
 {
     ASSERT_UNUSED(context, context->isWorkerGlobalScope());
     OwnPtr<ResourceResponse> response(ResourceResponse::adopt(responseData));
@@ -188,7 +188,7 @@
     m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidReceiveResponse, m_workerClientWrapper, identifier, response), m_taskMode);
 }
 
-static void workerGlobalScopeDidReceiveData(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vector<char> > vectorData)
+static void workerGlobalScopeDidReceiveData(ExecutionContext* context, PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vector<char> > vectorData)
 {
     ASSERT_UNUSED(context, context->isWorkerGlobalScope());
     workerClientWrapper->didReceiveData(vectorData->data(), vectorData->size());
@@ -201,7 +201,7 @@
     m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidReceiveData, m_workerClientWrapper, vector.release()), m_taskMode);
 }
 
-static void workerGlobalScopeDidReceiveCachedMetadata(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vector<char> > vectorData)
+static void workerGlobalScopeDidReceiveCachedMetadata(ExecutionContext* context, PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vector<char> > vectorData)
 {
     ASSERT_UNUSED(context, context->isWorkerGlobalScope());
     workerClientWrapper->didReceiveCachedMetadata(vectorData->data(), vectorData->size());
@@ -214,7 +214,7 @@
     m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidReceiveCachedMetadata, m_workerClientWrapper, vector.release()), m_taskMode);
 }
 
-static void workerGlobalScopeDidFinishLoading(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier, double finishTime)
+static void workerGlobalScopeDidFinishLoading(ExecutionContext* context, PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier, double finishTime)
 {
     ASSERT_UNUSED(context, context->isWorkerGlobalScope());
     workerClientWrapper->didFinishLoading(identifier, finishTime);
@@ -225,7 +225,7 @@
     m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidFinishLoading, m_workerClientWrapper, identifier, finishTime), m_taskMode);
 }
 
-static void workerGlobalScopeDidFail(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, const ResourceError& error)
+static void workerGlobalScopeDidFail(ExecutionContext* context, PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, const ResourceError& error)
 {
     ASSERT_UNUSED(context, context->isWorkerGlobalScope());
     workerClientWrapper->didFail(error);
@@ -236,7 +236,7 @@
     m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidFail, m_workerClientWrapper, error), m_taskMode);
 }
 
-static void workerGlobalScopeDidFailAccessControlCheck(ScriptExecutionContext* context, PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, const ResourceError& error)
+static void workerGlobalScopeDidFailAccessControlCheck(ExecutionContext* context, PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, const ResourceError& error)
 {
     ASSERT_UNUSED(context, context->isWorkerGlobalScope());
     workerClientWrapper->didFailAccessControlCheck(error);
@@ -247,7 +247,7 @@
     m_loaderProxy.postTaskForModeToWorkerGlobalScope(createCallbackTask(&workerGlobalScopeDidFailAccessControlCheck, m_workerClientWrapper, error), m_taskMode);
 }
 
-static void workerGlobalScopeDidFailRedirectCheck(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper)
+static void workerGlobalScopeDidFailRedirectCheck(ExecutionContext* context, PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper)
 {
     ASSERT_UNUSED(context, context->isWorkerGlobalScope());
     workerClientWrapper->didFailRedirectCheck();
diff --git a/Source/core/loader/WorkerThreadableLoader.h b/Source/core/loader/WorkerThreadableLoader.h
index 911bf6e..0d4ef1a 100644
--- a/Source/core/loader/WorkerThreadableLoader.h
+++ b/Source/core/loader/WorkerThreadableLoader.h
@@ -104,11 +104,11 @@
             void clearClientWrapper();
 
             // All executed on the main thread.
-            static void mainThreadDestroy(ScriptExecutionContext*, MainThreadBridge*);
+            static void mainThreadDestroy(ExecutionContext*, MainThreadBridge*);
             ~MainThreadBridge();
 
-            static void mainThreadCreateLoader(ScriptExecutionContext*, MainThreadBridge*, PassOwnPtr<CrossThreadResourceRequestData>, ThreadableLoaderOptions, const String& outgoingReferrer);
-            static void mainThreadCancel(ScriptExecutionContext*, MainThreadBridge*);
+            static void mainThreadCreateLoader(ExecutionContext*, MainThreadBridge*, PassOwnPtr<CrossThreadResourceRequestData>, ThreadableLoaderOptions, const String& outgoingReferrer);
+            static void mainThreadCancel(ExecutionContext*, MainThreadBridge*);
             virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) OVERRIDE;
             virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&) OVERRIDE;
             virtual void didReceiveData(const char*, int dataLength) OVERRIDE;
diff --git a/Source/core/loader/appcache/ApplicationCache.cpp b/Source/core/loader/appcache/ApplicationCache.cpp
index b3dd1a6..bc9ac05 100644
--- a/Source/core/loader/appcache/ApplicationCache.cpp
+++ b/Source/core/loader/appcache/ApplicationCache.cpp
@@ -29,13 +29,13 @@
 #include "bindings/v8/ExceptionMessages.h"
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
-#include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
+#include "core/events/EventListener.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/appcache/ApplicationCacheHost.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 namespace WebCore {
 
@@ -93,10 +93,10 @@
 
 const AtomicString& ApplicationCache::interfaceName() const
 {
-    return eventNames().interfaceForApplicationCache;
+    return EventTargetNames::ApplicationCache;
 }
 
-ScriptExecutionContext* ApplicationCache::scriptExecutionContext() const
+ExecutionContext* ApplicationCache::executionContext() const
 {
     if (m_frame)
         return m_frame->document();
@@ -107,34 +107,24 @@
 {
     switch (id) {
     case ApplicationCacheHost::CHECKING_EVENT:
-        return eventNames().checkingEvent;
+        return EventTypeNames::checking;
     case ApplicationCacheHost::ERROR_EVENT:
-        return eventNames().errorEvent;
+        return EventTypeNames::error;
     case ApplicationCacheHost::NOUPDATE_EVENT:
-        return eventNames().noupdateEvent;
+        return EventTypeNames::noupdate;
     case ApplicationCacheHost::DOWNLOADING_EVENT:
-        return eventNames().downloadingEvent;
+        return EventTypeNames::downloading;
     case ApplicationCacheHost::PROGRESS_EVENT:
-        return eventNames().progressEvent;
+        return EventTypeNames::progress;
     case ApplicationCacheHost::UPDATEREADY_EVENT:
-        return eventNames().updatereadyEvent;
+        return EventTypeNames::updateready;
     case ApplicationCacheHost::CACHED_EVENT:
-        return eventNames().cachedEvent;
+        return EventTypeNames::cached;
     case ApplicationCacheHost::OBSOLETE_EVENT:
-        return eventNames().obsoleteEvent;
+        return EventTypeNames::obsolete;
     }
     ASSERT_NOT_REACHED();
-    return eventNames().errorEvent;
-}
-
-EventTargetData* ApplicationCache::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* ApplicationCache::ensureEventTargetData()
-{
-    return &m_eventTargetData;
+    return EventTypeNames::error;
 }
 
 } // namespace WebCore
diff --git a/Source/core/loader/appcache/ApplicationCache.h b/Source/core/loader/appcache/ApplicationCache.h
index 39c4ac5..9e6fe1d 100644
--- a/Source/core/loader/appcache/ApplicationCache.h
+++ b/Source/core/loader/appcache/ApplicationCache.h
@@ -27,10 +27,10 @@
 #define ApplicationCache_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/events/EventNames.h"
 #include "core/events/EventTarget.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/loader/appcache/ApplicationCacheHost.h"
-#include "core/page/DOMWindowProperty.h"
+#include "core/frame/DOMWindowProperty.h"
 #include "wtf/Forward.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
@@ -41,7 +41,7 @@
 class Frame;
 class KURL;
 
-class ApplicationCache : public ScriptWrappable, public RefCounted<ApplicationCache>, public EventTarget, public DOMWindowProperty {
+class ApplicationCache : public ScriptWrappable, public RefCounted<ApplicationCache>, public EventTargetWithInlineData, public DOMWindowProperty {
 public:
     static PassRefPtr<ApplicationCache> create(Frame* frame) { return adoptRef(new ApplicationCache(frame)); }
     ~ApplicationCache() { ASSERT(!m_frame); }
@@ -69,22 +69,18 @@
     DEFINE_ATTRIBUTE_EVENT_LISTENER(cached);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(obsolete);
 
-    virtual const AtomicString& interfaceName() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const;
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
 
     static const AtomicString& toEventType(ApplicationCacheHost::EventID);
 
 private:
     explicit ApplicationCache(Frame*);
 
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
-    virtual EventTargetData* eventTargetData();
-    virtual EventTargetData* ensureEventTargetData();
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
 
     ApplicationCacheHost* applicationCacheHost() const;
-
-    EventTargetData m_eventTargetData;
 };
 
 } // namespace WebCore
diff --git a/Source/core/loader/archive/ArchiveResource.cpp b/Source/core/loader/archive/ArchiveResource.cpp
index ebcbadc..07e3f1d 100644
--- a/Source/core/loader/archive/ArchiveResource.cpp
+++ b/Source/core/loader/archive/ArchiveResource.cpp
@@ -29,7 +29,7 @@
 #include "config.h"
 #include "core/loader/archive/ArchiveResource.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 
 namespace WebCore {
 
diff --git a/Source/core/loader/archive/ArchiveResource.h b/Source/core/loader/archive/ArchiveResource.h
index df6a949..3c96e6c 100644
--- a/Source/core/loader/archive/ArchiveResource.h
+++ b/Source/core/loader/archive/ArchiveResource.h
@@ -29,7 +29,7 @@
 #ifndef ArchiveResource_h
 #define ArchiveResource_h
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/network/ResourceResponse.h"
 #include "weborigin/KURL.h"
 #include "wtf/RefCounted.h"
diff --git a/Source/core/loader/archive/MHTMLArchive.cpp b/Source/core/loader/archive/MHTMLArchive.cpp
index 90cdb2c..a470445 100644
--- a/Source/core/loader/archive/MHTMLArchive.cpp
+++ b/Source/core/loader/archive/MHTMLArchive.cpp
@@ -35,8 +35,8 @@
 #include "core/loader/archive/MHTMLParser.h"
 #include "core/platform/MIMETypeRegistry.h"
 #include "core/platform/SerializedResource.h"
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/text/QuotedPrintable.h"
+#include "platform/SharedBuffer.h"
+#include "platform/text/QuotedPrintable.h"
 #include "weborigin/SchemeRegistry.h"
 #include "wtf/CryptographicallyRandomNumber.h"
 #include "wtf/DateMath.h"
diff --git a/Source/core/loader/archive/MHTMLParser.cpp b/Source/core/loader/archive/MHTMLParser.cpp
index 6bab361..b306165 100644
--- a/Source/core/loader/archive/MHTMLParser.cpp
+++ b/Source/core/loader/archive/MHTMLParser.cpp
@@ -33,12 +33,155 @@
 
 #include "core/loader/archive/MHTMLArchive.h"
 #include "core/platform/MIMETypeRegistry.h"
-#include "core/platform/network/MIMEHeader.h"
-#include "core/platform/text/QuotedPrintable.h"
+#include "platform/SharedBufferChunkReader.h"
+#include "platform/network/ParsedContentType.h"
+#include "platform/text/QuotedPrintable.h"
+#include "wtf/HashMap.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
 #include "wtf/text/Base64.h"
+#include "wtf/text/CString.h"
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/StringConcatenate.h"
+#include "wtf/text/StringHash.h"
+#include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
+// This class is a limited MIME parser used to parse the MIME headers of MHTML files.
+class MIMEHeader : public RefCounted<MIMEHeader> {
+public:
+    enum Encoding {
+        QuotedPrintable,
+        Base64,
+        EightBit,
+        SevenBit,
+        Binary,
+        Unknown
+    };
+
+    static PassRefPtr<MIMEHeader> parseHeader(SharedBufferChunkReader* crLFLineReader);
+
+    bool isMultipart() const { return m_contentType.startsWith("multipart/"); }
+
+    String contentType() const { return m_contentType; }
+    String charset() const { return m_charset; }
+    Encoding contentTransferEncoding() const { return m_contentTransferEncoding; }
+    String contentLocation() const { return m_contentLocation; }
+
+    // Multi-part type and boundaries are only valid for multipart MIME headers.
+    String multiPartType() const { return m_multipartType; }
+    String endOfPartBoundary() const { return m_endOfPartBoundary; }
+    String endOfDocumentBoundary() const { return m_endOfDocumentBoundary; }
+
+private:
+    MIMEHeader();
+
+    static Encoding parseContentTransferEncoding(const String&);
+
+    String m_contentType;
+    String m_charset;
+    Encoding m_contentTransferEncoding;
+    String m_contentLocation;
+    String m_multipartType;
+    String m_endOfPartBoundary;
+    String m_endOfDocumentBoundary;
+};
+
+typedef HashMap<String, String> KeyValueMap;
+
+static KeyValueMap retrieveKeyValuePairs(WebCore::SharedBufferChunkReader* buffer)
+{
+    KeyValueMap keyValuePairs;
+    String line;
+    String key;
+    StringBuilder value;
+    while (!(line = buffer->nextChunkAsUTF8StringWithLatin1Fallback()).isNull()) {
+        if (line.isEmpty())
+            break; // Empty line means end of key/value section.
+        if (line[0] == '\t') {
+            ASSERT(!key.isEmpty());
+            value.append(line.substring(1));
+            continue;
+        }
+        // New key/value, store the previous one if any.
+        if (!key.isEmpty()) {
+            if (keyValuePairs.find(key) != keyValuePairs.end())
+                LOG_ERROR("Key duplicate found in MIME header. Key is '%s', previous value replaced.", key.ascii().data());
+            keyValuePairs.add(key, value.toString().stripWhiteSpace());
+            key = String();
+            value.clear();
+        }
+        size_t semiColonIndex = line.find(':');
+        if (semiColonIndex == kNotFound) {
+            // This is not a key value pair, ignore.
+            continue;
+        }
+        key = line.substring(0, semiColonIndex).lower().stripWhiteSpace();
+        value.append(line.substring(semiColonIndex + 1));
+    }
+    // Store the last property if there is one.
+    if (!key.isEmpty())
+        keyValuePairs.set(key, value.toString().stripWhiteSpace());
+    return keyValuePairs;
+}
+
+PassRefPtr<MIMEHeader> MIMEHeader::parseHeader(SharedBufferChunkReader* buffer)
+{
+    RefPtr<MIMEHeader> mimeHeader = adoptRef(new MIMEHeader);
+    KeyValueMap keyValuePairs = retrieveKeyValuePairs(buffer);
+    KeyValueMap::iterator mimeParametersIterator = keyValuePairs.find("content-type");
+    if (mimeParametersIterator != keyValuePairs.end()) {
+        ParsedContentType parsedContentType(mimeParametersIterator->value);
+        mimeHeader->m_contentType = parsedContentType.mimeType();
+        if (!mimeHeader->isMultipart()) {
+            mimeHeader->m_charset = parsedContentType.charset().stripWhiteSpace();
+        } else {
+            mimeHeader->m_multipartType = parsedContentType.parameterValueForName("type");
+            mimeHeader->m_endOfPartBoundary = parsedContentType.parameterValueForName("boundary");
+            if (mimeHeader->m_endOfPartBoundary.isNull()) {
+                LOG_ERROR("No boundary found in multipart MIME header.");
+                return 0;
+            }
+            mimeHeader->m_endOfPartBoundary.insert("--", 0);
+            mimeHeader->m_endOfDocumentBoundary = mimeHeader->m_endOfPartBoundary;
+            mimeHeader->m_endOfDocumentBoundary.append("--");
+        }
+    }
+
+    mimeParametersIterator = keyValuePairs.find("content-transfer-encoding");
+    if (mimeParametersIterator != keyValuePairs.end())
+        mimeHeader->m_contentTransferEncoding = parseContentTransferEncoding(mimeParametersIterator->value);
+
+    mimeParametersIterator = keyValuePairs.find("content-location");
+    if (mimeParametersIterator != keyValuePairs.end())
+        mimeHeader->m_contentLocation = mimeParametersIterator->value;
+
+    return mimeHeader.release();
+}
+
+MIMEHeader::Encoding MIMEHeader::parseContentTransferEncoding(const String& text)
+{
+    String encoding = text.stripWhiteSpace().lower();
+    if (encoding == "base64")
+        return Base64;
+    if (encoding == "quoted-printable")
+        return QuotedPrintable;
+    if (encoding == "8bit")
+        return EightBit;
+    if (encoding == "7bit")
+        return SevenBit;
+    if (encoding == "binary")
+        return Binary;
+    LOG_ERROR("Unknown encoding '%s' found in MIME header.", text.ascii().data());
+    return Unknown;
+}
+
+MIMEHeader::MIMEHeader()
+    : m_contentTransferEncoding(Unknown)
+{
+}
+
 static bool skipLinesUntilBoundaryFound(SharedBufferChunkReader& lineReader, const String& boundary)
 {
     String line;
diff --git a/Source/core/loader/archive/MHTMLParser.h b/Source/core/loader/archive/MHTMLParser.h
index dda8bd3..58333a7 100644
--- a/Source/core/loader/archive/MHTMLParser.h
+++ b/Source/core/loader/archive/MHTMLParser.h
@@ -31,7 +31,7 @@
 #ifndef MHTMLParser_h
 #define MHTMLParser_h
 
-#include "core/platform/SharedBufferChunkReader.h"
+#include "platform/SharedBufferChunkReader.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
 #include "wtf/text/WTFString.h"
diff --git a/Source/core/make_derived_sources.target.darwin-arm.mk b/Source/core/make_derived_sources.target.darwin-arm.mk
index 114713f..be16935 100644
--- a/Source/core/make_derived_sources.target.darwin-arm.mk
+++ b/Source/core/make_derived_sources.target.darwin-arm.mk
@@ -21,7 +21,7 @@
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustomScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating V8ArrayBufferViewCustomScript.h from V8ArrayBufferViewCustomScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
 
 
 ### Rules for action "generateXMLViewerCSS":
@@ -31,7 +31,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerCSS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
 
 
 ### Rules for action "generateXMLViewerJS":
@@ -41,7 +41,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerJS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
 
 
 ### Rules for action "HTMLEntityTable":
@@ -59,9 +59,9 @@
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.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)
+$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_RuntimeEnabledFeatures ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.h: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp ;
 
@@ -70,9 +70,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp ;
 
@@ -81,9 +81,9 @@
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StylePropertyShorthand ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.h: $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp ;
 
@@ -92,9 +92,9 @@
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StyleBuilder ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.h: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.cpp: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
@@ -104,9 +104,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_value_keywords.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSValueKeywords.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSValueKeywords.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_css_value_keywords.py $(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_derived_sources_gyp_make_derived_sources_target_CSSValueKeywords ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; ../build/scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp ;
 
@@ -115,9 +115,9 @@
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.h: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
@@ -129,9 +129,9 @@
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.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/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FontFamilyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl css/FontFamilyNames.in -- --fonts
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl css/FontFamilyNames.in -- --fonts
 
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp ;
 
@@ -140,9 +140,9 @@
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/SVGNames.h: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
@@ -155,32 +155,54 @@
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventHeaders.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 $(gyp_shared_intermediate_dir)/blink/EventInterfaces.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 
+### Rules for action "EventNames":
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventNames.h: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp ;
+
 ### Rules for action "EventTargetFactory":
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h: $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h ;
 
+### Rules for action "EventTargetNames":
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp ;
+
 ### Rules for action "MathMLNames":
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.h: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp ;
 
@@ -189,9 +211,9 @@
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/build/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_UserAgentStyleSheets ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl ../build/scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h ;
 
@@ -200,53 +222,31 @@
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.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/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FetchInitiatorTypeNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl fetch/FetchInitiatorTypeNames.in -- --resourceTypes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py fetch/FetchInitiatorTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp ;
 
-### Rules for action "PickerCommon":
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_PickerCommon ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/PickerCommon.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp" Resources/pagepopups/pickerCommon.css Resources/pagepopups/pickerCommon.js
+### Rules for action "EventTypeNames":
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.h ;
-
-### Rules for action "CalendarPicker":
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.js $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/calendarPickerChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/pickerCommonChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CalendarPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--condition=ENABLE(CALENDAR_PICKER)" "--out-h=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp" Resources/pagepopups/calendarPicker.css Resources/pagepopups/calendarPicker.js Resources/pagepopups/chromium/calendarPickerChromium.css Resources/pagepopups/chromium/pickerCommonChromium.css Resources/pagepopups/suggestionPicker.css Resources/pagepopups/suggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.h ;
-
-### Rules for action "ColorSuggestionPicker":
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_ColorSuggestionPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp" Resources/pagepopups/colorSuggestionPicker.css Resources/pagepopups/colorSuggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h ;
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp ;
 
 ### Rules for action "XLinkNames":
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py svg/xlinkattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.h: $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp ;
 
@@ -255,9 +255,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlnsattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp ;
 
@@ -266,9 +266,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp ;
 
@@ -279,7 +279,7 @@
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/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_derived_sources_gyp_make_derived_sources_target_preprocess_grammar ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -I../build/scripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
 
 
 ### Rules for action "MakeTokenMatcher":
@@ -287,21 +287,31 @@
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcher ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+
+
+### Rules for action "MakeTokenMatcherForViewport":
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLMetaElement-in.cpp $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcherForViewport ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/html/HTMLMetaElement-in.cpp "$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp"
 
 
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_bison":
-# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', 'scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
+# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', '../build/scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.h: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -312,7 +322,7 @@
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XPathGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.h: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -320,13 +330,13 @@
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_gperf":
-# "{'inputs': ['scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', 'scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
+# "{'inputs': ['../build/scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', '../build/scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
+$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl ../build/scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
 
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
 third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger: $(gyp_shared_intermediate_dir)/blink/ColorData.cpp
@@ -365,20 +375,20 @@
 	$(gyp_shared_intermediate_dir)/blink/Event.cpp \
 	$(gyp_shared_intermediate_dir)/blink/EventHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp \
@@ -387,6 +397,7 @@
 	$(gyp_shared_intermediate_dir)/blink/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y \
 	$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp \
+	$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp \
@@ -451,7 +462,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
@@ -532,7 +542,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
diff --git a/Source/core/make_derived_sources.target.darwin-mips.mk b/Source/core/make_derived_sources.target.darwin-mips.mk
index 595d076..41870e2 100644
--- a/Source/core/make_derived_sources.target.darwin-mips.mk
+++ b/Source/core/make_derived_sources.target.darwin-mips.mk
@@ -21,7 +21,7 @@
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustomScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating V8ArrayBufferViewCustomScript.h from V8ArrayBufferViewCustomScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
 
 
 ### Rules for action "generateXMLViewerCSS":
@@ -31,7 +31,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerCSS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
 
 
 ### Rules for action "generateXMLViewerJS":
@@ -41,7 +41,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerJS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
 
 
 ### Rules for action "HTMLEntityTable":
@@ -59,9 +59,9 @@
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.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)
+$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_RuntimeEnabledFeatures ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.h: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp ;
 
@@ -70,9 +70,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp ;
 
@@ -81,9 +81,9 @@
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StylePropertyShorthand ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.h: $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp ;
 
@@ -92,9 +92,9 @@
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StyleBuilder ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.h: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.cpp: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
@@ -104,9 +104,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_value_keywords.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSValueKeywords.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSValueKeywords.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_css_value_keywords.py $(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_derived_sources_gyp_make_derived_sources_target_CSSValueKeywords ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; ../build/scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp ;
 
@@ -115,9 +115,9 @@
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.h: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
@@ -129,9 +129,9 @@
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.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/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FontFamilyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl css/FontFamilyNames.in -- --fonts
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl css/FontFamilyNames.in -- --fonts
 
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp ;
 
@@ -140,9 +140,9 @@
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/SVGNames.h: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
@@ -155,32 +155,54 @@
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventHeaders.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 $(gyp_shared_intermediate_dir)/blink/EventInterfaces.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 
+### Rules for action "EventNames":
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventNames.h: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp ;
+
 ### Rules for action "EventTargetFactory":
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h: $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h ;
 
+### Rules for action "EventTargetNames":
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp ;
+
 ### Rules for action "MathMLNames":
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.h: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp ;
 
@@ -189,9 +211,9 @@
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/build/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_UserAgentStyleSheets ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl ../build/scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h ;
 
@@ -200,53 +222,31 @@
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.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/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FetchInitiatorTypeNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl fetch/FetchInitiatorTypeNames.in -- --resourceTypes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py fetch/FetchInitiatorTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp ;
 
-### Rules for action "PickerCommon":
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_PickerCommon ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/PickerCommon.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp" Resources/pagepopups/pickerCommon.css Resources/pagepopups/pickerCommon.js
+### Rules for action "EventTypeNames":
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.h ;
-
-### Rules for action "CalendarPicker":
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.js $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/calendarPickerChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/pickerCommonChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CalendarPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--condition=ENABLE(CALENDAR_PICKER)" "--out-h=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp" Resources/pagepopups/calendarPicker.css Resources/pagepopups/calendarPicker.js Resources/pagepopups/chromium/calendarPickerChromium.css Resources/pagepopups/chromium/pickerCommonChromium.css Resources/pagepopups/suggestionPicker.css Resources/pagepopups/suggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.h ;
-
-### Rules for action "ColorSuggestionPicker":
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_ColorSuggestionPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp" Resources/pagepopups/colorSuggestionPicker.css Resources/pagepopups/colorSuggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h ;
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp ;
 
 ### Rules for action "XLinkNames":
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py svg/xlinkattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.h: $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp ;
 
@@ -255,9 +255,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlnsattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp ;
 
@@ -266,9 +266,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp ;
 
@@ -279,7 +279,7 @@
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/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_derived_sources_gyp_make_derived_sources_target_preprocess_grammar ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -I../build/scripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
 
 
 ### Rules for action "MakeTokenMatcher":
@@ -287,21 +287,31 @@
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcher ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+
+
+### Rules for action "MakeTokenMatcherForViewport":
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLMetaElement-in.cpp $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcherForViewport ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/html/HTMLMetaElement-in.cpp "$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp"
 
 
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_bison":
-# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', 'scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
+# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', '../build/scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.h: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -312,7 +322,7 @@
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XPathGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.h: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -320,13 +330,13 @@
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_gperf":
-# "{'inputs': ['scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', 'scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
+# "{'inputs': ['../build/scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', '../build/scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
+$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl ../build/scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
 
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
 third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger: $(gyp_shared_intermediate_dir)/blink/ColorData.cpp
@@ -365,20 +375,20 @@
 	$(gyp_shared_intermediate_dir)/blink/Event.cpp \
 	$(gyp_shared_intermediate_dir)/blink/EventHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp \
@@ -387,6 +397,7 @@
 	$(gyp_shared_intermediate_dir)/blink/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y \
 	$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp \
+	$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp \
@@ -451,7 +462,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
@@ -532,7 +542,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
diff --git a/Source/core/make_derived_sources.target.darwin-x86.mk b/Source/core/make_derived_sources.target.darwin-x86.mk
index 600c361..e0a50c0 100644
--- a/Source/core/make_derived_sources.target.darwin-x86.mk
+++ b/Source/core/make_derived_sources.target.darwin-x86.mk
@@ -21,7 +21,7 @@
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustomScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating V8ArrayBufferViewCustomScript.h from V8ArrayBufferViewCustomScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
 
 
 ### Rules for action "generateXMLViewerCSS":
@@ -31,7 +31,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerCSS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
 
 
 ### Rules for action "generateXMLViewerJS":
@@ -41,7 +41,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerJS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
 
 
 ### Rules for action "HTMLEntityTable":
@@ -59,9 +59,9 @@
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.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)
+$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_RuntimeEnabledFeatures ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.h: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp ;
 
@@ -70,9 +70,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp ;
 
@@ -81,9 +81,9 @@
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StylePropertyShorthand ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.h: $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp ;
 
@@ -92,9 +92,9 @@
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StyleBuilder ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.h: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.cpp: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
@@ -104,9 +104,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_value_keywords.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSValueKeywords.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSValueKeywords.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_css_value_keywords.py $(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_derived_sources_gyp_make_derived_sources_target_CSSValueKeywords ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; ../build/scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp ;
 
@@ -115,9 +115,9 @@
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.h: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
@@ -129,9 +129,9 @@
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.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/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FontFamilyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl css/FontFamilyNames.in -- --fonts
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl css/FontFamilyNames.in -- --fonts
 
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp ;
 
@@ -140,9 +140,9 @@
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/SVGNames.h: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
@@ -155,32 +155,54 @@
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventHeaders.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 $(gyp_shared_intermediate_dir)/blink/EventInterfaces.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 
+### Rules for action "EventNames":
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventNames.h: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp ;
+
 ### Rules for action "EventTargetFactory":
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h: $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h ;
 
+### Rules for action "EventTargetNames":
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp ;
+
 ### Rules for action "MathMLNames":
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.h: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp ;
 
@@ -189,9 +211,9 @@
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/build/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_UserAgentStyleSheets ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl ../build/scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h ;
 
@@ -200,53 +222,31 @@
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.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/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FetchInitiatorTypeNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl fetch/FetchInitiatorTypeNames.in -- --resourceTypes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py fetch/FetchInitiatorTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp ;
 
-### Rules for action "PickerCommon":
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_PickerCommon ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/PickerCommon.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp" Resources/pagepopups/pickerCommon.css Resources/pagepopups/pickerCommon.js
+### Rules for action "EventTypeNames":
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.h ;
-
-### Rules for action "CalendarPicker":
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.js $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/calendarPickerChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/pickerCommonChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CalendarPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--condition=ENABLE(CALENDAR_PICKER)" "--out-h=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp" Resources/pagepopups/calendarPicker.css Resources/pagepopups/calendarPicker.js Resources/pagepopups/chromium/calendarPickerChromium.css Resources/pagepopups/chromium/pickerCommonChromium.css Resources/pagepopups/suggestionPicker.css Resources/pagepopups/suggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.h ;
-
-### Rules for action "ColorSuggestionPicker":
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_ColorSuggestionPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp" Resources/pagepopups/colorSuggestionPicker.css Resources/pagepopups/colorSuggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h ;
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp ;
 
 ### Rules for action "XLinkNames":
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py svg/xlinkattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.h: $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp ;
 
@@ -255,9 +255,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlnsattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp ;
 
@@ -266,9 +266,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp ;
 
@@ -279,7 +279,7 @@
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/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_derived_sources_gyp_make_derived_sources_target_preprocess_grammar ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -I../build/scripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
 
 
 ### Rules for action "MakeTokenMatcher":
@@ -287,21 +287,31 @@
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcher ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+
+
+### Rules for action "MakeTokenMatcherForViewport":
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLMetaElement-in.cpp $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcherForViewport ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/html/HTMLMetaElement-in.cpp "$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp"
 
 
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_bison":
-# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', 'scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
+# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', '../build/scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.h: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -312,7 +322,7 @@
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XPathGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.h: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -320,13 +330,13 @@
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_gperf":
-# "{'inputs': ['scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', 'scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
+# "{'inputs': ['../build/scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', '../build/scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
+$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl ../build/scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
 
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
 third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger: $(gyp_shared_intermediate_dir)/blink/ColorData.cpp
@@ -365,20 +375,20 @@
 	$(gyp_shared_intermediate_dir)/blink/Event.cpp \
 	$(gyp_shared_intermediate_dir)/blink/EventHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp \
@@ -387,6 +397,7 @@
 	$(gyp_shared_intermediate_dir)/blink/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y \
 	$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp \
+	$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp \
@@ -453,7 +464,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
@@ -537,7 +547,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
diff --git a/Source/core/make_derived_sources.target.linux-arm.mk b/Source/core/make_derived_sources.target.linux-arm.mk
index 114713f..be16935 100644
--- a/Source/core/make_derived_sources.target.linux-arm.mk
+++ b/Source/core/make_derived_sources.target.linux-arm.mk
@@ -21,7 +21,7 @@
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustomScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating V8ArrayBufferViewCustomScript.h from V8ArrayBufferViewCustomScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
 
 
 ### Rules for action "generateXMLViewerCSS":
@@ -31,7 +31,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerCSS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
 
 
 ### Rules for action "generateXMLViewerJS":
@@ -41,7 +41,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerJS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
 
 
 ### Rules for action "HTMLEntityTable":
@@ -59,9 +59,9 @@
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.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)
+$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_RuntimeEnabledFeatures ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.h: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp ;
 
@@ -70,9 +70,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp ;
 
@@ -81,9 +81,9 @@
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StylePropertyShorthand ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.h: $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp ;
 
@@ -92,9 +92,9 @@
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StyleBuilder ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.h: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.cpp: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
@@ -104,9 +104,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_value_keywords.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSValueKeywords.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSValueKeywords.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_css_value_keywords.py $(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_derived_sources_gyp_make_derived_sources_target_CSSValueKeywords ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; ../build/scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp ;
 
@@ -115,9 +115,9 @@
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.h: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
@@ -129,9 +129,9 @@
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.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/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FontFamilyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl css/FontFamilyNames.in -- --fonts
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl css/FontFamilyNames.in -- --fonts
 
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp ;
 
@@ -140,9 +140,9 @@
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/SVGNames.h: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
@@ -155,32 +155,54 @@
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventHeaders.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 $(gyp_shared_intermediate_dir)/blink/EventInterfaces.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 
+### Rules for action "EventNames":
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventNames.h: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp ;
+
 ### Rules for action "EventTargetFactory":
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h: $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h ;
 
+### Rules for action "EventTargetNames":
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp ;
+
 ### Rules for action "MathMLNames":
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.h: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp ;
 
@@ -189,9 +211,9 @@
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/build/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_UserAgentStyleSheets ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl ../build/scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h ;
 
@@ -200,53 +222,31 @@
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.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/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FetchInitiatorTypeNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl fetch/FetchInitiatorTypeNames.in -- --resourceTypes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py fetch/FetchInitiatorTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp ;
 
-### Rules for action "PickerCommon":
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_PickerCommon ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/PickerCommon.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp" Resources/pagepopups/pickerCommon.css Resources/pagepopups/pickerCommon.js
+### Rules for action "EventTypeNames":
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.h ;
-
-### Rules for action "CalendarPicker":
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.js $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/calendarPickerChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/pickerCommonChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CalendarPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--condition=ENABLE(CALENDAR_PICKER)" "--out-h=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp" Resources/pagepopups/calendarPicker.css Resources/pagepopups/calendarPicker.js Resources/pagepopups/chromium/calendarPickerChromium.css Resources/pagepopups/chromium/pickerCommonChromium.css Resources/pagepopups/suggestionPicker.css Resources/pagepopups/suggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.h ;
-
-### Rules for action "ColorSuggestionPicker":
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_ColorSuggestionPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp" Resources/pagepopups/colorSuggestionPicker.css Resources/pagepopups/colorSuggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h ;
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp ;
 
 ### Rules for action "XLinkNames":
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py svg/xlinkattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.h: $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp ;
 
@@ -255,9 +255,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlnsattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp ;
 
@@ -266,9 +266,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp ;
 
@@ -279,7 +279,7 @@
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/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_derived_sources_gyp_make_derived_sources_target_preprocess_grammar ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -I../build/scripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
 
 
 ### Rules for action "MakeTokenMatcher":
@@ -287,21 +287,31 @@
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcher ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+
+
+### Rules for action "MakeTokenMatcherForViewport":
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLMetaElement-in.cpp $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcherForViewport ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/html/HTMLMetaElement-in.cpp "$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp"
 
 
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_bison":
-# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', 'scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
+# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', '../build/scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.h: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -312,7 +322,7 @@
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XPathGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.h: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -320,13 +330,13 @@
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_gperf":
-# "{'inputs': ['scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', 'scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
+# "{'inputs': ['../build/scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', '../build/scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
+$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl ../build/scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
 
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
 third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger: $(gyp_shared_intermediate_dir)/blink/ColorData.cpp
@@ -365,20 +375,20 @@
 	$(gyp_shared_intermediate_dir)/blink/Event.cpp \
 	$(gyp_shared_intermediate_dir)/blink/EventHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp \
@@ -387,6 +397,7 @@
 	$(gyp_shared_intermediate_dir)/blink/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y \
 	$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp \
+	$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp \
@@ -451,7 +462,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
@@ -532,7 +542,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
diff --git a/Source/core/make_derived_sources.target.linux-mips.mk b/Source/core/make_derived_sources.target.linux-mips.mk
index 595d076..41870e2 100644
--- a/Source/core/make_derived_sources.target.linux-mips.mk
+++ b/Source/core/make_derived_sources.target.linux-mips.mk
@@ -21,7 +21,7 @@
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustomScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating V8ArrayBufferViewCustomScript.h from V8ArrayBufferViewCustomScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
 
 
 ### Rules for action "generateXMLViewerCSS":
@@ -31,7 +31,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerCSS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
 
 
 ### Rules for action "generateXMLViewerJS":
@@ -41,7 +41,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerJS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
 
 
 ### Rules for action "HTMLEntityTable":
@@ -59,9 +59,9 @@
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.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)
+$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_RuntimeEnabledFeatures ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.h: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp ;
 
@@ -70,9 +70,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp ;
 
@@ -81,9 +81,9 @@
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StylePropertyShorthand ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.h: $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp ;
 
@@ -92,9 +92,9 @@
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StyleBuilder ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.h: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.cpp: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
@@ -104,9 +104,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_value_keywords.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSValueKeywords.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSValueKeywords.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_css_value_keywords.py $(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_derived_sources_gyp_make_derived_sources_target_CSSValueKeywords ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; ../build/scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp ;
 
@@ -115,9 +115,9 @@
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.h: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
@@ -129,9 +129,9 @@
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.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/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FontFamilyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl css/FontFamilyNames.in -- --fonts
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl css/FontFamilyNames.in -- --fonts
 
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp ;
 
@@ -140,9 +140,9 @@
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/SVGNames.h: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
@@ -155,32 +155,54 @@
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventHeaders.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 $(gyp_shared_intermediate_dir)/blink/EventInterfaces.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 
+### Rules for action "EventNames":
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventNames.h: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp ;
+
 ### Rules for action "EventTargetFactory":
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h: $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h ;
 
+### Rules for action "EventTargetNames":
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp ;
+
 ### Rules for action "MathMLNames":
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.h: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp ;
 
@@ -189,9 +211,9 @@
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/build/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_UserAgentStyleSheets ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl ../build/scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h ;
 
@@ -200,53 +222,31 @@
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.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/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FetchInitiatorTypeNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl fetch/FetchInitiatorTypeNames.in -- --resourceTypes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py fetch/FetchInitiatorTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp ;
 
-### Rules for action "PickerCommon":
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_PickerCommon ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/PickerCommon.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp" Resources/pagepopups/pickerCommon.css Resources/pagepopups/pickerCommon.js
+### Rules for action "EventTypeNames":
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.h ;
-
-### Rules for action "CalendarPicker":
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.js $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/calendarPickerChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/pickerCommonChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CalendarPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--condition=ENABLE(CALENDAR_PICKER)" "--out-h=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp" Resources/pagepopups/calendarPicker.css Resources/pagepopups/calendarPicker.js Resources/pagepopups/chromium/calendarPickerChromium.css Resources/pagepopups/chromium/pickerCommonChromium.css Resources/pagepopups/suggestionPicker.css Resources/pagepopups/suggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.h ;
-
-### Rules for action "ColorSuggestionPicker":
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_ColorSuggestionPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp" Resources/pagepopups/colorSuggestionPicker.css Resources/pagepopups/colorSuggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h ;
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp ;
 
 ### Rules for action "XLinkNames":
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py svg/xlinkattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.h: $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp ;
 
@@ -255,9 +255,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlnsattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp ;
 
@@ -266,9 +266,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp ;
 
@@ -279,7 +279,7 @@
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/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_derived_sources_gyp_make_derived_sources_target_preprocess_grammar ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -I../build/scripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
 
 
 ### Rules for action "MakeTokenMatcher":
@@ -287,21 +287,31 @@
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcher ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+
+
+### Rules for action "MakeTokenMatcherForViewport":
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLMetaElement-in.cpp $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcherForViewport ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/html/HTMLMetaElement-in.cpp "$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp"
 
 
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_bison":
-# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', 'scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
+# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', '../build/scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.h: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -312,7 +322,7 @@
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XPathGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.h: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -320,13 +330,13 @@
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_gperf":
-# "{'inputs': ['scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', 'scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
+# "{'inputs': ['../build/scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', '../build/scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
+$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl ../build/scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
 
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
 third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger: $(gyp_shared_intermediate_dir)/blink/ColorData.cpp
@@ -365,20 +375,20 @@
 	$(gyp_shared_intermediate_dir)/blink/Event.cpp \
 	$(gyp_shared_intermediate_dir)/blink/EventHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp \
@@ -387,6 +397,7 @@
 	$(gyp_shared_intermediate_dir)/blink/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y \
 	$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp \
+	$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp \
@@ -451,7 +462,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
@@ -532,7 +542,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
diff --git a/Source/core/make_derived_sources.target.linux-x86.mk b/Source/core/make_derived_sources.target.linux-x86.mk
index 600c361..e0a50c0 100644
--- a/Source/core/make_derived_sources.target.linux-x86.mk
+++ b/Source/core/make_derived_sources.target.linux-x86.mk
@@ -21,7 +21,7 @@
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h: $(LOCAL_PATH)/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustomScript.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: Generating V8ArrayBufferViewCustomScript.h from V8ArrayBufferViewCustomScript.js ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl V8ArrayBufferViewCustomScript_js ../bindings/v8/custom/V8ArrayBufferViewCustomScript.js "$(gyp_shared_intermediate_dir)/blink/V8ArrayBufferViewCustomScript.h"
 
 
 ### Rules for action "generateXMLViewerCSS":
@@ -31,7 +31,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerCSS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_css xml/XMLViewer.css "$(gyp_shared_intermediate_dir)/blink/XMLViewerCSS.h"
 
 
 ### Rules for action "generateXMLViewerJS":
@@ -41,7 +41,7 @@
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XMLViewer.js $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_generateXMLViewerJS ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl ../build/scripts/xxd.pl XMLViewer_js xml/XMLViewer.js "$(gyp_shared_intermediate_dir)/blink/XMLViewerJS.h"
 
 
 ### Rules for action "HTMLEntityTable":
@@ -59,9 +59,9 @@
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.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)
+$(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_runtime_features.py $(LOCAL_PATH)/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_RuntimeEnabledFeatures ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_runtime_features.py page/RuntimeEnabledFeatures.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.h: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp ;
 
@@ -70,9 +70,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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)
+$(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_css_property_names.py css/CSSPropertyNames.in css/SVGCSSPropertyNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.h: $(gyp_shared_intermediate_dir)/blink/CSSPropertyNames.cpp ;
 
@@ -81,9 +81,9 @@
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_shorthands.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSShorthands.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StylePropertyShorthand.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StylePropertyShorthand ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_shorthands.py css/CSSShorthands.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.h: $(gyp_shared_intermediate_dir)/blink/StylePropertyShorthand.cpp ;
 
@@ -92,9 +92,9 @@
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_style_builder.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSProperties.in $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilder.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_StyleBuilder ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_style_builder.py css/CSSProperties.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.h: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
 $(gyp_shared_intermediate_dir)/blink/StyleBuilderFunctions.cpp: $(gyp_shared_intermediate_dir)/blink/StyleBuilder.cpp ;
@@ -104,9 +104,9 @@
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_value_keywords.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSValueKeywords.in $(LOCAL_PATH)/third_party/WebKit/Source/core/css/SVGCSSValueKeywords.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_css_value_keywords.py $(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_derived_sources_gyp_make_derived_sources_target_CSSValueKeywords ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; ../build/scripts/make_css_value_keywords.py css/CSSValueKeywords.in css/SVGCSSValueKeywords.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.h: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp ;
 
@@ -115,9 +115,9 @@
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/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_derived_sources_gyp_make_derived_sources_target_HTMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/HTMLNames.h" "$(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl html/HTMLTagNames.in html/HTMLAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/HTMLNames.h: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp ;
@@ -129,9 +129,9 @@
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.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/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/css/FontFamilyNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FontFamilyNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl css/FontFamilyNames.in -- --fonts
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl css/FontFamilyNames.in -- --fonts
 
 $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.h: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp ;
 
@@ -140,9 +140,9 @@
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/Hasher.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/StaticString.pm $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.pl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/SVGAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_SVGNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/SVGNames.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGNames.h" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/SVGElementFactory.h" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.cpp" "$(gyp_shared_intermediate_dir)/blink/V8SVGElementWrapperFactory.h" -- ../build/scripts/Hasher.pm ../build/scripts/StaticString.pm ../build/scripts/make_names.pl svg/SVGTagNames.in svg/SVGAttributeNames.in -- --factory --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/SVGNames.h: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
 $(gyp_shared_intermediate_dir)/blink/SVGElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp ;
@@ -155,32 +155,54 @@
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/Event.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/Event.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventAliases.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" events/EventAliases.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventHeaders.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 $(gyp_shared_intermediate_dir)/blink/EventInterfaces.h: $(gyp_shared_intermediate_dir)/blink/Event.cpp ;
 
+### Rules for action "EventNames":
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(gyp_shared_intermediate_dir)/blink/EventInterfaces.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py "$(gyp_shared_intermediate_dir)/blink/EventInterfaces.in" --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventNames.h: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp ;
+
 ### Rules for action "EventTargetFactory":
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_event_factory.py $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetFactory ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_event_factory.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h: $(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h ;
 
+### Rules for action "EventTargetNames":
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTargetFactory.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTargetNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTargetFactory.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
+
+$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp ;
+
 ### Rules for action "MathMLNames":
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLTagNames.in $(LOCAL_PATH)/third_party/WebKit/Source/core/html/parser/MathMLAttributeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MathMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/MathMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py html/parser/MathMLTagNames.in html/parser/MathMLAttributeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink" --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/MathMLNames.h: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp ;
 
@@ -189,9 +211,9 @@
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/css/make-css-file-arrays.pl $(LOCAL_PATH)/third_party/WebKit/Source/build/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/mediaControls.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/mediaControlsAndroid.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/fullscreen.css $(LOCAL_PATH)/third_party/WebKit/Source/core/css/xhtmlmp.css $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_UserAgentStyleSheets ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/action_useragentstylesheets.py "$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h" "$(gyp_shared_intermediate_dir)/blink/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/mediaControls.css css/mediaControlsAndroid.css css/fullscreen.css css/xhtmlmp.css -- css/make-css-file-arrays.pl ../build/scripts/preprocessor.pm -- --defines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=0\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
 
 $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h ;
 
@@ -200,53 +222,31 @@
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.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/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/fetch/FetchInitiatorTypeNames.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_FetchInitiatorTypeNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp" "$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl fetch/FetchInitiatorTypeNames.in -- --resourceTypes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py fetch/FetchInitiatorTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp ;
 
-### Rules for action "PickerCommon":
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/pickerCommon.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_PickerCommon ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/PickerCommon.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp" Resources/pagepopups/pickerCommon.css Resources/pagepopups/pickerCommon.js
+### Rules for action "EventTypeNames":
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/events/EventTypeNames.in $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_EventTypeNames ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_names.py events/EventTypeNames.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
-$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.h ;
-
-### Rules for action "CalendarPicker":
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/calendarPicker.js $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/calendarPickerChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/chromium/pickerCommonChromium.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/suggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CalendarPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--condition=ENABLE(CALENDAR_PICKER)" "--out-h=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp" Resources/pagepopups/calendarPicker.css Resources/pagepopups/calendarPicker.js Resources/pagepopups/chromium/calendarPickerChromium.css Resources/pagepopups/chromium/pickerCommonChromium.css Resources/pagepopups/suggestionPicker.css Resources/pagepopups/suggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.h ;
-
-### Rules for action "ColorSuggestionPicker":
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_local_path := $(LOCAL_PATH)
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h: $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.css $(LOCAL_PATH)/third_party/WebKit/Source/core/Resources/pagepopups/colorSuggestionPicker.js $(GYP_TARGET_DEPENDENCIES)
-	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_ColorSuggestionPicker ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/make-file-arrays.py "--out-h=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h" "--out-cpp=$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp" Resources/pagepopups/colorSuggestionPicker.css Resources/pagepopups/colorSuggestionPicker.js
-
-$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h ;
+$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp ;
 
 ### Rules for action "XLinkNames":
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/svg/xlinkattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XLinkNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XLinkNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl svg/xlinkattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py svg/xlinkattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XLinkNames.h: $(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp ;
 
@@ -255,9 +255,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlnsattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNSNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNSNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlnsattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlnsattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNSNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp ;
 
@@ -266,9 +266,9 @@
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/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)
+$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_qualified_names.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.h.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/xmlattrs.in $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_XMLNames ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python scripts/action_makenames.py "$(gyp_shared_intermediate_dir)/blink/XMLNames.cpp" "$(gyp_shared_intermediate_dir)/blink/XMLNames.h" -- scripts/Hasher.pm scripts/StaticString.pm scripts/make_names.pl xml/xmlattrs.in -- --extraDefines "\"ENABLE_CSS3_TEXT=0\" \"ENABLE_CSS_EXCLUSIONS=1\" \"ENABLE_CSS_REGIONS=1\" \"ENABLE_CUSTOM_SCHEME_HANDLER=0\" \"ENABLE_ENCRYPTED_MEDIA_V2=1\" \"ENABLE_SVG_FONTS=1\" \"ENABLE_TOUCH_ICON_LOADING=1\" \"ENABLE_GDI_FONTS_ON_WINDOWS=1\" \"WTF_USE_CONCATENATED_IMPULSE_RESPONSES=1\" \"ENABLE_CALENDAR_PICKER=0\" \"ENABLE_FAST_MOBILE_SCROLLING=1\" \"ENABLE_INPUT_SPEECH=0\" \"ENABLE_LEGACY_NOTIFICATIONS=0\" \"ENABLE_MEDIA_CAPTURE=1\" \"ENABLE_ORIENTATION_EVENTS=1\" \"ENABLE_NAVIGATOR_CONTENT_UTILS=0\" \"ENABLE_OPENTYPE_VERTICAL=1\""
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_qualified_names.py xml/xmlattrs.in --output_dir "$(gyp_shared_intermediate_dir)/blink"
 
 $(gyp_shared_intermediate_dir)/blink/XMLNames.h: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp ;
 
@@ -279,7 +279,7 @@
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/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_derived_sources_gyp_make_derived_sources_target_preprocess_grammar ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -Iscripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; perl -I../build/scripts css/makegrammar.pl --outputDir "$(gyp_shared_intermediate_dir)/blink" css/CSSGrammar.y.in css/CSSGrammar.y.includes
 
 
 ### Rules for action "MakeTokenMatcher":
@@ -287,21 +287,31 @@
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(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_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
+$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/css/CSSParser-in.cpp $(GYP_TARGET_DEPENDENCIES)
 	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcher ($@)"
-	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../core/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/css/CSSParser-in.cpp "$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp"
+
+
+### Rules for action "MakeTokenMatcherForViewport":
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_local_path := $(LOCAL_PATH)
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
+$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp: $(LOCAL_PATH)/third_party/jinja2/__init__.py $(LOCAL_PATH)/third_party/markupsafe/__init__.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/hasher.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_file.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/in_generator.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/license.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_macros.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/name_utilities.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/template_expander.py $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/templates/macros.tmpl $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make_token_matcher.py $(LOCAL_PATH)/third_party/WebKit/Source/core/html/HTMLMetaElement-in.cpp $(GYP_TARGET_DEPENDENCIES)
+	@echo "Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_MakeTokenMatcherForViewport ($@)"
+	$(hide)cd $(gyp_local_path)/third_party/WebKit/Source/core; mkdir -p $(gyp_shared_intermediate_dir)/blink; python ../build/scripts/make_token_matcher.py ../core/html/HTMLMetaElement-in.cpp "$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp"
 
 
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_bison":
-# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', 'scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
+# "{'msvs_cygwin_shell': '1', 'extension': 'y', 'rule_sources': ['$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y', 'xml/XPathGrammar.y'], 'rule_name': 'bison', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp', '$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.h'], 'action': ['python', '../build/scripts/rule_bison.py', '$(RULE_SOURCES)', '$(gyp_shared_intermediate_dir)/blink', 'bison']}":
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py "$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y" "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/CSSGrammar.h: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -312,7 +322,7 @@
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/xml/XPathGrammar.y $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; python ../build/scripts/rule_bison.py xml/XPathGrammar.y "$(gyp_shared_intermediate_dir)/blink" bison
 
 $(gyp_shared_intermediate_dir)/blink/XPathGrammar.h: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp ;
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
@@ -320,13 +330,13 @@
 
 
 ### Generated for rule "third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_gperf":
-# "{'inputs': ['scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', 'scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
+# "{'inputs': ['../build/scripts/make-hash-tools.pl'], 'msvs_cygwin_shell': '0', 'extension': 'gperf', 'outputs': ['$(gyp_shared_intermediate_dir)/blink/%(INPUT_ROOT)s.cpp'], 'rule_name': 'gperf', 'rule_sources': ['platform/ColorData.gperf'], 'action': ['perl', '../build/scripts/make-hash-tools.pl', '$(gyp_shared_intermediate_dir)/blink', '$(RULE_SOURCES)', 'gperf']}":
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_local_path := $(LOCAL_PATH)
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_intermediate_dir := $(abspath $(gyp_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: gyp_shared_intermediate_dir := $(abspath $(gyp_shared_intermediate_dir))
 $(gyp_shared_intermediate_dir)/blink/ColorData.cpp: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))
-$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/core/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
-	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
+$(gyp_shared_intermediate_dir)/blink/ColorData.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/core/platform/ColorData.gperf $(LOCAL_PATH)/third_party/WebKit/Source/build/scripts/make-hash-tools.pl $(GYP_TARGET_DEPENDENCIES)
+	mkdir -p $(gyp_shared_intermediate_dir)/blink; cd $(gyp_local_path)/third_party/WebKit/Source/core; perl ../build/scripts/make-hash-tools.pl "$(gyp_shared_intermediate_dir)/blink" platform/ColorData.gperf gperf
 
 .PHONY: third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger
 third_party_WebKit_Source_core_make_derived_sources_gyp_rule_trigger: $(gyp_shared_intermediate_dir)/blink/ColorData.cpp
@@ -365,20 +375,20 @@
 	$(gyp_shared_intermediate_dir)/blink/Event.cpp \
 	$(gyp_shared_intermediate_dir)/blink/EventHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventNames.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetHeaders.h \
 	$(gyp_shared_intermediate_dir)/blink/EventTargetInterfaces.h \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTargetNames.h \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/MathMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheets.h \
 	$(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.h \
-	$(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.h \
-	$(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp \
+	$(gyp_shared_intermediate_dir)/blink/EventTypeNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.cpp \
 	$(gyp_shared_intermediate_dir)/blink/XLinkNames.h \
 	$(gyp_shared_intermediate_dir)/blink/XMLNSNames.cpp \
@@ -387,6 +397,7 @@
 	$(gyp_shared_intermediate_dir)/blink/XMLNames.h \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.y \
 	$(gyp_shared_intermediate_dir)/blink/CSSParser.cpp \
+	$(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp \
 	$(gyp_shared_intermediate_dir)/blink/CSSGrammar.h \
 	$(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp \
@@ -453,7 +464,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
@@ -537,7 +547,6 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
diff --git a/Source/core/page/AbstractView.idl b/Source/core/page/AbstractView.idl
deleted file mode 100644
index 60c537f..0000000
--- a/Source/core/page/AbstractView.idl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- *
- * 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,
- * 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.
- */
-
-// Introduced in DOM Level 2:
-[
-
-] interface AbstractView {
-    readonly attribute Document document;
-    readonly attribute StyleMedia styleMedia;
-};
-
diff --git a/Source/core/page/AutoscrollController.cpp b/Source/core/page/AutoscrollController.cpp
index 257bb7d..90a6b90 100644
--- a/Source/core/page/AutoscrollController.cpp
+++ b/Source/core/page/AutoscrollController.cpp
@@ -29,8 +29,8 @@
 #include "core/page/AutoscrollController.h"
 
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderBox.h"
diff --git a/Source/core/page/AutoscrollController.h b/Source/core/page/AutoscrollController.h
index 88ed10f..361581c 100644
--- a/Source/core/page/AutoscrollController.h
+++ b/Source/core/page/AutoscrollController.h
@@ -26,8 +26,8 @@
 #ifndef AutoscrollController_h
 #define AutoscrollController_h
 
-#include "core/platform/Timer.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/Timer.h"
+#include "platform/geometry/IntPoint.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/page/BarProp.cpp b/Source/core/page/BarProp.cpp
deleted file mode 100644
index 169d65a..0000000
--- a/Source/core/page/BarProp.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2007, 2010 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.
- * 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.
- *
- * 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/page/BarProp.h"
-
-#include "core/page/Chrome.h"
-#include "core/page/Frame.h"
-#include "core/page/Page.h"
-
-namespace WebCore {
-
-BarProp::BarProp(Frame* frame, Type type)
-    : DOMWindowProperty(frame)
-    , m_type(type)
-{
-    ScriptWrappable::init(this);
-}
-
-BarProp::Type BarProp::type() const
-{
-    return m_type;
-}
-
-bool BarProp::visible() const
-{
-    if (!m_frame)
-        return false;
-    Page* page = m_frame->page();
-    if (!page)
-        return false;
-
-    switch (m_type) {
-    case Locationbar:
-    case Personalbar:
-    case Toolbar:
-        return page->chrome().toolbarsVisible();
-    case Menubar:
-        return page->chrome().menubarVisible();
-    case Scrollbars:
-        return page->chrome().scrollbarsVisible();
-    case Statusbar:
-        return page->chrome().statusbarVisible();
-    }
-
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/BarProp.h b/Source/core/page/BarProp.h
deleted file mode 100644
index 9c6b724..0000000
--- a/Source/core/page/BarProp.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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 BarProp_h
-#define BarProp_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/page/DOMWindowProperty.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-    class Frame;
-
-    class BarProp : public ScriptWrappable, public RefCounted<BarProp>, public DOMWindowProperty {
-    public:
-        enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar };
-
-        static PassRefPtr<BarProp> create(Frame* frame, Type type) { return adoptRef(new BarProp(frame, type)); }
-
-        Type type() const;
-        bool visible() const;
-
-    private:
-        BarProp(Frame*, Type);
-        Type m_type;
-    };
-
-} // namespace WebCore
-
-#endif // BarProp_h
diff --git a/Source/core/page/Chrome.cpp b/Source/core/page/Chrome.cpp
index 57c5838..5d5c9ad 100644
--- a/Source/core/page/Chrome.cpp
+++ b/Source/core/page/Chrome.cpp
@@ -28,7 +28,7 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
 #include "core/page/Page.h"
 #include "core/page/PageGroupLoadDeferrer.h"
@@ -36,10 +36,10 @@
 #include "core/page/WindowFeatures.h"
 #include "core/platform/ColorChooser.h"
 #include "core/platform/DateTimeChooser.h"
-#include "core/platform/FileChooser.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/network/DNS.h"
 #include "core/rendering/HitTestResult.h"
+#include "platform/FileChooser.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/network/DNS.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/Vector.h"
 
@@ -243,10 +243,9 @@
 
     ASSERT(frame);
     notifyPopupOpeningObservers();
-    String displayMessage = frame->displayStringModifiedByEncoding(message);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(m_page, displayMessage);
-    m_client->runJavaScriptAlert(frame, displayMessage);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(m_page, message);
+    m_client->runJavaScriptAlert(frame, message);
     InspectorInstrumentation::didRunJavaScriptDialog(cookie);
 }
 
@@ -261,10 +260,9 @@
 
     ASSERT(frame);
     notifyPopupOpeningObservers();
-    String displayMessage = frame->displayStringModifiedByEncoding(message);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(m_page, displayMessage);
-    bool ok = m_client->runJavaScriptConfirm(frame, displayMessage);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(m_page, message);
+    bool ok = m_client->runJavaScriptConfirm(frame, message);
     InspectorInstrumentation::didRunJavaScriptDialog(cookie);
     return ok;
 }
@@ -280,22 +278,18 @@
 
     ASSERT(frame);
     notifyPopupOpeningObservers();
-    String displayPrompt = frame->displayStringModifiedByEncoding(prompt);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(m_page, displayPrompt);
-    bool ok = m_client->runJavaScriptPrompt(frame, displayPrompt, frame->displayStringModifiedByEncoding(defaultValue), result);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRunJavaScriptDialog(m_page, prompt);
+    bool ok = m_client->runJavaScriptPrompt(frame, prompt, defaultValue, result);
     InspectorInstrumentation::didRunJavaScriptDialog(cookie);
 
-    if (ok)
-        result = frame->displayStringModifiedByEncoding(result);
-
     return ok;
 }
 
 void Chrome::setStatusbarText(Frame* frame, const String& status)
 {
     ASSERT(frame);
-    m_client->setStatusbarText(frame->displayStringModifiedByEncoding(status));
+    m_client->setStatusbarText(status);
 }
 
 IntRect Chrome::windowResizerRect() const
@@ -371,9 +365,9 @@
     m_client->runOpenPanel(frame, fileChooser);
 }
 
-void Chrome::dispatchViewportPropertiesDidChange(const ViewportArguments& arguments) const
+void Chrome::dispatchViewportPropertiesDidChange(const ViewportDescription& description) const
 {
-    m_client->dispatchViewportPropertiesDidChange(arguments);
+    m_client->dispatchViewportPropertiesDidChange(description);
 }
 
 void Chrome::setCursor(const Cursor& cursor)
diff --git a/Source/core/page/Chrome.h b/Source/core/page/Chrome.h
index f9171c2..7f8b681 100644
--- a/Source/core/page/Chrome.h
+++ b/Source/core/page/Chrome.h
@@ -25,7 +25,7 @@
 #include "core/loader/NavigationPolicy.h"
 #include "core/page/FocusDirection.h"
 #include "core/platform/Cursor.h"
-#include "core/platform/HostWindow.h"
+#include "platform/HostWindow.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
@@ -49,7 +49,7 @@
 class SearchPopupMenu;
 
 struct DateTimeChooserParameters;
-struct ViewportArguments;
+struct ViewportDescription;
 struct WindowFeatures;
 
 class Chrome : public HostWindow {
@@ -124,7 +124,7 @@
     void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
     void enumerateChosenDirectory(FileChooser*);
 
-    void dispatchViewportPropertiesDidChange(const ViewportArguments&) const;
+    void dispatchViewportPropertiesDidChange(const ViewportDescription&) const;
 
     bool hasOpenedPopup() const;
     PassRefPtr<PopupMenu> createPopupMenu(Frame&, PopupMenuClient*) const;
diff --git a/Source/core/page/ChromeClient.h b/Source/core/page/ChromeClient.h
index 9eab17f..67b541a 100644
--- a/Source/core/page/ChromeClient.h
+++ b/Source/core/page/ChromeClient.h
@@ -26,16 +26,16 @@
 #include "core/inspector/ConsoleAPITypes.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/NavigationPolicy.h"
-#include "core/page/ConsoleTypes.h"
+#include "core/frame/ConsoleTypes.h"
 #include "core/page/FocusDirection.h"
 #include "core/platform/Cursor.h"
-#include "core/platform/HostWindow.h"
 #include "core/platform/PopupMenu.h"
 #include "core/platform/PopupMenuClient.h"
-#include "core/platform/ScrollTypes.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/rendering/RenderEmbeddedObject.h"
 #include "modules/webdatabase/DatabaseDetails.h"
+#include "platform/HostWindow.h"
+#include "platform/scroll/ScrollTypes.h"
 #include "wtf/Forward.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/UnusedParam.h"
@@ -78,7 +78,7 @@
 struct DateTimeChooserParameters;
 struct FrameLoadRequest;
 struct GraphicsDeviceAdapter;
-struct ViewportArguments;
+struct ViewportDescription;
 struct WindowFeatures;
 
 class ChromeClient {
@@ -153,7 +153,7 @@
     virtual void scheduleAnimation() = 0;
     // End methods used by HostWindow.
 
-    virtual void dispatchViewportPropertiesDidChange(const ViewportArguments&) const { }
+    virtual void dispatchViewportPropertiesDidChange(const ViewportDescription&) const { }
 
     virtual void contentsSizeChanged(Frame*, const IntSize&) const = 0;
     virtual void deviceOrPageScaleFactorChanged() const { }
@@ -261,6 +261,7 @@
     virtual FloatSize minimumWindowSize() const { return FloatSize(100, 100); };
 
     virtual bool isEmptyChromeClient() const { return false; }
+    virtual bool isChromeClientImpl() const { return false; }
 
     virtual void didAssociateFormControls(const Vector<RefPtr<Element> >&) { };
 
diff --git a/Source/core/page/Console.cpp b/Source/core/page/Console.cpp
deleted file mode 100644
index 006028c..0000000
--- a/Source/core/page/Console.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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/page/Console.h"
-
-#include "bindings/v8/ScriptCallStackFactory.h"
-#include "bindings/v8/ScriptProfiler.h"
-#include "core/inspector/ConsoleAPITypes.h"
-#include "core/inspector/InspectorConsoleInstrumentation.h"
-#include "core/inspector/ScriptArguments.h"
-#include "core/inspector/ScriptCallStack.h"
-#include "core/inspector/ScriptProfile.h"
-#include "core/page/Chrome.h"
-#include "core/page/ChromeClient.h"
-#include "core/page/ConsoleBase.h"
-#include "core/page/ConsoleTypes.h"
-#include "core/page/Frame.h"
-#include "core/page/MemoryInfo.h"
-#include "core/page/Page.h"
-#include "core/page/PageConsole.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
-
-#include "core/platform/chromium/TraceEvent.h"
-
-namespace WebCore {
-
-Console::Console(Frame* frame)
-    : DOMWindowProperty(frame)
-{
-    ScriptWrappable::init(this);
-}
-
-Console::~Console()
-{
-}
-
-ScriptExecutionContext* Console::context()
-{
-    if (!m_frame)
-        return 0;
-    return m_frame->document();
-}
-
-void Console::reportMessageToClient(MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack)
-{
-    String stackTrace;
-    if (m_frame->page()->chrome().client().shouldReportDetailedMessageForSource(callStack->at(0).sourceURL())) {
-        RefPtr<ScriptCallStack> fullStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture);
-        stackTrace = PageConsole::formatStackTraceString(message, fullStack);
-    }
-    m_frame->page()->chrome().client().addMessageToConsole(ConsoleAPIMessageSource, level, message, callStack->at(0).lineNumber(), callStack->at(0).sourceURL(), stackTrace);
-}
-
-bool Console::profilerEnabled()
-{
-    return InspectorInstrumentation::profilerEnabled(m_frame->page());
-}
-
-PassRefPtr<MemoryInfo> Console::memory() const
-{
-    // FIXME: Because we create a new object here each time,
-    // console.memory !== console.memory, which seems wrong.
-    return MemoryInfo::create(m_frame);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/Console.h b/Source/core/page/Console.h
deleted file mode 100644
index abf4e71..0000000
--- a/Source/core/page/Console.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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 Console_h
-#define Console_h
-
-#include "bindings/v8/ScriptState.h"
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/page/ConsoleBase.h"
-#include "core/page/DOMWindowProperty.h"
-#include "wtf/Forward.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class Frame;
-class MemoryInfo;
-class Page;
-class ScriptArguments;
-
-class Console : public RefCounted<Console>, public ConsoleBase, public ScriptWrappable, public DOMWindowProperty {
-public:
-    using RefCounted<Console>::ref;
-    using RefCounted<Console>::deref;
-
-    static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Console(frame)); }
-    virtual ~Console();
-
-    PassRefPtr<MemoryInfo> memory() const;
-
-protected:
-    virtual ScriptExecutionContext* context();
-    virtual void reportMessageToClient(MessageLevel, const String& message, PassRefPtr<ScriptCallStack>) OVERRIDE;
-    virtual bool profilerEnabled();
-
-private:
-    explicit Console(Frame*);
-    inline Page* page() const;
-
-    virtual void refConsole() { ref(); }
-    virtual void derefConsole() { deref(); }
-};
-
-} // namespace WebCore
-
-#endif // Console_h
diff --git a/Source/core/page/ConsoleBase.cpp b/Source/core/page/ConsoleBase.cpp
deleted file mode 100644
index a889446..0000000
--- a/Source/core/page/ConsoleBase.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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/page/Console.h"
-
-#include "bindings/v8/ScriptCallStackFactory.h"
-#include "bindings/v8/ScriptProfiler.h"
-#include "core/dom/Document.h"
-#include "core/inspector/ConsoleAPITypes.h"
-#include "core/inspector/InspectorConsoleInstrumentation.h"
-#include "core/inspector/ScriptArguments.h"
-#include "core/inspector/ScriptCallStack.h"
-#include "core/inspector/ScriptProfile.h"
-#include "core/page/ConsoleTypes.h"
-#include "core/platform/chromium/TraceEvent.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-ConsoleBase::~ConsoleBase()
-{
-}
-
-void ConsoleBase::debug(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(LogMessageType, DebugMessageLevel, state, arguments);
-}
-
-void ConsoleBase::error(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(LogMessageType, ErrorMessageLevel, state, arguments);
-}
-
-void ConsoleBase::info(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    log(state, arguments);
-}
-
-void ConsoleBase::log(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(LogMessageType, LogMessageLevel, state, arguments);
-}
-
-void ConsoleBase::warn(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(LogMessageType, WarningMessageLevel, state, arguments);
-}
-
-void ConsoleBase::dir(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(DirMessageType, LogMessageLevel, state, arguments);
-}
-
-void ConsoleBase::dirxml(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(DirXMLMessageType, LogMessageLevel, state, arguments);
-}
-
-void ConsoleBase::table(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(TableMessageType, LogMessageLevel, state, arguments);
-}
-
-void ConsoleBase::clear(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSource, ClearMessageType, LogMessageLevel, String(), state, arguments);
-}
-
-void ConsoleBase::trace(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    internalAddMessage(TraceMessageType, LogMessageLevel, state, arguments, true, true);
-}
-
-void ConsoleBase::assertCondition(ScriptState* state, PassRefPtr<ScriptArguments> arguments, bool condition)
-{
-    if (condition)
-        return;
-
-    internalAddMessage(AssertMessageType, ErrorMessageLevel, state, arguments, true);
-}
-
-void ConsoleBase::count(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    InspectorInstrumentation::consoleCount(context(), state, arguments);
-}
-
-void ConsoleBase::markTimeline(const String& title)
-{
-    InspectorInstrumentation::consoleTimeStamp(context(), title);
-}
-
-void ConsoleBase::profile(ScriptState* state, const String& title)
-{
-    ScriptExecutionContext* context = this->context();
-    if (!context)
-        return;
-
-    // FIXME: log a console message when profiling is disabled.
-    if (!profilerEnabled())
-        return;
-
-    String resolvedTitle = title;
-    if (title.isNull()) // no title so give it the next user initiated profile title.
-        resolvedTitle = InspectorInstrumentation::getCurrentUserInitiatedProfileName(context, true);
-
-    ScriptProfiler::start(resolvedTitle);
-    InspectorInstrumentation::addMessageToConsole(context, ConsoleAPIMessageSource, ProfileMessageType, DebugMessageLevel, resolvedTitle, String(), 0, 0, state);
-}
-
-void ConsoleBase::profileEnd(ScriptState* state, const String& title)
-{
-    ScriptExecutionContext* context = this->context();
-    if (!context)
-        return;
-
-    if (!profilerEnabled())
-        return;
-
-    RefPtr<ScriptProfile> profile = ScriptProfiler::stop(title);
-    if (!profile)
-        return;
-
-    RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, 1));
-    InspectorInstrumentation::addProfile(context, profile, callStack);
-}
-
-void ConsoleBase::time(const String& title)
-{
-    InspectorInstrumentation::consoleTime(context(), title);
-    TRACE_EVENT_COPY_ASYNC_BEGIN0("webkit.console", title.utf8().data(), this);
-}
-
-void ConsoleBase::timeEnd(ScriptState* state, const String& title)
-{
-    TRACE_EVENT_COPY_ASYNC_END0("webkit.console", title.utf8().data(), this);
-    InspectorInstrumentation::consoleTimeEnd(context(), title, state);
-}
-
-void ConsoleBase::timeStamp(const String& title)
-{
-    InspectorInstrumentation::consoleTimeStamp(context(), title);
-}
-
-void ConsoleBase::timeline(ScriptState* state, const String& title)
-{
-    InspectorInstrumentation::consoleTimeline(context(), title, state);
-}
-
-void ConsoleBase::timelineEnd(ScriptState* state, const String& title)
-{
-    InspectorInstrumentation::consoleTimelineEnd(context(), title, state);
-}
-
-void ConsoleBase::group(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSource, StartGroupMessageType, LogMessageLevel, String(), state, arguments);
-}
-
-void ConsoleBase::groupCollapsed(ScriptState* state, PassRefPtr<ScriptArguments> arguments)
-{
-    InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSource, StartGroupCollapsedMessageType, LogMessageLevel, String(), state, arguments);
-}
-
-void ConsoleBase::groupEnd()
-{
-    InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSource, EndGroupMessageType, LogMessageLevel, String(), 0);
-}
-
-void ConsoleBase::internalAddMessage(MessageType type, MessageLevel level, ScriptState* state, PassRefPtr<ScriptArguments> scriptArguments, bool acceptNoArguments, bool printTrace)
-{
-    if (!context())
-        return;
-
-    RefPtr<ScriptArguments> arguments = scriptArguments;
-    if (!acceptNoArguments && !arguments->argumentCount())
-        return;
-
-    size_t stackSize = printTrace ? ScriptCallStack::maxCallStackSizeToCapture : 1;
-    RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, stackSize));
-    const ScriptCallFrame& lastCaller = callStack->at(0);
-
-    String message;
-    bool gotStringMessage = arguments->getFirstArgumentAsString(message);
-    InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSource, type, level, message, state, arguments);
-    if (gotStringMessage)
-        reportMessageToClient(level, message, callStack);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/ConsoleBase.h b/Source/core/page/ConsoleBase.h
deleted file mode 100644
index 4fcd971..0000000
--- a/Source/core/page/ConsoleBase.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2007 Apple 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 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.
- * 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.
- *
- * 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 ConsoleBase_h
-#define ConsoleBase_h
-
-#include "bindings/v8/ScriptState.h"
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/inspector/ConsoleAPITypes.h"
-#include "core/inspector/ScriptCallStack.h"
-#include "core/page/ConsoleTypes.h"
-#include "core/page/DOMWindowProperty.h"
-#include "wtf/Forward.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class ScriptArguments;
-
-class ConsoleBase {
-public:
-    void ref() { refConsole(); }
-    void deref() { derefConsole(); }
-
-    void debug(ScriptState*, PassRefPtr<ScriptArguments>);
-    void error(ScriptState*, PassRefPtr<ScriptArguments>);
-    void info(ScriptState*, PassRefPtr<ScriptArguments>);
-    void log(ScriptState*, PassRefPtr<ScriptArguments>);
-    void clear(ScriptState*, PassRefPtr<ScriptArguments>);
-    void warn(ScriptState*, PassRefPtr<ScriptArguments>);
-    void dir(ScriptState*, PassRefPtr<ScriptArguments>);
-    void dirxml(ScriptState*, PassRefPtr<ScriptArguments>);
-    void table(ScriptState*, PassRefPtr<ScriptArguments>);
-    void trace(ScriptState*, PassRefPtr<ScriptArguments>);
-    void assertCondition(ScriptState*, PassRefPtr<ScriptArguments>, bool condition);
-    void count(ScriptState*, PassRefPtr<ScriptArguments>);
-    void markTimeline(const String&);
-    void profile(ScriptState*, const String&);
-    void profileEnd(ScriptState*, const String&);
-    void time(const String&);
-    void timeEnd(ScriptState*, const String&);
-    void timeStamp(const String&);
-    void timeline(ScriptState*, const String&);
-    void timelineEnd(ScriptState*, const String&);
-    void group(ScriptState*, PassRefPtr<ScriptArguments>);
-    void groupCollapsed(ScriptState*, PassRefPtr<ScriptArguments>);
-    void groupEnd();
-
-protected:
-    virtual ~ConsoleBase();
-    virtual ScriptExecutionContext* context() = 0;
-    virtual void reportMessageToClient(MessageLevel, const String& message, PassRefPtr<ScriptCallStack>) = 0;
-    virtual bool profilerEnabled() = 0;
-
-private:
-    virtual void refConsole() = 0;
-    virtual void derefConsole() = 0;
-
-    void internalAddMessage(MessageType, MessageLevel, ScriptState*, PassRefPtr<ScriptArguments>, bool acceptNoArguments = false, bool printTrace = false);
-};
-
-} // namespace WebCore
-
-#endif // ConsoleBase_h
diff --git a/Source/core/page/ContentSecurityPolicy.cpp b/Source/core/page/ContentSecurityPolicy.cpp
deleted file mode 100644
index d6489e8..0000000
--- a/Source/core/page/ContentSecurityPolicy.cpp
+++ /dev/null
@@ -1,1898 +0,0 @@
-/*
- * Copyright (C) 2011 Google, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GOOGLE 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,
- * 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/page/ContentSecurityPolicy.h"
-
-#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"
-#include "core/events/SecurityPolicyViolationEvent.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/inspector/ScriptCallStack.h"
-#include "core/loader/DocumentLoader.h"
-#include "core/loader/PingLoader.h"
-#include "core/page/ContentSecurityPolicyResponseHeaders.h"
-#include "core/page/Frame.h"
-#include "core/page/UseCounter.h"
-#include "core/platform/JSONValues.h"
-#include "core/platform/ParsingUtilities.h"
-#include "core/platform/network/FormData.h"
-#include "core/platform/network/ResourceResponse.h"
-#include "weborigin/KURL.h"
-#include "weborigin/KnownPorts.h"
-#include "weborigin/SchemeRegistry.h"
-#include "weborigin/SecurityOrigin.h"
-#include "wtf/HashSet.h"
-#include "wtf/text/TextPosition.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-// Normally WebKit uses "static" for internal linkage, but using "static" for
-// these functions causes a compile error because these functions are used as
-// template parameters.
-namespace {
-
-bool isDirectiveNameCharacter(UChar c)
-{
-    return isASCIIAlphanumeric(c) || c == '-';
-}
-
-bool isDirectiveValueCharacter(UChar c)
-{
-    return isASCIISpace(c) || (c >= 0x21 && c <= 0x7e); // Whitespace + VCHAR
-}
-
-bool isNonceCharacter(UChar c)
-{
-    return isASCIIAlphanumeric(c) || c == '+' || c == '/';
-}
-
-bool isSourceCharacter(UChar c)
-{
-    return !isASCIISpace(c);
-}
-
-bool isPathComponentCharacter(UChar c)
-{
-    return c != '?' && c != '#';
-}
-
-bool isHostCharacter(UChar c)
-{
-    return isASCIIAlphanumeric(c) || c == '-';
-}
-
-bool isSchemeContinuationCharacter(UChar c)
-{
-    return isASCIIAlphanumeric(c) || c == '+' || c == '-' || c == '.';
-}
-
-bool isNotASCIISpace(UChar c)
-{
-    return !isASCIISpace(c);
-}
-
-bool isNotColonOrSlash(UChar c)
-{
-    return c != ':' && c != '/';
-}
-
-bool isMediaTypeCharacter(UChar c)
-{
-    return !isASCIISpace(c) && c != '/';
-}
-
-// CSP 1.0 Directives
-static const char connectSrc[] = "connect-src";
-static const char defaultSrc[] = "default-src";
-static const char fontSrc[] = "font-src";
-static const char frameSrc[] = "frame-src";
-static const char imgSrc[] = "img-src";
-static const char mediaSrc[] = "media-src";
-static const char objectSrc[] = "object-src";
-static const char reportURI[] = "report-uri";
-static const char sandbox[] = "sandbox";
-static const char scriptSrc[] = "script-src";
-static const char styleSrc[] = "style-src";
-
-// CSP 1.1 Directives
-static const char baseURI[] = "base-uri";
-static const char formAction[] = "form-action";
-static const char pluginTypes[] = "plugin-types";
-static const char reflectedXSS[] = "reflected-xss";
-
-bool isDirectiveName(const String& name)
-{
-    return (equalIgnoringCase(name, connectSrc)
-        || equalIgnoringCase(name, defaultSrc)
-        || equalIgnoringCase(name, fontSrc)
-        || equalIgnoringCase(name, frameSrc)
-        || equalIgnoringCase(name, imgSrc)
-        || equalIgnoringCase(name, mediaSrc)
-        || equalIgnoringCase(name, objectSrc)
-        || equalIgnoringCase(name, reportURI)
-        || equalIgnoringCase(name, sandbox)
-        || equalIgnoringCase(name, scriptSrc)
-        || equalIgnoringCase(name, styleSrc)
-        || equalIgnoringCase(name, baseURI)
-        || equalIgnoringCase(name, formAction)
-        || equalIgnoringCase(name, pluginTypes)
-        || equalIgnoringCase(name, reflectedXSS)
-    );
-}
-
-UseCounter::Feature getUseCounterType(ContentSecurityPolicy::HeaderType type)
-{
-    switch (type) {
-    case ContentSecurityPolicy::PrefixedEnforce:
-        return UseCounter::PrefixedContentSecurityPolicy;
-    case ContentSecurityPolicy::Enforce:
-        return UseCounter::ContentSecurityPolicy;
-    case ContentSecurityPolicy::PrefixedReport:
-        return UseCounter::PrefixedContentSecurityPolicyReportOnly;
-    case ContentSecurityPolicy::Report:
-        return UseCounter::ContentSecurityPolicyReportOnly;
-    }
-    ASSERT_NOT_REACHED();
-    return UseCounter::NumberOfFeatures;
-}
-
-} // namespace
-
-static bool isSourceListNone(const UChar* begin, const UChar* end)
-{
-    skipWhile<UChar, isASCIISpace>(begin, end);
-
-    const UChar* position = begin;
-    skipWhile<UChar, isSourceCharacter>(position, end);
-    if (!equalIgnoringCase("'none'", begin, position - begin))
-        return false;
-
-    skipWhile<UChar, isASCIISpace>(position, end);
-    if (position != end)
-        return false;
-
-    return true;
-}
-
-class CSPSource {
-public:
-    CSPSource(ContentSecurityPolicy* policy, const String& scheme, const String& host, int port, const String& path, bool hostHasWildcard, bool portHasWildcard)
-        : m_policy(policy)
-        , m_scheme(scheme)
-        , m_host(host)
-        , m_port(port)
-        , m_path(path)
-        , m_hostHasWildcard(hostHasWildcard)
-        , m_portHasWildcard(portHasWildcard)
-    {
-    }
-
-    bool matches(const KURL& url) const
-    {
-        if (!schemeMatches(url))
-            return false;
-        if (isSchemeOnly())
-            return true;
-        return hostMatches(url) && portMatches(url) && pathMatches(url);
-    }
-
-private:
-    bool schemeMatches(const KURL& url) const
-    {
-        if (m_scheme.isEmpty()) {
-            String protectedResourceScheme(m_policy->securityOrigin()->protocol());
-            if (equalIgnoringCase("http", protectedResourceScheme))
-                return url.protocolIs("http") || url.protocolIs("https");
-            return equalIgnoringCase(url.protocol(), protectedResourceScheme);
-        }
-        return equalIgnoringCase(url.protocol(), m_scheme);
-    }
-
-    bool hostMatches(const KURL& url) const
-    {
-        const String& host = url.host();
-        if (equalIgnoringCase(host, m_host))
-            return true;
-        return m_hostHasWildcard && host.endsWith("." + m_host, false);
-
-    }
-
-    bool pathMatches(const KURL& url) const
-    {
-        if (m_path.isEmpty())
-            return true;
-
-        String path = decodeURLEscapeSequences(url.path());
-
-        if (m_path.endsWith("/"))
-            return path.startsWith(m_path, false);
-
-        return path == m_path;
-    }
-
-    bool portMatches(const KURL& url) const
-    {
-        if (m_portHasWildcard)
-            return true;
-
-        int port = url.port();
-
-        if (port == m_port)
-            return true;
-
-        if (!port)
-            return isDefaultPortForProtocol(m_port, url.protocol());
-
-        if (!m_port)
-            return isDefaultPortForProtocol(port, url.protocol());
-
-        return false;
-    }
-
-    bool isSchemeOnly() const { return m_host.isEmpty(); }
-
-    ContentSecurityPolicy* m_policy;
-    String m_scheme;
-    String m_host;
-    int m_port;
-    String m_path;
-
-    bool m_hostHasWildcard;
-    bool m_portHasWildcard;
-};
-
-class CSPSourceList {
-public:
-    CSPSourceList(ContentSecurityPolicy*, const String& directiveName);
-
-    void parse(const UChar* begin, const UChar* end);
-
-    bool matches(const KURL&);
-    bool allowInline() const { return m_allowInline; }
-    bool allowEval() const { return m_allowEval; }
-    bool allowNonce(const String& nonce) const { return !nonce.isNull() && m_nonces.contains(nonce); }
-
-private:
-    bool parseSource(const UChar* begin, const UChar* end, String& scheme, String& host, int& port, String& path, bool& hostHasWildcard, bool& portHasWildcard);
-    bool parseScheme(const UChar* begin, const UChar* end, String& scheme);
-    bool parseHost(const UChar* begin, const UChar* end, String& host, bool& hostHasWildcard);
-    bool parsePort(const UChar* begin, const UChar* end, int& port, bool& portHasWildcard);
-    bool parsePath(const UChar* begin, const UChar* end, String& path);
-    bool parseNonce(const UChar* begin, const UChar* end, String& nonce);
-
-    void addSourceSelf();
-    void addSourceStar();
-    void addSourceUnsafeInline();
-    void addSourceUnsafeEval();
-    void addSourceNonce(const String& nonce);
-
-    ContentSecurityPolicy* m_policy;
-    Vector<CSPSource> m_list;
-    String m_directiveName;
-    bool m_allowStar;
-    bool m_allowInline;
-    bool m_allowEval;
-    HashSet<String> m_nonces;
-};
-
-CSPSourceList::CSPSourceList(ContentSecurityPolicy* policy, const String& directiveName)
-    : m_policy(policy)
-    , m_directiveName(directiveName)
-    , m_allowStar(false)
-    , m_allowInline(false)
-    , m_allowEval(false)
-{
-}
-
-bool CSPSourceList::matches(const KURL& url)
-{
-    if (m_allowStar)
-        return true;
-
-    KURL effectiveURL = SecurityOrigin::shouldUseInnerURL(url) ? SecurityOrigin::extractInnerURL(url) : url;
-
-    for (size_t i = 0; i < m_list.size(); ++i) {
-        if (m_list[i].matches(effectiveURL))
-            return true;
-    }
-
-    return false;
-}
-
-// source-list       = *WSP [ source *( 1*WSP source ) *WSP ]
-//                   / *WSP "'none'" *WSP
-//
-void CSPSourceList::parse(const UChar* begin, const UChar* end)
-{
-    // We represent 'none' as an empty m_list.
-    if (isSourceListNone(begin, end))
-        return;
-
-    const UChar* position = begin;
-    while (position < end) {
-        skipWhile<UChar, isASCIISpace>(position, end);
-        if (position == end)
-            return;
-
-        const UChar* beginSource = position;
-        skipWhile<UChar, isSourceCharacter>(position, end);
-
-        String scheme, host, path;
-        int port = 0;
-        bool hostHasWildcard = false;
-        bool portHasWildcard = false;
-
-        if (parseSource(beginSource, position, scheme, host, port, path, hostHasWildcard, portHasWildcard)) {
-            // Wildcard hosts and keyword sources ('self', 'unsafe-inline',
-            // etc.) aren't stored in m_list, but as attributes on the source
-            // list itself.
-            if (scheme.isEmpty() && host.isEmpty())
-                continue;
-            if (isDirectiveName(host))
-                m_policy->reportDirectiveAsSourceExpression(m_directiveName, host);
-            m_list.append(CSPSource(m_policy, scheme, host, port, path, hostHasWildcard, portHasWildcard));
-        } else
-            m_policy->reportInvalidSourceExpression(m_directiveName, String(beginSource, position - beginSource));
-
-        ASSERT(position == end || isASCIISpace(*position));
-     }
-}
-
-// source            = scheme ":"
-//                   / ( [ scheme "://" ] host [ port ] [ path ] )
-//                   / "'self'"
-//
-bool CSPSourceList::parseSource(const UChar* begin, const UChar* end,
-                                String& scheme, String& host, int& port, String& path,
-                                bool& hostHasWildcard, bool& portHasWildcard)
-{
-    if (begin == end)
-        return false;
-
-    if (equalIgnoringCase("'none'", begin, end - begin))
-        return false;
-
-    if (end - begin == 1 && *begin == '*') {
-        addSourceStar();
-        return true;
-    }
-
-    if (equalIgnoringCase("'self'", begin, end - begin)) {
-        addSourceSelf();
-        return true;
-    }
-
-    if (equalIgnoringCase("'unsafe-inline'", begin, end - begin)) {
-        addSourceUnsafeInline();
-        return true;
-    }
-
-    if (equalIgnoringCase("'unsafe-eval'", begin, end - begin)) {
-        addSourceUnsafeEval();
-        return true;
-    }
-
-    if (m_policy->experimentalFeaturesEnabled()) {
-        String nonce;
-        if (!parseNonce(begin, end, nonce))
-            return false;
-
-        if (!nonce.isNull()) {
-            addSourceNonce(nonce);
-            return true;
-        }
-    }
-
-    const UChar* position = begin;
-    const UChar* beginHost = begin;
-    const UChar* beginPath = end;
-    const UChar* beginPort = 0;
-
-    skipWhile<UChar, isNotColonOrSlash>(position, end);
-
-    if (position == end) {
-        // host
-        //     ^
-        return parseHost(beginHost, position, host, hostHasWildcard);
-    }
-
-    if (position < end && *position == '/') {
-        // host/path || host/ || /
-        //     ^            ^    ^
-        return parseHost(beginHost, position, host, hostHasWildcard) && parsePath(position, end, path);
-    }
-
-    if (position < end && *position == ':') {
-        if (end - position == 1) {
-            // scheme:
-            //       ^
-            return parseScheme(begin, position, scheme);
-        }
-
-        if (position[1] == '/') {
-            // scheme://host || scheme://
-            //       ^                ^
-            if (!parseScheme(begin, position, scheme)
-                || !skipExactly<UChar>(position, end, ':')
-                || !skipExactly<UChar>(position, end, '/')
-                || !skipExactly<UChar>(position, end, '/'))
-                return false;
-            if (position == end)
-                return true;
-            beginHost = position;
-            skipWhile<UChar, isNotColonOrSlash>(position, end);
-        }
-
-        if (position < end && *position == ':') {
-            // host:port || scheme://host:port
-            //     ^                     ^
-            beginPort = position;
-            skipUntil<UChar>(position, end, '/');
-        }
-    }
-
-    if (position < end && *position == '/') {
-        // scheme://host/path || scheme://host:port/path
-        //              ^                          ^
-        if (position == beginHost)
-            return false;
-        beginPath = position;
-    }
-
-    if (!parseHost(beginHost, beginPort ? beginPort : beginPath, host, hostHasWildcard))
-        return false;
-
-    if (beginPort) {
-        if (!parsePort(beginPort, beginPath, port, portHasWildcard))
-            return false;
-    } else {
-        port = 0;
-    }
-
-    if (beginPath != end) {
-        if (!parsePath(beginPath, end, path))
-            return false;
-    }
-
-    return true;
-}
-
-// nonce-source      = "'nonce-" nonce-value "'"
-// nonce-value       = 1*( ALPHA / DIGIT / "+" / "/" )
-//
-bool CSPSourceList::parseNonce(const UChar* begin, const UChar* end, String& nonce)
-{
-    DEFINE_STATIC_LOCAL(const String, noncePrefix, ("'nonce-"));
-
-    if (!equalIgnoringCase(noncePrefix.characters8(), begin, noncePrefix.length()))
-        return true;
-
-    const UChar* position = begin + noncePrefix.length();
-    const UChar* nonceBegin = position;
-
-    skipWhile<UChar, isNonceCharacter>(position, end);
-    ASSERT(nonceBegin <= position);
-
-    if (((position + 1) != end  && *position != '\'') || !(position - nonceBegin))
-        return false;
-
-    nonce = String(nonceBegin, position - nonceBegin);
-    return true;
-}
-
-//                     ; <scheme> production from RFC 3986
-// scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
-//
-bool CSPSourceList::parseScheme(const UChar* begin, const UChar* end, String& scheme)
-{
-    ASSERT(begin <= end);
-    ASSERT(scheme.isEmpty());
-
-    if (begin == end)
-        return false;
-
-    const UChar* position = begin;
-
-    if (!skipExactly<UChar, isASCIIAlpha>(position, end))
-        return false;
-
-    skipWhile<UChar, isSchemeContinuationCharacter>(position, end);
-
-    if (position != end)
-        return false;
-
-    scheme = String(begin, end - begin);
-    return true;
-}
-
-// host              = [ "*." ] 1*host-char *( "." 1*host-char )
-//                   / "*"
-// host-char         = ALPHA / DIGIT / "-"
-//
-bool CSPSourceList::parseHost(const UChar* begin, const UChar* end, String& host, bool& hostHasWildcard)
-{
-    ASSERT(begin <= end);
-    ASSERT(host.isEmpty());
-    ASSERT(!hostHasWildcard);
-
-    if (begin == end)
-        return false;
-
-    const UChar* position = begin;
-
-    if (skipExactly<UChar>(position, end, '*')) {
-        hostHasWildcard = true;
-
-        if (position == end)
-            return true;
-
-        if (!skipExactly<UChar>(position, end, '.'))
-            return false;
-    }
-
-    const UChar* hostBegin = position;
-
-    while (position < end) {
-        if (!skipExactly<UChar, isHostCharacter>(position, end))
-            return false;
-
-        skipWhile<UChar, isHostCharacter>(position, end);
-
-        if (position < end && !skipExactly<UChar>(position, end, '.'))
-            return false;
-    }
-
-    ASSERT(position == end);
-    host = String(hostBegin, end - hostBegin);
-    return true;
-}
-
-bool CSPSourceList::parsePath(const UChar* begin, const UChar* end, String& path)
-{
-    ASSERT(begin <= end);
-    ASSERT(path.isEmpty());
-
-    const UChar* position = begin;
-    skipWhile<UChar, isPathComponentCharacter>(position, end);
-    // path/to/file.js?query=string || path/to/file.js#anchor
-    //                ^                               ^
-    if (position < end)
-        m_policy->reportInvalidPathCharacter(m_directiveName, String(begin, end - begin), *position);
-
-    path = decodeURLEscapeSequences(String(begin, position - begin));
-
-    ASSERT(position <= end);
-    ASSERT(position == end || (*position == '#' || *position == '?'));
-    return true;
-}
-
-// port              = ":" ( 1*DIGIT / "*" )
-//
-bool CSPSourceList::parsePort(const UChar* begin, const UChar* end, int& port, bool& portHasWildcard)
-{
-    ASSERT(begin <= end);
-    ASSERT(!port);
-    ASSERT(!portHasWildcard);
-
-    if (!skipExactly<UChar>(begin, end, ':'))
-        ASSERT_NOT_REACHED();
-
-    if (begin == end)
-        return false;
-
-    if (end - begin == 1 && *begin == '*') {
-        port = 0;
-        portHasWildcard = true;
-        return true;
-    }
-
-    const UChar* position = begin;
-    skipWhile<UChar, isASCIIDigit>(position, end);
-
-    if (position != end)
-        return false;
-
-    bool ok;
-    port = charactersToIntStrict(begin, end - begin, &ok);
-    return ok;
-}
-
-void CSPSourceList::addSourceSelf()
-{
-    m_list.append(CSPSource(m_policy, m_policy->securityOrigin()->protocol(), m_policy->securityOrigin()->host(), m_policy->securityOrigin()->port(), String(), false, false));
-}
-
-void CSPSourceList::addSourceStar()
-{
-    m_allowStar = true;
-}
-
-void CSPSourceList::addSourceUnsafeInline()
-{
-    m_allowInline = true;
-}
-
-void CSPSourceList::addSourceUnsafeEval()
-{
-    m_allowEval = true;
-}
-
-void CSPSourceList::addSourceNonce(const String& nonce)
-{
-    m_nonces.add(nonce);
-}
-
-class CSPDirective {
-public:
-    CSPDirective(const String& name, const String& value, ContentSecurityPolicy* policy)
-        : m_name(name)
-        , m_text(name + ' ' + value)
-        , m_policy(policy)
-    {
-    }
-
-    const String& text() const { return m_text; }
-
-protected:
-    const ContentSecurityPolicy* policy() const { return m_policy; }
-
-private:
-    String m_name;
-    String m_text;
-    ContentSecurityPolicy* m_policy;
-};
-
-class MediaListDirective : public CSPDirective {
-public:
-    MediaListDirective(const String& name, const String& value, ContentSecurityPolicy* policy)
-        : CSPDirective(name, value, policy)
-    {
-        Vector<UChar> characters;
-        value.appendTo(characters);
-        parse(characters.data(), characters.data() + characters.size());
-    }
-
-    bool allows(const String& type)
-    {
-        return m_pluginTypes.contains(type);
-    }
-
-private:
-    void parse(const UChar* begin, const UChar* end)
-    {
-        const UChar* position = begin;
-
-        // 'plugin-types ____;' OR 'plugin-types;'
-        if (position == end) {
-            policy()->reportInvalidPluginTypes(String());
-            return;
-        }
-
-        while (position < end) {
-            // _____ OR _____mime1/mime1
-            // ^        ^
-            skipWhile<UChar, isASCIISpace>(position, end);
-            if (position == end)
-                return;
-
-            // mime1/mime1 mime2/mime2
-            // ^
-            begin = position;
-            if (!skipExactly<UChar, isMediaTypeCharacter>(position, end)) {
-                skipWhile<UChar, isNotASCIISpace>(position, end);
-                policy()->reportInvalidPluginTypes(String(begin, position - begin));
-                continue;
-            }
-            skipWhile<UChar, isMediaTypeCharacter>(position, end);
-
-            // mime1/mime1 mime2/mime2
-            //      ^
-            if (!skipExactly<UChar>(position, end, '/')) {
-                skipWhile<UChar, isNotASCIISpace>(position, end);
-                policy()->reportInvalidPluginTypes(String(begin, position - begin));
-                continue;
-            }
-
-            // mime1/mime1 mime2/mime2
-            //       ^
-            if (!skipExactly<UChar, isMediaTypeCharacter>(position, end)) {
-                skipWhile<UChar, isNotASCIISpace>(position, end);
-                policy()->reportInvalidPluginTypes(String(begin, position - begin));
-                continue;
-            }
-            skipWhile<UChar, isMediaTypeCharacter>(position, end);
-
-            // mime1/mime1 mime2/mime2 OR mime1/mime1  OR mime1/mime1/error
-            //            ^                          ^               ^
-            if (position < end && isNotASCIISpace(*position)) {
-                skipWhile<UChar, isNotASCIISpace>(position, end);
-                policy()->reportInvalidPluginTypes(String(begin, position - begin));
-                continue;
-            }
-            m_pluginTypes.add(String(begin, position - begin));
-
-            ASSERT(position == end || isASCIISpace(*position));
-        }
-    }
-
-    HashSet<String> m_pluginTypes;
-};
-
-class SourceListDirective : public CSPDirective {
-public:
-    SourceListDirective(const String& name, const String& value, ContentSecurityPolicy* policy)
-        : CSPDirective(name, value, policy)
-        , m_sourceList(policy, name)
-    {
-        Vector<UChar> characters;
-        value.appendTo(characters);
-
-        m_sourceList.parse(characters.data(), characters.data() + characters.size());
-    }
-
-    bool allows(const KURL& url)
-    {
-        return m_sourceList.matches(url.isEmpty() ? policy()->url() : url);
-    }
-
-    bool allowInline() const { return m_sourceList.allowInline(); }
-    bool allowEval() const { return m_sourceList.allowEval(); }
-    bool allowNonce(const String& nonce) const { return m_sourceList.allowNonce(nonce.stripWhiteSpace()); }
-
-private:
-    CSPSourceList m_sourceList;
-};
-
-class CSPDirectiveList {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    static PassOwnPtr<CSPDirectiveList> create(ContentSecurityPolicy*, const UChar* begin, const UChar* end, ContentSecurityPolicy::HeaderType);
-
-    void parse(const UChar* begin, const UChar* end);
-
-    const String& header() const { return m_header; }
-    ContentSecurityPolicy::HeaderType headerType() const { return m_headerType; }
-
-    bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowEval(ScriptState*, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowPluginType(const String& type, const String& typeAttribute, const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-
-    bool allowScriptFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowObjectFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowChildFrameFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowImageFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowStyleFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowFontFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowMediaFromSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowConnectToSource(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowFormAction(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowBaseURI(const KURL&, ContentSecurityPolicy::ReportingStatus) const;
-    bool allowScriptNonce(const String&) const;
-
-    void gatherReportURIs(DOMStringList&) const;
-    const String& evalDisabledErrorMessage() const { return m_evalDisabledErrorMessage; }
-    ContentSecurityPolicy::ReflectedXSSDisposition reflectedXSSDisposition() const { return m_reflectedXSSDisposition; }
-    bool isReportOnly() const { return m_reportOnly; }
-    const Vector<KURL>& reportURIs() const { return m_reportURIs; }
-
-private:
-    CSPDirectiveList(ContentSecurityPolicy*, ContentSecurityPolicy::HeaderType);
-
-    bool parseDirective(const UChar* begin, const UChar* end, String& name, String& value);
-    void parseReportURI(const String& name, const String& value);
-    void parsePluginTypes(const String& name, const String& value);
-    void parseReflectedXSS(const String& name, const String& value);
-    void addDirective(const String& name, const String& value);
-    void applySandboxPolicy(const String& name, const String& sandboxPolicy);
-
-    template <class CSPDirectiveType>
-    void setCSPDirective(const String& name, const String& value, OwnPtr<CSPDirectiveType>&);
-
-    SourceListDirective* operativeDirective(SourceListDirective*) const;
-    void reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL) const;
-    void reportViolationWithLocation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const String& contextURL, const WTF::OrdinalNumber& contextLine) const;
-    void reportViolationWithState(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, ScriptState*) const;
-
-    bool checkEval(SourceListDirective*) const;
-    bool checkInline(SourceListDirective*) const;
-    bool checkNonce(SourceListDirective*, const String&) const;
-    bool checkSource(SourceListDirective*, const KURL&) const;
-    bool checkMediaType(MediaListDirective*, const String& type, const String& typeAttribute) const;
-
-    void setEvalDisabledErrorMessage(const String& errorMessage) { m_evalDisabledErrorMessage = errorMessage; }
-
-    bool checkEvalAndReportViolation(SourceListDirective*, const String& consoleMessage, ScriptState*) const;
-    bool checkInlineAndReportViolation(SourceListDirective*, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, bool isScript) const;
-
-    bool checkSourceAndReportViolation(SourceListDirective*, const KURL&, const String& effectiveDirective) const;
-    bool checkMediaTypeAndReportViolation(MediaListDirective*, const String& type, const String& typeAttribute, const String& consoleMessage) const;
-
-    bool denyIfEnforcingPolicy() const { return m_reportOnly; }
-
-    ContentSecurityPolicy* m_policy;
-
-    String m_header;
-    ContentSecurityPolicy::HeaderType m_headerType;
-
-    bool m_reportOnly;
-    bool m_haveSandboxPolicy;
-    ContentSecurityPolicy::ReflectedXSSDisposition m_reflectedXSSDisposition;
-
-    OwnPtr<MediaListDirective> m_pluginTypes;
-    OwnPtr<SourceListDirective> m_baseURI;
-    OwnPtr<SourceListDirective> m_connectSrc;
-    OwnPtr<SourceListDirective> m_defaultSrc;
-    OwnPtr<SourceListDirective> m_fontSrc;
-    OwnPtr<SourceListDirective> m_formAction;
-    OwnPtr<SourceListDirective> m_frameSrc;
-    OwnPtr<SourceListDirective> m_imgSrc;
-    OwnPtr<SourceListDirective> m_mediaSrc;
-    OwnPtr<SourceListDirective> m_objectSrc;
-    OwnPtr<SourceListDirective> m_scriptSrc;
-    OwnPtr<SourceListDirective> m_styleSrc;
-
-    Vector<KURL> m_reportURIs;
-
-    String m_evalDisabledErrorMessage;
-};
-
-CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy, ContentSecurityPolicy::HeaderType type)
-    : m_policy(policy)
-    , m_headerType(type)
-    , m_reportOnly(false)
-    , m_haveSandboxPolicy(false)
-    , m_reflectedXSSDisposition(ContentSecurityPolicy::ReflectedXSSUnset)
-{
-    m_reportOnly = (type == ContentSecurityPolicy::Report || type == ContentSecurityPolicy::PrefixedReport);
-}
-
-PassOwnPtr<CSPDirectiveList> CSPDirectiveList::create(ContentSecurityPolicy* policy, const UChar* begin, const UChar* end, ContentSecurityPolicy::HeaderType type)
-{
-    OwnPtr<CSPDirectiveList> directives = adoptPtr(new CSPDirectiveList(policy, type));
-    directives->parse(begin, end);
-
-    if (!directives->checkEval(directives->operativeDirective(directives->m_scriptSrc.get()))) {
-        String message = "Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: \"" + directives->operativeDirective(directives->m_scriptSrc.get())->text() + "\".\n";
-        directives->setEvalDisabledErrorMessage(message);
-    }
-
-    if (directives->isReportOnly() && directives->reportURIs().isEmpty())
-        policy->reportMissingReportURI(String(begin, end - begin));
-
-    return directives.release();
-}
-
-void CSPDirectiveList::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL) const
-{
-    String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleMessage;
-    m_policy->scriptExecutionContext()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
-    m_policy->reportViolation(directiveText, effectiveDirective, message, blockedURL, m_reportURIs, m_header);
-}
-
-void CSPDirectiveList::reportViolationWithLocation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const String& contextURL, const WTF::OrdinalNumber& contextLine) const
-{
-    String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleMessage;
-    m_policy->scriptExecutionContext()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, contextURL, contextLine.oneBasedInt());
-    m_policy->reportViolation(directiveText, effectiveDirective, message, blockedURL, m_reportURIs, m_header);
-}
-
-void CSPDirectiveList::reportViolationWithState(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, ScriptState* state) const
-{
-    String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleMessage;
-    m_policy->scriptExecutionContext()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, state);
-    m_policy->reportViolation(directiveText, effectiveDirective, message, blockedURL, m_reportURIs, m_header);
-}
-
-bool CSPDirectiveList::checkEval(SourceListDirective* directive) const
-{
-    return !directive || directive->allowEval();
-}
-
-bool CSPDirectiveList::checkInline(SourceListDirective* directive) const
-{
-    return !directive || directive->allowInline();
-}
-
-bool CSPDirectiveList::checkNonce(SourceListDirective* directive, const String& nonce) const
-{
-    return !directive || directive->allowNonce(nonce);
-}
-
-bool CSPDirectiveList::checkSource(SourceListDirective* directive, const KURL& url) const
-{
-    return !directive || directive->allows(url);
-}
-
-bool CSPDirectiveList::checkMediaType(MediaListDirective* directive, const String& type, const String& typeAttribute) const
-{
-    if (!directive)
-        return true;
-    if (typeAttribute.isEmpty() || typeAttribute.stripWhiteSpace() != type)
-        return false;
-    return directive->allows(type);
-}
-
-SourceListDirective* CSPDirectiveList::operativeDirective(SourceListDirective* directive) const
-{
-    return directive ? directive : m_defaultSrc.get();
-}
-
-bool CSPDirectiveList::checkEvalAndReportViolation(SourceListDirective* directive, const String& consoleMessage, ScriptState* state) const
-{
-    if (checkEval(directive))
-        return true;
-
-    String suffix = String();
-    if (directive == m_defaultSrc)
-        suffix = " Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.";
-
-    reportViolationWithState(directive->text(), scriptSrc, consoleMessage + "\"" + directive->text() + "\"." + suffix + "\n", KURL(), state);
-    if (!m_reportOnly) {
-        m_policy->reportBlockedScriptExecutionToInspector(directive->text());
-        return false;
-    }
-    return true;
-}
-
-bool CSPDirectiveList::checkMediaTypeAndReportViolation(MediaListDirective* directive, const String& type, const String& typeAttribute, const String& consoleMessage) const
-{
-    if (checkMediaType(directive, type, typeAttribute))
-        return true;
-
-    String message = consoleMessage + "\'" + directive->text() + "\'.";
-    if (typeAttribute.isEmpty())
-        message = message + " When enforcing the 'plugin-types' directive, the plugin's media type must be explicitly declared with a 'type' attribute on the containing element (e.g. '<object type=\"[TYPE GOES HERE]\" ...>').";
-
-    reportViolation(directive->text(), pluginTypes, message + "\n", KURL());
-    return denyIfEnforcingPolicy();
-}
-
-bool CSPDirectiveList::checkInlineAndReportViolation(SourceListDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, bool isScript) const
-{
-    if (checkInline(directive))
-        return true;
-
-    String suffix = String();
-    if (directive == m_defaultSrc)
-        suffix = " Note that '" + String(isScript ? "script" : "style") + "-src' was not explicitly set, so 'default-src' is used as a fallback.";
-
-    reportViolationWithLocation(directive->text(), isScript ? scriptSrc : styleSrc, consoleMessage + "\"" + directive->text() + "\"." + suffix + "\n", KURL(), contextURL, contextLine);
-
-    if (!m_reportOnly) {
-        if (isScript)
-            m_policy->reportBlockedScriptExecutionToInspector(directive->text());
-        return false;
-    }
-    return true;
-}
-
-bool CSPDirectiveList::checkSourceAndReportViolation(SourceListDirective* directive, const KURL& url, const String& effectiveDirective) const
-{
-    if (checkSource(directive, url))
-        return true;
-
-    String prefix;
-    if (baseURI == effectiveDirective)
-        prefix = "Refused to set the document's base URI to '";
-    else if (connectSrc == effectiveDirective)
-        prefix = "Refused to connect to '";
-    else if (fontSrc == effectiveDirective)
-        prefix = "Refused to load the font '";
-    else if (formAction == effectiveDirective)
-        prefix = "Refused to send form data to '";
-    else if (frameSrc == effectiveDirective)
-        prefix = "Refused to frame '";
-    else if (imgSrc == effectiveDirective)
-        prefix = "Refused to load the image '";
-    else if (mediaSrc == effectiveDirective)
-        prefix = "Refused to load media from '";
-    else if (objectSrc == effectiveDirective)
-        prefix = "Refused to load plugin data from '";
-    else if (scriptSrc == effectiveDirective)
-        prefix = "Refused to load the script '";
-    else if (styleSrc == effectiveDirective)
-        prefix = "Refused to load the stylesheet '";
-
-    String suffix = String();
-    if (directive == m_defaultSrc)
-        suffix = " Note that '" + effectiveDirective + "' was not explicitly set, so 'default-src' is used as a fallback.";
-
-    reportViolation(directive->text(), effectiveDirective, prefix + url.elidedString() + "' because it violates the following Content Security Policy directive: \"" + directive->text() + "\"." + suffix + "\n", url);
-    return denyIfEnforcingPolicy();
-}
-
-bool CSPDirectiveList::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute JavaScript URL because it violates the following Content Security Policy directive: "));
-    if (reportingStatus == ContentSecurityPolicy::SendReport) {
-        return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true);
-    } else {
-        return checkInline(operativeDirective(m_scriptSrc.get()));
-    }
-}
-
-bool CSPDirectiveList::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute inline event handler because it violates the following Content Security Policy directive: "));
-    if (reportingStatus == ContentSecurityPolicy::SendReport) {
-        return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true);
-    } else {
-        return checkInline(operativeDirective(m_scriptSrc.get()));
-    }
-}
-
-bool CSPDirectiveList::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute inline script because it violates the following Content Security Policy directive: "));
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine, true) :
-        checkInline(operativeDirective(m_scriptSrc.get()));
-}
-
-bool CSPDirectiveList::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to apply inline style because it violates the following Content Security Policy directive: "));
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkInlineAndReportViolation(operativeDirective(m_styleSrc.get()), consoleMessage, contextURL, contextLine, false) :
-        checkInline(operativeDirective(m_styleSrc.get()));
-}
-
-bool CSPDirectiveList::allowEval(ScriptState* state, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "));
-
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkEvalAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, state) :
-        checkEval(operativeDirective(m_scriptSrc.get()));
-}
-
-bool CSPDirectiveList::allowPluginType(const String& type, const String& typeAttribute, const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkMediaTypeAndReportViolation(m_pluginTypes.get(), type, typeAttribute, "Refused to load '" + url.elidedString() + "' (MIME type '" + typeAttribute + "') because it violates the following Content Security Policy Directive: ") :
-        checkMediaType(m_pluginTypes.get(), type, typeAttribute);
-}
-
-bool CSPDirectiveList::allowScriptFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkSourceAndReportViolation(operativeDirective(m_scriptSrc.get()), url, scriptSrc) :
-        checkSource(operativeDirective(m_scriptSrc.get()), url);
-}
-
-bool CSPDirectiveList::allowObjectFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    if (url.isBlankURL())
-        return true;
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkSourceAndReportViolation(operativeDirective(m_objectSrc.get()), url, objectSrc) :
-        checkSource(operativeDirective(m_objectSrc.get()), url);
-}
-
-bool CSPDirectiveList::allowChildFrameFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    if (url.isBlankURL())
-        return true;
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkSourceAndReportViolation(operativeDirective(m_frameSrc.get()), url, frameSrc) :
-        checkSource(operativeDirective(m_frameSrc.get()), url);
-}
-
-bool CSPDirectiveList::allowImageFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkSourceAndReportViolation(operativeDirective(m_imgSrc.get()), url, imgSrc) :
-        checkSource(operativeDirective(m_imgSrc.get()), url);
-}
-
-bool CSPDirectiveList::allowStyleFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkSourceAndReportViolation(operativeDirective(m_styleSrc.get()), url, styleSrc) :
-        checkSource(operativeDirective(m_styleSrc.get()), url);
-}
-
-bool CSPDirectiveList::allowFontFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkSourceAndReportViolation(operativeDirective(m_fontSrc.get()), url, fontSrc) :
-        checkSource(operativeDirective(m_fontSrc.get()), url);
-}
-
-bool CSPDirectiveList::allowMediaFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkSourceAndReportViolation(operativeDirective(m_mediaSrc.get()), url, mediaSrc) :
-        checkSource(operativeDirective(m_mediaSrc.get()), url);
-}
-
-bool CSPDirectiveList::allowConnectToSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkSourceAndReportViolation(operativeDirective(m_connectSrc.get()), url, connectSrc) :
-        checkSource(operativeDirective(m_connectSrc.get()), url);
-}
-
-void CSPDirectiveList::gatherReportURIs(DOMStringList& list) const
-{
-    for (size_t i = 0; i < m_reportURIs.size(); ++i)
-        list.append(m_reportURIs[i].string());
-}
-
-bool CSPDirectiveList::allowFormAction(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkSourceAndReportViolation(m_formAction.get(), url, formAction) :
-        checkSource(m_formAction.get(), url);
-}
-
-bool CSPDirectiveList::allowBaseURI(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return reportingStatus == ContentSecurityPolicy::SendReport ?
-        checkSourceAndReportViolation(m_baseURI.get(), url, baseURI) :
-        checkSource(m_baseURI.get(), url);
-}
-
-bool CSPDirectiveList::allowScriptNonce(const String& nonce) const
-{
-    return checkNonce(operativeDirective(m_scriptSrc.get()), nonce);
-}
-
-// policy            = directive-list
-// directive-list    = [ directive *( ";" [ directive ] ) ]
-//
-void CSPDirectiveList::parse(const UChar* begin, const UChar* end)
-{
-    m_header = String(begin, end - begin);
-
-    if (begin == end)
-        return;
-
-    const UChar* position = begin;
-    while (position < end) {
-        const UChar* directiveBegin = position;
-        skipUntil<UChar>(position, end, ';');
-
-        String name, value;
-        if (parseDirective(directiveBegin, position, name, value)) {
-            ASSERT(!name.isEmpty());
-            addDirective(name, value);
-        }
-
-        ASSERT(position == end || *position == ';');
-        skipExactly<UChar>(position, end, ';');
-    }
-}
-
-// directive         = *WSP [ directive-name [ WSP directive-value ] ]
-// directive-name    = 1*( ALPHA / DIGIT / "-" )
-// directive-value   = *( WSP / <VCHAR except ";"> )
-//
-bool CSPDirectiveList::parseDirective(const UChar* begin, const UChar* end, String& name, String& value)
-{
-    ASSERT(name.isEmpty());
-    ASSERT(value.isEmpty());
-
-    const UChar* position = begin;
-    skipWhile<UChar, isASCIISpace>(position, end);
-
-    // Empty directive (e.g. ";;;"). Exit early.
-    if (position == end)
-        return false;
-
-    const UChar* nameBegin = position;
-    skipWhile<UChar, isDirectiveNameCharacter>(position, end);
-
-    // The directive-name must be non-empty.
-    if (nameBegin == position) {
-        skipWhile<UChar, isNotASCIISpace>(position, end);
-        m_policy->reportUnsupportedDirective(String(nameBegin, position - nameBegin));
-        return false;
-    }
-
-    name = String(nameBegin, position - nameBegin);
-
-    if (position == end)
-        return true;
-
-    if (!skipExactly<UChar, isASCIISpace>(position, end)) {
-        skipWhile<UChar, isNotASCIISpace>(position, end);
-        m_policy->reportUnsupportedDirective(String(nameBegin, position - nameBegin));
-        return false;
-    }
-
-    skipWhile<UChar, isASCIISpace>(position, end);
-
-    const UChar* valueBegin = position;
-    skipWhile<UChar, isDirectiveValueCharacter>(position, end);
-
-    if (position != end) {
-        m_policy->reportInvalidDirectiveValueCharacter(name, String(valueBegin, end - valueBegin));
-        return false;
-    }
-
-    // The directive-value may be empty.
-    if (valueBegin == position)
-        return true;
-
-    value = String(valueBegin, position - valueBegin);
-    return true;
-}
-
-void CSPDirectiveList::parseReportURI(const String& name, const String& value)
-{
-    if (!m_reportURIs.isEmpty()) {
-        m_policy->reportDuplicateDirective(name);
-        return;
-    }
-
-    Vector<UChar> characters;
-    value.appendTo(characters);
-
-    const UChar* position = characters.data();
-    const UChar* end = position + characters.size();
-
-    while (position < end) {
-        skipWhile<UChar, isASCIISpace>(position, end);
-
-        const UChar* urlBegin = position;
-        skipWhile<UChar, isNotASCIISpace>(position, end);
-
-        if (urlBegin < position) {
-            String url = String(urlBegin, position - urlBegin);
-            m_reportURIs.append(m_policy->completeURL(url));
-        }
-    }
-}
-
-
-template<class CSPDirectiveType>
-void CSPDirectiveList::setCSPDirective(const String& name, const String& value, OwnPtr<CSPDirectiveType>& directive)
-{
-    if (directive) {
-        m_policy->reportDuplicateDirective(name);
-        return;
-    }
-    directive = adoptPtr(new CSPDirectiveType(name, value, m_policy));
-}
-
-void CSPDirectiveList::applySandboxPolicy(const String& name, const String& sandboxPolicy)
-{
-    if (m_haveSandboxPolicy) {
-        m_policy->reportDuplicateDirective(name);
-        return;
-    }
-    m_haveSandboxPolicy = true;
-    String invalidTokens;
-    m_policy->enforceSandboxFlags(SecurityContext::parseSandboxPolicy(sandboxPolicy, invalidTokens));
-    if (!invalidTokens.isNull())
-        m_policy->reportInvalidSandboxFlags(invalidTokens);
-}
-
-void CSPDirectiveList::parseReflectedXSS(const String& name, const String& value)
-{
-    if (m_reflectedXSSDisposition != ContentSecurityPolicy::ReflectedXSSUnset) {
-        m_policy->reportDuplicateDirective(name);
-        m_reflectedXSSDisposition = ContentSecurityPolicy::ReflectedXSSInvalid;
-        return;
-    }
-
-    if (value.isEmpty()) {
-        m_reflectedXSSDisposition = ContentSecurityPolicy::ReflectedXSSInvalid;
-        m_policy->reportInvalidReflectedXSS(value);
-        return;
-    }
-
-    Vector<UChar> characters;
-    value.appendTo(characters);
-
-    const UChar* position = characters.data();
-    const UChar* end = position + characters.size();
-
-    skipWhile<UChar, isASCIISpace>(position, end);
-    const UChar* begin = position;
-    skipWhile<UChar, isNotASCIISpace>(position, end);
-
-    // value1
-    //       ^
-    if (equalIgnoringCase("allow", begin, position - begin))
-        m_reflectedXSSDisposition = ContentSecurityPolicy::AllowReflectedXSS;
-    else if (equalIgnoringCase("filter", begin, position - begin))
-        m_reflectedXSSDisposition = ContentSecurityPolicy::FilterReflectedXSS;
-    else if (equalIgnoringCase("block", begin, position - begin))
-        m_reflectedXSSDisposition = ContentSecurityPolicy::BlockReflectedXSS;
-    else {
-        m_reflectedXSSDisposition = ContentSecurityPolicy::ReflectedXSSInvalid;
-        m_policy->reportInvalidReflectedXSS(value);
-        return;
-    }
-
-    skipWhile<UChar, isASCIISpace>(position, end);
-    if (position == end && m_reflectedXSSDisposition != ContentSecurityPolicy::ReflectedXSSUnset)
-        return;
-
-    // value1 value2
-    //        ^
-    m_reflectedXSSDisposition = ContentSecurityPolicy::ReflectedXSSInvalid;
-    m_policy->reportInvalidReflectedXSS(value);
-}
-
-void CSPDirectiveList::addDirective(const String& name, const String& value)
-{
-    ASSERT(!name.isEmpty());
-
-    if (equalIgnoringCase(name, defaultSrc))
-        setCSPDirective<SourceListDirective>(name, value, m_defaultSrc);
-    else if (equalIgnoringCase(name, scriptSrc))
-        setCSPDirective<SourceListDirective>(name, value, m_scriptSrc);
-    else if (equalIgnoringCase(name, objectSrc))
-        setCSPDirective<SourceListDirective>(name, value, m_objectSrc);
-    else if (equalIgnoringCase(name, frameSrc))
-        setCSPDirective<SourceListDirective>(name, value, m_frameSrc);
-    else if (equalIgnoringCase(name, imgSrc))
-        setCSPDirective<SourceListDirective>(name, value, m_imgSrc);
-    else if (equalIgnoringCase(name, styleSrc))
-        setCSPDirective<SourceListDirective>(name, value, m_styleSrc);
-    else if (equalIgnoringCase(name, fontSrc))
-        setCSPDirective<SourceListDirective>(name, value, m_fontSrc);
-    else if (equalIgnoringCase(name, mediaSrc))
-        setCSPDirective<SourceListDirective>(name, value, m_mediaSrc);
-    else if (equalIgnoringCase(name, connectSrc))
-        setCSPDirective<SourceListDirective>(name, value, m_connectSrc);
-    else if (equalIgnoringCase(name, sandbox))
-        applySandboxPolicy(name, value);
-    else if (equalIgnoringCase(name, reportURI))
-        parseReportURI(name, value);
-    else if (m_policy->experimentalFeaturesEnabled()) {
-        if (equalIgnoringCase(name, baseURI))
-            setCSPDirective<SourceListDirective>(name, value, m_baseURI);
-        else if (equalIgnoringCase(name, formAction))
-            setCSPDirective<SourceListDirective>(name, value, m_formAction);
-        else if (equalIgnoringCase(name, pluginTypes))
-            setCSPDirective<MediaListDirective>(name, value, m_pluginTypes);
-        else if (equalIgnoringCase(name, reflectedXSS))
-            parseReflectedXSS(name, value);
-        else
-            m_policy->reportUnsupportedDirective(name);
-    }
-    else
-        m_policy->reportUnsupportedDirective(name);
-}
-
-ContentSecurityPolicy::ContentSecurityPolicy(ScriptExecutionContext* scriptExecutionContext)
-    : m_scriptExecutionContext(scriptExecutionContext)
-    , m_overrideInlineStyleAllowed(false)
-{
-}
-
-ContentSecurityPolicy::~ContentSecurityPolicy()
-{
-}
-
-void ContentSecurityPolicy::copyStateFrom(const ContentSecurityPolicy* other)
-{
-    ASSERT(m_policies.isEmpty());
-    for (CSPDirectiveListVector::const_iterator iter = other->m_policies.begin(); iter != other->m_policies.end(); ++iter)
-        addPolicyFromHeaderValue((*iter)->header(), (*iter)->headerType());
-}
-
-void ContentSecurityPolicy::didReceiveHeaders(const ContentSecurityPolicyResponseHeaders& headers)
-{
-    if (!headers.contentSecurityPolicy().isEmpty())
-        didReceiveHeader(headers.contentSecurityPolicy(), ContentSecurityPolicy::Enforce);
-    if (!headers.contentSecurityPolicyReportOnly().isEmpty())
-        didReceiveHeader(headers.contentSecurityPolicyReportOnly(), ContentSecurityPolicy::Report);
-    if (!headers.xWebKitCSP().isEmpty())
-        didReceiveHeader(headers.xWebKitCSP(), ContentSecurityPolicy::PrefixedEnforce);
-    if (!headers.xWebKitCSPReportOnly().isEmpty())
-        didReceiveHeader(headers.xWebKitCSPReportOnly(), ContentSecurityPolicy::PrefixedReport);
-}
-
-void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType type)
-{
-    addPolicyFromHeaderValue(header, type);
-}
-
-void ContentSecurityPolicy::addPolicyFromHeaderValue(const String& header, HeaderType type)
-{
-    if (m_scriptExecutionContext->isDocument()) {
-        Document* document = toDocument(m_scriptExecutionContext);
-        if (type == PrefixedReport || type == PrefixedEnforce)
-            UseCounter::countDeprecation(document, getUseCounterType(type));
-        else
-            UseCounter::count(document, getUseCounterType(type));
-    }
-
-    Vector<UChar> characters;
-    header.appendTo(characters);
-
-    const UChar* begin = characters.data();
-    const UChar* end = begin + characters.size();
-
-    // RFC2616, section 4.2 specifies that headers appearing multiple times can
-    // be combined with a comma. Walk the header string, and parse each comma
-    // separated chunk as a separate header.
-    const UChar* position = begin;
-    while (position < end) {
-        skipUntil<UChar>(position, end, ',');
-
-        // header1,header2 OR header1
-        //        ^                  ^
-        OwnPtr<CSPDirectiveList> policy = CSPDirectiveList::create(this, begin, position, type);
-
-        // We disable 'eval()' even in the case of report-only policies, and rely on the check in the V8Initializer::codeGenerationCheckCallbackInMainThread callback to determine whether the call should execute or not.
-        if (!policy->allowEval(0, SuppressReport))
-            m_scriptExecutionContext->disableEval(policy->evalDisabledErrorMessage());
-
-        m_policies.append(policy.release());
-
-        // Skip the comma, and begin the next header from the current position.
-        ASSERT(position == end || *position == ',');
-        skipExactly<UChar>(position, end, ',');
-        begin = position;
-    }
-}
-
-void ContentSecurityPolicy::setOverrideAllowInlineStyle(bool value)
-{
-    m_overrideInlineStyleAllowed = value;
-}
-
-const String& ContentSecurityPolicy::deprecatedHeader() const
-{
-    return m_policies.isEmpty() ? emptyString() : m_policies[0]->header();
-}
-
-ContentSecurityPolicy::HeaderType ContentSecurityPolicy::deprecatedHeaderType() const
-{
-    return m_policies.isEmpty() ? Enforce : m_policies[0]->headerType();
-}
-
-template<bool (CSPDirectiveList::*allowed)(ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowedByAll(const CSPDirectiveListVector& policies, ContentSecurityPolicy::ReportingStatus reportingStatus)
-{
-    for (size_t i = 0; i < policies.size(); ++i) {
-        if (!(policies[i].get()->*allowed)(reportingStatus))
-            return false;
-    }
-    return true;
-}
-
-template<bool (CSPDirectiveList::*allowed)(ScriptState* state, ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowedByAllWithState(const CSPDirectiveListVector& policies, ScriptState* state, ContentSecurityPolicy::ReportingStatus reportingStatus)
-{
-    for (size_t i = 0; i < policies.size(); ++i) {
-        if (!(policies[i].get()->*allowed)(state, reportingStatus))
-            return false;
-    }
-    return true;
-}
-
-template<bool (CSPDirectiveList::*allowed)(const String&, const WTF::OrdinalNumber&, ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowedByAllWithContext(const CSPDirectiveListVector& policies, const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus)
-{
-    for (size_t i = 0; i < policies.size(); ++i) {
-        if (!(policies[i].get()->*allowed)(contextURL, contextLine, reportingStatus))
-            return false;
-    }
-    return true;
-}
-
-template<bool (CSPDirectiveList::*allowed)(const String&) const>
-bool isAllowedByAllWithNonce(const CSPDirectiveListVector& policies, const String& nonce)
-{
-    for (size_t i = 0; i < policies.size(); ++i) {
-        if (!(policies[i].get()->*allowed)(nonce))
-            return false;
-    }
-    return true;
-}
-template<bool (CSPDirectiveList::*allowFromURL)(const KURL&, ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowedByAllWithURL(const CSPDirectiveListVector& policies, const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus)
-{
-    if (SchemeRegistry::schemeShouldBypassContentSecurityPolicy(url.protocol()))
-        return true;
-
-    for (size_t i = 0; i < policies.size(); ++i) {
-        if (!(policies[i].get()->*allowFromURL)(url, reportingStatus))
-            return false;
-    }
-    return true;
-}
-
-bool ContentSecurityPolicy::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithContext<&CSPDirectiveList::allowJavaScriptURLs>(m_policies, contextURL, contextLine, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineEventHandlers>(m_policies, contextURL, contextLine, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineScript>(m_policies, contextURL, contextLine, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    if (m_overrideInlineStyleAllowed)
-        return true;
-    return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineStyle>(m_policies, contextURL, contextLine, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowEval(ScriptState* state, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithState<&CSPDirectiveList::allowEval>(m_policies, state, reportingStatus);
-}
-
-String ContentSecurityPolicy::evalDisabledErrorMessage() const
-{
-    for (size_t i = 0; i < m_policies.size(); ++i) {
-        if (!m_policies[i]->allowEval(0, SuppressReport))
-            return m_policies[i]->evalDisabledErrorMessage();
-    }
-    return String();
-}
-
-bool ContentSecurityPolicy::allowPluginType(const String& type, const String& typeAttribute, const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    for (size_t i = 0; i < m_policies.size(); ++i) {
-        if (!m_policies[i]->allowPluginType(type, typeAttribute, url, reportingStatus))
-            return false;
-    }
-    return true;
-}
-
-bool ContentSecurityPolicy::allowScriptFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithURL<&CSPDirectiveList::allowScriptFromSource>(m_policies, url, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowScriptNonce(const String& nonce) const
-{
-    return isAllowedByAllWithNonce<&CSPDirectiveList::allowScriptNonce>(m_policies, nonce);
-}
-
-bool ContentSecurityPolicy::allowObjectFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithURL<&CSPDirectiveList::allowObjectFromSource>(m_policies, url, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowChildFrameFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithURL<&CSPDirectiveList::allowChildFrameFromSource>(m_policies, url, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowImageFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithURL<&CSPDirectiveList::allowImageFromSource>(m_policies, url, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowStyleFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithURL<&CSPDirectiveList::allowStyleFromSource>(m_policies, url, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowFontFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithURL<&CSPDirectiveList::allowFontFromSource>(m_policies, url, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowMediaFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithURL<&CSPDirectiveList::allowMediaFromSource>(m_policies, url, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowConnectToSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithURL<&CSPDirectiveList::allowConnectToSource>(m_policies, url, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowFormAction(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithURL<&CSPDirectiveList::allowFormAction>(m_policies, url, reportingStatus);
-}
-
-bool ContentSecurityPolicy::allowBaseURI(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
-{
-    return isAllowedByAllWithURL<&CSPDirectiveList::allowBaseURI>(m_policies, url, reportingStatus);
-}
-
-bool ContentSecurityPolicy::isActive() const
-{
-    return !m_policies.isEmpty();
-}
-
-ContentSecurityPolicy::ReflectedXSSDisposition ContentSecurityPolicy::reflectedXSSDisposition() const
-{
-    ReflectedXSSDisposition disposition = ReflectedXSSUnset;
-    for (size_t i = 0; i < m_policies.size(); ++i) {
-        if (m_policies[i]->reflectedXSSDisposition() > disposition)
-            disposition = std::max(disposition, m_policies[i]->reflectedXSSDisposition());
-    }
-    return disposition;
-}
-
-void ContentSecurityPolicy::gatherReportURIs(DOMStringList& list) const
-{
-    for (size_t i = 0; i < m_policies.size(); ++i)
-        m_policies[i]->gatherReportURIs(list);
-}
-
-SecurityOrigin* ContentSecurityPolicy::securityOrigin() const
-{
-    return m_scriptExecutionContext->securityOrigin();
-}
-
-const KURL& ContentSecurityPolicy::url() const
-{
-    return m_scriptExecutionContext->url();
-}
-
-KURL ContentSecurityPolicy::completeURL(const String& url) const
-{
-    return m_scriptExecutionContext->completeURL(url);
-}
-
-void ContentSecurityPolicy::enforceSandboxFlags(SandboxFlags mask) const
-{
-    m_scriptExecutionContext->enforceSandboxFlags(mask);
-}
-
-static String stripURLForUseInReport(Document* document, const KURL& url)
-{
-    if (!url.isValid())
-        return String();
-    if (!url.isHierarchical() || url.protocolIs("file"))
-        return url.protocol();
-    return document->securityOrigin()->canRequest(url) ? url.strippedForUseAsReferrer() : SecurityOrigin::create(url)->toString();
-}
-
-static void gatherSecurityPolicyViolationEventData(SecurityPolicyViolationEventInit& init, Document* document, const String& directiveText, const String& effectiveDirective, const KURL& blockedURL, const String& header)
-{
-    init.documentURI = document->url().string();
-    init.referrer = document->referrer();
-    init.blockedURI = stripURLForUseInReport(document, blockedURL);
-    init.violatedDirective = directiveText;
-    init.effectiveDirective = effectiveDirective;
-    init.originalPolicy = header;
-    init.sourceFile = String();
-    init.lineNumber = 0;
-    init.columnNumber = 0;
-    init.statusCode = 0;
-
-    if (!SecurityOrigin::isSecure(document->url()) && document->loader())
-        init.statusCode = document->loader()->response().httpStatusCode();
-
-    RefPtr<ScriptCallStack> stack = createScriptCallStack(1, false);
-    if (!stack)
-        return;
-
-    const ScriptCallFrame& callFrame = stack->at(0);
-
-    if (callFrame.lineNumber()) {
-        KURL source = KURL(ParsedURLString, callFrame.sourceURL());
-        init.sourceFile = stripURLForUseInReport(document, source);
-        init.lineNumber = callFrame.lineNumber();
-        init.columnNumber = callFrame.columnNumber();
-    }
-}
-
-void ContentSecurityPolicy::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header)
-{
-    // FIXME: Support sending reports from worker.
-    if (!m_scriptExecutionContext->isDocument())
-        return;
-
-    Document* document = toDocument(m_scriptExecutionContext);
-    Frame* frame = document->frame();
-    if (!frame)
-        return;
-
-    SecurityPolicyViolationEventInit violationData;
-    gatherSecurityPolicyViolationEventData(violationData, document, directiveText, effectiveDirective, blockedURL, header);
-
-    if (experimentalFeaturesEnabled())
-        document->enqueueDocumentEvent(SecurityPolicyViolationEvent::create(eventNames().securitypolicyviolationEvent, violationData));
-
-    if (reportURIs.isEmpty())
-        return;
-
-    // We need to be careful here when deciding what information to send to the
-    // report-uri. Currently, we send only the current document's URL and the
-    // directive that was violated. The document's URL is safe to send because
-    // it's the document itself that's requesting that it be sent. You could
-    // make an argument that we shouldn't send HTTPS document URLs to HTTP
-    // report-uris (for the same reasons that we supress the Referer in that
-    // case), but the Referer is sent implicitly whereas this request is only
-    // sent explicitly. As for which directive was violated, that's pretty
-    // harmless information.
-
-    RefPtr<JSONObject> cspReport = JSONObject::create();
-    cspReport->setString("document-uri", violationData.documentURI);
-    cspReport->setString("referrer", violationData.referrer);
-    cspReport->setString("violated-directive", violationData.violatedDirective);
-    if (experimentalFeaturesEnabled())
-        cspReport->setString("effective-directive", violationData.effectiveDirective);
-    cspReport->setString("original-policy", violationData.originalPolicy);
-    cspReport->setString("blocked-uri", violationData.blockedURI);
-    if (!violationData.sourceFile.isEmpty() && violationData.lineNumber) {
-        cspReport->setString("source-file", violationData.sourceFile);
-        cspReport->setNumber("line-number", violationData.lineNumber);
-        cspReport->setNumber("column-number", violationData.columnNumber);
-    }
-    cspReport->setNumber("status-code", violationData.statusCode);
-
-    RefPtr<JSONObject> reportObject = JSONObject::create();
-    reportObject->setObject("csp-report", cspReport.release());
-    String stringifiedReport = reportObject->toJSONString();
-
-    if (!shouldSendViolationReport(stringifiedReport))
-        return;
-
-    RefPtr<FormData> report = FormData::create(stringifiedReport.utf8());
-
-    for (size_t i = 0; i < reportURIs.size(); ++i)
-        PingLoader::sendViolationReport(frame, reportURIs[i], report, PingLoader::ContentSecurityPolicyViolationReport);
-
-    didSendViolationReport(stringifiedReport);
-}
-
-void ContentSecurityPolicy::reportUnsupportedDirective(const String& name) const
-{
-    DEFINE_STATIC_LOCAL(String, allow, ("allow"));
-    DEFINE_STATIC_LOCAL(String, options, ("options"));
-    DEFINE_STATIC_LOCAL(String, policyURI, ("policy-uri"));
-    DEFINE_STATIC_LOCAL(String, allowMessage, ("The 'allow' directive has been replaced with 'default-src'. Please use that directive instead, as 'allow' has no effect."));
-    DEFINE_STATIC_LOCAL(String, optionsMessage, ("The 'options' directive has been replaced with 'unsafe-inline' and 'unsafe-eval' source expressions for the 'script-src' and 'style-src' directives. Please use those directives instead, as 'options' has no effect."));
-    DEFINE_STATIC_LOCAL(String, policyURIMessage, ("The 'policy-uri' directive has been removed from the specification. Please specify a complete policy via the Content-Security-Policy header."));
-
-    String message = "Unrecognized Content-Security-Policy directive '" + name + "'.\n";
-    if (equalIgnoringCase(name, allow))
-        message = allowMessage;
-    else if (equalIgnoringCase(name, options))
-        message = optionsMessage;
-    else if (equalIgnoringCase(name, policyURI))
-        message = policyURIMessage;
-
-    logToConsole(message);
-}
-
-void ContentSecurityPolicy::reportDirectiveAsSourceExpression(const String& directiveName, const String& sourceExpression) const
-{
-    String message = "The Content Security Policy directive '" + directiveName + "' contains '" + sourceExpression + "' as a source expression. Did you mean '" + directiveName + " ...; " + sourceExpression + "...' (note the semicolon)?";
-    logToConsole(message);
-}
-
-void ContentSecurityPolicy::reportDuplicateDirective(const String& name) const
-{
-    String message = "Ignoring duplicate Content-Security-Policy directive '" + name + "'.\n";
-    logToConsole(message);
-}
-
-void ContentSecurityPolicy::reportInvalidPluginTypes(const String& pluginType) const
-{
-    String message;
-    if (pluginType.isNull())
-        message = "'plugin-types' Content Security Policy directive is empty; all plugins will be blocked.\n";
-    else
-        message = "Invalid plugin type in 'plugin-types' Content Security Policy directive: '" + pluginType + "'.\n";
-    logToConsole(message);
-}
-
-void ContentSecurityPolicy::reportInvalidSandboxFlags(const String& invalidFlags) const
-{
-    logToConsole("Error while parsing the 'sandbox' Content Security Policy directive: " + invalidFlags);
-}
-
-void ContentSecurityPolicy::reportInvalidReflectedXSS(const String& invalidValue) const
-{
-    logToConsole("The 'reflected-xss' Content Security Policy directive has the invalid value \"" + invalidValue + "\". Valid values are \"allow\", \"filter\", and \"block\".");
-}
-
-void ContentSecurityPolicy::reportInvalidDirectiveValueCharacter(const String& directiveName, const String& value) const
-{
-    String message = "The value for Content Security Policy directive '" + directiveName + "' contains an invalid character: '" + value + "'. Non-whitespace characters outside ASCII 0x21-0x7E must be percent-encoded, as described in RFC 3986, section 2.1: http://tools.ietf.org/html/rfc3986#section-2.1.";
-    logToConsole(message);
-}
-
-void ContentSecurityPolicy::reportInvalidPathCharacter(const String& directiveName, const String& value, const char invalidChar) const
-{
-    ASSERT(invalidChar == '#' || invalidChar == '?');
-
-    String ignoring = "The fragment identifier, including the '#', will be ignored.";
-    if (invalidChar == '?')
-        ignoring = "The query component, including the '?', will be ignored.";
-    String message = "The source list for Content Security Policy directive '" + directiveName + "' contains a source with an invalid path: '" + value + "'. " + ignoring;
-    logToConsole(message);
-}
-
-void ContentSecurityPolicy::reportInvalidNonce(const String& nonce) const
-{
-    String message = "Ignoring invalid Content Security Policy script nonce: '" + nonce + "'.\n";
-    logToConsole(message);
-}
-
-void ContentSecurityPolicy::reportInvalidSourceExpression(const String& directiveName, const String& source) const
-{
-    String message = "The source list for Content Security Policy directive '" + directiveName + "' contains an invalid source: '" + source + "'. It will be ignored.";
-    if (equalIgnoringCase(source, "'none'"))
-        message = message + " Note that 'none' has no effect unless it is the only expression in the source list.";
-    logToConsole(message);
-}
-
-void ContentSecurityPolicy::reportMissingReportURI(const String& policy) const
-{
-    logToConsole("The Content Security Policy '" + policy + "' was delivered in report-only mode, but does not specify a 'report-uri'; the policy will have no effect. Please either add a 'report-uri' directive, or deliver the policy via the 'Content-Security-Policy' header.");
-}
-
-void ContentSecurityPolicy::logToConsole(const String& message) const
-{
-    m_scriptExecutionContext->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
-}
-
-void ContentSecurityPolicy::reportBlockedScriptExecutionToInspector(const String& directiveText) const
-{
-    InspectorInstrumentation::scriptExecutionBlockedByCSP(m_scriptExecutionContext, directiveText);
-}
-
-bool ContentSecurityPolicy::experimentalFeaturesEnabled() const
-{
-    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;
-}
-
-bool ContentSecurityPolicy::shouldSendViolationReport(const String& report) const
-{
-    // Collisions have no security impact, so we can save space by storing only the string's hash rather than the whole report.
-    return !m_violationReportsSent.contains(report.impl()->hash());
-}
-
-void ContentSecurityPolicy::didSendViolationReport(const String& report)
-{
-    m_violationReportsSent.add(report.impl()->hash());
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/ContentSecurityPolicy.h b/Source/core/page/ContentSecurityPolicy.h
deleted file mode 100644
index ad5c6b0..0000000
--- a/Source/core/page/ContentSecurityPolicy.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) 2011 Google, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GOOGLE 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,
- * 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 ContentSecurityPolicy_h
-#define ContentSecurityPolicy_h
-
-#include "bindings/v8/ScriptState.h"
-#include "wtf/HashSet.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/Vector.h"
-#include "wtf/text/StringHash.h"
-#include "wtf/text/TextPosition.h"
-#include "wtf/text/WTFString.h"
-
-namespace WTF {
-class OrdinalNumber;
-}
-
-namespace WebCore {
-
-class ContentSecurityPolicyResponseHeaders;
-class CSPDirectiveList;
-class DOMStringList;
-class JSONObject;
-class KURL;
-class ScriptExecutionContext;
-class SecurityOrigin;
-
-typedef int SandboxFlags;
-typedef Vector<OwnPtr<CSPDirectiveList> > CSPDirectiveListVector;
-
-class ContentSecurityPolicy {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    static PassOwnPtr<ContentSecurityPolicy> create(ScriptExecutionContext* scriptExecutionContext)
-    {
-        return adoptPtr(new ContentSecurityPolicy(scriptExecutionContext));
-    }
-    ~ContentSecurityPolicy();
-
-    void copyStateFrom(const ContentSecurityPolicy*);
-
-    enum HeaderType {
-        Report,
-        Enforce,
-        PrefixedReport,
-        PrefixedEnforce
-    };
-
-    enum ReportingStatus {
-        SendReport,
-        SuppressReport
-    };
-
-    // Be sure to update the behavior of XSSAuditor::combineXSSProtectionHeaderAndCSP whenever you change this enum's content or ordering.
-    enum ReflectedXSSDisposition {
-        ReflectedXSSUnset = 0,
-        AllowReflectedXSS,
-        ReflectedXSSInvalid,
-        FilterReflectedXSS,
-        BlockReflectedXSS
-    };
-
-    void didReceiveHeaders(const ContentSecurityPolicyResponseHeaders&);
-    void didReceiveHeader(const String&, HeaderType);
-
-    // These functions are wrong because they assume that there is only one header.
-    // FIXME: Replace them with functions that return vectors.
-    const String& deprecatedHeader() const;
-    HeaderType deprecatedHeaderType() const;
-
-    bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const;
-    bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const;
-    bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const;
-    bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const;
-    bool allowEval(ScriptState* = 0, ReportingStatus = SendReport) const;
-    bool allowPluginType(const String& type, const String& typeAttribute, const KURL&, ReportingStatus = SendReport) const;
-
-    bool allowScriptFromSource(const KURL&, ReportingStatus = SendReport) const;
-    bool allowObjectFromSource(const KURL&, ReportingStatus = SendReport) const;
-    bool allowChildFrameFromSource(const KURL&, ReportingStatus = SendReport) const;
-    bool allowImageFromSource(const KURL&, ReportingStatus = SendReport) const;
-    bool allowStyleFromSource(const KURL&, ReportingStatus = SendReport) const;
-    bool allowFontFromSource(const KURL&, ReportingStatus = SendReport) const;
-    bool allowMediaFromSource(const KURL&, ReportingStatus = SendReport) const;
-    bool allowConnectToSource(const KURL&, ReportingStatus = SendReport) const;
-    bool allowFormAction(const KURL&, ReportingStatus = SendReport) const;
-    bool allowBaseURI(const KURL&, ReportingStatus = SendReport) const;
-    bool allowScriptNonce(const String& nonce) const;
-
-    ReflectedXSSDisposition reflectedXSSDisposition() const;
-
-    void setOverrideAllowInlineStyle(bool);
-
-    bool isActive() const;
-    void gatherReportURIs(DOMStringList&) const;
-
-    void reportDirectiveAsSourceExpression(const String& directiveName, const String& sourceExpression) const;
-    void reportDuplicateDirective(const String&) const;
-    void reportInvalidDirectiveValueCharacter(const String& directiveName, const String& value) const;
-    void reportInvalidPathCharacter(const String& directiveName, const String& value, const char) const;
-    void reportInvalidNonce(const String&) const;
-    void reportInvalidPluginTypes(const String&) const;
-    void reportInvalidSandboxFlags(const String&) const;
-    void reportInvalidSourceExpression(const String& directiveName, const String& source) const;
-    void reportInvalidReflectedXSS(const String&) const;
-    void reportMissingReportURI(const String&) const;
-    void reportUnsupportedDirective(const String&) const;
-    void reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header);
-
-    void reportBlockedScriptExecutionToInspector(const String& directiveText) const;
-
-    const KURL& url() const;
-    KURL completeURL(const String&) const;
-    SecurityOrigin* securityOrigin() const;
-    void enforceSandboxFlags(SandboxFlags) const;
-    String evalDisabledErrorMessage() const;
-
-    bool experimentalFeaturesEnabled() const;
-
-    static bool shouldBypassMainWorld(ScriptExecutionContext*);
-
-    ScriptExecutionContext* scriptExecutionContext() { return m_scriptExecutionContext; }
-
-private:
-    explicit ContentSecurityPolicy(ScriptExecutionContext*);
-
-    void logToConsole(const String& message) const;
-    void addPolicyFromHeaderValue(const String&, HeaderType);
-
-    bool shouldSendViolationReport(const String&) const;
-    void didSendViolationReport(const String&);
-
-    ScriptExecutionContext* m_scriptExecutionContext;
-    bool m_overrideInlineStyleAllowed;
-    CSPDirectiveListVector m_policies;
-
-    HashSet<unsigned, AlreadyHashed> m_violationReportsSent;
-};
-
-}
-
-#endif
diff --git a/Source/core/page/ContentSecurityPolicyResponseHeaders.cpp b/Source/core/page/ContentSecurityPolicyResponseHeaders.cpp
deleted file mode 100644
index f51d762..0000000
--- a/Source/core/page/ContentSecurityPolicyResponseHeaders.cpp
+++ /dev/null
@@ -1,42 +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:
- * 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 GOOGLE 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,
- * 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/page/ContentSecurityPolicyResponseHeaders.h"
-
-#include "core/platform/network/ResourceResponse.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders(const ResourceResponse& response)
-    : m_contentSecurityPolicy(response.httpHeaderField("Content-Security-Policy"))
-    , m_contentSecurityPolicyReportOnly(response.httpHeaderField("Content-Security-Policy-Report-Only"))
-    , m_xWebKitCSP(response.httpHeaderField("X-WebKit-CSP"))
-    , m_xWebKitCSPReportOnly(response.httpHeaderField("X-WebKit-CSP-Report-Only"))
-{
-}
-
-}
diff --git a/Source/core/page/ContextMenuController.cpp b/Source/core/page/ContextMenuController.cpp
index c7ac96e..4570af4 100644
--- a/Source/core/page/ContextMenuController.cpp
+++ b/Source/core/page/ContextMenuController.cpp
@@ -34,7 +34,7 @@
 #include "core/page/ContextMenuClient.h"
 #include "core/page/ContextMenuProvider.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/platform/ContextMenu.h"
 #include "core/platform/ContextMenuItem.h"
 #include "core/rendering/HitTestResult.h"
@@ -72,7 +72,7 @@
 {
     if (Node* innerNode = m_hitTestResult.innerNode()) {
         // Invalidate the context menu info if its target document is detached.
-        if (&innerNode->document() == document)
+        if (innerNode->document() == document)
             clearContextMenu();
     }
 }
diff --git a/Source/core/page/CreateWindow.cpp b/Source/core/page/CreateWindow.cpp
index d2b4fbe..03fd40c 100644
--- a/Source/core/page/CreateWindow.cpp
+++ b/Source/core/page/CreateWindow.cpp
@@ -31,7 +31,7 @@
 #include "core/loader/FrameLoadRequest.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/page/WindowFeatures.h"
diff --git a/Source/core/page/CreateWindow.h b/Source/core/page/CreateWindow.h
index 4160344..7226fa4 100644
--- a/Source/core/page/CreateWindow.h
+++ b/Source/core/page/CreateWindow.h
@@ -27,7 +27,7 @@
 #ifndef CreateWindow_h
 #define CreateWindow_h
 
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
diff --git a/Source/core/page/DOMPoint.h b/Source/core/page/DOMPoint.h
deleted file mode 100644
index 060e19a..0000000
--- a/Source/core/page/DOMPoint.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2009 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,
- * 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 DOMPoint_h
-#define DOMPoint_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class DOMPoint : public RefCounted<DOMPoint>, public ScriptWrappable {
-public:
-    static PassRefPtr<DOMPoint> create()
-    {
-        return adoptRef(new DOMPoint());
-    }
-    static PassRefPtr<DOMPoint> create(float x, float y)
-    {
-        return adoptRef(new DOMPoint(x, y));
-    }
-
-    float x() const { return m_x; }
-    float y() const { return m_y; }
-
-    void setX(float x) { m_x = x; }
-    void setY(float y) { m_y = y; }
-
-private:
-    DOMPoint(float x=0, float y=0)
-        : m_x(x)
-        , m_y(y)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    float m_x;
-    float m_y;
-};
-
-} // namespace WebCore
-
-#endif // DOMPoint_h
diff --git a/Source/core/page/DOMSecurityPolicy.cpp b/Source/core/page/DOMSecurityPolicy.cpp
deleted file mode 100644
index 1c62083..0000000
--- a/Source/core/page/DOMSecurityPolicy.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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 GOOGLE 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,
- * 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/page/DOMSecurityPolicy.h"
-
-#include "core/dom/ContextLifecycleObserver.h"
-#include "core/dom/DOMStringList.h"
-#include "core/dom/ScriptExecutionContext.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "wtf/text/TextPosition.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-namespace {
-
-bool isPolicyActiveInContext(ScriptExecutionContext* context)
-{
-    // If the ScriptExecutionContext has been destroyed, there's no active policy.
-    if (!context)
-        return false;
-
-    return context->contentSecurityPolicy()->isActive();
-}
-
-template<bool (ContentSecurityPolicy::*allowWithType)(const String&, const String&, const KURL&, ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowedWithType(ScriptExecutionContext* context, const String& type)
-{
-    if (!isPolicyActiveInContext(context))
-        return true;
-
-    return (context->contentSecurityPolicy()->*allowWithType)(type, type, KURL(), ContentSecurityPolicy::SuppressReport);
-}
-
-template<bool (ContentSecurityPolicy::*allowWithURL)(const KURL&, ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowedWithURL(ScriptExecutionContext* context, const String& url)
-{
-    if (!isPolicyActiveInContext(context))
-        return true;
-
-    KURL parsedURL = context->completeURL(url);
-    if (!parsedURL.isValid())
-        return false; // FIXME: Figure out how to throw a JavaScript error.
-
-    return (context->contentSecurityPolicy()->*allowWithURL)(parsedURL, ContentSecurityPolicy::SuppressReport);
-}
-
-template<bool (ContentSecurityPolicy::*allowWithContext)(const String&, const WTF::OrdinalNumber&, ContentSecurityPolicy::ReportingStatus) const>
-bool isAllowed(ScriptExecutionContext* context)
-{
-    if (!isPolicyActiveInContext(context))
-        return true;
-
-    return (context->contentSecurityPolicy()->*allowWithContext)(String(), WTF::OrdinalNumber::beforeFirst(), ContentSecurityPolicy::SuppressReport);
-}
-
-} // namespace
-
-DOMSecurityPolicy::DOMSecurityPolicy(ScriptExecutionContext* context)
-    : ContextLifecycleObserver(context)
-{
-    ScriptWrappable::init(this);
-}
-
-DOMSecurityPolicy::~DOMSecurityPolicy()
-{
-}
-
-bool DOMSecurityPolicy::isActive() const
-{
-    return isPolicyActiveInContext(scriptExecutionContext());
-}
-
-PassRefPtr<DOMStringList> DOMSecurityPolicy::reportURIs() const
-{
-    RefPtr<DOMStringList> result = DOMStringList::create();
-
-    if (isActive())
-        scriptExecutionContext()->contentSecurityPolicy()->gatherReportURIs(*result.get());
-
-    return result.release();
-}
-
-bool DOMSecurityPolicy::allowsInlineScript() const
-{
-    return isAllowed<&ContentSecurityPolicy::allowInlineScript>(scriptExecutionContext());
-}
-
-bool DOMSecurityPolicy::allowsInlineStyle() const
-{
-    return isAllowed<&ContentSecurityPolicy::allowInlineStyle>(scriptExecutionContext());
-}
-
-bool DOMSecurityPolicy::allowsEval() const
-{
-    if (!isActive())
-        return true;
-
-    return scriptExecutionContext()->contentSecurityPolicy()->allowEval(0, ContentSecurityPolicy::SuppressReport);
-}
-
-
-bool DOMSecurityPolicy::allowsConnectionTo(const String& url) const
-{
-    return isAllowedWithURL<&ContentSecurityPolicy::allowConnectToSource>(scriptExecutionContext(), url);
-}
-
-bool DOMSecurityPolicy::allowsFontFrom(const String& url) const
-{
-    return isAllowedWithURL<&ContentSecurityPolicy::allowFontFromSource>(scriptExecutionContext(), url);
-}
-
-bool DOMSecurityPolicy::allowsFormAction(const String& url) const
-{
-    return isAllowedWithURL<&ContentSecurityPolicy::allowFormAction>(scriptExecutionContext(), url);
-}
-
-bool DOMSecurityPolicy::allowsFrameFrom(const String& url) const
-{
-    return isAllowedWithURL<&ContentSecurityPolicy::allowChildFrameFromSource>(scriptExecutionContext(), url);
-}
-
-bool DOMSecurityPolicy::allowsImageFrom(const String& url) const
-{
-    return isAllowedWithURL<&ContentSecurityPolicy::allowImageFromSource>(scriptExecutionContext(), url);
-}
-
-bool DOMSecurityPolicy::allowsMediaFrom(const String& url) const
-{
-    return isAllowedWithURL<&ContentSecurityPolicy::allowMediaFromSource>(scriptExecutionContext(), url);
-}
-
-bool DOMSecurityPolicy::allowsObjectFrom(const String& url) const
-{
-    return isAllowedWithURL<&ContentSecurityPolicy::allowObjectFromSource>(scriptExecutionContext(), url);
-}
-
-bool DOMSecurityPolicy::allowsPluginType(const String& type) const
-{
-    return isAllowedWithType<&ContentSecurityPolicy::allowPluginType>(scriptExecutionContext(), type);
-}
-
-bool DOMSecurityPolicy::allowsScriptFrom(const String& url) const
-{
-    return isAllowedWithURL<&ContentSecurityPolicy::allowScriptFromSource>(scriptExecutionContext(), url);
-}
-
-bool DOMSecurityPolicy::allowsStyleFrom(const String& url) const
-{
-    return isAllowedWithURL<&ContentSecurityPolicy::allowStyleFromSource>(scriptExecutionContext(), url);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/DOMSecurityPolicy.h b/Source/core/page/DOMSecurityPolicy.h
deleted file mode 100644
index 6cb8a80..0000000
--- a/Source/core/page/DOMSecurityPolicy.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2011 Google, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GOOGLE 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,
- * 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 DOMSecurityPolicy_h
-#define DOMSecurityPolicy_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/ContextLifecycleObserver.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class ContentSecurityPolicy;
-class DOMStringList;
-class Frame;
-
-class DOMSecurityPolicy : public RefCounted<DOMSecurityPolicy>, public ScriptWrappable, public ContextLifecycleObserver {
-public:
-    static PassRefPtr<DOMSecurityPolicy> create(ScriptExecutionContext* context)
-    {
-        return adoptRef(new DOMSecurityPolicy(context));
-    }
-    ~DOMSecurityPolicy();
-
-    bool isActive() const;
-    PassRefPtr<DOMStringList> reportURIs() const;
-
-    bool allowsInlineScript() const;
-    bool allowsInlineStyle() const;
-    bool allowsEval() const;
-
-    bool allowsConnectionTo(const String& url) const;
-    bool allowsFontFrom(const String& url) const;
-    bool allowsFormAction(const String& url) const;
-    bool allowsFrameFrom(const String& url) const;
-    bool allowsImageFrom(const String& url) const;
-    bool allowsMediaFrom(const String& url) const;
-    bool allowsObjectFrom(const String& url) const;
-    bool allowsPluginType(const String& type) const;
-    bool allowsScriptFrom(const String& url) const;
-    bool allowsStyleFrom(const String& url) const;
-
-private:
-    explicit DOMSecurityPolicy(ScriptExecutionContext*);
-};
-
-}
-
-#endif
diff --git a/Source/core/page/DOMSelection.cpp b/Source/core/page/DOMSelection.cpp
index a9fd1ad..fbba561 100644
--- a/Source/core/page/DOMSelection.cpp
+++ b/Source/core/page/DOMSelection.cpp
@@ -42,7 +42,7 @@
 #include "core/editing/FrameSelection.h"
 #include "core/editing/TextIterator.h"
 #include "core/editing/htmlediting.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
@@ -465,7 +465,7 @@
 
     FrameSelection& selection = m_frame->selection();
 
-    if (!n || m_frame->document() != &n->document() || selection.isNone())
+    if (!n || m_frame->document() != n->document() || selection.isNone())
         return false;
 
     unsigned nodeIndex = n->nodeIndex();
@@ -547,7 +547,7 @@
     ASSERT(m_frame);
     if (!node)
         return true;
-    return &node->document() == m_frame->document();
+    return node->document() == m_frame->document();
 }
 
 } // namespace WebCore
diff --git a/Source/core/page/DOMSelection.h b/Source/core/page/DOMSelection.h
index 16d48f1..0b4adfe 100644
--- a/Source/core/page/DOMSelection.h
+++ b/Source/core/page/DOMSelection.h
@@ -32,7 +32,7 @@
 #define DOMSelection_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/page/DOMWindowProperty.h"
+#include "core/frame/DOMWindowProperty.h"
 #include "wtf/Forward.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
diff --git a/Source/core/page/DOMTimer.cpp b/Source/core/page/DOMTimer.cpp
deleted file mode 100644
index 16210e5..0000000
--- a/Source/core/page/DOMTimer.cpp
+++ /dev/null
@@ -1,201 +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 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,
- * 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/page/DOMTimer.h"
-
-#include "bindings/v8/ScheduledAction.h"
-#include "core/dom/ScriptExecutionContext.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "wtf/CurrentTime.h"
-
-using namespace std;
-
-namespace WebCore {
-
-static const int maxIntervalForUserGestureForwarding = 1000; // One second matches Gecko.
-static const int maxTimerNestingLevel = 5;
-static const double oneMillisecond = 0.001;
-// Chromium uses a minimum timer interval of 4ms. We'd like to go
-// lower; however, there are poorly coded websites out there which do
-// create CPU-spinning loops.  Using 4ms prevents the CPU from
-// spinning too busily and provides a balance between CPU spinning and
-// the smallest possible interval timer.
-static const double minimumInterval = 0.004;
-
-static int timerNestingLevel = 0;
-
-static inline bool shouldForwardUserGesture(int interval, int nestingLevel)
-{
-    return UserGestureIndicator::processingUserGesture()
-        && interval <= maxIntervalForUserGestureForwarding
-        && nestingLevel == 1; // Gestures should not be forwarded to nested timers.
-}
-
-double DOMTimer::hiddenPageAlignmentInterval()
-{
-    // Timers on hidden pages are aligned so that they fire once per
-    // second at most.
-    return 1.0;
-}
-
-double DOMTimer::visiblePageAlignmentInterval()
-{
-    // Alignment does not apply to timers on visible pages.
-    return 0;
-}
-
-int DOMTimer::install(ScriptExecutionContext* context, PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot)
-{
-    int timeoutID = context->installNewTimeout(action, timeout, singleShot);
-    InspectorInstrumentation::didInstallTimer(context, timeoutID, timeout, singleShot);
-    return timeoutID;
-}
-
-void DOMTimer::removeByID(ScriptExecutionContext* context, int timeoutID)
-{
-    context->removeTimeoutByID(timeoutID);
-    InspectorInstrumentation::didRemoveTimer(context, timeoutID);
-}
-
-DOMTimer::DOMTimer(ScriptExecutionContext* context, PassOwnPtr<ScheduledAction> action, int interval, bool singleShot, int timeoutID)
-    : SuspendableTimer(context)
-    , m_timeoutID(timeoutID)
-    , m_nestingLevel(timerNestingLevel + 1)
-    , m_action(action)
-{
-    ASSERT(timeoutID > 0);
-    if (shouldForwardUserGesture(interval, m_nestingLevel))
-        m_userGestureToken = UserGestureIndicator::currentToken();
-
-    double intervalMilliseconds = max(oneMillisecond, interval * oneMillisecond);
-    if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNestingLevel)
-        intervalMilliseconds = minimumInterval;
-    if (singleShot)
-        startOneShot(intervalMilliseconds);
-    else
-        startRepeating(intervalMilliseconds);
-}
-
-DOMTimer::~DOMTimer()
-{
-}
-
-int DOMTimer::timeoutID() const
-{
-    return m_timeoutID;
-}
-
-void DOMTimer::fired()
-{
-    ScriptExecutionContext* context = scriptExecutionContext();
-    timerNestingLevel = m_nestingLevel;
-    ASSERT(!context->activeDOMObjectsAreSuspended());
-    // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator.
-    UserGestureIndicator gestureIndicator(m_userGestureToken.release());
-
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID);
-
-    // Simple case for non-one-shot timers.
-    if (isActive()) {
-        if (repeatInterval() && repeatInterval() < minimumInterval) {
-            m_nestingLevel++;
-            if (m_nestingLevel >= maxTimerNestingLevel)
-                augmentRepeatInterval(minimumInterval - repeatInterval());
-        }
-
-        // No access to member variables after this point, it can delete the timer.
-        m_action->execute(context);
-
-        InspectorInstrumentation::didFireTimer(cookie);
-
-        return;
-    }
-
-    // Delete timer before executing the action for one-shot timers.
-    OwnPtr<ScheduledAction> action = m_action.release();
-
-    // This timer is being deleted; no access to member variables allowed after this point.
-    context->removeTimeoutByID(m_timeoutID);
-
-    action->execute(context);
-
-    InspectorInstrumentation::didFireTimer(cookie);
-
-    timerNestingLevel = 0;
-}
-
-void DOMTimer::contextDestroyed()
-{
-    SuspendableTimer::contextDestroyed();
-}
-
-void DOMTimer::stop()
-{
-    SuspendableTimer::stop();
-    // Need to release JS objects potentially protected by ScheduledAction
-    // because they can form circular references back to the ScriptExecutionContext
-    // which will cause a memory leak.
-    m_action.clear();
-}
-
-double DOMTimer::alignedFireTime(double fireTime) const
-{
-    double alignmentInterval = scriptExecutionContext()->timerAlignmentInterval();
-    if (alignmentInterval) {
-        double currentTime = monotonicallyIncreasingTime();
-        if (fireTime <= currentTime)
-            return fireTime;
-
-        // When a repeating timer is scheduled for exactly the
-        // background page alignment interval, because it's impossible
-        // for the timer to be rescheduled instantaneously, it misses
-        // every other fire time. Avoid this by looking at the next
-        // fire time rounded both down and up.
-
-        double alignedTimeRoundedDown = floor(fireTime / alignmentInterval) * alignmentInterval;
-        double alignedTimeRoundedUp = ceil(fireTime / alignmentInterval) * alignmentInterval;
-
-        // If the version rounded down is in the past, discard it
-        // immediately.
-
-        if (alignedTimeRoundedDown <= currentTime)
-            return alignedTimeRoundedUp;
-
-        // Only use the rounded-down time if it's within a certain
-        // tolerance of the fire time. This avoids speeding up timers
-        // on background pages in the common case.
-
-        if (fireTime - alignedTimeRoundedDown < minimumInterval)
-            return alignedTimeRoundedDown;
-
-        return alignedTimeRoundedUp;
-    }
-
-    return fireTime;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/DOMTimer.h b/Source/core/page/DOMTimer.h
deleted file mode 100644
index 9324899..0000000
--- a/Source/core/page/DOMTimer.h
+++ /dev/null
@@ -1,82 +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 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,
- * 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 DOMTimer_h
-#define DOMTimer_h
-
-#include "bindings/v8/ScheduledAction.h"
-#include "core/dom/UserGestureIndicator.h"
-#include "core/page/SuspendableTimer.h"
-#include "wtf/Compiler.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebCore {
-
-class ScriptExecutionContext;
-
-class DOMTimer : public SuspendableTimer {
-public:
-    // Creates a new timer owned by the ScriptExecutionContext, starts it and returns its ID.
-    static int install(ScriptExecutionContext*, PassOwnPtr<ScheduledAction>, int timeout, bool singleShot);
-    static void removeByID(ScriptExecutionContext*, int timeoutID);
-
-    virtual ~DOMTimer();
-
-    int timeoutID() const;
-
-    // ActiveDOMObject
-    virtual void contextDestroyed() OVERRIDE;
-    virtual void stop() OVERRIDE;
-
-    // The following are essentially constants. All intervals are in seconds.
-    static double hiddenPageAlignmentInterval();
-    static double visiblePageAlignmentInterval();
-
-private:
-    friend class ScriptExecutionContext; // For create().
-
-    // Should only be used by ScriptExecutionContext.
-    static PassOwnPtr<DOMTimer> create(ScriptExecutionContext* context, PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot, int timeoutID)
-    {
-        return adoptPtr(new DOMTimer(context, action, timeout, singleShot, timeoutID));
-    }
-
-    DOMTimer(ScriptExecutionContext*, PassOwnPtr<ScheduledAction>, int interval, bool singleShot, int timeoutID);
-    virtual void fired();
-
-    // Retuns timer fire time rounded to the next multiple of timer alignment interval.
-    virtual double alignedFireTime(double) const;
-
-    int m_timeoutID;
-    int m_nestingLevel;
-    OwnPtr<ScheduledAction> m_action;
-    RefPtr<UserGestureToken> m_userGestureToken;
-};
-
-} // namespace WebCore
-
-#endif // DOMTimer_h
diff --git a/Source/core/page/DOMWindow.cpp b/Source/core/page/DOMWindow.cpp
deleted file mode 100644
index ed404f2..0000000
--- a/Source/core/page/DOMWindow.cpp
+++ /dev/null
@@ -1,1761 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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,
- * 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/page/DOMWindow.h"
-
-#include "wtf/MainThread.h"
-#include "wtf/MathExtras.h"
-#include "wtf/text/WTFString.h"
-#include <algorithm>
-#include "RuntimeEnabledFeatures.h"
-#include "bindings/v8/ExceptionState.h"
-#include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "bindings/v8/ScriptCallStackFactory.h"
-#include "bindings/v8/ScriptController.h"
-#include "bindings/v8/SerializedScriptValue.h"
-#include "core/css/CSSComputedStyleDeclaration.h"
-#include "core/css/CSSRuleList.h"
-#include "core/css/DOMWindowCSS.h"
-#include "core/css/MediaQueryList.h"
-#include "core/css/MediaQueryMatcher.h"
-#include "core/css/StyleMedia.h"
-#include "core/css/resolver/StyleResolver.h"
-#include "core/dom/DeviceOrientationController.h"
-#include "core/dom/Document.h"
-#include "core/dom/Element.h"
-#include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/events/MessageEvent.h"
-#include "core/events/PageTransitionEvent.h"
-#include "core/dom/RequestAnimationFrameCallback.h"
-#include "core/dom/ScriptExecutionContext.h"
-#include "core/dom/TouchController.h"
-#include "core/editing/Editor.h"
-#include "core/history/BackForwardController.h"
-#include "core/html/HTMLFrameOwnerElement.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/inspector/ScriptCallStack.h"
-#include "core/loader/DocumentLoader.h"
-#include "core/loader/FrameLoadRequest.h"
-#include "core/loader/FrameLoader.h"
-#include "core/loader/FrameLoaderClient.h"
-#include "core/loader/appcache/ApplicationCache.h"
-#include "core/page/BarProp.h"
-#include "core/page/Chrome.h"
-#include "core/page/ChromeClient.h"
-#include "core/page/Console.h"
-#include "core/page/CreateWindow.h"
-#include "core/page/DOMPoint.h"
-#include "core/page/DOMWindowLifecycleNotifier.h"
-#include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
-#include "core/page/History.h"
-#include "core/page/Location.h"
-#include "core/page/Navigator.h"
-#include "core/page/Page.h"
-#include "core/page/PageConsole.h"
-#include "core/page/PageGroup.h"
-#include "core/page/Performance.h"
-#include "core/page/Screen.h"
-#include "core/page/Settings.h"
-#include "core/page/WindowFeatures.h"
-#include "core/page/WindowFocusAllowedIndicator.h"
-#include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/platform/PlatformScreen.h"
-#include "core/platform/SuddenTermination.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/MediaPlayer.h"
-#include "core/storage/Storage.h"
-#include "core/storage/StorageArea.h"
-#include "core/storage/StorageNamespace.h"
-#include "weborigin/KURL.h"
-#include "weborigin/SecurityOrigin.h"
-#include "weborigin/SecurityPolicy.h"
-
-using std::min;
-using std::max;
-
-namespace WebCore {
-
-class PostMessageTimer : public TimerBase {
-public:
-    PostMessageTimer(DOMWindow* window, PassRefPtr<SerializedScriptValue> message, const String& sourceOrigin, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, PassRefPtr<ScriptCallStack> stackTrace)
-        : m_window(window)
-        , m_message(message)
-        , m_origin(sourceOrigin)
-        , m_source(source)
-        , m_channels(channels)
-        , m_targetOrigin(targetOrigin)
-        , m_stackTrace(stackTrace)
-    {
-    }
-
-    PassRefPtr<MessageEvent> event(ScriptExecutionContext* context)
-    {
-        OwnPtr<MessagePortArray> messagePorts = MessagePort::entanglePorts(*context, m_channels.release());
-        return MessageEvent::create(messagePorts.release(), m_message, m_origin, String(), m_source);
-    }
-    SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); }
-    ScriptCallStack* stackTrace() const { return m_stackTrace.get(); }
-
-private:
-    virtual void fired()
-    {
-        m_window->postMessageTimerFired(adoptPtr(this));
-        // This object is deleted now.
-    }
-
-    RefPtr<DOMWindow> m_window;
-    RefPtr<SerializedScriptValue> m_message;
-    String m_origin;
-    RefPtr<DOMWindow> m_source;
-    OwnPtr<MessagePortChannelArray> m_channels;
-    RefPtr<SecurityOrigin> m_targetOrigin;
-    RefPtr<ScriptCallStack> m_stackTrace;
-};
-
-typedef HashCountedSet<DOMWindow*> DOMWindowSet;
-
-static DOMWindowSet& windowsWithUnloadEventListeners()
-{
-    DEFINE_STATIC_LOCAL(DOMWindowSet, windowsWithUnloadEventListeners, ());
-    return windowsWithUnloadEventListeners;
-}
-
-static DOMWindowSet& windowsWithBeforeUnloadEventListeners()
-{
-    DEFINE_STATIC_LOCAL(DOMWindowSet, windowsWithBeforeUnloadEventListeners, ());
-    return windowsWithBeforeUnloadEventListeners;
-}
-
-static void addUnloadEventListener(DOMWindow* domWindow)
-{
-    DOMWindowSet& set = windowsWithUnloadEventListeners();
-    if (set.isEmpty())
-        disableSuddenTermination();
-    set.add(domWindow);
-}
-
-static void removeUnloadEventListener(DOMWindow* domWindow)
-{
-    DOMWindowSet& set = windowsWithUnloadEventListeners();
-    DOMWindowSet::iterator it = set.find(domWindow);
-    if (it == set.end())
-        return;
-    set.remove(it);
-    if (set.isEmpty())
-        enableSuddenTermination();
-}
-
-static void removeAllUnloadEventListeners(DOMWindow* domWindow)
-{
-    DOMWindowSet& set = windowsWithUnloadEventListeners();
-    DOMWindowSet::iterator it = set.find(domWindow);
-    if (it == set.end())
-        return;
-    set.removeAll(it);
-    if (set.isEmpty())
-        enableSuddenTermination();
-}
-
-static void addBeforeUnloadEventListener(DOMWindow* domWindow)
-{
-    DOMWindowSet& set = windowsWithBeforeUnloadEventListeners();
-    if (set.isEmpty())
-        disableSuddenTermination();
-    set.add(domWindow);
-}
-
-static void removeBeforeUnloadEventListener(DOMWindow* domWindow)
-{
-    DOMWindowSet& set = windowsWithBeforeUnloadEventListeners();
-    DOMWindowSet::iterator it = set.find(domWindow);
-    if (it == set.end())
-        return;
-    set.remove(it);
-    if (set.isEmpty())
-        enableSuddenTermination();
-}
-
-static void removeAllBeforeUnloadEventListeners(DOMWindow* domWindow)
-{
-    DOMWindowSet& set = windowsWithBeforeUnloadEventListeners();
-    DOMWindowSet::iterator it = set.find(domWindow);
-    if (it == set.end())
-        return;
-    set.removeAll(it);
-    if (set.isEmpty())
-        enableSuddenTermination();
-}
-
-static bool allowsBeforeUnloadListeners(DOMWindow* window)
-{
-    ASSERT_ARG(window, window);
-    Frame* frame = window->frame();
-    if (!frame)
-        return false;
-    Page* page = frame->page();
-    if (!page)
-        return false;
-    return frame == page->mainFrame();
-}
-
-unsigned DOMWindow::pendingUnloadEventListeners() const
-{
-    return windowsWithUnloadEventListeners().count(const_cast<DOMWindow*>(this));
-}
-
-// This function:
-// 1) Validates the pending changes are not changing any value to NaN; in that case keep original value.
-// 2) Constrains the window rect to the minimum window size and no bigger than the float rect's dimensions.
-// 3) Constrains the window rect to within the top and left boundaries of the available screen rect.
-// 4) Constrains the window rect to within the bottom and right boundaries of the available screen rect.
-// 5) Translate the window rect coordinates to be within the coordinate space of the screen.
-FloatRect DOMWindow::adjustWindowRect(Page* page, const FloatRect& pendingChanges)
-{
-    ASSERT(page);
-
-    FloatRect screen = screenAvailableRect(page->mainFrame()->view());
-    FloatRect window = page->chrome().windowRect();
-
-    // Make sure we're in a valid state before adjusting dimensions.
-    ASSERT(std::isfinite(screen.x()));
-    ASSERT(std::isfinite(screen.y()));
-    ASSERT(std::isfinite(screen.width()));
-    ASSERT(std::isfinite(screen.height()));
-    ASSERT(std::isfinite(window.x()));
-    ASSERT(std::isfinite(window.y()));
-    ASSERT(std::isfinite(window.width()));
-    ASSERT(std::isfinite(window.height()));
-
-    // Update window values if new requested values are not NaN.
-    if (!std::isnan(pendingChanges.x()))
-        window.setX(pendingChanges.x());
-    if (!std::isnan(pendingChanges.y()))
-        window.setY(pendingChanges.y());
-    if (!std::isnan(pendingChanges.width()))
-        window.setWidth(pendingChanges.width());
-    if (!std::isnan(pendingChanges.height()))
-        window.setHeight(pendingChanges.height());
-
-    FloatSize minimumSize = page->chrome().client().minimumWindowSize();
-    // Let size 0 pass through, since that indicates default size, not minimum size.
-    if (window.width())
-        window.setWidth(min(max(minimumSize.width(), window.width()), screen.width()));
-    if (window.height())
-        window.setHeight(min(max(minimumSize.height(), window.height()), screen.height()));
-
-    // Constrain the window position within the valid screen area.
-    window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width())));
-    window.setY(max(screen.y(), min(window.y(), screen.maxY() - window.height())));
-
-    return window;
-}
-
-bool DOMWindow::allowPopUp(Frame* firstFrame)
-{
-    ASSERT(firstFrame);
-
-    if (ScriptController::processingUserGesture())
-        return true;
-
-    Settings* settings = firstFrame->settings();
-    return settings && settings->javaScriptCanOpenWindowsAutomatically();
-}
-
-bool DOMWindow::allowPopUp()
-{
-    return m_frame && allowPopUp(m_frame);
-}
-
-bool DOMWindow::canShowModalDialog(const Frame* frame)
-{
-    if (!frame)
-        return false;
-    Page* page = frame->page();
-    if (!page)
-        return false;
-    return page->chrome().canRunModal();
-}
-
-bool DOMWindow::canShowModalDialogNow(const Frame* frame)
-{
-    if (!frame)
-        return false;
-    Page* page = frame->page();
-    if (!page)
-        return false;
-    return page->chrome().canRunModalNow();
-}
-
-DOMWindow::DOMWindow(Frame* frame)
-    : FrameDestructionObserver(frame)
-    , m_shouldPrintWhenFinishedLoading(false)
-{
-    ASSERT(frame);
-    ScriptWrappable::init(this);
-}
-
-void DOMWindow::setDocument(PassRefPtr<Document> document)
-{
-    ASSERT(!document || document->frame() == m_frame);
-    if (m_document) {
-        if (m_document->attached()) {
-            // FIXME: We don't call willRemove here. Why is that OK?
-            // This detach() call is also mostly redundant. Most of the calls to
-            // this function come via DocumentLoader::createWriterFor, which
-            // always detaches the previous Document first. Only XSLTProcessor
-            // depends on this detach() call, so it seems like there's some room
-            // for cleanup.
-            m_document->detach();
-        }
-        m_document->setDOMWindow(0);
-    }
-
-    m_document = document;
-
-    if (!m_document)
-        return;
-
-    m_document->setDOMWindow(this);
-    if (!m_document->attached())
-        m_document->attach();
-
-    if (!m_frame)
-        return;
-
-    m_frame->script()->updateDocument();
-    m_document->updateViewportArguments();
-
-    if (m_frame->page() && m_frame->view()) {
-        if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scrollingCoordinator()) {
-            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame->view(), HorizontalScrollbar);
-            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame->view(), VerticalScrollbar);
-            scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_frame->view());
-        }
-    }
-
-    m_frame->selection().updateSecureKeyboardEntryIfActive();
-
-    if (m_frame->page() && m_frame->page()->mainFrame() == m_frame) {
-        m_frame->page()->mainFrame()->notifyChromeClientWheelEventHandlerCountChanged();
-        if (TouchController::from(m_document.get())->hasTouchEventHandlers())
-            m_frame->page()->chrome().client().needTouchEvents(true);
-    }
-}
-
-DOMWindow::~DOMWindow()
-{
-    ASSERT(!m_screen);
-    ASSERT(!m_history);
-    ASSERT(!m_locationbar);
-    ASSERT(!m_menubar);
-    ASSERT(!m_personalbar);
-    ASSERT(!m_scrollbars);
-    ASSERT(!m_statusbar);
-    ASSERT(!m_toolbar);
-    ASSERT(!m_console);
-    ASSERT(!m_navigator);
-    ASSERT(!m_performance);
-    ASSERT(!m_location);
-    ASSERT(!m_media);
-    ASSERT(!m_sessionStorage);
-    ASSERT(!m_localStorage);
-    ASSERT(!m_applicationCache);
-
-    reset();
-
-    removeAllEventListeners();
-
-    ASSERT(!m_document->attached());
-    setDocument(0);
-}
-
-const AtomicString& DOMWindow::interfaceName() const
-{
-    return eventNames().interfaceForDOMWindow;
-}
-
-ScriptExecutionContext* DOMWindow::scriptExecutionContext() const
-{
-    return m_document.get();
-}
-
-DOMWindow* DOMWindow::toDOMWindow()
-{
-    return this;
-}
-
-PassRefPtr<MediaQueryList> DOMWindow::matchMedia(const String& media)
-{
-    return document() ? document()->mediaQueryMatcher()->matchMedia(media) : 0;
-}
-
-Page* DOMWindow::page()
-{
-    return frame() ? frame()->page() : 0;
-}
-
-void DOMWindow::frameDestroyed()
-{
-    FrameDestructionObserver::frameDestroyed();
-    reset();
-}
-
-void DOMWindow::willDetachPage()
-{
-    InspectorInstrumentation::frameWindowDiscarded(m_frame, this);
-    // FIXME: Once DeviceOrientationController is a ScriptExecutionContext
-    // Supplement, this will no longer be needed.
-    if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
-        controller->removeAllDeviceEventListeners(this);
-}
-
-void DOMWindow::willDestroyDocumentInFrame()
-{
-    // It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
-    // unregister themselves from the DOMWindow as a result of the call to willDestroyGlobalObjectInFrame.
-    Vector<DOMWindowProperty*> properties;
-    copyToVector(m_properties, properties);
-    for (size_t i = 0; i < properties.size(); ++i)
-        properties[i]->willDestroyGlobalObjectInFrame();
-}
-
-void DOMWindow::willDetachDocumentFromFrame()
-{
-    // It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
-    // unregister themselves from the DOMWindow as a result of the call to willDetachGlobalObjectFromFrame.
-    Vector<DOMWindowProperty*> properties;
-    copyToVector(m_properties, properties);
-    for (size_t i = 0; i < properties.size(); ++i)
-        properties[i]->willDetachGlobalObjectFromFrame();
-}
-
-void DOMWindow::registerProperty(DOMWindowProperty* property)
-{
-    m_properties.add(property);
-}
-
-void DOMWindow::unregisterProperty(DOMWindowProperty* property)
-{
-    m_properties.remove(property);
-}
-
-void DOMWindow::reset()
-{
-    willDestroyDocumentInFrame();
-    resetDOMWindowProperties();
-}
-
-void DOMWindow::resetDOMWindowProperties()
-{
-    m_properties.clear();
-
-    m_screen = 0;
-    m_history = 0;
-    m_locationbar = 0;
-    m_menubar = 0;
-    m_personalbar = 0;
-    m_scrollbars = 0;
-    m_statusbar = 0;
-    m_toolbar = 0;
-    m_console = 0;
-    m_navigator = 0;
-    m_performance = 0;
-    m_location = 0;
-    m_media = 0;
-    m_sessionStorage = 0;
-    m_localStorage = 0;
-    m_applicationCache = 0;
-}
-
-bool DOMWindow::isCurrentlyDisplayedInFrame() const
-{
-    return m_frame && m_frame->domWindow() == this;
-}
-
-#if ENABLE(ORIENTATION_EVENTS)
-int DOMWindow::orientation() const
-{
-    if (!m_frame)
-        return 0;
-
-    return m_frame->orientation();
-}
-#endif
-
-Screen* DOMWindow::screen() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_screen)
-        m_screen = Screen::create(m_frame);
-    return m_screen.get();
-}
-
-History* DOMWindow::history() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_history)
-        m_history = History::create(m_frame);
-    return m_history.get();
-}
-
-BarProp* DOMWindow::locationbar() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_locationbar)
-        m_locationbar = BarProp::create(m_frame, BarProp::Locationbar);
-    return m_locationbar.get();
-}
-
-BarProp* DOMWindow::menubar() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_menubar)
-        m_menubar = BarProp::create(m_frame, BarProp::Menubar);
-    return m_menubar.get();
-}
-
-BarProp* DOMWindow::personalbar() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_personalbar)
-        m_personalbar = BarProp::create(m_frame, BarProp::Personalbar);
-    return m_personalbar.get();
-}
-
-BarProp* DOMWindow::scrollbars() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_scrollbars)
-        m_scrollbars = BarProp::create(m_frame, BarProp::Scrollbars);
-    return m_scrollbars.get();
-}
-
-BarProp* DOMWindow::statusbar() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_statusbar)
-        m_statusbar = BarProp::create(m_frame, BarProp::Statusbar);
-    return m_statusbar.get();
-}
-
-BarProp* DOMWindow::toolbar() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_toolbar)
-        m_toolbar = BarProp::create(m_frame, BarProp::Toolbar);
-    return m_toolbar.get();
-}
-
-Console* DOMWindow::console() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_console)
-        m_console = Console::create(m_frame);
-    return m_console.get();
-}
-
-PageConsole* DOMWindow::pageConsole() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    return m_frame->page() ? &m_frame->page()->console() : 0;
-}
-
-ApplicationCache* DOMWindow::applicationCache() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_applicationCache)
-        m_applicationCache = ApplicationCache::create(m_frame);
-    return m_applicationCache.get();
-}
-
-Navigator* DOMWindow::navigator() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_navigator)
-        m_navigator = Navigator::create(m_frame);
-    return m_navigator.get();
-}
-
-Performance* DOMWindow::performance() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_performance)
-        m_performance = Performance::create(m_frame);
-    return m_performance.get();
-}
-
-Location* DOMWindow::location() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_location)
-        m_location = Location::create(m_frame);
-    return m_location.get();
-}
-
-Storage* DOMWindow::sessionStorage(ExceptionState& es) const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-
-    Document* document = this->document();
-    if (!document)
-        return 0;
-
-    String accessDeniedMessage = "Access to 'sessionStorage' is denied for this document.";
-    if (!document->securityOrigin()->canAccessLocalStorage()) {
-        if (document->isSandboxed(SandboxOrigin))
-            es.throwSecurityError(accessDeniedMessage + " The document is sandboxed and lacks the 'allow-same-origin' flag.");
-        else if (document->url().protocolIs("data"))
-            es.throwSecurityError(accessDeniedMessage + " Storage is disabled inside 'data:' URLs.");
-        else
-            es.throwSecurityError(accessDeniedMessage);
-        return 0;
-    }
-
-    if (m_sessionStorage) {
-        if (!m_sessionStorage->area()->canAccessStorage(m_frame)) {
-            es.throwSecurityError(accessDeniedMessage);
-            return 0;
-        }
-        return m_sessionStorage.get();
-    }
-
-    Page* page = document->page();
-    if (!page)
-        return 0;
-
-    OwnPtr<StorageArea> storageArea = page->sessionStorage()->storageArea(document->securityOrigin());
-    if (!storageArea->canAccessStorage(m_frame)) {
-        es.throwSecurityError(accessDeniedMessage);
-        return 0;
-    }
-
-    m_sessionStorage = Storage::create(m_frame, storageArea.release());
-    return m_sessionStorage.get();
-}
-
-Storage* DOMWindow::localStorage(ExceptionState& es) const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-
-    Document* document = this->document();
-    if (!document)
-        return 0;
-
-    String accessDeniedMessage = "Access to 'localStorage' is denied for this document.";
-    if (!document->securityOrigin()->canAccessLocalStorage()) {
-        if (document->isSandboxed(SandboxOrigin))
-            es.throwSecurityError(accessDeniedMessage + " The document is sandboxed and lacks the 'allow-same-origin' flag.");
-        else if (document->url().protocolIs("data"))
-            es.throwSecurityError(accessDeniedMessage + " Storage is disabled inside 'data:' URLs.");
-        else
-            es.throwSecurityError(accessDeniedMessage);
-        return 0;
-    }
-
-    if (m_localStorage) {
-        if (!m_localStorage->area()->canAccessStorage(m_frame)) {
-            es.throwSecurityError(accessDeniedMessage);
-            return 0;
-        }
-        return m_localStorage.get();
-    }
-
-    Page* page = document->page();
-    if (!page)
-        return 0;
-
-    if (!page->settings().localStorageEnabled())
-        return 0;
-
-    OwnPtr<StorageArea> storageArea = StorageNamespace::localStorageArea(document->securityOrigin());
-    if (!storageArea->canAccessStorage(m_frame)) {
-        es.throwSecurityError(accessDeniedMessage);
-        return 0;
-    }
-
-    m_localStorage = Storage::create(m_frame, storageArea.release());
-    return m_localStorage.get();
-}
-
-void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, const String& targetOrigin, DOMWindow* source, ExceptionState& es)
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return;
-
-    Document* sourceDocument = source->document();
-
-    // Compute the target origin.  We need to do this synchronously in order
-    // to generate the SyntaxError exception correctly.
-    RefPtr<SecurityOrigin> target;
-    if (targetOrigin == "/") {
-        if (!sourceDocument)
-            return;
-        target = sourceDocument->securityOrigin();
-    } else if (targetOrigin != "*") {
-        target = SecurityOrigin::createFromString(targetOrigin);
-        // It doesn't make sense target a postMessage at a unique origin
-        // because there's no way to represent a unique origin in a string.
-        if (target->isUnique()) {
-            es.throwDOMException(SyntaxError, "Invalid target origin '" + targetOrigin + "' in a call to 'postMessage'.");
-            return;
-        }
-    }
-
-    OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(ports, es);
-    if (es.hadException())
-        return;
-
-    // Capture the source of the message.  We need to do this synchronously
-    // in order to capture the source of the message correctly.
-    if (!sourceDocument)
-        return;
-    String sourceOrigin = sourceDocument->securityOrigin()->toString();
-
-    // Capture stack trace only when inspector front-end is loaded as it may be time consuming.
-    RefPtr<ScriptCallStack> stackTrace;
-    if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument))
-        stackTrace = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
-
-    // Schedule the message.
-    PostMessageTimer* timer = new PostMessageTimer(this, message, sourceOrigin, source, channels.release(), target.get(), stackTrace.release());
-    timer->startOneShot(0);
-}
-
-void DOMWindow::postMessageTimerFired(PassOwnPtr<PostMessageTimer> t)
-{
-    OwnPtr<PostMessageTimer> timer(t);
-
-    if (!document() || !isCurrentlyDisplayedInFrame())
-        return;
-
-    RefPtr<MessageEvent> event = timer->event(document());
-
-    // Give the embedder a chance to intercept this postMessage because this
-    // DOMWindow might be a proxy for another in browsers that support
-    // postMessage calls across WebKit instances.
-    if (m_frame->loader()->client()->willCheckAndDispatchMessageEvent(timer->targetOrigin(), event.get()))
-        return;
-
-    dispatchMessageEventWithOriginCheck(timer->targetOrigin(), event, timer->stackTrace());
-}
-
-void DOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, PassRefPtr<Event> event, PassRefPtr<ScriptCallStack> stackTrace)
-{
-    if (intendedTargetOrigin) {
-        // Check target origin now since the target document may have changed since the timer was scheduled.
-        if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrigin())) {
-            String message = "Unable to post message to " + intendedTargetOrigin->toString() +
-                             ". Recipient has origin " + document()->securityOrigin()->toString() + ".\n";
-            pageConsole()->addMessage(SecurityMessageSource, ErrorMessageLevel, message, stackTrace);
-            return;
-        }
-    }
-
-    dispatchEvent(event);
-}
-
-DOMSelection* DOMWindow::getSelection()
-{
-    if (!isCurrentlyDisplayedInFrame() || !m_frame)
-        return 0;
-
-    return m_frame->document()->getSelection();
-}
-
-Element* DOMWindow::frameElement() const
-{
-    if (!m_frame)
-        return 0;
-
-    return m_frame->ownerElement();
-}
-
-void DOMWindow::focus(ScriptExecutionContext* context)
-{
-    if (!m_frame)
-        return;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed();
-    if (context) {
-        ASSERT(isMainThread());
-        Document* activeDocument = toDocument(context);
-        if (opener() && opener() != this && activeDocument->domWindow() == opener())
-            allowFocus = true;
-    }
-
-    // If we're a top level window, bring the window to the front.
-    if (m_frame == page->mainFrame() && allowFocus)
-        page->chrome().focus();
-
-    if (!m_frame)
-        return;
-
-    m_frame->eventHandler()->focusDocumentView();
-}
-
-void DOMWindow::blur()
-{
-}
-
-void DOMWindow::close(ScriptExecutionContext* context)
-{
-    if (!m_frame)
-        return;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    if (m_frame != page->mainFrame())
-        return;
-
-    if (context) {
-        ASSERT(isMainThread());
-        Document* activeDocument = toDocument(context);
-        if (!activeDocument)
-            return;
-
-        if (!activeDocument->canNavigate(m_frame))
-            return;
-    }
-
-    Settings* settings = m_frame->settings();
-    bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseWindows();
-
-    if (!(page->openedByDOM() || page->backForward().count() <= 1 || allowScriptsToCloseWindows))
-        return;
-
-    if (!m_frame->loader()->shouldClose())
-        return;
-
-    page->chrome().closeWindowSoon();
-}
-
-void DOMWindow::print()
-{
-    if (!m_frame)
-        return;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    if (m_frame->loader()->activeDocumentLoader()->isLoading()) {
-        m_shouldPrintWhenFinishedLoading = true;
-        return;
-    }
-    m_shouldPrintWhenFinishedLoading = false;
-    page->chrome().print(m_frame);
-}
-
-void DOMWindow::stop()
-{
-    if (!m_frame)
-        return;
-    m_frame->loader()->stopAllLoaders();
-}
-
-void DOMWindow::alert(const String& message)
-{
-    if (!m_frame)
-        return;
-
-    m_frame->document()->updateStyleIfNeeded();
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    page->chrome().runJavaScriptAlert(m_frame, message);
-}
-
-bool DOMWindow::confirm(const String& message)
-{
-    if (!m_frame)
-        return false;
-
-    m_frame->document()->updateStyleIfNeeded();
-
-    Page* page = m_frame->page();
-    if (!page)
-        return false;
-
-    return page->chrome().runJavaScriptConfirm(m_frame, message);
-}
-
-String DOMWindow::prompt(const String& message, const String& defaultValue)
-{
-    if (!m_frame)
-        return String();
-
-    m_frame->document()->updateStyleIfNeeded();
-
-    Page* page = m_frame->page();
-    if (!page)
-        return String();
-
-    String returnValue;
-    if (page->chrome().runJavaScriptPrompt(m_frame, message, defaultValue, returnValue))
-        return returnValue;
-
-    return String();
-}
-
-bool DOMWindow::find(const String& string, bool caseSensitive, bool backwards, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return false;
-
-    // FIXME (13016): Support wholeWord, searchInFrames and showDialog
-    return m_frame->editor().findString(string, !backwards, caseSensitive, wrap, false);
-}
-
-bool DOMWindow::offscreenBuffering() const
-{
-    return true;
-}
-
-int DOMWindow::outerHeight() const
-{
-    if (!m_frame)
-        return 0;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return 0;
-
-    return static_cast<int>(page->chrome().windowRect().height());
-}
-
-int DOMWindow::outerWidth() const
-{
-    if (!m_frame)
-        return 0;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return 0;
-
-    return static_cast<int>(page->chrome().windowRect().width());
-}
-
-int DOMWindow::innerHeight() const
-{
-    if (!m_frame)
-        return 0;
-
-    FrameView* view = m_frame->view();
-    if (!view)
-        return 0;
-
-    // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer.
-    if (Frame* parent = m_frame->tree()->parent())
-        parent->document()->updateLayoutIgnorePendingStylesheets();
-
-    // If the device height is overridden, do not include the horizontal scrollbar into the innerHeight (since it is absent on the real device).
-    bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenHeightOverride(m_frame);
-    return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRect(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::ExcludeScrollbars).height()));
-}
-
-int DOMWindow::innerWidth() const
-{
-    if (!m_frame)
-        return 0;
-
-    FrameView* view = m_frame->view();
-    if (!view)
-        return 0;
-
-    // FIXME: This is potentially too much work. We really only need to know the dimensions of the parent frame's renderer.
-    if (Frame* parent = m_frame->tree()->parent())
-        parent->document()->updateLayoutIgnorePendingStylesheets();
-
-    // If the device width is overridden, do not include the vertical scrollbar into the innerWidth (since it is absent on the real device).
-    bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(m_frame);
-    return view->mapFromLayoutToCSSUnits(static_cast<int>(view->visibleContentRect(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::ExcludeScrollbars).width()));
-}
-
-int DOMWindow::screenX() const
-{
-    if (!m_frame)
-        return 0;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return 0;
-
-    return static_cast<int>(page->chrome().windowRect().x());
-}
-
-int DOMWindow::screenY() const
-{
-    if (!m_frame)
-        return 0;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return 0;
-
-    return static_cast<int>(page->chrome().windowRect().y());
-}
-
-int DOMWindow::scrollX() const
-{
-    if (!m_frame)
-        return 0;
-
-    FrameView* view = m_frame->view();
-    if (!view)
-        return 0;
-
-    m_frame->document()->updateLayoutIgnorePendingStylesheets();
-
-    return view->mapFromLayoutToCSSUnits(view->scrollX());
-}
-
-int DOMWindow::scrollY() const
-{
-    if (!m_frame)
-        return 0;
-
-    FrameView* view = m_frame->view();
-    if (!view)
-        return 0;
-
-    m_frame->document()->updateLayoutIgnorePendingStylesheets();
-
-    return view->mapFromLayoutToCSSUnits(view->scrollY());
-}
-
-bool DOMWindow::closed() const
-{
-    return !m_frame;
-}
-
-unsigned DOMWindow::length() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-
-    return m_frame->tree()->scopedChildCount();
-}
-
-String DOMWindow::name() const
-{
-    if (!m_frame)
-        return String();
-
-    return m_frame->tree()->name();
-}
-
-void DOMWindow::setName(const String& string)
-{
-    if (!m_frame)
-        return;
-
-    m_frame->tree()->setName(string);
-    m_frame->loader()->client()->didChangeName(string);
-}
-
-void DOMWindow::setStatus(const String& string)
-{
-    m_status = string;
-
-    if (!m_frame)
-        return;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    ASSERT(m_frame->document()); // Client calls shouldn't be made when the frame is in inconsistent state.
-    page->chrome().setStatusbarText(m_frame, m_status);
-}
-
-void DOMWindow::setDefaultStatus(const String& string)
-{
-    m_defaultStatus = string;
-
-    if (!m_frame)
-        return;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    ASSERT(m_frame->document()); // Client calls shouldn't be made when the frame is in inconsistent state.
-    page->chrome().setStatusbarText(m_frame, m_defaultStatus);
-}
-
-DOMWindow* DOMWindow::self() const
-{
-    if (!m_frame)
-        return 0;
-
-    return m_frame->domWindow();
-}
-
-DOMWindow* DOMWindow::opener() const
-{
-    if (!m_frame)
-        return 0;
-
-    Frame* opener = m_frame->loader()->opener();
-    if (!opener)
-        return 0;
-
-    return opener->domWindow();
-}
-
-DOMWindow* DOMWindow::parent() const
-{
-    if (!m_frame)
-        return 0;
-
-    Frame* parent = m_frame->tree()->parent();
-    if (parent)
-        return parent->domWindow();
-
-    return m_frame->domWindow();
-}
-
-DOMWindow* DOMWindow::top() const
-{
-    if (!m_frame)
-        return 0;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return 0;
-
-    return m_frame->tree()->top()->domWindow();
-}
-
-Document* DOMWindow::document() const
-{
-    return m_document.get();
-}
-
-PassRefPtr<StyleMedia> DOMWindow::styleMedia() const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    if (!m_media)
-        m_media = StyleMedia::create(m_frame);
-    return m_media.get();
-}
-
-PassRefPtr<CSSStyleDeclaration> DOMWindow::getComputedStyle(Element* elt, const String& pseudoElt) const
-{
-    if (!elt)
-        return 0;
-
-    return CSSComputedStyleDeclaration::create(elt, false, pseudoElt);
-}
-
-PassRefPtr<CSSRuleList> DOMWindow::getMatchedCSSRules(Element* element, const String& pseudoElement, bool authorOnly) const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-
-    unsigned colonStart = pseudoElement[0] == ':' ? (pseudoElement[1] == ':' ? 2 : 1) : 0;
-    CSSSelector::PseudoType pseudoType = CSSSelector::parsePseudoType(AtomicString(pseudoElement.substring(colonStart)));
-    if (pseudoType == CSSSelector::PseudoUnknown && !pseudoElement.isEmpty())
-        return 0;
-
-    unsigned rulesToInclude = StyleResolver::AuthorCSSRules;
-    if (!authorOnly)
-        rulesToInclude |= StyleResolver::UAAndUserCSSRules;
-
-    PseudoId pseudoId = CSSSelector::pseudoId(pseudoType);
-
-    return m_frame->document()->styleResolver()->pseudoStyleRulesForElement(element, pseudoId, rulesToInclude);
-}
-
-PassRefPtr<DOMPoint> DOMWindow::webkitConvertPointFromNodeToPage(Node* node, const DOMPoint* p) const
-{
-    if (!node || !p)
-        return 0;
-
-    if (!document())
-        return 0;
-
-    document()->updateLayoutIgnorePendingStylesheets();
-
-    FloatPoint pagePoint(p->x(), p->y());
-    pagePoint = node->convertToPage(pagePoint);
-    return DOMPoint::create(pagePoint.x(), pagePoint.y());
-}
-
-PassRefPtr<DOMPoint> DOMWindow::webkitConvertPointFromPageToNode(Node* node, const DOMPoint* p) const
-{
-    if (!node || !p)
-        return 0;
-
-    if (!document())
-        return 0;
-
-    document()->updateLayoutIgnorePendingStylesheets();
-
-    FloatPoint nodePoint(p->x(), p->y());
-    nodePoint = node->convertFromPage(nodePoint);
-    return DOMPoint::create(nodePoint.x(), nodePoint.y());
-}
-
-double DOMWindow::devicePixelRatio() const
-{
-    if (!m_frame)
-        return 0.0;
-
-    return m_frame->devicePixelRatio();
-}
-
-void DOMWindow::scrollBy(int x, int y) const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return;
-
-    document()->updateLayoutIgnorePendingStylesheets();
-
-    FrameView* view = m_frame->view();
-    if (!view)
-        return;
-
-    IntSize scaledOffset(view->mapFromCSSToLayoutUnits(x), view->mapFromCSSToLayoutUnits(y));
-    view->scrollBy(scaledOffset);
-}
-
-void DOMWindow::scrollTo(int x, int y) const
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return;
-
-    document()->updateLayoutIgnorePendingStylesheets();
-
-    RefPtr<FrameView> view = m_frame->view();
-    if (!view)
-        return;
-
-    IntPoint layoutPos(view->mapFromCSSToLayoutUnits(x), view->mapFromCSSToLayoutUnits(y));
-    view->setScrollPosition(layoutPos);
-}
-
-void DOMWindow::moveBy(float x, float y) const
-{
-    if (!m_frame)
-        return;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    if (m_frame != page->mainFrame())
-        return;
-
-    FloatRect fr = page->chrome().windowRect();
-    FloatRect update = fr;
-    update.move(x, y);
-    // Security check (the spec talks about UniversalBrowserWrite to disable this check...)
-    page->chrome().setWindowRect(adjustWindowRect(page, update));
-}
-
-void DOMWindow::moveTo(float x, float y) const
-{
-    if (!m_frame)
-        return;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    if (m_frame != page->mainFrame())
-        return;
-
-    FloatRect fr = page->chrome().windowRect();
-    FloatRect sr = screenAvailableRect(page->mainFrame()->view());
-    fr.setLocation(sr.location());
-    FloatRect update = fr;
-    update.move(x, y);
-    // Security check (the spec talks about UniversalBrowserWrite to disable this check...)
-    page->chrome().setWindowRect(adjustWindowRect(page, update));
-}
-
-void DOMWindow::resizeBy(float x, float y) const
-{
-    if (!m_frame)
-        return;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    if (m_frame != page->mainFrame())
-        return;
-
-    FloatRect fr = page->chrome().windowRect();
-    FloatSize dest = fr.size() + FloatSize(x, y);
-    FloatRect update(fr.location(), dest);
-    page->chrome().setWindowRect(adjustWindowRect(page, update));
-}
-
-void DOMWindow::resizeTo(float width, float height) const
-{
-    if (!m_frame)
-        return;
-
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    if (m_frame != page->mainFrame())
-        return;
-
-    FloatRect fr = page->chrome().windowRect();
-    FloatSize dest = FloatSize(width, height);
-    FloatRect update(fr.location(), dest);
-    page->chrome().setWindowRect(adjustWindowRect(page, update));
-}
-
-int DOMWindow::requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
-{
-    callback->m_useLegacyTimeBase = false;
-    if (Document* d = document())
-        return d->requestAnimationFrame(callback);
-    return 0;
-}
-
-int DOMWindow::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
-{
-    callback->m_useLegacyTimeBase = true;
-    if (Document* d = document())
-        return d->requestAnimationFrame(callback);
-    return 0;
-}
-
-void DOMWindow::cancelAnimationFrame(int id)
-{
-    if (Document* d = document())
-        d->cancelAnimationFrame(id);
-}
-
-DOMWindowCSS* DOMWindow::css()
-{
-    if (!m_css)
-        m_css = DOMWindowCSS::create();
-    return m_css.get();
-}
-
-static void didAddStorageEventListener(DOMWindow* window)
-{
-    // Creating these WebCore::Storage objects informs the system that we'd like to receive
-    // notifications about storage events that might be triggered in other processes. Rather
-    // than subscribe to these notifications explicitly, we subscribe to them implicitly to
-    // simplify the work done by the system.
-    window->localStorage(IGNORE_EXCEPTION);
-    window->sessionStorage(IGNORE_EXCEPTION);
-}
-
-bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture)
-{
-    if (!EventTarget::addEventListener(eventType, listener, useCapture))
-        return false;
-
-    if (Document* document = this->document()) {
-        document->addListenerTypeIfNeeded(eventType);
-        if (eventType == eventNames().storageEvent)
-            didAddStorageEventListener(this);
-    }
-
-    lifecycleNotifier()->notifyAddEventListener(this, eventType);
-
-    if (eventType == eventNames().unloadEvent) {
-        addUnloadEventListener(this);
-    } else if (eventType == eventNames().beforeunloadEvent) {
-        if (allowsBeforeUnloadListeners(this)) {
-            // This is confusingly named. It doesn't actually add the listener. It just increments a count
-            // so that we know we have listeners registered for the purposes of determining if we can
-            // fast terminate the renderer process.
-            addBeforeUnloadEventListener(this);
-        } else {
-            // Subframes return false from allowsBeforeUnloadListeners.
-            UseCounter::count(this, UseCounter::SubFrameBeforeUnloadRegistered);
-        }
-    } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnabledFeatures::deviceOrientationEnabled()) {
-        if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
-            controller->addDeviceEventListener(this);
-    }
-
-    return true;
-}
-
-bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture)
-{
-    if (!EventTarget::removeEventListener(eventType, listener, useCapture))
-        return false;
-
-    lifecycleNotifier()->notifyRemoveEventListener(this, eventType);
-
-    if (eventType == eventNames().unloadEvent) {
-        removeUnloadEventListener(this);
-    } else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this)) {
-        removeBeforeUnloadEventListener(this);
-    } else if (eventType == eventNames().deviceorientationEvent) {
-        if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
-            controller->removeDeviceEventListener(this);
-    }
-
-    return true;
-}
-
-void DOMWindow::dispatchLoadEvent()
-{
-    RefPtr<Event> loadEvent(Event::create(eventNames().loadEvent));
-    if (m_frame && m_frame->loader()->documentLoader() && !m_frame->loader()->documentLoader()->timing()->loadEventStart()) {
-        // The DocumentLoader (and thus its DocumentLoadTiming) might get destroyed while dispatching
-        // the event, so protect it to prevent writing the end time into freed memory.
-        RefPtr<DocumentLoader> documentLoader = m_frame->loader()->documentLoader();
-        DocumentLoadTiming* timing = documentLoader->timing();
-        timing->markLoadEventStart();
-        dispatchEvent(loadEvent, document());
-        timing->markLoadEventEnd();
-    } else
-        dispatchEvent(loadEvent, document());
-
-    // For load events, send a separate load event to the enclosing frame only.
-    // This is a DOM extension and is independent of bubbling/capturing rules of
-    // the DOM.
-    Element* ownerElement = m_frame ? m_frame->ownerElement() : 0;
-    if (ownerElement)
-        ownerElement->dispatchEvent(Event::create(eventNames().loadEvent));
-
-    InspectorInstrumentation::loadEventFired(frame());
-}
-
-bool DOMWindow::dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget)
-{
-    RefPtr<EventTarget> protect = this;
-    RefPtr<Event> event = prpEvent;
-
-    event->setTarget(prpTarget ? prpTarget : this);
-    event->setCurrentTarget(this);
-    event->setEventPhase(Event::AT_TARGET);
-
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEventOnWindow(frame(), *event, this);
-
-    bool result = fireEventListeners(event.get());
-
-    InspectorInstrumentation::didDispatchEventOnWindow(cookie);
-
-    return result;
-}
-
-void DOMWindow::removeAllEventListeners()
-{
-    EventTarget::removeAllEventListeners();
-
-    lifecycleNotifier()->notifyRemoveAllEventListeners(this);
-
-    if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
-        controller->removeAllDeviceEventListeners(this);
-
-    removeAllUnloadEventListeners(this);
-    removeAllBeforeUnloadEventListeners(this);
-}
-
-void DOMWindow::finishedLoading()
-{
-    if (m_shouldPrintWhenFinishedLoading) {
-        m_shouldPrintWhenFinishedLoading = false;
-        print();
-    }
-}
-
-EventTargetData* DOMWindow::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* DOMWindow::ensureEventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-void DOMWindow::setLocation(const String& urlString, DOMWindow* activeWindow, DOMWindow* firstWindow, SetLocationLocking locking)
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return;
-
-    Document* activeDocument = activeWindow->document();
-    if (!activeDocument)
-        return;
-
-    if (!activeDocument->canNavigate(m_frame))
-        return;
-
-    Frame* firstFrame = firstWindow->frame();
-    if (!firstFrame)
-        return;
-
-    KURL completedURL = firstFrame->document()->completeURL(urlString);
-    if (completedURL.isNull())
-        return;
-
-    if (isInsecureScriptAccess(activeWindow, completedURL))
-        return;
-
-    // We want a new history item if we are processing a user gesture.
-    m_frame->navigationScheduler()->scheduleLocationChange(activeDocument->securityOrigin(),
-        // FIXME: What if activeDocument()->frame() is 0?
-        completedURL, activeDocument->frame()->loader()->outgoingReferrer(),
-        locking != LockHistoryBasedOnGestureState);
-}
-
-void DOMWindow::printErrorMessage(const String& message)
-{
-    if (message.isEmpty())
-        return;
-
-    pageConsole()->addMessage(JSMessageSource, ErrorMessageLevel, message);
-}
-
-// FIXME: Once we're throwing exceptions for cross-origin access violations, we will always sanitize the target
-// frame details, so we can safely combine 'crossDomainAccessErrorMessage' with this method after considering
-// exactly which details may be exposed to JavaScript.
-//
-// http://crbug.com/17325
-String DOMWindow::sanitizedCrossDomainAccessErrorMessage(DOMWindow* activeWindow)
-{
-    const KURL& activeWindowURL = activeWindow->document()->url();
-    if (activeWindowURL.isNull())
-        return String();
-
-    ASSERT(!activeWindow->document()->securityOrigin()->canAccess(document()->securityOrigin()));
-
-    SecurityOrigin* activeOrigin = activeWindow->document()->securityOrigin();
-    String message = "Blocked a frame with origin \"" + activeOrigin->toString() + "\" from accessing a cross-origin frame.";
-
-    // FIXME: Evaluate which details from 'crossDomainAccessErrorMessage' may safely be reported to JavaScript.
-
-    return message;
-}
-
-String DOMWindow::crossDomainAccessErrorMessage(DOMWindow* activeWindow)
-{
-    const KURL& activeWindowURL = activeWindow->document()->url();
-    if (activeWindowURL.isNull())
-        return String();
-
-    ASSERT(!activeWindow->document()->securityOrigin()->canAccess(document()->securityOrigin()));
-
-    // FIXME: This message, and other console messages, have extra newlines. Should remove them.
-    SecurityOrigin* activeOrigin = activeWindow->document()->securityOrigin();
-    SecurityOrigin* targetOrigin = document()->securityOrigin();
-    String message = "Blocked a frame with origin \"" + activeOrigin->toString() + "\" from accessing a frame with origin \"" + targetOrigin->toString() + "\". ";
-
-    // Sandbox errors: Use the origin of the frames' location, rather than their actual origin (since we know that at least one will be "null").
-    KURL activeURL = activeWindow->document()->url();
-    KURL targetURL = document()->url();
-    if (document()->isSandboxed(SandboxOrigin) || activeWindow->document()->isSandboxed(SandboxOrigin)) {
-        message = "Blocked a frame at \"" + SecurityOrigin::create(activeURL)->toString() + "\" from accessing a frame at \"" + SecurityOrigin::create(targetURL)->toString() + "\". ";
-        if (document()->isSandboxed(SandboxOrigin) && activeWindow->document()->isSandboxed(SandboxOrigin))
-            return "Sandbox access violation: " + message + " Both frames are sandboxed and lack the \"allow-same-origin\" flag.";
-        if (document()->isSandboxed(SandboxOrigin))
-            return "Sandbox access violation: " + message + " The frame being accessed is sandboxed and lacks the \"allow-same-origin\" flag.";
-        return "Sandbox access violation: " + message + " The frame requesting access is sandboxed and lacks the \"allow-same-origin\" flag.";
-    }
-
-    // Protocol errors: Use the URL's protocol rather than the origin's protocol so that we get a useful message for non-heirarchal URLs like 'data:'.
-    if (targetOrigin->protocol() != activeOrigin->protocol())
-        return message + " The frame requesting access has a protocol of \"" + activeURL.protocol() + "\", the frame being accessed has a protocol of \"" + targetURL.protocol() + "\". Protocols must match.\n";
-
-    // 'document.domain' errors.
-    if (targetOrigin->domainWasSetInDOM() && activeOrigin->domainWasSetInDOM())
-        return message + "The frame requesting access set \"document.domain\" to \"" + activeOrigin->domain() + "\", the frame being accessed set it to \"" + targetOrigin->domain() + "\". Both must set \"document.domain\" to the same value to allow access.";
-    if (activeOrigin->domainWasSetInDOM())
-        return message + "The frame requesting access set \"document.domain\" to \"" + activeOrigin->domain() + "\", but the frame being accessed did not. Both must set \"document.domain\" to the same value to allow access.";
-    if (targetOrigin->domainWasSetInDOM())
-        return message + "The frame being accessed set \"document.domain\" to \"" + targetOrigin->domain() + "\", but the frame requesting access did not. Both must set \"document.domain\" to the same value to allow access.";
-
-    // Default.
-    return message + "Protocols, domains, and ports must match.";
-}
-
-bool DOMWindow::isInsecureScriptAccess(DOMWindow* activeWindow, const String& urlString)
-{
-    if (!protocolIsJavaScript(urlString))
-        return false;
-
-    // If this DOMWindow isn't currently active in the Frame, then there's no
-    // way we should allow the access.
-    // FIXME: Remove this check if we're able to disconnect DOMWindow from
-    // Frame on navigation: https://bugs.webkit.org/show_bug.cgi?id=62054
-    if (isCurrentlyDisplayedInFrame()) {
-        // FIXME: Is there some way to eliminate the need for a separate "activeWindow == this" check?
-        if (activeWindow == this)
-            return false;
-
-        // FIXME: The name canAccess seems to be a roundabout way to ask "can execute script".
-        // Can we name the SecurityOrigin function better to make this more clear?
-        if (activeWindow->document()->securityOrigin()->canAccess(document()->securityOrigin()))
-            return false;
-    }
-
-    printErrorMessage(crossDomainAccessErrorMessage(activeWindow));
-    return true;
-}
-
-PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicString& frameName, const String& windowFeaturesString,
-    DOMWindow* activeWindow, DOMWindow* firstWindow)
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return 0;
-    Document* activeDocument = activeWindow->document();
-    if (!activeDocument)
-        return 0;
-    Frame* firstFrame = firstWindow->frame();
-    if (!firstFrame)
-        return 0;
-
-    if (!firstWindow->allowPopUp()) {
-        // Because FrameTree::find() returns true for empty strings, we must check for empty frame names.
-        // Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker.
-        if (frameName.isEmpty() || !m_frame->tree()->find(frameName))
-            return 0;
-    }
-
-    // Get the target frame for the special cases of _top and _parent.
-    // In those cases, we schedule a location change right now and return early.
-    Frame* targetFrame = 0;
-    if (frameName == "_top")
-        targetFrame = m_frame->tree()->top();
-    else if (frameName == "_parent") {
-        if (Frame* parent = m_frame->tree()->parent())
-            targetFrame = parent;
-        else
-            targetFrame = m_frame;
-    }
-    if (targetFrame) {
-        if (!activeDocument->canNavigate(targetFrame))
-            return 0;
-
-        KURL completedURL = firstFrame->document()->completeURL(urlString);
-
-        if (targetFrame->domWindow()->isInsecureScriptAccess(activeWindow, completedURL))
-            return targetFrame->domWindow();
-
-        if (urlString.isEmpty())
-            return targetFrame->domWindow();
-
-        // For whatever reason, Firefox uses the first window rather than the active window to
-        // determine the outgoing referrer. We replicate that behavior here.
-        targetFrame->navigationScheduler()->scheduleLocationChange(
-            activeDocument->securityOrigin(),
-            completedURL,
-            firstFrame->loader()->outgoingReferrer(),
-            false);
-        return targetFrame->domWindow();
-    }
-
-    WindowFeatures windowFeatures(windowFeaturesString);
-    Frame* result = createWindow(urlString, frameName, windowFeatures, activeWindow, firstFrame, m_frame);
-    return result ? result->domWindow() : 0;
-}
-
-void DOMWindow::showModalDialog(const String& urlString, const String& dialogFeaturesString,
-    DOMWindow* activeWindow, DOMWindow* firstWindow, PrepareDialogFunction function, void* functionContext)
-{
-    if (!isCurrentlyDisplayedInFrame())
-        return;
-    Frame* activeFrame = activeWindow->frame();
-    if (!activeFrame)
-        return;
-    Frame* firstFrame = firstWindow->frame();
-    if (!firstFrame)
-        return;
-
-    if (!canShowModalDialogNow(m_frame) || !firstWindow->allowPopUp())
-        return;
-
-    WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_frame->view()));
-    Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures,
-        activeWindow, firstFrame, m_frame, function, functionContext);
-    if (!dialogFrame)
-        return;
-    UserGestureIndicatorDisabler disabler;
-    dialogFrame->page()->chrome().runModal();
-}
-
-DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index)
-{
-    Frame* frame = this->frame();
-    if (!frame)
-        return 0;
-
-    Frame* child = frame->tree()->scopedChild(index);
-    if (child)
-        return child->domWindow();
-
-    return 0;
-}
-
-DOMWindowLifecycleNotifier* DOMWindow::lifecycleNotifier()
-{
-    return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleNotifier());
-}
-
-PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier()
-{
-    return DOMWindowLifecycleNotifier::create(this);
-}
-
-
-} // namespace WebCore
diff --git a/Source/core/page/DOMWindow.h b/Source/core/page/DOMWindow.h
deleted file mode 100644
index 21ecdc5..0000000
--- a/Source/core/page/DOMWindow.h
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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,
- * 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 DOMWindow_h
-#define DOMWindow_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/events/EventTarget.h"
-#include "core/page/FrameDestructionObserver.h"
-#include "core/platform/LifecycleContext.h"
-#include "core/platform/Supplementable.h"
-
-#include "wtf/Forward.h"
-
-namespace WebCore {
-    class ApplicationCache;
-    class BarProp;
-    class CSSRuleList;
-    class CSSStyleDeclaration;
-    class Console;
-    class DOMPoint;
-    class DOMSelection;
-    class DOMURL;
-    class DOMWindowProperty;
-    class Database;
-    class DatabaseCallback;
-    class Document;
-    class DOMWindowLifecycleNotifier;
-    class Element;
-    class EventListener;
-    class ExceptionState;
-    class FloatRect;
-    class Frame;
-    class History;
-    class IDBFactory;
-    class Location;
-    class MediaQueryList;
-    class MessageEvent;
-    class Navigator;
-    class Node;
-    class Page;
-    class PageConsole;
-    class Performance;
-    class PostMessageTimer;
-    class RequestAnimationFrameCallback;
-    class ScheduledAction;
-    class Screen;
-    class ScriptCallStack;
-    class SecurityOrigin;
-    class SerializedScriptValue;
-    class Storage;
-    class StyleMedia;
-    class DOMWindowCSS;
-
-    struct WindowFeatures;
-
-    typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray;
-
-    enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBackForwardList };
-
-    class DOMWindow : public RefCounted<DOMWindow>, public ScriptWrappable, public EventTarget, public FrameDestructionObserver, public Supplementable<DOMWindow>, public LifecycleContext {
-    public:
-        static PassRefPtr<DOMWindow> create(Frame* frame) { return adoptRef(new DOMWindow(frame)); }
-        virtual ~DOMWindow();
-
-        // In some rare cases, we'll re-used a DOMWindow for a new Document. For example,
-        // when a script calls window.open("..."), the browser gives JavaScript a window
-        // synchronously but kicks off the load in the window asynchronously. Web sites
-        // expect that modifications that they make to the window object synchronously
-        // won't be blown away when the network load commits. To make that happen, we
-        // "securely transition" the existing DOMWindow to the Document that results from
-        // the network load. See also SecurityContext::isSecureTransitionTo.
-        void setDocument(PassRefPtr<Document>);
-
-        virtual const AtomicString& interfaceName() const;
-        virtual ScriptExecutionContext* scriptExecutionContext() const;
-
-        virtual DOMWindow* toDOMWindow();
-
-        void registerProperty(DOMWindowProperty*);
-        void unregisterProperty(DOMWindowProperty*);
-
-        void reset();
-
-        PassRefPtr<MediaQueryList> matchMedia(const String&);
-
-        unsigned pendingUnloadEventListeners() const;
-
-        static FloatRect adjustWindowRect(Page*, const FloatRect& pendingChanges);
-
-        bool allowPopUp(); // Call on first window, not target window.
-        static bool allowPopUp(Frame* firstFrame);
-        static bool canShowModalDialog(const Frame*);
-        static bool canShowModalDialogNow(const Frame*);
-
-        // DOM Level 0
-
-        Screen* screen() const;
-        History* history() 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(); }
-
-        Location* location() const;
-        void setLocation(const String& location, DOMWindow* activeWindow, DOMWindow* firstWindow,
-            SetLocationLocking = LockHistoryBasedOnGestureState);
-
-        DOMSelection* getSelection();
-
-        Element* frameElement() const;
-
-        void focus(ScriptExecutionContext* = 0);
-        void blur();
-        void close(ScriptExecutionContext* = 0);
-        void print();
-        void stop();
-
-        PassRefPtr<DOMWindow> open(const String& urlString, const AtomicString& frameName, const String& windowFeaturesString,
-            DOMWindow* activeWindow, DOMWindow* firstWindow);
-
-        typedef void (*PrepareDialogFunction)(DOMWindow*, void* context);
-        void showModalDialog(const String& urlString, const String& dialogFeaturesString,
-            DOMWindow* activeWindow, DOMWindow* firstWindow, PrepareDialogFunction, void* functionContext);
-
-        void alert(const String& message);
-        bool confirm(const String& message);
-        String prompt(const String& message, const String& defaultValue);
-
-        bool find(const String&, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) const;
-
-        bool offscreenBuffering() const;
-
-        int outerHeight() const;
-        int outerWidth() const;
-        int innerHeight() const;
-        int innerWidth() const;
-        int screenX() const;
-        int screenY() const;
-        int screenLeft() const { return screenX(); }
-        int screenTop() const { return screenY(); }
-        int scrollX() const;
-        int scrollY() const;
-        int pageXOffset() const { return scrollX(); }
-        int pageYOffset() const { return scrollY(); }
-
-        bool closed() const;
-
-        unsigned length() const;
-
-        String name() const;
-        void setName(const String&);
-
-        String status() const;
-        void setStatus(const String&);
-        String defaultStatus() const;
-        void setDefaultStatus(const String&);
-
-        // This attribute is an alias of defaultStatus and is necessary for legacy uses.
-        String defaultstatus() const { return defaultStatus(); }
-        void setDefaultstatus(const String& status) { setDefaultStatus(status); }
-
-        // Self-referential attributes
-
-        DOMWindow* self() const;
-        DOMWindow* window() const { return self(); }
-        DOMWindow* frames() const { return self(); }
-
-        DOMWindow* opener() const;
-        DOMWindow* parent() const;
-        DOMWindow* top() const;
-
-        // DOM Level 2 AbstractView Interface
-
-        Document* document() const;
-
-        // CSSOM View Module
-
-        PassRefPtr<StyleMedia> styleMedia() const;
-
-        // DOM Level 2 Style Interface
-
-        PassRefPtr<CSSStyleDeclaration> getComputedStyle(Element*, const String& pseudoElt) const;
-
-        // WebKit extensions
-
-        PassRefPtr<CSSRuleList> getMatchedCSSRules(Element*, const String& pseudoElt, bool authorOnly = true) const;
-        double devicePixelRatio() const;
-
-        PassRefPtr<DOMPoint> webkitConvertPointFromPageToNode(Node*, const DOMPoint*) const;
-        PassRefPtr<DOMPoint> webkitConvertPointFromNodeToPage(Node*, const DOMPoint*) const;
-
-        Console* console() const;
-        PageConsole* pageConsole() const;
-
-        void printErrorMessage(const String&);
-        String crossDomainAccessErrorMessage(DOMWindow* activeWindow);
-        String sanitizedCrossDomainAccessErrorMessage(DOMWindow* activeWindow);
-
-        void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionState&);
-        void postMessageTimerFired(PassOwnPtr<PostMessageTimer>);
-        void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, PassRefPtr<Event>, PassRefPtr<ScriptCallStack>);
-
-        void scrollBy(int x, int y) const;
-        void scrollTo(int x, int y) const;
-        void scroll(int x, int y) const { scrollTo(x, y); }
-
-        void moveBy(float x, float y) const;
-        void moveTo(float x, float y) const;
-
-        void resizeBy(float x, float y) const;
-        void resizeTo(float width, float height) const;
-
-        // WebKit animation extensions
-        int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
-        int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
-        void cancelAnimationFrame(int id);
-
-        DOMWindowCSS* css();
-
-        // Events
-        // EventTarget API
-        virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
-        virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
-        virtual void removeAllEventListeners();
-
-        using EventTarget::dispatchEvent;
-        bool dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> prpTarget);
-
-        void dispatchLoadEvent();
-
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(beforeunload);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(blur);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(canplay);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(canplaythrough);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(change);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(click);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(contextmenu);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(dblclick);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(drag);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(dragenter);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(dragleave);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(dragover);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(drop);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(durationchange);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(emptied);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(ended);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(focus);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(hashchange);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(input);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(keypress);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(keyup);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(load);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(loadeddata);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(loadedmetadata);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(mousedown);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseenter);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseleave);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(mousemove);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseout);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseover);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseup);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(mousewheel);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(offline);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(online);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(pagehide);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(pageshow);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(pause);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(play);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(playing);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(popstate);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(progress);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(ratechange);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(reset);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(resize);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(scroll);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(search);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(seeked);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(seeking);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(select);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(stalled);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(storage);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(submit);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(suspend);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(timeupdate);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(transitionend);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(unload);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(volumechange);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(waiting);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(wheel);
-
-        DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart, webkitAnimationStart);
-        DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitAnimationIteration);
-        DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEnd);
-        DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransitionEnd);
-
-        void captureEvents() { }
-        void releaseEvents() { }
-
-        void finishedLoading();
-
-        using RefCounted<DOMWindow>::ref;
-        using RefCounted<DOMWindow>::deref;
-
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(devicemotion);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(deviceorientation);
-
-        // HTML 5 key/value storage
-        Storage* sessionStorage(ExceptionState&) const;
-        Storage* localStorage(ExceptionState&) const;
-        Storage* optionalSessionStorage() const { return m_sessionStorage.get(); }
-        Storage* optionalLocalStorage() const { return m_localStorage.get(); }
-
-        ApplicationCache* applicationCache() const;
-        ApplicationCache* optionalApplicationCache() const { return m_applicationCache.get(); }
-
-#if ENABLE(ORIENTATION_EVENTS)
-        // This is the interface orientation in degrees. Some examples are:
-        //  0 is straight up; -90 is when the device is rotated 90 clockwise;
-        //  90 is when rotated counter clockwise.
-        int orientation() const;
-
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange);
-#endif
-
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
-        DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
-
-        Performance* performance() const;
-
-        // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e.,
-        // when its document is no longer the document that is displayed in its
-        // frame), we would like to zero out m_frame to avoid being confused
-        // by the document that is currently active in m_frame.
-        bool isCurrentlyDisplayedInFrame() const;
-
-        void willDetachDocumentFromFrame();
-        DOMWindow* anonymousIndexedGetter(uint32_t);
-
-        bool isInsecureScriptAccess(DOMWindow* activeWindow, const String& urlString);
-
-    protected:
-        DOMWindowLifecycleNotifier* lifecycleNotifier();
-
-    private:
-        explicit DOMWindow(Frame*);
-
-        Page* page();
-
-        virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE;
-
-        virtual void frameDestroyed() OVERRIDE;
-        virtual void willDetachPage() OVERRIDE;
-
-        virtual void refEventTarget() { ref(); }
-        virtual void derefEventTarget() { deref(); }
-        virtual EventTargetData* eventTargetData();
-        virtual EventTargetData* ensureEventTargetData();
-
-        void resetDOMWindowProperties();
-        void willDestroyDocumentInFrame();
-
-        RefPtr<Document> m_document;
-
-        bool m_shouldPrintWhenFinishedLoading;
-
-        HashSet<DOMWindowProperty*> m_properties;
-
-        mutable RefPtr<Screen> m_screen;
-        mutable RefPtr<History> m_history;
-        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;
-        mutable RefPtr<StyleMedia> m_media;
-
-        EventTargetData m_eventTargetData;
-
-        String m_status;
-        String m_defaultStatus;
-
-        mutable RefPtr<Storage> m_sessionStorage;
-        mutable RefPtr<Storage> m_localStorage;
-        mutable RefPtr<ApplicationCache> m_applicationCache;
-
-        mutable RefPtr<Performance> m_performance;
-
-        mutable RefPtr<DOMWindowCSS> m_css;
-    };
-
-    inline String DOMWindow::status() const
-    {
-        return m_status;
-    }
-
-    inline String DOMWindow::defaultStatus() const
-    {
-        return m_defaultStatus;
-    }
-
-} // namespace WebCore
-
-#endif // DOMWindow_h
diff --git a/Source/core/page/DOMWindowBase64.cpp b/Source/core/page/DOMWindowBase64.cpp
deleted file mode 100644
index 6411d14..0000000
--- a/Source/core/page/DOMWindowBase64.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2013 Samsung Electronics. 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/page/DOMWindowBase64.h"
-
-#include "bindings/v8/ExceptionState.h"
-#include "core/dom/ExceptionCode.h"
-#include "wtf/text/Base64.h"
-
-namespace WebCore {
-
-namespace DOMWindowBase64 {
-
-String btoa(void*, const String& stringToEncode, ExceptionState& es)
-{
-    if (stringToEncode.isNull())
-        return String();
-
-    if (!stringToEncode.containsOnlyLatin1()) {
-        es.throwDOMException(InvalidCharacterError, "'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
-        return String();
-    }
-
-    return base64Encode(stringToEncode.latin1());
-}
-
-String atob(void*, const String& encodedString, ExceptionState& es)
-{
-    if (encodedString.isNull())
-        return String();
-
-    if (!encodedString.containsOnlyLatin1()) {
-        es.throwDOMException(InvalidCharacterError, "'atob' failed: The string to be decoded contains characters outside of the Latin1 range.");
-        return String();
-    }
-
-    Vector<char> out;
-    if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacterOrExcessPadding)) {
-        es.throwDOMException(InvalidCharacterError, "'atob' failed: The string to be decoded is not correctly encoded.");
-        return String();
-    }
-
-    return String(out.data(), out.size());
-}
-
-} // namespace DOMWindowBase64
-
-} // namespace WebCore
diff --git a/Source/core/page/DOMWindowLifecycleNotifier.cpp b/Source/core/page/DOMWindowLifecycleNotifier.cpp
deleted file mode 100644
index 189b18a..0000000
--- a/Source/core/page/DOMWindowLifecycleNotifier.cpp
+++ /dev/null
@@ -1,83 +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:
- * 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/page/DOMWindowLifecycleNotifier.h"
-
-namespace WebCore {
-
-DOMWindowLifecycleNotifier::DOMWindowLifecycleNotifier(LifecycleContext* context)
-    : LifecycleNotifier(context)
-{
-}
-
-void DOMWindowLifecycleNotifier::addObserver(LifecycleObserver* observer)
-{
-    if (observer->observerType() == LifecycleObserver::DOMWindowLifecycleObserverType) {
-        RELEASE_ASSERT(m_iterating != IteratingOverDOMWindowObservers);
-        m_windowObservers.add(static_cast<DOMWindowLifecycleObserver*>(observer));
-    }
-
-    LifecycleNotifier::addObserver(observer);
-}
-
-void DOMWindowLifecycleNotifier::removeObserver(LifecycleObserver* observer)
-{
-    if (observer->observerType() == LifecycleObserver::DOMWindowLifecycleObserverType) {
-        RELEASE_ASSERT(m_iterating != IteratingOverDOMWindowObservers);
-        m_windowObservers.remove(static_cast<DOMWindowLifecycleObserver*>(observer));
-    }
-
-    LifecycleNotifier::removeObserver(observer);
-}
-
-PassOwnPtr<DOMWindowLifecycleNotifier> DOMWindowLifecycleNotifier::create(LifecycleContext* context)
-{
-    return adoptPtr(new DOMWindowLifecycleNotifier(context));
-}
-
-void DOMWindowLifecycleNotifier::notifyAddEventListener(DOMWindow* window, const AtomicString& eventType)
-{
-    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDOMWindowObservers);
-    for (DOMWindowObserverSet::iterator it = m_windowObservers.begin(); it != m_windowObservers.end(); ++it)
-        (*it)->didAddEventListener(window, eventType);
-}
-
-void DOMWindowLifecycleNotifier::notifyRemoveEventListener(DOMWindow* window, const AtomicString& eventType)
-{
-    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDOMWindowObservers);
-    for (DOMWindowObserverSet::iterator it = m_windowObservers.begin(); it != m_windowObservers.end(); ++it)
-        (*it)->didRemoveEventListener(window, eventType);
-}
-
-void DOMWindowLifecycleNotifier::notifyRemoveAllEventListeners(DOMWindow* window)
-{
-    TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDOMWindowObservers);
-    for (DOMWindowObserverSet::iterator it = m_windowObservers.begin(); it != m_windowObservers.end(); ++it)
-        (*it)->didRemoveAllEventListeners(window);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/DOMWindowLifecycleNotifier.h b/Source/core/page/DOMWindowLifecycleNotifier.h
deleted file mode 100644
index e56f9ac..0000000
--- a/Source/core/page/DOMWindowLifecycleNotifier.h
+++ /dev/null
@@ -1,59 +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:
- * 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 DOMWindowLifecycleNotifier_h
-#define DOMWindowLifecycleNotifier_h
-
-#include "core/page/DOMWindowLifecycleObserver.h"
-#include "core/platform/LifecycleNotifier.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/TemporaryChange.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class DOMWindow;
-
-class DOMWindowLifecycleNotifier : public LifecycleNotifier {
-public:
-    static PassOwnPtr<DOMWindowLifecycleNotifier> create(LifecycleContext*);
-
-    void notifyAddEventListener(DOMWindow*, const AtomicString& eventType);
-    void notifyRemoveEventListener(DOMWindow*, const AtomicString& eventType);
-    void notifyRemoveAllEventListeners(DOMWindow*);
-
-    virtual void addObserver(LifecycleObserver*) OVERRIDE;
-    virtual void removeObserver(LifecycleObserver*) OVERRIDE;
-
-private:
-    explicit DOMWindowLifecycleNotifier(LifecycleContext*);
-
-    typedef HashSet<DOMWindowLifecycleObserver*> DOMWindowObserverSet;
-    DOMWindowObserverSet m_windowObservers;
-};
-
-} // namespace WebCore
-
-#endif // DOMWindowLifecycleNotifier_h
diff --git a/Source/core/page/DOMWindowLifecycleObserver.cpp b/Source/core/page/DOMWindowLifecycleObserver.cpp
deleted file mode 100644
index 5c88b45..0000000
--- a/Source/core/page/DOMWindowLifecycleObserver.cpp
+++ /dev/null
@@ -1,48 +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:
- * 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/page/DOMWindowLifecycleObserver.h"
-
-#include "core/page/DOMWindow.h"
-
-namespace WebCore {
-
-DOMWindowLifecycleObserver::DOMWindowLifecycleObserver(DOMWindow* window)
-    : LifecycleObserver(window, DOMWindowLifecycleObserverType)
-{
-}
-
-DOMWindowLifecycleObserver::~DOMWindowLifecycleObserver()
-{
-}
-
-DOMWindow* DOMWindowLifecycleObserver::window() const
-{
-    return static_cast<DOMWindow*>(lifecycleContext());
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/DOMWindowPagePopup.cpp b/Source/core/page/DOMWindowPagePopup.cpp
index a5c803c..348c589 100644
--- a/Source/core/page/DOMWindowPagePopup.cpp
+++ b/Source/core/page/DOMWindowPagePopup.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/page/DOMWindowPagePopup.h"
 
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 #include "core/page/PagePopupController.h"
 
 namespace WebCore {
diff --git a/Source/core/page/DOMWindowPagePopup.h b/Source/core/page/DOMWindowPagePopup.h
index d39555e..aa401a4 100644
--- a/Source/core/page/DOMWindowPagePopup.h
+++ b/Source/core/page/DOMWindowPagePopup.h
@@ -31,7 +31,7 @@
 #ifndef DOMWindowPagePopup_h
 #define DOMWindowPagePopup_h
 
-#include "core/platform/Supplementable.h"
+#include "platform/Supplementable.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/DOMWindowProperty.cpp b/Source/core/page/DOMWindowProperty.cpp
deleted file mode 100644
index 14df8ac..0000000
--- a/Source/core/page/DOMWindowProperty.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2011 Google, Inc. All Rights Reserved.
- * 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 GOOGLE 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/page/DOMWindowProperty.h"
-
-#include "core/dom/Document.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-
-namespace WebCore {
-
-DOMWindowProperty::DOMWindowProperty(Frame* frame)
-    : m_frame(frame)
-    , m_associatedDOMWindow(0)
-{
-    // FIXME: For now it *is* acceptable for a DOMWindowProperty to be created with a null frame.
-    // See fast/dom/navigator-detached-no-crash.html for the recipe.
-    // We should fix that.  <rdar://problem/11567132>
-    if (m_frame) {
-        m_associatedDOMWindow = m_frame->domWindow();
-        m_associatedDOMWindow->registerProperty(this);
-    }
-}
-
-DOMWindowProperty::~DOMWindowProperty()
-{
-    if (m_associatedDOMWindow)
-        m_associatedDOMWindow->unregisterProperty(this);
-
-    m_associatedDOMWindow = 0;
-    m_frame = 0;
-}
-
-void DOMWindowProperty::willDestroyGlobalObjectInFrame()
-{
-    // If the property is getting this callback it must have been created with a Frame/DOMWindow and it should still have them.
-    ASSERT(m_frame);
-    ASSERT(m_associatedDOMWindow);
-
-    // DOMWindowProperty lifetime isn't tied directly to the DOMWindow itself so it is important that it unregister
-    // itself from any DOMWindow it is associated with if that DOMWindow is going away.
-    if (m_associatedDOMWindow)
-        m_associatedDOMWindow->unregisterProperty(this);
-    m_associatedDOMWindow = 0;
-    m_frame = 0;
-}
-
-void DOMWindowProperty::willDetachGlobalObjectFromFrame()
-{
-    // If the property is getting this callback it must have been created with a Frame/DOMWindow and it should still have them.
-    ASSERT(m_frame);
-    ASSERT(m_associatedDOMWindow);
-}
-
-}
diff --git a/Source/core/page/DOMWindowTimers.cpp b/Source/core/page/DOMWindowTimers.cpp
deleted file mode 100644
index d8bbe6c..0000000
--- a/Source/core/page/DOMWindowTimers.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2013 Samsung Electronics. 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/page/DOMWindowTimers.h"
-
-#include "core/events/EventTarget.h"
-#include "core/page/DOMTimer.h"
-
-namespace WebCore {
-
-namespace DOMWindowTimers {
-
-int setTimeout(EventTarget* eventTarget, PassOwnPtr<ScheduledAction> action, int timeout)
-{
-    return DOMTimer::install(eventTarget->scriptExecutionContext(), action, timeout, true);
-}
-
-int setInterval(EventTarget* eventTarget, PassOwnPtr<ScheduledAction> action, int timeout)
-{
-    return DOMTimer::install(eventTarget->scriptExecutionContext(), action, timeout, false);
-}
-
-void clearTimeout(EventTarget* eventTarget, int timeoutID)
-{
-    if (ScriptExecutionContext* context = eventTarget->scriptExecutionContext())
-        DOMTimer::removeByID(context, timeoutID);
-}
-
-void clearInterval(EventTarget* eventTarget, int timeoutID)
-{
-    if (ScriptExecutionContext* context = eventTarget->scriptExecutionContext())
-        DOMTimer::removeByID(context, timeoutID);
-}
-
-} // namespace DOMWindowTimers
-
-} // namespace WebCore
diff --git a/Source/core/page/DeviceClient.h b/Source/core/page/DeviceClient.h
deleted file mode 100644
index d5160b7..0000000
--- a/Source/core/page/DeviceClient.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. 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 DeviceClient_h
-#define DeviceClient_h
-
-namespace WebCore {
-
-class DeviceClient {
-public:
-    virtual ~DeviceClient() { }
-
-    virtual void startUpdating() = 0;
-    virtual void stopUpdating() = 0;
-};
-
-} // namespace WebCore
-
-#endif // DeviceClient_h
diff --git a/Source/core/page/DeviceController.cpp b/Source/core/page/DeviceController.cpp
deleted file mode 100644
index 4376fd3..0000000
--- a/Source/core/page/DeviceController.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/page/DeviceController.h"
-
-#include "core/dom/Document.h"
-#include "core/page/DeviceClient.h"
-
-namespace WebCore {
-
-// FIXME: Another alternative is to update copyToVector in HashCountedSet to allow the source
-// and destination types to differ it the source type is convertible to the destination type.
-Vector<RefPtr<DOMWindow> > copyKeysToReferencingVector(const HashCountedSet<DOMWindow*>& set)
-{
-    Vector<RefPtr<DOMWindow> > vector;
-    vector.reserveCapacity(set.size());
-
-    HashCountedSet<DOMWindow*>::const_iterator end= set.end();
-    for (HashCountedSet<DOMWindow*>::const_iterator it = set.begin(); it != end; ++it)
-        vector.append((*it).key);
-    return vector;
-}
-
-DeviceController::DeviceController(DeviceClient* client)
-    : m_client(client)
-    , m_timer(this, &DeviceController::fireDeviceEvent)
-{
-    ASSERT(m_client);
-}
-
-void DeviceController::addDeviceEventListener(DOMWindow* window)
-{
-    bool wasEmpty = m_listeners.isEmpty();
-    m_listeners.add(window);
-
-    if (hasLastData()) {
-        m_lastEventListeners.add(window);
-        if (!m_timer.isActive())
-            m_timer.startOneShot(0);
-    }
-
-    if (wasEmpty)
-        m_client->startUpdating();
-}
-
-void DeviceController::removeDeviceEventListener(DOMWindow* window)
-{
-    m_listeners.remove(window);
-    m_lastEventListeners.remove(window);
-    if (m_listeners.isEmpty())
-        m_client->stopUpdating();
-}
-
-void DeviceController::removeAllDeviceEventListeners(DOMWindow* window)
-{
-    m_listeners.removeAll(window);
-    m_lastEventListeners.removeAll(window);
-    if (m_listeners.isEmpty())
-        m_client->stopUpdating();
-}
-
-void DeviceController::dispatchDeviceEvent(PassRefPtr<Event> prpEvent)
-{
-    RefPtr<Event> event = prpEvent;
-    Vector<RefPtr<DOMWindow> > listenerVector = copyKeysToReferencingVector(m_listeners);
-    for (size_t i = 0; i < listenerVector.size(); ++i) {
-        if (listenerVector[i]->document()
-            && !listenerVector[i]->document()->activeDOMObjectsAreSuspended()
-            && !listenerVector[i]->document()->activeDOMObjectsAreStopped())
-        listenerVector[i]->dispatchEvent(event);
-    }
-}
-
-void DeviceController::fireDeviceEvent(Timer<DeviceController>* timer)
-{
-    ASSERT_UNUSED(timer, timer == &m_timer);
-    ASSERT(hasLastData());
-
-    m_timer.stop();
-    Vector<RefPtr<DOMWindow> > listenerVector = copyKeysToReferencingVector(m_lastEventListeners);
-    m_lastEventListeners.clear();
-    for (size_t i = 0; i < listenerVector.size(); ++i) {
-        if (listenerVector[i]->document()
-            && !listenerVector[i]->document()->activeDOMObjectsAreSuspended()
-            && !listenerVector[i]->document()->activeDOMObjectsAreStopped())
-        listenerVector[i]->dispatchEvent(getLastEvent());
-    }
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/DeviceController.h b/Source/core/page/DeviceController.h
deleted file mode 100644
index bcdf1f1..0000000
--- a/Source/core/page/DeviceController.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- * Copyright (C) 2012 Samsung Electronics. 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 DeviceController_h
-#define DeviceController_h
-
-#include "core/events/Event.h"
-#include "core/page/DOMWindow.h"
-#include "core/platform/Supplementable.h"
-#include "core/platform/Timer.h"
-#include "wtf/HashCountedSet.h"
-
-namespace WebCore {
-
-class DeviceClient;
-class Page;
-
-class DeviceController : public Supplement<Page> {
-public:
-    explicit DeviceController(DeviceClient*);
-    ~DeviceController() { }
-
-    void addDeviceEventListener(DOMWindow*);
-    void removeDeviceEventListener(DOMWindow*);
-    void removeAllDeviceEventListeners(DOMWindow*);
-
-    void dispatchDeviceEvent(PassRefPtr<Event>);
-    bool isActive() { return !m_listeners.isEmpty(); }
-    DeviceClient* client() { return m_client; }
-
-    virtual bool hasLastData() { return false; }
-    virtual PassRefPtr<Event> getLastEvent() { return 0; }
-
-protected:
-    void fireDeviceEvent(Timer<DeviceController>*);
-
-    HashCountedSet<DOMWindow*> m_listeners;
-    HashCountedSet<DOMWindow*> m_lastEventListeners;
-    DeviceClient* m_client;
-    Timer<DeviceController> m_timer;
-};
-
-} // namespace WebCore
-
-#endif // DeviceController_h
diff --git a/Source/core/page/DiagnosticLoggingKeys.cpp b/Source/core/page/DiagnosticLoggingKeys.cpp
deleted file mode 100644
index 690ddc6..0000000
--- a/Source/core/page/DiagnosticLoggingKeys.cpp
+++ /dev/null
@@ -1,97 +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.
- */
-
-#include "config.h"
-#include "core/page/DiagnosticLoggingKeys.h"
-
-namespace WebCore {
-
-const String& DiagnosticLoggingKeys::mediaLoadedKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("mediaLoaded"));
-    return key;
-}
-
-const String& DiagnosticLoggingKeys::mediaLoadingFailedKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("mediaFailedLoading"));
-    return key;
-}
-
-const String& DiagnosticLoggingKeys::pluginLoadedKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("pluginLoaded"));
-    return key;
-}
-
-const String& DiagnosticLoggingKeys::pluginLoadingFailedKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("pluginFailedLoading"));
-    return key;
-}
-
-const String& DiagnosticLoggingKeys::pageContainsPluginKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("pageContainsPlugin"));
-    return key;
-}
-
-const String& DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("pageContainsAtLeastOnePlugin"));
-    return key;
-}
-
-const String& DiagnosticLoggingKeys::pageContainsMediaEngineKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("pageContainsMediaEngine"));
-    return key;
-}
-
-const String& DiagnosticLoggingKeys::pageContainsAtLeastOneMediaEngineKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("pageContainsAtLeastOneMediaEngine"));
-    return key;
-}
-
-const String& DiagnosticLoggingKeys::passKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("pass"));
-    return key;
-}
-
-const String& DiagnosticLoggingKeys::failKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("fail"));
-    return key;
-}
-
-const String& DiagnosticLoggingKeys::noopKey()
-{
-    DEFINE_STATIC_LOCAL(const String, key, ("noop"));
-    return key;
-}
-
-}
diff --git a/Source/core/page/DiagnosticLoggingKeys.h b/Source/core/page/DiagnosticLoggingKeys.h
deleted file mode 100644
index 50f0362..0000000
--- a/Source/core/page/DiagnosticLoggingKeys.h
+++ /dev/null
@@ -1,53 +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 DiagnosticLoggingKeys_h
-#define DiagnosticLoggingKeys_h
-
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class DiagnosticLoggingKeys {
-public:
-    // Message keys
-    static const String& mediaLoadedKey();
-    static const String& mediaLoadingFailedKey();
-    static const String& pluginLoadedKey();
-    static const String& pluginLoadingFailedKey();
-    static const String& pageContainsPluginKey();
-    static const String& pageContainsAtLeastOnePluginKey();
-    static const String& pageContainsMediaEngineKey();
-    static const String& pageContainsAtLeastOneMediaEngineKey();
-
-    // Success keys
-    static const String& passKey();
-    static const String& failKey();
-    static const String& noopKey();
-};
-
-}
-
-#endif // DiagnosticLoggingKeys_h
diff --git a/Source/core/page/DragController.cpp b/Source/core/page/DragController.cpp
index 19dc678..0009a1b 100644
--- a/Source/core/page/DragController.cpp
+++ b/Source/core/page/DragController.cpp
@@ -57,21 +57,22 @@
 #include "core/page/DragSession.h"
 #include "core/page/DragState.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/DragData.h"
 #include "core/platform/DragImage.h"
-#include "core/platform/graphics/FloatRect.h"
+#include "core/platform/chromium/ChromiumDataObject.h"
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/ImageOrientation.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/rendering/HitTestRequest.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderImage.h"
 #include "core/rendering/RenderTheme.h"
 #include "core/rendering/RenderView.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/graphics/ImageOrientation.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/OwnPtr.h"
@@ -121,6 +122,11 @@
                               metaKey, currentTime());
 }
 
+static PassRefPtr<Clipboard> createDraggingClipboard(ClipboardAccessPolicy policy, DragData* dragData)
+{
+    return Clipboard::create(Clipboard::DragAndDrop, policy, dragData->platformData());
+}
+
 DragController::DragController(Page* page, DragClient* client)
     : m_page(page)
     , m_client(client)
@@ -154,16 +160,16 @@
         if (PassRefPtr<DocumentFragment> fragment = dragData->asFragment(frame, context, allowPlainText, chosePlainText))
             return fragment;
 
-        if (dragData->containsURL(frame, DragData::DoNotConvertFilenames)) {
+        if (dragData->containsURL(DragData::DoNotConvertFilenames)) {
             String title;
-            String url = dragData->asURL(frame, DragData::DoNotConvertFilenames, &title);
+            String url = dragData->asURL(DragData::DoNotConvertFilenames, &title);
             if (!url.isEmpty()) {
                 RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(document);
                 anchor->setHref(url);
                 if (title.isEmpty()) {
                     // Try the plain text first because the url might be normalized or escaped.
                     if (dragData->containsPlainText())
-                        title = dragData->asPlainText(frame);
+                        title = dragData->asPlainText();
                     if (title.isEmpty())
                         title = url;
                 }
@@ -177,7 +183,7 @@
     }
     if (allowPlainText && dragData->containsPlainText()) {
         chosePlainText = true;
-        return createFragmentFromText(context.get(), dragData->asPlainText(frame)).get();
+        return createFragmentFromText(context.get(), dragData->asPlainText()).get();
     }
 
     return 0;
@@ -213,7 +219,7 @@
 
     if (RefPtr<FrameView> v = mainFrame->view()) {
         ClipboardAccessPolicy policy = (!m_documentUnderMouse || m_documentUnderMouse->securityOrigin()->isLocal()) ? ClipboardReadable : ClipboardTypesReadable;
-        RefPtr<Clipboard> clipboard = Clipboard::create(policy, dragData, mainFrame);
+        RefPtr<Clipboard> clipboard = createDraggingClipboard(policy, dragData);
         clipboard->setSourceOperation(dragData->draggingSourceOperationMask());
         mainFrame->eventHandler()->cancelDragAndDrop(createMouseEvent(dragData), clipboard.get());
         clipboard->setAccessPolicy(ClipboardNumb);    // invalidate clipboard here for security
@@ -238,7 +244,7 @@
         bool preventedDefault = false;
         if (mainFrame->view()) {
             // Sending an event can result in the destruction of the view and part.
-            RefPtr<Clipboard> clipboard = Clipboard::create(ClipboardReadable, dragData, mainFrame.get());
+            RefPtr<Clipboard> clipboard = createDraggingClipboard(ClipboardReadable, dragData);
             clipboard->setSourceOperation(dragData->draggingSourceOperationMask());
             preventedDefault = mainFrame->eventHandler()->performDragAndDrop(createMouseEvent(dragData), clipboard.get());
             clipboard->setAccessPolicy(ClipboardNumb); // Invalidate clipboard here for security
@@ -259,7 +265,7 @@
     if (operationForLoad(dragData) == DragOperationNone)
         return false;
 
-    m_page->mainFrame()->loader()->load(FrameLoadRequest(0, ResourceRequest(dragData->asURL(m_page->mainFrame()))));
+    m_page->mainFrame()->loader()->load(FrameLoadRequest(0, ResourceRequest(dragData->asURL())));
     return true;
 }
 
@@ -432,7 +438,7 @@
 bool DragController::dispatchTextInputEventFor(Frame* innerFrame, DragData* dragData)
 {
     ASSERT(m_page->dragCaretController().hasCaret());
-    String text = m_page->dragCaretController().isContentRichlyEditable() ? "" : dragData->asPlainText(innerFrame);
+    String text = m_page->dragCaretController().isContentRichlyEditable() ? "" : dragData->asPlainText();
     Node* target = innerFrame->editor().findEventTargetFrom(m_page->dragCaretController().caretPosition());
     return target->dispatchEvent(TextEvent::createForDrop(innerFrame->domWindow(), text), IGNORE_EXCEPTION);
 }
@@ -489,9 +495,8 @@
     if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRichlyEditable()) {
         bool chosePlainText = false;
         RefPtr<DocumentFragment> fragment = documentFragmentFromDragData(dragData, innerFrame.get(), range, true, chosePlainText);
-        if (!fragment || !innerFrame->editor().shouldInsertFragment(fragment, range, EditorInsertActionDropped)) {
+        if (!fragment)
             return false;
-        }
 
         if (dragIsMove(innerFrame->selection(), dragData)) {
             // NSTextView behavior is to always smart delete on moving a selection,
@@ -511,10 +516,9 @@
             }
         }
     } else {
-        String text = dragData->asPlainText(innerFrame.get());
-        if (text.isEmpty() || !innerFrame->editor().shouldInsertText(text, range.get(), EditorInsertActionDropped)) {
+        String text = dragData->asPlainText();
+        if (text.isEmpty())
             return false;
-        }
 
         if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point)) {
             ASSERT(m_documentUnderMouse);
@@ -592,7 +596,7 @@
         return false;
 
     ClipboardAccessPolicy policy = m_documentUnderMouse->securityOrigin()->isLocal() ? ClipboardReadable : ClipboardTypesReadable;
-    RefPtr<Clipboard> clipboard = Clipboard::create(policy, dragData, mainFrame.get());
+    RefPtr<Clipboard> clipboard = createDraggingClipboard(policy, dragData);
     DragOperation srcOpMask = dragData->draggingSourceOperationMask();
     clipboard->setSourceOperation(srcOpMask);
 
@@ -683,7 +687,7 @@
         range->selectNode(node, ASSERT_NO_EXCEPTION);
         source->selection().setSelection(VisibleSelection(range.get(), DOWNSTREAM));
     }
-    clipboard->declareAndWriteDragImage(node, !linkURL.isEmpty() ? linkURL : imageURL, label, source);
+    clipboard->declareAndWriteDragImage(node, !linkURL.isEmpty() ? linkURL : imageURL, label);
 }
 
 bool DragController::populateDragClipboard(Frame* src, const DragState& state, const IntPoint& dragOrigin)
@@ -727,7 +731,7 @@
             return false;
         // Simplify whitespace so the title put on the clipboard resembles what the user sees
         // on the web page. This includes replacing newlines with spaces.
-        clipboard->writeURL(linkURL, hitTestResult.textContent().simplifyWhiteSpace(), src);
+        clipboard->writeURL(linkURL, hitTestResult.textContent().simplifyWhiteSpace());
     }
     // FIXME: For DHTML/draggable element drags, write element markup to clipboard.
     return true;
@@ -830,7 +834,7 @@
     Clipboard* clipboard = state.m_dragClipboard.get();
     // We allow DHTML/JS to set the drag image, even if its a link, image or text we're dragging.
     // This is in the spirit of the IE API, which allows overriding of pasteboard data and DragOp.
-    OwnPtr<DragImage> dragImage = clipboard->createDragImage(dragOffset);
+    OwnPtr<DragImage> dragImage = clipboard->createDragImage(dragOffset, src);
     if (dragImage) {
         dragLocation = dragLocationForDHTMLDrag(mouseDraggedPoint, dragOrigin, dragOffset, !linkURL.isEmpty());
     }
@@ -910,7 +914,7 @@
     // attached sheet If this can be determined from within WebCore
     // operationForDrag can be pulled into WebCore itself
     ASSERT(dragData);
-    return dragData->containsURL(0) && !m_didInitiateDrag ? DragOperationCopy : DragOperationNone;
+    return dragData->containsURL() && !m_didInitiateDrag ? DragOperationCopy : DragOperationNone;
 }
 
 bool DragController::isCopyKeyDown(DragData*)
diff --git a/Source/core/page/DragController.h b/Source/core/page/DragController.h
index 23293e5..1aed97e 100644
--- a/Source/core/page/DragController.h
+++ b/Source/core/page/DragController.h
@@ -27,7 +27,7 @@
 #define DragController_h
 
 #include "core/page/DragActions.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/geometry/IntPoint.h"
 #include "weborigin/KURL.h"
 #include "wtf/Forward.h"
 
diff --git a/Source/core/page/EditorClient.h b/Source/core/page/EditorClient.h
index 5b866af..7be8026 100644
--- a/Source/core/page/EditorClient.h
+++ b/Source/core/page/EditorClient.h
@@ -27,11 +27,10 @@
 #ifndef EditorClient_h
 #define EditorClient_h
 
-#include "core/editing/EditorInsertAction.h"
 #include "core/editing/TextAffinity.h"
 #include "core/editing/UndoStep.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/text/TextChecking.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/text/TextChecking.h"
 #include "wtf/Forward.h"
 #include "wtf/Vector.h"
 
@@ -58,25 +57,14 @@
 public:
     virtual ~EditorClient() {  }
 
-    virtual bool shouldDeleteRange(Range*) = 0;
     virtual bool smartInsertDeleteEnabled() = 0;
     virtual bool isSelectTrailingWhitespaceEnabled() = 0;
     virtual bool isContinuousSpellCheckingEnabled() = 0;
     virtual void toggleContinuousSpellChecking() = 0;
     virtual bool isGrammarCheckingEnabled() = 0;
 
-    virtual bool shouldBeginEditing(Range*) = 0;
-    virtual bool shouldEndEditing(Range*) = 0;
-    virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction) = 0;
-    virtual bool shouldInsertText(const String&, Range*, EditorInsertAction) = 0;
-    virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting) = 0;
-
-    virtual bool shouldApplyStyle(StylePropertySet*, Range*) = 0;
-
-    virtual void didBeginEditing() = 0;
     virtual void respondToChangedContents() = 0;
     virtual void respondToChangedSelection(Frame*) = 0;
-    virtual void didEndEditing() = 0;
     virtual void didCancelCompositionOnSelectionChange() = 0;
 
     virtual void registerUndoStep(PassRefPtr<UndoStep>) = 0;
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index eb00a9c..0fbfe2a 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -32,25 +32,24 @@
 #include "RuntimeEnabledFeatures.h"
 #include "SVGNames.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
+#include "core/dom/Clipboard.h"
 #include "core/dom/Document.h"
-#include "core/events/DocumentEventQueue.h"
 #include "core/dom/DocumentMarkerController.h"
-#include "core/events/EventNames.h"
-#include "core/events/EventPathWalker.h"
 #include "core/dom/FullscreenElementStack.h"
-#include "core/events/KeyboardEvent.h"
-#include "core/events/MouseEvent.h"
-#include "core/events/TextEvent.h"
-#include "core/dom/TouchController.h"
-#include "core/events/TouchEvent.h"
 #include "core/dom/TouchList.h"
-#include "core/dom/UserTypingGestureIndicator.h"
-#include "core/events/WheelEvent.h"
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/TextIterator.h"
 #include "core/editing/htmlediting.h"
+#include "core/events/DocumentEventQueue.h"
+#include "core/events/EventPathWalker.h"
+#include "core/events/KeyboardEvent.h"
+#include "core/events/MouseEvent.h"
+#include "core/events/TextEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/events/TouchEvent.h"
+#include "core/events/WheelEvent.h"
 #include "core/fetch/ImageResource.h"
 #include "core/history/BackForwardController.h"
 #include "core/html/HTMLDialogElement.h"
@@ -63,26 +62,19 @@
 #include "core/page/DragState.h"
 #include "core/page/EditorClient.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/MouseEventWithHitTestResults.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/page/SpatialNavigation.h"
 #include "core/page/TouchAdjustment.h"
 #include "core/platform/Cursor.h"
-#include "core/platform/PlatformEvent.h"
-#include "core/platform/PlatformGestureEvent.h"
-#include "core/platform/PlatformKeyboardEvent.h"
-#include "core/platform/PlatformTouchEvent.h"
-#include "core/platform/PlatformWheelEvent.h"
 #include "core/platform/ScrollAnimator.h"
 #include "core/platform/Scrollbar.h"
 #include "core/platform/WindowsKeyboardCodes.h"
 #include "core/platform/chromium/ChromiumDataObject.h"
-#include "core/platform/chromium/ClipboardChromium.h"
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/platform/graphics/Image.h"
 #include "core/rendering/HitTestRequest.h"
 #include "core/rendering/HitTestResult.h"
@@ -94,6 +86,11 @@
 #include "core/svg/SVGDocument.h"
 #include "core/svg/SVGElementInstance.h"
 #include "core/svg/SVGUseElement.h"
+#include "platform/PlatformGestureEvent.h"
+#include "platform/PlatformKeyboardEvent.h"
+#include "platform/PlatformTouchEvent.h"
+#include "platform/PlatformWheelEvent.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/Assertions.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/StdLibExtras.h"
@@ -102,38 +99,37 @@
 namespace WebCore {
 
 using namespace HTMLNames;
+using namespace SVGNames;
 
 // The link drag hysteresis is much larger than the others because there
 // needs to be enough space to cancel the link press without starting a link drag,
 // and because dragging links is rare.
-const int LinkDragHysteresis = 40;
-const int ImageDragHysteresis = 5;
-const int TextDragHysteresis = 3;
-const int GeneralDragHysteresis = 3;
-
-// Match key code of composition keydown event on windows.
-// IE sends VK_PROCESSKEY which has value 229;
-const int CompositionEventKeyCode = 229;
-
-using namespace SVGNames;
+static const int LinkDragHysteresis = 40;
+static const int ImageDragHysteresis = 5;
+static const int TextDragHysteresis = 3;
+static const int GeneralDragHysteresis = 3;
 
 // The amount of time to wait before sending a fake mouse event, triggered
 // during a scroll. The short interval is used if the content responds to the mouse events quickly enough,
 // otherwise the long interval is used.
-const double fakeMouseMoveShortInterval = 0.1;
-const double fakeMouseMoveLongInterval = 0.250;
+static const double fakeMouseMoveShortInterval = 0.1;
+static const double fakeMouseMoveLongInterval = 0.250;
 
-const int maximumCursorSize = 128;
+// The amount of time to wait for a cursor update on style and layout changes
+// Set to 50Hz, no need to be faster than common screen refresh rate
+static const double cursorUpdateInterval = 0.02;
+
+static const int maximumCursorSize = 128;
 
 // It's pretty unlikely that a scale of less than one would ever be used. But all we really
 // need to ensure here is that the scale isn't so small that integer overflow can occur when
 // dividing cursor sizes (limited above) by the scale.
-const double minimumCursorScale = 0.001;
+static const double minimumCursorScale = 0.001;
 
 #if OS(MACOSX)
-const double EventHandler::TextDragDelay = 0.15;
+static const double TextDragDelay = 0.15;
 #else
-const double EventHandler::TextDragDelay = 0.0;
+static const double TextDragDelay = 0.0;
 #endif
 
 
@@ -262,7 +258,7 @@
 
 static inline bool shouldGesturesTriggerActive()
 {
-    // If the platform we're on supports GestureTapDown and GestureTapCancel then we'll
+    // If the platform we're on supports GestureShowPress and GestureTapCancel then we'll
     // rely on them to set the active state. Unfortunately there's no generic way to
     // know in advance what event types are supported.
     return true;
@@ -275,8 +271,7 @@
 static inline bool shouldRefetchEventTarget(const MouseEventWithHitTestResults& mev)
 {
     Node* targetNode = mev.targetNode();
-    ASSERT(targetNode);
-    if (!targetNode->parentNode())
+    if (!targetNode || !targetNode->parentNode())
         return true;
     return targetNode->isShadowRoot() && toShadowRoot(targetNode)->host()->hasTagName(inputTag);
 }
@@ -290,7 +285,9 @@
     , m_dragMayStartSelectionInstead(false)
     , m_mouseDownWasSingleClickInSelection(false)
     , m_selectionInitiationState(HaveNotStartedSelection)
+    , m_panScrollButtonPressed(false)
     , m_hoverTimer(this, &EventHandler::hoverTimerFired)
+    , m_cursorUpdateTimer(this, &EventHandler::cursorUpdateTimerFired)
     , m_mouseDownMayStartAutoscroll(false)
     , m_mouseDownWasInSubframe(false)
     , m_fakeMouseMoveEventTimer(this, &EventHandler::fakeMouseMoveEventTimerFired)
@@ -298,6 +295,7 @@
     , m_resizeLayer(0)
     , m_eventHandlerWillResetCapturingMouseEventsNode(0)
     , m_clickCount(0)
+    , m_shouldOnlyFireDragOverEvent(false)
     , m_mousePositionIsUnknown(true)
     , m_mouseDownTimestamp(0)
     , m_widgetIsLatched(false)
@@ -326,6 +324,7 @@
 void EventHandler::clear()
 {
     m_hoverTimer.stop();
+    m_cursorUpdateTimer.stop();
     m_fakeMouseMoveEventTimer.stop();
     m_resizeLayer = 0;
     m_nodeUnderMouse = 0;
@@ -370,7 +369,7 @@
 
 static void setSelectionIfNeeded(FrameSelection& selection, const VisibleSelection& newSelection)
 {
-    if (selection.selection() != newSelection && selection.shouldChangeSelection(newSelection))
+    if (selection.selection() != newSelection)
         selection.setSelection(newSelection);
 }
 
@@ -379,7 +378,7 @@
     if (!node || !node->renderer())
         return true;
 
-    return node->dispatchEvent(Event::createCancelableBubble(eventNames().selectstartEvent));
+    return node->dispatchEvent(Event::createCancelableBubble(EventTypeNames::selectstart));
 }
 
 static VisibleSelection expandSelectionToRespectUserSelectAll(Node* targetNode, const VisibleSelection& selection)
@@ -796,11 +795,6 @@
         FrameSelection::AdjustEndpointsAtBidiBoundary);
 }
 
-void EventHandler::lostMouseCapture()
-{
-    m_frame->selection().setCaretBlinkingSuspended(false);
-}
-
 bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& event)
 {
     Page* page = m_frame->page();
@@ -829,7 +823,7 @@
         VisibleSelection newSelection;
         Node* node = event.targetNode();
         bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
-        if (node && (caretBrowsing || node->rendererIsEditable()) && node->renderer()) {
+        if (node && node->renderer() && (caretBrowsing || node->rendererIsEditable())) {
             VisiblePosition pos = VisiblePosition(node->renderer()->positionForPoint(event.localPoint()));
             newSelection = VisibleSelection(pos);
         }
@@ -924,11 +918,6 @@
     return m_mousePressNode.get();
 }
 
-void EventHandler::setMousePressNode(PassRefPtr<Node> node)
-{
-    m_mousePressNode = node;
-}
-
 bool EventHandler::scrollOverflow(ScrollDirection direction, ScrollGranularity granularity, Node* startingNode)
 {
     Node* node = startingNode;
@@ -1017,14 +1006,7 @@
     return m_lastKnownMousePosition;
 }
 
-Frame* EventHandler::subframeForHitTestResult(const MouseEventWithHitTestResults& hitTestResult)
-{
-    if (!hitTestResult.isOverWidget())
-        return 0;
-    return subframeForTargetNode(hitTestResult.targetNode());
-}
-
-Frame* EventHandler::subframeForTargetNode(Node* node)
+static Frame* subframeForTargetNode(Node* node)
 {
     if (!node)
         return 0;
@@ -1040,6 +1022,13 @@
     return &toFrameView(widget)->frame();
 }
 
+static Frame* subframeForHitTestResult(const MouseEventWithHitTestResults& hitTestResult)
+{
+    if (!hitTestResult.isOverWidget())
+        return 0;
+    return subframeForTargetNode(hitTestResult.targetNode());
+}
+
 static bool isSubmitImage(Node* node)
 {
     return node && node->hasTagName(inputTag) && toHTMLInputElement(node)->isImageButton();
@@ -1086,7 +1075,47 @@
     return ((isOverLink || isSubmitImage(node)) && (!editable || editableLinkEnabled));
 }
 
-OptionalCursor EventHandler::selectCursor(const MouseEventWithHitTestResults& event, Scrollbar* scrollbar)
+void EventHandler::cursorUpdateTimerFired(Timer<EventHandler>*)
+{
+    ASSERT(m_frame);
+    ASSERT(m_frame->document());
+
+    updateCursor();
+}
+
+void EventHandler::updateCursor()
+{
+    if (m_mousePositionIsUnknown)
+        return;
+
+    FrameView* view = m_frame->view();
+    if (!view || !view->shouldSetCursor())
+        return;
+
+    RenderView* renderView = view->renderView();
+    if (!renderView)
+        return;
+
+    bool shiftKey;
+    bool ctrlKey;
+    bool altKey;
+    bool metaKey;
+    PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey);
+
+    m_frame->document()->updateLayout();
+
+    HitTestRequest request(HitTestRequest::ReadOnly);
+    HitTestResult result(view->windowToContents(m_lastKnownMousePosition));
+    renderView->hitTest(request, result);
+
+    OptionalCursor optionalCursor = selectCursor(result, shiftKey);
+    if (optionalCursor.isCursorChange()) {
+        m_currentMouseCursor = optionalCursor.cursor();
+        view->setCursor(m_currentMouseCursor);
+    }
+}
+
+OptionalCursor EventHandler::selectCursor(const HitTestResult& result, bool shiftKey)
 {
     if (m_resizeLayer && m_resizeLayer->inResizeMode())
         return NoCursorChange;
@@ -1099,15 +1128,18 @@
         return NoCursorChange;
 #endif
 
-    Node* node = event.targetNode();
-    RenderObject* renderer = node ? node->renderer() : 0;
+    Node* node = result.targetNode();
+    if (!node)
+        return NoCursorChange;
+
+    RenderObject* renderer = node->renderer();
     RenderStyle* style = renderer ? renderer->style() : 0;
     bool horizontalText = !style || style->isHorizontalWritingMode();
     const Cursor& iBeam = horizontalText ? iBeamCursor() : verticalTextCursor();
 
     if (renderer) {
         Cursor overrideCursor;
-        switch (renderer->getCursor(roundedIntPoint(event.localPoint()), overrideCursor)) {
+        switch (renderer->getCursor(roundedIntPoint(result.localPoint()), overrideCursor)) {
         case SetCursorBasedOnStyle:
             break;
         case SetCursor:
@@ -1149,16 +1181,16 @@
 
     switch (style ? style->cursor() : CURSOR_AUTO) {
     case CURSOR_AUTO: {
-        bool editable = (node && node->rendererIsEditable());
+        bool editable = node->rendererIsEditable();
 
-        if (useHandCursor(node, event.isOverLink(), event.event().shiftKey()))
+        if (useHandCursor(node, result.isOverLink(), shiftKey))
             return handCursor();
 
         bool inResizer = false;
         if (renderer) {
             if (RenderLayer* layer = renderer->enclosingLayer()) {
                 if (FrameView* view = m_frame->view())
-                    inResizer = layer->isPointInResizeControl(view->windowToContents(event.event().position()), ResizerForPointer);
+                    inResizer = layer->isPointInResizeControl(view->windowToContents(roundedIntPoint(result.localPoint())), ResizerForPointer);
             }
         }
 
@@ -1171,7 +1203,7 @@
             return iBeam;
         }
 
-        if ((editable || (renderer && renderer->isText() && node->canStartSelection())) && !inResizer && !scrollbar)
+        if ((editable || (renderer && renderer->isText() && node->canStartSelection())) && !inResizer && !result.scrollbar())
             return iBeam;
         return pointerCursor();
     }
@@ -1342,7 +1374,7 @@
 
     m_frame->selection().setCaretBlinkingSuspended(true);
 
-    bool swallowEvent = !dispatchMouseEvent(eventNames().mousedownEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
+    bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.targetNode(), true, m_clickCount, mouseEvent, true);
     m_capturesDragging = !swallowEvent || mev.scrollbar();
 
     // If the hit testing originally determined the event was in a scrollbar, refetch the MouseEventWithHitTestResults
@@ -1470,6 +1502,8 @@
     if (m_hoverTimer.isActive())
         m_hoverTimer.stop();
 
+    m_cursorUpdateTimer.stop();
+
     cancelFakeMouseMoveEvent();
 
     if (m_svgPan) {
@@ -1478,7 +1512,7 @@
     }
 
     if (m_frameSetBeingResized)
-        return !dispatchMouseEvent(eventNames().mousemoveEvent, m_frameSetBeingResized.get(), false, 0, mouseEvent, false);
+        return !dispatchMouseEvent(EventTypeNames::mousemove, m_frameSetBeingResized.get(), false, 0, mouseEvent, false);
 
     // Send events right to a scrollbar if the mouse is pressed.
     if (m_lastScrollbarUnderMouse && m_mousePressed) {
@@ -1540,7 +1574,7 @@
         if (scrollbar && !m_mousePressed)
             scrollbar->mouseMoved(mouseEvent); // Handle hover effects on platforms that support visual feedback on scrollbar hovering.
         if (FrameView* view = m_frame->view()) {
-            OptionalCursor optionalCursor = selectCursor(mev, scrollbar);
+            OptionalCursor optionalCursor = selectCursor(mev.hitTestResult(), mouseEvent.shiftKey());
             if (optionalCursor.isCursorChange()) {
                 m_currentMouseCursor = optionalCursor.cursor();
                 view->setCursor(m_currentMouseCursor);
@@ -1553,7 +1587,7 @@
     if (swallowEvent)
         return true;
 
-    swallowEvent = !dispatchMouseEvent(eventNames().mousemoveEvent, mev.targetNode(), false, 0, mouseEvent, true);
+    swallowEvent = !dispatchMouseEvent(EventTypeNames::mousemove, mev.targetNode(), false, 0, mouseEvent, true);
     if (!swallowEvent)
         swallowEvent = handleMouseDraggedEvent(mev);
 
@@ -1622,14 +1656,14 @@
     }
 
     if (m_frameSetBeingResized)
-        return !dispatchMouseEvent(eventNames().mouseupEvent, m_frameSetBeingResized.get(), true, m_clickCount, mouseEvent, false);
+        return !dispatchMouseEvent(EventTypeNames::mouseup, m_frameSetBeingResized.get(), true, m_clickCount, mouseEvent, false);
 
     if (m_lastScrollbarUnderMouse) {
         invalidateClick();
         m_lastScrollbarUnderMouse->mouseUp(mouseEvent);
         bool cancelable = true;
         bool setUnder = false;
-        return !dispatchMouseEvent(eventNames().mouseupEvent, m_lastNodeUnderMouse.get(), cancelable, m_clickCount, mouseEvent, setUnder);
+        return !dispatchMouseEvent(EventTypeNames::mouseup, m_lastNodeUnderMouse.get(), cancelable, m_clickCount, mouseEvent, setUnder);
     }
 
     HitTestRequest request(HitTestRequest::Release | HitTestRequest::DisallowShadowContent);
@@ -1640,7 +1674,7 @@
     if (subframe && passMouseReleaseEventToSubframe(mev, subframe))
         return true;
 
-    bool swallowMouseUpEvent = !dispatchMouseEvent(eventNames().mouseupEvent, mev.targetNode(), true, m_clickCount, mouseEvent, false);
+    bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev.targetNode(), true, m_clickCount, mouseEvent, false);
 
     bool contextMenuEvent = mouseEvent.button() == RightButton;
 #if OS(MACOSX)
@@ -1649,7 +1683,7 @@
         contextMenuEvent = true;
 #endif
 
-    bool swallowClickEvent = m_clickCount > 0 && !contextMenuEvent && mouseIsReleasedOnPressedElement(mev.targetNode(), m_clickNode.get()) && !dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
+    bool swallowClickEvent = m_clickCount > 0 && !contextMenuEvent && mouseIsReleasedOnPressedElement(mev.targetNode(), m_clickNode.get()) && !dispatchMouseEvent(EventTypeNames::click, mev.targetNode(), true, m_clickCount, mouseEvent, true);
 
     if (m_resizeLayer) {
         m_resizeLayer->setInResizeMode(false);
@@ -1739,7 +1773,7 @@
         if (dropZoneStr.isEmpty())
             continue;
 
-        dropZoneStr.makeLower();
+        dropZoneStr = dropZoneStr.lower();
 
         SpaceSplitString keywords(dropZoneStr, false);
         if (keywords.isNull())
@@ -1797,9 +1831,9 @@
             // As per section 7.9.4 of the HTML 5 spec., we must always fire a drag event before firing a dragenter, dragleave, or dragover event.
             if (dragState().m_dragSrc) {
                 // for now we don't care if event handler cancels default behavior, since there is none
-                dispatchDragSrcEvent(eventNames().dragEvent, event);
+                dispatchDragSrcEvent(EventTypeNames::drag, event);
             }
-            accept = dispatchDragEvent(eventNames().dragenterEvent, newTarget.get(), event, clipboard);
+            accept = dispatchDragEvent(EventTypeNames::dragenter, newTarget.get(), event, clipboard);
             if (!accept)
                 accept = findDropZone(newTarget.get(), clipboard);
         }
@@ -1808,7 +1842,7 @@
             if (targetFrame)
                 accept = targetFrame->eventHandler()->updateDragAndDrop(event, clipboard);
         } else if (m_dragTarget)
-            dispatchDragEvent(eventNames().dragleaveEvent, m_dragTarget.get(), event, clipboard);
+            dispatchDragEvent(EventTypeNames::dragleave, m_dragTarget.get(), event, clipboard);
 
         if (newTarget) {
             // We do not explicitly call dispatchDragEvent here because it could ultimately result in the appearance that
@@ -1824,9 +1858,9 @@
             // Note, when dealing with sub-frames, we may need to fire only a dragover event as a drag event may have been fired earlier.
             if (!m_shouldOnlyFireDragOverEvent && dragState().m_dragSrc) {
                 // for now we don't care if event handler cancels default behavior, since there is none
-                dispatchDragSrcEvent(eventNames().dragEvent, event);
+                dispatchDragSrcEvent(EventTypeNames::drag, event);
             }
-            accept = dispatchDragEvent(eventNames().dragoverEvent, newTarget.get(), event, clipboard);
+            accept = dispatchDragEvent(EventTypeNames::dragover, newTarget.get(), event, clipboard);
             if (!accept)
                 accept = findDropZone(newTarget.get(), clipboard);
             m_shouldOnlyFireDragOverEvent = false;
@@ -1845,8 +1879,8 @@
             targetFrame->eventHandler()->cancelDragAndDrop(event, clipboard);
     } else if (m_dragTarget.get()) {
         if (dragState().m_dragSrc)
-            dispatchDragSrcEvent(eventNames().dragEvent, event);
-        dispatchDragEvent(eventNames().dragleaveEvent, m_dragTarget.get(), event, clipboard);
+            dispatchDragSrcEvent(EventTypeNames::drag, event);
+        dispatchDragEvent(EventTypeNames::dragleave, m_dragTarget.get(), event, clipboard);
     }
     clearDragState();
 }
@@ -1859,7 +1893,7 @@
         if (targetFrame)
             preventedDefault = targetFrame->eventHandler()->performDragAndDrop(event, clipboard);
     } else if (m_dragTarget.get())
-        preventedDefault = dispatchDragEvent(eventNames().dropEvent, m_dragTarget.get(), event, clipboard);
+        preventedDefault = dispatchDragEvent(EventTypeNames::drop, m_dragTarget.get(), event, clipboard);
     clearDragState();
     return preventedDefault;
 }
@@ -1954,7 +1988,7 @@
         RenderLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get());
         Page* page = m_frame->page();
 
-        if (m_lastNodeUnderMouse && (!m_nodeUnderMouse || &m_nodeUnderMouse->document() != m_frame->document())) {
+        if (m_lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->document() != m_frame->document())) {
             // The mouse has moved between frames.
             if (Frame* frame = m_lastNodeUnderMouse->document().frame()) {
                 if (FrameView* frameView = frame->view())
@@ -1966,7 +2000,7 @@
                 scrollableAreaForLastNode->mouseExitedContentArea();
         }
 
-        if (m_nodeUnderMouse && (!m_lastNodeUnderMouse || &m_lastNodeUnderMouse->document() != m_frame->document())) {
+        if (m_nodeUnderMouse && (!m_lastNodeUnderMouse || m_lastNodeUnderMouse->document() != m_frame->document())) {
             // The mouse has moved between frames.
             if (Frame* frame = m_nodeUnderMouse->document().frame()) {
                 if (FrameView* frameView = frame->view())
@@ -1978,7 +2012,7 @@
                 scrollableAreaForNodeUnderMouse->mouseEnteredContentArea();
         }
 
-        if (m_lastNodeUnderMouse && &m_lastNodeUnderMouse->document() != m_frame->document()) {
+        if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame->document()) {
             m_lastNodeUnderMouse = 0;
             m_lastScrollbarUnderMouse = 0;
             m_lastInstanceUnderMouse = 0;
@@ -1987,10 +2021,10 @@
         if (m_lastNodeUnderMouse != m_nodeUnderMouse) {
             // send mouseout event to the old node
             if (m_lastNodeUnderMouse)
-                m_lastNodeUnderMouse->dispatchMouseEvent(mouseEvent, eventNames().mouseoutEvent, 0, m_nodeUnderMouse.get());
+                m_lastNodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames::mouseout, 0, m_nodeUnderMouse.get());
             // send mouseover event to the new node
             if (m_nodeUnderMouse)
-                m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventNames().mouseoverEvent, 0, m_lastNodeUnderMouse.get());
+                m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames::mouseover, 0, m_lastNodeUnderMouse.get());
         }
         m_lastNodeUnderMouse = m_nodeUnderMouse;
         m_lastInstanceUnderMouse = instanceAssociatedWithShadowTreeElement(m_nodeUnderMouse.get());
@@ -2009,7 +2043,7 @@
     if (m_nodeUnderMouse)
         swallowEvent = !(m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventType, clickCount));
 
-    if (swallowEvent || eventType != eventNames().mousedownEvent)
+    if (swallowEvent || eventType != EventTypeNames::mousedown)
         return !swallowEvent;
 
     // If clicking on a frame scrollbar, do not mess up with content focus.
@@ -2025,10 +2059,12 @@
     if (m_nodeUnderMouse)
         element = m_nodeUnderMouse->isElementNode() ? toElement(m_nodeUnderMouse.get()) : m_nodeUnderMouse->parentOrShadowHostElement();
     for (; element; element = element->parentOrShadowHostElement()) {
-        if (element->isFocusable())
+        if (element->isFocusable() && element->focused())
+            return !swallowEvent;
+        if (element->isMouseFocusable())
             break;
     }
-    ASSERT(!element || element->isFocusable());
+    ASSERT(!element || element->isMouseFocusable());
 
     // To fix <rdar://problem/4895428> Can't drag selected ToDo, we don't focus
     // a node on mouse down if it's selected and inside a focused node. It will
@@ -2041,21 +2077,19 @@
         && element->isDescendantOf(m_frame->document()->focusedElement()))
         return true;
 
-    bool elementIsMouseFocusable = element && element->isMouseFocusable();
-
     // Only change the focus when clicking scrollbars if it can transfered to a
     // mouse focusable node.
-    if (!elementIsMouseFocusable && isInsideScrollbar(mouseEvent.position()))
+    if (!element && isInsideScrollbar(mouseEvent.position()))
         return false;
 
     if (Page* page = m_frame->page()) {
         // If focus shift is blocked, we eat the event. Note we should never
         // clear swallowEvent if the page already set it (e.g., by canceling
         // default behavior).
-        if (elementIsMouseFocusable) {
+        if (element) {
             if (!page->focusController().setFocusedElement(element, m_frame, FocusDirectionMouse))
                 swallowEvent = true;
-        } else if (!element || !element->focused()) {
+        } else {
             // We call setFocusedElement even with !element in order to blur
             // current focus element when a link is clicked; this is expected by
             // some sites that rely on onChange handlers running from form
@@ -2194,7 +2228,7 @@
         m_previousWheelScrolledNode = stopNode;
 }
 
-bool EventHandler::handleGestureTapDown()
+bool EventHandler::handleGestureShowPress()
 {
     FrameView* view = m_frame->view();
     if (!view)
@@ -2226,8 +2260,8 @@
 
     IntPoint adjustedPoint = gestureEvent.position();
     HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent;
-    if (gestureEvent.type() == PlatformEvent::GestureTapDown ||
-        gestureEvent.type() == PlatformEvent::GestureTapUnconfirmed) {
+    if (gestureEvent.type() == PlatformEvent::GestureShowPress
+        || gestureEvent.type() == PlatformEvent::GestureTapUnconfirmed) {
         adjustGesturePosition(gestureEvent, adjustedPoint);
         hitType |= HitTestRequest::Active;
     } else if (gestureEvent.type() == PlatformEvent::GestureTapDownCancel)
@@ -2295,8 +2329,8 @@
         return handleGestureScrollEnd(gestureEvent);
     case PlatformEvent::GestureTap:
         return handleGestureTap(gestureEvent);
-    case PlatformEvent::GestureTapDown:
-        return handleGestureTapDown();
+    case PlatformEvent::GestureShowPress:
+        return handleGestureShowPress();
     case PlatformEvent::GestureLongPress:
         return handleGestureLongPress(gestureEvent);
     case PlatformEvent::GestureLongTap:
@@ -2327,20 +2361,14 @@
         gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());
     handleMouseMoveEvent(fakeMouseMove);
 
-    int tapCount = 1;
-    // FIXME: deletaX is overloaded to mean different things for different gestures.
-    // http://wkb.ug/93123
-    if (gestureEvent.deltaX() > 0)
-        tapCount = static_cast<int>(gestureEvent.deltaX());
-
     bool defaultPrevented = false;
     PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition(),
-        LeftButton, PlatformEvent::MousePressed, tapCount,
+        LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(),
         gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());
     defaultPrevented |= handleMousePressEvent(fakeMouseDown);
 
     PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(),
-        LeftButton, PlatformEvent::MouseReleased, tapCount,
+        LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(),
         gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());
     defaultPrevented |= handleMouseReleaseEvent(fakeMouseUp);
 
@@ -2477,8 +2505,7 @@
 bool EventHandler::handleGestureScrollBegin(const PlatformGestureEvent& gestureEvent)
 {
     Document* document = m_frame->document();
-    RenderObject* documentRenderer = document->renderer();
-    if (!documentRenderer)
+    if (!document->renderView())
         return false;
 
     FrameView* view = m_frame->view();
@@ -2587,7 +2614,7 @@
         gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp());
     HitTestRequest request(HitTestRequest::ReadOnly);
     MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDown);
-    return EventHandler::subframeForHitTestResult(mev);
+    return subframeForHitTestResult(mev);
 }
 
 void EventHandler::clearGestureScrollNodes()
@@ -2669,6 +2696,7 @@
     case PlatformEvent::GestureTap:
     case PlatformEvent::GestureTapUnconfirmed:
     case PlatformEvent::GestureTapDown:
+    case PlatformEvent::GestureShowPress:
         bestClickableNodeForTouchPoint(gestureEvent.position(), IntSize(gestureEvent.area().width() / 2, gestureEvent.area().height() / 2), adjustedPoint, targetNode);
         break;
     case PlatformEvent::GestureLongPress:
@@ -2711,7 +2739,7 @@
             selectClosestWordOrLinkFromMouseEvent(mev);
     }
 
-    swallowEvent = !dispatchMouseEvent(eventNames().contextmenuEvent, mev.targetNode(), true, 0, event, false);
+    swallowEvent = !dispatchMouseEvent(EventTypeNames::contextmenu, mev.targetNode(), true, 0, event, false);
 
     return swallowEvent;
 }
@@ -2787,7 +2815,7 @@
 
     PlatformMouseEvent mouseEvent(position, globalPosition, RightButton, eventType, 1, false, false, false, false, WTF::currentTime());
 
-    return !dispatchMouseEvent(eventNames().contextmenuEvent, targetNode, true, 0, mouseEvent, false);
+    return !dispatchMouseEvent(EventTypeNames::contextmenu, targetNode, true, 0, mouseEvent, false);
 }
 
 bool EventHandler::sendContextMenuEventForGesture(const PlatformGestureEvent& event)
@@ -2815,6 +2843,12 @@
         m_hoverTimer.startOneShot(0);
 }
 
+void EventHandler::scheduleCursorUpdate()
+{
+    if (!m_cursorUpdateTimer.isActive())
+        m_cursorUpdateTimer.startOneShot(cursorUpdateInterval);
+}
+
 void EventHandler::dispatchFakeMouseMoveEventSoon()
 {
     if (m_mousePressed)
@@ -2986,7 +3020,6 @@
         return false;
 
     UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
-    UserTypingGestureIndicator typingGestureIndicator(m_frame);
 
     if (FrameView* view = m_frame->view())
         view->resetDeferredRepaintDelay();
@@ -3068,7 +3101,7 @@
 
 void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event)
 {
-    if (event->type() == eventNames().keydownEvent) {
+    if (event->type() == EventTypeNames::keydown) {
         m_frame->editor().handleKeyboardEvent(event);
         if (event->defaultHandled())
             return;
@@ -3084,7 +3117,7 @@
                 defaultArrowEventHandler(direction, event);
         }
     }
-    if (event->type() == eventNames().keypressEvent) {
+    if (event->type() == EventTypeNames::keypress) {
         m_frame->editor().handleKeyboardEvent(event);
         if (event->defaultHandled())
             return;
@@ -3142,7 +3175,7 @@
     if (dragState().m_dragSrc) {
         dragState().m_dragClipboard->setDestinationOperation(operation);
         // for now we don't care if event handler cancels default behavior, since there is none
-        dispatchDragSrcEvent(eventNames().dragendEvent, event);
+        dispatchDragSrcEvent(EventTypeNames::dragend, event);
     }
     freeClipboard();
     dragState().m_dragSrc = 0;
@@ -3172,7 +3205,7 @@
 bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, CheckDragHysteresis checkDragHysteresis)
 {
     // Callers must protect the reference to FrameView, since this function may dispatch DOM
-    // events, causing Frame/FrameView to go away.
+    // events, causing page/FrameView to go away.
     ASSERT(m_frame);
     ASSERT(m_frame->view());
     if (!m_frame->page())
@@ -3284,7 +3317,7 @@
     DragController& dragController = m_frame->page()->dragController();
     if (!dragController.populateDragClipboard(m_frame, dragState(), m_mouseDownPos))
         return false;
-    m_mouseDownMayStartDrag = dispatchDragSrcEvent(eventNames().dragstartEvent, m_mouseDown)
+    m_mouseDownMayStartDrag = dispatchDragSrcEvent(EventTypeNames::dragstart, m_mouseDown)
         && !m_frame->selection().isInPasswordField();
 
     // Invalidate clipboard here against anymore pasteboard writing for security. The drag
@@ -3292,12 +3325,6 @@
     dragState().m_dragClipboard->setAccessPolicy(ClipboardImageWritable);
 
     if (m_mouseDownMayStartDrag) {
-        // Yuck, a draggedImage:moveTo: message can be fired as a result of kicking off the
-        // drag with dragImage! Because of that dumb reentrancy, we may think we've not
-        // started the drag when that happens. So we have to assume it's started before we
-        // kick it off.
-        dragState().m_dragClipboard->setDragHasStarted();
-
         // Dispatching the event could cause Page to go away. Make sure it's still valid before trying to use DragController.
         m_didStartDrag = m_frame->page() && dragController.startDrag(m_frame, dragState(), event.event(), m_mouseDownPos);
         // FIXME: This seems pretty useless now. The gesture code uses this as a signal for
@@ -3306,7 +3333,7 @@
         if (m_didStartDrag)
             return true;
         // Drag was canned at the last minute - we owe m_dragSrc a DRAGEND event
-        dispatchDragSrcEvent(eventNames().dragendEvent, event.event());
+        dispatchDragSrcEvent(EventTypeNames::dragend, event.event());
     }
 
     return false;
@@ -3316,7 +3343,7 @@
 {
     // Platforms should differentiate real commands like selectAll from text input in disguise (like insertNewline),
     // and avoid dispatching text input events from keydown default handlers.
-    ASSERT(!underlyingEvent || !underlyingEvent->isKeyboardEvent() || toKeyboardEvent(underlyingEvent)->type() == eventNames().keypressEvent);
+    ASSERT(!underlyingEvent || !underlyingEvent->isKeyboardEvent() || toKeyboardEvent(underlyingEvent)->type() == EventTypeNames::keypress);
 
     if (!m_frame)
         return false;
@@ -3339,14 +3366,6 @@
     return event->defaultHandled();
 }
 
-bool EventHandler::isKeyboardOptionTab(KeyboardEvent* event)
-{
-    return event
-        && (event->type() == eventNames().keydownEvent || event->type() == eventNames().keypressEvent)
-        && event->altKey()
-        && event->keyIdentifier() == "U+0009";
-}
-
 void EventHandler::defaultTextInputEventHandler(TextEvent* event)
 {
     if (m_frame->editor().handleTextEvent(event))
@@ -3355,7 +3374,7 @@
 
 void EventHandler::defaultSpaceEventHandler(KeyboardEvent* event)
 {
-    ASSERT(event->type() == eventNames().keypressEvent);
+    ASSERT(event->type() == EventTypeNames::keypress);
 
     if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGraphKey())
         return;
@@ -3376,7 +3395,7 @@
 
 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event)
 {
-    ASSERT(event->type() == eventNames().keydownEvent);
+    ASSERT(event->type() == EventTypeNames::keydown);
 
     if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGraphKey())
         return;
@@ -3401,7 +3420,7 @@
 
 void EventHandler::defaultArrowEventHandler(FocusDirection focusDirection, KeyboardEvent* event)
 {
-    ASSERT(event->type() == eventNames().keydownEvent);
+    ASSERT(event->type() == EventTypeNames::keydown);
 
     if (event->ctrlKey() || event->metaKey() || event->altGraphKey() || event->shiftKey())
         return;
@@ -3424,7 +3443,7 @@
 
 void EventHandler::defaultTabEventHandler(KeyboardEvent* event)
 {
-    ASSERT(event->type() == eventNames().keydownEvent);
+    ASSERT(event->type() == EventTypeNames::keydown);
 
     // We should only advance focus on tabs if no special modifier keys are held down.
     if (event->ctrlKey() || event->metaKey() || event->altGraphKey())
@@ -3449,7 +3468,7 @@
 void EventHandler::defaultEscapeEventHandler(KeyboardEvent* event)
 {
     if (HTMLDialogElement* dialog = m_frame->document()->activeModalDialog())
-        dialog->dispatchEvent(Event::createCancelable(eventNames().cancelEvent));
+        dialog->dispatchEvent(Event::createCancelable(EventTypeNames::cancel));
 }
 
 void EventHandler::capsLockStateMayHaveChanged()
@@ -3464,14 +3483,14 @@
 
 void EventHandler::sendResizeEvent()
 {
-    m_frame->document()->enqueueWindowEvent(Event::create(eventNames().resizeEvent));
+    m_frame->document()->enqueueWindowEvent(Event::create(EventTypeNames::resize));
 }
 
 void EventHandler::sendScrollEvent()
 {
     setFrameWasScrolledByUser();
     if (m_frame->view() && m_frame->document())
-        m_frame->document()->eventQueue()->enqueueOrDispatchScrollEvent(m_frame->document(), DocumentEventQueue::ScrollEventDocumentTarget);
+        m_frame->document()->enqueueScrollEventForNode(m_frame->document());
 }
 
 void EventHandler::setFrameWasScrolledByUser()
@@ -3511,13 +3530,13 @@
 {
     switch (state) {
     case PlatformTouchPoint::TouchReleased:
-        return eventNames().touchendEvent;
+        return EventTypeNames::touchend;
     case PlatformTouchPoint::TouchCancelled:
-        return eventNames().touchcancelEvent;
+        return EventTypeNames::touchcancel;
     case PlatformTouchPoint::TouchPressed:
-        return eventNames().touchstartEvent;
+        return EventTypeNames::touchstart;
     case PlatformTouchPoint::TouchMoved:
-        return eventNames().touchmoveEvent;
+        return EventTypeNames::touchmove;
     case PlatformTouchPoint::TouchStationary:
         // TouchStationary state is not converted to touch events, so fall through to assert.
     default:
@@ -3640,7 +3659,7 @@
                 m_originatingTouchPointDocument = &doc;
                 freshTouchEvents = false;
             }
-            if (!TouchController::from(&doc)->hasTouchEventHandlers())
+            if (!doc.hasTouchEventHandlers())
                 continue;
             m_originatingTouchPointTargets.set(touchPointTargetKey, node);
             touchTarget = node;
@@ -3663,7 +3682,7 @@
         if (!touchTarget.get())
             continue;
         Document& doc = touchTarget->toNode()->document();
-        if (!TouchController::from(&doc)->hasTouchEventHandlers())
+        if (!doc.hasTouchEventHandlers())
             continue;
         Frame* targetFrame = doc.frame();
         if (!targetFrame)
@@ -3784,8 +3803,7 @@
         VisiblePosition visiblePos(
             mev.targetNode()->renderer()->positionForPoint(mev.localPoint()));
         VisibleSelection newSelection(visiblePos);
-        if (m_frame->selection().shouldChangeSelection(newSelection))
-            m_frame->selection().setSelection(newSelection);
+        m_frame->selection().setSelection(newSelection);
     }
 
     subframe->eventHandler()->handleMousePressEvent(mev.event());
@@ -3831,8 +3849,7 @@
 
 PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
 {
-    RefPtr<ChromiumDataObject> dataObject = ChromiumDataObject::create();
-    return ClipboardChromium::create(Clipboard::DragAndDrop, dataObject.get(), ClipboardWritable, m_frame);
+    return Clipboard::create(Clipboard::DragAndDrop, ClipboardWritable, ChromiumDataObject::create());
 }
 
 void EventHandler::focusDocumentView()
diff --git a/Source/core/page/EventHandler.h b/Source/core/page/EventHandler.h
index 32ee8b3..ada5def 100644
--- a/Source/core/page/EventHandler.h
+++ b/Source/core/page/EventHandler.h
@@ -26,17 +26,17 @@
 #ifndef EventHandler_h
 #define EventHandler_h
 
-#include "core/events/TextEventInputType.h"
-#include "core/dom/UserGestureIndicator.h"
 #include "core/editing/TextGranularity.h"
+#include "core/events/TextEventInputType.h"
 #include "core/page/DragActions.h"
 #include "core/page/FocusDirection.h"
 #include "core/platform/Cursor.h"
-#include "core/platform/PlatformMouseEvent.h"
-#include "core/platform/ScrollTypes.h"
-#include "core/platform/Timer.h"
-#include "core/platform/graphics/LayoutPoint.h"
 #include "core/rendering/HitTestRequest.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/Timer.h"
+#include "platform/UserGestureIndicator.h"
+#include "platform/geometry/LayoutPoint.h"
+#include "platform/scroll/ScrollTypes.h"
 #include "wtf/Forward.h"
 #include "wtf/HashMap.h"
 #include "wtf/RefPtr.h"
@@ -77,11 +77,6 @@
 
 struct DragState;
 
-extern const int LinkDragHysteresis;
-extern const int ImageDragHysteresis;
-extern const int TextDragHysteresis;
-extern const int GeneralDragHysteresis;
-
 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTrailingWhitespace };
 enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis };
 
@@ -97,14 +92,12 @@
     void updateSelectionForMouseDrag();
 
     Node* mousePressNode() const;
-    void setMousePressNode(PassRefPtr<Node>);
 
 #if OS(WIN)
     void startPanScrolling(RenderObject*);
 #endif
 
     void stopAutoscrollTimer();
-    bool mouseDownWasInSubframe() const { return m_mouseDownWasInSubframe; }
 
     void dispatchFakeMouseMoveEventSoon();
     void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);
@@ -124,6 +117,7 @@
     void updateDragStateAfterEditDragIfNeeded(Element* rootEditableElement);
 
     void scheduleHoverStateUpdate();
+    void scheduleCursorUpdate();
 
     void setResizingFrameSet(HTMLFrameSetElement*);
 
@@ -132,9 +126,6 @@
     IntPoint lastKnownMousePosition() const;
     Cursor currentMouseCursor() const { return m_currentMouseCursor; }
 
-    static Frame* subframeForTargetNode(Node*);
-    static Frame* subframeForHitTestResult(const MouseEventWithHitTestResults&);
-
     bool scrollOverflow(ScrollDirection, ScrollGranularity, Node* startingNode = 0);
     bool scrollRecursively(ScrollDirection, ScrollGranularity, Node* startingNode = 0);
     bool logicalScrollRecursively(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0);
@@ -142,27 +133,15 @@
     bool handleMouseMoveEvent(const PlatformMouseEvent&);
     void handleMouseLeaveEvent(const PlatformMouseEvent&);
 
-    void lostMouseCapture();
-
     bool handleMousePressEvent(const PlatformMouseEvent&);
     bool handleMouseReleaseEvent(const PlatformMouseEvent&);
     bool handleWheelEvent(const PlatformWheelEvent&);
     void defaultWheelEventHandler(Node*, WheelEvent*);
-    bool handlePasteGlobalSelection(const PlatformMouseEvent&);
 
     bool handleGestureEvent(const PlatformGestureEvent&);
-    bool handleGestureTap(const PlatformGestureEvent&);
-    bool handleGestureLongPress(const PlatformGestureEvent&);
-    bool handleGestureLongTap(const PlatformGestureEvent&);
-    bool handleGestureTwoFingerTap(const PlatformGestureEvent&);
-    bool handleGestureScrollUpdate(const PlatformGestureEvent&);
-    bool handleGestureScrollBegin(const PlatformGestureEvent&);
     bool handleGestureScrollEnd(const PlatformGestureEvent&);
-    void clearGestureScrollNodes();
     bool isScrollbarHandlingGestures() const;
 
-    bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const;
-
     bool bestClickableNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode);
     bool bestContextMenuNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode);
     bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntRect& targetArea, Node*& targetNode);
@@ -198,7 +177,6 @@
 
 private:
     static DragState& dragState();
-    static const double TextDragDelay;
 
     PassRefPtr<Clipboard> createDraggingClipboard() const;
 
@@ -217,19 +195,32 @@
     bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&);
     bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
 
-    OptionalCursor selectCursor(const MouseEventWithHitTestResults&, Scrollbar*);
+    bool handlePasteGlobalSelection(const PlatformMouseEvent&);
+
+    bool handleGestureTap(const PlatformGestureEvent&);
+    bool handleGestureLongPress(const PlatformGestureEvent&);
+    bool handleGestureLongTap(const PlatformGestureEvent&);
+    bool handleGestureTwoFingerTap(const PlatformGestureEvent&);
+    bool handleGestureScrollUpdate(const PlatformGestureEvent&);
+    bool handleGestureScrollBegin(const PlatformGestureEvent&);
+    void clearGestureScrollNodes();
+
+    bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const;
+
+    OptionalCursor selectCursor(const HitTestResult&, bool shiftKey);
+
     void hoverTimerFired(Timer<EventHandler>*);
+    void cursorUpdateTimerFired(Timer<EventHandler>*);
 
     bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0);
 
     bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const;
     bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; }
 
-    static bool isKeyboardOptionTab(KeyboardEvent*);
-
     void fakeMouseMoveEventTimerFired(Timer<EventHandler>*);
     void cancelFakeMouseMoveEvent();
     bool isCursorVisible() const;
+    void updateCursor();
 
     bool isInsideScrollbar(const IntPoint&) const;
 
@@ -243,7 +234,6 @@
     Node* nodeUnderMouse() const;
 
     void updateMouseEventTargetNode(Node*, const PlatformMouseEvent&, bool fireMouseOverOut);
-    void fireMouseOverOut(bool fireMouseOver = true, bool fireMouseOut = true, bool updateLastNodeUnderMouse = true);
 
     MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&);
 
@@ -265,8 +255,6 @@
     bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult* hoveredNode = 0);
     bool passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe);
 
-    bool passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult* hoveredNode = 0);
-
     bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&, Scrollbar*);
 
     bool passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&);
@@ -279,8 +267,6 @@
     void defaultEscapeEventHandler(KeyboardEvent*);
     void defaultArrowEventHandler(FocusDirection, KeyboardEvent*);
 
-    DragSourceAction updateDragSourceActionsAllowed() const;
-
     void updateSelectionForMouseDrag(const HitTestResult&);
 
     void updateLastScrollbarUnderMouse(Scrollbar*, bool);
@@ -291,7 +277,7 @@
 
     bool isKeyEventAllowedInFullScreen(FullscreenElementStack*, const PlatformKeyboardEvent&) const;
 
-    bool handleGestureTapDown();
+    bool handleGestureShowPress();
 
     bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&);
 
@@ -321,6 +307,7 @@
     bool m_panScrollButtonPressed;
 
     Timer<EventHandler> m_hoverTimer;
+    Timer<EventHandler> m_cursorUpdateTimer;
 
     bool m_mouseDownMayStartAutoscroll;
     bool m_mouseDownWasInSubframe;
diff --git a/Source/core/page/EventSource.cpp b/Source/core/page/EventSource.cpp
index 6d069cc..b9963ca 100644
--- a/Source/core/page/EventSource.cpp
+++ b/Source/core/page/EventSource.cpp
@@ -40,16 +40,16 @@
 #include "core/dom/Document.h"
 #include "core/events/Event.h"
 #include "core/dom/ExceptionCode.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/events/MessageEvent.h"
-#include "core/dom/ScriptExecutionContext.h"
 #include "core/fetch/TextResourceDecoder.h"
 #include "core/loader/ThreadableLoader.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-#include "core/platform/network/ResourceError.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
+#include "platform/network/ResourceError.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/text/StringBuilder.h"
 
@@ -57,7 +57,7 @@
 
 const unsigned long long EventSource::defaultReconnectDelay = 3000;
 
-inline EventSource::EventSource(ScriptExecutionContext* context, const KURL& url, const Dictionary& eventSourceInit)
+inline EventSource::EventSource(ExecutionContext* context, const KURL& url, const Dictionary& eventSourceInit)
     : ActiveDOMObject(context)
     , m_url(url)
     , m_withCredentials(false)
@@ -72,7 +72,7 @@
     eventSourceInit.get("withCredentials", m_withCredentials);
 }
 
-PassRefPtr<EventSource> EventSource::create(ScriptExecutionContext* context, const String& url, const Dictionary& eventSourceInit, ExceptionState& es)
+PassRefPtr<EventSource> EventSource::create(ExecutionContext* context, const String& url, const Dictionary& eventSourceInit, ExceptionState& es)
 {
     if (url.isEmpty()) {
         es.throwDOMException(SyntaxError, "Cannot open an EventSource to an empty URL.");
@@ -124,7 +124,7 @@
     if (!m_lastEventId.isEmpty())
         request.setHTTPHeaderField("Last-Event-ID", m_lastEventId);
 
-    SecurityOrigin* origin = scriptExecutionContext()->securityOrigin();
+    SecurityOrigin* origin = executionContext()->securityOrigin();
 
     ThreadableLoaderOptions options;
     options.sendLoadCallbacks = SendCallbacks;
@@ -135,9 +135,9 @@
     options.crossOriginRequestPolicy = UseAccessControl;
     options.dataBufferingPolicy = DoNotBufferData;
     options.securityOrigin = origin;
-    options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective;
+    options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(executionContext()) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective;
 
-    m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options);
+    m_loader = ThreadableLoader::create(executionContext(), this, request, options);
 
     if (m_loader)
         m_requestInFlight = true;
@@ -160,7 +160,7 @@
 {
     m_state = CONNECTING;
     m_reconnectTimer.startOneShot(m_reconnectDelay / 1000.0);
-    dispatchEvent(Event::create(eventNames().errorEvent));
+    dispatchEvent(Event::create(EventTypeNames::error));
 }
 
 void EventSource::reconnectTimerFired(Timer<EventSource>*)
@@ -204,12 +204,12 @@
 
 const AtomicString& EventSource::interfaceName() const
 {
-    return eventNames().interfaceForEventSource;
+    return EventTargetNames::EventSource;
 }
 
-ScriptExecutionContext* EventSource::scriptExecutionContext() const
+ExecutionContext* EventSource::executionContext() const
 {
-    return ActiveDOMObject::scriptExecutionContext();
+    return ActiveDOMObject::executionContext();
 }
 
 void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& response)
@@ -231,7 +231,7 @@
             message.append(charset);
             message.appendLiteral("\") that is not UTF-8. Aborting the connection.");
             // FIXME: We are missing the source line.
-            scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message.toString());
+            executionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message.toString());
         }
     } else {
         // To keep the signal-to-noise ratio low, we only log 200-response with an invalid MIME type.
@@ -241,16 +241,16 @@
             message.append(response.mimeType());
             message.appendLiteral("\") that is not \"text/event-stream\". Aborting the connection.");
             // FIXME: We are missing the source line.
-            scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message.toString());
+            executionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message.toString());
         }
     }
 
     if (responseIsValid) {
         m_state = OPEN;
-        dispatchEvent(Event::create(eventNames().openEvent));
+        dispatchEvent(Event::create(EventTypeNames::open));
     } else {
         m_loader->cancel();
-        dispatchEvent(Event::create(eventNames().errorEvent));
+        dispatchEvent(Event::create(EventTypeNames::error));
     }
 }
 
@@ -293,7 +293,7 @@
 void EventSource::didFailAccessControlCheck(const ResourceError& error)
 {
     String message = "EventSource cannot load " + error.failingURL() + ". " + error.localizedDescription();
-    scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message);
+    executionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message);
 
     abortConnectionAttempt();
 }
@@ -311,7 +311,7 @@
     m_loader->cancel();
 
     ASSERT(m_state == CLOSED);
-    dispatchEvent(Event::create(eventNames().errorEvent));
+    dispatchEvent(Event::create(EventTypeNames::error));
 }
 
 void EventSource::parseEventStream()
@@ -416,19 +416,9 @@
 PassRefPtr<MessageEvent> EventSource::createMessageEvent()
 {
     RefPtr<MessageEvent> event = MessageEvent::create();
-    event->initMessageEvent(m_eventName.isEmpty() ? eventNames().messageEvent : AtomicString(m_eventName), false, false, SerializedScriptValue::create(String(m_data)), m_eventStreamOrigin, m_lastEventId, 0, nullptr);
+    event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : AtomicString(m_eventName), false, false, SerializedScriptValue::create(String(m_data)), m_eventStreamOrigin, m_lastEventId, 0, nullptr);
     m_data.clear();
     return event.release();
 }
 
-EventTargetData* EventSource::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* EventSource::ensureEventTargetData()
-{
-    return &m_eventTargetData;
-}
-
 } // namespace WebCore
diff --git a/Source/core/page/EventSource.h b/Source/core/page/EventSource.h
index 8a77c79..8410d1f 100644
--- a/Source/core/page/EventSource.h
+++ b/Source/core/page/EventSource.h
@@ -36,7 +36,7 @@
 #include "core/dom/ActiveDOMObject.h"
 #include "core/events/EventTarget.h"
 #include "core/loader/ThreadableLoaderClient.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "weborigin/KURL.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
@@ -50,10 +50,10 @@
 class TextResourceDecoder;
 class ThreadableLoader;
 
-class EventSource : public RefCounted<EventSource>, public ScriptWrappable, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
+class EventSource : public RefCounted<EventSource>, public ScriptWrappable, public EventTargetWithInlineData, private ThreadableLoaderClient, public ActiveDOMObject {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<EventSource> create(ScriptExecutionContext*, const String& url, const Dictionary&, ExceptionState&);
+    static PassRefPtr<EventSource> create(ExecutionContext*, const String& url, const Dictionary&, ExceptionState&);
     virtual ~EventSource();
 
     static const unsigned long long defaultReconnectDelay;
@@ -77,18 +77,16 @@
     using RefCounted<EventSource>::ref;
     using RefCounted<EventSource>::deref;
 
-    virtual const AtomicString& interfaceName() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const;
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
 
     virtual void stop();
 
 private:
-    EventSource(ScriptExecutionContext*, const KURL&, const Dictionary&);
+    EventSource(ExecutionContext*, const KURL&, const Dictionary&);
 
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
-    virtual EventTargetData* eventTargetData();
-    virtual EventTargetData* ensureEventTargetData();
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
 
     virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
     virtual void didReceiveData(const char*, int);
@@ -123,8 +121,6 @@
     String m_lastEventId;
     unsigned long long m_reconnectDelay;
     String m_eventStreamOrigin;
-
-    EventTargetData m_eventTargetData;
 };
 
 } // namespace WebCore
diff --git a/Source/core/page/EventSource.idl b/Source/core/page/EventSource.idl
index 6aeade1..b43938d 100644
--- a/Source/core/page/EventSource.idl
+++ b/Source/core/page/EventSource.idl
@@ -33,7 +33,7 @@
     GlobalContext=Window&WorkerGlobalScope,
     ActiveDOMObject,
     Constructor(DOMString url, optional Dictionary eventSourceInit),
-    ConstructorCallWith=ScriptExecutionContext,
+    ConstructorCallWith=ExecutionContext,
     ConstructorRaisesException
 ] interface EventSource : EventTarget {
 
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index 69a776b..f77ca1f 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -33,8 +33,6 @@
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/dom/ElementTraversal.h"
-#include "core/events/Event.h"
-#include "core/events/EventNames.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/Range.h"
 #include "core/dom/shadow/ElementShadow.h"
@@ -42,6 +40,8 @@
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
 #include "core/editing/htmlediting.h" // For firstPositionInOrBeforeNode
+#include "core/events/Event.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLAreaElement.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/html/HTMLTextAreaElement.h"
@@ -49,9 +49,9 @@
 #include "core/page/Chrome.h"
 #include "core/page/EditorClient.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/page/SpatialNavigation.h"
@@ -135,11 +135,25 @@
             return;
     }
 
-    if (!focused && document->focusedElement())
-        document->focusedElement()->dispatchBlurEvent(0);
-    document->dispatchWindowEvent(Event::create(focused ? eventNames().focusEvent : eventNames().blurEvent));
-    if (focused && document->focusedElement())
-        document->focusedElement()->dispatchFocusEvent(0, FocusDirectionPage);
+    if (!focused && document->focusedElement()) {
+        RefPtr<Element> focusedElement(document->focusedElement());
+        focusedElement->dispatchBlurEvent(0);
+        if (focusedElement == document->focusedElement()) {
+            focusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, 0);
+            if (focusedElement == document->focusedElement())
+                focusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOut, 0);
+        }
+    }
+    document->dispatchWindowEvent(Event::create(focused ? EventTypeNames::focus : EventTypeNames::blur));
+    if (focused && document->focusedElement()) {
+        RefPtr<Element> focusedElement(document->focusedElement());
+        focusedElement->dispatchFocusEvent(0, FocusDirectionPage);
+        if (focusedElement == document->focusedElement()) {
+            document->focusedElement()->dispatchFocusInEvent(EventTypeNames::focusin, 0);
+            if (focusedElement == document->focusedElement())
+                document->focusedElement()->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, 0);
+        }
+    }
 }
 
 static inline bool hasCustomFocusLogic(Element* element)
@@ -222,12 +236,12 @@
     // Now that the frame is updated, fire events and update the selection focused states of both frames.
     if (oldFrame && oldFrame->view()) {
         oldFrame->selection().setFocused(false);
-        oldFrame->document()->dispatchWindowEvent(Event::create(eventNames().blurEvent));
+        oldFrame->document()->dispatchWindowEvent(Event::create(EventTypeNames::blur));
     }
 
     if (newFrame && newFrame->view() && isFocused()) {
         newFrame->selection().setFocused(true);
-        newFrame->document()->dispatchWindowEvent(Event::create(eventNames().focusEvent));
+        newFrame->document()->dispatchWindowEvent(Event::create(EventTypeNames::focus));
     }
 
     m_isChangingFocusedFrame = false;
@@ -380,8 +394,7 @@
     if (caretBrowsing) {
         Position position = firstPositionInOrBeforeNode(element);
         VisibleSelection newSelection(position, position, DOWNSTREAM);
-        if (frame->selection().shouldChangeSelection(newSelection))
-            frame->selection().setSelection(newSelection);
+        frame->selection().setSelection(newSelection);
     }
 
     element->focus(false, direction);
@@ -559,13 +572,7 @@
 {
     ASSERT(node);
     ASSERT(node->rendererIsEditable());
-
-    Node* root = node->rootEditableElement();
-    Frame* frame = node->document().frame();
-    if (!frame || !root)
-        return false;
-
-    return frame->editor().shouldEndEditing(rangeOfContents(root).get());
+    return node->document().frame() && node->rootEditableElement();
 }
 
 static void clearSelectionIfNeeded(Frame* oldFocusedFrame, Frame* newFocusedFrame, Node* newFocusedNode)
@@ -628,7 +635,7 @@
         return true;
     }
 
-    RefPtr<Document> newDocument = &element->document();
+    RefPtr<Document> newDocument(element->document());
 
     if (newDocument && newDocument->focusedElement() == element)
         return true;
diff --git a/Source/core/page/FocusController.h b/Source/core/page/FocusController.h
index ff245c6..8abdb66 100644
--- a/Source/core/page/FocusController.h
+++ b/Source/core/page/FocusController.h
@@ -27,7 +27,7 @@
 #define FocusController_h
 
 #include "core/page/FocusDirection.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/Forward.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/page/Frame.cpp b/Source/core/page/Frame.cpp
deleted file mode 100644
index 7e1e409..0000000
--- a/Source/core/page/Frame.cpp
+++ /dev/null
@@ -1,720 +0,0 @@
-/*
- * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
- *                     1999 Lars Knoll <knoll@kde.org>
- *                     1999 Antti Koivisto <koivisto@kde.org>
- *                     2000 Simon Hausmann <hausmann@kde.org>
- *                     2000 Stefan Schimanski <1Stein@gmx.de>
- *                     2001 George Staikos <staikos@kde.org>
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
- * Copyright (C) 2008 Google Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/page/Frame.h"
-
-#include "RuntimeEnabledFeatures.h"
-#include "bindings/v8/ScriptController.h"
-#include "core/dom/DocumentType.h"
-#include "core/events/Event.h"
-#include "core/dom/WheelController.h"
-#include "core/editing/Editor.h"
-#include "core/editing/FrameSelection.h"
-#include "core/editing/InputMethodController.h"
-#include "core/editing/htmlediting.h"
-#include "core/editing/markup.h"
-#include "core/fetch/ResourceFetcher.h"
-#include "core/html/HTMLFrameElementBase.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/loader/FrameLoader.h"
-#include "core/loader/FrameLoaderClient.h"
-#include "core/page/Chrome.h"
-#include "core/page/ChromeClient.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/EventHandler.h"
-#include "core/page/FocusController.h"
-#include "core/page/FrameDestructionObserver.h"
-#include "core/page/FrameView.h"
-#include "core/page/Page.h"
-#include "core/page/Settings.h"
-#include "core/page/animation/AnimationController.h"
-#include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/platform/DragImage.h"
-#include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/graphics/ImageBuffer.h"
-#include "core/rendering/HitTestResult.h"
-#include "core/rendering/RenderLayerCompositor.h"
-#include "core/rendering/RenderPart.h"
-#include "core/rendering/RenderView.h"
-#include "core/svg/SVGDocument.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/RefCountedLeakCounter.h"
-#include "wtf/StdLibExtras.h"
-
-using namespace std;
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, frameCounter, ("Frame"));
-
-static inline Frame* parentFromOwnerElement(HTMLFrameOwnerElement* ownerElement)
-{
-    if (!ownerElement)
-        return 0;
-    return ownerElement->document().frame();
-}
-
-static inline float parentPageZoomFactor(Frame* frame)
-{
-    Frame* parent = frame->tree()->parent();
-    if (!parent)
-        return 1;
-    return parent->pageZoomFactor();
-}
-
-static inline float parentTextZoomFactor(Frame* frame)
-{
-    Frame* parent = frame->tree()->parent();
-    if (!parent)
-        return 1;
-    return parent->textZoomFactor();
-}
-
-inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* frameLoaderClient)
-    : m_page(page)
-    , m_treeNode(this, parentFromOwnerElement(ownerElement))
-    , m_loader(this, frameLoaderClient)
-    , m_navigationScheduler(this)
-    , m_ownerElement(ownerElement)
-    , m_script(adoptPtr(new ScriptController(this)))
-    , m_editor(adoptPtr(new Editor(*this)))
-    , m_selection(adoptPtr(new FrameSelection(this)))
-    , m_eventHandler(adoptPtr(new EventHandler(this)))
-    , m_animationController(adoptPtr(new AnimationController(this)))
-    , m_inputMethodController(InputMethodController::create(this))
-    , m_pageZoomFactor(parentPageZoomFactor(this))
-    , m_textZoomFactor(parentTextZoomFactor(this))
-#if ENABLE(ORIENTATION_EVENTS)
-    , m_orientation(0)
-#endif
-    , m_inViewSourceMode(false)
-{
-    ASSERT(page);
-
-    if (ownerElement) {
-        page->incrementSubframeCount();
-        ownerElement->setContentFrame(this);
-    }
-
-#ifndef NDEBUG
-    frameCounter.increment();
-#endif
-}
-
-PassRefPtr<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client)
-{
-    RefPtr<Frame> frame = adoptRef(new Frame(page, ownerElement, client));
-    if (!ownerElement)
-        page->setMainFrame(frame);
-    InspectorInstrumentation::frameAttachedToParent(frame.get());
-    return frame.release();
-}
-
-Frame::~Frame()
-{
-    setView(0);
-    loader()->clear(ClearScriptObjects | ClearWindowObject);
-
-    // FIXME: We should not be doing all this work inside the destructor
-
-#ifndef NDEBUG
-    frameCounter.decrement();
-#endif
-
-    disconnectOwnerElement();
-
-    HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.end();
-    for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it)
-        (*it)->frameDestroyed();
-}
-
-bool Frame::inScope(TreeScope* scope) const
-{
-    ASSERT(scope);
-    Document* doc = document();
-    if (!doc)
-        return false;
-    HTMLFrameOwnerElement* owner = doc->ownerElement();
-    if (!owner)
-        return false;
-    return &owner->treeScope() == scope;
-}
-
-void Frame::addDestructionObserver(FrameDestructionObserver* observer)
-{
-    m_destructionObservers.add(observer);
-}
-
-void Frame::removeDestructionObserver(FrameDestructionObserver* observer)
-{
-    m_destructionObservers.remove(observer);
-}
-
-void Frame::setView(PassRefPtr<FrameView> view)
-{
-    // We the custom scroll bars as early as possible to prevent m_doc->detach()
-    // from messing with the view such that its scroll bars won't be torn down.
-    // FIXME: We should revisit this.
-    if (m_view)
-        m_view->prepareForDetach();
-
-    // Prepare for destruction now, so any unload event handlers get run and the DOMWindow is
-    // notified. If we wait until the view is destroyed, then things won't be hooked up enough for
-    // these calls to work.
-    if (!view && document() && document()->attached()) {
-        // FIXME: We don't call willRemove here. Why is that OK?
-        document()->prepareForDestruction();
-    }
-
-    if (m_view)
-        m_view->unscheduleRelayout();
-
-    eventHandler()->clear();
-
-    m_view = view;
-
-    if (m_view && m_page && m_page->mainFrame() == this)
-        m_view->setVisibleContentScaleFactor(m_page->pageScaleFactor());
-}
-
-#if ENABLE(ORIENTATION_EVENTS)
-void Frame::sendOrientationChangeEvent(int orientation)
-{
-    m_orientation = orientation;
-    if (Document* doc = document())
-        doc->dispatchWindowEvent(Event::create(eventNames().orientationchangeEvent));
-}
-#endif // ENABLE(ORIENTATION_EVENTS)
-
-Settings* Frame::settings() const
-{
-    return m_page ? &m_page->settings() : 0;
-}
-
-void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize)
-{
-    // In setting printing, we should not validate resources already cached for the document.
-    // See https://bugs.webkit.org/show_bug.cgi?id=43704
-    ResourceCacheValidationSuppressor validationSuppressor(document()->fetcher());
-
-    document()->setPrinting(printing);
-    view()->adjustMediaTypeForPrinting(printing);
-
-    document()->styleResolverChanged(RecalcStyleImmediately);
-    if (shouldUsePrintingLayout()) {
-        view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize);
-    } else {
-        view()->forceLayout();
-        if (shouldAdjustViewSize == AdjustViewSize)
-            view()->adjustViewSize();
-    }
-
-    // Subframes of the one we're printing don't lay out to the page size.
-    for (RefPtr<Frame> child = tree()->firstChild(); child; child = child->tree()->nextSibling())
-        child->setPrinting(printing, FloatSize(), FloatSize(), 0, shouldAdjustViewSize);
-}
-
-bool Frame::shouldUsePrintingLayout() const
-{
-    // Only top frame being printed should be fit to page size.
-    // Subframes should be constrained by parents only.
-    return document()->printing() && (!tree()->parent() || !tree()->parent()->document()->printing());
-}
-
-FloatSize Frame::resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize)
-{
-    FloatSize resultSize;
-    if (!contentRenderer())
-        return FloatSize();
-
-    if (contentRenderer()->style()->isHorizontalWritingMode()) {
-        ASSERT(fabs(originalSize.width()) > numeric_limits<float>::epsilon());
-        float ratio = originalSize.height() / originalSize.width();
-        resultSize.setWidth(floorf(expectedSize.width()));
-        resultSize.setHeight(floorf(resultSize.width() * ratio));
-    } else {
-        ASSERT(fabs(originalSize.height()) > numeric_limits<float>::epsilon());
-        float ratio = originalSize.width() / originalSize.height();
-        resultSize.setHeight(floorf(expectedSize.height()));
-        resultSize.setWidth(floorf(resultSize.height() * ratio));
-    }
-    return resultSize;
-}
-
-void Frame::setDOMWindow(PassRefPtr<DOMWindow> domWindow)
-{
-    m_domWindow = domWindow;
-}
-
-Document* Frame::document() const
-{
-    return m_domWindow ? m_domWindow->document() : 0;
-}
-
-RenderView* Frame::contentRenderer() const
-{
-    return document() ? document()->renderView() : 0;
-}
-
-RenderPart* Frame::ownerRenderer() const
-{
-    HTMLFrameOwnerElement* ownerElement = m_ownerElement;
-    if (!ownerElement)
-        return 0;
-    RenderObject* object = ownerElement->renderer();
-    if (!object)
-        return 0;
-    // FIXME: If <object> is ever fixed to disassociate itself from frames
-    // that it has started but canceled, then this can turn into an ASSERT
-    // since m_ownerElement would be 0 when the load is canceled.
-    // https://bugs.webkit.org/show_bug.cgi?id=18585
-    if (!object->isRenderPart())
-        return 0;
-    return toRenderPart(object);
-}
-
-Frame* Frame::frameForWidget(const Widget* widget)
-{
-    ASSERT_ARG(widget, widget);
-
-    if (RenderWidget* renderer = RenderWidget::find(widget)) {
-        if (Node* node = renderer->node())
-            return node->document().frame();
-    }
-
-    // Assume all widgets are either a FrameView or owned by a RenderWidget.
-    // FIXME: That assumption is not right for scroll bars!
-    ASSERT_WITH_SECURITY_IMPLICATION(widget->isFrameView());
-    return &toFrameView(widget)->frame();
-}
-
-void Frame::clearTimers(FrameView *view, Document *document)
-{
-    if (view) {
-        view->unscheduleRelayout();
-        if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
-            view->frame().animation()->suspendAnimationsForDocument(document);
-        view->frame().eventHandler()->stopAutoscrollTimer();
-    }
-}
-
-void Frame::clearTimers()
-{
-    clearTimers(m_view.get(), document());
-}
-
-void Frame::dispatchVisibilityStateChangeEvent()
-{
-    if (document())
-        document()->dispatchVisibilityStateChangeEvent();
-
-    Vector<RefPtr<Frame> > childFrames;
-    for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
-        childFrames.append(child);
-
-    for (size_t i = 0; i < childFrames.size(); ++i)
-        childFrames[i]->dispatchVisibilityStateChangeEvent();
-}
-
-void Frame::willDetachPage()
-{
-    // We should never be detatching the page during a Layout.
-    RELEASE_ASSERT(!m_view || !m_view->isInLayout());
-
-    if (Frame* parent = tree()->parent())
-        parent->loader()->checkLoadComplete();
-
-    HashSet<FrameDestructionObserver*>::iterator stop = m_destructionObservers.end();
-    for (HashSet<FrameDestructionObserver*>::iterator it = m_destructionObservers.begin(); it != stop; ++it)
-        (*it)->willDetachPage();
-
-    // FIXME: It's unclear as to why this is called more than once, but it is,
-    // so page() could be NULL.
-    if (page() && page()->focusController().focusedFrame() == this)
-        page()->focusController().setFocusedFrame(0);
-
-    if (page() && page()->scrollingCoordinator() && m_view)
-        page()->scrollingCoordinator()->willDestroyScrollableArea(m_view.get());
-
-    script()->clearScriptObjects();
-}
-
-void Frame::detachFromPage()
-{
-    // We should never be detatching the page during a Layout.
-    RELEASE_ASSERT(!m_view || !m_view->isInLayout());
-    m_page = 0;
-}
-
-void Frame::disconnectOwnerElement()
-{
-    if (m_ownerElement) {
-        if (Document* doc = document())
-            doc->topDocument()->clearAXObjectCache();
-        m_ownerElement->clearContentFrame();
-        if (m_page)
-            m_page->decrementSubframeCount();
-    }
-    m_ownerElement = 0;
-}
-
-String Frame::documentTypeString() const
-{
-    if (DocumentType* doctype = document()->doctype())
-        return createMarkup(doctype);
-
-    return String();
-}
-
-String Frame::displayStringModifiedByEncoding(const String& str) const
-{
-    return document() ? document()->displayStringModifiedByEncoding(str) : str;
-}
-
-String Frame::selectedText() const
-{
-    return selection().selectedText();
-}
-
-String Frame::selectedTextForClipboard() const
-{
-    return selection().selectedTextForClipboard();
-}
-
-VisiblePosition Frame::visiblePositionForPoint(const IntPoint& framePoint)
-{
-    HitTestResult result = eventHandler()->hitTestResultAtPoint(framePoint);
-    Node* node = result.innerNonSharedNode();
-    if (!node)
-        return VisiblePosition();
-    RenderObject* renderer = node->renderer();
-    if (!renderer)
-        return VisiblePosition();
-    VisiblePosition visiblePos = VisiblePosition(renderer->positionForPoint(result.localPoint()));
-    if (visiblePos.isNull())
-        visiblePos = firstPositionInOrBeforeNode(node);
-    return visiblePos;
-}
-
-Document* Frame::documentAtPoint(const IntPoint& point)
-{
-    if (!view())
-        return 0;
-
-    IntPoint pt = view()->windowToContents(point);
-    HitTestResult result = HitTestResult(pt);
-
-    if (contentRenderer())
-        result = eventHandler()->hitTestResultAtPoint(pt, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
-    return result.innerNode() ? &result.innerNode()->document() : 0;
-}
-
-PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint)
-{
-    VisiblePosition position = visiblePositionForPoint(framePoint);
-    if (position.isNull())
-        return 0;
-
-    VisiblePosition previous = position.previous();
-    if (previous.isNotNull()) {
-        RefPtr<Range> previousCharacterRange = makeRange(previous, position);
-        LayoutRect rect = editor().firstRectForRange(previousCharacterRange.get());
-        if (rect.contains(framePoint))
-            return previousCharacterRange.release();
-    }
-
-    VisiblePosition next = position.next();
-    if (RefPtr<Range> nextCharacterRange = makeRange(position, next)) {
-        LayoutRect rect = editor().firstRectForRange(nextCharacterRange.get());
-        if (rect.contains(framePoint))
-            return nextCharacterRange.release();
-    }
-
-    return 0;
-}
-
-void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent,
-    const IntSize& fixedLayoutSize, bool useFixedLayout, ScrollbarMode horizontalScrollbarMode, bool horizontalLock,
-    ScrollbarMode verticalScrollbarMode, bool verticalLock)
-{
-    ASSERT(this);
-    ASSERT(m_page);
-
-    bool isMainFrame = this == m_page->mainFrame();
-
-    if (isMainFrame && view())
-        view()->setParentVisible(false);
-
-    setView(0);
-
-    RefPtr<FrameView> frameView;
-    if (isMainFrame) {
-        frameView = FrameView::create(this, viewportSize);
-        frameView->setFixedLayoutSize(fixedLayoutSize);
-        frameView->setUseFixedLayout(useFixedLayout);
-    } else
-        frameView = FrameView::create(this);
-
-    frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock);
-
-    setView(frameView);
-
-    if (backgroundColor.isValid())
-        frameView->updateBackgroundRecursively(backgroundColor, transparent);
-
-    if (isMainFrame)
-        frameView->setParentVisible(true);
-
-    if (ownerRenderer())
-        ownerRenderer()->setWidget(frameView);
-
-    if (HTMLFrameOwnerElement* owner = ownerElement())
-        view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOff);
-}
-
-String Frame::layerTreeAsText(unsigned flags) const
-{
-    document()->updateLayout();
-
-    if (!contentRenderer())
-        return String();
-
-    return contentRenderer()->compositor()->layerTreeAsText(static_cast<LayerTreeFlags>(flags));
-}
-
-String Frame::trackedRepaintRectsAsText() const
-{
-    if (!m_view)
-        return String();
-    return m_view->trackedRepaintRectsAsText();
-}
-
-void Frame::setPageZoomFactor(float factor)
-{
-    setPageAndTextZoomFactors(factor, m_textZoomFactor);
-}
-
-void Frame::setTextZoomFactor(float factor)
-{
-    setPageAndTextZoomFactors(m_pageZoomFactor, factor);
-}
-
-void Frame::setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor)
-{
-    if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor)
-        return;
-
-    Page* page = this->page();
-    if (!page)
-        return;
-
-    Document* document = this->document();
-    if (!document)
-        return;
-
-    // Respect SVGs zoomAndPan="disabled" property in standalone SVG documents.
-    // FIXME: How to handle compound documents + zoomAndPan="disabled"? Needs SVG WG clarification.
-    if (document->isSVGDocument()) {
-        if (!toSVGDocument(document)->zoomAndPanEnabled())
-            return;
-    }
-
-    if (m_pageZoomFactor != pageZoomFactor) {
-        if (FrameView* view = this->view()) {
-            // Update the scroll position when doing a full page zoom, so the content stays in relatively the same position.
-            LayoutPoint scrollPosition = view->scrollPosition();
-            float percentDifference = (pageZoomFactor / m_pageZoomFactor);
-            view->setScrollPosition(IntPoint(scrollPosition.x() * percentDifference, scrollPosition.y() * percentDifference));
-        }
-    }
-
-    m_pageZoomFactor = pageZoomFactor;
-    m_textZoomFactor = textZoomFactor;
-
-    document->recalcStyle(Force);
-
-    for (RefPtr<Frame> child = tree()->firstChild(); child; child = child->tree()->nextSibling())
-        child->setPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor);
-
-    if (FrameView* view = this->view()) {
-        if (document->renderer() && document->renderer()->needsLayout() && view->didFirstLayout())
-            view->layout();
-    }
-}
-
-void Frame::deviceOrPageScaleFactorChanged()
-{
-    for (RefPtr<Frame> child = tree()->firstChild(); child; child = child->tree()->nextSibling())
-        child->deviceOrPageScaleFactorChanged();
-
-    m_page->chrome().client().deviceOrPageScaleFactorChanged();
-}
-
-void Frame::notifyChromeClientWheelEventHandlerCountChanged() const
-{
-    // Ensure that this method is being called on the main frame of the page.
-    ASSERT(m_page && m_page->mainFrame() == this);
-
-    unsigned count = 0;
-    for (const Frame* frame = this; frame; frame = frame->tree()->traverseNext()) {
-        if (frame->document())
-            count += WheelController::from(frame->document())->wheelEventHandlerCount();
-    }
-
-    m_page->chrome().client().numWheelEventHandlersChanged(count);
-}
-
-bool Frame::isURLAllowed(const KURL& url) const
-{
-    // We allow one level of self-reference because some sites depend on that,
-    // but we don't allow more than one.
-    if (m_page->subframeCount() >= Page::maxNumberOfFrames)
-        return false;
-    bool foundSelfReference = false;
-    for (const Frame* frame = this; frame; frame = frame->tree()->parent()) {
-        if (equalIgnoringFragmentIdentifier(frame->document()->url(), url)) {
-            if (foundSelfReference)
-                return false;
-            foundSelfReference = true;
-        }
-    }
-    return true;
-}
-
-struct ScopedFramePaintingState {
-    ScopedFramePaintingState(Frame* frame, Node* node)
-        : frame(frame)
-        , node(node)
-        , paintBehavior(frame->view()->paintBehavior())
-        , backgroundColor(frame->view()->baseBackgroundColor())
-    {
-        ASSERT(!node || node->renderer());
-        if (node)
-            node->renderer()->updateDragState(true);
-    }
-
-    ~ScopedFramePaintingState()
-    {
-        if (node && node->renderer())
-            node->renderer()->updateDragState(false);
-        frame->view()->setPaintBehavior(paintBehavior);
-        frame->view()->setBaseBackgroundColor(backgroundColor);
-        frame->view()->setNodeToDraw(0);
-    }
-
-    Frame* frame;
-    Node* node;
-    PaintBehavior paintBehavior;
-    Color backgroundColor;
-};
-
-PassOwnPtr<DragImage> Frame::nodeImage(Node* node)
-{
-    if (!node->renderer())
-        return nullptr;
-
-    const ScopedFramePaintingState state(this, node);
-
-    m_view->setPaintBehavior(state.paintBehavior | PaintBehaviorFlattenCompositingLayers);
-
-    // When generating the drag image for an element, ignore the document background.
-    m_view->setBaseBackgroundColor(Color::transparent);
-    document()->updateLayout();
-    m_view->setNodeToDraw(node); // Enable special sub-tree drawing mode.
-
-    // Document::updateLayout may have blown away the original RenderObject.
-    RenderObject* renderer = node->renderer();
-    if (!renderer)
-        return nullptr;
-
-    LayoutRect topLevelRect;
-    IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLevelRect));
-
-    float deviceScaleFactor = 1;
-    if (m_page)
-        deviceScaleFactor = m_page->deviceScaleFactor();
-    paintingRect.setWidth(paintingRect.width() * deviceScaleFactor);
-    paintingRect.setHeight(paintingRect.height() * deviceScaleFactor);
-
-    OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor));
-    if (!buffer)
-        return nullptr;
-    buffer->context()->translate(-paintingRect.x(), -paintingRect.y());
-    buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY()));
-
-    m_view->paintContents(buffer->context(), paintingRect);
-
-    RefPtr<Image> image = buffer->copyImage();
-    return DragImage::create(image.get(), renderer->shouldRespectImageOrientation());
-}
-
-PassOwnPtr<DragImage> Frame::dragImageForSelection()
-{
-    if (!selection().isRange())
-        return nullptr;
-
-    const ScopedFramePaintingState state(this, 0);
-    m_view->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorFlattenCompositingLayers);
-    document()->updateLayout();
-
-    IntRect paintingRect = enclosingIntRect(selection().bounds());
-
-    float deviceScaleFactor = 1;
-    if (m_page)
-        deviceScaleFactor = m_page->deviceScaleFactor();
-    paintingRect.setWidth(paintingRect.width() * deviceScaleFactor);
-    paintingRect.setHeight(paintingRect.height() * deviceScaleFactor);
-
-    OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor));
-    if (!buffer)
-        return nullptr;
-    buffer->context()->translate(-paintingRect.x(), -paintingRect.y());
-    buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY()));
-
-    m_view->paintContents(buffer->context(), paintingRect);
-
-    RefPtr<Image> image = buffer->copyImage();
-    return DragImage::create(image.get());
-}
-
-double Frame::devicePixelRatio() const
-{
-    if (!m_page)
-        return 0;
-
-    double ratio = m_page->deviceScaleFactor();
-    if (RuntimeEnabledFeatures::devicePixelRatioIncludesZoomEnabled())
-        ratio *= pageZoomFactor();
-    return ratio;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/Frame.h b/Source/core/page/Frame.h
deleted file mode 100644
index 1a912eb..0000000
--- a/Source/core/page/Frame.h
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
- *                     1999-2001 Lars Knoll <knoll@kde.org>
- *                     1999-2001 Antti Koivisto <koivisto@kde.org>
- *                     2000-2001 Simon Hausmann <hausmann@kde.org>
- *                     2000-2001 Dirk Mueller <mueller@kde.org>
- *                     2000 Stefan Schimanski <1Stein@gmx.de>
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef Frame_h
-#define Frame_h
-
-#include "core/loader/FrameLoader.h"
-#include "core/loader/NavigationScheduler.h"
-#include "core/page/AdjustViewSizeOrNot.h"
-#include "core/page/FrameTree.h"
-#include "core/platform/ScrollTypes.h"
-#include "core/platform/graphics/IntSize.h"
-#include "wtf/Forward.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-    class AnimationController;
-    class Color;
-    class DOMWindow;
-    class Document;
-    class DragImage;
-    class Editor;
-    class Element;
-    class EventHandler;
-    class FetchContext;
-    class FloatSize;
-    class FrameDestructionObserver;
-    class FrameSelection;
-    class FrameView;
-    class HTMLFrameOwnerElement;
-    class HTMLTableCellElement;
-    class InputMethodController;
-    class IntPoint;
-    class Node;
-    class Range;
-    class RenderPart;
-    class RenderView;
-    class TreeScope;
-    class ScriptController;
-    class Settings;
-    class TreeScope;
-    class VisiblePosition;
-    class Widget;
-
-    class Frame : public RefCounted<Frame> {
-    public:
-        static PassRefPtr<Frame> create(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
-
-        void init();
-        void setView(PassRefPtr<FrameView>);
-        void createView(const IntSize&, const Color&, bool,
-            const IntSize& fixedLayoutSize = IntSize(), bool useFixedLayout = false, ScrollbarMode = ScrollbarAuto, bool horizontalLock = false,
-            ScrollbarMode = ScrollbarAuto, bool verticalLock = false);
-
-        ~Frame();
-
-        void addDestructionObserver(FrameDestructionObserver*);
-        void removeDestructionObserver(FrameDestructionObserver*);
-
-        void willDetachPage();
-        void detachFromPage();
-        void disconnectOwnerElement();
-
-        Page* page() const;
-        HTMLFrameOwnerElement* ownerElement() const;
-
-        void setDOMWindow(PassRefPtr<DOMWindow>);
-        DOMWindow* domWindow() const;
-        Document* document() const;
-        FrameView* view() const;
-
-        Editor& editor() const;
-        EventHandler* eventHandler() const;
-        FrameLoader* loader() const;
-        NavigationScheduler* navigationScheduler() const;
-        FrameSelection& selection() const;
-        FrameTree* tree() const;
-        AnimationController* animation() const;
-        InputMethodController& inputMethodController() const;
-        FetchContext& fetchContext() const { return loader()->fetchContext(); }
-        ScriptController* script();
-
-        RenderView* contentRenderer() const; // Root of the render tree for the document contained in this frame.
-        RenderPart* ownerRenderer() const; // Renderer for the element that contains this frame.
-
-        void dispatchVisibilityStateChangeEvent();
-
-    // ======== All public functions below this point are candidates to move out of Frame into another class. ========
-
-        bool inScope(TreeScope*) const;
-
-        // See GraphicsLayerClient.h for accepted flags.
-        String layerTreeAsText(unsigned flags = 0) const;
-        String trackedRepaintRectsAsText() const;
-
-        static Frame* frameForWidget(const Widget*);
-
-        Settings* settings() const; // can be NULL
-
-        void setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot);
-        bool shouldUsePrintingLayout() const;
-        FloatSize resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize);
-
-        bool inViewSourceMode() const;
-        void setInViewSourceMode(bool = true);
-
-        void setPageZoomFactor(float factor);
-        float pageZoomFactor() const { return m_pageZoomFactor; }
-        void setTextZoomFactor(float factor);
-        float textZoomFactor() const { return m_textZoomFactor; }
-        void setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor);
-
-        void deviceOrPageScaleFactorChanged();
-        double devicePixelRatio() const;
-
-#if ENABLE(ORIENTATION_EVENTS)
-        // Orientation is the interface orientation in degrees. Some examples are:
-        //  0 is straight up; -90 is when the device is rotated 90 clockwise;
-        //  90 is when rotated counter clockwise.
-        void sendOrientationChangeEvent(int orientation);
-        int orientation() const { return m_orientation; }
-#endif
-
-        void clearTimers();
-        static void clearTimers(FrameView*, Document*);
-
-        String documentTypeString() const;
-
-        String displayStringModifiedByEncoding(const String&) const;
-
-        PassOwnPtr<DragImage> nodeImage(Node*);
-        PassOwnPtr<DragImage> dragImageForSelection();
-
-        String selectedText() const;
-        String selectedTextForClipboard() const;
-
-        VisiblePosition visiblePositionForPoint(const IntPoint& framePoint);
-        Document* documentAtPoint(const IntPoint& windowPoint);
-        PassRefPtr<Range> rangeForPoint(const IntPoint& framePoint);
-
-        // Should only be called on the main frame of a page.
-        void notifyChromeClientWheelEventHandlerCountChanged() const;
-
-        bool isURLAllowed(const KURL&) const;
-
-    // ========
-
-    private:
-        Frame(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
-
-        HashSet<FrameDestructionObserver*> m_destructionObservers;
-
-        Page* m_page;
-        mutable FrameTree m_treeNode;
-        mutable FrameLoader m_loader;
-        mutable NavigationScheduler m_navigationScheduler;
-
-        HTMLFrameOwnerElement* m_ownerElement;
-        RefPtr<FrameView> m_view;
-        RefPtr<DOMWindow> m_domWindow;
-
-        OwnPtr<ScriptController> m_script;
-        const OwnPtr<Editor> m_editor;
-        const OwnPtr<FrameSelection> m_selection;
-        OwnPtr<EventHandler> m_eventHandler;
-        OwnPtr<AnimationController> m_animationController;
-        OwnPtr<InputMethodController> m_inputMethodController;
-
-        float m_pageZoomFactor;
-        float m_textZoomFactor;
-
-#if ENABLE(ORIENTATION_EVENTS)
-        int m_orientation;
-#endif
-
-        bool m_inViewSourceMode;
-    };
-
-    inline void Frame::init()
-    {
-        m_loader.init();
-    }
-
-    inline FrameLoader* Frame::loader() const
-    {
-        return &m_loader;
-    }
-
-    inline NavigationScheduler* Frame::navigationScheduler() const
-    {
-        return &m_navigationScheduler;
-    }
-
-    inline FrameView* Frame::view() const
-    {
-        return m_view.get();
-    }
-
-    inline ScriptController* Frame::script()
-    {
-        return m_script.get();
-    }
-
-    inline DOMWindow* Frame::domWindow() const
-    {
-        return m_domWindow.get();
-    }
-
-    inline FrameSelection& Frame::selection() const
-    {
-        return *m_selection;
-    }
-
-    inline Editor& Frame::editor() const
-    {
-        return *m_editor;
-    }
-
-    inline AnimationController* Frame::animation() const
-    {
-        return m_animationController.get();
-    }
-
-    inline InputMethodController& Frame::inputMethodController() const
-    {
-        return *m_inputMethodController;
-    }
-
-    inline HTMLFrameOwnerElement* Frame::ownerElement() const
-    {
-        return m_ownerElement;
-    }
-
-    inline bool Frame::inViewSourceMode() const
-    {
-        return m_inViewSourceMode;
-    }
-
-    inline void Frame::setInViewSourceMode(bool mode)
-    {
-        m_inViewSourceMode = mode;
-    }
-
-    inline FrameTree* Frame::tree() const
-    {
-        return &m_treeNode;
-    }
-
-    inline Page* Frame::page() const
-    {
-        return m_page;
-    }
-
-    inline EventHandler* Frame::eventHandler() const
-    {
-        return m_eventHandler.get();
-    }
-
-} // namespace WebCore
-
-#endif // Frame_h
diff --git a/Source/core/page/FrameActionScheduler.cpp b/Source/core/page/FrameActionScheduler.cpp
deleted file mode 100644
index ff47c51..0000000
--- a/Source/core/page/FrameActionScheduler.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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/page/FrameActionScheduler.h"
-
-#include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/events/Event.h"
-#include "core/dom/Node.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class EventFrameAction : public FrameAction {
-public:
-    EventFrameAction(PassRefPtr<Event> event, PassRefPtr<Node> target)
-        : m_event(event)
-        , m_eventTarget(target)
-    {
-    }
-
-    virtual void fire()
-    {
-        // Only dispatch events to nodes that are in the document
-        if (m_eventTarget->inDocument())
-            m_eventTarget->dispatchEvent(m_event, IGNORE_EXCEPTION);
-    }
-
-private:
-    RefPtr<Event> m_event;
-    RefPtr<Node> m_eventTarget;
-};
-
-FrameActionScheduler::FrameActionScheduler()
-    : m_enqueueActions(0)
-{
-}
-
-FrameActionScheduler::~FrameActionScheduler()
-{
-    clear();
-}
-
-bool FrameActionScheduler::isEmpty() const
-{
-    return m_scheduledActions.isEmpty();
-}
-
-void FrameActionScheduler::clear()
-{
-    m_scheduledActions.clear();
-    m_enqueueActions = 0;
-}
-
-void FrameActionScheduler::pause()
-{
-    ASSERT(isEmpty() || m_enqueueActions);
-    m_enqueueActions++;
-}
-
-void FrameActionScheduler::resume()
-{
-    m_enqueueActions--;
-    if (!m_enqueueActions)
-        dispatch();
-    ASSERT(isEmpty() || m_enqueueActions);
-}
-
-void FrameActionScheduler::dispatch()
-{
-    Vector< OwnPtr<FrameAction> > snapshot;
-    m_scheduledActions.swap(snapshot);
-
-    for (Vector< OwnPtr<FrameAction> >::iterator i = snapshot.begin(); i != snapshot.end(); ++i)
-        (*i)->fire();
-}
-
-void FrameActionScheduler::scheduleAction(PassOwnPtr<FrameAction> action)
-{
-    m_scheduledActions.append(action);
-}
-
-void FrameActionScheduler::scheduleEvent(PassRefPtr<Event> event, PassRefPtr<Node> eventTarget)
-{
-    scheduleAction(adoptPtr(new EventFrameAction(event, eventTarget)));
-}
-
-
-} // namespace WebCore
diff --git a/Source/core/page/FrameActionScheduler.h b/Source/core/page/FrameActionScheduler.h
deleted file mode 100644
index a4143be..0000000
--- a/Source/core/page/FrameActionScheduler.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 FrameActionScheduler_h
-#define FrameActionScheduler_h
-
-#include "wtf/FastAllocBase.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class Node;
-class Event;
-
-class FrameAction {
-    WTF_MAKE_FAST_ALLOCATED;
-    WTF_MAKE_NONCOPYABLE(FrameAction);
-public:
-    FrameAction() {}
-    virtual ~FrameAction() {}
-    virtual void fire() = 0;
-};
-
-class FrameActionScheduler {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    FrameActionScheduler();
-    ~FrameActionScheduler();
-
-    bool isEmpty() const;
-    // FIXME: Why is this < m_enqueueActions, does this
-    // mean that the steady state of m_enqueueActions should be -1?
-    bool isScheduled() const { return 0 < m_enqueueActions; }
-    void clear();
-    void pause();
-    void resume();
-
-    void scheduleAction(PassOwnPtr<FrameAction>);
-    void scheduleEvent(PassRefPtr<Event>, PassRefPtr<Node>);
-
-private:
-    void dispatch();
-
-    unsigned m_enqueueActions;
-    Vector< OwnPtr<FrameAction> > m_scheduledActions;
-};
-
-} // namespace WebCore
-
-#endif // FrameActionScheduler_h
diff --git a/Source/core/page/FrameDestructionObserver.cpp b/Source/core/page/FrameDestructionObserver.cpp
deleted file mode 100644
index 528c45f..0000000
--- a/Source/core/page/FrameDestructionObserver.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2011 Google, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GOOGLE 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/page/FrameDestructionObserver.h"
-
-#include "core/page/Frame.h"
-
-namespace WebCore {
-
-FrameDestructionObserver::FrameDestructionObserver(Frame* frame)
-    : m_frame(0)
-{
-    observeFrame(frame);
-}
-
-FrameDestructionObserver::~FrameDestructionObserver()
-{
-    observeFrame(0);
-
-}
-
-void FrameDestructionObserver::observeFrame(Frame* frame)
-{
-    if (m_frame)
-        m_frame->removeDestructionObserver(this);
-
-    m_frame = frame;
-
-    if (m_frame)
-        m_frame->addDestructionObserver(this);
-}
-
-void FrameDestructionObserver::frameDestroyed()
-{
-    m_frame = 0;
-}
-
-void FrameDestructionObserver::willDetachPage()
-{
-    // Subclasses should override this function to handle this notification.
-}
-
-}
diff --git a/Source/core/page/FrameTree.cpp b/Source/core/page/FrameTree.cpp
index 47e59ad..7dbe45e 100644
--- a/Source/core/page/FrameTree.cpp
+++ b/Source/core/page/FrameTree.cpp
@@ -22,8 +22,8 @@
 #include "core/page/FrameTree.h"
 
 #include "core/dom/Document.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/PageGroup.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp
deleted file mode 100644
index 26a418a..0000000
--- a/Source/core/page/FrameView.cpp
+++ /dev/null
@@ -1,3420 +0,0 @@
-/*
- * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
- *                     1999 Lars Knoll <knoll@kde.org>
- *                     1999 Antti Koivisto <koivisto@kde.org>
- *                     2000 Dirk Mueller <mueller@kde.org>
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
- *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
- *           (C) 2006 Alexey Proskuryakov (ap@nypop.com)
- * Copyright (C) 2009 Google Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/page/FrameView.h"
-
-#include "HTMLNames.h"
-#include "RuntimeEnabledFeatures.h"
-#include "core/accessibility/AXObjectCache.h"
-#include "core/animation/DocumentTimeline.h"
-#include "core/css/FontFaceSet.h"
-#include "core/css/resolver/StyleResolver.h"
-#include "core/dom/DocumentMarkerController.h"
-#include "core/events/OverflowEvent.h"
-#include "core/editing/FrameSelection.h"
-#include "core/fetch/ResourceFetcher.h"
-#include "core/fetch/TextResourceDecoder.h"
-#include "core/html/HTMLFrameElement.h"
-#include "core/html/HTMLHtmlElement.h"
-#include "core/html/HTMLPlugInImageElement.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/loader/FrameLoader.h"
-#include "core/loader/FrameLoaderClient.h"
-#include "core/page/Chrome.h"
-#include "core/page/ChromeClient.h"
-#include "core/page/EventHandler.h"
-#include "core/page/FocusController.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameActionScheduler.h"
-#include "core/page/FrameTree.h"
-#include "core/page/Settings.h"
-#include "core/page/animation/AnimationController.h"
-#include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/platform/ScrollAnimator.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/FontCache.h"
-#include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/text/TextStream.h"
-#include "core/rendering/LayoutIndicator.h"
-#include "core/rendering/RenderCounter.h"
-#include "core/rendering/RenderEmbeddedObject.h"
-#include "core/rendering/RenderLayer.h"
-#include "core/rendering/RenderLayerBacking.h"
-#include "core/rendering/RenderLayerCompositor.h"
-#include "core/rendering/RenderPart.h"
-#include "core/rendering/RenderScrollbar.h"
-#include "core/rendering/RenderScrollbarPart.h"
-#include "core/rendering/RenderTheme.h"
-#include "core/rendering/RenderView.h"
-#include "core/rendering/TextAutosizer.h"
-#include "core/rendering/style/RenderStyle.h"
-#include "core/rendering/svg/RenderSVGRoot.h"
-#include "core/svg/SVGDocument.h"
-#include "core/svg/SVGSVGElement.h"
-
-#include "wtf/CurrentTime.h"
-#include "wtf/TemporaryChange.h"
-
-#include "core/platform/chromium/TraceEvent.h"
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-double FrameView::s_currentFrameTimeStamp = 0.0;
-bool FrameView::s_inPaintContents = false;
-
-
-// REPAINT_THROTTLING now chooses default values for throttling parameters.
-// Should be removed when applications start using runtime configuration.
-#if ENABLE(REPAINT_THROTTLING)
-// Normal delay
-double FrameView::s_normalDeferredRepaintDelay = 0.016;
-// Negative value would mean that first few repaints happen without a delay
-double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0;
-// The delay grows on each repaint to this maximum value
-double FrameView::s_maxDeferredRepaintDelayDuringLoading = 2.5;
-// On each repaint the delay increses by this amount
-double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0.5;
-#else
-// FIXME: Repaint throttling could be good to have on all platform.
-// The balance between CPU use and repaint frequency will need some tuning for desktop.
-// More hooks may be needed to reset the delay on things like GIF and CSS animations.
-double FrameView::s_normalDeferredRepaintDelay = 0;
-double FrameView::s_initialDeferredRepaintDelayDuringLoading = 0;
-double FrameView::s_maxDeferredRepaintDelayDuringLoading = 0;
-double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0;
-#endif
-
-// The maximum number of updateWidgets iterations that should be done before returning.
-static const unsigned maxUpdateWidgetsIterations = 2;
-
-static RenderLayer::UpdateLayerPositionsFlags updateLayerPositionFlags(RenderLayer* layer, bool isRelayoutingSubtree, bool didFullRepaint)
-{
-    RenderLayer::UpdateLayerPositionsFlags flags = RenderLayer::defaultFlags;
-    if (didFullRepaint) {
-        flags &= ~RenderLayer::CheckForRepaint;
-        flags |= RenderLayer::NeedsFullRepaintInBacking;
-    }
-    if (isRelayoutingSubtree && layer->isPaginated())
-        flags |= RenderLayer::UpdatePagination;
-    return flags;
-}
-
-Pagination::Mode paginationModeForRenderStyle(RenderStyle* style)
-{
-    EOverflow overflow = style->overflowY();
-    if (overflow != OPAGEDX && overflow != OPAGEDY)
-        return Pagination::Unpaginated;
-
-    bool isHorizontalWritingMode = style->isHorizontalWritingMode();
-    TextDirection textDirection = style->direction();
-    WritingMode writingMode = style->writingMode();
-
-    // paged-x always corresponds to LeftToRightPaginated or RightToLeftPaginated. If the WritingMode
-    // is horizontal, then we use TextDirection to choose between those options. If the WritingMode
-    // is vertical, then the direction of the verticality dictates the choice.
-    if (overflow == OPAGEDX) {
-        if ((isHorizontalWritingMode && textDirection == LTR) || writingMode == LeftToRightWritingMode)
-            return Pagination::LeftToRightPaginated;
-        return Pagination::RightToLeftPaginated;
-    }
-
-    // paged-y always corresponds to TopToBottomPaginated or BottomToTopPaginated. If the WritingMode
-    // is horizontal, then the direction of the horizontality dictates the choice. If the WritingMode
-    // is vertical, then we use TextDirection to choose between those options.
-    if (writingMode == TopToBottomWritingMode || (!isHorizontalWritingMode && textDirection == RTL))
-        return Pagination::TopToBottomPaginated;
-    return Pagination::BottomToTopPaginated;
-}
-
-FrameView::FrameView(Frame* frame)
-    : m_frame(frame)
-    , m_canHaveScrollbars(true)
-    , m_slowRepaintObjectCount(0)
-    , m_layoutTimer(this, &FrameView::layoutTimerFired)
-    , m_layoutRoot(0)
-    , m_inSynchronousPostLayout(false)
-    , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
-    , m_isTransparent(false)
-    , m_baseBackgroundColor(Color::white)
-    , m_mediaType("screen")
-    , m_actionScheduler(adoptPtr(new FrameActionScheduler))
-    , m_overflowStatusDirty(true)
-    , m_viewportRenderer(0)
-    , m_wasScrolledByUser(false)
-    , m_inProgrammaticScroll(false)
-    , m_safeToPropagateScrollToParent(true)
-    , m_deferredRepaintTimer(this, &FrameView::deferredRepaintTimerFired)
-    , m_disableRepaints(0)
-    , m_isTrackingRepaints(false)
-    , m_shouldUpdateWhileOffscreen(true)
-    , m_deferSetNeedsLayouts(0)
-    , m_setNeedsLayoutWasDeferred(false)
-    , m_scrollCorner(0)
-    , m_shouldAutoSize(false)
-    , m_inAutoSize(false)
-    , m_didRunAutosize(false)
-    , m_hasSoftwareFilters(false)
-    , m_visibleContentScaleFactor(1)
-    , m_partialLayout()
-{
-    ASSERT(m_frame);
-    init();
-
-    if (!isMainFrame())
-        return;
-
-    ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed);
-    ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed);
-}
-
-PassRefPtr<FrameView> FrameView::create(Frame* frame)
-{
-    RefPtr<FrameView> view = adoptRef(new FrameView(frame));
-    view->show();
-    return view.release();
-}
-
-PassRefPtr<FrameView> FrameView::create(Frame* frame, const IntSize& initialSize)
-{
-    RefPtr<FrameView> view = adoptRef(new FrameView(frame));
-    view->Widget::setFrameRect(IntRect(view->location(), initialSize));
-    view->show();
-    return view.release();
-}
-
-FrameView::~FrameView()
-{
-    if (m_postLayoutTasksTimer.isActive()) {
-        m_postLayoutTasksTimer.stop();
-        m_actionScheduler->clear();
-    }
-
-    removeFromAXObjectCache();
-    resetScrollbars();
-
-    // Custom scrollbars should already be destroyed at this point
-    ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar());
-    ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar());
-
-    setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow.
-    setHasVerticalScrollbar(false);
-
-    ASSERT(!m_scrollCorner);
-    ASSERT(m_actionScheduler->isEmpty());
-
-    ASSERT(m_frame);
-    ASSERT(m_frame->view() != this || !m_frame->contentRenderer());
-    RenderPart* renderer = m_frame->ownerRenderer();
-    if (renderer && renderer->widget() == this)
-        renderer->setWidget(0);
-}
-
-void FrameView::reset()
-{
-    m_cannotBlitToWindow = false;
-    m_isOverlapped = false;
-    m_contentIsOpaque = false;
-    m_borderX = 30;
-    m_borderY = 30;
-    m_layoutTimer.stop();
-    m_layoutRoot = 0;
-    m_delayedLayout = false;
-    m_doFullRepaint = true;
-    m_layoutSchedulingEnabled = true;
-    m_inLayout = false;
-    m_doingPreLayoutStyleUpdate = false;
-    m_inSynchronousPostLayout = false;
-    m_layoutCount = 0;
-    m_nestedLayoutCount = 0;
-    m_postLayoutTasksTimer.stop();
-    m_firstLayout = true;
-    m_firstLayoutCallbackPending = false;
-    m_wasScrolledByUser = false;
-    m_safeToPropagateScrollToParent = true;
-    m_lastViewportSize = IntSize();
-    m_lastZoomFactor = 1.0f;
-    m_deferringRepaints = 0;
-    m_repaintCount = 0;
-    m_repaintRects.clear();
-    m_deferredRepaintDelay = s_initialDeferredRepaintDelayDuringLoading;
-    m_deferredRepaintTimer.stop();
-    m_isTrackingRepaints = false;
-    m_trackedRepaintRects.clear();
-    m_lastPaintTime = 0;
-    m_paintBehavior = PaintBehaviorNormal;
-    m_isPainting = false;
-    m_visuallyNonEmptyCharacterCount = 0;
-    m_visuallyNonEmptyPixelCount = 0;
-    m_isVisuallyNonEmpty = false;
-    m_firstVisuallyNonEmptyLayoutCallbackPending = true;
-    m_maintainScrollPositionAnchor = 0;
-    m_disableRepaints = 0;
-    m_partialLayout.reset();
-}
-
-void FrameView::removeFromAXObjectCache()
-{
-    if (AXObjectCache* cache = axObjectCache())
-        cache->remove(this);
-}
-
-void FrameView::resetScrollbars()
-{
-    // Reset the document's scrollbars back to our defaults before we yield the floor.
-    m_firstLayout = true;
-    setScrollbarsSuppressed(true);
-    if (m_canHaveScrollbars)
-        setScrollbarModes(ScrollbarAuto, ScrollbarAuto);
-    else
-        setScrollbarModes(ScrollbarAlwaysOff, ScrollbarAlwaysOff);
-    setScrollbarsSuppressed(false);
-}
-
-void FrameView::init()
-{
-    reset();
-
-    m_margins = LayoutSize(-1, -1); // undefined
-    m_size = LayoutSize();
-
-    // Propagate the marginwidth/height and scrolling modes to the view.
-    Element* ownerElement = m_frame->ownerElement();
-    if (ownerElement && (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))) {
-        HTMLFrameElementBase* frameElt = toHTMLFrameElementBase(ownerElement);
-        if (frameElt->scrollingMode() == ScrollbarAlwaysOff)
-            setCanHaveScrollbars(false);
-        LayoutUnit marginWidth = frameElt->marginWidth();
-        LayoutUnit marginHeight = frameElt->marginHeight();
-        if (marginWidth != -1)
-            setMarginWidth(marginWidth);
-        if (marginHeight != -1)
-            setMarginHeight(marginHeight);
-    }
-}
-
-void FrameView::prepareForDetach()
-{
-    RELEASE_ASSERT(!isInLayout());
-
-    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
-        scrollAnimator->cancelAnimations();
-
-    detachCustomScrollbars();
-    // When the view is no longer associated with a frame, it needs to be removed from the ax object cache
-    // right now, otherwise it won't be able to reach the topDocument()'s axObject cache later.
-    removeFromAXObjectCache();
-
-    if (m_frame->page()) {
-        if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scrollingCoordinator())
-            scrollingCoordinator->willDestroyScrollableArea(this);
-    }
-}
-
-void FrameView::detachCustomScrollbars()
-{
-    Scrollbar* horizontalBar = horizontalScrollbar();
-    if (horizontalBar && horizontalBar->isCustomScrollbar())
-        setHasHorizontalScrollbar(false);
-
-    Scrollbar* verticalBar = verticalScrollbar();
-    if (verticalBar && verticalBar->isCustomScrollbar())
-        setHasVerticalScrollbar(false);
-
-    if (m_scrollCorner) {
-        m_scrollCorner->destroy();
-        m_scrollCorner = 0;
-    }
-}
-
-void FrameView::recalculateScrollbarOverlayStyle()
-{
-    ScrollbarOverlayStyle oldOverlayStyle = scrollbarOverlayStyle();
-    ScrollbarOverlayStyle overlayStyle = ScrollbarOverlayStyleDefault;
-
-    Color backgroundColor = documentBackgroundColor();
-    if (backgroundColor.isValid()) {
-        // Reduce the background color from RGB to a lightness value
-        // and determine which scrollbar style to use based on a lightness
-        // heuristic.
-        double hue, saturation, lightness;
-        backgroundColor.getHSL(hue, saturation, lightness);
-        if (lightness <= .5)
-            overlayStyle = ScrollbarOverlayStyleLight;
-    }
-
-    if (oldOverlayStyle != overlayStyle)
-        setScrollbarOverlayStyle(overlayStyle);
-}
-
-void FrameView::clear()
-{
-    setCanBlitOnScroll(true);
-
-    reset();
-
-    if (RenderPart* renderer = m_frame->ownerRenderer())
-        renderer->viewCleared();
-
-    setScrollbarsSuppressed(true);
-}
-
-bool FrameView::didFirstLayout() const
-{
-    return !m_firstLayout;
-}
-
-void FrameView::invalidateRect(const IntRect& rect)
-{
-    if (!parent()) {
-        if (HostWindow* window = hostWindow())
-            window->invalidateContentsAndRootView(rect);
-        return;
-    }
-
-    RenderPart* renderer = m_frame->ownerRenderer();
-    if (!renderer)
-        return;
-
-    IntRect repaintRect = rect;
-    repaintRect.move(renderer->borderLeft() + renderer->paddingLeft(),
-                     renderer->borderTop() + renderer->paddingTop());
-    renderer->repaintRectangle(repaintRect);
-}
-
-void FrameView::setFrameRect(const IntRect& newRect)
-{
-    IntRect oldRect = frameRect();
-    if (newRect == oldRect)
-        return;
-
-    // Autosized font sizes depend on the width of the viewing area.
-    if (newRect.width() != oldRect.width()) {
-        Page* page = m_frame->page();
-        if (isMainFrame() && page->settings().textAutosizingEnabled()) {
-            for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
-                m_frame->document()->textAutosizer()->recalculateMultipliers();
-        }
-    }
-
-    ScrollView::setFrameRect(newRect);
-
-    updateScrollableAreaSet();
-
-    if (RenderView* renderView = this->renderView()) {
-        if (renderView->usesCompositing())
-            renderView->compositor()->frameViewDidChangeSize();
-    }
-
-    sendResizeEventIfNeeded();
-}
-
-bool FrameView::scheduleAnimation()
-{
-    if (HostWindow* window = hostWindow()) {
-        window->scheduleAnimation();
-        return true;
-    }
-    return false;
-}
-
-RenderView* FrameView::renderView() const
-{
-    return frame().contentRenderer();
-}
-
-int FrameView::mapFromLayoutToCSSUnits(LayoutUnit value) const
-{
-    return value / frame().pageZoomFactor();
-}
-
-LayoutUnit FrameView::mapFromCSSToLayoutUnits(int value) const
-{
-    return value * frame().pageZoomFactor();
-}
-
-void FrameView::setMarginWidth(LayoutUnit w)
-{
-    // make it update the rendering area when set
-    m_margins.setWidth(w);
-}
-
-void FrameView::setMarginHeight(LayoutUnit h)
-{
-    // make it update the rendering area when set
-    m_margins.setHeight(h);
-}
-
-void FrameView::setCanHaveScrollbars(bool canHaveScrollbars)
-{
-    m_canHaveScrollbars = canHaveScrollbars;
-    ScrollView::setCanHaveScrollbars(canHaveScrollbars);
-}
-
-void FrameView::updateCanHaveScrollbars()
-{
-    ScrollbarMode hMode;
-    ScrollbarMode vMode;
-    scrollbarModes(hMode, vMode);
-    if (hMode == ScrollbarAlwaysOff && vMode == ScrollbarAlwaysOff)
-        setCanHaveScrollbars(false);
-    else
-        setCanHaveScrollbars(true);
-}
-
-PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation)
-{
-    if (Settings* settings = m_frame->settings()) {
-        if (!settings->allowCustomScrollbarInMainFrame() && isMainFrame())
-            return ScrollView::createScrollbar(orientation);
-    }
-
-    // FIXME: We need to update the scrollbar dynamically as documents change (or as doc elements and bodies get discovered that have custom styles).
-    Document* doc = m_frame->document();
-
-    // Try the <body> element first as a scrollbar source.
-    Element* body = doc ? doc->body() : 0;
-    if (body && body->renderer() && body->renderer()->style()->hasPseudoStyle(SCROLLBAR))
-        return RenderScrollbar::createCustomScrollbar(this, orientation, body);
-
-    // If the <body> didn't have a custom style, then the root element might.
-    Element* docElement = doc ? doc->documentElement() : 0;
-    if (docElement && docElement->renderer() && docElement->renderer()->style()->hasPseudoStyle(SCROLLBAR))
-        return RenderScrollbar::createCustomScrollbar(this, orientation, docElement);
-
-    // If we have an owning iframe/frame element, then it can set the custom scrollbar also.
-    RenderPart* frameRenderer = m_frame->ownerRenderer();
-    if (frameRenderer && frameRenderer->style()->hasPseudoStyle(SCROLLBAR))
-        return RenderScrollbar::createCustomScrollbar(this, orientation, 0, m_frame.get());
-
-    // Nobody set a custom style, so we just use a native scrollbar.
-    return ScrollView::createScrollbar(orientation);
-}
-
-void FrameView::setContentsSize(const IntSize& size)
-{
-    if (size == contentsSize())
-        return;
-
-    m_deferSetNeedsLayouts++;
-
-    ScrollView::setContentsSize(size);
-    ScrollView::contentsResized();
-
-    Page* page = frame().page();
-    if (!page)
-        return;
-
-    updateScrollableAreaSet();
-
-    page->chrome().contentsSizeChanged(m_frame.get(), size); // Notify only.
-
-    m_deferSetNeedsLayouts--;
-
-    if (!m_deferSetNeedsLayouts)
-        m_setNeedsLayoutWasDeferred = false; // FIXME: Find a way to make the deferred layout actually happen.
-}
-
-void FrameView::adjustViewSize()
-{
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return;
-
-    ASSERT(m_frame->view() == this);
-
-    const IntRect rect = renderView->documentRect();
-    const IntSize& size = rect.size();
-    ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->document()->printing(), size == contentsSize());
-
-    setContentsSize(size);
-}
-
-void FrameView::applyOverflowToViewport(RenderObject* o, ScrollbarMode& hMode, ScrollbarMode& vMode)
-{
-    // Handle the overflow:hidden/scroll case for the body/html elements.  WinIE treats
-    // overflow:hidden and overflow:scroll on <body> as applying to the document's
-    // scrollbars.  The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should
-    // use the root element.
-
-    EOverflow overflowX = o->style()->overflowX();
-    EOverflow overflowY = o->style()->overflowY();
-
-    if (o->isSVGRoot()) {
-        // overflow is ignored in stand-alone SVG documents.
-        if (!toRenderSVGRoot(o)->isEmbeddedThroughFrameContainingSVGDocument())
-            return;
-        overflowX = OHIDDEN;
-        overflowY = OHIDDEN;
-    }
-
-    bool ignoreOverflowHidden = false;
-    if (m_frame->page()->settings().ignoreMainFrameOverflowHiddenQuirk() && m_frame->page()->mainFrame() == m_frame)
-        ignoreOverflowHidden = true;
-
-    switch (overflowX) {
-        case OHIDDEN:
-            if (!ignoreOverflowHidden)
-                hMode = ScrollbarAlwaysOff;
-            break;
-        case OSCROLL:
-            hMode = ScrollbarAlwaysOn;
-            break;
-        case OAUTO:
-            hMode = ScrollbarAuto;
-            break;
-        default:
-            // Don't set it at all.
-            ;
-    }
-
-     switch (overflowY) {
-        case OHIDDEN:
-            if (!ignoreOverflowHidden)
-                vMode = ScrollbarAlwaysOff;
-            break;
-        case OSCROLL:
-            vMode = ScrollbarAlwaysOn;
-            break;
-        case OAUTO:
-            vMode = ScrollbarAuto;
-            break;
-        default:
-            // Don't set it at all. Values of OPAGEDX and OPAGEDY are handled by applyPaginationToViewPort().
-            ;
-    }
-
-    m_viewportRenderer = o;
-}
-
-void FrameView::applyPaginationToViewport()
-{
-    Document* document = m_frame->document();
-    Node* documentElement = document->documentElement();
-    RenderObject* documentRenderer = documentElement ? documentElement->renderer() : 0;
-    RenderObject* documentOrBodyRenderer = documentRenderer;
-    Node* body = document->body();
-    if (body && body->renderer()) {
-        if (body->hasTagName(bodyTag))
-            documentOrBodyRenderer = documentRenderer->style()->overflowX() == OVISIBLE && isHTMLHtmlElement(documentElement) ? body->renderer() : documentRenderer;
-    }
-
-    Pagination pagination;
-
-    if (!documentOrBodyRenderer) {
-        setPagination(pagination);
-        return;
-    }
-
-    EOverflow overflowY = documentOrBodyRenderer->style()->overflowY();
-    if (overflowY == OPAGEDX || overflowY == OPAGEDY) {
-        pagination.mode = WebCore::paginationModeForRenderStyle(documentOrBodyRenderer->style());
-        pagination.gap = static_cast<unsigned>(documentOrBodyRenderer->style()->columnGap());
-    }
-
-    setPagination(pagination);
-}
-
-void FrameView::calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy strategy)
-{
-    m_viewportRenderer = 0;
-
-    const HTMLFrameOwnerElement* owner = m_frame->ownerElement();
-    if (owner && (owner->scrollingMode() == ScrollbarAlwaysOff)) {
-        hMode = ScrollbarAlwaysOff;
-        vMode = ScrollbarAlwaysOff;
-        return;
-    }
-
-    if (m_canHaveScrollbars || strategy == RulesFromWebContentOnly) {
-        hMode = ScrollbarAuto;
-        // Seamless documents begin with heights of 0; we special case that here
-        // to correctly render documents that don't need scrollbars.
-        IntSize fullVisibleSize = visibleContentRect(IncludeScrollbars).size();
-        bool isSeamlessDocument = frame().document() && frame().document()->shouldDisplaySeamlesslyWithParent();
-        vMode = (isSeamlessDocument && !fullVisibleSize.height()) ? ScrollbarAlwaysOff : ScrollbarAuto;
-    } else {
-        hMode = ScrollbarAlwaysOff;
-        vMode = ScrollbarAlwaysOff;
-    }
-
-    if (!m_layoutRoot) {
-        Document* document = m_frame->document();
-        Node* documentElement = document->documentElement();
-        RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0;
-        Node* body = document->body();
-        if (body && body->renderer()) {
-            if (body->hasTagName(framesetTag)) {
-                vMode = ScrollbarAlwaysOff;
-                hMode = ScrollbarAlwaysOff;
-            } else if (body->hasTagName(bodyTag)) {
-                // It's sufficient to just check the X overflow,
-                // since it's illegal to have visible in only one direction.
-                RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE && isHTMLHtmlElement(document->documentElement()) ? body->renderer() : rootRenderer;
-                if (o->style())
-                    applyOverflowToViewport(o, hMode, vMode);
-            }
-        } else if (rootRenderer)
-            applyOverflowToViewport(rootRenderer, hMode, vMode);
-    }
-}
-
-void FrameView::updateCompositingLayersAfterStyleChange()
-{
-    TRACE_EVENT0("webkit", "FrameView::updateCompositingLayersAfterStyleChange");
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return;
-
-    // If we expect to update compositing after an incipient layout, don't do so here.
-    if (m_doingPreLayoutStyleUpdate || layoutPending() || renderView->needsLayout())
-        return;
-
-    // This call will make sure the cached hasAcceleratedCompositing is updated from the pref
-    renderView->compositor()->cacheAcceleratedCompositingFlags();
-
-    // Sometimes we will change a property (for example, z-index) that will not
-    // cause a layout, but will require us to update compositing state. We only
-    // need to do this if a layout is not already scheduled.
-    if (!needsLayout())
-        renderView->compositor()->updateCompositingRequirementsState();
-
-    renderView->compositor()->updateCompositingLayers(CompositingUpdateAfterStyleChange);
-}
-
-void FrameView::updateCompositingLayersAfterLayout()
-{
-    TRACE_EVENT0("webkit", "FrameView::updateCompositingLayersAfterLayout");
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return;
-
-    // This call will make sure the cached hasAcceleratedCompositing is updated from the pref
-    renderView->compositor()->cacheAcceleratedCompositingFlags();
-    renderView->compositor()->updateCompositingRequirementsState();
-    renderView->compositor()->updateCompositingLayers(CompositingUpdateAfterLayout);
-}
-
-bool FrameView::usesCompositedScrolling() const
-{
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return false;
-    if (m_frame->settings() && m_frame->settings()->compositedScrollingForFramesEnabled())
-        return renderView->compositor()->inForcedCompositingMode();
-    return false;
-}
-
-GraphicsLayer* FrameView::layerForScrolling() const
-{
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return 0;
-    return renderView->compositor()->scrollLayer();
-}
-
-GraphicsLayer* FrameView::layerForHorizontalScrollbar() const
-{
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return 0;
-    return renderView->compositor()->layerForHorizontalScrollbar();
-}
-
-GraphicsLayer* FrameView::layerForVerticalScrollbar() const
-{
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return 0;
-    return renderView->compositor()->layerForVerticalScrollbar();
-}
-
-GraphicsLayer* FrameView::layerForScrollCorner() const
-{
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return 0;
-    return renderView->compositor()->layerForScrollCorner();
-}
-
-#if USE(RUBBER_BANDING)
-GraphicsLayer* FrameView::layerForOverhangAreas() const
-{
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return 0;
-    return renderView->compositor()->layerForOverhangAreas();
-}
-#endif // USE(RUBBER_BANDING)
-
-bool FrameView::hasCompositedContent() const
-{
-    if (RenderView* renderView = this->renderView())
-        return renderView->compositor()->inCompositingMode();
-    return false;
-}
-
-bool FrameView::isEnclosedInCompositingLayer() const
-{
-    RenderObject* frameOwnerRenderer = m_frame->ownerRenderer();
-    if (frameOwnerRenderer && frameOwnerRenderer->containerForRepaint())
-        return true;
-
-    if (FrameView* parentView = parentFrameView())
-        return parentView->isEnclosedInCompositingLayer();
-
-    return false;
-}
-
-bool FrameView::isSoftwareRenderable() const
-{
-    RenderView* renderView = this->renderView();
-    return !renderView || !renderView->compositor()->has3DContent();
-}
-
-RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const
-{
-    return onlyDuringLayout && layoutPending() ? 0 : m_layoutRoot;
-}
-
-static inline void collectFrameViewChildren(FrameView* frameView, Vector<RefPtr<FrameView> >& frameViews)
-{
-    const HashSet<RefPtr<Widget> >* viewChildren = frameView->children();
-    ASSERT(viewChildren);
-
-    const HashSet<RefPtr<Widget> >::iterator end = viewChildren->end();
-    for (HashSet<RefPtr<Widget> >::iterator current = viewChildren->begin(); current != end; ++current) {
-        Widget* widget = (*current).get();
-        if (widget->isFrameView())
-            frameViews.append(toFrameView(widget));
-    }
-}
-
-inline void FrameView::forceLayoutParentViewIfNeeded()
-{
-    RenderPart* ownerRenderer = m_frame->ownerRenderer();
-    if (!ownerRenderer || !ownerRenderer->frame())
-        return;
-
-    RenderBox* contentBox = embeddedContentBox();
-    if (!contentBox)
-        return;
-
-    RenderSVGRoot* svgRoot = toRenderSVGRoot(contentBox);
-    if (svgRoot->everHadLayout() && !svgRoot->needsLayout())
-        return;
-
-    // If the embedded SVG document appears the first time, the ownerRenderer has already finished
-    // layout without knowing about the existence of the embedded SVG document, because RenderReplaced
-    // embeddedContentBox() returns 0, as long as the embedded document isn't loaded yet. Before
-    // bothering to lay out the SVG document, mark the ownerRenderer needing layout and ask its
-    // FrameView for a layout. After that the RenderEmbeddedObject (ownerRenderer) carries the
-    // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rely on, when laying
-    // out for the first time, or when the RenderSVGRoot size has changed dynamically (eg. via <script>).
-    RefPtr<FrameView> frameView = ownerRenderer->frame()->view();
-
-    // Mark the owner renderer as needing layout.
-    ownerRenderer->setNeedsLayoutAndPrefWidthsRecalc();
-
-    // Synchronously enter layout, to layout the view containing the host object/embed/iframe.
-    ASSERT(frameView);
-    frameView->layout();
-}
-
-void FrameView::performPreLayoutTasks()
-{
-    // Don't schedule more layouts, we're in one.
-    TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
-
-    if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTasksTimer.isActive() && !frame().document()->shouldDisplaySeamlesslyWithParent()) {
-        // This is a new top-level layout. If there are any remaining tasks from the previous layout, finish them now.
-        m_inSynchronousPostLayout = true;
-        performPostLayoutTasks();
-        m_inSynchronousPostLayout = false;
-    }
-
-    // Viewport-dependent media queries may cause us to need completely different style information.
-    Document* document = m_frame->document();
-    if (!document->styleResolverIfExists() || document->styleResolverIfExists()->affectedByViewportChange()) {
-        document->styleResolverChanged(RecalcStyleDeferred);
-        // FIXME: This instrumentation event is not strictly accurate since cached media query results
-        //        do not persist across StyleResolver rebuilds.
-        InspectorInstrumentation::mediaQueryResultChanged(document);
-    } else {
-        document->evaluateMediaQueryList();
-    }
-
-    // If there is any pagination to apply, it will affect the RenderView's style, so we should
-    // take care of that now.
-    applyPaginationToViewport();
-
-    // Always ensure our style info is up-to-date. This can happen in situations where
-    // the layout beats any sort of style recalc update that needs to occur.
-    TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleUpdate, true);
-    document->updateStyleIfNeeded();
-}
-
-void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLayout)
-{
-    // performLayout is the actual guts of layout().
-    // FIXME: The 300 other lines in layout() probably belong in other helper functions
-    // so that a single human could understand what layout() is actually doing.
-    {
-        bool disableLayoutState = false;
-        if (inSubtreeLayout) {
-            RenderView* view = rootForThisLayout->view();
-            disableLayoutState = view->shouldDisableLayoutStateForSubtree(rootForThisLayout);
-            view->pushLayoutState(rootForThisLayout);
-        }
-        LayoutStateDisabler layoutStateDisabler(disableLayoutState ? rootForThisLayout->view() : 0);
-
-        m_inLayout = true;
-
-        beginDeferredRepaints();
-        forceLayoutParentViewIfNeeded();
-        renderView()->updateConfiguration();
-
-        // Text Autosizing requires two-pass layout which is incompatible with partial layout.
-        // If enabled, only do partial layout for the second layout.
-        // FIXME (crbug.com/256657): Do not do two layouts for text autosizing.
-        PartialLayoutDisabler partialLayoutDisabler(partialLayout(), m_frame->settings() && m_frame->settings()->textAutosizingEnabled());
-
-        LayoutIndicator layoutIndicator;
-        rootForThisLayout->layout();
-    }
-
-    bool autosized = frame().document()->textAutosizer()->processSubtree(rootForThisLayout);
-    if (autosized && rootForThisLayout->needsLayout()) {
-        TRACE_EVENT0("webkit", "2nd layout due to Text Autosizing");
-        LayoutIndicator layoutIndicator;
-        rootForThisLayout->layout();
-    }
-
-    endDeferredRepaints();
-    m_inLayout = false;
-
-    if (inSubtreeLayout)
-        rootForThisLayout->view()->popLayoutState(rootForThisLayout);
-}
-
-void FrameView::scheduleOrPerformPostLayoutTasks()
-{
-    if (m_postLayoutTasksTimer.isActive()) {
-        m_actionScheduler->resume();
-        return;
-    }
-
-    // Partial layouts should not happen with synchronous post layouts.
-    ASSERT(!(m_inSynchronousPostLayout && partialLayout().isStopping()));
-
-    if (!m_inSynchronousPostLayout) {
-        if (frame().document()->shouldDisplaySeamlesslyWithParent()) {
-            if (RenderView* renderView = this->renderView())
-                renderView->updateWidgetPositions();
-        } else {
-            m_inSynchronousPostLayout = true;
-            // Calls resumeScheduledEvents()
-            performPostLayoutTasks();
-            m_inSynchronousPostLayout = false;
-        }
-    }
-
-    if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchronousPostLayout || frame().document()->shouldDisplaySeamlesslyWithParent())) {
-        // If we need layout or are already in a synchronous call to postLayoutTasks(),
-        // defer widget updates and event dispatch until after we return. postLayoutTasks()
-        // can make us need to update again, and we can get stuck in a nasty cycle unless
-        // we call it through the timer here.
-        m_postLayoutTasksTimer.startOneShot(0);
-        if (!partialLayout().isStopping() && needsLayout()) {
-            m_actionScheduler->pause();
-            layout();
-        }
-    }
-}
-
-void FrameView::layout(bool allowSubtree)
-{
-    // We should never layout a Document which is not in a Frame.
-    ASSERT(m_frame);
-    ASSERT(m_frame->view() == this);
-    ASSERT(m_frame->page());
-
-    if (m_inLayout)
-        return;
-
-    ASSERT(!partialLayout().isStopping());
-
-    TRACE_EVENT0("webkit", "FrameView::layout");
-    TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "Layout");
-
-    // Protect the view from being deleted during layout (in recalcStyle)
-    RefPtr<FrameView> protector(this);
-
-    // Every scroll that happens during layout is programmatic.
-    TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true);
-
-    m_layoutTimer.stop();
-    m_delayedLayout = false;
-    m_setNeedsLayoutWasDeferred = false;
-
-    // we shouldn't enter layout() while painting
-    ASSERT(!isPainting());
-    if (isPainting())
-        return;
-
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout(m_frame.get());
-
-    if (!allowSubtree && m_layoutRoot) {
-        m_layoutRoot->markContainingBlocksForLayout(false);
-        m_layoutRoot = 0;
-    }
-
-    performPreLayoutTasks();
-
-    // If there is only one ref to this view left, then its going to be destroyed as soon as we exit,
-    // so there's no point to continuing to layout
-    if (protector->hasOneRef())
-        return;
-
-    Document* document = m_frame->document();
-    bool inSubtreeLayout = m_layoutRoot;
-    RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutRoot : document->renderer();
-    if (!rootForThisLayout) {
-        // FIXME: Do we need to set m_size here?
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    bool isPartialLayout = partialLayout().isPartialLayout();
-
-    FontCachePurgePreventer fontCachePurgePreventer;
-    RenderLayer* layer;
-    {
-        TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
-
-        m_nestedLayoutCount++;
-
-        updateCounters();
-        autoSizeIfEnabled();
-
-        ScrollbarMode hMode;
-        ScrollbarMode vMode;
-        calculateScrollbarModesForLayout(hMode, vMode);
-
-        m_doFullRepaint = !inSubtreeLayout && !isPartialLayout && (m_firstLayout || toRenderView(rootForThisLayout)->document().printing());
-
-        if (!inSubtreeLayout && !isPartialLayout) {
-            // Now set our scrollbar state for the layout.
-            ScrollbarMode currentHMode = horizontalScrollbarMode();
-            ScrollbarMode currentVMode = verticalScrollbarMode();
-
-            if (m_firstLayout || (hMode != currentHMode || vMode != currentVMode)) {
-                if (m_firstLayout) {
-                    setScrollbarsSuppressed(true);
-
-                    m_firstLayout = false;
-                    m_firstLayoutCallbackPending = true;
-                    m_lastViewportSize = layoutSize(IncludeScrollbars);
-                    m_lastZoomFactor = rootForThisLayout->style()->zoom();
-
-                    // Set the initial vMode to AlwaysOn if we're auto.
-                    if (vMode == ScrollbarAuto)
-                        setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
-                    // Set the initial hMode to AlwaysOff if we're auto.
-                    if (hMode == ScrollbarAuto)
-                        setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
-
-                    setScrollbarModes(hMode, vMode);
-                    setScrollbarsSuppressed(false, true);
-                } else
-                    setScrollbarModes(hMode, vMode);
-            }
-
-            LayoutSize oldSize = m_size;
-
-            m_size = LayoutSize(layoutWidth(), layoutHeight());
-
-            if (oldSize != m_size) {
-                m_doFullRepaint = true;
-                if (!m_firstLayout) {
-                    RenderBox* rootRenderer = document->documentElement() ? document->documentElement()->renderBox() : 0;
-                    RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0;
-                    if (bodyRenderer && bodyRenderer->stretchesToViewport())
-                        bodyRenderer->setChildNeedsLayout();
-                    else if (rootRenderer && rootRenderer->stretchesToViewport())
-                        rootRenderer->setChildNeedsLayout();
-                }
-            }
-        }
-
-        layer = rootForThisLayout->enclosingLayer();
-
-        m_actionScheduler->pause();
-
-        performLayout(rootForThisLayout, inSubtreeLayout);
-        m_layoutRoot = 0;
-    } // Reset m_layoutSchedulingEnabled to its previous value.
-
-    bool neededFullRepaint = m_doFullRepaint;
-
-    if (!inSubtreeLayout && !isPartialLayout && !toRenderView(rootForThisLayout)->document().printing())
-        adjustViewSize();
-
-    m_doFullRepaint = neededFullRepaint;
-
-    // Now update the positions of all layers.
-    beginDeferredRepaints();
-    if (m_doFullRepaint) {
-        // FIXME: This isn't really right, since the RenderView doesn't fully encompass
-        // the visibleContentRect(). It just happens to work out most of the time,
-        // since first layouts and printing don't have you scrolled anywhere.
-        rootForThisLayout->view()->repaint();
-    }
-
-    layer->updateLayerPositionsAfterLayout(renderView()->layer(), updateLayerPositionFlags(layer, inSubtreeLayout, m_doFullRepaint));
-
-    endDeferredRepaints();
-
-    updateCompositingLayersAfterLayout();
-
-    m_layoutCount++;
-
-    if (AXObjectCache* cache = rootForThisLayout->document().existingAXObjectCache())
-        cache->postNotification(rootForThisLayout, AXObjectCache::AXLayoutComplete, true);
-    updateAnnotatedRegions();
-
-    ASSERT(partialLayout().isStopping() || !rootForThisLayout->needsLayout());
-
-    updateCanBlitOnScrollRecursively();
-
-    if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER))
-        updateOverflowStatus(layoutWidth() < contentsWidth(), layoutHeight() < contentsHeight());
-
-    // Resume scheduled events (FrameActionScheduler m_actionScheduler)
-    // and ensure post layout tasks are executed or scheduled to be.
-    scheduleOrPerformPostLayoutTasks();
-
-    InspectorInstrumentation::didLayout(cookie, rootForThisLayout);
-
-    m_nestedLayoutCount--;
-    if (m_nestedLayoutCount)
-        return;
-
-    if (partialLayout().isStopping())
-        return;
-
-#ifndef NDEBUG
-    // Post-layout assert that nobody was re-marked as needing layout during layout.
-    document->renderer()->assertSubtreeIsLaidOut();
-#endif
-
-    // FIXME: It should be not possible to remove the FrameView from the frame/page during layout
-    // however m_inLayout is not set for most of this function, so none of our RELEASE_ASSERTS
-    // in Frame/Page will fire. One of the post-layout tasks is disconnecting the Frame from
-    // the page in fast/frames/crash-remove-iframe-during-object-beforeload-2.html
-    // necessitating this check here.
-    // ASSERT(frame()->page());
-    if (frame().page())
-        frame().page()->chrome().client().layoutUpdated(m_frame.get());
-}
-
-RenderBox* FrameView::embeddedContentBox() const
-{
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return 0;
-
-    RenderObject* firstChild = renderView->firstChild();
-    if (!firstChild || !firstChild->isBox())
-        return 0;
-
-    // Curently only embedded SVG documents participate in the size-negotiation logic.
-    if (firstChild->isSVGRoot())
-        return toRenderBox(firstChild);
-
-    return 0;
-}
-
-void FrameView::addWidgetToUpdate(RenderObject* object)
-{
-    if (!m_widgetUpdateSet)
-        m_widgetUpdateSet = adoptPtr(new RenderObjectSet);
-
-    // Tell the DOM element that it needs a widget update.
-    Node* node = object->node();
-    if (node->hasTagName(objectTag) || node->hasTagName(embedTag)) {
-        HTMLPlugInImageElement* pluginElement = toHTMLPlugInImageElement(node);
-        pluginElement->setNeedsWidgetUpdate(true);
-    }
-
-    m_widgetUpdateSet->add(object);
-}
-
-void FrameView::removeWidgetToUpdate(RenderObject* object)
-{
-    if (!m_widgetUpdateSet)
-        return;
-
-    m_widgetUpdateSet->remove(object);
-}
-
-void FrameView::setMediaType(const AtomicString& mediaType)
-{
-    m_mediaType = mediaType;
-}
-
-AtomicString FrameView::mediaType() const
-{
-    // See if we have an override type.
-    String overrideType;
-    InspectorInstrumentation::applyEmulatedMedia(m_frame.get(), &overrideType);
-    if (!overrideType.isNull())
-        return overrideType;
-    return m_mediaType;
-}
-
-void FrameView::adjustMediaTypeForPrinting(bool printing)
-{
-    if (printing) {
-        if (m_mediaTypeWhenNotPrinting.isNull())
-            m_mediaTypeWhenNotPrinting = mediaType();
-            setMediaType("print");
-    } else {
-        if (!m_mediaTypeWhenNotPrinting.isNull())
-            setMediaType(m_mediaTypeWhenNotPrinting);
-        m_mediaTypeWhenNotPrinting = nullAtom;
-    }
-}
-
-bool FrameView::useSlowRepaints(bool considerOverlap) const
-{
-    bool mustBeSlow = m_slowRepaintObjectCount > 0;
-
-    if (contentsInCompositedLayer())
-        return mustBeSlow;
-
-    // The chromium compositor does not support scrolling a non-composited frame within a composited page through
-    // the fast scrolling path, so force slow scrolling in that case.
-    if (m_frame->ownerElement() && !hasCompositedContent() && m_frame->page() && m_frame->page()->mainFrame()->view()->hasCompositedContent())
-        return true;
-
-    bool isOverlapped = m_isOverlapped && considerOverlap;
-
-    if (mustBeSlow || m_cannotBlitToWindow || isOverlapped || !m_contentIsOpaque)
-        return true;
-
-    if (FrameView* parentView = parentFrameView())
-        return parentView->useSlowRepaints(considerOverlap);
-
-    return false;
-}
-
-bool FrameView::useSlowRepaintsIfNotOverlapped() const
-{
-    return useSlowRepaints(false);
-}
-
-void FrameView::updateCanBlitOnScrollRecursively()
-{
-    for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext(m_frame.get())) {
-        if (FrameView* view = frame->view())
-            view->setCanBlitOnScroll(!view->useSlowRepaints());
-    }
-}
-
-bool FrameView::contentsInCompositedLayer() const
-{
-    RenderView* renderView = this->renderView();
-    if (renderView && renderView->isComposited()) {
-        GraphicsLayer* layer = renderView->layer()->backing()->graphicsLayer();
-        if (layer && layer->drawsContent())
-            return true;
-    }
-
-    return false;
-}
-
-void FrameView::setCannotBlitToWindow()
-{
-    m_cannotBlitToWindow = true;
-    updateCanBlitOnScrollRecursively();
-}
-
-void FrameView::addSlowRepaintObject()
-{
-    if (!m_slowRepaintObjectCount++) {
-        updateCanBlitOnScrollRecursively();
-
-        if (Page* page = m_frame->page()) {
-            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
-                scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this);
-        }
-    }
-}
-
-void FrameView::removeSlowRepaintObject()
-{
-    ASSERT(m_slowRepaintObjectCount > 0);
-    m_slowRepaintObjectCount--;
-    if (!m_slowRepaintObjectCount) {
-        updateCanBlitOnScrollRecursively();
-
-        if (Page* page = m_frame->page()) {
-            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
-                scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this);
-        }
-    }
-}
-
-void FrameView::addViewportConstrainedObject(RenderObject* object)
-{
-    if (!m_viewportConstrainedObjects)
-        m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet);
-
-    if (!m_viewportConstrainedObjects->contains(object)) {
-        m_viewportConstrainedObjects->add(object);
-
-        if (Page* page = m_frame->page()) {
-            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
-                scrollingCoordinator->frameViewFixedObjectsDidChange(this);
-        }
-    }
-}
-
-void FrameView::removeViewportConstrainedObject(RenderObject* object)
-{
-    if (m_viewportConstrainedObjects && m_viewportConstrainedObjects->contains(object)) {
-        m_viewportConstrainedObjects->remove(object);
-        if (Page* page = m_frame->page()) {
-            if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
-                scrollingCoordinator->frameViewFixedObjectsDidChange(this);
-        }
-
-        // FIXME: In addFixedObject() we only call this if there's a platform widget,
-        // why isn't the same check being made here?
-        updateCanBlitOnScrollRecursively();
-    }
-}
-
-LayoutRect FrameView::viewportConstrainedVisibleContentRect() const
-{
-    LayoutRect viewportRect = visibleContentRect();
-    // Ignore overhang. No-op when not using rubber banding.
-    viewportRect.setLocation(clampScrollPosition(scrollPosition()));
-    return viewportRect;
-}
-
-
-IntSize FrameView::scrollOffsetForFixedPosition() const
-{
-    return toIntSize(clampScrollPosition(scrollPosition()));
-}
-
-IntPoint FrameView::lastKnownMousePosition() const
-{
-    return m_frame->eventHandler()->lastKnownMousePosition();
-}
-
-bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
-{
-    if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()) {
-        hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
-        return true;
-    }
-
-    const bool isCompositedContentLayer = contentsInCompositedLayer();
-
-    // Get the rects of the fixed objects visible in the rectToScroll
-    Region regionToUpdate;
-    ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObjects->end();
-    for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrainedObjects->begin(); it != end; ++it) {
-        RenderObject* renderer = *it;
-        if (!renderer->style()->hasViewportConstrainedPosition())
-            continue;
-
-        // Fixed items should always have layers.
-        ASSERT(renderer->hasLayer());
-        RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
-
-        // Composited layers may still actually paint into their ancestor.
-        // If that happens, the viewport constrained object needs to be
-        // repainted on scroll.
-        if (layer->isComposited() && !layer->backing()->paintsIntoCompositedAncestor())
-            continue;
-
-        if (layer->viewportConstrainedNotCompositedReason() == RenderLayer::NotCompositedForBoundsOutOfView
-            || layer->viewportConstrainedNotCompositedReason() == RenderLayer::NotCompositedForNoVisibleContent) {
-            // Don't invalidate for invisible fixed layers.
-            continue;
-        }
-
-        if (layer->hasAncestorWithFilterOutsets()) {
-            // If the fixed layer has a blur/drop-shadow filter applied on at least one of its parents, we cannot
-            // scroll using the fast path, otherwise the outsets of the filter will be moved around the page.
-            return false;
-        }
-
-        IntRect updateRect = pixelSnappedIntRect(layer->repaintRectIncludingNonCompositingDescendants());
-
-        RenderLayer* enclosingCompositingLayer = layer->enclosingCompositingLayer(false);
-        if (enclosingCompositingLayer && !enclosingCompositingLayer->renderer()->isRenderView()) {
-            // If the fixed-position layer is contained by a composited layer that is not its containing block,
-            // then we have to invlidate that enclosing layer, not the RenderView.
-            updateRect.moveBy(scrollPosition());
-            IntRect previousRect = updateRect;
-            previousRect.move(scrollDelta);
-            updateRect.unite(previousRect);
-            enclosingCompositingLayer->setBackingNeedsRepaintInRect(updateRect);
-        } else {
-            // Coalesce the repaints that will be issued to the renderView.
-            updateRect = contentsToRootView(updateRect);
-            if (!isCompositedContentLayer && clipsRepaints())
-                updateRect.intersect(rectToScroll);
-            if (!updateRect.isEmpty())
-                regionToUpdate.unite(updateRect);
-        }
-    }
-
-    // 1) scroll
-    hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
-
-    // 2) update the area of fixed objects that has been invalidated
-    Vector<IntRect> subRectsToUpdate = regionToUpdate.rects();
-    size_t viewportConstrainedObjectsCount = subRectsToUpdate.size();
-    for (size_t i = 0; i < viewportConstrainedObjectsCount; ++i) {
-        IntRect updateRect = subRectsToUpdate[i];
-        IntRect scrolledRect = updateRect;
-        scrolledRect.move(scrollDelta);
-        updateRect.unite(scrolledRect);
-        if (isCompositedContentLayer) {
-            updateRect = rootViewToContents(updateRect);
-            ASSERT(renderView());
-            renderView()->layer()->setBackingNeedsRepaintInRect(updateRect);
-            continue;
-        }
-        if (clipsRepaints())
-            updateRect.intersect(rectToScroll);
-        hostWindow()->invalidateContentsAndRootView(updateRect);
-    }
-
-    return true;
-}
-
-void FrameView::scrollContentsSlowPath(const IntRect& updateRect)
-{
-    if (contentsInCompositedLayer()) {
-        IntRect updateRect = visibleContentRect();
-        ASSERT(renderView());
-        renderView()->layer()->setBackingNeedsRepaintInRect(updateRect);
-    }
-    if (RenderPart* frameRenderer = m_frame->ownerRenderer()) {
-        if (isEnclosedInCompositingLayer()) {
-            LayoutRect rect(frameRenderer->borderLeft() + frameRenderer->paddingLeft(),
-                            frameRenderer->borderTop() + frameRenderer->paddingTop(),
-                            visibleWidth(), visibleHeight());
-            frameRenderer->repaintRectangle(rect);
-            return;
-        }
-    }
-
-    ScrollView::scrollContentsSlowPath(updateRect);
-}
-
-// Note that this gets called at painting time.
-void FrameView::setIsOverlapped(bool isOverlapped)
-{
-    if (isOverlapped == m_isOverlapped)
-        return;
-
-    m_isOverlapped = isOverlapped;
-    updateCanBlitOnScrollRecursively();
-}
-
-bool FrameView::isOverlappedIncludingAncestors() const
-{
-    if (isOverlapped())
-        return true;
-
-    if (FrameView* parentView = parentFrameView()) {
-        if (parentView->isOverlapped())
-            return true;
-    }
-
-    return false;
-}
-
-void FrameView::setContentIsOpaque(bool contentIsOpaque)
-{
-    if (contentIsOpaque == m_contentIsOpaque)
-        return;
-
-    m_contentIsOpaque = contentIsOpaque;
-    updateCanBlitOnScrollRecursively();
-}
-
-void FrameView::restoreScrollbar()
-{
-    setScrollbarsSuppressed(false);
-}
-
-bool FrameView::scrollToFragment(const KURL& url)
-{
-    // If our URL has no ref, then we have no place we need to jump to.
-    // OTOH If CSS target was set previously, we want to set it to 0, recalc
-    // and possibly repaint because :target pseudo class may have been
-    // set (see bug 11321).
-    if (!url.hasFragmentIdentifier() && !m_frame->document()->cssTarget())
-        return false;
-
-    String fragmentIdentifier = url.fragmentIdentifier();
-    if (scrollToAnchor(fragmentIdentifier))
-        return true;
-
-    // Try again after decoding the ref, based on the document's encoding.
-    if (m_frame->document()->encoding().isValid())
-        return scrollToAnchor(decodeURLEscapeSequences(fragmentIdentifier, m_frame->document()->encoding()));
-
-    return false;
-}
-
-bool FrameView::scrollToAnchor(const String& name)
-{
-    ASSERT(m_frame->document());
-
-    if (!m_frame->document()->haveStylesheetsLoaded()) {
-        m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(true);
-        return false;
-    }
-
-    m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(false);
-
-    Element* anchorNode = m_frame->document()->findAnchor(name);
-
-    // Setting to null will clear the current target.
-    m_frame->document()->setCSSTarget(anchorNode);
-
-    if (m_frame->document()->isSVGDocument()) {
-        if (SVGSVGElement* svg = toSVGDocument(m_frame->document())->rootElement()) {
-            svg->setupInitialView(name, anchorNode);
-            if (!anchorNode)
-                return true;
-        }
-    }
-
-    // Implement the rule that "" and "top" both mean top of page as in other browsers.
-    if (!anchorNode && !(name.isEmpty() || equalIgnoringCase(name, "top")))
-        return false;
-
-    maintainScrollPositionAtAnchor(anchorNode ? static_cast<Node*>(anchorNode) : m_frame->document());
-
-    // If the anchor accepts keyboard focus, move focus there to aid users relying on keyboard navigation.
-    if (anchorNode && anchorNode->isFocusable())
-        m_frame->document()->setFocusedElement(anchorNode);
-
-    return true;
-}
-
-void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode)
-{
-    m_maintainScrollPositionAnchor = anchorNode;
-    if (!m_maintainScrollPositionAnchor)
-        return;
-
-    // We need to update the layout before scrolling, otherwise we could
-    // really mess things up if an anchor scroll comes at a bad moment.
-    m_frame->document()->updateStyleIfNeeded();
-    // Only do a layout if changes have occurred that make it necessary.
-    RenderView* renderView = this->renderView();
-    if (renderView && renderView->needsLayout())
-        layout();
-    else
-        scrollToAnchor();
-}
-
-void FrameView::scrollElementToRect(Element* element, const IntRect& rect)
-{
-    m_frame->document()->updateLayoutIgnorePendingStylesheets();
-
-    LayoutRect bounds = element->boundingBox();
-    int centeringOffsetX = (rect.width() - bounds.width()) / 2;
-    int centeringOffsetY = (rect.height() - bounds.height()) / 2;
-    setScrollPosition(IntPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.y() - centeringOffsetY - rect.y()));
-}
-
-void FrameView::setScrollPosition(const IntPoint& scrollPoint)
-{
-    TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true);
-    m_maintainScrollPositionAnchor = 0;
-
-    IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
-
-    if (newScrollPosition == scrollPosition())
-        return;
-
-    Page* page = m_frame->page();
-    if (page && RuntimeEnabledFeatures::programmaticScrollNotificationsEnabled())
-        page->chrome().client().didProgrammaticallyScroll(m_frame.get(), newScrollPosition);
-
-    if (requestScrollPositionUpdate(newScrollPosition))
-        return;
-
-    ScrollView::setScrollPosition(newScrollPosition);
-}
-
-void FrameView::setScrollPositionNonProgrammatically(const IntPoint& scrollPoint)
-{
-    IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
-
-    if (newScrollPosition == scrollPosition())
-        return;
-
-    TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, false);
-    notifyScrollPositionChanged(newScrollPosition);
-}
-
-void FrameView::setViewportConstrainedObjectsNeedLayout()
-{
-    if (!hasViewportConstrainedObjects())
-        return;
-
-    ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObjects->end();
-    for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrainedObjects->begin(); it != end; ++it) {
-        RenderObject* renderer = *it;
-        renderer->setNeedsLayout();
-    }
-}
-
-
-void FrameView::scrollPositionChanged()
-{
-    m_frame->eventHandler()->sendScrollEvent();
-    m_frame->eventHandler()->dispatchFakeMouseMoveEventSoon();
-
-    if (RenderView* renderView = this->renderView()) {
-        if (renderView->usesCompositing())
-            renderView->compositor()->frameViewDidScroll();
-    }
-}
-
-void FrameView::repaintFixedElementsAfterScrolling()
-{
-    // For fixed position elements, update widget positions and compositing layers after scrolling,
-    // but only if we're not inside of layout.
-    if (!m_nestedLayoutCount && hasViewportConstrainedObjects()) {
-        if (RenderView* renderView = this->renderView()) {
-            renderView->updateWidgetPositions();
-            renderView->layer()->updateLayerPositionsAfterDocumentScroll();
-        }
-    }
-}
-
-void FrameView::updateFixedElementsAfterScrolling()
-{
-    if (m_nestedLayoutCount <= 1 && hasViewportConstrainedObjects()) {
-        if (RenderView* renderView = this->renderView())
-            renderView->compositor()->updateCompositingLayers(CompositingUpdateOnScroll);
-    }
-}
-
-bool FrameView::shouldRubberBandInDirection(ScrollDirection direction) const
-{
-    Page* page = frame().page();
-    if (!page)
-        return ScrollView::shouldRubberBandInDirection(direction);
-    return page->chrome().client().shouldRubberBandInDirection(direction);
-}
-
-bool FrameView::isRubberBandInProgress() const
-{
-    if (scrollbarsSuppressed())
-        return false;
-
-    // If the main thread updates the scroll position for this FrameView, we should return
-    // ScrollAnimator::isRubberBandInProgress().
-    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
-        return scrollAnimator->isRubberBandInProgress();
-
-    return false;
-}
-
-bool FrameView::requestScrollPositionUpdate(const IntPoint& position)
-{
-    return false;
-}
-
-HostWindow* FrameView::hostWindow() const
-{
-    Page* page = frame().page();
-    if (!page)
-        return 0;
-    return &page->chrome();
-}
-
-const unsigned cRepaintRectUnionThreshold = 25;
-
-void FrameView::repaintContentRectangle(const IntRect& r)
-{
-    ASSERT(!m_frame->ownerElement());
-
-    if (m_isTrackingRepaints) {
-        IntRect repaintRect = r;
-        repaintRect.move(-scrollOffset());
-        m_trackedRepaintRects.append(repaintRect);
-    }
-
-    double delay = m_deferringRepaints ? 0 : adjustedDeferredRepaintDelay();
-    if (m_deferringRepaints || m_deferredRepaintTimer.isActive() || delay) {
-        IntRect paintRect = r;
-        if (clipsRepaints() && !paintsEntireContents())
-            paintRect.intersect(visibleContentRect());
-        if (paintRect.isEmpty())
-            return;
-        if (m_repaintCount == cRepaintRectUnionThreshold) {
-            IntRect unionedRect;
-            for (unsigned i = 0; i < cRepaintRectUnionThreshold; ++i)
-                unionedRect.unite(pixelSnappedIntRect(m_repaintRects[i]));
-            m_repaintRects.clear();
-            m_repaintRects.append(unionedRect);
-        }
-        if (m_repaintCount < cRepaintRectUnionThreshold)
-            m_repaintRects.append(paintRect);
-        else
-            m_repaintRects[0].unite(paintRect);
-        m_repaintCount++;
-
-        if (!m_deferringRepaints)
-            startDeferredRepaintTimer(delay);
-
-        return;
-    }
-
-    if (!shouldUpdate())
-        return;
-
-    ScrollView::repaintContentRectangle(r);
-}
-
-void FrameView::contentsResized()
-{
-    ScrollView::contentsResized();
-    setNeedsLayout();
-}
-
-void FrameView::visibleContentsResized()
-{
-    // We check to make sure the view is attached to a frame() as this method can
-    // be triggered before the view is attached by Frame::createView(...) setting
-    // various values such as setScrollBarModes(...) for example.  An ASSERT is
-    // triggered when a view is layout before being attached to a frame().
-    if (!frame().view())
-        return;
-
-    if (!useFixedLayout() && needsLayout())
-        layout();
-
-    if (RenderView* renderView = this->renderView()) {
-        if (renderView->usesCompositing())
-            renderView->compositor()->frameViewDidChangeSize();
-    }
-}
-
-void FrameView::beginDeferredRepaints()
-{
-    Page* page = m_frame->page();
-    ASSERT(page);
-
-    if (!isMainFrame()) {
-        page->mainFrame()->view()->beginDeferredRepaints();
-        return;
-    }
-
-    m_deferringRepaints++;
-}
-
-void FrameView::endDeferredRepaints()
-{
-    Page* page = m_frame->page();
-    ASSERT(page);
-
-    if (!isMainFrame()) {
-        page->mainFrame()->view()->endDeferredRepaints();
-        return;
-    }
-
-    ASSERT(m_deferringRepaints > 0);
-
-    if (--m_deferringRepaints)
-        return;
-
-    if (m_deferredRepaintTimer.isActive())
-        return;
-
-    if (double delay = adjustedDeferredRepaintDelay()) {
-        startDeferredRepaintTimer(delay);
-        return;
-    }
-
-    doDeferredRepaints();
-}
-
-void FrameView::startDeferredRepaintTimer(double delay)
-{
-    if (m_deferredRepaintTimer.isActive())
-        return;
-
-    if (m_disableRepaints)
-        return;
-
-    m_deferredRepaintTimer.startOneShot(delay);
-}
-
-void FrameView::handleLoadCompleted()
-{
-    // Once loading has completed, allow autoSize one last opportunity to
-    // reduce the size of the frame.
-    autoSizeIfEnabled();
-    if (shouldUseLoadTimeDeferredRepaintDelay())
-        return;
-    m_deferredRepaintDelay = s_normalDeferredRepaintDelay;
-    flushDeferredRepaints();
-}
-
-void FrameView::flushDeferredRepaints()
-{
-    if (!m_deferredRepaintTimer.isActive())
-        return;
-    m_deferredRepaintTimer.stop();
-    doDeferredRepaints();
-}
-
-void FrameView::doDeferredRepaints()
-{
-    if (m_disableRepaints)
-        return;
-
-    ASSERT(!m_deferringRepaints);
-    if (!shouldUpdate()) {
-        m_repaintRects.clear();
-        m_repaintCount = 0;
-        return;
-    }
-    unsigned size = m_repaintRects.size();
-    for (unsigned i = 0; i < size; i++) {
-        ScrollView::repaintContentRectangle(pixelSnappedIntRect(m_repaintRects[i]));
-    }
-    m_repaintRects.clear();
-    m_repaintCount = 0;
-
-    updateDeferredRepaintDelayAfterRepaint();
-}
-
-bool FrameView::shouldUseLoadTimeDeferredRepaintDelay() const
-{
-    // Don't defer after the initial load of the page has been completed.
-    if (m_frame->tree()->top()->document()->loadEventFinished())
-        return false;
-    Document* document = m_frame->document();
-    if (!document)
-        return false;
-    if (document->parsing())
-        return true;
-    if (document->fetcher()->requestCount())
-        return true;
-    return false;
-}
-
-void FrameView::updateDeferredRepaintDelayAfterRepaint()
-{
-    if (!shouldUseLoadTimeDeferredRepaintDelay()) {
-        m_deferredRepaintDelay = s_normalDeferredRepaintDelay;
-        return;
-    }
-    double incrementedRepaintDelay = m_deferredRepaintDelay + s_deferredRepaintDelayIncrementDuringLoading;
-    m_deferredRepaintDelay = std::min(incrementedRepaintDelay, s_maxDeferredRepaintDelayDuringLoading);
-}
-
-void FrameView::resetDeferredRepaintDelay()
-{
-    m_deferredRepaintDelay = 0;
-    if (m_deferredRepaintTimer.isActive()) {
-        m_deferredRepaintTimer.stop();
-        if (!m_deferringRepaints)
-            doDeferredRepaints();
-    }
-}
-
-double FrameView::adjustedDeferredRepaintDelay() const
-{
-    ASSERT(!m_deferringRepaints);
-    if (!m_deferredRepaintDelay)
-        return 0;
-    double timeSinceLastPaint = currentTime() - m_lastPaintTime;
-    return max(0., m_deferredRepaintDelay - timeSinceLastPaint);
-}
-
-void FrameView::deferredRepaintTimerFired(Timer<FrameView>*)
-{
-    doDeferredRepaints();
-}
-
-void FrameView::beginDisableRepaints()
-{
-    m_disableRepaints++;
-}
-
-void FrameView::endDisableRepaints()
-{
-    ASSERT(m_disableRepaints > 0);
-    m_disableRepaints--;
-}
-
-void FrameView::layoutTimerFired(Timer<FrameView>*)
-{
-    layout();
-}
-
-void FrameView::scheduleRelayout()
-{
-    ASSERT(m_frame->view() == this);
-
-    if (m_layoutRoot) {
-        m_layoutRoot->markContainingBlocksForLayout(false);
-        m_layoutRoot = 0;
-    }
-    if (!m_layoutSchedulingEnabled)
-        return;
-    if (!needsLayout())
-        return;
-    if (!m_frame->document()->shouldScheduleLayout())
-        return;
-    InspectorInstrumentation::didInvalidateLayout(m_frame.get());
-
-    // When frame seamless is enabled, the contents of the frame could affect the layout of the parent frames.
-    // Also invalidate parent frame starting from the owner element of this frame.
-    if (m_frame->ownerRenderer() && m_frame->document()->shouldDisplaySeamlesslyWithParent())
-        m_frame->ownerRenderer()->setNeedsLayout();
-
-    int delay = m_frame->document()->minimumLayoutDelay();
-    if (m_layoutTimer.isActive() && m_delayedLayout && !delay)
-        unscheduleRelayout();
-    if (m_layoutTimer.isActive())
-        return;
-
-    m_delayedLayout = delay != 0;
-    m_layoutTimer.startOneShot(delay * 0.001);
-}
-
-static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* descendant)
-{
-    for (RenderObject* r = descendant; r; r = r->container()) {
-        if (r == ancestor)
-            return true;
-    }
-    return false;
-}
-
-void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot)
-{
-    ASSERT(m_frame->view() == this);
-
-    RenderView* renderView = this->renderView();
-    if (renderView && renderView->needsLayout()) {
-        if (relayoutRoot)
-            relayoutRoot->markContainingBlocksForLayout(false);
-        return;
-    }
-
-    if (layoutPending() || !m_layoutSchedulingEnabled) {
-        if (m_layoutRoot != relayoutRoot) {
-            if (isObjectAncestorContainerOf(m_layoutRoot, relayoutRoot)) {
-                // Keep the current root
-                relayoutRoot->markContainingBlocksForLayout(false, m_layoutRoot);
-                ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
-            } else if (m_layoutRoot && isObjectAncestorContainerOf(relayoutRoot, m_layoutRoot)) {
-                // Re-root at relayoutRoot
-                m_layoutRoot->markContainingBlocksForLayout(false, relayoutRoot);
-                m_layoutRoot = relayoutRoot;
-                ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
-                InspectorInstrumentation::didInvalidateLayout(m_frame.get());
-            } else {
-                // Just do a full relayout
-                if (m_layoutRoot)
-                    m_layoutRoot->markContainingBlocksForLayout(false);
-                m_layoutRoot = 0;
-                relayoutRoot->markContainingBlocksForLayout(false);
-                InspectorInstrumentation::didInvalidateLayout(m_frame.get());
-            }
-        }
-    } else if (m_layoutSchedulingEnabled) {
-        int delay = m_frame->document()->minimumLayoutDelay();
-        m_layoutRoot = relayoutRoot;
-        ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
-        InspectorInstrumentation::didInvalidateLayout(m_frame.get());
-        m_delayedLayout = delay != 0;
-        m_layoutTimer.startOneShot(delay * 0.001);
-    }
-}
-
-bool FrameView::layoutPending() const
-{
-    return m_layoutTimer.isActive();
-}
-
-bool FrameView::needsLayout() const
-{
-    // This can return true in cases where the document does not have a body yet.
-    // Document::shouldScheduleLayout takes care of preventing us from scheduling
-    // layout in that case.
-
-    RenderView* renderView = this->renderView();
-    return layoutPending()
-        || (renderView && renderView->needsLayout())
-        || m_layoutRoot
-        || (m_deferSetNeedsLayouts && m_setNeedsLayoutWasDeferred);
-}
-
-void FrameView::setNeedsLayout()
-{
-    if (m_deferSetNeedsLayouts) {
-        m_setNeedsLayoutWasDeferred = true;
-        return;
-    }
-
-    if (RenderView* renderView = this->renderView())
-        renderView->setNeedsLayout();
-}
-
-void FrameView::unscheduleRelayout()
-{
-    if (!m_layoutTimer.isActive())
-        return;
-
-    m_layoutTimer.stop();
-    m_delayedLayout = false;
-}
-
-void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime)
-{
-    for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree()->traverseNext()) {
-        frame->view()->serviceScrollAnimations();
-        if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
-            frame->animation()->serviceAnimations();
-        if (RuntimeEnabledFeatures::webAnimationsEnabled())
-            frame->document()->timeline()->serviceAnimations(monotonicAnimationStartTime);
-    }
-
-    Vector<RefPtr<Document> > documents;
-    for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext())
-        documents.append(frame->document());
-
-    for (size_t i = 0; i < documents.size(); ++i)
-        documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime);
-}
-
-bool FrameView::isTransparent() const
-{
-    return m_isTransparent;
-}
-
-void FrameView::setTransparent(bool isTransparent)
-{
-    m_isTransparent = isTransparent;
-    if (renderView() && renderView()->layer()->backing())
-        renderView()->layer()->backing()->updateContentsOpaque();
-}
-
-bool FrameView::hasOpaqueBackground() const
-{
-    return !m_isTransparent && !m_baseBackgroundColor.hasAlpha();
-}
-
-Color FrameView::baseBackgroundColor() const
-{
-    return m_baseBackgroundColor;
-}
-
-void FrameView::setBaseBackgroundColor(const Color& backgroundColor)
-{
-    if (!backgroundColor.isValid())
-        m_baseBackgroundColor = Color::white;
-    else
-        m_baseBackgroundColor = backgroundColor;
-
-    if (RenderLayerBacking* backing = renderView() ? renderView()->layer()->backing() : 0) {
-        backing->updateContentsOpaque();
-        if (backing->graphicsLayer())
-            backing->graphicsLayer()->setNeedsDisplay();
-    }
-    recalculateScrollbarOverlayStyle();
-}
-
-void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool transparent)
-{
-    for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext(m_frame.get())) {
-        if (FrameView* view = frame->view()) {
-            view->setTransparent(transparent);
-            view->setBaseBackgroundColor(backgroundColor);
-        }
-    }
-}
-
-bool FrameView::shouldUpdateWhileOffscreen() const
-{
-    return m_shouldUpdateWhileOffscreen;
-}
-
-void FrameView::setShouldUpdateWhileOffscreen(bool shouldUpdateWhileOffscreen)
-{
-    m_shouldUpdateWhileOffscreen = shouldUpdateWhileOffscreen;
-}
-
-bool FrameView::shouldUpdate() const
-{
-    if (isOffscreen() && !shouldUpdateWhileOffscreen())
-        return false;
-    return true;
-}
-
-void FrameView::scheduleEvent(PassRefPtr<Event> event, PassRefPtr<Node> eventTarget)
-{
-    m_actionScheduler->scheduleEvent(event, eventTarget);
-}
-
-void FrameView::pauseScheduledEvents()
-{
-    m_actionScheduler->pause();
-}
-
-void FrameView::resumeScheduledEvents()
-{
-    m_actionScheduler->resume();
-}
-
-void FrameView::scrollToAnchor()
-{
-    RefPtr<Node> anchorNode = m_maintainScrollPositionAnchor;
-    if (!anchorNode)
-        return;
-
-    if (!anchorNode->renderer())
-        return;
-
-    LayoutRect rect;
-    if (anchorNode != m_frame->document())
-        rect = anchorNode->boundingBox();
-
-    // Scroll nested layers and frames to reveal the anchor.
-    // Align to the top and to the closest side (this matches other browsers).
-    anchorNode->renderer()->scrollRectToVisible(rect, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways);
-
-    if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache())
-        cache->handleScrolledToAnchor(anchorNode.get());
-
-    // scrollRectToVisible can call into setScrollPosition(), which resets m_maintainScrollPositionAnchor.
-    m_maintainScrollPositionAnchor = anchorNode;
-}
-
-void FrameView::updateWidget(RenderObject* object)
-{
-    ASSERT(!object->node() || object->node()->isElementNode());
-    Element* ownerElement = toElement(object->node());
-    // The object may have already been destroyed (thus node cleared),
-    // but FrameView holds a manual ref, so it won't have been deleted.
-    ASSERT(m_widgetUpdateSet->contains(object));
-    if (!ownerElement)
-        return;
-
-    if (object->isEmbeddedObject()) {
-        RenderEmbeddedObject* embeddedObject = static_cast<RenderEmbeddedObject*>(object);
-        // No need to update if it's already crashed or known to be missing.
-        if (embeddedObject->showsUnavailablePluginIndicator())
-            return;
-
-        // FIXME: This could turn into a real virtual dispatch if we defined
-        // updateWidget(PluginCreationOption) on HTMLElement.
-        if (ownerElement->hasTagName(objectTag) || ownerElement->hasTagName(embedTag) || ownerElement->hasTagName(appletTag)) {
-            HTMLPlugInImageElement* pluginElement = toHTMLPlugInImageElement(ownerElement);
-            if (pluginElement->needsWidgetUpdate())
-                pluginElement->updateWidget(CreateAnyWidgetType);
-        } else
-            ASSERT_NOT_REACHED();
-
-        // Caution: it's possible the object was destroyed again, since loading a
-        // plugin may run any arbitrary JavaScript.
-        embeddedObject->updateWidgetPosition();
-    }
-}
-
-bool FrameView::updateWidgets()
-{
-    if (m_nestedLayoutCount > 1 || !m_widgetUpdateSet || m_widgetUpdateSet->isEmpty())
-        return true;
-
-    size_t size = m_widgetUpdateSet->size();
-
-    Vector<RenderObject*> objects;
-    objects.reserveInitialCapacity(size);
-
-    RenderObjectSet::const_iterator end = m_widgetUpdateSet->end();
-    for (RenderObjectSet::const_iterator it = m_widgetUpdateSet->begin(); it != end; ++it) {
-        RenderObject* object = *it;
-        objects.uncheckedAppend(object);
-        if (object->isEmbeddedObject()) {
-            RenderEmbeddedObject* embeddedObject = static_cast<RenderEmbeddedObject*>(object);
-            embeddedObject->ref();
-        }
-    }
-
-    for (size_t i = 0; i < size; ++i) {
-        RenderObject* object = objects[i];
-        updateWidget(object);
-        m_widgetUpdateSet->remove(object);
-    }
-
-    for (size_t i = 0; i < size; ++i) {
-        RenderObject* object = objects[i];
-        if (object->isEmbeddedObject()) {
-            RenderEmbeddedObject* embeddedObject = static_cast<RenderEmbeddedObject*>(object);
-            embeddedObject->deref();
-        }
-    }
-
-    return m_widgetUpdateSet->isEmpty();
-}
-
-void FrameView::flushAnyPendingPostLayoutTasks()
-{
-    if (!m_postLayoutTasksTimer.isActive())
-        return;
-
-    performPostLayoutTasks();
-}
-
-void FrameView::performPostLayoutTasks()
-{
-    TRACE_EVENT0("webkit", "FrameView::performPostLayoutTasks");
-    // updateWidgets() call below can blow us away from underneath.
-    RefPtr<FrameView> protect(this);
-
-    m_postLayoutTasksTimer.stop();
-
-    m_frame->selection().setCaretRectNeedsUpdate();
-    m_frame->selection().updateAppearance();
-
-    LayoutMilestones milestonesOfInterest = 0;
-    LayoutMilestones milestonesAchieved = 0;
-    Page* page = m_frame->page();
-    if (page)
-        milestonesOfInterest = page->layoutMilestones();
-
-    if (m_nestedLayoutCount <= 1) {
-        if (m_firstLayoutCallbackPending) {
-            m_firstLayoutCallbackPending = false;
-            m_frame->loader()->didFirstLayout();
-            if (milestonesOfInterest & DidFirstLayout)
-                milestonesAchieved |= DidFirstLayout;
-            if (isMainFrame())
-                page->startCountingRelevantRepaintedObjects();
-        }
-
-        // Ensure that we always send this eventually.
-        if (!m_frame->document()->parsing() && m_frame->loader()->stateMachine()->committedFirstRealDocumentLoad())
-            m_isVisuallyNonEmpty = true;
-
-        // If the layout was done with pending sheets, we are not in fact visually non-empty yet.
-        if (m_isVisuallyNonEmpty && !m_frame->document()->didLayoutWithPendingStylesheets() && m_firstVisuallyNonEmptyLayoutCallbackPending) {
-            m_firstVisuallyNonEmptyLayoutCallbackPending = false;
-            if (milestonesOfInterest & DidFirstVisuallyNonEmptyLayout)
-                milestonesAchieved |= DidFirstVisuallyNonEmptyLayout;
-        }
-    }
-
-    m_frame->loader()->didLayout(milestonesAchieved);
-    m_frame->document()->fonts()->didLayout();
-
-    RenderView* renderView = this->renderView();
-    if (renderView)
-        renderView->updateWidgetPositions();
-
-    for (unsigned i = 0; i < maxUpdateWidgetsIterations; i++) {
-        if (updateWidgets())
-            break;
-    }
-
-    if (page) {
-        if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
-            scrollingCoordinator->frameViewLayoutUpdated(this);
-    }
-
-    scrollToAnchor();
-
-    m_actionScheduler->resume();
-
-    sendResizeEventIfNeeded();
-}
-
-void FrameView::sendResizeEventIfNeeded()
-{
-    ASSERT(m_frame);
-
-    RenderView* renderView = this->renderView();
-    if (!renderView || renderView->document().printing())
-        return;
-
-    IntSize currentSize = layoutSize(IncludeScrollbars);
-    float currentZoomFactor = renderView->style()->zoom();
-
-    bool shouldSendResizeEvent = currentSize != m_lastViewportSize || currentZoomFactor != m_lastZoomFactor;
-
-    m_lastViewportSize = currentSize;
-    m_lastZoomFactor = currentZoomFactor;
-
-    if (!shouldSendResizeEvent)
-        return;
-
-    m_frame->eventHandler()->sendResizeEvent();
-
-    Page* page = m_frame->page();
-    if (isMainFrame())
-        InspectorInstrumentation::didResizeMainFrame(page);
-}
-
-void FrameView::postLayoutTimerFired(Timer<FrameView>*)
-{
-    performPostLayoutTasks();
-}
-
-void FrameView::updateCounters()
-{
-    RenderView* view = renderView();
-    if (!view->hasRenderCounters())
-        return;
-
-    for (RenderObject* renderer = view; renderer; renderer = renderer->nextInPreOrder()) {
-        if (!renderer->isCounter())
-            continue;
-
-        toRenderCounter(renderer)->updateCounter();
-    }
-}
-
-void FrameView::autoSizeIfEnabled()
-{
-    if (!m_shouldAutoSize)
-        return;
-
-    if (m_inAutoSize)
-        return;
-
-    TemporaryChange<bool> changeInAutoSize(m_inAutoSize, true);
-
-    Document* document = frame().document();
-    if (!document)
-        return;
-
-    RenderView* documentView = document->renderView();
-    Element* documentElement = document->documentElement();
-    if (!documentView || !documentElement)
-        return;
-
-    RenderBox* documentRenderBox = documentElement->renderBox();
-    if (!documentRenderBox)
-        return;
-
-    // If this is the first time we run autosize, start from small height and
-    // allow it to grow.
-    if (!m_didRunAutosize)
-        resize(frameRect().width(), m_minAutoSize.height());
-
-    IntSize size = frameRect().size();
-
-    // Do the resizing twice. The first time is basically a rough calculation using the preferred width
-    // which may result in a height change during the second iteration.
-    for (int i = 0; i < 2; i++) {
-        // Update various sizes including contentsSize, scrollHeight, etc.
-        document->updateLayoutIgnorePendingStylesheets();
-        int width = documentView->minPreferredLogicalWidth();
-        int height = documentRenderBox->scrollHeight();
-        IntSize newSize(width, height);
-
-        // Check to see if a scrollbar is needed for a given dimension and
-        // if so, increase the other dimension to account for the scrollbar.
-        // Since the dimensions are only for the view rectangle, once a
-        // dimension exceeds the maximum, there is no need to increase it further.
-        if (newSize.width() > m_maxAutoSize.width()) {
-            RefPtr<Scrollbar> localHorizontalScrollbar = horizontalScrollbar();
-            if (!localHorizontalScrollbar)
-                localHorizontalScrollbar = createScrollbar(HorizontalScrollbar);
-            if (!localHorizontalScrollbar->isOverlayScrollbar())
-                newSize.setHeight(newSize.height() + localHorizontalScrollbar->height());
-
-            // Don't bother checking for a vertical scrollbar because the width is at
-            // already greater the maximum.
-        } else if (newSize.height() > m_maxAutoSize.height()) {
-            RefPtr<Scrollbar> localVerticalScrollbar = verticalScrollbar();
-            if (!localVerticalScrollbar)
-                localVerticalScrollbar = createScrollbar(VerticalScrollbar);
-            if (!localVerticalScrollbar->isOverlayScrollbar())
-                newSize.setWidth(newSize.width() + localVerticalScrollbar->width());
-
-            // Don't bother checking for a horizontal scrollbar because the height is
-            // already greater the maximum.
-        }
-
-        // Ensure the size is at least the min bounds.
-        newSize = newSize.expandedTo(m_minAutoSize);
-
-        // Bound the dimensions by the max bounds and determine what scrollbars to show.
-        ScrollbarMode horizonalScrollbarMode = ScrollbarAlwaysOff;
-        if (newSize.width() > m_maxAutoSize.width()) {
-            newSize.setWidth(m_maxAutoSize.width());
-            horizonalScrollbarMode = ScrollbarAlwaysOn;
-        }
-        ScrollbarMode verticalScrollbarMode = ScrollbarAlwaysOff;
-        if (newSize.height() > m_maxAutoSize.height()) {
-            newSize.setHeight(m_maxAutoSize.height());
-            verticalScrollbarMode = ScrollbarAlwaysOn;
-        }
-
-        if (newSize == size)
-            continue;
-
-        // While loading only allow the size to increase (to avoid twitching during intermediate smaller states)
-        // unless autoresize has just been turned on or the maximum size is smaller than the current size.
-        if (m_didRunAutosize && size.height() <= m_maxAutoSize.height() && size.width() <= m_maxAutoSize.width()
-            && !m_frame->document()->loadEventFinished() && (newSize.height() < size.height() || newSize.width() < size.width()))
-            break;
-
-        resize(newSize.width(), newSize.height());
-        // Force the scrollbar state to avoid the scrollbar code adding them and causing them to be needed. For example,
-        // a vertical scrollbar may cause text to wrap and thus increase the height (which is the only reason the scollbar is needed).
-        setVerticalScrollbarLock(false);
-        setHorizontalScrollbarLock(false);
-        setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, true);
-    }
-    m_didRunAutosize = true;
-}
-
-void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow)
-{
-    if (!m_viewportRenderer)
-        return;
-
-    if (m_overflowStatusDirty) {
-        m_horizontalOverflow = horizontalOverflow;
-        m_verticalOverflow = verticalOverflow;
-        m_overflowStatusDirty = false;
-        return;
-    }
-
-    bool horizontalOverflowChanged = (m_horizontalOverflow != horizontalOverflow);
-    bool verticalOverflowChanged = (m_verticalOverflow != verticalOverflow);
-
-    if (horizontalOverflowChanged || verticalOverflowChanged) {
-        m_horizontalOverflow = horizontalOverflow;
-        m_verticalOverflow = verticalOverflow;
-
-        m_actionScheduler->scheduleEvent(OverflowEvent::create(horizontalOverflowChanged, horizontalOverflow,
-            verticalOverflowChanged, verticalOverflow),
-            m_viewportRenderer->node());
-    }
-
-}
-
-const Pagination& FrameView::pagination() const
-{
-    if (m_pagination != Pagination())
-        return m_pagination;
-
-    if (isMainFrame())
-        return m_frame->page()->pagination();
-
-    return m_pagination;
-}
-
-void FrameView::setPagination(const Pagination& pagination)
-{
-    if (m_pagination == pagination)
-        return;
-
-    m_pagination = pagination;
-
-    m_frame->document()->styleResolverChanged(RecalcStyleDeferred);
-}
-
-IntRect FrameView::windowClipRect(bool clipToContents) const
-{
-    ASSERT(m_frame->view() == this);
-
-    if (paintsEntireContents())
-        return IntRect(IntPoint(), contentsSize());
-
-    // Set our clip rect to be our contents.
-    IntRect clipRect = contentsToWindow(visibleContentRect(clipToContents ? ExcludeScrollbars : IncludeScrollbars));
-    if (!m_frame->ownerElement())
-        return clipRect;
-
-    // Take our owner element and get its clip rect.
-    HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement();
-    FrameView* parentView = ownerElement->document().view();
-    if (parentView)
-        clipRect.intersect(parentView->windowClipRectForFrameOwner(ownerElement, true));
-    return clipRect;
-}
-
-IntRect FrameView::windowClipRectForFrameOwner(const HTMLFrameOwnerElement* ownerElement, bool clipToLayerContents) const
-{
-    // The renderer can sometimes be null when style="display:none" interacts
-    // with external content and plugins.
-    if (!ownerElement->renderer())
-        return windowClipRect();
-
-    // If we have no layer, just return our window clip rect.
-    const RenderLayer* enclosingLayer = ownerElement->renderer()->enclosingLayer();
-    if (!enclosingLayer)
-        return windowClipRect();
-
-    // Apply the clip from the layer.
-    IntRect clipRect;
-    if (clipToLayerContents)
-        clipRect = pixelSnappedIntRect(enclosingLayer->childrenClipRect());
-    else
-        clipRect = pixelSnappedIntRect(enclosingLayer->selfClipRect());
-    clipRect = contentsToWindow(clipRect);
-    return intersection(clipRect, windowClipRect());
-}
-
-bool FrameView::isActive() const
-{
-    Page* page = frame().page();
-    return page && page->focusController().isActive();
-}
-
-void FrameView::scrollTo(const IntSize& newOffset)
-{
-    LayoutSize offset = scrollOffset();
-    ScrollView::scrollTo(newOffset);
-    if (offset != scrollOffset())
-        scrollPositionChanged();
-    frame().loader()->client()->didChangeScrollOffset();
-}
-
-void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
-{
-    // Add in our offset within the FrameView.
-    IntRect dirtyRect = rect;
-    dirtyRect.moveBy(scrollbar->location());
-    invalidateRect(dirtyRect);
-}
-
-void FrameView::getTickmarks(Vector<IntRect>& tickmarks) const
-{
-    tickmarks = frame().document()->markers()->renderedRectsForMarkers(DocumentMarker::TextMatch);
-}
-
-IntRect FrameView::windowResizerRect() const
-{
-    Page* page = frame().page();
-    if (!page)
-        return IntRect();
-    return page->chrome().windowResizerRect();
-}
-
-void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor)
-{
-    if (m_visibleContentScaleFactor == visibleContentScaleFactor)
-        return;
-
-    m_visibleContentScaleFactor = visibleContentScaleFactor;
-    updateScrollbars(scrollOffset());
-}
-
-bool FrameView::scrollbarsCanBeActive() const
-{
-    if (m_frame->view() != this)
-        return false;
-
-    return !!m_frame->document();
-}
-
-ScrollableArea* FrameView::enclosingScrollableArea() const
-{
-    // FIXME: Walk up the frame tree and look for a scrollable parent frame or RenderLayer.
-    return 0;
-}
-
-IntRect FrameView::scrollableAreaBoundingBox() const
-{
-    RenderPart* ownerRenderer = frame().ownerRenderer();
-    if (!ownerRenderer)
-        return frameRect();
-
-    return ownerRenderer->absoluteContentQuad().enclosingBoundingBox();
-}
-
-bool FrameView::isScrollable()
-{
-    // Check for:
-    // 1) If there an actual overflow.
-    // 2) display:none or visibility:hidden set to self or inherited.
-    // 3) overflow{-x,-y}: hidden;
-    // 4) scrolling: no;
-
-    // Covers #1
-    IntSize contentsSize = this->contentsSize();
-    IntSize visibleContentSize = visibleContentRect().size();
-    if ((contentsSize.height() <= visibleContentSize.height() && contentsSize.width() <= visibleContentSize.width()))
-        return false;
-
-    // Covers #2.
-    HTMLFrameOwnerElement* owner = m_frame->ownerElement();
-    if (owner && (!owner->renderer() || !owner->renderer()->visibleToHitTesting()))
-        return false;
-
-    // Cover #3 and #4.
-    ScrollbarMode horizontalMode;
-    ScrollbarMode verticalMode;
-    calculateScrollbarModesForLayout(horizontalMode, verticalMode, RulesFromWebContentOnly);
-    if (horizontalMode == ScrollbarAlwaysOff && verticalMode == ScrollbarAlwaysOff)
-        return false;
-
-    return true;
-}
-
-void FrameView::updateScrollableAreaSet()
-{
-    // That ensures that only inner frames are cached.
-    FrameView* parentFrameView = this->parentFrameView();
-    if (!parentFrameView)
-        return;
-
-    if (!isScrollable()) {
-        parentFrameView->removeScrollableArea(this);
-        return;
-    }
-
-    parentFrameView->addScrollableArea(this);
-}
-
-bool FrameView::shouldSuspendScrollAnimations() const
-{
-    return m_frame->loader()->state() != FrameStateComplete;
-}
-
-void FrameView::scrollbarStyleChanged(int newStyle, bool forceUpdate)
-{
-    if (!isMainFrame())
-        return;
-
-    if (forceUpdate)
-        ScrollView::scrollbarStyleChanged(newStyle, forceUpdate);
-}
-
-void FrameView::setAnimatorsAreActive()
-{
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    if (ScrollAnimator* scrollAnimator = existingScrollAnimator())
-        scrollAnimator->setIsActive();
-
-    if (!m_scrollableAreas)
-        return;
-
-    for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin(), end = m_scrollableAreas->end(); it != end; ++it) {
-        ScrollableArea* scrollableArea = *it;
-
-        ASSERT(scrollableArea->scrollbarsCanBeActive());
-        scrollableArea->scrollAnimator()->setIsActive();
-    }
-}
-
-void FrameView::notifyPageThatContentAreaWillPaint() const
-{
-    Page* page = m_frame->page();
-    if (!page)
-        return;
-
-    contentAreaWillPaint();
-
-    if (!m_scrollableAreas)
-        return;
-
-    for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin(), end = m_scrollableAreas->end(); it != end; ++it) {
-        ScrollableArea* scrollableArea = *it;
-
-        if (!scrollableArea->scrollbarsCanBeActive())
-            continue;
-
-        scrollableArea->contentAreaWillPaint();
-    }
-}
-
-bool FrameView::scrollAnimatorEnabled() const
-{
-    if (Page* page = m_frame->page())
-        return page->settings().scrollAnimatorEnabled();
-    return false;
-}
-
-void FrameView::updateAnnotatedRegions()
-{
-    Document* document = m_frame->document();
-    if (!document->hasAnnotatedRegions())
-        return;
-    Vector<AnnotatedRegionValue> newRegions;
-    document->renderBox()->collectAnnotatedRegions(newRegions);
-    if (newRegions == document->annotatedRegions())
-        return;
-    document->setAnnotatedRegions(newRegions);
-    if (Page* page = m_frame->page())
-        page->chrome().client().annotatedRegionsChanged();
-}
-
-void FrameView::updateScrollCorner()
-{
-    RefPtr<RenderStyle> cornerStyle;
-    IntRect cornerRect = scrollCornerRect();
-    Document* doc = m_frame->document();
-
-    if (doc && !cornerRect.isEmpty()) {
-        // Try the <body> element first as a scroll corner source.
-        if (Element* body = doc->body()) {
-            if (RenderObject* renderer = body->renderer())
-                cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), renderer->style());
-        }
-
-        if (!cornerStyle) {
-            // If the <body> didn't have a custom style, then the root element might.
-            if (Element* docElement = doc->documentElement()) {
-                if (RenderObject* renderer = docElement->renderer())
-                    cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), renderer->style());
-            }
-        }
-
-        if (!cornerStyle) {
-            // If we have an owning iframe/frame element, then it can set the custom scrollbar also.
-            if (RenderPart* renderer = m_frame->ownerRenderer())
-                cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), renderer->style());
-        }
-    }
-
-    if (cornerStyle) {
-        if (!m_scrollCorner)
-            m_scrollCorner = RenderScrollbarPart::createAnonymous(doc);
-        m_scrollCorner->setStyle(cornerStyle.release());
-        invalidateScrollCorner(cornerRect);
-    } else if (m_scrollCorner) {
-        m_scrollCorner->destroy();
-        m_scrollCorner = 0;
-    }
-
-    ScrollView::updateScrollCorner();
-}
-
-void FrameView::paintScrollCorner(GraphicsContext* context, const IntRect& cornerRect)
-{
-    if (context->updatingControlTints()) {
-        updateScrollCorner();
-        return;
-    }
-
-    if (m_scrollCorner) {
-        bool needsBackgorund = isMainFrame();
-        if (needsBackgorund)
-            context->fillRect(cornerRect, baseBackgroundColor());
-        m_scrollCorner->paintIntoRect(context, cornerRect.location(), cornerRect);
-        return;
-    }
-
-    ScrollView::paintScrollCorner(context, cornerRect);
-}
-
-void FrameView::paintScrollbar(GraphicsContext* context, Scrollbar* bar, const IntRect& rect)
-{
-    bool needsBackgorund = bar->isCustomScrollbar() && isMainFrame();
-    if (needsBackgorund) {
-        IntRect toFill = bar->frameRect();
-        toFill.intersect(rect);
-        context->fillRect(toFill, baseBackgroundColor());
-    }
-
-    ScrollView::paintScrollbar(context, bar, rect);
-}
-
-Color FrameView::documentBackgroundColor() const
-{
-    // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background color of
-    // the document and the body against the base background color of the frame view.
-    // Background images are unfortunately impractical to include.
-
-    // Return invalid Color objects whenever there is insufficient information.
-    if (!frame().document())
-        return Color();
-
-    Element* htmlElement = frame().document()->documentElement();
-    Element* bodyElement = frame().document()->body();
-
-    // Start with invalid colors.
-    Color htmlBackgroundColor;
-    Color bodyBackgroundColor;
-    if (htmlElement && htmlElement->renderer())
-        htmlBackgroundColor = htmlElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
-    if (bodyElement && bodyElement->renderer())
-        bodyBackgroundColor = bodyElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
-
-    if (!bodyBackgroundColor.isValid()) {
-        if (!htmlBackgroundColor.isValid())
-            return Color();
-        return baseBackgroundColor().blend(htmlBackgroundColor);
-    }
-
-    if (!htmlBackgroundColor.isValid())
-        return baseBackgroundColor().blend(bodyBackgroundColor);
-
-    // We take the aggregate of the base background color
-    // the <html> background color, and the <body>
-    // background color to find the document color. The
-    // addition of the base background color is not
-    // technically part of the document background, but it
-    // otherwise poses problems when the aggregate is not
-    // fully opaque.
-    return baseBackgroundColor().blend(htmlBackgroundColor).blend(bodyBackgroundColor);
-}
-
-bool FrameView::hasCustomScrollbars() const
-{
-    const HashSet<RefPtr<Widget> >* viewChildren = children();
-    HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end();
-    for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) {
-        Widget* widget = current->get();
-        if (widget->isFrameView()) {
-            if (toFrameView(widget)->hasCustomScrollbars())
-                return true;
-        } else if (widget->isScrollbar()) {
-            Scrollbar* scrollbar = static_cast<Scrollbar*>(widget);
-            if (scrollbar->isCustomScrollbar())
-                return true;
-        }
-    }
-
-    return false;
-}
-
-FrameView* FrameView::parentFrameView() const
-{
-    if (!parent())
-        return 0;
-
-    if (Frame* parentFrame = m_frame->tree()->parent())
-        return parentFrame->view();
-
-    return 0;
-}
-
-void FrameView::updateControlTints()
-{
-    // This is called when control tints are changed from aqua/graphite to clear and vice versa.
-    // We do a "fake" paint, and when the theme gets a paint call, it can then do an invalidate.
-    // This is only done if the theme supports control tinting. It's up to the theme and platform
-    // to define when controls get the tint and to call this function when that changes.
-
-    // Optimize the common case where we bring a window to the front while it's still empty.
-    if (m_frame->document()->url().isEmpty())
-        return;
-
-    if (RenderTheme::theme().supportsControlTints() || hasCustomScrollbars())
-        paintControlTints();
-}
-
-void FrameView::paintControlTints()
-{
-    if (needsLayout())
-        layout();
-    // FIXME: The use of paint seems like overkill: crbug.com/236892
-    GraphicsContext context(0); // NULL canvas to get a non-painting context.
-    context.setUpdatingControlTints(true);
-    paint(&context, frameRect());
-}
-
-bool FrameView::wasScrolledByUser() const
-{
-    return m_wasScrolledByUser;
-}
-
-void FrameView::setWasScrolledByUser(bool wasScrolledByUser)
-{
-    if (m_inProgrammaticScroll)
-        return;
-    m_maintainScrollPositionAnchor = 0;
-    m_wasScrolledByUser = wasScrolledByUser;
-}
-
-void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
-{
-    Document* document = m_frame->document();
-
-#ifndef NDEBUG
-    bool fillWithRed;
-    if (document->printing())
-        fillWithRed = false; // Printing, don't fill with red (can't remember why).
-    else if (m_frame->ownerElement())
-        fillWithRed = false; // Subframe, don't fill with red.
-    else if (isTransparent())
-        fillWithRed = false; // Transparent, don't fill with red.
-    else if (m_paintBehavior & PaintBehaviorSelectionOnly)
-        fillWithRed = false; // Selections are transparent, don't fill with red.
-    else if (m_nodeToDraw)
-        fillWithRed = false; // Element images are transparent, don't fill with red.
-    else
-        fillWithRed = true;
-
-    if (fillWithRed)
-        p->fillRect(rect, Color(0xFF, 0, 0));
-#endif
-
-    RenderView* renderView = this->renderView();
-    if (!renderView) {
-        LOG_ERROR("called FrameView::paint with nil renderer");
-        return;
-    }
-
-    ASSERT(!needsLayout());
-    if (needsLayout())
-        return;
-
-    InspectorInstrumentation::willPaint(renderView);
-
-    bool isTopLevelPainter = !s_inPaintContents;
-    s_inPaintContents = true;
-
-    FontCachePurgePreventer fontCachePurgePreventer;
-
-    PaintBehavior oldPaintBehavior = m_paintBehavior;
-
-    if (FrameView* parentView = parentFrameView()) {
-        if (parentView->paintBehavior() & PaintBehaviorFlattenCompositingLayers)
-            m_paintBehavior |= PaintBehaviorFlattenCompositingLayers;
-    }
-
-    if (m_paintBehavior == PaintBehaviorNormal)
-        document->markers()->invalidateRenderedRectsForMarkersInRect(rect);
-
-    if (document->printing())
-        m_paintBehavior |= PaintBehaviorFlattenCompositingLayers;
-
-    ASSERT(!m_isPainting);
-    m_isPainting = true;
-
-    // m_nodeToDraw is used to draw only one element (and its descendants)
-    RenderObject* eltRenderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0;
-    RenderLayer* rootLayer = renderView->layer();
-
-#ifndef NDEBUG
-    renderView->assertSubtreeIsLaidOut();
-    RenderObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(rootLayer->renderer());
-#endif
-
-    RenderObject* enclosingLayerRenderer = eltRenderer->enclosingLayer() ? eltRenderer->enclosingLayer()->renderer() : eltRenderer;
-    rootLayer->paint(p, rect, m_paintBehavior, enclosingLayerRenderer);
-
-    if (rootLayer->containsDirtyOverlayScrollbars())
-        rootLayer->paintOverlayScrollbars(p, rect, m_paintBehavior, eltRenderer);
-
-    m_isPainting = false;
-
-    m_paintBehavior = oldPaintBehavior;
-    m_lastPaintTime = currentTime();
-
-    // Regions may have changed as a result of the visibility/z-index of element changing.
-    if (document->annotatedRegionsDirty())
-        updateAnnotatedRegions();
-
-    if (isTopLevelPainter) {
-        // Everythin that happens after paintContents completions is considered
-        // to be part of the next frame.
-        s_currentFrameTimeStamp = currentTime();
-        s_inPaintContents = false;
-    }
-
-    InspectorInstrumentation::didPaint(renderView, p, rect);
-}
-
-void FrameView::setPaintBehavior(PaintBehavior behavior)
-{
-    m_paintBehavior = behavior;
-}
-
-PaintBehavior FrameView::paintBehavior() const
-{
-    return m_paintBehavior;
-}
-
-bool FrameView::isPainting() const
-{
-    return m_isPainting;
-}
-
-void FrameView::setNodeToDraw(Node* node)
-{
-    m_nodeToDraw = node;
-}
-
-void FrameView::paintOverhangAreas(GraphicsContext* context, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect)
-{
-    if (context->paintingDisabled())
-        return;
-
-    if (m_frame->document()->printing())
-        return;
-
-    if (isMainFrame()) {
-        if (m_frame->page()->chrome().client().paintCustomOverhangArea(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect))
-            return;
-    }
-
-    ScrollView::paintOverhangAreas(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect);
-}
-
-void FrameView::updateLayoutAndStyleIfNeededRecursive()
-{
-    // We have to crawl our entire tree looking for any FrameViews that need
-    // layout and make sure they are up to date.
-    // Mac actually tests for intersection with the dirty region and tries not to
-    // update layout for frames that are outside the dirty region.  Not only does this seem
-    // pointless (since those frames will have set a zero timer to layout anyway), but
-    // it is also incorrect, since if two frames overlap, the first could be excluded from the dirty
-    // region but then become included later by the second frame adding rects to the dirty region
-    // when it lays out.
-
-    m_frame->document()->updateStyleIfNeeded();
-
-    if (needsLayout())
-        layout();
-
-    // Grab a copy of the children() set, as it may be mutated by the following updateLayoutAndStyleIfNeededRecursive
-    // calls, as they can potentially re-enter a layout of the parent frame view, which may add/remove scrollbars
-    // and thus mutates the children() set.
-    Vector<RefPtr<FrameView> > frameViews;
-    collectFrameViewChildren(this, frameViews);
-
-    const Vector<RefPtr<FrameView> >::iterator end = frameViews.end();
-    for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end; ++it)
-        (*it)->updateLayoutAndStyleIfNeededRecursive();
-
-    // updateLayoutAndStyleIfNeededRecursive is called when we need to make sure style and layout are up-to-date before
-    // painting, so we need to flush out any deferred repaints too.
-    flushDeferredRepaints();
-
-    // When seamless is on, child frame can mark parent frame dirty. In such case, child frame
-    // needs to call layout on parent frame recursively.
-    // This assert ensures that parent frames are clean, when child frames finished updating layout and style.
-    ASSERT(!needsLayout());
-}
-
-void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize)
-{
-    ASSERT(!enable || !minSize.isEmpty());
-    ASSERT(minSize.width() <= maxSize.width());
-    ASSERT(minSize.height() <= maxSize.height());
-
-    if (m_shouldAutoSize == enable && m_minAutoSize == minSize && m_maxAutoSize == maxSize)
-        return;
-
-    m_shouldAutoSize = enable;
-    m_minAutoSize = minSize;
-    m_maxAutoSize = maxSize;
-    m_didRunAutosize = false;
-
-    setNeedsLayout();
-    scheduleRelayout();
-    if (m_shouldAutoSize)
-        return;
-
-    // Since autosize mode forces the scrollbar mode, change them to being auto.
-    setVerticalScrollbarLock(false);
-    setHorizontalScrollbarLock(false);
-    setScrollbarModes(ScrollbarAuto, ScrollbarAuto);
-}
-
-void FrameView::forceLayout(bool allowSubtree)
-{
-    layout(allowSubtree);
-}
-
-void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot shouldAdjustViewSize)
-{
-    // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good trick to see
-    // the state of things before and after the layout
-    if (RenderView* renderView = this->renderView()) {
-        float pageLogicalWidth = renderView->style()->isHorizontalWritingMode() ? pageSize.width() : pageSize.height();
-        float pageLogicalHeight = renderView->style()->isHorizontalWritingMode() ? pageSize.height() : pageSize.width();
-
-        LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth);
-        LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight);
-        renderView->setLogicalWidth(flooredPageLogicalWidth);
-        renderView->setPageLogicalHeight(flooredPageLogicalHeight);
-        renderView->setNeedsLayoutAndPrefWidthsRecalc();
-        forceLayout();
-
-        // If we don't fit in the given page width, we'll lay out again. If we don't fit in the
-        // page width when shrunk, we will lay out at maximum shrink and clip extra content.
-        // FIXME: We are assuming a shrink-to-fit printing implementation.  A cropping
-        // implementation should not do this!
-        bool horizontalWritingMode = renderView->style()->isHorizontalWritingMode();
-        const LayoutRect& documentRect = renderView->documentRect();
-        LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width() : documentRect.height();
-        if (docLogicalWidth > pageLogicalWidth) {
-            int expectedPageWidth = std::min<float>(documentRect.width(), pageSize.width() * maximumShrinkFactor);
-            int expectedPageHeight = std::min<float>(documentRect.height(), pageSize.height() * maximumShrinkFactor);
-            FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSize(originalPageSize.width(), originalPageSize.height()), FloatSize(expectedPageWidth, expectedPageHeight));
-            pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : maxPageSize.height();
-            pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : maxPageSize.width();
-
-            flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth);
-            flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight);
-            renderView->setLogicalWidth(flooredPageLogicalWidth);
-            renderView->setPageLogicalHeight(flooredPageLogicalHeight);
-            renderView->setNeedsLayoutAndPrefWidthsRecalc();
-            forceLayout();
-
-            const LayoutRect& updatedDocumentRect = renderView->documentRect();
-            LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumentRect.height() : updatedDocumentRect.width();
-            LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRect.y() : updatedDocumentRect.x();
-            LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocumentRect.maxX() : updatedDocumentRect.maxY();
-            LayoutUnit clippedLogicalLeft = 0;
-            if (!renderView->style()->isLeftToRightDirection())
-                clippedLogicalLeft = docLogicalRight - pageLogicalWidth;
-            LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWidth, docLogicalHeight);
-
-            if (!horizontalWritingMode)
-                overflow = overflow.transposedRect();
-            renderView->clearLayoutOverflow();
-            renderView->addLayoutOverflow(overflow); // This is how we clip in case we overflow again.
-        }
-    }
-
-    if (shouldAdjustViewSize)
-        adjustViewSize();
-}
-
-IntRect FrameView::convertFromRenderer(const RenderObject* renderer, const IntRect& rendererRect) const
-{
-    IntRect rect = pixelSnappedIntRect(enclosingLayoutRect(renderer->localToAbsoluteQuad(FloatRect(rendererRect)).boundingBox()));
-
-    // Convert from page ("absolute") to FrameView coordinates.
-    rect.moveBy(-scrollPosition());
-
-    return rect;
-}
-
-IntRect FrameView::convertToRenderer(const RenderObject* renderer, const IntRect& viewRect) const
-{
-    IntRect rect = viewRect;
-
-    // Convert from FrameView coords into page ("absolute") coordinates.
-    rect.moveBy(scrollPosition());
-
-    // FIXME: we don't have a way to map an absolute rect down to a local quad, so just
-    // move the rect for now.
-    rect.setLocation(roundedIntPoint(renderer->absoluteToLocal(rect.location(), UseTransforms)));
-    return rect;
-}
-
-IntPoint FrameView::convertFromRenderer(const RenderObject* renderer, const IntPoint& rendererPoint) const
-{
-    IntPoint point = roundedIntPoint(renderer->localToAbsolute(rendererPoint, UseTransforms));
-
-    // Convert from page ("absolute") to FrameView coordinates.
-    point.moveBy(-scrollPosition());
-    return point;
-}
-
-IntPoint FrameView::convertToRenderer(const RenderObject* renderer, const IntPoint& viewPoint) const
-{
-    IntPoint point = viewPoint;
-
-    // Convert from FrameView coords into page ("absolute") coordinates.
-    point += IntSize(scrollX(), scrollY());
-
-    return roundedIntPoint(renderer->absoluteToLocal(point, UseTransforms));
-}
-
-IntRect FrameView::convertToContainingView(const IntRect& localRect) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        if (parentScrollView->isFrameView()) {
-            const FrameView* parentView = toFrameView(parentScrollView);
-            // Get our renderer in the parent view
-            RenderPart* renderer = m_frame->ownerRenderer();
-            if (!renderer)
-                return localRect;
-
-            IntRect rect(localRect);
-            // Add borders and padding??
-            rect.move(renderer->borderLeft() + renderer->paddingLeft(),
-                      renderer->borderTop() + renderer->paddingTop());
-            return parentView->convertFromRenderer(renderer, rect);
-        }
-
-        return Widget::convertToContainingView(localRect);
-    }
-
-    return localRect;
-}
-
-IntRect FrameView::convertFromContainingView(const IntRect& parentRect) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        if (parentScrollView->isFrameView()) {
-            const FrameView* parentView = toFrameView(parentScrollView);
-
-            // Get our renderer in the parent view
-            RenderPart* renderer = m_frame->ownerRenderer();
-            if (!renderer)
-                return parentRect;
-
-            IntRect rect = parentView->convertToRenderer(renderer, parentRect);
-            // Subtract borders and padding
-            rect.move(-renderer->borderLeft() - renderer->paddingLeft(),
-                      -renderer->borderTop() - renderer->paddingTop());
-            return rect;
-        }
-
-        return Widget::convertFromContainingView(parentRect);
-    }
-
-    return parentRect;
-}
-
-IntPoint FrameView::convertToContainingView(const IntPoint& localPoint) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        if (parentScrollView->isFrameView()) {
-            const FrameView* parentView = toFrameView(parentScrollView);
-
-            // Get our renderer in the parent view
-            RenderPart* renderer = m_frame->ownerRenderer();
-            if (!renderer)
-                return localPoint;
-
-            IntPoint point(localPoint);
-
-            // Add borders and padding
-            point.move(renderer->borderLeft() + renderer->paddingLeft(),
-                       renderer->borderTop() + renderer->paddingTop());
-            return parentView->convertFromRenderer(renderer, point);
-        }
-
-        return Widget::convertToContainingView(localPoint);
-    }
-
-    return localPoint;
-}
-
-IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        if (parentScrollView->isFrameView()) {
-            const FrameView* parentView = toFrameView(parentScrollView);
-
-            // Get our renderer in the parent view
-            RenderPart* renderer = m_frame->ownerRenderer();
-            if (!renderer)
-                return parentPoint;
-
-            IntPoint point = parentView->convertToRenderer(renderer, parentPoint);
-            // Subtract borders and padding
-            point.move(-renderer->borderLeft() - renderer->paddingLeft(),
-                       -renderer->borderTop() - renderer->paddingTop());
-            return point;
-        }
-
-        return Widget::convertFromContainingView(parentPoint);
-    }
-
-    return parentPoint;
-}
-
-// Normal delay
-void FrameView::setRepaintThrottlingDeferredRepaintDelay(double p)
-{
-    s_normalDeferredRepaintDelay = p;
-}
-
-// Negative value would mean that first few repaints happen without a delay
-void FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p)
-{
-    s_initialDeferredRepaintDelayDuringLoading = p;
-}
-
-// The delay grows on each repaint to this maximum value
-void FrameView::setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p)
-{
-    s_maxDeferredRepaintDelayDuringLoading = p;
-}
-
-// On each repaint the delay increases by this amount
-void FrameView::setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p)
-{
-    s_deferredRepaintDelayIncrementDuringLoading = p;
-}
-
-void FrameView::setTracksRepaints(bool trackRepaints)
-{
-    if (trackRepaints == m_isTrackingRepaints)
-        return;
-
-    for (Frame* frame = m_frame->tree()->top(); frame; frame = frame->tree()->traverseNext()) {
-        if (RenderView* renderView = frame->contentRenderer())
-            renderView->compositor()->setTracksRepaints(trackRepaints);
-    }
-
-    resetTrackedRepaints();
-    m_isTrackingRepaints = trackRepaints;
-}
-
-void FrameView::resetTrackedRepaints()
-{
-    m_trackedRepaintRects.clear();
-    if (RenderView* renderView = this->renderView())
-        renderView->compositor()->resetTrackedRepaintRects();
-}
-
-String FrameView::trackedRepaintRectsAsText() const
-{
-    TextStream ts;
-    if (!m_trackedRepaintRects.isEmpty()) {
-        ts << "(repaint rects\n";
-        for (size_t i = 0; i < m_trackedRepaintRects.size(); ++i)
-            ts << "  (rect " << m_trackedRepaintRects[i].x() << " " << m_trackedRepaintRects[i].y() << " " << m_trackedRepaintRects[i].width() << " " << m_trackedRepaintRects[i].height() << ")\n";
-        ts << ")\n";
-    }
-    return ts.release();
-}
-
-void FrameView::addResizerArea(RenderLayer* resizerLayer)
-{
-    if (!m_resizerAreas)
-        m_resizerAreas = adoptPtr(new ResizerAreaSet);
-    m_resizerAreas->add(resizerLayer);
-}
-
-void FrameView::removeResizerArea(RenderLayer* resizerLayer)
-{
-    if (!m_resizerAreas)
-        return;
-
-    ResizerAreaSet::iterator it = m_resizerAreas->find(resizerLayer);
-    if (it != m_resizerAreas->end())
-        m_resizerAreas->remove(it);
-}
-
-bool FrameView::addScrollableArea(ScrollableArea* scrollableArea)
-{
-    if (!m_scrollableAreas)
-        m_scrollableAreas = adoptPtr(new ScrollableAreaSet);
-    return m_scrollableAreas->add(scrollableArea).isNewEntry;
-}
-
-bool FrameView::removeScrollableArea(ScrollableArea* scrollableArea)
-{
-    if (!m_scrollableAreas)
-        return false;
-
-    ScrollableAreaSet::iterator it = m_scrollableAreas->find(scrollableArea);
-    if (it == m_scrollableAreas->end())
-        return false;
-
-    m_scrollableAreas->remove(it);
-    return true;
-}
-
-bool FrameView::containsScrollableArea(const ScrollableArea* scrollableArea) const
-{
-    if (!m_scrollableAreas)
-        return false;
-    return m_scrollableAreas->contains(const_cast<ScrollableArea*>(scrollableArea));
-}
-
-void FrameView::removeChild(Widget* widget)
-{
-    if (widget->isFrameView())
-        removeScrollableArea(toFrameView(widget));
-
-    ScrollView::removeChild(widget);
-}
-
-bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
-{
-    // Note that to allow for rubber-band over-scroll behavior, even non-scrollable views
-    // should handle wheel events.
-#if !USE(RUBBER_BANDING)
-    if (!isScrollable())
-        return false;
-#endif
-
-    // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled.
-    if (!canHaveScrollbars())
-        return false;
-
-    return ScrollableArea::handleWheelEvent(wheelEvent);
-}
-
-bool FrameView::isVerticalDocument() const
-{
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return true;
-
-    return renderView->style()->isHorizontalWritingMode();
-}
-
-bool FrameView::isFlippedDocument() const
-{
-    RenderView* renderView = this->renderView();
-    if (!renderView)
-        return false;
-
-    return renderView->style()->isFlippedBlocksWritingMode();
-}
-
-AXObjectCache* FrameView::axObjectCache() const
-{
-    if (frame().document())
-        return frame().document()->existingAXObjectCache();
-    return 0;
-}
-
-bool FrameView::isMainFrame() const
-{
-    return m_frame->page() && m_frame->page()->mainFrame() == m_frame;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/FrameView.h b/Source/core/page/FrameView.h
deleted file mode 100644
index 81c9895..0000000
--- a/Source/core/page/FrameView.h
+++ /dev/null
@@ -1,583 +0,0 @@
-/*
-   Copyright (C) 1997 Martin Jones (mjones@kde.org)
-             (C) 1998 Waldo Bastian (bastian@kde.org)
-             (C) 1998, 1999 Torben Weis (weis@kde.org)
-             (C) 1999 Lars Knoll (knoll@kde.org)
-             (C) 1999 Antti Koivisto (koivisto@kde.org)
-   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 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
-   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
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this library; see the file COPYING.LIB.  If not, write to
-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.
-*/
-
-#ifndef FrameView_h
-#define FrameView_h
-
-#include "core/page/AdjustViewSizeOrNot.h"
-#include "core/platform/ScrollView.h"
-#include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/LayoutRect.h"
-#include "core/rendering/Pagination.h"
-#include "core/rendering/PaintPhase.h"
-#include "core/rendering/PartialLayoutState.h"
-#include "wtf/Forward.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class Element;
-class Event;
-class FloatSize;
-class Frame;
-class FrameActionScheduler;
-class KURL;
-class Node;
-class Page;
-class RenderBox;
-class RenderEmbeddedObject;
-class RenderLayer;
-class RenderObject;
-class RenderScrollbarPart;
-class RenderStyle;
-
-Pagination::Mode paginationModeForRenderStyle(RenderStyle*);
-
-typedef unsigned long long DOMTimeStamp;
-
-class FrameView : public ScrollView {
-public:
-    friend class RenderView;
-    friend class Internals;
-
-    static PassRefPtr<FrameView> create(Frame*);
-    static PassRefPtr<FrameView> create(Frame*, const IntSize& initialSize);
-
-    virtual ~FrameView();
-
-    virtual HostWindow* hostWindow() const;
-
-    virtual void invalidateRect(const IntRect&);
-    virtual void setFrameRect(const IntRect&);
-
-    virtual bool scheduleAnimation();
-
-    Frame& frame() const { return *m_frame; }
-
-    RenderView* renderView() const;
-
-    int mapFromLayoutToCSSUnits(LayoutUnit) const;
-    LayoutUnit mapFromCSSToLayoutUnits(int) const;
-
-    LayoutUnit marginWidth() const { return m_margins.width(); } // -1 means default
-    LayoutUnit marginHeight() const { return m_margins.height(); } // -1 means default
-    void setMarginWidth(LayoutUnit);
-    void setMarginHeight(LayoutUnit);
-
-    virtual void setCanHaveScrollbars(bool);
-    void updateCanHaveScrollbars();
-
-    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
-
-    virtual void setContentsSize(const IntSize&);
-
-    void layout(bool allowSubtree = true);
-    bool didFirstLayout() const;
-    void layoutTimerFired(Timer<FrameView>*);
-    void scheduleRelayout();
-    void scheduleRelayoutOfSubtree(RenderObject*);
-    void unscheduleRelayout();
-    bool layoutPending() const;
-    bool isInLayout() const { return m_inLayout; }
-
-    RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
-    void clearLayoutRoot() { m_layoutRoot = 0; }
-    int layoutCount() const { return m_layoutCount; }
-
-    bool needsLayout() const;
-    void setNeedsLayout();
-    void setViewportConstrainedObjectsNeedLayout();
-
-    bool needsFullRepaint() const { return m_doFullRepaint; }
-
-    void serviceScriptedAnimations(double monotonicAnimationStartTime);
-
-    void updateCompositingLayersAfterStyleChange();
-    void updateCompositingLayersAfterLayout();
-
-    bool hasCompositedContent() const;
-    bool isEnclosedInCompositingLayer() const;
-
-    // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives
-    // a faithful representation of the content.
-    bool isSoftwareRenderable() const;
-
-    void resetScrollbars();
-    void prepareForDetach();
-    void detachCustomScrollbars();
-    virtual void recalculateScrollbarOverlayStyle();
-
-    void clear();
-
-    bool isTransparent() const;
-    void setTransparent(bool isTransparent);
-
-    // True if the FrameView is not transparent, and the base background color is opaque.
-    bool hasOpaqueBackground() const;
-
-    Color baseBackgroundColor() const;
-    void setBaseBackgroundColor(const Color&);
-    void updateBackgroundRecursively(const Color&, bool);
-
-    bool shouldUpdateWhileOffscreen() const;
-    void setShouldUpdateWhileOffscreen(bool);
-    bool shouldUpdate() const;
-
-    void adjustViewSize();
-
-    virtual IntRect windowClipRect(bool clipToContents = true) const;
-    IntRect windowClipRectForFrameOwner(const HTMLFrameOwnerElement*, bool clipToLayerContents) const;
-
-    virtual IntRect windowResizerRect() const;
-
-    virtual float visibleContentScaleFactor() const OVERRIDE { return m_visibleContentScaleFactor; }
-    void setVisibleContentScaleFactor(float);
-
-    virtual void setScrollPosition(const IntPoint&) OVERRIDE;
-    virtual void repaintFixedElementsAfterScrolling();
-    virtual void updateFixedElementsAfterScrolling();
-    virtual bool shouldRubberBandInDirection(ScrollDirection) const;
-    virtual bool requestScrollPositionUpdate(const IntPoint&) OVERRIDE;
-    virtual bool isRubberBandInProgress() const OVERRIDE;
-    void setScrollPositionNonProgrammatically(const IntPoint&);
-
-    // This is different than visibleContentRect() in that it ignores negative (or overly positive)
-    // offsets from rubber-banding, and it takes zooming into account.
-    LayoutRect viewportConstrainedVisibleContentRect() const;
-
-    AtomicString mediaType() const;
-    void setMediaType(const AtomicString&);
-    void adjustMediaTypeForPrinting(bool printing);
-
-    void setCannotBlitToWindow();
-    void setIsOverlapped(bool);
-    bool isOverlapped() const { return m_isOverlapped; }
-    bool isOverlappedIncludingAncestors() const;
-    void setContentIsOpaque(bool);
-
-    void addSlowRepaintObject();
-    void removeSlowRepaintObject();
-    bool hasSlowRepaintObjects() const { return m_slowRepaintObjectCount; }
-
-    // Includes fixed- and sticky-position objects.
-    typedef HashSet<RenderObject*> ViewportConstrainedObjectSet;
-    void addViewportConstrainedObject(RenderObject*);
-    void removeViewportConstrainedObject(RenderObject*);
-    const ViewportConstrainedObjectSet* viewportConstrainedObjects() const { return m_viewportConstrainedObjects.get(); }
-    bool hasViewportConstrainedObjects() const { return m_viewportConstrainedObjects && m_viewportConstrainedObjects->size() > 0; }
-
-    void beginDeferredRepaints();
-    void endDeferredRepaints();
-    void handleLoadCompleted();
-    void flushDeferredRepaints();
-    void startDeferredRepaintTimer(double delay);
-    void resetDeferredRepaintDelay();
-
-    void beginDisableRepaints();
-    void endDisableRepaints();
-    bool repaintsDisabled() { return m_disableRepaints > 0; }
-
-    void updateAnnotatedRegions();
-    void updateControlTints();
-
-    void restoreScrollbar();
-
-    void scheduleEvent(PassRefPtr<Event>, PassRefPtr<Node>);
-    void pauseScheduledEvents();
-    void resumeScheduledEvents();
-    void postLayoutTimerFired(Timer<FrameView>*);
-
-    bool wasScrolledByUser() const;
-    void setWasScrolledByUser(bool);
-
-    bool safeToPropagateScrollToParent() const { return m_safeToPropagateScrollToParent; }
-    void setSafeToPropagateScrollToParent(bool isSafe) { m_safeToPropagateScrollToParent = isSafe; }
-
-    void addWidgetToUpdate(RenderObject*);
-    void removeWidgetToUpdate(RenderObject*);
-
-    virtual void paintContents(GraphicsContext*, const IntRect& damageRect);
-    void setPaintBehavior(PaintBehavior);
-    PaintBehavior paintBehavior() const;
-    bool isPainting() const;
-    bool hasEverPainted() const { return m_lastPaintTime; }
-    void setLastPaintTime(double lastPaintTime) { m_lastPaintTime = lastPaintTime; }
-    void setNodeToDraw(Node*);
-
-    virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
-    virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
-    virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) OVERRIDE;
-
-    Color documentBackgroundColor() const;
-
-    static double currentFrameTimeStamp() { return s_currentFrameTimeStamp; }
-
-    void updateLayoutAndStyleIfNeededRecursive();
-
-    void incrementVisuallyNonEmptyCharacterCount(unsigned);
-    void incrementVisuallyNonEmptyPixelCount(const IntSize&);
-    void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; }
-    bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; }
-    void enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize);
-
-    void forceLayout(bool allowSubtree = false);
-    void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot);
-
-    bool scrollToFragment(const KURL&);
-    bool scrollToAnchor(const String&);
-    void maintainScrollPositionAtAnchor(Node*);
-    void scrollElementToRect(Element*, const IntRect&);
-
-    // Methods to convert points and rects between the coordinate space of the renderer, and this view.
-    virtual IntRect convertFromRenderer(const RenderObject*, const IntRect&) const;
-    virtual IntRect convertToRenderer(const RenderObject*, const IntRect&) const;
-    virtual IntPoint convertFromRenderer(const RenderObject*, const IntPoint&) const;
-    virtual IntPoint convertToRenderer(const RenderObject*, const IntPoint&) const;
-
-    bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
-
-    bool isScrollable();
-
-    enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
-    void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
-
-    // Normal delay
-    static void setRepaintThrottlingDeferredRepaintDelay(double p);
-    // Negative value would mean that first few repaints happen without a delay
-    static void setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p);
-    // The delay grows on each repaint to this maximum value
-    static void setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p);
-    // On each repaint the delay increses by this amount
-    static void setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p);
-
-    virtual IntPoint lastKnownMousePosition() const;
-
-    virtual bool scrollbarsCanBeActive() const OVERRIDE;
-
-    // FIXME: Remove this method once plugin loading is decoupled from layout.
-    void flushAnyPendingPostLayoutTasks();
-
-    virtual bool shouldSuspendScrollAnimations() const;
-    virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
-
-    void setAnimatorsAreActive();
-
-    RenderBox* embeddedContentBox() const;
-
-    void setTracksRepaints(bool);
-    bool isTrackingRepaints() const { return m_isTrackingRepaints; }
-    void resetTrackedRepaints();
-    const Vector<IntRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }
-    String trackedRepaintRectsAsText() const;
-
-    typedef HashSet<ScrollableArea*> ScrollableAreaSet;
-    // Returns whether the scrollable area has just been newly added.
-    bool addScrollableArea(ScrollableArea*);
-    // Returns whether the scrollable area has just been removed.
-    bool removeScrollableArea(ScrollableArea*);
-    bool containsScrollableArea(const ScrollableArea*) const;
-    const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
-
-    // With CSS style "resize:" enabled, a little resizer handle will appear at the bottom
-    // right of the object. We keep track of these resizer areas for checking if touches
-    // (implemented using Scroll gesture) are targeting the resizer.
-    typedef HashSet<RenderLayer*> ResizerAreaSet;
-    void addResizerArea(RenderLayer*);
-    void removeResizerArea(RenderLayer*);
-    const ResizerAreaSet* resizerAreas() const { return m_resizerAreas.get(); }
-
-    virtual void removeChild(Widget*) OVERRIDE;
-
-    // This function exists for ports that need to handle wheel events manually.
-    // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
-    // we need this function in order to do the scroll ourselves.
-    bool wheelEvent(const PlatformWheelEvent&);
-
-    // Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
-    // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
-    // FrameViews in the page cache, but FrameView::pagination() only affects the current
-    // FrameView. FrameView::pagination() will return m_pagination if it has been set. Otherwise,
-    // it will return Page::pagination() since currently there are no callers that need to
-    // distinguish between the two.
-    const Pagination& pagination() const;
-    void setPagination(const Pagination&);
-
-    bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
-    void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
-
-    void setHasSoftwareFilters(bool hasSoftwareFilters) { m_hasSoftwareFilters = hasSoftwareFilters; }
-    bool hasSoftwareFilters() const { return m_hasSoftwareFilters; }
-
-    virtual bool isActive() const OVERRIDE;
-
-    // DEPRECATED: Use viewportConstrainedVisibleContentRect() instead.
-    IntSize scrollOffsetForFixedPosition() const;
-
-    PartialLayoutState& partialLayout() { return m_partialLayout; }
-
-protected:
-    virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
-    virtual void scrollContentsSlowPath(const IntRect& updateRect);
-
-    virtual bool isVerticalDocument() const;
-    virtual bool isFlippedDocument() const;
-
-private:
-    explicit FrameView(Frame*);
-
-    void reset();
-    void init();
-
-    virtual bool isFrameView() const OVERRIDE { return true; }
-
-    friend class RenderWidget;
-    bool useSlowRepaints(bool considerOverlap = true) const;
-    bool useSlowRepaintsIfNotOverlapped() const;
-    void updateCanBlitOnScrollRecursively();
-    bool contentsInCompositedLayer() const;
-
-    void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode);
-    void applyPaginationToViewport();
-
-    void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
-
-    void paintControlTints();
-
-    void updateCounters();
-    void autoSizeIfEnabled();
-    void forceLayoutParentViewIfNeeded();
-    void performPreLayoutTasks();
-    void performLayout(RenderObject* rootForThisLayout, bool inSubtreeLayout);
-    void scheduleOrPerformPostLayoutTasks();
-    void performPostLayoutTasks();
-
-    virtual void repaintContentRectangle(const IntRect&);
-    virtual void contentsResized() OVERRIDE;
-    virtual void visibleContentsResized();
-
-    // Override ScrollView methods to do point conversion via renderers, in order to
-    // take transforms into account.
-    virtual IntRect convertToContainingView(const IntRect&) const OVERRIDE;
-    virtual IntRect convertFromContainingView(const IntRect&) const OVERRIDE;
-    virtual IntPoint convertToContainingView(const IntPoint&) const OVERRIDE;
-    virtual IntPoint convertFromContainingView(const IntPoint&) const OVERRIDE;
-
-    // ScrollableArea interface
-    virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE;
-    virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE;
-    virtual void scrollTo(const IntSize&) OVERRIDE;
-    virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE;
-    virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
-    virtual bool scrollAnimatorEnabled() const OVERRIDE;
-    virtual bool usesCompositedScrolling() const OVERRIDE;
-    virtual GraphicsLayer* layerForScrolling() const OVERRIDE;
-    virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE;
-    virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE;
-    virtual GraphicsLayer* layerForScrollCorner() const OVERRIDE;
-#if USE(RUBBER_BANDING)
-    virtual GraphicsLayer* layerForOverhangAreas() const OVERRIDE;
-#endif
-
-    void sendResizeEventIfNeeded();
-
-    void updateScrollableAreaSet();
-
-    virtual void notifyPageThatContentAreaWillPaint() const;
-
-    bool shouldUseLoadTimeDeferredRepaintDelay() const;
-    void deferredRepaintTimerFired(Timer<FrameView>*);
-    void doDeferredRepaints();
-    void updateDeferredRepaintDelayAfterRepaint();
-    double adjustedDeferredRepaintDelay() const;
-
-    bool updateWidgets();
-    void updateWidget(RenderObject*);
-    void scrollToAnchor();
-    void scrollPositionChanged();
-
-    bool hasCustomScrollbars() const;
-
-    virtual void updateScrollCorner();
-
-    FrameView* parentFrameView() const;
-
-    virtual AXObjectCache* axObjectCache() const;
-    void removeFromAXObjectCache();
-
-    bool isMainFrame() const;
-
-    static double s_currentFrameTimeStamp; // used for detecting decoded resource thrash in the cache
-    static bool s_inPaintContents;
-
-    LayoutSize m_size;
-    LayoutSize m_margins;
-
-    typedef HashSet<RenderObject*> RenderObjectSet;
-    OwnPtr<RenderObjectSet> m_widgetUpdateSet;
-    RefPtr<Frame> m_frame;
-
-    bool m_doFullRepaint;
-
-    bool m_canHaveScrollbars;
-    bool m_cannotBlitToWindow;
-    bool m_isOverlapped;
-    bool m_contentIsOpaque;
-    unsigned m_slowRepaintObjectCount;
-    int m_borderX;
-    int m_borderY;
-
-    Timer<FrameView> m_layoutTimer;
-    bool m_delayedLayout;
-    RenderObject* m_layoutRoot;
-
-    bool m_layoutSchedulingEnabled;
-    bool m_inLayout;
-    bool m_doingPreLayoutStyleUpdate;
-    bool m_inSynchronousPostLayout;
-    int m_layoutCount;
-    unsigned m_nestedLayoutCount;
-    Timer<FrameView> m_postLayoutTasksTimer;
-    bool m_firstLayoutCallbackPending;
-
-    bool m_firstLayout;
-    bool m_isTransparent;
-    Color m_baseBackgroundColor;
-    IntSize m_lastViewportSize;
-    float m_lastZoomFactor;
-
-    AtomicString m_mediaType;
-    AtomicString m_mediaTypeWhenNotPrinting;
-
-    OwnPtr<FrameActionScheduler> m_actionScheduler;
-
-    bool m_overflowStatusDirty;
-    bool m_horizontalOverflow;
-    bool m_verticalOverflow;
-    RenderObject* m_viewportRenderer;
-
-    Pagination m_pagination;
-
-    bool m_wasScrolledByUser;
-    bool m_inProgrammaticScroll;
-    bool m_safeToPropagateScrollToParent;
-
-    unsigned m_deferringRepaints;
-    unsigned m_repaintCount;
-    Vector<LayoutRect> m_repaintRects;
-    Timer<FrameView> m_deferredRepaintTimer;
-    double m_deferredRepaintDelay;
-    double m_lastPaintTime;
-
-    unsigned m_disableRepaints;
-
-    bool m_isTrackingRepaints; // Used for testing.
-    Vector<IntRect> m_trackedRepaintRects;
-
-    bool m_shouldUpdateWhileOffscreen;
-
-    unsigned m_deferSetNeedsLayouts;
-    bool m_setNeedsLayoutWasDeferred;
-
-    RefPtr<Node> m_nodeToDraw;
-    PaintBehavior m_paintBehavior;
-    bool m_isPainting;
-
-    unsigned m_visuallyNonEmptyCharacterCount;
-    unsigned m_visuallyNonEmptyPixelCount;
-    bool m_isVisuallyNonEmpty;
-    bool m_firstVisuallyNonEmptyLayoutCallbackPending;
-
-    RefPtr<Node> m_maintainScrollPositionAnchor;
-
-    // Renderer to hold our custom scroll corner.
-    RenderScrollbarPart* m_scrollCorner;
-
-    // If true, automatically resize the frame view around its content.
-    bool m_shouldAutoSize;
-    bool m_inAutoSize;
-    // True if autosize has been run since m_shouldAutoSize was set.
-    bool m_didRunAutosize;
-    // The lower bound on the size when autosizing.
-    IntSize m_minAutoSize;
-    // The upper bound on the size when autosizing.
-    IntSize m_maxAutoSize;
-
-    OwnPtr<ScrollableAreaSet> m_scrollableAreas;
-    OwnPtr<ResizerAreaSet> m_resizerAreas;
-    OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
-
-    static double s_normalDeferredRepaintDelay;
-    static double s_initialDeferredRepaintDelayDuringLoading;
-    static double s_maxDeferredRepaintDelayDuringLoading;
-    static double s_deferredRepaintDelayIncrementDuringLoading;
-
-    bool m_hasSoftwareFilters;
-
-    float m_visibleContentScaleFactor;
-
-    PartialLayoutState m_partialLayout;
-};
-
-inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
-{
-    if (m_isVisuallyNonEmpty)
-        return;
-    m_visuallyNonEmptyCharacterCount += count;
-    // Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout.
-    // The first few hundred characters rarely contain the interesting content of the page.
-    static const unsigned visualCharacterThreshold = 200;
-    if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold)
-        setIsVisuallyNonEmpty();
-}
-
-inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
-{
-    if (m_isVisuallyNonEmpty)
-        return;
-    m_visuallyNonEmptyPixelCount += size.width() * size.height();
-    // Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout
-    static const unsigned visualPixelThreshold = 32 * 32;
-    if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
-        setIsVisuallyNonEmpty();
-}
-
-inline FrameView* toFrameView(Widget* widget)
-{
-    ASSERT(!widget || widget->isFrameView());
-    return static_cast<FrameView*>(widget);
-}
-
-inline const FrameView* toFrameView(const Widget* widget)
-{
-    ASSERT(!widget || widget->isFrameView());
-    return static_cast<const FrameView*>(widget);
-}
-
-// This will catch anyone doing an unnecessary cast.
-void toFrameView(const FrameView*);
-
-} // namespace WebCore
-
-#endif // FrameView_h
diff --git a/Source/core/page/History.cpp b/Source/core/page/History.cpp
deleted file mode 100644
index 3e4f242..0000000
--- a/Source/core/page/History.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2007 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,
- * 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/page/History.h"
-
-#include "bindings/v8/ExceptionState.h"
-#include "bindings/v8/SerializedScriptValue.h"
-#include "core/dom/Document.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/history/BackForwardController.h"
-#include "core/history/HistoryItem.h"
-#include "core/loader/DocumentLoader.h"
-#include "core/loader/FrameLoader.h"
-#include "core/loader/FrameLoaderClient.h"
-#include "core/page/Frame.h"
-#include "core/page/Page.h"
-#include "weborigin/KURL.h"
-#include "weborigin/SecurityOrigin.h"
-#include "wtf/MainThread.h"
-
-namespace WebCore {
-
-History::History(Frame* frame)
-    : DOMWindowProperty(frame)
-    , m_lastStateObjectRequested(0)
-{
-    ScriptWrappable::init(this);
-}
-
-unsigned History::length() const
-{
-    if (!m_frame)
-        return 0;
-    if (!m_frame->page())
-        return 0;
-    return m_frame->page()->backForward().count();
-}
-
-SerializedScriptValue* History::state()
-{
-    m_lastStateObjectRequested = stateInternal();
-    return m_lastStateObjectRequested.get();
-}
-
-SerializedScriptValue* History::stateInternal() const
-{
-    if (!m_frame)
-        return 0;
-
-    if (HistoryItem* historyItem = m_frame->loader()->history()->currentItem())
-        return historyItem->stateObject();
-
-    return 0;
-}
-
-bool History::stateChanged() const
-{
-    return m_lastStateObjectRequested != stateInternal();
-}
-
-bool History::isSameAsCurrentState(SerializedScriptValue* state) const
-{
-    return state == stateInternal();
-}
-
-void History::back()
-{
-    go(-1);
-}
-
-void History::back(ScriptExecutionContext* context)
-{
-    go(context, -1);
-}
-
-void History::forward()
-{
-    go(1);
-}
-
-void History::forward(ScriptExecutionContext* context)
-{
-    go(context, 1);
-}
-
-void History::go(int distance)
-{
-    if (!m_frame)
-        return;
-
-    m_frame->navigationScheduler()->scheduleHistoryNavigation(distance);
-}
-
-void History::go(ScriptExecutionContext* context, int distance)
-{
-    if (!m_frame)
-        return;
-
-    ASSERT(isMainThread());
-    Document* activeDocument = toDocument(context);
-    if (!activeDocument)
-        return;
-
-    if (!activeDocument->canNavigate(m_frame))
-        return;
-
-    m_frame->navigationScheduler()->scheduleHistoryNavigation(distance);
-}
-
-KURL History::urlForState(const String& urlString)
-{
-    KURL baseURL = m_frame->document()->baseURL();
-    if (urlString.isEmpty())
-        return baseURL;
-
-    return KURL(baseURL, urlString);
-}
-
-void History::stateObjectAdded(PassRefPtr<SerializedScriptValue> data, const String& title, const String& urlString, SameDocumentNavigationSource sameDocumentNavigationSource, ExceptionState& es)
-{
-    if (!m_frame || !m_frame->page())
-        return;
-
-    KURL fullURL = urlForState(urlString);
-    if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest(fullURL)) {
-        // We can safely expose the URL to JavaScript, as a) no redirection takes place: JavaScript already had this URL, b) JavaScript can only access a same-origin History object.
-        es.throwSecurityError("A history state object with URL '" + fullURL.elidedString() + "' cannot be created in a document with origin '" + m_frame->document()->securityOrigin()->toString() + "'.");
-        return;
-    }
-    m_frame->loader()->updateForSameDocumentNavigation(fullURL, sameDocumentNavigationSource, data, title, FrameLoader::DoNotUpdateBackForwardList);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/History.h b/Source/core/page/History.h
deleted file mode 100644
index 6bd9da7..0000000
--- a/Source/core/page/History.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2007 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,
- * 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 History_h
-#define History_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "bindings/v8/SerializedScriptValue.h"
-#include "core/loader/FrameLoaderTypes.h"
-#include "core/page/DOMWindowProperty.h"
-#include "wtf/Forward.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class Frame;
-class KURL;
-class ScriptExecutionContext;
-class ExceptionState;
-
-class History : public ScriptWrappable, public RefCounted<History>, public DOMWindowProperty {
-public:
-    static PassRefPtr<History> create(Frame* frame) { return adoptRef(new History(frame)); }
-
-    unsigned length() const;
-    SerializedScriptValue* state();
-    void back();
-    void forward();
-    void go(int distance);
-
-    void back(ScriptExecutionContext*);
-    void forward(ScriptExecutionContext*);
-    void go(ScriptExecutionContext*, int distance);
-
-    bool stateChanged() const;
-    bool isSameAsCurrentState(SerializedScriptValue*) const;
-
-    void stateObjectAdded(PassRefPtr<SerializedScriptValue>, const String& title, const String& url, SameDocumentNavigationSource, ExceptionState&);
-
-private:
-    explicit History(Frame*);
-
-    KURL urlForState(const String& url);
-
-    SerializedScriptValue* stateInternal() const;
-
-    RefPtr<SerializedScriptValue> m_lastStateObjectRequested;
-};
-
-} // namespace WebCore
-
-#endif // History_h
diff --git a/Source/core/page/History.idl b/Source/core/page/History.idl
deleted file mode 100644
index d20cc89..0000000
--- a/Source/core/page/History.idl
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2007, 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 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,
- * 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.
- */
-
-interface History {
-    readonly attribute unsigned long length;
-    [Custom] readonly attribute SerializedScriptValue state;
-
-    [CallWith=ScriptExecutionContext] void back();
-    [CallWith=ScriptExecutionContext] void forward();
-    [CallWith=ScriptExecutionContext] void go([Default=Undefined] optional long distance);
-
-    [Custom, EnabledPerContext=pushState, RaisesException] void pushState(any data, DOMString title, optional DOMString url);
-    [Custom, EnabledPerContext=pushState, RaisesException] void replaceState(any data, DOMString title, optional DOMString url);
-};
diff --git a/Source/core/page/ImageBitmap.cpp b/Source/core/page/ImageBitmap.cpp
deleted file mode 100644
index a64ea0d..0000000
--- a/Source/core/page/ImageBitmap.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "core/page/ImageBitmap.h"
-
-#include "core/html/HTMLCanvasElement.h"
-#include "core/html/HTMLImageElement.h"
-#include "core/html/HTMLVideoElement.h"
-#include "core/html/ImageData.h"
-#include "core/html/canvas/CanvasRenderingContext.h"
-#include "core/platform/graphics/BitmapImage.h"
-#include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/graphics/ImageBuffer.h"
-#include "wtf/RefPtr.h"
-
-using namespace std;
-
-namespace WebCore {
-
-static inline IntRect normalizeRect(const IntRect& rect)
-{
-    return IntRect(min(rect.x(), rect.maxX()),
-        min(rect.y(), rect.maxY()),
-        max(rect.width(), -rect.width()),
-        max(rect.height(), -rect.height()));
-}
-
-static inline PassRefPtr<Image> cropImage(Image* image, const IntRect& cropRect)
-{
-    IntRect intersectRect = intersection(IntRect(IntPoint(), image->size()), cropRect);
-    if (!intersectRect.width() || !intersectRect.height())
-        return 0;
-
-    SkBitmap cropped;
-    image->nativeImageForCurrentFrame()->bitmap().extractSubset(&cropped, intersectRect);
-    return BitmapImage::create(NativeImageSkia::create(cropped));
-}
-
-ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect)
-    : m_cropRect(cropRect)
-    , m_bitmap(0)
-    , m_imageElement(image)
-{
-    IntRect srcRect = intersection(cropRect, IntRect(0, 0, image->width(), image->height()));
-    m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())), srcRect.size());
-    m_bitmapOffset = srcRect.location();
-
-    if (!srcRect.width() || !srcRect.height())
-        m_imageElement = 0;
-    else
-        m_imageElement->addClient(this);
-
-    ScriptWrappable::init(this);
-}
-
-ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect)
-    : m_cropRect(cropRect)
-    , m_imageElement(0)
-    , m_bitmapOffset(IntPoint())
-{
-    IntRect videoRect = IntRect(IntPoint(), video->player()->naturalSize());
-    IntRect srcRect = intersection(cropRect, videoRect);
-    IntRect dstRect(IntPoint(), srcRect.size());
-
-    OwnPtr<ImageBuffer> buf = ImageBuffer::create(videoRect.size(), 1, UnacceleratedNonPlatformBuffer);
-    GraphicsContext* c = buf->context();
-    c->clip(dstRect);
-    c->translate(-srcRect.x(), -srcRect.y());
-    video->paintCurrentFrameInContext(c, videoRect);
-    m_bitmap = buf->copyImage(DontCopyBackingStore);
-    m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())), srcRect.size());
-
-    ScriptWrappable::init(this);
-}
-
-ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect)
-    : m_cropRect(cropRect)
-    , m_imageElement(0)
-    , m_bitmapOffset(IntPoint())
-{
-    CanvasRenderingContext* sourceContext = canvas->renderingContext();
-    if (sourceContext && sourceContext->is3d())
-        sourceContext->paintRenderingResultsToCanvas();
-
-    IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), canvas->size()));
-    m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())), srcRect.size());
-    m_bitmap = cropImage(canvas->buffer()->copyImage(CopyBackingStore).get(), cropRect);
-
-    ScriptWrappable::init(this);
-}
-
-ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect)
-    : m_cropRect(cropRect)
-    , m_imageElement(0)
-    , m_bitmapOffset(IntPoint())
-{
-    IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), data->size()));
-
-    OwnPtr<ImageBuffer> buf = ImageBuffer::create(data->size(), 1, UnacceleratedNonPlatformBuffer);
-    if (srcRect.width() > 0 && srcRect.height() > 0)
-        buf->putByteArray(Premultiplied, data->data(), data->size(), srcRect, IntPoint(min(0, -cropRect.x()), min(0, -cropRect.y())));
-
-    m_bitmap = buf->copyImage(DontCopyBackingStore);
-    m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())),  srcRect.size());
-
-    ScriptWrappable::init(this);
-}
-
-ImageBitmap::ImageBitmap(ImageBitmap* bitmap, const IntRect& cropRect)
-    : m_cropRect(cropRect)
-    , m_bitmap(0)
-    , m_imageElement(bitmap->imageElement())
-    , m_bitmapOffset(IntPoint())
-{
-    IntRect oldBitmapRect = bitmap->bitmapRect();
-    IntRect srcRect = intersection(cropRect, oldBitmapRect);
-    m_bitmapRect = IntRect(IntPoint(max(0, oldBitmapRect.x() - cropRect.x()), max(0, oldBitmapRect.y() - cropRect.y())), srcRect.size());
-
-    if (m_imageElement) {
-        m_imageElement->addClient(this);
-        m_bitmapOffset = srcRect.location();
-    } else if (bitmap->bitmapImage()) {
-        IntRect adjustedCropRect(IntPoint(cropRect.x() -oldBitmapRect.x(), cropRect.y() - oldBitmapRect.y()), cropRect.size());
-        m_bitmap = cropImage(bitmap->bitmapImage().get(), adjustedCropRect);
-    }
-
-    ScriptWrappable::init(this);
-}
-
-ImageBitmap::ImageBitmap(Image* image, const IntRect& cropRect)
-    : m_cropRect(cropRect)
-    , m_imageElement(0)
-{
-    IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), image->size()));
-    m_bitmap = cropImage(image, cropRect);
-    m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())),  srcRect.size());
-
-    ScriptWrappable::init(this);
-}
-
-ImageBitmap::~ImageBitmap()
-{
-    if (m_imageElement)
-        m_imageElement->removeClient(this);
-}
-
-PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRect& cropRect)
-{
-    IntRect normalizedCropRect = normalizeRect(cropRect);
-    return adoptRef(new ImageBitmap(image, normalizedCropRect));
-}
-
-PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video, const IntRect& cropRect)
-{
-    IntRect normalizedCropRect = normalizeRect(cropRect);
-    return adoptRef(new ImageBitmap(video, normalizedCropRect));
-}
-
-PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canvas, const IntRect& cropRect)
-{
-    IntRect normalizedCropRect = normalizeRect(cropRect);
-    return adoptRef(new ImageBitmap(canvas, normalizedCropRect));
-}
-
-PassRefPtr<ImageBitmap> ImageBitmap::create(ImageData* data, const IntRect& cropRect)
-{
-    IntRect normalizedCropRect = normalizeRect(cropRect);
-    return adoptRef(new ImageBitmap(data, normalizedCropRect));
-}
-
-PassRefPtr<ImageBitmap> ImageBitmap::create(ImageBitmap* bitmap, const IntRect& cropRect)
-{
-    IntRect normalizedCropRect = normalizeRect(cropRect);
-    return adoptRef(new ImageBitmap(bitmap, normalizedCropRect));
-}
-
-PassRefPtr<ImageBitmap> ImageBitmap::create(Image* image, const IntRect& cropRect)
-{
-    IntRect normalizedCropRect = normalizeRect(cropRect);
-    return adoptRef(new ImageBitmap(image, normalizedCropRect));
-}
-
-void ImageBitmap::notifyImageSourceChanged()
-{
-    m_bitmap = cropImage(m_imageElement->cachedImage()->image(), m_cropRect);
-    m_bitmapOffset = IntPoint();
-    m_imageElement = 0;
-}
-
-PassRefPtr<Image> ImageBitmap::bitmapImage() const
-{
-    ASSERT((m_imageElement || m_bitmap || !m_bitmapRect.width() || !m_bitmapRect.height()) && (!m_imageElement || !m_bitmap));
-    if (m_imageElement)
-        return m_imageElement->cachedImage()->image();
-    return m_bitmap;
-}
-
-}
diff --git a/Source/core/page/ImageBitmap.h b/Source/core/page/ImageBitmap.h
deleted file mode 100644
index 604d87c..0000000
--- a/Source/core/page/ImageBitmap.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ImageBitmap_h
-#define ImageBitmap_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/html/HTMLImageElement.h"
-#include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/IntRect.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class HTMLCanvasElement;
-class HTMLVideoElement;
-class ImageData;
-
-class ImageBitmap : public RefCounted<ImageBitmap>, public ScriptWrappable, public ImageLoaderClient {
-
-public:
-    static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&);
-    static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, const IntRect&);
-    static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&);
-    static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&);
-    static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&);
-    static PassRefPtr<ImageBitmap> create(Image*, const IntRect&);
-
-    PassRefPtr<Image> bitmapImage() const;
-    PassRefPtr<HTMLImageElement> imageElement() const { return m_imageElement; }
-
-    IntRect bitmapRect() const { return m_bitmapRect; }
-    IntPoint bitmapOffset() const { return m_bitmapOffset; }
-
-    int width() const { return m_cropRect.width(); }
-    int height() const { return m_cropRect.height(); }
-    IntSize size() const { return m_cropRect.size(); }
-
-    virtual ~ImageBitmap();
-
-private:
-    ImageBitmap(HTMLImageElement*, const IntRect&);
-    ImageBitmap(HTMLVideoElement*, const IntRect&);
-    ImageBitmap(HTMLCanvasElement*, const IntRect&);
-    ImageBitmap(ImageData*, const IntRect&);
-    ImageBitmap(ImageBitmap*, const IntRect&);
-    ImageBitmap(Image*, const IntRect&);
-
-    // ImageLoaderClient
-    virtual void notifyImageSourceChanged();
-    virtual bool requestsHighLiveResourceCachePriority() { return true; }
-
-    // ImageBitmaps constructed from HTMLImageElements hold a reference to the HTMLImageElement until
-    // the image source changes.
-    RefPtr<HTMLImageElement> m_imageElement;
-    RefPtr<Image> m_bitmap;
-
-    IntRect m_bitmapRect; // The rect where the underlying Image should be placed in reference to the ImageBitmap.
-    IntRect m_cropRect;
-
-    // The offset by which the desired Image is stored internally.
-    // ImageBitmaps constructed from HTMLImageElements reference the entire ImageResource and may have a non-zero bitmap offset.
-    // ImageBitmaps not constructed from HTMLImageElements always pre-crop and store the image at (0, 0).
-    IntPoint m_bitmapOffset;
-
-};
-
-} // namespace WebCore
-
-#endif // ImageBitmap_h
diff --git a/Source/core/page/ImageBitmapTest.cpp b/Source/core/page/ImageBitmapTest.cpp
deleted file mode 100644
index 7d3d1b0..0000000
--- a/Source/core/page/ImageBitmapTest.cpp
+++ /dev/null
@@ -1,209 +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.
- */
-
-#include "config.h"
-#include "core/page/ImageBitmap.h"
-
-#include "core/dom/Document.h"
-#include "core/fetch/ImageResource.h"
-#include "core/fetch/MemoryCache.h"
-#include "core/fetch/MockImageResourceClient.h"
-#include "core/fetch/ResourcePtr.h"
-#include "core/html/HTMLCanvasElement.h"
-#include "core/html/HTMLImageElement.h"
-#include "core/html/canvas/CanvasRenderingContext2D.h"
-#include "core/platform/graphics/BitmapImage.h"
-#include "core/platform/graphics/skia/NativeImageSkia.h"
-#include "core/platform/network/ResourceRequest.h"
-#include "third_party/skia/include/core/SkPixelRef.h"
-#include "wtf/OwnPtr.h"
-
-#include <gtest/gtest.h>
-
-namespace WebCore {
-
-class ImageBitmapTest : public ::testing::Test {
-protected:
-    virtual void SetUp()
-    {
-        m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
-        m_bitmap.allocPixels();
-        m_bitmap.eraseColor(0xFFFFFFFF);
-
-        m_bitmap2.setConfig(SkBitmap::kARGB_8888_Config, 5, 5);
-        m_bitmap2.allocPixels();
-        m_bitmap2.eraseColor(0xAAAAAAAA);
-
-        // Save the global memory cache to restore it upon teardown.
-        m_globalMemoryCache = adoptPtr(memoryCache());
-        // Create the test memory cache instance and hook it in.
-        m_testingMemoryCache = adoptPtr(new MemoryCache());
-        setMemoryCacheForTesting(m_testingMemoryCache.leakPtr());
-    }
-    virtual void TearDown()
-    {
-        // Regain the ownership of testing memory cache, so that it will be
-        // destroyed.
-        m_testingMemoryCache = adoptPtr(memoryCache());
-        // Yield the ownership of the global memory cache back.
-        setMemoryCacheForTesting(m_globalMemoryCache.leakPtr());
-    }
-
-    SkBitmap m_bitmap, m_bitmap2;
-    OwnPtr<MemoryCache> m_testingMemoryCache;
-    OwnPtr<MemoryCache> m_globalMemoryCache;
-};
-
-// Verifies that the image resource held by an ImageBitmap is the same as the
-// one held by the HTMLImageElement.
-TEST_F(ImageBitmapTest, ImageResourceConsistency)
-{
-    RefPtr<HTMLImageElement> imageElement = HTMLImageElement::create(*Document::create().get());
-    imageElement->setImageResource(new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get()));
-
-    RefPtr<ImageBitmap> imageBitmapNoCrop = ImageBitmap::create(imageElement.get(), IntRect(0, 0, m_bitmap.width(), m_bitmap.height()));
-    RefPtr<ImageBitmap> imageBitmapInteriorCrop = ImageBitmap::create(imageElement.get(), IntRect(m_bitmap.width() / 2, m_bitmap.height() / 2, m_bitmap.width() / 2, m_bitmap.height() / 2));
-    RefPtr<ImageBitmap> imageBitmapExteriorCrop = ImageBitmap::create(imageElement.get(), IntRect(-m_bitmap.width() / 2, -m_bitmap.height() / 2, m_bitmap.width(), m_bitmap.height()));
-    RefPtr<ImageBitmap> imageBitmapOutsideCrop = ImageBitmap::create(imageElement.get(), IntRect(-m_bitmap.width(), -m_bitmap.height(), m_bitmap.width(), m_bitmap.height()));
-
-    ASSERT_EQ(imageBitmapNoCrop->bitmapImage().get(), imageElement->cachedImage()->image());
-    ASSERT_EQ(imageBitmapInteriorCrop->bitmapImage().get(), imageElement->cachedImage()->image());
-    ASSERT_EQ(imageBitmapExteriorCrop->bitmapImage().get(), imageElement->cachedImage()->image());
-
-    RefPtr<Image> emptyImage = imageBitmapOutsideCrop->bitmapImage();
-    ASSERT_NE(emptyImage.get(), imageElement->cachedImage()->image());
-}
-
-// Verifies that HTMLImageElements are given an elevated CacheLiveResourcePriority when used to construct an ImageBitmap.
-// ImageBitmaps that have crop rects outside of the bounds of the HTMLImageElement do not have elevated CacheLiveResourcePriority.
-TEST_F(ImageBitmapTest, ImageBitmapLiveResourcePriority)
-{
-    RefPtr<HTMLImageElement> imageNoCrop = HTMLImageElement::create(*Document::create().get());
-    ResourcePtr<ImageResource> cachedImageNoCrop = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get());
-    imageNoCrop->setImageResource(cachedImageNoCrop.get());
-
-    RefPtr<HTMLImageElement> imageInteriorCrop = HTMLImageElement::create(*Document::create().get());
-    ResourcePtr<ImageResource> cachedImageInteriorCrop = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get());
-    imageInteriorCrop->setImageResource(cachedImageInteriorCrop.get());
-
-    RefPtr<HTMLImageElement> imageExteriorCrop = HTMLImageElement::create(*Document::create().get());
-    ResourcePtr<ImageResource> cachedImageExteriorCrop = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get());
-    imageExteriorCrop->setImageResource(cachedImageExteriorCrop.get());
-
-    RefPtr<HTMLImageElement> imageOutsideCrop = HTMLImageElement::create(*Document::create().get());
-    ResourcePtr<ImageResource> cachedImageOutsideCrop = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get());
-    imageOutsideCrop->setImageResource(cachedImageOutsideCrop.get());
-
-    MockImageResourceClient mockClient1, mockClient2, mockClient3, mockClient4;
-    cachedImageNoCrop->addClient(&mockClient1);
-    cachedImageInteriorCrop->addClient(&mockClient2);
-    cachedImageExteriorCrop->addClient(&mockClient3);
-    cachedImageOutsideCrop->addClient(&mockClient4);
-
-    memoryCache()->add(cachedImageNoCrop.get());
-    memoryCache()->add(cachedImageInteriorCrop.get());
-    memoryCache()->add(cachedImageExteriorCrop.get());
-    memoryCache()->add(cachedImageOutsideCrop.get());
-    memoryCache()->insertInLiveDecodedResourcesList(cachedImageNoCrop.get());
-    memoryCache()->insertInLiveDecodedResourcesList(cachedImageInteriorCrop.get());
-    memoryCache()->insertInLiveDecodedResourcesList(cachedImageExteriorCrop.get());
-    memoryCache()->insertInLiveDecodedResourcesList(cachedImageOutsideCrop.get());
-
-    // HTMLImageElements should default to CacheLiveResourcePriorityLow.
-    ASSERT_EQ(imageNoCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
-    ASSERT_EQ(imageInteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
-    ASSERT_EQ(imageExteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
-    ASSERT_EQ(imageOutsideCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
-
-    RefPtr<ImageBitmap> imageBitmapInteriorCrop = ImageBitmap::create(imageInteriorCrop.get(), IntRect(m_bitmap.width() / 2, m_bitmap.height() / 2, m_bitmap.width(), m_bitmap.height()));
-    {
-        RefPtr<ImageBitmap> imageBitmapNoCrop = ImageBitmap::create(imageNoCrop.get(), IntRect(0, 0, m_bitmap.width(), m_bitmap.height()));
-        RefPtr<ImageBitmap> imageBitmapInteriorCrop2 = ImageBitmap::create(imageInteriorCrop.get(), IntRect(m_bitmap.width() / 2, m_bitmap.height() / 2, m_bitmap.width(), m_bitmap.height()));
-        RefPtr<ImageBitmap> imageBitmapExteriorCrop = ImageBitmap::create(imageExteriorCrop.get(), IntRect(-m_bitmap.width() / 2, -m_bitmap.height() / 2, m_bitmap.width(), m_bitmap.height()));
-        RefPtr<ImageBitmap> imageBitmapOutsideCrop = ImageBitmap::create(imageOutsideCrop.get(), IntRect(-m_bitmap.width(), -m_bitmap.height(), m_bitmap.width(), m_bitmap.height()));
-
-        // Images that are referenced by ImageBitmaps have CacheLiveResourcePriorityHigh.
-        ASSERT_EQ(imageNoCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityHigh);
-        ASSERT_EQ(imageInteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityHigh);
-        ASSERT_EQ(imageExteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityHigh);
-
-        // ImageBitmaps that do not contain any of the source image do not elevate CacheLiveResourcePriority.
-        ASSERT_EQ(imageOutsideCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
-    }
-
-    // CacheLiveResourcePriroity should return to CacheLiveResourcePriorityLow when no ImageBitmaps reference the image.
-    ASSERT_EQ(imageNoCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
-    ASSERT_EQ(imageExteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
-    ASSERT_EQ(imageOutsideCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityLow);
-
-    // There is still an ImageBitmap that references this image.
-    ASSERT_EQ(imageInteriorCrop->cachedImage()->cacheLiveResourcePriority(), Resource::CacheLiveResourcePriorityHigh);
-}
-
-// Verifies that ImageBitmaps constructed from HTMLImageElements hold a reference to the original Image if the HTMLImageElement src is changed.
-TEST_F(ImageBitmapTest, ImageBitmapSourceChanged)
-{
-    RefPtr<HTMLImageElement> image = HTMLImageElement::create(*Document::create().get());
-    ResourcePtr<ImageResource> originalImageResource = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap)).get());
-    image->setImageResource(originalImageResource.get());
-
-    RefPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get(), IntRect(0, 0, m_bitmap.width(), m_bitmap.height()));
-    ASSERT_EQ(imageBitmap->bitmapImage().get(), originalImageResource->image());
-
-    ResourcePtr<ImageResource> newImageResource = new ImageResource(BitmapImage::create(NativeImageSkia::create(m_bitmap2)).get());
-    image->setImageResource(newImageResource.get());
-
-    // The ImageBitmap should contain the same data as the original cached image but should no longer hold a reference.
-    ASSERT_NE(imageBitmap->bitmapImage().get(), originalImageResource->image());
-    ASSERT_EQ(imageBitmap->bitmapImage()->nativeImageForCurrentFrame()->bitmap().pixelRef()->pixels(),
-        originalImageResource->image()->nativeImageForCurrentFrame()->bitmap().pixelRef()->pixels());
-
-    ASSERT_NE(imageBitmap->bitmapImage().get(), newImageResource->image());
-    ASSERT_NE(imageBitmap->bitmapImage()->nativeImageForCurrentFrame()->bitmap().pixelRef()->pixels(),
-        newImageResource->image()->nativeImageForCurrentFrame()->bitmap().pixelRef()->pixels());
-}
-
-// Verifies that ImageBitmaps constructed from ImageBitmaps hold onto their own Image.
-TEST_F(ImageBitmapTest, ImageResourceLifetime)
-{
-    RefPtr<HTMLCanvasElement> canvasElement = HTMLCanvasElement::create(*Document::create().get());
-    canvasElement->setHeight(40);
-    canvasElement->setWidth(40);
-    RefPtr<ImageBitmap> imageBitmapDerived;
-    {
-        RefPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::create(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->height()));
-        imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), IntRect(0, 0, 20, 20));
-    }
-    CanvasRenderingContext* context = canvasElement->getContext("2d");
-    TrackExceptionState es;
-    static_cast<CanvasRenderingContext2D*>(context)->drawImage(imageBitmapDerived.get(), 0, 0, es);
-}
-
-} // namespace
diff --git a/Source/core/page/InjectedStyleSheet.h b/Source/core/page/InjectedStyleSheet.h
new file mode 100644
index 0000000..cdee055
--- /dev/null
+++ b/Source/core/page/InjectedStyleSheet.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009 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,
+ * 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 InjectedStyleSheet_h
+#define InjectedStyleSheet_h
+
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+enum StyleInjectionTarget { InjectStyleInAllFrames, InjectStyleInTopFrameOnly };
+
+class InjectedStyleSheet {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    InjectedStyleSheet(const String& source, const Vector<String>& whitelist, StyleInjectionTarget injectedFrames)
+        : m_source(source)
+        , m_whitelist(whitelist)
+        , m_injectedFrames(injectedFrames)
+    {
+    }
+
+    const String& source() const { return m_source; }
+    const Vector<String>& whitelist() const { return m_whitelist; }
+    StyleInjectionTarget injectedFrames() const { return m_injectedFrames; }
+
+private:
+    String m_source;
+    Vector<String> m_whitelist;
+    StyleInjectionTarget m_injectedFrames;
+};
+
+typedef Vector<OwnPtr<InjectedStyleSheet> > InjectedStyleSheetVector;
+
+} // namespace WebCore
+
+#endif // InjectedStyleSheet_h
diff --git a/Source/core/page/LayoutMilestones.h b/Source/core/page/LayoutMilestones.h
deleted file mode 100644
index dbfcf14..0000000
--- a/Source/core/page/LayoutMilestones.h
+++ /dev/null
@@ -1,41 +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 LayoutMilestones_h
-#define LayoutMilestones_h
-
-namespace WebCore {
-
-enum LayoutMilestoneFlag {
-    DidFirstLayout = 1 << 0,
-    DidFirstVisuallyNonEmptyLayout = 1 << 1,
-    DidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2
-};
-
-typedef unsigned LayoutMilestones;
-
-} // namespace WebCore
-
-#endif // LayoutMilestones_h
diff --git a/Source/core/page/Location.cpp b/Source/core/page/Location.cpp
deleted file mode 100644
index 4937756..0000000
--- a/Source/core/page/Location.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Copyright (C) 2008, 2010 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.
- * 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.
- *
- * 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/page/Location.h"
-
-#include "bindings/v8/ExceptionMessages.h"
-#include "bindings/v8/ExceptionState.h"
-#include "core/dom/Document.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/loader/FrameLoader.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-#include "weborigin/KURL.h"
-#include "weborigin/SecurityOrigin.h"
-
-namespace WebCore {
-
-Location::Location(Frame* frame)
-    : DOMWindowProperty(frame)
-{
-    ScriptWrappable::init(this);
-}
-
-inline const KURL& Location::url() const
-{
-    ASSERT(m_frame);
-
-    const KURL& url = m_frame->document()->url();
-    if (!url.isValid())
-        return blankURL(); // Use "about:blank" while the page is still loading (before we have a frame).
-
-    return url;
-}
-
-String Location::href() const
-{
-    if (!m_frame)
-        return String();
-
-    return url().string();
-}
-
-String Location::protocol() const
-{
-    if (!m_frame)
-        return String();
-
-    return url().protocol() + ":";
-}
-
-String Location::host() const
-{
-    if (!m_frame)
-        return String();
-
-    // Note: this is the IE spec. The NS spec swaps the two, it says
-    // "The hostname property is the concatenation of the host and port properties, separated by a colon."
-    const KURL& url = this->url();
-    return url.hasPort() ? url.host() + ":" + String::number(url.port()) : url.host();
-}
-
-String Location::hostname() const
-{
-    if (!m_frame)
-        return String();
-
-    return url().host();
-}
-
-String Location::port() const
-{
-    if (!m_frame)
-        return String();
-
-    const KURL& url = this->url();
-    return url.hasPort() ? String::number(url.port()) : "";
-}
-
-String Location::pathname() const
-{
-    if (!m_frame)
-        return String();
-
-    const KURL& url = this->url();
-    return url.path().isEmpty() ? "/" : url.path();
-}
-
-String Location::search() const
-{
-    if (!m_frame)
-        return String();
-
-    const KURL& url = this->url();
-    return url.query().isEmpty() ? emptyString() : "?" + url.query();
-}
-
-String Location::origin() const
-{
-    if (!m_frame)
-        return String();
-    return SecurityOrigin::create(url())->toString();
-}
-
-PassRefPtr<DOMStringList> Location::ancestorOrigins() const
-{
-    RefPtr<DOMStringList> origins = DOMStringList::create();
-    if (!m_frame)
-        return origins.release();
-    for (Frame* frame = m_frame->tree()->parent(); frame; frame = frame->tree()->parent())
-        origins->append(frame->document()->securityOrigin()->toString());
-    return origins.release();
-}
-
-String Location::hash() const
-{
-    if (!m_frame)
-        return String();
-
-    const String& fragmentIdentifier = url().fragmentIdentifier();
-    return fragmentIdentifier.isEmpty() ? emptyString() : "#" + fragmentIdentifier;
-}
-
-void Location::setHref(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& url)
-{
-    if (!m_frame)
-        return;
-    setLocation(url, activeWindow, firstWindow);
-}
-
-void Location::setProtocol(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& protocol, ExceptionState& es)
-{
-    if (!m_frame)
-        return;
-    KURL url = m_frame->document()->url();
-    if (!url.setProtocol(protocol)) {
-        es.throwDOMException(SyntaxError, ExceptionMessages::failedToSet("protocol", "Location", "'" + protocol + "' is an invalid protocol."));
-        return;
-    }
-    setLocation(url.string(), activeWindow, firstWindow);
-}
-
-void Location::setHost(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& host)
-{
-    if (!m_frame)
-        return;
-    KURL url = m_frame->document()->url();
-    url.setHostAndPort(host);
-    setLocation(url.string(), activeWindow, firstWindow);
-}
-
-void Location::setHostname(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& hostname)
-{
-    if (!m_frame)
-        return;
-    KURL url = m_frame->document()->url();
-    url.setHost(hostname);
-    setLocation(url.string(), activeWindow, firstWindow);
-}
-
-void Location::setPort(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& portString)
-{
-    if (!m_frame)
-        return;
-    KURL url = m_frame->document()->url();
-    int port = portString.toInt();
-    if (port < 0 || port > 0xFFFF || portString.isEmpty())
-        url.removePort();
-    else
-        url.setPort(port);
-    setLocation(url.string(), activeWindow, firstWindow);
-}
-
-void Location::setPathname(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& pathname)
-{
-    if (!m_frame)
-        return;
-    KURL url = m_frame->document()->url();
-    url.setPath(pathname);
-    setLocation(url.string(), activeWindow, firstWindow);
-}
-
-void Location::setSearch(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& search)
-{
-    if (!m_frame)
-        return;
-    KURL url = m_frame->document()->url();
-    url.setQuery(search);
-    setLocation(url.string(), activeWindow, firstWindow);
-}
-
-void Location::setHash(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& hash)
-{
-    if (!m_frame)
-        return;
-    KURL url = m_frame->document()->url();
-    String oldFragmentIdentifier = url.fragmentIdentifier();
-    String newFragmentIdentifier = hash;
-    if (hash[0] == '#')
-        newFragmentIdentifier = hash.substring(1);
-    url.setFragmentIdentifier(newFragmentIdentifier);
-    // Note that by parsing the URL and *then* comparing fragments, we are
-    // comparing fragments post-canonicalization, and so this handles the
-    // cases where fragment identifiers are ignored or invalid.
-    if (equalIgnoringNullity(oldFragmentIdentifier, url.fragmentIdentifier()))
-        return;
-    setLocation(url.string(), activeWindow, firstWindow);
-}
-
-void Location::assign(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& url)
-{
-    if (!m_frame)
-        return;
-    setLocation(url, activeWindow, firstWindow);
-}
-
-void Location::replace(DOMWindow* activeWindow, DOMWindow* firstWindow, const String& url)
-{
-    if (!m_frame)
-        return;
-    // Note: We call DOMWindow::setLocation directly here because replace() always operates on the current frame.
-    m_frame->domWindow()->setLocation(url, activeWindow, firstWindow, LockHistoryAndBackForwardList);
-}
-
-void Location::reload(DOMWindow* activeWindow)
-{
-    if (!m_frame)
-        return;
-    if (protocolIsJavaScript(m_frame->document()->url()))
-        return;
-    m_frame->navigationScheduler()->scheduleRefresh();
-}
-
-void Location::setLocation(const String& url, DOMWindow* activeWindow, DOMWindow* firstWindow)
-{
-    ASSERT(m_frame);
-    // We call findFrameForNavigation to handle the case of a seamless iframe correctly.
-    Frame* frame = m_frame->loader()->findFrameForNavigation(String(), activeWindow->document());
-    if (!frame)
-        return;
-    frame->domWindow()->setLocation(url, activeWindow, firstWindow);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/Location.h b/Source/core/page/Location.h
deleted file mode 100644
index 63c5b3c..0000000
--- a/Source/core/page/Location.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2008, 2010 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.
- * 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.
- *
- * 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 Location_h
-#define Location_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/DOMStringList.h"
-#include "core/page/DOMWindowProperty.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class DOMWindow;
-class ExceptionState;
-class Frame;
-class KURL;
-
-class Location : public ScriptWrappable, public RefCounted<Location>, public DOMWindowProperty {
-public:
-    static PassRefPtr<Location> create(Frame* frame) { return adoptRef(new Location(frame)); }
-
-    void setHref(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
-    String href() const;
-
-    void assign(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
-    void replace(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
-    void reload(DOMWindow* activeWindow);
-
-    void setProtocol(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&, ExceptionState&);
-    String protocol() const;
-    void setHost(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
-    String host() const;
-    void setHostname(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
-    String hostname() const;
-    void setPort(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
-    String port() const;
-    void setPathname(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
-    String pathname() const;
-    void setSearch(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
-    String search() const;
-    void setHash(DOMWindow* activeWindow, DOMWindow* firstWindow, const String&);
-    String hash() const;
-    String origin() const;
-
-    String toString() const { return href(); }
-
-    PassRefPtr<DOMStringList> ancestorOrigins() const;
-
-private:
-    explicit Location(Frame*);
-
-    void setLocation(const String&, DOMWindow* activeWindow, DOMWindow* firstWindow);
-
-    const KURL& url() const;
-};
-
-} // namespace WebCore
-
-#endif // Location_h
diff --git a/Source/core/page/Location.idl b/Source/core/page/Location.idl
deleted file mode 100644
index 77778e1..0000000
--- a/Source/core/page/Location.idl
+++ /dev/null
@@ -1,54 +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.
- * 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.
- *
- * 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.
- */
-
-[
-    CheckSecurity
-] interface Location {
-    [SetterCallWith=ActiveWindow&FirstWindow, DoNotCheckSecurityOnSetter, Unforgeable] attribute DOMString href;
-
-    [CallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity, Unforgeable, ReadOnly, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] void assign([Default=Undefined] optional DOMString url);
-    [CallWith=ActiveWindow&FirstWindow, DoNotCheckSecurity, Unforgeable, ReadOnly, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] void replace([Default=Undefined] optional DOMString url);
-    [CallWith=ActiveWindow, Unforgeable, ReadOnly] void reload();
-
-    // URI decomposition attributes
-    [SetterCallWith=ActiveWindow&FirstWindow, SetterRaisesException] attribute DOMString protocol;
-    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString host;
-    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString hostname;
-    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString port;
-    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString pathname;
-    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString search;
-    [SetterCallWith=ActiveWindow&FirstWindow] attribute DOMString hash;
-
-    readonly attribute DOMString origin;
-
-    readonly attribute DOMStringList ancestorOrigins;
-
-    [NotEnumerable, Unforgeable, ReadOnly, ImplementedAs=href] DOMString toString();
-    [NotEnumerable, Custom, Unforgeable, ReadOnly] any valueOf();
-};
-
diff --git a/Source/core/page/MemoryInfo.cpp b/Source/core/page/MemoryInfo.cpp
deleted file mode 100644
index b3ec36a..0000000
--- a/Source/core/page/MemoryInfo.cpp
+++ /dev/null
@@ -1,150 +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/page/MemoryInfo.h"
-
-#include <limits>
-#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/MathExtras.h"
-
-namespace WebCore {
-
-
-class HeapSizeCache {
-    WTF_MAKE_NONCOPYABLE(HeapSizeCache); WTF_MAKE_FAST_ALLOCATED;
-public:
-    HeapSizeCache()
-        : m_lastUpdateTime(0)
-    {
-    }
-
-    void getCachedHeapSize(HeapInfo& info)
-    {
-        maybeUpdate();
-        info = m_info;
-    }
-
-private:
-    void maybeUpdate()
-    {
-        // We rate-limit queries to once every twenty minutes to make it more difficult
-        // for attackers to compare memory usage before and after some event.
-        const double TwentyMinutesInSeconds = 20 * 60;
-
-        double now = monotonicallyIncreasingTime();
-        if (now - m_lastUpdateTime >= TwentyMinutesInSeconds) {
-            update();
-            m_lastUpdateTime = now;
-        }
-    }
-
-    void update()
-    {
-        ScriptGCEvent::getHeapSize(m_info);
-        m_info.usedJSHeapSize = quantizeMemorySize(m_info.usedJSHeapSize);
-        m_info.totalJSHeapSize = quantizeMemorySize(m_info.totalJSHeapSize);
-        m_info.jsHeapSizeLimit = quantizeMemorySize(m_info.jsHeapSizeLimit);
-    }
-
-    double m_lastUpdateTime;
-
-    HeapInfo m_info;
-};
-
-// We quantize the sizes to make it more difficult for an attacker to see precise
-// impact of operations on memory. The values are used for performance tuning,
-// and hence don't need to be as refined when the value is large, so we threshold
-// at a list of exponentially separated buckets.
-size_t quantizeMemorySize(size_t size)
-{
-    const int numberOfBuckets = 100;
-    DEFINE_STATIC_LOCAL(Vector<size_t>, bucketSizeList, ());
-
-    ASSERT(isMainThread());
-    if (bucketSizeList.isEmpty()) {
-        bucketSizeList.resize(numberOfBuckets);
-
-        float sizeOfNextBucket = 10000000.0; // First bucket size is roughly 10M.
-        const float largestBucketSize = 4000000000.0; // Roughly 4GB.
-        // We scale with the Nth root of the ratio, so that we use all the bucktes.
-        const float scalingFactor = exp(log(largestBucketSize / sizeOfNextBucket) / numberOfBuckets);
-
-        size_t nextPowerOfTen = static_cast<size_t>(pow(10, floor(log10(sizeOfNextBucket)) + 1) + 0.5);
-        size_t granularity = nextPowerOfTen / 1000; // We want 3 signficant digits.
-
-        for (int i = 0; i < numberOfBuckets; ++i) {
-            size_t currentBucketSize = static_cast<size_t>(sizeOfNextBucket);
-            bucketSizeList[i] = currentBucketSize - (currentBucketSize % granularity);
-
-            sizeOfNextBucket *= scalingFactor;
-            if (sizeOfNextBucket >= nextPowerOfTen) {
-                if (std::numeric_limits<size_t>::max() / 10 <= nextPowerOfTen)
-                    nextPowerOfTen = std::numeric_limits<size_t>::max();
-                else {
-                    nextPowerOfTen *= 10;
-                    granularity *= 10;
-                }
-            }
-
-            // Watch out for overflow, if the range is too large for size_t.
-            if (i > 0 && bucketSizeList[i] < bucketSizeList[i - 1])
-                bucketSizeList[i] = std::numeric_limits<size_t>::max();
-        }
-    }
-
-    for (int i = 0; i < numberOfBuckets; ++i) {
-        if (size <= bucketSizeList[i])
-            return bucketSizeList[i];
-    }
-
-    return bucketSizeList[numberOfBuckets - 1];
-}
-
-
-MemoryInfo::MemoryInfo(Frame* frame)
-{
-    ScriptWrappable::init(this);
-    if (!frame || !frame->settings())
-        return;
-
-    if (frame->settings()->memoryInfoEnabled())
-        ScriptGCEvent::getHeapSize(m_info);
-    else {
-        DEFINE_STATIC_LOCAL(HeapSizeCache, heapSizeCache, ());
-        heapSizeCache.getCachedHeapSize(m_info);
-    }
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/MouseEventWithHitTestResults.cpp b/Source/core/page/MouseEventWithHitTestResults.cpp
index d0402cf..2b6a70c 100644
--- a/Source/core/page/MouseEventWithHitTestResults.cpp
+++ b/Source/core/page/MouseEventWithHitTestResults.cpp
@@ -34,7 +34,7 @@
 
 bool MouseEventWithHitTestResults::isOverLink() const
 {
-    return m_hitTestResult.URLElement() && m_hitTestResult.URLElement()->isLink();
+    return m_hitTestResult.isOverLink();
 }
 
 }
diff --git a/Source/core/page/MouseEventWithHitTestResults.h b/Source/core/page/MouseEventWithHitTestResults.h
index 650936a..4ad317d 100644
--- a/Source/core/page/MouseEventWithHitTestResults.h
+++ b/Source/core/page/MouseEventWithHitTestResults.h
@@ -21,8 +21,8 @@
 #ifndef MouseEventWithHitTestResults_h
 #define MouseEventWithHitTestResults_h
 
-#include "core/platform/PlatformMouseEvent.h"
 #include "core/rendering/HitTestResult.h"
+#include "platform/PlatformMouseEvent.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/Navigator.cpp b/Source/core/page/Navigator.cpp
deleted file mode 100644
index b93cb62..0000000
--- a/Source/core/page/Navigator.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- *  Copyright (C) 2000 Harri Porten (porten@kde.org)
- *  Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
- *  Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
- *  Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
- *  Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- *
- *  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
- */
-
-#include "config.h"
-#include "core/page/Navigator.h"
-
-#include "bindings/v8/ScriptController.h"
-#include "core/dom/Document.h"
-#include "core/loader/CookieJar.h"
-#include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
-#include "core/page/NavigatorID.h"
-#include "core/page/Page.h"
-#include "core/page/Settings.h"
-#include "core/platform/Language.h"
-#include "core/plugins/DOMMimeTypeArray.h"
-#include "core/plugins/DOMPluginArray.h"
-
-#ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
-#define WEBCORE_NAVIGATOR_PRODUCT_SUB "20030107"
-#endif // ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
-
-#ifndef WEBCORE_NAVIGATOR_VENDOR
-#define WEBCORE_NAVIGATOR_VENDOR "Google Inc."
-#endif // ifndef WEBCORE_NAVIGATOR_VENDOR
-
-#ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
-#define WEBCORE_NAVIGATOR_VENDOR_SUB ""
-#endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
-
-namespace WebCore {
-
-Navigator::Navigator(Frame* frame)
-    : DOMWindowProperty(frame)
-{
-    ScriptWrappable::init(this);
-}
-
-Navigator::~Navigator()
-{
-}
-
-// If this function returns true, we need to hide the substring "4." that would otherwise
-// appear in the appVersion string. This is to avoid problems with old versions of a
-// library called OpenCube QuickMenu, which as of this writing is still being used on
-// sites such as nwa.com -- the library thinks Safari is Netscape 4 if we don't do this!
-static bool shouldHideFourDot(Frame* frame)
-{
-    const String* sourceURL = frame->script()->sourceURL();
-    if (!sourceURL)
-        return false;
-    if (!(sourceURL->endsWith("/dqm_script.js") || sourceURL->endsWith("/dqm_loader.js") || sourceURL->endsWith("/tdqm_loader.js")))
-        return false;
-    Settings* settings = frame->settings();
-    if (!settings)
-        return false;
-    return settings->needsSiteSpecificQuirks();
-}
-
-String Navigator::appVersion() const
-{
-    if (!m_frame)
-        return String();
-    String appVersion = NavigatorID::appVersion(this);
-    if (shouldHideFourDot(m_frame))
-        appVersion.replace("4.", "4_");
-    return appVersion;
-}
-
-String Navigator::language() const
-{
-    return defaultLanguage();
-}
-
-String Navigator::productSub() const
-{
-    return WEBCORE_NAVIGATOR_PRODUCT_SUB;
-}
-
-String Navigator::vendor() const
-{
-    return WEBCORE_NAVIGATOR_VENDOR;
-}
-
-String Navigator::vendorSub() const
-{
-    return WEBCORE_NAVIGATOR_VENDOR_SUB;
-}
-
-String Navigator::userAgent() const
-{
-    if (!m_frame)
-        return String();
-
-    // If the frame is already detached, FrameLoader::userAgent may malfunction, because it calls a client method
-    // that uses frame's WebView (at least, in Mac WebKit).
-    if (!m_frame->page())
-        return String();
-
-    return m_frame->loader()->userAgent(m_frame->document()->url());
-}
-
-DOMPluginArray* Navigator::plugins() const
-{
-    if (!m_plugins)
-        m_plugins = DOMPluginArray::create(m_frame);
-    return m_plugins.get();
-}
-
-DOMMimeTypeArray* Navigator::mimeTypes() const
-{
-    if (!m_mimeTypes)
-        m_mimeTypes = DOMMimeTypeArray::create(m_frame);
-    return m_mimeTypes.get();
-}
-
-bool Navigator::cookieEnabled() const
-{
-    if (!m_frame)
-        return false;
-
-    if (m_frame->page() && !m_frame->page()->settings().cookieEnabled())
-        return false;
-
-    return cookiesEnabled(m_frame->document());
-}
-
-bool Navigator::javaEnabled() const
-{
-    if (!m_frame || !m_frame->settings())
-        return false;
-
-    if (!m_frame->settings()->isJavaEnabled())
-        return false;
-
-    return true;
-}
-
-void Navigator::getStorageUpdates()
-{
-    // FIXME: Remove this method or rename to yieldForStorageUpdates.
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/Navigator.h b/Source/core/page/Navigator.h
deleted file mode 100644
index 3f417d7..0000000
--- a/Source/core/page/Navigator.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-    Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library 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
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef Navigator_h
-#define Navigator_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/page/DOMWindowProperty.h"
-#include "core/page/NavigatorBase.h"
-#include "core/platform/Supplementable.h"
-#include "wtf/Forward.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class DOMMimeTypeArray;
-class DOMPluginArray;
-class Frame;
-class PluginData;
-
-typedef int ExceptionCode;
-
-class Navigator : public NavigatorBase, public ScriptWrappable, public RefCounted<Navigator>, public DOMWindowProperty, public Supplementable<Navigator> {
-public:
-    static PassRefPtr<Navigator> create(Frame* frame) { return adoptRef(new Navigator(frame)); }
-    virtual ~Navigator();
-
-    String appVersion() const;
-    String language() const;
-    DOMPluginArray* plugins() const;
-    DOMMimeTypeArray* mimeTypes() const;
-    bool cookieEnabled() const;
-    bool javaEnabled() const;
-
-    String productSub() const;
-    String vendor() const;
-    String vendorSub() const;
-
-    virtual String userAgent() const OVERRIDE;
-
-    // Relinquishes the storage lock, if one exists.
-    void getStorageUpdates();
-
-private:
-    explicit Navigator(Frame*);
-
-    mutable RefPtr<DOMPluginArray> m_plugins;
-    mutable RefPtr<DOMMimeTypeArray> m_mimeTypes;
-};
-
-}
-
-#endif
diff --git a/Source/core/page/NavigatorID.cpp b/Source/core/page/NavigatorID.cpp
deleted file mode 100644
index f76f57f..0000000
--- a/Source/core/page/NavigatorID.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- * Copyright (C) 2013 Samsung Electronics. 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 "NavigatorID.h"
-
-#include "core/page/NavigatorBase.h"
-
-#if !defined(WEBCORE_NAVIGATOR_PLATFORM) && OS(POSIX) && !OS(MACOSX)
-#include "wtf/StdLibExtras.h"
-#include <sys/utsname.h>
-#endif
-
-#ifndef WEBCORE_NAVIGATOR_PRODUCT
-#define WEBCORE_NAVIGATOR_PRODUCT "Gecko"
-#endif // ifndef WEBCORE_NAVIGATOR_PRODUCT
-
-namespace WebCore {
-
-String NavigatorID::appName(const NavigatorBase*)
-{
-    return "Netscape";
-}
-
-String NavigatorID::appVersion(const NavigatorBase* navigator)
-{
-    // Version is everything in the user agent string past the "Mozilla/" prefix.
-    const String& agent = navigator->userAgent();
-    return agent.substring(agent.find('/') + 1);
-}
-
-String NavigatorID::userAgent(const NavigatorBase* navigator)
-{
-    return navigator->userAgent();
-}
-
-String NavigatorID::platform(const NavigatorBase*)
-{
-#if defined(WEBCORE_NAVIGATOR_PLATFORM)
-    return WEBCORE_NAVIGATOR_PLATFORM;
-#elif OS(MACOSX)
-    // Match Safari and Mozilla on Mac x86.
-    return "MacIntel";
-#elif OS(WIN)
-    // Match Safari and Mozilla on Windows.
-    return "Win32";
-#else // Unix-like systems
-    struct utsname osname;
-    DEFINE_STATIC_LOCAL(String, platformName, (uname(&osname) >= 0 ? String(osname.sysname) + String(" ") + String(osname.machine) : emptyString()));
-    return platformName;
-#endif
-}
-
-String NavigatorID::appCodeName(const NavigatorBase*)
-{
-    return "Mozilla";
-}
-
-String NavigatorID::product(const NavigatorBase*)
-{
-    return WEBCORE_NAVIGATOR_PRODUCT;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/NavigatorOnLine.h b/Source/core/page/NavigatorOnLine.h
deleted file mode 100644
index 934cecb..0000000
--- a/Source/core/page/NavigatorOnLine.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2013 Samsung Electronics. 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 NavigatorOnLine_h
-#define NavigatorOnLine_h
-
-#include "core/platform/network/NetworkStateNotifier.h"
-
-namespace WebCore {
-
-class NavigatorOnLine {
-public:
-    static bool onLine(void*)
-    {
-        return networkStateNotifier().onLine();
-    }
-};
-
-}
-
-#endif // NavigatorOnLine_h
diff --git a/Source/core/page/NetworkStateNotifier.cpp b/Source/core/page/NetworkStateNotifier.cpp
new file mode 100644
index 0000000..02cc461
--- /dev/null
+++ b/Source/core/page/NetworkStateNotifier.cpp
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "core/page/NetworkStateNotifier.h"
+
+#include "core/page/Page.h"
+#include "wtf/Assertions.h"
+#include "wtf/MainThread.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/Threading.h"
+
+namespace WebCore {
+
+NetworkStateNotifier& networkStateNotifier()
+{
+    AtomicallyInitializedStatic(NetworkStateNotifier*, networkStateNotifier = new NetworkStateNotifier);
+    return *networkStateNotifier;
+}
+
+void NetworkStateNotifier::setOnLine(bool onLine)
+{
+    ASSERT(isMainThread());
+
+    {
+        MutexLocker locker(m_mutex);
+        if (m_isOnLine == onLine)
+            return;
+
+        m_isOnLine = onLine;
+    }
+
+    Page::networkStateChanged(onLine);
+}
+
+}
diff --git a/Source/core/page/NetworkStateNotifier.h b/Source/core/page/NetworkStateNotifier.h
new file mode 100644
index 0000000..7e5fb72
--- /dev/null
+++ b/Source/core/page/NetworkStateNotifier.h
@@ -0,0 +1,58 @@
+/*
+ * 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 NetworkStateNotifier_h
+#define NetworkStateNotifier_h
+
+#include "wtf/FastAllocBase.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/ThreadingPrimitives.h"
+
+namespace WebCore {
+
+class NetworkStateNotifier {
+    WTF_MAKE_NONCOPYABLE(NetworkStateNotifier); WTF_MAKE_FAST_ALLOCATED;
+public:
+    NetworkStateNotifier()
+        : m_isOnLine(true) { }
+
+    bool onLine() const
+    {
+        MutexLocker locker(m_mutex);
+        return m_isOnLine;
+    }
+
+    void setOnLine(bool);
+
+private:
+    mutable Mutex m_mutex;
+    bool m_isOnLine;
+};
+
+NetworkStateNotifier& networkStateNotifier();
+
+};
+
+#endif // NetworkStateNotifier_h
diff --git a/Source/core/page/Page.cpp b/Source/core/page/Page.cpp
index 5635bb3..3f1af06 100644
--- a/Source/core/page/Page.cpp
+++ b/Source/core/page/Page.cpp
@@ -22,11 +22,11 @@
 
 #include "core/dom/ClientRectList.h"
 #include "core/dom/DocumentMarkerController.h"
-#include "core/events/Event.h"
-#include "core/events/EventNames.h"
 #include "core/dom/StyleEngine.h"
 #include "core/dom/VisitedLinkState.h"
 #include "core/editing/Caret.h"
+#include "core/events/Event.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/history/BackForwardController.h"
 #include "core/history/HistoryItem.h"
 #include "core/inspector/InspectorController.h"
@@ -35,13 +35,14 @@
 #include "core/loader/ProgressTracker.h"
 #include "core/page/AutoscrollController.h"
 #include "core/page/Chrome.h"
+#include "core/page/ChromeClient.h"
 #include "core/page/ContextMenuController.h"
-#include "core/page/DOMTimer.h"
+#include "core/frame/DOMTimer.h"
 #include "core/page/DragController.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/PageConsole.h"
 #include "core/page/PageGroup.h"
 #include "core/page/PageLifecycleNotifier.h"
@@ -49,7 +50,6 @@
 #include "core/page/Settings.h"
 #include "core/page/ValidationMessageClient.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/platform/network/NetworkStateNotifier.h"
 #include "core/plugins/PluginData.h"
 #include "core/rendering/RenderView.h"
 #include "core/storage/StorageNamespace.h"
@@ -64,7 +64,7 @@
 
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, pageCounter, ("Page"));
 
-static void networkStateChanged()
+void Page::networkStateChanged(bool online)
 {
     Vector<RefPtr<Frame> > frames;
 
@@ -73,10 +73,10 @@
     for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it) {
         for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
             frames.append(frame);
-        InspectorInstrumentation::networkStateChanged(*it);
+        InspectorInstrumentation::networkStateChanged(*it, online);
     }
 
-    AtomicString eventName = networkStateNotifier().onLine() ? eventNames().onlineEvent : eventNames().offlineEvent;
+    AtomicString eventName = online ? EventTypeNames::online : EventTypeNames::offline;
     for (unsigned i = 0; i < frames.size(); i++)
         frames[i]->document()->dispatchWindowEvent(Event::create(eventName));
 }
@@ -116,8 +116,6 @@
     , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval())
     , m_visibilityState(PageVisibilityStateVisible)
     , m_isCursorVisible(true)
-    , m_layoutMilestones(0)
-    , m_isCountingRelevantRepaintedObjects(false)
 #ifndef NDEBUG
     , m_isPainting(false)
 #endif
@@ -125,12 +123,9 @@
 {
     ASSERT(m_editorClient);
 
-    if (!allPages) {
+    if (!allPages)
         allPages = new HashSet<Page*>;
 
-        networkStateNotifier().setNetworkStateChangedFunction(networkStateChanged);
-    }
-
     ASSERT(!allPages->contains(this));
     allPages->add(this);
 
@@ -160,9 +155,9 @@
 #endif
 }
 
-ViewportArguments Page::viewportArguments() const
+ViewportDescription Page::viewportDescription() const
 {
-    return mainFrame() && mainFrame()->document() ? mainFrame()->document()->viewportArguments() : ViewportArguments();
+    return mainFrame() && mainFrame()->document() ? mainFrame()->document()->viewportDescription() : ViewportDescription();
 }
 
 bool Page::autoscrollInProgress() const
@@ -411,6 +406,7 @@
             view->setVisibleContentScaleFactor(scale);
 
         mainFrame()->deviceOrPageScaleFactorChanged();
+        m_chrome->client().deviceOrPageScaleFactorChanged();
 
         if (view)
             view->setViewportConstrainedObjectsNeedLayout();
@@ -428,8 +424,10 @@
     m_deviceScaleFactor = scaleFactor;
     setNeedsRecalcStyleInAllFrames();
 
-    if (mainFrame())
+    if (mainFrame()) {
         mainFrame()->deviceOrPageScaleFactorChanged();
+        m_chrome->client().deviceOrPageScaleFactorChanged();
+    }
 }
 
 void Page::setPagination(const Pagination& pagination)
@@ -570,138 +568,6 @@
     return m_visibilityState;
 }
 
-void Page::addLayoutMilestones(LayoutMilestones milestones)
-{
-    // In the future, we may want a function that replaces m_layoutMilestones instead of just adding to it.
-    m_layoutMilestones |= milestones;
-}
-
-// These are magical constants that might be tweaked over time.
-static double gMinimumPaintedAreaRatio = 0.1;
-static double gMaximumUnpaintedAreaRatio = 0.04;
-
-bool Page::isCountingRelevantRepaintedObjects() const
-{
-    return m_isCountingRelevantRepaintedObjects && (m_layoutMilestones & DidHitRelevantRepaintedObjectsAreaThreshold);
-}
-
-void Page::startCountingRelevantRepaintedObjects()
-{
-    // Reset everything in case we didn't hit the threshold last time.
-    resetRelevantPaintedObjectCounter();
-
-    m_isCountingRelevantRepaintedObjects = true;
-}
-
-void Page::resetRelevantPaintedObjectCounter()
-{
-    m_isCountingRelevantRepaintedObjects = false;
-    m_relevantUnpaintedRenderObjects.clear();
-    m_topRelevantPaintedRegion = Region();
-    m_bottomRelevantPaintedRegion = Region();
-    m_relevantUnpaintedRegion = Region();
-}
-
-static LayoutRect relevantViewRect(RenderView* view)
-{
-    // DidHitRelevantRepaintedObjectsAreaThreshold is a LayoutMilestone intended to indicate that
-    // a certain relevant amount of content has been drawn to the screen. This is the rect that
-    // has been determined to be relevant in the context of this goal. We may choose to tweak
-    // the rect over time, much like we may choose to tweak gMinimumPaintedAreaRatio and
-    // gMaximumUnpaintedAreaRatio. But this seems to work well right now.
-    LayoutRect relevantViewRect = LayoutRect(0, 0, 980, 1300);
-
-    LayoutRect viewRect = view->viewRect();
-    // If the viewRect is wider than the relevantViewRect, center the relevantViewRect.
-    if (viewRect.width() > relevantViewRect.width())
-        relevantViewRect.setX((viewRect.width() - relevantViewRect.width()) / 2);
-
-    return relevantViewRect;
-}
-
-void Page::addRelevantRepaintedObject(RenderObject* object, const LayoutRect& objectPaintRect)
-{
-    if (!isCountingRelevantRepaintedObjects())
-        return;
-
-    // Objects inside sub-frames are not considered to be relevant.
-    if (object->document().frame() != mainFrame())
-        return;
-
-    RenderView* view = object->view();
-    if (!view)
-        return;
-
-    LayoutRect relevantRect = relevantViewRect(view);
-
-    // The objects are only relevant if they are being painted within the viewRect().
-    if (!objectPaintRect.intersects(pixelSnappedIntRect(relevantRect)))
-        return;
-
-    IntRect snappedPaintRect = pixelSnappedIntRect(objectPaintRect);
-
-    // If this object was previously counted as an unpainted object, remove it from that HashSet
-    // and corresponding Region. FIXME: This doesn't do the right thing if the objects overlap.
-    HashSet<RenderObject*>::iterator it = m_relevantUnpaintedRenderObjects.find(object);
-    if (it != m_relevantUnpaintedRenderObjects.end()) {
-        m_relevantUnpaintedRenderObjects.remove(it);
-        m_relevantUnpaintedRegion.subtract(snappedPaintRect);
-    }
-
-    // Split the relevantRect into a top half and a bottom half. Making sure we have coverage in
-    // both halves helps to prevent cases where we have a fully loaded menu bar or masthead with
-    // no content beneath that.
-    LayoutRect topRelevantRect = relevantRect;
-    topRelevantRect.contract(LayoutSize(0, relevantRect.height() / 2));
-    LayoutRect bottomRelevantRect = topRelevantRect;
-    bottomRelevantRect.setY(relevantRect.height() / 2);
-
-    // If the rect straddles both Regions, split it appropriately.
-    if (topRelevantRect.intersects(snappedPaintRect) && bottomRelevantRect.intersects(snappedPaintRect)) {
-        IntRect topIntersection = snappedPaintRect;
-        topIntersection.intersect(pixelSnappedIntRect(topRelevantRect));
-        m_topRelevantPaintedRegion.unite(topIntersection);
-
-        IntRect bottomIntersection = snappedPaintRect;
-        bottomIntersection.intersect(pixelSnappedIntRect(bottomRelevantRect));
-        m_bottomRelevantPaintedRegion.unite(bottomIntersection);
-    } else if (topRelevantRect.intersects(snappedPaintRect))
-        m_topRelevantPaintedRegion.unite(snappedPaintRect);
-    else
-        m_bottomRelevantPaintedRegion.unite(snappedPaintRect);
-
-    float topPaintedArea = m_topRelevantPaintedRegion.totalArea();
-    float bottomPaintedArea = m_bottomRelevantPaintedRegion.totalArea();
-    float viewArea = relevantRect.width() * relevantRect.height();
-
-    float ratioThatIsPaintedOnTop = topPaintedArea / viewArea;
-    float ratioThatIsPaintedOnBottom = bottomPaintedArea / viewArea;
-    float ratioOfViewThatIsUnpainted = m_relevantUnpaintedRegion.totalArea() / viewArea;
-
-    if (ratioThatIsPaintedOnTop > (gMinimumPaintedAreaRatio / 2) && ratioThatIsPaintedOnBottom > (gMinimumPaintedAreaRatio / 2)
-        && ratioOfViewThatIsUnpainted < gMaximumUnpaintedAreaRatio) {
-        m_isCountingRelevantRepaintedObjects = false;
-        resetRelevantPaintedObjectCounter();
-        if (Frame* frame = mainFrame())
-            frame->loader()->didLayout(DidHitRelevantRepaintedObjectsAreaThreshold);
-    }
-}
-
-void Page::addRelevantUnpaintedObject(RenderObject* object, const LayoutRect& objectPaintRect)
-{
-    if (!isCountingRelevantRepaintedObjects())
-        return;
-
-    // The objects are only relevant if they are being painted within the relevantViewRect().
-    if (RenderView* view = object->view()) {
-        if (!objectPaintRect.intersects(pixelSnappedIntRect(relevantViewRect(view))))
-            return;
-    }
-
-    m_relevantUnpaintedRenderObjects.add(object);
-    m_relevantUnpaintedRegion.unite(pixelSnappedIntRect(objectPaintRect));
-}
-
 void Page::addMultisamplingChangedObserver(MultisamplingChangedObserver* observer)
 {
     m_multisamplingChangedObservers.add(observer);
@@ -742,6 +608,7 @@
     , editorClient(0)
     , dragClient(0)
     , inspectorClient(0)
+    , backForwardClient(0)
 {
 }
 
diff --git a/Source/core/page/Page.h b/Source/core/page/Page.h
index 1323bff..aef41da 100644
--- a/Source/core/page/Page.h
+++ b/Source/core/page/Page.h
@@ -21,15 +21,14 @@
 #ifndef Page_h
 #define Page_h
 
-#include "core/dom/ViewportArguments.h"
-#include "core/page/LayoutMilestones.h"
+#include "core/dom/ViewportDescription.h"
 #include "core/page/PageVisibilityState.h"
 #include "core/page/UseCounter.h"
 #include "core/platform/LifecycleContext.h"
-#include "core/platform/Supplementable.h"
-#include "core/platform/graphics/LayoutRect.h"
-#include "core/platform/graphics/Region.h"
 #include "core/rendering/Pagination.h"
+#include "platform/Supplementable.h"
+#include "platform/geometry/LayoutRect.h"
+#include "platform/geometry/Region.h"
 #include "wtf/Forward.h"
 #include "wtf/HashSet.h"
 #include "wtf/Noncopyable.h"
@@ -106,7 +105,7 @@
 
     void setNeedsRecalcStyleInAllFrames();
 
-    ViewportArguments viewportArguments() const;
+    ViewportDescription viewportDescription() const;
 
     static void refreshPlugins(bool reload);
     PluginData* pluginData() const;
@@ -216,15 +215,6 @@
     bool isCursorVisible() const { return m_isCursorVisible; }
     void setIsCursorVisible(bool isVisible) { m_isCursorVisible = isVisible; }
 
-    void addLayoutMilestones(LayoutMilestones);
-    LayoutMilestones layoutMilestones() const { return m_layoutMilestones; }
-
-    bool isCountingRelevantRepaintedObjects() const;
-    void startCountingRelevantRepaintedObjects();
-    void resetRelevantPaintedObjectCounter();
-    void addRelevantRepaintedObject(RenderObject*, const LayoutRect& objectPaintRect);
-    void addRelevantUnpaintedObject(RenderObject*, const LayoutRect& objectPaintRect);
-
 #ifndef NDEBUG
     void setIsPainting(bool painting) { m_isPainting = painting; }
     bool isPainting() const { return m_isPainting; }
@@ -245,6 +235,8 @@
 
     void didCommitLoad(Frame*);
 
+    static void networkStateChanged(bool online);
+
 protected:
     PageLifecycleNotifier* lifecycleNotifier();
 
@@ -308,13 +300,6 @@
 
     bool m_isCursorVisible;
 
-    LayoutMilestones m_layoutMilestones;
-
-    HashSet<RenderObject*> m_relevantUnpaintedRenderObjects;
-    Region m_topRelevantPaintedRegion;
-    Region m_bottomRelevantPaintedRegion;
-    Region m_relevantUnpaintedRegion;
-    bool m_isCountingRelevantRepaintedObjects;
 #ifndef NDEBUG
     bool m_isPainting;
 #endif
diff --git a/Source/core/page/PageConsole.cpp b/Source/core/page/PageConsole.cpp
index 81cbc4c..0cd21cb 100644
--- a/Source/core/page/PageConsole.cpp
+++ b/Source/core/page/PageConsole.cpp
@@ -36,8 +36,8 @@
 #include "core/inspector/ScriptCallStack.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/ConsoleBase.h"
-#include "core/page/ConsoleTypes.h"
+#include "core/frame/ConsoleBase.h"
+#include "core/frame/ConsoleTypes.h"
 #include "core/page/Page.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/WTFString.h"
@@ -72,7 +72,7 @@
     if (muteCount && source != ConsoleAPIMessageSource)
         return;
 
-    ScriptExecutionContext* context = m_page->mainFrame()->document();
+    ExecutionContext* context = m_page->mainFrame()->document();
     if (!context)
         return;
 
diff --git a/Source/core/page/PageConsole.h b/Source/core/page/PageConsole.h
index 20cd086..8f92d69 100644
--- a/Source/core/page/PageConsole.h
+++ b/Source/core/page/PageConsole.h
@@ -31,7 +31,7 @@
 
 #include "bindings/v8/ScriptState.h"
 #include "core/inspector/ScriptCallStack.h"
-#include "core/page/ConsoleTypes.h"
+#include "core/frame/ConsoleTypes.h"
 #include "wtf/Forward.h"
 #include "wtf/PassOwnPtr.h"
 
diff --git a/Source/core/page/PageGroup.cpp b/Source/core/page/PageGroup.cpp
index 29b1937..d623f59 100644
--- a/Source/core/page/PageGroup.cpp
+++ b/Source/core/page/PageGroup.cpp
@@ -28,7 +28,7 @@
 
 #include "core/dom/Document.h"
 #include "core/dom/StyleEngine.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 
 namespace WebCore {
@@ -39,7 +39,7 @@
 
 PageGroup::~PageGroup()
 {
-    removeAllUserContent();
+    removeInjectedStyleSheets();
 }
 
 PageGroup* PageGroup::sharedGroup()
@@ -68,21 +68,15 @@
     m_pages.remove(page);
 }
 
-void PageGroup::addUserStyleSheet(const String& source, const KURL& url,
-                                  const Vector<String>& whitelist, const Vector<String>& blacklist,
-                                  UserContentInjectedFrames injectedFrames,
-                                  UserStyleLevel level,
-                                  UserStyleInjectionTime injectionTime)
+void PageGroup::injectStyleSheet(const String& source, const Vector<String>& whitelist, StyleInjectionTarget injectIn)
 {
-    m_userStyleSheets.append(adoptPtr(new UserStyleSheet(source, url, whitelist, blacklist, injectedFrames, level)));
-
-    if (injectionTime == InjectInExistingDocuments)
-        invalidatedInjectedStyleSheetCacheInAllFrames();
+    m_injectedStyleSheets.append(adoptPtr(new InjectedStyleSheet(source, whitelist, injectIn)));
+    invalidatedInjectedStyleSheetCacheInAllFrames();
 }
 
-void PageGroup::removeAllUserContent()
+void PageGroup::removeInjectedStyleSheets()
 {
-    m_userStyleSheets.clear();
+    m_injectedStyleSheets.clear();
     invalidatedInjectedStyleSheetCacheInAllFrames();
 }
 
diff --git a/Source/core/page/PageGroup.h b/Source/core/page/PageGroup.h
index c10f83a..0c7fb0d 100644
--- a/Source/core/page/PageGroup.h
+++ b/Source/core/page/PageGroup.h
@@ -26,8 +26,8 @@
 #ifndef PageGroup_h
 #define PageGroup_h
 
-#include "core/page/UserStyleSheet.h"
-#include "core/platform/Supplementable.h"
+#include "core/page/InjectedStyleSheet.h"
+#include "platform/Supplementable.h"
 #include "wtf/HashSet.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/PassRefPtr.h"
@@ -53,15 +53,10 @@
         void addPage(Page*);
         void removePage(Page*);
 
-        void addUserStyleSheet(const String& source, const KURL&,
-                               const Vector<String>& whitelist, const Vector<String>& blacklist,
-                               UserContentInjectedFrames,
-                               UserStyleLevel level = UserStyleUserLevel,
-                               UserStyleInjectionTime injectionTime = InjectInExistingDocuments);
+        void injectStyleSheet(const String& source, const Vector<String>& whitelist, StyleInjectionTarget);
+        void removeInjectedStyleSheets();
 
-        void removeAllUserContent();
-
-        const UserStyleSheetVector& userStyleSheets() const { return m_userStyleSheets; }
+        const InjectedStyleSheetVector& injectedStyleSheets() const { return m_injectedStyleSheets; }
 
     private:
         PageGroup();
@@ -69,7 +64,7 @@
         void invalidatedInjectedStyleSheetCacheInAllFrames();
 
         HashSet<Page*> m_pages;
-        UserStyleSheetVector m_userStyleSheets;
+        InjectedStyleSheetVector m_injectedStyleSheets;
     };
 
 } // namespace WebCore
diff --git a/Source/core/page/PageGroupLoadDeferrer.cpp b/Source/core/page/PageGroupLoadDeferrer.cpp
index fec74c1..d00a519 100644
--- a/Source/core/page/PageGroupLoadDeferrer.cpp
+++ b/Source/core/page/PageGroupLoadDeferrer.cpp
@@ -23,7 +23,7 @@
 
 #include "core/dom/Document.h"
 #include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/PageGroup.h"
 #include "wtf/HashSet.h"
@@ -50,7 +50,7 @@
                 // This code is not logically part of load deferring, but we do not want JS code executed beneath modal
                 // windows or sheets, which is exactly when PageGroupLoadDeferrer is used.
                 for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree()->traverseNext())
-                    frame->document()->suspendScheduledTasks(ActiveDOMObject::WillDeferLoading);
+                    frame->document()->suspendScheduledTasks();
             }
         }
     }
diff --git a/Source/core/page/PagePopupClient.h b/Source/core/page/PagePopupClient.h
index 0d2ff6f..812e973 100644
--- a/Source/core/page/PagePopupClient.h
+++ b/Source/core/page/PagePopupClient.h
@@ -32,7 +32,7 @@
 #define PagePopupClient_h
 
 #include "core/loader/DocumentWriter.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/page/PagePopupController.cpp b/Source/core/page/PagePopupController.cpp
index 144682f..8950000 100644
--- a/Source/core/page/PagePopupController.cpp
+++ b/Source/core/page/PagePopupController.cpp
@@ -33,7 +33,7 @@
 
 #include "core/page/PagePopupClient.h"
 #include "core/platform/HistogramSupport.h"
-#include "core/platform/text/PlatformLocale.h"
+#include "platform/text/PlatformLocale.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/PagePopupController.idl b/Source/core/page/PagePopupController.idl
index 453850d..069098c 100644
--- a/Source/core/page/PagePopupController.idl
+++ b/Source/core/page/PagePopupController.idl
@@ -30,7 +30,7 @@
 
 [
     NoInterfaceObject,
-    EnabledAtRuntime=PagePopup
+    RuntimeEnabled=PagePopup
 ] interface PagePopupController {
     void setValueAndClosePopup(long numberValue, DOMString stringValue);
     void setValue(DOMString value);
diff --git a/Source/core/page/PageScaleConstraints.h b/Source/core/page/PageScaleConstraints.h
index 92688aa..dc390e2 100644
--- a/Source/core/page/PageScaleConstraints.h
+++ b/Source/core/page/PageScaleConstraints.h
@@ -31,7 +31,7 @@
 #ifndef PageScaleConstraints_h
 #define PageScaleConstraints_h
 
-#include "core/platform/graphics/FloatSize.h"
+#include "platform/geometry/FloatSize.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/PageScaleConstraintsSet.cpp b/Source/core/page/PageScaleConstraintsSet.cpp
deleted file mode 100644
index 6eacede..0000000
--- a/Source/core/page/PageScaleConstraintsSet.cpp
+++ /dev/null
@@ -1,169 +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.
- */
-
-#include "config.h"
-#include "core/page/PageScaleConstraintsSet.h"
-
-#include "wtf/Assertions.h"
-
-namespace WebCore {
-
-static const float defaultMinimumScale = 0.25f;
-static const float defaultMaximumScale = 5.0f;
-
-PageScaleConstraintsSet::PageScaleConstraintsSet()
-    : m_lastContentsWidth(0)
-    , m_needsReset(false)
-    , m_constraintsDirty(false)
-{
-    m_finalConstraints = defaultConstraints();
-}
-
-PageScaleConstraints PageScaleConstraintsSet::defaultConstraints() const
-{
-    return PageScaleConstraints(-1, defaultMinimumScale, defaultMaximumScale);
-}
-
-void PageScaleConstraintsSet::updatePageDefinedConstraints(const ViewportArguments& arguments, IntSize viewSize)
-{
-    m_pageDefinedConstraints = arguments.resolve(viewSize);
-
-    m_constraintsDirty = true;
-}
-
-void PageScaleConstraintsSet::setUserAgentConstraints(const PageScaleConstraints& userAgentConstraints)
-{
-    m_userAgentConstraints = userAgentConstraints;
-    m_constraintsDirty = true;
-}
-
-void PageScaleConstraintsSet::computeFinalConstraints()
-{
-    m_finalConstraints = defaultConstraints();
-    m_finalConstraints.overrideWith(m_pageDefinedConstraints);
-    m_finalConstraints.overrideWith(m_userAgentConstraints);
-
-    m_constraintsDirty = false;
-}
-
-void PageScaleConstraintsSet::adjustFinalConstraintsToContentsSize(IntSize viewSize, IntSize contentsSize, int nonOverlayScrollbarWidth)
-{
-    m_finalConstraints.fitToContentsWidth(contentsSize.width(), viewSize.width() - nonOverlayScrollbarWidth);
-}
-
-void PageScaleConstraintsSet::setNeedsReset(bool needsReset)
-{
-    m_needsReset = needsReset;
-    if (needsReset)
-        m_constraintsDirty = true;
-}
-
-void PageScaleConstraintsSet::didChangeContentsSize(IntSize contentsSize, float pageScaleFactor)
-{
-    // If a large fixed-width element expanded the size of the document
-    // late in loading and our initial scale is not constrained, reset the
-    // page scale factor to the new minimum scale.
-    if (contentsSize.width() > m_lastContentsWidth
-        && pageScaleFactor == finalConstraints().minimumScale
-        && userAgentConstraints().initialScale == -1 && pageDefinedConstraints().initialScale == -1)
-        setNeedsReset(true);
-
-    m_constraintsDirty = true;
-    m_lastContentsWidth = contentsSize.width();
-}
-
-static float computeDeprecatedTargetDensityDPIFactor(const ViewportArguments& arguments, float deviceScaleFactor)
-{
-    if (arguments.deprecatedTargetDensityDPI == ViewportArguments::ValueDeviceDPI)
-        return 1.0f / deviceScaleFactor;
-
-    float targetDPI = -1.0f;
-    if (arguments.deprecatedTargetDensityDPI == ViewportArguments::ValueLowDPI)
-        targetDPI = 120.0f;
-    else if (arguments.deprecatedTargetDensityDPI == ViewportArguments::ValueMediumDPI)
-        targetDPI = 160.0f;
-    else if (arguments.deprecatedTargetDensityDPI == ViewportArguments::ValueHighDPI)
-        targetDPI = 240.0f;
-    else if (arguments.deprecatedTargetDensityDPI != ViewportArguments::ValueAuto)
-        targetDPI = arguments.deprecatedTargetDensityDPI;
-    return targetDPI > 0 ? 160.0f / targetDPI : 1.0f;
-}
-
-static float getLayoutWidthForNonWideViewport(const FloatSize& deviceSize, float initialScale)
-{
-    return initialScale == -1 ? deviceSize.width() : deviceSize.width() / initialScale;
-}
-
-void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportArguments& arguments, IntSize viewSize, int layoutFallbackWidth, float deviceScaleFactor, bool supportTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool loadWithOverviewMode)
-{
-    if (!supportTargetDensityDPI && !wideViewportQuirkEnabled && loadWithOverviewMode)
-        return;
-
-    float initialScale = m_pageDefinedConstraints.initialScale;
-    if (!loadWithOverviewMode) {
-        bool resetInitialScale = false;
-        if (arguments.zoom == -1) {
-            if (arguments.maxWidth.isAuto())
-                resetInitialScale = true;
-            if (useWideViewport && arguments.maxWidth.isFixed())
-                resetInitialScale = true;
-        }
-        if (resetInitialScale)
-            m_pageDefinedConstraints.initialScale = 1.0f;
-    }
-
-    float adjustedLayoutSizeWidth = m_pageDefinedConstraints.layoutSize.width();
-    float targetDensityDPIFactor = 1.0f;
-
-    if (supportTargetDensityDPI) {
-        targetDensityDPIFactor = computeDeprecatedTargetDensityDPIFactor(arguments, deviceScaleFactor);
-        if (m_pageDefinedConstraints.initialScale != -1)
-            m_pageDefinedConstraints.initialScale *= targetDensityDPIFactor;
-        m_pageDefinedConstraints.minimumScale *= targetDensityDPIFactor;
-        m_pageDefinedConstraints.maximumScale *= targetDensityDPIFactor;
-        adjustedLayoutSizeWidth /= targetDensityDPIFactor;
-    }
-
-    if (wideViewportQuirkEnabled) {
-        if (useWideViewport && (arguments.maxWidth.isAuto() || arguments.maxWidth.type() == ExtendToZoom) && arguments.zoom != 1.0f)
-            adjustedLayoutSizeWidth = layoutFallbackWidth;
-        else if (!useWideViewport)
-            adjustedLayoutSizeWidth = getLayoutWidthForNonWideViewport(viewSize, initialScale) / targetDensityDPIFactor;
-    }
-
-    if (adjustedLayoutSizeWidth != m_pageDefinedConstraints.layoutSize.width()) {
-        ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0);
-        float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefinedConstraints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width();
-        m_pageDefinedConstraints.layoutSize.setWidth(adjustedLayoutSizeWidth);
-        m_pageDefinedConstraints.layoutSize.setHeight(adjustedLayoutSizeHeight);
-    }
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/PageScaleConstraintsSet.h b/Source/core/page/PageScaleConstraintsSet.h
deleted file mode 100644
index 2e281cb..0000000
--- a/Source/core/page/PageScaleConstraintsSet.h
+++ /dev/null
@@ -1,88 +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 PageScaleConstraintsSet_h
-#define PageScaleConstraintsSet_h
-
-#include "PageScaleConstraints.h"
-#include "core/dom/ViewportArguments.h"
-#include "core/platform/graphics/IntSize.h"
-
-namespace WebCore {
-
-// This class harmonizes the viewport (particularly page scale) constraints from
-// the meta viewport tag and other sources.
-class PageScaleConstraintsSet {
-public:
-    PageScaleConstraintsSet();
-
-    PageScaleConstraints defaultConstraints() const;
-
-    // Settings defined in the website's viewport tag, if viewport tag support
-    // is enabled.
-    const PageScaleConstraints& pageDefinedConstraints() const { return m_pageDefinedConstraints; }
-    void updatePageDefinedConstraints(const ViewportArguments&, IntSize viewSize);
-    void adjustForAndroidWebViewQuirks(const ViewportArguments&, IntSize viewSize, int layoutFallbackWidth, float deviceScaleFactor, bool supportTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool loadWithOverviewMode);
-
-    // Constraints may also be set from Chromium -- this overrides any
-    // page-defined values.
-    const PageScaleConstraints& userAgentConstraints() const { return m_userAgentConstraints; }
-    void setUserAgentConstraints(const PageScaleConstraints&);
-
-    // Actual computed values, taking into account the above plus the current
-    // viewport size and document width.
-    const PageScaleConstraints& finalConstraints() const { return m_finalConstraints; }
-    void computeFinalConstraints();
-    void adjustFinalConstraintsToContentsSize(IntSize viewSize, IntSize contentsSize, int nonOverlayScrollbarWidth);
-
-    void didChangeContentsSize(IntSize contentsSize, float pageScaleFactor);
-
-    // This should be set to true on each page load to note that the page scale
-    // factor needs to be reset to its initial value.
-    void setNeedsReset(bool);
-    bool needsReset() const { return m_needsReset; }
-
-    // This is set when one of the inputs to finalConstraints changes.
-    bool constraintsDirty() const { return m_constraintsDirty; }
-
-private:
-    PageScaleConstraints m_pageDefinedConstraints;
-    PageScaleConstraints m_userAgentConstraints;
-    PageScaleConstraints m_finalConstraints;
-
-    int m_lastContentsWidth;
-
-    bool m_needsReset;
-    bool m_constraintsDirty;
-};
-
-} // namespace WebCore
-
-#endif // PageScaleConstraintsSet_h
diff --git a/Source/core/page/PageSerializer.cpp b/Source/core/page/PageSerializer.cpp
index e22b0d4..9f46480 100644
--- a/Source/core/page/PageSerializer.cpp
+++ b/Source/core/page/PageSerializer.cpp
@@ -54,7 +54,7 @@
 #include "core/html/HTMLLinkElement.h"
 #include "core/html/HTMLStyleElement.h"
 #include "core/html/parser/HTMLMetaCharsetParser.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/platform/SerializedResource.h"
 #include "core/platform/graphics/Image.h"
diff --git a/Source/core/page/Performance.cpp b/Source/core/page/Performance.cpp
deleted file mode 100644
index 483bb73..0000000
--- a/Source/core/page/Performance.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- * Copyright (C) 2012 Intel 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/page/Performance.h"
-
-#include "core/dom/Document.h"
-#include "core/loader/DocumentLoader.h"
-#include "core/page/MemoryInfo.h"
-#include "core/page/PerformanceEntry.h"
-#include "core/page/PerformanceNavigation.h"
-#include "core/page/PerformanceResourceTiming.h"
-#include "core/page/PerformanceTiming.h"
-#include "core/page/PerformanceUserTiming.h"
-#include "core/page/ResourceTimingInfo.h"
-#include "weborigin/SecurityOrigin.h"
-#include "wtf/CurrentTime.h"
-
-#include "core/page/Frame.h"
-
-namespace WebCore {
-
-static const size_t defaultResourceTimingBufferSize = 150;
-
-Performance::Performance(Frame* frame)
-    : DOMWindowProperty(frame)
-    , m_resourceTimingBufferSize(defaultResourceTimingBufferSize)
-    , m_userTiming(0)
-    , m_referenceTime(frame->document()->loader()->timing()->referenceMonotonicTime())
-{
-    ASSERT(m_referenceTime);
-    ScriptWrappable::init(this);
-}
-
-Performance::~Performance()
-{
-}
-
-const AtomicString& Performance::interfaceName() const
-{
-    return eventNames().interfaceForPerformance;
-}
-
-ScriptExecutionContext* Performance::scriptExecutionContext() const
-{
-    if (!frame())
-        return 0;
-    return frame()->document();
-}
-
-PassRefPtr<MemoryInfo> Performance::memory() const
-{
-    return MemoryInfo::create(m_frame);
-}
-
-PerformanceNavigation* Performance::navigation() const
-{
-    if (!m_navigation)
-        m_navigation = PerformanceNavigation::create(m_frame);
-
-    return m_navigation.get();
-}
-
-PerformanceTiming* Performance::timing() const
-{
-    if (!m_timing)
-        m_timing = PerformanceTiming::create(m_frame);
-
-    return m_timing.get();
-}
-
-Vector<RefPtr<PerformanceEntry> > Performance::getEntries() const
-{
-    Vector<RefPtr<PerformanceEntry> > entries;
-
-    entries.append(m_resourceTimingBuffer);
-
-    if (m_userTiming) {
-        entries.append(m_userTiming->getMarks());
-        entries.append(m_userTiming->getMeasures());
-    }
-
-    std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompareLessThan);
-    return entries;
-}
-
-Vector<RefPtr<PerformanceEntry> > Performance::getEntriesByType(const String& entryType)
-{
-    Vector<RefPtr<PerformanceEntry> > entries;
-
-    if (equalIgnoringCase(entryType, "resource"))
-        for (Vector<RefPtr<PerformanceEntry> >::const_iterator resource = m_resourceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
-            entries.append(*resource);
-
-    if (m_userTiming) {
-        if (equalIgnoringCase(entryType, "mark"))
-            entries.append(m_userTiming->getMarks());
-        else if (equalIgnoringCase(entryType, "measure"))
-            entries.append(m_userTiming->getMeasures());
-    }
-
-    std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompareLessThan);
-    return entries;
-}
-
-Vector<RefPtr<PerformanceEntry> > Performance::getEntriesByName(const String& name, const String& entryType)
-{
-    Vector<RefPtr<PerformanceEntry> > entries;
-
-    if (entryType.isNull() || equalIgnoringCase(entryType, "resource"))
-        for (Vector<RefPtr<PerformanceEntry> >::const_iterator resource = m_resourceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
-            if ((*resource)->name() == name)
-                entries.append(*resource);
-
-    if (m_userTiming) {
-        if (entryType.isNull() || equalIgnoringCase(entryType, "mark"))
-            entries.append(m_userTiming->getMarks(name));
-        if (entryType.isNull() || equalIgnoringCase(entryType, "measure"))
-            entries.append(m_userTiming->getMeasures(name));
-    }
-
-    std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompareLessThan);
-    return entries;
-}
-
-void Performance::webkitClearResourceTimings()
-{
-    m_resourceTimingBuffer.clear();
-}
-
-void Performance::webkitSetResourceTimingBufferSize(unsigned size)
-{
-    m_resourceTimingBufferSize = size;
-    if (isResourceTimingBufferFull())
-        dispatchEvent(Event::create(eventNames().webkitresourcetimingbufferfullEvent));
-}
-
-static bool passesTimingAllowCheck(const ResourceResponse& response, Document* requestingDocument)
-{
-    AtomicallyInitializedStatic(AtomicString&, timingAllowOrigin = *new AtomicString("timing-allow-origin"));
-
-    RefPtr<SecurityOrigin> resourceOrigin = SecurityOrigin::create(response.url());
-    if (resourceOrigin->isSameSchemeHostPort(requestingDocument->securityOrigin()))
-        return true;
-
-    const String& timingAllowOriginString = response.httpHeaderField(timingAllowOrigin);
-    if (timingAllowOriginString.isEmpty() || equalIgnoringCase(timingAllowOriginString, "null"))
-        return false;
-
-    if (timingAllowOriginString == "*")
-        return true;
-
-    const String& securityOrigin = requestingDocument->securityOrigin()->toString();
-    Vector<String> timingAllowOrigins;
-    timingAllowOriginString.split(" ", timingAllowOrigins);
-    for (size_t i = 0; i < timingAllowOrigins.size(); ++i) {
-        if (timingAllowOrigins[i] == securityOrigin)
-            return true;
-    }
-
-    return false;
-}
-
-static bool allowsTimingRedirect(const Vector<ResourceResponse>& redirectChain, const ResourceResponse& finalResponse, Document* initiatorDocument)
-{
-    if (!passesTimingAllowCheck(finalResponse, initiatorDocument))
-        return false;
-
-    for (size_t i = 0; i < redirectChain.size(); i++) {
-        if (!passesTimingAllowCheck(redirectChain[i], initiatorDocument))
-            return false;
-    }
-
-    return true;
-}
-
-void Performance::addResourceTiming(const ResourceTimingInfo& info, Document* initiatorDocument)
-{
-    if (isResourceTimingBufferFull())
-        return;
-
-    const ResourceResponse& finalResponse = info.finalResponse();
-    bool allowTimingDetails = passesTimingAllowCheck(finalResponse, initiatorDocument);
-    double startTime = info.initialTime();
-
-    if (info.redirectChain().isEmpty()) {
-        RefPtr<PerformanceEntry> entry = PerformanceResourceTiming::create(info, initiatorDocument, startTime, allowTimingDetails);
-        addResourceTimingBuffer(entry);
-        return;
-    }
-
-    const Vector<ResourceResponse>& redirectChain = info.redirectChain();
-    bool allowRedirectDetails = allowsTimingRedirect(redirectChain, finalResponse, initiatorDocument);
-
-    if (!allowRedirectDetails) {
-        ResourceLoadTiming* finalTiming = finalResponse.resourceLoadTiming();
-        ASSERT(finalTiming);
-        if (finalTiming)
-            startTime = finalTiming->requestTime;
-    }
-
-    ResourceLoadTiming* lastRedirectTiming = redirectChain.last().resourceLoadTiming();
-    ASSERT(lastRedirectTiming);
-    double lastRedirectEndTime = lastRedirectTiming->receiveHeadersEnd;
-
-    RefPtr<PerformanceEntry> entry = PerformanceResourceTiming::create(info, initiatorDocument, startTime, lastRedirectEndTime, allowTimingDetails, allowRedirectDetails);
-    addResourceTimingBuffer(entry);
-}
-
-void Performance::addResourceTimingBuffer(PassRefPtr<PerformanceEntry> entry)
-{
-    m_resourceTimingBuffer.append(entry);
-
-    if (isResourceTimingBufferFull())
-        dispatchEvent(Event::create(eventNames().webkitresourcetimingbufferfullEvent));
-}
-
-bool Performance::isResourceTimingBufferFull()
-{
-    return m_resourceTimingBuffer.size() >= m_resourceTimingBufferSize;
-}
-
-EventTargetData* Performance::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* Performance::ensureEventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-void Performance::mark(const String& markName, ExceptionState& es)
-{
-    if (!m_userTiming)
-        m_userTiming = UserTiming::create(this);
-    m_userTiming->mark(markName, es);
-}
-
-void Performance::clearMarks(const String& markName)
-{
-    if (!m_userTiming)
-        m_userTiming = UserTiming::create(this);
-    m_userTiming->clearMarks(markName);
-}
-
-void Performance::measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState& es)
-{
-    if (!m_userTiming)
-        m_userTiming = UserTiming::create(this);
-    m_userTiming->measure(measureName, startMark, endMark, es);
-}
-
-void Performance::clearMeasures(const String& measureName)
-{
-    if (!m_userTiming)
-        m_userTiming = UserTiming::create(this);
-    m_userTiming->clearMeasures(measureName);
-}
-
-double Performance::now() const
-{
-    return 1000.0 * (monotonicallyIncreasingTime() - m_referenceTime);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/Performance.h b/Source/core/page/Performance.h
deleted file mode 100644
index b222b49..0000000
--- a/Source/core/page/Performance.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- * Copyright (C) 2012 Intel 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 Performance_h
-#define Performance_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/events/EventTarget.h"
-#include "core/page/DOMWindowProperty.h"
-#include "core/page/MemoryInfo.h"
-#include "core/page/PerformanceEntry.h"
-#include "core/page/PerformanceNavigation.h"
-#include "core/page/PerformanceTiming.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class Document;
-class ExceptionState;
-class ResourceRequest;
-class ResourceResponse;
-class ResourceTimingInfo;
-class UserTiming;
-
-class Performance : public ScriptWrappable, public RefCounted<Performance>, public DOMWindowProperty, public EventTarget {
-public:
-    static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Performance(frame)); }
-    ~Performance();
-
-    virtual const AtomicString& interfaceName() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const;
-
-    PassRefPtr<MemoryInfo> memory() const;
-    PerformanceNavigation* navigation() const;
-    PerformanceTiming* timing() const;
-    double now() const;
-
-    Vector<RefPtr<PerformanceEntry> > getEntries() const;
-    Vector<RefPtr<PerformanceEntry> > getEntriesByType(const String& entryType);
-    Vector<RefPtr<PerformanceEntry> > getEntriesByName(const String& name, const String& entryType);
-
-    void webkitClearResourceTimings();
-    void webkitSetResourceTimingBufferSize(unsigned int);
-
-    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull);
-
-    void addResourceTiming(const ResourceTimingInfo&, Document*);
-
-    using RefCounted<Performance>::ref;
-    using RefCounted<Performance>::deref;
-
-    void mark(const String& markName, ExceptionState&);
-    void clearMarks(const String& markName);
-
-    void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState&);
-    void clearMeasures(const String& measureName);
-
-private:
-    explicit Performance(Frame*);
-
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
-    virtual EventTargetData* eventTargetData();
-    virtual EventTargetData* ensureEventTargetData();
-    bool isResourceTimingBufferFull();
-    void addResourceTimingBuffer(PassRefPtr<PerformanceEntry>);
-
-    EventTargetData m_eventTargetData;
-
-    mutable RefPtr<PerformanceNavigation> m_navigation;
-    mutable RefPtr<PerformanceTiming> m_timing;
-
-    Vector<RefPtr<PerformanceEntry> > m_resourceTimingBuffer;
-    unsigned m_resourceTimingBufferSize;
-    double m_referenceTime;
-
-    RefPtr<UserTiming> m_userTiming;
-};
-
-}
-
-#endif // Performance_h
diff --git a/Source/core/page/Performance.idl b/Source/core/page/Performance.idl
deleted file mode 100644
index 8dd3ea8..0000000
--- a/Source/core/page/Performance.idl
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- * Copyright (C) 2012 Intel 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.
- */
-
-// See: http://dev.w3.org/2006/webapi/WebTiming/
-interface Performance : EventTarget {
-    readonly attribute PerformanceNavigation navigation;
-    readonly attribute PerformanceTiming timing;
-    readonly attribute MemoryInfo memory;
-
-    [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntries();
-    [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByType(DOMString entryType);
-    [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByName(DOMString name, [Default=NullString] optional DOMString entryType);
-    [DeprecateAs=PrefixedPerformanceTimeline,ImplementedAs=getEntries] sequence<PerformanceEntry> webkitGetEntries();
-    [DeprecateAs=PrefixedPerformanceTimeline,ImplementedAs=getEntriesByType] sequence<PerformanceEntry> webkitGetEntriesByType(DOMString entryType);
-    [DeprecateAs=PrefixedPerformanceTimeline,ImplementedAs=getEntriesByName] sequence<PerformanceEntry> webkitGetEntriesByName(DOMString name, [Default=NullString] optional DOMString entryType);
-
-    void webkitClearResourceTimings();
-    void webkitSetResourceTimingBufferSize(unsigned long maxSize);
-
-    attribute EventHandler onwebkitresourcetimingbufferfull;
-
-    // See http://www.w3.org/TR/2012/CR-user-timing-20120726/
-    [RaisesException,MeasureAs=UnprefixedUserTiming] void mark(DOMString markName);
-    [MeasureAs=UnprefixedUserTiming] void clearMarks([Default=NullString] optional  DOMString markName);
-
-    [RaisesException,MeasureAs=UnprefixedUserTiming] void measure(DOMString measureName, [Default=NullString] optional DOMString startMark, [Default=NullString] optional DOMString endMark);
-    [MeasureAs=UnprefixedUserTiming] void clearMeasures([Default=NullString] optional DOMString measureName);
-
-    [RaisesException,DeprecateAs=PrefixedUserTiming,ImplementedAs=mark] void webkitMark(DOMString markName);
-    [DeprecateAs=PrefixedUserTiming,ImplementedAs=clearMarks] void webkitClearMarks([Default=NullString] optional  DOMString markName);
-
-    [RaisesException,DeprecateAs=PrefixedUserTiming,ImplementedAs=measure] void webkitMeasure(DOMString measureName, [Default=NullString] optional DOMString startMark, [Default=NullString] optional DOMString endMark);
-    [DeprecateAs=PrefixedUserTiming,ImplementedAs=clearMeasures] void webkitClearMeasures([Default=NullString] optional DOMString measureName);
-
-    // See http://www.w3.org/TR/hr-time/ for details.
-    double now();
-};
-
diff --git a/Source/core/page/PerformanceEntry.cpp b/Source/core/page/PerformanceEntry.cpp
deleted file mode 100644
index ac69608..0000000
--- a/Source/core/page/PerformanceEntry.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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:
- *
- *     * 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/page/PerformanceEntry.h"
-
-namespace WebCore {
-
-PerformanceEntry::PerformanceEntry(const String& name, const String& entryType, double startTime, double finishTime)
-    : m_name(name)
-    , m_entryType(entryType)
-    , m_startTime(startTime)
-    , m_duration(finishTime - startTime)
-{
-    ScriptWrappable::init(this);
-}
-
-PerformanceEntry::~PerformanceEntry()
-{
-}
-
-String PerformanceEntry::name() const
-{
-    return m_name;
-}
-
-String PerformanceEntry::entryType() const
-{
-    return m_entryType;
-}
-
-double PerformanceEntry::startTime() const
-{
-    return m_startTime;
-}
-
-double PerformanceEntry::duration() const
-{
-    return m_duration;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/PerformanceMark.h b/Source/core/page/PerformanceMark.h
deleted file mode 100644
index 4e66458..0000000
--- a/Source/core/page/PerformanceMark.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2012 Intel 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 PerformanceMark_h
-#define PerformanceMark_h
-
-#include "core/page/PerformanceEntry.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class PerformanceMark : public PerformanceEntry {
-public:
-    static PassRefPtr<PerformanceMark> create(const String& name, double startTime) { return adoptRef(new PerformanceMark(name, startTime)); }
-
-    virtual bool isMark() { return true; }
-
-private:
-    PerformanceMark(const String& name, double startTime) : PerformanceEntry(name, "mark", startTime, startTime)
-    {
-        ScriptWrappable::init(this);
-    }
-
-    ~PerformanceMark() { }
-};
-
-}
-
-#endif // !defined(PerformanceMark_h)
diff --git a/Source/core/page/PerformanceMeasure.h b/Source/core/page/PerformanceMeasure.h
deleted file mode 100644
index 9708d33..0000000
--- a/Source/core/page/PerformanceMeasure.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2012 Intel 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 PerformanceMeasure_h
-#define PerformanceMeasure_h
-
-#include "core/page/PerformanceEntry.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class PerformanceMeasure : public PerformanceEntry {
-public:
-    static PassRefPtr<PerformanceMeasure> create(const String& name, double startTime, double endTime) { return adoptRef(new PerformanceMeasure(name, startTime, endTime)); }
-
-    virtual bool isMeasure() { return true; }
-
-private:
-    PerformanceMeasure(const String& name, double startTime, double endTime) : PerformanceEntry(name, "measure", startTime, endTime)
-    {
-        ScriptWrappable::init(this);
-    }
-    ~PerformanceMeasure() { }
-};
-
-}
-
-#endif // !defined(PerformanceMeasure_h)
diff --git a/Source/core/page/PerformanceNavigation.cpp b/Source/core/page/PerformanceNavigation.cpp
deleted file mode 100644
index 9e3a031..0000000
--- a/Source/core/page/PerformanceNavigation.cpp
+++ /dev/null
@@ -1,82 +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/page/PerformanceNavigation.h"
-
-#include "core/loader/DocumentLoader.h"
-#include "core/loader/FrameLoaderTypes.h"
-#include "core/page/Frame.h"
-
-namespace WebCore {
-
-PerformanceNavigation::PerformanceNavigation(Frame* frame)
-    : DOMWindowProperty(frame)
-{
-    ScriptWrappable::init(this);
-}
-
-unsigned short PerformanceNavigation::type() const
-{
-    if (!m_frame)
-        return TYPE_NAVIGATE;
-
-    DocumentLoader* documentLoader = m_frame->loader()->documentLoader();
-    if (!documentLoader)
-        return TYPE_NAVIGATE;
-
-    WebCore::NavigationType navigationType = documentLoader->triggeringAction().type();
-    switch (navigationType) {
-    case NavigationTypeReload:
-        return TYPE_RELOAD;
-    case NavigationTypeBackForward:
-        return TYPE_BACK_FORWARD;
-    default:
-        return TYPE_NAVIGATE;
-    }
-}
-
-unsigned short PerformanceNavigation::redirectCount() const
-{
-    if (!m_frame)
-        return 0;
-
-    DocumentLoader* loader = m_frame->loader()->documentLoader();
-    if (!loader)
-        return 0;
-
-    DocumentLoadTiming* timing = loader->timing();
-    if (timing->hasCrossOriginRedirect())
-        return 0;
-
-    return timing->redirectCount();
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/PerformanceNavigation.h b/Source/core/page/PerformanceNavigation.h
deleted file mode 100644
index 1fab798..0000000
--- a/Source/core/page/PerformanceNavigation.h
+++ /dev/null
@@ -1,63 +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 PerformanceNavigation_h
-#define PerformanceNavigation_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/page/DOMWindowProperty.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class Frame;
-
-class PerformanceNavigation : public RefCounted<PerformanceNavigation>, public ScriptWrappable, public DOMWindowProperty {
-public:
-    static PassRefPtr<PerformanceNavigation> create(Frame* frame) { return adoptRef(new PerformanceNavigation(frame)); }
-
-    enum PerformanceNavigationType {
-        TYPE_NAVIGATE,
-        TYPE_RELOAD,
-        TYPE_BACK_FORWARD,
-        TYPE_RESERVED = 255
-    };
-
-    unsigned short type() const;
-    unsigned short redirectCount() const;
-
-private:
-    explicit PerformanceNavigation(Frame*);
-};
-
-}
-
-#endif // !defined(PerformanceNavigation_h)
diff --git a/Source/core/page/PerformanceResourceTiming.cpp b/Source/core/page/PerformanceResourceTiming.cpp
deleted file mode 100644
index 4f1f7a5..0000000
--- a/Source/core/page/PerformanceResourceTiming.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2012 Intel 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/page/PerformanceResourceTiming.h"
-
-#include "core/dom/Document.h"
-#include "core/loader/DocumentLoadTiming.h"
-#include "core/loader/DocumentLoader.h"
-#include "core/page/ResourceTimingInfo.h"
-#include "core/platform/network/ResourceRequest.h"
-#include "core/platform/network/ResourceResponse.h"
-
-namespace WebCore {
-
-static double monotonicTimeToDocumentMilliseconds(Document* document, double seconds)
-{
-    ASSERT(seconds >= 0.0);
-    return document->loader()->timing()->monotonicTimeToZeroBasedDocumentTime(seconds) * 1000.0;
-}
-
-PerformanceResourceTiming::PerformanceResourceTiming(const ResourceTimingInfo& info, Document* requestingDocument, double startTime, double lastRedirectEndTime, bool allowTimingDetails, bool allowRedirectDetails)
-    : PerformanceEntry(info.initialRequest().url().string(), "resource", monotonicTimeToDocumentMilliseconds(requestingDocument, startTime), monotonicTimeToDocumentMilliseconds(requestingDocument, info.loadFinishTime()))
-    , m_initiatorType(info.initiatorType())
-    , m_timing(info.finalResponse().resourceLoadTiming())
-    , m_lastRedirectEndTime(lastRedirectEndTime)
-    , m_finishTime(info.loadFinishTime())
-    , m_didReuseConnection(info.finalResponse().connectionReused())
-    , m_allowTimingDetails(allowTimingDetails)
-    , m_allowRedirectDetails(allowRedirectDetails)
-    , m_requestingDocument(requestingDocument)
-{
-    ScriptWrappable::init(this);
-}
-
-PerformanceResourceTiming::~PerformanceResourceTiming()
-{
-}
-
-AtomicString PerformanceResourceTiming::initiatorType() const
-{
-    return m_initiatorType;
-}
-
-double PerformanceResourceTiming::redirectStart() const
-{
-    if (!m_lastRedirectEndTime || !m_allowRedirectDetails)
-        return 0.0;
-
-    return PerformanceEntry::startTime();
-}
-
-double PerformanceResourceTiming::redirectEnd() const
-{
-    if (!m_lastRedirectEndTime || !m_allowRedirectDetails)
-        return 0.0;
-
-    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_lastRedirectEndTime);
-}
-
-double PerformanceResourceTiming::fetchStart() const
-{
-    if (m_lastRedirectEndTime) {
-        // FIXME: ASSERT(m_timing) should be in constructor once timeticks of
-        // AppCache is exposed from chrome network stack, crbug/251100
-        ASSERT(m_timing);
-        return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->requestTime);
-    }
-
-    return PerformanceEntry::startTime();
-}
-
-double PerformanceResourceTiming::domainLookupStart() const
-{
-    if (!m_allowTimingDetails)
-        return 0.0;
-
-    if (!m_timing || m_timing->dnsStart == 0.0)
-        return fetchStart();
-
-    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->dnsStart);
-}
-
-double PerformanceResourceTiming::domainLookupEnd() const
-{
-    if (!m_allowTimingDetails)
-        return 0.0;
-
-    if (!m_timing || m_timing->dnsEnd == 0.0)
-        return domainLookupStart();
-
-    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->dnsEnd);
-}
-
-double PerformanceResourceTiming::connectStart() const
-{
-    if (!m_allowTimingDetails)
-        return 0.0;
-
-    // connectStart will be zero when a network request is not made.
-    if (!m_timing || m_timing->connectStart == 0.0 || m_didReuseConnection)
-        return domainLookupEnd();
-
-    // connectStart includes any DNS time, so we may need to trim that off.
-    double connectStart = m_timing->connectStart;
-    if (m_timing->dnsEnd > 0.0)
-        connectStart = m_timing->dnsEnd;
-
-    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), connectStart);
-}
-
-double PerformanceResourceTiming::connectEnd() const
-{
-    if (!m_allowTimingDetails)
-        return 0.0;
-
-    // connectStart will be zero when a network request is not made.
-    if (!m_timing || m_timing->connectEnd == 0.0 || m_didReuseConnection)
-        return connectStart();
-
-    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->connectEnd);
-}
-
-double PerformanceResourceTiming::secureConnectionStart() const
-{
-    if (!m_allowTimingDetails)
-        return 0.0;
-
-    if (!m_timing || m_timing->sslStart == 0.0) // Secure connection not negotiated.
-        return 0.0;
-
-    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->sslStart);
-}
-
-double PerformanceResourceTiming::requestStart() const
-{
-    if (!m_allowTimingDetails)
-        return 0.0;
-
-    if (!m_timing)
-        return connectEnd();
-
-    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->sendStart);
-}
-
-double PerformanceResourceTiming::responseStart() const
-{
-    if (!m_allowTimingDetails)
-        return 0.0;
-
-    if (!m_timing)
-        return requestStart();
-
-    // FIXME: This number isn't exactly correct. See the notes in PerformanceTiming::responseStart().
-    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->receiveHeadersEnd);
-}
-
-double PerformanceResourceTiming::responseEnd() const
-{
-    if (!m_finishTime)
-        return responseStart();
-
-    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_finishTime);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/PerformanceResourceTiming.h b/Source/core/page/PerformanceResourceTiming.h
deleted file mode 100644
index 5ea27ea..0000000
--- a/Source/core/page/PerformanceResourceTiming.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2012 Intel 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 PerformanceResourceTiming_h
-#define PerformanceResourceTiming_h
-
-#include "core/page/PerformanceEntry.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class Document;
-class KURL;
-class ResourceLoadTiming;
-class ResourceRequest;
-class ResourceResponse;
-class ResourceTimingInfo;
-
-class PerformanceResourceTiming : public PerformanceEntry {
-public:
-    static PassRefPtr<PerformanceResourceTiming> create(const ResourceTimingInfo& info, Document* requestingDocument, double startTime, double lastRedirectEndTime, bool m_allowTimingDetails, bool m_allowRedirectDetails)
-    {
-        return adoptRef(new PerformanceResourceTiming(info, requestingDocument, startTime, lastRedirectEndTime, m_allowTimingDetails, m_allowRedirectDetails));
-    }
-
-    static PassRefPtr<PerformanceResourceTiming> create(const ResourceTimingInfo& info, Document* requestingDocument, double startTime, bool m_allowTimingDetails)
-    {
-        return adoptRef(new PerformanceResourceTiming(info, requestingDocument, startTime, 0.0, m_allowTimingDetails, false));
-    }
-
-    AtomicString initiatorType() const;
-
-    double redirectStart() const;
-    double redirectEnd() const;
-    double fetchStart() const;
-    double domainLookupStart() const;
-    double domainLookupEnd() const;
-    double connectStart() const;
-    double connectEnd() const;
-    double secureConnectionStart() const;
-    double requestStart() const;
-    double responseStart() const;
-    double responseEnd() const;
-
-    virtual bool isResource() { return true; }
-
-private:
-    PerformanceResourceTiming(const ResourceTimingInfo&, Document* requestingDocument, double startTime, double lastRedirectEndTime, bool m_allowTimingDetails, bool m_allowRedirectDetails);
-    ~PerformanceResourceTiming();
-
-    AtomicString m_initiatorType;
-    RefPtr<ResourceLoadTiming> m_timing;
-    double m_lastRedirectEndTime;
-    double m_finishTime;
-    bool m_didReuseConnection;
-    bool m_allowTimingDetails;
-    bool m_allowRedirectDetails;
-    RefPtr<Document> m_requestingDocument;
-};
-
-}
-
-#endif // !defined(PerformanceResourceTiming_h)
diff --git a/Source/core/page/PerformanceTiming.cpp b/Source/core/page/PerformanceTiming.cpp
deleted file mode 100644
index 81214c3..0000000
--- a/Source/core/page/PerformanceTiming.cpp
+++ /dev/null
@@ -1,356 +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/page/PerformanceTiming.h"
-
-#include "core/dom/Document.h"
-#include "core/dom/DocumentTiming.h"
-#include "core/loader/DocumentLoadTiming.h"
-#include "core/loader/DocumentLoader.h"
-#include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
-#include "core/platform/network/ResourceLoadTiming.h"
-#include "core/platform/network/ResourceResponse.h"
-
-namespace WebCore {
-
-static unsigned long long toIntegerMilliseconds(double seconds)
-{
-    ASSERT(seconds >= 0);
-    return static_cast<unsigned long long>(seconds * 1000.0);
-}
-
-PerformanceTiming::PerformanceTiming(Frame* frame)
-    : DOMWindowProperty(frame)
-{
-    ScriptWrappable::init(this);
-}
-
-unsigned long long PerformanceTiming::navigationStart() const
-{
-    DocumentLoadTiming* timing = documentLoadTiming();
-    if (!timing)
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->navigationStart());
-}
-
-unsigned long long PerformanceTiming::unloadEventStart() const
-{
-    DocumentLoadTiming* timing = documentLoadTiming();
-    if (!timing)
-        return 0;
-
-    if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument())
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->unloadEventStart());
-}
-
-unsigned long long PerformanceTiming::unloadEventEnd() const
-{
-    DocumentLoadTiming* timing = documentLoadTiming();
-    if (!timing)
-        return 0;
-
-    if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument())
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->unloadEventEnd());
-}
-
-unsigned long long PerformanceTiming::redirectStart() const
-{
-    DocumentLoadTiming* timing = documentLoadTiming();
-    if (!timing)
-        return 0;
-
-    if (timing->hasCrossOriginRedirect())
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->redirectStart());
-}
-
-unsigned long long PerformanceTiming::redirectEnd() const
-{
-    DocumentLoadTiming* timing = documentLoadTiming();
-    if (!timing)
-        return 0;
-
-    if (timing->hasCrossOriginRedirect())
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->redirectEnd());
-}
-
-unsigned long long PerformanceTiming::fetchStart() const
-{
-    DocumentLoadTiming* timing = documentLoadTiming();
-    if (!timing)
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->fetchStart());
-}
-
-unsigned long long PerformanceTiming::domainLookupStart() const
-{
-    ResourceLoadTiming* timing = resourceLoadTiming();
-    if (!timing)
-        return fetchStart();
-
-    // This will be zero when a DNS request is not performed.
-    // Rather than exposing a special value that indicates no DNS, we "backfill" with fetchStart.
-    double dnsStart = timing->dnsStart;
-    if (dnsStart == 0.0)
-        return fetchStart();
-
-    return monotonicTimeToIntegerMilliseconds(dnsStart);
-}
-
-unsigned long long PerformanceTiming::domainLookupEnd() const
-{
-    ResourceLoadTiming* timing = resourceLoadTiming();
-    if (!timing)
-        return domainLookupStart();
-
-    // This will be zero when a DNS request is not performed.
-    // Rather than exposing a special value that indicates no DNS, we "backfill" with domainLookupStart.
-    double dnsEnd = timing->dnsEnd;
-    if (dnsEnd == 0.0)
-        return domainLookupStart();
-
-    return monotonicTimeToIntegerMilliseconds(dnsEnd);
-}
-
-unsigned long long PerformanceTiming::connectStart() const
-{
-    DocumentLoader* loader = documentLoader();
-    if (!loader)
-        return domainLookupEnd();
-
-    ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
-    if (!timing)
-        return domainLookupEnd();
-
-    // connectStart will be zero when a network request is not made.
-    // Rather than exposing a special value that indicates no new connection, we "backfill" with domainLookupEnd.
-    double connectStart = timing->connectStart;
-    if (connectStart == 0.0 || loader->response().connectionReused())
-        return domainLookupEnd();
-
-    // ResourceLoadTiming's connect phase includes DNS, however Navigation Timing's
-    // connect phase should not. So if there is DNS time, trim it from the start.
-    if (timing->dnsEnd > 0.0 && timing->dnsEnd > connectStart)
-        connectStart = timing->dnsEnd;
-
-    return monotonicTimeToIntegerMilliseconds(connectStart);
-}
-
-unsigned long long PerformanceTiming::connectEnd() const
-{
-    DocumentLoader* loader = documentLoader();
-    if (!loader)
-        return connectStart();
-
-    ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
-    if (!timing)
-        return connectStart();
-
-    // connectEnd will be zero when a network request is not made.
-    // Rather than exposing a special value that indicates no new connection, we "backfill" with connectStart.
-    double connectEnd = timing->connectEnd;
-    if (connectEnd == 0.0 || loader->response().connectionReused())
-        return connectStart();
-
-    return monotonicTimeToIntegerMilliseconds(connectEnd);
-}
-
-unsigned long long PerformanceTiming::secureConnectionStart() const
-{
-    DocumentLoader* loader = documentLoader();
-    if (!loader)
-        return 0;
-
-    ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
-    if (!timing)
-        return 0;
-
-    double sslStart = timing->sslStart;
-    if (sslStart == 0.0)
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(sslStart);
-}
-
-unsigned long long PerformanceTiming::requestStart() const
-{
-    ResourceLoadTiming* timing = resourceLoadTiming();
-
-    if (!timing || timing->sendStart == 0.0)
-        return connectEnd();
-
-    return monotonicTimeToIntegerMilliseconds(timing->sendStart);
-}
-
-unsigned long long PerformanceTiming::responseStart() const
-{
-    ResourceLoadTiming* timing = resourceLoadTiming();
-    if (!timing || timing->receiveHeadersEnd == 0.0)
-        return requestStart();
-
-    // FIXME: Response start needs to be the time of the first received byte.
-    // However, the ResourceLoadTiming API currently only supports the time
-    // the last header byte was received. For many responses with reasonable
-    // sized cookies, the HTTP headers fit into a single packet so this time
-    // is basically equivalent. But for some responses, particularly those with
-    // headers larger than a single packet, this time will be too late.
-    return monotonicTimeToIntegerMilliseconds(timing->receiveHeadersEnd);
-}
-
-unsigned long long PerformanceTiming::responseEnd() const
-{
-    DocumentLoadTiming* timing = documentLoadTiming();
-    if (!timing)
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->responseEnd());
-}
-
-unsigned long long PerformanceTiming::domLoading() const
-{
-    const DocumentTiming* timing = documentTiming();
-    if (!timing)
-        return fetchStart();
-
-    return monotonicTimeToIntegerMilliseconds(timing->domLoading);
-}
-
-unsigned long long PerformanceTiming::domInteractive() const
-{
-    const DocumentTiming* timing = documentTiming();
-    if (!timing)
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->domInteractive);
-}
-
-unsigned long long PerformanceTiming::domContentLoadedEventStart() const
-{
-    const DocumentTiming* timing = documentTiming();
-    if (!timing)
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventStart);
-}
-
-unsigned long long PerformanceTiming::domContentLoadedEventEnd() const
-{
-    const DocumentTiming* timing = documentTiming();
-    if (!timing)
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventEnd);
-}
-
-unsigned long long PerformanceTiming::domComplete() const
-{
-    const DocumentTiming* timing = documentTiming();
-    if (!timing)
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->domComplete);
-}
-
-unsigned long long PerformanceTiming::loadEventStart() const
-{
-    DocumentLoadTiming* timing = documentLoadTiming();
-    if (!timing)
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->loadEventStart());
-}
-
-unsigned long long PerformanceTiming::loadEventEnd() const
-{
-    DocumentLoadTiming* timing = documentLoadTiming();
-    if (!timing)
-        return 0;
-
-    return monotonicTimeToIntegerMilliseconds(timing->loadEventEnd());
-}
-
-DocumentLoader* PerformanceTiming::documentLoader() const
-{
-    if (!m_frame)
-        return 0;
-
-    return m_frame->loader()->documentLoader();
-}
-
-const DocumentTiming* PerformanceTiming::documentTiming() const
-{
-    if (!m_frame)
-        return 0;
-
-    Document* document = m_frame->document();
-    if (!document)
-        return 0;
-
-    return document->timing();
-}
-
-DocumentLoadTiming* PerformanceTiming::documentLoadTiming() const
-{
-    DocumentLoader* loader = documentLoader();
-    if (!loader)
-        return 0;
-
-    return loader->timing();
-}
-
-ResourceLoadTiming* PerformanceTiming::resourceLoadTiming() const
-{
-    DocumentLoader* loader = documentLoader();
-    if (!loader)
-        return 0;
-
-    return loader->response().resourceLoadTiming();
-}
-
-unsigned long long PerformanceTiming::monotonicTimeToIntegerMilliseconds(double monotonicSeconds) const
-{
-    ASSERT(monotonicSeconds >= 0);
-    const DocumentLoadTiming* timing = documentLoadTiming();
-    ASSERT(timing);
-    return toIntegerMilliseconds(timing->monotonicTimeToPseudoWallTime(monotonicSeconds));
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/PerformanceTiming.h b/Source/core/page/PerformanceTiming.h
deleted file mode 100644
index ff9b875..0000000
--- a/Source/core/page/PerformanceTiming.h
+++ /dev/null
@@ -1,86 +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 PerformanceTiming_h
-#define PerformanceTiming_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/page/DOMWindowProperty.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class DocumentLoadTiming;
-class DocumentLoader;
-struct DocumentTiming;
-class Frame;
-class ResourceLoadTiming;
-
-class PerformanceTiming : public RefCounted<PerformanceTiming>, public ScriptWrappable, public DOMWindowProperty {
-public:
-    static PassRefPtr<PerformanceTiming> create(Frame* frame) { return adoptRef(new PerformanceTiming(frame)); }
-
-    unsigned long long navigationStart() const;
-    unsigned long long unloadEventStart() const;
-    unsigned long long unloadEventEnd() const;
-    unsigned long long redirectStart() const;
-    unsigned long long redirectEnd() const;
-    unsigned long long fetchStart() const;
-    unsigned long long domainLookupStart() const;
-    unsigned long long domainLookupEnd() const;
-    unsigned long long connectStart() const;
-    unsigned long long connectEnd() const;
-    unsigned long long secureConnectionStart() const;
-    unsigned long long requestStart() const;
-    unsigned long long responseStart() const;
-    unsigned long long responseEnd() const;
-    unsigned long long domLoading() const;
-    unsigned long long domInteractive() const;
-    unsigned long long domContentLoadedEventStart() const;
-    unsigned long long domContentLoadedEventEnd() const;
-    unsigned long long domComplete() const;
-    unsigned long long loadEventStart() const;
-    unsigned long long loadEventEnd() const;
-
-private:
-    explicit PerformanceTiming(Frame*);
-
-    const DocumentTiming* documentTiming() const;
-    DocumentLoader* documentLoader() const;
-    DocumentLoadTiming* documentLoadTiming() const;
-    ResourceLoadTiming* resourceLoadTiming() const;
-
-    unsigned long long monotonicTimeToIntegerMilliseconds(double) const;
-};
-
-}
-
-#endif // !defined(PerformanceTiming_h)
diff --git a/Source/core/page/PerformanceUserTiming.cpp b/Source/core/page/PerformanceUserTiming.cpp
deleted file mode 100644
index 568fa35..0000000
--- a/Source/core/page/PerformanceUserTiming.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 2012 Intel 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/page/PerformanceUserTiming.h"
-
-#include "bindings/v8/ExceptionState.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/page/Performance.h"
-#include "core/page/PerformanceMark.h"
-#include "core/page/PerformanceMeasure.h"
-#include "core/platform/HistogramSupport.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-namespace {
-
-typedef HashMap<String, NavigationTimingFunction> RestrictedKeyMap;
-static RestrictedKeyMap restrictedKeyMap()
-{
-    DEFINE_STATIC_LOCAL(RestrictedKeyMap, map, ());
-    if (map.isEmpty()) {
-        map.add("navigationStart", &PerformanceTiming::navigationStart);
-        map.add("unloadEventStart", &PerformanceTiming::unloadEventStart);
-        map.add("unloadEventEnd", &PerformanceTiming::unloadEventEnd);
-        map.add("redirectStart", &PerformanceTiming::redirectStart);
-        map.add("redirectEnd", &PerformanceTiming::redirectEnd);
-        map.add("fetchStart", &PerformanceTiming::fetchStart);
-        map.add("domainLookupStart", &PerformanceTiming::domainLookupStart);
-        map.add("domainLookupEnd", &PerformanceTiming::domainLookupEnd);
-        map.add("connectStart", &PerformanceTiming::connectStart);
-        map.add("connectEnd", &PerformanceTiming::connectEnd);
-        map.add("secureConnectionStart", &PerformanceTiming::secureConnectionStart);
-        map.add("requestStart", &PerformanceTiming::requestStart);
-        map.add("responseStart", &PerformanceTiming::responseStart);
-        map.add("responseEnd", &PerformanceTiming::responseEnd);
-        map.add("domLoading", &PerformanceTiming::domLoading);
-        map.add("domInteractive", &PerformanceTiming::domInteractive);
-        map.add("domContentLoadedEventStart", &PerformanceTiming::domContentLoadedEventStart);
-        map.add("domContentLoadedEventEnd", &PerformanceTiming::domContentLoadedEventEnd);
-        map.add("domComplete", &PerformanceTiming::domComplete);
-        map.add("loadEventStart", &PerformanceTiming::loadEventStart);
-        map.add("loadEventEnd", &PerformanceTiming::loadEventEnd);
-    }
-    return map;
-}
-
-} // namespace anonymous
-
-UserTiming::UserTiming(Performance* performance)
-    : m_performance(performance)
-{
-}
-
-static void insertPerformanceEntry(PerformanceEntryMap& performanceEntryMap, PassRefPtr<PerformanceEntry> performanceEntry)
-{
-    RefPtr<PerformanceEntry> entry = performanceEntry;
-    PerformanceEntryMap::iterator it = performanceEntryMap.find(entry->name());
-    if (it != performanceEntryMap.end())
-        it->value.append(entry);
-    else {
-        Vector<RefPtr<PerformanceEntry> > v(1);
-        v[0] = entry;
-        performanceEntryMap.set(entry->name(), v);
-    }
-}
-
-static void clearPeformanceEntries(PerformanceEntryMap& performanceEntryMap, const String& name)
-{
-    if (name.isNull()) {
-        performanceEntryMap.clear();
-        return;
-    }
-
-    if (performanceEntryMap.contains(name))
-        performanceEntryMap.remove(name);
-}
-
-void UserTiming::mark(const String& markName, ExceptionState& es)
-{
-    if (restrictedKeyMap().contains(markName)) {
-        es.throwDOMException(SyntaxError, "'" + markName + "' is part of the PerformanceTiming interface, and cannot be used as a mark name.");
-        return;
-    }
-
-    double startTime = m_performance->now();
-    insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTime));
-    HistogramSupport::histogramCustomCounts("PLT.UserTiming_Mark", static_cast<int>(startTime), 0, 600000, 100);
-}
-
-void UserTiming::clearMarks(const String& markName)
-{
-    clearPeformanceEntries(m_marksMap, markName);
-}
-
-double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionState& es)
-{
-    if (m_marksMap.contains(markName))
-        return m_marksMap.get(markName).last()->startTime();
-
-    if (restrictedKeyMap().contains(markName)) {
-        double value = static_cast<double>((m_performance->timing()->*(restrictedKeyMap().get(markName)))());
-        if (!value) {
-            es.throwDOMException(InvalidAccessError, "'" + markName + "' is empty: either the event hasn't happened yet, or it would provide cross-origin timing information.");
-            return 0.0;
-        }
-        return value - m_performance->timing()->navigationStart();
-    }
-
-    es.throwDOMException(SyntaxError, "The mark '" + markName + "' does not exist.");
-    return 0.0;
-}
-
-void UserTiming::measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState& es)
-{
-    double startTime = 0.0;
-    double endTime = 0.0;
-
-    if (startMark.isNull())
-        endTime = m_performance->now();
-    else if (endMark.isNull()) {
-        endTime = m_performance->now();
-        startTime = findExistingMarkStartTime(startMark, es);
-        if (es.hadException())
-            return;
-    } else {
-        endTime = findExistingMarkStartTime(endMark, es);
-        if (es.hadException())
-            return;
-        startTime = findExistingMarkStartTime(startMark, es);
-        if (es.hadException())
-            return;
-    }
-
-    insertPerformanceEntry(m_measuresMap, PerformanceMeasure::create(measureName, startTime, endTime));
-    if (endTime >= startTime)
-        HistogramSupport::histogramCustomCounts("PLT.UserTiming_MeasureDuration", static_cast<int>(endTime - startTime), 0, 600000, 100);
-}
-
-void UserTiming::clearMeasures(const String& measureName)
-{
-    clearPeformanceEntries(m_measuresMap, measureName);
-}
-
-static Vector<RefPtr<PerformanceEntry> > convertToEntrySequence(const PerformanceEntryMap& performanceEntryMap)
-{
-    Vector<RefPtr<PerformanceEntry> > entries;
-
-    for (PerformanceEntryMap::const_iterator it = performanceEntryMap.begin(); it != performanceEntryMap.end(); ++it)
-        entries.append(it->value);
-
-    return entries;
-}
-
-static Vector<RefPtr<PerformanceEntry> > getEntrySequenceByName(const PerformanceEntryMap& performanceEntryMap, const String& name)
-{
-    Vector<RefPtr<PerformanceEntry> > entries;
-
-    PerformanceEntryMap::const_iterator it = performanceEntryMap.find(name);
-    if (it != performanceEntryMap.end())
-        entries.append(it->value);
-
-    return entries;
-}
-
-Vector<RefPtr<PerformanceEntry> > UserTiming::getMarks() const
-{
-    return convertToEntrySequence(m_marksMap);
-}
-
-Vector<RefPtr<PerformanceEntry> > UserTiming::getMarks(const String& name) const
-{
-    return getEntrySequenceByName(m_marksMap, name);
-}
-
-Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures() const
-{
-    return convertToEntrySequence(m_measuresMap);
-}
-
-Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) const
-{
-    return getEntrySequenceByName(m_measuresMap, name);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/PerformanceUserTiming.h b/Source/core/page/PerformanceUserTiming.h
deleted file mode 100644
index 1f150ae..0000000
--- a/Source/core/page/PerformanceUserTiming.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2012 Intel 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 PerformanceUserTiming_h
-#define PerformanceUserTiming_h
-
-#include "core/page/PerformanceTiming.h"
-#include "wtf/HashMap.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/StringHash.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class ExceptionState;
-class Performance;
-class PerformanceEntry;
-
-typedef unsigned long long (PerformanceTiming::*NavigationTimingFunction)() const;
-typedef HashMap<String, Vector<RefPtr<PerformanceEntry> > > PerformanceEntryMap;
-
-class UserTiming : public RefCounted<UserTiming> {
-public:
-    static PassRefPtr<UserTiming> create(Performance* performance) { return adoptRef(new UserTiming(performance)); }
-
-    void mark(const String& markName, ExceptionState&);
-    void clearMarks(const String& markName);
-
-    void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState&);
-    void clearMeasures(const String& measureName);
-
-    Vector<RefPtr<PerformanceEntry> > getMarks() const;
-    Vector<RefPtr<PerformanceEntry> > getMeasures() const;
-
-    Vector<RefPtr<PerformanceEntry> > getMarks(const String& name) const;
-    Vector<RefPtr<PerformanceEntry> > getMeasures(const String& name) const;
-
-private:
-    explicit UserTiming(Performance*);
-
-    double findExistingMarkStartTime(const String& markName, ExceptionState&);
-    Performance* m_performance;
-    PerformanceEntryMap m_marksMap;
-    PerformanceEntryMap m_measuresMap;
-};
-
-}
-
-#endif // !defined(PerformanceUserTiming_h)
diff --git a/Source/core/page/PointerLockController.cpp b/Source/core/page/PointerLockController.cpp
index 3145cff..9230453 100644
--- a/Source/core/page/PointerLockController.cpp
+++ b/Source/core/page/PointerLockController.cpp
@@ -30,7 +30,7 @@
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
 #include "core/page/Page.h"
-#include "core/platform/PlatformMouseEvent.h"
+#include "platform/PlatformMouseEvent.h"
 
 namespace WebCore {
 
@@ -47,29 +47,29 @@
 void PointerLockController::requestPointerLock(Element* target)
 {
     if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaitingForUnlock) {
-        enqueueEvent(eventNames().webkitpointerlockerrorEvent, target);
+        enqueueEvent(EventTypeNames::webkitpointerlockerror, target);
         return;
     }
 
     if (target->document().isSandboxed(SandboxPointerLock)) {
         // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
         target->document().addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Blocked pointer lock on an element because the element's frame is sandboxed and the 'allow-pointer-lock' permission is not set.");
-        enqueueEvent(eventNames().webkitpointerlockerrorEvent, target);
+        enqueueEvent(EventTypeNames::webkitpointerlockerror, target);
         return;
     }
 
     if (m_element) {
-        if (&m_element->document() != &target->document()) {
-            enqueueEvent(eventNames().webkitpointerlockerrorEvent, target);
+        if (m_element->document() != target->document()) {
+            enqueueEvent(EventTypeNames::webkitpointerlockerror, target);
             return;
         }
-        enqueueEvent(eventNames().webkitpointerlockchangeEvent, target);
+        enqueueEvent(EventTypeNames::webkitpointerlockchange, target);
         m_element = target;
     } else if (m_page->chrome().client().requestPointerLock()) {
         m_lockPending = true;
         m_element = target;
     } else {
-        enqueueEvent(eventNames().webkitpointerlockerrorEvent, target);
+        enqueueEvent(EventTypeNames::webkitpointerlockerror, target);
     }
 }
 
@@ -91,7 +91,7 @@
 
 void PointerLockController::documentDetached(Document* document)
 {
-    if (m_element && &m_element->document() == document) {
+    if (m_element && m_element->document() == document) {
         clearElement();
         requestPointerUnlock();
     }
@@ -109,19 +109,19 @@
 
 void PointerLockController::didAcquirePointerLock()
 {
-    enqueueEvent(eventNames().webkitpointerlockchangeEvent, m_element.get());
+    enqueueEvent(EventTypeNames::webkitpointerlockchange, m_element.get());
     m_lockPending = false;
 }
 
 void PointerLockController::didNotAcquirePointerLock()
 {
-    enqueueEvent(eventNames().webkitpointerlockerrorEvent, m_element.get());
+    enqueueEvent(EventTypeNames::webkitpointerlockerror, m_element.get());
     clearElement();
 }
 
 void PointerLockController::didLosePointerLock()
 {
-    enqueueEvent(eventNames().webkitpointerlockchangeEvent, m_element ? &m_element->document() : m_documentOfRemovedElementWhileWaitingForUnlock.get());
+    enqueueEvent(EventTypeNames::webkitpointerlockchange, m_element ? &m_element->document() : m_documentOfRemovedElementWhileWaitingForUnlock.get());
     clearElement();
     m_documentOfRemovedElementWhileWaitingForUnlock = 0;
 }
@@ -134,8 +134,8 @@
     m_element->dispatchMouseEvent(event, eventType, event.clickCount());
 
     // Create click events
-    if (eventType == eventNames().mouseupEvent)
-        m_element->dispatchMouseEvent(event, eventNames().clickEvent, event.clickCount());
+    if (eventType == EventTypeNames::mouseup)
+        m_element->dispatchMouseEvent(event, EventTypeNames::click, event.clickCount());
 }
 
 void PointerLockController::clearElement()
@@ -153,7 +153,7 @@
 void PointerLockController::enqueueEvent(const AtomicString& type, Document* document)
 {
     if (document)
-        document->enqueueDocumentEvent(Event::createBubble(type));
+        document->enqueueDocumentEvent(Event::create(type));
 }
 
 } // namespace WebCore
diff --git a/Source/core/page/PrintContext.cpp b/Source/core/page/PrintContext.cpp
index 0803a41..e78dc99 100644
--- a/Source/core/page/PrintContext.cpp
+++ b/Source/core/page/PrintContext.cpp
@@ -21,8 +21,8 @@
 #include "config.h"
 #include "core/page/PrintContext.h"
 
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/rendering/RenderView.h"
 #include "wtf/text/WTFString.h"
diff --git a/Source/core/page/RuntimeCSSEnabled.cpp b/Source/core/page/RuntimeCSSEnabled.cpp
index 42934b3..1ce511d 100644
--- a/Source/core/page/RuntimeCSSEnabled.cpp
+++ b/Source/core/page/RuntimeCSSEnabled.cpp
@@ -74,6 +74,8 @@
     setCSSPropertiesEnabled(css3TextDecorationProperties, WTF_ARRAY_LENGTH(css3TextDecorationProperties), RuntimeEnabledFeatures::css3TextDecorationsEnabled());
     CSSPropertyID css3TextProperties[] = {
         CSSPropertyTextAlignLast,
+        CSSPropertyTextIndent,
+        CSSPropertyTextJustify,
     };
     setCSSPropertiesEnabled(css3TextProperties, WTF_ARRAY_LENGTH(css3TextProperties), RuntimeEnabledFeatures::css3TextEnabled());
     CSSPropertyID cssGridLayoutProperties[] = {
@@ -118,6 +120,10 @@
     RuntimeCSSEnabled::setCSSPropertyEnabled(CSSPropertyPaintOrder, RuntimeEnabledFeatures::svgPaintOrderEnabled());
     RuntimeCSSEnabled::setCSSPropertyEnabled(CSSPropertyVariable, RuntimeEnabledFeatures::cssVariablesEnabled());
     RuntimeCSSEnabled::setCSSPropertyEnabled(CSSPropertyMaskSourceType, RuntimeEnabledFeatures::cssMaskSourceTypeEnabled());
+    RuntimeCSSEnabled::setCSSPropertyEnabled(CSSPropertyColumnFill, RuntimeEnabledFeatures::regionBasedColumnsEnabled());
+
+    // InternalCallback is an implementation detail, rather than an experimental feature, and should never be exposed to the web.
+    RuntimeCSSEnabled::setCSSPropertyEnabled(CSSPropertyInternalCallback, false);
 }
 
 static BoolVector& propertySwitches()
diff --git a/Source/core/page/RuntimeCSSEnabled.h b/Source/core/page/RuntimeCSSEnabled.h
index 71a19a4..493d3a5 100644
--- a/Source/core/page/RuntimeCSSEnabled.h
+++ b/Source/core/page/RuntimeCSSEnabled.h
@@ -40,6 +40,8 @@
 
 class RuntimeCSSEnabled {
 public:
+    // isCSSPropertyEnabled returns false for internal properties
+    // to avoid mistakenly leaking them to the web.
     static bool isCSSPropertyEnabled(CSSPropertyID);
     static void setCSSPropertyEnabled(CSSPropertyID, bool);
 
diff --git a/Source/core/page/RuntimeEnabledFeatures.in b/Source/core/page/RuntimeEnabledFeatures.in
index a6b6686..bec7f6c 100644
--- a/Source/core/page/RuntimeEnabledFeatures.in
+++ b/Source/core/page/RuntimeEnabledFeatures.in
@@ -18,14 +18,16 @@
 AnimatedWebP status=experimental
 ApplicationCache status=stable
 AuthorShadowDOMForAnyElement
-Crypto status=test
+Crypto status=experimental
 CSSAnimationUnprefixed status=experimental
 CSSCompositing status=experimental
+CSSCustomFilter status=experimental
 CSSExclusions status=experimental
 CSSGridLayout status=experimental
 CSSMaskSourceType status=experimental
 CSSRegions status=experimental
 CSSShapes status=experimental
+CSSStickyPosition status=experimental
 CSSTouchAction status=test
 CSSVariables status=experimental
 CSSViewport status=experimental
@@ -34,11 +36,13 @@
 CustomElements status=experimental
 Database status=stable
 DataListElement status=stable
+DateExtension status=stable
 DeviceMotion status=stable
 DeviceOrientation status=stable
 DevicePixelRatioIncludesZoom status=stable
 DialogElement status=experimental
 DirectoryUpload status=stable
+DirectWrite
 // FIXME: Remove this separate feature when CustomElements are always enabled
 EmbedderCustomElements
 EncodingAPI status=experimental
@@ -49,12 +53,14 @@
 FileSystem status=stable
 FontLoadEvents status=experimental
 Fullscreen status=stable
+FastTextAutosizing
 Gamepad status=stable
 Geolocation status=stable
 HTMLImports status=test
 HighResolutionTimeInWorkers status=experimental
 IMEAPI status=test
 IndexedDB status=stable
+IndexedDBExperimental status=experimental
 InputModeAttribute status=test
 InputTypeColor status=stable
 InputTypeWeek status=stable
@@ -65,7 +71,7 @@
 MediaSource status=stable
 MediaStream status=stable
 Notifications status=stable
-ObjectFitPosition status=experimental
+ObjectFitPosition status=stable
 // Only enabled on Android, and for certain layout tests on Linux.
 OverlayFullscreenVideo
 PagePopup status=stable
@@ -76,8 +82,9 @@
 Promise status=experimental
 Quota status=stable
 OverlayScrollbars
+RegionBasedColumns status=experimental
 RequestAutocomplete status=test
-RowSpanLogicalHeightSpreading status=test
+RowSpanLogicalHeightSpreading status=stable
 ScriptedSpeech status=stable
 SeamlessIFrames status=experimental
 ServiceWorker status=experimental
@@ -91,7 +98,13 @@
 StyleScoped status=experimental
 SubpixelFontScaling
 SVGPaintOrder status=experimental
+
+// Many websites disable mouse support when touch APIs are available.  We'd
+// like to enable this always but can't until more websites fix this bug.
+// Chromium sets this conditionally (eg. based on the presence of a
+// touchscreen) in ApplyWebPreferences.
 Touch status=stable
+
 UserSelectAll status=experimental
 Vibration status=experimental
 VideoTrack status=stable
@@ -103,3 +116,4 @@
 WebMIDI status=test
 WebKitMediaSource status=stable
 WOFF2 status=experimental
+XSLT status=stable
diff --git a/Source/core/page/Screen.cpp b/Source/core/page/Screen.cpp
deleted file mode 100644
index 7b7b4d3..0000000
--- a/Source/core/page/Screen.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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/page/Screen.h"
-
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
-#include "core/platform/PlatformScreen.h"
-#include "core/platform/graphics/FloatRect.h"
-
-namespace WebCore {
-
-Screen::Screen(Frame* frame)
-    : DOMWindowProperty(frame)
-{
-    ScriptWrappable::init(this);
-}
-
-unsigned Screen::height() const
-{
-    if (!m_frame)
-        return 0;
-    long height = static_cast<long>(screenRect(m_frame->view()).height());
-    InspectorInstrumentation::applyScreenHeightOverride(m_frame, &height);
-    return static_cast<unsigned>(height);
-}
-
-unsigned Screen::width() const
-{
-    if (!m_frame)
-        return 0;
-    long width = static_cast<long>(screenRect(m_frame->view()).width());
-    InspectorInstrumentation::applyScreenWidthOverride(m_frame, &width);
-    return static_cast<unsigned>(width);
-}
-
-unsigned Screen::colorDepth() const
-{
-    if (!m_frame)
-        return 0;
-    return static_cast<unsigned>(screenDepth(m_frame->view()));
-}
-
-unsigned Screen::pixelDepth() const
-{
-    if (!m_frame)
-        return 0;
-    return static_cast<unsigned>(screenDepth(m_frame->view()));
-}
-
-int Screen::availLeft() const
-{
-    if (!m_frame)
-        return 0;
-    return static_cast<int>(screenAvailableRect(m_frame->view()).x());
-}
-
-int Screen::availTop() const
-{
-    if (!m_frame)
-        return 0;
-    return static_cast<int>(screenAvailableRect(m_frame->view()).y());
-}
-
-unsigned Screen::availHeight() const
-{
-    if (!m_frame)
-        return 0;
-    return static_cast<unsigned>(screenAvailableRect(m_frame->view()).height());
-}
-
-unsigned Screen::availWidth() const
-{
-    if (!m_frame)
-        return 0;
-    return static_cast<unsigned>(screenAvailableRect(m_frame->view()).width());
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/Screen.h b/Source/core/page/Screen.h
deleted file mode 100644
index 59fba13..0000000
--- a/Source/core/page/Screen.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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 Screen_h
-#define Screen_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/page/DOMWindowProperty.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-    class Frame;
-
-    class Screen : public ScriptWrappable, public RefCounted<Screen>, public DOMWindowProperty {
-    public:
-        static PassRefPtr<Screen> create(Frame *frame) { return adoptRef(new Screen(frame)); }
-
-        unsigned height() const;
-        unsigned width() const;
-        unsigned colorDepth() const;
-        unsigned pixelDepth() const;
-        int availLeft() const;
-        int availTop() const;
-        unsigned availHeight() const;
-        unsigned availWidth() const;
-
-    private:
-        explicit Screen(Frame*);
-    };
-
-} // namespace WebCore
-
-#endif // Screen_h
diff --git a/Source/core/page/Selection.idl b/Source/core/page/Selection.idl
index e5d7a9e..8f03f8e 100644
--- a/Source/core/page/Selection.idl
+++ b/Source/core/page/Selection.idl
@@ -45,7 +45,7 @@
     [RaisesException] void collapseToEnd();
     [RaisesException] void collapseToStart();
 
-    [CustomElementCallbacks=Enable] void deleteFromDocument();
+    [CustomElementCallbacks] void deleteFromDocument();
     boolean containsNode([Default=Undefined] optional Node node,
                          [Default=Undefined] optional boolean allowPartial);
     [RaisesException] void selectAllChildren([Default=Undefined] optional Node node);
diff --git a/Source/core/page/Settings.cpp b/Source/core/page/Settings.cpp
index d46062d..317c8e3 100644
--- a/Source/core/page/Settings.cpp
+++ b/Source/core/page/Settings.cpp
@@ -31,10 +31,11 @@
 #include "core/fetch/ResourceFetcher.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/Chrome.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
+#include "core/platform/ScrollbarTheme.h"
 #include "core/rendering/TextAutosizer.h"
 
 using namespace std;
@@ -76,8 +77,6 @@
     return emptyAtom;
 }
 
-bool Settings::gMockScrollbarsEnabled = false;
-
 // NOTEs
 //  1) EditingMacBehavior comprises builds on Mac;
 //  2) EditingWindowsBehavior comprises builds on Windows;
@@ -129,8 +128,6 @@
     , m_areImagesEnabled(true)
     , m_arePluginsEnabled(false)
     , m_isScriptEnabled(false)
-    , m_isCSSCustomFilterEnabled(false)
-    , m_cssStickyPositionEnabled(true)
     , m_dnsPrefetchingEnabled(false)
     , m_touchEventEmulationEnabled(false)
     , m_openGLMultisamplingEnabled(false)
@@ -243,7 +240,7 @@
 
     m_useWideViewport = useWideViewport;
     if (m_page->mainFrame())
-        m_page->chrome().dispatchViewportPropertiesDidChange(m_page->mainFrame()->document()->viewportArguments());
+        m_page->chrome().dispatchViewportPropertiesDidChange(m_page->mainFrame()->document()->viewportDescription());
 }
 
 void Settings::setLoadWithOverviewMode(bool loadWithOverviewMode)
@@ -253,7 +250,7 @@
 
     m_loadWithOverviewMode = loadWithOverviewMode;
     if (m_page->mainFrame())
-        m_page->chrome().dispatchViewportPropertiesDidChange(m_page->mainFrame()->document()->viewportArguments());
+        m_page->chrome().dispatchViewportPropertiesDidChange(m_page->mainFrame()->document()->viewportDescription());
 }
 
 void Settings::setTextAutosizingFontScaleFactor(float fontScaleFactor)
@@ -283,6 +280,17 @@
     m_page->setNeedsRecalcStyleInAllFrames();
 }
 
+void Settings::resetFontFamilies()
+{
+    m_standardFontFamilyMap.clear();
+    m_serifFontFamilyMap.clear();
+    m_fixedFontFamilyMap.clear();
+    m_sansSerifFontFamilyMap.clear();
+    m_cursiveFontFamilyMap.clear();
+    m_fantasyFontFamilyMap.clear();
+    m_pictographFontFamilyMap.clear();
+}
+
 void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
 {
     m_loadsImagesAutomatically = loadsImagesAutomatically;
@@ -347,12 +355,12 @@
 
 void Settings::setMockScrollbarsEnabled(bool flag)
 {
-    gMockScrollbarsEnabled = flag;
+    ScrollbarTheme::setMockScrollbarsEnabled(flag);
 }
 
 bool Settings::mockScrollbarsEnabled()
 {
-    return gMockScrollbarsEnabled;
+    return ScrollbarTheme::mockScrollbarsEnabled();
 }
 
 void Settings::setOpenGLMultisamplingEnabled(bool flag)
@@ -376,7 +384,7 @@
 
     m_viewportEnabled = enabled;
     if (m_page->mainFrame())
-        m_page->mainFrame()->document()->updateViewportArguments();
+        m_page->mainFrame()->document()->updateViewportDescription();
 }
 
 } // namespace WebCore
diff --git a/Source/core/page/Settings.h b/Source/core/page/Settings.h
index 588380b..e391fec 100644
--- a/Source/core/page/Settings.h
+++ b/Source/core/page/Settings.h
@@ -29,8 +29,8 @@
 
 #include "SettingsMacros.h"
 #include "core/editing/EditingBehaviorTypes.h"
-#include "core/platform/Timer.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/Timer.h"
+#include "platform/geometry/IntSize.h"
 #include "weborigin/KURL.h"
 #include "wtf/HashMap.h"
 #include "wtf/text/AtomicString.h"
@@ -105,6 +105,9 @@
     void setMediaTypeOverride(const String&);
     const String& mediaTypeOverride() const { return m_mediaTypeOverride; }
 
+    // Only called by InternalSettings to clear font family maps.
+    void resetFontFamilies();
+
     // Unlike areImagesEnabled, this only suppresses the network load of
     // the image URL.  A cached image will still be rendered if requested.
     void setLoadsImagesAutomatically(bool);
@@ -133,12 +136,6 @@
     void setUserStyleSheetLocation(const KURL&);
     const KURL& userStyleSheetLocation() const { return m_userStyleSheetLocation; }
 
-    void setCSSCustomFilterEnabled(bool enabled) { m_isCSSCustomFilterEnabled = enabled; }
-    bool isCSSCustomFilterEnabled() const { return m_isCSSCustomFilterEnabled; }
-
-    void setCSSStickyPositionEnabled(bool enabled) { m_cssStickyPositionEnabled = enabled; }
-    bool cssStickyPositionEnabled() const { return m_cssStickyPositionEnabled; }
-
     static void setMockScrollbarsEnabled(bool flag);
     static bool mockScrollbarsEnabled();
 
@@ -183,8 +180,6 @@
     bool m_areImagesEnabled : 1;
     bool m_arePluginsEnabled : 1;
     bool m_isScriptEnabled : 1;
-    bool m_isCSSCustomFilterEnabled : 1;
-    bool m_cssStickyPositionEnabled : 1;
     bool m_dnsPrefetchingEnabled : 1;
 
     bool m_touchEventEmulationEnabled : 1;
@@ -197,8 +192,6 @@
 
     Timer<Settings> m_setImageLoadingSettingsTimer;
     void imageLoadingSettingsTimerFired(Timer<Settings>*);
-
-    static bool gMockScrollbarsEnabled;
 };
 
 } // namespace WebCore
diff --git a/Source/core/page/Settings.in b/Source/core/page/Settings.in
index 5383a4a..df7ace4 100644
--- a/Source/core/page/Settings.in
+++ b/Source/core/page/Settings.in
@@ -1,8 +1,38 @@
+# Defines properties which are available on the Settings object.
+#
+# Please think carefully before adding a new Setting.  Some questions to
+# consider are:
+# - Should this be a RuntimeEnabledFeature instead? Settings are for things
+#   which we support either values of at runtime.  Features are set at renderer
+#   process startup and are never changed. Features also tend to be set to a
+#   value based on the platform or the stability of the code in question, where
+#   as settings both codepaths need to be stable.
+# - How will you ensure test coverage of all relevant values of your setting?
+# - Is the default value appropriate for other platforms or ports which may
+#   not be aware of your setting?
+# - Can your setting result in behavior differences observable to web
+#   developers?
+# - Should this setting ideally be removed in the future?  If so please file
+#   a bug and reference it in the comments for your setting.
+#
+# One reason to add a Setting is to manage the risk associated with adding a
+# new feature.  For example, we may choose to ship a new UI behavior or
+# performance optimization to ChromeOS users first (in order to gather feedback
+# and metrics on its use from the wild) before attempting to ship it to
+# Windows.
+#
 # FIXME: Add support for global settings.
 # FIXME: Add support for custom getters/setters.
 
 defaultTextEncodingName type=String
 editableLinkBehavior type=EditableLinkBehavior, initial=EditableLinkDefaultBehavior
+
+# Do not hide chars typed in password fields immediately, but let the last char stay
+# visible for N seconds, configured by the passwordEchoDurationInSeconds setting
+# FIXME: Enable automatically if passwordEchoDurationInSeconds is set to a positive value.
+passwordEchoEnabled initial=false
+
+# Configure how long the last char should say visible in seconds.
 passwordEchoDurationInSeconds type=double, initial=1
 
 # Sets the magnification value for validation message timer.  If the
@@ -21,6 +51,8 @@
 # draw canvas in software.
 minimumAccelerated2dCanvasSize type=int, initial=257*256
 
+# The layout width used with --enable-viewport when no viewport meta tag was defined.
+# FIXME: This should get the value from the @viewport UA sheet instead.
 layoutFallbackWidth type=int, initial=980
 
 minimumFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
@@ -42,10 +74,15 @@
 textAreasAreResizable initial=false, setNeedsStyleRecalcInAllFrames=1
 authorAndUserStylesEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
 acceleratedCompositingEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
+
+# Debugging feature used for accelerated compositing layers.
 showRepaintCounter initial=false, setNeedsStyleRecalcInAllFrames=1
 
 shrinksStandaloneImagesToFit initial=true
+
+# FIXME: Does this do anything now that we don't support page cache?
 pageCacheSupportsPlugins initial=false
+
 needsSiteSpecificQuirks initial=false
 offlineWebApplicationCacheEnabled initial=false
 usesEncodingDetector initial=false
@@ -53,12 +90,14 @@
 acceleratedFiltersEnabled initial=false
 regionBasedColumnsEnabled initial=false
 
-# FIXME: This should really be disabled by default as it makes platforms that don't support the feature download files
-# they can't use by. Leaving enabled for now to not change existing behavior.
+# FIXME: This should really be disabled by default as it makes platforms that
+# don't support the feature download files they can't use by.
+# Leaving enabled for now to not change existing behavior.
 downloadableBinaryFontsEnabled initial=true
 
 xssAuditorEnabled initial=false
 unsafePluginPastingEnabled initial=true
+
 acceleratedCompositingFor3DTransformsEnabled initial=true
 acceleratedCompositingForVideoEnabled initial=true
 acceleratedCompositingForPluginsEnabled initial=true
@@ -70,40 +109,61 @@
 acceleratedCompositingForTransitionEnabled initial=false
 acceleratedCompositingForFixedRootBackgroundEnabled initial=false
 
+forceCompositingMode initial=false
+
 # Works only in conjunction with forceCompositingMode.
+# crbug.com/304900 tracks removal once enabled on all platforms.
 acceleratedCompositingForScrollableFramesEnabled initial=false
 compositedScrollingForFramesEnabled initial=false
 
+# 3D canvas (WebGL) support.
 webGLEnabled initial=false
+
 webGLErrorsToConsoleEnabled initial=true
 privilegedWebGLExtensionsEnabled initial=false
 accelerated2dCanvasEnabled initial=false
 antialiased2dCanvasEnabled initial=true
+
+# WebAudio support.
 webAudioEnabled initial=false
+
 fullScreenEnabled initial=false
 asynchronousSpellCheckingEnabled initial=false
 memoryInfoEnabled initial=false
 
 hyperlinkAuditingEnabled initial=false
-forceCompositingMode initial=false
 allowDisplayOfInsecureContent initial=true
 allowRunningOfInsecureContent initial=true
 mediaPlaybackRequiresUserGesture initial=false
 mediaFullscreenRequiresUserGesture initial=true
-passwordEchoEnabled initial=false
 visualWordMovementEnabled initial=false
 shouldDisplaySubtitles initial=false
 shouldDisplayCaptions initial=false
 shouldDisplayTextDescriptions initial=false
+
 scrollingCoordinatorEnabled initial=false
 scrollAnimatorEnabled initial=true
 
 shouldRespectImageOrientation initial=false
+
+# Limited use by features which behave differently depending on the input
+# devices available.  For example, the pointer and hover media queries.
+# Note that we need to be careful when basing behavior or UI on this -
+# just because a device is present doesn't mean the user cares about it
+# or uses it (i.e. Chromebook Pixel users generally don't want to give up
+# screen real estate just because they happen to have a touchscreen).
 deviceSupportsTouch initial=false
 deviceSupportsMouse initial=true
 
+# Whether touch gestures should be "fuzzed" to nearest touch targets.
+# It's expected that this is enabled everywhere by default, but it may be
+# disabled for testing purposes as the algorithm is not yet perfect.
+# crbug.com/304895 tracks removal once we're satisfied with the algorithm.
 touchAdjustmentEnabled initial=true
 
+# A mostly-stable performance optimization. crbug.com/304518 tracks removal.
+compositorTouchHitTesting initial=true
+
 fixedPositionCreatesStackingContext initial=false
 syncXHRInDocumentsEnabled initial=true
 cookieEnabled initial=true
@@ -117,10 +177,14 @@
 
 allowCustomScrollbarInMainFrame initial=true
 webSecurityEnabled initial=true
+
+# Special keyboard navigation mode intented for platforms with no
+# proper mouse or touch support, such as a TV controller with a remote.
 spatialNavigationEnabled initial=false
 
 # This setting adds a means to enable/disable touch initiated drag & drop. If
 # enabled, the user can initiate drag using long press.
+# crbug.com/304894 tracks removal once it's been enabled on all platforms.
 touchDragDropEnabled initial=false
 
 unifiedTextCheckerEnabled initial=defaultUnifiedTextCheckerEnabled
@@ -133,20 +197,40 @@
 
 selectionIncludesAltImageText initial=false
 useLegacyBackgroundSizeShorthandBehavior initial=false
+
 # This quirk is to maintain compatibility with Android apps built on
-# the Android SDK prior to and including version 18. Presumably, this
-# can be removed any time after 2015. See http://crbug.com/282130.
+# the Android SDK prior to and including version 18.
+# Presumably, this can be removed any time after 2015.
+# See http://crbug.com/282130.
 viewportMetaZeroValuesQuirk initial=false
-# Another Android SDK <= 18 quirk, removable 2015.  http://crbug.com/295287
+
+# Another Android SDK <= 18 quirk, removable 2015.
+# See http://crbug.com/295287
 ignoreMainFrameOverflowHiddenQuirk initial=false
+
+# Yet another Android SDK <= 18 quirk, removable 2015.
+# See http://crbug.com/305236
+reportScreenSizeInPhysicalPixelsQuirk initial=false
+
 # This quirk is to maintain compatibility with Android apps.
 # It will be possible to remove it once WebSettings.{get|set}UseWideViewPort
-# API function will be removed. See http://crbug.com/288037.
+# API function will be removed.
+# See http://crbug.com/288037.
 wideViewportQuirkEnabled initial=false
 
-# This setting enables touch based text selection and editing.
+# Touch based text selection and editing on desktop.
+# crbug.com/304873 tracks removal once it's been enabled on all platforms.
 touchEditingEnabled initial=false
 
 experimentalWebSocketEnabled initial=false
+
+# Settings for experimental desktop pinch-zoom support (with semantics
+# optimized for large screens).  Pinch-zoom generally is implemented mainly
+# outside of blink (in the compositor) and doesn't require any settings.
+# These settings are for an experimental modification to how pinch-zoom
+# behaves.  TODO(wjmaclean): link to design document.
+# crbug.com/304869 tracks removal.
 pinchVirtualViewportEnabled initial=false
 useSolidColorScrollbars initial=false
+
+mainFrameClipsContent initial=true
diff --git a/Source/core/page/SpatialNavigation.cpp b/Source/core/page/SpatialNavigation.cpp
index 37426cb..843f1aa 100644
--- a/Source/core/page/SpatialNavigation.cpp
+++ b/Source/core/page/SpatialNavigation.cpp
@@ -33,13 +33,13 @@
 #include "core/dom/Node.h"
 #include "core/html/HTMLAreaElement.h"
 #include "core/html/HTMLImageElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/rendering/RenderLayer.h"
+#include "platform/geometry/IntRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/SpatialNavigation.h b/Source/core/page/SpatialNavigation.h
index e56c734..1e2f56c 100644
--- a/Source/core/page/SpatialNavigation.h
+++ b/Source/core/page/SpatialNavigation.h
@@ -24,7 +24,7 @@
 #include "core/dom/Node.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/page/FocusDirection.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 
 #include <limits>
 
diff --git a/Source/core/page/SpeechInput.cpp b/Source/core/page/SpeechInput.cpp
deleted file mode 100644
index 0ad8c86..0000000
--- a/Source/core/page/SpeechInput.cpp
+++ /dev/null
@@ -1,131 +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/page/SpeechInput.h"
-
-#if ENABLE(INPUT_SPEECH)
-
-#include "core/page/SpeechInputClient.h"
-#include "core/page/SpeechInputListener.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebCore {
-
-SpeechInput::SpeechInput(SpeechInputClient* client)
-    : m_client(client)
-    , m_nextListenerId(1)
-{
-    m_client->setListener(this);
-}
-
-SpeechInput::~SpeechInput()
-{
-    m_client->setListener(0);
-}
-
-PassOwnPtr<SpeechInput> SpeechInput::create(SpeechInputClient* client)
-{
-    return adoptPtr(new SpeechInput(client));
-}
-
-int SpeechInput::registerListener(SpeechInputListener* listener)
-{
-#if defined(DEBUG)
-    // Check if already present.
-    for (HashMap<int, SpeechInputListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
-      ASSERT(it->value != listener);
-#endif
-
-    m_listeners.add(m_nextListenerId, listener);
-    return m_nextListenerId++;
-}
-
-void SpeechInput::unregisterListener(int listenerId)
-{
-    if (m_listeners.contains(listenerId))
-        m_listeners.remove(listenerId);
-}
-
-void SpeechInput::didCompleteRecording(int listenerId)
-{
-    // Don't assert if not present as the element might have been removed by the page while
-    // this event was on the way.
-    if (m_listeners.contains(listenerId))
-        m_listeners.get(listenerId)->didCompleteRecording(listenerId);
-}
-
-void SpeechInput::didCompleteRecognition(int listenerId)
-{
-    // Don't assert if not present as the element might have been removed by the page while
-    // this event was on the way.
-    if (m_listeners.contains(listenerId))
-        m_listeners.get(listenerId)->didCompleteRecognition(listenerId);
-}
-
-void SpeechInput::setRecognitionResult(int listenerId, const SpeechInputResultArray& result)
-{
-    // Don't assert if not present as the element might have been removed by the page while
-    // this event was on the way.
-    if (m_listeners.contains(listenerId))
-        m_listeners.get(listenerId)->setRecognitionResult(listenerId, result);
-}
-
-bool SpeechInput::startRecognition(int listenerId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin* origin)
-{
-    ASSERT(m_listeners.contains(listenerId));
-    return m_client->startRecognition(listenerId, elementRect, language, grammar, origin);
-}
-
-void SpeechInput::stopRecording(int listenerId)
-{
-    ASSERT(m_listeners.contains(listenerId));
-    m_client->stopRecording(listenerId);
-}
-
-void SpeechInput::cancelRecognition(int listenerId)
-{
-    ASSERT(m_listeners.contains(listenerId));
-    m_client->cancelRecognition(listenerId);
-}
-
-const char* SpeechInput::supplementName()
-{
-    return "SpeechInput";
-}
-
-void provideSpeechInputTo(Page* page, SpeechInputClient* client)
-{
-    SpeechInput::provideTo(page, SpeechInput::supplementName(), SpeechInput::create(client));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(INPUT_SPEECH)
diff --git a/Source/core/page/SpeechInput.h b/Source/core/page/SpeechInput.h
deleted file mode 100644
index 8544e21..0000000
--- a/Source/core/page/SpeechInput.h
+++ /dev/null
@@ -1,91 +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 SpeechInput_h
-#define SpeechInput_h
-
-#if ENABLE(INPUT_SPEECH)
-
-#include "core/page/Page.h"
-#include "core/page/SpeechInputListener.h"
-#include "wtf/Forward.h"
-#include "wtf/HashMap.h"
-
-namespace WebCore {
-
-class IntRect;
-class SecurityOrigin;
-class SpeechInputClient;
-class SpeechInputListener;
-
-// This class connects the input elements requiring speech input with the platform specific
-// speech recognition engine. It provides methods for the input elements to activate speech
-// recognition and methods for the speech recognition engine to return back the results.
-class SpeechInput : public SpeechInputListener,
-                    public Supplement<Page> {
-    WTF_MAKE_NONCOPYABLE(SpeechInput);
-public:
-    virtual ~SpeechInput();
-
-    static PassOwnPtr<SpeechInput> create(SpeechInputClient*);
-    static const char* supplementName();
-    static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(Supplement<Page>::from(page, supplementName())); }
-
-    // Generates a unique ID for the given listener to be used for speech requests.
-    // This should be the first call made by listeners before anything else.
-    int registerListener(SpeechInputListener*);
-
-    // Invoked when the listener is done with recording or getting destroyed.
-    // Failure to unregister may result in crashes if there were any pending speech events.
-    void unregisterListener(int);
-
-    // Methods invoked by the input elements.
-    bool startRecognition(int listenerId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin*);
-    void stopRecording(int);
-    void cancelRecognition(int);
-
-    // SpeechInputListener methods.
-    virtual void didCompleteRecording(int);
-    virtual void didCompleteRecognition(int);
-    virtual void setRecognitionResult(int, const SpeechInputResultArray&);
-
-private:
-    explicit SpeechInput(SpeechInputClient*);
-
-    SpeechInputClient* m_client;
-    HashMap<int, SpeechInputListener*> m_listeners;
-    int m_nextListenerId;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(INPUT_SPEECH)
-
-#endif // SpeechInput_h
diff --git a/Source/core/page/SpeechInputEvent.cpp b/Source/core/page/SpeechInputEvent.cpp
deleted file mode 100644
index 5a9a15e..0000000
--- a/Source/core/page/SpeechInputEvent.cpp
+++ /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.
- */
-
-#include "config.h"
-
-#if ENABLE(INPUT_SPEECH)
-
-#include "core/page/SpeechInputEvent.h"
-
-#include "core/events/EventNames.h"
-
-namespace WebCore {
-
-PassRefPtr<SpeechInputEvent> SpeechInputEvent::create()
-{
-    return adoptRef(new SpeechInputEvent);
-}
-
-PassRefPtr<SpeechInputEvent> SpeechInputEvent::create(const AtomicString& eventType, const SpeechInputResultArray& results)
-{
-    return adoptRef(new SpeechInputEvent(eventType, results));
-}
-
-SpeechInputEvent::SpeechInputEvent()
-{
-    ScriptWrappable::init(this);
-}
-
-SpeechInputEvent::SpeechInputEvent(const AtomicString& eventType, const SpeechInputResultArray& results)
-    : Event(eventType, true, false) // Can bubble, not cancelable
-    , m_results(SpeechInputResultList::create(results))
-{
-    ScriptWrappable::init(this);
-}
-
-SpeechInputEvent::~SpeechInputEvent()
-{
-}
-
-const AtomicString& SpeechInputEvent::interfaceName() const
-{
-    return eventNames().interfaceForSpeechInputEvent;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(INPUT_SPEECH)
diff --git a/Source/core/page/SpeechInputEvent.h b/Source/core/page/SpeechInputEvent.h
deleted file mode 100644
index 0fe594c..0000000
--- a/Source/core/page/SpeechInputEvent.h
+++ /dev/null
@@ -1,59 +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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 SpeechInputEvent_h
-#define SpeechInputEvent_h
-
-#if ENABLE(INPUT_SPEECH)
-
-#include "core/events/Event.h"
-#include "core/page/SpeechInputResultList.h"
-
-#include "wtf/PassRefPtr.h"
-
-namespace WebCore {
-
-class SpeechInputEvent : public Event {
-public:
-    static PassRefPtr<SpeechInputEvent> create();
-    static PassRefPtr<SpeechInputEvent> create(const AtomicString& eventType, const SpeechInputResultArray& results);
-    ~SpeechInputEvent();
-
-    SpeechInputResultList* results() const { return m_results.get(); }
-
-    virtual const AtomicString& interfaceName() const;
-
-private:
-    SpeechInputEvent();
-    SpeechInputEvent(const AtomicString& eventType, const SpeechInputResultArray& results);
-
-    RefPtr<SpeechInputResultList> m_results;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(INPUT_SPEECH)
-
-#endif // SpeechInputEvent_h
diff --git a/Source/core/page/SpeechInputListener.h b/Source/core/page/SpeechInputListener.h
deleted file mode 100644
index d9f501c..0000000
--- a/Source/core/page/SpeechInputListener.h
+++ /dev/null
@@ -1,67 +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 SpeechInputListener_h
-#define SpeechInputListener_h
-
-#if ENABLE(INPUT_SPEECH)
-
-#include "core/page/SpeechInputResult.h"
-#include "wtf/Forward.h"
-
-namespace WebCore {
-
-// Interface to be implemented by the element which invokes SpeechInput.
-class SpeechInputListener {
-public:
-    // Informs that audio recording has completed and recognition is underway.
-    virtual void didCompleteRecording(int requestId) = 0;
-
-    // Informs that speech recognition has completed. This gets invoked irrespective of whether
-    // recognition was succesful or not, whether setRecognitionResult() was invoked or not. The
-    // handler typically frees up any temporary resources allocated and waits for the next speech
-    // recognition request.
-    virtual void didCompleteRecognition(int requestId) = 0;
-
-    // Gives results from speech recognition, either partial or the final results.
-    // This method can potentially get called multiple times if there are partial results
-    // available as the user keeps speaking. If the speech could not be recognized properly
-    // or if there was any other errors in the process, this method may never be called.
-    virtual void setRecognitionResult(int requestId, const SpeechInputResultArray&) = 0;
-
-protected:
-    virtual ~SpeechInputListener() { }
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(INPUT_SPEECH)
-
-#endif // SpeechInputListener_h
diff --git a/Source/core/page/SpeechInputResult.cpp b/Source/core/page/SpeechInputResult.cpp
deleted file mode 100644
index 82ef65b..0000000
--- a/Source/core/page/SpeechInputResult.cpp
+++ /dev/null
@@ -1,62 +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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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/page/SpeechInputResult.h"
-
-#if ENABLE(INPUT_SPEECH)
-
-namespace WebCore {
-
-PassRefPtr<SpeechInputResult> SpeechInputResult::create(const String& utterance, double confidence)
-{
-    return adoptRef(new SpeechInputResult(utterance, confidence));
-}
-
-PassRefPtr<SpeechInputResult> SpeechInputResult::create(const SpeechInputResult& source)
-{
-    return adoptRef(new SpeechInputResult(source.m_utterance, source.m_confidence));
-}
-
-SpeechInputResult::SpeechInputResult(const String& utterance, double confidence)
-    : m_utterance(utterance)
-    , m_confidence(confidence)
-{
-    ScriptWrappable::init(this);
-}
-
-double SpeechInputResult::confidence() const
-{
-    return m_confidence;
-}
-
-const String& SpeechInputResult::utterance() const
-{
-    return m_utterance;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(INPUT_SPEECH)
diff --git a/Source/core/page/SpeechInputResultList.cpp b/Source/core/page/SpeechInputResultList.cpp
deleted file mode 100644
index 89905a1..0000000
--- a/Source/core/page/SpeechInputResultList.cpp
+++ /dev/null
@@ -1,56 +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/page/SpeechInputResultList.h"
-
-#if ENABLE(INPUT_SPEECH)
-
-namespace WebCore {
-
-PassRefPtr<SpeechInputResultList> SpeechInputResultList::create(const SpeechInputResultArray& results)
-{
-    return adoptRef(new SpeechInputResultList(results));
-}
-
-SpeechInputResult* SpeechInputResultList::item(unsigned index)
-{
-    return index >= m_results.size() ? 0 : m_results[index].get();
-}
-
-SpeechInputResultList::SpeechInputResultList(const SpeechInputResultArray& results)
-    : m_results(results) // Takes a copy of the array of RefPtrs.
-{
-    ScriptWrappable::init(this);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(INPUT_SPEECH)
diff --git a/Source/core/page/SpeechInputResultList.h b/Source/core/page/SpeechInputResultList.h
deleted file mode 100644
index eef6ca3..0000000
--- a/Source/core/page/SpeechInputResultList.h
+++ /dev/null
@@ -1,56 +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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 SpeechInputResultList_h
-#define SpeechInputResultList_h
-
-#if ENABLE(INPUT_SPEECH)
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/page/SpeechInputResult.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class SpeechInputResultList : public RefCounted<SpeechInputResultList>, public ScriptWrappable {
-public:
-    static PassRefPtr<SpeechInputResultList> create(const SpeechInputResultArray& results);
-
-    // Methods from the IDL.
-    size_t length() { return m_results.size(); }
-    SpeechInputResult* item(unsigned index);
-
-private:
-    explicit SpeechInputResultList(const SpeechInputResultArray& results);
-
-    SpeechInputResultArray m_results;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(INPUT_SPEECH)
-
-#endif // SpeechInputResultList_h
diff --git a/Source/core/page/SuspendableTimer.cpp b/Source/core/page/SuspendableTimer.cpp
deleted file mode 100644
index 471f68c..0000000
--- a/Source/core/page/SuspendableTimer.cpp
+++ /dev/null
@@ -1,86 +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 COMPUTER, 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/page/SuspendableTimer.h"
-
-namespace WebCore {
-
-SuspendableTimer::SuspendableTimer(ScriptExecutionContext* context)
-    : ActiveDOMObject(context)
-    , m_nextFireInterval(0)
-    , m_repeatInterval(0)
-    , m_active(false)
-#if !ASSERT_DISABLED
-    , m_suspended(false)
-#endif
-{
-}
-
-SuspendableTimer::~SuspendableTimer()
-{
-}
-
-bool SuspendableTimer::hasPendingActivity() const
-{
-    return isActive();
-}
-
-void SuspendableTimer::stop()
-{
-    TimerBase::stop();
-}
-
-void SuspendableTimer::suspend(ReasonForSuspension)
-{
-#if !ASSERT_DISABLED
-    ASSERT(!m_suspended);
-    m_suspended = true;
-#endif
-    m_active = isActive();
-    if (m_active) {
-        m_nextFireInterval = nextUnalignedFireInterval();
-        m_repeatInterval = repeatInterval();
-        TimerBase::stop();
-    }
-}
-
-void SuspendableTimer::resume()
-{
-#if !ASSERT_DISABLED
-    ASSERT(m_suspended);
-    m_suspended = false;
-#endif
-    if (m_active)
-        start(m_nextFireInterval, m_repeatInterval);
-}
-
-bool SuspendableTimer::canSuspend() const
-{
-    return true;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/SuspendableTimer.h b/Source/core/page/SuspendableTimer.h
deleted file mode 100644
index 8d8f539..0000000
--- a/Source/core/page/SuspendableTimer.h
+++ /dev/null
@@ -1,61 +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 COMPUTER, 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 SuspendableTimer_h
-#define SuspendableTimer_h
-
-#include "core/dom/ActiveDOMObject.h"
-#include "core/platform/Timer.h"
-
-namespace WebCore {
-
-class SuspendableTimer : public TimerBase, public ActiveDOMObject {
-public:
-    explicit SuspendableTimer(ScriptExecutionContext*);
-    virtual ~SuspendableTimer();
-
-    // ActiveDOMObject
-    virtual bool hasPendingActivity() const;
-    virtual void stop();
-    virtual bool canSuspend() const;
-    virtual void suspend(ReasonForSuspension);
-    virtual void resume();
-
-private:
-    virtual void fired() = 0;
-
-    double m_nextFireInterval;
-    double m_repeatInterval;
-    bool m_active;
-#if !ASSERT_DISABLED
-    bool m_suspended;
-#endif
-};
-
-} // namespace WebCore
-
-#endif // SuspendableTimer_h
-
diff --git a/Source/core/page/TouchAdjustment.cpp b/Source/core/page/TouchAdjustment.cpp
index fcd5901..fa5cff5 100644
--- a/Source/core/page/TouchAdjustment.cpp
+++ b/Source/core/page/TouchAdjustment.cpp
@@ -27,17 +27,17 @@
 #include "core/dom/Text.h"
 #include "core/editing/Editor.h"
 #include "core/html/HTMLFrameOwnerElement.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/IntPoint.h"
-#include "core/platform/graphics/IntSize.h"
-#include "core/platform/text/TextBreakIterator.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/RenderBox.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderText.h"
 #include "core/rendering/style/RenderStyle.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/geometry/IntPoint.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/text/TextBreakIterator.h"
 
 namespace WebCore {
 
@@ -158,11 +158,11 @@
         // Make subtargets out of every word.
         String textValue = textNode->data();
         TextBreakIterator* wordIterator = wordBreakIterator(textValue, 0, textValue.length());
-        int lastOffset = textBreakFirst(wordIterator);
+        int lastOffset = wordIterator->first();
         if (lastOffset == -1)
             return;
         int offset;
-        while ((offset = textBreakNext(wordIterator)) != -1) {
+        while ((offset = wordIterator->next()) != -1) {
             if (isWordTextBreak(wordIterator)) {
                 Vector<FloatQuad> quads;
                 textRenderer->absoluteQuadsForRange(quads, lastOffset, offset);
diff --git a/Source/core/page/TouchAdjustment.h b/Source/core/page/TouchAdjustment.h
index 16bfe85..2bd66d6 100644
--- a/Source/core/page/TouchAdjustment.h
+++ b/Source/core/page/TouchAdjustment.h
@@ -20,8 +20,8 @@
 #ifndef TouchAdjustment_h
 #define TouchAdjustment_h
 
-#include "core/platform/graphics/IntPoint.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntPoint.h"
+#include "platform/geometry/IntRect.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/page/TouchDisambiguation.cpp b/Source/core/page/TouchDisambiguation.cpp
index 6638ce3..a2f46dc 100644
--- a/Source/core/page/TouchDisambiguation.cpp
+++ b/Source/core/page/TouchDisambiguation.cpp
@@ -40,8 +40,8 @@
 #include "core/dom/NodeTraversal.h"
 #include "core/html/HTMLHtmlElement.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderBlock.h"
 
diff --git a/Source/core/page/UseCounter.cpp b/Source/core/page/UseCounter.cpp
index c7788ce..4bdefd5 100644
--- a/Source/core/page/UseCounter.cpp
+++ b/Source/core/page/UseCounter.cpp
@@ -30,8 +30,8 @@
 #include "core/css/CSSStyleSheet.h"
 #include "core/css/StyleSheetContents.h"
 #include "core/dom/Document.h"
-#include "core/dom/ScriptExecutionContext.h"
-#include "core/page/DOMWindow.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/frame/DOMWindow.h"
 #include "core/page/Page.h"
 #include "core/page/PageConsole.h"
 #include "core/platform/HistogramSupport.h"
@@ -324,11 +324,7 @@
     case CSSPropertyWebkitMarginEnd: return 272;
     case CSSPropertyWebkitMarginStart: return 273;
     // CSSPropertyWebkitMarquee was 274.
-    case CSSPropertyInternalMarqueeDirection: return 275;
-    case CSSPropertyInternalMarqueeIncrement: return 276;
-    case CSSPropertyInternalMarqueeRepetition: return 277;
-    case CSSPropertyInternalMarqueeSpeed: return 278;
-    case CSSPropertyInternalMarqueeStyle: return 279;
+    // CSSPropertyInternalMarquee* were 275-279.
     case CSSPropertyWebkitMask: return 280;
     case CSSPropertyWebkitMaskBoxImage: return 281;
     case CSSPropertyWebkitMaskBoxImageOutset: return 282;
@@ -497,10 +493,20 @@
     case CSSPropertyMaskSourceType: return 435;
     case CSSPropertyIsolation: return 436;
     case CSSPropertyObjectPosition: return 437;
+    case CSSPropertyInternalCallback: return 438;
+    case CSSPropertyWebkitShapeImageThreshold: return 439;
+    case CSSPropertyColumnFill: return 440;
+    case CSSPropertyTextJustify: return 441;
 
     // Add new features above this line (don't change the assigned numbers of the existing
     // items) and update maximumCSSSampleId() with the new maximum value.
 
+    // Internal properties should not be counted.
+    case CSSPropertyInternalMarqueeDirection:
+    case CSSPropertyInternalMarqueeIncrement:
+    case CSSPropertyInternalMarqueeRepetition:
+    case CSSPropertyInternalMarqueeSpeed:
+    case CSSPropertyInternalMarqueeStyle:
     case CSSPropertyInvalid:
     case CSSPropertyVariable:
         ASSERT_NOT_REACHED();
@@ -511,7 +517,7 @@
     return 0;
 }
 
-static int maximumCSSSampleId() { return 437; }
+static int maximumCSSSampleId() { return 441; }
 
 UseCounter::UseCounter()
 {
@@ -563,12 +569,9 @@
     updateMeasurements();
 }
 
-void UseCounter::count(Document* document, Feature feature)
+void UseCounter::count(const Document& document, Feature feature)
 {
-    if (!document)
-        return;
-
-    Page* page = document->page();
+    Page* page = document.page();
     if (!page)
         return;
 
@@ -576,32 +579,31 @@
     page->useCounter().recordMeasurement(feature);
 }
 
-void UseCounter::count(DOMWindow* domWindow, Feature feature)
+void UseCounter::count(const DOMWindow* domWindow, Feature feature)
 {
     ASSERT(domWindow);
-    count(domWindow->document(), feature);
+    if (!domWindow->document())
+        return;
+    count(*domWindow->document(), feature);
 }
 
-void UseCounter::countDeprecation(ScriptExecutionContext* context, Feature feature)
+void UseCounter::countDeprecation(ExecutionContext* context, Feature feature)
 {
     if (!context || !context->isDocument())
         return;
-    UseCounter::countDeprecation(toDocument(context), feature);
+    UseCounter::countDeprecation(*toDocument(context), feature);
 }
 
-void UseCounter::countDeprecation(DOMWindow* window, Feature feature)
+void UseCounter::countDeprecation(const DOMWindow* window, Feature feature)
 {
-    if (!window)
+    if (!window || !window->document())
         return;
-    UseCounter::countDeprecation(window->document(), feature);
+    UseCounter::countDeprecation(*window->document(), feature);
 }
 
-void UseCounter::countDeprecation(Document* document, Feature feature)
+void UseCounter::countDeprecation(const Document& document, Feature feature)
 {
-    if (!document)
-        return;
-
-    Page* page = document->page();
+    Page* page = document.page();
     if (!page)
         return;
 
@@ -672,6 +674,12 @@
     case EventReturnValue:
         return "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.";
 
+    case ScrollTopBodyNotQuirksMode:
+        return "body.scrollTop is deprecated in strict mode. Please use 'documentElement.scrollTop' if in strict mode and 'body.scrollTop' only if in quirks mode.";
+
+    case ScrollLeftBodyNotQuirksMode:
+        return "body.scrollLeft is deprecated in strict mode. Please use 'documentElement.scrollLeft' if in strict mode and 'body.scrollLeft' only if in quirks mode.";
+
     // Features that aren't deprecated don't have a deprecation message.
     default:
         return String();
diff --git a/Source/core/page/UseCounter.h b/Source/core/page/UseCounter.h
index b5bba84..9bfde13 100644
--- a/Source/core/page/UseCounter.h
+++ b/Source/core/page/UseCounter.h
@@ -38,7 +38,7 @@
 class CSSStyleSheet;
 class DOMWindow;
 class Document;
-class ScriptExecutionContext;
+class ExecutionContext;
 class StyleSheetContents;
 
 // UseCounter is used for counting the number of times features of
@@ -213,14 +213,19 @@
         HTMLAppletElementLegacyCall,
         HTMLEmbedElementLegacyCall,
         HTMLObjectElementLegacyCall,
+        BeforeLoadEvent,
+        GetMatchedCSSRules,
+        SVGFontInCSS,
+        ScrollTopBodyNotQuirksMode,
+        ScrollLeftBodyNotQuirksMode,
         // Add new features immediately above this line. Don't change assigned
         // numbers of each items, and don't reuse unused slots.
         NumberOfFeatures, // This enum value must be last.
     };
 
     // "count" sets the bit for this feature to 1. Repeated calls are ignored.
-    static void count(Document*, Feature);
-    static void count(DOMWindow*, Feature);
+    static void count(const Document&, Feature);
+    static void count(const DOMWindow*, Feature);
     void count(CSSParserContext, CSSPropertyID);
     void count(Feature);
 
@@ -229,9 +234,9 @@
     //
     // Be considerate to developers' consoles: features should only send deprecation warnings
     // when we're actively interested in removing them from the platform.
-    static void countDeprecation(DOMWindow*, Feature);
-    static void countDeprecation(ScriptExecutionContext*, Feature);
-    static void countDeprecation(Document*, Feature);
+    static void countDeprecation(const DOMWindow*, Feature);
+    static void countDeprecation(ExecutionContext*, Feature);
+    static void countDeprecation(const Document&, Feature);
     String deprecationMessage(Feature);
 
     void didCommitLoad();
diff --git a/Source/core/page/UserContentTypes.h b/Source/core/page/UserContentTypes.h
deleted file mode 100644
index 58c8bb9..0000000
--- a/Source/core/page/UserContentTypes.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2009 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,
- * 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 UserContentTypes_h
-#define UserContentTypes_h
-
-namespace WebCore {
-
-enum UserContentInjectedFrames { InjectInAllFrames, InjectInTopFrameOnly };
-
-} // namespace WebCore
-
-#endif // UserContentTypes_h
diff --git a/Source/core/page/UserContentURLPattern.cpp b/Source/core/page/UserContentURLPattern.cpp
deleted file mode 100644
index 4f18ab8..0000000
--- a/Source/core/page/UserContentURLPattern.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (C) 2009, 2010 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,
- * 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/page/UserContentURLPattern.h"
-
-#include "weborigin/KURL.h"
-#include "wtf/StdLibExtras.h"
-
-namespace WebCore {
-
-bool UserContentURLPattern::matchesPatterns(const KURL& url, const Vector<String>& whitelist, const Vector<String>& blacklist)
-{
-    // In order for a URL to be a match it has to be present in the whitelist and not present in the blacklist.
-    // If there is no whitelist at all, then all URLs are assumed to be in the whitelist.
-    bool matchesWhitelist = whitelist.isEmpty();
-    if (!matchesWhitelist) {
-        size_t whitelistSize = whitelist.size();
-        for (size_t i = 0; i < whitelistSize; ++i) {
-            UserContentURLPattern contentPattern(whitelist[i]);
-            if (contentPattern.matches(url)) {
-                matchesWhitelist = true;
-                break;
-            }
-        }
-    }
-
-    bool matchesBlacklist = false;
-    if (!blacklist.isEmpty()) {
-        size_t blacklistSize = blacklist.size();
-        for (size_t i = 0; i < blacklistSize; ++i) {
-            UserContentURLPattern contentPattern(blacklist[i]);
-            if (contentPattern.matches(url)) {
-                matchesBlacklist = true;
-                break;
-            }
-        }
-    }
-
-    return matchesWhitelist && !matchesBlacklist;
-}
-
-bool UserContentURLPattern::parse(const String& pattern)
-{
-    DEFINE_STATIC_LOCAL(const String, schemeSeparator, ("://"));
-
-    size_t schemeEndPos = pattern.find(schemeSeparator);
-    if (schemeEndPos == kNotFound)
-        return false;
-
-    m_scheme = pattern.left(schemeEndPos);
-
-    unsigned hostStartPos = schemeEndPos + schemeSeparator.length();
-    if (hostStartPos >= pattern.length())
-        return false;
-
-    int pathStartPos = 0;
-
-    if (equalIgnoringCase(m_scheme, "file"))
-        pathStartPos = hostStartPos;
-    else {
-        size_t hostEndPos = pattern.find("/", hostStartPos);
-        if (hostEndPos == kNotFound)
-            return false;
-
-        m_host = pattern.substring(hostStartPos, hostEndPos - hostStartPos);
-        m_matchSubdomains = false;
-
-        if (m_host == "*") {
-            // The pattern can be just '*', which means match all domains.
-            m_host = "";
-            m_matchSubdomains = true;
-        } else if (m_host.startsWith("*.")) {
-            // The first component can be '*', which means to match all subdomains.
-            m_host = m_host.substring(2); // Length of "*."
-            m_matchSubdomains = true;
-        }
-
-        // No other '*' can occur in the host.
-        if (m_host.find("*") != kNotFound)
-            return false;
-
-        pathStartPos = hostEndPos;
-    }
-
-    m_path = pattern.right(pattern.length() - pathStartPos);
-
-    return true;
-}
-
-bool UserContentURLPattern::matches(const KURL& test) const
-{
-    if (m_invalid)
-        return false;
-
-    if (!equalIgnoringCase(test.protocol(), m_scheme))
-        return false;
-
-    if (!equalIgnoringCase(m_scheme, "file") && !matchesHost(test))
-        return false;
-
-    return matchesPath(test);
-}
-
-bool UserContentURLPattern::matchesHost(const KURL& test) const
-{
-    const String& host = test.host();
-    if (equalIgnoringCase(host, m_host))
-        return true;
-
-    if (!m_matchSubdomains)
-        return false;
-
-    // If we're matching subdomains, and we have no host, that means the pattern
-    // was <scheme>://*/<whatever>, so we match anything.
-    if (!m_host.length())
-        return true;
-
-    // Check if the domain is a subdomain of our host.
-    if (!host.endsWith(m_host, false))
-        return false;
-
-    ASSERT(host.length() > m_host.length());
-
-    // Check that the character before the suffix is a period.
-    return host[host.length() - m_host.length() - 1] == '.';
-}
-
-struct MatchTester
-{
-    const String m_pattern;
-    unsigned m_patternIndex;
-
-    const String m_test;
-    unsigned m_testIndex;
-
-    MatchTester(const String& pattern, const String& test)
-    : m_pattern(pattern)
-    , m_patternIndex(0)
-    , m_test(test)
-    , m_testIndex(0)
-    {
-    }
-
-    bool testStringFinished() const { return m_testIndex >= m_test.length(); }
-    bool patternStringFinished() const { return m_patternIndex >= m_pattern.length(); }
-
-    void eatWildcard()
-    {
-        while (!patternStringFinished()) {
-            if (m_pattern[m_patternIndex] != '*')
-                return;
-            m_patternIndex++;
-        }
-    }
-
-    void eatSameChars()
-    {
-        while (!patternStringFinished() && !testStringFinished()) {
-            if (m_pattern[m_patternIndex] == '*')
-                return;
-            if (m_pattern[m_patternIndex] != m_test[m_testIndex])
-                return;
-            m_patternIndex++;
-            m_testIndex++;
-        }
-    }
-
-    bool test()
-    {
-        // Eat all the matching chars.
-        eatSameChars();
-
-        // If the string is finished, then the pattern must be empty too, or contains
-        // only wildcards.
-        if (testStringFinished()) {
-            eatWildcard();
-            if (patternStringFinished())
-                return true;
-            return false;
-        }
-
-        // Pattern is empty but not string, this is not a match.
-        if (patternStringFinished())
-            return false;
-
-        // If we don't encounter a *, then we're hosed.
-        if (m_pattern[m_patternIndex] != '*')
-            return false;
-
-        while (!testStringFinished()) {
-            MatchTester nextMatch(*this);
-            nextMatch.m_patternIndex++;
-            if (nextMatch.test())
-                return true;
-            m_testIndex++;
-        }
-
-        // We reached the end of the string.  Let's see if the pattern contains only
-        // wildcards.
-        eatWildcard();
-        return patternStringFinished();
-    }
-};
-
-bool UserContentURLPattern::matchesPath(const KURL& test) const
-{
-    MatchTester match(m_path, test.path());
-    return match.test();
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/UserContentURLPattern.h b/Source/core/page/UserContentURLPattern.h
deleted file mode 100644
index 7415b88..0000000
--- a/Source/core/page/UserContentURLPattern.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2009 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,
- * 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 UserContentURLPattern_h
-#define UserContentURLPattern_h
-
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class KURL;
-
-class UserContentURLPattern {
-public:
-    UserContentURLPattern() : m_invalid(true), m_matchSubdomains(false) { }
-
-    UserContentURLPattern(const String& pattern)
-    : m_matchSubdomains(false)
-    {
-        m_invalid = !parse(pattern);
-    }
-
-    bool isValid() const { return !m_invalid; }
-
-    bool matches(const KURL&) const;
-
-    const String& scheme() const { return m_scheme; }
-    const String& host() const { return m_host; }
-    const String& path() const { return m_path; }
-
-    bool matchSubdomains() const { return m_matchSubdomains; }
-
-    static bool matchesPatterns(const KURL&, const Vector<String>& whitelist, const Vector<String>& blacklist);
-
-private:
-    bool parse(const String& pattern);
-
-    bool matchesHost(const KURL&) const;
-    bool matchesPath(const KURL&) const;
-
-    bool m_invalid;
-
-    String m_scheme;
-    String m_host;
-    String m_path;
-
-    bool m_matchSubdomains;
-};
-
-
-} // namespace WebCore
-
-#endif // UserContentURLPattern_h
diff --git a/Source/core/page/UserStyleSheet.h b/Source/core/page/UserStyleSheet.h
deleted file mode 100644
index c5f8e19..0000000
--- a/Source/core/page/UserStyleSheet.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2009 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,
- * 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 UserStyleSheet_h
-#define UserStyleSheet_h
-
-#include "core/page/UserContentTypes.h"
-#include "core/page/UserStyleSheetTypes.h"
-#include "weborigin/KURL.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class UserStyleSheet {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    UserStyleSheet()
-        : m_injectedFrames(InjectInAllFrames)
-        , m_level(UserStyleUserLevel)
-    {
-    }
-
-    UserStyleSheet(const String& source, const KURL& url, const Vector<String>& whitelist, const Vector<String>& blacklist, UserContentInjectedFrames injectedFrames, UserStyleLevel level)
-        : m_source(source)
-        , m_url(url)
-        , m_whitelist(whitelist)
-        , m_blacklist(blacklist)
-        , m_injectedFrames(injectedFrames)
-        , m_level(level)
-    {
-    }
-
-    const String& source() const { return m_source; }
-    const KURL& url() const { return m_url; }
-    const Vector<String>& whitelist() const { return m_whitelist; }
-    const Vector<String>& blacklist() const { return m_blacklist; }
-    UserContentInjectedFrames injectedFrames() const { return m_injectedFrames; }
-    UserStyleLevel level() const { return m_level; }
-
-private:
-    String m_source;
-    KURL m_url;
-    Vector<String> m_whitelist;
-    Vector<String> m_blacklist;
-    UserContentInjectedFrames m_injectedFrames;
-    UserStyleLevel m_level;
-};
-
-} // namespace WebCore
-
-#endif // UserStyleSheet_h
diff --git a/Source/core/page/UserStyleSheetTypes.h b/Source/core/page/UserStyleSheetTypes.h
deleted file mode 100644
index 6ddebda..0000000
--- a/Source/core/page/UserStyleSheetTypes.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2009 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,
- * 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 UserStyleSheetTypes_h
-#define UserStyleSheetTypes_h
-
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-enum UserStyleInjectionTime { InjectInExistingDocuments, InjectInSubsequentDocuments };
-enum UserStyleLevel { UserStyleUserLevel, UserStyleAuthorLevel };
-
-class UserStyleSheet;
-
-typedef Vector<OwnPtr<UserStyleSheet> > UserStyleSheetVector;
-
-} // namespace WebCore
-
-#endif // UserStyleSheetTypes_h
diff --git a/Source/core/page/Window.idl b/Source/core/page/Window.idl
deleted file mode 100644
index c720658..0000000
--- a/Source/core/page/Window.idl
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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,
- * 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.
- */
-
-[
-    CheckSecurity,
-    CustomToV8,
-    DoNotGenerateWrap,
-    ImplementedAs=DOMWindow
-] interface Window : EventTarget {
-    // DOM Level 0
-    [Replaceable] readonly attribute Screen screen;
-    [Replaceable] readonly attribute History history;
-    [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;
-    [DoNotCheckSecurity, CustomSetter, Unforgeable, Replaceable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] readonly attribute Location location;
-    [MeasureAs=WindowEvent, NotEnumerable, Replaceable, CustomGetter, CustomSetter] readonly attribute Event event;
-
-    Selection getSelection();
-
-    [CheckSecurityForNode] readonly attribute Element frameElement;
-
-    [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void focus();
-    [DoNotCheckSecurity] void blur();
-    [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void close();
-
-    void print();
-    void stop();
-
-    [Custom] Window open(DOMString url,
-                            DOMString name,
-                            optional DOMString options);
-
-    [Custom] any showModalDialog(DOMString url,
-                                       optional any dialogArgs,
-                                       optional DOMString featureArgs);
-
-    void alert([Default=Undefined] optional DOMString message);
-    boolean confirm([Default=Undefined] optional DOMString message);
-    [TreatReturnedNullStringAs=Null] DOMString prompt([Default=Undefined] optional DOMString message,
-                                                [TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString defaultValue);
-
-    boolean find([Default=Undefined] optional DOMString string,
-                 [Default=Undefined] optional boolean caseSensitive,
-                 [Default=Undefined] optional boolean backwards,
-                 [Default=Undefined] optional boolean wrap,
-                 [Default=Undefined] optional boolean wholeWord,
-                 [Default=Undefined] optional boolean searchInFrames,
-                 [Default=Undefined] optional boolean showDialog);
-
-    [Replaceable] readonly attribute  boolean offscreenBuffering;
-
-    [Replaceable] readonly attribute long outerHeight;
-    [Replaceable] readonly attribute long outerWidth;
-    [Replaceable] readonly attribute long innerHeight;
-    [Replaceable] readonly attribute long innerWidth;
-    [Replaceable] readonly attribute long screenX;
-    [Replaceable] readonly attribute long screenY;
-    [Replaceable] readonly attribute long screenLeft;
-    [Replaceable] readonly attribute long screenTop;
-    [Replaceable] readonly attribute long scrollX;
-    [Replaceable] readonly attribute long scrollY;
-    readonly attribute long pageXOffset;
-    readonly attribute long pageYOffset;
-
-    void scrollBy([Default=Undefined] optional long x, [Default=Undefined] optional long y);
-    void scrollTo([Default=Undefined] optional long x, [Default=Undefined] optional long y);
-    void scroll([Default=Undefined] optional long x, [Default=Undefined] optional long y);
-    void moveBy([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats.
-    void moveTo([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats.
-    void resizeBy([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats.
-    void resizeTo([Default=Undefined] optional float width, [Default=Undefined] optional float height); // FIXME: this should take longs not floats.
-
-    [DoNotCheckSecurity] readonly attribute boolean closed;
-
-    [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute unsigned long length;
-
-    attribute DOMString name;
-
-    attribute DOMString status;
-    attribute DOMString defaultStatus;
-    // This attribute is an alias of defaultStatus and is necessary for legacy uses.
-    attribute DOMString defaultstatus;
-
-    // Self referential attributes
-    [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute Window self;
-    [DoNotCheckSecurity, Unforgeable] readonly attribute Window window;
-    [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute  Window frames;
-
-    [Replaceable, DoNotCheckSecurityOnGetter, CustomSetter] readonly attribute Window opener;
-    [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute Window parent;
-    [DoNotCheckSecurityOnGetter, Unforgeable] readonly attribute Window top;
-
-    // DOM Level 2 AbstractView Interface
-    readonly attribute Document document;
-
-    // CSSOM View Module
-    MediaQueryList matchMedia(DOMString query);
-
-    // styleMedia has been removed from the CSSOM View specification.
-    readonly attribute StyleMedia styleMedia;
-
-    // DOM Level 2 Style Interface
-    [PerWorldBindings] CSSStyleDeclaration getComputedStyle([Default=Undefined] optional Element element,
-                                                              [TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString pseudoElement);
-
-    // WebKit extensions
-    CSSRuleList getMatchedCSSRules([Default=Undefined] optional Element element,
-                                   [TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString pseudoElement);
-
-    [Replaceable] readonly attribute double devicePixelRatio;
-
-    WebKitPoint webkitConvertPointFromPageToNode([Default=Undefined] optional Node node,
-                                                 [Default=Undefined] optional WebKitPoint p);
-    WebKitPoint webkitConvertPointFromNodeToPage([Default=Undefined] optional Node node,
-                                                 [Default=Undefined] optional WebKitPoint p);
-
-    [EnabledAtRuntime=ApplicationCache, PerWorldBindings, ActivityLog=GetterForIsolatedWorlds] readonly attribute ApplicationCache applicationCache;
-
-    [EnabledAtRuntime=SessionStorage, PerWorldBindings, ActivityLog=GetterForIsolatedWorlds, GetterRaisesException] readonly attribute Storage sessionStorage;
-    [EnabledAtRuntime=LocalStorage, PerWorldBindings, ActivityLog=GetterForIsolatedWorlds, GetterRaisesException] readonly attribute Storage localStorage;
-
-    // This is the interface orientation in degrees. Some examples are:
-    //  0 is straight up; -90 is when the device is rotated 90 clockwise;
-    //  90 is when rotated counter clockwise.
-    [Conditional=ORIENTATION_EVENTS] readonly attribute long orientation;
-
-    [Replaceable] readonly attribute Console console;
-
-    // cross-document messaging
-    [DoNotCheckSecurity, Custom, RaisesException] void postMessage(SerializedScriptValue message, DOMString targetOrigin, optional Array messagePorts);
-
-    [Replaceable] readonly attribute Performance performance;
-
-    [MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(RequestAnimationFrameCallback callback);
-    void cancelAnimationFrame(long id);
-    [MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(RequestAnimationFrameCallback callback);
-    [ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id);
-    [ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove this when removing vendor prefix.
-
-    [Replaceable] readonly attribute CSS CSS;
-
-    // Events
-    attribute EventHandler onabort;
-    attribute EventHandler onbeforeunload;
-    attribute EventHandler onblur;
-    attribute EventHandler oncanplay;
-    attribute EventHandler oncanplaythrough;
-    attribute EventHandler onchange;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onclick;
-    attribute EventHandler oncontextmenu;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondblclick;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondrag;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragend;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragenter;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragleave;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragover;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragstart;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondrop;
-    attribute EventHandler ondurationchange;
-    attribute EventHandler onemptied;
-    attribute EventHandler onended;
-    attribute EventHandler onerror;
-    attribute EventHandler onfocus;
-    attribute EventHandler onhashchange;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler oninput;
-    attribute EventHandler oninvalid;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeydown;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeypress;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeyup;
-    attribute EventHandler onload;
-    attribute EventHandler onloadeddata;
-    attribute EventHandler onloadedmetadata;
-    attribute EventHandler onloadstart;
-    attribute EventHandler onmessage;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousedown;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseenter;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseleave;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousemove;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseout;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseover;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseup;
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousewheel; // Deprecated in favor of onwheel.
-    [PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onwheel;
-    attribute EventHandler onoffline;
-    attribute EventHandler ononline;
-    attribute EventHandler onpagehide;
-    attribute EventHandler onpageshow;
-    attribute EventHandler onpause;
-    attribute EventHandler onplay;
-    attribute EventHandler onplaying;
-    attribute EventHandler onpopstate;
-    attribute EventHandler onprogress;
-    attribute EventHandler onratechange;
-    attribute EventHandler onresize;
-    attribute EventHandler onscroll;
-    attribute EventHandler onseeked;
-    attribute EventHandler onseeking;
-    attribute EventHandler onselect;
-    attribute EventHandler onstalled;
-    attribute EventHandler onstorage;
-    attribute EventHandler onsubmit;
-    attribute EventHandler onsuspend;
-    attribute EventHandler ontimeupdate;
-    attribute EventHandler onunload;
-    attribute EventHandler onvolumechange;
-    attribute EventHandler onwaiting;
-
-    // Not implemented yet.
-    // attribute EventHandler onafterprint;
-    // attribute EventHandler onbeforeprint;
-    // attribute EventHandler onreadystatechange;
-    // attribute EventHandler onredo;
-    // attribute EventHandler onshow;
-    // attribute EventHandler onundo;
-
-    // Webkit extensions
-    attribute EventHandler onreset;
-    attribute EventHandler onsearch;
-    [EnabledAtRuntime=CSSAnimationUnprefixed] attribute EventHandler onanimationend;
-    [EnabledAtRuntime=CSSAnimationUnprefixed] attribute EventHandler onanimationiteration;
-    [EnabledAtRuntime=CSSAnimationUnprefixed] attribute EventHandler onanimationstart;
-    attribute EventHandler onwebkitanimationend;
-    attribute EventHandler onwebkitanimationiteration;
-    attribute EventHandler onwebkitanimationstart;
-    attribute EventHandler onwebkittransitionend;
-    attribute EventHandler ontransitionend;
-    [Conditional=ORIENTATION_EVENTS] attribute EventHandler onorientationchange;
-    [EnabledAtRuntime=Touch] attribute EventHandler ontouchstart;
-    [EnabledAtRuntime=Touch] attribute EventHandler ontouchmove;
-    [EnabledAtRuntime=Touch] attribute EventHandler ontouchend;
-    [EnabledAtRuntime=Touch] attribute EventHandler ontouchcancel;
-
-    [EnabledAtRuntime=DeviceMotion] attribute EventHandler ondevicemotion;
-    [EnabledAtRuntime=DeviceOrientation] attribute EventHandler ondeviceorientation;
-
-    [DeprecateAs=CaptureEvents] void captureEvents();
-    [DeprecateAs=ReleaseEvents] void releaseEvents();
-
-    // Additional constructors.
-    attribute TransitionEventConstructor WebKitTransitionEvent;
-    [EnabledAtRuntime=CSSAnimationUnprefixed] attribute WebKitAnimationEventConstructor AnimationEvent;
-    [CustomConstructor] attribute HTMLImageElementConstructorConstructor Image; // Usable with new operator
-    // Mozilla has a separate XMLDocument object for XML documents.
-    // We just use Document for this.
-    attribute DocumentConstructor XMLDocument;
-    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;
-    attribute IDBFactoryConstructor webkitIDBFactory;
-    attribute IDBIndexConstructor webkitIDBIndex;
-    attribute IDBKeyRangeConstructor webkitIDBKeyRange;
-    attribute IDBObjectStoreConstructor webkitIDBObjectStore;
-    attribute IDBRequestConstructor webkitIDBRequest;
-    attribute IDBTransactionConstructor webkitIDBTransaction;
-
-    // Constructors whose name does not match the interface name.
-    // FIXME: Remove these once [ImplementedAs] is used and once constructor names match interface names.
-    [EnabledAtRuntime=MediaStream] attribute MediaStreamConstructor webkitMediaStream;
-    [Conditional=WEB_AUDIO, EnabledAtRuntime=WebAudio] attribute AudioContextConstructor webkitAudioContext;
-    [Conditional=WEB_AUDIO, EnabledAtRuntime=WebAudio] attribute OfflineAudioContextConstructor webkitOfflineAudioContext;
-    [EnabledAtRuntime=PeerConnection] attribute RTCPeerConnectionConstructor webkitRTCPeerConnection;
-    [EnabledAtRuntime=ScriptedSpeech] attribute SpeechGrammarConstructor webkitSpeechGrammar;
-    [EnabledAtRuntime=ScriptedSpeech] attribute SpeechGrammarListConstructor webkitSpeechGrammarList;
-    [EnabledAtRuntime=ScriptedSpeech] attribute SpeechRecognitionConstructor webkitSpeechRecognition;
-    [EnabledAtRuntime=ScriptedSpeech] attribute SpeechRecognitionErrorConstructor webkitSpeechRecognitionError;
-    [EnabledAtRuntime=ScriptedSpeech] attribute SpeechRecognitionEventConstructor webkitSpeechRecognitionEvent;
-    [Conditional=WEB_AUDIO] attribute PannerNodeConstructor webkitAudioPannerNode;
-
-    // Prefixed ShadowRoot constructor should be phased out eventually, but for the moment it must be always exposed.
-    // Unprefixed ShadowRoot constructor should be visible when the feature flag is enabled.
-    // FIXME: When it's ready to remove WebKitShadowRoot, get rid of both constructors from Window.idl and remove
-    // [NoInterfaceObject] from ShadowRoot interface definition.
-    [EnabledAtRuntime=ShadowDOM] attribute ShadowRootConstructor ShadowRoot;
-    [MeasureAs=PrefixedShadowRootConstructor] attribute ShadowRootConstructor WebKitShadowRoot;
-
-    // window.toString() requires special handling in V8
-    [DoNotCheckSignature, DoNotCheckSecurity, Custom, NotEnumerable] DOMString toString();
-
-    [ImplementedAs=anonymousIndexedGetter, NotEnumerable] getter Window(unsigned long index);
-    [Custom, NotEnumerable] getter Window (DOMString name);
-};
-
-Window implements ImageBitmapFactories;
-Window implements WindowTimers;
-Window implements WindowBase64;
diff --git a/Source/core/page/WindowFeatures.cpp b/Source/core/page/WindowFeatures.cpp
index 8614ea0..3796f0b 100644
--- a/Source/core/page/WindowFeatures.cpp
+++ b/Source/core/page/WindowFeatures.cpp
@@ -23,7 +23,7 @@
 #include "config.h"
 #include "core/page/WindowFeatures.h"
 
-#include "core/platform/graphics/FloatRect.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/Assertions.h"
 #include "wtf/MathExtras.h"
 #include "wtf/text/StringHash.h"
diff --git a/Source/core/page/WindowPagePopup.idl b/Source/core/page/WindowPagePopup.idl
index 0ae9bbe..e7ef1eb 100644
--- a/Source/core/page/WindowPagePopup.idl
+++ b/Source/core/page/WindowPagePopup.idl
@@ -29,8 +29,8 @@
  */
 
 [
-    EnabledAtRuntime=PagePopup,
+    RuntimeEnabled=PagePopup,
     ImplementedAs=DOMWindowPagePopup
 ] partial interface Window {
-    [EnabledPerContext=pagePopup] readonly attribute PagePopupController pagePopupController;
+    [PerContextEnabled=pagePopup] readonly attribute PagePopupController pagePopupController;
 };
diff --git a/Source/core/page/WorkerNavigator.cpp b/Source/core/page/WorkerNavigator.cpp
deleted file mode 100644
index 76d5058..0000000
--- a/Source/core/page/WorkerNavigator.cpp
+++ /dev/null
@@ -1,48 +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 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,
- * 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/page/WorkerNavigator.h"
-
-namespace WebCore {
-
-WorkerNavigator::WorkerNavigator(const String& userAgent)
-    : m_userAgent(userAgent)
-{
-    ScriptWrappable::init(this);
-}
-
-WorkerNavigator::~WorkerNavigator()
-{
-}
-
-String WorkerNavigator::userAgent() const
-{
-    return m_userAgent;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/WorkerNavigator.h b/Source/core/page/WorkerNavigator.h
deleted file mode 100644
index 710f307..0000000
--- a/Source/core/page/WorkerNavigator.h
+++ /dev/null
@@ -1,53 +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 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,
- * 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 WorkerNavigator_h
-#define WorkerNavigator_h
-
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/page/NavigatorBase.h"
-#include "core/platform/Supplementable.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class WorkerNavigator : public RefCounted<WorkerNavigator>, public ScriptWrappable, public NavigatorBase, public Supplementable<WorkerNavigator> {
-public:
-    static PassRefPtr<WorkerNavigator> create(const String& userAgent) { return adoptRef(new WorkerNavigator(userAgent)); }
-    virtual ~WorkerNavigator();
-
-    virtual String userAgent() const OVERRIDE;
-
-private:
-    explicit WorkerNavigator(const String&);
-
-    String m_userAgent;
-};
-
-} // namespace WebCore
-
-#endif // WorkerNavigator_h
diff --git a/Source/core/page/animation/AnimationBase.cpp b/Source/core/page/animation/AnimationBase.cpp
deleted file mode 100644
index f5dd049..0000000
--- a/Source/core/page/animation/AnimationBase.cpp
+++ /dev/null
@@ -1,594 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2009 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.
- * 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.
- *
- * 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/page/animation/AnimationBase.h"
-
-#include "core/page/animation/AnimationControllerPrivate.h"
-#include "core/page/animation/CompositeAnimation.h"
-#include "core/platform/animation/AnimationUtilities.h"
-#include "core/platform/animation/TimingFunction.h"
-#include "core/rendering/RenderBox.h"
-#include <algorithm>
-
-using namespace std;
-
-namespace WebCore {
-
-AnimationBase::AnimationBase(const CSSAnimationData* transition, RenderObject* renderer, CompositeAnimation* compAnim)
-    : m_animState(AnimationStateNew)
-    , m_isAccelerated(false)
-    , m_transformFunctionListValid(false)
-    , m_filterFunctionListsMatch(false)
-    , m_startTime(0)
-    , m_pauseTime(-1)
-    , m_requestedStartTime(0)
-    , m_totalDuration(-1)
-    , m_nextIterationDuration(-1)
-    , m_object(renderer)
-    , m_animation(const_cast<CSSAnimationData*>(transition))
-    , m_compAnim(compAnim)
-{
-    // Compute the total duration
-    if (m_animation->iterationCount() > 0)
-        m_totalDuration = m_animation->duration() * m_animation->iterationCount();
-}
-
-void AnimationBase::setNeedsStyleRecalc(Node* node)
-{
-    if (node)
-        node->setNeedsStyleRecalc(LocalStyleChange);
-}
-
-double AnimationBase::duration() const
-{
-    return m_animation->duration();
-}
-
-bool AnimationBase::playStatePlaying() const
-{
-    return m_animation->playState() == AnimPlayStatePlaying;
-}
-
-void AnimationBase::updateStateMachine(AnimStateInput input, double param)
-{
-    if (!m_compAnim)
-        return;
-
-    // If we get AnimationStateInputRestartAnimation then we force a new animation, regardless of state.
-    if (input == AnimationStateInputMakeNew) {
-        if (m_animState == AnimationStateStartWaitStyleAvailable)
-            m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
-        m_animState = AnimationStateNew;
-        m_startTime = 0;
-        m_pauseTime = -1;
-        m_requestedStartTime = 0;
-        m_nextIterationDuration = -1;
-        endAnimation();
-        return;
-    }
-
-    if (input == AnimationStateInputRestartAnimation) {
-        if (m_animState == AnimationStateStartWaitStyleAvailable)
-            m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
-        m_animState = AnimationStateNew;
-        m_startTime = 0;
-        m_pauseTime = -1;
-        m_requestedStartTime = 0;
-        m_nextIterationDuration = -1;
-        endAnimation();
-
-        if (!paused())
-            updateStateMachine(AnimationStateInputStartAnimation, -1);
-        return;
-    }
-
-    if (input == AnimationStateInputEndAnimation) {
-        if (m_animState == AnimationStateStartWaitStyleAvailable)
-            m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
-        m_animState = AnimationStateDone;
-        endAnimation();
-        return;
-    }
-
-    if (input == AnimationStateInputPauseOverride) {
-        if (m_animState == AnimationStateStartWaitResponse) {
-            // If we are in AnimationStateStartWaitResponse, the animation will get canceled before
-            // we get a response, so move to the next state.
-            endAnimation();
-            updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
-        }
-        return;
-    }
-
-    if (input == AnimationStateInputResumeOverride) {
-        if (m_animState == AnimationStateLooping || m_animState == AnimationStateEnding) {
-            // Start the animation
-            startAnimation(beginAnimationUpdateTime() - m_startTime);
-        }
-        return;
-    }
-
-    // Execute state machine
-    switch (m_animState) {
-        case AnimationStateNew:
-            ASSERT(input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning || input == AnimationStateInputPlayStatePaused);
-            if (input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning) {
-                m_requestedStartTime = beginAnimationUpdateTime();
-                m_animState = AnimationStateStartWaitTimer;
-            }
-            break;
-        case AnimationStateStartWaitTimer:
-            ASSERT(input == AnimationStateInputStartTimerFired || input == AnimationStateInputPlayStatePaused);
-
-            if (input == AnimationStateInputStartTimerFired) {
-                ASSERT(param >= 0);
-                // Start timer has fired, tell the animation to start and wait for it to respond with start time
-                m_animState = AnimationStateStartWaitStyleAvailable;
-                m_compAnim->animationController()->addToAnimationsWaitingForStyle(this);
-
-                // Trigger a render so we can start the animation
-                if (m_object)
-                    m_compAnim->animationController()->addNodeChangeToDispatch(m_object->node());
-            } else {
-                ASSERT(!paused());
-                // We're waiting for the start timer to fire and we got a pause. Cancel the timer, pause and wait
-                m_pauseTime = beginAnimationUpdateTime();
-                m_animState = AnimationStatePausedWaitTimer;
-            }
-            break;
-        case AnimationStateStartWaitStyleAvailable:
-            ASSERT(input == AnimationStateInputStyleAvailable || input == AnimationStateInputPlayStatePaused);
-
-            if (input == AnimationStateInputStyleAvailable) {
-                // Start timer has fired, tell the animation to start and wait for it to respond with start time
-                m_animState = AnimationStateStartWaitResponse;
-
-                overrideAnimations();
-
-                // Start the animation
-                if (overridden()) {
-                    // We won't try to start accelerated animations if we are overridden and
-                    // just move on to the next state.
-                    m_animState = AnimationStateStartWaitResponse;
-                    m_isAccelerated = false;
-                    updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
-                } else {
-                    double timeOffset = 0;
-                    // If the value for 'animation-delay' is negative then the animation appears to have started in the past.
-                    if (m_animation->delay() < 0)
-                        timeOffset = -m_animation->delay();
-                    bool started = startAnimation(timeOffset);
-
-                    m_compAnim->animationController()->addToAnimationsWaitingForStartTimeResponse(this, started);
-                    m_isAccelerated = started;
-                }
-            } else {
-                // We're waiting for the style to be available and we got a pause. Pause and wait
-                m_pauseTime = beginAnimationUpdateTime();
-                m_animState = AnimationStatePausedWaitStyleAvailable;
-            }
-            break;
-        case AnimationStateStartWaitResponse:
-            ASSERT(input == AnimationStateInputStartTimeSet || input == AnimationStateInputPlayStatePaused);
-
-            if (input == AnimationStateInputStartTimeSet) {
-                ASSERT(param >= 0);
-                // We have a start time, set it, unless the startTime is already set
-                if (m_startTime <= 0) {
-                    m_startTime = param;
-                    // If the value for 'animation-delay' is negative then the animation appears to have started in the past.
-                    if (m_animation->delay() < 0)
-                        m_startTime += m_animation->delay();
-                }
-
-                // Now that we know the start time, fire the start event.
-                onAnimationStart(0); // The elapsedTime is 0.
-
-                // Decide whether to go into looping or ending state
-                goIntoEndingOrLoopingState();
-
-                // Dispatch updateStyleIfNeeded so we can start the animation
-                if (m_object)
-                    m_compAnim->animationController()->addNodeChangeToDispatch(m_object->node());
-            } else {
-                // We are pausing while waiting for a start response. Cancel the animation and wait. When
-                // we unpause, we will act as though the start timer just fired
-                m_pauseTime = beginAnimationUpdateTime();
-                pauseAnimation(beginAnimationUpdateTime() - m_startTime);
-                m_animState = AnimationStatePausedWaitResponse;
-            }
-            break;
-        case AnimationStateLooping:
-            ASSERT(input == AnimationStateInputLoopTimerFired || input == AnimationStateInputPlayStatePaused);
-
-            if (input == AnimationStateInputLoopTimerFired) {
-                ASSERT(param >= 0);
-                // Loop timer fired, loop again or end.
-                onAnimationIteration(param);
-
-                // Decide whether to go into looping or ending state
-                goIntoEndingOrLoopingState();
-            } else {
-                // We are pausing while running. Cancel the animation and wait
-                m_pauseTime = beginAnimationUpdateTime();
-                pauseAnimation(beginAnimationUpdateTime() - m_startTime);
-                m_animState = AnimationStatePausedRun;
-            }
-            break;
-        case AnimationStateEnding:
-#if !LOG_DISABLED
-            if (input != AnimationStateInputEndTimerFired && input != AnimationStateInputPlayStatePaused)
-                LOG_ERROR("State is AnimationStateEnding, but input is not AnimationStateInputEndTimerFired or AnimationStateInputPlayStatePaused. It is %d.", input);
-#endif
-            if (input == AnimationStateInputEndTimerFired) {
-
-                ASSERT(param >= 0);
-                // End timer fired, finish up
-                onAnimationEnd(param);
-
-                m_animState = AnimationStateDone;
-
-                if (m_object) {
-                    if (m_animation->fillsForwards())
-                        m_animState = AnimationStateFillingForwards;
-                    else
-                        resumeOverriddenAnimations();
-
-                    // Fire off another style change so we can set the final value
-                    m_compAnim->animationController()->addNodeChangeToDispatch(m_object->node());
-                }
-            } else {
-                // We are pausing while running. Cancel the animation and wait
-                m_pauseTime = beginAnimationUpdateTime();
-                pauseAnimation(beginAnimationUpdateTime() - m_startTime);
-                m_animState = AnimationStatePausedRun;
-            }
-            // |this| may be deleted here
-            break;
-        case AnimationStatePausedWaitTimer:
-            ASSERT(input == AnimationStateInputPlayStateRunning);
-            ASSERT(paused());
-            // Update the times
-            m_startTime += beginAnimationUpdateTime() - m_pauseTime;
-            m_pauseTime = -1;
-
-            // we were waiting for the start timer to fire, go back and wait again
-            m_animState = AnimationStateNew;
-            updateStateMachine(AnimationStateInputStartAnimation, 0);
-            break;
-        case AnimationStatePausedWaitResponse:
-        case AnimationStatePausedWaitStyleAvailable:
-        case AnimationStatePausedRun:
-            // We treat these two cases the same. The only difference is that, when we are in
-            // AnimationStatePausedWaitResponse, we don't yet have a valid startTime, so we send 0 to startAnimation.
-            // When the AnimationStateInputStartTimeSet comes in and we were in AnimationStatePausedRun, we will notice
-            // that we have already set the startTime and will ignore it.
-            ASSERT(input == AnimationStateInputPlayStateRunning || input == AnimationStateInputStartTimeSet || input == AnimationStateInputStyleAvailable);
-            ASSERT(paused());
-
-            if (input == AnimationStateInputPlayStateRunning) {
-                // Update the times
-                if (m_animState == AnimationStatePausedRun)
-                    m_startTime += beginAnimationUpdateTime() - m_pauseTime;
-                else
-                    m_startTime = 0;
-                m_pauseTime = -1;
-
-                if (m_animState == AnimationStatePausedWaitStyleAvailable)
-                    m_animState = AnimationStateStartWaitStyleAvailable;
-                else {
-                    // We were either running or waiting for a begin time response from the animation.
-                    // Either way we need to restart the animation (possibly with an offset if we
-                    // had already been running) and wait for it to start.
-                    m_animState = AnimationStateStartWaitResponse;
-
-                    // Start the animation
-                    if (overridden()) {
-                        // We won't try to start accelerated animations if we are overridden and
-                        // just move on to the next state.
-                        updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
-                        m_isAccelerated = true;
-                    } else {
-                        bool started = startAnimation(beginAnimationUpdateTime() - m_startTime);
-                        m_compAnim->animationController()->addToAnimationsWaitingForStartTimeResponse(this, started);
-                        m_isAccelerated = started;
-                    }
-                }
-                break;
-            }
-
-            if (input == AnimationStateInputStartTimeSet) {
-                ASSERT(m_animState == AnimationStatePausedWaitResponse);
-
-                // We are paused but we got the callback that notifies us that an accelerated animation started.
-                // We ignore the start time and just move into the paused-run state.
-                m_animState = AnimationStatePausedRun;
-                ASSERT(m_startTime == 0);
-                m_startTime = param;
-                m_pauseTime += m_startTime;
-                break;
-            }
-
-            ASSERT(m_animState == AnimationStatePausedWaitStyleAvailable);
-            // We are paused but we got the callback that notifies us that style has been updated.
-            // We move to the AnimationStatePausedWaitResponse state
-            m_animState = AnimationStatePausedWaitResponse;
-            overrideAnimations();
-            break;
-        case AnimationStateFillingForwards:
-        case AnimationStateDone:
-            // We're done. Stay in this state until we are deleted
-            break;
-    }
-}
-
-void AnimationBase::fireAnimationEventsIfNeeded()
-{
-    if (!m_compAnim)
-        return;
-
-    // If we are waiting for the delay time to expire and it has, go to the next state
-    if (m_animState != AnimationStateStartWaitTimer && m_animState != AnimationStateLooping && m_animState != AnimationStateEnding)
-        return;
-
-    // We have to make sure to keep a ref to the this pointer, because it could get destroyed
-    // during an animation callback that might get called. Since the owner is a CompositeAnimation
-    // and it ref counts this object, we will keep a ref to that instead. That way the AnimationBase
-    // can still access the resources of its CompositeAnimation as needed.
-    RefPtr<AnimationBase> protector(this);
-    RefPtr<CompositeAnimation> compProtector(m_compAnim);
-
-    // Check for start timeout
-    if (m_animState == AnimationStateStartWaitTimer) {
-        if (beginAnimationUpdateTime() - m_requestedStartTime >= m_animation->delay())
-            updateStateMachine(AnimationStateInputStartTimerFired, 0);
-        return;
-    }
-
-    double elapsedDuration = getElapsedTime();
-
-    // Check for end timeout
-    if (m_totalDuration >= 0 && elapsedDuration >= m_totalDuration) {
-        // We may still be in AnimationStateLooping if we've managed to skip a
-        // whole iteration, in which case we should jump to the end state.
-        m_animState = AnimationStateEnding;
-
-        // Fire an end event
-        updateStateMachine(AnimationStateInputEndTimerFired, m_totalDuration);
-    } else {
-        // Check for iteration timeout
-        if (m_nextIterationDuration < 0) {
-            // Hasn't been set yet, set it
-            double durationLeft = m_animation->duration() - fmod(elapsedDuration, m_animation->duration());
-            m_nextIterationDuration = elapsedDuration + durationLeft;
-        }
-
-        if (elapsedDuration >= m_nextIterationDuration) {
-            // Set to the next iteration
-            double previous = m_nextIterationDuration;
-            double durationLeft = m_animation->duration() - fmod(elapsedDuration, m_animation->duration());
-            m_nextIterationDuration = elapsedDuration + durationLeft;
-
-            // Send the event
-            updateStateMachine(AnimationStateInputLoopTimerFired, previous);
-        }
-    }
-}
-
-void AnimationBase::updatePlayState(EAnimPlayState playState)
-{
-    if (!m_compAnim)
-        return;
-
-    // When we get here, we can have one of 4 desired states: running, paused, suspended, paused & suspended.
-    // The state machine can be in one of two states: running, paused.
-    // Set the state machine to the desired state.
-    bool pause = playState == AnimPlayStatePaused || m_compAnim->suspended();
-
-    if (pause == paused() && !isNew())
-        return;
-
-    updateStateMachine(pause ?  AnimationStateInputPlayStatePaused : AnimationStateInputPlayStateRunning, -1);
-}
-
-double AnimationBase::timeToNextService()
-{
-    // Returns the time at which next service is required. -1 means no service is required. 0 means
-    // service is required now, and > 0 means service is required that many seconds in the future.
-    if (paused() || isNew() || m_animState == AnimationStateFillingForwards)
-        return -1;
-
-    if (m_animState == AnimationStateStartWaitTimer) {
-        double timeFromNow = m_animation->delay() - (beginAnimationUpdateTime() - m_requestedStartTime);
-        return max(timeFromNow, 0.0);
-    }
-
-    fireAnimationEventsIfNeeded();
-
-    // In all other cases, we need service right away.
-    return 0;
-}
-
-// Compute the fractional time, taking into account direction.
-// There is no need to worry about iterations, we assume that we would have
-// short circuited above if we were done.
-
-double AnimationBase::fractionalTime(double scale, double elapsedTime, double offset) const
-{
-    double fractionalTime = m_animation->duration() ? (elapsedTime / m_animation->duration()) : 1;
-    // FIXME: startTime can be before the current animation "frame" time. This is to sync with the frame time
-    // concept in AnimationTimeController. So we need to somehow sync the two. Until then, the possible
-    // error is small and will probably not be noticeable. Until we fix this, remove the assert.
-    // https://bugs.webkit.org/show_bug.cgi?id=52037
-    // ASSERT(fractionalTime >= 0);
-    if (fractionalTime < 0)
-        fractionalTime = 0;
-
-    int integralTime = static_cast<int>(fractionalTime);
-    const int integralIterationCount = static_cast<int>(m_animation->iterationCount());
-    const bool iterationCountHasFractional = m_animation->iterationCount() - integralIterationCount;
-    if (m_animation->iterationCount() != CSSAnimationData::IterationCountInfinite && !iterationCountHasFractional)
-        integralTime = min(integralTime, integralIterationCount - 1);
-
-    fractionalTime -= integralTime;
-
-    // Thie method can be called with an elapsedTime which very slightly
-    // exceeds the end of the animation. In this case, clamp the
-    // fractionalTime.
-    if (fractionalTime > 1)
-        fractionalTime = 1;
-    ASSERT(fractionalTime >= 0 && fractionalTime <= 1);
-
-    if (((m_animation->direction() == CSSAnimationData::AnimationDirectionAlternate) && (integralTime & 1))
-        || ((m_animation->direction() == CSSAnimationData::AnimationDirectionAlternateReverse) && !(integralTime & 1))
-        || m_animation->direction() == CSSAnimationData::AnimationDirectionReverse)
-        fractionalTime = 1 - fractionalTime;
-
-    fractionalTime -= offset;
-    // Note that if fractionalTime == 0 here, scale may be infinity, but in
-    // this case we don't need to apply scale anyway.
-    if (scale != 1.0 && fractionalTime) {
-        ASSERT(scale >= 0 && !std::isinf(scale));
-        fractionalTime *= scale;
-    }
-
-    ASSERT(fractionalTime >= 0 && fractionalTime <= 1);
-    return fractionalTime;
-}
-
-double AnimationBase::progress(double scale, double offset, const TimingFunction* timingFunction) const
-{
-    if (preActive())
-        return 0;
-
-    double dur = m_animation->duration();
-    if (m_animation->iterationCount() > 0)
-        dur *= m_animation->iterationCount();
-
-    if (postActive() || !m_animation->duration())
-        return 1.0;
-
-    double elapsedTime = getElapsedTime();
-    if (m_animation->iterationCount() > 0 && elapsedTime >= dur) {
-        const int integralIterationCount = static_cast<int>(m_animation->iterationCount());
-        const bool iterationCountHasFractional = m_animation->iterationCount() - integralIterationCount;
-        return (integralIterationCount % 2 || iterationCountHasFractional) ? 1.0 : 0.0;
-    }
-
-    const double fractionalTime = this->fractionalTime(scale, elapsedTime, offset);
-
-    if (!timingFunction)
-        timingFunction = m_animation->timingFunction();
-
-    return timingFunction->evaluate(fractionalTime, accuracyForDuration(m_animation->duration()));
-}
-
-void AnimationBase::getTimeToNextEvent(double& time, bool& isLooping) const
-{
-    if (postActive()) {
-        time = -1;
-        isLooping = false;
-        return;
-    }
-
-    // Decide when the end or loop event needs to fire
-    const double elapsedDuration = getElapsedTime();
-    double durationLeft = 0;
-    double nextIterationTime = m_totalDuration;
-
-    if (m_totalDuration < 0 || elapsedDuration < m_totalDuration) {
-        durationLeft = m_animation->duration() > 0 ? (m_animation->duration() - fmod(elapsedDuration, m_animation->duration())) : 0;
-        nextIterationTime = elapsedDuration + durationLeft;
-    }
-
-    if (m_totalDuration < 0 || nextIterationTime < m_totalDuration) {
-        // We are not at the end yet
-        ASSERT(nextIterationTime > 0);
-        isLooping = true;
-    } else {
-        // We are at the end
-        isLooping = false;
-    }
-
-    time = durationLeft;
-}
-
-void AnimationBase::goIntoEndingOrLoopingState()
-{
-    double t;
-    bool isLooping;
-    getTimeToNextEvent(t, isLooping);
-    m_animState = isLooping ? AnimationStateLooping : AnimationStateEnding;
-}
-
-void AnimationBase::freezeAtTime(double t)
-{
-    if (!m_compAnim)
-        return;
-
-    if (!m_startTime) {
-        // If we haven't started yet, make it as if we started.
-        m_animState = AnimationStateStartWaitResponse;
-        onAnimationStartResponse(beginAnimationUpdateTime());
-    }
-
-    ASSERT(m_startTime);        // if m_startTime is zero, we haven't started yet, so we'll get a bad pause time.
-    if (t <= m_animation->delay())
-        m_pauseTime = m_startTime;
-    else
-        m_pauseTime = m_startTime + t - m_animation->delay();
-
-    if (m_object && m_object->isComposited())
-        toRenderBoxModelObject(m_object)->suspendAnimations(m_pauseTime);
-}
-
-double AnimationBase::beginAnimationUpdateTime() const
-{
-    if (!m_compAnim)
-        return 0;
-
-    return m_compAnim->animationController()->beginAnimationUpdateTime();
-}
-
-double AnimationBase::getElapsedTime() const
-{
-    ASSERT(!postActive());
-    if (paused())
-        return m_pauseTime - m_startTime;
-    if (m_startTime <= 0)
-        return 0;
-
-    double elapsedTime = beginAnimationUpdateTime() - m_startTime;
-    // It's possible for the start time to be ahead of the last update time
-    // if the compositor has just sent notification for the start of an
-    // accelerated animation.
-    return max(elapsedTime, 0.0);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/animation/AnimationBase.h b/Source/core/page/animation/AnimationBase.h
deleted file mode 100644
index 29cdb42..0000000
--- a/Source/core/page/animation/AnimationBase.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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 AnimationBase_h
-#define AnimationBase_h
-
-#include "CSSPropertyNames.h"
-#include "core/platform/animation/CSSAnimationData.h"
-#include "core/rendering/style/RenderStyleConstants.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class AnimationBase;
-class AnimationController;
-class CompositeAnimation;
-class Element;
-class Node;
-class RenderObject;
-class RenderStyle;
-class TimingFunction;
-
-class AnimationBase : public RefCounted<AnimationBase> {
-    friend class CompositeAnimation;
-    friend class CSSPropertyAnimation;
-
-public:
-    AnimationBase(const CSSAnimationData* transition, RenderObject* renderer, CompositeAnimation* compAnim);
-    virtual ~AnimationBase() { }
-
-    RenderObject* renderer() const { return m_object; }
-    void clear()
-    {
-      endAnimation();
-      m_object = 0;
-      m_compAnim = 0;
-    }
-
-    double duration() const;
-
-    // Animations and Transitions go through the states below. When entering the STARTED state
-    // the animation is started. This may or may not require deferred response from the animator.
-    // If so, we stay in this state until that response is received (and it returns the start time).
-    // Otherwise, we use the current time as the start time and go immediately to AnimationStateLooping
-    // or AnimationStateEnding.
-    enum AnimState {
-        AnimationStateNew,                  // animation just created, animation not running yet
-        AnimationStateStartWaitTimer,       // start timer running, waiting for fire
-        AnimationStateStartWaitStyleAvailable,   // waiting for style setup so we can start animations
-        AnimationStateStartWaitResponse,    // animation started, waiting for response
-        AnimationStateLooping,              // response received, animation running, loop timer running, waiting for fire
-        AnimationStateEnding,               // received, animation running, end timer running, waiting for fire
-        AnimationStatePausedWaitTimer,      // in pause mode when animation started
-        AnimationStatePausedWaitStyleAvailable, // in pause mode when waiting for style setup
-        AnimationStatePausedWaitResponse,   // animation paused when in STARTING state
-        AnimationStatePausedRun,            // animation paused when in LOOPING or ENDING state
-        AnimationStateDone,                 // end timer fired, animation finished and removed
-        AnimationStateFillingForwards       // animation has ended and is retaining its final value
-    };
-
-    enum AnimStateInput {
-        AnimationStateInputMakeNew,           // reset back to new from any state
-        AnimationStateInputStartAnimation,    // animation requests a start
-        AnimationStateInputRestartAnimation,  // force a restart from any state
-        AnimationStateInputStartTimerFired,   // start timer fired
-        AnimationStateInputStyleAvailable,    // style is setup, ready to start animating
-        AnimationStateInputStartTimeSet,      // m_startTime was set
-        AnimationStateInputLoopTimerFired,    // loop timer fired
-        AnimationStateInputEndTimerFired,     // end timer fired
-        AnimationStateInputPauseOverride,     // pause an animation due to override
-        AnimationStateInputResumeOverride,    // resume an overridden animation
-        AnimationStateInputPlayStateRunning,  // play state paused -> running
-        AnimationStateInputPlayStatePaused,   // play state running -> paused
-        AnimationStateInputEndAnimation       // force an end from any state
-    };
-
-    // Called when animation is in AnimationStateNew to start animation
-    void updateStateMachine(AnimStateInput, double param);
-
-    // Animation has actually started, at passed time
-    void onAnimationStartResponse(double startTime)
-    {
-        updateStateMachine(AnimationBase::AnimationStateInputStartTimeSet, startTime);
-    }
-
-    // Called to change to or from paused state
-    void updatePlayState(EAnimPlayState);
-    bool playStatePlaying() const;
-
-    bool waitingToStart() const { return m_animState == AnimationStateNew || m_animState == AnimationStateStartWaitTimer; }
-    bool preActive() const
-    {
-        return m_animState == AnimationStateNew || m_animState == AnimationStateStartWaitTimer || m_animState == AnimationStateStartWaitStyleAvailable || m_animState == AnimationStateStartWaitResponse;
-    }
-
-    bool postActive() const { return m_animState == AnimationStateDone; }
-    bool active() const { return !postActive() && !preActive(); }
-    bool running() const { return !isNew() && !postActive(); }
-    bool paused() const { return m_pauseTime >= 0; }
-    bool isNew() const { return m_animState == AnimationStateNew; }
-    bool waitingForStartTime() const { return m_animState == AnimationStateStartWaitResponse; }
-    bool waitingForStyleAvailable() const { return m_animState == AnimationStateStartWaitStyleAvailable; }
-
-    virtual double timeToNextService();
-
-    double progress(double scale, double offset, const TimingFunction*) const;
-
-    virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle* /*currentStyle*/, RenderStyle* /*targetStyle*/, RefPtr<RenderStyle>& /*animatedStyle*/) = 0;
-    virtual void getAnimatedStyle(RefPtr<RenderStyle>& /*animatedStyle*/) = 0;
-
-    virtual bool shouldFireEvents() const { return false; }
-
-    void fireAnimationEventsIfNeeded();
-
-    void setAnimation(const CSSAnimationData* anim) { m_animation = const_cast<CSSAnimationData*>(anim); }
-
-    // Return true if this animation is overridden. This will only be the case for
-    // ImplicitAnimations and is used to determine whether or not we should force
-    // set the start time. If an animation is overridden, it will probably not get
-    // back the AnimationStateInputStartTimeSet input.
-    virtual bool overridden() const { return false; }
-
-    // Does this animation/transition involve the given property?
-    virtual bool affectsProperty(CSSPropertyID /*property*/) const { return false; }
-
-    bool isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, bool isRunningNow) const
-    {
-        if (acceleratedOnly && !m_isAccelerated)
-            return false;
-
-        if (isRunningNow)
-            return (!waitingToStart() && !postActive()) && affectsProperty(property);
-
-        return !postActive() && affectsProperty(property);
-    }
-
-    // FIXME: rename this using the "lists match" terminology.
-    bool isTransformFunctionListValid() const { return m_transformFunctionListValid; }
-    bool filterFunctionListsMatch() const { return m_filterFunctionListsMatch; }
-
-    // Freeze the animation; used by DumpRenderTree.
-    void freezeAtTime(double t);
-
-    double beginAnimationUpdateTime() const;
-
-    double getElapsedTime() const;
-
-    void styleAvailable()
-    {
-        ASSERT(waitingForStyleAvailable());
-        updateStateMachine(AnimationBase::AnimationStateInputStyleAvailable, -1);
-    }
-
-    const CSSAnimationData* animation() const { return m_animation.get(); }
-
-protected:
-    virtual void overrideAnimations() { }
-    virtual void resumeOverriddenAnimations() { }
-
-    CompositeAnimation* compositeAnimation() { return m_compAnim; }
-
-    // These are called when the corresponding timer fires so subclasses can do any extra work
-    virtual void onAnimationStart(double /*elapsedTime*/) { }
-    virtual void onAnimationIteration(double /*elapsedTime*/) { }
-    virtual void onAnimationEnd(double /*elapsedTime*/) { }
-
-    // timeOffset is an offset from the current time when the animation should start. Negative values are OK.
-    // Return value indicates whether to expect an asynchronous notifyAnimationStarted() callback.
-    virtual bool startAnimation(double /*timeOffset*/) { return false; }
-    // timeOffset is the time at which the animation is being paused.
-    virtual void pauseAnimation(double /*timeOffset*/) { }
-    virtual void endAnimation() { }
-
-    void goIntoEndingOrLoopingState();
-
-    bool isAccelerated() const { return m_isAccelerated; }
-
-    static void setNeedsStyleRecalc(Node*);
-
-    void getTimeToNextEvent(double& time, bool& isLooping) const;
-
-    double fractionalTime(double scale, double elapsedTime, double offset) const;
-
-    AnimState m_animState;
-
-    bool m_isAccelerated;
-    bool m_transformFunctionListValid;
-    bool m_filterFunctionListsMatch;
-    double m_startTime;
-    double m_pauseTime;
-    double m_requestedStartTime;
-
-    double m_totalDuration;
-    double m_nextIterationDuration;
-
-    RenderObject* m_object;
-
-    RefPtr<CSSAnimationData> m_animation;
-    CompositeAnimation* m_compAnim;
-};
-
-} // namespace WebCore
-
-#endif // AnimationBase_h
diff --git a/Source/core/page/animation/AnimationController.cpp b/Source/core/page/animation/AnimationController.cpp
deleted file mode 100644
index b313e7c..0000000
--- a/Source/core/page/animation/AnimationController.cpp
+++ /dev/null
@@ -1,615 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2009 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.
- * 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.
- *
- * 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/page/animation/AnimationController.h"
-
-#include "core/events/EventNames.h"
-#include "core/dom/PseudoElement.h"
-#include "core/events/TransitionEvent.h"
-#include "core/events/WebKitAnimationEvent.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
-#include "core/page/Page.h"
-#include "core/page/animation/AnimationBase.h"
-#include "core/page/animation/AnimationControllerPrivate.h"
-#include "core/page/animation/CSSPropertyAnimation.h"
-#include "core/page/animation/CompositeAnimation.h"
-#include "core/rendering/RenderView.h"
-#include "wtf/CurrentTime.h"
-
-namespace WebCore {
-
-static const double cBeginAnimationUpdateTimeNotSet = -1;
-
-AnimationControllerPrivate::AnimationControllerPrivate(Frame* frame)
-    : m_animationTimer(this, &AnimationControllerPrivate::animationTimerFired)
-    , m_updateStyleIfNeededDispatcher(this, &AnimationControllerPrivate::updateStyleIfNeededDispatcherFired)
-    , m_frame(frame)
-    , m_beginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet)
-    , m_animationsWaitingForStyle()
-    , m_animationsWaitingForStartTimeResponse()
-    , m_waitingForAsyncStartNotification(false)
-{
-}
-
-AnimationControllerPrivate::~AnimationControllerPrivate()
-{
-}
-
-PassRefPtr<CompositeAnimation> AnimationControllerPrivate::accessCompositeAnimation(RenderObject* renderer)
-{
-    RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer);
-    if (!animation) {
-        animation = CompositeAnimation::create(this);
-        m_compositeAnimations.set(renderer, animation);
-    }
-    return animation;
-}
-
-bool AnimationControllerPrivate::clear(RenderObject* renderer)
-{
-    // Return false if we didn't do anything OR we are suspended (so we don't try to
-    // do a setNeedsStyleRecalc() when suspended).
-    PassRefPtr<CompositeAnimation> animation = m_compositeAnimations.take(renderer);
-    if (!animation)
-        return false;
-    animation->clearRenderer();
-    return animation->suspended();
-}
-
-void AnimationControllerPrivate::updateAnimations(double& timeToNextService, double& timeToNextEvent, SetNeedsStyleRecalc callSetNeedsStyleRecalc/* = DoNotCallSetNeedsStyleRecalc*/)
-{
-    double minTimeToNextService = -1;
-    double minTimeToNextEvent = -1;
-    bool updateStyleNeeded = false;
-
-    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
-    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
-        CompositeAnimation* compAnim = it->value.get();
-        if (!compAnim->suspended() && compAnim->hasAnimations()) {
-            double t = compAnim->timeToNextService();
-            if (t != -1 && (t < minTimeToNextService || minTimeToNextService == -1))
-                minTimeToNextService = t;
-            double nextEvent = compAnim->timeToNextEvent();
-            if (nextEvent != -1 && (nextEvent < minTimeToNextEvent || minTimeToNextEvent == -1))
-                minTimeToNextEvent = nextEvent;
-            if (callSetNeedsStyleRecalc == CallSetNeedsStyleRecalc) {
-                if (!t) {
-                    Node* node = it->key->node();
-                    node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
-                    updateStyleNeeded = true;
-                }
-            } else if (!minTimeToNextService && !minTimeToNextEvent) {
-                // Found the minimum values and do not need to mark for style recalc.
-                break;
-            }
-        }
-    }
-
-    if (updateStyleNeeded)
-        m_frame->document()->updateStyleIfNeeded();
-
-    timeToNextService = minTimeToNextService;
-    timeToNextEvent = minTimeToNextEvent;
-}
-
-void AnimationControllerPrivate::scheduleServiceForRenderer(RenderObject* renderer)
-{
-    double timeToNextService = -1;
-    double timeToNextEvent = -1;
-
-    RefPtr<CompositeAnimation> compAnim = m_compositeAnimations.get(renderer);
-    if (!compAnim->suspended() && compAnim->hasAnimations()) {
-        timeToNextService = compAnim->timeToNextService();
-        timeToNextEvent = compAnim->timeToNextEvent();
-    }
-
-    if (timeToNextService >= 0)
-        scheduleService(timeToNextService, timeToNextEvent);
-}
-
-void AnimationControllerPrivate::scheduleService()
-{
-    double timeToNextService = -1;
-    double timeToNextEvent = -1;
-    updateAnimations(timeToNextService, timeToNextEvent, DoNotCallSetNeedsStyleRecalc);
-    scheduleService(timeToNextService, timeToNextEvent);
-}
-
-void AnimationControllerPrivate::scheduleService(double timeToNextService, double timeToNextEvent)
-{
-    if (!m_frame->page())
-        return;
-
-    bool visible = m_frame->page()->visibilityState() == WebCore::PageVisibilityStateVisible;
-
-    // This std::max to 1 second limits how often we service animations on background tabs.
-    // Without this, plus and gmail were recalculating style as every 200ms or even more
-    // often, burning CPU needlessly for background tabs.
-    // FIXME: Do we want to fire events at all on background tabs?
-    if (!visible)
-        timeToNextService = std::max(timeToNextEvent, 1.0);
-
-    if (visible && !timeToNextService) {
-        m_frame->document()->view()->scheduleAnimation();
-        if (m_animationTimer.isActive())
-            m_animationTimer.stop();
-        return;
-    }
-
-    if (timeToNextService < 0) {
-        if (m_animationTimer.isActive())
-            m_animationTimer.stop();
-        return;
-    }
-
-    if (m_animationTimer.isActive() && m_animationTimer.nextFireInterval() <= timeToNextService)
-        return;
-
-    m_animationTimer.startOneShot(timeToNextService);
-}
-
-void AnimationControllerPrivate::updateStyleIfNeededDispatcherFired(Timer<AnimationControllerPrivate>*)
-{
-    fireEventsAndUpdateStyle();
-}
-
-void AnimationControllerPrivate::fireEventsAndUpdateStyle()
-{
-    // Protect the frame from getting destroyed in the event handler
-    RefPtr<Frame> protector = m_frame;
-
-    bool updateStyle = !m_eventsToDispatch.isEmpty() || !m_nodeChangesToDispatch.isEmpty();
-
-    // fire all the events
-    Vector<EventToDispatch> eventsToDispatch = m_eventsToDispatch;
-    m_eventsToDispatch.clear();
-    Vector<EventToDispatch>::const_iterator eventsToDispatchEnd = eventsToDispatch.end();
-    for (Vector<EventToDispatch>::const_iterator it = eventsToDispatch.begin(); it != eventsToDispatchEnd; ++it) {
-        Element* element = it->element.get();
-        if (it->eventType == eventNames().transitionendEvent)
-            element->dispatchEvent(TransitionEvent::create(it->eventType, it->name, it->elapsedTime, PseudoElement::pseudoElementNameForEvents(element->pseudoId())));
-        else
-            element->dispatchEvent(WebKitAnimationEvent::create(it->eventType, it->name, it->elapsedTime));
-    }
-
-    // call setChanged on all the elements
-    Vector<RefPtr<Node> >::const_iterator nodeChangesToDispatchEnd = m_nodeChangesToDispatch.end();
-    for (Vector<RefPtr<Node> >::const_iterator it = m_nodeChangesToDispatch.begin(); it != nodeChangesToDispatchEnd; ++it)
-        (*it)->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
-
-    m_nodeChangesToDispatch.clear();
-
-    if (updateStyle && m_frame)
-        m_frame->document()->updateStyleIfNeeded();
-}
-
-void AnimationControllerPrivate::startUpdateStyleIfNeededDispatcher()
-{
-    if (!m_updateStyleIfNeededDispatcher.isActive())
-        m_updateStyleIfNeededDispatcher.startOneShot(0);
-}
-
-void AnimationControllerPrivate::addEventToDispatch(PassRefPtr<Element> element, const AtomicString& eventType, const String& name, double elapsedTime)
-{
-    m_eventsToDispatch.grow(m_eventsToDispatch.size()+1);
-    EventToDispatch& event = m_eventsToDispatch[m_eventsToDispatch.size()-1];
-    event.element = element;
-    event.eventType = eventType;
-    event.name = name;
-    event.elapsedTime = elapsedTime;
-
-    startUpdateStyleIfNeededDispatcher();
-}
-
-void AnimationControllerPrivate::addNodeChangeToDispatch(PassRefPtr<Node> node)
-{
-    if (!node)
-        return;
-
-    m_nodeChangesToDispatch.append(node);
-    startUpdateStyleIfNeededDispatcher();
-}
-
-void AnimationControllerPrivate::serviceAnimations()
-{
-    double timeToNextService = -1;
-    double timeToNextEvent = -1;
-    updateAnimations(timeToNextService, timeToNextEvent, CallSetNeedsStyleRecalc);
-    scheduleService(timeToNextService, timeToNextEvent);
-
-    // Fire events right away, to avoid a flash of unanimated style after an animation completes, and before
-    // the 'end' event fires.
-    fireEventsAndUpdateStyle();
-}
-
-void AnimationControllerPrivate::animationTimerFired(Timer<AnimationControllerPrivate>*)
-{
-    // Make sure animationUpdateTime is updated, so that it is current even if no
-    // styleChange has happened (e.g. accelerated animations)
-    setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
-    serviceAnimations();
-}
-
-bool AnimationControllerPrivate::isRunningAnimationOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const
-{
-    RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer);
-    if (!animation)
-        return false;
-
-    return animation->isAnimatingProperty(property, false, isRunningNow);
-}
-
-bool AnimationControllerPrivate::isRunningAcceleratableAnimationOnRenderer(RenderObject *renderer) const
-{
-    RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer);
-    if (!animation)
-        return false;
-
-    bool acceleratedOnly = false;
-    bool isRunningNow = true;
-    return animation->isAnimatingProperty(CSSPropertyOpacity, acceleratedOnly, isRunningNow)
-        || animation->isAnimatingProperty(CSSPropertyWebkitTransform, acceleratedOnly, isRunningNow)
-        || animation->isAnimatingProperty(CSSPropertyWebkitFilter, acceleratedOnly, isRunningNow);
-}
-
-bool AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const
-{
-    RefPtr<CompositeAnimation> animation = m_compositeAnimations.get(renderer);
-    if (!animation)
-        return false;
-
-    return animation->isAnimatingProperty(property, true, isRunningNow);
-}
-
-void AnimationControllerPrivate::suspendAnimations()
-{
-    suspendAnimationsForDocument(m_frame->document());
-
-    // Traverse subframes
-    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
-        child->animation()->suspendAnimations();
-}
-
-void AnimationControllerPrivate::resumeAnimations()
-{
-    resumeAnimationsForDocument(m_frame->document());
-
-    // Traverse subframes
-    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
-        child->animation()->resumeAnimations();
-}
-
-void AnimationControllerPrivate::suspendAnimationsForDocument(Document* document)
-{
-    setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
-
-    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
-    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
-        RenderObject* renderer = it->key;
-        if (&renderer->document() == document) {
-            CompositeAnimation* compAnim = it->value.get();
-            compAnim->suspendAnimations();
-        }
-    }
-
-    scheduleService();
-}
-
-void AnimationControllerPrivate::resumeAnimationsForDocument(Document* document)
-{
-    setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
-
-    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
-    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
-        RenderObject* renderer = it->key;
-        if (&renderer->document() == document) {
-            CompositeAnimation* compAnim = it->value.get();
-            compAnim->resumeAnimations();
-        }
-    }
-
-    scheduleService();
-}
-
-void AnimationControllerPrivate::pauseAnimationsForTesting(double t)
-{
-    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
-    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
-        it->value->pauseAnimationsForTesting(t);
-        it->key->node()->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
-    }
-}
-
-double AnimationControllerPrivate::beginAnimationUpdateTime()
-{
-    if (m_beginAnimationUpdateTime == cBeginAnimationUpdateTimeNotSet)
-        m_beginAnimationUpdateTime = currentTime();
-    return m_beginAnimationUpdateTime;
-}
-
-void AnimationControllerPrivate::endAnimationUpdate()
-{
-    styleAvailable();
-    if (!m_waitingForAsyncStartNotification)
-        startTimeResponse(beginAnimationUpdateTime());
-}
-
-void AnimationControllerPrivate::receivedStartTimeResponse(double time)
-{
-    m_waitingForAsyncStartNotification = false;
-    startTimeResponse(time);
-}
-
-PassRefPtr<RenderStyle> AnimationControllerPrivate::getAnimatedStyleForRenderer(RenderObject* renderer)
-{
-    if (!renderer)
-        return 0;
-
-    RefPtr<CompositeAnimation> rendererAnimations = m_compositeAnimations.get(renderer);
-    if (!rendererAnimations)
-        return renderer->style();
-
-    RefPtr<RenderStyle> animatingStyle = rendererAnimations->getAnimatedStyle();
-    if (!animatingStyle)
-        animatingStyle = renderer->style();
-
-    return animatingStyle.release();
-}
-
-unsigned AnimationControllerPrivate::numberOfActiveAnimations(Document* document) const
-{
-    unsigned count = 0;
-
-    RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end();
-    for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) {
-        RenderObject* renderer = it->key;
-        CompositeAnimation* compAnim = it->value.get();
-        if (&renderer->document() == document)
-            count += compAnim->numberOfActiveAnimations();
-    }
-
-    return count;
-}
-
-void AnimationControllerPrivate::addToAnimationsWaitingForStyle(AnimationBase* animation)
-{
-    // Make sure this animation is not in the start time waiters
-    m_animationsWaitingForStartTimeResponse.remove(animation);
-
-    m_animationsWaitingForStyle.add(animation);
-}
-
-void AnimationControllerPrivate::removeFromAnimationsWaitingForStyle(AnimationBase* animationToRemove)
-{
-    m_animationsWaitingForStyle.remove(animationToRemove);
-}
-
-void AnimationControllerPrivate::styleAvailable()
-{
-    // Go through list of waiters and send them on their way
-    WaitingAnimationsSet::const_iterator it = m_animationsWaitingForStyle.begin();
-    WaitingAnimationsSet::const_iterator end = m_animationsWaitingForStyle.end();
-    for (; it != end; ++it)
-        (*it)->styleAvailable();
-
-    m_animationsWaitingForStyle.clear();
-}
-
-void AnimationControllerPrivate::addToAnimationsWaitingForStartTimeResponse(AnimationBase* animation, bool willGetResponse)
-{
-    // If willGetResponse is true, it means this animation is actually waiting for a response
-    // (which will come in as a call to notifyAnimationStarted()).
-    // In that case we don't need to add it to this list. We just set a waitingForAResponse flag
-    // which says we are waiting for the response. If willGetResponse is false, this animation
-    // is not waiting for a response for itself, but rather for a notifyXXXStarted() call for
-    // another animation to which it will sync.
-    //
-    // When endAnimationUpdate() is called we check to see if the waitingForAResponse flag is
-    // true. If so, we just return and will do our work when the first notifyXXXStarted() call
-    // comes in. If it is false, we will not be getting a notifyXXXStarted() call, so we will
-    // do our work right away. In both cases we call the onAnimationStartResponse() method
-    // on each animation. In the first case we send in the time we got from notifyXXXStarted().
-    // In the second case, we just pass in the beginAnimationUpdateTime().
-    //
-    // This will synchronize all software and accelerated animations started in the same
-    // updateStyleIfNeeded cycle.
-    //
-
-    if (willGetResponse)
-        m_waitingForAsyncStartNotification = true;
-
-    m_animationsWaitingForStartTimeResponse.add(animation);
-}
-
-void AnimationControllerPrivate::removeFromAnimationsWaitingForStartTimeResponse(AnimationBase* animationToRemove)
-{
-    m_animationsWaitingForStartTimeResponse.remove(animationToRemove);
-
-    if (m_animationsWaitingForStartTimeResponse.isEmpty())
-        m_waitingForAsyncStartNotification = false;
-}
-
-void AnimationControllerPrivate::startTimeResponse(double time)
-{
-    // Go through list of waiters and send them on their way
-
-    WaitingAnimationsSet::const_iterator it = m_animationsWaitingForStartTimeResponse.begin();
-    WaitingAnimationsSet::const_iterator end = m_animationsWaitingForStartTimeResponse.end();
-    for (; it != end; ++it)
-        (*it)->onAnimationStartResponse(time);
-
-    m_animationsWaitingForStartTimeResponse.clear();
-    m_waitingForAsyncStartNotification = false;
-}
-
-void AnimationControllerPrivate::animationWillBeRemoved(AnimationBase* animation)
-{
-    removeFromAnimationsWaitingForStyle(animation);
-    removeFromAnimationsWaitingForStartTimeResponse(animation);
-}
-
-AnimationController::AnimationController(Frame* frame)
-    : m_data(adoptPtr(new AnimationControllerPrivate(frame)))
-    , m_beginAnimationUpdateCount(0)
-{
-}
-
-AnimationController::~AnimationController()
-{
-}
-
-void AnimationController::cancelAnimations(RenderObject* renderer)
-{
-    if (!m_data->hasAnimations())
-        return;
-
-    if (m_data->clear(renderer)) {
-        if (Node* node = renderer->node())
-            node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
-    }
-}
-
-PassRefPtr<RenderStyle> AnimationController::updateAnimations(RenderObject* renderer, RenderStyle* newStyle)
-{
-    RenderStyle* oldStyle = renderer->style();
-
-    if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle->animations() && !newStyle->transitions()))
-        return newStyle;
-
-    // Don't run transitions when printing.
-    if (renderer->view()->document().printing())
-        return newStyle;
-
-    // Fetch our current set of implicit animations from a hashtable.  We then compare them
-    // against the animations in the style and make sure we're in sync.  If destination values
-    // have changed, we reset the animation.  We then do a blend to get new values and we return
-    // a new style.
-
-    // We don't support anonymous pseudo elements like :first-line or :first-letter.
-    ASSERT(renderer->node());
-
-    RefPtr<CompositeAnimation> rendererAnimations = m_data->accessCompositeAnimation(renderer);
-    RefPtr<RenderStyle> blendedStyle = rendererAnimations->animate(renderer, oldStyle, newStyle);
-
-    if (renderer->parent() || newStyle->animations() || (oldStyle && oldStyle->animations())) {
-        m_data->scheduleServiceForRenderer(renderer);
-    }
-
-    if (blendedStyle != newStyle) {
-        // If the animations/transitions change opacity or transform, we need to update
-        // the style to impose the stacking rules. Note that this is also
-        // done in StyleResolver::adjustRenderStyle().
-        if (blendedStyle->hasAutoZIndex() && (blendedStyle->opacity() < 1.0f || blendedStyle->hasTransform()))
-            blendedStyle->setZIndex(0);
-    }
-    return blendedStyle.release();
-}
-
-PassRefPtr<RenderStyle> AnimationController::getAnimatedStyleForRenderer(RenderObject* renderer)
-{
-    return m_data->getAnimatedStyleForRenderer(renderer);
-}
-
-void AnimationController::notifyAnimationStarted(RenderObject*, double startTime)
-{
-    m_data->receivedStartTimeResponse(startTime);
-}
-
-void AnimationController::pauseAnimationsForTesting(double t)
-{
-    m_data->pauseAnimationsForTesting(t);
-}
-
-unsigned AnimationController::numberOfActiveAnimations(Document* document) const
-{
-    return m_data->numberOfActiveAnimations(document);
-}
-
-bool AnimationController::isRunningAnimationOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const
-{
-    return m_data->isRunningAnimationOnRenderer(renderer, property, isRunningNow);
-}
-
-bool AnimationController::isRunningAcceleratableAnimationOnRenderer(RenderObject* renderer) const
-{
-    return m_data->isRunningAcceleratableAnimationOnRenderer(renderer);
-}
-
-bool AnimationController::isRunningAcceleratedAnimationOnRenderer(RenderObject* renderer, CSSPropertyID property, bool isRunningNow) const
-{
-    return m_data->isRunningAcceleratedAnimationOnRenderer(renderer, property, isRunningNow);
-}
-
-void AnimationController::suspendAnimations()
-{
-    m_data->suspendAnimations();
-}
-
-void AnimationController::resumeAnimations()
-{
-    m_data->resumeAnimations();
-}
-
-void AnimationController::serviceAnimations()
-{
-    m_data->serviceAnimations();
-}
-
-void AnimationController::suspendAnimationsForDocument(Document* document)
-{
-    m_data->suspendAnimationsForDocument(document);
-}
-
-void AnimationController::resumeAnimationsForDocument(Document* document)
-{
-    m_data->resumeAnimationsForDocument(document);
-}
-
-void AnimationController::beginAnimationUpdate()
-{
-    if (!m_beginAnimationUpdateCount)
-        m_data->setBeginAnimationUpdateTime(cBeginAnimationUpdateTimeNotSet);
-    ++m_beginAnimationUpdateCount;
-}
-
-void AnimationController::endAnimationUpdate()
-{
-    ASSERT(m_beginAnimationUpdateCount > 0);
-    --m_beginAnimationUpdateCount;
-    if (!m_beginAnimationUpdateCount)
-        m_data->endAnimationUpdate();
-}
-
-bool AnimationController::supportsAcceleratedAnimationOfProperty(CSSPropertyID property)
-{
-    return CSSPropertyAnimation::animationOfPropertyIsAccelerated(property);
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/animation/AnimationControllerPrivate.h b/Source/core/page/animation/AnimationControllerPrivate.h
deleted file mode 100644
index 5a603fc..0000000
--- a/Source/core/page/animation/AnimationControllerPrivate.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- * 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.
- *
- * 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 AnimationControllerPrivate_h
-#define AnimationControllerPrivate_h
-
-#include "CSSPropertyNames.h"
-#include "core/platform/Timer.h"
-#include "wtf/HashMap.h"
-#include "wtf/HashSet.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class AnimationBase;
-class CompositeAnimation;
-class Document;
-class Element;
-class Frame;
-class Node;
-class RenderObject;
-class RenderStyle;
-
-enum SetNeedsStyleRecalc {
-    DoNotCallSetNeedsStyleRecalc = 0,
-    CallSetNeedsStyleRecalc = 1
-};
-
-class AnimationControllerPrivate {
-    WTF_MAKE_NONCOPYABLE(AnimationControllerPrivate); WTF_MAKE_FAST_ALLOCATED;
-public:
-    AnimationControllerPrivate(Frame*);
-    ~AnimationControllerPrivate();
-
-    void updateAnimations(double& timeToNextService, double& timeToNextEvent, SetNeedsStyleRecalc callSetNeedsStyleRecalc = DoNotCallSetNeedsStyleRecalc);
-    void scheduleService();
-
-    PassRefPtr<CompositeAnimation> accessCompositeAnimation(RenderObject*);
-    bool clear(RenderObject*);
-
-    void updateStyleIfNeededDispatcherFired(Timer<AnimationControllerPrivate>*);
-    void startUpdateStyleIfNeededDispatcher();
-    void addEventToDispatch(PassRefPtr<Element> element, const AtomicString& eventType, const String& name, double elapsedTime);
-    void addNodeChangeToDispatch(PassRefPtr<Node>);
-
-    bool hasAnimations() const { return !m_compositeAnimations.isEmpty(); }
-
-    void suspendAnimations();
-    void resumeAnimations();
-    void serviceAnimations();
-
-    void suspendAnimationsForDocument(Document*);
-    void resumeAnimationsForDocument(Document*);
-
-    bool isRunningAnimationOnRenderer(RenderObject*, CSSPropertyID, bool isRunningNow) const;
-    bool isRunningAcceleratableAnimationOnRenderer(RenderObject*) const;
-    bool isRunningAcceleratedAnimationOnRenderer(RenderObject*, CSSPropertyID, bool isRunningNow) const;
-
-    void pauseAnimationsForTesting(double t);
-    unsigned numberOfActiveAnimations(Document*) const;
-
-    PassRefPtr<RenderStyle> getAnimatedStyleForRenderer(RenderObject* renderer);
-
-    double beginAnimationUpdateTime();
-    void setBeginAnimationUpdateTime(double t) { m_beginAnimationUpdateTime = t; }
-    void endAnimationUpdate();
-    void receivedStartTimeResponse(double);
-
-    void addToAnimationsWaitingForStyle(AnimationBase*);
-    void removeFromAnimationsWaitingForStyle(AnimationBase*);
-
-    void addToAnimationsWaitingForStartTimeResponse(AnimationBase*, bool willGetResponse);
-    void removeFromAnimationsWaitingForStartTimeResponse(AnimationBase*);
-
-    void animationWillBeRemoved(AnimationBase*);
-
-    void scheduleServiceForRenderer(RenderObject*);
-
-private:
-    void animationTimerFired(Timer<AnimationControllerPrivate>*);
-
-    void scheduleService(double timeToNextService, double timeToNextEvent);
-
-    void styleAvailable();
-    void fireEventsAndUpdateStyle();
-    void startTimeResponse(double t);
-
-    typedef HashMap<RenderObject*, RefPtr<CompositeAnimation> > RenderObjectAnimationMap;
-
-    RenderObjectAnimationMap m_compositeAnimations;
-    Timer<AnimationControllerPrivate> m_animationTimer;
-    Timer<AnimationControllerPrivate> m_updateStyleIfNeededDispatcher;
-    Frame* m_frame;
-
-    class EventToDispatch {
-    public:
-        RefPtr<Element> element;
-        AtomicString eventType;
-        String name;
-        double elapsedTime;
-    };
-
-    Vector<EventToDispatch> m_eventsToDispatch;
-    Vector<RefPtr<Node> > m_nodeChangesToDispatch;
-
-    double m_beginAnimationUpdateTime;
-
-    typedef HashSet<RefPtr<AnimationBase> > WaitingAnimationsSet;
-    WaitingAnimationsSet m_animationsWaitingForStyle;
-    WaitingAnimationsSet m_animationsWaitingForStartTimeResponse;
-    bool m_waitingForAsyncStartNotification;
-};
-
-} // namespace WebCore
-
-#endif // AnimationControllerPrivate_h
diff --git a/Source/core/page/animation/CSSPropertyAnimation.cpp b/Source/core/page/animation/CSSPropertyAnimation.cpp
deleted file mode 100644
index 4f5ab98..0000000
--- a/Source/core/page/animation/CSSPropertyAnimation.cpp
+++ /dev/null
@@ -1,1279 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2012 Adobe Systems Incorporated. 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.
- * 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.
- *
- * 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/page/animation/CSSPropertyAnimation.h"
-
-#include <algorithm>
-#include "CSSPropertyNames.h"
-#include "StylePropertyShorthand.h"
-#include "core/animation/css/CSSAnimations.h"
-#include "core/css/CSSCrossfadeValue.h"
-#include "core/css/CSSImageValue.h"
-#include "core/css/CSSPrimitiveValue.h"
-#include "core/fetch/ImageResource.h"
-#include "core/page/animation/AnimationBase.h"
-#include "core/platform/FloatConversion.h"
-#include "core/rendering/ClipPathOperation.h"
-#include "core/rendering/RenderBox.h"
-#include "core/rendering/style/RenderStyle.h"
-#include "core/rendering/style/StyleFetchedImage.h"
-#include "core/rendering/style/StyleGeneratedImage.h"
-#include "wtf/Noncopyable.h"
-
-namespace WebCore {
-
-static inline int blendFunc(const AnimationBase*, int from, int to, double progress)
-{
-    return blend(from, to, progress);
-}
-
-static inline unsigned blendFunc(const AnimationBase*, unsigned from, unsigned to, double progress)
-{
-    return blend(from, to, progress);
-}
-
-static inline double blendFunc(const AnimationBase*, double from, double to, double progress)
-{
-    return blend(from, to, progress);
-}
-
-static inline float blendFunc(const AnimationBase*, float from, float to, double progress)
-{
-    return narrowPrecisionToFloat(from + (to - from) * progress);
-}
-
-static inline Color blendFunc(const AnimationBase*, const Color& from, const Color& to, double progress)
-{
-    return blend(from, to, progress);
-}
-
-static inline Length blendFunc(const AnimationBase*, const Length& from, const Length& to, double progress)
-{
-    return to.blend(from, narrowPrecisionToFloat(progress));
-}
-
-static inline LengthSize blendFunc(const AnimationBase* anim, const LengthSize& from, const LengthSize& to, double progress)
-{
-    return LengthSize(blendFunc(anim, from.width(), to.width(), progress),
-                      blendFunc(anim, from.height(), to.height(), progress));
-}
-
-static inline LengthPoint blendFunc(const AnimationBase* anim, const LengthPoint& from, const LengthPoint& to, double progress)
-{
-    return LengthPoint(blendFunc(anim, from.x(), to.x(), progress), blendFunc(anim, from.y(), to.y(), progress));
-}
-
-static inline IntSize blendFunc(const AnimationBase* anim, const IntSize& from, const IntSize& to, double progress)
-{
-    return IntSize(blendFunc(anim, from.width(), to.width(), progress),
-                   blendFunc(anim, from.height(), to.height(), progress));
-}
-
-static inline ShadowStyle blendFunc(const AnimationBase* anim, ShadowStyle from, ShadowStyle to, double progress)
-{
-    if (from == to)
-        return to;
-
-    double fromVal = from == Normal ? 1 : 0;
-    double toVal = to == Normal ? 1 : 0;
-    double result = blendFunc(anim, fromVal, toVal, progress);
-    return result > 0 ? Normal : Inset;
-}
-
-static inline PassOwnPtr<ShadowData> blendFunc(const AnimationBase* anim, const ShadowData* from, const ShadowData* to, double progress)
-{
-    ASSERT(from && to);
-    if (from->style() != to->style())
-        return to->clone();
-
-    return ShadowData::create(blend(from->location(), to->location(), progress),
-        blend(from->blur(), to->blur(), progress),
-        blend(from->spread(), to->spread(), progress),
-        blendFunc(anim, from->style(), to->style(), progress),
-        blend(from->color(), to->color(), progress));
-}
-
-static inline TransformOperations blendFunc(const AnimationBase* anim, const TransformOperations& from, const TransformOperations& to, double progress)
-{
-    if (anim->isTransformFunctionListValid())
-        return to.blendByMatchingOperations(from, progress);
-    return to.blendByUsingMatrixInterpolation(from, progress);
-}
-
-static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, ClipPathOperation* from, ClipPathOperation* to, double progress)
-{
-    // Other clip-path operations than BasicShapes can not be animated.
-    if (from->getOperationType() != ClipPathOperation::SHAPE || to->getOperationType() != ClipPathOperation::SHAPE)
-        return to;
-
-    const BasicShape* fromShape = static_cast<ShapeClipPathOperation*>(from)->basicShape();
-    const BasicShape* toShape = static_cast<ShapeClipPathOperation*>(to)->basicShape();
-
-    if (!fromShape->canBlend(toShape))
-        return to;
-
-    return ShapeClipPathOperation::create(toShape->blend(fromShape, progress));
-}
-
-static inline PassRefPtr<ShapeValue> blendFunc(const AnimationBase*, ShapeValue* from, ShapeValue* to, double progress)
-{
-    // FIXME Bug 102723: Shape-inside should be able to animate a value of 'outside-shape' when shape-outside is set to a BasicShape
-    if (from->type() != ShapeValue::Shape || to->type() != ShapeValue::Shape)
-        return to;
-
-    const BasicShape* fromShape = from->shape();
-    const BasicShape* toShape = to->shape();
-
-    if (!fromShape->canBlend(toShape))
-        return to;
-
-    return ShapeValue::createShapeValue(toShape->blend(fromShape, progress));
-}
-
-static inline PassRefPtr<FilterOperation> blendFunc(const AnimationBase* anim, FilterOperation* fromOp, FilterOperation* toOp, double progress, bool blendToPassthrough = false)
-{
-    ASSERT(toOp);
-    return toOp->blend(fromOp, progress, blendToPassthrough);
-}
-
-static inline FilterOperations blendFunc(const AnimationBase* anim, const FilterOperations& from, const FilterOperations& to, double progress)
-{
-    FilterOperations result;
-
-    // If we have a filter function list, use that to do a per-function animation.
-    if (anim->filterFunctionListsMatch()) {
-        size_t fromSize = from.operations().size();
-        size_t toSize = to.operations().size();
-        size_t size = max(fromSize, toSize);
-        for (size_t i = 0; i < size; i++) {
-            RefPtr<FilterOperation> fromOp = (i < fromSize) ? from.operations()[i].get() : 0;
-            RefPtr<FilterOperation> toOp = (i < toSize) ? to.operations()[i].get() : 0;
-            RefPtr<FilterOperation> blendedOp = toOp ? blendFunc(anim, fromOp.get(), toOp.get(), progress) : (fromOp ? blendFunc(anim, 0, fromOp.get(), progress, true) : 0);
-            if (blendedOp)
-                result.operations().append(blendedOp);
-            else {
-                RefPtr<FilterOperation> identityOp = PassthroughFilterOperation::create();
-                if (progress > 0.5)
-                    result.operations().append(toOp ? toOp : identityOp);
-                else
-                    result.operations().append(fromOp ? fromOp : identityOp);
-            }
-        }
-    } else {
-        // If the filter function lists don't match, we could try to cross-fade, but don't yet have a way to represent that in CSS.
-        // For now we'll just fail to animate.
-        result = to;
-    }
-
-    return result;
-}
-
-static inline EVisibility blendFunc(const AnimationBase* anim, EVisibility from, EVisibility to, double progress)
-{
-    // Any non-zero result means we consider the object to be visible. Only at 0 do we consider the object to be
-    // invisible. The invisible value we use (HIDDEN vs. COLLAPSE) depends on the specified from/to values.
-    double fromVal = from == VISIBLE ? 1. : 0.;
-    double toVal = to == VISIBLE ? 1. : 0.;
-    if (fromVal == toVal)
-        return to;
-    double result = blendFunc(anim, fromVal, toVal, progress);
-    return result > 0. ? VISIBLE : (to != VISIBLE ? to : from);
-}
-
-static inline LengthBox blendFunc(const AnimationBase* anim, const LengthBox& from, const LengthBox& to, double progress)
-{
-    // Length types have to match to animate
-    if (from.top().type() != to.top().type()
-        || from.right().type() != to.right().type()
-        || from.bottom().type() != to.bottom().type()
-        || from.left().type() != to.left().type())
-        return to;
-
-    LengthBox result(blendFunc(anim, from.top(), to.top(), progress),
-                     blendFunc(anim, from.right(), to.right(), progress),
-                     blendFunc(anim, from.bottom(), to.bottom(), progress),
-                     blendFunc(anim, from.left(), to.left(), progress));
-    return result;
-}
-
-static inline SVGLength blendFunc(const AnimationBase*, const SVGLength& from, const SVGLength& to, double progress)
-{
-    return to.blend(from, narrowPrecisionToFloat(progress));
-}
-
-static inline Vector<SVGLength> blendFunc(const AnimationBase*, const Vector<SVGLength>& from, const Vector<SVGLength>& to, double progress)
-{
-    size_t fromLength = from.size();
-    size_t toLength = to.size();
-    if (!fromLength)
-        return !progress ? from : to;
-    if (!toLength)
-        return progress == 1 ? from : to;
-
-    size_t resultLength = fromLength;
-    if (fromLength != toLength) {
-        if (!(fromLength % toLength))
-            resultLength = fromLength;
-        else if (!(toLength % fromLength))
-            resultLength = toLength;
-        else
-            resultLength = fromLength * toLength;
-    }
-    Vector<SVGLength> result(resultLength);
-    for (size_t i = 0; i < resultLength; ++i)
-        result[i] = to[i % toLength].blend(from[i % fromLength], narrowPrecisionToFloat(progress));
-    return result;
-}
-
-static inline PassRefPtr<StyleImage> crossfadeBlend(const AnimationBase*, StyleFetchedImage* fromStyleImage, StyleFetchedImage* toStyleImage, double progress)
-{
-    // If progress is at one of the extremes, we want getComputedStyle to show the image,
-    // not a completed cross-fade, so we hand back one of the existing images.
-    if (!progress)
-        return fromStyleImage;
-    if (progress == 1)
-        return toStyleImage;
-
-    ImageResource* fromImageResource = static_cast<ImageResource*>(fromStyleImage->data());
-    ImageResource* toImageResource = static_cast<ImageResource*>(toStyleImage->data());
-
-    RefPtr<CSSImageValue> fromImageValue = CSSImageValue::create(fromImageResource->url(), fromStyleImage);
-    RefPtr<CSSImageValue> toImageValue = CSSImageValue::create(toImageResource->url(), toStyleImage);
-    RefPtr<CSSCrossfadeValue> crossfadeValue = CSSCrossfadeValue::create(fromImageValue, toImageValue);
-
-    crossfadeValue->setPercentage(CSSPrimitiveValue::create(progress, CSSPrimitiveValue::CSS_NUMBER));
-
-    return StyleGeneratedImage::create(crossfadeValue.get());
-}
-
-static inline PassRefPtr<StyleImage> blendFunc(const AnimationBase* anim, StyleImage* from, StyleImage* to, double progress)
-{
-    if (!from || !to)
-        return to;
-
-    if (from->isImageResource() && to->isImageResource())
-        return crossfadeBlend(anim, static_cast<StyleFetchedImage*>(from), static_cast<StyleFetchedImage*>(to), progress);
-
-    // FIXME: Support transitioning generated images as well. (gradients, etc.)
-
-    return to;
-}
-
-static inline NinePieceImage blendFunc(const AnimationBase* anim, const NinePieceImage& from, const NinePieceImage& to, double progress)
-{
-    if (!from.hasImage() || !to.hasImage())
-        return to;
-
-    // FIXME (74112): Support transitioning between NinePieceImages that differ by more than image content.
-
-    if (from.imageSlices() != to.imageSlices() || from.borderSlices() != to.borderSlices() || from.outset() != to.outset() || from.fill() != to.fill() || from.horizontalRule() != to.horizontalRule() || from.verticalRule() != to.verticalRule())
-        return to;
-
-    if (from.image()->imageSize(anim->renderer(), 1.0) != to.image()->imageSize(anim->renderer(), 1.0))
-        return to;
-
-    RefPtr<StyleImage> newContentImage = blendFunc(anim, from.image(), to.image(), progress);
-
-    return NinePieceImage(newContentImage, from.imageSlices(), from.fill(), from.borderSlices(), from.outset(), from.horizontalRule(), from.verticalRule());
-}
-
-class AnimationPropertyWrapperBase {
-    WTF_MAKE_NONCOPYABLE(AnimationPropertyWrapperBase);
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    AnimationPropertyWrapperBase(CSSPropertyID prop)
-        : m_prop(prop)
-    {
-    }
-
-    virtual ~AnimationPropertyWrapperBase() { }
-
-    virtual bool isShorthandWrapper() const { return false; }
-    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const = 0;
-    virtual void blend(const AnimationBase*, RenderStyle*, const RenderStyle*, const RenderStyle*, double) const = 0;
-
-    CSSPropertyID property() const { return m_prop; }
-
-    virtual bool animationIsAccelerated() const { return false; }
-
-private:
-    CSSPropertyID m_prop;
-};
-
-static int gPropertyWrapperMap[numCSSProperties];
-static const int cInvalidPropertyWrapperIndex = -1;
-static Vector<AnimationPropertyWrapperBase*>* gPropertyWrappers = 0;
-
-static void addPropertyWrapper(CSSPropertyID propertyID, AnimationPropertyWrapperBase* wrapper)
-{
-    int propIndex = propertyID - firstCSSProperty;
-
-    ASSERT(gPropertyWrapperMap[propIndex] == cInvalidPropertyWrapperIndex);
-
-    unsigned wrapperIndex = gPropertyWrappers->size();
-    gPropertyWrappers->append(wrapper);
-    gPropertyWrapperMap[propIndex] = wrapperIndex;
-}
-
-static AnimationPropertyWrapperBase* wrapperForProperty(CSSPropertyID propertyID)
-{
-    int propIndex = propertyID - firstCSSProperty;
-    if (propIndex >= 0 && propIndex < numCSSProperties) {
-        int wrapperIndex = gPropertyWrapperMap[propIndex];
-        if (wrapperIndex >= 0)
-            return (*gPropertyWrappers)[wrapperIndex];
-    }
-    return 0;
-}
-
-template <typename T>
-class PropertyWrapperGetter : public AnimationPropertyWrapperBase {
-public:
-    PropertyWrapperGetter(CSSPropertyID prop, T (RenderStyle::*getter)() const)
-        : AnimationPropertyWrapperBase(prop)
-        , m_getter(getter)
-    {
-    }
-
-    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
-    {
-        // If the style pointers are the same, don't bother doing the test.
-        // If either is null, return false. If both are null, return true.
-        if ((!a && !b) || a == b)
-            return true;
-        if (!a || !b)
-            return false;
-        return (a->*m_getter)() == (b->*m_getter)();
-    }
-
-protected:
-    T (RenderStyle::*m_getter)() const;
-};
-
-template <typename T>
-class PropertyWrapper : public PropertyWrapperGetter<T> {
-public:
-    PropertyWrapper(CSSPropertyID prop, T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T))
-        : PropertyWrapperGetter<T>(prop, getter)
-        , m_setter(setter)
-    {
-    }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<T>::m_getter)(), (b->*PropertyWrapperGetter<T>::m_getter)(), progress));
-    }
-
-protected:
-    void (RenderStyle::*m_setter)(T);
-};
-
-template <typename T>
-class RefCountedPropertyWrapper : public PropertyWrapperGetter<T*> {
-public:
-    RefCountedPropertyWrapper(CSSPropertyID prop, T* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<T>))
-        : PropertyWrapperGetter<T*>(prop, getter)
-        , m_setter(setter)
-    {
-    }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<T*>::m_getter)(), (b->*PropertyWrapperGetter<T*>::m_getter)(), progress));
-    }
-
-protected:
-    void (RenderStyle::*m_setter)(PassRefPtr<T>);
-};
-
-
-class PropertyWrapperClipPath : public RefCountedPropertyWrapper<ClipPathOperation> {
-public:
-    PropertyWrapperClipPath(CSSPropertyID prop, ClipPathOperation* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<ClipPathOperation>))
-        : RefCountedPropertyWrapper<ClipPathOperation>(prop, getter, setter)
-    {
-    }
-};
-
-class PropertyWrapperShape : public RefCountedPropertyWrapper<ShapeValue> {
-public:
-    PropertyWrapperShape(CSSPropertyID prop, ShapeValue* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<ShapeValue>))
-        : RefCountedPropertyWrapper<ShapeValue>(prop, getter, setter)
-    {
-    }
-};
-
-class StyleImagePropertyWrapper : public RefCountedPropertyWrapper<StyleImage> {
-public:
-    StyleImagePropertyWrapper(CSSPropertyID prop, StyleImage* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassRefPtr<StyleImage>))
-        : RefCountedPropertyWrapper<StyleImage>(prop, getter, setter)
-    {
-    }
-
-    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
-    {
-       // If the style pointers are the same, don't bother doing the test.
-       // If either is null, return false. If both are null, return true.
-       if (a == b)
-           return true;
-       if (!a || !b)
-            return false;
-
-        StyleImage* imageA = (a->*m_getter)();
-        StyleImage* imageB = (b->*m_getter)();
-        return StyleImage::imagesEquivalent(imageA, imageB);
-    }
-};
-
-class PropertyWrapperColor : public PropertyWrapperGetter<Color> {
-public:
-    PropertyWrapperColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
-        : PropertyWrapperGetter<Color>(prop, getter)
-        , m_setter(setter)
-    {
-    }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<Color>::m_getter)(), (b->*PropertyWrapperGetter<Color>::m_getter)(), progress));
-    }
-
-protected:
-    void (RenderStyle::*m_setter)(const Color&);
-};
-
-class PropertyWrapperAcceleratedOpacity : public PropertyWrapper<float> {
-public:
-    PropertyWrapperAcceleratedOpacity()
-        : PropertyWrapper<float>(CSSPropertyOpacity, &RenderStyle::opacity, &RenderStyle::setOpacity)
-    {
-    }
-
-    virtual bool animationIsAccelerated() const { return true; }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        float fromOpacity = a->opacity();
-
-        // This makes sure we put the object being animated into a RenderLayer during the animation
-        dst->setOpacity(blendFunc(anim, (fromOpacity == 1) ? 0.999999f : fromOpacity, b->opacity(), progress));
-    }
-};
-
-class PropertyWrapperAcceleratedTransform : public PropertyWrapper<const TransformOperations&> {
-public:
-    PropertyWrapperAcceleratedTransform()
-        : PropertyWrapper<const TransformOperations&>(CSSPropertyWebkitTransform, &RenderStyle::transform, &RenderStyle::setTransform)
-    {
-    }
-
-    virtual bool animationIsAccelerated() const { return true; }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        dst->setTransform(blendFunc(anim, a->transform(), b->transform(), progress));
-    }
-};
-
-class PropertyWrapperAcceleratedFilter : public PropertyWrapper<const FilterOperations&> {
-public:
-    PropertyWrapperAcceleratedFilter()
-        : PropertyWrapper<const FilterOperations&>(CSSPropertyWebkitFilter, &RenderStyle::filter, &RenderStyle::setFilter)
-    {
-    }
-
-    virtual bool animationIsAccelerated() const { return true; }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        dst->setFilter(blendFunc(anim, a->filter(), b->filter(), progress));
-    }
-};
-
-static inline size_t shadowListLength(const ShadowData* shadow)
-{
-    size_t count;
-    for (count = 0; shadow; shadow = shadow->next())
-        ++count;
-    return count;
-}
-
-static inline const ShadowData* shadowForBlending(const ShadowData* srcShadow, const ShadowData* otherShadow)
-{
-    DEFINE_STATIC_LOCAL(OwnPtr<ShadowData>, defaultShadowData, (ShadowData::create(IntPoint(), 0, 0, Normal, Color::transparent)));
-    DEFINE_STATIC_LOCAL(OwnPtr<ShadowData>, defaultInsetShadowData, (ShadowData::create(IntPoint(), 0, 0, Inset, Color::transparent)));
-
-    if (srcShadow)
-        return srcShadow;
-
-    if (otherShadow->style() == Inset)
-        return defaultInsetShadowData.get();
-
-    return defaultShadowData.get();
-}
-
-class PropertyWrapperShadow : public AnimationPropertyWrapperBase {
-public:
-    PropertyWrapperShadow(CSSPropertyID prop, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(PassOwnPtr<ShadowData>, bool))
-        : AnimationPropertyWrapperBase(prop)
-        , m_getter(getter)
-        , m_setter(setter)
-    {
-    }
-
-    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
-    {
-        const ShadowData* shadowA = (a->*m_getter)();
-        const ShadowData* shadowB = (b->*m_getter)();
-
-        while (true) {
-            // end of both lists
-            if (!shadowA && !shadowB)
-                return true;
-
-            // end of just one of the lists
-            if (!shadowA || !shadowB)
-                return false;
-
-            if (*shadowA != *shadowB)
-                return false;
-
-            shadowA = shadowA->next();
-            shadowB = shadowB->next();
-        }
-
-        return true;
-    }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        const ShadowData* shadowA = (a->*m_getter)();
-        const ShadowData* shadowB = (b->*m_getter)();
-
-        int fromLength = shadowListLength(shadowA);
-        int toLength = shadowListLength(shadowB);
-
-        if (fromLength == toLength || (fromLength <= 1 && toLength <= 1)) {
-            (dst->*m_setter)(blendSimpleOrMatchedShadowLists(anim, progress, shadowA, shadowB), false);
-            return;
-        }
-
-        (dst->*m_setter)(blendMismatchedShadowLists(anim, progress, shadowA, shadowB, fromLength, toLength), false);
-    }
-
-private:
-    PassOwnPtr<ShadowData> blendSimpleOrMatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB) const
-    {
-        OwnPtr<ShadowData> newShadowData;
-        ShadowData* lastShadow = 0;
-
-        while (shadowA || shadowB) {
-            const ShadowData* srcShadow = shadowForBlending(shadowA, shadowB);
-            const ShadowData* dstShadow = shadowForBlending(shadowB, shadowA);
-
-            OwnPtr<ShadowData> blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress);
-            ShadowData* blendedShadowPtr = blendedShadow.get();
-
-            if (!lastShadow)
-                newShadowData = blendedShadow.release();
-            else
-                lastShadow->setNext(blendedShadow.release());
-
-            lastShadow = blendedShadowPtr;
-
-            shadowA = shadowA ? shadowA->next() : 0;
-            shadowB = shadowB ? shadowB->next() : 0;
-        }
-
-        return newShadowData.release();
-    }
-
-    PassOwnPtr<ShadowData> blendMismatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB, int fromLength, int toLength) const
-    {
-        // The shadows in ShadowData are stored in reverse order, so when animating mismatched lists,
-        // reverse them and match from the end.
-        Vector<const ShadowData*, 4> fromShadows(fromLength);
-        for (int i = fromLength - 1; i >= 0; --i) {
-            fromShadows[i] = shadowA;
-            shadowA = shadowA->next();
-        }
-
-        Vector<const ShadowData*, 4> toShadows(toLength);
-        for (int i = toLength - 1; i >= 0; --i) {
-            toShadows[i] = shadowB;
-            shadowB = shadowB->next();
-        }
-
-        OwnPtr<ShadowData> newShadowData;
-
-        int maxLength = max(fromLength, toLength);
-        for (int i = 0; i < maxLength; ++i) {
-            const ShadowData* fromShadow = i < fromLength ? fromShadows[i] : 0;
-            const ShadowData* toShadow = i < toLength ? toShadows[i] : 0;
-
-            const ShadowData* srcShadow = shadowForBlending(fromShadow, toShadow);
-            const ShadowData* dstShadow = shadowForBlending(toShadow, fromShadow);
-
-            OwnPtr<ShadowData> blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress);
-            // Insert at the start of the list to preserve the order.
-            blendedShadow->setNext(newShadowData.release());
-            newShadowData = blendedShadow.release();
-        }
-
-        return newShadowData.release();
-    }
-
-    const ShadowData* (RenderStyle::*m_getter)() const;
-    void (RenderStyle::*m_setter)(PassOwnPtr<ShadowData>, bool);
-};
-
-class PropertyWrapperMaybeInvalidColor : public AnimationPropertyWrapperBase {
-public:
-    PropertyWrapperMaybeInvalidColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
-        : AnimationPropertyWrapperBase(prop)
-        , m_getter(getter)
-        , m_setter(setter)
-    {
-    }
-
-    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
-    {
-        Color fromColor = (a->*m_getter)();
-        Color toColor = (b->*m_getter)();
-
-        if (!fromColor.isValid() && !toColor.isValid())
-            return true;
-
-        if (!fromColor.isValid())
-            fromColor = a->color();
-        if (!toColor.isValid())
-            toColor = b->color();
-
-        return fromColor == toColor;
-    }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        Color fromColor = (a->*m_getter)();
-        Color toColor = (b->*m_getter)();
-
-        if (!fromColor.isValid() && !toColor.isValid())
-            return;
-
-        if (!fromColor.isValid())
-            fromColor = a->color();
-        if (!toColor.isValid())
-            toColor = b->color();
-        (dst->*m_setter)(blendFunc(anim, fromColor, toColor, progress));
-    }
-
-private:
-    Color (RenderStyle::*m_getter)() const;
-    void (RenderStyle::*m_setter)(const Color&);
-};
-
-
-enum MaybeInvalidColorTag { MaybeInvalidColor };
-class PropertyWrapperVisitedAffectedColor : public AnimationPropertyWrapperBase {
-public:
-    PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
-        Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
-        : AnimationPropertyWrapperBase(prop)
-        , m_wrapper(adoptPtr(new PropertyWrapperColor(prop, getter, setter)))
-        , m_visitedWrapper(adoptPtr(new PropertyWrapperColor(prop, visitedGetter, visitedSetter)))
-    {
-    }
-    PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, MaybeInvalidColorTag, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
-        Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
-        : AnimationPropertyWrapperBase(prop)
-        , m_wrapper(adoptPtr(new PropertyWrapperMaybeInvalidColor(prop, getter, setter)))
-        , m_visitedWrapper(adoptPtr(new PropertyWrapperMaybeInvalidColor(prop, visitedGetter, visitedSetter)))
-    {
-    }
-    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
-    {
-        return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
-    }
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        m_wrapper->blend(anim, dst, a, b, progress);
-        m_visitedWrapper->blend(anim, dst, a, b, progress);
-    }
-
-private:
-    OwnPtr<AnimationPropertyWrapperBase> m_wrapper;
-    OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper;
-};
-
-// Wrapper base class for an animatable property in a FillLayer
-class FillLayerAnimationPropertyWrapperBase {
-public:
-    FillLayerAnimationPropertyWrapperBase()
-    {
-    }
-
-    virtual ~FillLayerAnimationPropertyWrapperBase() { }
-
-    virtual bool equals(const FillLayer*, const FillLayer*) const = 0;
-    virtual void blend(const AnimationBase*, FillLayer*, const FillLayer*, const FillLayer*, double) const = 0;
-};
-
-template <typename T>
-class FillLayerPropertyWrapperGetter : public FillLayerAnimationPropertyWrapperBase {
-    WTF_MAKE_NONCOPYABLE(FillLayerPropertyWrapperGetter);
-public:
-    FillLayerPropertyWrapperGetter(T (FillLayer::*getter)() const)
-        : m_getter(getter)
-    {
-    }
-
-    virtual bool equals(const FillLayer* a, const FillLayer* b) const
-    {
-       // If the style pointers are the same, don't bother doing the test.
-       // If either is null, return false. If both are null, return true.
-       if ((!a && !b) || a == b)
-           return true;
-       if (!a || !b)
-            return false;
-        return (a->*m_getter)() == (b->*m_getter)();
-    }
-
-protected:
-    T (FillLayer::*m_getter)() const;
-};
-
-template <typename T>
-class FillLayerPropertyWrapper : public FillLayerPropertyWrapperGetter<T> {
-public:
-    FillLayerPropertyWrapper(T (FillLayer::*getter)() const, void (FillLayer::*setter)(T))
-        : FillLayerPropertyWrapperGetter<T>(getter)
-        , m_setter(setter)
-    {
-    }
-
-    virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const
-    {
-        (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<T>::m_getter)(), progress));
-    }
-
-protected:
-    void (FillLayer::*m_setter)(T);
-};
-
-template <typename T>
-class FillLayerRefCountedPropertyWrapper : public FillLayerPropertyWrapperGetter<T*> {
-public:
-    FillLayerRefCountedPropertyWrapper(T* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<T>))
-        : FillLayerPropertyWrapperGetter<T*>(getter)
-        , m_setter(setter)
-    {
-    }
-
-    virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const
-    {
-        (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T*>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<T*>::m_getter)(), progress));
-    }
-
-protected:
-    void (FillLayer::*m_setter)(PassRefPtr<T>);
-};
-
-class FillLayerStyleImagePropertyWrapper : public FillLayerRefCountedPropertyWrapper<StyleImage> {
-public:
-    FillLayerStyleImagePropertyWrapper(StyleImage* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<StyleImage>))
-        : FillLayerRefCountedPropertyWrapper<StyleImage>(getter, setter)
-    {
-    }
-
-    virtual bool equals(const FillLayer* a, const FillLayer* b) const
-    {
-       // If the style pointers are the same, don't bother doing the test.
-       // If either is null, return false. If both are null, return true.
-       if (a == b)
-           return true;
-       if (!a || !b)
-            return false;
-
-        StyleImage* imageA = (a->*m_getter)();
-        StyleImage* imageB = (b->*m_getter)();
-        return StyleImage::imagesEquivalent(imageA, imageB);
-    }
-};
-
-
-class FillLayersPropertyWrapper : public AnimationPropertyWrapperBase {
-public:
-    typedef const FillLayer* (RenderStyle::*LayersGetter)() const;
-    typedef FillLayer* (RenderStyle::*LayersAccessor)();
-
-    FillLayersPropertyWrapper(CSSPropertyID prop, LayersGetter getter, LayersAccessor accessor)
-        : AnimationPropertyWrapperBase(prop)
-        , m_layersGetter(getter)
-        , m_layersAccessor(accessor)
-    {
-        switch (prop) {
-        case CSSPropertyBackgroundPositionX:
-        case CSSPropertyWebkitMaskPositionX:
-            m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&FillLayer::xPosition, &FillLayer::setXPosition);
-            break;
-        case CSSPropertyBackgroundPositionY:
-        case CSSPropertyWebkitMaskPositionY:
-            m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&FillLayer::yPosition, &FillLayer::setYPosition);
-            break;
-        case CSSPropertyBackgroundSize:
-        case CSSPropertyWebkitBackgroundSize:
-        case CSSPropertyWebkitMaskSize:
-            m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize>(&FillLayer::sizeLength, &FillLayer::setSizeLength);
-            break;
-        case CSSPropertyBackgroundImage:
-            m_fillLayerPropertyWrapper = new FillLayerStyleImagePropertyWrapper(&FillLayer::image, &FillLayer::setImage);
-            break;
-        default:
-            break;
-        }
-    }
-
-    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
-    {
-        const FillLayer* fromLayer = (a->*m_layersGetter)();
-        const FillLayer* toLayer = (b->*m_layersGetter)();
-
-        while (fromLayer && toLayer) {
-            if (!m_fillLayerPropertyWrapper->equals(fromLayer, toLayer))
-                return false;
-
-            fromLayer = fromLayer->next();
-            toLayer = toLayer->next();
-        }
-
-        return true;
-    }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        const FillLayer* aLayer = (a->*m_layersGetter)();
-        const FillLayer* bLayer = (b->*m_layersGetter)();
-        FillLayer* dstLayer = (dst->*m_layersAccessor)();
-
-        while (aLayer && bLayer && dstLayer) {
-            m_fillLayerPropertyWrapper->blend(anim, dstLayer, aLayer, bLayer, progress);
-            aLayer = aLayer->next();
-            bLayer = bLayer->next();
-            dstLayer = dstLayer->next();
-        }
-    }
-
-private:
-    FillLayerAnimationPropertyWrapperBase* m_fillLayerPropertyWrapper;
-
-    LayersGetter m_layersGetter;
-    LayersAccessor m_layersAccessor;
-};
-
-class ShorthandPropertyWrapper : public AnimationPropertyWrapperBase {
-public:
-    ShorthandPropertyWrapper(CSSPropertyID property, const StylePropertyShorthand& shorthand)
-        : AnimationPropertyWrapperBase(property)
-    {
-        for (unsigned i = 0; i < shorthand.length(); ++i) {
-            AnimationPropertyWrapperBase* wrapper = wrapperForProperty(shorthand.properties()[i]);
-            if (wrapper)
-                m_propertyWrappers.append(wrapper);
-        }
-    }
-
-    virtual bool isShorthandWrapper() const { return true; }
-
-    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
-    {
-        Vector<AnimationPropertyWrapperBase*>::const_iterator end = m_propertyWrappers.end();
-        for (Vector<AnimationPropertyWrapperBase*>::const_iterator it = m_propertyWrappers.begin(); it != end; ++it) {
-            if (!(*it)->equals(a, b))
-                return false;
-        }
-        return true;
-    }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        Vector<AnimationPropertyWrapperBase*>::const_iterator end = m_propertyWrappers.end();
-        for (Vector<AnimationPropertyWrapperBase*>::const_iterator it = m_propertyWrappers.begin(); it != end; ++it)
-            (*it)->blend(anim, dst, a, b, progress);
-    }
-
-    const Vector<AnimationPropertyWrapperBase*> propertyWrappers() const { return m_propertyWrappers; }
-
-private:
-    Vector<AnimationPropertyWrapperBase*> m_propertyWrappers;
-};
-
-class PropertyWrapperFlex : public AnimationPropertyWrapperBase {
-public:
-    PropertyWrapperFlex()
-        : AnimationPropertyWrapperBase(CSSPropertyFlex)
-    {
-    }
-
-    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
-    {
-        // If the style pointers are the same, don't bother doing the test.
-        // If either is null, return false. If both are null, return true.
-        if ((!a && !b) || a == b)
-            return true;
-        if (!a || !b)
-            return false;
-
-        return a->flexBasis() == b->flexBasis() && a->flexGrow() == b->flexGrow() && a->flexShrink() == b->flexShrink();
-    }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        dst->setFlexBasis(blendFunc(anim, a->flexBasis(), b->flexBasis(), progress));
-        dst->setFlexGrow(blendFunc(anim, a->flexGrow(), b->flexGrow(), progress));
-        dst->setFlexShrink(blendFunc(anim, a->flexShrink(), b->flexShrink(), progress));
-    }
-};
-
-class PropertyWrapperSVGPaint : public AnimationPropertyWrapperBase {
-public:
-    PropertyWrapperSVGPaint(CSSPropertyID prop, const SVGPaint::SVGPaintType& (RenderStyle::*paintTypeGetter)() const, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
-        : AnimationPropertyWrapperBase(prop)
-        , m_paintTypeGetter(paintTypeGetter)
-        , m_getter(getter)
-        , m_setter(setter)
-    {
-    }
-
-    virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
-    {
-        if ((a->*m_paintTypeGetter)() != (b->*m_paintTypeGetter)())
-            return false;
-
-        // We only support animations between SVGPaints that are pure Color values.
-        // For everything else we must return true for this method, otherwise
-        // we will try to animate between values forever.
-        if ((a->*m_paintTypeGetter)() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR) {
-            Color fromColor = (a->*m_getter)();
-            Color toColor = (b->*m_getter)();
-
-            if (!fromColor.isValid() && !toColor.isValid())
-                return true;
-
-            if (!fromColor.isValid())
-                fromColor = Color();
-            if (!toColor.isValid())
-                toColor = Color();
-
-            return fromColor == toColor;
-        }
-        return true;
-    }
-
-    virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const
-    {
-        if ((a->*m_paintTypeGetter)() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR
-            || (b->*m_paintTypeGetter)() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR)
-            return;
-
-        Color fromColor = (a->*m_getter)();
-        Color toColor = (b->*m_getter)();
-
-        if (!fromColor.isValid() && !toColor.isValid())
-            return;
-
-        if (!fromColor.isValid())
-            fromColor = Color();
-        if (!toColor.isValid())
-            toColor = Color();
-        (dst->*m_setter)(blendFunc(anim, fromColor, toColor, progress));
-    }
-
-private:
-    const SVGPaint::SVGPaintType& (RenderStyle::*m_paintTypeGetter)() const;
-    Color (RenderStyle::*m_getter)() const;
-    void (RenderStyle::*m_setter)(const Color&);
-};
-
-static void addShorthandProperties()
-{
-    static const CSSPropertyID animatableShorthandProperties[] = {
-        CSSPropertyBackground, // for background-color, background-position, background-image
-        CSSPropertyBackgroundPosition,
-        CSSPropertyFont, // for font-size, font-weight
-        CSSPropertyWebkitMask, // for mask-position
-        CSSPropertyWebkitMaskPosition,
-        CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft,
-        CSSPropertyBorderColor,
-        CSSPropertyBorderRadius,
-        CSSPropertyBorderWidth,
-        CSSPropertyBorder,
-        CSSPropertyBorderImage,
-        CSSPropertyBorderSpacing,
-        CSSPropertyListStyle, // for list-style-image
-        CSSPropertyMargin,
-        CSSPropertyOutline,
-        CSSPropertyPadding,
-        CSSPropertyWebkitTextStroke,
-        CSSPropertyWebkitColumnRule,
-        CSSPropertyWebkitBorderRadius,
-        CSSPropertyWebkitTransformOrigin
-    };
-
-    for (size_t i = 0; i < WTF_ARRAY_LENGTH(animatableShorthandProperties); ++i) {
-        CSSPropertyID propertyID = animatableShorthandProperties[i];
-        StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
-        if (shorthand.length() > 0)
-            addPropertyWrapper(propertyID, new ShorthandPropertyWrapper(propertyID, shorthand));
-    }
-}
-
-void CSSPropertyAnimation::ensurePropertyMap()
-{
-    // FIXME: This data is never destroyed. Maybe we should ref count it and toss it when the last AnimationController is destroyed?
-    if (gPropertyWrappers)
-        return;
-
-    gPropertyWrappers = new Vector<AnimationPropertyWrapperBase*>();
-
-    // build the list of property wrappers to do the comparisons and blends
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLeft, &RenderStyle::left, &RenderStyle::setLeft));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyRight, &RenderStyle::right, &RenderStyle::setRight));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTop, &RenderStyle::top, &RenderStyle::setTop));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyBottom, &RenderStyle::bottom, &RenderStyle::setBottom));
-
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWidth, &RenderStyle::width, &RenderStyle::setWidth));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinWidth, &RenderStyle::minWidth, &RenderStyle::setMinWidth));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxWidth, &RenderStyle::maxWidth, &RenderStyle::setMaxWidth));
-
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyHeight, &RenderStyle::height, &RenderStyle::setHeight));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinHeight, &RenderStyle::minHeight, &RenderStyle::setMinHeight));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxHeight, &RenderStyle::maxHeight, &RenderStyle::setMaxHeight));
-
-    gPropertyWrappers->append(new PropertyWrapperFlex());
-
-    gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderLeftWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth));
-    gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderRightWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth));
-    gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderTopWidth, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth));
-    gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderBottomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft, &RenderStyle::setMarginLeft));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginRight, &RenderStyle::marginRight, &RenderStyle::setMarginRight));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginTop, &RenderStyle::marginTop, &RenderStyle::setMarginTop));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginBottom, &RenderStyle::marginBottom, &RenderStyle::setMarginBottom));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingLeft, &RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingRight, &RenderStyle::paddingRight, &RenderStyle::setPaddingRight));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom));
-    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkColor, &RenderStyle::setVisitedLinkColor));
-
-    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor, &RenderStyle::visitedLinkBackgroundColor, &RenderStyle::setVisitedLinkBackgroundColor));
-
-    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundImage, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
-    gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyListStyleImage, &RenderStyle::listStyleImage, &RenderStyle::setListStyleImage));
-    gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMaskImage, &RenderStyle::maskImage, &RenderStyle::setMaskImage));
-
-    gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyBorderImageSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource));
-    gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderImageSlice, &RenderStyle::borderImageSlices, &RenderStyle::setBorderImageSlices));
-    gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderImageWidth, &RenderStyle::borderImageWidth, &RenderStyle::setBorderImageWidth));
-    gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderImageOutset, &RenderStyle::borderImageOutset, &RenderStyle::setBorderImageOutset));
-
-    gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMaskBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImageSource));
-    gPropertyWrappers->append(new PropertyWrapper<const NinePieceImage&>(CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage));
-
-    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
-    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
-    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
-    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
-
-    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
-    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
-    gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskSize, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
-
-    gPropertyWrappers->append(new PropertyWrapper<LengthPoint>(CSSPropertyObjectPosition, &RenderStyle::objectPosition, &RenderStyle::setObjectPosition));
-
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFontSize,
-        // Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size
-        // if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same).
-        // FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to
-        // enable text zoom rather than Text Autosizing? See http://crbug.com/227545.
-        &RenderStyle::specifiedFontSize,
-        &RenderStyle::setFontSize));
-    gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWebkitColumnRuleWidth, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth));
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumnGap, &RenderStyle::columnGap, &RenderStyle::setColumnGap));
-    gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWebkitColumnCount, &RenderStyle::columnCount, &RenderStyle::setColumnCount));
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumnWidth, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth));
-    gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorderHorizontalSpacing, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHorizontalBorderSpacing));
-    gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorderVerticalSpacing, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalBorderSpacing));
-    gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyZIndex, &RenderStyle::zIndex, &RenderStyle::setZIndex));
-    gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyOrphans, &RenderStyle::orphans, &RenderStyle::setOrphans));
-    gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWidows, &RenderStyle::widows, &RenderStyle::setWidows));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight, &RenderStyle::setLineHeight));
-    gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset));
-    gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyOutlineWidth, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth));
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyLetterSpacing, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing));
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTextIndent, &RenderStyle::textIndent, &RenderStyle::setTextIndent));
-
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitPerspective, &RenderStyle::perspective, &RenderStyle::setPerspective));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPerspectiveOriginX, &RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPerspectiveOriginY, &RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOriginY));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTransformOriginX, &RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX));
-    gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTransformOriginY, &RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY));
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitTransformOriginZ, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ));
-    gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderTopLeftRadius, &RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius));
-    gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderTopRightRadius, &RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius));
-    gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderBottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius));
-    gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius));
-    gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibility, &RenderStyle::visibility, &RenderStyle::setVisibility));
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoomWithoutReturnValue));
-
-    gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip));
-
-    gPropertyWrappers->append(new PropertyWrapperAcceleratedOpacity());
-    gPropertyWrappers->append(new PropertyWrapperAcceleratedTransform());
-    gPropertyWrappers->append(new PropertyWrapperAcceleratedFilter());
-
-    gPropertyWrappers->append(new PropertyWrapperClipPath(CSSPropertyWebkitClipPath, &RenderStyle::clipPath, &RenderStyle::setClipPath));
-
-    gPropertyWrappers->append(new PropertyWrapperShape(CSSPropertyWebkitShapeInside, &RenderStyle::shapeInside, &RenderStyle::setShapeInside));
-
-    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitColumnRuleColor, MaybeInvalidColor, &RenderStyle::columnRuleColor, &RenderStyle::setColumnRuleColor, &RenderStyle::visitedLinkColumnRuleColor, &RenderStyle::setVisitedLinkColumnRuleColor));
-    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitTextStrokeColor, MaybeInvalidColor, &RenderStyle::textStrokeColor, &RenderStyle::setTextStrokeColor, &RenderStyle::visitedLinkTextStrokeColor, &RenderStyle::setVisitedLinkTextStrokeColor));
-    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyWebkitTextFillColor, MaybeInvalidColor, &RenderStyle::textFillColor, &RenderStyle::setTextFillColor, &RenderStyle::visitedLinkTextFillColor, &RenderStyle::setVisitedLinkTextFillColor));
-    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderLeftColor, MaybeInvalidColor, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::visitedLinkBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor));
-    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderRightColor, MaybeInvalidColor, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::visitedLinkBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor));
-    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderTopColor, MaybeInvalidColor, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::visitedLinkBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor));
-    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyBorderBottomColor, MaybeInvalidColor, &RenderStyle::borderBottomColor, &RenderStyle::setBorderBottomColor, &RenderStyle::visitedLinkBorderBottomColor, &RenderStyle::setVisitedLinkBorderBottomColor));
-    gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropertyOutlineColor, MaybeInvalidColor, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, &RenderStyle::visitedLinkOutlineColor, &RenderStyle::setVisitedLinkOutlineColor));
-
-    gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyBoxShadow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow));
-    gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyWebkitBoxShadow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow));
-    gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyTextShadow, &RenderStyle::textShadow, &RenderStyle::setTextShadow));
-
-    gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyFill, &RenderStyle::fillPaintType, &RenderStyle::fillPaintColor, &RenderStyle::setFillPaintColor));
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFillOpacity, &RenderStyle::fillOpacity, &RenderStyle::setFillOpacity));
-
-    gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyStroke, &RenderStyle::strokePaintType, &RenderStyle::strokePaintColor, &RenderStyle::setStrokePaintColor));
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeOpacity, &RenderStyle::strokeOpacity, &RenderStyle::setStrokeOpacity));
-    gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyStrokeWidth, &RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth));
-    gPropertyWrappers->append(new PropertyWrapper< Vector<SVGLength> >(CSSPropertyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStrokeDashArray));
-    gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyStrokeDashoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDashOffset));
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeMiterlimit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit));
-
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFloodOpacity, &RenderStyle::floodOpacity, &RenderStyle::setFloodOpacity));
-    gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyFloodColor, &RenderStyle::floodColor, &RenderStyle::setFloodColor));
-
-    gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStopOpacity, &RenderStyle::stopOpacity, &RenderStyle::setStopOpacity));
-    gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyStopColor, &RenderStyle::stopColor, &RenderStyle::setStopColor));
-
-    gPropertyWrappers->append(new PropertyWrapperMaybeInvalidColor(CSSPropertyLightingColor, &RenderStyle::lightingColor, &RenderStyle::setLightingColor));
-
-    gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyBaselineShift, &RenderStyle::baselineShiftValue, &RenderStyle::setBaselineShiftValue));
-    gPropertyWrappers->append(new PropertyWrapper<SVGLength>(CSSPropertyKerning, &RenderStyle::kerning, &RenderStyle::setKerning));
-
-    // TODO:
-    //
-    //  CSSPropertyVerticalAlign
-    //
-    // Compound properties that have components that should be animatable:
-    //
-    //  CSSPropertyWebkitColumns
-    //  CSSPropertyWebkitBoxReflect
-
-    // Make sure unused slots have a value
-    for (unsigned int i = 0; i < static_cast<unsigned int>(numCSSProperties); ++i)
-        gPropertyWrapperMap[i] = cInvalidPropertyWrapperIndex;
-
-    // First we put the non-shorthand property wrappers into the map, so the shorthand-building
-    // code can find them.
-    size_t n = gPropertyWrappers->size();
-    for (unsigned int i = 0; i < n; ++i) {
-        CSSPropertyID property = (*gPropertyWrappers)[i]->property();
-        ASSERT_WITH_MESSAGE(CSSAnimations::isAnimatableProperty(property), "%s is not whitelisted for animation", getPropertyNameString(property).utf8().data());
-        ASSERT(property - firstCSSProperty < numCSSProperties);
-        gPropertyWrapperMap[property - firstCSSProperty] = i;
-    }
-
-    // Now add the shorthand wrappers.
-    addShorthandProperties();
-}
-
-// Returns true if we need to start animation timers
-bool CSSPropertyAnimation::blendProperties(const AnimationBase* anim, CSSPropertyID prop, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress)
-{
-    ASSERT(prop != CSSPropertyInvalid);
-
-    ensurePropertyMap();
-
-    AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop);
-    if (wrapper) {
-        wrapper->blend(anim, dst, a, b, progress);
-        return !wrapper->animationIsAccelerated() || !anim->isAccelerated();
-    }
-
-    return false;
-}
-
-bool CSSPropertyAnimation::animationOfPropertyIsAccelerated(CSSPropertyID prop)
-{
-    ensurePropertyMap();
-    AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop);
-    return wrapper ? wrapper->animationIsAccelerated() : false;
-}
-
-bool CSSPropertyAnimation::propertiesEqual(CSSPropertyID prop, const RenderStyle* a, const RenderStyle* b)
-{
-    ensurePropertyMap();
-
-    AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop);
-    if (wrapper)
-        return wrapper->equals(a, b);
-    return true;
-}
-
-CSSPropertyID CSSPropertyAnimation::getPropertyAtIndex(int i, bool& isShorthand)
-{
-    ensurePropertyMap();
-
-    if (i < 0 || i >= getNumProperties())
-        return CSSPropertyInvalid;
-
-    AnimationPropertyWrapperBase* wrapper = (*gPropertyWrappers)[i];
-    isShorthand = wrapper->isShorthandWrapper();
-    return wrapper->property();
-}
-
-int CSSPropertyAnimation::getNumProperties()
-{
-    ensurePropertyMap();
-
-    return gPropertyWrappers->size();
-}
-
-}
diff --git a/Source/core/page/animation/CompositeAnimation.cpp b/Source/core/page/animation/CompositeAnimation.cpp
deleted file mode 100644
index 7615715..0000000
--- a/Source/core/page/animation/CompositeAnimation.cpp
+++ /dev/null
@@ -1,562 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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/page/animation/CompositeAnimation.h"
-
-#include "CSSPropertyNames.h"
-#include "core/page/animation/AnimationControllerPrivate.h"
-#include "core/page/animation/CSSPropertyAnimation.h"
-#include "core/page/animation/ImplicitAnimation.h"
-#include "core/page/animation/KeyframeAnimation.h"
-#include "core/rendering/style/RenderStyle.h"
-
-namespace WebCore {
-
-CompositeAnimation::~CompositeAnimation()
-{
-    // Toss the refs to all animations, but make sure we remove them from
-    // any waiting lists first.
-
-    clearRenderer();
-    m_transitions.clear();
-    m_keyframeAnimations.clear();
-}
-
-void CompositeAnimation::clearRenderer()
-{
-    if (!m_transitions.isEmpty()) {
-        // Clear the renderers from all running animations, in case we are in the middle of
-        // an animation callback (see https://bugs.webkit.org/show_bug.cgi?id=22052)
-        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
-        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
-            ImplicitAnimation* transition = it->value.get();
-            animationController()->animationWillBeRemoved(transition);
-            transition->clear();
-        }
-    }
-    if (!m_keyframeAnimations.isEmpty()) {
-        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
-        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
-            KeyframeAnimation* anim = it->value.get();
-            animationController()->animationWillBeRemoved(anim);
-            anim->clear();
-        }
-    }
-}
-
-void CompositeAnimation::updateTransitions(RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle)
-{
-    // If currentStyle is null or there are no old or new transitions, just skip it
-    if (!currentStyle || (!targetStyle->transitions() && m_transitions.isEmpty()))
-        return;
-
-    // Mark all existing transitions as no longer active. We will mark the still active ones
-    // in the next loop and then toss the ones that didn't get marked.
-    CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
-    for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it)
-        it->value->setActive(false);
-
-    RefPtr<RenderStyle> modifiedCurrentStyle;
-
-    // Check to see if we need to update the active transitions
-    if (targetStyle->transitions()) {
-        for (size_t i = 0; i < targetStyle->transitions()->size(); ++i) {
-            const CSSAnimationData* anim = targetStyle->transitions()->animation(i);
-            bool isActiveTransition = anim->duration() || anim->delay() > 0;
-
-            CSSAnimationData::AnimationMode mode = anim->animationMode();
-            if (mode == CSSAnimationData::AnimateNone)
-                continue;
-
-            CSSPropertyID prop = anim->property();
-
-            bool all = mode == CSSAnimationData::AnimateAll;
-
-            // Handle both the 'all' and single property cases. For the single prop case, we make only one pass
-            // through the loop.
-            for (int propertyIndex = 0; propertyIndex < CSSPropertyAnimation::getNumProperties(); ++propertyIndex) {
-                if (all) {
-                    // Get the next property which is not a shorthand.
-                    bool isShorthand;
-                    prop = CSSPropertyAnimation::getPropertyAtIndex(propertyIndex, isShorthand);
-                    if (isShorthand)
-                        continue;
-                }
-
-                // ImplicitAnimations are always hashed by actual properties, never animateAll.
-                ASSERT(prop >= firstCSSProperty && prop < (firstCSSProperty + numCSSProperties));
-
-                // If there is a running animation for this property, the transition is overridden
-                // and we have to use the unanimatedStyle from the animation. We do the test
-                // against the unanimated style here, but we "override" the transition later.
-                RefPtr<KeyframeAnimation> keyframeAnim = getAnimationForProperty(prop);
-                RenderStyle* fromStyle = keyframeAnim ? keyframeAnim->unanimatedStyle() : currentStyle;
-
-                // See if there is a current transition for this prop
-                ImplicitAnimation* implAnim = m_transitions.get(prop);
-                bool equal = true;
-
-                if (implAnim) {
-                    // If we are post active don't bother setting the active flag. This will cause
-                    // this animation to get removed at the end of this function.
-                    if (!implAnim->postActive())
-                        implAnim->setActive(true);
-
-                    // This might be a transition that is just finishing. That would be the case
-                    // if it were postActive. But we still need to check for equality because
-                    // it could be just finishing AND changing to a new goal state.
-                    //
-                    // This implAnim might also not be an already running transition. It might be
-                    // newly added to the list in a previous iteration. This would happen if
-                    // you have both an explicit transition-property and 'all' in the same
-                    // list. In this case, the latter one overrides the earlier one, so we
-                    // behave as though this is a running animation being replaced.
-                    if (!implAnim->isTargetPropertyEqual(prop, targetStyle)) {
-                        // For accelerated animations we need to return a new RenderStyle with the _current_ value
-                        // of the property, so that restarted transitions use the correct starting point.
-                        if (CSSPropertyAnimation::animationOfPropertyIsAccelerated(prop) && implAnim->isAccelerated()) {
-                            if (!modifiedCurrentStyle)
-                                modifiedCurrentStyle = RenderStyle::clone(currentStyle);
-
-                            implAnim->blendPropertyValueInStyle(prop, modifiedCurrentStyle.get());
-                        }
-                        animationController()->animationWillBeRemoved(implAnim);
-                        m_transitions.remove(prop);
-                        equal = false;
-                    }
-                } else {
-                    // We need to start a transition if it is active and the properties don't match
-                    equal = !isActiveTransition || CSSPropertyAnimation::propertiesEqual(prop, fromStyle, targetStyle);
-                }
-
-                // We can be in this loop with an inactive transition (!isActiveTransition). We need
-                // to do that to check to see if we are canceling a transition. But we don't want to
-                // start one of the inactive transitions. So short circuit that here. (See
-                // <https://bugs.webkit.org/show_bug.cgi?id=24787>
-                if (!equal && isActiveTransition) {
-                    // Add the new transition
-                    m_transitions.set(prop, ImplicitAnimation::create(const_cast<CSSAnimationData*>(anim), prop, renderer, this, modifiedCurrentStyle ? modifiedCurrentStyle.get() : fromStyle));
-                }
-
-                // We only need one pass for the single prop case
-                if (!all)
-                    break;
-            }
-        }
-    }
-
-    // Make a list of transitions to be removed
-    Vector<int> toBeRemoved;
-    end = m_transitions.end();
-    for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
-        ImplicitAnimation* anim = it->value.get();
-        if (!anim->active()) {
-            animationController()->animationWillBeRemoved(anim);
-            toBeRemoved.append(anim->animatingProperty());
-        }
-    }
-
-    // Now remove the transitions from the list
-    for (size_t j = 0; j < toBeRemoved.size(); ++j)
-        m_transitions.remove(toBeRemoved[j]);
-}
-
-void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle)
-{
-    // Nothing to do if we don't have any animations, and didn't have any before
-    if (m_keyframeAnimations.isEmpty() && !targetStyle->hasAnimations())
-        return;
-
-    AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end();
-
-    if (currentStyle && currentStyle->hasAnimations() && targetStyle->hasAnimations() && *(currentStyle->animations()) == *(targetStyle->animations())) {
-        // The current and target animations are the same so we just need to toss any
-        // animation which is finished (postActive).
-        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
-            if (it->value->postActive())
-                it->value->setIndex(-1);
-        }
-    } else {
-        // Mark all existing animations as no longer active.
-        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it)
-            it->value->setIndex(-1);
-
-        // Toss the animation order map.
-        m_keyframeAnimationOrderList.clear();
-
-        DEFINE_STATIC_LOCAL(const AtomicString, none, ("none", AtomicString::ConstructFromLiteral));
-
-        // Now mark any still active animations as active and add any new animations.
-        if (targetStyle->animations()) {
-            int numAnims = targetStyle->animations()->size();
-            for (int i = 0; i < numAnims; ++i) {
-                const CSSAnimationData* anim = targetStyle->animations()->animation(i);
-                if (!anim->isValidAnimation())
-                    continue;
-
-                // See if there is a current animation for this name.
-                AtomicString name(anim->name());
-                RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(name);
-                if (keyframeAnim) {
-                    // If this animation is postActive, skip it so it gets removed at the end of this function.
-                    if (keyframeAnim->postActive())
-                        continue;
-
-                    // This one is still active.
-
-                    // Animations match, but play states may differ. Update if needed.
-                    keyframeAnim->updatePlayState(anim->playState());
-
-                    // Set the saved animation to this new one, just in case the play state has changed.
-                    keyframeAnim->setAnimation(anim);
-                    keyframeAnim->setIndex(i);
-                } else if ((anim->duration() || anim->delay()) && anim->iterationCount() && name != none) {
-                    keyframeAnim = KeyframeAnimation::create(const_cast<CSSAnimationData*>(anim), renderer, i, this, targetStyle);
-                    m_keyframeAnimations.set(name, keyframeAnim);
-                }
-
-                // Add this to the animation order map.
-                if (keyframeAnim)
-                    m_keyframeAnimationOrderList.append(name);
-            }
-        }
-    }
-
-    // Make a list of animations to be removed.
-    Vector<AtomicString> animsToBeRemoved;
-    kfend = m_keyframeAnimations.end();
-    for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
-        KeyframeAnimation* keyframeAnim = it->value.get();
-        if (keyframeAnim->index() < 0) {
-            animsToBeRemoved.append(keyframeAnim->name());
-            animationController()->animationWillBeRemoved(keyframeAnim);
-            keyframeAnim->clear();
-        }
-    }
-
-    // Now remove the animations from the list, and keep stale keys out of the order list.
-    if (animsToBeRemoved.size()) {
-        for (size_t j = 0; j < animsToBeRemoved.size(); ++j) {
-            ASSERT(m_keyframeAnimations.contains(animsToBeRemoved[j]));
-            m_keyframeAnimations.remove(animsToBeRemoved[j]);
-        }
-        Vector<AtomicString> newOrderList;
-        for (size_t j = 0; j < m_keyframeAnimationOrderList.size(); ++j) {
-            AtomicString key = m_keyframeAnimationOrderList[j];
-            if (m_keyframeAnimations.contains(key))
-                newOrderList.append(key);
-        }
-        m_keyframeAnimationOrderList.swap(newOrderList);
-    }
-}
-
-PassRefPtr<RenderStyle> CompositeAnimation::animate(RenderObject* renderer, RenderStyle* currentStyle, RenderStyle* targetStyle)
-{
-    RefPtr<RenderStyle> resultStyle;
-
-    // We don't do any transitions if we don't have a currentStyle (on startup).
-    updateTransitions(renderer, currentStyle, targetStyle);
-    updateKeyframeAnimations(renderer, currentStyle, targetStyle);
-
-    if (currentStyle) {
-        // Now that we have transition objects ready, let them know about the new goal state.  We want them
-        // to fill in a RenderStyle*& only if needed.
-        if (!m_transitions.isEmpty()) {
-            CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
-            for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
-                if (ImplicitAnimation* anim = it->value.get())
-                    anim->animate(this, renderer, currentStyle, targetStyle, resultStyle);
-            }
-        }
-    }
-
-    // Now that we have animation objects ready, let them know about the new goal state.  We want them
-    // to fill in a RenderStyle*& only if needed.
-    for (Vector<AtomicString>::const_iterator it = m_keyframeAnimationOrderList.begin(); it != m_keyframeAnimationOrderList.end(); ++it) {
-        RefPtr<KeyframeAnimation> keyframeAnim = m_keyframeAnimations.get(*it);
-        ASSERT(keyframeAnim);
-        keyframeAnim->animate(this, renderer, currentStyle, targetStyle, resultStyle);
-    }
-
-    return resultStyle ? resultStyle.release() : targetStyle;
-}
-
-PassRefPtr<RenderStyle> CompositeAnimation::getAnimatedStyle() const
-{
-    RefPtr<RenderStyle> resultStyle;
-    CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
-    for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
-        if (ImplicitAnimation* implicitAnimation = it->value.get())
-            implicitAnimation->getAnimatedStyle(resultStyle);
-    }
-
-    for (Vector<AtomicString>::const_iterator it = m_keyframeAnimationOrderList.begin(); it != m_keyframeAnimationOrderList.end(); ++it) {
-        RefPtr<KeyframeAnimation> keyframeAnimation = m_keyframeAnimations.get(*it);
-        ASSERT(keyframeAnimation);
-        keyframeAnimation->getAnimatedStyle(resultStyle);
-    }
-
-    return resultStyle;
-}
-
-double CompositeAnimation::timeToNextService() const
-{
-    // Returns the time at which next service is required. -1 means no service is required. 0 means
-    // service is required now, and > 0 means service is required that many seconds in the future.
-    double minT = -1;
-
-    if (!m_transitions.isEmpty()) {
-        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
-        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
-            ImplicitAnimation* transition = it->value.get();
-            double t = transition ? transition->timeToNextService() : -1;
-            if (t < minT || minT == -1)
-                minT = t;
-            if (minT == 0)
-                return 0;
-        }
-    }
-    if (!m_keyframeAnimations.isEmpty()) {
-        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
-        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
-            KeyframeAnimation* animation = it->value.get();
-            double t = animation ? animation->timeToNextService() : -1;
-            if (t < minT || minT == -1)
-                minT = t;
-            if (minT == 0)
-                return 0;
-        }
-    }
-
-    return minT;
-}
-
-double CompositeAnimation::timeToNextEvent() const
-{
-    // Returns the time at which next service to trigger events is required. -1 means no service is required. 0 means
-    // service is required now, and > 0 means service is required that many seconds in the future.
-    double minT = -1;
-
-    if (!m_transitions.isEmpty()) {
-        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
-        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
-            ImplicitAnimation* transition = it->value.get();
-            double t = -1;
-            bool isLooping;
-            if (transition)
-                transition->getTimeToNextEvent(t, isLooping);
-            if (t < minT || minT == -1)
-                minT = t;
-            if (!minT)
-                return 0;
-        }
-    }
-    if (!m_keyframeAnimations.isEmpty()) {
-        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
-        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
-            KeyframeAnimation* animation = it->value.get();
-            double t = -1;
-            bool isLooping;
-            if (animation)
-                animation->getTimeToNextEvent(t, isLooping);
-            if (t < minT || minT == -1)
-                minT = t;
-            if (!minT)
-                return 0;
-        }
-    }
-
-    return minT;
-}
-
-PassRefPtr<KeyframeAnimation> CompositeAnimation::getAnimationForProperty(CSSPropertyID property) const
-{
-    RefPtr<KeyframeAnimation> retval;
-
-    // We want to send back the last animation with the property if there are multiples.
-    // So we need to iterate through all animations
-    if (!m_keyframeAnimations.isEmpty()) {
-        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
-        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
-            RefPtr<KeyframeAnimation> anim = it->value;
-            if (anim->hasAnimationForProperty(property))
-                retval = anim;
-        }
-    }
-
-    return retval;
-}
-
-void CompositeAnimation::suspendAnimations()
-{
-    if (m_suspended)
-        return;
-
-    m_suspended = true;
-
-    if (!m_keyframeAnimations.isEmpty()) {
-        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
-        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
-            if (KeyframeAnimation* anim = it->value.get())
-                anim->updatePlayState(AnimPlayStatePaused);
-        }
-    }
-    if (!m_transitions.isEmpty()) {
-        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
-        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
-            ImplicitAnimation* anim = it->value.get();
-            if (anim && anim->hasStyle())
-                anim->updatePlayState(AnimPlayStatePaused);
-        }
-    }
-}
-
-void CompositeAnimation::resumeAnimations()
-{
-    if (!m_suspended)
-        return;
-
-    m_suspended = false;
-
-    if (!m_keyframeAnimations.isEmpty()) {
-        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
-        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
-            KeyframeAnimation* anim = it->value.get();
-            if (anim && anim->playStatePlaying())
-                anim->updatePlayState(AnimPlayStatePlaying);
-        }
-    }
-
-    if (!m_transitions.isEmpty()) {
-        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
-        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
-            ImplicitAnimation* anim = it->value.get();
-            if (anim && anim->hasStyle())
-                anim->updatePlayState(AnimPlayStatePlaying);
-        }
-    }
-}
-
-void CompositeAnimation::overrideImplicitAnimations(CSSPropertyID property)
-{
-    CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
-    if (!m_transitions.isEmpty()) {
-        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
-            ImplicitAnimation* anim = it->value.get();
-            if (anim && anim->animatingProperty() == property)
-                anim->setOverridden(true);
-        }
-    }
-}
-
-void CompositeAnimation::resumeOverriddenImplicitAnimations(CSSPropertyID property)
-{
-    if (!m_transitions.isEmpty()) {
-        CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
-        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
-            ImplicitAnimation* anim = it->value.get();
-            if (anim && anim->animatingProperty() == property)
-                anim->setOverridden(false);
-        }
-    }
-}
-
-bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, bool isRunningNow) const
-{
-    if (!m_keyframeAnimations.isEmpty()) {
-        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
-        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
-            KeyframeAnimation* anim = it->value.get();
-            if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isRunningNow))
-                return true;
-        }
-    }
-
-    if (!m_transitions.isEmpty()) {
-        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
-        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
-            ImplicitAnimation* anim = it->value.get();
-            if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isRunningNow))
-                return true;
-        }
-    }
-    return false;
-}
-
-void CompositeAnimation::pauseAnimationsForTesting(double t)
-{
-    AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
-    for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
-        RefPtr<KeyframeAnimation> keyframeAnim = it->value;
-        if (!keyframeAnim || !keyframeAnim->running())
-            continue;
-
-        double count = keyframeAnim->m_animation->iterationCount();
-        if ((t >= 0.0) && ((count == CSSAnimationData::IterationCountInfinite) || (t <= count * keyframeAnim->duration())))
-            keyframeAnim->freezeAtTime(t);
-    }
-
-    CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
-    for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
-        RefPtr<ImplicitAnimation> implAnim = it->value;
-
-        if (!implAnim->running())
-            continue;
-
-        if ((t >= 0.0) && (t <= implAnim->duration()))
-            implAnim->freezeAtTime(t);
-    }
-}
-
-unsigned CompositeAnimation::numberOfActiveAnimations() const
-{
-    unsigned count = 0;
-
-    if (!m_keyframeAnimations.isEmpty()) {
-        AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
-        for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
-            KeyframeAnimation* anim = it->value.get();
-            if (anim->running())
-                ++count;
-        }
-    }
-
-    if (!m_transitions.isEmpty()) {
-        CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
-        for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
-            ImplicitAnimation* anim = it->value.get();
-            if (anim->running())
-                ++count;
-        }
-    }
-
-    return count;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/animation/CompositeAnimation.h b/Source/core/page/animation/CompositeAnimation.h
deleted file mode 100644
index 96221ba..0000000
--- a/Source/core/page/animation/CompositeAnimation.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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 CompositeAnimation_h
-#define CompositeAnimation_h
-
-#include "core/page/animation/ImplicitAnimation.h"
-#include "core/page/animation/KeyframeAnimation.h"
-#include "wtf/HashMap.h"
-
-namespace WebCore {
-
-class AnimationControllerPrivate;
-class AnimationController;
-class RenderObject;
-class RenderStyle;
-
-// A CompositeAnimation represents a collection of animations that are running
-// on a single RenderObject, such as a number of properties transitioning at once.
-class CompositeAnimation : public RefCounted<CompositeAnimation> {
-public:
-    static PassRefPtr<CompositeAnimation> create(AnimationControllerPrivate* animationController)
-    {
-        return adoptRef(new CompositeAnimation(animationController));
-    };
-
-    ~CompositeAnimation();
-
-    void clearRenderer();
-
-    PassRefPtr<RenderStyle> animate(RenderObject*, RenderStyle* currentStyle, RenderStyle* targetStyle);
-    PassRefPtr<RenderStyle> getAnimatedStyle() const;
-
-    double timeToNextService() const;
-    double timeToNextEvent() const;
-
-    AnimationControllerPrivate* animationController() const { return m_animationController; }
-
-    void suspendAnimations();
-    void resumeAnimations();
-    bool suspended() const { return m_suspended; }
-
-    bool hasAnimations() const  { return !m_transitions.isEmpty() || !m_keyframeAnimations.isEmpty(); }
-
-    bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, bool isRunningNow) const;
-
-    PassRefPtr<KeyframeAnimation> getAnimationForProperty(CSSPropertyID) const;
-
-    void overrideImplicitAnimations(CSSPropertyID);
-    void resumeOverriddenImplicitAnimations(CSSPropertyID);
-
-    void pauseAnimationsForTesting(double t);
-    unsigned numberOfActiveAnimations() const;
-
-private:
-    CompositeAnimation(AnimationControllerPrivate* animationController)
-        : m_animationController(animationController)
-        , m_suspended(false)
-    {
-    }
-
-    void updateTransitions(RenderObject*, RenderStyle* currentStyle, RenderStyle* targetStyle);
-    void updateKeyframeAnimations(RenderObject*, RenderStyle* currentStyle, RenderStyle* targetStyle);
-
-    typedef HashMap<int, RefPtr<ImplicitAnimation> > CSSPropertyTransitionsMap;
-    typedef HashMap<AtomicString, RefPtr<KeyframeAnimation> > AnimationNameMap;
-
-    AnimationControllerPrivate* m_animationController;
-    CSSPropertyTransitionsMap m_transitions;
-    AnimationNameMap m_keyframeAnimations;
-    Vector<AtomicString> m_keyframeAnimationOrderList;
-    bool m_suspended;
-};
-
-} // namespace WebCore
-
-#endif // CompositeAnimation_h
diff --git a/Source/core/page/animation/ImplicitAnimation.cpp b/Source/core/page/animation/ImplicitAnimation.cpp
deleted file mode 100644
index 9120c90..0000000
--- a/Source/core/page/animation/ImplicitAnimation.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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/events/EventNames.h"
-#include "core/page/UseCounter.h"
-#include "core/page/animation/AnimationControllerPrivate.h"
-#include "core/page/animation/CSSPropertyAnimation.h"
-#include "core/page/animation/CompositeAnimation.h"
-#include "core/page/animation/ImplicitAnimation.h"
-#include "core/page/animation/KeyframeAnimation.h"
-#include "core/rendering/RenderBoxModelObject.h"
-#include "public/platform/Platform.h"
-
-namespace WebCore {
-
-ImplicitAnimation::ImplicitAnimation(const CSSAnimationData* transition, CSSPropertyID animatingProperty, RenderObject* renderer, CompositeAnimation* compAnim, RenderStyle* fromStyle)
-    : AnimationBase(transition, renderer, compAnim)
-    , m_transitionProperty(transition->property())
-    , m_animatingProperty(animatingProperty)
-    , m_overridden(false)
-    , m_active(true)
-    , m_fromStyle(fromStyle)
-{
-    ASSERT(animatingProperty != CSSPropertyInvalid);
-    WebKit::Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(m_animatingProperty));
-}
-
-ImplicitAnimation::~ImplicitAnimation()
-{
-    // // Make sure to tell the renderer that we are ending. This will make sure any accelerated animations are removed.
-    if (!postActive())
-        endAnimation();
-}
-
-bool ImplicitAnimation::shouldSendEventForListener(Document::ListenerType inListenerType) const
-{
-    return m_object->document().hasListenerType(inListenerType);
-}
-
-void ImplicitAnimation::animate(CompositeAnimation*, RenderObject*, const RenderStyle*, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle)
-{
-    // If we get this far and the animation is done, it means we are cleaning up a just finished animation.
-    // So just return. Everything is already all cleaned up.
-    if (postActive())
-        return;
-
-    // Reset to start the transition if we are new
-    if (isNew())
-        reset(targetStyle);
-
-    // Run a cycle of animation.
-    // We know we will need a new render style, so make one if needed
-    if (!animatedStyle)
-        animatedStyle = RenderStyle::clone(targetStyle);
-
-    bool needsAnim = CSSPropertyAnimation::blendProperties(this, m_animatingProperty, animatedStyle.get(), m_fromStyle.get(), m_toStyle.get(), progress(1, 0, 0));
-    // FIXME: we also need to detect cases where we have to software animate for other reasons,
-    // such as a child using inheriting the transform. https://bugs.webkit.org/show_bug.cgi?id=23902
-    if (!needsAnim)
-        // If we are running an accelerated animation, set a flag in the style which causes the style
-        // to compare as different to any other style. This ensures that changes to the property
-        // that is animating are correctly detected during the animation (e.g. when a transition
-        // gets interrupted).
-        animatedStyle->setIsRunningAcceleratedAnimation();
-
-    // Fire the start timeout if needed
-    fireAnimationEventsIfNeeded();
-}
-
-void ImplicitAnimation::getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle)
-{
-    if (!animatedStyle)
-        animatedStyle = RenderStyle::clone(m_toStyle.get());
-
-    CSSPropertyAnimation::blendProperties(this, m_animatingProperty, animatedStyle.get(), m_fromStyle.get(), m_toStyle.get(), progress(1, 0, 0));
-}
-
-bool ImplicitAnimation::startAnimation(double timeOffset)
-{
-    if (m_object && m_object->isComposited())
-        return toRenderBoxModelObject(m_object)->startTransition(timeOffset, m_animatingProperty, m_fromStyle.get(), m_toStyle.get());
-
-    return false;
-}
-
-void ImplicitAnimation::pauseAnimation(double timeOffset)
-{
-    if (!m_object)
-        return;
-
-    if (m_object->isComposited())
-        toRenderBoxModelObject(m_object)->transitionPaused(timeOffset, m_animatingProperty);
-
-    // Restore the original (unanimated) style
-    if (!paused())
-        setNeedsStyleRecalc(m_object->node());
-}
-
-void ImplicitAnimation::endAnimation()
-{
-    if (m_object && m_object->isComposited())
-        toRenderBoxModelObject(m_object)->transitionFinished(m_animatingProperty);
-}
-
-void ImplicitAnimation::onAnimationEnd(double elapsedTime)
-{
-    // If we have a keyframe animation on this property, this transition is being overridden. The keyframe
-    // animation keeps an unanimated style in case a transition starts while the keyframe animation is
-    // running. But now that the transition has completed, we need to update this style with its new
-    // destination. If we didn't, the next time through we would think a transition had started
-    // (comparing the old unanimated style with the new final style of the transition).
-    RefPtr<KeyframeAnimation> keyframeAnim = m_compAnim->getAnimationForProperty(m_animatingProperty);
-    if (keyframeAnim)
-        keyframeAnim->setUnanimatedStyle(m_toStyle);
-
-    sendTransitionEvent(eventNames().transitionendEvent, elapsedTime);
-    endAnimation();
-}
-
-bool ImplicitAnimation::sendTransitionEvent(const AtomicString& eventType, double elapsedTime)
-{
-    if (eventType == eventNames().transitionendEvent) {
-        Document::ListenerType listenerType = Document::TRANSITIONEND_LISTENER;
-
-        if (shouldSendEventForListener(listenerType)) {
-            String propertyName = getPropertyNameString(m_animatingProperty);
-
-            // Dispatch the event
-            RefPtr<Element> element = 0;
-            if (m_object->node() && m_object->node()->isElementNode())
-                element = toElement(m_object->node());
-
-            if (!element)
-                return false;
-
-            // Schedule event handling
-            m_compAnim->animationController()->addEventToDispatch(element, eventType, propertyName, elapsedTime);
-
-            // Restore the original (unanimated) style
-            if (eventType == eventNames().transitionendEvent && element->renderer())
-                setNeedsStyleRecalc(element.get());
-
-            return true; // Did dispatch an event
-        }
-    }
-
-    return false; // Didn't dispatch an event
-}
-
-void ImplicitAnimation::reset(RenderStyle* to)
-{
-    ASSERT(to);
-    ASSERT(m_fromStyle);
-
-    m_toStyle = to;
-
-    // Restart the transition
-    if (m_fromStyle && m_toStyle)
-        updateStateMachine(AnimationStateInputRestartAnimation, -1);
-
-    // set the transform animation list
-    validateTransformFunctionList();
-    checkForMatchingFilterFunctionLists();
-}
-
-void ImplicitAnimation::setOverridden(bool b)
-{
-    if (b == m_overridden)
-        return;
-
-    m_overridden = b;
-    updateStateMachine(m_overridden ? AnimationStateInputPauseOverride : AnimationStateInputResumeOverride, -1);
-}
-
-bool ImplicitAnimation::affectsProperty(CSSPropertyID property) const
-{
-    return (m_animatingProperty == property);
-}
-
-bool ImplicitAnimation::isTargetPropertyEqual(CSSPropertyID prop, const RenderStyle* targetStyle)
-{
-    // We can get here for a transition that has not started yet. This would make m_toStyle unset and null.
-    // So we check that here (see <https://bugs.webkit.org/show_bug.cgi?id=26706>)
-    if (!m_toStyle)
-        return false;
-    return CSSPropertyAnimation::propertiesEqual(prop, m_toStyle.get(), targetStyle);
-}
-
-void ImplicitAnimation::blendPropertyValueInStyle(CSSPropertyID prop, RenderStyle* currentStyle)
-{
-    // We should never add a transition with a 0 duration and delay. But if we ever did
-    // it would have a null toStyle. So just in case, let's check that here. (See
-    // <https://bugs.webkit.org/show_bug.cgi?id=24787>
-    if (!m_toStyle)
-        return;
-
-    CSSPropertyAnimation::blendProperties(this, prop, currentStyle, m_fromStyle.get(), m_toStyle.get(), progress(1, 0, 0));
-}
-
-void ImplicitAnimation::validateTransformFunctionList()
-{
-    m_transformFunctionListValid = false;
-
-    if (!m_fromStyle || !m_toStyle)
-        return;
-
-    const TransformOperations* val = &m_fromStyle->transform();
-    const TransformOperations* toVal = &m_toStyle->transform();
-
-    if (val->operations().isEmpty())
-        val = toVal;
-
-    if (val->operations().isEmpty())
-        return;
-
-    // An emtpy transform list matches anything.
-    if (val != toVal && !toVal->operations().isEmpty() && !val->operationsMatch(*toVal))
-        return;
-
-    // Transform lists match.
-    m_transformFunctionListValid = true;
-}
-
-void ImplicitAnimation::checkForMatchingFilterFunctionLists()
-{
-    m_filterFunctionListsMatch = false;
-
-    if (!m_fromStyle || !m_toStyle)
-        return;
-
-    const FilterOperations* val = &m_fromStyle->filter();
-    const FilterOperations* toVal = &m_toStyle->filter();
-
-    if (val->operations().isEmpty())
-        val = toVal;
-
-    if (val->operations().isEmpty())
-        return;
-
-    // An emtpy filter list matches anything.
-    if (val != toVal && !toVal->operations().isEmpty() && !val->operationsMatch(*toVal))
-        return;
-
-    // Filter lists match.
-    m_filterFunctionListsMatch = true;
-}
-
-double ImplicitAnimation::timeToNextService()
-{
-    double t = AnimationBase::timeToNextService();
-    if (t != 0 || preActive())
-        return t;
-
-    // A return value of 0 means we need service. But if this is an accelerated animation we
-    // only need service at the end of the transition.
-    if (CSSPropertyAnimation::animationOfPropertyIsAccelerated(m_animatingProperty) && isAccelerated()) {
-        bool isLooping;
-        getTimeToNextEvent(t, isLooping);
-    }
-
-    return t;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/animation/ImplicitAnimation.h b/Source/core/page/animation/ImplicitAnimation.h
deleted file mode 100644
index a33c2c9..0000000
--- a/Source/core/page/animation/ImplicitAnimation.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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 ImplicitAnimation_h
-#define ImplicitAnimation_h
-
-#include "CSSPropertyNames.h"
-#include "core/dom/Document.h"
-#include "core/page/animation/AnimationBase.h"
-
-namespace WebCore {
-
-// An ImplicitAnimation tracks the state of a transition of a specific CSS property
-// for a single RenderObject.
-class ImplicitAnimation : public AnimationBase {
-public:
-    static PassRefPtr<ImplicitAnimation> create(const CSSAnimationData* animation, CSSPropertyID animatingProperty, RenderObject* renderer, CompositeAnimation* compositeAnimation, RenderStyle* fromStyle)
-    {
-        return adoptRef(new ImplicitAnimation(animation, animatingProperty, renderer, compositeAnimation, fromStyle));
-    };
-
-    CSSPropertyID transitionProperty() const { return m_transitionProperty; }
-    CSSPropertyID animatingProperty() const { return m_animatingProperty; }
-
-    virtual void onAnimationEnd(double elapsedTime);
-    virtual bool startAnimation(double timeOffset);
-    virtual void pauseAnimation(double /*timeOffset*/);
-    virtual void endAnimation();
-
-    virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle* currentStyle, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle);
-    virtual void getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle);
-    virtual void reset(RenderStyle* to);
-
-    void setOverridden(bool);
-    virtual bool overridden() const { return m_overridden; }
-
-    virtual bool affectsProperty(CSSPropertyID) const;
-
-    bool hasStyle() const { return m_fromStyle && m_toStyle; }
-
-    bool isTargetPropertyEqual(CSSPropertyID, const RenderStyle*);
-
-    void blendPropertyValueInStyle(CSSPropertyID, RenderStyle*);
-
-    virtual double timeToNextService();
-
-    bool active() const { return m_active; }
-    void setActive(bool b) { m_active = b; }
-
-protected:
-    bool shouldSendEventForListener(Document::ListenerType) const;
-    bool sendTransitionEvent(const AtomicString&, double elapsedTime);
-
-    void validateTransformFunctionList();
-    void checkForMatchingFilterFunctionLists();
-
-private:
-    ImplicitAnimation(const CSSAnimationData*, CSSPropertyID, RenderObject*, CompositeAnimation*, RenderStyle*);
-    virtual ~ImplicitAnimation();
-
-    CSSPropertyID m_transitionProperty; // Transition property as specified in the RenderStyle.
-    CSSPropertyID m_animatingProperty; // Specific property for this ImplicitAnimation
-    bool m_overridden;          // true when there is a keyframe animation that overrides the transitioning property
-    bool m_active;              // used for culling the list of transitions
-
-    // The two styles that we are blending.
-    RefPtr<RenderStyle> m_fromStyle;
-    RefPtr<RenderStyle> m_toStyle;
-};
-
-} // namespace WebCore
-
-#endif // ImplicitAnimation_h
diff --git a/Source/core/page/animation/KeyframeAnimation.cpp b/Source/core/page/animation/KeyframeAnimation.cpp
deleted file mode 100644
index bba9862..0000000
--- a/Source/core/page/animation/KeyframeAnimation.cpp
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- * Copyright (C) 2007, 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.
- * 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.
- *
- * 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/page/animation/KeyframeAnimation.h"
-
-#include "CSSPropertyNames.h"
-#include "core/css/resolver/StyleResolver.h"
-#include "core/events/EventNames.h"
-#include "core/page/UseCounter.h"
-#include "core/page/animation/AnimationControllerPrivate.h"
-#include "core/page/animation/CSSPropertyAnimation.h"
-#include "core/page/animation/CompositeAnimation.h"
-#include "core/rendering/RenderBoxModelObject.h"
-#include "core/rendering/style/RenderStyle.h"
-#include "public/platform/Platform.h"
-
-using namespace std;
-
-namespace WebCore {
-
-KeyframeAnimation::KeyframeAnimation(const CSSAnimationData* animation, RenderObject* renderer, int index, CompositeAnimation* compAnim, RenderStyle* unanimatedStyle)
-    : AnimationBase(animation, renderer, compAnim)
-    , m_keyframes(renderer, animation->name())
-    , m_index(index)
-    , m_startEventDispatched(false)
-    , m_unanimatedStyle(unanimatedStyle)
-{
-    // Get the keyframe RenderStyles
-    if (m_object && m_object->node() && m_object->node()->isElementNode())
-        m_object->document().styleResolver()->keyframeStylesForAnimation(toElement(m_object->node()), unanimatedStyle, m_keyframes);
-
-    // Update the m_transformFunctionListValid flag based on whether the function lists in the keyframes match.
-    validateTransformFunctionList();
-    checkForMatchingFilterFunctionLists();
-    HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
-    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it)
-        WebKit::Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(*it));
-}
-
-KeyframeAnimation::~KeyframeAnimation()
-{
-    // Make sure to tell the renderer that we are ending. This will make sure any accelerated animations are removed.
-    if (!postActive())
-        endAnimation();
-}
-
-void KeyframeAnimation::fetchIntervalEndpointsForProperty(CSSPropertyID property, const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& prog) const
-{
-    // Find the first key
-    double elapsedTime = getElapsedTime();
-    if (m_animation->duration() && m_animation->iterationCount() != CSSAnimationData::IterationCountInfinite)
-        elapsedTime = min(elapsedTime, m_animation->duration() * m_animation->iterationCount());
-
-    const double fractionalTime = this->fractionalTime(1, elapsedTime, 0);
-
-    size_t numKeyframes = m_keyframes.size();
-    if (!numKeyframes)
-        return;
-
-    ASSERT(!m_keyframes[0].key());
-    ASSERT(m_keyframes[m_keyframes.size() - 1].key() == 1);
-
-    size_t currentIndex = 0;
-    size_t firstIndex = 0;
-    size_t lastIndex = numKeyframes - 1;
-    size_t distance = numKeyframes;
-
-    // Find keyframe that is closest to elapsed time.
-    while (distance > 1) {
-        currentIndex = (lastIndex + firstIndex) >> 1;
-        double key = m_keyframes[currentIndex].key();
-        distance = lastIndex - currentIndex;
-
-        if (key < fractionalTime) {
-            if (distance < 2)
-                currentIndex++;
-            firstIndex = currentIndex;
-        } else {
-            lastIndex = currentIndex;
-        }
-    }
-
-    int prevIndex = -1;
-    int nextIndex = -1;
-
-    // Iterate forward to find next keyframe that is used to animate CSS property.
-    for (size_t i = currentIndex; i < numKeyframes; ++i) {
-        const KeyframeValue& keyFrame = m_keyframes[i];
-        if (keyFrame.key() > fractionalTime && keyFrame.containsProperty(property)) {
-            nextIndex = i;
-            break;
-        }
-    }
-
-    // Iterate backward to find previous keyframe.
-    for (int i = currentIndex; i >= 0; --i) {
-        const KeyframeValue& keyFrame = m_keyframes[i];
-        if (keyFrame.key() <= fractionalTime && keyFrame.containsProperty(property)) {
-            prevIndex = i;
-            break;
-        }
-    }
-
-    double scale = 1;
-    double offset = 0;
-
-    if (prevIndex == -1)
-        prevIndex = 0;
-
-    if (nextIndex == -1)
-        nextIndex = numKeyframes - 1;
-
-    const KeyframeValue& prevKeyframe = m_keyframes[prevIndex];
-    const KeyframeValue& nextKeyframe = m_keyframes[nextIndex];
-
-    fromStyle = prevKeyframe.style();
-    toStyle = nextKeyframe.style();
-
-    offset = prevKeyframe.key();
-    scale = 1.0 / (nextKeyframe.key() - prevKeyframe.key());
-    // A scale of infinity is handled in AnimationBase::fractionalTime().
-    ASSERT(scale >= 0 && (!std::isinf(scale) || prevIndex == nextIndex));
-
-    // FIXME: This sometimes gets the wrong timing function. See crbug.com/288540.
-    const TimingFunction* timingFunction = KeyframeValue::timingFunction(prevKeyframe.style(), name());
-    prog = progress(scale, offset, timingFunction);
-}
-
-void KeyframeAnimation::animate(CompositeAnimation*, RenderObject*, const RenderStyle*, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle)
-{
-    // Fire the start timeout if needed
-    fireAnimationEventsIfNeeded();
-
-    // If we have not yet started, we will not have a valid start time, so just start the animation if needed.
-    if (isNew() && m_animation->playState() == AnimPlayStatePlaying)
-        updateStateMachine(AnimationStateInputStartAnimation, -1);
-
-    // If we get this far and the animation is done, it means we are cleaning up a just finished animation.
-    // If so, we need to send back the targetStyle.
-    if (postActive()) {
-        if (!animatedStyle)
-            animatedStyle = const_cast<RenderStyle*>(targetStyle);
-        return;
-    }
-
-    // If we are waiting for the start timer, we don't want to change the style yet.
-    // Special case 1 - if the delay time is 0, then we do want to set the first frame of the
-    // animation right away. This avoids a flash when the animation starts.
-    // Special case 2 - if there is a backwards fill mode, then we want to continue
-    // through to the style blend so that we get the fromStyle.
-    if (waitingToStart() && m_animation->delay() > 0 && !m_animation->fillsBackwards())
-        return;
-
-    // If we have no keyframes, don't animate.
-    if (!m_keyframes.size()) {
-        updateStateMachine(AnimationStateInputEndAnimation, -1);
-        return;
-    }
-
-    // Run a cycle of animation.
-    // We know we will need a new render style, so make one if needed.
-    if (!animatedStyle)
-        animatedStyle = RenderStyle::clone(targetStyle);
-
-    // FIXME: we need to be more efficient about determining which keyframes we are animating between.
-    // We should cache the last pair or something.
-    HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
-    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
-        // Get the from/to styles and progress between
-        const RenderStyle* fromStyle = 0;
-        const RenderStyle* toStyle = 0;
-        double progress = 0.0;
-        fetchIntervalEndpointsForProperty(*it, fromStyle, toStyle, progress);
-
-        bool needsAnim = CSSPropertyAnimation::blendProperties(this, *it, animatedStyle.get(), fromStyle, toStyle, progress);
-        if (!needsAnim)
-            // If we are running an accelerated animation, set a flag in the style
-            // to indicate it. This can be used to make sure we get an updated
-            // style for hit testing, etc.
-            animatedStyle->setIsRunningAcceleratedAnimation();
-    }
-}
-
-void KeyframeAnimation::getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle)
-{
-    // If we're in the delay phase and we're not backwards filling, tell the caller
-    // to use the current style.
-    if (waitingToStart() && m_animation->delay() > 0 && !m_animation->fillsBackwards())
-        return;
-
-    if (!m_keyframes.size())
-        return;
-
-    if (!animatedStyle)
-        animatedStyle = RenderStyle::clone(m_object->style());
-
-    HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
-    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
-        // Get the from/to styles and progress between
-        const RenderStyle* fromStyle = 0;
-        const RenderStyle* toStyle = 0;
-        double progress = 0.0;
-        fetchIntervalEndpointsForProperty(*it, fromStyle, toStyle, progress);
-
-        CSSPropertyAnimation::blendProperties(this, *it, animatedStyle.get(), fromStyle, toStyle, progress);
-    }
-}
-
-bool KeyframeAnimation::hasAnimationForProperty(CSSPropertyID property) const
-{
-    return m_keyframes.containsProperty(property);
-}
-
-bool KeyframeAnimation::startAnimation(double timeOffset)
-{
-    if (m_object && m_object->isComposited()) {
-        return toRenderBoxModelObject(m_object)->startAnimation(timeOffset, m_animation.get(), m_keyframes);
-    }
-    return false;
-}
-
-void KeyframeAnimation::pauseAnimation(double timeOffset)
-{
-    if (!m_object)
-        return;
-
-    if (m_object->isComposited())
-        toRenderBoxModelObject(m_object)->animationPaused(timeOffset, m_keyframes.animationName());
-
-    // Restore the original (unanimated) style
-    if (!paused())
-        setNeedsStyleRecalc(m_object->node());
-}
-
-void KeyframeAnimation::endAnimation()
-{
-    if (!m_object)
-        return;
-
-    if (m_object->isComposited())
-        toRenderBoxModelObject(m_object)->animationFinished(m_keyframes.animationName());
-
-    // Restore the original (unanimated) style
-    if (!paused())
-        setNeedsStyleRecalc(m_object->node());
-}
-
-bool KeyframeAnimation::shouldSendEventForListener(Document::ListenerType listenerType) const
-{
-    return m_object->document().hasListenerType(listenerType);
-}
-
-void KeyframeAnimation::onAnimationStart(double elapsedTime)
-{
-    sendAnimationEvent(eventNames().animationstartEvent, elapsedTime);
-}
-
-void KeyframeAnimation::onAnimationIteration(double elapsedTime)
-{
-    sendAnimationEvent(eventNames().animationiterationEvent, elapsedTime);
-}
-
-void KeyframeAnimation::onAnimationEnd(double elapsedTime)
-{
-    sendAnimationEvent(eventNames().animationendEvent, elapsedTime);
-    // End the animation if we don't fill forwards. Forward filling
-    // animations are ended properly in the class destructor.
-    if (!m_animation->fillsForwards())
-        endAnimation();
-}
-
-bool KeyframeAnimation::sendAnimationEvent(const AtomicString& eventType, double elapsedTime)
-{
-    Document::ListenerType listenerType;
-    if (eventType == eventNames().animationiterationEvent)
-        listenerType = Document::ANIMATIONITERATION_LISTENER;
-    else if (eventType == eventNames().animationendEvent)
-        listenerType = Document::ANIMATIONEND_LISTENER;
-    else {
-        ASSERT(eventType == eventNames().animationstartEvent);
-        if (m_startEventDispatched)
-            return false;
-        m_startEventDispatched = true;
-        listenerType = Document::ANIMATIONSTART_LISTENER;
-    }
-
-    if (shouldSendEventForListener(listenerType)) {
-        // Dispatch the event
-        RefPtr<Element> element;
-        if (m_object->node() && m_object->node()->isElementNode())
-            element = toElement(m_object->node());
-
-        if (!element)
-            return false;
-
-        // Schedule event handling
-        m_compAnim->animationController()->addEventToDispatch(element, eventType, m_keyframes.animationName(), elapsedTime);
-
-        // Restore the original (unanimated) style
-        if (eventType == eventNames().animationendEvent && element->renderer())
-            setNeedsStyleRecalc(element.get());
-
-        return true; // Did dispatch an event
-    }
-
-    return false; // Did not dispatch an event
-}
-
-void KeyframeAnimation::overrideAnimations()
-{
-    // This will override implicit animations that match the properties in the keyframe animation
-    HashSet<CSSPropertyID>::const_iterator end = m_keyframes.endProperties();
-    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != end; ++it)
-        compositeAnimation()->overrideImplicitAnimations(*it);
-}
-
-void KeyframeAnimation::resumeOverriddenAnimations()
-{
-    // This will resume overridden implicit animations
-    HashSet<CSSPropertyID>::const_iterator end = m_keyframes.endProperties();
-    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != end; ++it)
-        compositeAnimation()->resumeOverriddenImplicitAnimations(*it);
-}
-
-bool KeyframeAnimation::affectsProperty(CSSPropertyID property) const
-{
-    return m_keyframes.containsProperty(property);
-}
-
-void KeyframeAnimation::validateTransformFunctionList()
-{
-    m_transformFunctionListValid = false;
-
-    if (m_keyframes.size() < 2 || !m_keyframes.containsProperty(CSSPropertyWebkitTransform))
-        return;
-
-    // Empty transforms match anything, so find the first non-empty entry as the reference
-    size_t numKeyframes = m_keyframes.size();
-    size_t firstNonEmptyTransformKeyframeIndex = numKeyframes;
-
-    for (size_t i = 0; i < numKeyframes; ++i) {
-        const KeyframeValue& currentKeyframe = m_keyframes[i];
-        if (currentKeyframe.style()->transform().operations().size()) {
-            firstNonEmptyTransformKeyframeIndex = i;
-            break;
-        }
-    }
-
-    if (firstNonEmptyTransformKeyframeIndex == numKeyframes)
-        return;
-
-    const TransformOperations* firstVal = &m_keyframes[firstNonEmptyTransformKeyframeIndex].style()->transform();
-
-    // See if the keyframes are valid
-    for (size_t i = firstNonEmptyTransformKeyframeIndex + 1; i < numKeyframes; ++i) {
-        const KeyframeValue& currentKeyframe = m_keyframes[i];
-        const TransformOperations* val = &currentKeyframe.style()->transform();
-
-        // An emtpy transform list matches anything.
-        if (val->operations().isEmpty())
-            continue;
-
-        if (!firstVal->operationsMatch(*val))
-            return;
-    }
-
-    // Keyframes are valid
-    m_transformFunctionListValid = true;
-}
-
-void KeyframeAnimation::checkForMatchingFilterFunctionLists()
-{
-    m_filterFunctionListsMatch = false;
-
-    if (m_keyframes.size() < 2 || !m_keyframes.containsProperty(CSSPropertyWebkitFilter))
-        return;
-
-    // Empty filters match anything, so find the first non-empty entry as the reference
-    size_t numKeyframes = m_keyframes.size();
-    size_t firstNonEmptyFilterKeyframeIndex = numKeyframes;
-
-    for (size_t i = 0; i < numKeyframes; ++i) {
-        const KeyframeValue& currentKeyframe = m_keyframes[i];
-        if (currentKeyframe.style()->filter().operations().size()) {
-            firstNonEmptyFilterKeyframeIndex = i;
-            break;
-        }
-    }
-
-    if (firstNonEmptyFilterKeyframeIndex == numKeyframes)
-        return;
-
-    const FilterOperations* firstVal = &m_keyframes[firstNonEmptyFilterKeyframeIndex].style()->filter();
-
-    for (size_t i = firstNonEmptyFilterKeyframeIndex + 1; i < numKeyframes; ++i) {
-        const KeyframeValue& currentKeyframe = m_keyframes[i];
-        const FilterOperations* val = &currentKeyframe.style()->filter();
-
-        // An emtpy filter list matches anything.
-        if (val->operations().isEmpty())
-            continue;
-
-        if (!firstVal->operationsMatch(*val))
-            return;
-    }
-
-    m_filterFunctionListsMatch = true;
-}
-
-double KeyframeAnimation::timeToNextService()
-{
-    double t = AnimationBase::timeToNextService();
-    if (t != 0 || preActive())
-        return t;
-
-    // A return value of 0 means we need service. But if we only have accelerated animations we
-    // only need service at the end of the transition
-    HashSet<CSSPropertyID>::const_iterator endProperties = m_keyframes.endProperties();
-    bool acceleratedPropertiesOnly = true;
-
-    for (HashSet<CSSPropertyID>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) {
-        if (!CSSPropertyAnimation::animationOfPropertyIsAccelerated(*it) || !isAccelerated()) {
-            acceleratedPropertiesOnly = false;
-            break;
-        }
-    }
-
-    if (acceleratedPropertiesOnly) {
-        bool isLooping;
-        getTimeToNextEvent(t, isLooping);
-    }
-
-    return t;
-}
-
-} // namespace WebCore
diff --git a/Source/core/page/animation/KeyframeAnimation.h b/Source/core/page/animation/KeyframeAnimation.h
deleted file mode 100644
index 0d8b159..0000000
--- a/Source/core/page/animation/KeyframeAnimation.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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 KeyframeAnimation_h
-#define KeyframeAnimation_h
-
-#include "core/dom/Document.h"
-#include "core/page/animation/AnimationBase.h"
-#include "core/rendering/style/KeyframeList.h"
-
-namespace WebCore {
-
-class RenderStyle;
-
-// A KeyframeAnimation tracks the state of an explicit animation
-// for a single RenderObject.
-class KeyframeAnimation : public AnimationBase {
-public:
-    static PassRefPtr<KeyframeAnimation> create(const CSSAnimationData* animation, RenderObject* renderer, int index, CompositeAnimation* compositeAnimation, RenderStyle* unanimatedStyle)
-    {
-        return adoptRef(new KeyframeAnimation(animation, renderer, index, compositeAnimation, unanimatedStyle));
-    };
-
-    virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle* currentStyle, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle);
-    virtual void getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle);
-
-    const AtomicString& name() const { return m_keyframes.animationName(); }
-    int index() const { return m_index; }
-    void setIndex(int i) { m_index = i; }
-
-    bool hasAnimationForProperty(CSSPropertyID) const;
-
-    void setUnanimatedStyle(PassRefPtr<RenderStyle> style) { m_unanimatedStyle = style; }
-    RenderStyle* unanimatedStyle() const { return m_unanimatedStyle.get(); }
-
-    virtual double timeToNextService();
-
-protected:
-    virtual void onAnimationStart(double elapsedTime);
-    virtual void onAnimationIteration(double elapsedTime);
-    virtual void onAnimationEnd(double elapsedTime);
-    virtual bool startAnimation(double timeOffset);
-    virtual void pauseAnimation(double timeOffset);
-    virtual void endAnimation();
-
-    virtual void overrideAnimations();
-    virtual void resumeOverriddenAnimations();
-
-    bool shouldSendEventForListener(Document::ListenerType inListenerType) const;
-    bool sendAnimationEvent(const AtomicString&, double elapsedTime);
-
-    virtual bool affectsProperty(CSSPropertyID) const;
-
-    void validateTransformFunctionList();
-    void checkForMatchingFilterFunctionLists();
-
-private:
-    KeyframeAnimation(const CSSAnimationData* animation, RenderObject*, int index, CompositeAnimation*, RenderStyle* unanimatedStyle);
-    virtual ~KeyframeAnimation();
-
-    // Get the styles for the given property surrounding the current animation time and the progress between them.
-    void fetchIntervalEndpointsForProperty(CSSPropertyID, const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& progress) const;
-
-    // The keyframes that we are blending.
-    KeyframeList m_keyframes;
-
-    // The order in which this animation appears in the animation-name style.
-    int m_index;
-    bool m_startEventDispatched;
-
-    // The style just before we started animation
-    RefPtr<RenderStyle> m_unanimatedStyle;
-};
-
-} // namespace WebCore
-
-#endif // KeyframeAnimation_h
diff --git a/Source/core/page/scrolling/ScrollingConstraints.h b/Source/core/page/scrolling/ScrollingConstraints.h
index 8e7b0c7..993f234 100644
--- a/Source/core/page/scrolling/ScrollingConstraints.h
+++ b/Source/core/page/scrolling/ScrollingConstraints.h
@@ -26,7 +26,7 @@
 #ifndef ScrollingConstraints_h
 #define ScrollingConstraints_h
 
-#include "core/platform/graphics/FloatRect.h"
+#include "platform/geometry/FloatRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/page/scrolling/ScrollingCoordinator.cpp b/Source/core/page/scrolling/ScrollingCoordinator.cpp
index 3fc3145..6615cce 100644
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -30,31 +30,29 @@
 #include "RuntimeEnabledFeatures.h"
 #include "core/dom/Document.h"
 #include "core/dom/Node.h"
-#include "core/dom/TouchController.h"
 #include "core/dom/WheelController.h"
 #include "core/html/HTMLElement.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/PlatformWheelEvent.h"
 #include "core/platform/ScrollAnimator.h"
 #include "core/platform/ScrollbarTheme.h"
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/chromium/support/WebScrollbarImpl.h"
 #include "core/platform/chromium/support/WebScrollbarThemeGeometryNative.h"
 #include "core/platform/graphics/GraphicsLayer.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/Region.h"
 #include "core/platform/graphics/transforms/TransformState.h"
+#include "platform/TraceEvent.h"
+#include "platform/geometry/Region.h"
 #if OS(MACOSX)
 #include "core/platform/mac/ScrollAnimatorMac.h"
 #endif
 #include "core/plugins/PluginView.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/RenderGeometryMap.h"
-#include "core/rendering/RenderLayerBacking.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderView.h"
+#include "platform/geometry/IntRect.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCompositorSupport.h"
 #include "public/platform/WebLayerPositionConstraint.h"
@@ -106,7 +104,8 @@
 bool ScrollingCoordinator::touchHitTestingEnabled() const
 {
     RenderView* contentRenderer = m_page->mainFrame()->contentRenderer();
-    return RuntimeEnabledFeatures::touchEnabled() && contentRenderer && contentRenderer->usesCompositing();
+    Settings* settings = m_page->mainFrame()->document()->settings();
+    return RuntimeEnabledFeatures::touchEnabled() && settings->compositorTouchHitTesting() && contentRenderer && contentRenderer->usesCompositing();
 }
 
 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion(const Region& region)
@@ -175,13 +174,13 @@
 
 void ScrollingCoordinator::updateLayerPositionConstraint(RenderLayer* layer)
 {
-    ASSERT(layer->backing());
-    RenderLayerBacking* backing = layer->backing();
-    GraphicsLayer* mainLayer = backing->childForSuperlayers();
+    ASSERT(layer->compositedLayerMapping());
+    CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping();
+    GraphicsLayer* mainLayer = compositedLayerMapping->childForSuperlayers();
 
     // Avoid unnecessary commits
-    clearPositionConstraintExceptForLayer(backing->ancestorClippingLayer(), mainLayer);
-    clearPositionConstraintExceptForLayer(backing->graphicsLayer(), mainLayer);
+    clearPositionConstraintExceptForLayer(compositedLayerMapping->ancestorClippingLayer(), mainLayer);
+    clearPositionConstraintExceptForLayer(compositedLayerMapping->mainGraphicsLayer(), mainLayer);
 
     if (WebLayer* scrollableLayer = scrollingWebLayerForGraphicsLayer(mainLayer))
         scrollableLayer->setPositionConstraint(computePositionConstraint(layer));
@@ -478,12 +477,12 @@
         WebVector<WebRect> webRects(iter->value.size());
         for (size_t i = 0; i < iter->value.size(); ++i)
             webRects[i] = enclosingIntRect(iter->value[i]);
-        RenderLayerBacking* backing = layer->backing();
+        CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping();
         // If the layer is using composited scrolling, then it's the contents that these
         // rects apply to.
-        GraphicsLayer* graphicsLayer = backing->scrollingContentsLayer();
+        GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLayer();
         if (!graphicsLayer)
-            graphicsLayer = backing->graphicsLayer();
+            graphicsLayer = compositedLayerMapping->mainGraphicsLayer();
         graphicsLayer->platformLayer()->setTouchEventHandlerRegion(webRects);
         oldLayersWithTouchRects.remove(layer);
         m_layersWithTouchRects.add(layer);
@@ -491,10 +490,10 @@
 
     // If there are any layers left that we haven't updated, clear them out.
     for (HashSet<const RenderLayer*>::iterator it = oldLayersWithTouchRects.begin(); it != oldLayersWithTouchRects.end(); ++it) {
-        if (RenderLayerBacking* backing = (*it)->backing()) {
-            GraphicsLayer* graphicsLayer = backing->scrollingContentsLayer();
+        if (CompositedLayerMapping* compositedLayerMapping = (*it)->compositedLayerMapping()) {
+            GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLayer();
             if (!graphicsLayer)
-                graphicsLayer = backing->graphicsLayer();
+                graphicsLayer = compositedLayerMapping->mainGraphicsLayer();
             graphicsLayer->platformLayer()->setTouchEventHandlerRegion(WebVector<WebRect>());
         }
     }
@@ -519,8 +518,8 @@
 void ScrollingCoordinator::updateScrollParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* parent)
 {
     WebLayer* scrollParentWebLayer = 0;
-    if (parent && parent->backing())
-        scrollParentWebLayer = scrollingWebLayerForGraphicsLayer(parent->backing()->parentForSublayers());
+    if (parent && parent->compositedLayerMapping())
+        scrollParentWebLayer = scrollingWebLayerForGraphicsLayer(parent->compositedLayerMapping()->parentForSublayers());
 
     child->setScrollParent(scrollParentWebLayer);
 }
@@ -528,8 +527,8 @@
 void ScrollingCoordinator::updateClipParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* parent)
 {
     WebLayer* clipParentWebLayer = 0;
-    if (parent && parent->backing())
-        clipParentWebLayer = scrollingWebLayerForGraphicsLayer(parent->backing()->parentForSublayers());
+    if (parent && parent->compositedLayerMapping())
+        clipParentWebLayer = scrollingWebLayerForGraphicsLayer(parent->compositedLayerMapping()->parentForSublayers());
 
     child->setClipParent(clipParentWebLayer);
 }
@@ -607,9 +606,9 @@
     // on main thread).
     if (const FrameView::ResizerAreaSet* resizerAreas = frameView->resizerAreas()) {
         for (FrameView::ResizerAreaSet::const_iterator it = resizerAreas->begin(), end = resizerAreas->end(); it != end; ++it) {
-            RenderLayer* layer = *it;
-            IntRect bounds = layer->renderer()->absoluteBoundingBoxRect();
-            IntRect corner = layer->resizerCornerRect(bounds, ResizerForTouch);
+            RenderBox* box = *it;
+            IntRect bounds = box->absoluteBoundingBoxRect();
+            IntRect corner = box->layer()->scrollableArea()->touchResizerCornerRect(bounds);
             corner.moveBy(offset);
             shouldHandleScrollGestureOnMainThreadRegion.unite(corner);
         }
@@ -633,14 +632,13 @@
     return shouldHandleScrollGestureOnMainThreadRegion;
 }
 
-static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, Document* document)
+static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, const Document* document)
 {
     ASSERT(document);
-    TouchController* controller = TouchController::from(document);
-    if (!controller->touchEventTargets())
+    if (!document->touchEventTargets())
         return;
 
-    const TouchEventTargetSet* targets = controller->touchEventTargets();
+    const TouchEventTargetSet* targets = document->touchEventTargets();
 
     // If there's a handler on the document, html or body element (fairly common in practice),
     // then we can quickly mark the entire document and skip looking at any other handlers.
@@ -657,7 +655,7 @@
     }
 
     for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) {
-        Node* target = iter->key;
+        const Node* target = iter->key;
         if (!target->inDocument())
             continue;
 
@@ -812,7 +810,7 @@
 
         // Composited layers that actually paint into their enclosing ancestor
         // must also force main thread scrolling.
-        if (layer->isComposited() && layer->backing()->paintsIntoCompositedAncestor())
+        if (layer->isComposited() && layer->compositedLayerMapping()->paintsIntoCompositedAncestor())
             return true;
     }
     return false;
diff --git a/Source/core/page/scrolling/ScrollingCoordinator.h b/Source/core/page/scrolling/ScrollingCoordinator.h
index b0fe76a..e5a1d1a 100644
--- a/Source/core/page/scrolling/ScrollingCoordinator.h
+++ b/Source/core/page/scrolling/ScrollingCoordinator.h
@@ -26,10 +26,10 @@
 #ifndef ScrollingCoordinator_h
 #define ScrollingCoordinator_h
 
-#include "core/platform/PlatformWheelEvent.h"
-#include "core/platform/ScrollTypes.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/rendering/RenderObject.h"
+#include "platform/PlatformWheelEvent.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/scroll/ScrollTypes.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebKit {
diff --git a/Source/core/platform/AsyncFileSystem.h b/Source/core/platform/AsyncFileSystem.h
deleted file mode 100644
index a505175..0000000
--- a/Source/core/platform/AsyncFileSystem.h
+++ /dev/null
@@ -1,134 +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 AsyncFileSystem_h
-#define AsyncFileSystem_h
-
-#include "core/platform/Timer.h"
-#include "modules/filesystem/FileSystemType.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebKit { class WebFileWriterClient; }
-
-namespace WebCore {
-
-class AsyncFileSystem;
-class AsyncFileSystemCallbacks;
-class KURL;
-
-// This class provides async interface for platform-specific file system implementation.  Note that all the methods take platform paths.
-class AsyncFileSystem {
-    WTF_MAKE_NONCOPYABLE(AsyncFileSystem);
-public:
-    virtual ~AsyncFileSystem() { }
-
-    virtual void stop() { }
-    virtual bool hasPendingActivity() { return false; }
-
-    // Subclass must implement this if it supports synchronous operations.
-    // This should return false if there are no pending operations.
-    virtual bool waitForOperationToComplete() { return true; }
-
-    // Creates and returns a new platform-specific AsyncFileSystem instance if the platform has its own implementation.
-    static PassOwnPtr<AsyncFileSystem> create();
-
-    // Moves a file or directory from srcPath to destPath.
-    // AsyncFileSystemCallbacks::didSucceed() is called when the operation is completed successfully.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    virtual void move(const KURL& srcPath, const KURL& destPath, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Copies a file or directory from srcPath to destPath.
-    // AsyncFileSystemCallbacks::didSucceed() is called when the operation is completed successfully.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    virtual void copy(const KURL& srcPath, const KURL& destPath, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Deletes a file or directory at a given path.
-    // It is an error to try to remove a directory that is not empty.
-    // AsyncFileSystemCallbacks::didSucceed() is called when the operation is completed successfully.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    virtual void remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Recursively deletes a directory at a given path.
-    // AsyncFileSystemCallbacks::didSucceed() is called when the operation is completed successfully.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    virtual void removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Retrieves the metadata information of the file or directory at a given path.
-    // AsyncFileSystemCallbacks::didReadMetadata() is called when the operation is completed successfully.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    virtual void readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Creates a file at a given path.  If exclusive flag is true, it fails if the path already exists.
-    // AsyncFileSystemCallbacks::didSucceed() is called when the operation is completed successfully.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    virtual void createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Creates a directory at a given path.  If exclusive flag is true, it fails if the path already exists.
-    // AsyncFileSystemCallbacks::didSucceed() is called when the operation is completed successfully.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    virtual void createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Checks if a file exists at a given path.
-    // AsyncFileSystemCallbacks::didSucceed() is called if the file exists.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    virtual void fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Checks if a directory exists at a given path.
-    // AsyncFileSystemCallbacks::didSucceed() is called if the directory exists.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    virtual void directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Reads directory entries of a given directory at path.
-    // AsyncFileSystemCallbacks::didReadDirectoryEntry() is called when each directory entry is called. AsyncFileSystemCallbacks::didReadDirectoryEntries() is called after a chunk of directory entries have been read.
-    // AsyncFileSystemCallbacks::didFail() is when there is an error.
-    virtual void readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Creates an WebFileWriter for a given file path.
-    // AsyncFileSystemCallbacks::didCreateFileWriter() is called when an AsyncFileWriter is created successfully.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    virtual void createWriter(WebKit::WebFileWriterClient*, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-    // Creates a snapshot file and read its metadata for a new File object.
-    // In local filesystem cases the backend may simply return the metadata of the file itself (as well as readMetadata does),
-    // while in remote filesystem case the backend may download the file into a temporary snapshot file and return the metadata of the temporary file.
-    // AsyncFileSystemCallbacks::didReadMetadata() is called when the metadata for the snapshot file is successfully returned.
-    // AsyncFileSystemCallbacks::didFail() is called otherwise.
-    //
-    // Note: the returned metadata info is cached in the File object for non-regular filesystem types (neither Temporary nor Persistent). The port could return valid metadata if it wants File object to cache metadata (e.g. if the file body is on a remote server), but otherwise should NOT return valid metadata.
-    virtual void createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
-
-protected:
-    AsyncFileSystem() { }
-};
-
-} // namespace WebCore
-
-#endif // AsyncFileSystem_h
diff --git a/Source/core/platform/AsyncFileSystemCallbacks.h b/Source/core/platform/AsyncFileSystemCallbacks.h
index a210b99..4a29b3e 100644
--- a/Source/core/platform/AsyncFileSystemCallbacks.h
+++ b/Source/core/platform/AsyncFileSystemCallbacks.h
@@ -31,10 +31,12 @@
 #ifndef AsyncFileSystemCallbacks_h
 #define AsyncFileSystemCallbacks_h
 
-#include "core/platform/AsyncFileSystem.h"
-#include "core/platform/FileMetadata.h"
 #include "core/platform/network/BlobData.h"
+#include "platform/FileMetadata.h"
+#include "platform/FileSystemType.h"
 #include "public/platform/WebFileWriter.h"
+#include "wtf/Assertions.h"
+#include "wtf/Noncopyable.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/CalculationValue.cpp b/Source/core/platform/CalculationValue.cpp
index e45aae5..e161916 100644
--- a/Source/core/platform/CalculationValue.cpp
+++ b/Source/core/platform/CalculationValue.cpp
@@ -55,7 +55,7 @@
     return std::numeric_limits<float>::quiet_NaN();
 }
 
-PassRefPtr<CalculationValue> CalculationValue::create(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange range)
+PassRefPtr<CalculationValue> CalculationValue::create(PassOwnPtr<CalcExpressionNode> value, ValueRange range)
 {
     return adoptRef(new CalculationValue(value, range));
 }
diff --git a/Source/core/platform/CalculationValue.h b/Source/core/platform/CalculationValue.h
index 9545672..ae69886 100644
--- a/Source/core/platform/CalculationValue.h
+++ b/Source/core/platform/CalculationValue.h
@@ -47,11 +47,6 @@
     CalcDivide = '/'
 };
 
-enum CalculationPermittedValueRange {
-    CalculationRangeAll,
-    CalculationRangeNonNegative
-};
-
 enum CalcExpressionNodeType {
     CalcExpressionNodeUndefined,
     CalcExpressionNodeNumber,
@@ -83,7 +78,7 @@
 
 class CalculationValue : public RefCounted<CalculationValue> {
 public:
-    static PassRefPtr<CalculationValue> create(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange);
+    static PassRefPtr<CalculationValue> create(PassOwnPtr<CalcExpressionNode> value, ValueRange);
     float evaluate(float maxValue) const;
 
     bool operator==(const CalculationValue& o) const
@@ -95,9 +90,9 @@
     const CalcExpressionNode* expression() const { return m_value.get(); }
 
 private:
-    CalculationValue(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange range)
+    CalculationValue(PassOwnPtr<CalcExpressionNode> value, ValueRange range)
         : m_value(value)
-        , m_isNonNegative(range == CalculationRangeNonNegative)
+        , m_isNonNegative(range == ValueRangeNonNegative)
     {
     }
 
diff --git a/Source/core/platform/ColorChooserClient.h b/Source/core/platform/ColorChooserClient.h
index ba00ba5..d760935 100644
--- a/Source/core/platform/ColorChooserClient.h
+++ b/Source/core/platform/ColorChooserClient.h
@@ -32,7 +32,7 @@
 #define ColorChooserClient_h
 
 #include "core/platform/ColorChooser.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/platform/ContentType.cpp b/Source/core/platform/ContentType.cpp
deleted file mode 100644
index 7136ea5..0000000
--- a/Source/core/platform/ContentType.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2006, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- * 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 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,
- * 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/ContentType.h"
-
-namespace WebCore {
-
-ContentType::ContentType(const String& contentType)
-    : m_type(contentType)
-{
-}
-
-String ContentType::parameter(const String& parameterName) const
-{
-    String parameterValue;
-    String strippedType = m_type.stripWhiteSpace();
-
-    // a MIME type can have one or more "param=value" after a semi-colon, and separated from each other by semi-colons
-    size_t semi = strippedType.find(';');
-    if (semi != kNotFound) {
-        size_t start = strippedType.find(parameterName, semi + 1, false);
-        if (start != kNotFound) {
-            start = strippedType.find('=', start + parameterName.length());
-            if (start != kNotFound) {
-                size_t quote = strippedType.find('\"', start + 1);
-                size_t end = strippedType.find('\"', start + 2);
-                if (quote != kNotFound && end != kNotFound)
-                    start = quote;
-                else {
-                    end = strippedType.find(';', start + 1);
-                    if (end == kNotFound)
-                        end = strippedType.length();
-                }
-                parameterValue = strippedType.substring(start + 1, end - (start + 1)).stripWhiteSpace();
-            }
-        }
-    }
-
-    return parameterValue;
-}
-
-String ContentType::type() const
-{
-    String strippedType = m_type.stripWhiteSpace();
-
-    // "type" can have parameters after a semi-colon, strip them
-    size_t semi = strippedType.find(';');
-    if (semi != kNotFound)
-        strippedType = strippedType.left(semi).stripWhiteSpace();
-
-    return strippedType;
-}
-
-Vector<String> ContentType::codecs() const
-{
-    String codecsParameter = parameter("codecs");
-
-    if (codecsParameter.isEmpty())
-        return Vector<String>();
-
-    Vector<String> codecs;
-    codecsParameter.split(",", codecs);
-    for (size_t i = 0; i < codecs.size(); ++i)
-        codecs[i] = codecs[i].simplifyWhiteSpace();
-
-    return codecs;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/ContentType.h b/Source/core/platform/ContentType.h
deleted file mode 100644
index 848cc1d..0000000
--- a/Source/core/platform/ContentType.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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 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,
- * 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 ContentType_h
-#define ContentType_h
-
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-    class ContentType {
-    public:
-        explicit ContentType(const String& type);
-
-        String parameter (const String& parameterName) const;
-        String type() const;
-        Vector<String> codecs() const;
-        const String& raw() const { return m_type; }
-    private:
-        String m_type;
-    };
-
-} // namespace WebCore
-
-#endif // ContentType_h
diff --git a/Source/core/platform/CrossThreadCopier.cpp b/Source/core/platform/CrossThreadCopier.cpp
index ceb9bba..6cc2d44 100644
--- a/Source/core/platform/CrossThreadCopier.cpp
+++ b/Source/core/platform/CrossThreadCopier.cpp
@@ -32,9 +32,9 @@
 
 #include "core/platform/CrossThreadCopier.h"
 
-#include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
+#include "platform/network/ResourceError.h"
 #include "weborigin/KURL.h"
 #include "wtf/Assertions.h"
 #include "wtf/text/WTFString.h"
diff --git a/Source/core/platform/CryptoResult.h b/Source/core/platform/CryptoResult.h
new file mode 100644
index 0000000..c62768c
--- /dev/null
+++ b/Source/core/platform/CryptoResult.h
@@ -0,0 +1,58 @@
+/*
+ * 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 CryptoResult_h
+#define CryptoResult_h
+
+#include "public/platform/WebCrypto.h"
+#include "wtf/ThreadSafeRefCounted.h"
+
+namespace WebCore {
+
+// Receives notification of completion of the crypto operation.
+class CryptoResult : public ThreadSafeRefCounted<CryptoResult> {
+public:
+    virtual ~CryptoResult() { }
+
+    virtual void completeWithError() = 0;
+    virtual void completeWithBuffer(const WebKit::WebArrayBuffer&) = 0;
+    virtual void completeWithBoolean(bool) = 0;
+    virtual void completeWithKey(const WebKit::WebCryptoKey&) = 0;
+    virtual void completeWithKeyPair(const WebKit::WebCryptoKey& publicKey, const WebKit::WebCryptoKey& privateKey) = 0;
+
+    WebKit::WebCryptoResult result()
+    {
+        return WebKit::WebCryptoResult(this);
+    }
+};
+
+} // namespace WebCore
+
+#endif
diff --git a/Source/core/platform/Cursor.h b/Source/core/platform/Cursor.h
index a124ccb..de1ba5d 100644
--- a/Source/core/platform/Cursor.h
+++ b/Source/core/platform/Cursor.h
@@ -27,7 +27,7 @@
 #define Cursor_h
 
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/geometry/IntPoint.h"
 #include "wtf/Assertions.h"
 #include "wtf/RefPtr.h"
 
diff --git a/Source/core/platform/DEPS b/Source/core/platform/DEPS
index cfd697d..33693a0 100644
--- a/Source/core/platform/DEPS
+++ b/Source/core/platform/DEPS
@@ -4,6 +4,7 @@
 include_rules = [
     "-core",
     "+core/platform",
+    "+core/tests", # Remove after https://codereview.chromium.org/26227002/
     "+dl",
     "+skia",
     "+third_party",
@@ -18,7 +19,9 @@
     "!core/html",
     "!core/inspector",
     "!core/fetch",
+    "!core/frame",
     "!core/page",
     "!core/plugins",
     "!core/rendering",
+    "!core/events/ThreadLocalEventNames.h",
 ]
diff --git a/Source/core/platform/DateComponents.cpp b/Source/core/platform/DateComponents.cpp
deleted file mode 100644
index 3e07906..0000000
--- a/Source/core/platform/DateComponents.cpp
+++ /dev/null
@@ -1,723 +0,0 @@
-/*
- * 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
- * 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/DateComponents.h"
-
-#include <limits.h>
-#include "wtf/ASCIICType.h"
-#include "wtf/DateMath.h"
-#include "wtf/MathExtras.h"
-#include "wtf/text/WTFString.h"
-
-using namespace std;
-
-namespace WebCore {
-
-// HTML5 specification defines minimum week of year is one.
-const int DateComponents::minimumWeekNumber = 1;
-
-// HTML5 specification defines maximum week of year is 53.
-const int DateComponents::maximumWeekNumber = 53;
-
-static const int maximumMonthInMaximumYear = 8; // This is September, since months are 0 based.
-static const int maximumDayInMaximumMonth = 13;
-static const int maximumWeekInMaximumYear = 37; // The week of 275760-09-13
-
-static const int daysInMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
-static bool isLeapYear(int year)
-{
-    if (year % 4)
-        return false;
-    if (!(year % 400))
-        return true;
-    if (!(year % 100))
-        return false;
-    return true;
-}
-
-// 'month' is 0-based.
-static int maxDayOfMonth(int year, int month)
-{
-    if (month != 1) // February?
-        return daysInMonth[month];
-    return isLeapYear(year) ? 29 : 28;
-}
-
-// 'month' is 0-based.
-static int dayOfWeek(int year, int month, int day)
-{
-    int shiftedMonth = month + 2;
-    // 2:January, 3:Feburuary, 4:March, ...
-
-    // Zeller's congruence
-    if (shiftedMonth <= 3) {
-        shiftedMonth += 12;
-        year--;
-    }
-    // 4:March, ..., 14:January, 15:February
-
-    int highYear = year / 100;
-    int lowYear = year % 100;
-    // We add 6 to make the result Sunday-origin.
-    int result = (day + 13 * shiftedMonth / 5 + lowYear + lowYear / 4 + highYear / 4 + 5 * highYear + 6) % 7;
-    return result;
-}
-
-int DateComponents::maxWeekNumberInYear() const
-{
-    int day = dayOfWeek(m_year, 0, 1); // January 1.
-    return day == Thursday || (day == Wednesday && isLeapYear(m_year)) ? maximumWeekNumber : maximumWeekNumber - 1;
-}
-
-static unsigned countDigits(const String& src, unsigned start)
-{
-    unsigned index = start;
-    for (; index < src.length(); ++index) {
-        if (!isASCIIDigit(src[index]))
-            break;
-    }
-    return index - start;
-}
-
-// Very strict integer parser. Do not allow leading or trailing whitespace unlike charactersToIntStrict().
-static bool toInt(const String& src, unsigned parseStart, unsigned parseLength, int& out)
-{
-    if (parseStart + parseLength > src.length() || parseLength <= 0)
-        return false;
-    int value = 0;
-    unsigned current = parseStart;
-    unsigned end = current + parseLength;
-
-    // We don't need to handle negative numbers for ISO 8601.
-    for (; current < end; ++current) {
-        if (!isASCIIDigit(src[current]))
-            return false;
-        int digit = src[current] - '0';
-        if (value > (INT_MAX - digit) / 10) // Check for overflow.
-            return false;
-        value = value * 10 + digit;
-    }
-    out = value;
-    return true;
-}
-
-bool DateComponents::parseYear(const String& src, unsigned start, unsigned& end)
-{
-    unsigned digitsLength = countDigits(src, start);
-    // Needs at least 4 digits according to the standard.
-    if (digitsLength < 4)
-        return false;
-    int year;
-    if (!toInt(src, start, digitsLength, year))
-        return false;
-    if (year < minimumYear() || year > maximumYear())
-        return false;
-    m_year = year;
-    end = start + digitsLength;
-    return true;
-}
-
-static bool withinHTMLDateLimits(int year, int month)
-{
-    if (year < DateComponents::minimumYear())
-        return false;
-    if (year < DateComponents::maximumYear())
-        return true;
-    return month <= maximumMonthInMaximumYear;
-}
-
-static bool withinHTMLDateLimits(int year, int month, int monthDay)
-{
-    if (year < DateComponents::minimumYear())
-        return false;
-    if (year < DateComponents::maximumYear())
-        return true;
-    if (month < maximumMonthInMaximumYear)
-        return true;
-    return monthDay <= maximumDayInMaximumMonth;
-}
-
-static bool withinHTMLDateLimits(int year, int month, int monthDay, int hour, int minute, int second, int millisecond)
-{
-    if (year < DateComponents::minimumYear())
-        return false;
-    if (year < DateComponents::maximumYear())
-        return true;
-    if (month < maximumMonthInMaximumYear)
-        return true;
-    if (monthDay < maximumDayInMaximumMonth)
-        return true;
-    if (monthDay > maximumDayInMaximumMonth)
-        return false;
-    // (year, month, monthDay) = (maximumYear, maximumMonthInMaximumYear, maximumDayInMaximumMonth)
-    return !hour && !minute && !second && !millisecond;
-}
-
-bool DateComponents::addDay(int dayDiff)
-{
-    ASSERT(m_monthDay);
-
-    int day = m_monthDay + dayDiff;
-    if (day > maxDayOfMonth(m_year, m_month)) {
-        day = m_monthDay;
-        int year = m_year;
-        int month = m_month;
-        int maxDay = maxDayOfMonth(year, month);
-        for (; dayDiff > 0; --dayDiff) {
-            ++day;
-            if (day > maxDay) {
-                day = 1;
-                ++month;
-                if (month >= 12) { // month is 0-origin.
-                    month = 0;
-                    ++year;
-                }
-                maxDay = maxDayOfMonth(year, month);
-            }
-        }
-        if (!withinHTMLDateLimits(year, month, day))
-            return false;
-        m_year = year;
-        m_month = month;
-    } else if (day < 1) {
-        int month = m_month;
-        int year = m_year;
-        day = m_monthDay;
-        for (; dayDiff < 0; ++dayDiff) {
-            --day;
-            if (day < 1) {
-                --month;
-                if (month < 0) {
-                    month = 11;
-                    --year;
-                }
-                day = maxDayOfMonth(year, month);
-            }
-        }
-        if (!withinHTMLDateLimits(year, month, day))
-            return false;
-        m_year = year;
-        m_month = month;
-    } else {
-        if (!withinHTMLDateLimits(m_year, m_month, day))
-            return false;
-    }
-    m_monthDay = day;
-    return true;
-}
-
-bool DateComponents::addMinute(int minute)
-{
-    // This function is used to adjust timezone offset. So m_year, m_month,
-    // m_monthDay have values between the lower and higher limits.
-    ASSERT(withinHTMLDateLimits(m_year, m_month, m_monthDay));
-
-    int carry;
-    // minute can be negative or greater than 59.
-    minute += m_minute;
-    if (minute > 59) {
-        carry = minute / 60;
-        minute = minute % 60;
-    } else if (minute < 0) {
-        carry = (59 - minute) / 60;
-        minute += carry * 60;
-        carry = -carry;
-        ASSERT(minute >= 0 && minute <= 59);
-    } else {
-        if (!withinHTMLDateLimits(m_year, m_month, m_monthDay, m_hour, minute, m_second, m_millisecond))
-            return false;
-        m_minute = minute;
-        return true;
-    }
-
-    int hour = m_hour + carry;
-    if (hour > 23) {
-        carry = hour / 24;
-        hour = hour % 24;
-    } else if (hour < 0) {
-        carry = (23 - hour) / 24;
-        hour += carry * 24;
-        carry = -carry;
-        ASSERT(hour >= 0 && hour <= 23);
-    } else {
-        if (!withinHTMLDateLimits(m_year, m_month, m_monthDay, hour, minute, m_second, m_millisecond))
-            return false;
-        m_minute = minute;
-        m_hour = hour;
-        return true;
-    }
-    if (!addDay(carry))
-        return false;
-    if (!withinHTMLDateLimits(m_year, m_month, m_monthDay, hour, minute, m_second, m_millisecond))
-        return false;
-    m_minute = minute;
-    m_hour = hour;
-    return true;
-}
-
-// Parses a timezone part, and adjust year, month, monthDay, hour, minute, second, millisecond.
-bool DateComponents::parseTimeZone(const String& src, unsigned start, unsigned& end)
-{
-    if (start >= src.length())
-        return false;
-    unsigned index = start;
-    if (src[index] == 'Z') {
-        end = index + 1;
-        return true;
-    }
-
-    bool minus;
-    if (src[index] == '+')
-        minus = false;
-    else if (src[index] == '-')
-        minus = true;
-    else
-        return false;
-    ++index;
-
-    int hour;
-    int minute;
-    if (!toInt(src, index, 2, hour) || hour < 0 || hour > 23)
-        return false;
-    index += 2;
-
-    if (index >= src.length() || src[index] != ':')
-        return false;
-    ++index;
-
-    if (!toInt(src, index, 2, minute) || minute < 0 || minute > 59)
-        return false;
-    index += 2;
-
-    if (minus) {
-        hour = -hour;
-        minute = -minute;
-    }
-
-    // Subtract the timezone offset.
-    if (!addMinute(-(hour * 60 + minute)))
-        return false;
-    end = index;
-    return true;
-}
-
-bool DateComponents::parseMonth(const String& src, unsigned start, unsigned& end)
-{
-    unsigned index;
-    if (!parseYear(src, start, index))
-        return false;
-    if (index >= src.length() || src[index] != '-')
-        return false;
-    ++index;
-
-    int month;
-    if (!toInt(src, index, 2, month) || month < 1 || month > 12)
-        return false;
-    --month;
-    if (!withinHTMLDateLimits(m_year, month))
-        return false;
-    m_month = month;
-    end = index + 2;
-    m_type = Month;
-    return true;
-}
-
-bool DateComponents::parseDate(const String& src, unsigned start, unsigned& end)
-{
-    unsigned index;
-    if (!parseMonth(src, start, index))
-        return false;
-    // '-' and 2-digits are needed.
-    if (index + 2 >= src.length())
-        return false;
-    if (src[index] != '-')
-        return false;
-    ++index;
-
-    int day;
-    if (!toInt(src, index, 2, day) || day < 1 || day > maxDayOfMonth(m_year, m_month))
-        return false;
-    if (!withinHTMLDateLimits(m_year, m_month, day))
-        return false;
-    m_monthDay = day;
-    end = index + 2;
-    m_type = Date;
-    return true;
-}
-
-bool DateComponents::parseWeek(const String& src, unsigned start, unsigned& end)
-{
-    unsigned index;
-    if (!parseYear(src, start, index))
-        return false;
-
-    // 4 characters ('-' 'W' digit digit) are needed.
-    if (index + 3 >= src.length())
-        return false;
-    if (src[index] != '-')
-        return false;
-    ++index;
-    if (src[index] != 'W')
-        return false;
-    ++index;
-
-    int week;
-    if (!toInt(src, index, 2, week) || week < minimumWeekNumber || week > maxWeekNumberInYear())
-        return false;
-    if (m_year == maximumYear() && week > maximumWeekInMaximumYear)
-        return false;
-    m_week = week;
-    end = index + 2;
-    m_type = Week;
-    return true;
-}
-
-bool DateComponents::parseTime(const String& src, unsigned start, unsigned& end)
-{
-    int hour;
-    if (!toInt(src, start, 2, hour) || hour < 0 || hour > 23)
-        return false;
-    unsigned index = start + 2;
-    if (index >= src.length())
-        return false;
-    if (src[index] != ':')
-        return false;
-    ++index;
-
-    int minute;
-    if (!toInt(src, index, 2, minute) || minute < 0 || minute > 59)
-        return false;
-    index += 2;
-
-    int second = 0;
-    int millisecond = 0;
-    // Optional second part.
-    // Do not return with false because the part is optional.
-    if (index + 2 < src.length() && src[index] == ':') {
-        if (toInt(src, index + 1, 2, second) && second >= 0 && second <= 59) {
-            index += 3;
-
-            // Optional fractional second part.
-            if (index < src.length() && src[index] == '.') {
-                unsigned digitsLength = countDigits(src, index + 1);
-                if (digitsLength >  0) {
-                    ++index;
-                    bool ok;
-                    if (digitsLength == 1) {
-                        ok = toInt(src, index, 1, millisecond);
-                        millisecond *= 100;
-                    } else if (digitsLength == 2) {
-                        ok = toInt(src, index, 2, millisecond);
-                        millisecond *= 10;
-                    } else { // digitsLength >= 3
-                        ok = toInt(src, index, 3, millisecond);
-                    }
-                    ASSERT_UNUSED(ok, ok);
-                    index += digitsLength;
-                }
-            }
-        }
-    }
-    m_hour = hour;
-    m_minute = minute;
-    m_second = second;
-    m_millisecond = millisecond;
-    end = index;
-    m_type = Time;
-    return true;
-}
-
-bool DateComponents::parseDateTimeLocal(const String& src, unsigned start, unsigned& end)
-{
-    unsigned index;
-    if (!parseDate(src, start, index))
-        return false;
-    if (index >= src.length())
-        return false;
-    if (src[index] != 'T')
-        return false;
-    ++index;
-    if (!parseTime(src, index, end))
-        return false;
-    if (!withinHTMLDateLimits(m_year, m_month, m_monthDay, m_hour, m_minute, m_second, m_millisecond))
-        return false;
-    m_type = DateTimeLocal;
-    return true;
-}
-
-bool DateComponents::parseDateTime(const String& src, unsigned start, unsigned& end)
-{
-    unsigned index;
-    if (!parseDate(src, start, index))
-        return false;
-    if (index >= src.length())
-        return false;
-    if (src[index] != 'T')
-        return false;
-    ++index;
-    if (!parseTime(src, index, index))
-        return false;
-    if (!parseTimeZone(src, index, end))
-        return false;
-    if (!withinHTMLDateLimits(m_year, m_month, m_monthDay, m_hour, m_minute, m_second, m_millisecond))
-        return false;
-    m_type = DateTime;
-    return true;
-}
-
-static inline double positiveFmod(double value, double divider)
-{
-    double remainder = fmod(value, divider);
-    return remainder < 0 ? remainder + divider : remainder;
-}
-
-void DateComponents::setMillisecondsSinceMidnightInternal(double msInDay)
-{
-    ASSERT(msInDay >= 0 && msInDay < msPerDay);
-    m_millisecond = static_cast<int>(fmod(msInDay, msPerSecond));
-    double value = floor(msInDay / msPerSecond);
-    m_second = static_cast<int>(fmod(value, secondsPerMinute));
-    value = floor(value / secondsPerMinute);
-    m_minute = static_cast<int>(fmod(value, minutesPerHour));
-    m_hour = static_cast<int>(value / minutesPerHour);
-}
-
-bool DateComponents::setMillisecondsSinceEpochForDateInternal(double ms)
-{
-    m_year = msToYear(ms);
-    int yearDay = dayInYear(ms, m_year);
-    m_month = monthFromDayInYear(yearDay, isLeapYear(m_year));
-    m_monthDay = dayInMonthFromDayInYear(yearDay, isLeapYear(m_year));
-    return true;
-}
-
-bool DateComponents::setMillisecondsSinceEpochForDate(double ms)
-{
-    m_type = Invalid;
-    if (!std::isfinite(ms))
-        return false;
-    if (!setMillisecondsSinceEpochForDateInternal(round(ms)))
-        return false;
-    if (!withinHTMLDateLimits(m_year, m_month, m_monthDay))
-        return false;
-    m_type = Date;
-    return true;
-}
-
-bool DateComponents::setMillisecondsSinceEpochForDateTime(double ms)
-{
-    m_type = Invalid;
-    if (!std::isfinite(ms))
-        return false;
-    ms = round(ms);
-    setMillisecondsSinceMidnightInternal(positiveFmod(ms, msPerDay));
-    if (!setMillisecondsSinceEpochForDateInternal(ms))
-        return false;
-    if (!withinHTMLDateLimits(m_year, m_month, m_monthDay, m_hour, m_minute, m_second, m_millisecond))
-        return false;
-    m_type = DateTime;
-    return true;
-}
-
-bool DateComponents::setMillisecondsSinceEpochForDateTimeLocal(double ms)
-{
-    // Internal representation of DateTimeLocal is the same as DateTime except m_type.
-    if (!setMillisecondsSinceEpochForDateTime(ms))
-        return false;
-    m_type = DateTimeLocal;
-    return true;
-}
-
-bool DateComponents::setMillisecondsSinceEpochForMonth(double ms)
-{
-    m_type = Invalid;
-    if (!std::isfinite(ms))
-        return false;
-    if (!setMillisecondsSinceEpochForDateInternal(round(ms)))
-        return false;
-    if (!withinHTMLDateLimits(m_year, m_month))
-        return false;
-    m_type = Month;
-    return true;
-}
-
-bool DateComponents::setMillisecondsSinceMidnight(double ms)
-{
-    m_type = Invalid;
-    if (!std::isfinite(ms))
-        return false;
-    setMillisecondsSinceMidnightInternal(positiveFmod(round(ms), msPerDay));
-    m_type = Time;
-    return true;
-}
-
-bool DateComponents::setMonthsSinceEpoch(double months)
-{
-    if (!std::isfinite(months))
-        return false;
-    months = round(months);
-    double doubleMonth = positiveFmod(months, 12);
-    double doubleYear = 1970 + (months - doubleMonth) / 12;
-    if (doubleYear < minimumYear() || maximumYear() < doubleYear)
-        return false;
-    int year = static_cast<int>(doubleYear);
-    int month = static_cast<int>(doubleMonth);
-    if (!withinHTMLDateLimits(year, month))
-        return false;
-    m_year = year;
-    m_month = month;
-    m_type = Month;
-    return true;
-}
-
-// Offset from January 1st to Monday of the ISO 8601's first week.
-//   ex. If January 1st is Friday, such Monday is 3 days later. Returns 3.
-static int offsetTo1stWeekStart(int year)
-{
-    int offsetTo1stWeekStart = 1 - dayOfWeek(year, 0, 1);
-    if (offsetTo1stWeekStart <= -4)
-        offsetTo1stWeekStart += 7;
-    return offsetTo1stWeekStart;
-}
-
-bool DateComponents::setMillisecondsSinceEpochForWeek(double ms)
-{
-    m_type = Invalid;
-    if (!std::isfinite(ms))
-        return false;
-    ms = round(ms);
-
-    m_year = msToYear(ms);
-    if (m_year < minimumYear() || m_year > maximumYear())
-        return false;
-
-    int yearDay = dayInYear(ms, m_year);
-    int offset = offsetTo1stWeekStart(m_year);
-    if (yearDay < offset) {
-        // The day belongs to the last week of the previous year.
-        m_year--;
-        if (m_year <= minimumYear())
-            return false;
-        m_week = maxWeekNumberInYear();
-    } else {
-        m_week = ((yearDay - offset) / 7) + 1;
-        if (m_week > maxWeekNumberInYear()) {
-            m_year++;
-            m_week = 1;
-        }
-        if (m_year > maximumYear() || (m_year == maximumYear() && m_week > maximumWeekInMaximumYear))
-            return false;
-    }
-    m_type = Week;
-    return true;
-}
-
-double DateComponents::millisecondsSinceEpochForTime() const
-{
-    ASSERT(m_type == Time || m_type == DateTime || m_type == DateTimeLocal);
-    return ((m_hour * minutesPerHour + m_minute) * secondsPerMinute + m_second) * msPerSecond + m_millisecond;
-}
-
-double DateComponents::millisecondsSinceEpoch() const
-{
-    switch (m_type) {
-    case Date:
-        return dateToDaysFrom1970(m_year, m_month, m_monthDay) * msPerDay;
-    case DateTime:
-    case DateTimeLocal:
-        return dateToDaysFrom1970(m_year, m_month, m_monthDay) * msPerDay + millisecondsSinceEpochForTime();
-    case Month:
-        return dateToDaysFrom1970(m_year, m_month, 1) * msPerDay;
-    case Time:
-        return millisecondsSinceEpochForTime();
-    case Week:
-        return (dateToDaysFrom1970(m_year, 0, 1) + offsetTo1stWeekStart(m_year) + (m_week - 1) * 7) * msPerDay;
-    case Invalid:
-        break;
-    }
-    ASSERT_NOT_REACHED();
-    return invalidMilliseconds();
-}
-
-double DateComponents::monthsSinceEpoch() const
-{
-    ASSERT(m_type == Month);
-    return (m_year - 1970) * 12 + m_month;
-}
-
-String DateComponents::toStringForTime(SecondFormat format) const
-{
-    ASSERT(m_type == DateTime || m_type == DateTimeLocal || m_type == Time);
-    SecondFormat effectiveFormat = format;
-    if (m_millisecond)
-        effectiveFormat = Millisecond;
-    else if (format == None && m_second)
-        effectiveFormat = Second;
-
-    switch (effectiveFormat) {
-    default:
-        ASSERT_NOT_REACHED();
-        // Fallback to None.
-    case None:
-        return String::format("%02d:%02d", m_hour, m_minute);
-    case Second:
-        return String::format("%02d:%02d:%02d", m_hour, m_minute, m_second);
-    case Millisecond:
-        return String::format("%02d:%02d:%02d.%03d", m_hour, m_minute, m_second, m_millisecond);
-    }
-}
-
-String DateComponents::toString(SecondFormat format) const
-{
-    switch (m_type) {
-    case Date:
-        return String::format("%04d-%02d-%02d", m_year, m_month + 1, m_monthDay);
-    case DateTime:
-        return String::format("%04d-%02d-%02dT", m_year, m_month + 1, m_monthDay)
-            + toStringForTime(format) + String("Z");
-    case DateTimeLocal:
-        return String::format("%04d-%02d-%02dT", m_year, m_month + 1, m_monthDay)
-            + toStringForTime(format);
-    case Month:
-        return String::format("%04d-%02d", m_year, m_month + 1);
-    case Time:
-        return toStringForTime(format);
-    case Week:
-        return String::format("%04d-W%02d", m_year, m_week);
-    case Invalid:
-        break;
-    }
-    ASSERT_NOT_REACHED();
-    return String("(Invalid DateComponents)");
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/DateComponents.h b/Source/core/platform/DateComponents.h
deleted file mode 100644
index a8f4a49..0000000
--- a/Source/core/platform/DateComponents.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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
- * 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 DateComponents_h
-#define DateComponents_h
-
-#include <limits>
-#include "wtf/Forward.h"
-#include "wtf/unicode/Unicode.h"
-
-namespace WebCore {
-
-// A DateComponents instance represents one of the following date and time combinations:
-// * Month type: year-month
-// * Date type: year-month-day
-// * Week type: year-week
-// * Time type: hour-minute-second-millisecond
-// * DateTime or DateTimeLocal type: year-month-day hour-minute-second-millisecond
-class DateComponents {
-public:
-    DateComponents()
-        : m_millisecond(0)
-        , m_second(0)
-        , m_minute(0)
-        , m_hour(0)
-        , m_monthDay(0)
-        , m_month(0)
-        , m_year(0)
-        , m_week(0)
-        , m_type(Invalid)
-    {
-    }
-
-    enum Type {
-        Invalid,
-        Date,
-        DateTime,
-        DateTimeLocal,
-        Month,
-        Time,
-        Week,
-    };
-
-    int millisecond() const { return m_millisecond; }
-    int second() const { return m_second; }
-    int minute() const { return m_minute; }
-    int hour() const { return m_hour; }
-    int monthDay() const { return m_monthDay; }
-    int month() const { return m_month; }
-    int fullYear() const { return m_year; }
-    int week() const { return m_week; }
-    Type type() const { return m_type; }
-
-    enum SecondFormat {
-        None, // Suppress the second part and the millisecond part if they are 0.
-        Second, // Always show the second part, and suppress the millisecond part if it is 0.
-        Millisecond // Always show the second part and the millisecond part.
-    };
-
-    // Returns an ISO 8601 representation for this instance.
-    // The format argument is valid for DateTime, DateTimeLocal, and Time types.
-    String toString(SecondFormat format = None) const;
-
-    // parse*() and setMillisecondsSince*() functions are initializers for an
-    // DateComponents instance. If these functions return false, the instance
-    // might be invalid.
-
-    // The following six functions parse the input 'src' whose length is
-    // 'length', and updates some fields of this instance. The parsing starts at
-    // src[start] and examines characters before src[length].
-    // 'src' must be non-null. The 'src' string doesn't need to be
-    // null-terminated.
-    // The functions return true if the parsing succeeds, and set 'end' to the
-    // next index after the last consumed. Extra leading characters cause parse
-    // failures, and the trailing extra characters don't cause parse failures.
-
-    // Sets year and month.
-    bool parseMonth(const String&, unsigned start, unsigned& end);
-    // Sets year, month and monthDay.
-    bool parseDate(const String&, unsigned start, unsigned& end);
-    // Sets year and week.
-    bool parseWeek(const String&, unsigned start, unsigned& end);
-    // Sets hour, minute, second and millisecond.
-    bool parseTime(const String&, unsigned start, unsigned& end);
-    // Sets year, month, monthDay, hour, minute, second and millisecond.
-    bool parseDateTimeLocal(const String&, unsigned start, unsigned& end);
-    // Sets year, month, monthDay, hour, minute, second and millisecond, and adjusts timezone.
-    bool parseDateTime(const String&, unsigned start, unsigned& end);
-
-    // The following setMillisecondsSinceEpochFor*() functions take
-    // the number of milliseconds since 1970-01-01 00:00:00.000 UTC as
-    // the argument, and update all fields for the corresponding
-    // DateComponents type. The functions return true if it succeeds, and
-    // false if they fail.
-
-    // For Date type. Updates m_year, m_month and m_monthDay.
-    bool setMillisecondsSinceEpochForDate(double ms);
-    // For DateTime type. Updates m_year, m_month, m_monthDay, m_hour, m_minute, m_second and m_millisecond.
-    bool setMillisecondsSinceEpochForDateTime(double ms);
-    // For DateTimeLocal type. Updates m_year, m_month, m_monthDay, m_hour, m_minute, m_second and m_millisecond.
-    bool setMillisecondsSinceEpochForDateTimeLocal(double ms);
-    // For Month type. Updates m_year and m_month.
-    bool setMillisecondsSinceEpochForMonth(double ms);
-    // For Week type. Updates m_year and m_week.
-    bool setMillisecondsSinceEpochForWeek(double ms);
-
-    // For Time type. Updates m_hour, m_minute, m_second and m_millisecond.
-    bool setMillisecondsSinceMidnight(double ms);
-
-    // Another initializer for Month type. Updates m_year and m_month.
-    bool setMonthsSinceEpoch(double months);
-
-    // Returns the number of milliseconds from 1970-01-01 00:00:00 UTC.
-    // For a DateComponents initialized with parseDateTimeLocal(),
-    // millisecondsSinceEpoch() returns a value for UTC timezone.
-    double millisecondsSinceEpoch() const;
-    // Returns the number of months from 1970-01.
-    // Do not call this for types other than Month.
-    double monthsSinceEpoch() const;
-    static inline double invalidMilliseconds() { return std::numeric_limits<double>::quiet_NaN(); }
-
-    // Minimum and maxmimum limits for setMillisecondsSince*(),
-    // setMonthsSinceEpoch(), millisecondsSinceEpoch(), and monthsSinceEpoch().
-    static inline double minimumDate() { return -62135596800000.0; } // 0001-01-01T00:00Z
-    static inline double minimumDateTime() { return -62135596800000.0; } // ditto.
-    static inline double minimumMonth() { return (1 - 1970) * 12.0 + 1 - 1; } // 0001-01
-    static inline double minimumTime() { return 0; } // 00:00:00.000
-    static inline double minimumWeek() { return -62135596800000.0; } // 0001-01-01, the first Monday of 0001.
-    static inline double maximumDate() { return 8640000000000000.0; } // 275760-09-13T00:00Z
-    static inline double maximumDateTime() { return 8640000000000000.0; } // ditto.
-    static inline double maximumMonth() { return (275760 - 1970) * 12.0 + 9 - 1; } // 275760-09
-    static inline double maximumTime() { return 86399999; } // 23:59:59.999
-    static inline double maximumWeek() { return 8639999568000000.0; } // 275760-09-08, the Monday of the week including 275760-09-13.
-
-    // HTML5 uses ISO-8601 format with year >= 1. Gregorian calendar started in
-    // 1582. However, we need to support 0001-01-01 in Gregorian calendar rule.
-    static inline int minimumYear() { return 1; }
-    // Date in ECMAScript can't represent dates later than 275760-09-13T00:00Z.
-    // So, we have the same upper limit in HTML5 date/time types.
-    static inline int maximumYear() { return 275760; }
-    static const int minimumWeekNumber;
-    static const int maximumWeekNumber;
-
-private:
-    // Returns the maximum week number in this DateComponents's year.
-    // The result is either of 52 and 53.
-    int maxWeekNumberInYear() const;
-    bool parseYear(const String&, unsigned start, unsigned& end);
-    bool addDay(int);
-    bool addMinute(int);
-    bool parseTimeZone(const String&, unsigned start, unsigned& end);
-    // Helper for millisecondsSinceEpoch().
-    double millisecondsSinceEpochForTime() const;
-    // Helpers for setMillisecondsSinceEpochFor*().
-    bool setMillisecondsSinceEpochForDateInternal(double ms);
-    void setMillisecondsSinceMidnightInternal(double ms);
-    // Helper for toString().
-    String toStringForTime(SecondFormat) const;
-
-    // m_weekDay values
-    enum {
-        Sunday = 0,
-        Monday,
-        Tuesday,
-        Wednesday,
-        Thursday,
-        Friday,
-        Saturday,
-    };
-
-    int m_millisecond; // 0 - 999
-    int m_second;
-    int m_minute;
-    int m_hour;
-    int m_monthDay; // 1 - 31
-    int m_month; // 0:January - 11:December
-    int m_year; //  1582 -
-    int m_week; // 1 - 53
-
-    Type m_type;
-};
-
-
-} // namespace WebCore
-
-#endif // DateComponents_h
diff --git a/Source/core/platform/DateTimeChooser.h b/Source/core/platform/DateTimeChooser.h
index 814d24d..2b30c4b 100644
--- a/Source/core/platform/DateTimeChooser.h
+++ b/Source/core/platform/DateTimeChooser.h
@@ -31,7 +31,7 @@
 #ifndef DateTimeChooser_h
 #define DateTimeChooser_h
 
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
 #include "wtf/RefCounted.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/platform/Decimal.cpp b/Source/core/platform/Decimal.cpp
deleted file mode 100644
index e61d5bb..0000000
--- a/Source/core/platform/Decimal.cpp
+++ /dev/null
@@ -1,1034 +0,0 @@
-/*
- * 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:
- *
- *     * 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/Decimal.h"
-
-#include <float.h>
-#include <algorithm>
-
-#include "wtf/Assertions.h"
-#include "wtf/MathExtras.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/text/StringBuilder.h"
-
-namespace WebCore {
-
-namespace DecimalPrivate {
-
-static int const ExponentMax = 1023;
-static int const ExponentMin = -1023;
-static int const Precision = 18;
-
-static const uint64_t MaxCoefficient = UINT64_C(0x16345785D89FFFF); // 999999999999999999 == 18 9's
-
-// This class handles Decimal special values.
-class SpecialValueHandler {
-    WTF_MAKE_NONCOPYABLE(SpecialValueHandler);
-public:
-    enum HandleResult {
-        BothFinite,
-        BothInfinity,
-        EitherNaN,
-        LHSIsInfinity,
-        RHSIsInfinity,
-    };
-
-    SpecialValueHandler(const Decimal& lhs, const Decimal& rhs);
-    HandleResult handle();
-    Decimal value() const;
-
-private:
-    enum Result {
-        ResultIsLHS,
-        ResultIsRHS,
-        ResultIsUnknown,
-    };
-
-    const Decimal& m_lhs;
-    const Decimal& m_rhs;
-    Result m_result;
-};
-
-SpecialValueHandler::SpecialValueHandler(const Decimal& lhs, const Decimal& rhs)
-    : m_lhs(lhs), m_rhs(rhs), m_result(ResultIsUnknown)
-{
-}
-
-SpecialValueHandler::HandleResult SpecialValueHandler::handle()
-{
-    if (m_lhs.isFinite() && m_rhs.isFinite())
-        return BothFinite;
-
-    const Decimal::EncodedData::FormatClass lhsClass = m_lhs.value().formatClass();
-    const Decimal::EncodedData::FormatClass rhsClass = m_rhs.value().formatClass();
-    if (lhsClass == Decimal::EncodedData::ClassNaN) {
-        m_result = ResultIsLHS;
-        return EitherNaN;
-     }
-
-    if (rhsClass == Decimal::EncodedData::ClassNaN) {
-        m_result = ResultIsRHS;
-        return EitherNaN;
-     }
-
-    if (lhsClass == Decimal::EncodedData::ClassInfinity)
-        return rhsClass == Decimal::EncodedData::ClassInfinity ? BothInfinity : LHSIsInfinity;
-
-    if (rhsClass == Decimal::EncodedData::ClassInfinity)
-        return RHSIsInfinity;
-
-    ASSERT_NOT_REACHED();
-    return BothFinite;
-}
-
-Decimal SpecialValueHandler::value() const
-{
-    switch (m_result) {
-    case ResultIsLHS:
-        return m_lhs;
-    case ResultIsRHS:
-        return m_rhs;
-    case ResultIsUnknown:
-    default:
-        ASSERT_NOT_REACHED();
-        return m_lhs;
-    }
-}
-
-// This class is used for 128 bit unsigned integer arithmetic.
-class UInt128 {
-public:
-    UInt128(uint64_t low, uint64_t high)
-        : m_high(high), m_low(low)
-    {
-    }
-
-    UInt128& operator/=(uint32_t);
-
-    uint64_t high() const { return m_high; }
-    uint64_t low() const { return m_low; }
-
-    static UInt128 multiply(uint64_t u, uint64_t v) { return UInt128(u * v, multiplyHigh(u, v)); }
-
-private:
-    static uint32_t highUInt32(uint64_t x) { return static_cast<uint32_t>(x >> 32); }
-    static uint32_t lowUInt32(uint64_t x) { return static_cast<uint32_t>(x & ((static_cast<uint64_t>(1) << 32) - 1)); }
-    bool isZero() const { return !m_low && !m_high; }
-    static uint64_t makeUInt64(uint32_t low, uint32_t high) { return low | (static_cast<uint64_t>(high) << 32); }
-
-    static uint64_t multiplyHigh(uint64_t, uint64_t);
-
-    uint64_t m_high;
-    uint64_t m_low;
-};
-
-UInt128& UInt128::operator/=(const uint32_t divisor)
-{
-    ASSERT(divisor);
-
-    if (!m_high) {
-        m_low /= divisor;
-        return *this;
-    }
-
-    uint32_t dividend[4];
-    dividend[0] = lowUInt32(m_low);
-    dividend[1] = highUInt32(m_low);
-    dividend[2] = lowUInt32(m_high);
-    dividend[3] = highUInt32(m_high);
-
-    uint32_t quotient[4];
-    uint32_t remainder = 0;
-    for (int i = 3; i >= 0; --i) {
-        const uint64_t work = makeUInt64(dividend[i], remainder);
-        remainder = static_cast<uint32_t>(work % divisor);
-        quotient[i] = static_cast<uint32_t>(work / divisor);
-    }
-    m_low = makeUInt64(quotient[0], quotient[1]);
-    m_high = makeUInt64(quotient[2], quotient[3]);
-    return *this;
-}
-
-// Returns high 64bit of 128bit product.
-uint64_t UInt128::multiplyHigh(uint64_t u, uint64_t v)
-{
-    const uint64_t uLow = lowUInt32(u);
-    const uint64_t uHigh = highUInt32(u);
-    const uint64_t vLow = lowUInt32(v);
-    const uint64_t vHigh = highUInt32(v);
-    const uint64_t partialProduct = uHigh * vLow + highUInt32(uLow * vLow);
-    return uHigh * vHigh + highUInt32(partialProduct) + highUInt32(uLow * vHigh + lowUInt32(partialProduct));
-}
-
-static int countDigits(uint64_t x)
-{
-    int numberOfDigits = 0;
-    for (uint64_t powerOfTen = 1; x >= powerOfTen; powerOfTen *= 10) {
-        ++numberOfDigits;
-        if (powerOfTen >= std::numeric_limits<uint64_t>::max() / 10)
-            break;
-    }
-    return numberOfDigits;
-}
-
-static uint64_t scaleDown(uint64_t x, int n)
-{
-    ASSERT(n >= 0);
-    while (n > 0 && x) {
-        x /= 10;
-        --n;
-    }
-    return x;
-}
-
-static uint64_t scaleUp(uint64_t x, int n)
-{
-    ASSERT(n >= 0);
-    ASSERT(n < Precision);
-
-    uint64_t y = 1;
-    uint64_t z = 10;
-    for (;;) {
-        if (n & 1)
-            y = y * z;
-
-        n >>= 1;
-        if (!n)
-            return x * y;
-
-        z = z * z;
-    }
-}
-
-} // namespace DecimalPrivate
-
-using namespace DecimalPrivate;
-
-Decimal::EncodedData::EncodedData(Sign sign, FormatClass formatClass)
-    : m_coefficient(0)
-    , m_exponent(0)
-    , m_formatClass(formatClass)
-    , m_sign(sign)
-{
-}
-
-Decimal::EncodedData::EncodedData(Sign sign, int exponent, uint64_t coefficient)
-    : m_formatClass(coefficient ? ClassNormal : ClassZero)
-    , m_sign(sign)
-{
-    if (exponent >= ExponentMin && exponent <= ExponentMax) {
-        while (coefficient > MaxCoefficient) {
-            coefficient /= 10;
-            ++exponent;
-        }
-    }
-
-    if (exponent > ExponentMax) {
-        m_coefficient = 0;
-        m_exponent = 0;
-        m_formatClass = ClassInfinity;
-        return;
-    }
-
-    if (exponent < ExponentMin) {
-        m_coefficient = 0;
-        m_exponent = 0;
-        m_formatClass = ClassZero;
-        return;
-    }
-
-    m_coefficient = coefficient;
-    m_exponent = static_cast<int16_t>(exponent);
-}
-
-bool Decimal::EncodedData::operator==(const EncodedData& another) const
-{
-    return m_sign == another.m_sign
-        && m_formatClass == another.m_formatClass
-        && m_exponent == another.m_exponent
-        && m_coefficient == another.m_coefficient;
-}
-
-Decimal::Decimal(int32_t i32)
-    : m_data(i32 < 0 ? Negative : Positive, 0, i32 < 0 ? static_cast<uint64_t>(-static_cast<int64_t>(i32)) : static_cast<uint64_t>(i32))
-{
-}
-
-Decimal::Decimal(Sign sign, int exponent, uint64_t coefficient)
-    : m_data(sign, exponent, coefficient)
-{
-}
-
-Decimal::Decimal(const EncodedData& data)
-    : m_data(data)
-{
-}
-
-Decimal::Decimal(const Decimal& other)
-    : m_data(other.m_data)
-{
-}
-
-Decimal& Decimal::operator=(const Decimal& other)
-{
-    m_data = other.m_data;
-    return *this;
-}
-
-Decimal& Decimal::operator+=(const Decimal& other)
-{
-    m_data = (*this + other).m_data;
-    return *this;
-}
-
-Decimal& Decimal::operator-=(const Decimal& other)
-{
-    m_data = (*this - other).m_data;
-    return *this;
-}
-
-Decimal& Decimal::operator*=(const Decimal& other)
-{
-    m_data = (*this * other).m_data;
-    return *this;
-}
-
-Decimal& Decimal::operator/=(const Decimal& other)
-{
-    m_data = (*this / other).m_data;
-    return *this;
-}
-
-Decimal Decimal::operator-() const
-{
-    if (isNaN())
-        return *this;
-
-    Decimal result(*this);
-    result.m_data.setSign(invertSign(m_data.sign()));
-    return result;
-}
-
-Decimal Decimal::operator+(const Decimal& rhs) const
-{
-    const Decimal& lhs = *this;
-    const Sign lhsSign = lhs.sign();
-    const Sign rhsSign = rhs.sign();
-
-    SpecialValueHandler handler(lhs, rhs);
-    switch (handler.handle()) {
-    case SpecialValueHandler::BothFinite:
-        break;
-
-    case SpecialValueHandler::BothInfinity:
-        return lhsSign == rhsSign ? lhs : nan();
-
-    case SpecialValueHandler::EitherNaN:
-        return handler.value();
-
-    case SpecialValueHandler::LHSIsInfinity:
-        return lhs;
-
-    case SpecialValueHandler::RHSIsInfinity:
-        return rhs;
-    }
-
-    const AlignedOperands alignedOperands = alignOperands(lhs, rhs);
-
-    const uint64_t result = lhsSign == rhsSign
-        ? alignedOperands.lhsCoefficient + alignedOperands.rhsCoefficient
-        : alignedOperands.lhsCoefficient - alignedOperands.rhsCoefficient;
-
-    if (lhsSign == Negative && rhsSign == Positive && !result)
-        return Decimal(Positive, alignedOperands.exponent, 0);
-
-    return static_cast<int64_t>(result) >= 0
-        ? Decimal(lhsSign, alignedOperands.exponent, result)
-        : Decimal(invertSign(lhsSign), alignedOperands.exponent, -static_cast<int64_t>(result));
-}
-
-Decimal Decimal::operator-(const Decimal& rhs) const
-{
-    const Decimal& lhs = *this;
-    const Sign lhsSign = lhs.sign();
-    const Sign rhsSign = rhs.sign();
-
-    SpecialValueHandler handler(lhs, rhs);
-    switch (handler.handle()) {
-    case SpecialValueHandler::BothFinite:
-        break;
-
-    case SpecialValueHandler::BothInfinity:
-        return lhsSign == rhsSign ? nan() : lhs;
-
-    case SpecialValueHandler::EitherNaN:
-        return handler.value();
-
-    case SpecialValueHandler::LHSIsInfinity:
-        return lhs;
-
-    case SpecialValueHandler::RHSIsInfinity:
-        return infinity(invertSign(rhsSign));
-    }
-
-    const AlignedOperands alignedOperands = alignOperands(lhs, rhs);
-
-    const uint64_t result = lhsSign == rhsSign
-        ? alignedOperands.lhsCoefficient - alignedOperands.rhsCoefficient
-        : alignedOperands.lhsCoefficient + alignedOperands.rhsCoefficient;
-
-    if (lhsSign == Negative && rhsSign == Negative && !result)
-        return Decimal(Positive, alignedOperands.exponent, 0);
-
-    return static_cast<int64_t>(result) >= 0
-        ? Decimal(lhsSign, alignedOperands.exponent, result)
-        : Decimal(invertSign(lhsSign), alignedOperands.exponent, -static_cast<int64_t>(result));
-}
-
-Decimal Decimal::operator*(const Decimal& rhs) const
-{
-    const Decimal& lhs = *this;
-    const Sign lhsSign = lhs.sign();
-    const Sign rhsSign = rhs.sign();
-    const Sign resultSign = lhsSign == rhsSign ? Positive : Negative;
-
-    SpecialValueHandler handler(lhs, rhs);
-    switch (handler.handle()) {
-    case SpecialValueHandler::BothFinite: {
-        const uint64_t lhsCoefficient = lhs.m_data.coefficient();
-        const uint64_t rhsCoefficient = rhs.m_data.coefficient();
-        int resultExponent = lhs.exponent() + rhs.exponent();
-        UInt128 work(UInt128::multiply(lhsCoefficient, rhsCoefficient));
-        while (work.high()) {
-            work /= 10;
-            ++resultExponent;
-        }
-        return Decimal(resultSign, resultExponent, work.low());
-    }
-
-    case SpecialValueHandler::BothInfinity:
-        return infinity(resultSign);
-
-    case SpecialValueHandler::EitherNaN:
-        return handler.value();
-
-    case SpecialValueHandler::LHSIsInfinity:
-        return rhs.isZero() ? nan() : infinity(resultSign);
-
-    case SpecialValueHandler::RHSIsInfinity:
-        return lhs.isZero() ? nan() : infinity(resultSign);
-    }
-
-    ASSERT_NOT_REACHED();
-    return nan();
-}
-
-Decimal Decimal::operator/(const Decimal& rhs) const
-{
-    const Decimal& lhs = *this;
-    const Sign lhsSign = lhs.sign();
-    const Sign rhsSign = rhs.sign();
-    const Sign resultSign = lhsSign == rhsSign ? Positive : Negative;
-
-    SpecialValueHandler handler(lhs, rhs);
-    switch (handler.handle()) {
-    case SpecialValueHandler::BothFinite:
-        break;
-
-    case SpecialValueHandler::BothInfinity:
-        return nan();
-
-    case SpecialValueHandler::EitherNaN:
-        return handler.value();
-
-    case SpecialValueHandler::LHSIsInfinity:
-        return infinity(resultSign);
-
-    case SpecialValueHandler::RHSIsInfinity:
-        return zero(resultSign);
-    }
-
-    ASSERT(lhs.isFinite());
-    ASSERT(rhs.isFinite());
-
-    if (rhs.isZero())
-        return lhs.isZero() ? nan() : infinity(resultSign);
-
-    int resultExponent = lhs.exponent() - rhs.exponent();
-
-    if (lhs.isZero())
-        return Decimal(resultSign, resultExponent, 0);
-
-    uint64_t remainder = lhs.m_data.coefficient();
-    const uint64_t divisor = rhs.m_data.coefficient();
-    uint64_t result = 0;
-    while (result < MaxCoefficient / 100) {
-        while (remainder < divisor) {
-            remainder *= 10;
-            result *= 10;
-            --resultExponent;
-        }
-        result += remainder / divisor;
-        remainder %= divisor;
-        if (!remainder)
-            break;
-    }
-
-    if (remainder > divisor / 2)
-        ++result;
-
-    return Decimal(resultSign, resultExponent, result);
-}
-
-bool Decimal::operator==(const Decimal& rhs) const
-{
-    return m_data == rhs.m_data || compareTo(rhs).isZero();
-}
-
-bool Decimal::operator!=(const Decimal& rhs) const
-{
-    if (m_data == rhs.m_data)
-        return false;
-    const Decimal result = compareTo(rhs);
-    if (result.isNaN())
-        return false;
-    return !result.isZero();
-}
-
-bool Decimal::operator<(const Decimal& rhs) const
-{
-    const Decimal result = compareTo(rhs);
-    if (result.isNaN())
-        return false;
-    return !result.isZero() && result.isNegative();
-}
-
-bool Decimal::operator<=(const Decimal& rhs) const
-{
-    if (m_data == rhs.m_data)
-        return true;
-    const Decimal result = compareTo(rhs);
-    if (result.isNaN())
-        return false;
-    return result.isZero() || result.isNegative();
-}
-
-bool Decimal::operator>(const Decimal& rhs) const
-{
-    const Decimal result = compareTo(rhs);
-    if (result.isNaN())
-        return false;
-    return !result.isZero() && result.isPositive();
-}
-
-bool Decimal::operator>=(const Decimal& rhs) const
-{
-    if (m_data == rhs.m_data)
-        return true;
-    const Decimal result = compareTo(rhs);
-    if (result.isNaN())
-        return false;
-    return result.isZero() || !result.isNegative();
-}
-
-Decimal Decimal::abs() const
-{
-    Decimal result(*this);
-    result.m_data.setSign(Positive);
-    return result;
-}
-
-Decimal::AlignedOperands Decimal::alignOperands(const Decimal& lhs, const Decimal& rhs)
-{
-    ASSERT(lhs.isFinite());
-    ASSERT(rhs.isFinite());
-
-    const int lhsExponent = lhs.exponent();
-    const int rhsExponent = rhs.exponent();
-    int exponent = std::min(lhsExponent, rhsExponent);
-    uint64_t lhsCoefficient = lhs.m_data.coefficient();
-    uint64_t rhsCoefficient = rhs.m_data.coefficient();
-
-    if (lhsExponent > rhsExponent) {
-        const int numberOfLHSDigits = countDigits(lhsCoefficient);
-        if (numberOfLHSDigits) {
-            const int lhsShiftAmount = lhsExponent - rhsExponent;
-            const int overflow = numberOfLHSDigits + lhsShiftAmount - Precision;
-            if (overflow <= 0)
-                lhsCoefficient = scaleUp(lhsCoefficient, lhsShiftAmount);
-            else {
-                lhsCoefficient = scaleUp(lhsCoefficient, lhsShiftAmount - overflow);
-                rhsCoefficient = scaleDown(rhsCoefficient, overflow);
-                exponent += overflow;
-            }
-        }
-
-    } else if (lhsExponent < rhsExponent) {
-        const int numberOfRHSDigits = countDigits(rhsCoefficient);
-        if (numberOfRHSDigits) {
-            const int rhsShiftAmount = rhsExponent - lhsExponent;
-            const int overflow = numberOfRHSDigits + rhsShiftAmount - Precision;
-            if (overflow <= 0)
-                rhsCoefficient = scaleUp(rhsCoefficient, rhsShiftAmount);
-            else {
-                rhsCoefficient = scaleUp(rhsCoefficient, rhsShiftAmount - overflow);
-                lhsCoefficient = scaleDown(lhsCoefficient, overflow);
-                exponent += overflow;
-            }
-        }
-    }
-
-    AlignedOperands alignedOperands;
-    alignedOperands.exponent = exponent;
-    alignedOperands.lhsCoefficient = lhsCoefficient;
-    alignedOperands.rhsCoefficient = rhsCoefficient;
-    return alignedOperands;
-}
-
-// Round toward positive infinity.
-// Note: Mac ports defines ceil(x) as wtf_ceil(x), so we can't use name "ceil" here.
-Decimal Decimal::ceiling() const
-{
-    if (isSpecial())
-        return *this;
-
-    if (exponent() >= 0)
-        return *this;
-
-    uint64_t result = m_data.coefficient();
-    const int numberOfDigits = countDigits(result);
-    const int numberOfDropDigits = -exponent();
-    if (numberOfDigits < numberOfDropDigits)
-        return isPositive() ? Decimal(1) : zero(Positive);
-
-    result = scaleDown(result, numberOfDropDigits - 1);
-    if (sign() == Positive && result % 10 > 0)
-        result += 10;
-    result /= 10;
-    return Decimal(sign(), 0, result);
-}
-
-Decimal Decimal::compareTo(const Decimal& rhs) const
-{
-    const Decimal result(*this - rhs);
-    switch (result.m_data.formatClass()) {
-    case EncodedData::ClassInfinity:
-        return result.isNegative() ? Decimal(-1) : Decimal(1);
-
-    case EncodedData::ClassNaN:
-    case EncodedData::ClassNormal:
-        return result;
-
-    case EncodedData::ClassZero:
-        return zero(Positive);
-
-    default:
-        ASSERT_NOT_REACHED();
-        return nan();
-    }
-}
-
-// Round toward negative infinity.
-Decimal Decimal::floor() const
-{
-    if (isSpecial())
-        return *this;
-
-    if (exponent() >= 0)
-        return *this;
-
-    uint64_t result = m_data.coefficient();
-    const int numberOfDigits = countDigits(result);
-    const int numberOfDropDigits = -exponent();
-    if (numberOfDigits < numberOfDropDigits)
-        return isPositive() ? zero(Positive) : Decimal(-1);
-
-    result = scaleDown(result, numberOfDropDigits - 1);
-    if (isNegative() && result % 10 > 0)
-        result += 10;
-    result /= 10;
-    return Decimal(sign(), 0, result);
-}
-
-Decimal Decimal::fromDouble(double doubleValue)
-{
-    if (std::isfinite(doubleValue))
-        return fromString(String::numberToStringECMAScript(doubleValue));
-
-    if (std::isinf(doubleValue))
-        return infinity(doubleValue < 0 ? Negative : Positive);
-
-    return nan();
-}
-
-Decimal Decimal::fromString(const String& str)
-{
-    int exponent = 0;
-    Sign exponentSign = Positive;
-    int numberOfDigits = 0;
-    int numberOfDigitsAfterDot = 0;
-    int numberOfExtraDigits = 0;
-    Sign sign = Positive;
-
-    enum {
-        StateDigit,
-        StateDot,
-        StateDotDigit,
-        StateE,
-        StateEDigit,
-        StateESign,
-        StateSign,
-        StateStart,
-        StateZero,
-    } state = StateStart;
-
-#define HandleCharAndBreak(expected, nextState) \
-    if (ch == expected) { \
-        state = nextState; \
-        break; \
-    }
-
-#define HandleTwoCharsAndBreak(expected1, expected2, nextState) \
-    if (ch == expected1 || ch == expected2) { \
-        state = nextState; \
-        break; \
-    }
-
-    uint64_t accumulator = 0;
-    for (unsigned index = 0; index < str.length(); ++index) {
-        const int ch = str[index];
-        switch (state) {
-        case StateDigit:
-            if (ch >= '0' && ch <= '9') {
-                if (numberOfDigits < Precision) {
-                    ++numberOfDigits;
-                    accumulator *= 10;
-                    accumulator += ch - '0';
-                } else
-                    ++numberOfExtraDigits;
-                break;
-            }
-
-            HandleCharAndBreak('.', StateDot);
-            HandleTwoCharsAndBreak('E', 'e', StateE);
-            return nan();
-
-        case StateDot:
-            if (ch >= '0' && ch <= '9') {
-                if (numberOfDigits < Precision) {
-                    ++numberOfDigits;
-                    ++numberOfDigitsAfterDot;
-                    accumulator *= 10;
-                    accumulator += ch - '0';
-                }
-                state = StateDotDigit;
-                break;
-            }
-
-        case StateDotDigit:
-            if (ch >= '0' && ch <= '9') {
-                if (numberOfDigits < Precision) {
-                    ++numberOfDigits;
-                    ++numberOfDigitsAfterDot;
-                    accumulator *= 10;
-                    accumulator += ch - '0';
-                }
-                break;
-            }
-
-            HandleTwoCharsAndBreak('E', 'e', StateE);
-            return nan();
-
-        case StateE:
-            if (ch == '+') {
-                exponentSign = Positive;
-                state = StateESign;
-                break;
-            }
-
-            if (ch == '-') {
-                exponentSign = Negative;
-                state = StateESign;
-                break;
-            }
-
-            if (ch >= '0' && ch <= '9') {
-                exponent = ch - '0';
-                state = StateEDigit;
-                break;
-            }
-
-            return nan();
-
-        case StateEDigit:
-            if (ch >= '0' && ch <= '9') {
-                exponent *= 10;
-                exponent += ch - '0';
-                if (exponent > ExponentMax + Precision) {
-                    if (accumulator)
-                        return exponentSign == Negative ? zero(Positive) : infinity(sign);
-                    return zero(sign);
-                }
-                state = StateEDigit;
-                break;
-            }
-
-            return nan();
-
-        case StateESign:
-            if (ch >= '0' && ch <= '9') {
-                exponent = ch - '0';
-                state = StateEDigit;
-                break;
-            }
-
-            return nan();
-
-        case StateSign:
-            if (ch >= '1' && ch <= '9') {
-                accumulator = ch - '0';
-                numberOfDigits = 1;
-                state = StateDigit;
-                break;
-            }
-
-            HandleCharAndBreak('0', StateZero);
-            return nan();
-
-        case StateStart:
-            if (ch >= '1' && ch <= '9') {
-                accumulator = ch - '0';
-                numberOfDigits = 1;
-                state = StateDigit;
-                break;
-            }
-
-            if (ch == '-') {
-                sign = Negative;
-                state = StateSign;
-                break;
-            }
-
-            if (ch == '+') {
-                sign = Positive;
-                state = StateSign;
-                break;
-            }
-
-            HandleCharAndBreak('0', StateZero);
-            HandleCharAndBreak('.', StateDot);
-            return nan();
-
-        case StateZero:
-            if (ch == '0')
-                break;
-
-            if (ch >= '1' && ch <= '9') {
-                accumulator = ch - '0';
-                numberOfDigits = 1;
-                state = StateDigit;
-                break;
-            }
-
-            HandleCharAndBreak('.', StateDot);
-            HandleTwoCharsAndBreak('E', 'e', StateE);
-            return nan();
-
-        default:
-            ASSERT_NOT_REACHED();
-            return nan();
-        }
-    }
-
-    if (state == StateZero)
-        return zero(sign);
-
-    if (state == StateDigit || state == StateEDigit || state == StateDotDigit) {
-        int resultExponent = exponent * (exponentSign == Negative ? -1 : 1) - numberOfDigitsAfterDot + numberOfExtraDigits;
-        if (resultExponent < ExponentMin)
-            return zero(Positive);
-
-        const int overflow = resultExponent - ExponentMax + 1;
-        if (overflow > 0) {
-            if (overflow + numberOfDigits - numberOfDigitsAfterDot > Precision)
-                return infinity(sign);
-            accumulator = scaleUp(accumulator, overflow);
-            resultExponent -= overflow;
-        }
-
-        return Decimal(sign, resultExponent, accumulator);
-    }
-
-    return nan();
-}
-
-Decimal Decimal::infinity(const Sign sign)
-{
-    return Decimal(EncodedData(sign, EncodedData::ClassInfinity));
-}
-
-Decimal Decimal::nan()
-{
-    return Decimal(EncodedData(Positive, EncodedData::ClassNaN));
-}
-
-Decimal Decimal::remainder(const Decimal& rhs) const
-{
-    const Decimal quotient = *this / rhs;
-    return quotient.isSpecial() ? quotient : *this - (quotient.isNegative() ? quotient.ceiling() : quotient.floor()) * rhs;
-}
-
-Decimal Decimal::round() const
-{
-    if (isSpecial())
-        return *this;
-
-    if (exponent() >= 0)
-        return *this;
-
-    uint64_t result = m_data.coefficient();
-    const int numberOfDigits = countDigits(result);
-    const int numberOfDropDigits = -exponent();
-    if (numberOfDigits < numberOfDropDigits)
-        return zero(Positive);
-
-    result = scaleDown(result, numberOfDropDigits - 1);
-    if (result % 10 >= 5)
-        result += 10;
-    result /= 10;
-    return Decimal(sign(), 0, result);
-}
-
-double Decimal::toDouble() const
-{
-    if (isFinite()) {
-        bool valid;
-        const double doubleValue = toString().toDouble(&valid);
-        return valid ? doubleValue : std::numeric_limits<double>::quiet_NaN();
-    }
-
-    if (isInfinity())
-        return isNegative() ? -std::numeric_limits<double>::infinity() : std::numeric_limits<double>::infinity();
-
-    return std::numeric_limits<double>::quiet_NaN();
-}
-
-String Decimal::toString() const
-{
-    switch (m_data.formatClass()) {
-    case EncodedData::ClassInfinity:
-        return sign() ? "-Infinity" : "Infinity";
-
-    case EncodedData::ClassNaN:
-        return "NaN";
-
-    case EncodedData::ClassNormal:
-    case EncodedData::ClassZero:
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        return "";
-    }
-
-    StringBuilder builder;
-    if (sign())
-        builder.append('-');
-
-    int originalExponent = exponent();
-    uint64_t coefficient = m_data.coefficient();
-
-    if (originalExponent < 0) {
-        const int maxDigits = DBL_DIG;
-        uint64_t lastDigit = 0;
-        while (countDigits(coefficient) > maxDigits) {
-            lastDigit = coefficient % 10;
-            coefficient /= 10;
-            ++originalExponent;
-        }
-
-        if (lastDigit >= 5)
-            ++coefficient;
-
-        while (originalExponent < 0 && coefficient && !(coefficient % 10)) {
-            coefficient /= 10;
-            ++originalExponent;
-        }
-    }
-
-    const String digits = String::number(coefficient);
-    int coefficientLength = static_cast<int>(digits.length());
-    const int adjustedExponent = originalExponent + coefficientLength - 1;
-    if (originalExponent <= 0 && adjustedExponent >= -6) {
-        if (!originalExponent) {
-            builder.append(digits);
-            return builder.toString();
-        }
-
-        if (adjustedExponent >= 0) {
-            for (int i = 0; i < coefficientLength; ++i) {
-                builder.append(digits[i]);
-                if (i == adjustedExponent)
-                    builder.append('.');
-            }
-            return builder.toString();
-        }
-
-        builder.appendLiteral("0.");
-        for (int i = adjustedExponent + 1; i < 0; ++i)
-            builder.append('0');
-
-        builder.append(digits);
-
-    } else {
-        builder.append(digits[0]);
-        while (coefficientLength >= 2 && digits[coefficientLength - 1] == '0')
-            --coefficientLength;
-        if (coefficientLength >= 2) {
-            builder.append('.');
-            for (int i = 1; i < coefficientLength; ++i)
-                builder.append(digits[i]);
-        }
-
-        if (adjustedExponent) {
-            builder.append(adjustedExponent < 0 ? "e" : "e+");
-            builder.appendNumber(adjustedExponent);
-        }
-    }
-    return builder.toString();
-}
-
-Decimal Decimal::zero(Sign sign)
-{
-    return Decimal(EncodedData(sign, EncodedData::ClassZero));
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/Decimal.h b/Source/core/platform/Decimal.h
deleted file mode 100644
index fa9a1a3..0000000
--- a/Source/core/platform/Decimal.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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:
- *
- *     * 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 Decimal_h
-#define Decimal_h
-
-#include <stdint.h>
-#include "wtf/Assertions.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-namespace DecimalPrivate {
-class SpecialValueHandler;
-}
-
-// This class represents decimal base floating point number.
-//
-// FIXME: Once all C++ compiler support decimal type, we should replace this
-// class to compiler supported one. See below URI for current status of decimal
-// type for C++: // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1977.html
-class Decimal {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    enum Sign {
-        Positive,
-        Negative,
-    };
-
-    // You should not use EncodedData other than unit testing.
-    class EncodedData {
-        // For accessing FormatClass.
-        friend class Decimal;
-        friend class DecimalPrivate::SpecialValueHandler;
-    public:
-        EncodedData(Sign, int exponent, uint64_t coefficient);
-
-        bool operator==(const EncodedData&) const;
-        bool operator!=(const EncodedData& another) const { return !operator==(another); }
-
-        uint64_t coefficient() const { return m_coefficient; }
-        int countDigits() const;
-        int exponent() const { return m_exponent; }
-        bool isFinite() const { return !isSpecial(); }
-        bool isInfinity() const { return m_formatClass == ClassInfinity; }
-        bool isNaN() const { return m_formatClass == ClassNaN; }
-        bool isSpecial() const { return m_formatClass == ClassInfinity || m_formatClass == ClassNaN; }
-        bool isZero() const { return m_formatClass == ClassZero; }
-        Sign sign() const { return m_sign; }
-        void setSign(Sign sign) { m_sign = sign; }
-
-    private:
-        enum FormatClass {
-            ClassInfinity,
-            ClassNormal,
-            ClassNaN,
-            ClassZero,
-        };
-
-        EncodedData(Sign, FormatClass);
-        FormatClass formatClass() const { return m_formatClass; }
-
-        uint64_t m_coefficient;
-        int16_t m_exponent;
-        FormatClass m_formatClass;
-        Sign m_sign;
-    };
-
-    Decimal(int32_t = 0);
-    Decimal(Sign, int exponent, uint64_t coefficient);
-    Decimal(const Decimal&);
-
-    Decimal& operator=(const Decimal&);
-    Decimal& operator+=(const Decimal&);
-    Decimal& operator-=(const Decimal&);
-    Decimal& operator*=(const Decimal&);
-    Decimal& operator/=(const Decimal&);
-
-    Decimal operator-() const;
-
-    bool operator==(const Decimal&) const;
-    bool operator!=(const Decimal&) const;
-    bool operator<(const Decimal&) const;
-    bool operator<=(const Decimal&) const;
-    bool operator>(const Decimal&) const;
-    bool operator>=(const Decimal&) const;
-
-    Decimal operator+(const Decimal&) const;
-    Decimal operator-(const Decimal&) const;
-    Decimal operator*(const Decimal&) const;
-    Decimal operator/(const Decimal&) const;
-
-    int exponent() const
-    {
-        ASSERT(isFinite());
-        return m_data.exponent();
-    }
-
-    bool isFinite() const { return m_data.isFinite(); }
-    bool isInfinity() const { return m_data.isInfinity(); }
-    bool isNaN() const { return m_data.isNaN(); }
-    bool isNegative() const { return sign() == Negative; }
-    bool isPositive() const { return sign() == Positive; }
-    bool isSpecial() const { return m_data.isSpecial(); }
-    bool isZero() const { return m_data.isZero(); }
-
-    Decimal abs() const;
-    Decimal ceiling() const;
-    Decimal floor() const;
-    Decimal remainder(const Decimal&) const;
-    Decimal round() const;
-
-    double toDouble() const;
-    // Note: toString method supports infinity and nan but fromString not.
-    String toString() const;
-
-    static Decimal fromDouble(double);
-    // fromString supports following syntax EBNF:
-    //  number ::= sign? digit+ ('.' digit*) (exponent-marker sign? digit+)?
-    //          | sign? '.' digit+ (exponent-marker sign? digit+)?
-    //  sign ::= '+' | '-'
-    //  exponent-marker ::= 'e' | 'E'
-    //  digit ::= '0' | '1' | ... | '9'
-    // Note: fromString doesn't support "infinity" and "nan".
-    static Decimal fromString(const String&);
-    static Decimal infinity(Sign);
-    static Decimal nan();
-    static Decimal zero(Sign);
-
-    // You should not use below methods. We expose them for unit testing.
-    explicit Decimal(const EncodedData&);
-    const EncodedData& value() const { return m_data; }
-
-private:
-    struct AlignedOperands {
-        uint64_t lhsCoefficient;
-        uint64_t rhsCoefficient;
-        int exponent;
-    };
-
-    Decimal(double);
-    Decimal compareTo(const Decimal&) const;
-
-    static AlignedOperands alignOperands(const Decimal& lhs, const Decimal& rhs);
-    static inline Sign invertSign(Sign sign) { return sign == Negative ? Positive : Negative; }
-
-    Sign sign() const { return m_data.sign(); }
-
-    EncodedData m_data;
-};
-
-} // namespace WebCore
-
-#endif // Decimal_h
diff --git a/Source/core/platform/DecimalTest.cpp b/Source/core/platform/DecimalTest.cpp
deleted file mode 100644
index b56fe88..0000000
--- a/Source/core/platform/DecimalTest.cpp
+++ /dev/null
@@ -1,1097 +0,0 @@
-/*
- * 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:
- *
- *     * 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/Decimal.h"
-
-#include "wtf/MathExtras.h"
-#include "wtf/text/CString.h"
-#include <float.h>
-#include <gtest/gtest.h>
-
-namespace WebCore {
-
-std::ostream& operator<<(std::ostream& os, const Decimal& decimal)
-{
-    Decimal::EncodedData data = decimal.value();
-    return os
-        << "encode(" << String::number(data.coefficient()).ascii().data()
-        << ", " << String::number(data.exponent()).ascii().data()
-        << ", " << (data.sign() == Decimal::Negative ? "Negative" : "Positive")
-        << ")=" << decimal.toString().ascii().data();
-}
-
-} // namespace WebCore
-
-using namespace WebCore;
-
-// Simulate WebCore/html/StepRange
-class DecimalStepRange {
-public:
-    Decimal maximum;
-    Decimal minimum;
-    Decimal step;
-
-    DecimalStepRange(const Decimal& minimum, const Decimal& maximum, const Decimal& step)
-        : maximum(maximum)
-        , minimum(minimum)
-        , step(step)
-    {
-    }
-
-    Decimal clampValue(Decimal value) const
-    {
-        const Decimal result = minimum + ((value - minimum) / step).round() * step;
-        ASSERT(result.isFinite());
-        return result > maximum ? result - step : result;
-    }
-};
-
-class DecimalTest : public ::testing::Test {
-protected:
-    typedef Decimal::Sign Sign;
-    protected: static const Sign Positive = Decimal::Positive;
-    protected: static const Sign Negative = Decimal::Negative;
-
-    Decimal encode(uint64_t coefficient, int exponent, Sign sign)
-    {
-        return Decimal(sign, exponent, coefficient);
-    }
-
-    protected: Decimal fromString(const String& string)
-    {
-        return Decimal::fromString(string);
-    }
-
-    protected: Decimal stepDown(const String& minimum, const String& maximum, const String& step, const String& valueString, int numberOfStepTimes)
-    {
-        DecimalStepRange stepRange(fromString(minimum), fromString(maximum), fromString(step));
-        Decimal value = fromString(valueString);
-        for (int i = 0; i < numberOfStepTimes; ++i) {
-            value -= stepRange.step;
-            value = stepRange.clampValue(value);
-        }
-        return value;
-    }
-
-    protected: Decimal stepUp(const String& minimum, const String& maximum, const String& step, const String& valueString, int numberOfStepTimes)
-    {
-        DecimalStepRange stepRange(fromString(minimum), fromString(maximum), fromString(step));
-        Decimal value = fromString(valueString);
-        for (int i = 0; i < numberOfStepTimes; ++i) {
-            value += stepRange.step;
-            value = stepRange.clampValue(value);
-        }
-        return value;
-    }
-};
-
-// FIXME: We should use expectedSign without "Decimal::", however, g++ causes undefined references for DecimalTest::Positive and Negative.
-#define EXPECT_DECIMAL_ENCODED_DATA_EQ(expectedCoefficient, expectedExponent,  expectedSign, decimal) \
-    EXPECT_EQ((expectedCoefficient), (decimal).value().coefficient()); \
-    EXPECT_EQ((expectedExponent), (decimal).value().exponent()); \
-    EXPECT_EQ(Decimal::expectedSign, (decimal).value().sign());
-
-#define EXPECT_DECIMAL_STREQ(expected, decimal) EXPECT_STREQ((expected), (decimal).toString().ascii().data())
-
-TEST_F(DecimalTest, Abs)
-{
-    EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive).abs());
-    EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Negative).abs());
-
-    EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Positive).abs());
-    EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Negative).abs());
-
-    EXPECT_EQ(encode(0, -10, Positive), encode(0, -10, Positive).abs());
-    EXPECT_EQ(encode(0, -10, Positive), encode(0, -10, Negative).abs());
-
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, 0, Positive).abs());
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, 0, Negative).abs());
-
-    EXPECT_EQ(encode(1, 10, Positive), encode(1, 10, Positive).abs());
-    EXPECT_EQ(encode(1, 10, Positive), encode(1, 10, Negative).abs());
-
-    EXPECT_EQ(encode(1, -10, Positive), encode(1, -10, Positive).abs());
-    EXPECT_EQ(encode(1, -10, Positive), encode(1, -10, Negative).abs());
-}
-
-TEST_F(DecimalTest, AbsBigExponent)
-{
-    EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).abs());
-    EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Negative).abs());
-}
-
-TEST_F(DecimalTest, AbsSmallExponent)
-{
-    EXPECT_EQ(encode(1, -1000, Positive), encode(1, -1000, Positive).abs());
-    EXPECT_EQ(encode(1, -1000, Positive), encode(1, -1000, Negative).abs());
-}
-
-TEST_F(DecimalTest, AbsSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).abs());
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).abs());
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().abs());
-}
-
-TEST_F(DecimalTest, Add)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(0) + Decimal(0));
-    EXPECT_EQ(Decimal(1), Decimal(2) + Decimal(-1));
-    EXPECT_EQ(Decimal(1), Decimal(-1) + Decimal(2));
-    EXPECT_EQ(encode(100, 0, Positive), Decimal(99) + Decimal(1));
-    EXPECT_EQ(encode(100, 0, Negative), Decimal(-50) + Decimal(-50));
-    EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), encode(1, 50, Positive) + Decimal(1));
-    EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), Decimal(1) + encode(1, 50, Positive));
-    EXPECT_EQ(encode(UINT64_C(10000000001), 0, Positive), encode(1, 10, Positive) + Decimal(1));
-    EXPECT_EQ(encode(UINT64_C(10000000001), 0, Positive), Decimal(1) + encode(1, 10, Positive));
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) + encode(1, 0, Positive));
-    EXPECT_EQ(encode(2, -1022, Positive), encode(1, -1022, Positive) + encode(1, -1022, Positive));
-}
-
-TEST_F(DecimalTest, AddBigExponent)
-{
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, 0, Positive));
-    EXPECT_EQ(encode(2, 1022, Positive), encode(1, 1022, Positive) + encode(1, 1022, Positive));
-    EXPECT_EQ(Decimal::infinity(Positive), encode(std::numeric_limits<uint64_t>::max(), 1022, Positive) + encode(1, 0, Positive));
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, -1000, Positive));
-}
-
-TEST_F(DecimalTest, AddSmallExponent)
-{
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) + encode(1, 0, Positive));
-    EXPECT_EQ(encode(2, -1022, Positive), encode(1, -1022, Positive) + encode(1, -1022, Positive));
-}
-
-TEST_F(DecimalTest, AddSpecialValues)
-{
-    const Decimal Infinity(Decimal::infinity(Positive));
-    const Decimal MinusInfinity(Decimal::infinity(Negative));
-    const Decimal NaN(Decimal::nan());
-    const Decimal Ten(10);
-
-    EXPECT_EQ(Infinity, Infinity + Infinity);
-    EXPECT_EQ(NaN, Infinity + MinusInfinity);
-    EXPECT_EQ(NaN, MinusInfinity + Infinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity + MinusInfinity);
-
-    EXPECT_EQ(Infinity, Infinity + Ten);
-    EXPECT_EQ(Infinity, Ten + Infinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity + Ten);
-    EXPECT_EQ(MinusInfinity, Ten + MinusInfinity);
-
-    EXPECT_EQ(NaN, NaN + NaN);
-    EXPECT_EQ(NaN, NaN + Ten);
-    EXPECT_EQ(NaN, Ten + NaN);
-
-    EXPECT_EQ(NaN, NaN - Infinity);
-    EXPECT_EQ(NaN, NaN - MinusInfinity);
-    EXPECT_EQ(NaN, Infinity - NaN);
-    EXPECT_EQ(NaN, MinusInfinity - NaN);
-}
-
-TEST_F(DecimalTest, Ceiling)
-{
-    EXPECT_EQ(Decimal(1), Decimal(1).ceiling());
-    EXPECT_EQ(Decimal(1), encode(1, -10, Positive).ceiling());
-    EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling());
-    EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling());
-    EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling());
-    EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling());
-
-    EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling());
-    EXPECT_EQ(Decimal(0), encode(1, -10, Negative).ceiling());
-    EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling());
-    EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling());
-    EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling());
-    EXPECT_EQ(Decimal(-1), encode(19, -1, Negative).ceiling());
-}
-
-TEST_F(DecimalTest, CeilingBigExponent)
-{
-    EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).ceiling());
-    EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).ceiling());
-}
-
-TEST_F(DecimalTest, CeilingSmallExponent)
-{
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, -1000, Positive).ceiling());
-    EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).ceiling());
-}
-
-TEST_F(DecimalTest, CeilingSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).ceiling());
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).ceiling());
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().ceiling());
-}
-
-TEST_F(DecimalTest, Compare)
-{
-    EXPECT_TRUE(Decimal(0) == Decimal(0));
-    EXPECT_TRUE(Decimal(0) != Decimal(1));
-    EXPECT_TRUE(Decimal(0) < Decimal(1));
-    EXPECT_TRUE(Decimal(0) <= Decimal(0));
-    EXPECT_TRUE(Decimal(0) > Decimal(-1));
-    EXPECT_TRUE(Decimal(0) >= Decimal(0));
-
-    EXPECT_FALSE(Decimal(1) == Decimal(2));
-    EXPECT_FALSE(Decimal(1) != Decimal(1));
-    EXPECT_FALSE(Decimal(1) < Decimal(0));
-    EXPECT_FALSE(Decimal(1) <= Decimal(0));
-    EXPECT_FALSE(Decimal(1) > Decimal(2));
-    EXPECT_FALSE(Decimal(1) >= Decimal(2));
-}
-
-TEST_F(DecimalTest, CompareBigExponent)
-{
-    EXPECT_TRUE(encode(1, 1000, Positive) == encode(1, 1000, Positive));
-    EXPECT_FALSE(encode(1, 1000, Positive) != encode(1, 1000, Positive));
-    EXPECT_FALSE(encode(1, 1000, Positive) < encode(1, 1000, Positive));
-    EXPECT_TRUE(encode(1, 1000, Positive) <= encode(1, 1000, Positive));
-    EXPECT_FALSE(encode(1, 1000, Positive) > encode(1, 1000, Positive));
-    EXPECT_TRUE(encode(1, 1000, Positive) >= encode(1, 1000, Positive));
-
-    EXPECT_TRUE(encode(1, 1000, Negative) == encode(1, 1000, Negative));
-    EXPECT_FALSE(encode(1, 1000, Negative) != encode(1, 1000, Negative));
-    EXPECT_FALSE(encode(1, 1000, Negative) < encode(1, 1000, Negative));
-    EXPECT_TRUE(encode(1, 1000, Negative) <= encode(1, 1000, Negative));
-    EXPECT_FALSE(encode(1, 1000, Negative) > encode(1, 1000, Negative));
-    EXPECT_TRUE(encode(1, 1000, Negative) >= encode(1, 1000, Negative));
-
-    EXPECT_FALSE(encode(2, 1000, Positive) == encode(1, 1000, Positive));
-    EXPECT_TRUE(encode(2, 1000, Positive) != encode(1, 1000, Positive));
-    EXPECT_FALSE(encode(2, 1000, Positive) < encode(1, 1000, Positive));
-    EXPECT_FALSE(encode(2, 1000, Positive) <= encode(1, 1000, Positive));
-    EXPECT_TRUE(encode(2, 1000, Positive) > encode(1, 1000, Positive));
-    EXPECT_TRUE(encode(2, 1000, Positive) >= encode(1, 1000, Positive));
-
-    EXPECT_FALSE(encode(2, 1000, Negative) == encode(1, 1000, Negative));
-    EXPECT_TRUE(encode(2, 1000, Negative) != encode(1, 1000, Negative));
-    EXPECT_TRUE(encode(2, 1000, Negative) < encode(1, 1000, Negative));
-    EXPECT_TRUE(encode(2, 1000, Negative) <= encode(1, 1000, Negative));
-    EXPECT_FALSE(encode(2, 1000, Negative) > encode(1, 1000, Negative));
-    EXPECT_FALSE(encode(2, 1000, Negative) >= encode(1, 1000, Negative));
-}
-
-TEST_F(DecimalTest, CompareSmallExponent)
-{
-    EXPECT_TRUE(encode(1, -1000, Positive) == encode(1, -1000, Positive));
-    EXPECT_FALSE(encode(1, -1000, Positive) != encode(1, -1000, Positive));
-    EXPECT_FALSE(encode(1, -1000, Positive) < encode(1, -1000, Positive));
-    EXPECT_TRUE(encode(1, -1000, Positive) <= encode(1, -1000, Positive));
-    EXPECT_FALSE(encode(1, -1000, Positive) > encode(1, -1000, Positive));
-    EXPECT_TRUE(encode(1, -1000, Positive) >= encode(1, -1000, Positive));
-
-    EXPECT_TRUE(encode(1, -1000, Negative) == encode(1, -1000, Negative));
-    EXPECT_FALSE(encode(1, -1000, Negative) != encode(1, -1000, Negative));
-    EXPECT_FALSE(encode(1, -1000, Negative) < encode(1, -1000, Negative));
-    EXPECT_TRUE(encode(1, -1000, Negative) <= encode(1, -1000, Negative));
-    EXPECT_FALSE(encode(1, -1000, Negative) > encode(1, -1000, Negative));
-    EXPECT_TRUE(encode(1, -1000, Negative) >= encode(1, -1000, Negative));
-
-    EXPECT_FALSE(encode(2, -1000, Positive) == encode(1, -1000, Positive));
-    EXPECT_TRUE(encode(2, -1000, Positive) != encode(1, -1000, Positive));
-    EXPECT_FALSE(encode(2, -1000, Positive) < encode(1, -1000, Positive));
-    EXPECT_FALSE(encode(2, -1000, Positive) <= encode(1, -1000, Positive));
-    EXPECT_TRUE(encode(2, -1000, Positive) > encode(1, -1000, Positive));
-    EXPECT_TRUE(encode(2, -1000, Positive) >= encode(1, -1000, Positive));
-
-    EXPECT_FALSE(encode(2, -1000, Negative) == encode(1, -1000, Negative));
-    EXPECT_TRUE(encode(2, -1000, Negative) != encode(1, -1000, Negative));
-    EXPECT_TRUE(encode(2, -1000, Negative) < encode(1, -1000, Negative));
-    EXPECT_TRUE(encode(2, -1000, Negative) <= encode(1, -1000, Negative));
-    EXPECT_FALSE(encode(2, -1000, Negative) > encode(1, -1000, Negative));
-    EXPECT_FALSE(encode(2, -1000, Negative) >= encode(1, -1000, Negative));
-}
-
-TEST_F(DecimalTest, CompareSpecialValues)
-{
-    const Decimal Infinity(Decimal::infinity(Positive));
-    const Decimal MinusInfinity(Decimal::infinity(Negative));
-    const Decimal NaN(Decimal::nan());
-    const Decimal Zero(Decimal::zero(Positive));
-    const Decimal MinusZero(Decimal::zero(Negative));
-    const Decimal Ten(10);
-
-    EXPECT_TRUE(Zero == Zero);
-    EXPECT_FALSE(Zero != Zero);
-    EXPECT_FALSE(Zero < Zero);
-    EXPECT_TRUE(Zero <= Zero);
-    EXPECT_FALSE(Zero > Zero);
-    EXPECT_TRUE(Zero >= Zero);
-
-    EXPECT_TRUE(Zero == MinusZero);
-    EXPECT_FALSE(Zero != MinusZero);
-    EXPECT_FALSE(Zero < MinusZero);
-    EXPECT_TRUE(Zero <= MinusZero);
-    EXPECT_FALSE(Zero > MinusZero);
-    EXPECT_TRUE(Zero >= MinusZero);
-
-    EXPECT_TRUE(MinusZero == Zero);
-    EXPECT_FALSE(MinusZero != Zero);
-    EXPECT_FALSE(MinusZero < Zero);
-    EXPECT_TRUE(MinusZero <= Zero);
-    EXPECT_FALSE(MinusZero > Zero);
-    EXPECT_TRUE(MinusZero >= Zero);
-
-    EXPECT_TRUE(MinusZero == MinusZero);
-    EXPECT_FALSE(MinusZero != MinusZero);
-    EXPECT_FALSE(MinusZero < MinusZero);
-    EXPECT_TRUE(MinusZero <= MinusZero);
-    EXPECT_FALSE(MinusZero > MinusZero);
-    EXPECT_TRUE(MinusZero >= MinusZero);
-
-    EXPECT_TRUE(Infinity == Infinity);
-    EXPECT_FALSE(Infinity != Infinity);
-    EXPECT_FALSE(Infinity < Infinity);
-    EXPECT_TRUE(Infinity <= Infinity);
-    EXPECT_FALSE(Infinity > Infinity);
-    EXPECT_TRUE(Infinity >= Infinity);
-
-    EXPECT_FALSE(Infinity == Ten);
-    EXPECT_TRUE(Infinity != Ten);
-    EXPECT_FALSE(Infinity < Ten);
-    EXPECT_FALSE(Infinity <= Ten);
-    EXPECT_TRUE(Infinity > Ten);
-    EXPECT_TRUE(Infinity >= Ten);
-
-    EXPECT_FALSE(Infinity == MinusInfinity);
-    EXPECT_TRUE(Infinity != MinusInfinity);
-    EXPECT_FALSE(Infinity < MinusInfinity);
-    EXPECT_FALSE(Infinity <= MinusInfinity);
-    EXPECT_TRUE(Infinity > MinusInfinity);
-    EXPECT_TRUE(Infinity >= MinusInfinity);
-
-    EXPECT_FALSE(Infinity == NaN);
-    EXPECT_FALSE(Infinity != NaN);
-    EXPECT_FALSE(Infinity < NaN);
-    EXPECT_FALSE(Infinity <= NaN);
-    EXPECT_FALSE(Infinity > NaN);
-    EXPECT_FALSE(Infinity >= NaN);
-
-    EXPECT_FALSE(MinusInfinity == Infinity);
-    EXPECT_TRUE(MinusInfinity != Infinity);
-    EXPECT_TRUE(MinusInfinity < Infinity);
-    EXPECT_TRUE(MinusInfinity <= Infinity);
-    EXPECT_FALSE(MinusInfinity > Infinity);
-    EXPECT_FALSE(MinusInfinity >= Infinity);
-
-    EXPECT_FALSE(MinusInfinity == Ten);
-    EXPECT_TRUE(MinusInfinity != Ten);
-    EXPECT_TRUE(MinusInfinity < Ten);
-    EXPECT_TRUE(MinusInfinity <= Ten);
-    EXPECT_FALSE(MinusInfinity > Ten);
-    EXPECT_FALSE(MinusInfinity >= Ten);
-
-    EXPECT_TRUE(MinusInfinity == MinusInfinity);
-    EXPECT_FALSE(MinusInfinity != MinusInfinity);
-    EXPECT_FALSE(MinusInfinity < MinusInfinity);
-    EXPECT_TRUE(MinusInfinity <= MinusInfinity);
-    EXPECT_FALSE(MinusInfinity > MinusInfinity);
-    EXPECT_TRUE(MinusInfinity >= MinusInfinity);
-
-    EXPECT_FALSE(MinusInfinity == NaN);
-    EXPECT_FALSE(MinusInfinity != NaN);
-    EXPECT_FALSE(MinusInfinity < NaN);
-    EXPECT_FALSE(MinusInfinity <= NaN);
-    EXPECT_FALSE(MinusInfinity > NaN);
-    EXPECT_FALSE(MinusInfinity >= NaN);
-
-    EXPECT_FALSE(NaN == Infinity);
-    EXPECT_FALSE(NaN != Infinity);
-    EXPECT_FALSE(NaN < Infinity);
-    EXPECT_FALSE(NaN <= Infinity);
-    EXPECT_FALSE(NaN > Infinity);
-    EXPECT_FALSE(NaN >= Infinity);
-
-    EXPECT_FALSE(NaN == Ten);
-    EXPECT_FALSE(NaN != Ten);
-    EXPECT_FALSE(NaN < Ten);
-    EXPECT_FALSE(NaN <= Ten);
-    EXPECT_FALSE(NaN > Ten);
-    EXPECT_FALSE(NaN >= Ten);
-
-    EXPECT_FALSE(NaN == MinusInfinity);
-    EXPECT_FALSE(NaN != MinusInfinity);
-    EXPECT_FALSE(NaN < MinusInfinity);
-    EXPECT_FALSE(NaN <= MinusInfinity);
-    EXPECT_FALSE(NaN > MinusInfinity);
-    EXPECT_FALSE(NaN >= MinusInfinity);
-
-    EXPECT_TRUE(NaN == NaN);
-    EXPECT_FALSE(NaN != NaN);
-    EXPECT_FALSE(NaN < NaN);
-    EXPECT_TRUE(NaN <= NaN);
-    EXPECT_FALSE(NaN > NaN);
-    EXPECT_TRUE(NaN >= NaN);
-}
-
-TEST_F(DecimalTest, Constructor)
-{
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(0u, 0, Positive, encode(0, 0, Positive));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(0u, 0, Negative, encode(0, 0, Negative));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(1u, 0, Positive, encode(1, 0, Positive));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(1u, 0, Negative, encode(1, 0, Negative));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(1u, 1022, Positive, encode(1, 1022, Positive));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(1u, 1022, Negative, encode(1, 1022, Negative));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(1u, 1023, Positive, encode(1, 1023, Positive));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(1u, 1023, Negative, encode(1, 1023, Negative));
-    EXPECT_TRUE(encode(1, 2000, Positive).isInfinity());
-    EXPECT_TRUE(encode(1, 2000, Negative).isInfinity());
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(0u, 0, Positive, encode(1, -2000, Positive));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(0u, 0, Negative, encode(1, -2000, Negative));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(UINT64_C(99999999999999998), 0, Positive, encode(UINT64_C(99999999999999998), 0, Positive));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(UINT64_C(99999999999999998), 0, Negative, encode(UINT64_C(99999999999999998), 0, Negative));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(UINT64_C(99999999999999999), 0, Positive, encode(UINT64_C(99999999999999999), 0, Positive));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(UINT64_C(99999999999999999), 0, Negative, encode(UINT64_C(99999999999999999), 0, Negative));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(UINT64_C(10000000000000000), 1, Positive, encode(UINT64_C(100000000000000000), 0, Positive));
-    EXPECT_DECIMAL_ENCODED_DATA_EQ(UINT64_C(10000000000000000), 1, Negative, encode(UINT64_C(100000000000000000), 0, Negative));
-}
-
-TEST_F(DecimalTest, Division)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(0) / Decimal(1));
-    EXPECT_EQ(encode(2, 0, Negative), Decimal(2) / Decimal(-1));
-    EXPECT_EQ(encode(5, -1, Negative), Decimal(-1) / Decimal(2));
-    EXPECT_EQ(encode(99, 0, Positive), Decimal(99) / Decimal(1));
-    EXPECT_EQ(Decimal(1), Decimal(-50) / Decimal(-50));
-    EXPECT_EQ(encode(UINT64_C(3333333333333333), -16, Positive), Decimal(1) / Decimal(3));
-    EXPECT_EQ(encode(UINT64_C(12345678901234), -1, Positive), encode(UINT64_C(12345678901234), 0, Positive) / Decimal(10));
-}
-
-TEST_F(DecimalTest, DivisionBigExponent)
-{
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) / encode(1, 0, Positive));
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, 1022, Positive) / encode(1, 1022, Positive));
-    EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive) / encode(1, -1000, Positive));
-}
-
-TEST_F(DecimalTest, DivisionSmallExponent)
-{
-    EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive) / encode(1, 0, Positive));
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) / encode(1, -1022, Positive));
-}
-
-TEST_F(DecimalTest, DivisionSpecialValues)
-{
-    const Decimal Infinity(Decimal::infinity(Positive));
-    const Decimal MinusInfinity(Decimal::infinity(Negative));
-    const Decimal NaN(Decimal::nan());
-    const Decimal Zero(Decimal::zero(Positive));
-    const Decimal MinusZero(Decimal::zero(Negative));
-    const Decimal Ten(10);
-    const Decimal MinusTen(-10);
-
-    EXPECT_EQ(NaN, Zero / Zero);
-    EXPECT_EQ(NaN, Zero / MinusZero);
-    EXPECT_EQ(NaN, MinusZero / Zero);
-    EXPECT_EQ(NaN, MinusZero / MinusZero);
-
-    EXPECT_EQ(Infinity, Ten / Zero);
-    EXPECT_EQ(MinusInfinity, Ten / MinusZero);
-    EXPECT_EQ(MinusInfinity, MinusTen / Zero);
-    EXPECT_EQ(Infinity, MinusTen / MinusZero);
-
-    EXPECT_EQ(Infinity, Infinity / Zero);
-    EXPECT_EQ(MinusInfinity, Infinity / MinusZero);
-    EXPECT_EQ(MinusInfinity, MinusInfinity / Zero);
-    EXPECT_EQ(Infinity, MinusInfinity / MinusZero);
-
-    EXPECT_EQ(NaN, Infinity / Infinity);
-    EXPECT_EQ(NaN, Infinity / MinusInfinity);
-    EXPECT_EQ(NaN, MinusInfinity / Infinity);
-    EXPECT_EQ(NaN, MinusInfinity / MinusInfinity);
-
-    EXPECT_EQ(Zero, Ten / Infinity);
-    EXPECT_EQ(MinusZero, Ten / MinusInfinity);
-    EXPECT_EQ(MinusZero, MinusTen / Infinity);
-    EXPECT_EQ(Zero, MinusTen / MinusInfinity);
-
-    EXPECT_EQ(NaN, NaN / NaN);
-    EXPECT_EQ(NaN, NaN / Ten);
-    EXPECT_EQ(NaN, Ten / NaN);
-
-    EXPECT_EQ(NaN, NaN / Infinity);
-    EXPECT_EQ(NaN, NaN / MinusInfinity);
-    EXPECT_EQ(NaN, Infinity / NaN);
-    EXPECT_EQ(NaN, MinusInfinity / NaN);
-}
-
-TEST_F(DecimalTest, EncodedData)
-{
-    EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive));
-    EXPECT_EQ(encode(0, 0, Negative), encode(0, 0, Negative));
-    EXPECT_EQ(Decimal(1), Decimal(1));
-    EXPECT_EQ(encode(1, 0, Negative), encode(1, 0, Negative));
-    EXPECT_EQ(Decimal::infinity(Positive), encode(1, 2000, Positive));
-    EXPECT_EQ(Decimal::zero(Positive), encode(1, -2000, Positive));
-}
-
-TEST_F(DecimalTest, Floor)
-{
-    EXPECT_EQ(Decimal(1), Decimal(1).floor());
-    EXPECT_EQ(Decimal(0), encode(1, -10, Positive).floor());
-    EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor());
-    EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor());
-    EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor());
-    EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor());
-
-    EXPECT_EQ(Decimal(-1), Decimal(-1).floor());
-    EXPECT_EQ(Decimal(-1), encode(1, -10, Negative).floor());
-    EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor());
-    EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor());
-    EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor());
-    EXPECT_EQ(Decimal(-2), encode(19, -1, Negative).floor());
-}
-
-TEST_F(DecimalTest, FloorBigExponent)
-{
-    EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).floor());
-    EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).floor());
-}
-
-TEST_F(DecimalTest, FloorSmallExponent)
-{
-    EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).floor());
-    EXPECT_EQ(encode(1, 0, Negative), encode(1, -1000, Negative).floor());
-}
-
-TEST_F(DecimalTest, FloorSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).floor());
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).floor());
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().floor());
-}
-
-TEST_F(DecimalTest, FromDouble)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal::fromDouble(0.0));
-    EXPECT_EQ(encode(0, 0, Negative), Decimal::fromDouble(-0.0));
-    EXPECT_EQ(encode(1, 0, Positive), Decimal::fromDouble(1));
-    EXPECT_EQ(encode(1, 0, Negative), Decimal::fromDouble(-1));
-    EXPECT_EQ(encode(123, 0, Positive), Decimal::fromDouble(123));
-    EXPECT_EQ(encode(123, 0, Negative), Decimal::fromDouble(-123));
-    EXPECT_EQ(encode(1, -1, Positive), Decimal::fromDouble(0.1));
-    EXPECT_EQ(encode(1, -1, Negative), Decimal::fromDouble(-0.1));
-}
-
-TEST_F(DecimalTest, FromDoubleLimits)
-{
-    EXPECT_EQ(encode(UINT64_C(2220446049250313), -31, Positive), Decimal::fromDouble(std::numeric_limits<double>::epsilon()));
-    EXPECT_EQ(encode(UINT64_C(2220446049250313), -31, Negative), Decimal::fromDouble(-std::numeric_limits<double>::epsilon()));
-    EXPECT_EQ(encode(UINT64_C(17976931348623157), 292, Positive), Decimal::fromDouble(std::numeric_limits<double>::max()));
-    EXPECT_EQ(encode(UINT64_C(17976931348623157), 292, Negative), Decimal::fromDouble(-std::numeric_limits<double>::max()));
-    EXPECT_EQ(encode(UINT64_C(22250738585072014), -324, Positive), Decimal::fromDouble(std::numeric_limits<double>::min()));
-    EXPECT_EQ(encode(UINT64_C(22250738585072014), -324, Negative), Decimal::fromDouble(-std::numeric_limits<double>::min()));
-    EXPECT_TRUE(Decimal::fromDouble(std::numeric_limits<double>::infinity()).isInfinity());
-    EXPECT_TRUE(Decimal::fromDouble(-std::numeric_limits<double>::infinity()).isInfinity());
-    EXPECT_TRUE(Decimal::fromDouble(std::numeric_limits<double>::quiet_NaN()).isNaN());
-    EXPECT_TRUE(Decimal::fromDouble(-std::numeric_limits<double>::quiet_NaN()).isNaN());
-}
-
-TEST_F(DecimalTest, FromInt32)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(0));
-    EXPECT_EQ(encode(1, 0, Positive), Decimal(1));
-    EXPECT_EQ(encode(1, 0, Negative), Decimal(-1));
-    EXPECT_EQ(encode(100, 0, Positive), Decimal(100));
-    EXPECT_EQ(encode(100, 0, Negative), Decimal(-100));
-    EXPECT_EQ(encode(0x7FFFFFFF, 0, Positive), Decimal(std::numeric_limits<int32_t>::max()));
-    EXPECT_EQ(encode(0x80000000u, 0, Negative), Decimal(std::numeric_limits<int32_t>::min()));
-}
-
-TEST_F(DecimalTest, FromString)
-{
-    EXPECT_EQ(encode(0, 0, Positive), fromString("0"));
-    EXPECT_EQ(encode(0, 0, Negative), fromString("-0"));
-    EXPECT_EQ(Decimal(1), fromString("1"));
-    EXPECT_EQ(encode(1, 0, Negative), fromString("-1"));
-    EXPECT_EQ(Decimal(1), fromString("01"));
-    EXPECT_EQ(encode(3, 0, Positive), fromString("+3"));
-    EXPECT_EQ(encode(0, 3, Positive), fromString("0E3"));
-    EXPECT_EQ(encode(5, -1, Positive), fromString(".5"));
-    EXPECT_EQ(encode(100, 0, Positive), fromString("100"));
-    EXPECT_EQ(encode(100, 0, Negative), fromString("-100"));
-    EXPECT_EQ(encode(123, -2, Positive), fromString("1.23"));
-    EXPECT_EQ(encode(123, -2, Negative), fromString("-1.23"));
-    EXPECT_EQ(encode(123, 8, Positive), fromString("1.23E10"));
-    EXPECT_EQ(encode(123, 8, Negative), fromString("-1.23E10"));
-    EXPECT_EQ(encode(123, 8, Positive), fromString("1.23E+10"));
-    EXPECT_EQ(encode(123, 8, Negative), fromString("-1.23E+10"));
-    EXPECT_EQ(encode(123, -12, Positive), fromString("1.23E-10"));
-    EXPECT_EQ(encode(123, -12, Negative), fromString("-1.23E-10"));
-    EXPECT_EQ(encode(5, -7, Positive), fromString("0.0000005"));
-    EXPECT_EQ(encode(0, 0, Positive), fromString("0e9999"));
-    EXPECT_EQ(encode(123, -3, Positive), fromString("0.123"));
-    EXPECT_EQ(encode(0, -2, Positive), fromString("00.00"));
-    EXPECT_EQ(encode(1, 2, Positive), fromString("1E2"));
-    EXPECT_EQ(Decimal::infinity(Positive), fromString("1E20000"));
-    EXPECT_EQ(Decimal::zero(Positive), fromString("1E-20000"));
-    EXPECT_EQ(encode(1000, 1023, Positive), fromString("1E1026"));
-    EXPECT_EQ(Decimal::zero(Positive), fromString("1E-1026"));
-    EXPECT_EQ(Decimal::infinity(Positive), fromString("1234567890E1036"));
-
-    // 2^1024
-    const uint64_t leadingDigitsOf2PowerOf1024 = UINT64_C(17976931348623159);
-    EXPECT_EQ(encode(leadingDigitsOf2PowerOf1024, 292, Positive), fromString("179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216"));
-}
-
-// These strings are look like proper number, but we don't accept them.
-TEST_F(DecimalTest, FromStringLikeNumber)
-{
-    EXPECT_EQ(Decimal::nan(), fromString(" 123 "));
-    EXPECT_EQ(Decimal::nan(), fromString("1,234"));
-}
-
-// fromString doesn't support infinity and NaN.
-TEST_F(DecimalTest, FromStringSpecialValues)
-{
-    EXPECT_EQ(Decimal::nan(), fromString("INF"));
-    EXPECT_EQ(Decimal::nan(), fromString("Infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("+Infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("+infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("-Infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("-infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("NaN"));
-    EXPECT_EQ(Decimal::nan(), fromString("nan"));
-    EXPECT_EQ(Decimal::nan(), fromString("+NaN"));
-    EXPECT_EQ(Decimal::nan(), fromString("+nan"));
-    EXPECT_EQ(Decimal::nan(), fromString("-NaN"));
-    EXPECT_EQ(Decimal::nan(), fromString("-nan"));
-}
-
-TEST_F(DecimalTest, fromStringTruncated)
-{
-    EXPECT_EQ(Decimal::nan(), fromString("x"));
-    EXPECT_EQ(Decimal::nan(), fromString("0."));
-    EXPECT_EQ(Decimal::nan(), fromString("1x"));
-
-    EXPECT_EQ(Decimal::nan(), fromString("1Ex"));
-    EXPECT_EQ(Decimal::nan(), fromString("1E2x"));
-    EXPECT_EQ(Decimal::nan(), fromString("1E+x"));
-}
-
-TEST_F(DecimalTest, Multiplication)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(0) * Decimal(0));
-    EXPECT_EQ(encode(2, 0, Negative), Decimal(2) * Decimal(-1));
-    EXPECT_EQ(encode(2, 0, Negative), Decimal(-1) * Decimal(2));
-    EXPECT_EQ(encode(99, 0, Positive), Decimal(99) * Decimal(1));
-    EXPECT_EQ(encode(2500, 0, Positive), Decimal(-50) * Decimal(-50));
-    EXPECT_EQ(encode(1, 21, Positive), encode(UINT64_C(10000000000), 0, Positive) * encode(UINT64_C(100000000000), 0, Positive));
-}
-
-TEST_F(DecimalTest, MultiplicationBigExponent)
-{
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) * encode(1, 0, Positive));
-    EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive) * encode(1, 1022, Positive));
-    EXPECT_EQ(encode(1, 22, Positive), encode(1, 1022, Positive) * encode(1, -1000, Positive));
-}
-
-TEST_F(DecimalTest, MultiplicationSmallExponent)
-{
-    EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive) * encode(1, 0, Positive));
-    EXPECT_EQ(encode(0, 0, Positive), encode(1, -1022, Positive) * encode(1, -1022, Positive));
-}
-
-TEST_F(DecimalTest, MultiplicationSpecialValues)
-{
-    const Decimal Infinity(Decimal::infinity(Positive));
-    const Decimal MinusInfinity(Decimal::infinity(Negative));
-    const Decimal NaN(Decimal::nan());
-    const Decimal Ten(10);
-    const Decimal MinusTen(-10);
-    const Decimal Zero(Decimal::zero(Positive));
-    const Decimal MinusZero(Decimal::zero(Negative));
-
-    EXPECT_EQ(Infinity, Infinity * Infinity);
-    EXPECT_EQ(MinusInfinity, Infinity * MinusInfinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity * Infinity);
-    EXPECT_EQ(Infinity, MinusInfinity * MinusInfinity);
-
-    EXPECT_EQ(NaN, Infinity * Zero);
-    EXPECT_EQ(NaN, Zero * MinusInfinity);
-    EXPECT_EQ(NaN, MinusInfinity * Zero);
-    EXPECT_EQ(NaN, MinusInfinity * Zero);
-
-    EXPECT_EQ(NaN, Infinity * MinusZero);
-    EXPECT_EQ(NaN, MinusZero * MinusInfinity);
-    EXPECT_EQ(NaN, MinusInfinity * MinusZero);
-    EXPECT_EQ(NaN, MinusInfinity * MinusZero);
-
-    EXPECT_EQ(Infinity, Infinity * Ten);
-    EXPECT_EQ(Infinity, Ten * Infinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity * Ten);
-    EXPECT_EQ(MinusInfinity, Ten * MinusInfinity);
-
-    EXPECT_EQ(MinusInfinity, Infinity * MinusTen);
-    EXPECT_EQ(MinusInfinity, MinusTen * Infinity);
-    EXPECT_EQ(Infinity, MinusInfinity * MinusTen);
-    EXPECT_EQ(Infinity, MinusTen * MinusInfinity);
-
-    EXPECT_EQ(NaN, NaN * NaN);
-    EXPECT_EQ(NaN, NaN * Ten);
-    EXPECT_EQ(NaN, Ten * NaN);
-
-    EXPECT_EQ(NaN, NaN * Infinity);
-    EXPECT_EQ(NaN, NaN * MinusInfinity);
-    EXPECT_EQ(NaN, Infinity * NaN);
-    EXPECT_EQ(NaN, MinusInfinity * NaN);
-}
-
-TEST_F(DecimalTest, Negate)
-{
-    EXPECT_EQ(encode(0, 0, Negative), -encode(0, 0, Positive));
-    EXPECT_EQ(encode(0, 0, Positive), -encode(0, 0, Negative));
-
-    EXPECT_EQ(encode(0, 10, Negative), -encode(0, 10, Positive));
-    EXPECT_EQ(encode(0, 10, Positive), -encode(0, 10, Negative));
-
-    EXPECT_EQ(encode(0, -10, Negative), -encode(0, -10, Positive));
-    EXPECT_EQ(encode(0, -10, Positive), -encode(0, -10, Negative));
-
-    EXPECT_EQ(encode(1, 0, Negative), -encode(1, 0, Positive));
-    EXPECT_EQ(encode(1, 0, Positive), -encode(1, 0, Negative));
-
-    EXPECT_EQ(encode(1, 10, Negative), -encode(1, 10, Positive));
-    EXPECT_EQ(encode(1, 10, Positive), -encode(1, 10, Negative));
-
-    EXPECT_EQ(encode(1, -10, Negative), -encode(1, -10, Positive));
-    EXPECT_EQ(encode(1, -10, Positive), -encode(1, -10, Negative));
-}
-
-TEST_F(DecimalTest, NegateBigExponent)
-{
-    EXPECT_EQ(encode(1, 1000, Negative), -encode(1, 1000, Positive));
-    EXPECT_EQ(encode(1, 1000, Positive), -encode(1, 1000, Negative));
-}
-
-TEST_F(DecimalTest, NegateSmallExponent)
-{
-    EXPECT_EQ(encode(1, -1000, Negative), -encode(1, -1000, Positive));
-    EXPECT_EQ(encode(1, -1000, Positive), -encode(1, -1000, Negative));
-}
-
-TEST_F(DecimalTest, NegateSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Negative), -Decimal::infinity(Positive));
-    EXPECT_EQ(Decimal::infinity(Positive), -Decimal::infinity(Negative));
-    EXPECT_EQ(Decimal::nan(), -Decimal::nan());
-}
-
-TEST_F(DecimalTest, Predicates)
-{
-    EXPECT_TRUE(Decimal::zero(Positive).isFinite());
-    EXPECT_FALSE(Decimal::zero(Positive).isInfinity());
-    EXPECT_FALSE(Decimal::zero(Positive).isNaN());
-    EXPECT_TRUE(Decimal::zero(Positive).isPositive());
-    EXPECT_FALSE(Decimal::zero(Positive).isNegative());
-    EXPECT_FALSE(Decimal::zero(Positive).isSpecial());
-    EXPECT_TRUE(Decimal::zero(Positive).isZero());
-
-    EXPECT_TRUE(Decimal::zero(Negative).isFinite());
-    EXPECT_FALSE(Decimal::zero(Negative).isInfinity());
-    EXPECT_FALSE(Decimal::zero(Negative).isNaN());
-    EXPECT_FALSE(Decimal::zero(Negative).isPositive());
-    EXPECT_TRUE(Decimal::zero(Negative).isNegative());
-    EXPECT_FALSE(Decimal::zero(Negative).isSpecial());
-    EXPECT_TRUE(Decimal::zero(Negative).isZero());
-
-    EXPECT_TRUE(Decimal(123).isFinite());
-    EXPECT_FALSE(Decimal(123).isInfinity());
-    EXPECT_FALSE(Decimal(123).isNaN());
-    EXPECT_TRUE(Decimal(123).isPositive());
-    EXPECT_FALSE(Decimal(123).isNegative());
-    EXPECT_FALSE(Decimal(123).isSpecial());
-    EXPECT_FALSE(Decimal(123).isZero());
-
-    EXPECT_TRUE(Decimal(-123).isFinite());
-    EXPECT_FALSE(Decimal(-123).isInfinity());
-    EXPECT_FALSE(Decimal(-123).isNaN());
-    EXPECT_FALSE(Decimal(-123).isPositive());
-    EXPECT_TRUE(Decimal(-123).isNegative());
-    EXPECT_FALSE(Decimal(-123).isSpecial());
-    EXPECT_FALSE(Decimal(-123).isZero());
-}
-
-TEST_F(DecimalTest, PredicatesSpecialValues)
-{
-    EXPECT_FALSE(Decimal::infinity(Positive).isFinite());
-    EXPECT_TRUE(Decimal::infinity(Positive).isInfinity());
-    EXPECT_FALSE(Decimal::infinity(Positive).isNaN());
-    EXPECT_TRUE(Decimal::infinity(Positive).isPositive());
-    EXPECT_FALSE(Decimal::infinity(Positive).isNegative());
-    EXPECT_TRUE(Decimal::infinity(Positive).isSpecial());
-    EXPECT_FALSE(Decimal::infinity(Positive).isZero());
-
-    EXPECT_FALSE(Decimal::infinity(Negative).isFinite());
-    EXPECT_TRUE(Decimal::infinity(Negative).isInfinity());
-    EXPECT_FALSE(Decimal::infinity(Negative).isNaN());
-    EXPECT_FALSE(Decimal::infinity(Negative).isPositive());
-    EXPECT_TRUE(Decimal::infinity(Negative).isNegative());
-    EXPECT_TRUE(Decimal::infinity(Negative).isSpecial());
-    EXPECT_FALSE(Decimal::infinity(Negative).isZero());
-
-    EXPECT_FALSE(Decimal::nan().isFinite());
-    EXPECT_FALSE(Decimal::nan().isInfinity());
-    EXPECT_TRUE(Decimal::nan().isNaN());
-    EXPECT_TRUE(Decimal::nan().isSpecial());
-    EXPECT_FALSE(Decimal::nan().isZero());
-}
-
-// LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer
-TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRenderer)
-{
-    EXPECT_DECIMAL_STREQ("10", stepDown("0", "100", "10", "19", 1));
-    EXPECT_DECIMAL_STREQ("90", stepUp("0", "99", "10", "89", 1));
-    EXPECT_DECIMAL_STREQ("1", stepUp("0", "1", "0.33333333333333333", "0", 3)); // step=1/3
-    EXPECT_DECIMAL_STREQ("0.01", stepUp("0", "0.01", "0.0033333333333333333", "0", 3)); // step=1/300
-    EXPECT_DECIMAL_STREQ("1", stepUp("0", "1", "0.003921568627450980", "0", 255)); // step=1/255
-    EXPECT_DECIMAL_STREQ("1", stepUp("0", "1", "0.1", "0", 10));
-}
-
-TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRendererRounding)
-{
-    EXPECT_DECIMAL_STREQ("5.015", stepUp("0", "100", "0.005", "5.005", 2));
-    EXPECT_DECIMAL_STREQ("5.06", stepUp("0", "100", "0.005", "5.005", 11));
-    EXPECT_DECIMAL_STREQ("5.065", stepUp("0", "100", "0.005", "5.005", 12));
-
-    EXPECT_DECIMAL_STREQ("5.015", stepUp("4", "9", "0.005", "5.005", 2));
-    EXPECT_DECIMAL_STREQ("5.06", stepUp("4", "9", "0.005", "5.005", 11));
-    EXPECT_DECIMAL_STREQ("5.065", stepUp("4", "9", "0.005", "5.005", 12));
-}
-
-TEST_F(DecimalTest, RealWorldExampleRangeStepUpStepDown)
-{
-    EXPECT_DECIMAL_STREQ("1e+38", stepUp("0", "1E38", "1", "1E38", 9));
-    EXPECT_DECIMAL_STREQ("1e+38", stepDown("0", "1E38", "1", "1E38", 9));
-}
-
-TEST_F(DecimalTest, Remainder)
-{
-    EXPECT_EQ(encode(21, -1, Positive), encode(21, -1, Positive).remainder(3));
-    EXPECT_EQ(Decimal(1), Decimal(10).remainder(3));
-    EXPECT_EQ(Decimal(1), Decimal(10).remainder(-3));
-    EXPECT_EQ(encode(1, 0, Negative), Decimal(-10).remainder(3));
-    EXPECT_EQ(Decimal(-1), Decimal(-10).remainder(-3));
-    EXPECT_EQ(encode(2, -1, Positive), encode(102, -1, Positive).remainder(1));
-    EXPECT_EQ(encode(1, -1, Positive), Decimal(10).remainder(encode(3, -1, Positive)));
-    EXPECT_EQ(Decimal(1), encode(36, -1, Positive).remainder(encode(13, -1, Positive)));
-    EXPECT_EQ(encode(1, 87, Positive), (encode(1234, 100, Positive).remainder(Decimal(3))));
-    EXPECT_EQ(Decimal(500), (Decimal(500).remainder(1000)));
-    EXPECT_EQ(Decimal(-500), (Decimal(-500).remainder(1000)));
-}
-
-TEST_F(DecimalTest, RemainderBigExponent)
-{
-    EXPECT_EQ(encode(0, 1022, Positive), encode(1, 1022, Positive).remainder(encode(1, 0, Positive)));
-    EXPECT_EQ(encode(0, 1022, Positive), encode(1, 1022, Positive).remainder(encode(1, 1022, Positive)));
-    EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive).remainder(encode(1, -1000, Positive)));
-}
-
-TEST_F(DecimalTest, RemainderSmallExponent)
-{
-    EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive).remainder(encode(1, 0, Positive)));
-    EXPECT_EQ(encode(0, -1022, Positive), encode(1, -1022, Positive).remainder(encode(1, -1022, Positive)));
-}
-
-TEST_F(DecimalTest, RemainderSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).remainder(1));
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).remainder(1));
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(1));
-
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Positive).remainder(-1));
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).remainder(-1));
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(-1));
-
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).remainder(3));
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).remainder(3));
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(3));
-
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Positive).remainder(-1));
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).remainder(-1));
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(-1));
-
-    EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::infinity(Positive)));
-    EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::infinity(Negative)));
-    EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::nan()));
-}
-
-TEST_F(DecimalTest, Round)
-{
-    EXPECT_EQ(Decimal(1), (Decimal(9) / Decimal(10)).round());
-    EXPECT_EQ(Decimal(25), (Decimal(5) / fromString("0.200")).round());
-    EXPECT_EQ(Decimal(3), (Decimal(5) / Decimal(2)).round());
-    EXPECT_EQ(Decimal(1), (Decimal(2) / Decimal(3)).round());
-    EXPECT_EQ(Decimal(3), (Decimal(10) / Decimal(3)).round());
-    EXPECT_EQ(Decimal(3), (Decimal(1) / fromString("0.3")).round());
-    EXPECT_EQ(Decimal(10), (Decimal(1) / fromString("0.1")).round());
-    EXPECT_EQ(Decimal(5), (Decimal(1) / fromString("0.2")).round());
-    EXPECT_EQ(Decimal(10), (fromString("10.2") / 1).round());
-    EXPECT_EQ(encode(1234, 100, Positive), encode(1234, 100, Positive).round());
-}
-
-TEST_F(DecimalTest, RoundSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).round());
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).round());
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().round());
-}
-
-TEST_F(DecimalTest, Subtract)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(0) - Decimal(0));
-    EXPECT_EQ(encode(3, 0, Positive), Decimal(2) - Decimal(-1));
-    EXPECT_EQ(encode(3, 0, Negative), Decimal(-1) - Decimal(2));
-    EXPECT_EQ(encode(98, 0, Positive), Decimal(99) - Decimal(1));
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(-50) - Decimal(-50));
-    EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Positive), encode(1, 50, Positive) - Decimal(1));
-    EXPECT_EQ(encode(UINT64_C(1000000000000000), 35, Negative), Decimal(1) - encode(1, 50, Positive));
-}
-
-TEST_F(DecimalTest, SubtractBigExponent)
-{
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) - encode(1, 0, Positive));
-    EXPECT_EQ(encode(0, 0, Positive), encode(1, 1022, Positive) - encode(1, 1022, Positive));
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, -1000, Positive));
-}
-
-TEST_F(DecimalTest, SubtractSmallExponent)
-{
-    EXPECT_EQ(encode(UINT64_C(10000000000000000), -16, Negative), encode(1, -1022, Positive) - encode(1, 0, Positive));
-    EXPECT_EQ(encode(0, 0, Positive), encode(1, -1022, Positive) - encode(1, -1022, Positive));
-}
-
-TEST_F(DecimalTest, SubtractSpecialValues)
-{
-    const Decimal Infinity(Decimal::infinity(Positive));
-    const Decimal MinusInfinity(Decimal::infinity(Negative));
-    const Decimal NaN(Decimal::nan());
-    const Decimal Ten(10);
-
-    EXPECT_EQ(NaN, Infinity - Infinity);
-    EXPECT_EQ(Infinity, Infinity - MinusInfinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity - Infinity);
-    EXPECT_EQ(NaN, MinusInfinity - MinusInfinity);
-
-    EXPECT_EQ(Infinity, Infinity - Ten);
-    EXPECT_EQ(MinusInfinity, Ten - Infinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity - Ten);
-    EXPECT_EQ(Infinity, Ten - MinusInfinity);
-
-    EXPECT_EQ(NaN, NaN - NaN);
-    EXPECT_EQ(NaN, NaN - Ten);
-    EXPECT_EQ(NaN, Ten - NaN);
-
-    EXPECT_EQ(NaN, NaN - Infinity);
-    EXPECT_EQ(NaN, NaN - MinusInfinity);
-    EXPECT_EQ(NaN, Infinity - NaN);
-    EXPECT_EQ(NaN, MinusInfinity - NaN);
-}
-
-TEST_F(DecimalTest, ToDouble)
-{
-    EXPECT_EQ(0.0, encode(0, 0, Positive).toDouble());
-    EXPECT_EQ(-0.0, encode(0, 0, Negative).toDouble());
-
-    EXPECT_EQ(1.0, encode(1, 0, Positive).toDouble());
-    EXPECT_EQ(-1.0, encode(1, 0, Negative).toDouble());
-
-    EXPECT_EQ(0.1, encode(1, -1, Positive).toDouble());
-    EXPECT_EQ(-0.1, encode(1, -1, Negative).toDouble());
-    EXPECT_EQ(0.3, encode(3, -1, Positive).toDouble());
-    EXPECT_EQ(-0.3, encode(3, -1, Negative).toDouble());
-    EXPECT_EQ(0.6, encode(6, -1, Positive).toDouble());
-    EXPECT_EQ(-0.6, encode(6, -1, Negative).toDouble());
-    EXPECT_EQ(0.7, encode(7, -1, Positive).toDouble());
-    EXPECT_EQ(-0.7, encode(7, -1, Negative).toDouble());
-
-    EXPECT_EQ(0.01, encode(1, -2, Positive).toDouble());
-    EXPECT_EQ(0.001, encode(1, -3, Positive).toDouble());
-    EXPECT_EQ(0.0001, encode(1, -4, Positive).toDouble());
-    EXPECT_EQ(0.00001, encode(1, -5, Positive).toDouble());
-
-    EXPECT_EQ(1e+308, encode(1, 308, Positive).toDouble());
-    EXPECT_EQ(1e-307, encode(1, -307, Positive).toDouble());
-
-    EXPECT_TRUE(std::isinf(encode(1, 1000, Positive).toDouble()));
-    EXPECT_EQ(0.0, encode(1, -1000, Positive).toDouble());
-}
-
-TEST_F(DecimalTest, ToDoubleSpecialValues)
-{
-    EXPECT_TRUE(std::isinf(Decimal::infinity(Decimal::Positive).toDouble()));
-    EXPECT_TRUE(std::isinf(Decimal::infinity(Decimal::Negative).toDouble()));
-    EXPECT_TRUE(std::isnan(Decimal::nan().toDouble()));
-}
-
-TEST_F(DecimalTest, ToString)
-{
-    EXPECT_DECIMAL_STREQ("0", Decimal::zero(Positive));
-    EXPECT_DECIMAL_STREQ("-0", Decimal::zero(Negative));
-    EXPECT_DECIMAL_STREQ("1", Decimal(1));
-    EXPECT_DECIMAL_STREQ("-1", Decimal(-1));
-    EXPECT_DECIMAL_STREQ("1234567", Decimal(1234567));
-    EXPECT_DECIMAL_STREQ("-1234567", Decimal(-1234567));
-    EXPECT_DECIMAL_STREQ("0.5", encode(5, -1, Positive));
-    EXPECT_DECIMAL_STREQ("-0.5", encode(5, -1, Negative));
-    EXPECT_DECIMAL_STREQ("12.345", encode(12345, -3, Positive));
-    EXPECT_DECIMAL_STREQ("-12.345", encode(12345, -3, Negative));
-    EXPECT_DECIMAL_STREQ("0.12345", encode(12345, -5, Positive));
-    EXPECT_DECIMAL_STREQ("-0.12345", encode(12345, -5, Negative));
-    EXPECT_DECIMAL_STREQ("50", encode(50, 0, Positive));
-    EXPECT_DECIMAL_STREQ("-50", encode(50, 0, Negative));
-    EXPECT_DECIMAL_STREQ("5e+1", encode(5, 1, Positive));
-    EXPECT_DECIMAL_STREQ("-5e+1", encode(5, 1, Negative));
-    EXPECT_DECIMAL_STREQ("5.678e+103", encode(5678, 100, Positive));
-    EXPECT_DECIMAL_STREQ("-5.678e+103", encode(5678, 100, Negative));
-    EXPECT_DECIMAL_STREQ("5.678e-97", encode(5678, -100, Positive));
-    EXPECT_DECIMAL_STREQ("-5.678e-97", encode(5678, -100, Negative));
-    EXPECT_DECIMAL_STREQ("8639999913600001", encode(UINT64_C(8639999913600001), 0, Positive));
-    EXPECT_DECIMAL_STREQ("9007199254740991", encode((static_cast<uint64_t>(1) << DBL_MANT_DIG) - 1, 0, Positive));
-    EXPECT_DECIMAL_STREQ("99999999999999999", encode(UINT64_C(99999999999999999), 0, Positive));
-    EXPECT_DECIMAL_STREQ("9.9999999999999999e+17", encode(UINT64_C(99999999999999999), 1, Positive));
-    EXPECT_DECIMAL_STREQ("9.9999999999999999e+18", encode(UINT64_C(99999999999999999), 2, Positive));
-    EXPECT_DECIMAL_STREQ("1e+16", encode(UINT64_C(99999999999999999), -1, Positive));
-    EXPECT_DECIMAL_STREQ("1000000000000000", encode(UINT64_C(99999999999999999), -2, Positive));
-    EXPECT_DECIMAL_STREQ("1", encode(UINT64_C(99999999999999999), -17, Positive));
-    EXPECT_DECIMAL_STREQ("0.001", encode(UINT64_C(99999999999999999), -20, Positive));
-    EXPECT_DECIMAL_STREQ("1e-83", encode(UINT64_C(99999999999999999), -100, Positive));
-}
-
-TEST_F(DecimalTest, ToStringSpecialValues)
-{
-    EXPECT_DECIMAL_STREQ("Infinity", Decimal::infinity(Positive));
-    EXPECT_DECIMAL_STREQ("-Infinity", Decimal::infinity(Negative));
-    EXPECT_DECIMAL_STREQ("NaN", Decimal::nan());
-}
diff --git a/Source/core/platform/DragData.cpp b/Source/core/platform/DragData.cpp
index ce0d142..ccc049b 100644
--- a/Source/core/platform/DragData.cpp
+++ b/Source/core/platform/DragData.cpp
@@ -31,11 +31,11 @@
 #include "core/dom/DocumentFragment.h"
 #include "core/dom/Range.h"
 #include "core/editing/markup.h"
-#include "core/page/Frame.h"
-#include "core/platform/FileSystem.h"
+#include "core/frame/Frame.h"
 #include "core/platform/chromium/ChromiumDataObject.h"
-#include "core/platform/chromium/ClipboardMimeTypes.h"
 #include "modules/filesystem/DraggedIsolatedFileSystem.h"
+#include "platform/FileMetadata.h"
+#include "platform/clipboard/ClipboardMimeTypes.h"
 #include "weborigin/KURL.h"
 #include "wtf/text/WTFString.h"
 
@@ -69,13 +69,13 @@
     return dropData->types().contains(mimeTypeTextHTML);
 }
 
-bool DragData::containsURL(Frame*, FilenameConversionPolicy filenamePolicy) const
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
 {
     return m_platformDragData->types().contains(mimeTypeTextURIList)
         || (filenamePolicy == ConvertFilenames && m_platformDragData->containsFilenames());
 }
 
-String DragData::asURL(Frame*, FilenameConversionPolicy filenamePolicy, String* title) const
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
 {
     String url;
     if (m_platformDragData->types().contains(mimeTypeTextURIList))
@@ -112,7 +112,7 @@
     return m_platformDragData->types().contains(mimeTypeTextPlain);
 }
 
-String DragData::asPlainText(Frame*) const
+String DragData::asPlainText() const
 {
     return m_platformDragData->getData(mimeTypeTextPlain);
 }
@@ -130,7 +130,7 @@
 bool DragData::containsCompatibleContent() const
 {
     return containsPlainText()
-        || containsURL(0)
+        || containsURL()
         || containsHTML(m_platformDragData)
         || containsFiles();
 }
diff --git a/Source/core/platform/DragData.h b/Source/core/platform/DragData.h
index cf8fad1..b69f5c3 100644
--- a/Source/core/platform/DragData.h
+++ b/Source/core/platform/DragData.h
@@ -27,7 +27,7 @@
 #define DragData_h
 
 #include "core/page/DragActions.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/geometry/IntPoint.h"
 
 #include "wtf/Forward.h"
 #include "wtf/HashMap.h"
@@ -61,11 +61,11 @@
     DragApplicationFlags flags() const { return m_applicationFlags; }
     ChromiumDataObject* platformData() const { return m_platformDragData; }
     DragOperation draggingSourceOperationMask() const { return m_draggingSourceOperationMask; }
-    bool containsURL(Frame*, FilenameConversionPolicy filenamePolicy = ConvertFilenames) const;
+    bool containsURL(FilenameConversionPolicy filenamePolicy = ConvertFilenames) const;
     bool containsPlainText() const;
     bool containsCompatibleContent() const;
-    String asURL(Frame*, FilenameConversionPolicy filenamePolicy = ConvertFilenames, String* title = 0) const;
-    String asPlainText(Frame*) const;
+    String asURL(FilenameConversionPolicy filenamePolicy = ConvertFilenames, String* title = 0) const;
+    String asPlainText() const;
     void asFilenames(Vector<String>&) const;
     PassRefPtr<DocumentFragment> asFragment(Frame*, PassRefPtr<Range> context,
                                             bool allowPlainText, bool& chosePlainText) const;
diff --git a/Source/core/platform/DragImage.cpp b/Source/core/platform/DragImage.cpp
index 9de673d..5a6b40c 100644
--- a/Source/core/platform/DragImage.cpp
+++ b/Source/core/platform/DragImage.cpp
@@ -28,8 +28,6 @@
 
 #include "core/platform/graphics/BitmapImage.h"
 #include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/FontDescription.h"
@@ -37,12 +35,14 @@
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/Image.h"
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/platform/graphics/IntPoint.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/platform/graphics/StringTruncator.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/platform/graphics/skia/NativeImageSkia.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/IntPoint.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/graphics/TextRun.h"
+#include "platform/transforms/AffineTransform.h"
 #include "skia/ext/image_operations.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/core/SkMatrix.h"
@@ -97,7 +97,7 @@
                 return nullptr;
 
             SkCanvas canvas(skBitmap);
-            canvas.concat(orientation.transformFromDefault(sizeRespectingOrientation));
+            canvas.concat(affineTransformToSkMatrix(orientation.transformFromDefault(sizeRespectingOrientation)));
             canvas.drawBitmapRect(bitmap->bitmap(), 0, destRect);
 
             return adoptPtr(new DragImage(skBitmap, bitmap->resolutionScale()));
diff --git a/Source/core/platform/DragImage.h b/Source/core/platform/DragImage.h
index 129383d..72f969e 100644
--- a/Source/core/platform/DragImage.h
+++ b/Source/core/platform/DragImage.h
@@ -26,8 +26,8 @@
 #ifndef DragImage_h
 #define DragImage_h
 
-#include "core/platform/graphics/ImageOrientation.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/graphics/ImageOrientation.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "wtf/Forward.h"
 
diff --git a/Source/core/platform/EventTracer.cpp b/Source/core/platform/EventTracer.cpp
deleted file mode 100644
index d10037c..0000000
--- a/Source/core/platform/EventTracer.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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/EventTracer.h"
-
-#include "public/platform/Platform.h"
-#include <stdio.h>
-
-namespace WebCore {
-
-// The dummy variable is needed to avoid a crash when someone updates the state variables
-// before EventTracer::initialize() is called.
-long dummyTraceSamplingState = 0;
-long* traceSamplingState[3] = {&dummyTraceSamplingState, &dummyTraceSamplingState, &dummyTraceSamplingState };
-
-void EventTracer::initialize()
-{
-    traceSamplingState[0] = WebKit::Platform::current()->getTraceSamplingState(0);
-    // FIXME: traceSamplingState[0] can be 0 in split-dll build. http://crbug.com/256965
-    if (!traceSamplingState[0])
-        traceSamplingState[0] = &dummyTraceSamplingState;
-    traceSamplingState[1] = WebKit::Platform::current()->getTraceSamplingState(1);
-    if (!traceSamplingState[1])
-        traceSamplingState[1] = &dummyTraceSamplingState;
-    traceSamplingState[2] = WebKit::Platform::current()->getTraceSamplingState(2);
-    if (!traceSamplingState[2])
-        traceSamplingState[2] = &dummyTraceSamplingState;
-}
-
-const unsigned char* EventTracer::getTraceCategoryEnabledFlag(const char* categoryName)
-{
-    return WebKit::Platform::current()->getTraceCategoryEnabledFlag(categoryName);
-}
-
-void EventTracer::addTraceEvent(char phase, const unsigned char* categoryEnabledFlag,
-    const char* name, unsigned long long id, int numArgs, const char** argNames,
-    const unsigned char* argTypes, const unsigned long long* argValues, unsigned char flags)
-{
-    return WebKit::Platform::current()->addTraceEvent(phase, categoryEnabledFlag, name, id, numArgs, argNames, argTypes, argValues, flags);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/EventTracer.h b/Source/core/platform/EventTracer.h
deleted file mode 100644
index d1a1b0d..0000000
--- a/Source/core/platform/EventTracer.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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 EventTracer_h
-#define EventTracer_h
-
-// This will mark the trace event as disabled by default. The user will need
-// to explicitly enable the event.
-#define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name
-
-namespace WebCore {
-
-// FIXME: Make these global variables thread-safe. Make a value update atomic.
-extern long* traceSamplingState[3];
-
-class EventTracer {
-public:
-    static void initialize();
-    static const unsigned char* getTraceCategoryEnabledFlag(const char*);
-    static void addTraceEvent(char phase,
-                             const unsigned char* categoryEnabledFlag,
-                             const char* name,
-                             unsigned long long id,
-                             int numArgs,
-                             const char** argNames,
-                             const unsigned char* argTypes,
-                             const unsigned long long* argValues,
-                             unsigned char flags);
-};
-
-} // namespace WebCore
-
-#endif // EventTracer_h
diff --git a/Source/core/platform/FileChooser.cpp b/Source/core/platform/FileChooser.cpp
deleted file mode 100644
index f881550..0000000
--- a/Source/core/platform/FileChooser.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2007, 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.
- * 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.
- *
- * 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/FileChooser.h"
-
-namespace WebCore {
-
-FileChooserClient::~FileChooserClient()
-{
-    discardChooser();
-}
-
-FileChooser* FileChooserClient::newFileChooser(const FileChooserSettings& settings)
-{
-    discardChooser();
-
-    m_chooser = FileChooser::create(this, settings);
-    return m_chooser.get();
-}
-
-void FileChooserClient::discardChooser()
-{
-    if (m_chooser)
-        m_chooser->disconnectClient();
-}
-
-inline FileChooser::FileChooser(FileChooserClient* client, const FileChooserSettings& settings)
-    : m_client(client)
-    , m_settings(settings)
-{
-}
-
-PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const FileChooserSettings& settings)
-{
-    return adoptRef(new FileChooser(client, settings));
-}
-
-FileChooser::~FileChooser()
-{
-}
-
-void FileChooser::chooseFile(const String& filename)
-{
-    Vector<String> filenames;
-    filenames.append(filename);
-    chooseFiles(filenames);
-}
-
-void FileChooser::chooseFiles(const Vector<String>& filenames)
-{
-    // FIXME: This is inelegant. We should not be looking at settings here.
-    if (m_settings.selectedFiles == filenames)
-        return;
-
-    if (m_client) {
-        Vector<FileChooserFileInfo> files;
-        for (unsigned i = 0; i < filenames.size(); ++i)
-            files.append(FileChooserFileInfo(filenames[i]));
-        m_client->filesChosen(files);
-    }
-}
-
-void FileChooser::chooseFiles(const Vector<FileChooserFileInfo>& files)
-{
-    // FIXME: This is inelegant. We should not be looking at settings here.
-    Vector<String> paths;
-    for (unsigned i = 0; i < files.size(); ++i)
-        paths.append(files[i].path);
-    if (m_settings.selectedFiles == paths)
-        return;
-
-    if (m_client)
-        m_client->filesChosen(files);
-}
-
-Vector<String> FileChooserSettings::acceptTypes() const
-{
-    Vector<String> acceptTypes;
-    acceptTypes.reserveCapacity(acceptMIMETypes.size() + acceptFileExtensions.size());
-    acceptTypes.append(acceptMIMETypes);
-    acceptTypes.append(acceptFileExtensions);
-    return acceptTypes;
-}
-
-}
diff --git a/Source/core/platform/FileChooser.h b/Source/core/platform/FileChooser.h
deleted file mode 100644
index 95fabf0..0000000
--- a/Source/core/platform/FileChooser.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 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.
- * 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.
- *
- * 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 FileChooser_h
-#define FileChooser_h
-
-#include "wtf/RefCounted.h"
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class FileChooser;
-
-struct FileChooserFileInfo {
-    FileChooserFileInfo(const String& path, const String& displayName = String())
-        : path(path)
-        , displayName(displayName)
-    {
-    }
-
-    const String path;
-    const String displayName;
-};
-
-struct FileChooserSettings {
-    bool allowsMultipleFiles;
-    bool allowsDirectoryUpload;
-    Vector<String> acceptMIMETypes;
-    Vector<String> acceptFileExtensions;
-    Vector<String> selectedFiles;
-#if ENABLE(MEDIA_CAPTURE)
-    bool useMediaCapture;
-#endif
-
-    // Returns a combined vector of acceptMIMETypes and acceptFileExtensions.
-    Vector<String> acceptTypes() const;
-};
-
-class FileChooserClient {
-public:
-    virtual void filesChosen(const Vector<FileChooserFileInfo>&) = 0;
-    virtual ~FileChooserClient();
-
-protected:
-    FileChooser* newFileChooser(const FileChooserSettings&);
-
-private:
-    void discardChooser();
-
-    RefPtr<FileChooser> m_chooser;
-};
-
-class FileChooser : public RefCounted<FileChooser> {
-public:
-    static PassRefPtr<FileChooser> create(FileChooserClient*, const FileChooserSettings&);
-    ~FileChooser();
-
-    void disconnectClient() { m_client = 0; }
-
-    void chooseFile(const String& path);
-    void chooseFiles(const Vector<String>& paths);
-
-    // FIXME: We should probably just pass file paths that could be virtual paths with proper display names rather than passing structs.
-    void chooseFiles(const Vector<FileChooserFileInfo>& files);
-
-    const FileChooserSettings& settings() const { return m_settings; }
-
-private:
-    FileChooser(FileChooserClient*, const FileChooserSettings&);
-
-    FileChooserClient* m_client;
-    FileChooserSettings m_settings;
-};
-
-} // namespace WebCore
-
-#endif // FileChooser_h
diff --git a/Source/core/platform/FileMetadata.h b/Source/core/platform/FileMetadata.h
deleted file mode 100644
index 9da2570..0000000
--- a/Source/core/platform/FileMetadata.h
+++ /dev/null
@@ -1,62 +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 FileMetadata_h
-#define FileMetadata_h
-
-#include "core/platform/FileSystem.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-struct FileMetadata {
-    // The last modification time of the file, in seconds.
-    // The value 0.0 means that the time is not set.
-    double modificationTime;
-
-    // The length of the file in bytes.
-    // The value -1 means that the length is not set.
-    long long length;
-
-    enum Type {
-        TypeUnknown = 0,
-        TypeFile,
-        TypeDirectory
-    };
-
-    Type type;
-    String platformPath;
-
-    FileMetadata() : modificationTime(invalidFileTime()), length(-1), type(TypeUnknown) { }
-};
-
-} // namespace WebCore
-
-#endif // FileMetadata_h
diff --git a/Source/core/platform/FileSystem.h b/Source/core/platform/FileSystem.h
deleted file mode 100644
index 0d96833..0000000
--- a/Source/core/platform/FileSystem.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Collabora, Ltd. 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.
- * 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.
- *
- * 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 FileSystem_h
-#define FileSystem_h
-
-#include <time.h>
-#include "wtf/Forward.h"
-#include "wtf/MathExtras.h"
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-struct FileMetadata;
-
-bool getFileSize(const String&, long long& result);
-bool getFileModificationTime(const String&, time_t& result);
-bool getFileMetadata(const String&, FileMetadata&);
-String directoryName(const String&);
-
-inline double invalidFileTime() { return std::numeric_limits<double>::quiet_NaN(); }
-inline bool isValidFileTime(double time) { return std::isfinite(time); }
-
-} // namespace WebCore
-
-#endif // FileSystem_h
diff --git a/Source/core/platform/FloatConversion.h b/Source/core/platform/FloatConversion.h
deleted file mode 100644
index 95f013a..0000000
--- a/Source/core/platform/FloatConversion.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2007 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.
- * 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.
- *
- * 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 FloatConversion_h
-#define FloatConversion_h
-
-namespace WebCore {
-
-    template<typename T>
-    float narrowPrecisionToFloat(T);
-
-    template<>
-    inline float narrowPrecisionToFloat(double number)
-    {
-        return static_cast<float>(number);
-    }
-} // namespace WebCore
-
-#endif // FloatConversion_h
diff --git a/Source/core/platform/HostWindow.h b/Source/core/platform/HostWindow.h
deleted file mode 100644
index aec1b0e..0000000
--- a/Source/core/platform/HostWindow.h
+++ /dev/null
@@ -1,71 +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 HostWindow_h
-#define HostWindow_h
-
-#include "wtf/FastAllocBase.h"
-#include "wtf/Noncopyable.h"
-
-namespace WebKit {
-struct WebScreenInfo;
-}
-
-namespace WebCore {
-class Cursor;
-class IntPoint;
-class IntRect;
-class IntSize;
-
-class HostWindow {
-    WTF_MAKE_NONCOPYABLE(HostWindow); WTF_MAKE_FAST_ALLOCATED;
-public:
-    HostWindow() { }
-    virtual ~HostWindow() { }
-
-    // Requests the host invalidate the contents and the root view.
-    virtual void invalidateContentsAndRootView(const IntRect& updateRect) = 0;
-
-    // Requests the host scroll backingstore by the specified delta, rect to scroll, and clip rect.
-    virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) = 0;
-
-    // Requests the host invalidate the contents, not the root view. This is the slow path for scrolling.
-    virtual void invalidateContentsForSlowScroll(const IntRect& updateRect) = 0;
-
-    // Methods for doing coordinate conversions to and from screen coordinates.
-    virtual IntPoint screenToRootView(const IntPoint&) const = 0;
-    virtual IntRect rootViewToScreen(const IntRect&) const = 0;
-
-    virtual WebKit::WebScreenInfo screenInfo() const = 0;
-
-    // Request that the cursor change.
-    virtual void setCursor(const Cursor&) = 0;
-
-    virtual void scheduleAnimation() = 0;
-};
-
-} // namespace WebCore
-
-#endif // HostWindow_h
diff --git a/Source/core/platform/JSONValues.cpp b/Source/core/platform/JSONValues.cpp
deleted file mode 100644
index 667bedd..0000000
--- a/Source/core/platform/JSONValues.cpp
+++ /dev/null
@@ -1,386 +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/JSONValues.h"
-
-#include "wtf/DecimalNumber.h"
-#include "wtf/dtoa.h"
-#include "wtf/text/StringBuilder.h"
-
-namespace WebCore {
-
-namespace {
-
-const char* const nullString = "null";
-const char* const trueString = "true";
-const char* const falseString = "false";
-
-inline bool escapeChar(UChar c, StringBuilder* dst)
-{
-    switch (c) {
-    case '\b': dst->append("\\b", 2); break;
-    case '\f': dst->append("\\f", 2); break;
-    case '\n': dst->append("\\n", 2); break;
-    case '\r': dst->append("\\r", 2); break;
-    case '\t': dst->append("\\t", 2); break;
-    case '\\': dst->append("\\\\", 2); break;
-    case '"': dst->append("\\\"", 2); break;
-    default:
-        return false;
-    }
-    return true;
-}
-
-inline void doubleQuoteString(const String& str, StringBuilder* dst)
-{
-    dst->append('"');
-    for (unsigned i = 0; i < str.length(); ++i) {
-        UChar c = str[i];
-        if (!escapeChar(c, dst)) {
-            if (c < 32 || c > 126 || c == '<' || c == '>') {
-                // 1. Escaping <, > to prevent script execution.
-                // 2. Technically, we could also pass through c > 126 as UTF8, but this
-                //    is also optional. It would also be a pain to implement here.
-                unsigned symbol = static_cast<unsigned>(c);
-                String symbolCode = String::format("\\u%04X", symbol);
-                dst->append(symbolCode);
-            } else {
-                dst->append(c);
-            }
-        }
-    }
-    dst->append('"');
-}
-
-} // anonymous namespace
-
-bool JSONValue::asBoolean(bool*) const
-{
-    return false;
-}
-
-bool JSONValue::asNumber(double*) const
-{
-    return false;
-}
-
-bool JSONValue::asNumber(long*) const
-{
-    return false;
-}
-
-bool JSONValue::asNumber(int*) const
-{
-    return false;
-}
-
-bool JSONValue::asNumber(unsigned long*) const
-{
-    return false;
-}
-
-bool JSONValue::asNumber(unsigned*) const
-{
-    return false;
-}
-
-bool JSONValue::asString(String*) const
-{
-    return false;
-}
-
-bool JSONValue::asValue(RefPtr<JSONValue>* output)
-{
-    *output = this;
-    return true;
-}
-
-bool JSONValue::asObject(RefPtr<JSONObject>*)
-{
-    return false;
-}
-
-bool JSONValue::asArray(RefPtr<JSONArray>*)
-{
-    return false;
-}
-
-PassRefPtr<JSONObject> JSONValue::asObject()
-{
-    return 0;
-}
-
-PassRefPtr<JSONArray> JSONValue::asArray()
-{
-    return 0;
-}
-
-String JSONValue::toJSONString() const
-{
-    StringBuilder result;
-    result.reserveCapacity(512);
-    writeJSON(&result);
-    return result.toString();
-}
-
-void JSONValue::writeJSON(StringBuilder* output) const
-{
-    ASSERT(m_type == TypeNull);
-    output->append(nullString, 4);
-}
-
-bool JSONBasicValue::asBoolean(bool* output) const
-{
-    if (type() != TypeBoolean)
-        return false;
-    *output = m_boolValue;
-    return true;
-}
-
-bool JSONBasicValue::asNumber(double* output) const
-{
-    if (type() != TypeNumber)
-        return false;
-    *output = m_doubleValue;
-    return true;
-}
-
-bool JSONBasicValue::asNumber(long* output) const
-{
-    if (type() != TypeNumber)
-        return false;
-    *output = static_cast<long>(m_doubleValue);
-    return true;
-}
-
-bool JSONBasicValue::asNumber(int* output) const
-{
-    if (type() != TypeNumber)
-        return false;
-    *output = static_cast<int>(m_doubleValue);
-    return true;
-}
-
-bool JSONBasicValue::asNumber(unsigned long* output) const
-{
-    if (type() != TypeNumber)
-        return false;
-    *output = static_cast<unsigned long>(m_doubleValue);
-    return true;
-}
-
-bool JSONBasicValue::asNumber(unsigned* output) const
-{
-    if (type() != TypeNumber)
-        return false;
-    *output = static_cast<unsigned>(m_doubleValue);
-    return true;
-}
-
-void JSONBasicValue::writeJSON(StringBuilder* output) const
-{
-    ASSERT(type() == TypeBoolean || type() == TypeNumber);
-    if (type() == TypeBoolean) {
-        if (m_boolValue)
-            output->append(trueString, 4);
-        else
-            output->append(falseString, 5);
-    } else if (type() == TypeNumber) {
-        NumberToLStringBuffer buffer;
-        if (!std::isfinite(m_doubleValue)) {
-            output->append(nullString, 4);
-            return;
-        }
-        DecimalNumber decimal = m_doubleValue;
-        unsigned length = 0;
-        if (decimal.bufferLengthForStringDecimal() > WTF::NumberToStringBufferLength) {
-            // Not enough room for decimal. Use exponential format.
-            if (decimal.bufferLengthForStringExponential() > WTF::NumberToStringBufferLength) {
-                // Fallback for an abnormal case if it's too little even for exponential.
-                output->append("NaN", 3);
-                return;
-            }
-            length = decimal.toStringExponential(buffer, WTF::NumberToStringBufferLength);
-        } else {
-            length = decimal.toStringDecimal(buffer, WTF::NumberToStringBufferLength);
-        }
-        output->append(buffer, length);
-    }
-}
-
-bool JSONString::asString(String* output) const
-{
-    *output = m_stringValue;
-    return true;
-}
-
-void JSONString::writeJSON(StringBuilder* output) const
-{
-    ASSERT(type() == TypeString);
-    doubleQuoteString(m_stringValue, output);
-}
-
-JSONObjectBase::~JSONObjectBase()
-{
-}
-
-bool JSONObjectBase::asObject(RefPtr<JSONObject>* output)
-{
-    COMPILE_ASSERT(sizeof(JSONObject) == sizeof(JSONObjectBase), cannot_cast);
-    *output = static_cast<JSONObject*>(this);
-    return true;
-}
-
-PassRefPtr<JSONObject> JSONObjectBase::asObject()
-{
-    return openAccessors();
-}
-
-JSONObject* JSONObjectBase::openAccessors()
-{
-    COMPILE_ASSERT(sizeof(JSONObject) == sizeof(JSONObjectBase), cannot_cast);
-    return static_cast<JSONObject*>(this);
-}
-
-bool JSONObjectBase::getBoolean(const String& name, bool* output) const
-{
-    RefPtr<JSONValue> value = get(name);
-    if (!value)
-        return false;
-    return value->asBoolean(output);
-}
-
-bool JSONObjectBase::getString(const String& name, String* output) const
-{
-    RefPtr<JSONValue> value = get(name);
-    if (!value)
-        return false;
-    return value->asString(output);
-}
-
-PassRefPtr<JSONObject> JSONObjectBase::getObject(const String& name) const
-{
-    RefPtr<JSONValue> value = get(name);
-    if (!value)
-        return 0;
-    return value->asObject();
-}
-
-PassRefPtr<JSONArray> JSONObjectBase::getArray(const String& name) const
-{
-    RefPtr<JSONValue> value = get(name);
-    if (!value)
-        return 0;
-    return value->asArray();
-}
-
-PassRefPtr<JSONValue> JSONObjectBase::get(const String& name) const
-{
-    Dictionary::const_iterator it = m_data.find(name);
-    if (it == m_data.end())
-        return 0;
-    return it->value;
-}
-
-void JSONObjectBase::remove(const String& name)
-{
-    m_data.remove(name);
-    for (size_t i = 0; i < m_order.size(); ++i) {
-        if (m_order[i] == name) {
-            m_order.remove(i);
-            break;
-        }
-    }
-}
-
-void JSONObjectBase::writeJSON(StringBuilder* output) const
-{
-    output->append('{');
-    for (size_t i = 0; i < m_order.size(); ++i) {
-        Dictionary::const_iterator it = m_data.find(m_order[i]);
-        ASSERT(it != m_data.end());
-        if (i)
-            output->append(',');
-        doubleQuoteString(it->key, output);
-        output->append(':');
-        it->value->writeJSON(output);
-    }
-    output->append('}');
-}
-
-JSONObjectBase::JSONObjectBase()
-    : JSONValue(TypeObject)
-    , m_data()
-    , m_order()
-{
-}
-
-JSONArrayBase::~JSONArrayBase()
-{
-}
-
-bool JSONArrayBase::asArray(RefPtr<JSONArray>* output)
-{
-    COMPILE_ASSERT(sizeof(JSONArrayBase) == sizeof(JSONArray), cannot_cast);
-    *output = static_cast<JSONArray*>(this);
-    return true;
-}
-
-PassRefPtr<JSONArray> JSONArrayBase::asArray()
-{
-    COMPILE_ASSERT(sizeof(JSONArrayBase) == sizeof(JSONArray), cannot_cast);
-    return static_cast<JSONArray*>(this);
-}
-
-void JSONArrayBase::writeJSON(StringBuilder* output) const
-{
-    output->append('[');
-    for (Vector<RefPtr<JSONValue> >::const_iterator it = m_data.begin(); it != m_data.end(); ++it) {
-        if (it != m_data.begin())
-            output->append(',');
-        (*it)->writeJSON(output);
-    }
-    output->append(']');
-}
-
-JSONArrayBase::JSONArrayBase()
-    : JSONValue(TypeArray)
-    , m_data()
-{
-}
-
-PassRefPtr<JSONValue> JSONArrayBase::get(size_t index)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(index < m_data.size());
-    return m_data[index];
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/JSONValues.h b/Source/core/platform/JSONValues.h
deleted file mode 100644
index f1f3bf7..0000000
--- a/Source/core/platform/JSONValues.h
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * 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
- * 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 JSONValues_h
-#define JSONValues_h
-
-#include "wtf/Forward.h"
-#include "wtf/HashMap.h"
-#include "wtf/RefCounted.h"
-#include "wtf/Vector.h"
-#include "wtf/text/StringHash.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class JSONArray;
-class JSONObject;
-
-class JSONValue : public RefCounted<JSONValue> {
-public:
-    static const int maxDepth = 1000;
-
-    JSONValue() : m_type(TypeNull) { }
-    virtual ~JSONValue() { }
-
-    static PassRefPtr<JSONValue> null()
-    {
-        return adoptRef(new JSONValue());
-    }
-
-    typedef enum {
-        TypeNull = 0,
-        TypeBoolean,
-        TypeNumber,
-        TypeString,
-        TypeObject,
-        TypeArray
-    } Type;
-
-    Type type() const { return m_type; }
-
-    bool isNull() const { return m_type == TypeNull; }
-
-    virtual bool asBoolean(bool* output) const;
-    virtual bool asNumber(double* output) const;
-    virtual bool asNumber(long* output) const;
-    virtual bool asNumber(int* output) const;
-    virtual bool asNumber(unsigned long* output) const;
-    virtual bool asNumber(unsigned* output) const;
-    virtual bool asString(String* output) const;
-    virtual bool asValue(RefPtr<JSONValue>* output);
-    virtual bool asObject(RefPtr<JSONObject>* output);
-    virtual bool asArray(RefPtr<JSONArray>* output);
-    virtual PassRefPtr<JSONObject> asObject();
-    virtual PassRefPtr<JSONArray> asArray();
-
-    String toJSONString() const;
-    virtual void writeJSON(StringBuilder* output) const;
-
-protected:
-    explicit JSONValue(Type type) : m_type(type) { }
-
-private:
-    Type m_type;
-};
-
-class JSONBasicValue : public JSONValue {
-public:
-
-    static PassRefPtr<JSONBasicValue> create(bool value)
-    {
-        return adoptRef(new JSONBasicValue(value));
-    }
-
-    static PassRefPtr<JSONBasicValue> create(int value)
-    {
-        return adoptRef(new JSONBasicValue(value));
-    }
-
-    static PassRefPtr<JSONBasicValue> create(double value)
-    {
-        return adoptRef(new JSONBasicValue(value));
-    }
-
-    virtual bool asBoolean(bool* output) const;
-    virtual bool asNumber(double* output) const;
-    virtual bool asNumber(long* output) const;
-    virtual bool asNumber(int* output) const;
-    virtual bool asNumber(unsigned long* output) const;
-    virtual bool asNumber(unsigned* output) const;
-
-    virtual void writeJSON(StringBuilder* output) const;
-
-private:
-    explicit JSONBasicValue(bool value) : JSONValue(TypeBoolean), m_boolValue(value) { }
-    explicit JSONBasicValue(int value) : JSONValue(TypeNumber), m_doubleValue((double)value) { }
-    explicit JSONBasicValue(double value) : JSONValue(TypeNumber), m_doubleValue(value) { }
-
-    union {
-        bool m_boolValue;
-        double m_doubleValue;
-    };
-};
-
-class JSONString : public JSONValue {
-public:
-    static PassRefPtr<JSONString> create(const String& value)
-    {
-        return adoptRef(new JSONString(value));
-    }
-
-    static PassRefPtr<JSONString> create(const char* value)
-    {
-        return adoptRef(new JSONString(value));
-    }
-
-    virtual bool asString(String* output) const;
-
-    virtual void writeJSON(StringBuilder* output) const;
-
-private:
-    explicit JSONString(const String& value) : JSONValue(TypeString), m_stringValue(value) { }
-    explicit JSONString(const char* value) : JSONValue(TypeString), m_stringValue(value) { }
-
-    String m_stringValue;
-};
-
-class JSONObjectBase : public JSONValue {
-private:
-    typedef HashMap<String, RefPtr<JSONValue> > Dictionary;
-
-public:
-    typedef Dictionary::iterator iterator;
-    typedef Dictionary::const_iterator const_iterator;
-
-    virtual PassRefPtr<JSONObject> asObject();
-    JSONObject* openAccessors();
-
-protected:
-    ~JSONObjectBase();
-
-    virtual bool asObject(RefPtr<JSONObject>* output);
-
-    void setBoolean(const String& name, bool);
-    void setNumber(const String& name, double);
-    void setString(const String& name, const String&);
-    void setValue(const String& name, PassRefPtr<JSONValue>);
-    void setObject(const String& name, PassRefPtr<JSONObject>);
-    void setArray(const String& name, PassRefPtr<JSONArray>);
-
-    iterator find(const String& name);
-    const_iterator find(const String& name) const;
-    bool getBoolean(const String& name, bool* output) const;
-    template<class T> bool getNumber(const String& name, T* output) const
-    {
-        RefPtr<JSONValue> value = get(name);
-        if (!value)
-            return false;
-        return value->asNumber(output);
-    }
-    bool getString(const String& name, String* output) const;
-    PassRefPtr<JSONObject> getObject(const String& name) const;
-    PassRefPtr<JSONArray> getArray(const String& name) const;
-    PassRefPtr<JSONValue> get(const String& name) const;
-
-    void remove(const String& name);
-
-    virtual void writeJSON(StringBuilder* output) const;
-
-    iterator begin() { return m_data.begin(); }
-    iterator end() { return m_data.end(); }
-    const_iterator begin() const { return m_data.begin(); }
-    const_iterator end() const { return m_data.end(); }
-
-    int size() const { return m_data.size(); }
-
-protected:
-    JSONObjectBase();
-
-private:
-    Dictionary m_data;
-    Vector<String> m_order;
-};
-
-class JSONObject : public JSONObjectBase {
-public:
-    static PassRefPtr<JSONObject> create()
-    {
-        return adoptRef(new JSONObject());
-    }
-
-    using JSONObjectBase::asObject;
-
-    using JSONObjectBase::setBoolean;
-    using JSONObjectBase::setNumber;
-    using JSONObjectBase::setString;
-    using JSONObjectBase::setValue;
-    using JSONObjectBase::setObject;
-    using JSONObjectBase::setArray;
-
-    using JSONObjectBase::find;
-    using JSONObjectBase::getBoolean;
-    using JSONObjectBase::getNumber;
-    using JSONObjectBase::getString;
-    using JSONObjectBase::getObject;
-    using JSONObjectBase::getArray;
-    using JSONObjectBase::get;
-
-    using JSONObjectBase::remove;
-
-    using JSONObjectBase::begin;
-    using JSONObjectBase::end;
-
-    using JSONObjectBase::size;
-};
-
-
-class JSONArrayBase : public JSONValue {
-public:
-    typedef Vector<RefPtr<JSONValue> >::iterator iterator;
-    typedef Vector<RefPtr<JSONValue> >::const_iterator const_iterator;
-
-    virtual PassRefPtr<JSONArray> asArray();
-
-    unsigned length() const { return m_data.size(); }
-
-protected:
-    ~JSONArrayBase();
-
-    virtual bool asArray(RefPtr<JSONArray>* output);
-
-    void pushBoolean(bool);
-    void pushInt(int);
-    void pushNumber(double);
-    void pushString(const String&);
-    void pushValue(PassRefPtr<JSONValue>);
-    void pushObject(PassRefPtr<JSONObject>);
-    void pushArray(PassRefPtr<JSONArray>);
-
-    PassRefPtr<JSONValue> get(size_t index);
-
-    virtual void writeJSON(StringBuilder* output) const;
-
-    iterator begin() { return m_data.begin(); }
-    iterator end() { return m_data.end(); }
-    const_iterator begin() const { return m_data.begin(); }
-    const_iterator end() const { return m_data.end(); }
-
-protected:
-    JSONArrayBase();
-
-private:
-    Vector<RefPtr<JSONValue> > m_data;
-};
-
-class JSONArray : public JSONArrayBase {
-public:
-    static PassRefPtr<JSONArray> create()
-    {
-        return adoptRef(new JSONArray());
-    }
-
-    using JSONArrayBase::asArray;
-
-    using JSONArrayBase::pushBoolean;
-    using JSONArrayBase::pushInt;
-    using JSONArrayBase::pushNumber;
-    using JSONArrayBase::pushString;
-    using JSONArrayBase::pushValue;
-    using JSONArrayBase::pushObject;
-    using JSONArrayBase::pushArray;
-
-    using JSONArrayBase::get;
-
-    using JSONArrayBase::begin;
-    using JSONArrayBase::end;
-};
-
-
-inline JSONObjectBase::iterator JSONObjectBase::find(const String& name)
-{
-    return m_data.find(name);
-}
-
-inline JSONObjectBase::const_iterator JSONObjectBase::find(const String& name) const
-{
-    return m_data.find(name);
-}
-
-inline void JSONObjectBase::setBoolean(const String& name, bool value)
-{
-    setValue(name, JSONBasicValue::create(value));
-}
-
-inline void JSONObjectBase::setNumber(const String& name, double value)
-{
-    setValue(name, JSONBasicValue::create(value));
-}
-
-inline void JSONObjectBase::setString(const String& name, const String& value)
-{
-    setValue(name, JSONString::create(value));
-}
-
-inline void JSONObjectBase::setValue(const String& name, PassRefPtr<JSONValue> value)
-{
-    ASSERT(value);
-    if (m_data.set(name, value).isNewEntry)
-        m_order.append(name);
-}
-
-inline void JSONObjectBase::setObject(const String& name, PassRefPtr<JSONObject> value)
-{
-    ASSERT(value);
-    if (m_data.set(name, value).isNewEntry)
-        m_order.append(name);
-}
-
-inline void JSONObjectBase::setArray(const String& name, PassRefPtr<JSONArray> value)
-{
-    ASSERT(value);
-    if (m_data.set(name, value).isNewEntry)
-        m_order.append(name);
-}
-
-inline void JSONArrayBase::pushBoolean(bool value)
-{
-    m_data.append(JSONBasicValue::create(value));
-}
-
-inline void JSONArrayBase::pushInt(int value)
-{
-    m_data.append(JSONBasicValue::create(value));
-}
-
-inline void JSONArrayBase::pushNumber(double value)
-{
-    m_data.append(JSONBasicValue::create(value));
-}
-
-inline void JSONArrayBase::pushString(const String& value)
-{
-    m_data.append(JSONString::create(value));
-}
-
-inline void JSONArrayBase::pushValue(PassRefPtr<JSONValue> value)
-{
-    ASSERT(value);
-    m_data.append(value);
-}
-
-inline void JSONArrayBase::pushObject(PassRefPtr<JSONObject> value)
-{
-    ASSERT(value);
-    m_data.append(value);
-}
-
-inline void JSONArrayBase::pushArray(PassRefPtr<JSONArray> value)
-{
-    ASSERT(value);
-    m_data.append(value);
-}
-
-} // namespace WebCore
-
-#endif // !defined(JSONValues_h)
diff --git a/Source/core/platform/Language.cpp b/Source/core/platform/Language.cpp
deleted file mode 100644
index 1b50dd2..0000000
--- a/Source/core/platform/Language.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2010, 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.
- */
-
-#include "config.h"
-#include "core/platform/Language.h"
-
-#include "public/platform/Platform.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-static String platformLanguage()
-{
-    DEFINE_STATIC_LOCAL(String, computedDefaultLanguage, ());
-    if (computedDefaultLanguage.isEmpty()) {
-        computedDefaultLanguage.append(WebKit::Platform::current()->defaultLocale());
-        ASSERT(!computedDefaultLanguage.isEmpty());
-    }
-    return computedDefaultLanguage;
-}
-
-String defaultLanguage()
-{
-    Vector<String> languages = userPreferredLanguages();
-    if (languages.size())
-        return languages[0];
-
-    return emptyString();
-}
-
-static Vector<String>& preferredLanguagesOverride()
-{
-    DEFINE_STATIC_LOCAL(Vector<String>, override, ());
-    return override;
-}
-
-Vector<String> userPreferredLanguagesOverride()
-{
-    return preferredLanguagesOverride();
-}
-
-void overrideUserPreferredLanguages(const Vector<String>& override)
-{
-    preferredLanguagesOverride() = override;
-}
-
-Vector<String> userPreferredLanguages()
-{
-    Vector<String>& override = preferredLanguagesOverride();
-    if (!override.isEmpty())
-        return override;
-
-    Vector<String> languages;
-    languages.reserveInitialCapacity(1);
-    languages.append(platformLanguage());
-    return languages;
-}
-
-static String canonicalLanguageIdentifier(const String& languageCode)
-{
-    String lowercaseLanguageCode = languageCode.lower();
-
-    if (lowercaseLanguageCode.length() >= 3 && lowercaseLanguageCode[2] == '_')
-        lowercaseLanguageCode.replace(2, 1, "-");
-
-    return lowercaseLanguageCode;
-}
-
-size_t indexOfBestMatchingLanguageInList(const String& language, const Vector<String>& languageList)
-{
-    String languageWithoutLocaleMatch;
-    String languageMatchButNotLocale;
-    size_t languageWithoutLocaleMatchIndex = 0;
-    size_t languageMatchButNotLocaleMatchIndex = 0;
-    bool canMatchLanguageOnly = (language.length() == 2 || (language.length() >= 3 && language[2] == '-'));
-
-    for (size_t i = 0; i < languageList.size(); ++i) {
-        String canonicalizedLanguageFromList = canonicalLanguageIdentifier(languageList[i]);
-
-        if (language == canonicalizedLanguageFromList)
-            return i;
-
-        if (canMatchLanguageOnly && canonicalizedLanguageFromList.length() >= 2) {
-            if (language[0] == canonicalizedLanguageFromList[0] && language[1] == canonicalizedLanguageFromList[1]) {
-                if (!languageWithoutLocaleMatch.length() && canonicalizedLanguageFromList.length() == 2) {
-                    languageWithoutLocaleMatch = languageList[i];
-                    languageWithoutLocaleMatchIndex = i;
-                }
-                if (!languageMatchButNotLocale.length() && canonicalizedLanguageFromList.length() >= 3) {
-                    languageMatchButNotLocale = languageList[i];
-                    languageMatchButNotLocaleMatchIndex = i;
-                }
-            }
-        }
-    }
-
-    // If we have both a language-only match and a languge-but-not-locale match, return the
-    // languge-only match as is considered a "better" match. For example, if the list
-    // provided has both "en-GB" and "en" and the user prefers "en-US" we will return "en".
-    if (languageWithoutLocaleMatch.length())
-        return languageWithoutLocaleMatchIndex;
-
-    if (languageMatchButNotLocale.length())
-        return languageMatchButNotLocaleMatchIndex;
-
-    return languageList.size();
-}
-
-}
diff --git a/Source/core/platform/Language.h b/Source/core/platform/Language.h
deleted file mode 100644
index 44dc0a2..0000000
--- a/Source/core/platform/Language.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2010, 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 Language_h
-#define Language_h
-
-#include "wtf/Forward.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-String defaultLanguage();
-Vector<String> userPreferredLanguages();
-Vector<String> userPreferredLanguagesOverride();
-void overrideUserPreferredLanguages(const Vector<String>&);
-size_t indexOfBestMatchingLanguageInList(const String& language, const Vector<String>& languageList);
-
-}
-
-#endif
diff --git a/Source/core/platform/LayoutTestSupport.cpp b/Source/core/platform/LayoutTestSupport.cpp
deleted file mode 100644
index b6a75b1..0000000
--- a/Source/core/platform/LayoutTestSupport.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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:
- *
- *     * 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/LayoutTestSupport.h"
-
-namespace WebCore {
-
-static bool s_isRunningLayoutTest = false;
-
-bool isRunningLayoutTest()
-{
-    return s_isRunningLayoutTest;
-}
-
-void setIsRunningLayoutTest(bool value)
-{
-    s_isRunningLayoutTest = value;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/LayoutTestSupport.h b/Source/core/platform/LayoutTestSupport.h
deleted file mode 100644
index 48aa219..0000000
--- a/Source/core/platform/LayoutTestSupport.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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:
- *
- *     * 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 LayoutTestSupport_h
-#define LayoutTestSupport_h
-
-namespace WebCore {
-
-bool isRunningLayoutTest();
-void setIsRunningLayoutTest(bool);
-
-} // namespace WebCore
-
-#endif // LayoutTestSupport_h
diff --git a/Source/core/platform/LayoutUnit.h b/Source/core/platform/LayoutUnit.h
deleted file mode 100644
index 712fc88..0000000
--- a/Source/core/platform/LayoutUnit.h
+++ /dev/null
@@ -1,799 +0,0 @@
-/*
- * 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:
- *
- *     * 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 LayoutUnit_h
-#define LayoutUnit_h
-
-#include "wtf/Assertions.h"
-#include "wtf/MathExtras.h"
-#include "wtf/SaturatedArithmetic.h"
-#include <limits.h>
-#include <limits>
-#include <stdlib.h>
-
-namespace WebCore {
-
-#ifdef NDEBUG
-
-#define REPORT_OVERFLOW(doesOverflow) ((void)0)
-
-#else
-
-#define REPORT_OVERFLOW(doesOverflow) do \
-    if (!(doesOverflow)) { \
-        WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, "!(%s)", #doesOverflow); \
-    } \
-while (0)
-
-#endif
-
-static const int kFixedPointDenominator = 64;
-
-const int intMaxForLayoutUnit = INT_MAX / kFixedPointDenominator;
-const int intMinForLayoutUnit = INT_MIN / kFixedPointDenominator;
-
-class LayoutUnit {
-public:
-    LayoutUnit() : m_value(0) { }
-    LayoutUnit(int value) { setValue(value); }
-    LayoutUnit(unsigned short value) { setValue(value); }
-    LayoutUnit(unsigned value) { setValue(value); }
-    LayoutUnit(unsigned long value) { m_value = clampTo<int>(value * kFixedPointDenominator); }
-    LayoutUnit(unsigned long long value) { m_value = clampTo<int>(value * kFixedPointDenominator); }
-    LayoutUnit(float value) { m_value = clampTo<float>(value * kFixedPointDenominator, static_cast<float>(INT_MIN), static_cast<float>(INT_MAX)); }
-    LayoutUnit(double value) { m_value = clampTo<double>(value * kFixedPointDenominator, static_cast<double>(INT_MIN), static_cast<double>(INT_MAX)); }
-
-    static LayoutUnit fromFloatCeil(float value)
-    {
-        LayoutUnit v;
-        v.m_value = clampToInteger(ceilf(value * kFixedPointDenominator));
-        return v;
-    }
-
-    static LayoutUnit fromFloatFloor(float value)
-    {
-        LayoutUnit v;
-        v.m_value = clampToInteger(floorf(value * kFixedPointDenominator));
-        return v;
-    }
-
-    static LayoutUnit fromFloatRound(float value)
-    {
-        if (value >= 0)
-            return clamp(value + epsilon() / 2.0f);
-        return clamp(value - epsilon() / 2.0f);
-    }
-
-    int toInt() const { return m_value / kFixedPointDenominator; }
-    float toFloat() const { return static_cast<float>(m_value) / kFixedPointDenominator; }
-    double toDouble() const { return static_cast<double>(m_value) / kFixedPointDenominator; }
-    float ceilToFloat() const
-    {
-        float floatValue = toFloat();
-        if (static_cast<int>(floatValue * kFixedPointDenominator) == m_value)
-            return floatValue;
-        if (floatValue > 0)
-            return nextafterf(floatValue, std::numeric_limits<float>::max());
-        return nextafterf(floatValue, std::numeric_limits<float>::min());
-    }
-    unsigned toUnsigned() const { REPORT_OVERFLOW(m_value >= 0); return toInt(); }
-
-    operator int() const { return toInt(); }
-    operator unsigned() const { return toUnsigned(); }
-    operator float() const { return toFloat(); }
-    operator double() const { return toDouble(); }
-    operator bool() const { return m_value; }
-
-    LayoutUnit operator++(int)
-    {
-        m_value += kFixedPointDenominator;
-        return *this;
-    }
-
-    inline int rawValue() const { return m_value; }
-    inline void setRawValue(int value) { m_value = value; }
-    void setRawValue(long long value)
-    {
-        REPORT_OVERFLOW(value > std::numeric_limits<int>::min() && value < std::numeric_limits<int>::max());
-        m_value = static_cast<int>(value);
-    }
-
-    LayoutUnit abs() const
-    {
-        LayoutUnit returnValue;
-        returnValue.setRawValue(::abs(m_value));
-        return returnValue;
-    }
-#if OS(MACOSX)
-    int wtf_ceil() const
-#else
-    int ceil() const
-#endif
-    {
-        if (UNLIKELY(m_value >= INT_MAX - kFixedPointDenominator + 1))
-            return intMaxForLayoutUnit;
-
-        if (m_value >= 0)
-            return (m_value + kFixedPointDenominator - 1) / kFixedPointDenominator;
-        return toInt();
-    }
-    int round() const
-    {
-        if (m_value > 0)
-            return saturatedAddition(rawValue(), kFixedPointDenominator / 2) / kFixedPointDenominator;
-        return saturatedSubtraction(rawValue(), (kFixedPointDenominator / 2) - 1) / kFixedPointDenominator;
-    }
-
-    int floor() const
-    {
-        if (UNLIKELY(m_value <= INT_MIN + kFixedPointDenominator - 1))
-            return intMinForLayoutUnit;
-
-        if (m_value >= 0)
-            return toInt();
-        return (m_value - kFixedPointDenominator + 1) / kFixedPointDenominator;
-    }
-
-    LayoutUnit fraction() const
-    {
-        // Add the fraction to the size (as opposed to the full location) to avoid overflows.
-        // Compute fraction using the mod operator to preserve the sign of the value as it may affect rounding.
-        LayoutUnit fraction;
-        fraction.setRawValue(rawValue() % kFixedPointDenominator);
-        return fraction;
-    }
-
-    bool mightBeSaturated() const
-    {
-        return rawValue() == std::numeric_limits<int>::max()
-            || rawValue() == std::numeric_limits<int>::min();
-    }
-
-    static float epsilon() { return 1.0f / kFixedPointDenominator; }
-
-    static const LayoutUnit max()
-    {
-        LayoutUnit m;
-        m.m_value = std::numeric_limits<int>::max();
-        return m;
-    }
-    static const LayoutUnit min()
-    {
-        LayoutUnit m;
-        m.m_value = std::numeric_limits<int>::min();
-        return m;
-    }
-
-    // Versions of max/min that are slightly smaller/larger than max/min() to allow for roinding without overflowing.
-    static const LayoutUnit nearlyMax()
-    {
-        LayoutUnit m;
-        m.m_value = std::numeric_limits<int>::max() - kFixedPointDenominator / 2;
-        return m;
-    }
-    static const LayoutUnit nearlyMin()
-    {
-        LayoutUnit m;
-        m.m_value = std::numeric_limits<int>::min() + kFixedPointDenominator / 2;
-        return m;
-    }
-
-    static LayoutUnit clamp(double value)
-    {
-        return clampTo<LayoutUnit>(value, LayoutUnit::min(), LayoutUnit::max());
-    }
-
-private:
-    static bool isInBounds(int value)
-    {
-        return ::abs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator;
-    }
-    static bool isInBounds(unsigned value)
-    {
-        return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) / kFixedPointDenominator;
-    }
-    static bool isInBounds(double value)
-    {
-        return ::fabs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator;
-    }
-
-    inline void setValue(int value)
-    {
-        if (value > intMaxForLayoutUnit)
-            m_value = std::numeric_limits<int>::max();
-        else if (value < intMinForLayoutUnit)
-            m_value = std::numeric_limits<int>::min();
-        else
-            m_value = value * kFixedPointDenominator;
-    }
-    inline void setValue(unsigned value)
-    {
-        if (value >= static_cast<unsigned>(intMaxForLayoutUnit))
-            m_value = std::numeric_limits<int>::max();
-        else
-            m_value = value * kFixedPointDenominator;
-    }
-
-    int m_value;
-};
-
-inline bool operator<=(const LayoutUnit& a, const LayoutUnit& b)
-{
-    return a.rawValue() <= b.rawValue();
-}
-
-inline bool operator<=(const LayoutUnit& a, float b)
-{
-    return a.toFloat() <= b;
-}
-
-inline bool operator<=(const LayoutUnit& a, int b)
-{
-    return a <= LayoutUnit(b);
-}
-
-inline bool operator<=(const float a, const LayoutUnit& b)
-{
-    return a <= b.toFloat();
-}
-
-inline bool operator<=(const int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) <= b;
-}
-
-inline bool operator>=(const LayoutUnit& a, const LayoutUnit& b)
-{
-    return a.rawValue() >= b.rawValue();
-}
-
-inline bool operator>=(const LayoutUnit& a, int b)
-{
-    return a >= LayoutUnit(b);
-}
-
-inline bool operator>=(const float a, const LayoutUnit& b)
-{
-    return a >= b.toFloat();
-}
-
-inline bool operator>=(const LayoutUnit& a, float b)
-{
-    return a.toFloat() >= b;
-}
-
-inline bool operator>=(const int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) >= b;
-}
-
-inline bool operator<(const LayoutUnit& a, const LayoutUnit& b)
-{
-    return a.rawValue() < b.rawValue();
-}
-
-inline bool operator<(const LayoutUnit& a, int b)
-{
-    return a < LayoutUnit(b);
-}
-
-inline bool operator<(const LayoutUnit& a, float b)
-{
-    return a.toFloat() < b;
-}
-
-inline bool operator<(const LayoutUnit& a, double b)
-{
-    return a.toDouble() < b;
-}
-
-inline bool operator<(const int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) < b;
-}
-
-inline bool operator<(const float a, const LayoutUnit& b)
-{
-    return a < b.toFloat();
-}
-
-inline bool operator>(const LayoutUnit& a, const LayoutUnit& b)
-{
-    return a.rawValue() > b.rawValue();
-}
-
-inline bool operator>(const LayoutUnit& a, double b)
-{
-    return a.toDouble() > b;
-}
-
-inline bool operator>(const LayoutUnit& a, float b)
-{
-    return a.toFloat() > b;
-}
-
-inline bool operator>(const LayoutUnit& a, int b)
-{
-    return a > LayoutUnit(b);
-}
-
-inline bool operator>(const int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) > b;
-}
-
-inline bool operator>(const float a, const LayoutUnit& b)
-{
-    return a > b.toFloat();
-}
-
-inline bool operator>(const double a, const LayoutUnit& b)
-{
-    return a > b.toDouble();
-}
-
-inline bool operator!=(const LayoutUnit& a, const LayoutUnit& b)
-{
-    return a.rawValue() != b.rawValue();
-}
-
-inline bool operator!=(const LayoutUnit& a, float b)
-{
-    return a != LayoutUnit(b);
-}
-
-inline bool operator!=(const int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) != b;
-}
-
-inline bool operator!=(const LayoutUnit& a, int b)
-{
-    return a != LayoutUnit(b);
-}
-
-inline bool operator==(const LayoutUnit& a, const LayoutUnit& b)
-{
-    return a.rawValue() == b.rawValue();
-}
-
-inline bool operator==(const LayoutUnit& a, int b)
-{
-    return a == LayoutUnit(b);
-}
-
-inline bool operator==(const int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) == b;
-}
-
-inline bool operator==(const LayoutUnit& a, float b)
-{
-    return a.toFloat() == b;
-}
-
-inline bool operator==(const float a, const LayoutUnit& b)
-{
-    return a == b.toFloat();
-}
-
-// For multiplication that's prone to overflow, this bounds it to LayoutUnit::max() and ::min()
-inline LayoutUnit boundedMultiply(const LayoutUnit& a, const LayoutUnit& b)
-{
-    int64_t result = static_cast<int64_t>(a.rawValue()) * static_cast<int64_t>(b.rawValue()) / kFixedPointDenominator;
-    int32_t high = static_cast<int32_t>(result >> 32);
-    int32_t low = static_cast<int32_t>(result);
-    uint32_t saturated = (static_cast<uint32_t>(a.rawValue() ^ b.rawValue()) >> 31) + std::numeric_limits<int>::max();
-    // If the higher 32 bits does not match the lower 32 with sign extension the operation overflowed.
-    if (high != low >> 31)
-        result = saturated;
-
-    LayoutUnit returnVal;
-    returnVal.setRawValue(static_cast<int>(result));
-    return returnVal;
-}
-
-inline LayoutUnit operator*(const LayoutUnit& a, const LayoutUnit& b)
-{
-    return boundedMultiply(a, b);
-}
-
-inline double operator*(const LayoutUnit& a, double b)
-{
-    return a.toDouble() * b;
-}
-
-inline float operator*(const LayoutUnit& a, float b)
-{
-    return a.toFloat() * b;
-}
-
-inline LayoutUnit operator*(const LayoutUnit& a, int b)
-{
-    return a * LayoutUnit(b);
-}
-
-inline LayoutUnit operator*(const LayoutUnit& a, unsigned short b)
-{
-    return a * LayoutUnit(b);
-}
-
-inline LayoutUnit operator*(const LayoutUnit& a, unsigned b)
-{
-    return a * LayoutUnit(b);
-}
-
-inline LayoutUnit operator*(const LayoutUnit& a, unsigned long b)
-{
-    return a * LayoutUnit(b);
-}
-
-inline LayoutUnit operator*(const LayoutUnit& a, unsigned long long b)
-{
-    return a * LayoutUnit(b);
-}
-
-inline LayoutUnit operator*(unsigned short a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) * b;
-}
-
-inline LayoutUnit operator*(unsigned a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) * b;
-}
-
-inline LayoutUnit operator*(unsigned long a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) * b;
-}
-
-inline LayoutUnit operator*(unsigned long long a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) * b;
-}
-
-inline LayoutUnit operator*(const int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) * b;
-}
-
-inline float operator*(const float a, const LayoutUnit& b)
-{
-    return a * b.toFloat();
-}
-
-inline double operator*(const double a, const LayoutUnit& b)
-{
-    return a * b.toDouble();
-}
-
-inline LayoutUnit operator/(const LayoutUnit& a, const LayoutUnit& b)
-{
-    LayoutUnit returnVal;
-    long long rawVal = static_cast<long long>(kFixedPointDenominator) * a.rawValue() / b.rawValue();
-    returnVal.setRawValue(clampTo<int>(rawVal));
-    return returnVal;
-}
-
-inline float operator/(const LayoutUnit& a, float b)
-{
-    return a.toFloat() / b;
-}
-
-inline double operator/(const LayoutUnit& a, double b)
-{
-    return a.toDouble() / b;
-}
-
-inline LayoutUnit operator/(const LayoutUnit& a, int b)
-{
-    return a / LayoutUnit(b);
-}
-
-inline LayoutUnit operator/(const LayoutUnit& a, unsigned short b)
-{
-    return a / LayoutUnit(b);
-}
-
-inline LayoutUnit operator/(const LayoutUnit& a, unsigned b)
-{
-    return a / LayoutUnit(b);
-}
-
-inline LayoutUnit operator/(const LayoutUnit& a, unsigned long b)
-{
-    return a / LayoutUnit(b);
-}
-
-inline LayoutUnit operator/(const LayoutUnit& a, unsigned long long b)
-{
-    return a / LayoutUnit(b);
-}
-
-inline float operator/(const float a, const LayoutUnit& b)
-{
-    return a / b.toFloat();
-}
-
-inline double operator/(const double a, const LayoutUnit& b)
-{
-    return a / b.toDouble();
-}
-
-inline LayoutUnit operator/(const int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) / b;
-}
-
-inline LayoutUnit operator/(unsigned short a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) / b;
-}
-
-inline LayoutUnit operator/(unsigned a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) / b;
-}
-
-inline LayoutUnit operator/(unsigned long a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) / b;
-}
-
-inline LayoutUnit operator/(unsigned long long a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) / b;
-}
-
-inline LayoutUnit operator+(const LayoutUnit& a, const LayoutUnit& b)
-{
-    LayoutUnit returnVal;
-    returnVal.setRawValue(saturatedAddition(a.rawValue(), b.rawValue()));
-    return returnVal;
-}
-
-inline LayoutUnit operator+(const LayoutUnit& a, int b)
-{
-    return a + LayoutUnit(b);
-}
-
-inline float operator+(const LayoutUnit& a, float b)
-{
-    return a.toFloat() + b;
-}
-
-inline double operator+(const LayoutUnit& a, double b)
-{
-    return a.toDouble() + b;
-}
-
-inline LayoutUnit operator+(const int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) + b;
-}
-
-inline float operator+(const float a, const LayoutUnit& b)
-{
-    return a + b.toFloat();
-}
-
-inline double operator+(const double a, const LayoutUnit& b)
-{
-    return a + b.toDouble();
-}
-
-inline LayoutUnit operator-(const LayoutUnit& a, const LayoutUnit& b)
-{
-    LayoutUnit returnVal;
-    returnVal.setRawValue(saturatedSubtraction(a.rawValue(), b.rawValue()));
-    return returnVal;
-}
-
-inline LayoutUnit operator-(const LayoutUnit& a, int b)
-{
-    return a - LayoutUnit(b);
-}
-
-inline LayoutUnit operator-(const LayoutUnit& a, unsigned b)
-{
-    return a - LayoutUnit(b);
-}
-
-inline float operator-(const LayoutUnit& a, float b)
-{
-    return a.toFloat() - b;
-}
-
-inline LayoutUnit operator-(const int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) - b;
-}
-
-inline float operator-(const float a, const LayoutUnit& b)
-{
-    return a - b.toFloat();
-}
-
-inline LayoutUnit operator-(const LayoutUnit& a)
-{
-    LayoutUnit returnVal;
-    returnVal.setRawValue(-a.rawValue());
-    return returnVal;
-}
-
-// For returning the remainder after a division with integer results.
-inline LayoutUnit intMod(const LayoutUnit& a, const LayoutUnit& b)
-{
-    // This calculates the modulo so that: a = static_cast<int>(a / b) * b + intMod(a, b).
-    LayoutUnit returnVal;
-    returnVal.setRawValue(a.rawValue() % b.rawValue());
-    return returnVal;
-}
-
-inline LayoutUnit operator%(const LayoutUnit& a, const LayoutUnit& b)
-{
-    // This calculates the modulo so that: a = (a / b) * b + a % b.
-    LayoutUnit returnVal;
-    long long rawVal = (static_cast<long long>(kFixedPointDenominator) * a.rawValue()) % b.rawValue();
-    returnVal.setRawValue(rawVal / kFixedPointDenominator);
-    return returnVal;
-}
-
-inline LayoutUnit operator%(const LayoutUnit& a, int b)
-{
-    return a % LayoutUnit(b);
-}
-
-inline LayoutUnit operator%(int a, const LayoutUnit& b)
-{
-    return LayoutUnit(a) % b;
-}
-
-inline LayoutUnit& operator+=(LayoutUnit& a, const LayoutUnit& b)
-{
-    a.setRawValue(saturatedAddition(a.rawValue(), b.rawValue()));
-    return a;
-}
-
-inline LayoutUnit& operator+=(LayoutUnit& a, int b)
-{
-    a = a + b;
-    return a;
-}
-
-inline LayoutUnit& operator+=(LayoutUnit& a, float b)
-{
-    a = a + b;
-    return a;
-}
-
-inline float& operator+=(float& a, const LayoutUnit& b)
-{
-    a = a + b;
-    return a;
-}
-
-inline LayoutUnit& operator-=(LayoutUnit& a, int b)
-{
-    a = a - b;
-    return a;
-}
-
-inline LayoutUnit& operator-=(LayoutUnit& a, const LayoutUnit& b)
-{
-    a.setRawValue(saturatedSubtraction(a.rawValue(), b.rawValue()));
-    return a;
-}
-
-inline LayoutUnit& operator-=(LayoutUnit& a, float b)
-{
-    a = a - b;
-    return a;
-}
-
-inline float& operator-=(float& a, const LayoutUnit& b)
-{
-    a = a - b;
-    return a;
-}
-
-inline LayoutUnit& operator*=(LayoutUnit& a, const LayoutUnit& b)
-{
-    a = a * b;
-    return a;
-}
-// operator*=(LayoutUnit& a, int b) is supported by the operator above plus LayoutUnit(int).
-
-inline LayoutUnit& operator*=(LayoutUnit& a, float b)
-{
-    a = a * b;
-    return a;
-}
-
-inline float& operator*=(float& a, const LayoutUnit& b)
-{
-    a = a * b;
-    return a;
-}
-
-inline LayoutUnit& operator/=(LayoutUnit& a, const LayoutUnit& b)
-{
-    a = a / b;
-    return a;
-}
-// operator/=(LayoutUnit& a, int b) is supported by the operator above plus LayoutUnit(int).
-
-inline LayoutUnit& operator/=(LayoutUnit& a, float b)
-{
-    a = a / b;
-    return a;
-}
-
-inline float& operator/=(float& a, const LayoutUnit& b)
-{
-    a = a / b;
-    return a;
-}
-
-inline int snapSizeToPixel(LayoutUnit size, LayoutUnit location)
-{
-    LayoutUnit fraction = location.fraction();
-    return (fraction + size).round() - fraction.round();
-}
-
-inline int roundToInt(LayoutUnit value)
-{
-    return value.round();
-}
-
-inline int floorToInt(LayoutUnit value)
-{
-    return value.floor();
-}
-
-inline LayoutUnit absoluteValue(const LayoutUnit& value)
-{
-    return value.abs();
-}
-
-inline LayoutUnit layoutMod(const LayoutUnit& numerator, const LayoutUnit& denominator)
-{
-    return numerator % denominator;
-}
-
-inline bool isIntegerValue(const LayoutUnit value)
-{
-    return value.toInt() == value;
-}
-
-} // namespace WebCore
-
-#endif // LayoutUnit_h
diff --git a/Source/core/platform/Length.cpp b/Source/core/platform/Length.cpp
index 95a3733..767be3c 100644
--- a/Source/core/platform/Length.cpp
+++ b/Source/core/platform/Length.cpp
@@ -138,12 +138,25 @@
         m_map.remove(index);
     }
 
-    PassRefPtr<CalculationValue> get(int index)
+    CalculationValue* get(int index)
     {
         ASSERT(m_map.contains(index));
         return m_map.get(index);
     }
 
+    void decrementRef(int index)
+    {
+        ASSERT(m_map.contains(index));
+        CalculationValue* value = m_map.get(index);
+        if (value->hasOneRef()) {
+            // Force the CalculationValue destructor early to avoid a potential recursive call inside HashMap remove().
+            m_map.set(index, 0);
+            m_map.remove(index);
+        } else {
+            value->deref();
+        }
+    }
+
 private:
     int m_index;
     HashMap<int, RefPtr<CalculationValue> > m_map;
@@ -163,19 +176,12 @@
     m_intValue = calcHandles().insert(calc);
 }
 
-Length Length::blendMixedTypes(const Length& from, double progress) const
+Length Length::blendMixedTypes(const Length& from, double progress, ValueRange range) const
 {
-    if (progress <= 0.0)
-        return from;
-
-    if (progress >= 1.0)
-        return *this;
-
-    OwnPtr<CalcExpressionNode> blend = adoptPtr(new CalcExpressionBlendLength(from, *this, progress));
-    return Length(CalculationValue::create(blend.release(), CalculationRangeAll));
+    return Length(CalculationValue::create(adoptPtr(new CalcExpressionBlendLength(from, *this, progress)), range));
 }
 
-PassRefPtr<CalculationValue> Length::calculationValue() const
+CalculationValue* Length::calculationValue() const
 {
     ASSERT(isCalculated());
     return calcHandles().get(calculationHandle());
@@ -190,10 +196,7 @@
 void Length::decrementCalculatedRef() const
 {
     ASSERT(isCalculated());
-    RefPtr<CalculationValue> calcLength = calculationValue();
-    if (calcLength->hasOneRef())
-        calcHandles().remove(calculationHandle());
-    calcLength->deref();
+    calcHandles().decrementRef(calculationHandle());
 }
 
 float Length::nonNanCalculatedValue(int maxValue) const
diff --git a/Source/core/platform/Length.h b/Source/core/platform/Length.h
index 1a655d4..d2821a6 100644
--- a/Source/core/platform/Length.h
+++ b/Source/core/platform/Length.h
@@ -44,6 +44,11 @@
     Undefined
 };
 
+enum ValueRange {
+    ValueRangeAll,
+    ValueRangeNonNegative
+};
+
 class CalculationValue;
 
 struct Length {
@@ -141,7 +146,7 @@
         return getFloatValue();
     }
 
-    PassRefPtr<CalculationValue> calculationValue() const;
+    CalculationValue* calculationValue() const;
 
     LengthType type() const { return static_cast<LengthType>(m_type); }
     bool quirk() const { return m_quirk; }
@@ -233,17 +238,22 @@
     bool isFillAvailable() const { return type() == FillAvailable; }
     bool isFitContent() const { return type() == FitContent; }
 
-    Length blend(const Length& from, double progress) const
+    Length blend(const Length& from, double progress, ValueRange range) const
     {
-        if (isUndefined() || from.isUndefined())
+        if (progress == 0.0)
+            return from;
+
+        if (progress == 1.0)
             return *this;
 
-        // Blend two lengths to produce a new length that is in between them.  Used for animation.
+        if (isUndefined() || from.isUndefined())
+            return progress < 0.5 ? from : *this;
+
         if (from.type() == Calculated || type() == Calculated)
-            return blendMixedTypes(from, progress);
+            return blendMixedTypes(from, progress, range);
 
         if (!from.isZero() && !isZero() && from.type() != type())
-            return blendMixedTypes(from, progress);
+            return blendMixedTypes(from, progress, range);
 
         if (from.isZero() && isZero())
             return *this;
@@ -252,15 +262,10 @@
         if (isZero())
             resultType = from.type();
 
-        if (resultType == Percent) {
-            float fromPercent = from.isZero() ? 0 : from.percent();
-            float toPercent = isZero() ? 0 : percent();
-            return Length(WebCore::blend(fromPercent, toPercent, progress), Percent);
-        }
-
-        float fromValue = from.isZero() ? 0 : from.value();
-        float toValue = isZero() ? 0 : value();
-        return Length(WebCore::blend(fromValue, toValue, progress), resultType);
+        float blendedValue = WebCore::blend(from.value(), value(), progress);
+        if (range == ValueRangeNonNegative)
+            blendedValue = clampTo<float>(blendedValue, 0);
+        return Length(blendedValue, resultType);
     }
 
     float getFloatValue() const
@@ -294,7 +299,7 @@
             incrementCalculatedRef();
     }
 
-    Length blendMixedTypes(const Length& from, double progress) const;
+    Length blendMixedTypes(const Length& from, double progress, ValueRange) const;
 
     int calculationHandle() const
     {
diff --git a/Source/core/platform/LengthBox.h b/Source/core/platform/LengthBox.h
index a0e13e2..1e5d52c 100644
--- a/Source/core/platform/LengthBox.h
+++ b/Source/core/platform/LengthBox.h
@@ -23,8 +23,8 @@
 #define LengthBox_h
 
 #include "core/platform/Length.h"
-#include "core/platform/text/TextDirection.h"
-#include "core/platform/text/WritingMode.h"
+#include "platform/text/TextDirection.h"
+#include "platform/text/WritingMode.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/LifecycleNotifier.h b/Source/core/platform/LifecycleNotifier.h
index 0dea4ef..42942bf 100644
--- a/Source/core/platform/LifecycleNotifier.h
+++ b/Source/core/platform/LifecycleNotifier.h
@@ -45,6 +45,8 @@
     virtual void addObserver(LifecycleObserver*);
     virtual void removeObserver(LifecycleObserver*);
 
+    bool isIteratingOverObservers() const { return m_iterating != IteratingNone; }
+
 protected:
     explicit LifecycleNotifier(LifecycleContext*);
 
diff --git a/Source/core/platform/LinkHash.cpp b/Source/core/platform/LinkHash.cpp
deleted file mode 100644
index 03d4bb6..0000000
--- a/Source/core/platform/LinkHash.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2008, 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
- * 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/LinkHash.h"
-
-#include "public/platform/Platform.h"
-#include "weborigin/KURL.h"
-#include "wtf/text/StringUTF8Adaptor.h"
-#include <url/url_util.h>
-
-namespace WebCore {
-
-static bool resolveRelative(const KURL& base, const String& relative, url_canon::RawCanonOutput<2048>* buffer)
-{
-    // We use these low-level GURL functions to avoid converting back and forth from UTF-8 unnecessarily.
-    url_parse::Parsed parsed;
-    StringUTF8Adaptor baseUTF8(base.string());
-    if (relative.is8Bit()) {
-        StringUTF8Adaptor relativeUTF8(relative);
-        return url_util::ResolveRelative(baseUTF8.data(), baseUTF8.length(), base.parsed(), relativeUTF8.data(), relativeUTF8.length(), 0, buffer, &parsed);
-    }
-    return url_util::ResolveRelative(baseUTF8.data(), baseUTF8.length(), base.parsed(), relative.characters16(), relative.length(), 0, buffer, &parsed);
-}
-
-LinkHash visitedLinkHash(const KURL& base, const AtomicString& relative)
-{
-    if (relative.isNull())
-        return 0;
-    url_canon::RawCanonOutput<2048> buffer;
-    if (!resolveRelative(base, relative.string(), &buffer))
-        return 0;
-    return WebKit::Platform::current()->visitedLinkHash(buffer.data(), buffer.length());
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/LinkHash.h b/Source/core/platform/LinkHash.h
deleted file mode 100644
index 4ea5cec..0000000
--- a/Source/core/platform/LinkHash.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2008 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 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,
- * 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 LinkHash_h
-#define LinkHash_h
-
-#include "wtf/Forward.h"
-#include "wtf/text/StringHash.h"
-
-namespace WebCore {
-
-class KURL;
-
-typedef uint64_t LinkHash;
-
-// Use the low 32-bits of the 64-bit LinkHash as the key for HashSets.
-struct LinkHashHash {
-    static unsigned hash(LinkHash key) { return static_cast<unsigned>(key); }
-    static bool equal(LinkHash a, LinkHash b) { return a == b; }
-    static const bool safeToCompareToEmptyOrDeleted = true;
-
-    // See AlreadyHashed::avoidDeletedValue.
-    static unsigned avoidDeletedValue(LinkHash hash64)
-    {
-        ASSERT(hash64);
-        unsigned hash = static_cast<unsigned>(hash64);
-        unsigned newHash = hash | (!(hash + 1) << 31);
-        ASSERT(newHash);
-        ASSERT(newHash != 0xFFFFFFFF);
-        return newHash;
-    }
-};
-
-// Resolves the potentially relative URL "attributeURL" relative to the given
-// base URL, and returns the hash of the string that will be used for visited
-// link coloring. It will return the special value of 0 if attributeURL does not
-// look like a relative URL.
-LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL);
-
-} // namespace WebCore
-
-#endif // LinkHash_h
diff --git a/Source/core/platform/LocalizedStrings.cpp b/Source/core/platform/LocalizedStrings.cpp
deleted file mode 100644
index 17c63bb..0000000
--- a/Source/core/platform/LocalizedStrings.cpp
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * 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
- * 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/LocalizedStrings.h"
-
-#include "core/platform/NotImplemented.h"
-#include "core/platform/graphics/IntSize.h"
-#include "core/platform/text/DateTimeFormat.h"
-#include "public/platform/Platform.h"
-#include "public/platform/WebString.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/WTFString.h"
-
-using WebKit::WebLocalizedString;
-using WebKit::WebString;
-
-namespace WebCore {
-
-static String query(WebLocalizedString::Name name)
-{
-    return WebKit::Platform::current()->queryLocalizedString(name);
-}
-
-static String query(WebLocalizedString::Name name, const WebString& parameter)
-{
-    return WebKit::Platform::current()->queryLocalizedString(name, parameter);
-}
-
-static String query(WebLocalizedString::Name name, const WebString& parameter1, const WebString& parameter2)
-{
-    return WebKit::Platform::current()->queryLocalizedString(name, parameter1, parameter2);
-}
-
-String searchableIndexIntroduction()
-{
-    return query(WebLocalizedString::SearchableIndexIntroduction);
-}
-
-String submitButtonDefaultLabel()
-{
-    return query(WebLocalizedString::SubmitButtonDefaultLabel);
-}
-
-String inputElementAltText()
-{
-    return query(WebLocalizedString::InputElementAltText);
-}
-
-String resetButtonDefaultLabel()
-{
-    return query(WebLocalizedString::ResetButtonDefaultLabel);
-}
-
-String fileButtonChooseFileLabel()
-{
-    return query(WebLocalizedString::FileButtonChooseFileLabel);
-}
-
-String fileButtonChooseMultipleFilesLabel()
-{
-    return query(WebLocalizedString::FileButtonChooseMultipleFilesLabel);
-}
-
-String defaultDetailsSummaryText()
-{
-    return query(WebLocalizedString::DetailsLabel);
-}
-
-String fileButtonNoFileSelectedLabel()
-{
-    return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
-}
-
-String fileButtonNoFilesSelectedLabel()
-{
-    return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
-}
-
-String searchMenuNoRecentSearchesText()
-{
-    return query(WebLocalizedString::SearchMenuNoRecentSearchesText);
-}
-String searchMenuRecentSearchesText()
-{
-    return query(WebLocalizedString::SearchMenuRecentSearchesText);
-}
-
-String searchMenuClearRecentSearchesText()
-{
-    return query(WebLocalizedString::SearchMenuClearRecentSearchesText);
-}
-
-String AXWebAreaText()
-{
-    return query(WebLocalizedString::AXWebAreaText);
-}
-
-String AXLinkText()
-{
-    return query(WebLocalizedString::AXLinkText);
-}
-
-String AXListMarkerText()
-{
-    return query(WebLocalizedString::AXListMarkerText);
-}
-
-String AXImageMapText()
-{
-    return query(WebLocalizedString::AXImageMapText);
-}
-
-String AXHeadingText()
-{
-    return query(WebLocalizedString::AXHeadingText);
-}
-
-String AXButtonActionVerb()
-{
-    return query(WebLocalizedString::AXButtonActionVerb);
-}
-
-String AXRadioButtonActionVerb()
-{
-    return query(WebLocalizedString::AXRadioButtonActionVerb);
-}
-
-String AXTextFieldActionVerb()
-{
-    return query(WebLocalizedString::AXTextFieldActionVerb);
-}
-
-String AXCheckedCheckBoxActionVerb()
-{
-    return query(WebLocalizedString::AXCheckedCheckBoxActionVerb);
-}
-
-String AXUncheckedCheckBoxActionVerb()
-{
-    return query(WebLocalizedString::AXUncheckedCheckBoxActionVerb);
-}
-
-String AXLinkActionVerb()
-{
-    return query(WebLocalizedString::AXLinkActionVerb);
-}
-
-String AXMenuListPopupActionVerb()
-{
-    return String();
-}
-
-String AXMenuListActionVerb()
-{
-    return String();
-}
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-String AXAMPMFieldText()
-{
-    return query(WebLocalizedString::AXAMPMFieldText);
-}
-
-String AXDayOfMonthFieldText()
-{
-    return query(WebLocalizedString::AXDayOfMonthFieldText);
-}
-
-String AXDateTimeFieldEmptyValueText()
-{
-    return query(WebLocalizedString::AXDateTimeFieldEmptyValueText);
-}
-
-String AXHourFieldText()
-{
-    return query(WebLocalizedString::AXHourFieldText);
-}
-
-String AXMillisecondFieldText()
-{
-    return query(WebLocalizedString::AXMillisecondFieldText);
-}
-
-String AXMinuteFieldText()
-{
-    return query(WebLocalizedString::AXMinuteFieldText);
-}
-
-String AXMonthFieldText()
-{
-    return query(WebLocalizedString::AXMonthFieldText);
-}
-
-String AXSecondFieldText()
-{
-    return query(WebLocalizedString::AXSecondFieldText);
-}
-
-String AXWeekOfYearFieldText()
-{
-    return query(WebLocalizedString::AXWeekOfYearFieldText);
-}
-
-String AXYearFieldText()
-{
-    return query(WebLocalizedString::AXYearFieldText);
-}
-
-String placeholderForDayOfMonthField()
-{
-    return query(WebLocalizedString::PlaceholderForDayOfMonthField);
-}
-
-String placeholderForMonthField()
-{
-    return query(WebLocalizedString::PlaceholderForMonthField);
-}
-
-String placeholderForYearField()
-{
-    return query(WebLocalizedString::PlaceholderForYearField);
-}
-#endif
-
-String weekFormatInLDML()
-{
-    String templ = query(WebLocalizedString::WeekFormatTemplate);
-    // Converts a string like "Week $2, $1" to an LDML date format pattern like
-    // "'Week 'ww', 'yyyy".
-    StringBuilder builder;
-    unsigned literalStart = 0;
-    unsigned length = templ.length();
-    for (unsigned i = 0; i + 1 < length; ++i) {
-        if (templ[i] == '$' && (templ[i + 1] == '1' || templ[i + 1] == '2')) {
-            if (literalStart < i)
-                DateTimeFormat::quoteAndAppendLiteral(templ.substring(literalStart, i - literalStart), builder);
-            builder.append(templ[++i] == '1' ? "yyyy" : "ww");
-            literalStart = i + 1;
-        }
-    }
-    if (literalStart < length)
-        DateTimeFormat::quoteAndAppendLiteral(templ.substring(literalStart, length - literalStart), builder);
-    return builder.toString();
-}
-
-String missingPluginText()
-{
-    return query(WebLocalizedString::MissingPluginText);
-}
-
-String blockedPluginByContentSecurityPolicyText()
-{
-    notImplemented();
-    return String();
-}
-
-String multipleFileUploadText(unsigned numberOfFiles)
-{
-    return query(WebLocalizedString::MultipleFileUploadText, String::number(numberOfFiles));
-}
-
-// The following two functions are not declared in core/platform/LocalizedStrings.h.
-// They are used by the menu for the HTML keygen tag.
-String keygenMenuHighGradeKeySize()
-{
-    return query(WebLocalizedString::KeygenMenuHighGradeKeySize);
-}
-
-String keygenMenuMediumGradeKeySize()
-{
-    return query(WebLocalizedString::KeygenMenuMediumGradeKeySize);
-}
-
-// Used in ImageDocument.cpp as the title for pages when that page is an image.
-String imageTitle(const String& filename, const IntSize& size)
-{
-    StringBuilder result;
-    result.append(filename);
-    result.append(" (");
-    result.append(String::number(size.width()));
-    result.append(static_cast<UChar>(0xD7)); // U+00D7 (multiplication sign)
-    result.append(String::number(size.height()));
-    result.append(')');
-    return result.toString();
-}
-
-String textTrackClosedCaptionsText() { return String(); }
-String textTrackSubtitlesText() { return String(); }
-String textTrackOffText() { return String(); }
-String textTrackNoLabelText() { return String(); }
-
-String localizedMediaControlElementString(const String& name)
-{
-    if (name == "AudioElement")
-        return query(WebLocalizedString::AXMediaAudioElement);
-    if (name == "VideoElement")
-        return query(WebLocalizedString::AXMediaVideoElement);
-    if (name == "MuteButton")
-        return query(WebLocalizedString::AXMediaMuteButton);
-    if (name == "UnMuteButton")
-        return query(WebLocalizedString::AXMediaUnMuteButton);
-    if (name == "PlayButton")
-        return query(WebLocalizedString::AXMediaPlayButton);
-    if (name == "PauseButton")
-        return query(WebLocalizedString::AXMediaPauseButton);
-    if (name == "Slider")
-        return query(WebLocalizedString::AXMediaSlider);
-    if (name == "SliderThumb")
-        return query(WebLocalizedString::AXMediaSliderThumb);
-    if (name == "RewindButton")
-        return query(WebLocalizedString::AXMediaRewindButton);
-    if (name == "ReturnToRealtimeButton")
-        return query(WebLocalizedString::AXMediaReturnToRealTime);
-    if (name == "CurrentTimeDisplay")
-        return query(WebLocalizedString::AXMediaCurrentTimeDisplay);
-    if (name == "TimeRemainingDisplay")
-        return query(WebLocalizedString::AXMediaTimeRemainingDisplay);
-    if (name == "StatusDisplay")
-        return query(WebLocalizedString::AXMediaStatusDisplay);
-    if (name == "EnterFullscreenButton")
-        return query(WebLocalizedString::AXMediaEnterFullscreenButton);
-    if (name == "ExitFullscreenButton")
-        return query(WebLocalizedString::AXMediaExitFullscreenButton);
-    if (name == "SeekForwardButton")
-        return query(WebLocalizedString::AXMediaSeekForwardButton);
-    if (name == "SeekBackButton")
-        return query(WebLocalizedString::AXMediaSeekBackButton);
-    if (name == "ShowClosedCaptionsButton")
-        return query(WebLocalizedString::AXMediaShowClosedCaptionsButton);
-    if (name == "HideClosedCaptionsButton")
-        return query(WebLocalizedString::AXMediaHideClosedCaptionsButton);
-
-    // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy.
-    if (name == "ControlsPanel")
-        return query(WebLocalizedString::AXMediaDefault);
-
-    ASSERT_NOT_REACHED();
-    return query(WebLocalizedString::AXMediaDefault);
-}
-
-String localizedMediaControlElementHelpText(const String& name)
-{
-    if (name == "AudioElement")
-        return query(WebLocalizedString::AXMediaAudioElementHelp);
-    if (name == "VideoElement")
-        return query(WebLocalizedString::AXMediaVideoElementHelp);
-    if (name == "MuteButton")
-        return query(WebLocalizedString::AXMediaMuteButtonHelp);
-    if (name == "UnMuteButton")
-        return query(WebLocalizedString::AXMediaUnMuteButtonHelp);
-    if (name == "PlayButton")
-        return query(WebLocalizedString::AXMediaPlayButtonHelp);
-    if (name == "PauseButton")
-        return query(WebLocalizedString::AXMediaPauseButtonHelp);
-    if (name == "Slider")
-        return query(WebLocalizedString::AXMediaSliderHelp);
-    if (name == "SliderThumb")
-        return query(WebLocalizedString::AXMediaSliderThumbHelp);
-    if (name == "RewindButton")
-        return query(WebLocalizedString::AXMediaRewindButtonHelp);
-    if (name == "ReturnToRealtimeButton")
-        return query(WebLocalizedString::AXMediaReturnToRealTimeHelp);
-    if (name == "CurrentTimeDisplay")
-        return query(WebLocalizedString::AXMediaCurrentTimeDisplayHelp);
-    if (name == "TimeRemainingDisplay")
-        return query(WebLocalizedString::AXMediaTimeRemainingDisplayHelp);
-    if (name == "StatusDisplay")
-        return query(WebLocalizedString::AXMediaStatusDisplayHelp);
-    if (name == "EnterFullscreenButton")
-        return query(WebLocalizedString::AXMediaEnterFullscreenButtonHelp);
-    if (name == "ExitFullscreenButton")
-        return query(WebLocalizedString::AXMediaExitFullscreenButtonHelp);
-    if (name == "SeekForwardButton")
-        return query(WebLocalizedString::AXMediaSeekForwardButtonHelp);
-    if (name == "SeekBackButton")
-        return query(WebLocalizedString::AXMediaSeekBackButtonHelp);
-    if (name == "ShowClosedCaptionsButton")
-        return query(WebLocalizedString::AXMediaShowClosedCaptionsButtonHelp);
-    if (name == "HideClosedCaptionsButton")
-        return query(WebLocalizedString::AXMediaHideClosedCaptionsButtonHelp);
-
-    ASSERT_NOT_REACHED();
-    return query(WebLocalizedString::AXMediaDefault);
-}
-
-String localizedMediaTimeDescription(float /*time*/)
-{
-    // FIXME: to be fixed.
-    return String();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/LocalizedStrings.h b/Source/core/platform/LocalizedStrings.h
deleted file mode 100644
index d94765b..0000000
--- a/Source/core/platform/LocalizedStrings.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2009, 2011, 2012, 2013 Apple Inc.  All rights reserved.
- * Copyright (C) 2010 Igalia S.L
- *
- * 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,
- * 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 LocalizedStrings_h
-#define LocalizedStrings_h
-
-#include "public/platform/WebLocalizedString.h"
-#include "wtf/Forward.h"
-
-namespace WebCore {
-
-    class IntSize;
-
-    // FIXME: Use Locale::queryString instead of the following functions.
-
-    String inputElementAltText();
-    String resetButtonDefaultLabel();
-    String searchableIndexIntroduction();
-    String submitButtonDefaultLabel();
-    String fileButtonChooseFileLabel();
-    String fileButtonChooseMultipleFilesLabel();
-    String fileButtonNoFileSelectedLabel();
-    String fileButtonNoFilesSelectedLabel();
-    String defaultDetailsSummaryText();
-
-    String searchMenuNoRecentSearchesText();
-    String searchMenuRecentSearchesText();
-    String searchMenuClearRecentSearchesText();
-
-    String AXWebAreaText();
-    String AXLinkText();
-    String AXListMarkerText();
-    String AXImageMapText();
-    String AXHeadingText();
-    String AXFileUploadButtonText();
-    String AXButtonActionVerb();
-    String AXRadioButtonActionVerb();
-    String AXTextFieldActionVerb();
-    String AXCheckedCheckBoxActionVerb();
-    String AXUncheckedCheckBoxActionVerb();
-    String AXMenuListActionVerb();
-    String AXMenuListPopupActionVerb();
-    String AXLinkActionVerb();
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-    String AXAMPMFieldText();
-    String AXDayOfMonthFieldText();
-    String AXDateTimeFieldEmptyValueText();
-    String AXHourFieldText();
-    String AXMillisecondFieldText();
-    String AXMinuteFieldText();
-    String AXMonthFieldText();
-    String AXSecondFieldText();
-    String AXWeekOfYearFieldText();
-    String AXYearFieldText();
-
-    // placeholderForDayOfMonthField() returns localized placeholder text, e.g.
-    // "dd", for date field used in multiple fields "date", "datetime", and
-    // "datetime-local" input UI instead "--".
-    String placeholderForDayOfMonthField();
-
-    // placeholderForfMonthField() returns localized placeholder text, e.g.
-    // "mm", for month field used in multiple fields "date", "datetime", and
-    // "datetime-local" input UI instead "--".
-    String placeholderForMonthField();
-
-    // placeholderForYearField() returns localized placeholder text, e.g.
-    // "yyyy", for year field used in multiple fields "date", "datetime", and
-    // "datetime-local" input UI instead "----".
-    String placeholderForYearField();
-#endif
-    // weekFormatInLDML() returns week and year format in LDML, Unicode
-    // technical standard 35, Locale Data Markup Language, e.g. "'Week' ww, yyyy"
-    String weekFormatInLDML();
-
-    String missingPluginText();
-    String blockedPluginByContentSecurityPolicyText();
-
-    String multipleFileUploadText(unsigned numberOfFiles);
-
-    String imageTitle(const String& filename, const IntSize& size);
-
-    String localizedMediaControlElementString(const String&);
-    String localizedMediaControlElementHelpText(const String&);
-    String localizedMediaTimeDescription(float);
-
-    String clickToExitFullScreenText();
-
-    String textTrackSubtitlesText();
-    String textTrackOffText();
-    String textTrackNoLabelText();
-
-} // namespace WebCore
-
-#endif // LocalizedStrings_h
diff --git a/Source/core/platform/Logging.cpp b/Source/core/platform/Logging.cpp
deleted file mode 100644
index 834ece6..0000000
--- a/Source/core/platform/Logging.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2003, 2006 Apple Computer, 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,
- * 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/Logging.h"
-
-#include "wtf/text/WTFString.h"
-
-#if !LOG_DISABLED
-
-namespace WebCore {
-
-WTFLogChannel LogNotYetImplemented = { 0x00000001, "WebCoreLogLevel", WTFLogChannelOff };
-
-WTFLogChannel LogFrames =            { 0x00000010, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogLoading =           { 0x00000020, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogPopupBlocking =     { 0x00000040, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogEvents =            { 0x00000080, "WebCoreLogLevel", WTFLogChannelOff };
-
-WTFLogChannel LogEditing =           { 0x00000100, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogLiveConnect =       { 0x00000200, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogIconDatabase =      { 0x00000400, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogSQLDatabase =       { 0x00000800, "WebCoreLogLevel", WTFLogChannelOff };
-
-WTFLogChannel LogSpellingAndGrammar ={ 0x00001000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogBackForward =       { 0x00002000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogHistory =           { 0x00004000, "WebCoreLogLevel", WTFLogChannelOff };
-
-WTFLogChannel LogPlatformLeaks =     { 0x00010000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogResourceLoading =   { 0x00020000, "WebCoreLogLevel", WTFLogChannelOff };
-
-WTFLogChannel LogNetwork =           { 0x00100000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogFTP =               { 0x00200000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogThreading =         { 0x00400000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogStorageAPI =        { 0x00800000, "WebCoreLogLevel", WTFLogChannelOff };
-
-WTFLogChannel LogMedia =             { 0x01000000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogPlugins =           { 0x02000000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogArchives =          { 0x04000000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogProgress =          { 0x08000000, "WebCoreLogLevel", WTFLogChannelOff };
-
-WTFLogChannel LogFileAPI =           { 0x10000000, "WebCoreLogLevel", WTFLogChannelOff };
-
-WTFLogChannel LogWebAudio =          { 0x20000000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogCompositing =       { 0x40000000, "WebCoreLogLevel", WTFLogChannelOff };
-WTFLogChannel LogGamepad =           { 0x80000000, "WebCoreLogLevel", WTFLogChannelOff };
-
-
-WTFLogChannel* getChannelFromName(const String& channelName)
-{
-    if (!(channelName.length() >= 2))
-        return 0;
-
-    if (equalIgnoringCase(channelName, String("BackForward")))
-        return &LogBackForward;
-
-    if (equalIgnoringCase(channelName, String("Editing")))
-        return &LogEditing;
-
-    if (equalIgnoringCase(channelName, String("Events")))
-        return &LogEvents;
-
-    if (equalIgnoringCase(channelName, String("Frames")))
-        return &LogFrames;
-
-    if (equalIgnoringCase(channelName, String("FTP")))
-        return &LogFTP;
-
-    if (equalIgnoringCase(channelName, String("History")))
-        return &LogHistory;
-
-    if (equalIgnoringCase(channelName, String("IconDatabase")))
-        return &LogIconDatabase;
-
-    if (equalIgnoringCase(channelName, String("Loading")))
-        return &LogLoading;
-
-    if (equalIgnoringCase(channelName, String("Media")))
-        return &LogMedia;
-
-    if (equalIgnoringCase(channelName, String("Network")))
-        return &LogNetwork;
-
-    if (equalIgnoringCase(channelName, String("NotYetImplemented")))
-        return &LogNotYetImplemented;
-
-    if (equalIgnoringCase(channelName, String("PlatformLeaks")))
-        return &LogPlatformLeaks;
-
-    if (equalIgnoringCase(channelName, String("ResourceLoading")))
-        return &LogResourceLoading;
-
-    if (equalIgnoringCase(channelName, String("Plugins")))
-        return &LogPlugins;
-
-    if (equalIgnoringCase(channelName, String("PopupBlocking")))
-        return &LogPopupBlocking;
-
-    if (equalIgnoringCase(channelName, String("Progress")))
-        return &LogProgress;
-
-    if (equalIgnoringCase(channelName, String("SpellingAndGrammar")))
-        return &LogSpellingAndGrammar;
-
-    if (equalIgnoringCase(channelName, String("SQLDatabase")))
-        return &LogSQLDatabase;
-
-    if (equalIgnoringCase(channelName, String("StorageAPI")))
-        return &LogStorageAPI;
-
-    if (equalIgnoringCase(channelName, String("LiveConnect")))
-        return &LogLiveConnect;
-
-    if (equalIgnoringCase(channelName, String("Threading")))
-        return &LogThreading;
-
-    if (equalIgnoringCase(channelName, String("FileAPI")))
-        return &LogFileAPI;
-
-    if (equalIgnoringCase(channelName, String("WebAudio")))
-        return &LogWebAudio;
-
-    if (equalIgnoringCase(channelName, String("Compositing")))
-        return &LogCompositing;
-
-    if (equalIgnoringCase(channelName, String("Gamepad")))
-        return &LogGamepad;
-
-    return 0;
-}
-
-}
-
-#endif // !LOG_DISABLED
diff --git a/Source/core/platform/Logging.h b/Source/core/platform/Logging.h
deleted file mode 100644
index bdad93f..0000000
--- a/Source/core/platform/Logging.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2003, 2006 Apple Computer, 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,
- * 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 Logging_h
-#define Logging_h
-
-#include "wtf/Assertions.h"
-#include "wtf/Forward.h"
-
-#if !LOG_DISABLED
-
-#ifndef LOG_CHANNEL_PREFIX
-#define LOG_CHANNEL_PREFIX Log
-#endif
-
-namespace WebCore {
-
-    extern WTFLogChannel LogNotYetImplemented;
-    extern WTFLogChannel LogFrames;
-    extern WTFLogChannel LogLoading;
-    extern WTFLogChannel LogPopupBlocking;
-    extern WTFLogChannel LogEvents;
-    extern WTFLogChannel LogEditing;
-    extern WTFLogChannel LogLiveConnect;
-    extern WTFLogChannel LogIconDatabase;
-    extern WTFLogChannel LogSQLDatabase;
-    extern WTFLogChannel LogSpellingAndGrammar;
-    extern WTFLogChannel LogBackForward;
-    extern WTFLogChannel LogHistory;
-    extern WTFLogChannel LogPlatformLeaks;
-    extern WTFLogChannel LogResourceLoading;
-    extern WTFLogChannel LogNetwork;
-    extern WTFLogChannel LogFTP;
-    extern WTFLogChannel LogThreading;
-    extern WTFLogChannel LogStorageAPI;
-    extern WTFLogChannel LogMedia;
-    extern WTFLogChannel LogPlugins;
-    extern WTFLogChannel LogArchives;
-    extern WTFLogChannel LogProgress;
-    extern WTFLogChannel LogFileAPI;
-    extern WTFLogChannel LogWebAudio;
-    extern WTFLogChannel LogCompositing;
-    extern WTFLogChannel LogGamepad;
-
-    WTFLogChannel* getChannelFromName(const String& channelName);
-}
-
-#endif // !LOG_DISABLED
-
-#endif // Logging_h
diff --git a/Source/core/platform/NotImplemented.cpp b/Source/core/platform/NotImplemented.cpp
deleted file mode 100644
index 4b7584a..0000000
--- a/Source/core/platform/NotImplemented.cpp
+++ /dev/null
@@ -1,42 +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.
- */
-
-#include "config.h"
-#include "core/platform/NotImplemented.h"
-
-#include "core/platform/Logging.h"
-
-namespace WebCore {
-
-#if !LOG_DISABLED
-
-WTFLogChannel* notImplementedLoggingChannel()
-{
-    return &LogNotYetImplemented;
-}
-
-#endif
-
-}
diff --git a/Source/core/platform/NotImplemented.h b/Source/core/platform/NotImplemented.h
deleted file mode 100644
index d553018..0000000
--- a/Source/core/platform/NotImplemented.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Computer, 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,
- * 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 NotImplemented_h
-#define NotImplemented_h
-
-#include "wtf/Assertions.h"
-
-#if LOG_DISABLED
-    #define notImplemented() ((void)0)
-#else
-
-namespace WebCore {
-WTFLogChannel* notImplementedLoggingChannel();
-}
-
-#define notImplemented() do { \
-        static bool havePrinted = false; \
-        if (!havePrinted) { \
-            WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, WebCore::notImplementedLoggingChannel(), "UNIMPLEMENTED: "); \
-            havePrinted = true; \
-        } \
-    } while (0)
-
-#endif // NDEBUG
-
-#endif // NotImplemented_h
diff --git a/Source/core/platform/PODArena.h b/Source/core/platform/PODArena.h
deleted file mode 100644
index bc65de6..0000000
--- a/Source/core/platform/PODArena.h
+++ /dev/null
@@ -1,201 +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.
- */
-
-#ifndef PODArena_h
-#define PODArena_h
-
-#include <stdint.h>
-#include "wtf/Assertions.h"
-#include "wtf/FastMalloc.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-// An arena which allocates only Plain Old Data (POD), or classes and
-// structs bottoming out in Plain Old Data. NOTE: the constructors of
-// the objects allocated in this arena are called, but _not_ their
-// destructors.
-
-class PODArena : public RefCounted<PODArena> {
-public:
-    // The arena is configured with an allocator, which is responsible
-    // for allocating and freeing chunks of memory at a time.
-    class Allocator : public RefCounted<Allocator> {
-    public:
-        virtual void* allocate(size_t size) = 0;
-        virtual void free(void* ptr) = 0;
-    protected:
-        virtual ~Allocator() { }
-        friend class WTF::RefCounted<Allocator>;
-    };
-
-    // The Arena's default allocator, which uses fastMalloc and
-    // fastFree to allocate chunks of storage.
-    class FastMallocAllocator : public Allocator {
-    public:
-        static PassRefPtr<FastMallocAllocator> create()
-        {
-            return adoptRef(new FastMallocAllocator);
-        }
-
-        virtual void* allocate(size_t size) { return fastMalloc(size); }
-        virtual void free(void* ptr) { fastFree(ptr); }
-
-    protected:
-        FastMallocAllocator() { }
-    };
-
-    // Creates a new PODArena configured with a FastMallocAllocator.
-    static PassRefPtr<PODArena> create()
-    {
-        return adoptRef(new PODArena);
-    }
-
-    // Creates a new PODArena configured with the given Allocator.
-    static PassRefPtr<PODArena> create(PassRefPtr<Allocator> allocator)
-    {
-        return adoptRef(new PODArena(allocator));
-    }
-
-    // Allocates an object from the arena.
-    template<class T> T* allocateObject()
-    {
-        return new (allocateBase<T>()) T();
-    }
-
-    // Allocates an object from the arena, calling a single-argument constructor.
-    template<class T, class Argument1Type> T* allocateObject(const Argument1Type& argument1)
-    {
-        return new (allocateBase<T>()) T(argument1);
-    }
-
-    // The initial size of allocated chunks; increases as necessary to
-    // satisfy large allocations. Mainly public for unit tests.
-    enum {
-        DefaultChunkSize = 16384
-    };
-
-protected:
-    virtual ~PODArena() { }
-    friend class WTF::RefCounted<PODArena>;
-
-    PODArena()
-        : m_allocator(FastMallocAllocator::create())
-        , m_current(0)
-        , m_currentChunkSize(DefaultChunkSize) { }
-
-    explicit PODArena(PassRefPtr<Allocator> allocator)
-        : m_allocator(allocator)
-        , m_current(0)
-        , m_currentChunkSize(DefaultChunkSize) { }
-
-    // Returns the alignment requirement for classes and structs on the
-    // current platform.
-    template <class T> static size_t minAlignment()
-    {
-        return WTF_ALIGN_OF(T);
-    }
-
-    template<class T> void* allocateBase()
-    {
-        void* ptr = 0;
-        size_t roundedSize = roundUp(sizeof(T), minAlignment<T>());
-        if (m_current)
-            ptr = m_current->allocate(roundedSize);
-
-        if (!ptr) {
-            if (roundedSize > m_currentChunkSize)
-                m_currentChunkSize = roundedSize;
-            m_chunks.append(adoptPtr(new Chunk(m_allocator.get(), m_currentChunkSize)));
-            m_current = m_chunks.last().get();
-            ptr = m_current->allocate(roundedSize);
-        }
-        return ptr;
-    }
-
-    // Rounds up the given allocation size to the specified alignment.
-    size_t roundUp(size_t size, size_t alignment)
-    {
-        ASSERT(!(alignment % 2));
-        return (size + alignment - 1) & ~(alignment - 1);
-    }
-
-    // Manages a chunk of memory and individual allocations out of it.
-    class Chunk {
-        WTF_MAKE_NONCOPYABLE(Chunk);
-    public:
-        // Allocates a block of memory of the given size from the passed
-        // Allocator.
-        Chunk(Allocator* allocator, size_t size)
-            : m_allocator(allocator)
-            , m_size(size)
-            , m_currentOffset(0)
-        {
-            m_base = static_cast<uint8_t*>(m_allocator->allocate(size));
-        }
-
-        // Frees the memory allocated from the Allocator in the
-        // constructor.
-        virtual ~Chunk()
-        {
-            m_allocator->free(m_base);
-        }
-
-        // Returns a pointer to "size" bytes of storage, or 0 if this
-        // Chunk could not satisfy the allocation.
-        void* allocate(size_t size)
-        {
-            // Check for overflow
-            if (m_currentOffset + size < m_currentOffset)
-                return 0;
-
-            if (m_currentOffset + size > m_size)
-                return 0;
-
-            void* result = m_base + m_currentOffset;
-            m_currentOffset += size;
-            return result;
-        }
-
-    protected:
-        Allocator* m_allocator;
-        uint8_t* m_base;
-        size_t m_size;
-        size_t m_currentOffset;
-    };
-
-    RefPtr<Allocator> m_allocator;
-    Chunk* m_current;
-    size_t m_currentChunkSize;
-    Vector<OwnPtr<Chunk> > m_chunks;
-};
-
-} // namespace WebCore
-
-#endif // PODArena_h
diff --git a/Source/core/platform/PODFreeListArena.h b/Source/core/platform/PODFreeListArena.h
deleted file mode 100644
index 2eacd2d..0000000
--- a/Source/core/platform/PODFreeListArena.h
+++ /dev/null
@@ -1,132 +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,
- * 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 PODFreeListArena_h
-#define PODFreeListArena_h
-
-#include "core/platform/PODArena.h"
-
-namespace WebCore {
-
-// FIXME: Disassociate PODFreeListArena from PODArena, crbug.com/266535
-template <class T>
-class PODFreeListArena : public PODArena {
-public:
-    typedef Vector<OwnPtr<Chunk> > ChunkVector;
-
-    static PassRefPtr<PODFreeListArena> create()
-    {
-        return adoptRef(new PODFreeListArena);
-    }
-
-    // Creates a new PODArena configured with the given Allocator.
-    static PassRefPtr<PODFreeListArena> create(PassRefPtr<Allocator> allocator)
-    {
-        return adoptRef(new PODFreeListArena(allocator));
-    }
-
-    // Allocates an object from the arena.
-    T* allocateObject()
-    {
-        size_t roundedSize = roundUp(sizeof(T), minAlignment<T>());
-        void* ptr = allocate(roundedSize);
-        if (ptr) {
-            // Use placement operator new to allocate a T at this location.
-            new(ptr) T();
-        }
-        return static_cast<T*>(ptr);
-    }
-
-    template<class Argument1Type> T* allocateObject(const Argument1Type& argument1)
-    {
-        size_t roundedSize = roundUp(sizeof(T), minAlignment<T>());
-        void* ptr = allocate(roundedSize);
-        if (ptr) {
-            // Use placement operator new to allocate a T at this location.
-            new(ptr) T(argument1);
-        }
-        return static_cast<T*>(ptr);
-    }
-
-    void freeObject(T* ptr)
-    {
-        FixedSizeMemoryChunk* oldFreeList = m_freeList;
-
-        m_freeList = reinterpret_cast<FixedSizeMemoryChunk*>(ptr);
-        m_freeList->next = oldFreeList;
-    }
-
-private:
-    PODFreeListArena()
-        : PODArena(), m_freeList(0) { }
-
-    explicit PODFreeListArena(PassRefPtr<Allocator> allocator)
-        : PODArena(allocator), m_freeList(0) { }
-
-    void* allocate(size_t size)
-    {
-        ASSERT(size == roundUp(sizeof(T), minAlignment<T>()));
-
-        if (m_freeList) {
-            void* memory = m_freeList;
-            m_freeList = m_freeList->next;
-            return memory;
-        }
-
-        void* memory = 0;
-        if (m_current)
-            memory = m_current->allocate(size);
-
-        if (!memory) {
-            m_chunks.append(adoptPtr(new Chunk(m_allocator.get(), m_currentChunkSize)));
-            m_current = m_chunks.last().get();
-            memory = m_current->allocate(size);
-        }
-        return memory;
-    }
-
-    int getFreeListSizeForTesting() const
-    {
-        int total = 0;
-        for (FixedSizeMemoryChunk* cur = m_freeList; cur; cur = cur->next) {
-            total++;
-        }
-        return total;
-    }
-
-    // This free list contains pointers within every chunk that's been allocated so
-    // far. None of the individual chunks can be freed until the arena is
-    // destroyed.
-    struct FixedSizeMemoryChunk {
-        FixedSizeMemoryChunk* next;
-    };
-    FixedSizeMemoryChunk* m_freeList;
-
-    friend class PODFreeListArenaTest;
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/platform/PODInterval.h b/Source/core/platform/PODInterval.h
deleted file mode 100644
index 925187c..0000000
--- a/Source/core/platform/PODInterval.h
+++ /dev/null
@@ -1,165 +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.
- */
-
-#ifndef PODInterval_h
-#define PODInterval_h
-
-#ifndef NDEBUG
-#include "wtf/text/StringBuilder.h"
-#endif
-
-namespace WebCore {
-
-// Class representing a closed interval which can hold an arbitrary
-// Plain Old Datatype (POD) as its endpoints and a piece of user
-// data. An important characteristic for the algorithms we use is that
-// if two intervals have identical endpoints but different user data,
-// they are not considered to be equal. This situation can arise when
-// representing the vertical extents of bounding boxes of overlapping
-// triangles, where the pointer to the triangle is the user data of
-// the interval.
-//
-// *Note* that the destructors of type T and UserData will *not* be
-// called by this class. They must not allocate any memory that is
-// required to be cleaned up in their destructors.
-//
-// The following constructors and operators must be implemented on
-// type T:
-//
-//   - Copy constructor (if user data is desired)
-//   - operator<
-//   - operator==
-//   - operator=
-//
-// If the UserData type is specified, it must support a copy
-// constructor and assignment operator.
-//
-// In debug mode, printing of intervals and the data they contain is
-// enabled. This requires the following template specializations to be
-// available:
-//
-//   template<> struct WebCore::ValueToString<T> {
-//       static String string(const T& t);
-//   };
-//   template<> struct WebCore::ValueToString<UserData> {
-//       static String string(const UserData& t);
-//   };
-//
-// Note that this class requires a copy constructor and assignment
-// operator in order to be stored in the red-black tree.
-
-#ifndef NDEBUG
-template<class T>
-struct ValueToString;
-#endif
-
-template<class T, class UserData = void*>
-class PODInterval {
-public:
-    // Constructor from endpoints. This constructor only works when the
-    // UserData type is a pointer or other type which can be initialized
-    // with 0.
-    PODInterval(const T& low, const T& high)
-        : m_low(low)
-        , m_high(high)
-        , m_data(0)
-        , m_maxHigh(high)
-    {
-    }
-
-    // Constructor from two endpoints plus explicit user data.
-    PODInterval(const T& low, const T& high, const UserData data)
-        : m_low(low)
-        , m_high(high)
-        , m_data(data)
-        , m_maxHigh(high)
-    {
-    }
-
-    const T& low() const { return m_low; }
-    const T& high() const { return m_high; }
-    const UserData& data() const { return m_data; }
-
-    bool overlaps(const T& low, const T& high) const
-    {
-        if (this->high() < low)
-            return false;
-        if (high < this->low())
-            return false;
-        return true;
-    }
-
-    bool overlaps(const PODInterval& other) const
-    {
-        return overlaps(other.low(), other.high());
-    }
-
-    // Returns true if this interval is "less" than the other. The
-    // comparison is performed on the low endpoints of the intervals.
-    bool operator<(const PODInterval& other) const
-    {
-        return low() < other.low();
-    }
-
-    // Returns true if this interval is strictly equal to the other,
-    // including comparison of the user data.
-    bool operator==(const PODInterval& other) const
-    {
-        return (low() == other.low()
-                && high() == other.high()
-                && data() == other.data());
-    }
-
-    const T& maxHigh() const { return m_maxHigh; }
-    void setMaxHigh(const T& maxHigh) { m_maxHigh = maxHigh; }
-
-#ifndef NDEBUG
-    // Support for printing PODIntervals.
-    String toString() const
-    {
-        StringBuilder builder;
-        builder.append("[PODInterval (");
-        builder.append(ValueToString<T>::string(low()));
-        builder.append(", ");
-        builder.append(ValueToString<T>::string(high()));
-        builder.append("), data=");
-        builder.append(ValueToString<UserData>::string(data()));
-        builder.append(", maxHigh=");
-        builder.append(ValueToString<T>::string(maxHigh()));
-        builder.append("]");
-        return builder.toString();
-    }
-#endif
-
-private:
-    T m_low;
-    T m_high;
-    UserData m_data;
-    T m_maxHigh;
-};
-
-} // namespace WebCore
-
-#endif // PODInterval_h
diff --git a/Source/core/platform/PODIntervalTree.h b/Source/core/platform/PODIntervalTree.h
deleted file mode 100644
index b3e11e2..0000000
--- a/Source/core/platform/PODIntervalTree.h
+++ /dev/null
@@ -1,266 +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.
- */
-
-#ifndef PODIntervalTree_h
-#define PODIntervalTree_h
-
-#include "core/platform/PODArena.h"
-#include "core/platform/PODInterval.h"
-#include "core/platform/PODRedBlackTree.h"
-#include "wtf/Assertions.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-#ifndef NDEBUG
-template<class T>
-struct ValueToString;
-#endif
-
-template <class T, class UserData = void*>
-class PODIntervalSearchAdapter {
-public:
-    typedef PODInterval<T, UserData> IntervalType;
-
-    PODIntervalSearchAdapter(Vector<IntervalType>& result, const T& lowValue, const T& highValue)
-        : m_result(result)
-        , m_lowValue(lowValue)
-        , m_highValue(highValue)
-    {
-    }
-
-    const T& lowValue() const { return m_lowValue; }
-    const T& highValue() const { return m_highValue; }
-    void collectIfNeeded(const IntervalType& data) const
-    {
-        if (data.overlaps(m_lowValue, m_highValue))
-            m_result.append(data);
-    }
-
-private:
-    Vector<IntervalType>& m_result;
-    T m_lowValue;
-    T m_highValue;
-};
-
-// An interval tree, which is a form of augmented red-black tree. It
-// supports efficient (O(lg n)) insertion, removal and querying of
-// intervals in the tree.
-template<class T, class UserData = void*>
-class PODIntervalTree : public PODRedBlackTree<PODInterval<T, UserData> > {
-    WTF_MAKE_NONCOPYABLE(PODIntervalTree);
-public:
-    // Typedef to reduce typing when declaring intervals to be stored in
-    // this tree.
-    typedef PODInterval<T, UserData> IntervalType;
-    typedef PODIntervalSearchAdapter<T, UserData> IntervalSearchAdapterType;
-
-    PODIntervalTree(UninitializedTreeEnum unitializedTree)
-        : PODRedBlackTree<IntervalType>(unitializedTree)
-    {
-        init();
-    }
-
-    PODIntervalTree()
-        : PODRedBlackTree<IntervalType>()
-    {
-        init();
-    }
-
-    explicit PODIntervalTree(PassRefPtr<PODArena> arena)
-        : PODRedBlackTree<IntervalType>(arena)
-    {
-        init();
-    }
-
-    // Returns all intervals in the tree which overlap the given query
-    // interval. The returned intervals are sorted by increasing low
-    // endpoint.
-    Vector<IntervalType> allOverlaps(const IntervalType& interval) const
-    {
-        Vector<IntervalType> result;
-        allOverlaps(interval, result);
-        return result;
-    }
-
-    // Returns all intervals in the tree which overlap the given query
-    // interval. The returned intervals are sorted by increasing low
-    // endpoint.
-    void allOverlaps(const IntervalType& interval, Vector<IntervalType>& result) const
-    {
-        // Explicit dereference of "this" required because of
-        // inheritance rules in template classes.
-        IntervalSearchAdapterType adapter(result, interval.low(), interval.high());
-        searchForOverlapsFrom<IntervalSearchAdapterType>(this->root(), adapter);
-    }
-
-    template <class AdapterType>
-    void allOverlapsWithAdapter(AdapterType& adapter) const
-    {
-        // Explicit dereference of "this" required because of
-        // inheritance rules in template classes.
-        searchForOverlapsFrom<AdapterType>(this->root(), adapter);
-    }
-
-    // Helper to create interval objects.
-    static IntervalType createInterval(const T& low, const T& high, const UserData data = 0)
-    {
-        return IntervalType(low, high, data);
-    }
-
-    virtual bool checkInvariants() const
-    {
-        if (!PODRedBlackTree<IntervalType>::checkInvariants())
-            return false;
-        if (!this->root())
-            return true;
-        return checkInvariantsFromNode(this->root(), 0);
-    }
-
-private:
-    typedef typename PODRedBlackTree<IntervalType>::Node IntervalNode;
-
-    // Initializes the tree.
-    void init()
-    {
-        // Explicit dereference of "this" required because of
-        // inheritance rules in template classes.
-        this->setNeedsFullOrderingComparisons(true);
-    }
-
-    // Starting from the given node, adds all overlaps with the given
-    // interval to the result vector. The intervals are sorted by
-    // increasing low endpoint.
-    template <class AdapterType>
-    void searchForOverlapsFrom(IntervalNode* node, AdapterType& adapter) const
-    {
-        if (!node)
-            return;
-
-        // Because the intervals are sorted by left endpoint, inorder
-        // traversal produces results sorted as desired.
-
-        // See whether we need to traverse the left subtree.
-        IntervalNode* left = node->left();
-        if (left
-            // This is phrased this way to avoid the need for operator
-            // <= on type T.
-            && !(left->data().maxHigh() < adapter.lowValue()))
-            searchForOverlapsFrom<AdapterType>(left, adapter);
-
-        // Check for overlap with current node.
-        adapter.collectIfNeeded(node->data());
-
-        // See whether we need to traverse the right subtree.
-        // This is phrased this way to avoid the need for operator <=
-        // on type T.
-        if (!(adapter.highValue() < node->data().low()))
-            searchForOverlapsFrom<AdapterType>(node->right(), adapter);
-    }
-
-    virtual bool updateNode(IntervalNode* node)
-    {
-        // Would use const T&, but need to reassign this reference in this
-        // function.
-        const T* curMax = &node->data().high();
-        IntervalNode* left = node->left();
-        if (left) {
-            if (*curMax < left->data().maxHigh())
-                curMax = &left->data().maxHigh();
-        }
-        IntervalNode* right = node->right();
-        if (right) {
-            if (*curMax < right->data().maxHigh())
-                curMax = &right->data().maxHigh();
-        }
-        // This is phrased like this to avoid needing operator!= on type T.
-        if (!(*curMax == node->data().maxHigh())) {
-            node->data().setMaxHigh(*curMax);
-            return true;
-        }
-        return false;
-    }
-
-    bool checkInvariantsFromNode(IntervalNode* node, T* currentMaxValue) const
-    {
-        // These assignments are only done in order to avoid requiring
-        // a default constructor on type T.
-        T leftMaxValue(node->data().maxHigh());
-        T rightMaxValue(node->data().maxHigh());
-        IntervalNode* left = node->left();
-        IntervalNode* right = node->right();
-        if (left) {
-            if (!checkInvariantsFromNode(left, &leftMaxValue))
-                return false;
-        }
-        if (right) {
-            if (!checkInvariantsFromNode(right, &rightMaxValue))
-                return false;
-        }
-        if (!left && !right) {
-            // Base case.
-            if (currentMaxValue)
-                *currentMaxValue = node->data().high();
-            return (node->data().high() == node->data().maxHigh());
-        }
-        T localMaxValue(node->data().maxHigh());
-        if (!left || !right) {
-            if (left)
-                localMaxValue = leftMaxValue;
-            else
-                localMaxValue = rightMaxValue;
-        } else
-            localMaxValue = (leftMaxValue < rightMaxValue) ? rightMaxValue : leftMaxValue;
-        if (localMaxValue < node->data().high())
-            localMaxValue = node->data().high();
-        if (!(localMaxValue == node->data().maxHigh())) {
-#ifndef NDEBUG
-            String localMaxValueString = ValueToString<T>::string(localMaxValue);
-            LOG_ERROR("PODIntervalTree verification failed at node 0x%p: localMaxValue=%s and data=%s",
-                      node, localMaxValueString.utf8().data(), node->data().toString().utf8().data());
-#endif
-            return false;
-        }
-        if (currentMaxValue)
-            *currentMaxValue = localMaxValue;
-        return true;
-    }
-};
-
-#ifndef NDEBUG
-// Support for printing PODIntervals at the PODRedBlackTree level.
-template<class T, class UserData>
-struct ValueToString<PODInterval<T, UserData> > {
-    static String string(const PODInterval<T, UserData>& interval)
-    {
-        return interval.toString();
-    }
-};
-#endif
-
-} // namespace WebCore
-
-#endif // PODIntervalTree_h
diff --git a/Source/core/platform/PODRedBlackTree.h b/Source/core/platform/PODRedBlackTree.h
deleted file mode 100644
index 80a7160..0000000
--- a/Source/core/platform/PODRedBlackTree.h
+++ /dev/null
@@ -1,827 +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.
- */
-
-// A red-black tree, which is a form of a balanced binary tree. It
-// supports efficient insertion, deletion and queries of comparable
-// elements. The same element may be inserted multiple times. The
-// algorithmic complexity of common operations is:
-//
-//   Insertion: O(lg(n))
-//   Deletion:  O(lg(n))
-//   Querying:  O(lg(n))
-//
-// The data type T that is stored in this red-black tree must be only
-// Plain Old Data (POD), or bottom out into POD. It must _not_ rely on
-// having its destructor called. This implementation internally
-// allocates storage in large chunks and does not call the destructor
-// on each object.
-//
-// Type T must supply a default constructor, a copy constructor, and
-// the "<" and "==" operators.
-//
-// In debug mode, printing of the data contained in the tree is
-// enabled. This requires the template specialization to be available:
-//
-//   template<> struct WebCore::ValueToString<T> {
-//       static String string(const T& t);
-//   };
-//
-// Note that when complex types are stored in this red/black tree, it
-// is possible that single invocations of the "<" and "==" operators
-// will be insufficient to describe the ordering of elements in the
-// tree during queries. As a concrete example, consider the case where
-// intervals are stored in the tree sorted by low endpoint. The "<"
-// operator on the Interval class only compares the low endpoint, but
-// the "==" operator takes into account the high endpoint as well.
-// This makes the necessary logic for querying and deletion somewhat
-// more complex. In order to properly handle such situations, the
-// property "needsFullOrderingComparisons" must be set to true on
-// the tree.
-//
-// This red-black tree is designed to be _augmented_; subclasses can
-// add additional and summary information to each node to efficiently
-// store and index more complex data structures. A concrete example is
-// the IntervalTree, which extends each node with a summary statistic
-// to efficiently store one-dimensional intervals.
-//
-// The design of this red-black tree comes from Cormen, Leiserson,
-// and Rivest, _Introduction to Algorithms_, MIT Press, 1990.
-
-#ifndef PODRedBlackTree_h
-#define PODRedBlackTree_h
-
-#include "core/platform/PODFreeListArena.h"
-#include "wtf/Assertions.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/RefPtr.h"
-#ifndef NDEBUG
-#include "wtf/text/CString.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/WTFString.h"
-#endif
-
-namespace WebCore {
-
-#ifndef NDEBUG
-template<class T>
-struct ValueToString;
-#endif
-
-enum UninitializedTreeEnum {
-    UninitializedTree
-};
-
-template<class T>
-class PODRedBlackTree {
-public:
-    class Node;
-
-    // Visitor interface for walking all of the tree's elements.
-    class Visitor {
-    public:
-        virtual void visit(const T& data) = 0;
-    protected:
-        virtual ~Visitor() { }
-    };
-
-    // Constructs a new red-black tree without allocating an arena.
-    // isInitialized will return false in this case. initIfNeeded can be used
-    // to init the structure. This constructor is usefull for creating
-    // lazy initialized tree.
-    explicit PODRedBlackTree(UninitializedTreeEnum)
-        : m_root(0)
-        , m_needsFullOrderingComparisons(false)
-#ifndef NDEBUG
-        , m_verboseDebugging(false)
-#endif
-    {
-    }
-
-    // Constructs a new red-black tree, allocating temporary objects
-    // from a newly constructed PODFreeListArena.
-    PODRedBlackTree()
-        : m_arena(PODFreeListArena<Node>::create())
-        , m_root(0)
-        , m_needsFullOrderingComparisons(false)
-#ifndef NDEBUG
-        , m_verboseDebugging(false)
-#endif
-    {
-    }
-
-    // Constructs a new red-black tree, allocating temporary objects
-    // from the given PODArena.
-    explicit PODRedBlackTree(PassRefPtr<PODFreeListArena<Node> > arena)
-        : m_arena(arena)
-        , m_root(0)
-        , m_needsFullOrderingComparisons(false)
-#ifndef NDEBUG
-        , m_verboseDebugging(false)
-#endif
-    {
-    }
-
-    virtual ~PODRedBlackTree() { }
-
-    // Clearing will delete the contents of the tree. After this call
-    // isInitialized will return false.
-    void clear()
-    {
-        markFree(m_root);
-        m_arena = 0;
-        m_root = 0;
-    }
-
-    bool isInitialized() const
-    {
-        return m_arena;
-    }
-
-    void initIfNeeded()
-    {
-        if (!m_arena)
-            m_arena = PODFreeListArena<Node>::create();
-    }
-
-    void initIfNeeded(PODFreeListArena<Node>* arena)
-    {
-        if (!m_arena)
-            m_arena = arena;
-    }
-
-    void add(const T& data)
-    {
-        ASSERT(isInitialized());
-        Node* node = m_arena->template allocateObject<T>(data);
-        insertNode(node);
-    }
-
-    // Returns true if the datum was found in the tree.
-    bool remove(const T& data)
-    {
-        ASSERT(isInitialized());
-        Node* node = treeSearch(data);
-        if (node) {
-            deleteNode(node);
-            return true;
-        }
-        return false;
-    }
-
-    bool contains(const T& data) const
-    {
-        ASSERT(isInitialized());
-        return treeSearch(data);
-    }
-
-    void visitInorder(Visitor* visitor) const
-    {
-        ASSERT(isInitialized());
-        if (!m_root)
-            return;
-        visitInorderImpl(m_root, visitor);
-    }
-
-    int size() const
-    {
-        ASSERT(isInitialized());
-        Counter counter;
-        visitInorder(&counter);
-        return counter.count();
-    }
-
-    // See the class documentation for an explanation of this property.
-    void setNeedsFullOrderingComparisons(bool needsFullOrderingComparisons)
-    {
-        m_needsFullOrderingComparisons = needsFullOrderingComparisons;
-    }
-
-    virtual bool checkInvariants() const
-    {
-        ASSERT(isInitialized());
-        int blackCount;
-        return checkInvariantsFromNode(m_root, &blackCount);
-    }
-
-#ifndef NDEBUG
-    // Dumps the tree's contents to the logging info stream for
-    // debugging purposes.
-    void dump() const
-    {
-        if (m_arena)
-            dumpFromNode(m_root, 0);
-    }
-
-    // Turns on or off verbose debugging of the tree, causing many
-    // messages to be logged during insertion and other operations in
-    // debug mode.
-    void setVerboseDebugging(bool verboseDebugging)
-    {
-        m_verboseDebugging = verboseDebugging;
-    }
-#endif
-
-    enum Color {
-        Red = 1,
-        Black
-    };
-
-    // The base Node class which is stored in the tree. Nodes are only
-    // an internal concept; users of the tree deal only with the data
-    // they store in it.
-    class Node {
-        WTF_MAKE_NONCOPYABLE(Node);
-    public:
-        // Constructor. Newly-created nodes are colored red.
-        explicit Node(const T& data)
-            : m_left(0)
-            , m_right(0)
-            , m_parent(0)
-            , m_color(Red)
-            , m_data(data)
-        {
-        }
-
-        virtual ~Node() { }
-
-        Color color() const { return m_color; }
-        void setColor(Color color) { m_color = color; }
-
-        // Fetches the user data.
-        T& data() { return m_data; }
-
-        // Copies all user-level fields from the source node, but not
-        // internal fields. For example, the base implementation of this
-        // method copies the "m_data" field, but not the child or parent
-        // fields. Any augmentation information also does not need to be
-        // copied, as it will be recomputed. Subclasses must call the
-        // superclass implementation.
-        virtual void copyFrom(Node* src) { m_data = src->data(); }
-
-        Node* left() const { return m_left; }
-        void setLeft(Node* node) { m_left = node; }
-
-        Node* right() const { return m_right; }
-        void setRight(Node* node) { m_right = node; }
-
-        Node* parent() const { return m_parent; }
-        void setParent(Node* node) { m_parent = node; }
-
-    private:
-        Node* m_left;
-        Node* m_right;
-        Node* m_parent;
-        Color m_color;
-        T m_data;
-    };
-
-protected:
-    // Returns the root of the tree, which is needed by some subclasses.
-    Node* root() const { return m_root; }
-
-private:
-    // This virtual method is the hook that subclasses should use when
-    // augmenting the red-black tree with additional per-node summary
-    // information. For example, in the case of an interval tree, this
-    // is used to compute the maximum endpoint of the subtree below the
-    // given node based on the values in the left and right children. It
-    // is guaranteed that this will be called in the correct order to
-    // properly update such summary information based only on the values
-    // in the left and right children. This method should return true if
-    // the node's summary information changed.
-    virtual bool updateNode(Node*) { return false; }
-
-    //----------------------------------------------------------------------
-    // Generic binary search tree operations
-    //
-
-    // Searches the tree for the given datum.
-    Node* treeSearch(const T& data) const
-    {
-        if (m_needsFullOrderingComparisons)
-            return treeSearchFullComparisons(m_root, data);
-
-        return treeSearchNormal(m_root, data);
-    }
-
-    // Searches the tree using the normal comparison operations,
-    // suitable for simple data types such as numbers.
-    Node* treeSearchNormal(Node* current, const T& data) const
-    {
-        while (current) {
-            if (current->data() == data)
-                return current;
-            if (data < current->data())
-                current = current->left();
-            else
-                current = current->right();
-        }
-        return 0;
-    }
-
-    // Searches the tree using multiple comparison operations, required
-    // for data types with more complex behavior such as intervals.
-    Node* treeSearchFullComparisons(Node* current, const T& data) const
-    {
-        if (!current)
-            return 0;
-        if (data < current->data())
-            return treeSearchFullComparisons(current->left(), data);
-        if (current->data() < data)
-            return treeSearchFullComparisons(current->right(), data);
-        if (data == current->data())
-            return current;
-
-        // We may need to traverse both the left and right subtrees.
-        Node* result = treeSearchFullComparisons(current->left(), data);
-        if (!result)
-            result = treeSearchFullComparisons(current->right(), data);
-        return result;
-    }
-
-    void treeInsert(Node* z)
-    {
-        Node* y = 0;
-        Node* x = m_root;
-        while (x) {
-            y = x;
-            if (z->data() < x->data())
-                x = x->left();
-            else
-                x = x->right();
-        }
-        z->setParent(y);
-        if (!y)
-            m_root = z;
-        else {
-            if (z->data() < y->data())
-                y->setLeft(z);
-            else
-                y->setRight(z);
-        }
-    }
-
-    // Finds the node following the given one in sequential ordering of
-    // their data, or null if none exists.
-    Node* treeSuccessor(Node* x)
-    {
-        if (x->right())
-            return treeMinimum(x->right());
-        Node* y = x->parent();
-        while (y && x == y->right()) {
-            x = y;
-            y = y->parent();
-        }
-        return y;
-    }
-
-    // Finds the minimum element in the sub-tree rooted at the given
-    // node.
-    Node* treeMinimum(Node* x)
-    {
-        while (x->left())
-            x = x->left();
-        return x;
-    }
-
-    // Helper for maintaining the augmented red-black tree.
-    void propagateUpdates(Node* start)
-    {
-        bool shouldContinue = true;
-        while (start && shouldContinue) {
-            shouldContinue = updateNode(start);
-            start = start->parent();
-        }
-    }
-
-    //----------------------------------------------------------------------
-    // Red-Black tree operations
-    //
-
-    // Left-rotates the subtree rooted at x.
-    // Returns the new root of the subtree (x's right child).
-    Node* leftRotate(Node* x)
-    {
-        // Set y.
-        Node* y = x->right();
-
-        // Turn y's left subtree into x's right subtree.
-        x->setRight(y->left());
-        if (y->left())
-            y->left()->setParent(x);
-
-        // Link x's parent to y.
-        y->setParent(x->parent());
-        if (!x->parent())
-            m_root = y;
-        else {
-            if (x == x->parent()->left())
-                x->parent()->setLeft(y);
-            else
-                x->parent()->setRight(y);
-        }
-
-        // Put x on y's left.
-        y->setLeft(x);
-        x->setParent(y);
-
-        // Update nodes lowest to highest.
-        updateNode(x);
-        updateNode(y);
-        return y;
-    }
-
-    // Right-rotates the subtree rooted at y.
-    // Returns the new root of the subtree (y's left child).
-    Node* rightRotate(Node* y)
-    {
-        // Set x.
-        Node* x = y->left();
-
-        // Turn x's right subtree into y's left subtree.
-        y->setLeft(x->right());
-        if (x->right())
-            x->right()->setParent(y);
-
-        // Link y's parent to x.
-        x->setParent(y->parent());
-        if (!y->parent())
-            m_root = x;
-        else {
-            if (y == y->parent()->left())
-                y->parent()->setLeft(x);
-            else
-                y->parent()->setRight(x);
-        }
-
-        // Put y on x's right.
-        x->setRight(y);
-        y->setParent(x);
-
-        // Update nodes lowest to highest.
-        updateNode(y);
-        updateNode(x);
-        return x;
-    }
-
-    // Inserts the given node into the tree.
-    void insertNode(Node* x)
-    {
-        treeInsert(x);
-        x->setColor(Red);
-        updateNode(x);
-
-        logIfVerbose("  PODRedBlackTree::InsertNode");
-
-        // The node from which to start propagating updates upwards.
-        Node* updateStart = x->parent();
-
-        while (x != m_root && x->parent()->color() == Red) {
-            if (x->parent() == x->parent()->parent()->left()) {
-                Node* y = x->parent()->parent()->right();
-                if (y && y->color() == Red) {
-                    // Case 1
-                    logIfVerbose("  Case 1/1");
-                    x->parent()->setColor(Black);
-                    y->setColor(Black);
-                    x->parent()->parent()->setColor(Red);
-                    updateNode(x->parent());
-                    x = x->parent()->parent();
-                    updateNode(x);
-                    updateStart = x->parent();
-                } else {
-                    if (x == x->parent()->right()) {
-                        logIfVerbose("  Case 1/2");
-                        // Case 2
-                        x = x->parent();
-                        leftRotate(x);
-                    }
-                    // Case 3
-                    logIfVerbose("  Case 1/3");
-                    x->parent()->setColor(Black);
-                    x->parent()->parent()->setColor(Red);
-                    Node* newSubTreeRoot = rightRotate(x->parent()->parent());
-                    updateStart = newSubTreeRoot->parent();
-                }
-            } else {
-                // Same as "then" clause with "right" and "left" exchanged.
-                Node* y = x->parent()->parent()->left();
-                if (y && y->color() == Red) {
-                    // Case 1
-                    logIfVerbose("  Case 2/1");
-                    x->parent()->setColor(Black);
-                    y->setColor(Black);
-                    x->parent()->parent()->setColor(Red);
-                    updateNode(x->parent());
-                    x = x->parent()->parent();
-                    updateNode(x);
-                    updateStart = x->parent();
-                } else {
-                    if (x == x->parent()->left()) {
-                        // Case 2
-                        logIfVerbose("  Case 2/2");
-                        x = x->parent();
-                        rightRotate(x);
-                    }
-                    // Case 3
-                    logIfVerbose("  Case 2/3");
-                    x->parent()->setColor(Black);
-                    x->parent()->parent()->setColor(Red);
-                    Node* newSubTreeRoot = leftRotate(x->parent()->parent());
-                    updateStart = newSubTreeRoot->parent();
-                }
-            }
-        }
-
-        propagateUpdates(updateStart);
-
-        m_root->setColor(Black);
-    }
-
-    // Restores the red-black property to the tree after splicing out
-    // a node. Note that x may be null, which is why xParent must be
-    // supplied.
-    void deleteFixup(Node* x, Node* xParent)
-    {
-        while (x != m_root && (!x || x->color() == Black)) {
-            if (x == xParent->left()) {
-                // Note: the text points out that w can not be null.
-                // The reason is not obvious from simply looking at
-                // the code; it comes about from the properties of the
-                // red-black tree.
-                Node* w = xParent->right();
-                ASSERT(w); // x's sibling should not be null.
-                if (w->color() == Red) {
-                    // Case 1
-                    w->setColor(Black);
-                    xParent->setColor(Red);
-                    leftRotate(xParent);
-                    w = xParent->right();
-                }
-                if ((!w->left() || w->left()->color() == Black)
-                    && (!w->right() || w->right()->color() == Black)) {
-                    // Case 2
-                    w->setColor(Red);
-                    x = xParent;
-                    xParent = x->parent();
-                } else {
-                    if (!w->right() || w->right()->color() == Black) {
-                        // Case 3
-                        w->left()->setColor(Black);
-                        w->setColor(Red);
-                        rightRotate(w);
-                        w = xParent->right();
-                    }
-                    // Case 4
-                    w->setColor(xParent->color());
-                    xParent->setColor(Black);
-                    if (w->right())
-                        w->right()->setColor(Black);
-                    leftRotate(xParent);
-                    x = m_root;
-                    xParent = x->parent();
-                }
-            } else {
-                // Same as "then" clause with "right" and "left"
-                // exchanged.
-
-                // Note: the text points out that w can not be null.
-                // The reason is not obvious from simply looking at
-                // the code; it comes about from the properties of the
-                // red-black tree.
-                Node* w = xParent->left();
-                ASSERT(w); // x's sibling should not be null.
-                if (w->color() == Red) {
-                    // Case 1
-                    w->setColor(Black);
-                    xParent->setColor(Red);
-                    rightRotate(xParent);
-                    w = xParent->left();
-                }
-                if ((!w->right() || w->right()->color() == Black)
-                    && (!w->left() || w->left()->color() == Black)) {
-                    // Case 2
-                    w->setColor(Red);
-                    x = xParent;
-                    xParent = x->parent();
-                } else {
-                    if (!w->left() || w->left()->color() == Black) {
-                        // Case 3
-                        w->right()->setColor(Black);
-                        w->setColor(Red);
-                        leftRotate(w);
-                        w = xParent->left();
-                    }
-                    // Case 4
-                    w->setColor(xParent->color());
-                    xParent->setColor(Black);
-                    if (w->left())
-                        w->left()->setColor(Black);
-                    rightRotate(xParent);
-                    x = m_root;
-                    xParent = x->parent();
-                }
-            }
-        }
-        if (x)
-            x->setColor(Black);
-    }
-
-    // Deletes the given node from the tree. Note that this
-    // particular node may not actually be removed from the tree;
-    // instead, another node might be removed and its contents
-    // copied into z.
-    void deleteNode(Node* z)
-    {
-        // Y is the node to be unlinked from the tree.
-        Node* y;
-        if (!z->left() || !z->right())
-            y = z;
-        else
-            y = treeSuccessor(z);
-
-        // Y is guaranteed to be non-null at this point.
-        Node* x;
-        if (y->left())
-            x = y->left();
-        else
-            x = y->right();
-
-        // X is the child of y which might potentially replace y in
-        // the tree. X might be null at this point.
-        Node* xParent;
-        if (x) {
-            x->setParent(y->parent());
-            xParent = x->parent();
-        } else
-            xParent = y->parent();
-        if (!y->parent())
-            m_root = x;
-        else {
-            if (y == y->parent()->left())
-                y->parent()->setLeft(x);
-            else
-                y->parent()->setRight(x);
-        }
-        if (y != z) {
-            z->copyFrom(y);
-            // This node has changed location in the tree and must be updated.
-            updateNode(z);
-            // The parent and its parents may now be out of date.
-            propagateUpdates(z->parent());
-        }
-
-        // If we haven't already updated starting from xParent, do so now.
-        if (xParent && xParent != y && xParent != z)
-            propagateUpdates(xParent);
-        if (y->color() == Black)
-            deleteFixup(x, xParent);
-
-        m_arena->freeObject(y);
-    }
-
-    // Visits the subtree rooted at the given node in order.
-    void visitInorderImpl(Node* node, Visitor* visitor) const
-    {
-        if (node->left())
-            visitInorderImpl(node->left(), visitor);
-        visitor->visit(node->data());
-        if (node->right())
-            visitInorderImpl(node->right(), visitor);
-    }
-
-    void markFree(Node *node)
-    {
-        if (!node)
-            return;
-
-        if (node->left())
-            markFree(node->left());
-        if (node->right())
-            markFree(node->right());
-        m_arena->freeObject(node);
-    }
-
-    //----------------------------------------------------------------------
-    // Helper class for size()
-
-    // A Visitor which simply counts the number of visited elements.
-    class Counter : public Visitor {
-        WTF_MAKE_NONCOPYABLE(Counter);
-    public:
-        Counter()
-            : m_count(0) { }
-
-        virtual void visit(const T&) { ++m_count; }
-        int count() const { return m_count; }
-
-    private:
-        int m_count;
-    };
-
-    //----------------------------------------------------------------------
-    // Verification and debugging routines
-    //
-
-    // Returns in the "blackCount" parameter the number of black
-    // children along all paths to all leaves of the given node.
-    bool checkInvariantsFromNode(Node* node, int* blackCount) const
-    {
-        // Base case is a leaf node.
-        if (!node) {
-            *blackCount = 1;
-            return true;
-        }
-
-        // Each node is either red or black.
-        if (!(node->color() == Red || node->color() == Black))
-            return false;
-
-        // Every leaf (or null) is black.
-
-        if (node->color() == Red) {
-            // Both of its children are black.
-            if (!((!node->left() || node->left()->color() == Black)))
-                return false;
-            if (!((!node->right() || node->right()->color() == Black)))
-                return false;
-        }
-
-        // Every simple path to a leaf node contains the same number of
-        // black nodes.
-        int leftCount = 0, rightCount = 0;
-        bool leftValid = checkInvariantsFromNode(node->left(), &leftCount);
-        bool rightValid = checkInvariantsFromNode(node->right(), &rightCount);
-        if (!leftValid || !rightValid)
-            return false;
-        *blackCount = leftCount + (node->color() == Black ? 1 : 0);
-        return leftCount == rightCount;
-    }
-
-#ifdef NDEBUG
-    void logIfVerbose(const char*) const { }
-#else
-    void logIfVerbose(const char* output) const
-    {
-        if (m_verboseDebugging)
-            LOG_ERROR("%s", output);
-    }
-#endif
-
-#ifndef NDEBUG
-    // Dumps the subtree rooted at the given node.
-    void dumpFromNode(Node* node, int indentation) const
-    {
-        StringBuilder builder;
-        for (int i = 0; i < indentation; i++)
-            builder.append(" ");
-        builder.append("-");
-        if (node) {
-            builder.append(" ");
-            builder.append(ValueToString<T>::string(node->data()));
-            builder.append((node->color() == Black) ? " (black)" : " (red)");
-        }
-        LOG_ERROR("%s", builder.toString().ascii().data());
-        if (node) {
-            dumpFromNode(node->left(), indentation + 2);
-            dumpFromNode(node->right(), indentation + 2);
-        }
-    }
-#endif
-
-    //----------------------------------------------------------------------
-    // Data members
-
-    RefPtr<PODFreeListArena<Node> > m_arena;
-    Node* m_root;
-    bool m_needsFullOrderingComparisons;
-#ifndef NDEBUG
-    bool m_verboseDebugging;
-#endif
-};
-
-} // namespace WebCore
-
-#endif // PODRedBlackTree_h
diff --git a/Source/core/platform/Partitions.cpp b/Source/core/platform/Partitions.cpp
deleted file mode 100644
index 05ee880..0000000
--- a/Source/core/platform/Partitions.cpp
+++ /dev/null
@@ -1,55 +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.
- */
-
-
-#include "config.h"
-#include "core/platform/Partitions.h"
-
-namespace WebCore {
-
-PartitionAllocator<3072> Partitions::m_objectModelAllocator;
-PartitionAllocator<1024> Partitions::m_renderingAllocator;
-
-void Partitions::init()
-{
-    m_objectModelAllocator.init();
-    m_renderingAllocator.init();
-}
-
-void Partitions::shutdown()
-{
-    // We could ASSERT here for a memory leak within the partition, but it leads
-    // to very hard to diagnose ASSERTs, so it's best to leave leak checking for
-    // the valgrind and heapcheck bots, which run without partitions.
-    (void) m_renderingAllocator.shutdown();
-    (void) m_objectModelAllocator.shutdown();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/Partitions.h b/Source/core/platform/Partitions.h
deleted file mode 100644
index 6f20e70..0000000
--- a/Source/core/platform/Partitions.h
+++ /dev/null
@@ -1,53 +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 Partitions_h
-#define Partitions_h
-
-#include "wtf/PartitionAlloc.h"
-
-namespace WebCore {
-
-class Partitions {
-public:
-    static void init();
-    static void shutdown();
-
-    ALWAYS_INLINE static PartitionRoot* getObjectModelPartition() { return m_objectModelAllocator.root(); }
-    ALWAYS_INLINE static PartitionRoot* getRenderingPartition() { return m_renderingAllocator.root(); }
-
-private:
-    static PartitionAllocator<3072> m_objectModelAllocator;
-    static PartitionAllocator<1024> m_renderingAllocator;
-};
-
-} // namespace WebCore
-
-#endif // Partitions_h
diff --git a/Source/core/platform/Pasteboard.cpp b/Source/core/platform/Pasteboard.cpp
index 0c36c92..c34633a 100644
--- a/Source/core/platform/Pasteboard.cpp
+++ b/Source/core/platform/Pasteboard.cpp
@@ -34,22 +34,21 @@
 #include "HTMLNames.h"
 #include "SVGNames.h"
 #include "XLinkNames.h"
-#include "core/dom/Document.h"
-#include "core/dom/DocumentFragment.h"
 #include "core/dom/Element.h"
 #include "core/dom/Range.h"
 #include "core/editing/markup.h"
 #include "core/fetch/ImageResource.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/page/Frame.h"
 #include "core/platform/chromium/ChromiumDataObject.h"
-#include "core/platform/chromium/ClipboardUtilitiesChromium.h"
 #include "core/platform/graphics/Image.h"
 #include "core/platform/graphics/skia/NativeImageSkia.h"
 #include "core/rendering/RenderImage.h"
+#include "platform/clipboard/ClipboardUtilities.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebClipboard.h"
 #include "public/platform/WebDragData.h"
+#include "public/platform/WebString.h"
+#include "public/platform/WebURL.h"
 #include "weborigin/KURL.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
@@ -102,20 +101,6 @@
 #endif
 }
 
-void Pasteboard::writeURL(const KURL& url, const String& titleStr)
-{
-    ASSERT(!url.isEmpty());
-
-    String title(titleStr);
-    if (title.isEmpty()) {
-        title = url.lastPathComponent();
-        if (title.isEmpty())
-            title = url.host();
-    }
-
-    WebKit::Platform::current()->clipboard()->writeURL(url, title);
-}
-
 void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
 {
     ASSERT(node);
@@ -158,37 +143,29 @@
     return WebKit::Platform::current()->clipboard()->isFormatAvailable(WebKit::WebClipboard::FormatSmartPaste, m_buffer);
 }
 
+bool Pasteboard::isHTMLAvailable()
+{
+    return WebKit::Platform::current()->clipboard()->isFormatAvailable(WebKit::WebClipboard::FormatHTML, m_buffer);
+}
+
 String Pasteboard::plainText()
 {
     return WebKit::Platform::current()->clipboard()->readPlainText(m_buffer);
 }
 
-PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
+String Pasteboard::readHTML(KURL& url, unsigned& fragmentStart, unsigned& fragmentEnd)
 {
-    chosePlainText = false;
-
-    if (WebKit::Platform::current()->clipboard()->isFormatAvailable(WebKit::WebClipboard::FormatHTML, m_buffer)) {
-        unsigned fragmentStart = 0;
-        unsigned fragmentEnd = 0;
-        WebKit::WebURL url;
-        WebKit::WebString markup = WebKit::Platform::current()->clipboard()->readHTML(m_buffer, &url, &fragmentStart, &fragmentEnd);
-        if (!markup.isEmpty()) {
-            ASSERT(frame->document());
-            if (RefPtr<DocumentFragment> fragment = createFragmentFromMarkupWithContext(*frame->document(), markup, fragmentStart, fragmentEnd, KURL(url), DisallowScriptingAndPluginContent))
-                return fragment.release();
-        }
+    WebKit::WebURL webURL;
+    WebKit::WebString markup = WebKit::Platform::current()->clipboard()->readHTML(m_buffer, &webURL, &fragmentStart, &fragmentEnd);
+    if (!markup.isEmpty()) {
+        url = webURL;
+        // fragmentStart and fragmentEnd are populated by WebClipboard::readHTML.
+    } else {
+        url = KURL();
+        fragmentStart = 0;
+        fragmentEnd = 0;
     }
-
-    if (allowPlainText) {
-        String markup = WebKit::Platform::current()->clipboard()->readPlainText(m_buffer);
-        if (!markup.isEmpty()) {
-            chosePlainText = true;
-            if (RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), markup))
-                return fragment.release();
-        }
-    }
-
-    return 0;
+    return markup;
 }
 
 } // namespace WebCore
diff --git a/Source/core/platform/Pasteboard.h b/Source/core/platform/Pasteboard.h
index 58a498e..4664460 100644
--- a/Source/core/platform/Pasteboard.h
+++ b/Source/core/platform/Pasteboard.h
@@ -28,7 +28,6 @@
 
 #include "public/platform/WebClipboard.h"
 #include "wtf/Forward.h"
-#include "wtf/HashSet.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/text/WTFString.h"
 #include "wtf/Vector.h"
@@ -39,15 +38,10 @@
 
 namespace WebCore {
 
-class ArchiveResource;
 class ChromiumDataObject;
-class DocumentFragment;
-class Frame;
-class HitTestResult;
 class KURL;
 class Node;
 class Range;
-class SharedBuffer;
 
 class Pasteboard {
     WTF_MAKE_NONCOPYABLE(Pasteboard); WTF_MAKE_FAST_ALLOCATED;
@@ -60,16 +54,24 @@
     static Pasteboard* generalPasteboard();
     void writeSelection(Range*, bool canSmartCopyOrDelete, const String& text);
     void writePlainText(const String&, SmartReplaceOption);
-    void writeURL(const KURL&, const String&);
     void writeImage(Node*, const KURL&, const String& title);
     void writeDataObject(PassRefPtr<ChromiumDataObject>);
     bool canSmartReplace();
-    PassRefPtr<DocumentFragment> documentFragment(Frame*, PassRefPtr<Range>, bool allowPlainText, bool& chosePlainText);
+    bool isHTMLAvailable();
     String plainText();
 
+    // If no data is read, an empty string will be returned and all out parameters will be cleared.
+    // If applicable, the page URL will be assigned to the KURL parameter.
+    // fragmentStart and fragmentEnd are indexes into the returned markup that indicate
+    // the start and end of the returned markup. If there is no additional context,
+    // fragmentStart will be zero and fragmentEnd will be the same as the length of the markup.
+    String readHTML(KURL&, unsigned& fragmentStart, unsigned& fragmentEnd);
+
     bool isSelectionMode() const;
     void setSelectionMode(bool);
 
+    WebKit::WebClipboard::Buffer buffer() const { return m_buffer; }
+
 private:
     Pasteboard();
 
diff --git a/Source/core/platform/PlatformEvent.cpp b/Source/core/platform/PlatformEvent.cpp
deleted file mode 100644
index 28bfb2b..0000000
--- a/Source/core/platform/PlatformEvent.cpp
+++ /dev/null
@@ -1,27 +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 INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/platform/PlatformEvent.h"
diff --git a/Source/core/platform/PlatformEvent.h b/Source/core/platform/PlatformEvent.h
deleted file mode 100644
index ff14a97..0000000
--- a/Source/core/platform/PlatformEvent.h
+++ /dev/null
@@ -1,142 +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 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 PlatformEvent_h
-#define PlatformEvent_h
-
-namespace WebCore {
-
-class PlatformEvent {
-public:
-    enum Type {
-        NoType = 0,
-
-        // PlatformKeyboardEvent
-        KeyDown,
-        KeyUp,
-        RawKeyDown,
-        Char,
-
-        // PlatformMouseEvent
-        MouseMoved,
-        MousePressed,
-        MouseReleased,
-        MouseScroll,
-
-        // PlatformWheelEvent
-        Wheel,
-
-        // PlatformGestureEvent
-        GestureScrollBegin,
-        GestureScrollEnd,
-        GestureScrollUpdate,
-        GestureScrollUpdateWithoutPropagation,
-        GestureTap,
-        GestureTapUnconfirmed,
-        GestureTapDown,
-        GestureTapDownCancel,
-        GestureTwoFingerTap,
-        GestureLongPress,
-        GestureLongTap,
-        GesturePinchBegin,
-        GesturePinchEnd,
-        GesturePinchUpdate,
-
-        // PlatformTouchEvent
-        TouchStart,
-        TouchMove,
-        TouchEnd,
-        TouchCancel,
-    };
-
-    enum Modifiers {
-        AltKey      = 1 << 0,
-        CtrlKey     = 1 << 1,
-        MetaKey     = 1 << 2,
-        ShiftKey    = 1 << 3,
-    };
-
-    Type type() const { return static_cast<Type>(m_type); }
-
-    bool shiftKey() const { return m_modifiers & ShiftKey; }
-    bool ctrlKey() const { return m_modifiers & CtrlKey; }
-    bool altKey() const { return m_modifiers & AltKey; }
-    bool metaKey() const { return m_modifiers & MetaKey; }
-
-    unsigned modifiers() const { return m_modifiers; }
-
-    double timestamp() const { return m_timestamp; }
-
-protected:
-    PlatformEvent()
-        : m_type(NoType)
-        , m_modifiers(0)
-        , m_timestamp(0)
-    {
-    }
-
-    explicit PlatformEvent(Type type)
-        : m_type(type)
-        , m_modifiers(0)
-        , m_timestamp(0)
-    {
-    }
-
-    PlatformEvent(Type type, Modifiers modifiers, double timestamp)
-        : m_type(type)
-        , m_modifiers(modifiers)
-        , m_timestamp(timestamp)
-    {
-    }
-
-    PlatformEvent(Type type, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp)
-        : m_type(type)
-        , m_modifiers(0)
-        , m_timestamp(timestamp)
-    {
-        if (shiftKey)
-            m_modifiers |= ShiftKey;
-        if (ctrlKey)
-            m_modifiers |= CtrlKey;
-        if (altKey)
-            m_modifiers |= AltKey;
-        if (metaKey)
-            m_modifiers |= MetaKey;
-    }
-
-    // Explicit protected destructor so that people don't accidentally
-    // delete a PlatformEvent.
-    ~PlatformEvent()
-    {
-    }
-
-    unsigned m_type;
-    unsigned m_modifiers;
-    double m_timestamp;
-};
-
-} // namespace WebCore
-
-#endif // PlatformEvent_h
diff --git a/Source/core/platform/PlatformGestureEvent.h b/Source/core/platform/PlatformGestureEvent.h
deleted file mode 100644
index 42f69b3..0000000
--- a/Source/core/platform/PlatformGestureEvent.h
+++ /dev/null
@@ -1,82 +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,
- * 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 PlatformGestureEvent_h
-#define PlatformGestureEvent_h
-
-#include "core/platform/PlatformEvent.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/IntPoint.h"
-#include "core/platform/graphics/IntSize.h"
-
-namespace WebCore {
-
-class PlatformGestureEvent : public PlatformEvent {
-public:
-    PlatformGestureEvent()
-        : PlatformEvent(PlatformEvent::GestureScrollBegin)
-        , m_deltaX(0)
-        , m_deltaY(0)
-    {
-    }
-
-    PlatformGestureEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, double timestamp, float deltaX, float deltaY, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey)
-        : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
-        , m_position(position)
-        , m_globalPosition(globalPosition)
-        , m_deltaX(deltaX)
-        , m_deltaY(deltaY)
-    {
-    }
-
-    PlatformGestureEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, double timestamp, const IntSize& area, const FloatPoint& delta, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey)
-        : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
-        , m_position(position)
-        , m_globalPosition(globalPosition)
-        , m_area(area)
-        , m_deltaX(delta.x())
-        , m_deltaY(delta.y())
-    {
-    }
-
-    const IntPoint& position() const { return m_position; } // PlatformWindow coordinates.
-    const IntPoint& globalPosition() const { return m_globalPosition; } // Screen coordinates.
-
-    const IntSize& area() const { return m_area; }
-
-    float deltaX() const { return m_deltaX; }
-    float deltaY() const { return m_deltaY; }
-
-protected:
-    IntPoint m_position;
-    IntPoint m_globalPosition;
-    IntSize m_area;
-    float m_deltaX;
-    float m_deltaY;
-};
-
-} // namespace WebCore
-
-#endif // PlatformGestureEvent_h
diff --git a/Source/core/platform/PlatformInstrumentation.h b/Source/core/platform/PlatformInstrumentation.h
index c4e50af..aa68c88 100644
--- a/Source/core/platform/PlatformInstrumentation.h
+++ b/Source/core/platform/PlatformInstrumentation.h
@@ -31,11 +31,10 @@
 #ifndef PlatformInstrumentation_h
 #define PlatformInstrumentation_h
 
+#include "platform/TraceEvent.h"
 #include "wtf/MainThread.h"
 #include "wtf/text/WTFString.h"
 
-#include "core/platform/chromium/TraceEvent.h"
-
 namespace WebCore {
 
 class PlatformInstrumentationClient {
diff --git a/Source/core/platform/PlatformKeyboardEvent.h b/Source/core/platform/PlatformKeyboardEvent.h
deleted file mode 100644
index 4ad6ded..0000000
--- a/Source/core/platform/PlatformKeyboardEvent.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2008 Collabora, Ltd.  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,
- * 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 PlatformKeyboardEvent_h
-#define PlatformKeyboardEvent_h
-
-#include "core/platform/PlatformEvent.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-    class PlatformKeyboardEvent : public PlatformEvent {
-        WTF_MAKE_FAST_ALLOCATED;
-    public:
-        PlatformKeyboardEvent()
-            : PlatformEvent(PlatformEvent::KeyDown)
-            , m_windowsVirtualKeyCode(0)
-            , m_nativeVirtualKeyCode(0)
-            , m_macCharCode(0)
-            , m_autoRepeat(false)
-            , m_isKeypad(false)
-            , m_isSystemKey(false)
-        {
-        }
-
-        PlatformKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
-            : PlatformEvent(type, modifiers, timestamp)
-            , m_text(text)
-            , m_unmodifiedText(unmodifiedText)
-            , m_keyIdentifier(keyIdentifier)
-            , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
-            , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
-            , m_macCharCode(macCharCode)
-            , m_autoRepeat(isAutoRepeat)
-            , m_isKeypad(isKeypad)
-            , m_isSystemKey(isSystemKey)
-        {
-        }
-
-        void disambiguateKeyDownEvent(Type);
-
-        // Text as as generated by processing a virtual key code with a keyboard layout
-        // (in most cases, just a character code, but the layout can emit several
-        // characters in a single keypress event on some platforms).
-        // This may bear no resemblance to the ultimately inserted text if an input method
-        // processes the input.
-        // Will be null for KeyUp and RawKeyDown events.
-        String text() const { return m_text; }
-
-        // Text that would have been generated by the keyboard if no modifiers were pressed
-        // (except for Shift); useful for shortcut (accelerator) key handling.
-        // Otherwise, same as text().
-        String unmodifiedText() const { return m_unmodifiedText; }
-
-        String keyIdentifier() const { return m_keyIdentifier; }
-
-        // Most compatible Windows virtual key code associated with the event.
-        // Zero for Char events.
-        int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; }
-
-        int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; }
-        int macCharCode() const { return m_macCharCode; }
-
-        bool isAutoRepeat() const { return m_autoRepeat; }
-        bool isKeypad() const { return m_isKeypad; }
-        bool isSystemKey() const { return m_isSystemKey; }
-
-        static bool currentCapsLockState();
-        static void getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey);
-    protected:
-        String m_text;
-        String m_unmodifiedText;
-        String m_keyIdentifier;
-        int m_windowsVirtualKeyCode;
-        int m_nativeVirtualKeyCode;
-        int m_macCharCode;
-        bool m_autoRepeat;
-        bool m_isKeypad;
-        bool m_isSystemKey;
-    };
-
-} // namespace WebCore
-
-#endif // PlatformKeyboardEvent_h
diff --git a/Source/core/platform/PlatformMouseEvent.h b/Source/core/platform/PlatformMouseEvent.h
deleted file mode 100644
index f542461..0000000
--- a/Source/core/platform/PlatformMouseEvent.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006, 2009 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,
- * 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 PlatformMouseEvent_h
-#define PlatformMouseEvent_h
-
-#include "core/platform/PlatformEvent.h"
-#include "core/platform/graphics/IntPoint.h"
-
-namespace WebCore {
-
-    // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified.
-    enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton };
-
-    class PlatformMouseEvent : public PlatformEvent {
-    public:
-        PlatformMouseEvent()
-            : PlatformEvent(PlatformEvent::MouseMoved)
-            , m_button(NoButton)
-            , m_clickCount(0)
-            , m_modifierFlags(0)
-        {
-        }
-
-        PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type,
-                           int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp)
-            : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
-            , m_position(position)
-            , m_globalPosition(globalPosition)
-            , m_button(button)
-            , m_clickCount(clickCount)
-            , m_modifierFlags(0)
-        {
-        }
-
-        const IntPoint& position() const { return m_position; }
-        const IntPoint& globalPosition() const { return m_globalPosition; }
-        const IntPoint& movementDelta() const { return m_movementDelta; }
-
-        MouseButton button() const { return m_button; }
-        int clickCount() const { return m_clickCount; }
-        unsigned modifierFlags() const { return m_modifierFlags; }
-
-    protected:
-        IntPoint m_position;
-        IntPoint m_globalPosition;
-        IntPoint m_movementDelta;
-        MouseButton m_button;
-        int m_clickCount;
-        unsigned m_modifierFlags;
-    };
-
-} // namespace WebCore
-
-#endif // PlatformMouseEvent_h
diff --git a/Source/core/platform/PlatformScreen.h b/Source/core/platform/PlatformScreen.h
index 096f026..f4866c5 100644
--- a/Source/core/platform/PlatformScreen.h
+++ b/Source/core/platform/PlatformScreen.h
@@ -26,7 +26,7 @@
 #ifndef PlatformScreen_h
 #define PlatformScreen_h
 
-#include "core/platform/graphics/FloatRect.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/Forward.h"
 #include "wtf/RefPtr.h"
 
diff --git a/Source/core/platform/PlatformTouchEvent.h b/Source/core/platform/PlatformTouchEvent.h
deleted file mode 100644
index d3b1eef..0000000
--- a/Source/core/platform/PlatformTouchEvent.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library 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
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PlatformTouchEvent_h
-#define PlatformTouchEvent_h
-
-#include "core/platform/PlatformEvent.h"
-#include "core/platform/PlatformTouchPoint.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-
-class PlatformTouchEvent : public PlatformEvent {
-public:
-    PlatformTouchEvent()
-        : PlatformEvent(PlatformEvent::TouchStart)
-    {
-    }
-
-    const Vector<PlatformTouchPoint>& touchPoints() const { return m_touchPoints; }
-
-protected:
-    Vector<PlatformTouchPoint> m_touchPoints;
-};
-
-}
-
-#endif // PlatformTouchEvent_h
diff --git a/Source/core/platform/PlatformTouchPoint.h b/Source/core/platform/PlatformTouchPoint.h
deleted file mode 100644
index f6609a8..0000000
--- a/Source/core/platform/PlatformTouchPoint.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library 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
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PlatformTouchPoint_h
-#define PlatformTouchPoint_h
-
-#include "core/platform/graphics/IntPoint.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class PlatformTouchEvent;
-
-class PlatformTouchPoint {
-public:
-    enum State {
-        TouchReleased,
-        TouchPressed,
-        TouchMoved,
-        TouchStationary,
-        TouchCancelled,
-        TouchStateEnd // Placeholder: must remain the last item.
-    };
-
-    // This is necessary for us to be able to build synthetic events.
-    PlatformTouchPoint()
-        : m_id(0)
-        , m_radiusY(0)
-        , m_radiusX(0)
-        , m_rotationAngle(0)
-        , m_force(0)
-    {
-    }
-
-    unsigned id() const { return m_id; }
-    State state() const { return m_state; }
-    IntPoint screenPos() const { return m_screenPos; }
-    IntPoint pos() const { return m_pos; }
-    int radiusX() const { return m_radiusX; }
-    int radiusY() const { return m_radiusY; }
-    float rotationAngle() const { return m_rotationAngle; }
-    float force() const { return m_force; }
-
-protected:
-    unsigned m_id;
-    State m_state;
-    IntPoint m_screenPos;
-    IntPoint m_pos;
-    int m_radiusY;
-    int m_radiusX;
-    float m_rotationAngle;
-    float m_force;
-};
-
-}
-
-#endif // PlatformTouchPoint_h
diff --git a/Source/core/platform/PlatformWheelEvent.h b/Source/core/platform/PlatformWheelEvent.h
deleted file mode 100644
index 894c776..0000000
--- a/Source/core/platform/PlatformWheelEvent.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006, 2009 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,
- * 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 PlatformWheelEvent_h
-#define PlatformWheelEvent_h
-
-#include "core/platform/PlatformEvent.h"
-#include "core/platform/graphics/IntPoint.h"
-
-namespace WebCore {
-
-    class FloatPoint;
-    class FloatSize;
-
-    // Wheel events come in two flavors:
-    // The ScrollByPixelWheelEvent is a fine-grained event that specifies the precise number of pixels to scroll.  It is sent directly by MacBook touchpads on OS X,
-    // and synthesized in other cases where platforms generate line-by-line scrolling events.
-    // The ScrollByPageWheelEvent indicates that the wheel event should scroll an entire page.  In this case WebCore's built in paging behavior is used to page
-    // up and down (you get the same behavior as if the user was clicking in a scrollbar track to page up or page down).
-    enum PlatformWheelEventGranularity {
-        ScrollByPageWheelEvent,
-        ScrollByPixelWheelEvent,
-    };
-
-#if OS(MACOSX)
-    enum PlatformWheelEventPhase {
-        PlatformWheelEventPhaseNone        = 0,
-        PlatformWheelEventPhaseBegan       = 1 << 0,
-        PlatformWheelEventPhaseStationary  = 1 << 1,
-        PlatformWheelEventPhaseChanged     = 1 << 2,
-        PlatformWheelEventPhaseEnded       = 1 << 3,
-        PlatformWheelEventPhaseCancelled   = 1 << 4,
-        PlatformWheelEventPhaseMayBegin    = 1 << 5,
-    };
-#endif
-
-    class PlatformWheelEvent : public PlatformEvent {
-    public:
-        PlatformWheelEvent()
-            : PlatformEvent(PlatformEvent::Wheel)
-            , m_deltaX(0)
-            , m_deltaY(0)
-            , m_wheelTicksX(0)
-            , m_wheelTicksY(0)
-            , m_granularity(ScrollByPixelWheelEvent)
-            , m_directionInvertedFromDevice(false)
-            , m_hasPreciseScrollingDeltas(false)
-#if OS(MACOSX)
-            , m_phase(PlatformWheelEventPhaseNone)
-            , m_momentumPhase(PlatformWheelEventPhaseNone)
-            , m_scrollCount(0)
-            , m_unacceleratedScrollingDeltaX(0)
-            , m_unacceleratedScrollingDeltaY(0)
-#endif
-        {
-        }
-
-        PlatformWheelEvent(IntPoint position, IntPoint globalPosition, float deltaX, float deltaY, float wheelTicksX, float wheelTicksY, PlatformWheelEventGranularity granularity, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey)
-            : PlatformEvent(PlatformEvent::Wheel, shiftKey, ctrlKey, altKey, metaKey, 0)
-            , m_position(position)
-            , m_globalPosition(globalPosition)
-            , m_deltaX(deltaX)
-            , m_deltaY(deltaY)
-            , m_wheelTicksX(wheelTicksX)
-            , m_wheelTicksY(wheelTicksY)
-            , m_granularity(granularity)
-            , m_directionInvertedFromDevice(false)
-            , m_hasPreciseScrollingDeltas(false)
-#if OS(MACOSX)
-            , m_phase(PlatformWheelEventPhaseNone)
-            , m_momentumPhase(PlatformWheelEventPhaseNone)
-            , m_scrollCount(0)
-            , m_unacceleratedScrollingDeltaX(0)
-            , m_unacceleratedScrollingDeltaY(0)
-#endif
-        {
-        }
-
-        PlatformWheelEvent copyTurningVerticalTicksIntoHorizontalTicks() const
-        {
-            PlatformWheelEvent copy = *this;
-
-            copy.m_deltaX = copy.m_deltaY;
-            copy.m_deltaY = 0;
-            copy.m_wheelTicksX = copy.m_wheelTicksY;
-            copy.m_wheelTicksY = 0;
-
-            return copy;
-        }
-
-        const IntPoint& position() const { return m_position; } // PlatformWindow coordinates.
-        const IntPoint& globalPosition() const { return m_globalPosition; } // Screen coordinates.
-
-        float deltaX() const { return m_deltaX; }
-        float deltaY() const { return m_deltaY; }
-
-        float wheelTicksX() const { return m_wheelTicksX; }
-        float wheelTicksY() const { return m_wheelTicksY; }
-
-        PlatformWheelEventGranularity granularity() const { return m_granularity; }
-
-        bool directionInvertedFromDevice() const { return m_directionInvertedFromDevice; }
-
-        bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
-        void setHasPreciseScrollingDeltas(bool b) { m_hasPreciseScrollingDeltas = b; }
-#if OS(MACOSX)
-        PlatformWheelEventPhase phase() const { return m_phase; }
-        PlatformWheelEventPhase momentumPhase() const { return m_momentumPhase; }
-        unsigned scrollCount() const { return m_scrollCount; }
-        float unacceleratedScrollingDeltaX() const { return m_unacceleratedScrollingDeltaX; }
-        float unacceleratedScrollingDeltaY() const { return m_unacceleratedScrollingDeltaY; }
-        bool useLatchedEventNode() const { return m_momentumPhase == PlatformWheelEventPhaseBegan || m_momentumPhase == PlatformWheelEventPhaseChanged; }
-#else
-        bool useLatchedEventNode() const { return false; }
-#endif
-
-    protected:
-        IntPoint m_position;
-        IntPoint m_globalPosition;
-        float m_deltaX;
-        float m_deltaY;
-        float m_wheelTicksX;
-        float m_wheelTicksY;
-        PlatformWheelEventGranularity m_granularity;
-        bool m_directionInvertedFromDevice;
-        bool m_hasPreciseScrollingDeltas;
-#if OS(MACOSX)
-        PlatformWheelEventPhase m_phase;
-        PlatformWheelEventPhase m_momentumPhase;
-        unsigned m_scrollCount;
-        float m_unacceleratedScrollingDeltaX;
-        float m_unacceleratedScrollingDeltaY;
-#endif
-    };
-
-} // namespace WebCore
-
-#endif // PlatformWheelEvent_h
diff --git a/Source/core/platform/PopupMenuClient.h b/Source/core/platform/PopupMenuClient.h
index ed41b51..74da471 100644
--- a/Source/core/platform/PopupMenuClient.h
+++ b/Source/core/platform/PopupMenuClient.h
@@ -22,9 +22,9 @@
 #ifndef PopupMenuClient_h
 #define PopupMenuClient_h
 
-#include "core/platform/LayoutUnit.h"
 #include "core/platform/PopupMenuStyle.h"
-#include "core/platform/ScrollTypes.h"
+#include "platform/LayoutUnit.h"
+#include "platform/scroll/ScrollTypes.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/PopupMenuStyle.h b/Source/core/platform/PopupMenuStyle.h
index 63ea3ef..21bb1ce 100644
--- a/Source/core/platform/PopupMenuStyle.h
+++ b/Source/core/platform/PopupMenuStyle.h
@@ -29,7 +29,7 @@
 #include "core/platform/Length.h"
 #include "core/platform/graphics/Color.h"
 #include "core/platform/graphics/Font.h"
-#include "core/platform/text/TextDirection.h"
+#include "platform/text/TextDirection.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/Prerender.cpp b/Source/core/platform/Prerender.cpp
new file mode 100644
index 0000000..9b70ebf
--- /dev/null
+++ b/Source/core/platform/Prerender.cpp
@@ -0,0 +1,136 @@
+/*
+ * 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:
+ *
+ *     * 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/Prerender.h"
+
+#include "core/platform/PrerenderClient.h"
+#include "public/platform/WebPrerender.h"
+#include "public/platform/WebPrerenderingSupport.h"
+
+namespace WebCore {
+
+PassRefPtr<Prerender> Prerender::create(PrerenderClient* client, const KURL& url, const String& referrer, ReferrerPolicy policy)
+{
+    return adoptRef(new Prerender(client, url, referrer, policy));
+}
+
+Prerender::Prerender(PrerenderClient* client, const KURL& url, const String& referrer, ReferrerPolicy policy)
+    : m_client(client)
+    , m_url(url)
+    , m_referrer(referrer)
+    , m_referrerPolicy(policy)
+    , m_isActive(false)
+{
+}
+
+Prerender::~Prerender()
+{
+}
+
+void Prerender::removeClient()
+{
+    m_client = 0;
+}
+
+void Prerender::add()
+{
+    ASSERT(!m_isActive);
+    m_isActive = true;
+    WebKit::WebPrerenderingSupport* platform = WebKit::WebPrerenderingSupport::current();
+    if (!platform)
+        return;
+    platform->add(WebKit::WebPrerender(this));
+}
+
+void Prerender::cancel()
+{
+    // The LinkLoader and the Document (via Prerenderer) share ownership of
+    // the Prerender, so it may have been abandoned by the Prerenderer and
+    // then later canceled by the LinkLoader.
+    if (!m_isActive)
+        return;
+    m_isActive = false;
+    WebKit::WebPrerenderingSupport* platform = WebKit::WebPrerenderingSupport::current();
+    if (!platform)
+        return;
+    platform->cancel(WebKit::WebPrerender(this));
+}
+
+void Prerender::abandon()
+{
+    // The LinkLoader and the Document (via Prerenderer) share ownership of
+    // the Prerender, so it may have been canceled by the LinkLoader and
+    // then later abandoned by the Prerenderer.
+    if (!m_isActive)
+        return;
+    m_isActive = false;
+    WebKit::WebPrerenderingSupport* platform = WebKit::WebPrerenderingSupport::current();
+    if (!platform)
+        return;
+    platform->abandon(WebKit::WebPrerender(this));
+}
+
+void Prerender::suspend()
+{
+    abandon();
+}
+
+void Prerender::resume()
+{
+    add();
+}
+
+void Prerender::didStartPrerender()
+{
+    if (m_client)
+        m_client->didStartPrerender();
+}
+
+void Prerender::didStopPrerender()
+{
+    if (m_client)
+        m_client->didStopPrerender();
+}
+
+void Prerender::didSendLoadForPrerender()
+{
+    if (m_client)
+        m_client->didSendLoadForPrerender();
+}
+
+void Prerender::didSendDOMContentLoadedForPrerender()
+{
+    if (m_client)
+        m_client->didSendDOMContentLoadedForPrerender();
+}
+
+}
diff --git a/Source/core/platform/Prerender.h b/Source/core/platform/Prerender.h
new file mode 100644
index 0000000..282d218
--- /dev/null
+++ b/Source/core/platform/Prerender.h
@@ -0,0 +1,99 @@
+/*
+ * 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:
+ *
+ *     * 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 Prerender_h
+#define Prerender_h
+
+#include "weborigin/KURL.h"
+#include "weborigin/ReferrerPolicy.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebKit {
+class WebPrerender;
+}
+
+namespace WebCore {
+
+class PrerenderClient;
+
+class Prerender : public RefCounted<Prerender> {
+    WTF_MAKE_NONCOPYABLE(Prerender);
+public:
+    class ExtraData : public RefCounted<ExtraData> {
+    public:
+        virtual ~ExtraData() { }
+    };
+
+    static PassRefPtr<Prerender> create(PrerenderClient*, const KURL&, const String& referrer, ReferrerPolicy);
+    ~Prerender();
+
+    void removeClient();
+
+    void add();
+    void cancel();
+    void abandon();
+    void suspend();
+    void resume();
+
+    const KURL& url() const { return m_url; }
+    const String& referrer() const { return m_referrer; }
+    ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; }
+
+    void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData; }
+    ExtraData* extraData() { return m_extraData.get(); }
+
+    void didStartPrerender();
+    void didStopPrerender();
+    void didSendLoadForPrerender();
+    void didSendDOMContentLoadedForPrerender();
+
+private:
+    Prerender(PrerenderClient*, const KURL&, const String& referrer, ReferrerPolicy);
+
+    PrerenderClient* m_client;
+
+    const KURL m_url;
+    const String m_referrer;
+    const ReferrerPolicy m_referrerPolicy;
+
+    bool m_isActive;
+
+    RefPtr<ExtraData> m_extraData;
+};
+
+}
+
+#endif // Prerender_h
diff --git a/Source/core/platform/PrerenderHandle.h b/Source/core/platform/PrerenderHandle.h
deleted file mode 100644
index 90dd511..0000000
--- a/Source/core/platform/PrerenderHandle.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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:
- *
- *     * 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 PrerenderHandle_h
-#define PrerenderHandle_h
-
-#include "weborigin/ReferrerPolicy.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class KURL;
-class Prerender;
-class PrerenderClient;
-
-class PrerenderHandle : public RefCounted<PrerenderHandle> {
-    WTF_MAKE_NONCOPYABLE(PrerenderHandle);
-public:
-    static PassRefPtr<PrerenderHandle> create(PrerenderClient*, const KURL&, const String& referrer, ReferrerPolicy);
-    ~PrerenderHandle();
-
-    Prerender* prerender();
-
-    void removeClient();
-
-    // A prerender link element is added when it is inserted into a document.
-    void add();
-
-    // A prerender is abandoned when it's navigated away from. This is is a weaker signal
-    // than cancel(), since the launcher hasn't indicated that the prerender isn't wanted,
-    // and we may end up using it after, for instance, a short redirect chain.
-    void abandon();
-
-    // A prerender is canceled when it is removed from a document.
-    void cancel();
-
-    // A prerender is suspended along with the DOM containing its linkloader & prerenderer.
-    void suspend();
-    void resume();
-
-    const KURL& url() const;
-    const String& referrer() const;
-    ReferrerPolicy referrerPolicy() const;
-
-private:
-    PrerenderHandle(PrerenderClient*, const KURL&, const String& referrer, ReferrerPolicy);
-
-    RefPtr<Prerender> m_prerender;
-};
-
-} // namespace WebCore
-
-#endif // PrerenderHandle_h
diff --git a/Source/core/platform/PurgeableBuffer.cpp b/Source/core/platform/PurgeableBuffer.cpp
deleted file mode 100644
index a581138..0000000
--- a/Source/core/platform/PurgeableBuffer.cpp
+++ /dev/null
@@ -1,97 +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:
- * 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 GOOGLE 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 GOOGLE 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/platform/PurgeableBuffer.h"
-
-#include "public/platform/Platform.h"
-#include "public/platform/WebDiscardableMemory.h"
-
-#include <string.h>
-
-namespace WebCore {
-
-// WebDiscardableMemory allocations are a limited resource. We only use them
-// when there's a reasonable amount of memory to be saved by the OS discarding
-// the memory.
-static size_t minimumSize = 4 * 4096;
-
-PassOwnPtr<PurgeableBuffer> PurgeableBuffer::create(const char* data, size_t size)
-{
-    if (size < minimumSize)
-        return nullptr;
-
-    OwnPtr<WebKit::WebDiscardableMemory> memory = adoptPtr(WebKit::Platform::current()->allocateAndLockDiscardableMemory(size));
-    if (!memory)
-        return nullptr;
-
-    return adoptPtr(new PurgeableBuffer(memory.release(), data, size));
-}
-
-PurgeableBuffer::~PurgeableBuffer()
-{
-    if (m_state == Locked)
-        m_memory->unlock();
-}
-
-const char* PurgeableBuffer::data() const
-{
-    ASSERT(m_state == Locked);
-    return static_cast<const char*>(m_memory->data());
-}
-
-bool PurgeableBuffer::wasPurged() const
-{
-    return m_state == Purged;
-}
-
-bool PurgeableBuffer::lock()
-{
-    ASSERT(m_state == Unlocked);
-    if (!m_memory->lock()) {
-        m_state = Purged;
-        m_memory = nullptr;
-        return false;
-    }
-    m_state = Locked;
-    return true;
-}
-
-void PurgeableBuffer::unlock()
-{
-    ASSERT(m_state == Locked);
-    m_memory->unlock();
-    m_state = Unlocked;
-}
-
-PurgeableBuffer::PurgeableBuffer(PassOwnPtr<WebKit::WebDiscardableMemory> memory, const char* data, size_t size)
-    : m_memory(memory)
-    , m_size(size)
-    , m_state(Locked)
-{
-    memcpy(m_memory->data(), data, size);
-}
-
-}
diff --git a/Source/core/platform/PurgeableBuffer.h b/Source/core/platform/PurgeableBuffer.h
deleted file mode 100644
index 4b5fc2e..0000000
--- a/Source/core/platform/PurgeableBuffer.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2008, 2010 Apple 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 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 PurgeableBuffer_h
-#define PurgeableBuffer_h
-
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebKit {
-class WebDiscardableMemory;
-}
-
-namespace WebCore {
-
-class PurgeableBuffer {
-    WTF_MAKE_NONCOPYABLE(PurgeableBuffer);
-public:
-    static PassOwnPtr<PurgeableBuffer> create(const char* data, size_t);
-    ~PurgeableBuffer();
-
-    // Call lock and check the return value before accessing the data.
-    const char* data() const;
-    size_t size() const { return m_size; }
-
-    bool isPurgeable() const { return m_state != Locked; }
-    bool wasPurged() const;
-
-    bool lock();
-    void unlock();
-
-private:
-    enum State {
-        Locked,
-        Unlocked,
-        Purged
-    };
-
-    PurgeableBuffer(PassOwnPtr<WebKit::WebDiscardableMemory>, const char* data, size_t);
-
-    OwnPtr<WebKit::WebDiscardableMemory> m_memory;
-    size_t m_size;
-    State m_state;
-};
-
-}
-
-#endif
diff --git a/Source/core/platform/RefCountedSupplement.h b/Source/core/platform/RefCountedSupplement.h
index 985c81f..bb6d5e7 100644
--- a/Source/core/platform/RefCountedSupplement.h
+++ b/Source/core/platform/RefCountedSupplement.h
@@ -26,7 +26,7 @@
 #ifndef RefCountedSupplement_h
 #define RefCountedSupplement_h
 
-#include "core/platform/Supplementable.h"
+#include "platform/Supplementable.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
 
diff --git a/Source/core/platform/SSLKeyGenerator.h b/Source/core/platform/SSLKeyGenerator.h
deleted file mode 100644
index 9ab52cc..0000000
--- a/Source/core/platform/SSLKeyGenerator.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2003, 2006 Apple Computer, 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,
- * 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 SSLKeyGenerator_h
-#define SSLKeyGenerator_h
-
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-    class KURL;
-
-    // Returns strings representing key sizes that may be used
-    // for the <keygen> tag. The first string is displayed as the default
-    // key size in the <keygen> menu.
-    void getSupportedKeySizes(Vector<String>& sizes);
-
-    // This function handles the <keygen> tag in form elements.
-    // Returns a signed copy of the combined challenge string and public
-    // key (from a newly generated key pair).
-    String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const KURL&);
-
-} // namespace WebCore
-
-#endif // SSLKeyGenerator_h
diff --git a/Source/core/platform/ScrollAnimator.cpp b/Source/core/platform/ScrollAnimator.cpp
index 3be5c13..61ce764 100644
--- a/Source/core/platform/ScrollAnimator.cpp
+++ b/Source/core/platform/ScrollAnimator.cpp
@@ -31,11 +31,10 @@
 #include "config.h"
 #include "core/platform/ScrollAnimator.h"
 
-#include <algorithm>
-#include "core/platform/PlatformWheelEvent.h"
 #include "core/platform/ScrollableArea.h"
-#include "core/platform/graphics/FloatPoint.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/PassOwnPtr.h"
+#include <algorithm>
 
 using namespace std;
 
diff --git a/Source/core/platform/ScrollAnimator.h b/Source/core/platform/ScrollAnimator.h
index 964a46b..0eab2f0 100644
--- a/Source/core/platform/ScrollAnimator.h
+++ b/Source/core/platform/ScrollAnimator.h
@@ -31,9 +31,9 @@
 #ifndef ScrollAnimator_h
 #define ScrollAnimator_h
 
-#include "core/platform/PlatformWheelEvent.h"
-#include "core/platform/ScrollTypes.h"
-#include "core/platform/graphics/FloatSize.h"
+#include "platform/PlatformWheelEvent.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/scroll/ScrollTypes.h"
 #include "wtf/FastAllocBase.h"
 #include "wtf/Forward.h"
 #include "wtf/UnusedParam.h"
diff --git a/Source/core/platform/ScrollAnimatorNone.cpp b/Source/core/platform/ScrollAnimatorNone.cpp
index 27c12c3..ff7e852 100644
--- a/Source/core/platform/ScrollAnimatorNone.cpp
+++ b/Source/core/platform/ScrollAnimatorNone.cpp
@@ -34,12 +34,12 @@
 
 #include <algorithm>
 #include "core/platform/ScrollableArea.h"
-#include "core/platform/graphics/FloatPoint.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/CurrentTime.h"
-#include "wtf/OwnArrayPtr.h"
+#include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 
-#include "core/platform/chromium/TraceEvent.h"
+#include "platform/TraceEvent.h"
 
 using namespace std;
 
diff --git a/Source/core/platform/ScrollAnimatorNone.h b/Source/core/platform/ScrollAnimatorNone.h
index f54f9de..7734c4d 100644
--- a/Source/core/platform/ScrollAnimatorNone.h
+++ b/Source/core/platform/ScrollAnimatorNone.h
@@ -32,8 +32,8 @@
 #define ScrollAnimatorNone_h
 
 #include "core/platform/ScrollAnimator.h"
-#include "core/platform/Timer.h"
-#include "core/platform/graphics/FloatPoint.h"
+#include "platform/Timer.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/OwnPtr.h"
 
 class ScrollAnimatorNoneTest;
diff --git a/Source/core/platform/ScrollTypes.h b/Source/core/platform/ScrollTypes.h
deleted file mode 100644
index 8f333d8..0000000
--- a/Source/core/platform/ScrollTypes.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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,
- * 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 ScrollTypes_h
-#define ScrollTypes_h
-
-#include "wtf/Assertions.h"
-
-namespace WebCore {
-
-    enum ScrollDirection {
-        ScrollUp,
-        ScrollDown,
-        ScrollLeft,
-        ScrollRight
-    };
-
-    enum ScrollLogicalDirection {
-        ScrollBlockDirectionBackward,
-        ScrollBlockDirectionForward,
-        ScrollInlineDirectionBackward,
-        ScrollInlineDirectionForward
-    };
-
-
-    inline ScrollDirection logicalToPhysical(ScrollLogicalDirection direction, bool isVertical, bool isFlipped)
-    {
-        switch (direction) {
-        case ScrollBlockDirectionBackward: {
-            if (isVertical) {
-                if (!isFlipped)
-                    return ScrollUp;
-                return ScrollDown;
-            } else {
-                if (!isFlipped)
-                    return ScrollLeft;
-                return ScrollRight;
-            }
-            break;
-        }
-        case ScrollBlockDirectionForward: {
-            if (isVertical) {
-                if (!isFlipped)
-                    return ScrollDown;
-                return ScrollUp;
-            } else {
-                if (!isFlipped)
-                    return ScrollRight;
-                return ScrollLeft;
-            }
-            break;
-        }
-        case ScrollInlineDirectionBackward: {
-            if (isVertical) {
-                if (!isFlipped)
-                    return ScrollLeft;
-                return ScrollRight;
-            } else {
-                if (!isFlipped)
-                    return ScrollUp;
-                return ScrollDown;
-            }
-            break;
-        }
-        case ScrollInlineDirectionForward: {
-            if (isVertical) {
-                if (!isFlipped)
-                    return ScrollRight;
-                return ScrollLeft;
-            } else {
-                if (!isFlipped)
-                    return ScrollDown;
-                return ScrollUp;
-            }
-            break;
-        }
-        default:
-            ASSERT_NOT_REACHED();
-            break;
-        }
-        return ScrollUp;
-    }
-
-    enum ScrollGranularity {
-        ScrollByLine,
-        ScrollByPage,
-        ScrollByDocument,
-        ScrollByPixel,
-        ScrollByPrecisePixel
-    };
-
-    enum ScrollElasticity {
-        ScrollElasticityAutomatic,
-        ScrollElasticityNone,
-        ScrollElasticityAllowed
-    };
-
-    enum ScrollbarOrientation { HorizontalScrollbar, VerticalScrollbar };
-
-    enum ScrollbarMode { ScrollbarAuto, ScrollbarAlwaysOff, ScrollbarAlwaysOn };
-
-    enum ScrollbarControlSize { RegularScrollbar, SmallScrollbar };
-
-    typedef unsigned ScrollbarControlState;
-
-    enum ScrollbarControlStateMask {
-        ActiveScrollbarState = 1,
-        EnabledScrollbarState = 1 << 1,
-        PressedScrollbarState = 1 << 2
-    };
-
-    enum ScrollbarPart {
-        NoPart = 0,
-        BackButtonStartPart = 1,
-        ForwardButtonStartPart = 1 << 1,
-        BackTrackPart = 1 << 2,
-        ThumbPart = 1 << 3,
-        ForwardTrackPart = 1 << 4,
-        BackButtonEndPart = 1 << 5,
-        ForwardButtonEndPart = 1 << 6,
-        ScrollbarBGPart = 1 << 7,
-        TrackBGPart = 1 << 8,
-        AllParts = 0xffffffff
-    };
-
-    enum ScrollbarButtonsPlacement {
-        ScrollbarButtonsNone,
-        ScrollbarButtonsSingle,
-        ScrollbarButtonsDoubleStart,
-        ScrollbarButtonsDoubleEnd,
-        ScrollbarButtonsDoubleBoth
-    };
-
-    enum ScrollbarOverlayStyle {
-        ScrollbarOverlayStyleDefault,
-        ScrollbarOverlayStyleDark,
-        ScrollbarOverlayStyleLight
-    };
-
-    typedef unsigned ScrollbarControlPartMask;
-
-}
-
-#endif
diff --git a/Source/core/platform/ScrollView.cpp b/Source/core/platform/ScrollView.cpp
index 616dee2..384245e 100644
--- a/Source/core/platform/ScrollView.cpp
+++ b/Source/core/platform/ScrollView.cpp
@@ -27,11 +27,10 @@
 #include "core/platform/ScrollView.h"
 
 #include "core/accessibility/AXObjectCache.h"
-#include "core/platform/HostWindow.h"
-#include "core/platform/Scrollbar.h"
 #include "core/platform/ScrollbarTheme.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/GraphicsLayer.h"
+#include "platform/HostWindow.h"
 #include "wtf/StdLibExtras.h"
 
 using namespace std;
@@ -198,8 +197,7 @@
             horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horizontalBar->height() : 0;
     }
 
-    return IntSize(max(0, width() - verticalScrollbarWidth),
-                   max(0, height() - horizontalScrollbarHeight));
+    return IntSize(max(0, width() - verticalScrollbarWidth), max(0, height() - horizontalScrollbarHeight));
 }
 
 IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scollbarInclusion) const
@@ -677,7 +675,7 @@
     int oldCount = m_scrollbarsAvoidingResizer;
     m_scrollbarsAvoidingResizer += overlapDelta;
     if (parent())
-        parent()->adjustScrollbarsAvoidingResizerCount(overlapDelta);
+        toScrollView(parent())->adjustScrollbarsAvoidingResizerCount(overlapDelta);
     else if (!scrollbarsSuppressed()) {
         // If we went from n to 0 or from 0 to n and we're the outermost view,
         // we need to invalidate the windowResizerRect(), since it will now need to paint
@@ -688,18 +686,18 @@
     }
 }
 
-void ScrollView::setParent(ScrollView* parentView)
+void ScrollView::setParent(Widget* parentView)
 {
     if (parentView == parent())
         return;
 
     if (m_scrollbarsAvoidingResizer && parent())
-        parent()->adjustScrollbarsAvoidingResizerCount(-m_scrollbarsAvoidingResizer);
+        toScrollView(parent())->adjustScrollbarsAvoidingResizerCount(-m_scrollbarsAvoidingResizer);
 
     Widget::setParent(parentView);
 
     if (m_scrollbarsAvoidingResizer && parent())
-        parent()->adjustScrollbarsAvoidingResizerCount(m_scrollbarsAvoidingResizer);
+        toScrollView(parent())->adjustScrollbarsAvoidingResizerCount(m_scrollbarsAvoidingResizer);
 }
 
 void ScrollView::setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress)
@@ -901,7 +899,7 @@
     static Image* panScrollIcon = Image::loadPlatformResource("panIcon").leakRef();
     IntPoint iconGCPoint = m_panScrollIconPoint;
     if (parent())
-        iconGCPoint = parent()->windowToContents(iconGCPoint);
+        iconGCPoint = toScrollView(parent())->windowToContents(iconGCPoint);
     context->drawImage(panScrollIcon, iconGCPoint);
 }
 
diff --git a/Source/core/platform/ScrollView.h b/Source/core/platform/ScrollView.h
index bea72cf..1418c13 100644
--- a/Source/core/platform/ScrollView.h
+++ b/Source/core/platform/ScrollView.h
@@ -27,11 +27,11 @@
 #ifndef ScrollView_h
 #define ScrollView_h
 
-#include "core/platform/ScrollTypes.h"
 #include "core/platform/ScrollableArea.h"
 #include "core/platform/Scrollbar.h"
-#include "core/platform/Widget.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/Widget.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/scroll/ScrollTypes.h"
 
 #include "wtf/HashSet.h"
 
@@ -130,6 +130,9 @@
     IntSize unscaledVisibleContentSize(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
     virtual float visibleContentScaleFactor() const { return 1; }
 
+    // Scale used to convert incoming input events. Usually the same as visibleContentScaleFactor(), unless specifically changed.
+    virtual float inputEventsScaleFactor() const { return visibleContentScaleFactor(); }
+
     // Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible
     // content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead.
     IntSize layoutSize(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
@@ -204,7 +207,7 @@
     void adjustScrollbarsAvoidingResizerCount(int overlapDelta);
     void windowResizerRectChanged();
 
-    virtual void setParent(ScrollView*); // Overridden to update the overlapping scrollbar count.
+    virtual void setParent(Widget*) OVERRIDE; // Overridden to update the overlapping scrollbar count.
 
     // Called when our frame rect changes (or the rect/scroll position of an ancestor changes).
     virtual void frameRectsChanged();
@@ -218,7 +221,7 @@
     // For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
     Scrollbar* scrollbarAtPoint(const IntPoint& windowPoint);
 
-    IntPoint convertChildToSelf(const Widget* child, const IntPoint& point) const
+    virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint& point) const
     {
         IntPoint newPoint = point;
         if (!isScrollViewScrollbar(child))
@@ -227,7 +230,7 @@
         return newPoint;
     }
 
-    IntPoint convertSelfToChild(const Widget* child, const IntPoint& point) const
+    virtual IntPoint convertSelfToChild(const Widget* child, const IntPoint& point) const
     {
         IntPoint newPoint = point;
         if (!isScrollViewScrollbar(child))
@@ -236,6 +239,9 @@
         return newPoint;
     }
 
+    // A means to access the AX cache when this object can get a pointer to it.
+    virtual AXObjectCache* axObjectCache() const { return 0; }
+
     // Widget override. Handles painting of the contents of the view as well as the scrollbars.
     virtual void paint(GraphicsContext*, const IntRect&);
     void paintScrollbars(GraphicsContext*, const IntRect&);
diff --git a/Source/core/platform/ScrollableArea.cpp b/Source/core/platform/ScrollableArea.cpp
index 8bb6bed..f65f497 100644
--- a/Source/core/platform/ScrollableArea.cpp
+++ b/Source/core/platform/ScrollableArea.cpp
@@ -34,11 +34,11 @@
 
 #include "core/platform/ScrollAnimator.h"
 #include "core/platform/ScrollbarTheme.h"
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/platform/graphics/GraphicsLayer.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/PassOwnPtr.h"
 
-#include "core/platform/chromium/TraceEvent.h"
+#include "platform/TraceEvent.h"
 
 static const int kPixelsPerLineStep = 40;
 static const float kMinFractionToStepWhenPaging = 0.875f;
diff --git a/Source/core/platform/Scrollbar.cpp b/Source/core/platform/Scrollbar.cpp
index 96c712b..6a4f511 100644
--- a/Source/core/platform/Scrollbar.cpp
+++ b/Source/core/platform/Scrollbar.cpp
@@ -27,8 +27,6 @@
 #include "core/platform/Scrollbar.h"
 
 #include <algorithm>
-#include "core/platform/PlatformGestureEvent.h"
-#include "core/platform/PlatformMouseEvent.h"
 #include "core/platform/ScrollAnimator.h"
 #include "core/platform/ScrollableArea.h"
 #include "core/platform/ScrollbarTheme.h"
@@ -37,8 +35,11 @@
 // FIXME: The following #includes are a layering violation and should be removed.
 #include "core/accessibility/AXObjectCache.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
+
+#include "platform/PlatformGestureEvent.h"
+#include "platform/PlatformMouseEvent.h"
 
 using namespace std;
 
@@ -100,6 +101,22 @@
     m_theme->unregisterScrollbar(this);
 }
 
+void Scrollbar::removeFromParent()
+{
+    if (parent())
+        toScrollView(parent())->removeChild(this);
+}
+
+ScrollView* Scrollbar::parentScrollView() const
+{
+    return toScrollView(parent());
+}
+
+ScrollView* Scrollbar::rootScrollView() const
+{
+    return toScrollView(root());
+}
+
 ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const
 {
     return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : ScrollbarOverlayStyleDefault;
@@ -340,7 +357,7 @@
 {
     bool handled = false;
     switch (evt.type()) {
-    case PlatformEvent::GestureTapDown:
+    case PlatformEvent::GestureShowPress:
         setPressedPart(theme()->hitTest(this, evt.position()));
         m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
         return true;
@@ -479,7 +496,7 @@
     // if necessary.
     IntRect adjustedRect(rect);
     bool overlapsResizer = false;
-    ScrollView* view = parent();
+    ScrollView* view = parentScrollView();
     if (view && !rect.isEmpty() && !view->windowResizerRect().isEmpty()) {
         IntRect resizerRect = view->convertFromContainingWindow(view->windowResizerRect());
         if (rect.intersects(resizerRect)) {
@@ -507,10 +524,10 @@
     Widget::setFrameRect(adjustedRect);
 }
 
-void Scrollbar::setParent(ScrollView* parentView)
+void Scrollbar::setParent(Widget* parentView)
 {
-    if (!parentView && m_overlapsResizer && parent())
-        parent()->adjustScrollbarsAvoidingResizerCount(-1);
+    if (!parentView && m_overlapsResizer && parentScrollView())
+        parentScrollView()->adjustScrollbarsAvoidingResizerCount(-1);
     Widget::setParent(parentView);
 }
 
@@ -543,10 +560,10 @@
 
 AXObjectCache* Scrollbar::existingAXObjectCache() const
 {
-    if (!parent())
+    if (!parentScrollView())
         return 0;
 
-    return parent()->axObjectCache();
+    return parentScrollView()->axObjectCache();
 }
 
 void Scrollbar::invalidateRect(const IntRect& rect)
diff --git a/Source/core/platform/Scrollbar.h b/Source/core/platform/Scrollbar.h
index f8de1fa..398656e 100644
--- a/Source/core/platform/Scrollbar.h
+++ b/Source/core/platform/Scrollbar.h
@@ -26,21 +26,23 @@
 #ifndef Scrollbar_h
 #define Scrollbar_h
 
-#include "core/platform/ScrollTypes.h"
-#include "core/platform/ScrollbarThemeClient.h"
-#include "core/platform/Timer.h"
-#include "core/platform/Widget.h"
+#include "platform/Timer.h"
+#include "platform/Widget.h"
+#include "platform/scroll/ScrollTypes.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
 #include "wtf/MathExtras.h"
 #include "wtf/PassRefPtr.h"
 
 namespace WebCore {
 
+class AXObjectCache;
 class GraphicsContext;
 class IntRect;
 class PlatformGestureEvent;
 class PlatformMouseEvent;
 class ScrollableArea;
 class ScrollbarTheme;
+class ScrollView;
 
 class Scrollbar : public Widget,
                   public ScrollbarThemeClient {
@@ -58,8 +60,12 @@
     virtual IntSize size() const { return Widget::size(); }
     virtual IntPoint location() const { return Widget::location(); }
 
-    virtual ScrollView* parent() const { return Widget::parent(); }
-    virtual ScrollView* root() const { return Widget::root(); }
+    virtual Widget* parent() const { return Widget::parent(); }
+    virtual Widget* root() const { return Widget::root(); }
+
+    void removeFromParent();
+    ScrollView* parentScrollView() const;
+    ScrollView* rootScrollView() const;
 
     virtual void setFrameRect(const IntRect&);
     virtual IntRect frameRect() const { return Widget::frameRect(); }
@@ -129,7 +135,7 @@
 
     ScrollbarTheme* theme() const { return m_theme; }
 
-    virtual void setParent(ScrollView*);
+    virtual void setParent(Widget*) OVERRIDE;
 
     bool suppressInvalidation() const { return m_suppressInvalidation; }
     void setSuppressInvalidation(bool s) { m_suppressInvalidation = s; }
@@ -192,6 +198,21 @@
     float scrollableAreaCurrentPos() const;
 };
 
+inline Scrollbar* toScrollbar(Widget* widget)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!widget || widget->isScrollbar());
+    return static_cast<Scrollbar*>(widget);
+}
+
+inline const Scrollbar* toScrollbar(const Widget* widget)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!widget || widget->isScrollbar());
+    return static_cast<const Scrollbar*>(widget);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toScrollbar(const Scrollbar*);
+
 } // namespace WebCore
 
 #endif // Scrollbar_h
diff --git a/Source/core/platform/ScrollbarTheme.cpp b/Source/core/platform/ScrollbarTheme.cpp
index 4e910b0..03915a9 100644
--- a/Source/core/platform/ScrollbarTheme.cpp
+++ b/Source/core/platform/ScrollbarTheme.cpp
@@ -27,17 +27,16 @@
 #include "core/platform/ScrollbarTheme.h"
 
 #include "RuntimeEnabledFeatures.h"
-#include "core/page/Settings.h"
-#include "core/platform/ScrollbarThemeClient.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/mock/ScrollbarThemeMock.h"
 #include "core/platform/mock/ScrollbarThemeOverlayMock.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
 
 namespace WebCore {
 
 ScrollbarTheme* ScrollbarTheme::theme()
 {
-    if (Settings::mockScrollbarsEnabled()) {
+    if (ScrollbarTheme::mockScrollbarsEnabled()) {
         if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) {
             DEFINE_STATIC_LOCAL(ScrollbarThemeOverlayMock, overlayMockTheme, ());
             return &overlayMockTheme;
@@ -49,6 +48,18 @@
     return nativeTheme();
 }
 
+bool ScrollbarTheme::gMockScrollbarsEnabled = false;
+
+void ScrollbarTheme::setMockScrollbarsEnabled(bool flag)
+{
+    gMockScrollbarsEnabled = flag;
+}
+
+bool ScrollbarTheme::mockScrollbarsEnabled()
+{
+    return gMockScrollbarsEnabled;
+}
+
 bool ScrollbarTheme::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& damageRect)
 {
     // Create the ScrollbarControlPartMask based on the damageRect
diff --git a/Source/core/platform/ScrollbarTheme.h b/Source/core/platform/ScrollbarTheme.h
index 12b4829..cd84390 100644
--- a/Source/core/platform/ScrollbarTheme.h
+++ b/Source/core/platform/ScrollbarTheme.h
@@ -26,9 +26,9 @@
 #ifndef ScrollbarTheme_h
 #define ScrollbarTheme_h
 
-#include "core/platform/ScrollTypes.h"
 #include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/scroll/ScrollTypes.h"
 
 namespace WebCore {
 
@@ -138,8 +138,12 @@
 
     static ScrollbarTheme* theme();
 
+    static void setMockScrollbarsEnabled(bool flag);
+    static bool mockScrollbarsEnabled();
+
 private:
     static ScrollbarTheme* nativeTheme(); // Must be implemented to return the correct theme subclass.
+    static bool gMockScrollbarsEnabled;
 };
 
 }
diff --git a/Source/core/platform/ScrollbarThemeAuraOrGtk.cpp b/Source/core/platform/ScrollbarThemeAuraOrGtk.cpp
index 88791df..f5fc748 100644
--- a/Source/core/platform/ScrollbarThemeAuraOrGtk.cpp
+++ b/Source/core/platform/ScrollbarThemeAuraOrGtk.cpp
@@ -32,10 +32,10 @@
 #include "core/platform/ScrollbarThemeAuraOrGtk.h"
 
 #include "RuntimeEnabledFeatures.h"
-#include "core/platform/PlatformMouseEvent.h"
-#include "core/platform/Scrollbar.h"
 #include "core/platform/ScrollbarThemeOverlay.h"
 #include "core/platform/graphics/GraphicsContext.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebRect.h"
 #include "public/platform/default/WebThemeEngine.h"
diff --git a/Source/core/platform/ScrollbarThemeClient.h b/Source/core/platform/ScrollbarThemeClient.h
deleted file mode 100644
index 1fca367..0000000
--- a/Source/core/platform/ScrollbarThemeClient.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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 ScrollbarThemeClient_h
-#define ScrollbarThemeClient_h
-
-#include "core/platform/ScrollTypes.h"
-#include "core/platform/graphics/IntPoint.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/IntSize.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class ScrollView;
-
-class ScrollbarThemeClient {
-public:
-    virtual int x() const = 0;
-    virtual int y() const = 0;
-    virtual int width() const = 0;
-    virtual int height() const = 0;
-    virtual IntSize size() const = 0;
-    virtual IntPoint location() const = 0;
-
-    virtual ScrollView* parent() const = 0;
-    virtual ScrollView* root() const = 0;
-
-    virtual void setFrameRect(const IntRect&) = 0;
-    virtual IntRect frameRect() const = 0;
-
-    virtual void invalidate() = 0;
-    virtual void invalidateRect(const IntRect&) = 0;
-
-    virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const = 0;
-    virtual void getTickmarks(Vector<IntRect>&) const = 0;
-    virtual bool isScrollableAreaActive() const = 0;
-    virtual bool isScrollViewScrollbar() const = 0;
-
-    virtual IntPoint convertFromContainingWindow(const IntPoint& windowPoint) = 0;
-
-    virtual bool isCustomScrollbar() const = 0;
-    virtual ScrollbarOrientation orientation() const = 0;
-    virtual bool isLeftSideVerticalScrollbar() const = 0;
-
-    virtual int value() const = 0;
-    virtual float currentPos() const = 0;
-    virtual int visibleSize() const = 0;
-    virtual int totalSize() const = 0;
-    virtual int maximum() const = 0;
-    virtual ScrollbarControlSize controlSize() const = 0;
-
-    virtual ScrollbarPart pressedPart() const = 0;
-    virtual ScrollbarPart hoveredPart() const = 0;
-
-    virtual void styleChanged() = 0;
-
-    virtual bool enabled() const = 0;
-    virtual void setEnabled(bool) = 0;
-
-    virtual bool isOverlayScrollbar() const = 0;
-
-    virtual bool isAlphaLocked() const = 0;
-    virtual void setIsAlphaLocked(bool) = 0;
-
-protected:
-    virtual ~ScrollbarThemeClient() { }
-};
-
-} // namespace WebCore
-
-#endif // ScollbarThemeClient_h
diff --git a/Source/core/platform/ScrollbarThemeMacCommon.mm b/Source/core/platform/ScrollbarThemeMacCommon.mm
index 9aacbf4..d0559f7 100644
--- a/Source/core/platform/ScrollbarThemeMacCommon.mm
+++ b/Source/core/platform/ScrollbarThemeMacCommon.mm
@@ -27,8 +27,7 @@
 #include "core/platform/ScrollbarThemeMacCommon.h"
 
 #include <Carbon/Carbon.h>
-#include "core/page/FrameView.h"
-#include "core/platform/PlatformMouseEvent.h"
+#include "core/frame/FrameView.h"
 #include "core/platform/ScrollView.h"
 #include "core/platform/ScrollbarThemeMacNonOverlayAPI.h"
 #include "core/platform/ScrollbarThemeMacOverlayAPI.h"
@@ -41,6 +40,7 @@
 #include "core/platform/mac/LocalCurrentGraphicsContext.h"
 #include "core/platform/mac/NSScrollerImpDetails.h"
 #include "core/platform/mac/ScrollAnimatorMac.h"
+#include "platform/PlatformMouseEvent.h"
 #include "public/platform/mac/WebThemeEngine.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebRect.h"
diff --git a/Source/core/platform/ScrollbarThemeMacNonOverlayAPI.mm b/Source/core/platform/ScrollbarThemeMacNonOverlayAPI.mm
index dc85400..f9ec392 100644
--- a/Source/core/platform/ScrollbarThemeMacNonOverlayAPI.mm
+++ b/Source/core/platform/ScrollbarThemeMacNonOverlayAPI.mm
@@ -32,7 +32,7 @@
 #include "core/platform/ScrollbarThemeMacNonOverlayAPI.h"
 
 #include <Carbon/Carbon.h>
-#include "core/platform/ScrollbarThemeClient.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
 #include "public/platform/mac/WebThemeEngine.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebRect.h"
diff --git a/Source/core/platform/ScrollbarThemeMacOverlayAPI.mm b/Source/core/platform/ScrollbarThemeMacOverlayAPI.mm
index cac425e..d0434cc 100644
--- a/Source/core/platform/ScrollbarThemeMacOverlayAPI.mm
+++ b/Source/core/platform/ScrollbarThemeMacOverlayAPI.mm
@@ -35,7 +35,7 @@
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/mac/LocalCurrentGraphicsContext.h"
 #include "core/platform/mac/NSScrollerImpDetails.h"
-#include "core/platform/ScrollbarThemeClient.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/ScrollbarThemeNonMacCommon.cpp b/Source/core/platform/ScrollbarThemeNonMacCommon.cpp
index 72208ba..4a62adf 100644
--- a/Source/core/platform/ScrollbarThemeNonMacCommon.cpp
+++ b/Source/core/platform/ScrollbarThemeNonMacCommon.cpp
@@ -27,11 +27,11 @@
 #include "config.h"
 #include "core/platform/ScrollbarThemeNonMacCommon.h"
 
-#include "core/platform/PlatformMouseEvent.h"
 #include "core/platform/ScrollableArea.h"
-#include "core/platform/Scrollbar.h"
 #include "core/platform/ScrollbarTheme.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/ScrollbarThemeOverlay.cpp b/Source/core/platform/ScrollbarThemeOverlay.cpp
index 4d705a0..2ed789c 100644
--- a/Source/core/platform/ScrollbarThemeOverlay.cpp
+++ b/Source/core/platform/ScrollbarThemeOverlay.cpp
@@ -26,10 +26,10 @@
 #include "config.h"
 #include "core/platform/ScrollbarThemeOverlay.h"
 
-#include "core/platform/PlatformMouseEvent.h"
-#include "core/platform/Scrollbar.h"
 #include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
+#include "platform/transforms/TransformationMatrix.h"
 
 #include <algorithm>
 
diff --git a/Source/core/platform/ScrollbarThemeWin.cpp b/Source/core/platform/ScrollbarThemeWin.cpp
index d8f51e4..8a6ad25 100644
--- a/Source/core/platform/ScrollbarThemeWin.cpp
+++ b/Source/core/platform/ScrollbarThemeWin.cpp
@@ -30,14 +30,15 @@
 #include <windows.h>
 #include <vsstyle.h>
 
-#include "core/platform/LayoutTestSupport.h"
-#include "core/platform/PlatformMouseEvent.h"
-#include "core/platform/Scrollbar.h"
 #include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/win/SystemInfo.h"
+#include "platform/LayoutTestSupport.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
+#include "platform/win/SystemInfo.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebRect.h"
 #include "public/platform/win/WebThemeEngine.h"
+
 namespace WebCore {
 
 ScrollbarTheme* ScrollbarTheme::nativeTheme()
diff --git a/Source/core/platform/SecureTextInput.cpp b/Source/core/platform/SecureTextInput.cpp
deleted file mode 100644
index 78d3b81..0000000
--- a/Source/core/platform/SecureTextInput.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 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.
- */
-
-#include "config.h"
-
-// FIXME: This should be moved to WebKit, because browser process needs to track secure input state anyway to manipulate input contexts.
-#if OS(MACOSX)
-#include "core/platform/SecureTextInput.h"
-
-#import <Carbon/Carbon.h>
-
-namespace WebCore {
-
-void enableSecureTextInput()
-{
-    if (IsSecureEventInputEnabled())
-        return;
-    EnableSecureEventInput();
-}
-
-void disableSecureTextInput()
-{
-    if (!IsSecureEventInputEnabled())
-        return;
-    DisableSecureEventInput();
-}
-
-} // namespace WebCore
-
-#endif // OS(MACOSX)
diff --git a/Source/core/platform/SecureTextInput.h b/Source/core/platform/SecureTextInput.h
deleted file mode 100644
index 146e62c..0000000
--- a/Source/core/platform/SecureTextInput.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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
- * 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 SecureTextInput_h
-#define SecureTextInput_h
-
-namespace WebCore {
-
-// Once enableSecureTextInput is called, secure text input mode is set until
-// disableSecureTextInput has been called.
-void enableSecureTextInput();
-void disableSecureTextInput();
-
-#if !OS(MACOSX)
-inline void enableSecureTextInput() { }
-inline void disableSecureTextInput() { }
-#endif
-
-} // namespace WebCore
-
-#endif // SecureTextInput_h
diff --git a/Source/core/platform/SerializedResource.h b/Source/core/platform/SerializedResource.h
index 76fd022..029c333 100644
--- a/Source/core/platform/SerializedResource.h
+++ b/Source/core/platform/SerializedResource.h
@@ -31,7 +31,7 @@
 #ifndef SerializedResource_h
 #define SerializedResource_h
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "weborigin/KURL.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/platform/SharedBuffer.cpp b/Source/core/platform/SharedBuffer.cpp
deleted file mode 100644
index ce2c37a..0000000
--- a/Source/core/platform/SharedBuffer.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
- * Copyright (C) Research In Motion Limited 2009-2010. 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,
- * 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/SharedBuffer.h"
-
-#include "core/platform/PurgeableBuffer.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/unicode/Unicode.h"
-#include "wtf/unicode/UTF8.h"
-
-#undef SHARED_BUFFER_STATS
-
-#ifdef SHARED_BUFFER_STATS
-#include "wtf/DataLog.h"
-#include "wtf/MainThread.h"
-#endif
-
-using namespace std;
-
-namespace WebCore {
-
-static const unsigned segmentSize = 0x1000;
-static const unsigned segmentPositionMask = 0x0FFF;
-
-static inline unsigned segmentIndex(unsigned position)
-{
-    return position / segmentSize;
-}
-
-static inline unsigned offsetInSegment(unsigned position)
-{
-    return position & segmentPositionMask;
-}
-
-static inline char* allocateSegment()
-{
-    return static_cast<char*>(fastMalloc(segmentSize));
-}
-
-static inline void freeSegment(char* p)
-{
-    fastFree(p);
-}
-
-#ifdef SHARED_BUFFER_STATS
-
-static Mutex& statsMutex()
-{
-    DEFINE_STATIC_LOCAL(Mutex, mutex, ());
-    return mutex;
-}
-
-static HashSet<SharedBuffer*>& liveBuffers()
-{
-    DEFINE_STATIC_LOCAL(HashSet<SharedBuffer*>, buffers, ());
-    return buffers;
-}
-
-static bool sizeComparator(SharedBuffer* a, SharedBuffer* b)
-{
-    return a->size() > b->size();
-}
-
-static CString snippetForBuffer(SharedBuffer* sharedBuffer)
-{
-    const unsigned kMaxSnippetLength = 64;
-    char* snippet = 0;
-    unsigned snippetLength = std::min(sharedBuffer->size(), kMaxSnippetLength);
-    CString result = CString::newUninitialized(snippetLength, snippet);
-
-    const char* segment;
-    unsigned offset = 0;
-    while (unsigned segmentLength = sharedBuffer->getSomeData(segment, offset)) {
-        unsigned length = std::min(segmentLength, snippetLength - offset);
-        memcpy(snippet + offset, segment, length);
-        offset += segmentLength;
-        if (offset >= snippetLength)
-            break;
-    }
-
-    for (unsigned i = 0; i < snippetLength; ++i) {
-        if (!isASCIIPrintable(snippet[i]))
-            snippet[i] = '?';
-    }
-
-    return result;
-}
-
-static void printStats(void*)
-{
-    MutexLocker locker(statsMutex());
-    Vector<SharedBuffer*> buffers;
-    for (HashSet<SharedBuffer*>::const_iterator iter = liveBuffers().begin(); iter != liveBuffers().end(); ++iter)
-        buffers.append(*iter);
-    std::sort(buffers.begin(), buffers.end(), sizeComparator);
-
-    dataLogF("---- Shared Buffer Stats ----\n");
-    for (size_t i = 0; i < buffers.size() && i < 64; ++i) {
-        CString snippet = snippetForBuffer(buffers[i]);
-        dataLogF("Buffer size=%8u %s\n", buffers[i]->size(), snippet.data());
-    }
-}
-
-static void didCreateSharedBuffer(SharedBuffer* buffer)
-{
-    MutexLocker locker(statsMutex());
-    liveBuffers().add(buffer);
-
-    callOnMainThread(printStats, 0);
-}
-
-static void willDestroySharedBuffer(SharedBuffer* buffer)
-{
-    MutexLocker locker(statsMutex());
-    liveBuffers().remove(buffer);
-}
-
-#endif
-
-SharedBuffer::SharedBuffer()
-    : m_size(0)
-{
-#ifdef SHARED_BUFFER_STATS
-    didCreateSharedBuffer(this);
-#endif
-}
-
-SharedBuffer::SharedBuffer(size_t size)
-    : m_size(size)
-    , m_buffer(size)
-{
-#ifdef SHARED_BUFFER_STATS
-    didCreateSharedBuffer(this);
-#endif
-}
-
-SharedBuffer::SharedBuffer(const char* data, int size)
-    : m_size(0)
-{
-    // FIXME: Use unsigned consistently, and check for invalid casts when calling into SharedBuffer from other code.
-    if (size < 0)
-        CRASH();
-
-    append(data, size);
-
-#ifdef SHARED_BUFFER_STATS
-    didCreateSharedBuffer(this);
-#endif
-}
-
-SharedBuffer::SharedBuffer(const unsigned char* data, int size)
-    : m_size(0)
-{
-    // FIXME: Use unsigned consistently, and check for invalid casts when calling into SharedBuffer from other code.
-    if (size < 0)
-        CRASH();
-
-    append(reinterpret_cast<const char*>(data), size);
-
-#ifdef SHARED_BUFFER_STATS
-    didCreateSharedBuffer(this);
-#endif
-}
-
-SharedBuffer::~SharedBuffer()
-{
-    clear();
-
-#ifdef SHARED_BUFFER_STATS
-    willDestroySharedBuffer(this);
-#endif
-}
-
-PassRefPtr<SharedBuffer> SharedBuffer::adoptVector(Vector<char>& vector)
-{
-    RefPtr<SharedBuffer> buffer = create();
-    buffer->m_buffer.swap(vector);
-    buffer->m_size = buffer->m_buffer.size();
-    return buffer.release();
-}
-
-PassRefPtr<SharedBuffer> SharedBuffer::adoptPurgeableBuffer(PassOwnPtr<PurgeableBuffer> purgeableBuffer)
-{
-    ASSERT(!purgeableBuffer->isPurgeable());
-    RefPtr<SharedBuffer> buffer = create();
-    buffer->m_purgeableBuffer = purgeableBuffer;
-    return buffer.release();
-}
-
-unsigned SharedBuffer::size() const
-{
-    if (m_purgeableBuffer)
-        return m_purgeableBuffer->size();
-
-    return m_size;
-}
-
-void SharedBuffer::createPurgeableBuffer() const
-{
-    if (m_purgeableBuffer)
-        return;
-
-    m_purgeableBuffer = PurgeableBuffer::create(buffer().data(), m_size);
-}
-
-const char* SharedBuffer::data() const
-{
-    if (m_purgeableBuffer)
-        return m_purgeableBuffer->data();
-
-    return this->buffer().data();
-}
-
-void SharedBuffer::moveTo(Vector<char>& result)
-{
-    ASSERT(result.isEmpty());
-    if (m_purgeableBuffer) {
-        result.reserveCapacity(m_purgeableBuffer->size());
-        result.append(m_purgeableBuffer->data(), m_purgeableBuffer->size());
-        clear();
-        return;
-    }
-
-    unsigned bufferSize = m_buffer.size();
-    if (m_size == bufferSize) {
-        m_buffer.swap(result);
-        clear();
-        return;
-    }
-
-    result.reserveCapacity(m_size);
-
-    const char* segment = 0;
-    unsigned position = 0;
-    while (unsigned segmentSize = getSomeData(segment, position)) {
-        result.append(segment, segmentSize);
-        position += segmentSize;
-    }
-    ASSERT(result.size() == m_size);
-    clear();
-    return;
-}
-
-void SharedBuffer::append(SharedBuffer* data)
-{
-    const char* segment;
-    size_t position = 0;
-    while (size_t length = data->getSomeData(segment, position)) {
-        append(segment, length);
-        position += length;
-    }
-}
-
-void SharedBuffer::append(const char* data, unsigned length)
-{
-    ASSERT(!m_purgeableBuffer);
-    if (!length)
-        return;
-
-    unsigned positionInSegment = offsetInSegment(m_size - m_buffer.size());
-    m_size += length;
-
-    if (m_size <= segmentSize) {
-        // No need to use segments for small resource data
-        if (m_buffer.isEmpty())
-            m_buffer.reserveInitialCapacity(length);
-        m_buffer.append(data, length);
-        return;
-    }
-
-    char* segment;
-    if (!positionInSegment) {
-        segment = allocateSegment();
-        m_segments.append(segment);
-    } else
-        segment = m_segments.last() + positionInSegment;
-
-    unsigned segmentFreeSpace = segmentSize - positionInSegment;
-    unsigned bytesToCopy = min(length, segmentFreeSpace);
-
-    for (;;) {
-        memcpy(segment, data, bytesToCopy);
-        if (static_cast<unsigned>(length) == bytesToCopy)
-            break;
-
-        length -= bytesToCopy;
-        data += bytesToCopy;
-        segment = allocateSegment();
-        m_segments.append(segment);
-        bytesToCopy = min(length, segmentSize);
-    }
-}
-
-void SharedBuffer::append(const Vector<char>& data)
-{
-    append(data.data(), data.size());
-}
-
-void SharedBuffer::clear()
-{
-    for (unsigned i = 0; i < m_segments.size(); ++i)
-        freeSegment(m_segments[i]);
-
-    m_segments.clear();
-    m_size = 0;
-
-    m_buffer.clear();
-    m_purgeableBuffer.clear();
-}
-
-PassRefPtr<SharedBuffer> SharedBuffer::copy() const
-{
-    RefPtr<SharedBuffer> clone(adoptRef(new SharedBuffer));
-    if (m_purgeableBuffer) {
-        clone->append(data(), size());
-        return clone.release();
-    }
-
-    clone->m_size = m_size;
-    clone->m_buffer.reserveCapacity(m_size);
-    clone->m_buffer.append(m_buffer.data(), m_buffer.size());
-    if (!m_segments.isEmpty()) {
-        const char* segment = 0;
-        unsigned position = m_buffer.size();
-        while (unsigned segmentSize = getSomeData(segment, position)) {
-            clone->m_buffer.append(segment, segmentSize);
-            position += segmentSize;
-        }
-        ASSERT(position == clone->size());
-    }
-    return clone.release();
-}
-
-PassOwnPtr<PurgeableBuffer> SharedBuffer::releasePurgeableBuffer()
-{
-    ASSERT(hasOneRef());
-    return m_purgeableBuffer.release();
-}
-
-const Vector<char>& SharedBuffer::buffer() const
-{
-    unsigned bufferSize = m_buffer.size();
-    if (m_size > bufferSize) {
-        m_buffer.resize(m_size);
-        char* destination = m_buffer.data() + bufferSize;
-        unsigned bytesLeft = m_size - bufferSize;
-        for (unsigned i = 0; i < m_segments.size(); ++i) {
-            unsigned bytesToCopy = min(bytesLeft, segmentSize);
-            memcpy(destination, m_segments[i], bytesToCopy);
-            destination += bytesToCopy;
-            bytesLeft -= bytesToCopy;
-            freeSegment(m_segments[i]);
-        }
-        m_segments.clear();
-    }
-    return m_buffer;
-}
-
-unsigned SharedBuffer::getSomeData(const char*& someData, unsigned position) const
-{
-    unsigned totalSize = size();
-    if (position >= totalSize) {
-        someData = 0;
-        return 0;
-    }
-
-    if (m_purgeableBuffer) {
-        ASSERT_WITH_SECURITY_IMPLICATION(position < size());
-        someData = data() + position;
-        return totalSize - position;
-    }
-
-    ASSERT_WITH_SECURITY_IMPLICATION(position < m_size);
-    unsigned consecutiveSize = m_buffer.size();
-    if (position < consecutiveSize) {
-        someData = m_buffer.data() + position;
-        return consecutiveSize - position;
-    }
-
-    position -= consecutiveSize;
-    unsigned segments = m_segments.size();
-    unsigned maxSegmentedSize = segments * segmentSize;
-    unsigned segment = segmentIndex(position);
-    if (segment < segments) {
-        unsigned bytesLeft = totalSize - consecutiveSize;
-        unsigned segmentedSize = min(maxSegmentedSize, bytesLeft);
-
-        unsigned positionInSegment = offsetInSegment(position);
-        someData = m_segments[segment] + positionInSegment;
-        return segment == segments - 1 ? segmentedSize - position : segmentSize - positionInSegment;
-    }
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-PassRefPtr<ArrayBuffer> SharedBuffer::getAsArrayBuffer() const
-{
-    RefPtr<ArrayBuffer> arrayBuffer = ArrayBuffer::createUninitialized(static_cast<unsigned>(size()), 1);
-
-    const char* segment = 0;
-    unsigned position = 0;
-    while (unsigned segmentSize = getSomeData(segment, position)) {
-        memcpy(static_cast<char*>(arrayBuffer->data()) + position, segment, segmentSize);
-        position += segmentSize;
-    }
-
-    if (position != arrayBuffer->byteLength()) {
-        ASSERT_NOT_REACHED();
-        // Don't return the incomplete ArrayBuffer.
-        return 0;
-    }
-
-    return arrayBuffer;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/SharedBuffer.h b/Source/core/platform/SharedBuffer.h
deleted file mode 100644
index 4e6dcf8..0000000
--- a/Source/core/platform/SharedBuffer.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) Research In Motion Limited 2009-2010. 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,
- * 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 SharedBuffer_h
-#define SharedBuffer_h
-
-#include "wtf/ArrayBuffer.h"
-#include "wtf/Forward.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class PurgeableBuffer;
-
-class SharedBuffer : public RefCounted<SharedBuffer> {
-public:
-    static PassRefPtr<SharedBuffer> create() { return adoptRef(new SharedBuffer); }
-    static PassRefPtr<SharedBuffer> create(size_t size) { return adoptRef(new SharedBuffer(size)); }
-    static PassRefPtr<SharedBuffer> create(const char* c, int i) { return adoptRef(new SharedBuffer(c, i)); }
-    static PassRefPtr<SharedBuffer> create(const unsigned char* c, int i) { return adoptRef(new SharedBuffer(c, i)); }
-
-    static PassRefPtr<SharedBuffer> adoptVector(Vector<char>& vector);
-
-    // The buffer must be in non-purgeable state before adopted to a SharedBuffer.
-    // It will stay that way until released.
-    static PassRefPtr<SharedBuffer> adoptPurgeableBuffer(PassOwnPtr<PurgeableBuffer>);
-
-    ~SharedBuffer();
-
-    // Calling this function will force internal segmented buffers
-    // to be merged into a flat buffer. Use getSomeData() whenever possible
-    // for better performance.
-    const char* data() const;
-
-    void moveTo(Vector<char>&);
-
-    unsigned size() const;
-
-    bool isEmpty() const { return !size(); }
-
-    void append(SharedBuffer*);
-    void append(const char*, unsigned);
-    void append(const Vector<char>&);
-
-    void clear();
-
-    PassRefPtr<SharedBuffer> copy() const;
-
-    bool hasPurgeableBuffer() const { return m_purgeableBuffer.get(); }
-
-    // Ensure this buffer has no other clients before calling this.
-    PassOwnPtr<PurgeableBuffer> releasePurgeableBuffer();
-
-    // Return the number of consecutive bytes after "position". "data"
-    // points to the first byte.
-    // Return 0 when no more data left.
-    // When extracting all data with getSomeData(), the caller should
-    // repeat calling it until it returns 0.
-    // Usage:
-    //      const char* segment;
-    //      unsigned pos = 0;
-    //      while (unsigned length = sharedBuffer->getSomeData(segment, pos)) {
-    //          // Use the data. for example: decoder->decode(segment, length);
-    //          pos += length;
-    //      }
-    unsigned getSomeData(const char*& data, unsigned position = 0) const;
-
-    void createPurgeableBuffer() const;
-
-    // Creates an ArrayBuffer and copies this SharedBuffer's contents to that
-    // ArrayBuffer without merging segmented buffers into a flat buffer.
-    PassRefPtr<ArrayBuffer> getAsArrayBuffer() const;
-
-private:
-    SharedBuffer();
-    explicit SharedBuffer(size_t);
-    SharedBuffer(const char*, int);
-    SharedBuffer(const unsigned char*, int);
-
-    // Calling this function will force internal segmented buffers
-    // to be merged into a flat buffer. Use getSomeData() whenever possible
-    // for better performance.
-    // As well, be aware that this method does *not* return any purgeable
-    // memory, which can be a source of bugs.
-    const Vector<char>& buffer() const;
-
-    unsigned m_size;
-    mutable Vector<char> m_buffer;
-    mutable Vector<char*> m_segments;
-    mutable OwnPtr<PurgeableBuffer> m_purgeableBuffer;
-};
-
-} // namespace WebCore
-
-#endif // SharedBuffer_h
diff --git a/Source/core/platform/SharedBufferChunkReader.cpp b/Source/core/platform/SharedBufferChunkReader.cpp
deleted file mode 100644
index 8b216bd..0000000
--- a/Source/core/platform/SharedBufferChunkReader.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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/SharedBufferChunkReader.h"
-
-#include "core/platform/SharedBuffer.h"
-
-namespace WebCore {
-
-SharedBufferChunkReader::SharedBufferChunkReader(SharedBuffer* buffer, const Vector<char>& separator)
-    : m_buffer(buffer)
-    , m_bufferPosition(0)
-    , m_segment(0)
-    , m_segmentLength(0)
-    , m_segmentIndex(0)
-    , m_reachedEndOfFile(false)
-    , m_separator(separator)
-    , m_separatorIndex(0)
-{
-}
-
-SharedBufferChunkReader::SharedBufferChunkReader(SharedBuffer* buffer, const char* separator)
-    : m_buffer(buffer)
-    , m_bufferPosition(0)
-    , m_segment(0)
-    , m_segmentLength(0)
-    , m_segmentIndex(0)
-    , m_reachedEndOfFile(false)
-    , m_separatorIndex(0)
-{
-    setSeparator(separator);
-}
-
-void SharedBufferChunkReader::setSeparator(const Vector<char>& separator)
-{
-    m_separator = separator;
-}
-
-void SharedBufferChunkReader::setSeparator(const char* separator)
-{
-    m_separator.clear();
-    m_separator.append(separator, strlen(separator));
-}
-
-bool SharedBufferChunkReader::nextChunk(Vector<char>& chunk, bool includeSeparator)
-{
-    if (m_reachedEndOfFile)
-        return false;
-
-    chunk.clear();
-    while (true) {
-        while (m_segmentIndex < m_segmentLength) {
-            char currentCharacter = m_segment[m_segmentIndex++];
-            if (currentCharacter != m_separator[m_separatorIndex]) {
-                if (m_separatorIndex > 0) {
-                    ASSERT_WITH_SECURITY_IMPLICATION(m_separatorIndex <= m_separator.size());
-                    chunk.append(m_separator.data(), m_separatorIndex);
-                    m_separatorIndex = 0;
-                }
-                chunk.append(currentCharacter);
-                continue;
-            }
-            m_separatorIndex++;
-            if (m_separatorIndex == m_separator.size()) {
-                if (includeSeparator)
-                    chunk.append(m_separator);
-                m_separatorIndex = 0;
-                return true;
-            }
-        }
-
-        // Read the next segment.
-        m_segmentIndex = 0;
-        m_bufferPosition += m_segmentLength;
-        m_segmentLength = m_buffer->getSomeData(m_segment, m_bufferPosition);
-        if (!m_segmentLength) {
-            m_reachedEndOfFile = true;
-            if (m_separatorIndex > 0)
-                chunk.append(m_separator.data(), m_separatorIndex);
-            return !chunk.isEmpty();
-        }
-    }
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
-String SharedBufferChunkReader::nextChunkAsUTF8StringWithLatin1Fallback(bool includeSeparator)
-{
-    Vector<char> data;
-    if (!nextChunk(data, includeSeparator))
-        return String();
-
-    return data.size() ? String::fromUTF8WithLatin1Fallback(data.data(), data.size()) : emptyString();
-}
-
-size_t SharedBufferChunkReader::peek(Vector<char>& data, size_t requestedSize)
-{
-    data.clear();
-    if (requestedSize <= m_segmentLength - m_segmentIndex) {
-        data.append(m_segment + m_segmentIndex, requestedSize);
-        return requestedSize;
-    }
-
-    size_t readBytesCount = m_segmentLength - m_segmentIndex;
-    data.append(m_segment + m_segmentIndex, readBytesCount);
-
-    size_t bufferPosition = m_bufferPosition + m_segmentLength;
-    const char* segment = 0;
-    while (size_t segmentLength = m_buffer->getSomeData(segment, bufferPosition)) {
-        if (requestedSize <= readBytesCount + segmentLength) {
-            data.append(segment, requestedSize - readBytesCount);
-            readBytesCount += (requestedSize - readBytesCount);
-            break;
-        }
-        data.append(segment, segmentLength);
-        readBytesCount += segmentLength;
-        bufferPosition += segmentLength;
-    }
-    return readBytesCount;
-}
-
-}
diff --git a/Source/core/platform/SharedBufferChunkReader.h b/Source/core/platform/SharedBufferChunkReader.h
deleted file mode 100644
index 107b460..0000000
--- a/Source/core/platform/SharedBufferChunkReader.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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 SharedBufferChunkReader_h
-#define SharedBufferChunkReader_h
-
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class SharedBuffer;
-
-class SharedBufferChunkReader {
-public:
-    SharedBufferChunkReader(SharedBuffer*, const Vector<char>& separator);
-    SharedBufferChunkReader(SharedBuffer*, const char* separator);
-
-    void setSeparator(const Vector<char>&);
-    void setSeparator(const char*);
-
-    // Returns false when the end of the buffer was reached.
-    bool nextChunk(Vector<char>& data, bool includeSeparator = false);
-
-    // Returns a null string when the end of the buffer has been reached.
-    String nextChunkAsUTF8StringWithLatin1Fallback(bool includeSeparator = false);
-
-    // Reads size bytes at the current location in the buffer, without changing the buffer position.
-    // Returns the number of bytes read. That number might be less than the specified size if the end of the buffer was reached.
-    size_t peek(Vector<char>&, size_t);
-
-private:
-    SharedBuffer* m_buffer;
-    size_t m_bufferPosition;
-    const char* m_segment;
-    size_t m_segmentLength;
-    size_t m_segmentIndex;
-    bool m_reachedEndOfFile;
-    Vector<char> m_separator;
-    size_t m_separatorIndex;
-};
-
-}
-
-#endif
diff --git a/Source/core/platform/SharedBufferTest.cpp b/Source/core/platform/SharedBufferTest.cpp
deleted file mode 100644
index 1afa914..0000000
--- a/Source/core/platform/SharedBufferTest.cpp
+++ /dev/null
@@ -1,173 +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.
- */
-
-#include "config.h"
-
-#include "core/platform/SharedBuffer.h"
-
-#include "wtf/ArrayBuffer.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-#include <gtest/gtest.h>
-
-using namespace WebCore;
-
-namespace {
-
-TEST(SharedBufferTest, getAsArrayBuffer)
-{
-    char testData0[] = "Hello";
-    char testData1[] = "World";
-    char testData2[] = "Goodbye";
-
-    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(testData0, strlen(testData0));
-    sharedBuffer->append(testData1, strlen(testData1));
-    sharedBuffer->append(testData2, strlen(testData2));
-
-    RefPtr<ArrayBuffer> arrayBuffer = sharedBuffer->getAsArrayBuffer();
-
-    char expectedConcatenation[] = "HelloWorldGoodbye";
-    ASSERT_EQ(strlen(expectedConcatenation), arrayBuffer->byteLength());
-    EXPECT_EQ(0, memcmp(expectedConcatenation, arrayBuffer->data(), strlen(expectedConcatenation)));
-}
-
-TEST(SharedBufferTest, moveToAvoidsMemcpy)
-{
-    char testData[] = "Hello";
-
-    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(testData, strlen(testData));
-
-    const char* originalData = sharedBuffer->data();
-    const size_t originalSize = sharedBuffer->size();
-
-    Vector<char> result;
-    sharedBuffer->moveTo(result);
-
-    EXPECT_TRUE(sharedBuffer->isEmpty());
-    EXPECT_EQ(originalData, result.data());
-    EXPECT_EQ(originalSize, result.size());
-}
-
-TEST(SharedBufferTest, moveToHandlesSegments)
-{
-    Vector<char> vector0(0x4000);
-    for (size_t i = 0; i < vector0.size(); ++i)
-        vector0[i] = 'a';
-    Vector<char> vector1(0x4000);
-    for (size_t i = 0; i < vector1.size(); ++i)
-        vector1[i] = 'b';
-    Vector<char> vector2(0x4000);
-    for (size_t i = 0; i < vector2.size(); ++i)
-        vector2[i] = 'c';
-
-    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::adoptVector(vector0);
-    sharedBuffer->append(vector1);
-    sharedBuffer->append(vector2);
-
-    const size_t originalSize = sharedBuffer->size();
-
-    Vector<char> result;
-    sharedBuffer->moveTo(result);
-
-    EXPECT_TRUE(sharedBuffer->isEmpty());
-    EXPECT_EQ(originalSize, result.size());
-}
-
-TEST(SharedBufferTest, getAsArrayBufferLargeSegments)
-{
-    Vector<char> vector0(0x4000);
-    for (size_t i = 0; i < vector0.size(); ++i)
-        vector0[i] = 'a';
-    Vector<char> vector1(0x4000);
-    for (size_t i = 0; i < vector1.size(); ++i)
-        vector1[i] = 'b';
-    Vector<char> vector2(0x4000);
-    for (size_t i = 0; i < vector2.size(); ++i)
-        vector2[i] = 'c';
-
-    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::adoptVector(vector0);
-    sharedBuffer->append(vector1);
-    sharedBuffer->append(vector2);
-
-    RefPtr<ArrayBuffer> arrayBuffer = sharedBuffer->getAsArrayBuffer();
-
-    ASSERT_EQ(0x4000U + 0x4000U + 0x4000U, arrayBuffer->byteLength());
-    int position = 0;
-    for (int i = 0; i < 0x4000; ++i) {
-        EXPECT_EQ('a', static_cast<char*>(arrayBuffer->data())[position]);
-        ++position;
-    }
-    for (int i = 0; i < 0x4000; ++i) {
-        EXPECT_EQ('b', static_cast<char*>(arrayBuffer->data())[position]);
-        ++position;
-    }
-    for (int i = 0; i < 0x4000; ++i) {
-        EXPECT_EQ('c', static_cast<char*>(arrayBuffer->data())[position]);
-        ++position;
-    }
-}
-
-TEST(SharedBufferTest, copy)
-{
-    char testData[] = "Habitasse integer eros tincidunt a scelerisque! Enim elit? Scelerisque magnis,"
-        "et montes ultrices tristique a! Pid. Velit turpis, dapibus integer rhoncus sociis amet facilisis,"
-        "adipiscing pulvinar nascetur magnis tempor sit pulvinar, massa urna enim porttitor sociis sociis proin enim?"
-        "Lectus, platea dolor, integer a. A habitasse hac nunc, nunc, nec placerat vut in sit nunc nec, sed. Sociis,"
-        "vut! Hac, velit rhoncus facilisis. Rhoncus et, enim, sed et in tristique nunc montes,"
-        "natoque nunc sagittis elementum parturient placerat dolor integer? Pulvinar,"
-        "magnis dignissim porttitor ac pulvinar mid tempor. A risus sed mid! Magnis elit duis urna,"
-        "cras massa, magna duis. Vut magnis pid a! Penatibus aliquet porttitor nunc, adipiscing massa odio lundium,"
-        "risus elementum ac turpis massa pellentesque parturient augue. Purus amet turpis pid aliquam?"
-        "Dolor est tincidunt? Dolor? Dignissim porttitor sit in aliquam! Tincidunt, non nunc, rhoncus dictumst!"
-        "Porta augue etiam. Cursus augue nunc lacus scelerisque. Rhoncus lectus, integer hac, nec pulvinar augue massa,"
-        "integer amet nisi facilisis? A! A, enim velit pulvinar elit in non scelerisque in et ultricies amet est!"
-        "in porttitor montes lorem et, hac aliquet pellentesque a sed? Augue mid purus ridiculus vel dapibus,"
-        "sagittis sed, tortor auctor nascetur rhoncus nec, rhoncus, magna integer. Sit eu massa vut?"
-        "Porta augue porttitor elementum, enim, rhoncus pulvinar duis integer scelerisque rhoncus natoque,"
-        "mattis dignissim massa ac pulvinar urna, nunc ut. Sagittis, aliquet penatibus proin lorem, pulvinar lectus,"
-        "augue proin! Ac, arcu quis. Placerat habitasse, ridiculus ridiculus.";
-
-    unsigned length = strlen(testData);
-    RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(testData, length);
-    sharedBuffer->append(testData, length);
-    sharedBuffer->append(testData, length);
-    sharedBuffer->append(testData, length);
-    // sharedBuffer must contain data more than segmentSize (= 0x1000) to check copy().
-    ASSERT_EQ(length * 4, sharedBuffer->size());
-
-    RefPtr<SharedBuffer> clone = sharedBuffer->copy();
-    ASSERT_EQ(length * 4, clone->size());
-    ASSERT_EQ(0, memcmp(clone->data(), sharedBuffer->data(), clone->size()));
-
-    clone->append(testData, length);
-    ASSERT_EQ(length * 5, clone->size());
-}
-
-} // namespace
diff --git a/Source/core/platform/SharedTimer.h b/Source/core/platform/SharedTimer.h
deleted file mode 100644
index eddeaf9..0000000
--- a/Source/core/platform/SharedTimer.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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,
- * 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 SharedTimer_h
-#define SharedTimer_h
-
-#include "wtf/FastAllocBase.h"
-#include "wtf/Noncopyable.h"
-
-namespace WebCore {
-
-    // Each thread has its own single instance of shared timer, which implements this interface.
-    // This instance is shared by all timers in the thread.
-    // Not intended to be used directly; use the Timer class instead.
-    class SharedTimer {
-        WTF_MAKE_NONCOPYABLE(SharedTimer); WTF_MAKE_FAST_ALLOCATED;
-    public:
-        SharedTimer() { }
-        virtual ~SharedTimer() {}
-        virtual void setFiredFunction(void (*)()) = 0;
-
-        // The fire interval is in seconds relative to the current monotonic clock time.
-        virtual void setFireInterval(double) = 0;
-        virtual void stop() = 0;
-    };
-
-
-    // Implemented by port (since it provides the run loop for the main thread).
-    // FIXME: make ports implement MainThreadSharedTimer directly instead.
-    void setSharedTimerFiredFunction(void (*)());
-    void setSharedTimerFireInterval(double);
-    void stopSharedTimer();
-
-    // Implementation of SharedTimer for the main thread.
-    class MainThreadSharedTimer : public SharedTimer {
-    public:
-        virtual void setFiredFunction(void (*function)())
-        {
-            setSharedTimerFiredFunction(function);
-        }
-
-        virtual void setFireInterval(double interval)
-        {
-            setSharedTimerFireInterval(interval);
-        }
-
-        virtual void stop()
-        {
-            stopSharedTimer();
-        }
-    };
-
-} // namespace WebCore
-
-#endif // SharedTimer_h
diff --git a/Source/core/platform/Sound.h b/Source/core/platform/Sound.h
deleted file mode 100644
index be9ebe8..0000000
--- a/Source/core/platform/Sound.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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,
- * 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 Sound_h
-#define Sound_h
-
-namespace WebCore {
-
-    void systemBeep();
-
-} // namespace WebCore
-
-#endif // Sound_h
diff --git a/Source/core/platform/StatsCounter.h b/Source/core/platform/StatsCounter.h
deleted file mode 100644
index edd3e79..0000000
--- a/Source/core/platform/StatsCounter.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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:
- *
- *     * 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 StatsCounter_h
-#define StatsCounter_h
-
-namespace WebCore {
-
-class StatsCounter {
-public:
-    static void incrementStatsCounter(const char*);
-};
-
-} // namespace WebCore
-
-#endif // StatsCounter_h
diff --git a/Source/core/platform/SuddenTermination.h b/Source/core/platform/SuddenTermination.h
deleted file mode 100644
index 2534f94..0000000
--- a/Source/core/platform/SuddenTermination.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2009 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 SuddenTermination_h
-#define SuddenTermination_h
-
-namespace WebCore {
-
-    // Once disabled via one or more more calls to disableSuddenTermination(), fast shutdown
-    // is not valid until enableSuddenTermination() has been called an equal number of times.
-    // On Mac, these are thin wrappers around Mac OS X functions of the same name.
-    void disableSuddenTermination();
-    void enableSuddenTermination();
-} // namespace WebCore
-
-#endif // SuddenTermination_h
diff --git a/Source/core/platform/Supplementable.h b/Source/core/platform/Supplementable.h
deleted file mode 100644
index e87c12f..0000000
--- a/Source/core/platform/Supplementable.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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 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 Supplementable_h
-#define Supplementable_h
-
-#include "wtf/Assertions.h"
-#include "wtf/HashMap.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-
-#if !ASSERT_DISABLED
-#include "wtf/Threading.h"
-#endif
-
-namespace WebCore {
-
-// What you should know about Supplementable and Supplement
-// ========================================================
-// Supplementable and Supplement instances are meant to be thread local. They
-// should only be accessed from within the thread that created them. The
-// 2 classes are not designed for safe access from another thread. Violating
-// this design assumption can result in memory corruption and unpredictable
-// behavior.
-//
-// What you should know about the Supplement keys
-// ==============================================
-// The Supplement is expected to use the same const char* string instance
-// as its key. The Supplementable's SupplementMap will use the address of the
-// string as the key and not the characters themselves. Hence, 2 strings with
-// the same characters will be treated as 2 different keys.
-//
-// In practice, it is recommended that Supplements implements a static method
-// for returning its key to use. For example:
-//
-//     class MyClass : public Supplement<MySupplementable> {
-//         ...
-//         static const char* supplementName();
-//     }
-//
-//     const char* MyClass::supplementName()
-//     {
-//         return "MyClass";
-//     }
-//
-// An example of the using the key:
-//
-//     MyClass* MyClass::from(MySupplementable* host)
-//     {
-//         return reinterpret_cast<MyClass*>(Supplement<MySupplementable>::from(host, supplementName()));
-//     }
-//
-// What you should know about thread checks
-// ========================================
-// When assertion is enabled this class performs thread-safety check so that
-// provideTo and from happen on the same thread. If you want to provide
-// some value for Workers this thread check may not work very well though,
-// since in most case you'd provide the value while worker preparation is
-// being done on the main thread, even before the worker thread is started.
-// If that's the case you can explicitly call reattachThread() when the
-// Supplementable object is passed to the final destination thread (i.e.
-// worker thread). Please be extremely careful to use the method though,
-// as randomly calling the method could easily cause racy condition.
-//
-// Note that reattachThread() does nothing if assertion is not enabled.
-//
-
-template<typename T>
-class Supplementable;
-
-template<typename T>
-class Supplement {
-public:
-    virtual ~Supplement() { }
-#if !ASSERT_DISABLED || defined(ADDRESS_SANITIZER)
-    virtual bool isRefCountedWrapper() const { return false; }
-#endif
-
-    static void provideTo(Supplementable<T>* host, const char* key, PassOwnPtr<Supplement<T> > supplement)
-    {
-        host->provideSupplement(key, supplement);
-    }
-
-    static Supplement<T>* from(Supplementable<T>* host, const char* key)
-    {
-        return host ? host->requireSupplement(key) : 0;
-    }
-};
-
-template<typename T>
-class Supplementable {
-public:
-    void provideSupplement(const char* key, PassOwnPtr<Supplement<T> > supplement)
-    {
-        ASSERT(m_threadId == currentThread());
-        ASSERT(!m_supplements.get(key));
-        m_supplements.set(key, supplement);
-    }
-
-    void removeSupplement(const char* key)
-    {
-        ASSERT(m_threadId == currentThread());
-        m_supplements.remove(key);
-    }
-
-    Supplement<T>* requireSupplement(const char* key)
-    {
-        ASSERT(m_threadId == currentThread());
-        return m_supplements.get(key);
-    }
-
-    void reattachThread()
-    {
-#if !ASSERT_DISABLED
-        m_threadId = currentThread();
-#endif
-    }
-
-#if !ASSERT_DISABLED
-protected:
-    Supplementable() : m_threadId(currentThread()) { }
-#endif
-
-private:
-    typedef HashMap<const char*, OwnPtr<Supplement<T> >, PtrHash<const char*> > SupplementMap;
-    SupplementMap m_supplements;
-#if !ASSERT_DISABLED
-    ThreadIdentifier m_threadId;
-#endif
-};
-
-} // namespace WebCore
-
-#endif // Supplementable_h
diff --git a/Source/core/platform/Task.h b/Source/core/platform/Task.h
deleted file mode 100644
index b9d2e46..0000000
--- a/Source/core/platform/Task.h
+++ /dev/null
@@ -1,57 +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 Task_h
-#define Task_h
-
-#include "wtf/Functional.h"
-#include "public/platform/WebThread.h"
-
-namespace WebCore {
-
-class Task : public WebKit::WebThread::Task {
-public:
-    explicit Task(const Closure& closure)
-        : m_closure(closure)
-    {
-    }
-
-    virtual void run() OVERRIDE
-    {
-        m_closure();
-    }
-
-private:
-    Closure m_closure;
-};
-
-} // namespace WebCore
-
-#endif // Task_h
diff --git a/Source/core/platform/Theme.h b/Source/core/platform/Theme.h
index d4ba797..ef99ee4 100644
--- a/Source/core/platform/Theme.h
+++ b/Source/core/platform/Theme.h
@@ -31,7 +31,7 @@
 #include "core/platform/ThemeTypes.h"
 #include "core/platform/graphics/Color.h"
 #include "core/platform/graphics/Font.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/ThreadGlobalData.cpp b/Source/core/platform/ThreadGlobalData.cpp
deleted file mode 100644
index feeee03..0000000
--- a/Source/core/platform/ThreadGlobalData.cpp
+++ /dev/null
@@ -1,72 +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 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,
- * 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/ThreadGlobalData.h"
-
-#include "core/events/EventNames.h"
-#include "core/inspector/InspectorCounters.h"
-#include "core/platform/ThreadTimers.h"
-#include "wtf/MainThread.h"
-#include "wtf/ThreadSpecific.h"
-#include "wtf/Threading.h"
-#include "wtf/WTFThreadData.h"
-#include "wtf/text/StringImpl.h"
-
-using namespace WTF;
-
-namespace WebCore {
-
-ThreadSpecific<ThreadGlobalData>* ThreadGlobalData::staticData;
-
-ThreadGlobalData::ThreadGlobalData()
-    : m_eventNames(adoptPtr(new EventNames))
-    , m_threadTimers(adoptPtr(new ThreadTimers))
-#ifndef NDEBUG
-    , m_isMainThread(isMainThread())
-#endif
-    , m_inspectorCounters(adoptPtr(new ThreadLocalInspectorCounters()))
-{
-    // This constructor will have been called on the main thread before being called on
-    // any other thread, and is only called once per thread - this makes this a convenient
-    // point to call methods that internally perform a one-time initialization that is not
-    // threadsafe.
-    wtfThreadData();
-    StringImpl::empty();
-}
-
-ThreadGlobalData::~ThreadGlobalData()
-{
-}
-
-void ThreadGlobalData::destroy()
-{
-    m_inspectorCounters.clear();
-    m_eventNames.clear();
-    m_threadTimers.clear();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/ThreadGlobalData.h b/Source/core/platform/ThreadGlobalData.h
index cc56f0e..2e0fc74 100644
--- a/Source/core/platform/ThreadGlobalData.h
+++ b/Source/core/platform/ThreadGlobalData.h
@@ -36,53 +36,4 @@
 #include "wtf/Threading.h"
 #include "wtf/text/StringHash.h"
 
-using WTF::ThreadSpecific;
-
-namespace WebCore {
-
-    class EventNames;
-    class ThreadLocalInspectorCounters;
-    class ThreadTimers;
-
-    struct TECConverterWrapper;
-
-    class ThreadGlobalData {
-        WTF_MAKE_NONCOPYABLE(ThreadGlobalData);
-    public:
-        ThreadGlobalData();
-        ~ThreadGlobalData();
-        void destroy(); // called on workers to clean up the ThreadGlobalData before the thread exits.
-
-        EventNames& eventNames() { return *m_eventNames; }
-        ThreadTimers& threadTimers() { return *m_threadTimers; }
-
-        ThreadLocalInspectorCounters& inspectorCounters() { return *m_inspectorCounters; }
-
-    private:
-        OwnPtr<EventNames> m_eventNames;
-        OwnPtr<ThreadTimers> m_threadTimers;
-
-#ifndef NDEBUG
-        bool m_isMainThread;
-#endif
-
-        OwnPtr<ThreadLocalInspectorCounters> m_inspectorCounters;
-
-        static ThreadSpecific<ThreadGlobalData>* staticData;
-        friend ThreadGlobalData& threadGlobalData();
-    };
-
-inline ThreadGlobalData& threadGlobalData()
-{
-    // FIXME: Workers are not necessarily the only feature that make per-thread global data necessary.
-    // We need to check for e.g. database objects manipulating strings on secondary threads.
-
-    // ThreadGlobalData is used on main thread before it could possibly be used on secondary ones, so there is no need for synchronization here.
-    if (!ThreadGlobalData::staticData)
-        ThreadGlobalData::staticData = new ThreadSpecific<ThreadGlobalData>;
-    return **ThreadGlobalData::staticData;
-}
-
-} // namespace WebCore
-
 #endif // ThreadGlobalData_h
diff --git a/Source/core/platform/ThreadTimers.cpp b/Source/core/platform/ThreadTimers.cpp
deleted file mode 100644
index 884f644..0000000
--- a/Source/core/platform/ThreadTimers.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2006, 2008 Apple 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 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,
- * 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/ThreadTimers.h"
-
-#include "core/platform/SharedTimer.h"
-#include "core/platform/ThreadGlobalData.h"
-#include "core/platform/Timer.h"
-#include "core/platform/chromium/TraceEvent.h"
-#include "wtf/CurrentTime.h"
-#include "wtf/MainThread.h"
-
-using namespace std;
-
-namespace WebCore {
-
-// Fire timers for this length of time, and then quit to let the run loop process user input events.
-// 100ms is about a perceptable delay in UI, so use a half of that as a threshold.
-// This is to prevent UI freeze when there are too many timers or machine performance is low.
-static const double maxDurationOfFiringTimers = 0.050;
-
-// Timers are created, started and fired on the same thread, and each thread has its own ThreadTimers
-// copy to keep the heap and a set of currently firing timers.
-
-static MainThreadSharedTimer* mainThreadSharedTimer()
-{
-    static MainThreadSharedTimer* timer = new MainThreadSharedTimer;
-    return timer;
-}
-
-ThreadTimers::ThreadTimers()
-    : m_sharedTimer(0)
-    , m_firingTimers(false)
-    , m_pendingSharedTimerFireTime(0)
-{
-    if (isMainThread())
-        setSharedTimer(mainThreadSharedTimer());
-}
-
-// A worker thread may initialize SharedTimer after some timers are created.
-// Also, SharedTimer can be replaced with 0 before all timers are destroyed.
-void ThreadTimers::setSharedTimer(SharedTimer* sharedTimer)
-{
-    if (m_sharedTimer) {
-        m_sharedTimer->setFiredFunction(0);
-        m_sharedTimer->stop();
-        m_pendingSharedTimerFireTime = 0;
-    }
-
-    m_sharedTimer = sharedTimer;
-
-    if (sharedTimer) {
-        m_sharedTimer->setFiredFunction(ThreadTimers::sharedTimerFired);
-        updateSharedTimer();
-    }
-}
-
-void ThreadTimers::updateSharedTimer()
-{
-    if (!m_sharedTimer)
-        return;
-
-    if (m_firingTimers || m_timerHeap.isEmpty()) {
-        m_pendingSharedTimerFireTime = 0;
-        m_sharedTimer->stop();
-    } else {
-        double nextFireTime = m_timerHeap.first()->m_nextFireTime;
-        double currentMonotonicTime = monotonicallyIncreasingTime();
-        if (m_pendingSharedTimerFireTime) {
-            // No need to restart the timer if both the pending fire time and the new fire time are in the past.
-            if (m_pendingSharedTimerFireTime <= currentMonotonicTime && nextFireTime <= currentMonotonicTime)
-                return;
-        }
-        m_pendingSharedTimerFireTime = nextFireTime;
-        m_sharedTimer->setFireInterval(max(nextFireTime - currentMonotonicTime, 0.0));
-    }
-}
-
-void ThreadTimers::sharedTimerFired()
-{
-    TRACE_EVENT_SET_SAMPLING_STATE("Blink", "Internal");
-
-    // Redirect to non-static method.
-    threadGlobalData().threadTimers().sharedTimerFiredInternal();
-
-    TRACE_EVENT_SET_SAMPLING_STATE("Blink", "Sleeping");
-}
-
-void ThreadTimers::sharedTimerFiredInternal()
-{
-    // Do a re-entrancy check.
-    if (m_firingTimers)
-        return;
-    m_firingTimers = true;
-    m_pendingSharedTimerFireTime = 0;
-
-    double fireTime = monotonicallyIncreasingTime();
-    double timeToQuit = fireTime + maxDurationOfFiringTimers;
-
-    while (!m_timerHeap.isEmpty() && m_timerHeap.first()->m_nextFireTime <= fireTime) {
-        TimerBase* timer = m_timerHeap.first();
-        timer->m_nextFireTime = 0;
-        timer->m_unalignedNextFireTime = 0;
-        timer->heapDeleteMin();
-
-        double interval = timer->repeatInterval();
-        timer->setNextFireTime(interval ? fireTime + interval : 0);
-
-        // Once the timer has been fired, it may be deleted, so do nothing else with it after this point.
-        timer->fired();
-
-        // Catch the case where the timer asked timers to fire in a nested event loop, or we are over time limit.
-        if (!m_firingTimers || timeToQuit < monotonicallyIncreasingTime())
-            break;
-    }
-
-    m_firingTimers = false;
-
-    updateSharedTimer();
-}
-
-void ThreadTimers::fireTimersInNestedEventLoop()
-{
-    // Reset the reentrancy guard so the timers can fire again.
-    m_firingTimers = false;
-    updateSharedTimer();
-}
-
-} // namespace WebCore
-
diff --git a/Source/core/platform/ThreadTimers.h b/Source/core/platform/ThreadTimers.h
deleted file mode 100644
index 2201a5a..0000000
--- a/Source/core/platform/ThreadTimers.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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 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,
- * 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 ThreadTimers_h
-#define ThreadTimers_h
-
-#include "wtf/Noncopyable.h"
-#include "wtf/HashSet.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-    class SharedTimer;
-    class TimerBase;
-
-    // A collection of timers per thread. Kept in ThreadGlobalData.
-    class ThreadTimers {
-        WTF_MAKE_NONCOPYABLE(ThreadTimers); WTF_MAKE_FAST_ALLOCATED;
-    public:
-        ThreadTimers();
-
-        // On a thread different then main, we should set the thread's instance of the SharedTimer.
-        void setSharedTimer(SharedTimer*);
-
-        Vector<TimerBase*>& timerHeap() { return m_timerHeap; }
-
-        void updateSharedTimer();
-        void fireTimersInNestedEventLoop();
-
-    private:
-        static void sharedTimerFired();
-
-        void sharedTimerFiredInternal();
-        void fireTimersInNestedEventLoopInternal();
-
-        Vector<TimerBase*> m_timerHeap;
-        SharedTimer* m_sharedTimer; // External object, can be a run loop on a worker thread. Normally set/reset by worker thread.
-        bool m_firingTimers; // Reentrancy guard.
-        double m_pendingSharedTimerFireTime;
-    };
-
-}
-
-#endif
diff --git a/Source/core/platform/Timer.cpp b/Source/core/platform/Timer.cpp
deleted file mode 100644
index 783e6d3..0000000
--- a/Source/core/platform/Timer.cpp
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * Copyright (C) 2006, 2008 Apple 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 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,
- * 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/Timer.h"
-
-#include <limits.h>
-#include <math.h>
-#include <limits>
-#include "core/platform/ThreadGlobalData.h"
-#include "core/platform/ThreadTimers.h"
-#include "wtf/CurrentTime.h"
-#include "wtf/HashSet.h"
-#include "wtf/Vector.h"
-
-using namespace std;
-
-namespace WebCore {
-
-class TimerHeapReference;
-
-// Timers are stored in a heap data structure, used to implement a priority queue.
-// This allows us to efficiently determine which timer needs to fire the soonest.
-// Then we set a single shared system timer to fire at that time.
-//
-// When a timer's "next fire time" changes, we need to move it around in the priority queue.
-static Vector<TimerBase*>& threadGlobalTimerHeap()
-{
-    return threadGlobalData().threadTimers().timerHeap();
-}
-// ----------------
-
-class TimerHeapPointer {
-public:
-    TimerHeapPointer(TimerBase** pointer) : m_pointer(pointer) { }
-    TimerHeapReference operator*() const;
-    TimerBase* operator->() const { return *m_pointer; }
-private:
-    TimerBase** m_pointer;
-};
-
-class TimerHeapReference {
-public:
-    TimerHeapReference(TimerBase*& reference) : m_reference(reference) { }
-    operator TimerBase*() const { return m_reference; }
-    TimerHeapPointer operator&() const { return &m_reference; }
-    TimerHeapReference& operator=(TimerBase*);
-    TimerHeapReference& operator=(TimerHeapReference);
-private:
-    TimerBase*& m_reference;
-};
-
-inline TimerHeapReference TimerHeapPointer::operator*() const
-{
-    return *m_pointer;
-}
-
-inline TimerHeapReference& TimerHeapReference::operator=(TimerBase* timer)
-{
-    m_reference = timer;
-    Vector<TimerBase*>& heap = timer->timerHeap();
-    if (&m_reference >= heap.data() && &m_reference < heap.data() + heap.size())
-        timer->m_heapIndex = &m_reference - heap.data();
-    return *this;
-}
-
-inline TimerHeapReference& TimerHeapReference::operator=(TimerHeapReference b)
-{
-    TimerBase* timer = b;
-    return *this = timer;
-}
-
-inline void swap(TimerHeapReference a, TimerHeapReference b)
-{
-    TimerBase* timerA = a;
-    TimerBase* timerB = b;
-
-    // Invoke the assignment operator, since that takes care of updating m_heapIndex.
-    a = timerB;
-    b = timerA;
-}
-
-// ----------------
-
-// Class to represent iterators in the heap when calling the standard library heap algorithms.
-// Uses a custom pointer and reference type that update indices for pointers in the heap.
-class TimerHeapIterator : public iterator<random_access_iterator_tag, TimerBase*, ptrdiff_t, TimerHeapPointer, TimerHeapReference> {
-public:
-    explicit TimerHeapIterator(TimerBase** pointer) : m_pointer(pointer) { checkConsistency(); }
-
-    TimerHeapIterator& operator++() { checkConsistency(); ++m_pointer; checkConsistency(); return *this; }
-    TimerHeapIterator operator++(int) { checkConsistency(1); return TimerHeapIterator(m_pointer++); }
-
-    TimerHeapIterator& operator--() { checkConsistency(); --m_pointer; checkConsistency(); return *this; }
-    TimerHeapIterator operator--(int) { checkConsistency(-1); return TimerHeapIterator(m_pointer--); }
-
-    TimerHeapIterator& operator+=(ptrdiff_t i) { checkConsistency(); m_pointer += i; checkConsistency(); return *this; }
-    TimerHeapIterator& operator-=(ptrdiff_t i) { checkConsistency(); m_pointer -= i; checkConsistency(); return *this; }
-
-    TimerHeapReference operator*() const { return TimerHeapReference(*m_pointer); }
-    TimerHeapReference operator[](ptrdiff_t i) const { return TimerHeapReference(m_pointer[i]); }
-    TimerBase* operator->() const { return *m_pointer; }
-
-private:
-    void checkConsistency(ptrdiff_t offset = 0) const
-    {
-        ASSERT(m_pointer >= threadGlobalTimerHeap().data());
-        ASSERT(m_pointer <= threadGlobalTimerHeap().data() + threadGlobalTimerHeap().size());
-        ASSERT_UNUSED(offset, m_pointer + offset >= threadGlobalTimerHeap().data());
-        ASSERT_UNUSED(offset, m_pointer + offset <= threadGlobalTimerHeap().data() + threadGlobalTimerHeap().size());
-    }
-
-    friend bool operator==(TimerHeapIterator, TimerHeapIterator);
-    friend bool operator!=(TimerHeapIterator, TimerHeapIterator);
-    friend bool operator<(TimerHeapIterator, TimerHeapIterator);
-    friend bool operator>(TimerHeapIterator, TimerHeapIterator);
-    friend bool operator<=(TimerHeapIterator, TimerHeapIterator);
-    friend bool operator>=(TimerHeapIterator, TimerHeapIterator);
-
-    friend TimerHeapIterator operator+(TimerHeapIterator, size_t);
-    friend TimerHeapIterator operator+(size_t, TimerHeapIterator);
-
-    friend TimerHeapIterator operator-(TimerHeapIterator, size_t);
-    friend ptrdiff_t operator-(TimerHeapIterator, TimerHeapIterator);
-
-    TimerBase** m_pointer;
-};
-
-inline bool operator==(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer == b.m_pointer; }
-inline bool operator!=(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer != b.m_pointer; }
-inline bool operator<(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer < b.m_pointer; }
-inline bool operator>(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer > b.m_pointer; }
-inline bool operator<=(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer <= b.m_pointer; }
-inline bool operator>=(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer >= b.m_pointer; }
-
-inline TimerHeapIterator operator+(TimerHeapIterator a, size_t b) { return TimerHeapIterator(a.m_pointer + b); }
-inline TimerHeapIterator operator+(size_t a, TimerHeapIterator b) { return TimerHeapIterator(a + b.m_pointer); }
-
-inline TimerHeapIterator operator-(TimerHeapIterator a, size_t b) { return TimerHeapIterator(a.m_pointer - b); }
-inline ptrdiff_t operator-(TimerHeapIterator a, TimerHeapIterator b) { return a.m_pointer - b.m_pointer; }
-
-// ----------------
-
-class TimerHeapLessThanFunction {
-public:
-    bool operator()(const TimerBase*, const TimerBase*) const;
-};
-
-inline bool TimerHeapLessThanFunction::operator()(const TimerBase* a, const TimerBase* b) const
-{
-    // The comparisons below are "backwards" because the heap puts the largest
-    // element first and we want the lowest time to be the first one in the heap.
-    double aFireTime = a->m_nextFireTime;
-    double bFireTime = b->m_nextFireTime;
-    if (bFireTime != aFireTime)
-        return bFireTime < aFireTime;
-
-    // We need to look at the difference of the insertion orders instead of comparing the two
-    // outright in case of overflow.
-    unsigned difference = a->m_heapInsertionOrder - b->m_heapInsertionOrder;
-    return difference < numeric_limits<unsigned>::max() / 2;
-}
-
-// ----------------
-
-TimerBase::TimerBase()
-    : m_nextFireTime(0)
-    , m_unalignedNextFireTime(0)
-    , m_repeatInterval(0)
-    , m_heapIndex(-1)
-    , m_cachedThreadGlobalTimerHeap(0)
-#ifndef NDEBUG
-    , m_thread(currentThread())
-#endif
-{
-}
-
-TimerBase::~TimerBase()
-{
-    stop();
-    ASSERT(!inHeap());
-}
-
-void TimerBase::start(double nextFireInterval, double repeatInterval)
-{
-    ASSERT(m_thread == currentThread());
-
-    m_repeatInterval = repeatInterval;
-    setNextFireTime(monotonicallyIncreasingTime() + nextFireInterval);
-}
-
-void TimerBase::stop()
-{
-    ASSERT(m_thread == currentThread());
-
-    m_repeatInterval = 0;
-    setNextFireTime(0);
-
-    ASSERT(m_nextFireTime == 0);
-    ASSERT(m_repeatInterval == 0);
-    ASSERT(!inHeap());
-}
-
-double TimerBase::nextFireInterval() const
-{
-    ASSERT(isActive());
-    double current = monotonicallyIncreasingTime();
-    if (m_nextFireTime < current)
-        return 0;
-    return m_nextFireTime - current;
-}
-
-inline void TimerBase::checkHeapIndex() const
-{
-    ASSERT(timerHeap() == threadGlobalTimerHeap());
-    ASSERT(!timerHeap().isEmpty());
-    ASSERT(m_heapIndex >= 0);
-    ASSERT(m_heapIndex < static_cast<int>(timerHeap().size()));
-    ASSERT(timerHeap()[m_heapIndex] == this);
-}
-
-inline void TimerBase::checkConsistency() const
-{
-    // Timers should be in the heap if and only if they have a non-zero next fire time.
-    ASSERT(inHeap() == (m_nextFireTime != 0));
-    if (inHeap())
-        checkHeapIndex();
-}
-
-void TimerBase::heapDecreaseKey()
-{
-    ASSERT(m_nextFireTime != 0);
-    checkHeapIndex();
-    TimerBase** heapData = timerHeap().data();
-    push_heap(TimerHeapIterator(heapData), TimerHeapIterator(heapData + m_heapIndex + 1), TimerHeapLessThanFunction());
-    checkHeapIndex();
-}
-
-inline void TimerBase::heapDelete()
-{
-    ASSERT(m_nextFireTime == 0);
-    heapPop();
-    timerHeap().removeLast();
-    m_heapIndex = -1;
-}
-
-void TimerBase::heapDeleteMin()
-{
-    ASSERT(m_nextFireTime == 0);
-    heapPopMin();
-    timerHeap().removeLast();
-    m_heapIndex = -1;
-}
-
-inline void TimerBase::heapIncreaseKey()
-{
-    ASSERT(m_nextFireTime != 0);
-    heapPop();
-    heapDecreaseKey();
-}
-
-inline void TimerBase::heapInsert()
-{
-    ASSERT(!inHeap());
-    timerHeap().append(this);
-    m_heapIndex = timerHeap().size() - 1;
-    heapDecreaseKey();
-}
-
-inline void TimerBase::heapPop()
-{
-    // Temporarily force this timer to have the minimum key so we can pop it.
-    double fireTime = m_nextFireTime;
-    m_nextFireTime = -numeric_limits<double>::infinity();
-    heapDecreaseKey();
-    heapPopMin();
-    m_nextFireTime = fireTime;
-}
-
-void TimerBase::heapPopMin()
-{
-    ASSERT(this == timerHeap().first());
-    checkHeapIndex();
-    Vector<TimerBase*>& heap = timerHeap();
-    TimerBase** heapData = heap.data();
-    pop_heap(TimerHeapIterator(heapData), TimerHeapIterator(heapData + heap.size()), TimerHeapLessThanFunction());
-    checkHeapIndex();
-    ASSERT(this == timerHeap().last());
-}
-
-static inline bool parentHeapPropertyHolds(const TimerBase* current, const Vector<TimerBase*>& heap, unsigned currentIndex)
-{
-    if (!currentIndex)
-        return true;
-    unsigned parentIndex = (currentIndex - 1) / 2;
-    TimerHeapLessThanFunction compareHeapPosition;
-    return compareHeapPosition(current, heap[parentIndex]);
-}
-
-static inline bool childHeapPropertyHolds(const TimerBase* current, const Vector<TimerBase*>& heap, unsigned childIndex)
-{
-    if (childIndex >= heap.size())
-        return true;
-    TimerHeapLessThanFunction compareHeapPosition;
-    return compareHeapPosition(heap[childIndex], current);
-}
-
-bool TimerBase::hasValidHeapPosition() const
-{
-    ASSERT(m_nextFireTime);
-    if (!inHeap())
-        return false;
-    // Check if the heap property still holds with the new fire time. If it does we don't need to do anything.
-    // This assumes that the STL heap is a standard binary heap. In an unlikely event it is not, the assertions
-    // in updateHeapIfNeeded() will get hit.
-    const Vector<TimerBase*>& heap = timerHeap();
-    if (!parentHeapPropertyHolds(this, heap, m_heapIndex))
-        return false;
-    unsigned childIndex1 = 2 * m_heapIndex + 1;
-    unsigned childIndex2 = childIndex1 + 1;
-    return childHeapPropertyHolds(this, heap, childIndex1) && childHeapPropertyHolds(this, heap, childIndex2);
-}
-
-void TimerBase::updateHeapIfNeeded(double oldTime)
-{
-    if (m_nextFireTime && hasValidHeapPosition())
-        return;
-#ifndef NDEBUG
-    int oldHeapIndex = m_heapIndex;
-#endif
-    if (!oldTime)
-        heapInsert();
-    else if (!m_nextFireTime)
-        heapDelete();
-    else if (m_nextFireTime < oldTime)
-        heapDecreaseKey();
-    else
-        heapIncreaseKey();
-    ASSERT(m_heapIndex != oldHeapIndex);
-    ASSERT(!inHeap() || hasValidHeapPosition());
-}
-
-void TimerBase::setNextFireTime(double newUnalignedTime)
-{
-    ASSERT(m_thread == currentThread());
-
-    if (m_unalignedNextFireTime != newUnalignedTime)
-        m_unalignedNextFireTime = newUnalignedTime;
-
-    // Accessing thread global data is slow. Cache the heap pointer.
-    if (!m_cachedThreadGlobalTimerHeap)
-        m_cachedThreadGlobalTimerHeap = &threadGlobalTimerHeap();
-
-    // Keep heap valid while changing the next-fire time.
-    double oldTime = m_nextFireTime;
-    double newTime = alignedFireTime(newUnalignedTime);
-    if (oldTime != newTime) {
-        m_nextFireTime = newTime;
-        static unsigned currentHeapInsertionOrder;
-        m_heapInsertionOrder = currentHeapInsertionOrder++;
-
-        bool wasFirstTimerInHeap = m_heapIndex == 0;
-
-        updateHeapIfNeeded(oldTime);
-
-        bool isFirstTimerInHeap = m_heapIndex == 0;
-
-        if (wasFirstTimerInHeap || isFirstTimerInHeap)
-            threadGlobalData().threadTimers().updateSharedTimer();
-    }
-
-    checkConsistency();
-}
-
-void TimerBase::fireTimersInNestedEventLoop()
-{
-    // Redirect to ThreadTimers.
-    threadGlobalData().threadTimers().fireTimersInNestedEventLoop();
-}
-
-void TimerBase::didChangeAlignmentInterval()
-{
-    setNextFireTime(m_unalignedNextFireTime);
-}
-
-double TimerBase::nextUnalignedFireInterval() const
-{
-    ASSERT(isActive());
-    return max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0);
-}
-
-} // namespace WebCore
-
diff --git a/Source/core/platform/Timer.h b/Source/core/platform/Timer.h
deleted file mode 100644
index 7a1c408..0000000
--- a/Source/core/platform/Timer.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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,
- * 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 Timer_h
-#define Timer_h
-
-#include "wtf/Noncopyable.h"
-#include "wtf/Threading.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-// Time intervals are all in seconds.
-
-class TimerHeapElement;
-
-class TimerBase {
-    WTF_MAKE_NONCOPYABLE(TimerBase); WTF_MAKE_FAST_ALLOCATED;
-public:
-    TimerBase();
-    virtual ~TimerBase();
-
-    void start(double nextFireInterval, double repeatInterval);
-
-    void startRepeating(double repeatInterval) { start(repeatInterval, repeatInterval); }
-    void startOneShot(double interval) { start(interval, 0); }
-
-    void stop();
-    bool isActive() const;
-
-    double nextFireInterval() const;
-    double nextUnalignedFireInterval() const;
-    double repeatInterval() const { return m_repeatInterval; }
-
-    void augmentRepeatInterval(double delta) {
-        setNextFireTime(m_nextFireTime + delta);
-        m_repeatInterval += delta;
-    }
-
-    void didChangeAlignmentInterval();
-
-    static void fireTimersInNestedEventLoop();
-
-private:
-    virtual void fired() = 0;
-
-    virtual double alignedFireTime(double fireTime) const { return fireTime; }
-
-    void checkConsistency() const;
-    void checkHeapIndex() const;
-
-    void setNextFireTime(double);
-
-    bool inHeap() const { return m_heapIndex != -1; }
-
-    bool hasValidHeapPosition() const;
-    void updateHeapIfNeeded(double oldTime);
-
-    void heapDecreaseKey();
-    void heapDelete();
-    void heapDeleteMin();
-    void heapIncreaseKey();
-    void heapInsert();
-    void heapPop();
-    void heapPopMin();
-
-    Vector<TimerBase*>& timerHeap() const { ASSERT(m_cachedThreadGlobalTimerHeap); return *m_cachedThreadGlobalTimerHeap; }
-
-    double m_nextFireTime; // 0 if inactive
-    double m_unalignedNextFireTime; // m_nextFireTime not considering alignment interval
-    double m_repeatInterval; // 0 if not repeating
-    int m_heapIndex; // -1 if not in heap
-    unsigned m_heapInsertionOrder; // Used to keep order among equal-fire-time timers
-    Vector<TimerBase*>* m_cachedThreadGlobalTimerHeap;
-
-#ifndef NDEBUG
-    ThreadIdentifier m_thread;
-#endif
-
-    friend class ThreadTimers;
-    friend class TimerHeapLessThanFunction;
-    friend class TimerHeapReference;
-};
-
-template <typename TimerFiredClass> class Timer : public TimerBase {
-public:
-    typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*);
-
-    Timer(TimerFiredClass* o, TimerFiredFunction f)
-        : m_object(o), m_function(f) { }
-
-private:
-    virtual void fired() { (m_object->*m_function)(this); }
-
-    TimerFiredClass* m_object;
-    TimerFiredFunction m_function;
-};
-
-inline bool TimerBase::isActive() const
-{
-    ASSERT(m_thread == currentThread());
-    return m_nextFireTime;
-}
-
-template <typename TimerFiredClass> class DeferrableOneShotTimer : private TimerBase {
-public:
-    typedef void (TimerFiredClass::*TimerFiredFunction)(DeferrableOneShotTimer*);
-
-    DeferrableOneShotTimer(TimerFiredClass* o, TimerFiredFunction f, double delay)
-        : m_object(o)
-        , m_function(f)
-        , m_delay(delay)
-        , m_shouldRestartWhenTimerFires(false)
-    {
-    }
-
-    void restart()
-    {
-        // Setting this boolean is much more efficient than calling startOneShot
-        // again, which might result in rescheduling the system timer which
-        // can be quite expensive.
-
-        if (isActive()) {
-            m_shouldRestartWhenTimerFires = true;
-            return;
-        }
-        startOneShot(m_delay);
-    }
-
-    using TimerBase::stop;
-    using TimerBase::isActive;
-private:
-    virtual void fired()
-    {
-        if (m_shouldRestartWhenTimerFires) {
-            m_shouldRestartWhenTimerFires = false;
-            startOneShot(m_delay);
-            return;
-        }
-
-        (m_object->*m_function)(this);
-    }
-
-    TimerFiredClass* m_object;
-    TimerFiredFunction m_function;
-
-    double m_delay;
-    bool m_shouldRestartWhenTimerFires;
-};
-
-}
-
-#endif
diff --git a/Source/core/platform/TreeShared.h b/Source/core/platform/TreeShared.h
deleted file mode 100644
index 9c1b8d9..0000000
--- a/Source/core/platform/TreeShared.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2009, 2010, 2012 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef TreeShared_h
-#define TreeShared_h
-
-#include "wtf/Assertions.h"
-#include "wtf/MainThread.h"
-#include "wtf/Noncopyable.h"
-
-namespace WebCore {
-
-#ifndef NDEBUG
-template<typename NodeType> class TreeShared;
-template<typename NodeType> void adopted(TreeShared<NodeType>*);
-#endif
-
-template<typename NodeType> class TreeShared {
-    WTF_MAKE_NONCOPYABLE(TreeShared);
-protected:
-    TreeShared()
-        : m_refCount(1)
-#ifndef NDEBUG
-        , m_deletionHasBegun(false)
-        , m_inRemovedLastRefFunction(false)
-        , m_adoptionIsRequired(true)
-#endif
-    {
-        ASSERT(isMainThread());
-    }
-
-    ~TreeShared()
-    {
-        ASSERT(isMainThread());
-        ASSERT(!m_refCount);
-        ASSERT(m_deletionHasBegun);
-        ASSERT(!m_adoptionIsRequired);
-    }
-
-public:
-    void ref()
-    {
-        ASSERT(isMainThread());
-        ASSERT(!m_deletionHasBegun);
-        ASSERT(!m_inRemovedLastRefFunction);
-        ASSERT(!m_adoptionIsRequired);
-        ++m_refCount;
-    }
-
-    void deref()
-    {
-        ASSERT(isMainThread());
-        ASSERT(m_refCount >= 0);
-        ASSERT(!m_deletionHasBegun);
-        ASSERT(!m_inRemovedLastRefFunction);
-        ASSERT(!m_adoptionIsRequired);
-        NodeType* thisNode = static_cast<NodeType*>(this);
-        if (--m_refCount <= 0 && !thisNode->hasTreeSharedParent()) {
-#ifndef NDEBUG
-            m_inRemovedLastRefFunction = true;
-#endif
-            thisNode->removedLastRef();
-        }
-    }
-
-    bool hasOneRef() const
-    {
-        ASSERT(!m_deletionHasBegun);
-        ASSERT(!m_inRemovedLastRefFunction);
-        return m_refCount == 1;
-    }
-
-    int refCount() const
-    {
-        return m_refCount;
-    }
-
-private:
-    int m_refCount;
-
-#ifndef NDEBUG
-public:
-    bool m_deletionHasBegun;
-    bool m_inRemovedLastRefFunction;
-private:
-    friend void adopted<>(TreeShared<NodeType>*);
-    bool m_adoptionIsRequired;
-#endif
-};
-
-#ifndef NDEBUG
-
-template<typename NodeType> inline void adopted(TreeShared<NodeType>* object)
-{
-    if (!object)
-        return;
-    ASSERT(!object->m_deletionHasBegun);
-    ASSERT(!object->m_inRemovedLastRefFunction);
-    object->m_adoptionIsRequired = false;
-}
-
-#endif
-
-}
-
-#endif // TreeShared.h
diff --git a/Source/core/platform/UUID.cpp b/Source/core/platform/UUID.cpp
deleted file mode 100644
index 8e453f5..0000000
--- a/Source/core/platform/UUID.cpp
+++ /dev/null
@@ -1,62 +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/UUID.h"
-
-#include "wtf/CryptographicallyRandomNumber.h"
-#include "wtf/HexNumber.h"
-#include "wtf/text/StringBuilder.h"
-
-namespace WebCore {
-
-String createCanonicalUUIDString()
-{
-    unsigned randomData[4];
-    cryptographicallyRandomValues(reinterpret_cast<unsigned char*>(randomData), sizeof(randomData));
-
-    // Format as Version 4 UUID.
-    StringBuilder builder;
-    builder.reserveCapacity(36);
-    appendUnsignedAsHexFixedSize(randomData[0], builder, 8, Lowercase);
-    builder.append("-");
-    appendUnsignedAsHexFixedSize(randomData[1] >> 16, builder, 4, Lowercase);
-    builder.append("-4");
-    appendUnsignedAsHexFixedSize(randomData[1] & 0x00000fff, builder, 3, Lowercase);
-    builder.append("-");
-    appendUnsignedAsHexFixedSize((randomData[2] >> 30) | 0x8, builder, 1, Lowercase);
-    appendUnsignedAsHexFixedSize((randomData[2] >> 16) & 0x00000fff, builder, 3, Lowercase);
-    builder.append("-");
-    appendUnsignedAsHexFixedSize(randomData[2] & 0x0000ffff, builder, 4, Lowercase);
-    appendUnsignedAsHexFixedSize(randomData[3], builder, 8, Lowercase);
-    return builder.toString();
-}
-
-}
diff --git a/Source/core/platform/UUID.h b/Source/core/platform/UUID.h
deleted file mode 100644
index 99ab781..0000000
--- a/Source/core/platform/UUID.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 UUID_h
-#define UUID_h
-
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-// Creates a UUID that consists of 32 hexadecimal digits and returns its canonical form.
-// The canonical form is displayed in 5 groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters.
-// The hexadecimal values "a" through "f" are output as lower case characters.
-//
-// Note: for security reason, we should always generate version 4 UUID that use a scheme relying only on random numbers.
-// This algorithm sets the version number as well as two reserved bits. All other bits are set using a random or pseudorandom
-// data source. Version 4 UUIDs have the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx with hexadecimal digits for x and one of 8,
-// 9, A, or B for y.
-//
-// On Windows, version 4 UUIDs are used since Windows 2000 (http://msdn.microsoft.com/en-us/library/aa446557.aspx).
-// On MacOSX, version 4 UUIDs are used since Tiger (http://developer.apple.com/mac/library/technotes/tn/tn1103.html#TNTAG8).
-// On Linux, the kernel offers the procfs pseudo-file /proc/sys/kernel/random/uuid that yields version 4 UUIDs (http://hbfs.wordpress.com/2008/09/30/ueid-unique-enough-ids/).
-String createCanonicalUUIDString();
-
-}
-
-#endif
diff --git a/Source/core/platform/Widget.cpp b/Source/core/platform/Widget.cpp
deleted file mode 100644
index 8b26cb6..0000000
--- a/Source/core/platform/Widget.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006, 2010 Apple 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 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,
- * 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/Widget.h"
-
-#include "core/platform/HostWindow.h"
-#include "core/platform/ScrollView.h"
-#include "core/platform/graphics/IntRect.h"
-
-#include "wtf/Assertions.h"
-
-namespace WebCore {
-
-Widget::Widget()
-    : m_parent(0)
-    , m_selfVisible(false)
-    , m_parentVisible(false)
-{
-}
-
-Widget::~Widget()
-{
-    ASSERT(!parent());
-}
-
-void Widget::setCursor(const Cursor& cursor)
-{
-    if (ScrollView* view = root())
-        view->hostWindow()->setCursor(cursor);
-}
-
-void Widget::removeFromParent()
-{
-    if (parent())
-        parent()->removeChild(this);
-}
-
-void Widget::setParent(ScrollView* view)
-{
-    ASSERT(!view || !m_parent);
-    if (!view || !view->isVisible())
-        setParentVisible(false);
-    m_parent = view;
-    if (view && view->isVisible())
-        setParentVisible(true);
-}
-
-ScrollView* Widget::root() const
-{
-    const Widget* top = this;
-    while (top->parent())
-        top = top->parent();
-    if (top->isFrameView())
-        return const_cast<ScrollView*>(static_cast<const ScrollView*>(top));
-    return 0;
-}
-
-IntRect Widget::convertFromRootView(const IntRect& rootRect) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        IntRect parentRect = parentScrollView->convertFromRootView(rootRect);
-        return convertFromContainingView(parentRect);
-    }
-    return rootRect;
-}
-
-IntRect Widget::convertToRootView(const IntRect& localRect) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        IntRect parentRect = convertToContainingView(localRect);
-        return parentScrollView->convertToRootView(parentRect);
-    }
-    return localRect;
-}
-
-IntPoint Widget::convertFromRootView(const IntPoint& rootPoint) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        IntPoint parentPoint = parentScrollView->convertFromRootView(rootPoint);
-        return convertFromContainingView(parentPoint);
-    }
-    return rootPoint;
-}
-
-IntPoint Widget::convertToRootView(const IntPoint& localPoint) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        IntPoint parentPoint = convertToContainingView(localPoint);
-        return parentScrollView->convertToRootView(parentPoint);
-    }
-    return localPoint;
-}
-
-IntRect Widget::convertFromContainingWindow(const IntRect& windowRect) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        IntRect parentRect = parentScrollView->convertFromContainingWindow(windowRect);
-        return convertFromContainingView(parentRect);
-    }
-    return windowRect;
-}
-
-IntRect Widget::convertToContainingWindow(const IntRect& localRect) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        IntRect parentRect = convertToContainingView(localRect);
-        return parentScrollView->convertToContainingWindow(parentRect);
-    }
-    return localRect;
-}
-
-IntPoint Widget::convertFromContainingWindow(const IntPoint& windowPoint) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        IntPoint parentPoint = parentScrollView->convertFromContainingWindow(windowPoint);
-        return convertFromContainingView(parentPoint);
-    }
-    return windowPoint;
-}
-
-IntPoint Widget::convertToContainingWindow(const IntPoint& localPoint) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        IntPoint parentPoint = convertToContainingView(localPoint);
-        return parentScrollView->convertToContainingWindow(parentPoint);
-    }
-    return localPoint;
-}
-
-IntRect Widget::convertToContainingView(const IntRect& localRect) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        IntRect parentRect(localRect);
-        parentRect.setLocation(parentScrollView->convertChildToSelf(this, localRect.location()));
-        return parentRect;
-    }
-    return localRect;
-}
-
-IntRect Widget::convertFromContainingView(const IntRect& parentRect) const
-{
-    if (const ScrollView* parentScrollView = parent()) {
-        IntRect localRect = parentRect;
-        localRect.setLocation(parentScrollView->convertSelfToChild(this, localRect.location()));
-        return localRect;
-    }
-
-    return parentRect;
-}
-
-IntPoint Widget::convertToContainingView(const IntPoint& localPoint) const
-{
-    if (const ScrollView* parentScrollView = parent())
-        return parentScrollView->convertChildToSelf(this, localPoint);
-
-    return localPoint;
-}
-
-IntPoint Widget::convertFromContainingView(const IntPoint& parentPoint) const
-{
-    if (const ScrollView* parentScrollView = parent())
-        return parentScrollView->convertSelfToChild(this, parentPoint);
-
-    return parentPoint;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/Widget.h b/Source/core/platform/Widget.h
deleted file mode 100644
index 6a871a3..0000000
--- a/Source/core/platform/Widget.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2008 Collabora Ltd.  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 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,
- * 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 Widget_h
-#define Widget_h
-
-#include "core/platform/graphics/IntRect.h"
-#include "wtf/Forward.h"
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class AXObjectCache;
-class Cursor;
-class Event;
-class GraphicsContext;
-class ScrollView;
-
-// The Widget class serves as a base class for three kinds of objects:
-// (1) Scrollable areas (ScrollView)
-// (2) Scrollbars (Scrollbar)
-// (3) Plugins (PluginView)
-//
-// Widgets are connected in a hierarchy, with the restriction that plugins and scrollbars are always leaves of the
-// tree.  Only ScrollViews can have children (and therefore the Widget class has no concept of children).
-class Widget : public RefCounted<Widget> {
-public:
-    Widget();
-    virtual ~Widget();
-
-    int x() const { return frameRect().x(); }
-    int y() const { return frameRect().y(); }
-    int width() const { return frameRect().width(); }
-    int height() const { return frameRect().height(); }
-    IntSize size() const { return frameRect().size(); }
-    IntPoint location() const { return frameRect().location(); }
-
-    virtual void setFrameRect(const IntRect& frame) { m_frame = frame; }
-    const IntRect& frameRect() const { return m_frame; }
-    IntRect boundsRect() const { return IntRect(0, 0, width(),  height()); }
-
-    void resize(int w, int h) { setFrameRect(IntRect(x(), y(), w, h)); }
-    void resize(const IntSize& s) { setFrameRect(IntRect(location(), s)); }
-    void move(int x, int y) { setFrameRect(IntRect(x, y, width(), height())); }
-    void move(const IntPoint& p) { setFrameRect(IntRect(p, size())); }
-
-    virtual void paint(GraphicsContext*, const IntRect&) { }
-    void invalidate() { invalidateRect(boundsRect()); }
-    virtual void invalidateRect(const IntRect&) = 0;
-
-    virtual void setFocus(bool) { }
-
-    void setCursor(const Cursor&);
-
-    virtual void show() { }
-    virtual void hide() { }
-    bool isSelfVisible() const { return m_selfVisible; } // Whether or not we have been explicitly marked as visible or not.
-    bool isParentVisible() const { return m_parentVisible; } // Whether or not our parent is visible.
-    bool isVisible() const { return m_selfVisible && m_parentVisible; } // Whether or not we are actually visible.
-    virtual void setParentVisible(bool visible) { m_parentVisible = visible; }
-    void setSelfVisible(bool v) { m_selfVisible = v; }
-
-    virtual bool isFrameView() const { return false; }
-    virtual bool isPluginView() const { return false; }
-    virtual bool isPluginContainer() const { return false; }
-    virtual bool isScrollbar() const { return false; }
-    virtual bool isScrollView() const { return false; }
-
-    void removeFromParent();
-    virtual void setParent(ScrollView* view);
-    ScrollView* parent() const { return m_parent; }
-    ScrollView* root() const;
-
-    virtual void handleEvent(Event*) { }
-
-    IntRect convertToRootView(const IntRect&) const;
-    IntRect convertFromRootView(const IntRect&) const;
-
-    IntPoint convertToRootView(const IntPoint&) const;
-    IntPoint convertFromRootView(const IntPoint&) const;
-
-    // It is important for cross-platform code to realize that Mac has flipped coordinates.  Therefore any code
-    // that tries to convert the location of a rect using the point-based convertFromContainingWindow will end
-    // up with an inaccurate rect.  Always make sure to use the rect-based convertFromContainingWindow method
-    // when converting window rects.
-    IntRect convertToContainingWindow(const IntRect&) const;
-    IntRect convertFromContainingWindow(const IntRect&) const;
-
-    IntPoint convertToContainingWindow(const IntPoint&) const;
-    IntPoint convertFromContainingWindow(const IntPoint&) const;
-
-    virtual void frameRectsChanged() { }
-
-    // Notifies this widget that other widgets on the page have been repositioned.
-    virtual void widgetPositionsUpdated() {}
-
-    // Notifies this widget that its clip rect changed.
-    virtual void clipRectChanged() { }
-
-    // Virtual methods to convert points to/from the containing ScrollView
-    virtual IntRect convertToContainingView(const IntRect&) const;
-    virtual IntRect convertFromContainingView(const IntRect&) const;
-    virtual IntPoint convertToContainingView(const IntPoint&) const;
-    virtual IntPoint convertFromContainingView(const IntPoint&) const;
-
-    // A means to access the AX cache when this object can get a pointer to it.
-    virtual AXObjectCache* axObjectCache() const { return 0; }
-
-    // Notifies this widget that it will no longer be receiving events.
-    virtual void eventListenersRemoved() { }
-
-private:
-    ScrollView* m_parent;
-    IntRect m_frame;
-    bool m_selfVisible;
-    bool m_parentVisible;
-};
-
-} // namespace WebCore
-
-#endif // Widget_h
diff --git a/Source/core/platform/animation/AnimationTranslationUtil.cpp b/Source/core/platform/animation/AnimationTranslationUtil.cpp
index 57e103c..7f58116 100644
--- a/Source/core/platform/animation/AnimationTranslationUtil.cpp
+++ b/Source/core/platform/animation/AnimationTranslationUtil.cpp
@@ -29,8 +29,9 @@
 #include "core/css/LengthFunctions.h"
 #include "core/platform/animation/CSSAnimationData.h"
 #include "core/platform/animation/KeyframeValueList.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/chromium/TransformSkMatrix44Conversions.h"
+#include "core/platform/graphics/filters/FilterOperations.h"
+#include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
 #include "core/platform/graphics/transforms/InterpolatedTransformOperation.h"
 #include "core/platform/graphics/transforms/Matrix3DTransformOperation.h"
 #include "core/platform/graphics/transforms/MatrixTransformOperation.h"
@@ -40,11 +41,13 @@
 #include "core/platform/graphics/transforms/SkewTransformOperation.h"
 #include "core/platform/graphics/transforms/TransformOperations.h"
 #include "core/platform/graphics/transforms/TranslateTransformOperation.h"
+#include "platform/geometry/FloatSize.h"
 
 #include "public/platform/Platform.h"
 #include "public/platform/WebAnimation.h"
 #include "public/platform/WebAnimationCurve.h"
 #include "public/platform/WebCompositorSupport.h"
+#include "public/platform/WebFilterAnimationCurve.h"
 #include "public/platform/WebFloatAnimationCurve.h"
 #include "public/platform/WebTransformAnimationCurve.h"
 #include "public/platform/WebTransformOperations.h"
@@ -148,15 +151,6 @@
     return true;
 }
 
-bool isRotationType(TransformOperation::OperationType transformType)
-{
-    return transformType == TransformOperation::Rotate
-        || transformType == TransformOperation::RotateX
-        || transformType == TransformOperation::RotateY
-        || transformType == TransformOperation::RotateZ
-        || transformType == TransformOperation::Rotate3D;
-}
-
 template <>
 bool appendKeyframeWithStandardTimingFunction<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(WebTransformAnimationCurve* curve, double keyTime, const TransformAnimationValue* value, const TransformAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize)
 {
@@ -171,7 +165,7 @@
         canBlend = lastOperations->canBlendWith(*operations);
     }
     if (canBlend) {
-        curve->add(WebTransformKeyframe(keyTime, operations.leakPtr()), timingFunctionType);
+        curve->add(WebTransformKeyframe(keyTime, operations.release()), timingFunctionType);
         return true;
     }
     return false;
@@ -191,12 +185,42 @@
         canBlend = lastOperations->canBlendWith(*operations);
     }
     if (canBlend) {
-        curve->add(WebTransformKeyframe(keyTime, operations.leakPtr()), x1, y1, x2, y2);
+        curve->add(WebTransformKeyframe(keyTime, operations.release()), x1, y1, x2, y2);
         return true;
     }
     return false;
 }
 
+template <>
+bool appendKeyframeWithStandardTimingFunction<FilterAnimationValue, WebFilterKeyframe, WebFilterAnimationCurve>(WebFilterAnimationCurve* curve, double keyTime, const FilterAnimationValue* value, const FilterAnimationValue* lastValue, WebKit::WebAnimationCurve::TimingFunctionType timingFunctionType, const FloatSize& boxSize)
+{
+    SkiaImageFilterBuilder builder;
+    OwnPtr<WebFilterOperations> operations = adoptPtr(Platform::current()->compositorSupport()->createFilterOperations());
+    if (!operations)
+        return false;
+    FilterOutsets outsets = value->value()->outsets();
+    builder.setCropOffset(FloatSize(outsets.left(), outsets.top()));
+    if (!builder.buildFilterOperations(*value->value(), operations.get()))
+        return false;
+    curve->add(WebFilterKeyframe(keyTime, operations.leakPtr()), timingFunctionType);
+    return true;
+}
+
+template <>
+bool appendKeyframeWithCustomBezierTimingFunction<FilterAnimationValue, WebFilterKeyframe, WebFilterAnimationCurve>(WebFilterAnimationCurve* curve, double keyTime, const FilterAnimationValue* value, const FilterAnimationValue* lastValue, double x1, double y1, double x2, double y2, const FloatSize& boxSize)
+{
+    SkiaImageFilterBuilder builder;
+    OwnPtr<WebFilterOperations> operations = adoptPtr(Platform::current()->compositorSupport()->createFilterOperations());
+    if (!operations)
+        return false;
+    FilterOutsets outsets = value->value()->outsets();
+    builder.setCropOffset(FloatSize(outsets.left(), outsets.top()));
+    if (!builder.buildFilterOperations(*value->value(), operations.get()))
+        return false;
+    curve->add(WebFilterKeyframe(keyTime, operations.leakPtr()), x1, y1, x2, y2);
+    return true;
+}
+
 template <class Value, class Keyframe, class Curve>
 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& valueList, const CSSAnimationData* animation, int animationId, double timeOffset, Curve* curve, WebKit::WebAnimation::TargetProperty targetProperty, const FloatSize& boxSize)
 {
@@ -285,18 +309,27 @@
 
 PassOwnPtr<WebKit::WebAnimation> createWebAnimation(const KeyframeValueList& values, const CSSAnimationData* animation, int animationId, double timeOffset, const FloatSize& boxSize)
 {
-
-
-    if (values.property() == AnimatedPropertyWebkitTransform) {
+    switch (values.property()) {
+    case AnimatedPropertyWebkitTransform: {
         OwnPtr<WebTransformAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createTransformAnimationCurve());
         return createWebAnimation<TransformAnimationValue, WebTransformKeyframe, WebTransformAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyTransform, FloatSize(boxSize));
     }
 
-    if (values.property() == AnimatedPropertyOpacity) {
+    case AnimatedPropertyOpacity: {
         OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createFloatAnimationCurve());
         return createWebAnimation<FloatAnimationValue, WebFloatKeyframe, WebFloatAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyOpacity, FloatSize());
     }
 
+    case AnimatedPropertyWebkitFilter: {
+        OwnPtr<WebFilterAnimationCurve> curve = adoptPtr(Platform::current()->compositorSupport()->createFilterAnimationCurve());
+        return createWebAnimation<FilterAnimationValue, WebFilterKeyframe, WebFilterAnimationCurve>(values, animation, animationId, timeOffset, curve.get(), WebKit::WebAnimation::TargetPropertyFilter, FloatSize(boxSize));
+    }
+
+    case AnimatedPropertyBackgroundColor:
+    case AnimatedPropertyInvalid:
+        return nullptr;
+    }
+
     return nullptr;
 }
 
diff --git a/Source/core/platform/animation/AnimationTranslationUtilTest.cpp b/Source/core/platform/animation/AnimationTranslationUtilTest.cpp
index f81f305..801b62f 100644
--- a/Source/core/platform/animation/AnimationTranslationUtilTest.cpp
+++ b/Source/core/platform/animation/AnimationTranslationUtilTest.cpp
@@ -28,12 +28,13 @@
 
 #include "core/platform/animation/CSSAnimationData.h"
 #include "core/platform/animation/KeyframeValueList.h"
-#include "core/platform/graphics/IntSize.h"
+#include "core/platform/graphics/filters/FilterOperations.h"
 #include "core/platform/graphics/transforms/Matrix3DTransformOperation.h"
 #include "core/platform/graphics/transforms/RotateTransformOperation.h"
 #include "core/platform/graphics/transforms/ScaleTransformOperation.h"
 #include "core/platform/graphics/transforms/TransformOperations.h"
 #include "core/platform/graphics/transforms/TranslateTransformOperation.h"
+#include "platform/geometry/IntSize.h"
 #include "public/platform/WebAnimation.h"
 #include "wtf/RefPtr.h"
 #include <gtest/gtest.h>
@@ -62,6 +63,25 @@
     EXPECT_TRUE(animationCanBeTranslated(values, animation.get()));
 }
 
+TEST(AnimationTranslationUtilTest, createFilterAnimation)
+{
+    const double duration = 1;
+    WebCore::KeyframeValueList values(AnimatedPropertyWebkitFilter);
+
+    FilterOperations operations1;
+    operations1.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterOperation::SATURATE));
+    values.insert(adoptPtr(new FilterAnimationValue(0, &operations1)));
+
+    FilterOperations operations2;
+    operations2.operations().append(BasicColorMatrixFilterOperation::create(1.0, FilterOperation::SATURATE));
+    values.insert(adoptPtr(new FilterAnimationValue(duration, &operations2)));
+
+    RefPtr<CSSAnimationData> animation = CSSAnimationData::create();
+    animation->setDuration(duration);
+
+    EXPECT_TRUE(animationCanBeTranslated(values, animation.get()));
+}
+
 TEST(AnimationTranslationUtilTest, createTransformAnimation)
 {
     const double duration = 1;
diff --git a/Source/core/platform/animation/AnimationUtilities.h b/Source/core/platform/animation/AnimationUtilities.h
index 4c86e77..0f8a301 100644
--- a/Source/core/platform/animation/AnimationUtilities.h
+++ b/Source/core/platform/animation/AnimationUtilities.h
@@ -26,9 +26,10 @@
 #ifndef AnimationUtilities_h
 #define AnimationUtilities_h
 
-#include "core/platform/LayoutUnit.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/LayoutUnit.h"
+#include "platform/geometry/IntPoint.h"
 #include "wtf/MathExtras.h"
+#include "wtf/TypeTraits.h"
 
 namespace WebCore {
 
@@ -37,9 +38,12 @@
     return lround(from + (to - from) * progress);
 }
 
-inline unsigned blend(unsigned from, unsigned to, double progress)
+// For unsigned types.
+template <typename T>
+inline T blend(T from, T to, double progress)
 {
-    return clampTo<unsigned>(round(to > from ? from + (to - from) * progress : from - (from - to) * progress));
+    COMPILE_ASSERT(WTF::IsInteger<T>::value, BlendForUnsignedTypes);
+    return clampTo<T>(round(to > from ? from + (to - from) * progress : from - (from - to) * progress));
 }
 
 inline double blend(double from, double to, double progress)
diff --git a/Source/core/platform/animation/TimingFunction.h b/Source/core/platform/animation/TimingFunction.h
index 5ee8507..861375f 100644
--- a/Source/core/platform/animation/TimingFunction.h
+++ b/Source/core/platform/animation/TimingFunction.h
@@ -27,7 +27,7 @@
 
 #include "RuntimeEnabledFeatures.h"
 #include "core/platform/animation/AnimationUtilities.h" // For blend()
-#include "core/platform/graphics/UnitBezier.h"
+#include "platform/animation/UnitBezier.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
diff --git a/Source/core/platform/audio/AudioArray.h b/Source/core/platform/audio/AudioArray.h
deleted file mode 100644
index f611a2b..0000000
--- a/Source/core/platform/audio/AudioArray.h
+++ /dev/null
@@ -1,162 +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.
- * 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.
- *
- * 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 AudioArray_h
-#define AudioArray_h
-
-#include <string.h>
-#include "wtf/FastMalloc.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-template<typename T>
-class AudioArray {
-public:
-    AudioArray() : m_allocation(0), m_alignedData(0), m_size(0) { }
-    explicit AudioArray(size_t n) : m_allocation(0), m_alignedData(0), m_size(0)
-    {
-        allocate(n);
-    }
-
-    ~AudioArray()
-    {
-        fastFree(m_allocation);
-    }
-
-    // It's OK to call allocate() multiple times, but data will *not* be copied from an initial allocation
-    // if re-allocated. Allocations are zero-initialized.
-    void allocate(size_t n)
-    {
-        // Although n is a size_t, its true limit is max unsigned because we use unsigned in zeroRange()
-        // and copyToRange(). Also check for integer overflow.
-        if (n > std::numeric_limits<unsigned>::max() / sizeof(T))
-            CRASH();
-
-        unsigned initialSize = sizeof(T) * n;
-
-#if USE(WEBAUDIO_FFMPEG) || USE(WEBAUDIO_OPENMAX_DL_FFT)
-        const size_t alignment = 32;
-#else
-        const size_t alignment = 16;
-#endif
-
-        if (m_allocation)
-            fastFree(m_allocation);
-
-        bool isAllocationGood = false;
-
-        while (!isAllocationGood) {
-            // Initially we try to allocate the exact size, but if it's not aligned
-            // then we'll have to reallocate and from then on allocate extra.
-            static size_t extraAllocationBytes = 0;
-
-            // Again, check for integer overflow.
-            if (initialSize + extraAllocationBytes < initialSize)
-                CRASH();
-
-            T* allocation = static_cast<T*>(fastMalloc(initialSize + extraAllocationBytes));
-            if (!allocation)
-                CRASH();
-            T* alignedData = alignedAddress(allocation, alignment);
-
-            if (alignedData == allocation || extraAllocationBytes == alignment) {
-                m_allocation = allocation;
-                m_alignedData = alignedData;
-                m_size = n;
-                isAllocationGood = true;
-                zero();
-            } else {
-                extraAllocationBytes = alignment; // always allocate extra after the first alignment failure.
-                fastFree(allocation);
-            }
-        }
-    }
-
-    T* data() { return m_alignedData; }
-    const T* data() const { return m_alignedData; }
-    size_t size() const { return m_size; }
-
-    T& at(size_t i)
-    {
-        // Note that although it is a size_t, m_size is now guaranteed to be
-        // no greater than max unsigned. This guarantee is enforced in allocate().
-        ASSERT_WITH_SECURITY_IMPLICATION(i < size());
-        return data()[i];
-    }
-
-    T& operator[](size_t i) { return at(i); }
-
-    void zero()
-    {
-        // This multiplication is made safe by the check in allocate().
-        memset(this->data(), 0, sizeof(T) * this->size());
-    }
-
-    void zeroRange(unsigned start, unsigned end)
-    {
-        bool isSafe = (start <= end) && (end <= this->size());
-        ASSERT(isSafe);
-        if (!isSafe)
-            return;
-
-        // This expression cannot overflow because end - start cannot be
-        // greater than m_size, which is safe due to the check in allocate().
-        memset(this->data() + start, 0, sizeof(T) * (end - start));
-    }
-
-    void copyToRange(const T* sourceData, unsigned start, unsigned end)
-    {
-        bool isSafe = (start <= end) && (end <= this->size());
-        ASSERT(isSafe);
-        if (!isSafe)
-            return;
-
-        // This expression cannot overflow because end - start cannot be
-        // greater than m_size, which is safe due to the check in allocate().
-        memcpy(this->data() + start, sourceData, sizeof(T) * (end - start));
-    }
-
-private:
-    static T* alignedAddress(T* address, intptr_t alignment)
-    {
-        intptr_t value = reinterpret_cast<intptr_t>(address);
-        return reinterpret_cast<T*>((value + alignment - 1) & ~(alignment - 1));
-    }
-
-    T* m_allocation;
-    T* m_alignedData;
-    size_t m_size;
-};
-
-typedef AudioArray<float> AudioFloatArray;
-typedef AudioArray<double> AudioDoubleArray;
-
-} // WebCore
-
-#endif // AudioArray_h
diff --git a/Source/core/platform/audio/AudioBus.cpp b/Source/core/platform/audio/AudioBus.cpp
deleted file mode 100644
index dd8acff..0000000
--- a/Source/core/platform/audio/AudioBus.cpp
+++ /dev/null
@@ -1,638 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/AudioBus.h"
-
-#include "core/platform/audio/DenormalDisabler.h"
-
-#include <assert.h>
-#include <math.h>
-#include <algorithm>
-#include "core/platform/audio/SincResampler.h"
-#include "core/platform/audio/VectorMath.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebCore {
-
-using namespace VectorMath;
-
-const unsigned MaxBusChannels = 32;
-
-PassRefPtr<AudioBus> AudioBus::create(unsigned numberOfChannels, size_t length, bool allocate)
-{
-    ASSERT(numberOfChannels <= MaxBusChannels);
-    if (numberOfChannels > MaxBusChannels)
-        return 0;
-
-    return adoptRef(new AudioBus(numberOfChannels, length, allocate));
-}
-
-AudioBus::AudioBus(unsigned numberOfChannels, size_t length, bool allocate)
-    : m_length(length)
-    , m_busGain(1)
-    , m_isFirstTime(true)
-    , m_sampleRate(0)
-{
-    m_channels.reserveInitialCapacity(numberOfChannels);
-
-    for (unsigned i = 0; i < numberOfChannels; ++i) {
-        PassOwnPtr<AudioChannel> channel = allocate ? adoptPtr(new AudioChannel(length)) : adoptPtr(new AudioChannel(0, length));
-        m_channels.append(channel);
-    }
-
-    m_layout = LayoutCanonical; // for now this is the only layout we define
-}
-
-void AudioBus::setChannelMemory(unsigned channelIndex, float* storage, size_t length)
-{
-    if (channelIndex < m_channels.size()) {
-        channel(channelIndex)->set(storage, length);
-        m_length = length; // FIXME: verify that this length matches all the other channel lengths
-    }
-}
-
-void AudioBus::resizeSmaller(size_t newLength)
-{
-    ASSERT(newLength <= m_length);
-    if (newLength <= m_length)
-        m_length = newLength;
-
-    for (unsigned i = 0; i < m_channels.size(); ++i)
-        m_channels[i]->resizeSmaller(newLength);
-}
-
-void AudioBus::zero()
-{
-    for (unsigned i = 0; i < m_channels.size(); ++i)
-        m_channels[i]->zero();
-}
-
-AudioChannel* AudioBus::channelByType(unsigned channelType)
-{
-    // For now we only support canonical channel layouts...
-    if (m_layout != LayoutCanonical)
-        return 0;
-
-    switch (numberOfChannels()) {
-    case 1: // mono
-        if (channelType == ChannelMono || channelType == ChannelLeft)
-            return channel(0);
-        return 0;
-
-    case 2: // stereo
-        switch (channelType) {
-        case ChannelLeft: return channel(0);
-        case ChannelRight: return channel(1);
-        default: return 0;
-        }
-
-    case 4: // quad
-        switch (channelType) {
-        case ChannelLeft: return channel(0);
-        case ChannelRight: return channel(1);
-        case ChannelSurroundLeft: return channel(2);
-        case ChannelSurroundRight: return channel(3);
-        default: return 0;
-        }
-
-    case 5: // 5.0
-        switch (channelType) {
-        case ChannelLeft: return channel(0);
-        case ChannelRight: return channel(1);
-        case ChannelCenter: return channel(2);
-        case ChannelSurroundLeft: return channel(3);
-        case ChannelSurroundRight: return channel(4);
-        default: return 0;
-        }
-
-    case 6: // 5.1
-        switch (channelType) {
-        case ChannelLeft: return channel(0);
-        case ChannelRight: return channel(1);
-        case ChannelCenter: return channel(2);
-        case ChannelLFE: return channel(3);
-        case ChannelSurroundLeft: return channel(4);
-        case ChannelSurroundRight: return channel(5);
-        default: return 0;
-        }
-    }
-
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-const AudioChannel* AudioBus::channelByType(unsigned type) const
-{
-    return const_cast<AudioBus*>(this)->channelByType(type);
-}
-
-// Returns true if the channel count and frame-size match.
-bool AudioBus::topologyMatches(const AudioBus& bus) const
-{
-    if (numberOfChannels() != bus.numberOfChannels())
-        return false; // channel mismatch
-
-    // Make sure source bus has enough frames.
-    if (length() > bus.length())
-        return false; // frame-size mismatch
-
-    return true;
-}
-
-PassRefPtr<AudioBus> AudioBus::createBufferFromRange(const AudioBus* sourceBuffer, unsigned startFrame, unsigned endFrame)
-{
-    size_t numberOfSourceFrames = sourceBuffer->length();
-    unsigned numberOfChannels = sourceBuffer->numberOfChannels();
-
-    // Sanity checking
-    bool isRangeSafe = startFrame < endFrame && endFrame <= numberOfSourceFrames;
-    ASSERT(isRangeSafe);
-    if (!isRangeSafe)
-        return 0;
-
-    size_t rangeLength = endFrame - startFrame;
-
-    RefPtr<AudioBus> audioBus = create(numberOfChannels, rangeLength);
-    audioBus->setSampleRate(sourceBuffer->sampleRate());
-
-    for (unsigned i = 0; i < numberOfChannels; ++i)
-        audioBus->channel(i)->copyFromRange(sourceBuffer->channel(i), startFrame, endFrame);
-
-    return audioBus;
-}
-
-float AudioBus::maxAbsValue() const
-{
-    float max = 0.0f;
-    for (unsigned i = 0; i < numberOfChannels(); ++i) {
-        const AudioChannel* channel = this->channel(i);
-        max = std::max(max, channel->maxAbsValue());
-    }
-
-    return max;
-}
-
-void AudioBus::normalize()
-{
-    float max = maxAbsValue();
-    if (max)
-        scale(1.0f / max);
-}
-
-void AudioBus::scale(float scale)
-{
-    for (unsigned i = 0; i < numberOfChannels(); ++i)
-        channel(i)->scale(scale);
-}
-
-void AudioBus::copyFrom(const AudioBus& sourceBus, ChannelInterpretation channelInterpretation)
-{
-    if (&sourceBus == this)
-        return;
-
-    unsigned numberOfSourceChannels = sourceBus.numberOfChannels();
-    unsigned numberOfDestinationChannels = numberOfChannels();
-
-    if (numberOfDestinationChannels == numberOfSourceChannels) {
-        for (unsigned i = 0; i < numberOfSourceChannels; ++i)
-            channel(i)->copyFrom(sourceBus.channel(i));
-    } else {
-        switch (channelInterpretation) {
-        case Speakers:
-            speakersCopyFrom(sourceBus);
-            break;
-        case Discrete:
-            discreteCopyFrom(sourceBus);
-            break;
-        default:
-            ASSERT_NOT_REACHED();
-        }
-    }
-}
-
-void AudioBus::sumFrom(const AudioBus& sourceBus, ChannelInterpretation channelInterpretation)
-{
-    if (&sourceBus == this)
-        return;
-
-    unsigned numberOfSourceChannels = sourceBus.numberOfChannels();
-    unsigned numberOfDestinationChannels = numberOfChannels();
-
-    if (numberOfDestinationChannels == numberOfSourceChannels) {
-        for (unsigned i = 0; i < numberOfSourceChannels; ++i)
-            channel(i)->sumFrom(sourceBus.channel(i));
-    } else {
-        switch (channelInterpretation) {
-        case Speakers:
-            speakersSumFrom(sourceBus);
-            break;
-        case Discrete:
-            discreteSumFrom(sourceBus);
-            break;
-        default:
-            ASSERT_NOT_REACHED();
-        }
-    }
-}
-
-void AudioBus::speakersCopyFrom(const AudioBus& sourceBus)
-{
-    // FIXME: Implement down mixing 5.1 to stereo.
-    // https://bugs.webkit.org/show_bug.cgi?id=79192
-
-    unsigned numberOfSourceChannels = sourceBus.numberOfChannels();
-    unsigned numberOfDestinationChannels = numberOfChannels();
-
-    if (numberOfDestinationChannels == 2 && numberOfSourceChannels == 1) {
-        // Handle mono -> stereo case (for now simply copy mono channel into both left and right)
-        // FIXME: Really we should apply an equal-power scaling factor here, since we're effectively panning center...
-        const AudioChannel* sourceChannel = sourceBus.channel(0);
-        channel(0)->copyFrom(sourceChannel);
-        channel(1)->copyFrom(sourceChannel);
-    } else if (numberOfDestinationChannels == 1 && numberOfSourceChannels == 2) {
-        // Handle stereo -> mono case. output = 0.5 * (input.L + input.R).
-        AudioBus& sourceBusSafe = const_cast<AudioBus&>(sourceBus);
-
-        const float* sourceL = sourceBusSafe.channelByType(ChannelLeft)->data();
-        const float* sourceR = sourceBusSafe.channelByType(ChannelRight)->data();
-
-        float* destination = channelByType(ChannelLeft)->mutableData();
-        vadd(sourceL, 1, sourceR, 1, destination, 1, length());
-        float scale = 0.5;
-        vsmul(destination, 1, &scale, destination, 1, length());
-    } else if (numberOfDestinationChannels == 6 && numberOfSourceChannels == 1) {
-        // Handle mono -> 5.1 case, copy mono channel to center.
-        channel(2)->copyFrom(sourceBus.channel(0));
-        channel(0)->zero();
-        channel(1)->zero();
-        channel(3)->zero();
-        channel(4)->zero();
-        channel(5)->zero();
-    } else if (numberOfDestinationChannels == 1 && numberOfSourceChannels == 6) {
-        // Handle 5.1 -> mono case.
-        zero();
-        speakersSumFrom5_1_ToMono(sourceBus);
-    } else {
-        // Fallback for unknown combinations.
-        discreteCopyFrom(sourceBus);
-    }
-}
-
-void AudioBus::speakersSumFrom(const AudioBus& sourceBus)
-{
-    // FIXME: Implement down mixing 5.1 to stereo.
-    // https://bugs.webkit.org/show_bug.cgi?id=79192
-
-    unsigned numberOfSourceChannels = sourceBus.numberOfChannels();
-    unsigned numberOfDestinationChannels = numberOfChannels();
-
-    if (numberOfDestinationChannels == 2 && numberOfSourceChannels == 1) {
-        // Handle mono -> stereo case (summing mono channel into both left and right).
-        const AudioChannel* sourceChannel = sourceBus.channel(0);
-        channel(0)->sumFrom(sourceChannel);
-        channel(1)->sumFrom(sourceChannel);
-    } else if (numberOfDestinationChannels == 1 && numberOfSourceChannels == 2) {
-        // Handle stereo -> mono case. output += 0.5 * (input.L + input.R).
-        AudioBus& sourceBusSafe = const_cast<AudioBus&>(sourceBus);
-
-        const float* sourceL = sourceBusSafe.channelByType(ChannelLeft)->data();
-        const float* sourceR = sourceBusSafe.channelByType(ChannelRight)->data();
-
-        float* destination = channelByType(ChannelLeft)->mutableData();
-        float scale = 0.5;
-        vsma(sourceL, 1, &scale, destination, 1, length());
-        vsma(sourceR, 1, &scale, destination, 1, length());
-    } else if (numberOfDestinationChannels == 6 && numberOfSourceChannels == 1) {
-        // Handle mono -> 5.1 case, sum mono channel into center.
-        channel(2)->sumFrom(sourceBus.channel(0));
-    } else if (numberOfDestinationChannels == 1 && numberOfSourceChannels == 6) {
-        // Handle 5.1 -> mono case.
-        speakersSumFrom5_1_ToMono(sourceBus);
-    } else {
-        // Fallback for unknown combinations.
-        discreteSumFrom(sourceBus);
-    }
-}
-
-void AudioBus::speakersSumFrom5_1_ToMono(const AudioBus& sourceBus)
-{
-    AudioBus& sourceBusSafe = const_cast<AudioBus&>(sourceBus);
-
-    const float* sourceL = sourceBusSafe.channelByType(ChannelLeft)->data();
-    const float* sourceR = sourceBusSafe.channelByType(ChannelRight)->data();
-    const float* sourceC = sourceBusSafe.channelByType(ChannelCenter)->data();
-    const float* sourceSL = sourceBusSafe.channelByType(ChannelSurroundLeft)->data();
-    const float* sourceSR = sourceBusSafe.channelByType(ChannelSurroundRight)->data();
-
-    float* destination = channelByType(ChannelLeft)->mutableData();
-
-    AudioFloatArray temp(length());
-    float* tempData = temp.data();
-
-    // Sum in L and R.
-    vadd(sourceL, 1, sourceR, 1, tempData, 1, length());
-    float scale = 0.7071;
-    vsmul(tempData, 1, &scale, tempData, 1, length());
-    vadd(tempData, 1, destination, 1, destination, 1, length());
-
-    // Sum in SL and SR.
-    vadd(sourceSL, 1, sourceSR, 1, tempData, 1, length());
-    scale = 0.5;
-    vsmul(tempData, 1, &scale, tempData, 1, length());
-    vadd(tempData, 1, destination, 1, destination, 1, length());
-
-    // Sum in center.
-    vadd(sourceC, 1, destination, 1, destination, 1, length());
-}
-
-void AudioBus::discreteCopyFrom(const AudioBus& sourceBus)
-{
-    unsigned numberOfSourceChannels = sourceBus.numberOfChannels();
-    unsigned numberOfDestinationChannels = numberOfChannels();
-
-    if (numberOfDestinationChannels < numberOfSourceChannels) {
-        // Down-mix by copying channels and dropping the remaining.
-        for (unsigned i = 0; i < numberOfDestinationChannels; ++i)
-            channel(i)->copyFrom(sourceBus.channel(i));
-    } else if (numberOfDestinationChannels > numberOfSourceChannels) {
-        // Up-mix by copying as many channels as we have, then zeroing remaining channels.
-        for (unsigned i = 0; i < numberOfSourceChannels; ++i)
-            channel(i)->copyFrom(sourceBus.channel(i));
-        for (unsigned i = numberOfSourceChannels; i < numberOfDestinationChannels; ++i)
-            channel(i)->zero();
-    }
-}
-
-void AudioBus::discreteSumFrom(const AudioBus& sourceBus)
-{
-    unsigned numberOfSourceChannels = sourceBus.numberOfChannels();
-    unsigned numberOfDestinationChannels = numberOfChannels();
-
-    if (numberOfDestinationChannels < numberOfSourceChannels) {
-        // Down-mix by summing channels and dropping the remaining.
-        for (unsigned i = 0; i < numberOfDestinationChannels; ++i)
-            channel(i)->sumFrom(sourceBus.channel(i));
-    } else if (numberOfDestinationChannels > numberOfSourceChannels) {
-        // Up-mix by summing as many channels as we have.
-        for (unsigned i = 0; i < numberOfSourceChannels; ++i)
-            channel(i)->sumFrom(sourceBus.channel(i));
-    }
-}
-
-void AudioBus::copyWithGainFrom(const AudioBus &sourceBus, float* lastMixGain, float targetGain)
-{
-    if (!topologyMatches(sourceBus)) {
-        ASSERT_NOT_REACHED();
-        zero();
-        return;
-    }
-
-    if (sourceBus.isSilent()) {
-        zero();
-        return;
-    }
-
-    unsigned numberOfChannels = this->numberOfChannels();
-    ASSERT(numberOfChannels <= MaxBusChannels);
-    if (numberOfChannels > MaxBusChannels)
-        return;
-
-    // If it is copying from the same bus and no need to change gain, just return.
-    if (this == &sourceBus && *lastMixGain == targetGain && targetGain == 1)
-        return;
-
-    AudioBus& sourceBusSafe = const_cast<AudioBus&>(sourceBus);
-    const float* sources[MaxBusChannels];
-    float* destinations[MaxBusChannels];
-
-    for (unsigned i = 0; i < numberOfChannels; ++i) {
-        sources[i] = sourceBusSafe.channel(i)->data();
-        destinations[i] = channel(i)->mutableData();
-    }
-
-    // We don't want to suddenly change the gain from mixing one time slice to the next,
-    // so we "de-zipper" by slowly changing the gain each sample-frame until we've achieved the target gain.
-
-    // Take master bus gain into account as well as the targetGain.
-    float totalDesiredGain = static_cast<float>(m_busGain * targetGain);
-
-    // First time, snap directly to totalDesiredGain.
-    float gain = static_cast<float>(m_isFirstTime ? totalDesiredGain : *lastMixGain);
-    m_isFirstTime = false;
-
-    const float DezipperRate = 0.005f;
-    unsigned framesToProcess = length();
-
-    // If the gain is within epsilon of totalDesiredGain, we can skip dezippering.
-    // FIXME: this value may need tweaking.
-    const float epsilon = 0.001f;
-    float gainDiff = fabs(totalDesiredGain - gain);
-
-    // Number of frames to de-zipper before we are close enough to the target gain.
-    // FIXME: framesToDezipper could be smaller when target gain is close enough within this process loop.
-    unsigned framesToDezipper = (gainDiff < epsilon) ? 0 : framesToProcess;
-
-    if (framesToDezipper) {
-        if (!m_dezipperGainValues.get() || m_dezipperGainValues->size() < framesToDezipper)
-            m_dezipperGainValues = adoptPtr(new AudioFloatArray(framesToDezipper));
-
-        float* gainValues = m_dezipperGainValues->data();
-        for (unsigned i = 0; i < framesToDezipper; ++i) {
-            gain += (totalDesiredGain - gain) * DezipperRate;
-
-            // FIXME: If we are clever enough in calculating the framesToDezipper value, we can probably get
-            // rid of this DenormalDisabler::flushDenormalFloatToZero() call.
-            gain = DenormalDisabler::flushDenormalFloatToZero(gain);
-            *gainValues++ = gain;
-        }
-
-        for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) {
-            vmul(sources[channelIndex], 1, m_dezipperGainValues->data(), 1, destinations[channelIndex], 1, framesToDezipper);
-            sources[channelIndex] += framesToDezipper;
-            destinations[channelIndex] += framesToDezipper;
-        }
-    } else
-        gain = totalDesiredGain;
-
-    // Apply constant gain after de-zippering has converged on target gain.
-    if (framesToDezipper < framesToProcess) {
-        for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex)
-            vsmul(sources[channelIndex], 1, &gain, destinations[channelIndex], 1, framesToProcess - framesToDezipper);
-    }
-
-    // Save the target gain as the starting point for next time around.
-    *lastMixGain = gain;
-}
-
-void AudioBus::copyWithSampleAccurateGainValuesFrom(const AudioBus &sourceBus, float* gainValues, unsigned numberOfGainValues)
-{
-    // Make sure we're processing from the same type of bus.
-    // We *are* able to process from mono -> stereo
-    if (sourceBus.numberOfChannels() != 1 && !topologyMatches(sourceBus)) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    if (!gainValues || numberOfGainValues > sourceBus.length()) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    if (sourceBus.length() == numberOfGainValues && sourceBus.length() == length() && sourceBus.isSilent()) {
-        zero();
-        return;
-    }
-
-    // We handle both the 1 -> N and N -> N case here.
-    const float* source = sourceBus.channel(0)->data();
-    for (unsigned channelIndex = 0; channelIndex < numberOfChannels(); ++channelIndex) {
-        if (sourceBus.numberOfChannels() == numberOfChannels())
-            source = sourceBus.channel(channelIndex)->data();
-        float* destination = channel(channelIndex)->mutableData();
-        vmul(source, 1, gainValues, 1, destination, 1, numberOfGainValues);
-    }
-}
-
-PassRefPtr<AudioBus> AudioBus::createBySampleRateConverting(const AudioBus* sourceBus, bool mixToMono, double newSampleRate)
-{
-    // sourceBus's sample-rate must be known.
-    ASSERT(sourceBus && sourceBus->sampleRate());
-    if (!sourceBus || !sourceBus->sampleRate())
-        return 0;
-
-    double sourceSampleRate = sourceBus->sampleRate();
-    double destinationSampleRate = newSampleRate;
-    double sampleRateRatio = sourceSampleRate / destinationSampleRate;
-    unsigned numberOfSourceChannels = sourceBus->numberOfChannels();
-
-    if (numberOfSourceChannels == 1)
-        mixToMono = false; // already mono
-
-    if (sourceSampleRate == destinationSampleRate) {
-        // No sample-rate conversion is necessary.
-        if (mixToMono)
-            return AudioBus::createByMixingToMono(sourceBus);
-
-        // Return exact copy.
-        return AudioBus::createBufferFromRange(sourceBus, 0, sourceBus->length());
-    }
-
-    if (sourceBus->isSilent()) {
-        RefPtr<AudioBus> silentBus = create(numberOfSourceChannels, sourceBus->length() / sampleRateRatio);
-        silentBus->setSampleRate(newSampleRate);
-        return silentBus;
-    }
-
-    // First, mix to mono (if necessary) then sample-rate convert.
-    const AudioBus* resamplerSourceBus;
-    RefPtr<AudioBus> mixedMonoBus;
-    if (mixToMono) {
-        mixedMonoBus = AudioBus::createByMixingToMono(sourceBus);
-        resamplerSourceBus = mixedMonoBus.get();
-    } else {
-        // Directly resample without down-mixing.
-        resamplerSourceBus = sourceBus;
-    }
-
-    // Calculate destination length based on the sample-rates.
-    int sourceLength = resamplerSourceBus->length();
-    int destinationLength = sourceLength / sampleRateRatio;
-
-    // Create destination bus with same number of channels.
-    unsigned numberOfDestinationChannels = resamplerSourceBus->numberOfChannels();
-    RefPtr<AudioBus> destinationBus = create(numberOfDestinationChannels, destinationLength);
-
-    // Sample-rate convert each channel.
-    for (unsigned i = 0; i < numberOfDestinationChannels; ++i) {
-        const float* source = resamplerSourceBus->channel(i)->data();
-        float* destination = destinationBus->channel(i)->mutableData();
-
-        SincResampler resampler(sampleRateRatio);
-        resampler.process(source, destination, sourceLength);
-    }
-
-    destinationBus->clearSilentFlag();
-    destinationBus->setSampleRate(newSampleRate);
-    return destinationBus;
-}
-
-PassRefPtr<AudioBus> AudioBus::createByMixingToMono(const AudioBus* sourceBus)
-{
-    if (sourceBus->isSilent())
-        return create(1, sourceBus->length());
-
-    switch (sourceBus->numberOfChannels()) {
-    case 1:
-        // Simply create an exact copy.
-        return AudioBus::createBufferFromRange(sourceBus, 0, sourceBus->length());
-    case 2:
-        {
-            unsigned n = sourceBus->length();
-            RefPtr<AudioBus> destinationBus = create(1, n);
-
-            const float* sourceL = sourceBus->channel(0)->data();
-            const float* sourceR = sourceBus->channel(1)->data();
-            float* destination = destinationBus->channel(0)->mutableData();
-
-            // Do the mono mixdown.
-            for (unsigned i = 0; i < n; ++i)
-                destination[i] = (sourceL[i] + sourceR[i]) / 2;
-
-            destinationBus->clearSilentFlag();
-            destinationBus->setSampleRate(sourceBus->sampleRate());
-            return destinationBus;
-        }
-    }
-
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-bool AudioBus::isSilent() const
-{
-    for (size_t i = 0; i < m_channels.size(); ++i) {
-        if (!m_channels[i]->isSilent())
-            return false;
-    }
-    return true;
-}
-
-void AudioBus::clearSilentFlag()
-{
-    for (size_t i = 0; i < m_channels.size(); ++i)
-        m_channels[i]->clearSilentFlag();
-}
-
-} // WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/AudioBus.h b/Source/core/platform/audio/AudioBus.h
deleted file mode 100644
index d13b0e7..0000000
--- a/Source/core/platform/audio/AudioBus.h
+++ /dev/null
@@ -1,171 +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.
- * 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.
- *
- * 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 AudioBus_h
-#define AudioBus_h
-
-#include "core/platform/audio/AudioChannel.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/ThreadSafeRefCounted.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-// An AudioBus represents a collection of one or more AudioChannels.
-// The data layout is "planar" as opposed to "interleaved".
-// An AudioBus with one channel is mono, an AudioBus with two channels is stereo, etc.
-class AudioBus : public ThreadSafeRefCounted<AudioBus> {
-    WTF_MAKE_NONCOPYABLE(AudioBus);
-public:
-    enum {
-        ChannelLeft = 0,
-        ChannelRight = 1,
-        ChannelCenter = 2, // center and mono are the same
-        ChannelMono = 2,
-        ChannelLFE = 3,
-        ChannelSurroundLeft = 4,
-        ChannelSurroundRight = 5,
-    };
-
-    enum {
-        LayoutCanonical = 0
-        // Can define non-standard layouts here
-    };
-
-    enum ChannelInterpretation {
-        Speakers,
-        Discrete,
-    };
-
-    // allocate indicates whether or not to initially have the AudioChannels created with managed storage.
-    // Normal usage is to pass true here, in which case the AudioChannels will memory-manage their own storage.
-    // If allocate is false then setChannelMemory() has to be called later on for each channel before the AudioBus is useable...
-    static PassRefPtr<AudioBus> create(unsigned numberOfChannels, size_t length, bool allocate = true);
-
-    // Tells the given channel to use an externally allocated buffer.
-    void setChannelMemory(unsigned channelIndex, float* storage, size_t length);
-
-    // Channels
-    unsigned numberOfChannels() const { return m_channels.size(); }
-
-    AudioChannel* channel(unsigned channel) { return m_channels[channel].get(); }
-    const AudioChannel* channel(unsigned channel) const { return const_cast<AudioBus*>(this)->m_channels[channel].get(); }
-    AudioChannel* channelByType(unsigned type);
-    const AudioChannel* channelByType(unsigned type) const;
-
-    // Number of sample-frames
-    size_t length() const { return m_length; }
-
-    // resizeSmaller() can only be called with a new length <= the current length.
-    // The data stored in the bus will remain undisturbed.
-    void resizeSmaller(size_t newLength);
-
-    // Sample-rate : 0.0 if unknown or "don't care"
-    float sampleRate() const { return m_sampleRate; }
-    void setSampleRate(float sampleRate) { m_sampleRate = sampleRate; }
-
-    // Zeroes all channels.
-    void zero();
-
-    // Clears the silent flag on all channels.
-    void clearSilentFlag();
-
-    // Returns true if the silent bit is set on all channels.
-    bool isSilent() const;
-
-    // Returns true if the channel count and frame-size match.
-    bool topologyMatches(const AudioBus &sourceBus) const;
-
-    // Creates a new buffer from a range in the source buffer.
-    // 0 may be returned if the range does not fit in the sourceBuffer
-    static PassRefPtr<AudioBus> createBufferFromRange(const AudioBus* sourceBuffer, unsigned startFrame, unsigned endFrame);
-
-
-    // Creates a new AudioBus by sample-rate converting sourceBus to the newSampleRate.
-    // setSampleRate() must have been previously called on sourceBus.
-    // Note: sample-rate conversion is already handled in the file-reading code for the mac port, so we don't need this.
-    static PassRefPtr<AudioBus> createBySampleRateConverting(const AudioBus* sourceBus, bool mixToMono, double newSampleRate);
-
-    // Creates a new AudioBus by mixing all the channels down to mono.
-    // If sourceBus is already mono, then the returned AudioBus will simply be a copy.
-    static PassRefPtr<AudioBus> createByMixingToMono(const AudioBus* sourceBus);
-
-    // Scales all samples by the same amount.
-    void scale(float scale);
-
-    void reset() { m_isFirstTime = true; } // for de-zippering
-
-    // Copies the samples from the source bus to this one.
-    // This is just a simple per-channel copy if the number of channels match, otherwise an up-mix or down-mix is done.
-    void copyFrom(const AudioBus& sourceBus, ChannelInterpretation = Speakers);
-
-    // Sums the samples from the source bus to this one.
-    // This is just a simple per-channel summing if the number of channels match, otherwise an up-mix or down-mix is done.
-    void sumFrom(const AudioBus& sourceBus, ChannelInterpretation = Speakers);
-
-    // Copy each channel from sourceBus into our corresponding channel.
-    // We scale by targetGain (and our own internal gain m_busGain), performing "de-zippering" to smoothly change from *lastMixGain to (targetGain*m_busGain).
-    // The caller is responsible for setting up lastMixGain to point to storage which is unique for every "stream" which will be applied to this bus.
-    // This represents the dezippering memory.
-    void copyWithGainFrom(const AudioBus &sourceBus, float* lastMixGain, float targetGain);
-
-    // Copies the sourceBus by scaling with sample-accurate gain values.
-    void copyWithSampleAccurateGainValuesFrom(const AudioBus &sourceBus, float* gainValues, unsigned numberOfGainValues);
-
-    // Returns maximum absolute value across all channels (useful for normalization).
-    float maxAbsValue() const;
-
-    // Makes maximum absolute value == 1.0 (if possible).
-    void normalize();
-
-    static PassRefPtr<AudioBus> loadPlatformResource(const char* name, float sampleRate);
-
-protected:
-    AudioBus() { };
-
-    AudioBus(unsigned numberOfChannels, size_t length, bool allocate);
-
-    void speakersCopyFrom(const AudioBus&);
-    void discreteCopyFrom(const AudioBus&);
-    void speakersSumFrom(const AudioBus&);
-    void discreteSumFrom(const AudioBus&);
-    void speakersSumFrom5_1_ToMono(const AudioBus&);
-
-    size_t m_length;
-    Vector<OwnPtr<AudioChannel> > m_channels;
-    int m_layout;
-    float m_busGain;
-    OwnPtr<AudioFloatArray> m_dezipperGainValues;
-    bool m_isFirstTime;
-    float m_sampleRate; // 0.0 if unknown or N/A
-};
-
-} // WebCore
-
-#endif // AudioBus_h
diff --git a/Source/core/platform/audio/AudioChannel.cpp b/Source/core/platform/audio/AudioChannel.cpp
deleted file mode 100644
index 786d48b..0000000
--- a/Source/core/platform/audio/AudioChannel.cpp
+++ /dev/null
@@ -1,133 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/AudioChannel.h"
-
-#include <math.h>
-#include <algorithm>
-#include "core/platform/audio/VectorMath.h"
-#include "wtf/OwnPtr.h"
-
-namespace WebCore {
-
-using namespace VectorMath;
-
-void AudioChannel::resizeSmaller(size_t newLength)
-{
-    ASSERT(newLength <= m_length);
-    if (newLength <= m_length)
-        m_length = newLength;
-}
-
-void AudioChannel::scale(float scale)
-{
-    if (isSilent())
-        return;
-
-    vsmul(data(), 1, &scale, mutableData(), 1, length());
-}
-
-void AudioChannel::copyFrom(const AudioChannel* sourceChannel)
-{
-    bool isSafe = (sourceChannel && sourceChannel->length() >= length());
-    ASSERT(isSafe);
-    if (!isSafe)
-        return;
-
-    if (sourceChannel->isSilent()) {
-        zero();
-        return;
-    }
-    memcpy(mutableData(), sourceChannel->data(), sizeof(float) * length());
-}
-
-void AudioChannel::copyFromRange(const AudioChannel* sourceChannel, unsigned startFrame, unsigned endFrame)
-{
-    // Check that range is safe for reading from sourceChannel.
-    bool isRangeSafe = sourceChannel && startFrame < endFrame && endFrame <= sourceChannel->length();
-    ASSERT(isRangeSafe);
-    if (!isRangeSafe)
-        return;
-
-    if (sourceChannel->isSilent() && isSilent())
-        return;
-
-    // Check that this channel has enough space.
-    size_t rangeLength = endFrame - startFrame;
-    bool isRangeLengthSafe = rangeLength <= length();
-    ASSERT(isRangeLengthSafe);
-    if (!isRangeLengthSafe)
-        return;
-
-    const float* source = sourceChannel->data();
-    float* destination = mutableData();
-
-    if (sourceChannel->isSilent()) {
-        if (rangeLength == length())
-            zero();
-        else
-            memset(destination, 0, sizeof(float) * rangeLength);
-    } else
-        memcpy(destination, source + startFrame, sizeof(float) * rangeLength);
-}
-
-void AudioChannel::sumFrom(const AudioChannel* sourceChannel)
-{
-    bool isSafe = sourceChannel && sourceChannel->length() >= length();
-    ASSERT(isSafe);
-    if (!isSafe)
-        return;
-
-    if (sourceChannel->isSilent())
-        return;
-
-    if (isSilent())
-        copyFrom(sourceChannel);
-    else
-        vadd(data(), 1, sourceChannel->data(), 1, mutableData(), 1, length());
-}
-
-float AudioChannel::maxAbsValue() const
-{
-    if (isSilent())
-        return 0;
-
-    float max = 0;
-
-    vmaxmgv(data(), 1, &max, length());
-
-    return max;
-}
-
-} // WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/AudioChannel.h b/Source/core/platform/audio/AudioChannel.h
deleted file mode 100644
index 74a43dd..0000000
--- a/Source/core/platform/audio/AudioChannel.h
+++ /dev/null
@@ -1,139 +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.
- * 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.
- *
- * 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 AudioChannel_h
-#define AudioChannel_h
-
-#include "core/platform/audio/AudioArray.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebCore {
-
-// An AudioChannel represents a buffer of non-interleaved floating-point audio samples.
-// The PCM samples are normally assumed to be in a nominal range -1.0 -> +1.0
-class AudioChannel {
-    WTF_MAKE_NONCOPYABLE(AudioChannel);
-public:
-    // Memory can be externally referenced, or can be internally allocated with an AudioFloatArray.
-
-    // Reference an external buffer.
-    AudioChannel(float* storage, size_t length)
-        : m_length(length)
-        , m_rawPointer(storage)
-        , m_silent(false)
-    {
-    }
-
-    // Manage storage for us.
-    explicit AudioChannel(size_t length)
-        : m_length(length)
-        , m_rawPointer(0)
-        , m_silent(true)
-    {
-        m_memBuffer = adoptPtr(new AudioFloatArray(length));
-    }
-
-    // A "blank" audio channel -- must call set() before it's useful...
-    AudioChannel()
-        : m_length(0)
-        , m_rawPointer(0)
-        , m_silent(true)
-    {
-    }
-
-    // Redefine the memory for this channel.
-    // storage represents external memory not managed by this object.
-    void set(float* storage, size_t length)
-    {
-        m_memBuffer.clear(); // cleanup managed storage
-        m_rawPointer = storage;
-        m_length = length;
-        m_silent = false;
-    }
-
-    // How many sample-frames do we contain?
-    size_t length() const { return m_length; }
-
-    // resizeSmaller() can only be called with a new length <= the current length.
-    // The data stored in the bus will remain undisturbed.
-    void resizeSmaller(size_t newLength);
-
-    // Direct access to PCM sample data. Non-const accessor clears silent flag.
-    float* mutableData()
-    {
-        clearSilentFlag();
-        return m_rawPointer ? m_rawPointer : m_memBuffer->data();
-    }
-
-    const float* data() const { return m_rawPointer ? m_rawPointer : m_memBuffer->data(); }
-
-    // Zeroes out all sample values in buffer.
-    void zero()
-    {
-        if (m_silent)
-            return;
-
-        m_silent = true;
-
-        if (m_memBuffer.get())
-            m_memBuffer->zero();
-        else
-            memset(m_rawPointer, 0, sizeof(float) * m_length);
-    }
-
-    // Clears the silent flag.
-    void clearSilentFlag() { m_silent = false; }
-
-    bool isSilent() const { return m_silent; }
-
-    // Scales all samples by the same amount.
-    void scale(float scale);
-
-    // A simple memcpy() from the source channel
-    void copyFrom(const AudioChannel* sourceChannel);
-
-    // Copies the given range from the source channel.
-    void copyFromRange(const AudioChannel* sourceChannel, unsigned startFrame, unsigned endFrame);
-
-    // Sums (with unity gain) from the source channel.
-    void sumFrom(const AudioChannel* sourceChannel);
-
-    // Returns maximum absolute value (useful for normalization).
-    float maxAbsValue() const;
-
-private:
-    size_t m_length;
-
-    float* m_rawPointer;
-    OwnPtr<AudioFloatArray> m_memBuffer;
-    bool m_silent;
-};
-
-} // WebCore
-
-#endif // AudioChannel_h
diff --git a/Source/core/platform/audio/AudioDSPKernel.h b/Source/core/platform/audio/AudioDSPKernel.h
deleted file mode 100644
index 67b8930..0000000
--- a/Source/core/platform/audio/AudioDSPKernel.h
+++ /dev/null
@@ -1,76 +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 AudioDSPKernel_h
-#define AudioDSPKernel_h
-
-#include "core/platform/audio/AudioDSPKernelProcessor.h"
-
-namespace WebCore {
-
-// AudioDSPKernel does the processing for one channel of an AudioDSPKernelProcessor.
-
-class AudioDSPKernel {
-public:
-    AudioDSPKernel(AudioDSPKernelProcessor* kernelProcessor)
-        : m_kernelProcessor(kernelProcessor)
-        , m_sampleRate(kernelProcessor->sampleRate())
-    {
-    }
-
-    AudioDSPKernel(float sampleRate)
-        : m_kernelProcessor(0)
-        , m_sampleRate(sampleRate)
-    {
-    }
-
-    virtual ~AudioDSPKernel() { };
-
-    // Subclasses must override process() to do the processing and reset() to reset DSP state.
-    virtual void process(const float* source, float* destination, size_t framesToProcess) = 0;
-    virtual void reset() = 0;
-
-    float sampleRate() const { return m_sampleRate; }
-    double nyquist() const { return 0.5 * sampleRate(); }
-
-    AudioDSPKernelProcessor* processor() { return m_kernelProcessor; }
-    const AudioDSPKernelProcessor* processor() const { return m_kernelProcessor; }
-
-    virtual double tailTime() const = 0;
-    virtual double latencyTime() const = 0;
-
-protected:
-    AudioDSPKernelProcessor* m_kernelProcessor;
-    float m_sampleRate;
-};
-
-} // namespace WebCore
-
-#endif // AudioDSPKernel_h
diff --git a/Source/core/platform/audio/AudioDSPKernelProcessor.cpp b/Source/core/platform/audio/AudioDSPKernelProcessor.cpp
deleted file mode 100644
index d284b1c..0000000
--- a/Source/core/platform/audio/AudioDSPKernelProcessor.cpp
+++ /dev/null
@@ -1,157 +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(WEB_AUDIO)
-
-#include "core/platform/audio/AudioDSPKernelProcessor.h"
-
-#include "core/platform/audio/AudioDSPKernel.h"
-#include "wtf/MainThread.h"
-
-namespace WebCore {
-
-// setNumberOfChannels() may later be called if the object is not yet in an "initialized" state.
-AudioDSPKernelProcessor::AudioDSPKernelProcessor(float sampleRate, unsigned numberOfChannels)
-    : AudioProcessor(sampleRate, numberOfChannels)
-    , m_hasJustReset(true)
-{
-}
-
-void AudioDSPKernelProcessor::initialize()
-{
-    if (isInitialized())
-        return;
-
-    MutexLocker locker(m_processLock);
-    ASSERT(!m_kernels.size());
-
-    // Create processing kernels, one per channel.
-    for (unsigned i = 0; i < numberOfChannels(); ++i)
-        m_kernels.append(createKernel());
-
-    m_initialized = true;
-    m_hasJustReset = true;
-}
-
-void AudioDSPKernelProcessor::uninitialize()
-{
-    if (!isInitialized())
-        return;
-
-    MutexLocker locker(m_processLock);
-    m_kernels.clear();
-
-    m_initialized = false;
-}
-
-void AudioDSPKernelProcessor::process(const AudioBus* source, AudioBus* destination, size_t framesToProcess)
-{
-    ASSERT(source && destination);
-    if (!source || !destination)
-        return;
-
-    if (!isInitialized()) {
-        destination->zero();
-        return;
-    }
-
-    MutexTryLocker tryLocker(m_processLock);
-    if (tryLocker.locked()) {
-        bool channelCountMatches = source->numberOfChannels() == destination->numberOfChannels() && source->numberOfChannels() == m_kernels.size();
-        ASSERT(channelCountMatches);
-        if (!channelCountMatches)
-            return;
-
-        for (unsigned i = 0; i < m_kernels.size(); ++i)
-            m_kernels[i]->process(source->channel(i)->data(), destination->channel(i)->mutableData(), framesToProcess);
-    } else {
-        // Unfortunately, the kernel is being processed by another thread.
-        // See also ConvolverNode::process().
-        destination->zero();
-    }
-}
-
-// Resets filter state
-void AudioDSPKernelProcessor::reset()
-{
-    ASSERT(isMainThread());
-    if (!isInitialized())
-        return;
-
-    // Forces snap to parameter values - first time.
-    // Any processing depending on this value must set it to false at the appropriate time.
-    m_hasJustReset = true;
-
-    MutexLocker locker(m_processLock);
-    for (unsigned i = 0; i < m_kernels.size(); ++i)
-        m_kernels[i]->reset();
-}
-
-void AudioDSPKernelProcessor::setNumberOfChannels(unsigned numberOfChannels)
-{
-    if (numberOfChannels == m_numberOfChannels)
-        return;
-
-    ASSERT(!isInitialized());
-    if (!isInitialized())
-        m_numberOfChannels = numberOfChannels;
-}
-
-double AudioDSPKernelProcessor::tailTime() const
-{
-    ASSERT(!isMainThread());
-    MutexTryLocker tryLocker(m_processLock);
-    if (tryLocker.locked()) {
-        // It is expected that all the kernels have the same tailTime.
-        return !m_kernels.isEmpty() ? m_kernels.first()->tailTime() : 0;
-    }
-    // Since we don't want to block the Audio Device thread, we return a large value
-    // instead of trying to acquire the lock.
-    return std::numeric_limits<double>::infinity();
-}
-
-double AudioDSPKernelProcessor::latencyTime() const
-{
-    ASSERT(!isMainThread());
-    MutexTryLocker tryLocker(m_processLock);
-    if (tryLocker.locked()) {
-        // It is expected that all the kernels have the same latencyTime.
-        return !m_kernels.isEmpty() ? m_kernels.first()->latencyTime() : 0;
-    }
-    // Since we don't want to block the Audio Device thread, we return a large value
-    // instead of trying to acquire the lock.
-    return std::numeric_limits<double>::infinity();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/AudioDSPKernelProcessor.h b/Source/core/platform/audio/AudioDSPKernelProcessor.h
deleted file mode 100644
index 41c168a..0000000
--- a/Source/core/platform/audio/AudioDSPKernelProcessor.h
+++ /dev/null
@@ -1,79 +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 AudioDSPKernelProcessor_h
-#define AudioDSPKernelProcessor_h
-
-#include "core/platform/audio/AudioBus.h"
-#include "core/platform/audio/AudioProcessor.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/ThreadingPrimitives.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class AudioBus;
-class AudioDSPKernel;
-class AudioProcessor;
-
-// AudioDSPKernelProcessor processes one input -> one output (N channels each)
-// It uses one AudioDSPKernel object per channel to do the processing, thus there is no cross-channel processing.
-// Despite this limitation it turns out to be a very common and useful type of processor.
-
-class AudioDSPKernelProcessor : public AudioProcessor {
-public:
-    // numberOfChannels may be later changed if object is not yet in an "initialized" state
-    AudioDSPKernelProcessor(float sampleRate, unsigned numberOfChannels);
-
-    // Subclasses create the appropriate type of processing kernel here.
-    // We'll call this to create a kernel for each channel.
-    virtual PassOwnPtr<AudioDSPKernel> createKernel() = 0;
-
-    // AudioProcessor methods
-    virtual void initialize();
-    virtual void uninitialize();
-    virtual void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess);
-    virtual void reset();
-    virtual void setNumberOfChannels(unsigned numberOfChannels);
-    virtual unsigned numberOfChannels() const { return m_numberOfChannels; }
-
-    virtual double tailTime() const OVERRIDE;
-    virtual double latencyTime() const OVERRIDE;
-
-protected:
-    Vector<OwnPtr<AudioDSPKernel> > m_kernels;
-    mutable Mutex m_processLock;
-    bool m_hasJustReset;
-};
-
-} // namespace WebCore
-
-#endif // AudioDSPKernelProcessor_h
diff --git a/Source/core/platform/audio/AudioDestination.h b/Source/core/platform/audio/AudioDestination.h
deleted file mode 100644
index 4c1a56f..0000000
--- a/Source/core/platform/audio/AudioDestination.h
+++ /dev/null
@@ -1,71 +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.
- * 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.
- *
- * 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 AudioDestination_h
-#define AudioDestination_h
-
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class AudioIOCallback;
-
-// AudioDestination is an abstraction for audio hardware I/O.
-// The audio hardware periodically calls the AudioIOCallback render() method asking it to render/output the next render quantum of audio.
-// It optionally will pass in local/live audio input when it calls render().
-
-class AudioDestination {
-public:
-    // Pass in (numberOfInputChannels > 0) if live/local audio input is desired.
-    // Port-specific device identification information for live/local input streams can be passed in the inputDeviceId.
-    static PassOwnPtr<AudioDestination> create(AudioIOCallback&, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate);
-
-    virtual ~AudioDestination() { }
-
-    virtual void start() = 0;
-    virtual void stop() = 0;
-    virtual bool isPlaying() = 0;
-
-    // Sample-rate conversion may happen in AudioDestination to the hardware sample-rate
-    virtual float sampleRate() const = 0;
-    static float hardwareSampleRate();
-
-    // maxChannelCount() returns the total number of output channels of the audio hardware.
-    // A value of 0 indicates that the number of channels cannot be configured and
-    // that only stereo (2-channel) destinations can be created.
-    // The numberOfOutputChannels parameter of AudioDestination::create() is allowed to
-    // be a value: 1 <= numberOfOutputChannels <= maxChannelCount(),
-    // or if maxChannelCount() equals 0, then numberOfOutputChannels must be 2.
-    static unsigned long maxChannelCount();
-};
-
-} // namespace WebCore
-
-#endif // AudioDestination_h
diff --git a/Source/core/platform/audio/AudioDestinationConsumer.h b/Source/core/platform/audio/AudioDestinationConsumer.h
deleted file mode 100644
index 35bc396..0000000
--- a/Source/core/platform/audio/AudioDestinationConsumer.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- * 3. 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 AudioDestinationConsumer_h
-#define AudioDestinationConsumer_h
-
-#include "wtf/RefCounted.h"
-
-namespace WebCore {
-
-class AudioBus;
-
-class AudioDestinationConsumer : public RefCounted<AudioDestinationConsumer> {
-public:
-    virtual ~AudioDestinationConsumer() { }
-
-    virtual void setFormat(size_t numberOfChannels, float sampleRate) = 0;
-    virtual void consumeAudio(AudioBus*, size_t numberOfFrames) = 0;
-};
-
-} // WebCore
-
-#endif // AudioDestinationConsumer_h
diff --git a/Source/core/platform/audio/AudioFIFO.cpp b/Source/core/platform/audio/AudioFIFO.cpp
deleted file mode 100644
index f468d25..0000000
--- a/Source/core/platform/audio/AudioFIFO.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/AudioFIFO.h"
-
-namespace WebCore {
-
-AudioFIFO::AudioFIFO(unsigned numberOfChannels, size_t fifoLength)
-    : m_fifoAudioBus(AudioBus::create(numberOfChannels, fifoLength))
-    , m_fifoLength(fifoLength)
-    , m_framesInFifo(0)
-    , m_readIndex(0)
-    , m_writeIndex(0)
-{
-}
-
-void AudioFIFO::consume(AudioBus* destination, size_t framesToConsume)
-{
-    bool isGood = destination && (framesToConsume <= m_fifoLength) && (framesToConsume <= m_framesInFifo) && (destination->length() >= framesToConsume);
-    ASSERT(isGood);
-    if (!isGood)
-        return;
-
-    // Copy the requested number of samples to the destination.
-
-    size_t part1Length;
-    size_t part2Length;
-    findWrapLengths(m_readIndex, framesToConsume, part1Length, part2Length);
-
-    size_t numberOfChannels = m_fifoAudioBus->numberOfChannels();
-
-    for (size_t channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) {
-        float* destinationData = destination->channel(channelIndex)->mutableData();
-        const float* sourceData = m_fifoAudioBus->channel(channelIndex)->data();
-
-        bool isCopyGood = ((m_readIndex < m_fifoLength)
-                           && (m_readIndex + part1Length) <= m_fifoLength
-                           && (part1Length <= destination->length())
-                           && (part1Length + part2Length) <= destination->length());
-        ASSERT(isCopyGood);
-        if (!isCopyGood)
-            return;
-
-        memcpy(destinationData, sourceData + m_readIndex, part1Length * sizeof(*sourceData));
-        // Handle wrap around of the FIFO, if needed.
-        if (part2Length)
-            memcpy(destinationData + part1Length, sourceData, part2Length * sizeof(*sourceData));
-    }
-    m_readIndex = updateIndex(m_readIndex, framesToConsume);
-    ASSERT(m_framesInFifo >= framesToConsume);
-    m_framesInFifo -= framesToConsume;
-}
-
-void AudioFIFO::push(const AudioBus* sourceBus)
-{
-    // Copy the sourceBus into the FIFO buffer.
-
-    bool isGood = sourceBus && (m_framesInFifo + sourceBus->length() <= m_fifoLength);
-    if (!isGood)
-        return;
-
-    size_t sourceLength = sourceBus->length();
-    size_t part1Length;
-    size_t part2Length;
-    findWrapLengths(m_writeIndex, sourceLength, part1Length, part2Length);
-
-    size_t numberOfChannels = m_fifoAudioBus->numberOfChannels();
-
-    for (size_t channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) {
-        float* destination = m_fifoAudioBus->channel(channelIndex)->mutableData();
-        const float* source = sourceBus->channel(channelIndex)->data();
-
-        bool isCopyGood = ((m_writeIndex < m_fifoLength)
-                           && (m_writeIndex + part1Length) <= m_fifoLength
-                           && part2Length < m_fifoLength
-                           && part1Length + part2Length <= sourceLength);
-        ASSERT(isCopyGood);
-        if (!isCopyGood)
-            return;
-
-        memcpy(destination + m_writeIndex, source, part1Length * sizeof(*destination));
-
-        // Handle wrap around of the FIFO, if needed.
-        if (part2Length)
-            memcpy(destination, source + part1Length, part2Length * sizeof(*destination));
-    }
-
-    m_framesInFifo += sourceLength;
-    ASSERT(m_framesInFifo <= m_fifoLength);
-    m_writeIndex = updateIndex(m_writeIndex, sourceLength);
-}
-
-void AudioFIFO::findWrapLengths(size_t index, size_t size, size_t& part1Length, size_t& part2Length)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(index < m_fifoLength && size <= m_fifoLength);
-    if (index < m_fifoLength && size <= m_fifoLength) {
-        if (index + size > m_fifoLength) {
-            // Need to wrap. Figure out the length of each piece.
-            part1Length = m_fifoLength - index;
-            part2Length = size - part1Length;
-        } else {
-            // No wrap needed.
-            part1Length = size;
-            part2Length = 0;
-        }
-    } else {
-        // Invalid values for index or size. Set the part lengths to zero so nothing is copied.
-        part1Length = 0;
-        part2Length = 0;
-    }
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/AudioFIFO.h b/Source/core/platform/audio/AudioFIFO.h
deleted file mode 100644
index 920e606..0000000
--- a/Source/core/platform/audio/AudioFIFO.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- * 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.
- *
- * 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 AudioFIFO_h
-#define AudioFIFO_h
-
-#include "core/platform/audio/AudioBus.h"
-
-namespace WebCore {
-
-class AudioFIFO {
-public:
-    // Create a FIFO large enough to hold |fifoLength| frames of data of |numberOfChannels| channels.
-    AudioFIFO(unsigned numberOfChannels, size_t fifoLength);
-
-    // Push the data from the bus into the FIFO.
-    void push(const AudioBus*);
-
-    // Consume |framesToConsume| frames of data from the FIFO and put them in |destination|. The
-    // corresponding frames are removed from the FIFO.
-    void consume(AudioBus* destination, size_t framesToConsume);
-
-    // Number of frames of data that are currently in the FIFO.
-    size_t framesInFifo() const { return m_framesInFifo; }
-
-private:
-    // Update the FIFO index by the step, with appropriate wrapping around the endpoint.
-    int updateIndex(int index, int step) { return (index + step) % m_fifoLength; }
-
-    void findWrapLengths(size_t index, size_t providerSize, size_t& part1Length, size_t& part2Length);
-
-    // The FIFO itself. In reality, the FIFO is a circular buffer.
-    RefPtr<AudioBus> m_fifoAudioBus;
-
-    // The total available space in the FIFO.
-    size_t m_fifoLength;
-
-    // The number of actual elements in the FIFO
-    size_t m_framesInFifo;
-
-    // Where to start reading from the FIFO.
-    size_t m_readIndex;
-
-    // Where to start writing to the FIFO.
-    size_t m_writeIndex;
-};
-
-} // namespace WebCore
-
-#endif // AudioFIFO.h
diff --git a/Source/core/platform/audio/AudioFileReader.h b/Source/core/platform/audio/AudioFileReader.h
deleted file mode 100644
index 198d54d..0000000
--- a/Source/core/platform/audio/AudioFileReader.h
+++ /dev/null
@@ -1,52 +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.
- * 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.
- *
- * 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 AudioFileReader_h
-#define AudioFileReader_h
-
-#include "wtf/PassRefPtr.h"
-
-namespace WebCore {
-
-class AudioBus;
-
-// For both create functions:
-// Pass in 0.0 for sampleRate to use the file's sample-rate, otherwise a sample-rate conversion to the requested
-// sampleRate will be made (if it doesn't already match the file's sample-rate).
-// The created buffer will have its sample-rate set correctly to the result.
-
-PassRefPtr<AudioBus> createBusFromInMemoryAudioFile(const void* data, size_t dataSize, bool mixToMono, float sampleRate);
-
-PassRefPtr<AudioBus> createBusFromAudioFile(const char* filePath, bool mixToMono, float sampleRate);
-
-// May pass in 0.0 for sampleRate in which case it will use the AudioBus's sampleRate
-void writeBusToAudioFile(AudioBus* bus, const char* filePath, double fileSampleRate);
-
-} // namespace WebCore
-
-#endif // AudioFileReader_h
diff --git a/Source/core/platform/audio/AudioIOCallback.h b/Source/core/platform/audio/AudioIOCallback.h
deleted file mode 100644
index 2cc3a9d..0000000
--- a/Source/core/platform/audio/AudioIOCallback.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- * 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.
- *
- * 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 AudioIOCallback_h
-#define AudioIOCallback_h
-
-namespace WebCore {
-
-class AudioBus;
-
-// Abstract base-class for isochronous audio I/O client.
-class AudioIOCallback {
-public:
-    // render() is called periodically to get the next render quantum of audio into destinationBus.
-    // Optional audio input is given in sourceBus (if it's not 0).
-    virtual void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t framesToProcess) = 0;
-
-    virtual ~AudioIOCallback() { }
-};
-
-} // WebCore
-
-#endif // AudioIOCallback_h
diff --git a/Source/core/platform/audio/AudioProcessor.h b/Source/core/platform/audio/AudioProcessor.h
deleted file mode 100644
index 589b7f9..0000000
--- a/Source/core/platform/audio/AudioProcessor.h
+++ /dev/null
@@ -1,81 +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 AudioProcessor_h
-#define AudioProcessor_h
-
-namespace WebCore {
-
-class AudioBus;
-
-// AudioProcessor is an abstract base class representing an audio signal processing object with a single input and a single output,
-// where the number of input channels equals the number of output channels.  It can be used as one part of a complex DSP algorithm,
-// or as the processor for a basic (one input - one output) AudioNode.
-
-class AudioProcessor {
-public:
-    AudioProcessor(float sampleRate, unsigned numberOfChannels)
-        : m_initialized(false)
-        , m_numberOfChannels(numberOfChannels)
-        , m_sampleRate(sampleRate)
-    {
-    }
-
-    virtual ~AudioProcessor() { }
-
-    // Full initialization can be done here instead of in the constructor.
-    virtual void initialize() = 0;
-    virtual void uninitialize() = 0;
-
-    // Processes the source to destination bus.  The number of channels must match in source and destination.
-    virtual void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) = 0;
-
-    // Resets filter state
-    virtual void reset() = 0;
-
-    virtual void setNumberOfChannels(unsigned) = 0;
-    virtual unsigned numberOfChannels() const = 0;
-
-    bool isInitialized() const { return m_initialized; }
-
-    float sampleRate() const { return m_sampleRate; }
-
-    virtual double tailTime() const = 0;
-    virtual double latencyTime() const = 0;
-
-protected:
-    bool m_initialized;
-    unsigned m_numberOfChannels;
-    float m_sampleRate;
-};
-
-} // namespace WebCore
-
-#endif // AudioProcessor_h
diff --git a/Source/core/platform/audio/AudioPullFIFO.cpp b/Source/core/platform/audio/AudioPullFIFO.cpp
deleted file mode 100644
index ce8c0d9..0000000
--- a/Source/core/platform/audio/AudioPullFIFO.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/AudioPullFIFO.h"
-
-namespace WebCore {
-
-AudioPullFIFO::AudioPullFIFO(AudioSourceProvider& audioProvider, unsigned numberOfChannels, size_t fifoLength, size_t providerSize)
-    : m_provider(audioProvider)
-    , m_fifo(numberOfChannels, fifoLength)
-    , m_providerSize(providerSize)
-    , m_tempBus(AudioBus::create(numberOfChannels, providerSize))
-{
-}
-
-void AudioPullFIFO::consume(AudioBus* destination, size_t framesToConsume)
-{
-    if (!destination)
-        return;
-
-    if (framesToConsume > m_fifo.framesInFifo()) {
-        // We don't have enough data in the FIFO to fulfill the request. Ask for more data.
-        fillBuffer(framesToConsume - m_fifo.framesInFifo());
-    }
-
-    m_fifo.consume(destination, framesToConsume);
-}
-
-void AudioPullFIFO::fillBuffer(size_t numberOfFrames)
-{
-    // Keep asking the provider to give us data until we have received at least |numberOfFrames| of
-    // data. Stuff the data into the FIFO.
-    size_t framesProvided = 0;
-
-    while (framesProvided < numberOfFrames) {
-        m_provider.provideInput(m_tempBus.get(), m_providerSize);
-
-        m_fifo.push(m_tempBus.get());
-
-        framesProvided += m_providerSize;
-    }
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/AudioPullFIFO.h b/Source/core/platform/audio/AudioPullFIFO.h
deleted file mode 100644
index 86795a1..0000000
--- a/Source/core/platform/audio/AudioPullFIFO.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- * 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.
- *
- * 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 AudioPullFIFO_h
-#define AudioPullFIFO_h
-
-#include "core/platform/audio/AudioBus.h"
-#include "core/platform/audio/AudioFIFO.h"
-#include "core/platform/audio/AudioSourceProvider.h"
-
-namespace WebCore {
-
-// A FIFO (First In First Out) buffer to handle mismatches in buffer sizes between a provider and
-// receiver. The receiver will "pull" data from this FIFO. If data is already available in the
-// FIFO, it is provided to the receiver. If insufficient data is available to satisfy the request,
-// the FIFO will ask the provider for more data when necessary to fulfill a request. Contrast this
-// with a "push" FIFO, where the sender pushes data to the FIFO which will itself push the data to
-// the receiver when the FIFO is full.
-class AudioPullFIFO {
-public:
-    // Create a FIFO that gets data from |provider|. The FIFO will be large enough to hold
-    // |fifoLength| frames of data of |numberOfChannels| channels. The AudioSourceProvider will be
-    // asked to produce |providerSize| frames when the FIFO needs more data.
-    AudioPullFIFO(AudioSourceProvider& audioProvider, unsigned numberOfChannels, size_t fifoLength, size_t providerSize);
-
-    // Read |framesToConsume| frames from the FIFO into the destination. If the FIFO does not have
-    // enough data, we ask the |provider| to get more data to fulfill the request.
-    void consume(AudioBus* destination, size_t framesToConsume);
-
-private:
-    // Fill the FIFO buffer with at least |numberOfFrames| more data.
-    void fillBuffer(size_t numberOfFrames);
-
-    // The provider of the data in our FIFO.
-    AudioSourceProvider& m_provider;
-
-    // The actual FIFO
-    AudioFIFO m_fifo;
-
-    // Number of frames of data that the provider will produce per call.
-    unsigned int m_providerSize;
-
-    // Temporary workspace to hold the data from the provider.
-    RefPtr<AudioBus> m_tempBus;
-};
-
-} // namespace WebCore
-
-#endif // AudioPullFIFO.h
diff --git a/Source/core/platform/audio/AudioResampler.cpp b/Source/core/platform/audio/AudioResampler.cpp
deleted file mode 100644
index 58ceae1..0000000
--- a/Source/core/platform/audio/AudioResampler.cpp
+++ /dev/null
@@ -1,128 +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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/AudioResampler.h"
-
-#include <algorithm>
-#include "core/platform/audio/AudioBus.h"
-#include "wtf/MathExtras.h"
-
-using namespace std;
-
-namespace WebCore {
-
-const double AudioResampler::MaxRate = 8.0;
-
-AudioResampler::AudioResampler()
-    : m_rate(1.0)
-{
-    m_kernels.append(adoptPtr(new AudioResamplerKernel(this)));
-    m_sourceBus = AudioBus::create(1, 0, false);
-}
-
-AudioResampler::AudioResampler(unsigned numberOfChannels)
-    : m_rate(1.0)
-{
-    for (unsigned i = 0; i < numberOfChannels; ++i)
-        m_kernels.append(adoptPtr(new AudioResamplerKernel(this)));
-
-    m_sourceBus = AudioBus::create(numberOfChannels, 0, false);
-}
-
-void AudioResampler::configureChannels(unsigned numberOfChannels)
-{
-    unsigned currentSize = m_kernels.size();
-    if (numberOfChannels == currentSize)
-        return; // already setup
-
-    // First deal with adding or removing kernels.
-    if (numberOfChannels > currentSize) {
-        for (unsigned i = currentSize; i < numberOfChannels; ++i)
-            m_kernels.append(adoptPtr(new AudioResamplerKernel(this)));
-    } else
-        m_kernels.resize(numberOfChannels);
-
-    // Reconfigure our source bus to the new channel size.
-    m_sourceBus = AudioBus::create(numberOfChannels, 0, false);
-}
-
-void AudioResampler::process(AudioSourceProvider* provider, AudioBus* destinationBus, size_t framesToProcess)
-{
-    ASSERT(provider);
-    if (!provider)
-        return;
-
-    unsigned numberOfChannels = m_kernels.size();
-
-    // Make sure our configuration matches the bus we're rendering to.
-    bool channelsMatch = (destinationBus && destinationBus->numberOfChannels() == numberOfChannels);
-    ASSERT(channelsMatch);
-    if (!channelsMatch)
-        return;
-
-    // Setup the source bus.
-    for (unsigned i = 0; i < numberOfChannels; ++i) {
-        // Figure out how many frames we need to get from the provider, and a pointer to the buffer.
-        size_t framesNeeded;
-        float* fillPointer = m_kernels[i]->getSourcePointer(framesToProcess, &framesNeeded);
-        ASSERT(fillPointer);
-        if (!fillPointer)
-            return;
-
-        m_sourceBus->setChannelMemory(i, fillPointer, framesNeeded);
-    }
-
-    // Ask the provider to supply the desired number of source frames.
-    provider->provideInput(m_sourceBus.get(), m_sourceBus->length());
-
-    // Now that we have the source data, resample each channel into the destination bus.
-    // FIXME: optimize for the common stereo case where it's faster to process both left/right channels in the same inner loop.
-    for (unsigned i = 0; i < numberOfChannels; ++i) {
-        float* destination = destinationBus->channel(i)->mutableData();
-        m_kernels[i]->process(destination, framesToProcess);
-    }
-}
-
-void AudioResampler::setRate(double rate)
-{
-    if (std::isnan(rate) || std::isinf(rate) || rate <= 0.0)
-        return;
-
-    m_rate = min(AudioResampler::MaxRate, rate);
-}
-
-void AudioResampler::reset()
-{
-    unsigned numberOfChannels = m_kernels.size();
-    for (unsigned i = 0; i < numberOfChannels; ++i)
-        m_kernels[i]->reset();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/AudioResampler.h b/Source/core/platform/audio/AudioResampler.h
deleted file mode 100644
index 5ef70ac..0000000
--- a/Source/core/platform/audio/AudioResampler.h
+++ /dev/null
@@ -1,68 +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 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 AudioResampler_h
-#define AudioResampler_h
-
-#include "core/platform/audio/AudioBus.h"
-#include "core/platform/audio/AudioResamplerKernel.h"
-#include "core/platform/audio/AudioSourceProvider.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-// AudioResampler resamples the audio stream from an AudioSourceProvider.
-// The audio stream may be single or multi-channel.
-// The default constructor defaults to single-channel (mono).
-
-class AudioResampler {
-public:
-    AudioResampler();
-    AudioResampler(unsigned numberOfChannels);
-    ~AudioResampler() { }
-
-    // Given an AudioSourceProvider, process() resamples the source stream into destinationBus.
-    void process(AudioSourceProvider*, AudioBus* destinationBus, size_t framesToProcess);
-
-    // Resets the processing state.
-    void reset();
-
-    void configureChannels(unsigned numberOfChannels);
-
-    // 0 < rate <= MaxRate
-    void setRate(double rate);
-    double rate() const { return m_rate; }
-
-    static const double MaxRate;
-
-private:
-    double m_rate;
-    Vector<OwnPtr<AudioResamplerKernel> > m_kernels;
-    RefPtr<AudioBus> m_sourceBus;
-};
-
-} // namespace WebCore
-
-#endif // AudioResampler_h
diff --git a/Source/core/platform/audio/AudioResamplerKernel.cpp b/Source/core/platform/audio/AudioResamplerKernel.cpp
deleted file mode 100644
index 8b9b457..0000000
--- a/Source/core/platform/audio/AudioResamplerKernel.cpp
+++ /dev/null
@@ -1,143 +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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/AudioResamplerKernel.h"
-
-#include <algorithm>
-#include "core/platform/audio/AudioResampler.h"
-
-using namespace std;
-
-namespace WebCore {
-
-const size_t AudioResamplerKernel::MaxFramesToProcess = 128;
-
-AudioResamplerKernel::AudioResamplerKernel(AudioResampler* resampler)
-    : m_resampler(resampler)
-    // The buffer size must be large enough to hold up to two extra sample frames for the linear interpolation.
-    , m_sourceBuffer(2 + static_cast<int>(MaxFramesToProcess * AudioResampler::MaxRate))
-    , m_virtualReadIndex(0.0)
-    , m_fillIndex(0)
-{
-    m_lastValues[0] = 0.0f;
-    m_lastValues[1] = 0.0f;
-}
-
-float* AudioResamplerKernel::getSourcePointer(size_t framesToProcess, size_t* numberOfSourceFramesNeededP)
-{
-    ASSERT(framesToProcess <= MaxFramesToProcess);
-
-    // Calculate the next "virtual" index.  After process() is called, m_virtualReadIndex will equal this value.
-    double nextFractionalIndex = m_virtualReadIndex + framesToProcess * rate();
-
-    // Because we're linearly interpolating between the previous and next sample we need to round up so we include the next sample.
-    int endIndex = static_cast<int>(nextFractionalIndex + 1.0); // round up to next integer index
-
-    // Determine how many input frames we'll need.
-    // We need to fill the buffer up to and including endIndex (so add 1) but we've already buffered m_fillIndex frames from last time.
-    size_t framesNeeded = 1 + endIndex - m_fillIndex;
-    if (numberOfSourceFramesNeededP)
-        *numberOfSourceFramesNeededP = framesNeeded;
-
-    // Do bounds checking for the source buffer.
-    bool isGood = m_fillIndex < m_sourceBuffer.size() && m_fillIndex + framesNeeded <= m_sourceBuffer.size();
-    ASSERT(isGood);
-    if (!isGood)
-        return 0;
-
-    return m_sourceBuffer.data() + m_fillIndex;
-}
-
-void AudioResamplerKernel::process(float* destination, size_t framesToProcess)
-{
-    ASSERT(framesToProcess <= MaxFramesToProcess);
-
-    float* source = m_sourceBuffer.data();
-
-    double rate = this->rate();
-    rate = max(0.0, rate);
-    rate = min(AudioResampler::MaxRate, rate);
-
-    // Start out with the previous saved values (if any).
-    if (m_fillIndex > 0) {
-        source[0] = m_lastValues[0];
-        source[1] = m_lastValues[1];
-    }
-
-    // Make a local copy.
-    double virtualReadIndex = m_virtualReadIndex;
-
-    // Sanity check source buffer access.
-    ASSERT(framesToProcess > 0);
-    ASSERT(virtualReadIndex >= 0 && 1 + static_cast<unsigned>(virtualReadIndex + (framesToProcess - 1) * rate) < m_sourceBuffer.size());
-
-    // Do the linear interpolation.
-    int n = framesToProcess;
-    while (n--) {
-        unsigned readIndex = static_cast<unsigned>(virtualReadIndex);
-        double interpolationFactor = virtualReadIndex - readIndex;
-
-        double sample1 = source[readIndex];
-        double sample2 = source[readIndex + 1];
-
-        double sample = (1.0 - interpolationFactor) * sample1 + interpolationFactor * sample2;
-
-        *destination++ = static_cast<float>(sample);
-
-        virtualReadIndex += rate;
-    }
-
-    // Save the last two sample-frames which will later be used at the beginning of the source buffer the next time around.
-    int readIndex = static_cast<int>(virtualReadIndex);
-    m_lastValues[0] = source[readIndex];
-    m_lastValues[1] = source[readIndex + 1];
-    m_fillIndex = 2;
-
-    // Wrap the virtual read index back to the start of the buffer.
-    virtualReadIndex -= readIndex;
-
-    // Put local copy back into member variable.
-    m_virtualReadIndex = virtualReadIndex;
-}
-
-void AudioResamplerKernel::reset()
-{
-    m_virtualReadIndex = 0.0;
-    m_fillIndex = 0;
-    m_lastValues[0] = 0.0f;
-    m_lastValues[1] = 0.0f;
-}
-
-double AudioResamplerKernel::rate() const
-{
-    return m_resampler->rate();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/AudioResamplerKernel.h b/Source/core/platform/audio/AudioResamplerKernel.h
deleted file mode 100644
index 8bfb8a8..0000000
--- a/Source/core/platform/audio/AudioResamplerKernel.h
+++ /dev/null
@@ -1,76 +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 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 AudioResamplerKernel_h
-#define AudioResamplerKernel_h
-
-#include "core/platform/audio/AudioArray.h"
-
-namespace WebCore {
-
-class AudioResampler;
-
-// AudioResamplerKernel does resampling on a single mono channel.
-// It uses a simple linear interpolation for good performance.
-
-class AudioResamplerKernel {
-public:
-    AudioResamplerKernel(AudioResampler*);
-
-    // getSourcePointer() should be called each time before process() is called.
-    // Given a number of frames to process (for subsequent call to process()), it returns a pointer and numberOfSourceFramesNeeded
-    // where sample data should be copied. This sample data provides the input to the resampler when process() is called.
-    // framesToProcess must be less than or equal to MaxFramesToProcess.
-    float* getSourcePointer(size_t framesToProcess, size_t* numberOfSourceFramesNeeded);
-
-    // process() resamples framesToProcess frames from the source into destination.
-    // Each call to process() must be preceded by a call to getSourcePointer() so that source input may be supplied.
-    // framesToProcess must be less than or equal to MaxFramesToProcess.
-    void process(float* destination, size_t framesToProcess);
-
-    // Resets the processing state.
-    void reset();
-
-    static const size_t MaxFramesToProcess;
-
-private:
-    double rate() const;
-
-    AudioResampler* m_resampler;
-    AudioFloatArray m_sourceBuffer;
-
-    // This is a (floating point) read index on the input stream.
-    double m_virtualReadIndex;
-
-    // We need to have continuity from one call of process() to the next.
-    // m_lastValues stores the last two sample values from the last call to process().
-    // m_fillIndex represents how many buffered samples we have which can be as many as 2.
-    // For the first call to process() (or after reset()) there will be no buffered samples.
-    float m_lastValues[2];
-    unsigned m_fillIndex;
-};
-
-} // namespace WebCore
-
-#endif // AudioResamplerKernel_h
diff --git a/Source/core/platform/audio/AudioSourceProvider.h b/Source/core/platform/audio/AudioSourceProvider.h
deleted file mode 100644
index db82ba6..0000000
--- a/Source/core/platform/audio/AudioSourceProvider.h
+++ /dev/null
@@ -1,51 +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.
- * 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.
- *
- * 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 AudioSourceProvider_h
-#define AudioSourceProvider_h
-
-namespace WebCore {
-
-class AudioBus;
-class AudioSourceProviderClient;
-
-// Abstract base-class for a pull-model client.
-class AudioSourceProvider {
-public:
-    // provideInput() gets called repeatedly to render time-slices of a continuous audio stream.
-    virtual void provideInput(AudioBus* bus, size_t framesToProcess) = 0;
-
-    // If a client is set, we call it back when the audio format is available or changes.
-    virtual void setClient(AudioSourceProviderClient*) { };
-
-    virtual ~AudioSourceProvider() { }
-};
-
-} // WebCore
-
-#endif // AudioSourceProvider_h
diff --git a/Source/core/platform/audio/AudioSourceProviderClient.h b/Source/core/platform/audio/AudioSourceProviderClient.h
deleted file mode 100644
index 28489e0..0000000
--- a/Source/core/platform/audio/AudioSourceProviderClient.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2011, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1.  Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef AudioSourceProviderClient_h
-#define AudioSourceProviderClient_h
-
-namespace WebCore {
-
-class AudioSourceProviderClient {
-public:
-    virtual void setFormat(size_t numberOfChannels, float sampleRate) = 0;
-protected:
-    virtual ~AudioSourceProviderClient() { }
-};
-
-} // WebCore
-
-#endif // AudioSourceProviderClient_h
diff --git a/Source/core/platform/audio/AudioUtilities.cpp b/Source/core/platform/audio/AudioUtilities.cpp
deleted file mode 100644
index a76753e..0000000
--- a/Source/core/platform/audio/AudioUtilities.cpp
+++ /dev/null
@@ -1,66 +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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/AudioUtilities.h"
-#include "wtf/Assertions.h"
-#include "wtf/MathExtras.h"
-
-namespace WebCore {
-
-namespace AudioUtilities {
-
-float decibelsToLinear(float decibels)
-{
-    return powf(10, 0.05f * decibels);
-}
-
-float linearToDecibels(float linear)
-{
-    // It's not possible to calculate decibels for a zero linear value since it would be -Inf.
-    // -1000.0 dB represents a very tiny linear value in case we ever reach this case.
-    ASSERT(linear);
-    if (!linear)
-        return -1000;
-
-    return 20 * log10f(linear);
-}
-
-double discreteTimeConstantForSampleRate(double timeConstant, double sampleRate)
-{
-    return 1 - exp(-1 / (sampleRate * timeConstant));
-}
-
-size_t timeToSampleFrame(double time, double sampleRate)
-{
-    return static_cast<size_t>(round(time * sampleRate));
-}
-} // AudioUtilites
-
-} // WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/AudioUtilities.h b/Source/core/platform/audio/AudioUtilities.h
deleted file mode 100644
index c191e87..0000000
--- a/Source/core/platform/audio/AudioUtilities.h
+++ /dev/null
@@ -1,47 +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 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 AudioUtilities_h
-#define AudioUtilities_h
-
-namespace WebCore {
-
-namespace AudioUtilities {
-
-// Standard functions for converting to and from decibel values from linear.
-float linearToDecibels(float);
-float decibelsToLinear(float);
-
-// timeConstant is the time it takes a first-order linear time-invariant system
-// to reach the value 1 - 1/e (around 63.2%) given a step input response.
-// discreteTimeConstantForSampleRate() will return the discrete time-constant for the specific sampleRate.
-double discreteTimeConstantForSampleRate(double timeConstant, double sampleRate);
-
-// Convert the time to a sample frame at the given sample rate.
-size_t timeToSampleFrame(double time, double sampleRate);
-} // AudioUtilites
-
-} // WebCore
-
-#endif // AudioUtilities_h
diff --git a/Source/core/platform/audio/Biquad.cpp b/Source/core/platform/audio/Biquad.cpp
deleted file mode 100644
index 20c6487..0000000
--- a/Source/core/platform/audio/Biquad.cpp
+++ /dev/null
@@ -1,587 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/Biquad.h"
-
-#include <stdio.h>
-#include <algorithm>
-#include "core/platform/audio/DenormalDisabler.h"
-#include "wtf/MathExtras.h"
-
-#if OS(MACOSX)
-#include <Accelerate/Accelerate.h>
-#endif
-
-namespace WebCore {
-
-const int kBufferSize = 1024;
-
-Biquad::Biquad()
-{
-#if OS(MACOSX)
-    // Allocate two samples more for filter history
-    m_inputBuffer.allocate(kBufferSize + 2);
-    m_outputBuffer.allocate(kBufferSize + 2);
-#endif
-
-#if USE(WEBAUDIO_IPP)
-    int bufferSize;
-    ippsIIRGetStateSize64f_BiQuad_32f(1, &bufferSize);
-    m_ippInternalBuffer = ippsMalloc_8u(bufferSize);
-#endif // USE(WEBAUDIO_IPP)
-
-    // Initialize as pass-thru (straight-wire, no filter effect)
-    setNormalizedCoefficients(1, 0, 0, 1, 0, 0);
-
-    reset(); // clear filter memory
-}
-
-Biquad::~Biquad()
-{
-#if USE(WEBAUDIO_IPP)
-    ippsFree(m_ippInternalBuffer);
-#endif // USE(WEBAUDIO_IPP)
-}
-
-void Biquad::process(const float* sourceP, float* destP, size_t framesToProcess)
-{
-#if OS(MACOSX)
-    // Use vecLib if available
-    processFast(sourceP, destP, framesToProcess);
-
-#elif USE(WEBAUDIO_IPP)
-    ippsIIR64f_32f(sourceP, destP, static_cast<int>(framesToProcess), m_biquadState);
-#else // USE(WEBAUDIO_IPP)
-
-    int n = framesToProcess;
-
-    // Create local copies of member variables
-    double x1 = m_x1;
-    double x2 = m_x2;
-    double y1 = m_y1;
-    double y2 = m_y2;
-
-    double b0 = m_b0;
-    double b1 = m_b1;
-    double b2 = m_b2;
-    double a1 = m_a1;
-    double a2 = m_a2;
-
-    while (n--) {
-        // FIXME: this can be optimized by pipelining the multiply adds...
-        float x = *sourceP++;
-        float y = b0*x + b1*x1 + b2*x2 - a1*y1 - a2*y2;
-
-        *destP++ = y;
-
-        // Update state variables
-        x2 = x1;
-        x1 = x;
-        y2 = y1;
-        y1 = y;
-    }
-
-    // Local variables back to member. Flush denormals here so we
-    // don't slow down the inner loop above.
-    m_x1 = DenormalDisabler::flushDenormalFloatToZero(x1);
-    m_x2 = DenormalDisabler::flushDenormalFloatToZero(x2);
-    m_y1 = DenormalDisabler::flushDenormalFloatToZero(y1);
-    m_y2 = DenormalDisabler::flushDenormalFloatToZero(y2);
-
-    m_b0 = b0;
-    m_b1 = b1;
-    m_b2 = b2;
-    m_a1 = a1;
-    m_a2 = a2;
-#endif
-}
-
-#if OS(MACOSX)
-
-// Here we have optimized version using Accelerate.framework
-
-void Biquad::processFast(const float* sourceP, float* destP, size_t framesToProcess)
-{
-    double filterCoefficients[5];
-    filterCoefficients[0] = m_b0;
-    filterCoefficients[1] = m_b1;
-    filterCoefficients[2] = m_b2;
-    filterCoefficients[3] = m_a1;
-    filterCoefficients[4] = m_a2;
-
-    double* inputP = m_inputBuffer.data();
-    double* outputP = m_outputBuffer.data();
-
-    double* input2P = inputP + 2;
-    double* output2P = outputP + 2;
-
-    // Break up processing into smaller slices (kBufferSize) if necessary.
-
-    int n = framesToProcess;
-
-    while (n > 0) {
-        int framesThisTime = n < kBufferSize ? n : kBufferSize;
-
-        // Copy input to input buffer
-        for (int i = 0; i < framesThisTime; ++i)
-            input2P[i] = *sourceP++;
-
-        processSliceFast(inputP, outputP, filterCoefficients, framesThisTime);
-
-        // Copy output buffer to output (converts float -> double).
-        for (int i = 0; i < framesThisTime; ++i)
-            *destP++ = static_cast<float>(output2P[i]);
-
-        n -= framesThisTime;
-    }
-}
-
-void Biquad::processSliceFast(double* sourceP, double* destP, double* coefficientsP, size_t framesToProcess)
-{
-    // Use double-precision for filter stability
-    vDSP_deq22D(sourceP, 1, coefficientsP, destP, 1, framesToProcess);
-
-    // Save history.  Note that sourceP and destP reference m_inputBuffer and m_outputBuffer respectively.
-    // These buffers are allocated (in the constructor) with space for two extra samples so it's OK to access
-    // array values two beyond framesToProcess.
-    sourceP[0] = sourceP[framesToProcess - 2 + 2];
-    sourceP[1] = sourceP[framesToProcess - 1 + 2];
-    destP[0] = destP[framesToProcess - 2 + 2];
-    destP[1] = destP[framesToProcess - 1 + 2];
-}
-
-#endif // OS(MACOSX)
-
-
-void Biquad::reset()
-{
-#if OS(MACOSX)
-    // Two extra samples for filter history
-    double* inputP = m_inputBuffer.data();
-    inputP[0] = 0;
-    inputP[1] = 0;
-
-    double* outputP = m_outputBuffer.data();
-    outputP[0] = 0;
-    outputP[1] = 0;
-
-#elif USE(WEBAUDIO_IPP)
-    int bufferSize;
-    ippsIIRGetStateSize64f_BiQuad_32f(1, &bufferSize);
-    ippsZero_8u(m_ippInternalBuffer, bufferSize);
-
-#else
-    m_x1 = m_x2 = m_y1 = m_y2 = 0;
-#endif
-}
-
-void Biquad::setLowpassParams(double cutoff, double resonance)
-{
-    // Limit cutoff to 0 to 1.
-    cutoff = std::max(0.0, std::min(cutoff, 1.0));
-
-    if (cutoff == 1) {
-        // When cutoff is 1, the z-transform is 1.
-        setNormalizedCoefficients(1, 0, 0,
-                                  1, 0, 0);
-    } else if (cutoff > 0) {
-        // Compute biquad coefficients for lowpass filter
-        resonance = std::max(0.0, resonance); // can't go negative
-        double g = pow(10.0, 0.05 * resonance);
-        double d = sqrt((4 - sqrt(16 - 16 / (g * g))) / 2);
-
-        double theta = piDouble * cutoff;
-        double sn = 0.5 * d * sin(theta);
-        double beta = 0.5 * (1 - sn) / (1 + sn);
-        double gamma = (0.5 + beta) * cos(theta);
-        double alpha = 0.25 * (0.5 + beta - gamma);
-
-        double b0 = 2 * alpha;
-        double b1 = 2 * 2 * alpha;
-        double b2 = 2 * alpha;
-        double a1 = 2 * -gamma;
-        double a2 = 2 * beta;
-
-        setNormalizedCoefficients(b0, b1, b2, 1, a1, a2);
-    } else {
-        // When cutoff is zero, nothing gets through the filter, so set
-        // coefficients up correctly.
-        setNormalizedCoefficients(0, 0, 0,
-                                  1, 0, 0);
-    }
-}
-
-void Biquad::setHighpassParams(double cutoff, double resonance)
-{
-    // Limit cutoff to 0 to 1.
-    cutoff = std::max(0.0, std::min(cutoff, 1.0));
-
-    if (cutoff == 1) {
-        // The z-transform is 0.
-        setNormalizedCoefficients(0, 0, 0,
-                                  1, 0, 0);
-    } else if (cutoff > 0) {
-        // Compute biquad coefficients for highpass filter
-        resonance = std::max(0.0, resonance); // can't go negative
-        double g = pow(10.0, 0.05 * resonance);
-        double d = sqrt((4 - sqrt(16 - 16 / (g * g))) / 2);
-
-        double theta = piDouble * cutoff;
-        double sn = 0.5 * d * sin(theta);
-        double beta = 0.5 * (1 - sn) / (1 + sn);
-        double gamma = (0.5 + beta) * cos(theta);
-        double alpha = 0.25 * (0.5 + beta + gamma);
-
-        double b0 = 2 * alpha;
-        double b1 = 2 * -2 * alpha;
-        double b2 = 2 * alpha;
-        double a1 = 2 * -gamma;
-        double a2 = 2 * beta;
-
-        setNormalizedCoefficients(b0, b1, b2, 1, a1, a2);
-    } else {
-      // When cutoff is zero, we need to be careful because the above
-      // gives a quadratic divided by the same quadratic, with poles
-      // and zeros on the unit circle in the same place. When cutoff
-      // is zero, the z-transform is 1.
-        setNormalizedCoefficients(1, 0, 0,
-                                  1, 0, 0);
-    }
-}
-
-void Biquad::setNormalizedCoefficients(double b0, double b1, double b2, double a0, double a1, double a2)
-{
-    double a0Inverse = 1 / a0;
-
-    m_b0 = b0 * a0Inverse;
-    m_b1 = b1 * a0Inverse;
-    m_b2 = b2 * a0Inverse;
-    m_a1 = a1 * a0Inverse;
-    m_a2 = a2 * a0Inverse;
-
-#if USE(WEBAUDIO_IPP)
-    Ipp64f taps[6];
-    taps[0] = m_b0;
-    taps[1] = m_b1;
-    taps[2] = m_b2;
-    taps[3] = 1;
-    taps[4] = m_a1;
-    taps[5] = m_a2;
-    m_biquadState = 0;
-
-    ippsIIRInit64f_BiQuad_32f(&m_biquadState, taps, 1, 0, m_ippInternalBuffer);
-#endif // USE(WEBAUDIO_IPP)
-}
-
-void Biquad::setLowShelfParams(double frequency, double dbGain)
-{
-    // Clip frequencies to between 0 and 1, inclusive.
-    frequency = std::max(0.0, std::min(frequency, 1.0));
-
-    double A = pow(10.0, dbGain / 40);
-
-    if (frequency == 1) {
-        // The z-transform is a constant gain.
-        setNormalizedCoefficients(A * A, 0, 0,
-                                  1, 0, 0);
-    } else if (frequency > 0) {
-        double w0 = piDouble * frequency;
-        double S = 1; // filter slope (1 is max value)
-        double alpha = 0.5 * sin(w0) * sqrt((A + 1 / A) * (1 / S - 1) + 2);
-        double k = cos(w0);
-        double k2 = 2 * sqrt(A) * alpha;
-        double aPlusOne = A + 1;
-        double aMinusOne = A - 1;
-
-        double b0 = A * (aPlusOne - aMinusOne * k + k2);
-        double b1 = 2 * A * (aMinusOne - aPlusOne * k);
-        double b2 = A * (aPlusOne - aMinusOne * k - k2);
-        double a0 = aPlusOne + aMinusOne * k + k2;
-        double a1 = -2 * (aMinusOne + aPlusOne * k);
-        double a2 = aPlusOne + aMinusOne * k - k2;
-
-        setNormalizedCoefficients(b0, b1, b2, a0, a1, a2);
-    } else {
-        // When frequency is 0, the z-transform is 1.
-        setNormalizedCoefficients(1, 0, 0,
-                                  1, 0, 0);
-    }
-}
-
-void Biquad::setHighShelfParams(double frequency, double dbGain)
-{
-    // Clip frequencies to between 0 and 1, inclusive.
-    frequency = std::max(0.0, std::min(frequency, 1.0));
-
-    double A = pow(10.0, dbGain / 40);
-
-    if (frequency == 1) {
-        // The z-transform is 1.
-        setNormalizedCoefficients(1, 0, 0,
-                                  1, 0, 0);
-    } else if (frequency > 0) {
-        double w0 = piDouble * frequency;
-        double S = 1; // filter slope (1 is max value)
-        double alpha = 0.5 * sin(w0) * sqrt((A + 1 / A) * (1 / S - 1) + 2);
-        double k = cos(w0);
-        double k2 = 2 * sqrt(A) * alpha;
-        double aPlusOne = A + 1;
-        double aMinusOne = A - 1;
-
-        double b0 = A * (aPlusOne + aMinusOne * k + k2);
-        double b1 = -2 * A * (aMinusOne + aPlusOne * k);
-        double b2 = A * (aPlusOne + aMinusOne * k - k2);
-        double a0 = aPlusOne - aMinusOne * k + k2;
-        double a1 = 2 * (aMinusOne - aPlusOne * k);
-        double a2 = aPlusOne - aMinusOne * k - k2;
-
-        setNormalizedCoefficients(b0, b1, b2, a0, a1, a2);
-    } else {
-        // When frequency = 0, the filter is just a gain, A^2.
-        setNormalizedCoefficients(A * A, 0, 0,
-                                  1, 0, 0);
-    }
-}
-
-void Biquad::setPeakingParams(double frequency, double Q, double dbGain)
-{
-    // Clip frequencies to between 0 and 1, inclusive.
-    frequency = std::max(0.0, std::min(frequency, 1.0));
-
-    // Don't let Q go negative, which causes an unstable filter.
-    Q = std::max(0.0, Q);
-
-    double A = pow(10.0, dbGain / 40);
-
-    if (frequency > 0 && frequency < 1) {
-        if (Q > 0) {
-            double w0 = piDouble * frequency;
-            double alpha = sin(w0) / (2 * Q);
-            double k = cos(w0);
-
-            double b0 = 1 + alpha * A;
-            double b1 = -2 * k;
-            double b2 = 1 - alpha * A;
-            double a0 = 1 + alpha / A;
-            double a1 = -2 * k;
-            double a2 = 1 - alpha / A;
-
-            setNormalizedCoefficients(b0, b1, b2, a0, a1, a2);
-        } else {
-            // When Q = 0, the above formulas have problems. If we look at
-            // the z-transform, we can see that the limit as Q->0 is A^2, so
-            // set the filter that way.
-            setNormalizedCoefficients(A * A, 0, 0,
-                                      1, 0, 0);
-        }
-    } else {
-        // When frequency is 0 or 1, the z-transform is 1.
-        setNormalizedCoefficients(1, 0, 0,
-                                  1, 0, 0);
-    }
-}
-
-void Biquad::setAllpassParams(double frequency, double Q)
-{
-    // Clip frequencies to between 0 and 1, inclusive.
-    frequency = std::max(0.0, std::min(frequency, 1.0));
-
-    // Don't let Q go negative, which causes an unstable filter.
-    Q = std::max(0.0, Q);
-
-    if (frequency > 0 && frequency < 1) {
-        if (Q > 0) {
-            double w0 = piDouble * frequency;
-            double alpha = sin(w0) / (2 * Q);
-            double k = cos(w0);
-
-            double b0 = 1 - alpha;
-            double b1 = -2 * k;
-            double b2 = 1 + alpha;
-            double a0 = 1 + alpha;
-            double a1 = -2 * k;
-            double a2 = 1 - alpha;
-
-            setNormalizedCoefficients(b0, b1, b2, a0, a1, a2);
-        } else {
-            // When Q = 0, the above formulas have problems. If we look at
-            // the z-transform, we can see that the limit as Q->0 is -1, so
-            // set the filter that way.
-            setNormalizedCoefficients(-1, 0, 0,
-                                      1, 0, 0);
-        }
-    } else {
-        // When frequency is 0 or 1, the z-transform is 1.
-        setNormalizedCoefficients(1, 0, 0,
-                                  1, 0, 0);
-    }
-}
-
-void Biquad::setNotchParams(double frequency, double Q)
-{
-    // Clip frequencies to between 0 and 1, inclusive.
-    frequency = std::max(0.0, std::min(frequency, 1.0));
-
-    // Don't let Q go negative, which causes an unstable filter.
-    Q = std::max(0.0, Q);
-
-    if (frequency > 0 && frequency < 1) {
-        if (Q > 0) {
-            double w0 = piDouble * frequency;
-            double alpha = sin(w0) / (2 * Q);
-            double k = cos(w0);
-
-            double b0 = 1;
-            double b1 = -2 * k;
-            double b2 = 1;
-            double a0 = 1 + alpha;
-            double a1 = -2 * k;
-            double a2 = 1 - alpha;
-
-            setNormalizedCoefficients(b0, b1, b2, a0, a1, a2);
-        } else {
-            // When Q = 0, the above formulas have problems. If we look at
-            // the z-transform, we can see that the limit as Q->0 is 0, so
-            // set the filter that way.
-            setNormalizedCoefficients(0, 0, 0,
-                                      1, 0, 0);
-        }
-    } else {
-        // When frequency is 0 or 1, the z-transform is 1.
-        setNormalizedCoefficients(1, 0, 0,
-                                  1, 0, 0);
-    }
-}
-
-void Biquad::setBandpassParams(double frequency, double Q)
-{
-    // No negative frequencies allowed.
-    frequency = std::max(0.0, frequency);
-
-    // Don't let Q go negative, which causes an unstable filter.
-    Q = std::max(0.0, Q);
-
-    if (frequency > 0 && frequency < 1) {
-        double w0 = piDouble * frequency;
-        if (Q > 0) {
-            double alpha = sin(w0) / (2 * Q);
-            double k = cos(w0);
-
-            double b0 = alpha;
-            double b1 = 0;
-            double b2 = -alpha;
-            double a0 = 1 + alpha;
-            double a1 = -2 * k;
-            double a2 = 1 - alpha;
-
-            setNormalizedCoefficients(b0, b1, b2, a0, a1, a2);
-        } else {
-            // When Q = 0, the above formulas have problems. If we look at
-            // the z-transform, we can see that the limit as Q->0 is 1, so
-            // set the filter that way.
-            setNormalizedCoefficients(1, 0, 0,
-                                      1, 0, 0);
-        }
-    } else {
-        // When the cutoff is zero, the z-transform approaches 0, if Q
-        // > 0. When both Q and cutoff are zero, the z-transform is
-        // pretty much undefined. What should we do in this case?
-        // For now, just make the filter 0. When the cutoff is 1, the
-        // z-transform also approaches 0.
-        setNormalizedCoefficients(0, 0, 0,
-                                  1, 0, 0);
-    }
-}
-
-void Biquad::setZeroPolePairs(const Complex &zero, const Complex &pole)
-{
-    double b0 = 1;
-    double b1 = -2 * zero.real();
-
-    double zeroMag = abs(zero);
-    double b2 = zeroMag * zeroMag;
-
-    double a1 = -2 * pole.real();
-
-    double poleMag = abs(pole);
-    double a2 = poleMag * poleMag;
-    setNormalizedCoefficients(b0, b1, b2, 1, a1, a2);
-}
-
-void Biquad::setAllpassPole(const Complex &pole)
-{
-    Complex zero = Complex(1, 0) / pole;
-    setZeroPolePairs(zero, pole);
-}
-
-void Biquad::getFrequencyResponse(int nFrequencies,
-                                  const float* frequency,
-                                  float* magResponse,
-                                  float* phaseResponse)
-{
-    // Evaluate the Z-transform of the filter at given normalized
-    // frequency from 0 to 1.  (1 corresponds to the Nyquist
-    // frequency.)
-    //
-    // The z-transform of the filter is
-    //
-    // H(z) = (b0 + b1*z^(-1) + b2*z^(-2))/(1 + a1*z^(-1) + a2*z^(-2))
-    //
-    // Evaluate as
-    //
-    // b0 + (b1 + b2*z1)*z1
-    // --------------------
-    // 1 + (a1 + a2*z1)*z1
-    //
-    // with z1 = 1/z and z = exp(j*pi*frequency). Hence z1 = exp(-j*pi*frequency)
-
-    // Make local copies of the coefficients as a micro-optimization.
-    double b0 = m_b0;
-    double b1 = m_b1;
-    double b2 = m_b2;
-    double a1 = m_a1;
-    double a2 = m_a2;
-
-    for (int k = 0; k < nFrequencies; ++k) {
-        double omega = -piDouble * frequency[k];
-        Complex z = Complex(cos(omega), sin(omega));
-        Complex numerator = b0 + (b1 + b2 * z) * z;
-        Complex denominator = Complex(1, 0) + (a1 + a2 * z) * z;
-        Complex response = numerator / denominator;
-        magResponse[k] = static_cast<float>(abs(response));
-        phaseResponse[k] = static_cast<float>(atan2(imag(response), real(response)));
-    }
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/Biquad.h b/Source/core/platform/audio/Biquad.h
deleted file mode 100644
index ae0baf9..0000000
--- a/Source/core/platform/audio/Biquad.h
+++ /dev/null
@@ -1,117 +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.
- * 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.
- *
- * 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 Biquad_h
-#define Biquad_h
-
-#include <sys/types.h>
-#include "core/platform/audio/AudioArray.h"
-#include "wtf/Complex.h"
-
-#if USE(WEBAUDIO_IPP)
-#include <ipps.h>
-#endif // USE(WEBAUDIO_IPP)
-
-namespace WebCore {
-
-// A basic biquad (two-zero / two-pole digital filter)
-//
-// It can be configured to a number of common and very useful filters:
-//    lowpass, highpass, shelving, parameteric, notch, allpass, ...
-
-class Biquad {
-public:
-    Biquad();
-    virtual ~Biquad();
-
-    void process(const float* sourceP, float* destP, size_t framesToProcess);
-
-    // frequency is 0 - 1 normalized, resonance and dbGain are in decibels.
-    // Q is a unitless quality factor.
-    void setLowpassParams(double frequency, double resonance);
-    void setHighpassParams(double frequency, double resonance);
-    void setBandpassParams(double frequency, double Q);
-    void setLowShelfParams(double frequency, double dbGain);
-    void setHighShelfParams(double frequency, double dbGain);
-    void setPeakingParams(double frequency, double Q, double dbGain);
-    void setAllpassParams(double frequency, double Q);
-    void setNotchParams(double frequency, double Q);
-
-    // Set the biquad coefficients given a single zero (other zero will be conjugate)
-    // and a single pole (other pole will be conjugate)
-    void setZeroPolePairs(const Complex& zero, const Complex& pole);
-
-    // Set the biquad coefficients given a single pole (other pole will be conjugate)
-    // (The zeroes will be the inverse of the poles)
-    void setAllpassPole(const Complex& pole);
-
-    // Resets filter state
-    void reset();
-
-    // Filter response at a set of n frequencies. The magnitude and
-    // phase response are returned in magResponse and phaseResponse.
-    // The phase response is in radians.
-    void getFrequencyResponse(int nFrequencies,
-                              const float* frequency,
-                              float* magResponse,
-                              float* phaseResponse);
-private:
-    void setNormalizedCoefficients(double b0, double b1, double b2, double a0, double a1, double a2);
-
-    // Filter coefficients. The filter is defined as
-    //
-    // y[n] + m_a1*y[n-1] + m_a2*y[n-2] = m_b0*x[n] + m_b1*x[n-1] + m_b2*x[n-2].
-    double m_b0;
-    double m_b1;
-    double m_b2;
-    double m_a1;
-    double m_a2;
-
-#if OS(MACOSX)
-    void processFast(const float* sourceP, float* destP, size_t framesToProcess);
-    void processSliceFast(double* sourceP, double* destP, double* coefficientsP, size_t framesToProcess);
-
-    AudioDoubleArray m_inputBuffer;
-    AudioDoubleArray m_outputBuffer;
-
-#elif USE(WEBAUDIO_IPP)
-    IppsIIRState64f_32f* m_biquadState;
-    Ipp8u* m_ippInternalBuffer;
-
-#else
-    // Filter memory
-    double m_x1; // input delayed by 1 sample
-    double m_x2; // input delayed by 2 samples
-    double m_y1; // output delayed by 1 sample
-    double m_y2; // output delayed by 2 samples
-#endif
-};
-
-} // namespace WebCore
-
-#endif // Biquad_h
diff --git a/Source/core/platform/audio/Cone.cpp b/Source/core/platform/audio/Cone.cpp
deleted file mode 100644
index c38138a..0000000
--- a/Source/core/platform/audio/Cone.cpp
+++ /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:
- *
- * 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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/Cone.h"
-#include "wtf/MathExtras.h"
-
-namespace WebCore {
-
-ConeEffect::ConeEffect()
-    : m_innerAngle(360.0)
-    , m_outerAngle(360.0)
-    , m_outerGain(0.0)
-{
-}
-
-double ConeEffect::gain(FloatPoint3D sourcePosition, FloatPoint3D sourceOrientation, FloatPoint3D listenerPosition)
-{
-    if (sourceOrientation.isZero() || ((m_innerAngle == 360.0) && (m_outerAngle == 360.0)))
-        return 1.0; // no cone specified - unity gain
-
-    // Normalized source-listener vector
-    FloatPoint3D sourceToListener = listenerPosition - sourcePosition;
-    sourceToListener.normalize();
-
-    FloatPoint3D normalizedSourceOrientation = sourceOrientation;
-    normalizedSourceOrientation.normalize();
-
-    // Angle between the source orientation vector and the source-listener vector
-    double dotProduct = sourceToListener.dot(normalizedSourceOrientation);
-    double angle = 180.0 * acos(dotProduct) / piDouble;
-    double absAngle = fabs(angle);
-
-    // Divide by 2.0 here since API is entire angle (not half-angle)
-    double absInnerAngle = fabs(m_innerAngle) / 2.0;
-    double absOuterAngle = fabs(m_outerAngle) / 2.0;
-    double gain = 1.0;
-
-    if (absAngle <= absInnerAngle)
-        // No attenuation
-        gain = 1.0;
-    else if (absAngle >= absOuterAngle)
-        // Max attenuation
-        gain = m_outerGain;
-    else {
-        // Between inner and outer cones
-        // inner -> outer, x goes from 0 -> 1
-        double x = (absAngle - absInnerAngle) / (absOuterAngle - absInnerAngle);
-        gain = (1.0 - x) + m_outerGain * x;
-    }
-
-    return gain;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/Cone.h b/Source/core/platform/audio/Cone.h
deleted file mode 100644
index 4435e21..0000000
--- a/Source/core/platform/audio/Cone.h
+++ /dev/null
@@ -1,63 +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.
- * 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.
- *
- * 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 Cone_h
-#define Cone_h
-
-#include "core/platform/graphics/FloatPoint3D.h"
-
-namespace WebCore {
-
-// Cone gain is defined according to the OpenAL specification
-
-class ConeEffect {
-public:
-    ConeEffect();
-
-    // Returns scalar gain for the given source/listener positions/orientations
-    double gain(FloatPoint3D sourcePosition, FloatPoint3D sourceOrientation, FloatPoint3D listenerPosition);
-
-    // Angles in degrees
-    void setInnerAngle(double innerAngle) { m_innerAngle = innerAngle; }
-    double innerAngle() const { return m_innerAngle; }
-
-    void setOuterAngle(double outerAngle) { m_outerAngle = outerAngle; }
-    double outerAngle() const { return m_outerAngle; }
-
-    void setOuterGain(double outerGain) { m_outerGain = outerGain; }
-    double outerGain() const { return m_outerGain; }
-
-protected:
-    double m_innerAngle;
-    double m_outerAngle;
-    double m_outerGain;
-};
-
-} // namespace WebCore
-
-#endif // Cone_h
diff --git a/Source/core/platform/audio/DenormalDisabler.h b/Source/core/platform/audio/DenormalDisabler.h
deleted file mode 100644
index 802cb73..0000000
--- a/Source/core/platform/audio/DenormalDisabler.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2011, Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1.  Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DenormalDisabler_h
-#define DenormalDisabler_h
-
-#include "wtf/CPU.h"
-#include "wtf/MathExtras.h"
-#include <float.h>
-
-namespace WebCore {
-
-// Deal with denormals. They can very seriously impact performance on x86.
-
-// Define HAVE_DENORMAL if we support flushing denormals to zero.
-#if OS(WIN) && COMPILER(MSVC)
-#define HAVE_DENORMAL 1
-#endif
-
-#if COMPILER(GCC) && (CPU(X86) || CPU(X86_64))
-#define HAVE_DENORMAL 1
-#endif
-
-#if HAVE(DENORMAL)
-class DenormalDisabler {
-public:
-    DenormalDisabler()
-            : m_savedCSR(0)
-    {
-#if OS(WIN) && COMPILER(MSVC)
-        // Save the current state, and set mode to flush denormals.
-        //
-        // http://stackoverflow.com/questions/637175/possible-bug-in-controlfp-s-may-not-restore-control-word-correctly
-        _controlfp_s(&m_savedCSR, 0, 0);
-        unsigned int unused;
-        _controlfp_s(&unused, _DN_FLUSH, _MCW_DN);
-#else
-        m_savedCSR = getCSR();
-        setCSR(m_savedCSR | 0x8040);
-#endif
-    }
-
-    ~DenormalDisabler()
-    {
-#if OS(WIN) && COMPILER(MSVC)
-        unsigned int unused;
-        _controlfp_s(&unused, m_savedCSR, _MCW_DN);
-#else
-        setCSR(m_savedCSR);
-#endif
-    }
-
-    // This is a nop if we can flush denormals to zero in hardware.
-    static inline float flushDenormalFloatToZero(float f)
-    {
-#if OS(WIN) && COMPILER(MSVC) && (!_M_IX86_FP)
-        // For systems using x87 instead of sse, there's no hardware support
-        // to flush denormals automatically. Hence, we need to flush
-        // denormals to zero manually.
-        return (fabs(f) < FLT_MIN) ? 0.0f : f;
-#else
-        return f;
-#endif
-    }
-private:
-#if COMPILER(GCC) && (CPU(X86) || CPU(X86_64))
-    inline int getCSR()
-    {
-        int result;
-        asm volatile("stmxcsr %0" : "=m" (result));
-        return result;
-    }
-
-    inline void setCSR(int a)
-    {
-        int temp = a;
-        asm volatile("ldmxcsr %0" : : "m" (temp));
-    }
-
-#endif
-
-    unsigned int m_savedCSR;
-};
-
-#else
-// FIXME: add implementations for other architectures and compilers
-class DenormalDisabler {
-public:
-    DenormalDisabler() { }
-
-    // Assume the worst case that other architectures and compilers
-    // need to flush denormals to zero manually.
-    static inline float flushDenormalFloatToZero(float f)
-    {
-        return (fabs(f) < FLT_MIN) ? 0.0f : f;
-    }
-};
-
-#endif
-
-} // WebCore
-
-#undef HAVE_DENORMAL
-#endif // DenormalDisabler_h
diff --git a/Source/core/platform/audio/DirectConvolver.cpp b/Source/core/platform/audio/DirectConvolver.cpp
deleted file mode 100644
index d74fea4..0000000
--- a/Source/core/platform/audio/DirectConvolver.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Copyright (C) 2012 Intel 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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/DirectConvolver.h"
-
-#if OS(MACOSX)
-#include <Accelerate/Accelerate.h>
-#endif
-
-#include "core/platform/audio/VectorMath.h"
-#include "wtf/CPU.h"
-
-namespace WebCore {
-
-using namespace VectorMath;
-
-DirectConvolver::DirectConvolver(size_t inputBlockSize)
-    : m_inputBlockSize(inputBlockSize)
-#if USE(WEBAUDIO_IPP)
-    , m_overlayBuffer(inputBlockSize)
-#endif // USE(WEBAUDIO_IPP)
-    , m_buffer(inputBlockSize * 2)
-{
-}
-
-void DirectConvolver::process(AudioFloatArray* convolutionKernel, const float* sourceP, float* destP, size_t framesToProcess)
-{
-    ASSERT(framesToProcess == m_inputBlockSize);
-    if (framesToProcess != m_inputBlockSize)
-        return;
-
-    // Only support kernelSize <= m_inputBlockSize
-    size_t kernelSize = convolutionKernel->size();
-    ASSERT(kernelSize <= m_inputBlockSize);
-    if (kernelSize > m_inputBlockSize)
-        return;
-
-    float* kernelP = convolutionKernel->data();
-
-    // Sanity check
-    bool isCopyGood = kernelP && sourceP && destP && m_buffer.data();
-    ASSERT(isCopyGood);
-    if (!isCopyGood)
-        return;
-
-#if USE(WEBAUDIO_IPP)
-    float* outputBuffer = m_buffer.data();
-    float* overlayBuffer = m_overlayBuffer.data();
-    bool isCopyGood2 = overlayBuffer && m_overlayBuffer.size() >= kernelSize && m_buffer.size() == m_inputBlockSize * 2;
-    ASSERT(isCopyGood2);
-    if (!isCopyGood2)
-        return;
-
-    ippsConv_32f(static_cast<const Ipp32f*>(sourceP), framesToProcess, static_cast<Ipp32f*>(kernelP), kernelSize, static_cast<Ipp32f*>(outputBuffer));
-
-    vadd(outputBuffer, 1, overlayBuffer, 1, destP, 1, framesToProcess);
-    memcpy(overlayBuffer, outputBuffer + m_inputBlockSize, sizeof(float) * kernelSize);
-#else
-    float* inputP = m_buffer.data() + m_inputBlockSize;
-
-    // Copy samples to 2nd half of input buffer.
-    memcpy(inputP, sourceP, sizeof(float) * framesToProcess);
-
-#if OS(MACOSX)
-#if CPU(X86)
-    conv(inputP - kernelSize + 1, 1, kernelP + kernelSize - 1, -1, destP, 1, framesToProcess, kernelSize);
-#else
-    vDSP_conv(inputP - kernelSize + 1, 1, kernelP + kernelSize - 1, -1, destP, 1, framesToProcess, kernelSize);
-#endif // CPU(X86)
-#else
-    // FIXME: The macro can be further optimized to avoid pipeline stalls. One possibility is to maintain 4 separate sums and change the macro to CONVOLVE_FOUR_SAMPLES.
-#define CONVOLVE_ONE_SAMPLE             \
-    sum += inputP[i - j] * kernelP[j];  \
-    j++;
-
-    size_t i = 0;
-    while (i < framesToProcess) {
-        size_t j = 0;
-        float sum = 0;
-
-        // FIXME: SSE optimization may be applied here.
-        if (kernelSize == 32) {
-            CONVOLVE_ONE_SAMPLE // 1
-            CONVOLVE_ONE_SAMPLE // 2
-            CONVOLVE_ONE_SAMPLE // 3
-            CONVOLVE_ONE_SAMPLE // 4
-            CONVOLVE_ONE_SAMPLE // 5
-            CONVOLVE_ONE_SAMPLE // 6
-            CONVOLVE_ONE_SAMPLE // 7
-            CONVOLVE_ONE_SAMPLE // 8
-            CONVOLVE_ONE_SAMPLE // 9
-            CONVOLVE_ONE_SAMPLE // 10
-
-            CONVOLVE_ONE_SAMPLE // 11
-            CONVOLVE_ONE_SAMPLE // 12
-            CONVOLVE_ONE_SAMPLE // 13
-            CONVOLVE_ONE_SAMPLE // 14
-            CONVOLVE_ONE_SAMPLE // 15
-            CONVOLVE_ONE_SAMPLE // 16
-            CONVOLVE_ONE_SAMPLE // 17
-            CONVOLVE_ONE_SAMPLE // 18
-            CONVOLVE_ONE_SAMPLE // 19
-            CONVOLVE_ONE_SAMPLE // 20
-
-            CONVOLVE_ONE_SAMPLE // 21
-            CONVOLVE_ONE_SAMPLE // 22
-            CONVOLVE_ONE_SAMPLE // 23
-            CONVOLVE_ONE_SAMPLE // 24
-            CONVOLVE_ONE_SAMPLE // 25
-            CONVOLVE_ONE_SAMPLE // 26
-            CONVOLVE_ONE_SAMPLE // 27
-            CONVOLVE_ONE_SAMPLE // 28
-            CONVOLVE_ONE_SAMPLE // 29
-            CONVOLVE_ONE_SAMPLE // 30
-
-            CONVOLVE_ONE_SAMPLE // 31
-            CONVOLVE_ONE_SAMPLE // 32
-
-        } else if (kernelSize == 64) {
-            CONVOLVE_ONE_SAMPLE // 1
-            CONVOLVE_ONE_SAMPLE // 2
-            CONVOLVE_ONE_SAMPLE // 3
-            CONVOLVE_ONE_SAMPLE // 4
-            CONVOLVE_ONE_SAMPLE // 5
-            CONVOLVE_ONE_SAMPLE // 6
-            CONVOLVE_ONE_SAMPLE // 7
-            CONVOLVE_ONE_SAMPLE // 8
-            CONVOLVE_ONE_SAMPLE // 9
-            CONVOLVE_ONE_SAMPLE // 10
-
-            CONVOLVE_ONE_SAMPLE // 11
-            CONVOLVE_ONE_SAMPLE // 12
-            CONVOLVE_ONE_SAMPLE // 13
-            CONVOLVE_ONE_SAMPLE // 14
-            CONVOLVE_ONE_SAMPLE // 15
-            CONVOLVE_ONE_SAMPLE // 16
-            CONVOLVE_ONE_SAMPLE // 17
-            CONVOLVE_ONE_SAMPLE // 18
-            CONVOLVE_ONE_SAMPLE // 19
-            CONVOLVE_ONE_SAMPLE // 20
-
-            CONVOLVE_ONE_SAMPLE // 21
-            CONVOLVE_ONE_SAMPLE // 22
-            CONVOLVE_ONE_SAMPLE // 23
-            CONVOLVE_ONE_SAMPLE // 24
-            CONVOLVE_ONE_SAMPLE // 25
-            CONVOLVE_ONE_SAMPLE // 26
-            CONVOLVE_ONE_SAMPLE // 27
-            CONVOLVE_ONE_SAMPLE // 28
-            CONVOLVE_ONE_SAMPLE // 29
-            CONVOLVE_ONE_SAMPLE // 30
-
-            CONVOLVE_ONE_SAMPLE // 31
-            CONVOLVE_ONE_SAMPLE // 32
-            CONVOLVE_ONE_SAMPLE // 33
-            CONVOLVE_ONE_SAMPLE // 34
-            CONVOLVE_ONE_SAMPLE // 35
-            CONVOLVE_ONE_SAMPLE // 36
-            CONVOLVE_ONE_SAMPLE // 37
-            CONVOLVE_ONE_SAMPLE // 38
-            CONVOLVE_ONE_SAMPLE // 39
-            CONVOLVE_ONE_SAMPLE // 40
-
-            CONVOLVE_ONE_SAMPLE // 41
-            CONVOLVE_ONE_SAMPLE // 42
-            CONVOLVE_ONE_SAMPLE // 43
-            CONVOLVE_ONE_SAMPLE // 44
-            CONVOLVE_ONE_SAMPLE // 45
-            CONVOLVE_ONE_SAMPLE // 46
-            CONVOLVE_ONE_SAMPLE // 47
-            CONVOLVE_ONE_SAMPLE // 48
-            CONVOLVE_ONE_SAMPLE // 49
-            CONVOLVE_ONE_SAMPLE // 50
-
-            CONVOLVE_ONE_SAMPLE // 51
-            CONVOLVE_ONE_SAMPLE // 52
-            CONVOLVE_ONE_SAMPLE // 53
-            CONVOLVE_ONE_SAMPLE // 54
-            CONVOLVE_ONE_SAMPLE // 55
-            CONVOLVE_ONE_SAMPLE // 56
-            CONVOLVE_ONE_SAMPLE // 57
-            CONVOLVE_ONE_SAMPLE // 58
-            CONVOLVE_ONE_SAMPLE // 59
-            CONVOLVE_ONE_SAMPLE // 60
-
-            CONVOLVE_ONE_SAMPLE // 61
-            CONVOLVE_ONE_SAMPLE // 62
-            CONVOLVE_ONE_SAMPLE // 63
-            CONVOLVE_ONE_SAMPLE // 64
-
-        } else if (kernelSize == 128) {
-            CONVOLVE_ONE_SAMPLE // 1
-            CONVOLVE_ONE_SAMPLE // 2
-            CONVOLVE_ONE_SAMPLE // 3
-            CONVOLVE_ONE_SAMPLE // 4
-            CONVOLVE_ONE_SAMPLE // 5
-            CONVOLVE_ONE_SAMPLE // 6
-            CONVOLVE_ONE_SAMPLE // 7
-            CONVOLVE_ONE_SAMPLE // 8
-            CONVOLVE_ONE_SAMPLE // 9
-            CONVOLVE_ONE_SAMPLE // 10
-
-            CONVOLVE_ONE_SAMPLE // 11
-            CONVOLVE_ONE_SAMPLE // 12
-            CONVOLVE_ONE_SAMPLE // 13
-            CONVOLVE_ONE_SAMPLE // 14
-            CONVOLVE_ONE_SAMPLE // 15
-            CONVOLVE_ONE_SAMPLE // 16
-            CONVOLVE_ONE_SAMPLE // 17
-            CONVOLVE_ONE_SAMPLE // 18
-            CONVOLVE_ONE_SAMPLE // 19
-            CONVOLVE_ONE_SAMPLE // 20
-
-            CONVOLVE_ONE_SAMPLE // 21
-            CONVOLVE_ONE_SAMPLE // 22
-            CONVOLVE_ONE_SAMPLE // 23
-            CONVOLVE_ONE_SAMPLE // 24
-            CONVOLVE_ONE_SAMPLE // 25
-            CONVOLVE_ONE_SAMPLE // 26
-            CONVOLVE_ONE_SAMPLE // 27
-            CONVOLVE_ONE_SAMPLE // 28
-            CONVOLVE_ONE_SAMPLE // 29
-            CONVOLVE_ONE_SAMPLE // 30
-
-            CONVOLVE_ONE_SAMPLE // 31
-            CONVOLVE_ONE_SAMPLE // 32
-            CONVOLVE_ONE_SAMPLE // 33
-            CONVOLVE_ONE_SAMPLE // 34
-            CONVOLVE_ONE_SAMPLE // 35
-            CONVOLVE_ONE_SAMPLE // 36
-            CONVOLVE_ONE_SAMPLE // 37
-            CONVOLVE_ONE_SAMPLE // 38
-            CONVOLVE_ONE_SAMPLE // 39
-            CONVOLVE_ONE_SAMPLE // 40
-
-            CONVOLVE_ONE_SAMPLE // 41
-            CONVOLVE_ONE_SAMPLE // 42
-            CONVOLVE_ONE_SAMPLE // 43
-            CONVOLVE_ONE_SAMPLE // 44
-            CONVOLVE_ONE_SAMPLE // 45
-            CONVOLVE_ONE_SAMPLE // 46
-            CONVOLVE_ONE_SAMPLE // 47
-            CONVOLVE_ONE_SAMPLE // 48
-            CONVOLVE_ONE_SAMPLE // 49
-            CONVOLVE_ONE_SAMPLE // 50
-
-            CONVOLVE_ONE_SAMPLE // 51
-            CONVOLVE_ONE_SAMPLE // 52
-            CONVOLVE_ONE_SAMPLE // 53
-            CONVOLVE_ONE_SAMPLE // 54
-            CONVOLVE_ONE_SAMPLE // 55
-            CONVOLVE_ONE_SAMPLE // 56
-            CONVOLVE_ONE_SAMPLE // 57
-            CONVOLVE_ONE_SAMPLE // 58
-            CONVOLVE_ONE_SAMPLE // 59
-            CONVOLVE_ONE_SAMPLE // 60
-
-            CONVOLVE_ONE_SAMPLE // 61
-            CONVOLVE_ONE_SAMPLE // 62
-            CONVOLVE_ONE_SAMPLE // 63
-            CONVOLVE_ONE_SAMPLE // 64
-            CONVOLVE_ONE_SAMPLE // 65
-            CONVOLVE_ONE_SAMPLE // 66
-            CONVOLVE_ONE_SAMPLE // 67
-            CONVOLVE_ONE_SAMPLE // 68
-            CONVOLVE_ONE_SAMPLE // 69
-            CONVOLVE_ONE_SAMPLE // 70
-
-            CONVOLVE_ONE_SAMPLE // 71
-            CONVOLVE_ONE_SAMPLE // 72
-            CONVOLVE_ONE_SAMPLE // 73
-            CONVOLVE_ONE_SAMPLE // 74
-            CONVOLVE_ONE_SAMPLE // 75
-            CONVOLVE_ONE_SAMPLE // 76
-            CONVOLVE_ONE_SAMPLE // 77
-            CONVOLVE_ONE_SAMPLE // 78
-            CONVOLVE_ONE_SAMPLE // 79
-            CONVOLVE_ONE_SAMPLE // 80
-
-            CONVOLVE_ONE_SAMPLE // 81
-            CONVOLVE_ONE_SAMPLE // 82
-            CONVOLVE_ONE_SAMPLE // 83
-            CONVOLVE_ONE_SAMPLE // 84
-            CONVOLVE_ONE_SAMPLE // 85
-            CONVOLVE_ONE_SAMPLE // 86
-            CONVOLVE_ONE_SAMPLE // 87
-            CONVOLVE_ONE_SAMPLE // 88
-            CONVOLVE_ONE_SAMPLE // 89
-            CONVOLVE_ONE_SAMPLE // 90
-
-            CONVOLVE_ONE_SAMPLE // 91
-            CONVOLVE_ONE_SAMPLE // 92
-            CONVOLVE_ONE_SAMPLE // 93
-            CONVOLVE_ONE_SAMPLE // 94
-            CONVOLVE_ONE_SAMPLE // 95
-            CONVOLVE_ONE_SAMPLE // 96
-            CONVOLVE_ONE_SAMPLE // 97
-            CONVOLVE_ONE_SAMPLE // 98
-            CONVOLVE_ONE_SAMPLE // 99
-            CONVOLVE_ONE_SAMPLE // 100
-
-            CONVOLVE_ONE_SAMPLE // 101
-            CONVOLVE_ONE_SAMPLE // 102
-            CONVOLVE_ONE_SAMPLE // 103
-            CONVOLVE_ONE_SAMPLE // 104
-            CONVOLVE_ONE_SAMPLE // 105
-            CONVOLVE_ONE_SAMPLE // 106
-            CONVOLVE_ONE_SAMPLE // 107
-            CONVOLVE_ONE_SAMPLE // 108
-            CONVOLVE_ONE_SAMPLE // 109
-            CONVOLVE_ONE_SAMPLE // 110
-
-            CONVOLVE_ONE_SAMPLE // 111
-            CONVOLVE_ONE_SAMPLE // 112
-            CONVOLVE_ONE_SAMPLE // 113
-            CONVOLVE_ONE_SAMPLE // 114
-            CONVOLVE_ONE_SAMPLE // 115
-            CONVOLVE_ONE_SAMPLE // 116
-            CONVOLVE_ONE_SAMPLE // 117
-            CONVOLVE_ONE_SAMPLE // 118
-            CONVOLVE_ONE_SAMPLE // 119
-            CONVOLVE_ONE_SAMPLE // 120
-
-            CONVOLVE_ONE_SAMPLE // 121
-            CONVOLVE_ONE_SAMPLE // 122
-            CONVOLVE_ONE_SAMPLE // 123
-            CONVOLVE_ONE_SAMPLE // 124
-            CONVOLVE_ONE_SAMPLE // 125
-            CONVOLVE_ONE_SAMPLE // 126
-            CONVOLVE_ONE_SAMPLE // 127
-            CONVOLVE_ONE_SAMPLE // 128
-        } else {
-            while (j < kernelSize) {
-                // Non-optimized using actual while loop.
-                CONVOLVE_ONE_SAMPLE
-            }
-        }
-        destP[i++] = sum;
-    }
-#endif // OS(MACOSX)
-
-    // Copy 2nd half of input buffer to 1st half.
-    memcpy(m_buffer.data(), inputP, sizeof(float) * framesToProcess);
-#endif
-}
-
-void DirectConvolver::reset()
-{
-    m_buffer.zero();
-#if USE(WEBAUDIO_IPP)
-    m_overlayBuffer.zero();
-#endif // USE(WEBAUDIO_IPP)
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/DirectConvolver.h b/Source/core/platform/audio/DirectConvolver.h
deleted file mode 100644
index 0528d7c..0000000
--- a/Source/core/platform/audio/DirectConvolver.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2012 Intel 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.
- * 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.
- *
- * 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 DirectConvolver_h
-#define DirectConvolver_h
-
-#include "core/platform/audio/AudioArray.h"
-
-#if USE(WEBAUDIO_IPP)
-#include <ipps.h>
-#endif // USE(WEBAUDIO_IPP)
-
-namespace WebCore {
-
-class DirectConvolver {
-public:
-    DirectConvolver(size_t inputBlockSize);
-
-    void process(AudioFloatArray* convolutionKernel, const float* sourceP, float* destP, size_t framesToProcess);
-
-    void reset();
-
-private:
-    size_t m_inputBlockSize;
-
-#if USE(WEBAUDIO_IPP)
-    AudioFloatArray m_overlayBuffer;
-#endif // USE(WEBAUDIO_IPP)
-    AudioFloatArray m_buffer;
-};
-
-} // namespace WebCore
-
-#endif // DirectConvolver_h
diff --git a/Source/core/platform/audio/Distance.cpp b/Source/core/platform/audio/Distance.cpp
deleted file mode 100644
index 91a4a5f..0000000
--- a/Source/core/platform/audio/Distance.cpp
+++ /dev/null
@@ -1,92 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/Distance.h"
-#include "wtf/Assertions.h"
-
-#include <math.h>
-#include <algorithm>
-
-using namespace std;
-
-namespace WebCore {
-
-DistanceEffect::DistanceEffect()
-    : m_model(ModelInverse)
-    , m_isClamped(true)
-    , m_refDistance(1.0)
-    , m_maxDistance(10000.0)
-    , m_rolloffFactor(1.0)
-{
-}
-
-double DistanceEffect::gain(double distance)
-{
-    // don't go beyond maximum distance
-    distance = min(distance, m_maxDistance);
-
-    // if clamped, don't get closer than reference distance
-    if (m_isClamped)
-        distance = max(distance, m_refDistance);
-
-    switch (m_model) {
-    case ModelLinear:
-        return linearGain(distance);
-    case ModelInverse:
-        return inverseGain(distance);
-    case ModelExponential:
-        return exponentialGain(distance);
-    }
-    ASSERT_NOT_REACHED();
-    return 0.0;
-}
-
-double DistanceEffect::linearGain(double distance)
-{
-    // We want a gain that decreases linearly from m_refDistance to
-    // m_maxDistance. The gain is 1 at m_refDistance.
-    return (1.0 - m_rolloffFactor * (distance - m_refDistance) / (m_maxDistance - m_refDistance));
-}
-
-double DistanceEffect::inverseGain(double distance)
-{
-    return m_refDistance / (m_refDistance + m_rolloffFactor * (distance - m_refDistance));
-}
-
-double DistanceEffect::exponentialGain(double distance)
-{
-    return pow(distance / m_refDistance, -m_rolloffFactor);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/Distance.h b/Source/core/platform/audio/Distance.h
deleted file mode 100644
index c5b6cc9..0000000
--- a/Source/core/platform/audio/Distance.h
+++ /dev/null
@@ -1,81 +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.
- * 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.
- *
- * 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 Distance_h
-#define Distance_h
-
-namespace WebCore {
-
-// Distance models are defined according to the OpenAL specification:
-// http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.htm.
-
-class DistanceEffect {
-public:
-    enum ModelType {
-        ModelLinear = 0,
-        ModelInverse = 1,
-        ModelExponential = 2
-    };
-
-    DistanceEffect();
-
-    // Returns scalar gain for the given distance the current distance model is used
-    double gain(double distance);
-
-    ModelType model() { return m_model; }
-
-    void setModel(ModelType model, bool clamped)
-    {
-        m_model = model;
-        m_isClamped = clamped;
-    }
-
-    // Distance params
-    void setRefDistance(double refDistance) { m_refDistance = refDistance; }
-    void setMaxDistance(double maxDistance) { m_maxDistance = maxDistance; }
-    void setRolloffFactor(double rolloffFactor) { m_rolloffFactor = rolloffFactor; }
-
-    double refDistance() const { return m_refDistance; }
-    double maxDistance() const { return m_maxDistance; }
-    double rolloffFactor() const { return m_rolloffFactor; }
-
-protected:
-    double linearGain(double distance);
-    double inverseGain(double distance);
-    double exponentialGain(double distance);
-
-    ModelType m_model;
-    bool m_isClamped;
-    double m_refDistance;
-    double m_maxDistance;
-    double m_rolloffFactor;
-};
-
-} // namespace WebCore
-
-#endif // Distance_h
diff --git a/Source/core/platform/audio/DownSampler.cpp b/Source/core/platform/audio/DownSampler.cpp
deleted file mode 100644
index e2c9518..0000000
--- a/Source/core/platform/audio/DownSampler.cpp
+++ /dev/null
@@ -1,151 +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.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/DownSampler.h"
-
-#include "wtf/MathExtras.h"
-
-namespace WebCore {
-
-DownSampler::DownSampler(size_t inputBlockSize)
-    : m_inputBlockSize(inputBlockSize)
-    , m_reducedKernel(DefaultKernelSize / 2)
-    , m_tempBuffer(inputBlockSize / 2)
-    , m_inputBuffer(inputBlockSize * 2)
-    , m_convolver(inputBlockSize / 2) // runs at 1/2 source sample-rate
-{
-    initializeKernel();
-}
-
-void DownSampler::initializeKernel()
-{
-    // Blackman window parameters.
-    double alpha = 0.16;
-    double a0 = 0.5 * (1.0 - alpha);
-    double a1 = 0.5;
-    double a2 = 0.5 * alpha;
-
-    int n = DefaultKernelSize;
-    int halfSize = n / 2;
-
-    // Half-band filter.
-    double sincScaleFactor = 0.5;
-
-    // Compute only the odd terms because the even ones are zero, except
-    // right in the middle at halfSize, which is 0.5 and we'll handle specially during processing
-    // after doing the main convolution using m_reducedKernel.
-    for (int i = 1; i < n; i += 2) {
-        // Compute the sinc() with offset.
-        double s = sincScaleFactor * piDouble * (i - halfSize);
-        double sinc = !s ? 1.0 : sin(s) / s;
-        sinc *= sincScaleFactor;
-
-        // Compute Blackman window, matching the offset of the sinc().
-        double x = static_cast<double>(i) / n;
-        double window = a0 - a1 * cos(2.0 * piDouble * x) + a2 * cos(4.0 * piDouble * x);
-
-        // Window the sinc() function.
-        // Then store only the odd terms in the kernel.
-        // In a sense, this is shifting forward in time by one sample-frame at the destination sample-rate.
-        m_reducedKernel[(i - 1) / 2] = sinc * window;
-    }
-}
-
-void DownSampler::process(const float* sourceP, float* destP, size_t sourceFramesToProcess)
-{
-    bool isInputBlockSizeGood = sourceFramesToProcess == m_inputBlockSize;
-    ASSERT(isInputBlockSizeGood);
-    if (!isInputBlockSizeGood)
-        return;
-
-    size_t destFramesToProcess = sourceFramesToProcess / 2;
-
-    bool isTempBufferGood = destFramesToProcess == m_tempBuffer.size();
-    ASSERT(isTempBufferGood);
-    if (!isTempBufferGood)
-        return;
-
-    bool isReducedKernelGood = m_reducedKernel.size() == DefaultKernelSize / 2;
-    ASSERT(isReducedKernelGood);
-    if (!isReducedKernelGood)
-        return;
-
-    size_t halfSize = DefaultKernelSize / 2;
-
-    // Copy source samples to 2nd half of input buffer.
-    bool isInputBufferGood = m_inputBuffer.size() == sourceFramesToProcess * 2 && halfSize <= sourceFramesToProcess;
-    ASSERT(isInputBufferGood);
-    if (!isInputBufferGood)
-        return;
-
-    float* inputP = m_inputBuffer.data() + sourceFramesToProcess;
-    memcpy(inputP, sourceP, sizeof(float) * sourceFramesToProcess);
-
-    // Copy the odd sample-frames from sourceP, delayed by one sample-frame (destination sample-rate)
-    // to match shifting forward in time in m_reducedKernel.
-    float* oddSamplesP = m_tempBuffer.data();
-    for (unsigned i = 0; i < destFramesToProcess; ++i)
-        oddSamplesP[i] = *((inputP - 1) + i * 2);
-
-    // Actually process oddSamplesP with m_reducedKernel for efficiency.
-    // The theoretical kernel is double this size with 0 values for even terms (except center).
-    m_convolver.process(&m_reducedKernel, oddSamplesP, destP, destFramesToProcess);
-
-    // Now, account for the 0.5 term right in the middle of the kernel.
-    // This amounts to a delay-line of length halfSize (at the source sample-rate),
-    // scaled by 0.5.
-
-    // Sum into the destination.
-    for (unsigned i = 0; i < destFramesToProcess; ++i)
-        destP[i] += 0.5 * *((inputP - halfSize) + i * 2);
-
-    // Copy 2nd half of input buffer to 1st half.
-    memcpy(m_inputBuffer.data(), inputP, sizeof(float) * sourceFramesToProcess);
-}
-
-void DownSampler::reset()
-{
-    m_convolver.reset();
-    m_inputBuffer.zero();
-}
-
-size_t DownSampler::latencyFrames() const
-{
-    // Divide by two since this is a linear phase kernel and the delay is at the center of the kernel.
-    return m_reducedKernel.size() / 2;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/DownSampler.h b/Source/core/platform/audio/DownSampler.h
deleted file mode 100644
index afd5d98..0000000
--- a/Source/core/platform/audio/DownSampler.h
+++ /dev/null
@@ -1,74 +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 DownSampler_h
-#define DownSampler_h
-
-#include "core/platform/audio/AudioArray.h"
-#include "core/platform/audio/DirectConvolver.h"
-
-namespace WebCore {
-
-// DownSampler down-samples the source stream by a factor of 2x.
-
-class DownSampler {
-public:
-    DownSampler(size_t inputBlockSize);
-
-    // The destination buffer |destP| is of size sourceFramesToProcess / 2.
-    void process(const float* sourceP, float* destP, size_t sourceFramesToProcess);
-
-    void reset();
-
-    // Latency based on the destination sample-rate.
-    size_t latencyFrames() const;
-
-private:
-    enum { DefaultKernelSize = 256 };
-
-    size_t m_inputBlockSize;
-
-    // Computes ideal band-limited half-band filter coefficients.
-    // In other words, filter out all frequencies higher than 0.25 * Nyquist.
-    void initializeKernel();
-    AudioFloatArray m_reducedKernel;
-
-    // Half-band filter.
-    DirectConvolver m_convolver;
-
-    AudioFloatArray m_tempBuffer;
-
-    // Used as delay-line (FIR filter history) for the input samples to account for the 0.5 term right in the middle of the kernel.
-    AudioFloatArray m_inputBuffer;
-};
-
-} // namespace WebCore
-
-#endif // DownSampler_h
diff --git a/Source/core/platform/audio/DynamicsCompressor.cpp b/Source/core/platform/audio/DynamicsCompressor.cpp
deleted file mode 100644
index 46621bb..0000000
--- a/Source/core/platform/audio/DynamicsCompressor.cpp
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/DynamicsCompressor.h"
-
-#include "core/platform/audio/AudioBus.h"
-#include "core/platform/audio/AudioUtilities.h"
-#include "wtf/MathExtras.h"
-
-namespace WebCore {
-
-using namespace AudioUtilities;
-
-DynamicsCompressor::DynamicsCompressor(float sampleRate, unsigned numberOfChannels)
-    : m_numberOfChannels(numberOfChannels)
-    , m_sampleRate(sampleRate)
-    , m_compressor(sampleRate, numberOfChannels)
-{
-    // Uninitialized state - for parameter recalculation.
-    m_lastFilterStageRatio = -1;
-    m_lastAnchor = -1;
-    m_lastFilterStageGain = -1;
-
-    setNumberOfChannels(numberOfChannels);
-    initializeParameters();
-}
-
-void DynamicsCompressor::setParameterValue(unsigned parameterID, float value)
-{
-    ASSERT(parameterID < ParamLast);
-    if (parameterID < ParamLast)
-        m_parameters[parameterID] = value;
-}
-
-void DynamicsCompressor::initializeParameters()
-{
-    // Initializes compressor to default values.
-
-    m_parameters[ParamThreshold] = -24; // dB
-    m_parameters[ParamKnee] = 30; // dB
-    m_parameters[ParamRatio] = 12; // unit-less
-    m_parameters[ParamAttack] = 0.003f; // seconds
-    m_parameters[ParamRelease] = 0.250f; // seconds
-    m_parameters[ParamPreDelay] = 0.006f; // seconds
-
-    // Release zone values 0 -> 1.
-    m_parameters[ParamReleaseZone1] = 0.09f;
-    m_parameters[ParamReleaseZone2] = 0.16f;
-    m_parameters[ParamReleaseZone3] = 0.42f;
-    m_parameters[ParamReleaseZone4] = 0.98f;
-
-    m_parameters[ParamFilterStageGain] = 4.4f; // dB
-    m_parameters[ParamFilterStageRatio] = 2;
-    m_parameters[ParamFilterAnchor] = 15000 / nyquist();
-
-    m_parameters[ParamPostGain] = 0; // dB
-    m_parameters[ParamReduction] = 0; // dB
-
-    // Linear crossfade (0 -> 1).
-    m_parameters[ParamEffectBlend] = 1;
-}
-
-float DynamicsCompressor::parameterValue(unsigned parameterID)
-{
-    ASSERT(parameterID < ParamLast);
-    return m_parameters[parameterID];
-}
-
-void DynamicsCompressor::setEmphasisStageParameters(unsigned stageIndex, float gain, float normalizedFrequency /* 0 -> 1 */)
-{
-    float gk = 1 - gain / 20;
-    float f1 = normalizedFrequency * gk;
-    float f2 = normalizedFrequency / gk;
-    float r1 = expf(-f1 * piFloat);
-    float r2 = expf(-f2 * piFloat);
-
-    ASSERT(m_numberOfChannels == m_preFilterPacks.size());
-
-    for (unsigned i = 0; i < m_numberOfChannels; ++i) {
-        // Set pre-filter zero and pole to create an emphasis filter.
-        ZeroPole& preFilter = m_preFilterPacks[i]->filters[stageIndex];
-        preFilter.setZero(r1);
-        preFilter.setPole(r2);
-
-        // Set post-filter with zero and pole reversed to create the de-emphasis filter.
-        // If there were no compressor kernel in between, they would cancel each other out (allpass filter).
-        ZeroPole& postFilter = m_postFilterPacks[i]->filters[stageIndex];
-        postFilter.setZero(r2);
-        postFilter.setPole(r1);
-    }
-}
-
-void DynamicsCompressor::setEmphasisParameters(float gain, float anchorFreq, float filterStageRatio)
-{
-    setEmphasisStageParameters(0, gain, anchorFreq);
-    setEmphasisStageParameters(1, gain, anchorFreq / filterStageRatio);
-    setEmphasisStageParameters(2, gain, anchorFreq / (filterStageRatio * filterStageRatio));
-    setEmphasisStageParameters(3, gain, anchorFreq / (filterStageRatio * filterStageRatio * filterStageRatio));
-}
-
-void DynamicsCompressor::process(const AudioBus* sourceBus, AudioBus* destinationBus, unsigned framesToProcess)
-{
-    // Though numberOfChannels is retrived from destinationBus, we still name it numberOfChannels instead of numberOfDestinationChannels.
-    // It's because we internally match sourceChannels's size to destinationBus by channel up/down mix. Thus we need numberOfChannels
-    // to do the loop work for both m_sourceChannels and m_destinationChannels.
-
-    unsigned numberOfChannels = destinationBus->numberOfChannels();
-    unsigned numberOfSourceChannels = sourceBus->numberOfChannels();
-
-    ASSERT(numberOfChannels == m_numberOfChannels && numberOfSourceChannels);
-
-    if (numberOfChannels != m_numberOfChannels || !numberOfSourceChannels) {
-        destinationBus->zero();
-        return;
-    }
-
-    switch (numberOfChannels) {
-    case 2: // stereo
-        m_sourceChannels[0] = sourceBus->channel(0)->data();
-
-        if (numberOfSourceChannels > 1)
-            m_sourceChannels[1] = sourceBus->channel(1)->data();
-        else
-            // Simply duplicate mono channel input data to right channel for stereo processing.
-            m_sourceChannels[1] = m_sourceChannels[0];
-
-        break;
-    default:
-        // FIXME : support other number of channels.
-        ASSERT_NOT_REACHED();
-        destinationBus->zero();
-        return;
-    }
-
-    for (unsigned i = 0; i < numberOfChannels; ++i)
-        m_destinationChannels[i] = destinationBus->channel(i)->mutableData();
-
-    float filterStageGain = parameterValue(ParamFilterStageGain);
-    float filterStageRatio = parameterValue(ParamFilterStageRatio);
-    float anchor = parameterValue(ParamFilterAnchor);
-
-    if (filterStageGain != m_lastFilterStageGain || filterStageRatio != m_lastFilterStageRatio || anchor != m_lastAnchor) {
-        m_lastFilterStageGain = filterStageGain;
-        m_lastFilterStageRatio = filterStageRatio;
-        m_lastAnchor = anchor;
-
-        setEmphasisParameters(filterStageGain, anchor, filterStageRatio);
-    }
-
-    // Apply pre-emphasis filter.
-    // Note that the final three stages are computed in-place in the destination buffer.
-    for (unsigned i = 0; i < numberOfChannels; ++i) {
-        const float* sourceData = m_sourceChannels[i];
-        float* destinationData = m_destinationChannels[i];
-        ZeroPole* preFilters = m_preFilterPacks[i]->filters;
-
-        preFilters[0].process(sourceData, destinationData, framesToProcess);
-        preFilters[1].process(destinationData, destinationData, framesToProcess);
-        preFilters[2].process(destinationData, destinationData, framesToProcess);
-        preFilters[3].process(destinationData, destinationData, framesToProcess);
-    }
-
-    float dbThreshold = parameterValue(ParamThreshold);
-    float dbKnee = parameterValue(ParamKnee);
-    float ratio = parameterValue(ParamRatio);
-    float attackTime = parameterValue(ParamAttack);
-    float releaseTime = parameterValue(ParamRelease);
-    float preDelayTime = parameterValue(ParamPreDelay);
-
-    // This is effectively a master volume on the compressed signal (pre-blending).
-    float dbPostGain = parameterValue(ParamPostGain);
-
-    // Linear blending value from dry to completely processed (0 -> 1)
-    // 0 means the signal is completely unprocessed.
-    // 1 mixes in only the compressed signal.
-    float effectBlend = parameterValue(ParamEffectBlend);
-
-    float releaseZone1 = parameterValue(ParamReleaseZone1);
-    float releaseZone2 = parameterValue(ParamReleaseZone2);
-    float releaseZone3 = parameterValue(ParamReleaseZone3);
-    float releaseZone4 = parameterValue(ParamReleaseZone4);
-
-    // Apply compression to the pre-filtered signal.
-    // The processing is performed in place.
-    m_compressor.process(m_destinationChannels.get(),
-                         m_destinationChannels.get(),
-                         numberOfChannels,
-                         framesToProcess,
-
-                         dbThreshold,
-                         dbKnee,
-                         ratio,
-                         attackTime,
-                         releaseTime,
-                         preDelayTime,
-                         dbPostGain,
-                         effectBlend,
-
-                         releaseZone1,
-                         releaseZone2,
-                         releaseZone3,
-                         releaseZone4
-                         );
-
-    // Update the compression amount.
-    setParameterValue(ParamReduction, m_compressor.meteringGain());
-
-    // Apply de-emphasis filter.
-    for (unsigned i = 0; i < numberOfChannels; ++i) {
-        float* destinationData = m_destinationChannels[i];
-        ZeroPole* postFilters = m_postFilterPacks[i]->filters;
-
-        postFilters[0].process(destinationData, destinationData, framesToProcess);
-        postFilters[1].process(destinationData, destinationData, framesToProcess);
-        postFilters[2].process(destinationData, destinationData, framesToProcess);
-        postFilters[3].process(destinationData, destinationData, framesToProcess);
-    }
-}
-
-void DynamicsCompressor::reset()
-{
-    m_lastFilterStageRatio = -1; // for recalc
-    m_lastAnchor = -1;
-    m_lastFilterStageGain = -1;
-
-    for (unsigned channel = 0; channel < m_numberOfChannels; ++channel) {
-        for (unsigned stageIndex = 0; stageIndex < 4; ++stageIndex) {
-            m_preFilterPacks[channel]->filters[stageIndex].reset();
-            m_postFilterPacks[channel]->filters[stageIndex].reset();
-        }
-    }
-
-    m_compressor.reset();
-}
-
-void DynamicsCompressor::setNumberOfChannels(unsigned numberOfChannels)
-{
-    if (m_preFilterPacks.size() == numberOfChannels)
-        return;
-
-    m_preFilterPacks.clear();
-    m_postFilterPacks.clear();
-    for (unsigned i = 0; i < numberOfChannels; ++i) {
-        m_preFilterPacks.append(adoptPtr(new ZeroPoleFilterPack4()));
-        m_postFilterPacks.append(adoptPtr(new ZeroPoleFilterPack4()));
-    }
-
-    m_sourceChannels = adoptArrayPtr(new const float* [numberOfChannels]);
-    m_destinationChannels = adoptArrayPtr(new float* [numberOfChannels]);
-
-    m_compressor.setNumberOfChannels(numberOfChannels);
-    m_numberOfChannels = numberOfChannels;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/DynamicsCompressor.h b/Source/core/platform/audio/DynamicsCompressor.h
deleted file mode 100644
index 90922e6..0000000
--- a/Source/core/platform/audio/DynamicsCompressor.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 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.
- *
- * 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 DynamicsCompressor_h
-#define DynamicsCompressor_h
-
-#include "core/platform/audio/AudioArray.h"
-#include "core/platform/audio/DynamicsCompressorKernel.h"
-#include "core/platform/audio/ZeroPole.h"
-
-#include "wtf/OwnArrayPtr.h"
-
-namespace WebCore {
-
-class AudioBus;
-
-// DynamicsCompressor implements a flexible audio dynamics compression effect such as
-// is commonly used in musical production and game audio. It lowers the volume
-// of the loudest parts of the signal and raises the volume of the softest parts,
-// making the sound richer, fuller, and more controlled.
-
-class DynamicsCompressor {
-public:
-    enum {
-        ParamThreshold,
-        ParamKnee,
-        ParamRatio,
-        ParamAttack,
-        ParamRelease,
-        ParamPreDelay,
-        ParamReleaseZone1,
-        ParamReleaseZone2,
-        ParamReleaseZone3,
-        ParamReleaseZone4,
-        ParamPostGain,
-        ParamFilterStageGain,
-        ParamFilterStageRatio,
-        ParamFilterAnchor,
-        ParamEffectBlend,
-        ParamReduction,
-        ParamLast
-    };
-
-    DynamicsCompressor(float sampleRate, unsigned numberOfChannels);
-
-    void process(const AudioBus* sourceBus, AudioBus* destinationBus, unsigned framesToProcess);
-    void reset();
-    void setNumberOfChannels(unsigned);
-
-    void setParameterValue(unsigned parameterID, float value);
-    float parameterValue(unsigned parameterID);
-
-    float sampleRate() const { return m_sampleRate; }
-    float nyquist() const { return m_sampleRate / 2; }
-
-    double tailTime() const { return 0; }
-    double latencyTime() const { return m_compressor.latencyFrames() / static_cast<double>(sampleRate()); }
-
-protected:
-    unsigned m_numberOfChannels;
-
-    // m_parameters holds the tweakable compressor parameters.
-    float m_parameters[ParamLast];
-    void initializeParameters();
-
-    float m_sampleRate;
-
-    // Emphasis filter controls.
-    float m_lastFilterStageRatio;
-    float m_lastAnchor;
-    float m_lastFilterStageGain;
-
-    typedef struct {
-        ZeroPole filters[4];
-    } ZeroPoleFilterPack4;
-
-    // Per-channel emphasis filters.
-    Vector<OwnPtr<ZeroPoleFilterPack4> > m_preFilterPacks;
-    Vector<OwnPtr<ZeroPoleFilterPack4> > m_postFilterPacks;
-
-    OwnArrayPtr<const float*> m_sourceChannels;
-    OwnArrayPtr<float*> m_destinationChannels;
-
-    void setEmphasisStageParameters(unsigned stageIndex, float gain, float normalizedFrequency /* 0 -> 1 */);
-    void setEmphasisParameters(float gain, float anchorFreq, float filterStageRatio);
-
-    // The core compressor.
-    DynamicsCompressorKernel m_compressor;
-};
-
-} // namespace WebCore
-
-#endif // DynamicsCompressor_h
diff --git a/Source/core/platform/audio/DynamicsCompressorKernel.cpp b/Source/core/platform/audio/DynamicsCompressorKernel.cpp
deleted file mode 100644
index e5ee8a6..0000000
--- a/Source/core/platform/audio/DynamicsCompressorKernel.cpp
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/DynamicsCompressorKernel.h"
-
-#include <algorithm>
-#include "core/platform/audio/AudioUtilities.h"
-#include "core/platform/audio/DenormalDisabler.h"
-#include "wtf/MathExtras.h"
-
-using namespace std;
-
-namespace WebCore {
-
-using namespace AudioUtilities;
-
-// Metering hits peaks instantly, but releases this fast (in seconds).
-const float meteringReleaseTimeConstant = 0.325f;
-
-const float uninitializedValue = -1;
-
-DynamicsCompressorKernel::DynamicsCompressorKernel(float sampleRate, unsigned numberOfChannels)
-    : m_sampleRate(sampleRate)
-    , m_lastPreDelayFrames(DefaultPreDelayFrames)
-    , m_preDelayReadIndex(0)
-    , m_preDelayWriteIndex(DefaultPreDelayFrames)
-    , m_ratio(uninitializedValue)
-    , m_slope(uninitializedValue)
-    , m_linearThreshold(uninitializedValue)
-    , m_dbThreshold(uninitializedValue)
-    , m_dbKnee(uninitializedValue)
-    , m_kneeThreshold(uninitializedValue)
-    , m_kneeThresholdDb(uninitializedValue)
-    , m_ykneeThresholdDb(uninitializedValue)
-    , m_K(uninitializedValue)
-{
-    setNumberOfChannels(numberOfChannels);
-
-    // Initializes most member variables
-    reset();
-
-    m_meteringReleaseK = static_cast<float>(discreteTimeConstantForSampleRate(meteringReleaseTimeConstant, sampleRate));
-}
-
-void DynamicsCompressorKernel::setNumberOfChannels(unsigned numberOfChannels)
-{
-    if (m_preDelayBuffers.size() == numberOfChannels)
-        return;
-
-    m_preDelayBuffers.clear();
-    for (unsigned i = 0; i < numberOfChannels; ++i)
-        m_preDelayBuffers.append(adoptPtr(new AudioFloatArray(MaxPreDelayFrames)));
-}
-
-void DynamicsCompressorKernel::setPreDelayTime(float preDelayTime)
-{
-    // Re-configure look-ahead section pre-delay if delay time has changed.
-    unsigned preDelayFrames = preDelayTime * sampleRate();
-    if (preDelayFrames > MaxPreDelayFrames - 1)
-        preDelayFrames = MaxPreDelayFrames - 1;
-
-    if (m_lastPreDelayFrames != preDelayFrames) {
-        m_lastPreDelayFrames = preDelayFrames;
-        for (unsigned i = 0; i < m_preDelayBuffers.size(); ++i)
-            m_preDelayBuffers[i]->zero();
-
-        m_preDelayReadIndex = 0;
-        m_preDelayWriteIndex = preDelayFrames;
-    }
-}
-
-// Exponential curve for the knee.
-// It is 1st derivative matched at m_linearThreshold and asymptotically approaches the value m_linearThreshold + 1 / k.
-float DynamicsCompressorKernel::kneeCurve(float x, float k)
-{
-    // Linear up to threshold.
-    if (x < m_linearThreshold)
-        return x;
-
-    return m_linearThreshold + (1 - expf(-k * (x - m_linearThreshold))) / k;
-}
-
-// Full compression curve with constant ratio after knee.
-float DynamicsCompressorKernel::saturate(float x, float k)
-{
-    float y;
-
-    if (x < m_kneeThreshold)
-        y = kneeCurve(x, k);
-    else {
-        // Constant ratio after knee.
-        float xDb = linearToDecibels(x);
-        float yDb = m_ykneeThresholdDb + m_slope * (xDb - m_kneeThresholdDb);
-
-        y = decibelsToLinear(yDb);
-    }
-
-    return y;
-}
-
-// Approximate 1st derivative with input and output expressed in dB.
-// This slope is equal to the inverse of the compression "ratio".
-// In other words, a compression ratio of 20 would be a slope of 1/20.
-float DynamicsCompressorKernel::slopeAt(float x, float k)
-{
-    if (x < m_linearThreshold)
-        return 1;
-
-    float x2 = x * 1.001;
-
-    float xDb = linearToDecibels(x);
-    float x2Db = linearToDecibels(x2);
-
-    float yDb = linearToDecibels(kneeCurve(x, k));
-    float y2Db = linearToDecibels(kneeCurve(x2, k));
-
-    float m = (y2Db - yDb) / (x2Db - xDb);
-
-    return m;
-}
-
-float DynamicsCompressorKernel::kAtSlope(float desiredSlope)
-{
-    float xDb = m_dbThreshold + m_dbKnee;
-    float x = decibelsToLinear(xDb);
-
-    // Approximate k given initial values.
-    float minK = 0.1;
-    float maxK = 10000;
-    float k = 5;
-
-    for (int i = 0; i < 15; ++i) {
-        // A high value for k will more quickly asymptotically approach a slope of 0.
-        float slope = slopeAt(x, k);
-
-        if (slope < desiredSlope) {
-            // k is too high.
-            maxK = k;
-        } else {
-            // k is too low.
-            minK = k;
-        }
-
-        // Re-calculate based on geometric mean.
-        k = sqrtf(minK * maxK);
-    }
-
-    return k;
-}
-
-float DynamicsCompressorKernel::updateStaticCurveParameters(float dbThreshold, float dbKnee, float ratio)
-{
-    if (dbThreshold != m_dbThreshold || dbKnee != m_dbKnee || ratio != m_ratio) {
-        // Threshold and knee.
-        m_dbThreshold = dbThreshold;
-        m_linearThreshold = decibelsToLinear(dbThreshold);
-        m_dbKnee = dbKnee;
-
-        // Compute knee parameters.
-        m_ratio = ratio;
-        m_slope = 1 / m_ratio;
-
-        float k = kAtSlope(1 / m_ratio);
-
-        m_kneeThresholdDb = dbThreshold + dbKnee;
-        m_kneeThreshold = decibelsToLinear(m_kneeThresholdDb);
-
-        m_ykneeThresholdDb = linearToDecibels(kneeCurve(m_kneeThreshold, k));
-
-        m_K = k;
-    }
-    return m_K;
-}
-
-void DynamicsCompressorKernel::process(float* sourceChannels[],
-                                       float* destinationChannels[],
-                                       unsigned numberOfChannels,
-                                       unsigned framesToProcess,
-
-                                       float dbThreshold,
-                                       float dbKnee,
-                                       float ratio,
-                                       float attackTime,
-                                       float releaseTime,
-                                       float preDelayTime,
-                                       float dbPostGain,
-                                       float effectBlend, /* equal power crossfade */
-
-                                       float releaseZone1,
-                                       float releaseZone2,
-                                       float releaseZone3,
-                                       float releaseZone4
-                                       )
-{
-    ASSERT(m_preDelayBuffers.size() == numberOfChannels);
-
-    float sampleRate = this->sampleRate();
-
-    float dryMix = 1 - effectBlend;
-    float wetMix = effectBlend;
-
-    float k = updateStaticCurveParameters(dbThreshold, dbKnee, ratio);
-
-    // Makeup gain.
-    float fullRangeGain = saturate(1, k);
-    float fullRangeMakeupGain = 1 / fullRangeGain;
-
-    // Empirical/perceptual tuning.
-    fullRangeMakeupGain = powf(fullRangeMakeupGain, 0.6f);
-
-    float masterLinearGain = decibelsToLinear(dbPostGain) * fullRangeMakeupGain;
-
-    // Attack parameters.
-    attackTime = max(0.001f, attackTime);
-    float attackFrames = attackTime * sampleRate;
-
-    // Release parameters.
-    float releaseFrames = sampleRate * releaseTime;
-
-    // Detector release time.
-    float satReleaseTime = 0.0025f;
-    float satReleaseFrames = satReleaseTime * sampleRate;
-
-    // Create a smooth function which passes through four points.
-
-    // Polynomial of the form
-    // y = a + b*x + c*x^2 + d*x^3 + e*x^4;
-
-    float y1 = releaseFrames * releaseZone1;
-    float y2 = releaseFrames * releaseZone2;
-    float y3 = releaseFrames * releaseZone3;
-    float y4 = releaseFrames * releaseZone4;
-
-    // All of these coefficients were derived for 4th order polynomial curve fitting where the y values
-    // match the evenly spaced x values as follows: (y1 : x == 0, y2 : x == 1, y3 : x == 2, y4 : x == 3)
-    float kA = 0.9999999999999998f*y1 + 1.8432219684323923e-16f*y2 - 1.9373394351676423e-16f*y3 + 8.824516011816245e-18f*y4;
-    float kB = -1.5788320352845888f*y1 + 2.3305837032074286f*y2 - 0.9141194204840429f*y3 + 0.1623677525612032f*y4;
-    float kC = 0.5334142869106424f*y1 - 1.272736789213631f*y2 + 0.9258856042207512f*y3 - 0.18656310191776226f*y4;
-    float kD = 0.08783463138207234f*y1 - 0.1694162967925622f*y2 + 0.08588057951595272f*y3 - 0.00429891410546283f*y4;
-    float kE = -0.042416883008123074f*y1 + 0.1115693827987602f*y2 - 0.09764676325265872f*y3 + 0.028494263462021576f*y4;
-
-    // x ranges from 0 -> 3       0    1    2   3
-    //                           -15  -10  -5   0db
-
-    // y calculates adaptive release frames depending on the amount of compression.
-
-    setPreDelayTime(preDelayTime);
-
-    const int nDivisionFrames = 32;
-
-    const int nDivisions = framesToProcess / nDivisionFrames;
-
-    unsigned frameIndex = 0;
-    for (int i = 0; i < nDivisions; ++i) {
-        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-        // Calculate desired gain
-        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-        // Fix gremlins.
-        if (std::isnan(m_detectorAverage))
-            m_detectorAverage = 1;
-        if (std::isinf(m_detectorAverage))
-            m_detectorAverage = 1;
-
-        float desiredGain = m_detectorAverage;
-
-        // Pre-warp so we get desiredGain after sin() warp below.
-        float scaledDesiredGain = asinf(desiredGain) / (0.5f * piFloat);
-
-        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-        // Deal with envelopes
-        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-        // envelopeRate is the rate we slew from current compressor level to the desired level.
-        // The exact rate depends on if we're attacking or releasing and by how much.
-        float envelopeRate;
-
-        bool isReleasing = scaledDesiredGain > m_compressorGain;
-
-        // compressionDiffDb is the difference between current compression level and the desired level.
-        float compressionDiffDb = linearToDecibels(m_compressorGain / scaledDesiredGain);
-
-        if (isReleasing) {
-            // Release mode - compressionDiffDb should be negative dB
-            m_maxAttackCompressionDiffDb = -1;
-
-            // Fix gremlins.
-            if (std::isnan(compressionDiffDb))
-                compressionDiffDb = -1;
-            if (std::isinf(compressionDiffDb))
-                compressionDiffDb = -1;
-
-            // Adaptive release - higher compression (lower compressionDiffDb)  releases faster.
-
-            // Contain within range: -12 -> 0 then scale to go from 0 -> 3
-            float x = compressionDiffDb;
-            x = max(-12.0f, x);
-            x = min(0.0f, x);
-            x = 0.25f * (x + 12);
-
-            // Compute adaptive release curve using 4th order polynomial.
-            // Normal values for the polynomial coefficients would create a monotonically increasing function.
-            float x2 = x * x;
-            float x3 = x2 * x;
-            float x4 = x2 * x2;
-            float releaseFrames = kA + kB * x + kC * x2 + kD * x3 + kE * x4;
-
-#define kSpacingDb 5
-            float dbPerFrame = kSpacingDb / releaseFrames;
-
-            envelopeRate = decibelsToLinear(dbPerFrame);
-        } else {
-            // Attack mode - compressionDiffDb should be positive dB
-
-            // Fix gremlins.
-            if (std::isnan(compressionDiffDb))
-                compressionDiffDb = 1;
-            if (std::isinf(compressionDiffDb))
-                compressionDiffDb = 1;
-
-            // As long as we're still in attack mode, use a rate based off
-            // the largest compressionDiffDb we've encountered so far.
-            if (m_maxAttackCompressionDiffDb == -1 || m_maxAttackCompressionDiffDb < compressionDiffDb)
-                m_maxAttackCompressionDiffDb = compressionDiffDb;
-
-            float effAttenDiffDb = max(0.5f, m_maxAttackCompressionDiffDb);
-
-            float x = 0.25f / effAttenDiffDb;
-            envelopeRate = 1 - powf(x, 1 / attackFrames);
-        }
-
-        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-        // Inner loop - calculate shaped power average - apply compression.
-        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-        {
-            int preDelayReadIndex = m_preDelayReadIndex;
-            int preDelayWriteIndex = m_preDelayWriteIndex;
-            float detectorAverage = m_detectorAverage;
-            float compressorGain = m_compressorGain;
-
-            int loopFrames = nDivisionFrames;
-            while (loopFrames--) {
-                float compressorInput = 0;
-
-                // Predelay signal, computing compression amount from un-delayed version.
-                for (unsigned i = 0; i < numberOfChannels; ++i) {
-                    float* delayBuffer = m_preDelayBuffers[i]->data();
-                    float undelayedSource = sourceChannels[i][frameIndex];
-                    delayBuffer[preDelayWriteIndex] = undelayedSource;
-
-                    float absUndelayedSource = undelayedSource > 0 ? undelayedSource : -undelayedSource;
-                    if (compressorInput < absUndelayedSource)
-                        compressorInput = absUndelayedSource;
-                }
-
-                // Calculate shaped power on undelayed input.
-
-                float scaledInput = compressorInput;
-                float absInput = scaledInput > 0 ? scaledInput : -scaledInput;
-
-                // Put through shaping curve.
-                // This is linear up to the threshold, then enters a "knee" portion followed by the "ratio" portion.
-                // The transition from the threshold to the knee is smooth (1st derivative matched).
-                // The transition from the knee to the ratio portion is smooth (1st derivative matched).
-                float shapedInput = saturate(absInput, k);
-
-                float attenuation = absInput <= 0.0001f ? 1 : shapedInput / absInput;
-
-                float attenuationDb = -linearToDecibels(attenuation);
-                attenuationDb = max(2.0f, attenuationDb);
-
-                float dbPerFrame = attenuationDb / satReleaseFrames;
-
-                float satReleaseRate = decibelsToLinear(dbPerFrame) - 1;
-
-                bool isRelease = (attenuation > detectorAverage);
-                float rate = isRelease ? satReleaseRate : 1;
-
-                detectorAverage += (attenuation - detectorAverage) * rate;
-                detectorAverage = min(1.0f, detectorAverage);
-
-                // Fix gremlins.
-                if (std::isnan(detectorAverage))
-                    detectorAverage = 1;
-                if (std::isinf(detectorAverage))
-                    detectorAverage = 1;
-
-                // Exponential approach to desired gain.
-                if (envelopeRate < 1) {
-                    // Attack - reduce gain to desired.
-                    compressorGain += (scaledDesiredGain - compressorGain) * envelopeRate;
-                } else {
-                    // Release - exponentially increase gain to 1.0
-                    compressorGain *= envelopeRate;
-                    compressorGain = min(1.0f, compressorGain);
-                }
-
-                // Warp pre-compression gain to smooth out sharp exponential transition points.
-                float postWarpCompressorGain = sinf(0.5f * piFloat * compressorGain);
-
-                // Calculate total gain using master gain and effect blend.
-                float totalGain = dryMix + wetMix * masterLinearGain * postWarpCompressorGain;
-
-                // Calculate metering.
-                float dbRealGain = 20 * log10(postWarpCompressorGain);
-                if (dbRealGain < m_meteringGain)
-                    m_meteringGain = dbRealGain;
-                else
-                    m_meteringGain += (dbRealGain - m_meteringGain) * m_meteringReleaseK;
-
-                // Apply final gain.
-                for (unsigned i = 0; i < numberOfChannels; ++i) {
-                    float* delayBuffer = m_preDelayBuffers[i]->data();
-                    destinationChannels[i][frameIndex] = delayBuffer[preDelayReadIndex] * totalGain;
-                }
-
-                frameIndex++;
-                preDelayReadIndex = (preDelayReadIndex + 1) & MaxPreDelayFramesMask;
-                preDelayWriteIndex = (preDelayWriteIndex + 1) & MaxPreDelayFramesMask;
-            }
-
-            // Locals back to member variables.
-            m_preDelayReadIndex = preDelayReadIndex;
-            m_preDelayWriteIndex = preDelayWriteIndex;
-            m_detectorAverage = DenormalDisabler::flushDenormalFloatToZero(detectorAverage);
-            m_compressorGain = DenormalDisabler::flushDenormalFloatToZero(compressorGain);
-        }
-    }
-}
-
-void DynamicsCompressorKernel::reset()
-{
-    m_detectorAverage = 0;
-    m_compressorGain = 1;
-    m_meteringGain = 1;
-
-    // Predelay section.
-    for (unsigned i = 0; i < m_preDelayBuffers.size(); ++i)
-        m_preDelayBuffers[i]->zero();
-
-    m_preDelayReadIndex = 0;
-    m_preDelayWriteIndex = DefaultPreDelayFrames;
-
-    m_maxAttackCompressionDiffDb = -1; // uninitialized state
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/DynamicsCompressorKernel.h b/Source/core/platform/audio/DynamicsCompressorKernel.h
deleted file mode 100644
index f9e821b..0000000
--- a/Source/core/platform/audio/DynamicsCompressorKernel.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 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.
- *
- * 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 DynamicsCompressorKernel_h
-#define DynamicsCompressorKernel_h
-
-#include "core/platform/audio/AudioArray.h"
-
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebCore {
-
-class DynamicsCompressorKernel {
-public:
-    DynamicsCompressorKernel(float sampleRate, unsigned numberOfChannels);
-
-    void setNumberOfChannels(unsigned);
-
-    // Performs stereo-linked compression.
-    void process(float* sourceChannels[],
-                 float* destinationChannels[],
-                 unsigned numberOfChannels,
-                 unsigned framesToProcess,
-
-                 float dbThreshold,
-                 float dbKnee,
-                 float ratio,
-                 float attackTime,
-                 float releaseTime,
-                 float preDelayTime,
-                 float dbPostGain,
-                 float effectBlend,
-
-                 float releaseZone1,
-                 float releaseZone2,
-                 float releaseZone3,
-                 float releaseZone4
-                 );
-
-    void reset();
-
-    unsigned latencyFrames() const { return m_lastPreDelayFrames; }
-
-    float sampleRate() const { return m_sampleRate; }
-
-    float meteringGain() const { return m_meteringGain; }
-
-protected:
-    float m_sampleRate;
-
-    float m_detectorAverage;
-    float m_compressorGain;
-
-    // Metering
-    float m_meteringReleaseK;
-    float m_meteringGain;
-
-    // Lookahead section.
-    enum { MaxPreDelayFrames = 1024 };
-    enum { MaxPreDelayFramesMask = MaxPreDelayFrames - 1 };
-    enum { DefaultPreDelayFrames = 256 }; // setPreDelayTime() will override this initial value
-    unsigned m_lastPreDelayFrames;
-    void setPreDelayTime(float);
-
-    Vector<OwnPtr<AudioFloatArray> > m_preDelayBuffers;
-    int m_preDelayReadIndex;
-    int m_preDelayWriteIndex;
-
-    float m_maxAttackCompressionDiffDb;
-
-    // Static compression curve.
-    float kneeCurve(float x, float k);
-    float saturate(float x, float k);
-    float slopeAt(float x, float k);
-    float kAtSlope(float desiredSlope);
-
-    float updateStaticCurveParameters(float dbThreshold, float dbKnee, float ratio);
-
-    // Amount of input change in dB required for 1 dB of output change.
-    // This applies to the portion of the curve above m_kneeThresholdDb (see below).
-    float m_ratio;
-    float m_slope; // Inverse ratio.
-
-    // The input to output change below the threshold is linear 1:1.
-    float m_linearThreshold;
-    float m_dbThreshold;
-
-    // m_dbKnee is the number of dB above the threshold before we enter the "ratio" portion of the curve.
-    // m_kneeThresholdDb = m_dbThreshold + m_dbKnee
-    // The portion between m_dbThreshold and m_kneeThresholdDb is the "soft knee" portion of the curve
-    // which transitions smoothly from the linear portion to the ratio portion.
-    float m_dbKnee;
-    float m_kneeThreshold;
-    float m_kneeThresholdDb;
-    float m_ykneeThresholdDb;
-
-    // Internal parameter for the knee portion of the curve.
-    float m_K;
-};
-
-} // namespace WebCore
-
-#endif // DynamicsCompressorKernel_h
diff --git a/Source/core/platform/audio/EqualPowerPanner.cpp b/Source/core/platform/audio/EqualPowerPanner.cpp
deleted file mode 100644
index aed8f2f..0000000
--- a/Source/core/platform/audio/EqualPowerPanner.cpp
+++ /dev/null
@@ -1,159 +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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/EqualPowerPanner.h"
-
-#include <algorithm>
-#include "core/platform/audio/AudioBus.h"
-#include "core/platform/audio/AudioUtilities.h"
-#include "wtf/MathExtras.h"
-
-// Use a 50ms smoothing / de-zippering time-constant.
-const float SmoothingTimeConstant = 0.050f;
-
-using namespace std;
-
-namespace WebCore {
-
-EqualPowerPanner::EqualPowerPanner(float sampleRate)
-    : Panner(PanningModelEqualPower)
-    , m_isFirstRender(true)
-    , m_gainL(0.0)
-    , m_gainR(0.0)
-{
-    m_smoothingConstant = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, sampleRate);
-}
-
-void EqualPowerPanner::pan(double azimuth, double /*elevation*/, const AudioBus* inputBus, AudioBus* outputBus, size_t framesToProcess)
-{
-    bool isInputSafe = inputBus && (inputBus->numberOfChannels() == 1 || inputBus->numberOfChannels() == 2) && framesToProcess <= inputBus->length();
-    ASSERT(isInputSafe);
-    if (!isInputSafe)
-        return;
-
-    unsigned numberOfInputChannels = inputBus->numberOfChannels();
-
-    bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 && framesToProcess <= outputBus->length();
-    ASSERT(isOutputSafe);
-    if (!isOutputSafe)
-        return;
-
-    const float* sourceL = inputBus->channel(0)->data();
-    const float* sourceR = numberOfInputChannels > 1 ? inputBus->channel(1)->data() : sourceL;
-    float* destinationL = outputBus->channelByType(AudioBus::ChannelLeft)->mutableData();
-    float* destinationR = outputBus->channelByType(AudioBus::ChannelRight)->mutableData();
-
-    if (!sourceL || !sourceR || !destinationL || !destinationR)
-        return;
-
-    // Clamp azimuth to allowed range of -180 -> +180.
-    azimuth = max(-180.0, azimuth);
-    azimuth = min(180.0, azimuth);
-
-    // Alias the azimuth ranges behind us to in front of us:
-    // -90 -> -180 to -90 -> 0 and 90 -> 180 to 90 -> 0
-    if (azimuth < -90)
-        azimuth = -180 - azimuth;
-    else if (azimuth > 90)
-        azimuth = 180 - azimuth;
-
-    double desiredPanPosition;
-    double desiredGainL;
-    double desiredGainR;
-
-    if (numberOfInputChannels == 1) { // For mono source case.
-        // Pan smoothly from left to right with azimuth going from -90 -> +90 degrees.
-        desiredPanPosition = (azimuth + 90) / 180;
-    } else { // For stereo source case.
-        if (azimuth <= 0) { // from -90 -> 0
-            // sourceL -> destL and "equal-power pan" sourceR as in mono case
-            // by transforming the "azimuth" value from -90 -> 0 degrees into the range -90 -> +90.
-            desiredPanPosition = (azimuth + 90) / 90;
-        } else { // from 0 -> +90
-            // sourceR -> destR and "equal-power pan" sourceL as in mono case
-            // by transforming the "azimuth" value from 0 -> +90 degrees into the range -90 -> +90.
-            desiredPanPosition = azimuth / 90;
-        }
-    }
-
-    desiredGainL = cos(0.5 * piDouble * desiredPanPosition);
-    desiredGainR = sin(0.5 * piDouble * desiredPanPosition);
-
-    // Don't de-zipper on first render call.
-    if (m_isFirstRender) {
-        m_isFirstRender = false;
-        m_gainL = desiredGainL;
-        m_gainR = desiredGainR;
-    }
-
-    // Cache in local variables.
-    double gainL = m_gainL;
-    double gainR = m_gainR;
-
-    // Get local copy of smoothing constant.
-    const double SmoothingConstant = m_smoothingConstant;
-
-    int n = framesToProcess;
-
-    if (numberOfInputChannels == 1) { // For mono source case.
-        while (n--) {
-            float inputL = *sourceL++;
-            gainL += (desiredGainL - gainL) * SmoothingConstant;
-            gainR += (desiredGainR - gainR) * SmoothingConstant;
-            *destinationL++ = static_cast<float>(inputL * gainL);
-            *destinationR++ = static_cast<float>(inputL * gainR);
-        }
-    } else { // For stereo source case.
-        if (azimuth <= 0) { // from -90 -> 0
-            while (n--) {
-                float inputL = *sourceL++;
-                float inputR = *sourceR++;
-                gainL += (desiredGainL - gainL) * SmoothingConstant;
-                gainR += (desiredGainR - gainR) * SmoothingConstant;
-                *destinationL++ = static_cast<float>(inputL + inputR * gainL);
-                *destinationR++ = static_cast<float>(inputR * gainR);
-            }
-        } else { // from 0 -> +90
-            while (n--) {
-                float inputL = *sourceL++;
-                float inputR = *sourceR++;
-                gainL += (desiredGainL - gainL) * SmoothingConstant;
-                gainR += (desiredGainR - gainR) * SmoothingConstant;
-                *destinationL++ = static_cast<float>(inputL * gainL);
-                *destinationR++ = static_cast<float>(inputR + inputL * gainR);
-            }
-        }
-    }
-
-    m_gainL = gainL;
-    m_gainR = gainR;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/EqualPowerPanner.h b/Source/core/platform/audio/EqualPowerPanner.h
deleted file mode 100644
index ebdd9f9..0000000
--- a/Source/core/platform/audio/EqualPowerPanner.h
+++ /dev/null
@@ -1,56 +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 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 EqualPowerPanner_h
-#define EqualPowerPanner_h
-
-#include "core/platform/audio/Panner.h"
-
-namespace WebCore {
-
-// Common type of stereo panner as found in normal audio mixing equipment.
-
-class EqualPowerPanner : public Panner {
-public:
-    EqualPowerPanner(float sampleRate);
-
-    virtual void pan(double azimuth, double elevation, const AudioBus* inputBus, AudioBus* outputBuf, size_t framesToProcess);
-
-    virtual void reset() { m_isFirstRender = true; }
-
-    virtual double tailTime() const OVERRIDE { return 0; }
-    virtual double latencyTime() const OVERRIDE { return 0; }
-
-private:
-    // For smoothing / de-zippering
-    bool m_isFirstRender;
-    double m_smoothingConstant;
-
-    double m_gainL;
-    double m_gainR;
-};
-
-} // namespace WebCore
-
-#endif // EqualPowerPanner_h
diff --git a/Source/core/platform/audio/FFTConvolver.cpp b/Source/core/platform/audio/FFTConvolver.cpp
deleted file mode 100644
index ed62abc..0000000
--- a/Source/core/platform/audio/FFTConvolver.cpp
+++ /dev/null
@@ -1,120 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/FFTConvolver.h"
-
-#include "core/platform/audio/VectorMath.h"
-
-namespace WebCore {
-
-using namespace VectorMath;
-
-FFTConvolver::FFTConvolver(size_t fftSize)
-    : m_frame(fftSize)
-    , m_readWriteIndex(0)
-    , m_inputBuffer(fftSize) // 2nd half of buffer is always zeroed
-    , m_outputBuffer(fftSize)
-    , m_lastOverlapBuffer(fftSize / 2)
-{
-}
-
-void FFTConvolver::process(FFTFrame* fftKernel, const float* sourceP, float* destP, size_t framesToProcess)
-{
-    size_t halfSize = fftSize() / 2;
-
-    // framesToProcess must be an exact multiple of halfSize,
-    // or halfSize is a multiple of framesToProcess when halfSize > framesToProcess.
-    bool isGood = !(halfSize % framesToProcess && framesToProcess % halfSize);
-    ASSERT(isGood);
-    if (!isGood)
-        return;
-
-    size_t numberOfDivisions = halfSize <= framesToProcess ? (framesToProcess / halfSize) : 1;
-    size_t divisionSize = numberOfDivisions == 1 ? framesToProcess : halfSize;
-
-    for (size_t i = 0; i < numberOfDivisions; ++i, sourceP += divisionSize, destP += divisionSize) {
-        // Copy samples to input buffer (note contraint above!)
-        float* inputP = m_inputBuffer.data();
-
-        // Sanity check
-        bool isCopyGood1 = sourceP && inputP && m_readWriteIndex + divisionSize <= m_inputBuffer.size();
-        ASSERT(isCopyGood1);
-        if (!isCopyGood1)
-            return;
-
-        memcpy(inputP + m_readWriteIndex, sourceP, sizeof(float) * divisionSize);
-
-        // Copy samples from output buffer
-        float* outputP = m_outputBuffer.data();
-
-        // Sanity check
-        bool isCopyGood2 = destP && outputP && m_readWriteIndex + divisionSize <= m_outputBuffer.size();
-        ASSERT(isCopyGood2);
-        if (!isCopyGood2)
-            return;
-
-        memcpy(destP, outputP + m_readWriteIndex, sizeof(float) * divisionSize);
-        m_readWriteIndex += divisionSize;
-
-        // Check if it's time to perform the next FFT
-        if (m_readWriteIndex == halfSize) {
-            // The input buffer is now filled (get frequency-domain version)
-            m_frame.doFFT(m_inputBuffer.data());
-            m_frame.multiply(*fftKernel);
-            m_frame.doInverseFFT(m_outputBuffer.data());
-
-            // Overlap-add 1st half from previous time
-            vadd(m_outputBuffer.data(), 1, m_lastOverlapBuffer.data(), 1, m_outputBuffer.data(), 1, halfSize);
-
-            // Finally, save 2nd half of result
-            bool isCopyGood3 = m_outputBuffer.size() == 2 * halfSize && m_lastOverlapBuffer.size() == halfSize;
-            ASSERT(isCopyGood3);
-            if (!isCopyGood3)
-                return;
-
-            memcpy(m_lastOverlapBuffer.data(), m_outputBuffer.data() + halfSize, sizeof(float) * halfSize);
-
-            // Reset index back to start for next time
-            m_readWriteIndex = 0;
-        }
-    }
-}
-
-void FFTConvolver::reset()
-{
-    m_lastOverlapBuffer.zero();
-    m_readWriteIndex = 0;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/FFTConvolver.h b/Source/core/platform/audio/FFTConvolver.h
deleted file mode 100644
index 73f6e58..0000000
--- a/Source/core/platform/audio/FFTConvolver.h
+++ /dev/null
@@ -1,71 +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.
- * 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.
- *
- * 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 FFTConvolver_h
-#define FFTConvolver_h
-
-#include "core/platform/audio/AudioArray.h"
-#include "core/platform/audio/FFTFrame.h"
-
-namespace WebCore {
-
-class FFTConvolver {
-public:
-    // fftSize must be a power of two
-    FFTConvolver(size_t fftSize);
-
-    // For now, with multiple calls to Process(), framesToProcess MUST add up EXACTLY to fftSize / 2
-    //
-    // FIXME: Later, we can do more sophisticated buffering to relax this requirement...
-    //
-    // The input to output latency is equal to fftSize / 2
-    //
-    // Processing in-place is allowed...
-    void process(FFTFrame* fftKernel, const float* sourceP, float* destP, size_t framesToProcess);
-
-    void reset();
-
-    size_t fftSize() const { return m_frame.fftSize(); }
-
-private:
-    FFTFrame m_frame;
-
-    // Buffer input until we get fftSize / 2 samples then do an FFT
-    size_t m_readWriteIndex;
-    AudioFloatArray m_inputBuffer;
-
-    // Stores output which we read a little at a time
-    AudioFloatArray m_outputBuffer;
-
-    // Saves the 2nd half of the FFT buffer, so we can do an overlap-add with the 1st half of the next one
-    AudioFloatArray m_lastOverlapBuffer;
-};
-
-} // namespace WebCore
-
-#endif // FFTConvolver_h
diff --git a/Source/core/platform/audio/FFTFrame.cpp b/Source/core/platform/audio/FFTFrame.cpp
deleted file mode 100644
index 1bd5a63..0000000
--- a/Source/core/platform/audio/FFTFrame.cpp
+++ /dev/null
@@ -1,274 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/FFTFrame.h"
-
-#ifndef NDEBUG
-#include <stdio.h>
-#endif
-
-#include "core/platform/Logging.h"
-#include "wtf/Complex.h"
-#include "wtf/MathExtras.h"
-#include "wtf/OwnPtr.h"
-
-namespace WebCore {
-
-void FFTFrame::doPaddedFFT(const float* data, size_t dataSize)
-{
-    // Zero-pad the impulse response
-    AudioFloatArray paddedResponse(fftSize()); // zero-initialized
-    paddedResponse.copyToRange(data, 0, dataSize);
-
-    // Get the frequency-domain version of padded response
-    doFFT(paddedResponse.data());
-}
-
-PassOwnPtr<FFTFrame> FFTFrame::createInterpolatedFrame(const FFTFrame& frame1, const FFTFrame& frame2, double x)
-{
-    OwnPtr<FFTFrame> newFrame = adoptPtr(new FFTFrame(frame1.fftSize()));
-
-    newFrame->interpolateFrequencyComponents(frame1, frame2, x);
-
-    // In the time-domain, the 2nd half of the response must be zero, to avoid circular convolution aliasing...
-    int fftSize = newFrame->fftSize();
-    AudioFloatArray buffer(fftSize);
-    newFrame->doInverseFFT(buffer.data());
-    buffer.zeroRange(fftSize / 2, fftSize);
-
-    // Put back into frequency domain.
-    newFrame->doFFT(buffer.data());
-
-    return newFrame.release();
-}
-
-void FFTFrame::interpolateFrequencyComponents(const FFTFrame& frame1, const FFTFrame& frame2, double interp)
-{
-    // FIXME : with some work, this method could be optimized
-
-    float* realP = realData();
-    float* imagP = imagData();
-
-    const float* realP1 = frame1.realData();
-    const float* imagP1 = frame1.imagData();
-    const float* realP2 = frame2.realData();
-    const float* imagP2 = frame2.imagData();
-
-    m_FFTSize = frame1.fftSize();
-    m_log2FFTSize = frame1.log2FFTSize();
-
-    double s1base = (1.0 - interp);
-    double s2base = interp;
-
-    double phaseAccum = 0.0;
-    double lastPhase1 = 0.0;
-    double lastPhase2 = 0.0;
-
-    realP[0] = static_cast<float>(s1base * realP1[0] + s2base * realP2[0]);
-    imagP[0] = static_cast<float>(s1base * imagP1[0] + s2base * imagP2[0]);
-
-    int n = m_FFTSize / 2;
-
-    for (int i = 1; i < n; ++i) {
-        Complex c1(realP1[i], imagP1[i]);
-        Complex c2(realP2[i], imagP2[i]);
-
-        double mag1 = abs(c1);
-        double mag2 = abs(c2);
-
-        // Interpolate magnitudes in decibels
-        double mag1db = 20.0 * log10(mag1);
-        double mag2db = 20.0 * log10(mag2);
-
-        double s1 = s1base;
-        double s2 = s2base;
-
-        double magdbdiff = mag1db - mag2db;
-
-        // Empirical tweak to retain higher-frequency zeroes
-        double threshold =  (i > 16) ? 5.0 : 2.0;
-
-        if (magdbdiff < -threshold && mag1db < 0.0) {
-            s1 = pow(s1, 0.75);
-            s2 = 1.0 - s1;
-        } else if (magdbdiff > threshold && mag2db < 0.0) {
-            s2 = pow(s2, 0.75);
-            s1 = 1.0 - s2;
-        }
-
-        // Average magnitude by decibels instead of linearly
-        double magdb = s1 * mag1db + s2 * mag2db;
-        double mag = pow(10.0, 0.05 * magdb);
-
-        // Now, deal with phase
-        double phase1 = arg(c1);
-        double phase2 = arg(c2);
-
-        double deltaPhase1 = phase1 - lastPhase1;
-        double deltaPhase2 = phase2 - lastPhase2;
-        lastPhase1 = phase1;
-        lastPhase2 = phase2;
-
-        // Unwrap phase deltas
-        if (deltaPhase1 > piDouble)
-            deltaPhase1 -= 2.0 * piDouble;
-        if (deltaPhase1 < -piDouble)
-            deltaPhase1 += 2.0 * piDouble;
-        if (deltaPhase2 > piDouble)
-            deltaPhase2 -= 2.0 * piDouble;
-        if (deltaPhase2 < -piDouble)
-            deltaPhase2 += 2.0 * piDouble;
-
-        // Blend group-delays
-        double deltaPhaseBlend;
-
-        if (deltaPhase1 - deltaPhase2 > piDouble)
-            deltaPhaseBlend = s1 * deltaPhase1 + s2 * (2.0 * piDouble + deltaPhase2);
-        else if (deltaPhase2 - deltaPhase1 > piDouble)
-            deltaPhaseBlend = s1 * (2.0 * piDouble + deltaPhase1) + s2 * deltaPhase2;
-        else
-            deltaPhaseBlend = s1 * deltaPhase1 + s2 * deltaPhase2;
-
-        phaseAccum += deltaPhaseBlend;
-
-        // Unwrap
-        if (phaseAccum > piDouble)
-            phaseAccum -= 2.0 * piDouble;
-        if (phaseAccum < -piDouble)
-            phaseAccum += 2.0 * piDouble;
-
-        Complex c = complexFromMagnitudePhase(mag, phaseAccum);
-
-        realP[i] = static_cast<float>(c.real());
-        imagP[i] = static_cast<float>(c.imag());
-    }
-}
-
-double FFTFrame::extractAverageGroupDelay()
-{
-    float* realP = realData();
-    float* imagP = imagData();
-
-    double aveSum = 0.0;
-    double weightSum = 0.0;
-    double lastPhase = 0.0;
-
-    int halfSize = fftSize() / 2;
-
-    const double kSamplePhaseDelay = (2.0 * piDouble) / double(fftSize());
-
-    // Calculate weighted average group delay
-    for (int i = 0; i < halfSize; i++) {
-        Complex c(realP[i], imagP[i]);
-        double mag = abs(c);
-        double phase = arg(c);
-
-        double deltaPhase = phase - lastPhase;
-        lastPhase = phase;
-
-        // Unwrap
-        if (deltaPhase < -piDouble)
-            deltaPhase += 2.0 * piDouble;
-        if (deltaPhase > piDouble)
-            deltaPhase -= 2.0 * piDouble;
-
-        aveSum += mag * deltaPhase;
-        weightSum += mag;
-    }
-
-    // Note how we invert the phase delta wrt frequency since this is how group delay is defined
-    double ave = aveSum / weightSum;
-    double aveSampleDelay = -ave / kSamplePhaseDelay;
-
-    // Leave 20 sample headroom (for leading edge of impulse)
-    if (aveSampleDelay > 20.0)
-        aveSampleDelay -= 20.0;
-
-    // Remove average group delay (minus 20 samples for headroom)
-    addConstantGroupDelay(-aveSampleDelay);
-
-    // Remove DC offset
-    realP[0] = 0.0f;
-
-    return aveSampleDelay;
-}
-
-void FFTFrame::addConstantGroupDelay(double sampleFrameDelay)
-{
-    int halfSize = fftSize() / 2;
-
-    float* realP = realData();
-    float* imagP = imagData();
-
-    const double kSamplePhaseDelay = (2.0 * piDouble) / double(fftSize());
-
-    double phaseAdj = -sampleFrameDelay * kSamplePhaseDelay;
-
-    // Add constant group delay
-    for (int i = 1; i < halfSize; i++) {
-        Complex c(realP[i], imagP[i]);
-        double mag = abs(c);
-        double phase = arg(c);
-
-        phase += i * phaseAdj;
-
-        Complex c2 = complexFromMagnitudePhase(mag, phase);
-
-        realP[i] = static_cast<float>(c2.real());
-        imagP[i] = static_cast<float>(c2.imag());
-    }
-}
-
-#ifndef NDEBUG
-void FFTFrame::print()
-{
-    FFTFrame& frame = *this;
-    float* realP = frame.realData();
-    float* imagP = frame.imagData();
-    LOG(WebAudio, "**** \n");
-    LOG(WebAudio, "DC = %f : nyquist = %f\n", realP[0], imagP[0]);
-
-    int n = m_FFTSize / 2;
-
-    for (int i = 1; i < n; i++) {
-        double mag = sqrt(realP[i] * realP[i] + imagP[i] * imagP[i]);
-        double phase = atan2(realP[i], imagP[i]);
-
-        LOG(WebAudio, "[%d] (%f %f)\n", i, mag, phase);
-    }
-    LOG(WebAudio, "****\n");
-}
-#endif // NDEBUG
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/FFTFrame.h b/Source/core/platform/audio/FFTFrame.h
deleted file mode 100644
index 38f9016..0000000
--- a/Source/core/platform/audio/FFTFrame.h
+++ /dev/null
@@ -1,159 +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.
- * 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.
- *
- * 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 FFTFrame_h
-#define FFTFrame_h
-
-#include "core/platform/audio/AudioArray.h"
-
-#if OS(MACOSX) && !USE(WEBAUDIO_FFMPEG)
-#define USE_ACCELERATE_FFT 1
-#else
-#define USE_ACCELERATE_FFT 0
-#endif
-
-#if USE_ACCELERATE_FFT
-#include <Accelerate/Accelerate.h>
-#endif
-
-#if !USE_ACCELERATE_FFT
-
-#if USE(WEBAUDIO_OPENMAX_DL_FFT)
-#include "dl/sp/api/omxSP.h"
-#elif USE(WEBAUDIO_FFMPEG)
-struct RDFTContext;
-#endif
-
-#endif // !USE_ACCELERATE_FFT
-
-#if USE(WEBAUDIO_IPP)
-#include <ipps.h>
-#endif // USE(WEBAUDIO_IPP)
-
-#include "wtf/Forward.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/Threading.h"
-
-namespace WebCore {
-
-// Defines the interface for an "FFT frame", an object which is able to perform a forward
-// and reverse FFT, internally storing the resultant frequency-domain data.
-
-class FFTFrame {
-public:
-    // The constructors, destructor, and methods up to the CROSS-PLATFORM section have platform-dependent implementations.
-
-    FFTFrame(unsigned fftSize);
-    FFTFrame(); // creates a blank/empty frame for later use with createInterpolatedFrame()
-    FFTFrame(const FFTFrame& frame);
-    ~FFTFrame();
-
-    static void initialize();
-    static void cleanup();
-    void doFFT(const float* data);
-    void doInverseFFT(float* data);
-    void multiply(const FFTFrame& frame); // multiplies ourself with frame : effectively operator*=()
-
-    float* realData() const;
-    float* imagData() const;
-
-    void print(); // for debugging
-
-    // CROSS-PLATFORM
-    // The remaining public methods have cross-platform implementations:
-
-    // Interpolates from frame1 -> frame2 as x goes from 0.0 -> 1.0
-    static PassOwnPtr<FFTFrame> createInterpolatedFrame(const FFTFrame& frame1, const FFTFrame& frame2, double x);
-
-    void doPaddedFFT(const float* data, size_t dataSize); // zero-padding with dataSize <= fftSize
-    double extractAverageGroupDelay();
-    void addConstantGroupDelay(double sampleFrameDelay);
-
-    unsigned fftSize() const { return m_FFTSize; }
-    unsigned log2FFTSize() const { return m_log2FFTSize; }
-
-private:
-    unsigned m_FFTSize;
-    unsigned m_log2FFTSize;
-
-    void interpolateFrequencyComponents(const FFTFrame& frame1, const FFTFrame& frame2, double x);
-
-#if USE_ACCELERATE_FFT
-    DSPSplitComplex& dspSplitComplex() { return m_frame; }
-    DSPSplitComplex dspSplitComplex() const { return m_frame; }
-
-    static FFTSetup fftSetupForSize(unsigned fftSize);
-
-    static FFTSetup* fftSetups;
-
-    FFTSetup m_FFTSetup;
-
-    DSPSplitComplex m_frame;
-    AudioFloatArray m_realData;
-    AudioFloatArray m_imagData;
-#else // !USE_ACCELERATE_FFT
-
-#if USE(WEBAUDIO_FFMPEG)
-    static RDFTContext* contextForSize(unsigned fftSize, int trans);
-
-    RDFTContext* m_forwardContext;
-    RDFTContext* m_inverseContext;
-
-    float* getUpToDateComplexData();
-    AudioFloatArray m_complexData;
-    AudioFloatArray m_realData;
-    AudioFloatArray m_imagData;
-#endif // USE(WEBAUDIO_FFMPEG)
-
-#if USE(WEBAUDIO_IPP)
-    Ipp8u* m_buffer;
-    IppsDFTSpec_R_32f* m_DFTSpec;
-
-    float* getUpToDateComplexData();
-    AudioFloatArray m_complexData;
-    AudioFloatArray m_realData;
-    AudioFloatArray m_imagData;
-#endif // USE(WEBAUDIO_IPP)
-
-#if USE(WEBAUDIO_OPENMAX_DL_FFT)
-    static OMXFFTSpec_R_F32* contextForSize(unsigned log2FFTSize);
-
-    OMXFFTSpec_R_F32* m_forwardContext;
-    OMXFFTSpec_R_F32* m_inverseContext;
-
-    AudioFloatArray m_complexData;
-    AudioFloatArray m_realData;
-    AudioFloatArray m_imagData;
-#endif
-
-#endif // !USE_ACCELERATE_FFT
-};
-
-} // namespace WebCore
-
-#endif // FFTFrame_h
diff --git a/Source/core/platform/audio/FFTFrameStub.cpp b/Source/core/platform/audio/FFTFrameStub.cpp
deleted file mode 100644
index 6a0f887..0000000
--- a/Source/core/platform/audio/FFTFrameStub.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 stub implementation to avoid link errors during bringup
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#if !OS(MACOSX) && !USE(WEBAUDIO_FFMPEG) && !USE(WEBAUDIO_IPP) && !USE(WEBAUDIO_OPENMAX_DL_FFT)
-
-#include "core/platform/audio/FFTFrame.h"
-
-namespace WebCore {
-
-// Normal constructor: allocates for a given fftSize.
-FFTFrame::FFTFrame(unsigned /*fftSize*/)
-    : m_FFTSize(0)
-    , m_log2FFTSize(0)
-{
-    ASSERT_NOT_REACHED();
-}
-
-// Creates a blank/empty frame (interpolate() must later be called).
-FFTFrame::FFTFrame()
-    : m_FFTSize(0)
-    , m_log2FFTSize(0)
-{
-    ASSERT_NOT_REACHED();
-}
-
-// Copy constructor.
-FFTFrame::FFTFrame(const FFTFrame& frame)
-    : m_FFTSize(frame.m_FFTSize)
-    , m_log2FFTSize(frame.m_log2FFTSize)
-{
-    ASSERT_NOT_REACHED();
-}
-
-FFTFrame::~FFTFrame()
-{
-    ASSERT_NOT_REACHED();
-}
-
-void FFTFrame::multiply(const FFTFrame& frame)
-{
-    ASSERT_NOT_REACHED();
-}
-
-void FFTFrame::doFFT(const float* data)
-{
-    ASSERT_NOT_REACHED();
-}
-
-void FFTFrame::doInverseFFT(float* data)
-{
-    ASSERT_NOT_REACHED();
-}
-
-void FFTFrame::initialize()
-{
-}
-
-void FFTFrame::cleanup()
-{
-    ASSERT_NOT_REACHED();
-}
-
-float* FFTFrame::realData() const
-{
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-float* FFTFrame::imagData() const
-{
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-} // namespace WebCore
-
-#endif // !OS(MACOSX) && !USE(WEBAUDIO_FFMPEG) && !USE(WEBAUDIO_IPP) && !USE(WEBAUDIO_OPENMAX_DL_FFT)
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/HRTFDatabase.cpp b/Source/core/platform/audio/HRTFDatabase.cpp
deleted file mode 100644
index 9980211..0000000
--- a/Source/core/platform/audio/HRTFDatabase.cpp
+++ /dev/null
@@ -1,124 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/HRTFDatabase.h"
-
-#include "core/platform/audio/HRTFElevation.h"
-
-using namespace std;
-
-namespace WebCore {
-
-const int HRTFDatabase::MinElevation = -45;
-const int HRTFDatabase::MaxElevation = 90;
-const unsigned HRTFDatabase::RawElevationAngleSpacing = 15;
-const unsigned HRTFDatabase::NumberOfRawElevations = 10; // -45 -> +90 (each 15 degrees)
-const unsigned HRTFDatabase::InterpolationFactor = 1;
-const unsigned HRTFDatabase::NumberOfTotalElevations = NumberOfRawElevations * InterpolationFactor;
-
-PassOwnPtr<HRTFDatabase> HRTFDatabase::create(float sampleRate)
-{
-    OwnPtr<HRTFDatabase> hrtfDatabase = adoptPtr(new HRTFDatabase(sampleRate));
-    return hrtfDatabase.release();
-}
-
-HRTFDatabase::HRTFDatabase(float sampleRate)
-    : m_elevations(NumberOfTotalElevations)
-    , m_sampleRate(sampleRate)
-{
-    unsigned elevationIndex = 0;
-    for (int elevation = MinElevation; elevation <= MaxElevation; elevation += RawElevationAngleSpacing) {
-        OwnPtr<HRTFElevation> hrtfElevation = HRTFElevation::createForSubject("Composite", elevation, sampleRate);
-        ASSERT(hrtfElevation.get());
-        if (!hrtfElevation.get())
-            return;
-
-        m_elevations[elevationIndex] = hrtfElevation.release();
-        elevationIndex += InterpolationFactor;
-    }
-
-    // Now, go back and interpolate elevations.
-    if (InterpolationFactor > 1) {
-        for (unsigned i = 0; i < NumberOfTotalElevations; i += InterpolationFactor) {
-            unsigned j = (i + InterpolationFactor);
-            if (j >= NumberOfTotalElevations)
-                j = i; // for last elevation interpolate with itself
-
-            // Create the interpolated convolution kernels and delays.
-            for (unsigned jj = 1; jj < InterpolationFactor; ++jj) {
-                float x = static_cast<float>(jj) / static_cast<float>(InterpolationFactor);
-                m_elevations[i + jj] = HRTFElevation::createByInterpolatingSlices(m_elevations[i].get(), m_elevations[j].get(), x, sampleRate);
-                ASSERT(m_elevations[i + jj].get());
-            }
-        }
-    }
-}
-
-void HRTFDatabase::getKernelsFromAzimuthElevation(double azimuthBlend, unsigned azimuthIndex, double elevationAngle, HRTFKernel* &kernelL, HRTFKernel* &kernelR,
-                                                  double& frameDelayL, double& frameDelayR)
-{
-    unsigned elevationIndex = indexFromElevationAngle(elevationAngle);
-    ASSERT_WITH_SECURITY_IMPLICATION(elevationIndex < m_elevations.size() && m_elevations.size() > 0);
-
-    if (!m_elevations.size()) {
-        kernelL = 0;
-        kernelR = 0;
-        return;
-    }
-
-    if (elevationIndex > m_elevations.size() - 1)
-        elevationIndex = m_elevations.size() - 1;
-
-    HRTFElevation* hrtfElevation = m_elevations[elevationIndex].get();
-    ASSERT(hrtfElevation);
-    if (!hrtfElevation) {
-        kernelL = 0;
-        kernelR = 0;
-        return;
-    }
-
-    hrtfElevation->getKernelsFromAzimuth(azimuthBlend, azimuthIndex, kernelL, kernelR, frameDelayL, frameDelayR);
-}
-
-unsigned HRTFDatabase::indexFromElevationAngle(double elevationAngle)
-{
-    // Clamp to allowed range.
-    elevationAngle = max(static_cast<double>(MinElevation), elevationAngle);
-    elevationAngle = min(static_cast<double>(MaxElevation), elevationAngle);
-
-    unsigned elevationIndex = static_cast<int>(InterpolationFactor * (elevationAngle - MinElevation) / RawElevationAngleSpacing);
-    return elevationIndex;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/HRTFDatabase.h b/Source/core/platform/audio/HRTFDatabase.h
deleted file mode 100644
index 30c2c26..0000000
--- a/Source/core/platform/audio/HRTFDatabase.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:
- *
- * 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.
- * 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.
- *
- * 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 HRTFDatabase_h
-#define HRTFDatabase_h
-
-#include "core/platform/audio/HRTFElevation.h"
-#include "wtf/Forward.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class HRTFKernel;
-
-class HRTFDatabase {
-    WTF_MAKE_NONCOPYABLE(HRTFDatabase);
-public:
-    static PassOwnPtr<HRTFDatabase> create(float sampleRate);
-
-    // getKernelsFromAzimuthElevation() returns a left and right ear kernel, and an interpolated left and right frame delay for the given azimuth and elevation.
-    // azimuthBlend must be in the range 0 -> 1.
-    // Valid values for azimuthIndex are 0 -> HRTFElevation::NumberOfTotalAzimuths - 1 (corresponding to angles of 0 -> 360).
-    // Valid values for elevationAngle are MinElevation -> MaxElevation.
-    void getKernelsFromAzimuthElevation(double azimuthBlend, unsigned azimuthIndex, double elevationAngle, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& frameDelayL, double& frameDelayR);
-
-    // Returns the number of different azimuth angles.
-    static unsigned numberOfAzimuths() { return HRTFElevation::NumberOfTotalAzimuths; }
-
-    float sampleRate() const { return m_sampleRate; }
-
-    // Number of elevations loaded from resource.
-    static const unsigned NumberOfRawElevations;
-
-private:
-    explicit HRTFDatabase(float sampleRate);
-
-    // Minimum and maximum elevation angles (inclusive) for a HRTFDatabase.
-    static const int MinElevation;
-    static const int MaxElevation;
-    static const unsigned RawElevationAngleSpacing;
-
-    // Interpolates by this factor to get the total number of elevations from every elevation loaded from resource.
-    static const unsigned InterpolationFactor;
-
-    // Total number of elevations after interpolation.
-    static const unsigned NumberOfTotalElevations;
-
-    // Returns the index for the correct HRTFElevation given the elevation angle.
-    static unsigned indexFromElevationAngle(double);
-
-    Vector<OwnPtr<HRTFElevation> > m_elevations;
-    float m_sampleRate;
-};
-
-} // namespace WebCore
-
-#endif // HRTFDatabase_h
diff --git a/Source/core/platform/audio/HRTFDatabaseLoader.cpp b/Source/core/platform/audio/HRTFDatabaseLoader.cpp
deleted file mode 100644
index 47219ec..0000000
--- a/Source/core/platform/audio/HRTFDatabaseLoader.cpp
+++ /dev/null
@@ -1,131 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/HRTFDatabaseLoader.h"
-
-#include "core/platform/audio/HRTFDatabase.h"
-#include "wtf/MainThread.h"
-
-namespace WebCore {
-
-// Singleton
-HRTFDatabaseLoader::LoaderMap* HRTFDatabaseLoader::s_loaderMap = 0;
-
-PassRefPtr<HRTFDatabaseLoader> HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(float sampleRate)
-{
-    ASSERT(isMainThread());
-
-    RefPtr<HRTFDatabaseLoader> 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;
-}
-
-HRTFDatabaseLoader::HRTFDatabaseLoader(float sampleRate)
-    : m_databaseLoaderThread(0)
-    , m_databaseSampleRate(sampleRate)
-{
-    ASSERT(isMainThread());
-}
-
-HRTFDatabaseLoader::~HRTFDatabaseLoader()
-{
-    ASSERT(isMainThread());
-
-    waitForLoaderThreadCompletion();
-    m_hrtfDatabase.clear();
-
-    // 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)
-{
-    HRTFDatabaseLoader* loader = reinterpret_cast<HRTFDatabaseLoader*>(threadData);
-    ASSERT(loader);
-    loader->load();
-}
-
-void HRTFDatabaseLoader::load()
-{
-    ASSERT(!isMainThread());
-    if (!m_hrtfDatabase.get()) {
-        // Load the default HRTF database.
-        m_hrtfDatabase = HRTFDatabase::create(m_databaseSampleRate);
-    }
-}
-
-void HRTFDatabaseLoader::loadAsynchronously()
-{
-    ASSERT(isMainThread());
-
-    MutexLocker locker(m_threadLock);
-
-    if (!m_hrtfDatabase.get() && !m_databaseLoaderThread) {
-        // Start the asynchronous database loading process.
-        m_databaseLoaderThread = createThread(databaseLoaderEntry, this, "HRTF database loader");
-    }
-}
-
-bool HRTFDatabaseLoader::isLoaded() const
-{
-    return m_hrtfDatabase.get();
-}
-
-void HRTFDatabaseLoader::waitForLoaderThreadCompletion()
-{
-    MutexLocker locker(m_threadLock);
-
-    // waitForThreadCompletion() should not be called twice for the same thread.
-    if (m_databaseLoaderThread)
-        waitForThreadCompletion(m_databaseLoaderThread);
-    m_databaseLoaderThread = 0;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/HRTFDatabaseLoader.h b/Source/core/platform/audio/HRTFDatabaseLoader.h
deleted file mode 100644
index 65de173..0000000
--- a/Source/core/platform/audio/HRTFDatabaseLoader.h
+++ /dev/null
@@ -1,93 +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.
- * 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.
- *
- * 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 HRTFDatabaseLoader_h
-#define HRTFDatabaseLoader_h
-
-#include "core/platform/audio/HRTFDatabase.h"
-#include "wtf/HashMap.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Threading.h"
-#include "wtf/ThreadingPrimitives.h"
-
-namespace WebCore {
-
-// HRTFDatabaseLoader will asynchronously load the default HRTFDatabase in a new thread.
-
-class HRTFDatabaseLoader : public RefCounted<HRTFDatabaseLoader> {
-public:
-    // 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);
-
-    // Both constructor and destructor must be called from the main thread.
-    ~HRTFDatabaseLoader();
-
-    // Returns true once the default database has been completely loaded.
-    bool isLoaded() const;
-
-    // waitForLoaderThreadCompletion() may be called more than once and is thread-safe.
-    void waitForLoaderThreadCompletion();
-
-    HRTFDatabase* database() { return m_hrtfDatabase.get(); }
-
-    float databaseSampleRate() const { return m_databaseSampleRate; }
-
-    // Called in asynchronous loading thread.
-    void load();
-
-private:
-    // Both constructor and destructor must be called from the main thread.
-    explicit HRTFDatabaseLoader(float sampleRate);
-
-    // If it hasn't already been loaded, creates a new thread and initiates asynchronous loading of the default database.
-    // This must be called from the main thread.
-    void loadAsynchronously();
-
-    // Map from sample-rate to loader.
-    typedef HashMap<double, HRTFDatabaseLoader*> LoaderMap;
-
-    // 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.
-    Mutex m_threadLock;
-    ThreadIdentifier m_databaseLoaderThread;
-
-    float m_databaseSampleRate;
-};
-
-} // namespace WebCore
-
-#endif // HRTFDatabaseLoader_h
diff --git a/Source/core/platform/audio/HRTFElevation.cpp b/Source/core/platform/audio/HRTFElevation.cpp
deleted file mode 100644
index a5c606c..0000000
--- a/Source/core/platform/audio/HRTFElevation.cpp
+++ /dev/null
@@ -1,342 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/HRTFElevation.h"
-
-#include <math.h>
-#include <algorithm>
-#include "core/platform/audio/AudioBus.h"
-#include "core/platform/audio/HRTFPanner.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/ThreadingPrimitives.h"
-
-using namespace std;
-
-namespace WebCore {
-
-const unsigned HRTFElevation::AzimuthSpacing = 15;
-const unsigned HRTFElevation::NumberOfRawAzimuths = 360 / AzimuthSpacing;
-const unsigned HRTFElevation::InterpolationFactor = 8;
-const unsigned HRTFElevation::NumberOfTotalAzimuths = NumberOfRawAzimuths * InterpolationFactor;
-
-// Total number of components of an HRTF database.
-const size_t TotalNumberOfResponses = 240;
-
-// Number of frames in an individual impulse response.
-const size_t ResponseFrameSize = 256;
-
-// Sample-rate of the spatialization impulse responses as stored in the resource file.
-// The impulse responses may be resampled to a different sample-rate (depending on the audio hardware) when they are loaded.
-const float ResponseSampleRate = 44100;
-
-#if USE(CONCATENATED_IMPULSE_RESPONSES)
-// Lazily load a concatenated HRTF database for given subject and store it in a
-// local hash table to ensure quick efficient future retrievals.
-static PassRefPtr<AudioBus> getConcatenatedImpulseResponsesForSubject(const String& subjectName)
-{
-    typedef HashMap<String, RefPtr<AudioBus> > AudioBusMap;
-    DEFINE_STATIC_LOCAL(AudioBusMap, audioBusMap, ());
-    DEFINE_STATIC_LOCAL(Mutex, mutex, ());
-
-    MutexLocker locker(mutex);
-    RefPtr<AudioBus> bus;
-    AudioBusMap::iterator iterator = audioBusMap.find(subjectName);
-    if (iterator == audioBusMap.end()) {
-        RefPtr<AudioBus> concatenatedImpulseResponses(AudioBus::loadPlatformResource(subjectName.utf8().data(), ResponseSampleRate));
-        ASSERT(concatenatedImpulseResponses);
-        if (!concatenatedImpulseResponses)
-            return 0;
-
-        bus = concatenatedImpulseResponses;
-        audioBusMap.set(subjectName, bus);
-    } else
-        bus = iterator->value;
-
-    size_t responseLength = bus->length();
-    size_t expectedLength = static_cast<size_t>(TotalNumberOfResponses * ResponseFrameSize);
-
-    // Check number of channels and length. For now these are fixed and known.
-    bool isBusGood = responseLength == expectedLength && bus->numberOfChannels() == 2;
-    ASSERT(isBusGood);
-    if (!isBusGood)
-        return 0;
-
-    return bus;
-}
-#endif
-
-// Takes advantage of the symmetry and creates a composite version of the two measured versions.  For example, we have both azimuth 30 and -30 degrees
-// where the roles of left and right ears are reversed with respect to each other.
-bool HRTFElevation::calculateSymmetricKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName,
-                                                                 RefPtr<HRTFKernel>& kernelL, RefPtr<HRTFKernel>& kernelR)
-{
-    RefPtr<HRTFKernel> kernelL1;
-    RefPtr<HRTFKernel> kernelR1;
-    bool success = calculateKernelsForAzimuthElevation(azimuth, elevation, sampleRate, subjectName, kernelL1, kernelR1);
-    if (!success)
-        return false;
-
-    // And symmetric version
-    int symmetricAzimuth = !azimuth ? 0 : 360 - azimuth;
-
-    RefPtr<HRTFKernel> kernelL2;
-    RefPtr<HRTFKernel> kernelR2;
-    success = calculateKernelsForAzimuthElevation(symmetricAzimuth, elevation, sampleRate, subjectName, kernelL2, kernelR2);
-    if (!success)
-        return false;
-
-    // Notice L/R reversal in symmetric version.
-    kernelL = HRTFKernel::createInterpolatedKernel(kernelL1.get(), kernelR2.get(), 0.5f);
-    kernelR = HRTFKernel::createInterpolatedKernel(kernelR1.get(), kernelL2.get(), 0.5f);
-
-    return true;
-}
-
-bool HRTFElevation::calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName,
-                                                        RefPtr<HRTFKernel>& kernelL, RefPtr<HRTFKernel>& kernelR)
-{
-    // Valid values for azimuth are 0 -> 345 in 15 degree increments.
-    // Valid values for elevation are -45 -> +90 in 15 degree increments.
-
-    bool isAzimuthGood = azimuth >= 0 && azimuth <= 345 && (azimuth / 15) * 15 == azimuth;
-    ASSERT(isAzimuthGood);
-    if (!isAzimuthGood)
-        return false;
-
-    bool isElevationGood = elevation >= -45 && elevation <= 90 && (elevation / 15) * 15 == elevation;
-    ASSERT(isElevationGood);
-    if (!isElevationGood)
-        return false;
-
-    // Construct the resource name from the subject name, azimuth, and elevation, for example:
-    // "IRC_Composite_C_R0195_T015_P000"
-    // Note: the passed in subjectName is not a string passed in via JavaScript or the web.
-    // It's passed in as an internal ASCII identifier and is an implementation detail.
-    int positiveElevation = elevation < 0 ? elevation + 360 : elevation;
-
-#if USE(CONCATENATED_IMPULSE_RESPONSES)
-    RefPtr<AudioBus> bus(getConcatenatedImpulseResponsesForSubject(subjectName));
-
-    if (!bus)
-        return false;
-
-    int elevationIndex = positiveElevation / AzimuthSpacing;
-    if (positiveElevation > 90)
-        elevationIndex -= AzimuthSpacing;
-
-    // The concatenated impulse response is a bus containing all
-    // the elevations per azimuth, for all azimuths by increasing
-    // order. So for a given azimuth and elevation we need to compute
-    // the index of the wanted audio frames in the concatenated table.
-    unsigned index = ((azimuth / AzimuthSpacing) * HRTFDatabase::NumberOfRawElevations) + elevationIndex;
-    bool isIndexGood = index < TotalNumberOfResponses;
-    ASSERT(isIndexGood);
-    if (!isIndexGood)
-        return false;
-
-    // Extract the individual impulse response from the concatenated
-    // responses and potentially sample-rate convert it to the desired
-    // (hardware) sample-rate.
-    unsigned startFrame = index * ResponseFrameSize;
-    unsigned stopFrame = startFrame + ResponseFrameSize;
-    RefPtr<AudioBus> preSampleRateConvertedResponse(AudioBus::createBufferFromRange(bus.get(), startFrame, stopFrame));
-    RefPtr<AudioBus> response(AudioBus::createBySampleRateConverting(preSampleRateConvertedResponse.get(), false, sampleRate));
-    AudioChannel* leftEarImpulseResponse = response->channel(AudioBus::ChannelLeft);
-    AudioChannel* rightEarImpulseResponse = response->channel(AudioBus::ChannelRight);
-#else
-    String resourceName = String::format("IRC_%s_C_R0195_T%03d_P%03d", subjectName.utf8().data(), azimuth, positiveElevation);
-
-    RefPtr<AudioBus> impulseResponse(AudioBus::loadPlatformResource(resourceName.utf8().data(), sampleRate));
-
-    ASSERT(impulseResponse.get());
-    if (!impulseResponse.get())
-        return false;
-
-    size_t responseLength = impulseResponse->length();
-    size_t expectedLength = static_cast<size_t>(256 * (sampleRate / 44100.0));
-
-    // Check number of channels and length.  For now these are fixed and known.
-    bool isBusGood = responseLength == expectedLength && impulseResponse->numberOfChannels() == 2;
-    ASSERT(isBusGood);
-    if (!isBusGood)
-        return false;
-
-    AudioChannel* leftEarImpulseResponse = impulseResponse->channelByType(AudioBus::ChannelLeft);
-    AudioChannel* rightEarImpulseResponse = impulseResponse->channelByType(AudioBus::ChannelRight);
-#endif
-
-    // Note that depending on the fftSize returned by the panner, we may be truncating the impulse response we just loaded in.
-    const size_t fftSize = HRTFPanner::fftSizeForSampleRate(sampleRate);
-    kernelL = HRTFKernel::create(leftEarImpulseResponse, fftSize, sampleRate);
-    kernelR = HRTFKernel::create(rightEarImpulseResponse, fftSize, sampleRate);
-
-    return true;
-}
-
-// The range of elevations for the IRCAM impulse responses varies depending on azimuth, but the minimum elevation appears to always be -45.
-//
-// Here's how it goes:
-static int maxElevations[] = {
-        //  Azimuth
-        //
-    90, // 0
-    45, // 15
-    60, // 30
-    45, // 45
-    75, // 60
-    45, // 75
-    60, // 90
-    45, // 105
-    75, // 120
-    45, // 135
-    60, // 150
-    45, // 165
-    75, // 180
-    45, // 195
-    60, // 210
-    45, // 225
-    75, // 240
-    45, // 255
-    60, // 270
-    45, // 285
-    75, // 300
-    45, // 315
-    60, // 330
-    45 //  345
-};
-
-PassOwnPtr<HRTFElevation> HRTFElevation::createForSubject(const String& subjectName, int elevation, float sampleRate)
-{
-    bool isElevationGood = elevation >= -45 && elevation <= 90 && (elevation / 15) * 15 == elevation;
-    ASSERT(isElevationGood);
-    if (!isElevationGood)
-        return nullptr;
-
-    OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths));
-    OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths));
-
-    // Load convolution kernels from HRTF files.
-    int interpolatedIndex = 0;
-    for (unsigned rawIndex = 0; rawIndex < NumberOfRawAzimuths; ++rawIndex) {
-        // Don't let elevation exceed maximum for this azimuth.
-        int maxElevation = maxElevations[rawIndex];
-        int actualElevation = min(elevation, maxElevation);
-
-        bool success = calculateKernelsForAzimuthElevation(rawIndex * AzimuthSpacing, actualElevation, sampleRate, subjectName, kernelListL->at(interpolatedIndex), kernelListR->at(interpolatedIndex));
-        if (!success)
-            return nullptr;
-
-        interpolatedIndex += InterpolationFactor;
-    }
-
-    // Now go back and interpolate intermediate azimuth values.
-    for (unsigned i = 0; i < NumberOfTotalAzimuths; i += InterpolationFactor) {
-        int j = (i + InterpolationFactor) % NumberOfTotalAzimuths;
-
-        // Create the interpolated convolution kernels and delays.
-        for (unsigned jj = 1; jj < InterpolationFactor; ++jj) {
-            float x = float(jj) / float(InterpolationFactor); // interpolate from 0 -> 1
-
-            (*kernelListL)[i + jj] = HRTFKernel::createInterpolatedKernel(kernelListL->at(i).get(), kernelListL->at(j).get(), x);
-            (*kernelListR)[i + jj] = HRTFKernel::createInterpolatedKernel(kernelListR->at(i).get(), kernelListR->at(j).get(), x);
-        }
-    }
-
-    OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(kernelListL.release(), kernelListR.release(), elevation, sampleRate));
-    return hrtfElevation.release();
-}
-
-PassOwnPtr<HRTFElevation> HRTFElevation::createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate)
-{
-    ASSERT(hrtfElevation1 && hrtfElevation2);
-    if (!hrtfElevation1 || !hrtfElevation2)
-        return nullptr;
-
-    ASSERT(x >= 0.0 && x < 1.0);
-
-    OwnPtr<HRTFKernelList> kernelListL = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths));
-    OwnPtr<HRTFKernelList> kernelListR = adoptPtr(new HRTFKernelList(NumberOfTotalAzimuths));
-
-    HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL();
-    HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR();
-    HRTFKernelList* kernelListL2 = hrtfElevation2->kernelListL();
-    HRTFKernelList* kernelListR2 = hrtfElevation2->kernelListR();
-
-    // Interpolate kernels of corresponding azimuths of the two elevations.
-    for (unsigned i = 0; i < NumberOfTotalAzimuths; ++i) {
-        (*kernelListL)[i] = HRTFKernel::createInterpolatedKernel(kernelListL1->at(i).get(), kernelListL2->at(i).get(), x);
-        (*kernelListR)[i] = HRTFKernel::createInterpolatedKernel(kernelListR1->at(i).get(), kernelListR2->at(i).get(), x);
-    }
-
-    // Interpolate elevation angle.
-    double angle = (1.0 - x) * hrtfElevation1->elevationAngle() + x * hrtfElevation2->elevationAngle();
-
-    OwnPtr<HRTFElevation> hrtfElevation = adoptPtr(new HRTFElevation(kernelListL.release(), kernelListR.release(), static_cast<int>(angle), sampleRate));
-    return hrtfElevation.release();
-}
-
-void HRTFElevation::getKernelsFromAzimuth(double azimuthBlend, unsigned azimuthIndex, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& frameDelayL, double& frameDelayR)
-{
-    bool checkAzimuthBlend = azimuthBlend >= 0.0 && azimuthBlend < 1.0;
-    ASSERT(checkAzimuthBlend);
-    if (!checkAzimuthBlend)
-        azimuthBlend = 0.0;
-
-    unsigned numKernels = m_kernelListL->size();
-
-    bool isIndexGood = azimuthIndex < numKernels;
-    ASSERT(isIndexGood);
-    if (!isIndexGood) {
-        kernelL = 0;
-        kernelR = 0;
-        return;
-    }
-
-    // Return the left and right kernels.
-    kernelL = m_kernelListL->at(azimuthIndex).get();
-    kernelR = m_kernelListR->at(azimuthIndex).get();
-
-    frameDelayL = m_kernelListL->at(azimuthIndex)->frameDelay();
-    frameDelayR = m_kernelListR->at(azimuthIndex)->frameDelay();
-
-    int azimuthIndex2 = (azimuthIndex + 1) % numKernels;
-    double frameDelay2L = m_kernelListL->at(azimuthIndex2)->frameDelay();
-    double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay();
-
-    // Linearly interpolate delays.
-    frameDelayL = (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay2L;
-    frameDelayR = (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay2R;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/HRTFElevation.h b/Source/core/platform/audio/HRTFElevation.h
deleted file mode 100644
index b16408d..0000000
--- a/Source/core/platform/audio/HRTFElevation.h
+++ /dev/null
@@ -1,112 +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.
- * 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.
- *
- * 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 HRTFElevation_h
-#define HRTFElevation_h
-
-#include "core/platform/audio/HRTFKernel.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-// HRTFElevation contains all of the HRTFKernels (one left ear and one right ear per azimuth angle) for a particular elevation.
-
-class HRTFElevation {
-    WTF_MAKE_NONCOPYABLE(HRTFElevation);
-public:
-    // Loads and returns an HRTFElevation with the given HRTF database subject name and elevation from browser (or WebKit.framework) resources.
-    // Normally, there will only be a single HRTF database set, but this API supports the possibility of multiple ones with different names.
-    // Interpolated azimuths will be generated based on InterpolationFactor.
-    // Valid values for elevation are -45 -> +90 in 15 degree increments.
-    static PassOwnPtr<HRTFElevation> createForSubject(const String& subjectName, int elevation, float sampleRate);
-
-    // Given two HRTFElevations, and an interpolation factor x: 0 -> 1, returns an interpolated HRTFElevation.
-    static PassOwnPtr<HRTFElevation> createByInterpolatingSlices(HRTFElevation* hrtfElevation1, HRTFElevation* hrtfElevation2, float x, float sampleRate);
-
-    // Returns the list of left or right ear HRTFKernels for all the azimuths going from 0 to 360 degrees.
-    HRTFKernelList* kernelListL() { return m_kernelListL.get(); }
-    HRTFKernelList* kernelListR() { return m_kernelListR.get(); }
-
-    double elevationAngle() const { return m_elevationAngle; }
-    unsigned numberOfAzimuths() const { return NumberOfTotalAzimuths; }
-    float sampleRate() const { return m_sampleRate; }
-
-    // Returns the left and right kernels for the given azimuth index.
-    // The interpolated delays based on azimuthBlend: 0 -> 1 are returned in frameDelayL and frameDelayR.
-    void getKernelsFromAzimuth(double azimuthBlend, unsigned azimuthIndex, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& frameDelayL, double& frameDelayR);
-
-    // Spacing, in degrees, between every azimuth loaded from resource.
-    static const unsigned AzimuthSpacing;
-
-    // Number of azimuths loaded from resource.
-    static const unsigned NumberOfRawAzimuths;
-
-    // Interpolates by this factor to get the total number of azimuths from every azimuth loaded from resource.
-    static const unsigned InterpolationFactor;
-
-    // Total number of azimuths after interpolation.
-    static const unsigned NumberOfTotalAzimuths;
-
-    // Given a specific azimuth and elevation angle, returns the left and right HRTFKernel.
-    // Valid values for azimuth are 0 -> 345 in 15 degree increments.
-    // Valid values for elevation are -45 -> +90 in 15 degree increments.
-    // Returns true on success.
-    static bool calculateKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName,
-                                                    RefPtr<HRTFKernel>& kernelL, RefPtr<HRTFKernel>& kernelR);
-
-    // Given a specific azimuth and elevation angle, returns the left and right HRTFKernel in kernelL and kernelR.
-    // This method averages the measured response using symmetry of azimuth (for example by averaging the -30.0 and +30.0 azimuth responses).
-    // Returns true on success.
-    static bool calculateSymmetricKernelsForAzimuthElevation(int azimuth, int elevation, float sampleRate, const String& subjectName,
-                                                             RefPtr<HRTFKernel>& kernelL, RefPtr<HRTFKernel>& kernelR);
-
-private:
-    HRTFElevation(PassOwnPtr<HRTFKernelList> kernelListL, PassOwnPtr<HRTFKernelList> kernelListR, int elevation, float sampleRate)
-        : m_kernelListL(kernelListL)
-        , m_kernelListR(kernelListR)
-        , m_elevationAngle(elevation)
-        , m_sampleRate(sampleRate)
-    {
-    }
-
-    OwnPtr<HRTFKernelList> m_kernelListL;
-    OwnPtr<HRTFKernelList> m_kernelListR;
-    double m_elevationAngle;
-    float m_sampleRate;
-};
-
-} // namespace WebCore
-
-#endif // HRTFElevation_h
diff --git a/Source/core/platform/audio/HRTFKernel.cpp b/Source/core/platform/audio/HRTFKernel.cpp
deleted file mode 100644
index d825962..0000000
--- a/Source/core/platform/audio/HRTFKernel.cpp
+++ /dev/null
@@ -1,136 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/HRTFKernel.h"
-
-#include "core/platform/FloatConversion.h"
-#include "core/platform/audio/AudioChannel.h"
-#include "core/platform/audio/FFTFrame.h"
-#include "wtf/MathExtras.h"
-
-using namespace std;
-
-namespace WebCore {
-
-// Takes the input AudioChannel as an input impulse response and calculates the average group delay.
-// This represents the initial delay before the most energetic part of the impulse response.
-// The sample-frame delay is removed from the impulseP impulse response, and this value  is returned.
-// the length of the passed in AudioChannel must be a power of 2.
-static float extractAverageGroupDelay(AudioChannel* channel, size_t analysisFFTSize)
-{
-    ASSERT(channel);
-
-    float* impulseP = channel->mutableData();
-
-    bool isSizeGood = channel->length() >= analysisFFTSize;
-    ASSERT(isSizeGood);
-    if (!isSizeGood)
-        return 0;
-
-    // Check for power-of-2.
-    ASSERT(1UL << static_cast<unsigned>(log2(analysisFFTSize)) == analysisFFTSize);
-
-    FFTFrame estimationFrame(analysisFFTSize);
-    estimationFrame.doFFT(impulseP);
-
-    float frameDelay = narrowPrecisionToFloat(estimationFrame.extractAverageGroupDelay());
-    estimationFrame.doInverseFFT(impulseP);
-
-    return frameDelay;
-}
-
-HRTFKernel::HRTFKernel(AudioChannel* channel, size_t fftSize, float sampleRate)
-    : m_frameDelay(0)
-    , m_sampleRate(sampleRate)
-{
-    ASSERT(channel);
-
-    // Determine the leading delay (average group delay) for the response.
-    m_frameDelay = extractAverageGroupDelay(channel, fftSize / 2);
-
-    float* impulseResponse = channel->mutableData();
-    size_t responseLength = channel->length();
-
-    // We need to truncate to fit into 1/2 the FFT size (with zero padding) in order to do proper convolution.
-    size_t truncatedResponseLength = min(responseLength, fftSize / 2); // truncate if necessary to max impulse response length allowed by FFT
-
-    // Quick fade-out (apply window) at truncation point
-    unsigned numberOfFadeOutFrames = static_cast<unsigned>(sampleRate / 4410); // 10 sample-frames @44.1KHz sample-rate
-    ASSERT(numberOfFadeOutFrames < truncatedResponseLength);
-    if (numberOfFadeOutFrames < truncatedResponseLength) {
-        for (unsigned i = truncatedResponseLength - numberOfFadeOutFrames; i < truncatedResponseLength; ++i) {
-            float x = 1.0f - static_cast<float>(i - (truncatedResponseLength - numberOfFadeOutFrames)) / numberOfFadeOutFrames;
-            impulseResponse[i] *= x;
-        }
-    }
-
-    m_fftFrame = adoptPtr(new FFTFrame(fftSize));
-    m_fftFrame->doPaddedFFT(impulseResponse, truncatedResponseLength);
-}
-
-PassOwnPtr<AudioChannel> HRTFKernel::createImpulseResponse()
-{
-    OwnPtr<AudioChannel> channel = adoptPtr(new AudioChannel(fftSize()));
-    FFTFrame fftFrame(*m_fftFrame);
-
-    // Add leading delay back in.
-    fftFrame.addConstantGroupDelay(m_frameDelay);
-    fftFrame.doInverseFFT(channel->mutableData());
-
-    return channel.release();
-}
-
-// Interpolates two kernels with x: 0 -> 1 and returns the result.
-PassRefPtr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x)
-{
-    ASSERT(kernel1 && kernel2);
-    if (!kernel1 || !kernel2)
-        return 0;
-
-    ASSERT(x >= 0.0 && x < 1.0);
-    x = min(1.0f, max(0.0f, x));
-
-    float sampleRate1 = kernel1->sampleRate();
-    float sampleRate2 = kernel2->sampleRate();
-    ASSERT(sampleRate1 == sampleRate2);
-    if (sampleRate1 != sampleRate2)
-        return 0;
-
-    float frameDelay = (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay();
-
-    OwnPtr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kernel1->fftFrame(), *kernel2->fftFrame(), x);
-    return HRTFKernel::create(interpolatedFrame.release(), frameDelay, sampleRate1);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/HRTFKernel.h b/Source/core/platform/audio/HRTFKernel.h
deleted file mode 100644
index 14b1db0..0000000
--- a/Source/core/platform/audio/HRTFKernel.h
+++ /dev/null
@@ -1,98 +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.
- * 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.
- *
- * 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 HRTFKernel_h
-#define HRTFKernel_h
-
-#include "core/platform/audio/FFTFrame.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class AudioChannel;
-
-// HRTF stands for Head-Related Transfer Function.
-// HRTFKernel is a frequency-domain representation of an impulse-response used as part of the spatialized panning system.
-// For a given azimuth / elevation angle there will be one HRTFKernel for the left ear transfer function, and one for the right ear.
-// The leading delay (average group delay) for each impulse response is extracted:
-//      m_fftFrame is the frequency-domain representation of the impulse response with the delay removed
-//      m_frameDelay is the leading delay of the original impulse response.
-class HRTFKernel : public RefCounted<HRTFKernel> {
-public:
-    // Note: this is destructive on the passed in AudioChannel.
-    // The length of channel must be a power of two.
-    static PassRefPtr<HRTFKernel> create(AudioChannel* channel, size_t fftSize, float sampleRate)
-    {
-        return adoptRef(new HRTFKernel(channel, fftSize, sampleRate));
-    }
-
-    static PassRefPtr<HRTFKernel> create(PassOwnPtr<FFTFrame> fftFrame, float frameDelay, float sampleRate)
-    {
-        return adoptRef(new HRTFKernel(fftFrame, frameDelay, sampleRate));
-    }
-
-    // Given two HRTFKernels, and an interpolation factor x: 0 -> 1, returns an interpolated HRTFKernel.
-    static PassRefPtr<HRTFKernel> createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x);
-
-    FFTFrame* fftFrame() { return m_fftFrame.get(); }
-
-    size_t fftSize() const { return m_fftFrame->fftSize(); }
-    float frameDelay() const { return m_frameDelay; }
-
-    float sampleRate() const { return m_sampleRate; }
-    double nyquist() const { return 0.5 * sampleRate(); }
-
-    // Converts back into impulse-response form.
-    PassOwnPtr<AudioChannel> createImpulseResponse();
-
-private:
-    // Note: this is destructive on the passed in AudioChannel.
-    HRTFKernel(AudioChannel*, size_t fftSize, float sampleRate);
-
-    HRTFKernel(PassOwnPtr<FFTFrame> fftFrame, float frameDelay, float sampleRate)
-        : m_fftFrame(fftFrame)
-        , m_frameDelay(frameDelay)
-        , m_sampleRate(sampleRate)
-    {
-    }
-
-    OwnPtr<FFTFrame> m_fftFrame;
-    float m_frameDelay;
-    float m_sampleRate;
-};
-
-typedef Vector<RefPtr<HRTFKernel> > HRTFKernelList;
-
-} // namespace WebCore
-
-#endif // HRTFKernel_h
diff --git a/Source/core/platform/audio/HRTFPanner.cpp b/Source/core/platform/audio/HRTFPanner.cpp
deleted file mode 100644
index db7f2d8..0000000
--- a/Source/core/platform/audio/HRTFPanner.cpp
+++ /dev/null
@@ -1,314 +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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/HRTFPanner.h"
-
-#include <algorithm>
-#include "core/platform/audio/AudioBus.h"
-#include "core/platform/audio/FFTConvolver.h"
-#include "core/platform/audio/HRTFDatabase.h"
-#include "wtf/MathExtras.h"
-#include "wtf/RefPtr.h"
-
-using namespace std;
-
-namespace WebCore {
-
-// The value of 2 milliseconds is larger than the largest delay which exists in any HRTFKernel from the default HRTFDatabase (0.0136 seconds).
-// We ASSERT the delay values used in process() with this value.
-const double MaxDelayTimeSeconds = 0.002;
-
-const int UninitializedAzimuth = -1;
-const unsigned RenderingQuantum = 128;
-
-HRTFPanner::HRTFPanner(float sampleRate, HRTFDatabaseLoader* databaseLoader)
-    : Panner(PanningModelHRTF)
-    , m_databaseLoader(databaseLoader)
-    , m_sampleRate(sampleRate)
-    , m_crossfadeSelection(CrossfadeSelection1)
-    , m_azimuthIndex1(UninitializedAzimuth)
-    , m_elevation1(0)
-    , m_azimuthIndex2(UninitializedAzimuth)
-    , m_elevation2(0)
-    , m_crossfadeX(0)
-    , m_crossfadeIncr(0)
-    , m_convolverL1(fftSizeForSampleRate(sampleRate))
-    , m_convolverR1(fftSizeForSampleRate(sampleRate))
-    , m_convolverL2(fftSizeForSampleRate(sampleRate))
-    , m_convolverR2(fftSizeForSampleRate(sampleRate))
-    , m_delayLineL(MaxDelayTimeSeconds, sampleRate)
-    , m_delayLineR(MaxDelayTimeSeconds, sampleRate)
-    , m_tempL1(RenderingQuantum)
-    , m_tempR1(RenderingQuantum)
-    , m_tempL2(RenderingQuantum)
-    , m_tempR2(RenderingQuantum)
-{
-    ASSERT(databaseLoader);
-}
-
-HRTFPanner::~HRTFPanner()
-{
-}
-
-size_t HRTFPanner::fftSizeForSampleRate(float sampleRate)
-{
-    // The HRTF impulse responses (loaded as audio resources) are 512 sample-frames @44.1KHz.
-    // Currently, we truncate the impulse responses to half this size, but an FFT-size of twice impulse response size is needed (for convolution).
-    // So for sample rates around 44.1KHz an FFT size of 512 is good. We double the FFT-size only for sample rates at least double this.
-    ASSERT(sampleRate >= 44100 && sampleRate <= 96000.0);
-    return (sampleRate < 88200.0) ? 512 : 1024;
-}
-
-void HRTFPanner::reset()
-{
-    m_convolverL1.reset();
-    m_convolverR1.reset();
-    m_convolverL2.reset();
-    m_convolverR2.reset();
-    m_delayLineL.reset();
-    m_delayLineR.reset();
-}
-
-int HRTFPanner::calculateDesiredAzimuthIndexAndBlend(double azimuth, double& azimuthBlend)
-{
-    // Convert the azimuth angle from the range -180 -> +180 into the range 0 -> 360.
-    // The azimuth index may then be calculated from this positive value.
-    if (azimuth < 0)
-        azimuth += 360.0;
-
-    HRTFDatabase* database = m_databaseLoader->database();
-    ASSERT(database);
-
-    int numberOfAzimuths = database->numberOfAzimuths();
-    const double angleBetweenAzimuths = 360.0 / numberOfAzimuths;
-
-    // Calculate the azimuth index and the blend (0 -> 1) for interpolation.
-    double desiredAzimuthIndexFloat = azimuth / angleBetweenAzimuths;
-    int desiredAzimuthIndex = static_cast<int>(desiredAzimuthIndexFloat);
-    azimuthBlend = desiredAzimuthIndexFloat - static_cast<double>(desiredAzimuthIndex);
-
-    // We don't immediately start using this azimuth index, but instead approach this index from the last index we rendered at.
-    // This minimizes the clicks and graininess for moving sources which occur otherwise.
-    desiredAzimuthIndex = max(0, desiredAzimuthIndex);
-    desiredAzimuthIndex = min(numberOfAzimuths - 1, desiredAzimuthIndex);
-    return desiredAzimuthIndex;
-}
-
-void HRTFPanner::pan(double desiredAzimuth, double elevation, const AudioBus* inputBus, AudioBus* outputBus, size_t framesToProcess)
-{
-    unsigned numInputChannels = inputBus ? inputBus->numberOfChannels() : 0;
-
-    bool isInputGood = inputBus &&  numInputChannels >= 1 && numInputChannels <= 2;
-    ASSERT(isInputGood);
-
-    bool isOutputGood = outputBus && outputBus->numberOfChannels() == 2 && framesToProcess <= outputBus->length();
-    ASSERT(isOutputGood);
-
-    if (!isInputGood || !isOutputGood) {
-        if (outputBus)
-            outputBus->zero();
-        return;
-    }
-
-    HRTFDatabase* database = m_databaseLoader->database();
-    ASSERT(database);
-    if (!database) {
-        outputBus->zero();
-        return;
-    }
-
-    // IRCAM HRTF azimuths values from the loaded database is reversed from the panner's notion of azimuth.
-    double azimuth = -desiredAzimuth;
-
-    bool isAzimuthGood = azimuth >= -180.0 && azimuth <= 180.0;
-    ASSERT(isAzimuthGood);
-    if (!isAzimuthGood) {
-        outputBus->zero();
-        return;
-    }
-
-    // Normally, we'll just be dealing with mono sources.
-    // If we have a stereo input, implement stereo panning with left source processed by left HRTF, and right source by right HRTF.
-    const AudioChannel* inputChannelL = inputBus->channelByType(AudioBus::ChannelLeft);
-    const AudioChannel* inputChannelR = numInputChannels > 1 ? inputBus->channelByType(AudioBus::ChannelRight) : 0;
-
-    // Get source and destination pointers.
-    const float* sourceL = inputChannelL->data();
-    const float* sourceR = numInputChannels > 1 ? inputChannelR->data() : sourceL;
-    float* destinationL = outputBus->channelByType(AudioBus::ChannelLeft)->mutableData();
-    float* destinationR = outputBus->channelByType(AudioBus::ChannelRight)->mutableData();
-
-    double azimuthBlend;
-    int desiredAzimuthIndex = calculateDesiredAzimuthIndexAndBlend(azimuth, azimuthBlend);
-
-    // Initially snap azimuth and elevation values to first values encountered.
-    if (m_azimuthIndex1 == UninitializedAzimuth) {
-        m_azimuthIndex1 = desiredAzimuthIndex;
-        m_elevation1 = elevation;
-    }
-    if (m_azimuthIndex2 == UninitializedAzimuth) {
-        m_azimuthIndex2 = desiredAzimuthIndex;
-        m_elevation2 = elevation;
-    }
-
-    // Cross-fade / transition over a period of around 45 milliseconds.
-    // This is an empirical value tuned to be a reasonable trade-off between
-    // smoothness and speed.
-    const double fadeFrames = sampleRate() <= 48000 ? 2048 : 4096;
-
-    // Check for azimuth and elevation changes, initiating a cross-fade if needed.
-    if (!m_crossfadeX && m_crossfadeSelection == CrossfadeSelection1) {
-        if (desiredAzimuthIndex != m_azimuthIndex1 || elevation != m_elevation1) {
-            // Cross-fade from 1 -> 2
-            m_crossfadeIncr = 1 / fadeFrames;
-            m_azimuthIndex2 = desiredAzimuthIndex;
-            m_elevation2 = elevation;
-        }
-    }
-    if (m_crossfadeX == 1 && m_crossfadeSelection == CrossfadeSelection2) {
-        if (desiredAzimuthIndex != m_azimuthIndex2 || elevation != m_elevation2) {
-            // Cross-fade from 2 -> 1
-            m_crossfadeIncr = -1 / fadeFrames;
-            m_azimuthIndex1 = desiredAzimuthIndex;
-            m_elevation1 = elevation;
-        }
-    }
-
-    // This algorithm currently requires that we process in power-of-two size chunks at least RenderingQuantum.
-    ASSERT(1UL << static_cast<int>(log2(framesToProcess)) == framesToProcess);
-    ASSERT(framesToProcess >= RenderingQuantum);
-
-    const unsigned framesPerSegment = RenderingQuantum;
-    const unsigned numberOfSegments = framesToProcess / framesPerSegment;
-
-    for (unsigned segment = 0; segment < numberOfSegments; ++segment) {
-        // Get the HRTFKernels and interpolated delays.
-        HRTFKernel* kernelL1;
-        HRTFKernel* kernelR1;
-        HRTFKernel* kernelL2;
-        HRTFKernel* kernelR2;
-        double frameDelayL1;
-        double frameDelayR1;
-        double frameDelayL2;
-        double frameDelayR2;
-        database->getKernelsFromAzimuthElevation(azimuthBlend, m_azimuthIndex1, m_elevation1, kernelL1, kernelR1, frameDelayL1, frameDelayR1);
-        database->getKernelsFromAzimuthElevation(azimuthBlend, m_azimuthIndex2, m_elevation2, kernelL2, kernelR2, frameDelayL2, frameDelayR2);
-
-        bool areKernelsGood = kernelL1 && kernelR1 && kernelL2 && kernelR2;
-        ASSERT(areKernelsGood);
-        if (!areKernelsGood) {
-            outputBus->zero();
-            return;
-        }
-
-        ASSERT(frameDelayL1 / sampleRate() < MaxDelayTimeSeconds && frameDelayR1 / sampleRate() < MaxDelayTimeSeconds);
-        ASSERT(frameDelayL2 / sampleRate() < MaxDelayTimeSeconds && frameDelayR2 / sampleRate() < MaxDelayTimeSeconds);
-
-        // Crossfade inter-aural delays based on transitions.
-        double frameDelayL = (1 - m_crossfadeX) * frameDelayL1 + m_crossfadeX * frameDelayL2;
-        double frameDelayR = (1 - m_crossfadeX) * frameDelayR1 + m_crossfadeX * frameDelayR2;
-
-        // Calculate the source and destination pointers for the current segment.
-        unsigned offset = segment * framesPerSegment;
-        const float* segmentSourceL = sourceL + offset;
-        const float* segmentSourceR = sourceR + offset;
-        float* segmentDestinationL = destinationL + offset;
-        float* segmentDestinationR = destinationR + offset;
-
-        // First run through delay lines for inter-aural time difference.
-        m_delayLineL.setDelayFrames(frameDelayL);
-        m_delayLineR.setDelayFrames(frameDelayR);
-        m_delayLineL.process(segmentSourceL, segmentDestinationL, framesPerSegment);
-        m_delayLineR.process(segmentSourceR, segmentDestinationR, framesPerSegment);
-
-        bool needsCrossfading = m_crossfadeIncr;
-
-        // Have the convolvers render directly to the final destination if we're not cross-fading.
-        float* convolutionDestinationL1 = needsCrossfading ? m_tempL1.data() : segmentDestinationL;
-        float* convolutionDestinationR1 = needsCrossfading ? m_tempR1.data() : segmentDestinationR;
-        float* convolutionDestinationL2 = needsCrossfading ? m_tempL2.data() : segmentDestinationL;
-        float* convolutionDestinationR2 = needsCrossfading ? m_tempR2.data() : segmentDestinationR;
-
-        // Now do the convolutions.
-        // Note that we avoid doing convolutions on both sets of convolvers if we're not currently cross-fading.
-
-        if (m_crossfadeSelection == CrossfadeSelection1 || needsCrossfading) {
-            m_convolverL1.process(kernelL1->fftFrame(), segmentDestinationL, convolutionDestinationL1, framesPerSegment);
-            m_convolverR1.process(kernelR1->fftFrame(), segmentDestinationR, convolutionDestinationR1, framesPerSegment);
-        }
-
-        if (m_crossfadeSelection == CrossfadeSelection2 || needsCrossfading) {
-            m_convolverL2.process(kernelL2->fftFrame(), segmentDestinationL, convolutionDestinationL2, framesPerSegment);
-            m_convolverR2.process(kernelR2->fftFrame(), segmentDestinationR, convolutionDestinationR2, framesPerSegment);
-        }
-
-        if (needsCrossfading) {
-            // Apply linear cross-fade.
-            float x = m_crossfadeX;
-            float incr = m_crossfadeIncr;
-            for (unsigned i = 0; i < framesPerSegment; ++i) {
-                segmentDestinationL[i] = (1 - x) * convolutionDestinationL1[i] + x * convolutionDestinationL2[i];
-                segmentDestinationR[i] = (1 - x) * convolutionDestinationR1[i] + x * convolutionDestinationR2[i];
-                x += incr;
-            }
-            // Update cross-fade value from local.
-            m_crossfadeX = x;
-
-            if (m_crossfadeIncr > 0 && fabs(m_crossfadeX - 1) < m_crossfadeIncr) {
-                // We've fully made the crossfade transition from 1 -> 2.
-                m_crossfadeSelection = CrossfadeSelection2;
-                m_crossfadeX = 1;
-                m_crossfadeIncr = 0;
-            } else if (m_crossfadeIncr < 0 && fabs(m_crossfadeX) < -m_crossfadeIncr) {
-                // We've fully made the crossfade transition from 2 -> 1.
-                m_crossfadeSelection = CrossfadeSelection1;
-                m_crossfadeX = 0;
-                m_crossfadeIncr = 0;
-            }
-        }
-    }
-}
-
-double HRTFPanner::tailTime() const
-{
-    // Because HRTFPanner is implemented with a DelayKernel and a FFTConvolver, the tailTime of the HRTFPanner
-    // is the sum of the tailTime of the DelayKernel and the tailTime of the FFTConvolver, which is MaxDelayTimeSeconds
-    // and fftSize() / 2, respectively.
-    return MaxDelayTimeSeconds + (fftSize() / 2) / static_cast<double>(sampleRate());
-}
-
-double HRTFPanner::latencyTime() const
-{
-    // The latency of a FFTConvolver is also fftSize() / 2, and is in addition to its tailTime of the
-    // same value.
-    return (fftSize() / 2) / static_cast<double>(sampleRate());
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/HRTFPanner.h b/Source/core/platform/audio/HRTFPanner.h
deleted file mode 100644
index 1e63ddd..0000000
--- a/Source/core/platform/audio/HRTFPanner.h
+++ /dev/null
@@ -1,109 +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 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 HRTFPanner_h
-#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"
-
-namespace WebCore {
-
-class HRTFPanner : public Panner {
-public:
-    HRTFPanner(float sampleRate, HRTFDatabaseLoader*);
-    virtual ~HRTFPanner();
-
-    // Panner
-    virtual void pan(double azimuth, double elevation, const AudioBus* inputBus, AudioBus* outputBus, size_t framesToProcess);
-    virtual void reset();
-
-    size_t fftSize() const { return fftSizeForSampleRate(m_sampleRate); }
-    static size_t fftSizeForSampleRate(float sampleRate);
-
-    float sampleRate() const { return m_sampleRate; }
-
-    virtual double tailTime() const OVERRIDE;
-    virtual double latencyTime() const OVERRIDE;
-
-private:
-    // Given an azimuth angle in the range -180 -> +180, returns the corresponding azimuth index for the database,
-    // 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
-    // then azimuth and elevation are dynamically changing.
-    // When the azimuth and elevation are not changing, we simply process with one of the two sets.
-    // Initially we use CrossfadeSelection1 corresponding to m_convolverL1 and m_convolverR1.
-    // Whenever the azimuth or elevation changes, a crossfade is initiated to transition
-    // to the new position. So if we're currently processing with CrossfadeSelection1, then
-    // we transition to CrossfadeSelection2 (and vice versa).
-    // If we're in the middle of a transition, then we wait until it is complete before
-    // initiating a new transition.
-
-    // Selects either the convolver set (m_convolverL1, m_convolverR1) or (m_convolverL2, m_convolverR2).
-    enum CrossfadeSelection {
-        CrossfadeSelection1,
-        CrossfadeSelection2
-    };
-
-    CrossfadeSelection m_crossfadeSelection;
-
-    // azimuth/elevation for CrossfadeSelection1.
-    int m_azimuthIndex1;
-    double m_elevation1;
-
-    // azimuth/elevation for CrossfadeSelection2.
-    int m_azimuthIndex2;
-    double m_elevation2;
-
-    // A crossfade value 0 <= m_crossfadeX <= 1.
-    float m_crossfadeX;
-
-    // Per-sample-frame crossfade value increment.
-    float m_crossfadeIncr;
-
-    FFTConvolver m_convolverL1;
-    FFTConvolver m_convolverR1;
-    FFTConvolver m_convolverL2;
-    FFTConvolver m_convolverR2;
-
-    DelayDSPKernel m_delayLineL;
-    DelayDSPKernel m_delayLineR;
-
-    AudioFloatArray m_tempL1;
-    AudioFloatArray m_tempR1;
-    AudioFloatArray m_tempL2;
-    AudioFloatArray m_tempR2;
-};
-
-} // namespace WebCore
-
-#endif // HRTFPanner_h
diff --git a/Source/core/platform/audio/MultiChannelResampler.cpp b/Source/core/platform/audio/MultiChannelResampler.cpp
deleted file mode 100644
index 4bd742f..0000000
--- a/Source/core/platform/audio/MultiChannelResampler.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/MultiChannelResampler.h"
-
-#include "core/platform/audio/AudioBus.h"
-
-namespace WebCore {
-
-namespace {
-
-// ChannelProvider provides a single channel of audio data (one channel at a time) for each channel
-// of data provided to us in a multi-channel provider.
-
-class ChannelProvider : public AudioSourceProvider {
-public:
-    ChannelProvider(AudioSourceProvider* multiChannelProvider, unsigned numberOfChannels)
-        : m_multiChannelProvider(multiChannelProvider)
-        , m_numberOfChannels(numberOfChannels)
-        , m_currentChannel(0)
-        , m_framesToProcess(0)
-    {
-    }
-
-    // provideInput() will be called once for each channel, starting with the first channel.
-    // Each time it's called, it will provide the next channel of data.
-    virtual void provideInput(AudioBus* bus, size_t framesToProcess)
-    {
-        bool isBusGood = bus && bus->numberOfChannels() == 1;
-        ASSERT(isBusGood);
-        if (!isBusGood)
-            return;
-
-        // Get the data from the multi-channel provider when the first channel asks for it.
-        // For subsequent channels, we can just dish out the channel data from that (stored in m_multiChannelBus).
-        if (!m_currentChannel) {
-            m_framesToProcess = framesToProcess;
-            m_multiChannelBus = AudioBus::create(m_numberOfChannels, framesToProcess);
-            m_multiChannelProvider->provideInput(m_multiChannelBus.get(), framesToProcess);
-        }
-
-        // All channels must ask for the same amount. This should always be the case, but let's just make sure.
-        bool isGood = m_multiChannelBus.get() && framesToProcess == m_framesToProcess;
-        ASSERT(isGood);
-        if (!isGood)
-            return;
-
-        // Copy the channel data from what we received from m_multiChannelProvider.
-        ASSERT(m_currentChannel <= m_numberOfChannels);
-        if (m_currentChannel < m_numberOfChannels) {
-            memcpy(bus->channel(0)->mutableData(), m_multiChannelBus->channel(m_currentChannel)->data(), sizeof(float) * framesToProcess);
-            ++m_currentChannel;
-        }
-    }
-
-private:
-    AudioSourceProvider* m_multiChannelProvider;
-    RefPtr<AudioBus> m_multiChannelBus;
-    unsigned m_numberOfChannels;
-    unsigned m_currentChannel;
-    size_t m_framesToProcess; // Used to verify that all channels ask for the same amount.
-};
-
-} // namespace
-
-MultiChannelResampler::MultiChannelResampler(double scaleFactor, unsigned numberOfChannels)
-    : m_numberOfChannels(numberOfChannels)
-{
-    // Create each channel's resampler.
-    for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex)
-        m_kernels.append(adoptPtr(new SincResampler(scaleFactor)));
-}
-
-void MultiChannelResampler::process(AudioSourceProvider* provider, AudioBus* destination, size_t framesToProcess)
-{
-    // The provider can provide us with multi-channel audio data. But each of our single-channel resamplers (kernels)
-    // below requires a provider which provides a single unique channel of data.
-    // channelProvider wraps the original multi-channel provider and dishes out one channel at a time.
-    ChannelProvider channelProvider(provider, m_numberOfChannels);
-
-    for (unsigned channelIndex = 0; channelIndex < m_numberOfChannels; ++channelIndex) {
-        // Depending on the sample-rate scale factor, and the internal buffering used in a SincResampler
-        // kernel, this call to process() will only sometimes call provideInput() on the channelProvider.
-        // However, if it calls provideInput() for the first channel, then it will call it for the remaining
-        // channels, since they all buffer in the same way and are processing the same number of frames.
-        m_kernels[channelIndex]->process(&channelProvider,
-                                         destination->channel(channelIndex)->mutableData(),
-                                         framesToProcess);
-    }
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/MultiChannelResampler.h b/Source/core/platform/audio/MultiChannelResampler.h
deleted file mode 100644
index 16a57fd..0000000
--- a/Source/core/platform/audio/MultiChannelResampler.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 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.
- *
- * 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 MultiChannelResampler_h
-#define MultiChannelResampler_h
-
-#include "core/platform/audio/SincResampler.h"
-#include "wtf/OwnPtr.h"
-
-namespace WebCore {
-
-class AudioBus;
-
-class MultiChannelResampler {
-public:
-    MultiChannelResampler(double scaleFactor, unsigned numberOfChannels);
-
-    // Process given AudioSourceProvider for streaming applications.
-    void process(AudioSourceProvider*, AudioBus* destination, size_t framesToProcess);
-
-private:
-    // FIXME: the mac port can have a more highly optimized implementation based on CoreAudio
-    // instead of SincResampler. For now the default implementation will be used on all ports.
-    // https://bugs.webkit.org/show_bug.cgi?id=75118
-
-    // Each channel will be resampled using a high-quality SincResampler.
-    Vector<OwnPtr<SincResampler> > m_kernels;
-
-    unsigned m_numberOfChannels;
-};
-
-} // namespace WebCore
-
-#endif // MultiChannelResampler_h
diff --git a/Source/core/platform/audio/Panner.cpp b/Source/core/platform/audio/Panner.cpp
deleted file mode 100644
index 30fca6e..0000000
--- a/Source/core/platform/audio/Panner.cpp
+++ /dev/null
@@ -1,66 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/Panner.h"
-
-#include "core/platform/audio/EqualPowerPanner.h"
-#include "core/platform/audio/HRTFPanner.h"
-#include "wtf/OwnPtr.h"
-
-namespace WebCore {
-
-PassOwnPtr<Panner> Panner::create(PanningModel model, float sampleRate, HRTFDatabaseLoader* databaseLoader)
-{
-    OwnPtr<Panner> panner;
-
-    switch (model) {
-    case PanningModelEqualPower:
-        panner = adoptPtr(new EqualPowerPanner(sampleRate));
-        break;
-
-    case PanningModelHRTF:
-        panner = adoptPtr(new HRTFPanner(sampleRate, databaseLoader));
-        break;
-
-    // FIXME: sound field panning is not yet implemented...
-    case PanningModelSoundField:
-    default:
-        ASSERT_NOT_REACHED();
-        return nullptr;
-    }
-
-    return panner.release();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/Panner.h b/Source/core/platform/audio/Panner.h
deleted file mode 100644
index d6eac04..0000000
--- a/Source/core/platform/audio/Panner.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 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.
- * 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.
- *
- * 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 Panner_h
-#define Panner_h
-
-#include "wtf/PassOwnPtr.h"
-
-namespace WebCore {
-
-class AudioBus;
-class HRTFDatabaseLoader;
-
-// Abstract base class for panning a mono or stereo source.
-
-class Panner {
-public:
-    enum {
-        PanningModelEqualPower = 0,
-        PanningModelHRTF = 1,
-        PanningModelSoundField = 2
-    };
-
-    typedef unsigned PanningModel;
-
-    static PassOwnPtr<Panner> create(PanningModel, float sampleRate, HRTFDatabaseLoader*);
-
-    virtual ~Panner() { };
-
-    PanningModel panningModel() const { return m_panningModel; }
-
-    virtual void pan(double azimuth, double elevation, const AudioBus* inputBus, AudioBus* outputBus, size_t framesToProcess) = 0;
-
-    virtual void reset() = 0;
-
-    virtual double tailTime() const = 0;
-    virtual double latencyTime() const = 0;
-
-protected:
-    Panner(PanningModel model) : m_panningModel(model) { }
-
-    PanningModel m_panningModel;
-};
-
-} // namespace WebCore
-
-#endif // Panner_h
diff --git a/Source/core/platform/audio/Reverb.cpp b/Source/core/platform/audio/Reverb.cpp
deleted file mode 100644
index 9ca5c90..0000000
--- a/Source/core/platform/audio/Reverb.cpp
+++ /dev/null
@@ -1,242 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/Reverb.h"
-
-#include <math.h>
-#include "core/platform/audio/AudioBus.h"
-#include "core/platform/audio/ReverbConvolver.h"
-#include "core/platform/audio/VectorMath.h"
-#include "wtf/MathExtras.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-
-#if OS(MACOSX)
-using namespace std;
-#endif
-
-namespace WebCore {
-
-using namespace VectorMath;
-
-// Empirical gain calibration tested across many impulse responses to ensure perceived volume is same as dry (unprocessed) signal
-const float GainCalibration = -58;
-const float GainCalibrationSampleRate = 44100;
-
-// A minimum power value to when normalizing a silent (or very quiet) impulse response
-const float MinPower = 0.000125f;
-
-static float calculateNormalizationScale(AudioBus* response)
-{
-    // Normalize by RMS power
-    size_t numberOfChannels = response->numberOfChannels();
-    size_t length = response->length();
-
-    float power = 0;
-
-    for (size_t i = 0; i < numberOfChannels; ++i) {
-        float channelPower = 0;
-        vsvesq(response->channel(i)->data(), 1, &channelPower, length);
-        power += channelPower;
-    }
-
-    power = sqrt(power / (numberOfChannels * length));
-
-    // Protect against accidental overload
-    if (std::isinf(power) || std::isnan(power) || power < MinPower)
-        power = MinPower;
-
-    float scale = 1 / power;
-
-    scale *= powf(10, GainCalibration * 0.05f); // calibrate to make perceived volume same as unprocessed
-
-    // Scale depends on sample-rate.
-    if (response->sampleRate())
-        scale *= GainCalibrationSampleRate / response->sampleRate();
-
-    // True-stereo compensation
-    if (response->numberOfChannels() == 4)
-        scale *= 0.5f;
-
-    return scale;
-}
-
-Reverb::Reverb(AudioBus* impulseResponse, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads, bool normalize)
-{
-    float scale = 1;
-
-    if (normalize) {
-        scale = calculateNormalizationScale(impulseResponse);
-
-        if (scale)
-            impulseResponse->scale(scale);
-    }
-
-    initialize(impulseResponse, renderSliceSize, maxFFTSize, numberOfChannels, useBackgroundThreads);
-
-    // Undo scaling since this shouldn't be a destructive operation on impulseResponse.
-    // FIXME: What about roundoff? Perhaps consider making a temporary scaled copy
-    // instead of scaling and unscaling in place.
-    if (normalize && scale)
-        impulseResponse->scale(1 / scale);
-}
-
-void Reverb::initialize(AudioBus* impulseResponseBuffer, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads)
-{
-    m_impulseResponseLength = impulseResponseBuffer->length();
-
-    // The reverb can handle a mono impulse response and still do stereo processing
-    size_t numResponseChannels = impulseResponseBuffer->numberOfChannels();
-    m_convolvers.reserveCapacity(numberOfChannels);
-
-    int convolverRenderPhase = 0;
-    for (size_t i = 0; i < numResponseChannels; ++i) {
-        AudioChannel* channel = impulseResponseBuffer->channel(i);
-
-        OwnPtr<ReverbConvolver> convolver = adoptPtr(new ReverbConvolver(channel, renderSliceSize, maxFFTSize, convolverRenderPhase, useBackgroundThreads));
-        m_convolvers.append(convolver.release());
-
-        convolverRenderPhase += renderSliceSize;
-    }
-
-    // For "True" stereo processing we allocate a temporary buffer to avoid repeatedly allocating it in the process() method.
-    // It can be bad to allocate memory in a real-time thread.
-    if (numResponseChannels == 4)
-        m_tempBuffer = AudioBus::create(2, MaxFrameSize);
-}
-
-void Reverb::process(const AudioBus* sourceBus, AudioBus* destinationBus, size_t framesToProcess)
-{
-    // Do a fairly comprehensive sanity check.
-    // If these conditions are satisfied, all of the source and destination pointers will be valid for the various matrixing cases.
-    bool isSafeToProcess = sourceBus && destinationBus && sourceBus->numberOfChannels() > 0 && destinationBus->numberOfChannels() > 0
-        && framesToProcess <= MaxFrameSize && framesToProcess <= sourceBus->length() && framesToProcess <= destinationBus->length();
-
-    ASSERT(isSafeToProcess);
-    if (!isSafeToProcess)
-        return;
-
-    // For now only handle mono or stereo output
-    if (destinationBus->numberOfChannels() > 2) {
-        destinationBus->zero();
-        return;
-    }
-
-    AudioChannel* destinationChannelL = destinationBus->channel(0);
-    const AudioChannel* sourceChannelL = sourceBus->channel(0);
-
-    // Handle input -> output matrixing...
-    size_t numInputChannels = sourceBus->numberOfChannels();
-    size_t numOutputChannels = destinationBus->numberOfChannels();
-    size_t numReverbChannels = m_convolvers.size();
-
-    if (numInputChannels == 2 && numReverbChannels == 2 && numOutputChannels == 2) {
-        // 2 -> 2 -> 2
-        const AudioChannel* sourceChannelR = sourceBus->channel(1);
-        AudioChannel* destinationChannelR = destinationBus->channel(1);
-        m_convolvers[0]->process(sourceChannelL, destinationChannelL, framesToProcess);
-        m_convolvers[1]->process(sourceChannelR, destinationChannelR, framesToProcess);
-    } else  if (numInputChannels == 1 && numOutputChannels == 2 && numReverbChannels == 2) {
-        // 1 -> 2 -> 2
-        for (int i = 0; i < 2; ++i) {
-            AudioChannel* destinationChannel = destinationBus->channel(i);
-            m_convolvers[i]->process(sourceChannelL, destinationChannel, framesToProcess);
-        }
-    } else if (numInputChannels == 1 && numReverbChannels == 1 && numOutputChannels == 2) {
-        // 1 -> 1 -> 2
-        m_convolvers[0]->process(sourceChannelL, destinationChannelL, framesToProcess);
-
-        // simply copy L -> R
-        AudioChannel* destinationChannelR = destinationBus->channel(1);
-        bool isCopySafe = destinationChannelL->data() && destinationChannelR->data() && destinationChannelL->length() >= framesToProcess && destinationChannelR->length() >= framesToProcess;
-        ASSERT(isCopySafe);
-        if (!isCopySafe)
-            return;
-        memcpy(destinationChannelR->mutableData(), destinationChannelL->data(), sizeof(float) * framesToProcess);
-    } else if (numInputChannels == 1 && numReverbChannels == 1 && numOutputChannels == 1) {
-        // 1 -> 1 -> 1
-        m_convolvers[0]->process(sourceChannelL, destinationChannelL, framesToProcess);
-    } else if (numInputChannels == 2 && numReverbChannels == 4 && numOutputChannels == 2) {
-        // 2 -> 4 -> 2 ("True" stereo)
-        const AudioChannel* sourceChannelR = sourceBus->channel(1);
-        AudioChannel* destinationChannelR = destinationBus->channel(1);
-
-        AudioChannel* tempChannelL = m_tempBuffer->channel(0);
-        AudioChannel* tempChannelR = m_tempBuffer->channel(1);
-
-        // Process left virtual source
-        m_convolvers[0]->process(sourceChannelL, destinationChannelL, framesToProcess);
-        m_convolvers[1]->process(sourceChannelL, destinationChannelR, framesToProcess);
-
-        // Process right virtual source
-        m_convolvers[2]->process(sourceChannelR, tempChannelL, framesToProcess);
-        m_convolvers[3]->process(sourceChannelR, tempChannelR, framesToProcess);
-
-        destinationBus->sumFrom(*m_tempBuffer);
-    } else if (numInputChannels == 1 && numReverbChannels == 4 && numOutputChannels == 2) {
-        // 1 -> 4 -> 2 (Processing mono with "True" stereo impulse response)
-        // This is an inefficient use of a four-channel impulse response, but we should handle the case.
-        AudioChannel* destinationChannelR = destinationBus->channel(1);
-
-        AudioChannel* tempChannelL = m_tempBuffer->channel(0);
-        AudioChannel* tempChannelR = m_tempBuffer->channel(1);
-
-        // Process left virtual source
-        m_convolvers[0]->process(sourceChannelL, destinationChannelL, framesToProcess);
-        m_convolvers[1]->process(sourceChannelL, destinationChannelR, framesToProcess);
-
-        // Process right virtual source
-        m_convolvers[2]->process(sourceChannelL, tempChannelL, framesToProcess);
-        m_convolvers[3]->process(sourceChannelL, tempChannelR, framesToProcess);
-
-        destinationBus->sumFrom(*m_tempBuffer);
-    } else {
-        // Handle gracefully any unexpected / unsupported matrixing
-        // FIXME: add code for 5.1 support...
-        destinationBus->zero();
-    }
-}
-
-void Reverb::reset()
-{
-    for (size_t i = 0; i < m_convolvers.size(); ++i)
-        m_convolvers[i]->reset();
-}
-
-size_t Reverb::latencyFrames() const
-{
-    return !m_convolvers.isEmpty() ? m_convolvers.first()->latencyFrames() : 0;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/Reverb.h b/Source/core/platform/audio/Reverb.h
deleted file mode 100644
index 1e79596..0000000
--- a/Source/core/platform/audio/Reverb.h
+++ /dev/null
@@ -1,67 +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.
- * 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.
- *
- * 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 Reverb_h
-#define Reverb_h
-
-#include "core/platform/audio/ReverbConvolver.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class AudioBus;
-
-// Multi-channel convolution reverb with channel matrixing - one or more ReverbConvolver objects are used internally.
-
-class Reverb {
-public:
-    enum { MaxFrameSize = 256 };
-
-    // renderSliceSize is a rendering hint, so the FFTs can be optimized to not all occur at the same time (very bad when rendering on a real-time thread).
-    Reverb(AudioBus* impulseResponseBuffer, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads, bool normalize);
-
-    void process(const AudioBus* sourceBus, AudioBus* destinationBus, size_t framesToProcess);
-    void reset();
-
-    size_t impulseResponseLength() const { return m_impulseResponseLength; }
-    size_t latencyFrames() const;
-
-private:
-    void initialize(AudioBus* impulseResponseBuffer, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads);
-
-    size_t m_impulseResponseLength;
-
-    Vector<OwnPtr<ReverbConvolver> > m_convolvers;
-
-    // For "True" stereo processing
-    RefPtr<AudioBus> m_tempBuffer;
-};
-
-} // namespace WebCore
-
-#endif // Reverb_h
diff --git a/Source/core/platform/audio/ReverbAccumulationBuffer.cpp b/Source/core/platform/audio/ReverbAccumulationBuffer.cpp
deleted file mode 100644
index e7506fa..0000000
--- a/Source/core/platform/audio/ReverbAccumulationBuffer.cpp
+++ /dev/null
@@ -1,119 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/ReverbAccumulationBuffer.h"
-
-#include "core/platform/audio/VectorMath.h"
-
-namespace WebCore {
-
-using namespace VectorMath;
-
-ReverbAccumulationBuffer::ReverbAccumulationBuffer(size_t length)
-    : m_buffer(length)
-    , m_readIndex(0)
-    , m_readTimeFrame(0)
-{
-}
-
-void ReverbAccumulationBuffer::readAndClear(float* destination, size_t numberOfFrames)
-{
-    size_t bufferLength = m_buffer.size();
-    bool isCopySafe = m_readIndex <= bufferLength && numberOfFrames <= bufferLength;
-
-    ASSERT(isCopySafe);
-    if (!isCopySafe)
-        return;
-
-    size_t framesAvailable = bufferLength - m_readIndex;
-    size_t numberOfFrames1 = std::min(numberOfFrames, framesAvailable);
-    size_t numberOfFrames2 = numberOfFrames - numberOfFrames1;
-
-    float* source = m_buffer.data();
-    memcpy(destination, source + m_readIndex, sizeof(float) * numberOfFrames1);
-    memset(source + m_readIndex, 0, sizeof(float) * numberOfFrames1);
-
-    // Handle wrap-around if necessary
-    if (numberOfFrames2 > 0) {
-        memcpy(destination + numberOfFrames1, source, sizeof(float) * numberOfFrames2);
-        memset(source, 0, sizeof(float) * numberOfFrames2);
-    }
-
-    m_readIndex = (m_readIndex + numberOfFrames) % bufferLength;
-    m_readTimeFrame += numberOfFrames;
-}
-
-void ReverbAccumulationBuffer::updateReadIndex(int* readIndex, size_t numberOfFrames) const
-{
-    // Update caller's readIndex
-    *readIndex = (*readIndex + numberOfFrames) % m_buffer.size();
-}
-
-int ReverbAccumulationBuffer::accumulate(float* source, size_t numberOfFrames, int* readIndex, size_t delayFrames)
-{
-    size_t bufferLength = m_buffer.size();
-
-    size_t writeIndex = (*readIndex + delayFrames) % bufferLength;
-
-    // Update caller's readIndex
-    *readIndex = (*readIndex + numberOfFrames) % bufferLength;
-
-    size_t framesAvailable = bufferLength - writeIndex;
-    size_t numberOfFrames1 = std::min(numberOfFrames, framesAvailable);
-    size_t numberOfFrames2 = numberOfFrames - numberOfFrames1;
-
-    float* destination = m_buffer.data();
-
-    bool isSafe = writeIndex <= bufferLength && numberOfFrames1 + writeIndex <= bufferLength && numberOfFrames2 <= bufferLength;
-    ASSERT(isSafe);
-    if (!isSafe)
-        return 0;
-
-    vadd(source, 1, destination + writeIndex, 1, destination + writeIndex, 1, numberOfFrames1);
-
-    // Handle wrap-around if necessary
-    if (numberOfFrames2 > 0)
-        vadd(source + numberOfFrames1, 1, destination, 1, destination, 1, numberOfFrames2);
-
-    return writeIndex;
-}
-
-void ReverbAccumulationBuffer::reset()
-{
-    m_buffer.zero();
-    m_readIndex = 0;
-    m_readTimeFrame = 0;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/ReverbAccumulationBuffer.h b/Source/core/platform/audio/ReverbAccumulationBuffer.h
deleted file mode 100644
index fe3f3a5..0000000
--- a/Source/core/platform/audio/ReverbAccumulationBuffer.h
+++ /dev/null
@@ -1,67 +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.
- * 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.
- *
- * 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 ReverbAccumulationBuffer_h
-#define ReverbAccumulationBuffer_h
-
-#include "core/platform/audio/AudioArray.h"
-
-namespace WebCore {
-
-// ReverbAccumulationBuffer is a circular delay buffer with one client reading from it and multiple clients
-// writing/accumulating to it at different delay offsets from the read position.  The read operation will zero the memory
-// just read from the buffer, so it will be ready for accumulation the next time around.
-class ReverbAccumulationBuffer {
-public:
-    ReverbAccumulationBuffer(size_t length);
-
-    // This will read from, then clear-out numberOfFrames
-    void readAndClear(float* destination, size_t numberOfFrames);
-
-    // Each ReverbConvolverStage will accumulate its output at the appropriate delay from the read position.
-    // We need to pass in and update readIndex here, since each ReverbConvolverStage may be running in
-    // a different thread than the realtime thread calling ReadAndClear() and maintaining m_readIndex
-    // Returns the writeIndex where the accumulation took place
-    int accumulate(float* source, size_t numberOfFrames, int* readIndex, size_t delayFrames);
-
-    size_t readIndex() const { return m_readIndex; }
-    void updateReadIndex(int* readIndex, size_t numberOfFrames) const;
-
-    size_t readTimeFrame() const { return m_readTimeFrame; }
-
-    void reset();
-
-private:
-    AudioFloatArray m_buffer;
-    size_t m_readIndex;
-    size_t m_readTimeFrame; // for debugging (frame on continuous timeline)
-};
-
-} // namespace WebCore
-
-#endif // ReverbAccumulationBuffer_h
diff --git a/Source/core/platform/audio/ReverbConvolver.cpp b/Source/core/platform/audio/ReverbConvolver.cpp
deleted file mode 100644
index 17ace84..0000000
--- a/Source/core/platform/audio/ReverbConvolver.cpp
+++ /dev/null
@@ -1,238 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/ReverbConvolver.h"
-
-#include "core/platform/audio/AudioBus.h"
-#include "core/platform/audio/VectorMath.h"
-
-namespace WebCore {
-
-using namespace VectorMath;
-
-const int InputBufferSize = 8 * 16384;
-
-// We only process the leading portion of the impulse response in the real-time thread.  We don't exceed this length.
-// It turns out then, that the background thread has about 278msec of scheduling slop.
-// Empirically, this has been found to be a good compromise between giving enough time for scheduling slop,
-// while still minimizing the amount of processing done in the primary (high-priority) thread.
-// This was found to be a good value on Mac OS X, and may work well on other platforms as well, assuming
-// the very rough scheduling latencies are similar on these time-scales.  Of course, this code may need to be
-// tuned for individual platforms if this assumption is found to be incorrect.
-const size_t RealtimeFrameLimit = 8192  + 4096; // ~278msec @ 44.1KHz
-
-const size_t MinFFTSize = 128;
-const size_t MaxRealtimeFFTSize = 2048;
-
-static void backgroundThreadEntry(void* threadData)
-{
-    ReverbConvolver* reverbConvolver = static_cast<ReverbConvolver*>(threadData);
-    reverbConvolver->backgroundThreadEntry();
-}
-
-ReverbConvolver::ReverbConvolver(AudioChannel* impulseResponse, size_t renderSliceSize, size_t maxFFTSize, size_t convolverRenderPhase, bool useBackgroundThreads)
-    : m_impulseResponseLength(impulseResponse->length())
-    , m_accumulationBuffer(impulseResponse->length() + renderSliceSize)
-    , m_inputBuffer(InputBufferSize)
-    , m_minFFTSize(MinFFTSize) // First stage will have this size - successive stages will double in size each time
-    , m_maxFFTSize(maxFFTSize) // until we hit m_maxFFTSize
-    , m_useBackgroundThreads(useBackgroundThreads)
-    , m_backgroundThread(0)
-    , m_wantsToExit(false)
-    , m_moreInputBuffered(false)
-{
-    // If we are using background threads then don't exceed this FFT size for the
-    // stages which run in the real-time thread.  This avoids having only one or two
-    // large stages (size 16384 or so) at the end which take a lot of time every several
-    // processing slices.  This way we amortize the cost over more processing slices.
-    m_maxRealtimeFFTSize = MaxRealtimeFFTSize;
-
-    // For the moment, a good way to know if we have real-time constraint is to check if we're using background threads.
-    // Otherwise, assume we're being run from a command-line tool.
-    bool hasRealtimeConstraint = useBackgroundThreads;
-
-    const float* response = impulseResponse->data();
-    size_t totalResponseLength = impulseResponse->length();
-
-    // The total latency is zero because the direct-convolution is used in the leading portion.
-    size_t reverbTotalLatency = 0;
-
-    size_t stageOffset = 0;
-    int i = 0;
-    size_t fftSize = m_minFFTSize;
-    while (stageOffset < totalResponseLength) {
-        size_t stageSize = fftSize / 2;
-
-        // For the last stage, it's possible that stageOffset is such that we're straddling the end
-        // of the impulse response buffer (if we use stageSize), so reduce the last stage's length...
-        if (stageSize + stageOffset > totalResponseLength)
-            stageSize = totalResponseLength - stageOffset;
-
-        // This "staggers" the time when each FFT happens so they don't all happen at the same time
-        int renderPhase = convolverRenderPhase + i * renderSliceSize;
-
-        bool useDirectConvolver = !stageOffset;
-
-        OwnPtr<ReverbConvolverStage> stage = adoptPtr(new ReverbConvolverStage(response, totalResponseLength, reverbTotalLatency, stageOffset, stageSize, fftSize, renderPhase, renderSliceSize, &m_accumulationBuffer, useDirectConvolver));
-
-        bool isBackgroundStage = false;
-
-        if (this->useBackgroundThreads() && stageOffset > RealtimeFrameLimit) {
-            m_backgroundStages.append(stage.release());
-            isBackgroundStage = true;
-        } else
-            m_stages.append(stage.release());
-
-        stageOffset += stageSize;
-        ++i;
-
-        if (!useDirectConvolver) {
-            // Figure out next FFT size
-            fftSize *= 2;
-        }
-
-        if (hasRealtimeConstraint && !isBackgroundStage && fftSize > m_maxRealtimeFFTSize)
-            fftSize = m_maxRealtimeFFTSize;
-        if (fftSize > m_maxFFTSize)
-            fftSize = m_maxFFTSize;
-    }
-
-    // Start up background thread
-    // FIXME: would be better to up the thread priority here.  It doesn't need to be real-time, but higher than the default...
-    if (this->useBackgroundThreads() && m_backgroundStages.size() > 0)
-        m_backgroundThread = createThread(WebCore::backgroundThreadEntry, this, "convolution background thread");
-}
-
-ReverbConvolver::~ReverbConvolver()
-{
-    // Wait for background thread to stop
-    if (useBackgroundThreads() && m_backgroundThread) {
-        m_wantsToExit = true;
-
-        // Wake up thread so it can return
-        {
-            MutexLocker locker(m_backgroundThreadLock);
-            m_moreInputBuffered = true;
-            m_backgroundThreadCondition.signal();
-        }
-
-        waitForThreadCompletion(m_backgroundThread);
-    }
-}
-
-void ReverbConvolver::backgroundThreadEntry()
-{
-    while (!m_wantsToExit) {
-        // Wait for realtime thread to give us more input
-        m_moreInputBuffered = false;
-        {
-            MutexLocker locker(m_backgroundThreadLock);
-            while (!m_moreInputBuffered && !m_wantsToExit)
-                m_backgroundThreadCondition.wait(m_backgroundThreadLock);
-        }
-
-        // Process all of the stages until their read indices reach the input buffer's write index
-        int writeIndex = m_inputBuffer.writeIndex();
-
-        // Even though it doesn't seem like every stage needs to maintain its own version of readIndex
-        // we do this in case we want to run in more than one background thread.
-        int readIndex;
-
-        while ((readIndex = m_backgroundStages[0]->inputReadIndex()) != writeIndex) { // FIXME: do better to detect buffer overrun...
-            // The ReverbConvolverStages need to process in amounts which evenly divide half the FFT size
-            const int SliceSize = MinFFTSize / 2;
-
-            // Accumulate contributions from each stage
-            for (size_t i = 0; i < m_backgroundStages.size(); ++i)
-                m_backgroundStages[i]->processInBackground(this, SliceSize);
-        }
-    }
-}
-
-void ReverbConvolver::process(const AudioChannel* sourceChannel, AudioChannel* destinationChannel, size_t framesToProcess)
-{
-    bool isSafe = sourceChannel && destinationChannel && sourceChannel->length() >= framesToProcess && destinationChannel->length() >= framesToProcess;
-    ASSERT(isSafe);
-    if (!isSafe)
-        return;
-
-    const float* source = sourceChannel->data();
-    float* destination = destinationChannel->mutableData();
-    bool isDataSafe = source && destination;
-    ASSERT(isDataSafe);
-    if (!isDataSafe)
-        return;
-
-    // Feed input buffer (read by all threads)
-    m_inputBuffer.write(source, framesToProcess);
-
-    // Accumulate contributions from each stage
-    for (size_t i = 0; i < m_stages.size(); ++i)
-        m_stages[i]->process(source, framesToProcess);
-
-    // Finally read from accumulation buffer
-    m_accumulationBuffer.readAndClear(destination, framesToProcess);
-
-    // Now that we've buffered more input, wake up our background thread.
-
-    // Not using a MutexLocker looks strange, but we use a tryLock() instead because this is run on the real-time
-    // thread where it is a disaster for the lock to be contended (causes audio glitching).  It's OK if we fail to
-    // signal from time to time, since we'll get to it the next time we're called.  We're called repeatedly
-    // and frequently (around every 3ms).  The background thread is processing well into the future and has a considerable amount of
-    // leeway here...
-    if (m_backgroundThreadLock.tryLock()) {
-        m_moreInputBuffered = true;
-        m_backgroundThreadCondition.signal();
-        m_backgroundThreadLock.unlock();
-    }
-}
-
-void ReverbConvolver::reset()
-{
-    for (size_t i = 0; i < m_stages.size(); ++i)
-        m_stages[i]->reset();
-
-    for (size_t i = 0; i < m_backgroundStages.size(); ++i)
-        m_backgroundStages[i]->reset();
-
-    m_accumulationBuffer.reset();
-    m_inputBuffer.reset();
-}
-
-size_t ReverbConvolver::latencyFrames() const
-{
-    return 0;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/ReverbConvolver.h b/Source/core/platform/audio/ReverbConvolver.h
deleted file mode 100644
index 9c2616b..0000000
--- a/Source/core/platform/audio/ReverbConvolver.h
+++ /dev/null
@@ -1,96 +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.
- * 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.
- *
- * 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 ReverbConvolver_h
-#define ReverbConvolver_h
-
-#include "core/platform/audio/AudioArray.h"
-#include "core/platform/audio/DirectConvolver.h"
-#include "core/platform/audio/FFTConvolver.h"
-#include "core/platform/audio/ReverbAccumulationBuffer.h"
-#include "core/platform/audio/ReverbConvolverStage.h"
-#include "core/platform/audio/ReverbInputBuffer.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/Threading.h"
-#include "wtf/ThreadingPrimitives.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class AudioChannel;
-
-class ReverbConvolver {
-public:
-    // maxFFTSize can be adjusted (from say 2048 to 32768) depending on how much precision is necessary.
-    // For certain tweaky de-convolving applications the phase errors add up quickly and lead to non-sensical results with
-    // larger FFT sizes and single-precision floats.  In these cases 2048 is a good size.
-    // If not doing multi-threaded convolution, then should not go > 8192.
-    ReverbConvolver(AudioChannel* impulseResponse, size_t renderSliceSize, size_t maxFFTSize, size_t convolverRenderPhase, bool useBackgroundThreads);
-    ~ReverbConvolver();
-
-    void process(const AudioChannel* sourceChannel, AudioChannel* destinationChannel, size_t framesToProcess);
-    void reset();
-
-    size_t impulseResponseLength() const { return m_impulseResponseLength; }
-
-    ReverbInputBuffer* inputBuffer() { return &m_inputBuffer; }
-
-    bool useBackgroundThreads() const { return m_useBackgroundThreads; }
-    void backgroundThreadEntry();
-
-    size_t latencyFrames() const;
-private:
-    Vector<OwnPtr<ReverbConvolverStage> > m_stages;
-    Vector<OwnPtr<ReverbConvolverStage> > m_backgroundStages;
-    size_t m_impulseResponseLength;
-
-    ReverbAccumulationBuffer m_accumulationBuffer;
-
-    // One or more background threads read from this input buffer which is fed from the realtime thread.
-    ReverbInputBuffer m_inputBuffer;
-
-    // First stage will be of size m_minFFTSize.  Each next stage will be twice as big until we hit m_maxFFTSize.
-    size_t m_minFFTSize;
-    size_t m_maxFFTSize;
-
-    // But don't exceed this size in the real-time thread (if we're doing background processing).
-    size_t m_maxRealtimeFFTSize;
-
-    // Background thread and synchronization
-    bool m_useBackgroundThreads;
-    ThreadIdentifier m_backgroundThread;
-    bool m_wantsToExit;
-    bool m_moreInputBuffered;
-    mutable Mutex m_backgroundThreadLock;
-    mutable ThreadCondition m_backgroundThreadCondition;
-};
-
-} // namespace WebCore
-
-#endif // ReverbConvolver_h
diff --git a/Source/core/platform/audio/ReverbConvolverStage.cpp b/Source/core/platform/audio/ReverbConvolverStage.cpp
deleted file mode 100644
index 51fe898..0000000
--- a/Source/core/platform/audio/ReverbConvolverStage.cpp
+++ /dev/null
@@ -1,185 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/ReverbConvolverStage.h"
-
-#include "core/platform/audio/ReverbAccumulationBuffer.h"
-#include "core/platform/audio/ReverbConvolver.h"
-#include "core/platform/audio/ReverbInputBuffer.h"
-#include "core/platform/audio/VectorMath.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebCore {
-
-using namespace VectorMath;
-
-ReverbConvolverStage::ReverbConvolverStage(const float* impulseResponse, size_t, size_t reverbTotalLatency, size_t stageOffset, size_t stageLength,
-                                           size_t fftSize, size_t renderPhase, size_t renderSliceSize, ReverbAccumulationBuffer* accumulationBuffer, bool directMode)
-    : m_accumulationBuffer(accumulationBuffer)
-    , m_accumulationReadIndex(0)
-    , m_inputReadIndex(0)
-    , m_directMode(directMode)
-{
-    ASSERT(impulseResponse);
-    ASSERT(accumulationBuffer);
-
-    if (!m_directMode) {
-        m_fftKernel = adoptPtr(new FFTFrame(fftSize));
-        m_fftKernel->doPaddedFFT(impulseResponse + stageOffset, stageLength);
-        m_fftConvolver = adoptPtr(new FFTConvolver(fftSize));
-    } else {
-        ASSERT(!stageOffset);
-        ASSERT(stageLength <= fftSize / 2);
-
-        m_directKernel = adoptPtr(new AudioFloatArray(fftSize / 2));
-        m_directKernel->copyToRange(impulseResponse, 0, stageLength);
-        m_directConvolver = adoptPtr(new DirectConvolver(renderSliceSize));
-    }
-    m_temporaryBuffer.allocate(renderSliceSize);
-
-    // The convolution stage at offset stageOffset needs to have a corresponding delay to cancel out the offset.
-    size_t totalDelay = stageOffset + reverbTotalLatency;
-
-    // But, the FFT convolution itself incurs fftSize / 2 latency, so subtract this out...
-    size_t halfSize = fftSize / 2;
-    if (!m_directMode) {
-        ASSERT(totalDelay >= halfSize);
-        if (totalDelay >= halfSize)
-            totalDelay -= halfSize;
-    }
-
-    // We divide up the total delay, into pre and post delay sections so that we can schedule at exactly the moment when the FFT will happen.
-    // This is coordinated with the other stages, so they don't all do their FFTs at the same time...
-    int maxPreDelayLength = std::min(halfSize, totalDelay);
-    m_preDelayLength = totalDelay > 0 ? renderPhase % maxPreDelayLength : 0;
-    if (m_preDelayLength > totalDelay)
-        m_preDelayLength = 0;
-
-    m_postDelayLength = totalDelay - m_preDelayLength;
-    m_preReadWriteIndex = 0;
-    m_framesProcessed = 0; // total frames processed so far
-
-    size_t delayBufferSize = m_preDelayLength < fftSize ? fftSize : m_preDelayLength;
-    delayBufferSize = delayBufferSize < renderSliceSize ? renderSliceSize : delayBufferSize;
-    m_preDelayBuffer.allocate(delayBufferSize);
-}
-
-void ReverbConvolverStage::processInBackground(ReverbConvolver* convolver, size_t framesToProcess)
-{
-    ReverbInputBuffer* inputBuffer = convolver->inputBuffer();
-    float* source = inputBuffer->directReadFrom(&m_inputReadIndex, framesToProcess);
-    process(source, framesToProcess);
-}
-
-void ReverbConvolverStage::process(const float* source, size_t framesToProcess)
-{
-    ASSERT(source);
-    if (!source)
-        return;
-
-    // Deal with pre-delay stream : note special handling of zero delay.
-
-    const float* preDelayedSource;
-    float* preDelayedDestination;
-    float* temporaryBuffer;
-    bool isTemporaryBufferSafe = false;
-    if (m_preDelayLength > 0) {
-        // Handles both the read case (call to process() ) and the write case (memcpy() )
-        bool isPreDelaySafe = m_preReadWriteIndex + framesToProcess <= m_preDelayBuffer.size();
-        ASSERT(isPreDelaySafe);
-        if (!isPreDelaySafe)
-            return;
-
-        isTemporaryBufferSafe = framesToProcess <= m_temporaryBuffer.size();
-
-        preDelayedDestination = m_preDelayBuffer.data() + m_preReadWriteIndex;
-        preDelayedSource = preDelayedDestination;
-        temporaryBuffer = m_temporaryBuffer.data();
-    } else {
-        // Zero delay
-        preDelayedDestination = 0;
-        preDelayedSource = source;
-        temporaryBuffer = m_preDelayBuffer.data();
-
-        isTemporaryBufferSafe = framesToProcess <= m_preDelayBuffer.size();
-    }
-
-    ASSERT(isTemporaryBufferSafe);
-    if (!isTemporaryBufferSafe)
-        return;
-
-    if (m_framesProcessed < m_preDelayLength) {
-        // For the first m_preDelayLength frames don't process the convolver, instead simply buffer in the pre-delay.
-        // But while buffering the pre-delay, we still need to update our index.
-        m_accumulationBuffer->updateReadIndex(&m_accumulationReadIndex, framesToProcess);
-    } else {
-        // Now, run the convolution (into the delay buffer).
-        // An expensive FFT will happen every fftSize / 2 frames.
-        // We process in-place here...
-        if (!m_directMode)
-            m_fftConvolver->process(m_fftKernel.get(), preDelayedSource, temporaryBuffer, framesToProcess);
-        else
-            m_directConvolver->process(m_directKernel.get(), preDelayedSource, temporaryBuffer, framesToProcess);
-
-        // Now accumulate into reverb's accumulation buffer.
-        m_accumulationBuffer->accumulate(temporaryBuffer, framesToProcess, &m_accumulationReadIndex, m_postDelayLength);
-    }
-
-    // Finally copy input to pre-delay.
-    if (m_preDelayLength > 0) {
-        memcpy(preDelayedDestination, source, sizeof(float) * framesToProcess);
-        m_preReadWriteIndex += framesToProcess;
-
-        ASSERT(m_preReadWriteIndex <= m_preDelayLength);
-        if (m_preReadWriteIndex >= m_preDelayLength)
-            m_preReadWriteIndex = 0;
-    }
-
-    m_framesProcessed += framesToProcess;
-}
-
-void ReverbConvolverStage::reset()
-{
-    if (!m_directMode)
-        m_fftConvolver->reset();
-    else
-        m_directConvolver->reset();
-    m_preDelayBuffer.zero();
-    m_accumulationReadIndex = 0;
-    m_inputReadIndex = 0;
-    m_framesProcessed = 0;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/ReverbConvolverStage.h b/Source/core/platform/audio/ReverbConvolverStage.h
deleted file mode 100644
index c88f41b..0000000
--- a/Source/core/platform/audio/ReverbConvolverStage.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:
- *
- * 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.
- * 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.
- *
- * 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 ReverbConvolverStage_h
-#define ReverbConvolverStage_h
-
-#include "core/platform/audio/AudioArray.h"
-#include "core/platform/audio/FFTFrame.h"
-#include "wtf/OwnPtr.h"
-
-namespace WebCore {
-
-class ReverbAccumulationBuffer;
-class ReverbConvolver;
-class FFTConvolver;
-class DirectConvolver;
-
-// A ReverbConvolverStage represents the convolution associated with a sub-section of a large impulse response.
-// It incorporates a delay line to account for the offset of the sub-section within the larger impulse response.
-class ReverbConvolverStage {
-public:
-    // renderPhase is useful to know so that we can manipulate the pre versus post delay so that stages will perform
-    // their heavy work (FFT processing) on different slices to balance the load in a real-time thread.
-    ReverbConvolverStage(const float* impulseResponse, size_t responseLength, size_t reverbTotalLatency, size_t stageOffset, size_t stageLength, size_t fftSize, size_t renderPhase, size_t renderSliceSize, ReverbAccumulationBuffer*, bool directMode = false);
-
-    // WARNING: framesToProcess must be such that it evenly divides the delay buffer size (stage_offset).
-    void process(const float* source, size_t framesToProcess);
-
-    void processInBackground(ReverbConvolver* convolver, size_t framesToProcess);
-
-    void reset();
-
-    // Useful for background processing
-    int inputReadIndex() const { return m_inputReadIndex; }
-
-private:
-    OwnPtr<FFTFrame> m_fftKernel;
-    OwnPtr<FFTConvolver> m_fftConvolver;
-
-    AudioFloatArray m_preDelayBuffer;
-
-    ReverbAccumulationBuffer* m_accumulationBuffer;
-    int m_accumulationReadIndex;
-    int m_inputReadIndex;
-
-    size_t m_preDelayLength;
-    size_t m_postDelayLength;
-    size_t m_preReadWriteIndex;
-    size_t m_framesProcessed;
-
-    AudioFloatArray m_temporaryBuffer;
-
-    bool m_directMode;
-    OwnPtr<AudioFloatArray> m_directKernel;
-    OwnPtr<DirectConvolver> m_directConvolver;
-};
-
-} // namespace WebCore
-
-#endif // ReverbConvolverStage_h
diff --git a/Source/core/platform/audio/ReverbInputBuffer.cpp b/Source/core/platform/audio/ReverbInputBuffer.cpp
deleted file mode 100644
index 0a6dca7..0000000
--- a/Source/core/platform/audio/ReverbInputBuffer.cpp
+++ /dev/null
@@ -1,89 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/ReverbInputBuffer.h"
-
-namespace WebCore {
-
-ReverbInputBuffer::ReverbInputBuffer(size_t length)
-    : m_buffer(length)
-    , m_writeIndex(0)
-{
-}
-
-void ReverbInputBuffer::write(const float* sourceP, size_t numberOfFrames)
-{
-    size_t bufferLength = m_buffer.size();
-    bool isCopySafe = m_writeIndex + numberOfFrames <= bufferLength;
-    ASSERT(isCopySafe);
-    if (!isCopySafe)
-        return;
-
-    memcpy(m_buffer.data() + m_writeIndex, sourceP, sizeof(float) * numberOfFrames);
-
-    m_writeIndex += numberOfFrames;
-    ASSERT(m_writeIndex <= bufferLength);
-
-    if (m_writeIndex >= bufferLength)
-        m_writeIndex = 0;
-}
-
-float* ReverbInputBuffer::directReadFrom(int* readIndex, size_t numberOfFrames)
-{
-    size_t bufferLength = m_buffer.size();
-    bool isPointerGood = readIndex && *readIndex >= 0 && *readIndex + numberOfFrames <= bufferLength;
-    ASSERT(isPointerGood);
-    if (!isPointerGood) {
-        // Should never happen in practice but return pointer to start of buffer (avoid crash)
-        if (readIndex)
-            *readIndex = 0;
-        return m_buffer.data();
-    }
-
-    float* sourceP = m_buffer.data();
-    float* p = sourceP + *readIndex;
-
-    // Update readIndex
-    *readIndex = (*readIndex + numberOfFrames) % bufferLength;
-
-    return p;
-}
-
-void ReverbInputBuffer::reset()
-{
-    m_buffer.zero();
-    m_writeIndex = 0;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/ReverbInputBuffer.h b/Source/core/platform/audio/ReverbInputBuffer.h
deleted file mode 100644
index ea1233f..0000000
--- a/Source/core/platform/audio/ReverbInputBuffer.h
+++ /dev/null
@@ -1,64 +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.
- * 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.
- *
- * 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 ReverbInputBuffer_h
-#define ReverbInputBuffer_h
-
-#include "core/platform/audio/AudioArray.h"
-
-namespace WebCore {
-
-// ReverbInputBuffer is used to buffer input samples for deferred processing by the background threads.
-class ReverbInputBuffer {
-public:
-    ReverbInputBuffer(size_t length);
-
-    // The realtime audio thread keeps writing samples here.
-    // The assumption is that the buffer's length is evenly divisible by numberOfFrames (for nearly all cases this will be fine).
-    // FIXME: remove numberOfFrames restriction...
-    void write(const float* sourceP, size_t numberOfFrames);
-
-    // Background threads can call this to check if there's anything to read...
-    size_t writeIndex() const { return m_writeIndex; }
-
-    // The individual background threads read here (and hope that they can keep up with the buffer writing).
-    // readIndex is updated with the next readIndex to read from...
-    // The assumption is that the buffer's length is evenly divisible by numberOfFrames.
-    // FIXME: remove numberOfFrames restriction...
-    float* directReadFrom(int* readIndex, size_t numberOfFrames);
-
-    void reset();
-
-private:
-    AudioFloatArray m_buffer;
-    size_t m_writeIndex;
-};
-
-} // namespace WebCore
-
-#endif // ReverbInputBuffer_h
diff --git a/Source/core/platform/audio/SincResampler.cpp b/Source/core/platform/audio/SincResampler.cpp
deleted file mode 100644
index d429fbc..0000000
--- a/Source/core/platform/audio/SincResampler.cpp
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/SincResampler.h"
-
-#include "core/platform/audio/AudioBus.h"
-#include "wtf/MathExtras.h"
-
-#ifdef __SSE2__
-#include <emmintrin.h>
-#endif
-
-using namespace std;
-
-// Input buffer layout, dividing the total buffer into regions (r0 - r5):
-//
-// |----------------|----------------------------------------------------------------|----------------|
-//
-//                                              blockSize + kernelSize / 2
-//                   <-------------------------------------------------------------------------------->
-//                                                  r0
-//
-//   kernelSize / 2   kernelSize / 2                                 kernelSize / 2     kernelSize / 2
-// <---------------> <--------------->                              <---------------> <--------------->
-//         r1                r2                                             r3                r4
-//
-//                                              blockSize
-//                                     <-------------------------------------------------------------->
-//                                                  r5
-
-// The Algorithm:
-//
-// 1) Consume input frames into r0 (r1 is zero-initialized).
-// 2) Position kernel centered at start of r0 (r2) and generate output frames until kernel is centered at start of r4.
-//    or we've finished generating all the output frames.
-// 3) Copy r3 to r1 and r4 to r2.
-// 4) Consume input frames into r5 (zero-pad if we run out of input).
-// 5) Goto (2) until all of input is consumed.
-//
-// note: we're glossing over how the sub-sample handling works with m_virtualSourceIndex, etc.
-
-namespace WebCore {
-
-SincResampler::SincResampler(double scaleFactor, unsigned kernelSize, unsigned numberOfKernelOffsets)
-    : m_scaleFactor(scaleFactor)
-    , m_kernelSize(kernelSize)
-    , m_numberOfKernelOffsets(numberOfKernelOffsets)
-    , m_kernelStorage(m_kernelSize * (m_numberOfKernelOffsets + 1))
-    , m_virtualSourceIndex(0)
-    , m_blockSize(512)
-    , m_inputBuffer(m_blockSize + m_kernelSize) // See input buffer layout above.
-    , m_source(0)
-    , m_sourceFramesAvailable(0)
-    , m_sourceProvider(0)
-    , m_isBufferPrimed(false)
-{
-    initializeKernel();
-}
-
-void SincResampler::initializeKernel()
-{
-    // Blackman window parameters.
-    double alpha = 0.16;
-    double a0 = 0.5 * (1.0 - alpha);
-    double a1 = 0.5;
-    double a2 = 0.5 * alpha;
-
-    // sincScaleFactor is basically the normalized cutoff frequency of the low-pass filter.
-    double sincScaleFactor = m_scaleFactor > 1.0 ? 1.0 / m_scaleFactor : 1.0;
-
-    // The sinc function is an idealized brick-wall filter, but since we're windowing it the
-    // transition from pass to stop does not happen right away. So we should adjust the
-    // lowpass filter cutoff slightly downward to avoid some aliasing at the very high-end.
-    // FIXME: this value is empirical and to be more exact should vary depending on m_kernelSize.
-    sincScaleFactor *= 0.9;
-
-    int n = m_kernelSize;
-    int halfSize = n / 2;
-
-    // Generates a set of windowed sinc() kernels.
-    // We generate a range of sub-sample offsets from 0.0 to 1.0.
-    for (unsigned offsetIndex = 0; offsetIndex <= m_numberOfKernelOffsets; ++offsetIndex) {
-        double subsampleOffset = static_cast<double>(offsetIndex) / m_numberOfKernelOffsets;
-
-        for (int i = 0; i < n; ++i) {
-            // Compute the sinc() with offset.
-            double s = sincScaleFactor * piDouble * (i - halfSize - subsampleOffset);
-            double sinc = !s ? 1.0 : sin(s) / s;
-            sinc *= sincScaleFactor;
-
-            // Compute Blackman window, matching the offset of the sinc().
-            double x = (i - subsampleOffset) / n;
-            double window = a0 - a1 * cos(2.0 * piDouble * x) + a2 * cos(4.0 * piDouble * x);
-
-            // Window the sinc() function and store at the correct offset.
-            m_kernelStorage[i + offsetIndex * m_kernelSize] = sinc * window;
-        }
-    }
-}
-
-void SincResampler::consumeSource(float* buffer, unsigned numberOfSourceFrames)
-{
-    ASSERT(m_sourceProvider);
-    if (!m_sourceProvider)
-        return;
-
-    // Wrap the provided buffer by an AudioBus for use by the source provider.
-    RefPtr<AudioBus> bus = AudioBus::create(1, numberOfSourceFrames, false);
-
-    // FIXME: Find a way to make the following const-correct:
-    bus->setChannelMemory(0, buffer, numberOfSourceFrames);
-
-    m_sourceProvider->provideInput(bus.get(), numberOfSourceFrames);
-}
-
-namespace {
-
-// BufferSourceProvider is an AudioSourceProvider wrapping an in-memory buffer.
-
-class BufferSourceProvider : public AudioSourceProvider {
-public:
-    BufferSourceProvider(const float* source, size_t numberOfSourceFrames)
-        : m_source(source)
-        , m_sourceFramesAvailable(numberOfSourceFrames)
-    {
-    }
-
-    // Consumes samples from the in-memory buffer.
-    virtual void provideInput(AudioBus* bus, size_t framesToProcess)
-    {
-        ASSERT(m_source && bus);
-        if (!m_source || !bus)
-            return;
-
-        float* buffer = bus->channel(0)->mutableData();
-
-        // Clamp to number of frames available and zero-pad.
-        size_t framesToCopy = min(m_sourceFramesAvailable, framesToProcess);
-        memcpy(buffer, m_source, sizeof(float) * framesToCopy);
-
-        // Zero-pad if necessary.
-        if (framesToCopy < framesToProcess)
-            memset(buffer + framesToCopy, 0, sizeof(float) * (framesToProcess - framesToCopy));
-
-        m_sourceFramesAvailable -= framesToCopy;
-        m_source += framesToCopy;
-    }
-
-private:
-    const float* m_source;
-    size_t m_sourceFramesAvailable;
-};
-
-} // namespace
-
-void SincResampler::process(const float* source, float* destination, unsigned numberOfSourceFrames)
-{
-    // Resample an in-memory buffer using an AudioSourceProvider.
-    BufferSourceProvider sourceProvider(source, numberOfSourceFrames);
-
-    unsigned numberOfDestinationFrames = static_cast<unsigned>(numberOfSourceFrames / m_scaleFactor);
-    unsigned remaining = numberOfDestinationFrames;
-
-    while (remaining) {
-        unsigned framesThisTime = min(remaining, m_blockSize);
-        process(&sourceProvider, destination, framesThisTime);
-
-        destination += framesThisTime;
-        remaining -= framesThisTime;
-    }
-}
-
-void SincResampler::process(AudioSourceProvider* sourceProvider, float* destination, size_t framesToProcess)
-{
-    bool isGood = sourceProvider && m_blockSize > m_kernelSize && m_inputBuffer.size() >= m_blockSize + m_kernelSize && !(m_kernelSize % 2);
-    ASSERT(isGood);
-    if (!isGood)
-        return;
-
-    m_sourceProvider = sourceProvider;
-
-    unsigned numberOfDestinationFrames = framesToProcess;
-
-    // Setup various region pointers in the buffer (see diagram above).
-    float* r0 = m_inputBuffer.data() + m_kernelSize / 2;
-    float* r1 = m_inputBuffer.data();
-    float* r2 = r0;
-    float* r3 = r0 + m_blockSize - m_kernelSize / 2;
-    float* r4 = r0 + m_blockSize;
-    float* r5 = r0 + m_kernelSize / 2;
-
-    // Step (1)
-    // Prime the input buffer at the start of the input stream.
-    if (!m_isBufferPrimed) {
-        consumeSource(r0, m_blockSize + m_kernelSize / 2);
-        m_isBufferPrimed = true;
-    }
-
-    // Step (2)
-
-    while (numberOfDestinationFrames) {
-        while (m_virtualSourceIndex < m_blockSize) {
-            // m_virtualSourceIndex lies in between two kernel offsets so figure out what they are.
-            int sourceIndexI = static_cast<int>(m_virtualSourceIndex);
-            double subsampleRemainder = m_virtualSourceIndex - sourceIndexI;
-
-            double virtualOffsetIndex = subsampleRemainder * m_numberOfKernelOffsets;
-            int offsetIndex = static_cast<int>(virtualOffsetIndex);
-
-            float* k1 = m_kernelStorage.data() + offsetIndex * m_kernelSize;
-            float* k2 = k1 + m_kernelSize;
-
-            // Initialize input pointer based on quantized m_virtualSourceIndex.
-            float* inputP = r1 + sourceIndexI;
-
-            // We'll compute "convolutions" for the two kernels which straddle m_virtualSourceIndex
-            float sum1 = 0;
-            float sum2 = 0;
-
-            // Figure out how much to weight each kernel's "convolution".
-            double kernelInterpolationFactor = virtualOffsetIndex - offsetIndex;
-
-            // Generate a single output sample.
-            int n = m_kernelSize;
-
-#define CONVOLVE_ONE_SAMPLE      \
-            input = *inputP++;   \
-            sum1 += input * *k1; \
-            sum2 += input * *k2; \
-            ++k1;                \
-            ++k2;
-
-            {
-                float input;
-
-#ifdef __SSE2__
-                // If the sourceP address is not 16-byte aligned, the first several frames (at most three) should be processed seperately.
-                while ((reinterpret_cast<uintptr_t>(inputP) & 0x0F) && n) {
-                    CONVOLVE_ONE_SAMPLE
-                    n--;
-                }
-
-                // Now the inputP is aligned and start to apply SSE.
-                float* endP = inputP + n - n % 4;
-                __m128 mInput;
-                __m128 mK1;
-                __m128 mK2;
-                __m128 mul1;
-                __m128 mul2;
-
-                __m128 sums1 = _mm_setzero_ps();
-                __m128 sums2 = _mm_setzero_ps();
-                bool k1Aligned = !(reinterpret_cast<uintptr_t>(k1) & 0x0F);
-                bool k2Aligned = !(reinterpret_cast<uintptr_t>(k2) & 0x0F);
-
-#define LOAD_DATA(l1, l2)                        \
-                mInput = _mm_load_ps(inputP);    \
-                mK1 = _mm_##l1##_ps(k1);         \
-                mK2 = _mm_##l2##_ps(k2);
-
-#define CONVOLVE_4_SAMPLES                       \
-                mul1 = _mm_mul_ps(mInput, mK1);  \
-                mul2 = _mm_mul_ps(mInput, mK2);  \
-                sums1 = _mm_add_ps(sums1, mul1); \
-                sums2 = _mm_add_ps(sums2, mul2); \
-                inputP += 4;                     \
-                k1 += 4;                         \
-                k2 += 4;
-
-                if (k1Aligned && k2Aligned) { // both aligned
-                    while (inputP < endP) {
-                        LOAD_DATA(load, load)
-                        CONVOLVE_4_SAMPLES
-                    }
-                } else if (!k1Aligned && k2Aligned) { // only k2 aligned
-                    while (inputP < endP) {
-                        LOAD_DATA(loadu, load)
-                        CONVOLVE_4_SAMPLES
-                    }
-                } else if (k1Aligned && !k2Aligned) { // only k1 aligned
-                    while (inputP < endP) {
-                        LOAD_DATA(load, loadu)
-                        CONVOLVE_4_SAMPLES
-                    }
-                } else { // both non-aligned
-                    while (inputP < endP) {
-                        LOAD_DATA(loadu, loadu)
-                        CONVOLVE_4_SAMPLES
-                    }
-                }
-
-                // Summarize the SSE results to sum1 and sum2.
-                float* groupSumP = reinterpret_cast<float*>(&sums1);
-                sum1 += groupSumP[0] + groupSumP[1] + groupSumP[2] + groupSumP[3];
-                groupSumP = reinterpret_cast<float*>(&sums2);
-                sum2 += groupSumP[0] + groupSumP[1] + groupSumP[2] + groupSumP[3];
-
-                n %= 4;
-                while (n) {
-                    CONVOLVE_ONE_SAMPLE
-                    n--;
-                }
-#else
-                // FIXME: add ARM NEON optimizations for the following. The scalar code-path can probably also be optimized better.
-
-                // Optimize size 32 and size 64 kernels by unrolling the while loop.
-                // A 20 - 30% speed improvement was measured in some cases by using this approach.
-
-                if (n == 32) {
-                    CONVOLVE_ONE_SAMPLE // 1
-                    CONVOLVE_ONE_SAMPLE // 2
-                    CONVOLVE_ONE_SAMPLE // 3
-                    CONVOLVE_ONE_SAMPLE // 4
-                    CONVOLVE_ONE_SAMPLE // 5
-                    CONVOLVE_ONE_SAMPLE // 6
-                    CONVOLVE_ONE_SAMPLE // 7
-                    CONVOLVE_ONE_SAMPLE // 8
-                    CONVOLVE_ONE_SAMPLE // 9
-                    CONVOLVE_ONE_SAMPLE // 10
-                    CONVOLVE_ONE_SAMPLE // 11
-                    CONVOLVE_ONE_SAMPLE // 12
-                    CONVOLVE_ONE_SAMPLE // 13
-                    CONVOLVE_ONE_SAMPLE // 14
-                    CONVOLVE_ONE_SAMPLE // 15
-                    CONVOLVE_ONE_SAMPLE // 16
-                    CONVOLVE_ONE_SAMPLE // 17
-                    CONVOLVE_ONE_SAMPLE // 18
-                    CONVOLVE_ONE_SAMPLE // 19
-                    CONVOLVE_ONE_SAMPLE // 20
-                    CONVOLVE_ONE_SAMPLE // 21
-                    CONVOLVE_ONE_SAMPLE // 22
-                    CONVOLVE_ONE_SAMPLE // 23
-                    CONVOLVE_ONE_SAMPLE // 24
-                    CONVOLVE_ONE_SAMPLE // 25
-                    CONVOLVE_ONE_SAMPLE // 26
-                    CONVOLVE_ONE_SAMPLE // 27
-                    CONVOLVE_ONE_SAMPLE // 28
-                    CONVOLVE_ONE_SAMPLE // 29
-                    CONVOLVE_ONE_SAMPLE // 30
-                    CONVOLVE_ONE_SAMPLE // 31
-                    CONVOLVE_ONE_SAMPLE // 32
-                } else if (n == 64) {
-                    CONVOLVE_ONE_SAMPLE // 1
-                    CONVOLVE_ONE_SAMPLE // 2
-                    CONVOLVE_ONE_SAMPLE // 3
-                    CONVOLVE_ONE_SAMPLE // 4
-                    CONVOLVE_ONE_SAMPLE // 5
-                    CONVOLVE_ONE_SAMPLE // 6
-                    CONVOLVE_ONE_SAMPLE // 7
-                    CONVOLVE_ONE_SAMPLE // 8
-                    CONVOLVE_ONE_SAMPLE // 9
-                    CONVOLVE_ONE_SAMPLE // 10
-                    CONVOLVE_ONE_SAMPLE // 11
-                    CONVOLVE_ONE_SAMPLE // 12
-                    CONVOLVE_ONE_SAMPLE // 13
-                    CONVOLVE_ONE_SAMPLE // 14
-                    CONVOLVE_ONE_SAMPLE // 15
-                    CONVOLVE_ONE_SAMPLE // 16
-                    CONVOLVE_ONE_SAMPLE // 17
-                    CONVOLVE_ONE_SAMPLE // 18
-                    CONVOLVE_ONE_SAMPLE // 19
-                    CONVOLVE_ONE_SAMPLE // 20
-                    CONVOLVE_ONE_SAMPLE // 21
-                    CONVOLVE_ONE_SAMPLE // 22
-                    CONVOLVE_ONE_SAMPLE // 23
-                    CONVOLVE_ONE_SAMPLE // 24
-                    CONVOLVE_ONE_SAMPLE // 25
-                    CONVOLVE_ONE_SAMPLE // 26
-                    CONVOLVE_ONE_SAMPLE // 27
-                    CONVOLVE_ONE_SAMPLE // 28
-                    CONVOLVE_ONE_SAMPLE // 29
-                    CONVOLVE_ONE_SAMPLE // 30
-                    CONVOLVE_ONE_SAMPLE // 31
-                    CONVOLVE_ONE_SAMPLE // 32
-                    CONVOLVE_ONE_SAMPLE // 33
-                    CONVOLVE_ONE_SAMPLE // 34
-                    CONVOLVE_ONE_SAMPLE // 35
-                    CONVOLVE_ONE_SAMPLE // 36
-                    CONVOLVE_ONE_SAMPLE // 37
-                    CONVOLVE_ONE_SAMPLE // 38
-                    CONVOLVE_ONE_SAMPLE // 39
-                    CONVOLVE_ONE_SAMPLE // 40
-                    CONVOLVE_ONE_SAMPLE // 41
-                    CONVOLVE_ONE_SAMPLE // 42
-                    CONVOLVE_ONE_SAMPLE // 43
-                    CONVOLVE_ONE_SAMPLE // 44
-                    CONVOLVE_ONE_SAMPLE // 45
-                    CONVOLVE_ONE_SAMPLE // 46
-                    CONVOLVE_ONE_SAMPLE // 47
-                    CONVOLVE_ONE_SAMPLE // 48
-                    CONVOLVE_ONE_SAMPLE // 49
-                    CONVOLVE_ONE_SAMPLE // 50
-                    CONVOLVE_ONE_SAMPLE // 51
-                    CONVOLVE_ONE_SAMPLE // 52
-                    CONVOLVE_ONE_SAMPLE // 53
-                    CONVOLVE_ONE_SAMPLE // 54
-                    CONVOLVE_ONE_SAMPLE // 55
-                    CONVOLVE_ONE_SAMPLE // 56
-                    CONVOLVE_ONE_SAMPLE // 57
-                    CONVOLVE_ONE_SAMPLE // 58
-                    CONVOLVE_ONE_SAMPLE // 59
-                    CONVOLVE_ONE_SAMPLE // 60
-                    CONVOLVE_ONE_SAMPLE // 61
-                    CONVOLVE_ONE_SAMPLE // 62
-                    CONVOLVE_ONE_SAMPLE // 63
-                    CONVOLVE_ONE_SAMPLE // 64
-                } else {
-                    while (n--) {
-                        // Non-optimized using actual while loop.
-                        CONVOLVE_ONE_SAMPLE
-                    }
-                }
-#endif
-            }
-
-            // Linearly interpolate the two "convolutions".
-            double result = (1.0 - kernelInterpolationFactor) * sum1 + kernelInterpolationFactor * sum2;
-
-            *destination++ = result;
-
-            // Advance the virtual index.
-            m_virtualSourceIndex += m_scaleFactor;
-
-            --numberOfDestinationFrames;
-            if (!numberOfDestinationFrames)
-                return;
-        }
-
-        // Wrap back around to the start.
-        m_virtualSourceIndex -= m_blockSize;
-
-        // Step (3) Copy r3 to r1 and r4 to r2.
-        // This wraps the last input frames back to the start of the buffer.
-        memcpy(r1, r3, sizeof(float) * (m_kernelSize / 2));
-        memcpy(r2, r4, sizeof(float) * (m_kernelSize / 2));
-
-        // Step (4)
-        // Refresh the buffer with more input.
-        consumeSource(r5, m_blockSize);
-    }
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/SincResampler.h b/Source/core/platform/audio/SincResampler.h
deleted file mode 100644
index 807596e..0000000
--- a/Source/core/platform/audio/SincResampler.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 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.
- *
- * 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 SincResampler_h
-#define SincResampler_h
-
-#include "core/platform/audio/AudioArray.h"
-#include "core/platform/audio/AudioSourceProvider.h"
-
-namespace WebCore {
-
-// SincResampler is a high-quality sample-rate converter.
-
-class SincResampler {
-public:
-    // scaleFactor == sourceSampleRate / destinationSampleRate
-    // kernelSize can be adjusted for quality (higher is better)
-    // numberOfKernelOffsets is used for interpolation and is the number of sub-sample kernel shifts.
-    SincResampler(double scaleFactor, unsigned kernelSize = 32, unsigned numberOfKernelOffsets = 32);
-
-    // Processes numberOfSourceFrames from source to produce numberOfSourceFrames / scaleFactor frames in destination.
-    void process(const float* source, float* destination, unsigned numberOfSourceFrames);
-
-    // Process with input source callback function for streaming applications.
-    void process(AudioSourceProvider*, float* destination, size_t framesToProcess);
-
-protected:
-    void initializeKernel();
-    void consumeSource(float* buffer, unsigned numberOfSourceFrames);
-
-    double m_scaleFactor;
-    unsigned m_kernelSize;
-    unsigned m_numberOfKernelOffsets;
-
-    // m_kernelStorage has m_numberOfKernelOffsets kernels back-to-back, each of size m_kernelSize.
-    // The kernel offsets are sub-sample shifts of a windowed sinc() shifted from 0.0 to 1.0 sample.
-    AudioFloatArray m_kernelStorage;
-
-    // m_virtualSourceIndex is an index on the source input buffer with sub-sample precision.
-    // It must be double precision to avoid drift.
-    double m_virtualSourceIndex;
-
-    // This is the number of destination frames we generate per processing pass on the buffer.
-    unsigned m_blockSize;
-
-    // Source is copied into this buffer for each processing pass.
-    AudioFloatArray m_inputBuffer;
-
-    const float* m_source;
-    unsigned m_sourceFramesAvailable;
-
-    // m_sourceProvider is used to provide the audio input stream to the resampler.
-    AudioSourceProvider* m_sourceProvider;
-
-    // The buffer is primed once at the very beginning of processing.
-    bool m_isBufferPrimed;
-};
-
-} // namespace WebCore
-
-#endif // SincResampler_h
diff --git a/Source/core/platform/audio/UpSampler.cpp b/Source/core/platform/audio/UpSampler.cpp
deleted file mode 100644
index ebc1761..0000000
--- a/Source/core/platform/audio/UpSampler.cpp
+++ /dev/null
@@ -1,134 +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.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/UpSampler.h"
-
-#include "wtf/MathExtras.h"
-
-namespace WebCore {
-
-UpSampler::UpSampler(size_t inputBlockSize)
-    : m_inputBlockSize(inputBlockSize)
-    , m_kernel(DefaultKernelSize)
-    , m_tempBuffer(inputBlockSize)
-    , m_inputBuffer(inputBlockSize * 2)
-    , m_convolver(inputBlockSize)
-{
-    initializeKernel();
-}
-
-void UpSampler::initializeKernel()
-{
-    // Blackman window parameters.
-    double alpha = 0.16;
-    double a0 = 0.5 * (1.0 - alpha);
-    double a1 = 0.5;
-    double a2 = 0.5 * alpha;
-
-    int n = m_kernel.size();
-    int halfSize = n / 2;
-    double subsampleOffset = -0.5;
-
-    for (int i = 0; i < n; ++i) {
-        // Compute the sinc() with offset.
-        double s = piDouble * (i - halfSize - subsampleOffset);
-        double sinc = !s ? 1.0 : sin(s) / s;
-
-        // Compute Blackman window, matching the offset of the sinc().
-        double x = (i - subsampleOffset) / n;
-        double window = a0 - a1 * cos(2.0 * piDouble * x) + a2 * cos(4.0 * piDouble * x);
-
-        // Window the sinc() function.
-        m_kernel[i] = sinc * window;
-    }
-}
-
-void UpSampler::process(const float* sourceP, float* destP, size_t sourceFramesToProcess)
-{
-    bool isInputBlockSizeGood = sourceFramesToProcess == m_inputBlockSize;
-    ASSERT(isInputBlockSizeGood);
-    if (!isInputBlockSizeGood)
-        return;
-
-    bool isTempBufferGood = sourceFramesToProcess == m_tempBuffer.size();
-    ASSERT(isTempBufferGood);
-    if (!isTempBufferGood)
-        return;
-
-    bool isKernelGood = m_kernel.size() == DefaultKernelSize;
-    ASSERT(isKernelGood);
-    if (!isKernelGood)
-        return;
-
-    size_t halfSize = m_kernel.size() / 2;
-
-    // Copy source samples to 2nd half of input buffer.
-    bool isInputBufferGood = m_inputBuffer.size() == sourceFramesToProcess * 2 && halfSize <= sourceFramesToProcess;
-    ASSERT(isInputBufferGood);
-    if (!isInputBufferGood)
-        return;
-
-    float* inputP = m_inputBuffer.data() + sourceFramesToProcess;
-    memcpy(inputP, sourceP, sizeof(float) * sourceFramesToProcess);
-
-    // Copy even sample-frames 0,2,4,6... (delayed by the linear phase delay) directly into destP.
-    for (unsigned i = 0; i < sourceFramesToProcess; ++i)
-        destP[i * 2] = *((inputP - halfSize) + i);
-
-    // Compute odd sample-frames 1,3,5,7...
-    float* oddSamplesP = m_tempBuffer.data();
-    m_convolver.process(&m_kernel, sourceP, oddSamplesP, sourceFramesToProcess);
-
-    for (unsigned i = 0; i < sourceFramesToProcess; ++i)
-        destP[i * 2 + 1] = oddSamplesP[i];
-
-    // Copy 2nd half of input buffer to 1st half.
-    memcpy(m_inputBuffer.data(), inputP, sizeof(float) * sourceFramesToProcess);
-}
-
-void UpSampler::reset()
-{
-    m_convolver.reset();
-    m_inputBuffer.zero();
-}
-
-size_t UpSampler::latencyFrames() const
-{
-    // Divide by two since this is a linear phase kernel and the delay is at the center of the kernel.
-    return m_kernel.size() / 2;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/UpSampler.h b/Source/core/platform/audio/UpSampler.h
deleted file mode 100644
index ebd3993..0000000
--- a/Source/core/platform/audio/UpSampler.h
+++ /dev/null
@@ -1,76 +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 UpSampler_h
-#define UpSampler_h
-
-#include "core/platform/audio/AudioArray.h"
-#include "core/platform/audio/DirectConvolver.h"
-
-namespace WebCore {
-
-// UpSampler up-samples the source stream by a factor of 2x.
-
-class UpSampler {
-public:
-    UpSampler(size_t inputBlockSize);
-
-    // The destination buffer |destP| is of size sourceFramesToProcess * 2.
-    void process(const float* sourceP, float* destP, size_t sourceFramesToProcess);
-
-    void reset();
-
-    // Latency based on the source sample-rate.
-    size_t latencyFrames() const;
-
-private:
-    enum { DefaultKernelSize = 128 };
-
-    size_t m_inputBlockSize;
-
-    // Computes ideal band-limited filter coefficients to sample in between each source sample-frame.
-    // This filter will be used to compute the odd sample-frames of the output.
-    void initializeKernel();
-    AudioFloatArray m_kernel;
-
-    // Computes the odd sample-frames of the output.
-    DirectConvolver m_convolver;
-
-    AudioFloatArray m_tempBuffer;
-
-    // Delay line for generating the even sample-frames of the output.
-    // The source samples are delayed exactly to match the linear phase delay of the FIR filter (convolution)
-    // used to generate the odd sample-frames of the output.
-    AudioFloatArray m_inputBuffer;
-};
-
-} // namespace WebCore
-
-#endif // UpSampler_h
diff --git a/Source/core/platform/audio/VectorMath.cpp b/Source/core/platform/audio/VectorMath.cpp
deleted file mode 100644
index d16f3c8..0000000
--- a/Source/core/platform/audio/VectorMath.cpp
+++ /dev/null
@@ -1,690 +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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/VectorMath.h"
-#include "wtf/Assertions.h"
-#include "wtf/CPU.h"
-#include <stdint.h>
-
-#if OS(MACOSX)
-#include <Accelerate/Accelerate.h>
-#endif
-
-#ifdef __SSE2__
-#include <emmintrin.h>
-#endif
-
-#if HAVE(ARM_NEON_INTRINSICS)
-#include <arm_neon.h>
-#endif
-
-#include <math.h>
-#include <algorithm>
-
-namespace WebCore {
-
-namespace VectorMath {
-
-#if OS(MACOSX)
-// On the Mac we use the highly optimized versions in Accelerate.framework
-// In 32-bit mode (__ppc__ or __i386__) <Accelerate/Accelerate.h> includes <vecLib/vDSP_translate.h> which defines macros of the same name as
-// our namespaced function names, so we must handle this case differently. Other architectures (64bit, ARM, etc.) do not include this header file.
-
-void vsmul(const float* sourceP, int sourceStride, const float* scale, float* destP, int destStride, size_t framesToProcess)
-{
-#if CPU(X86)
-    ::vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess);
-#else
-    vDSP_vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess);
-#endif
-}
-
-void vadd(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess)
-{
-#if CPU(X86)
-    ::vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
-#else
-    vDSP_vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
-#endif
-}
-
-void vmul(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess)
-{
-#if CPU(X86)
-    ::vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
-#else
-    vDSP_vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
-#endif
-}
-
-void zvmul(const float* real1P, const float* imag1P, const float* real2P, const float* imag2P, float* realDestP, float* imagDestP, size_t framesToProcess)
-{
-    DSPSplitComplex sc1;
-    DSPSplitComplex sc2;
-    DSPSplitComplex dest;
-    sc1.realp = const_cast<float*>(real1P);
-    sc1.imagp = const_cast<float*>(imag1P);
-    sc2.realp = const_cast<float*>(real2P);
-    sc2.imagp = const_cast<float*>(imag2P);
-    dest.realp = realDestP;
-    dest.imagp = imagDestP;
-#if CPU(X86)
-    ::zvmul(&sc1, 1, &sc2, 1, &dest, 1, framesToProcess, 1);
-#else
-    vDSP_zvmul(&sc1, 1, &sc2, 1, &dest, 1, framesToProcess, 1);
-#endif
-}
-
-void vsma(const float* sourceP, int sourceStride, const float* scale, float* destP, int destStride, size_t framesToProcess)
-{
-    vDSP_vsma(sourceP, sourceStride, scale, destP, destStride, destP, destStride, framesToProcess);
-}
-
-void vmaxmgv(const float* sourceP, int sourceStride, float* maxP, size_t framesToProcess)
-{
-    vDSP_maxmgv(sourceP, sourceStride, maxP, framesToProcess);
-}
-
-void vsvesq(const float* sourceP, int sourceStride, float* sumP, size_t framesToProcess)
-{
-    vDSP_svesq(const_cast<float*>(sourceP), sourceStride, sumP, framesToProcess);
-}
-
-void vclip(const float* sourceP, int sourceStride, const float* lowThresholdP, const float* highThresholdP, float* destP, int destStride, size_t framesToProcess)
-{
-    vDSP_vclip(const_cast<float*>(sourceP), sourceStride, const_cast<float*>(lowThresholdP), const_cast<float*>(highThresholdP), destP, destStride, framesToProcess);
-}
-#else
-
-void vsma(const float* sourceP, int sourceStride, const float* scale, float* destP, int destStride, size_t framesToProcess)
-{
-    int n = framesToProcess;
-
-#ifdef __SSE2__
-    if ((sourceStride == 1) && (destStride == 1)) {
-        float k = *scale;
-
-        // If the sourceP address is not 16-byte aligned, the first several frames (at most three) should be processed separately.
-        while ((reinterpret_cast<uintptr_t>(sourceP) & 0x0F) && n) {
-            *destP += k * *sourceP;
-            sourceP++;
-            destP++;
-            n--;
-        }
-
-        // Now the sourceP is aligned, use SSE.
-        int tailFrames = n % 4;
-        const float* endP = destP + n - tailFrames;
-
-        __m128 pSource;
-        __m128 dest;
-        __m128 temp;
-        __m128 mScale = _mm_set_ps1(k);
-
-        bool destAligned = !(reinterpret_cast<uintptr_t>(destP) & 0x0F);
-
-#define SSE2_MULT_ADD(loadInstr, storeInstr)        \
-            while (destP < endP)                    \
-            {                                       \
-                pSource = _mm_load_ps(sourceP);     \
-                temp = _mm_mul_ps(pSource, mScale); \
-                dest = _mm_##loadInstr##_ps(destP); \
-                dest = _mm_add_ps(dest, temp);      \
-                _mm_##storeInstr##_ps(destP, dest); \
-                sourceP += 4;                       \
-                destP += 4;                         \
-            }
-
-        if (destAligned)
-            SSE2_MULT_ADD(load, store)
-        else
-            SSE2_MULT_ADD(loadu, storeu)
-
-        n = tailFrames;
-    }
-#elif HAVE(ARM_NEON_INTRINSICS)
-    if ((sourceStride == 1) && (destStride == 1)) {
-        int tailFrames = n % 4;
-        const float* endP = destP + n - tailFrames;
-
-        float32x4_t k = vdupq_n_f32(*scale);
-        while (destP < endP) {
-            float32x4_t source = vld1q_f32(sourceP);
-            float32x4_t dest = vld1q_f32(destP);
-
-            dest = vmlaq_f32(dest, source, k);
-            vst1q_f32(destP, dest);
-
-            sourceP += 4;
-            destP += 4;
-        }
-        n = tailFrames;
-    }
-#endif
-    while (n) {
-        *destP += *sourceP * *scale;
-        sourceP += sourceStride;
-        destP += destStride;
-        n--;
-    }
-}
-
-void vsmul(const float* sourceP, int sourceStride, const float* scale, float* destP, int destStride, size_t framesToProcess)
-{
-    int n = framesToProcess;
-
-#ifdef __SSE2__
-    if ((sourceStride == 1) && (destStride == 1)) {
-        float k = *scale;
-
-        // If the sourceP address is not 16-byte aligned, the first several frames (at most three) should be processed separately.
-        while ((reinterpret_cast<size_t>(sourceP) & 0x0F) && n) {
-            *destP = k * *sourceP;
-            sourceP++;
-            destP++;
-            n--;
-        }
-
-        // Now the sourceP address is aligned and start to apply SSE.
-        int group = n / 4;
-        __m128 mScale = _mm_set_ps1(k);
-        __m128* pSource;
-        __m128* pDest;
-        __m128 dest;
-
-
-        if (reinterpret_cast<size_t>(destP) & 0x0F) {
-            while (group--) {
-                pSource = reinterpret_cast<__m128*>(const_cast<float*>(sourceP));
-                dest = _mm_mul_ps(*pSource, mScale);
-                _mm_storeu_ps(destP, dest);
-
-                sourceP += 4;
-                destP += 4;
-            }
-        } else {
-            while (group--) {
-                pSource = reinterpret_cast<__m128*>(const_cast<float*>(sourceP));
-                pDest = reinterpret_cast<__m128*>(destP);
-                *pDest = _mm_mul_ps(*pSource, mScale);
-
-                sourceP += 4;
-                destP += 4;
-            }
-        }
-
-        // Non-SSE handling for remaining frames which is less than 4.
-        n %= 4;
-        while (n) {
-            *destP = k * *sourceP;
-            sourceP++;
-            destP++;
-            n--;
-        }
-    } else { // If strides are not 1, rollback to normal algorithm.
-#elif HAVE(ARM_NEON_INTRINSICS)
-    if ((sourceStride == 1) && (destStride == 1)) {
-        float k = *scale;
-        int tailFrames = n % 4;
-        const float* endP = destP + n - tailFrames;
-
-        while (destP < endP) {
-            float32x4_t source = vld1q_f32(sourceP);
-            vst1q_f32(destP, vmulq_n_f32(source, k));
-
-            sourceP += 4;
-            destP += 4;
-        }
-        n = tailFrames;
-    }
-#endif
-    float k = *scale;
-    while (n--) {
-        *destP = k * *sourceP;
-        sourceP += sourceStride;
-        destP += destStride;
-    }
-#ifdef __SSE2__
-    }
-#endif
-}
-
-void vadd(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess)
-{
-    int n = framesToProcess;
-
-#ifdef __SSE2__
-    if ((sourceStride1 ==1) && (sourceStride2 == 1) && (destStride == 1)) {
-        // If the sourceP address is not 16-byte aligned, the first several frames (at most three) should be processed separately.
-        while ((reinterpret_cast<size_t>(source1P) & 0x0F) && n) {
-            *destP = *source1P + *source2P;
-            source1P++;
-            source2P++;
-            destP++;
-            n--;
-        }
-
-        // Now the source1P address is aligned and start to apply SSE.
-        int group = n / 4;
-        __m128* pSource1;
-        __m128* pSource2;
-        __m128* pDest;
-        __m128 source2;
-        __m128 dest;
-
-        bool source2Aligned = !(reinterpret_cast<size_t>(source2P) & 0x0F);
-        bool destAligned = !(reinterpret_cast<size_t>(destP) & 0x0F);
-
-        if (source2Aligned && destAligned) { // all aligned
-            while (group--) {
-                pSource1 = reinterpret_cast<__m128*>(const_cast<float*>(source1P));
-                pSource2 = reinterpret_cast<__m128*>(const_cast<float*>(source2P));
-                pDest = reinterpret_cast<__m128*>(destP);
-                *pDest = _mm_add_ps(*pSource1, *pSource2);
-
-                source1P += 4;
-                source2P += 4;
-                destP += 4;
-            }
-
-        } else if (source2Aligned && !destAligned) { // source2 aligned but dest not aligned
-            while (group--) {
-                pSource1 = reinterpret_cast<__m128*>(const_cast<float*>(source1P));
-                pSource2 = reinterpret_cast<__m128*>(const_cast<float*>(source2P));
-                dest = _mm_add_ps(*pSource1, *pSource2);
-                _mm_storeu_ps(destP, dest);
-
-                source1P += 4;
-                source2P += 4;
-                destP += 4;
-            }
-
-        } else if (!source2Aligned && destAligned) { // source2 not aligned but dest aligned
-            while (group--) {
-                pSource1 = reinterpret_cast<__m128*>(const_cast<float*>(source1P));
-                source2 = _mm_loadu_ps(source2P);
-                pDest = reinterpret_cast<__m128*>(destP);
-                *pDest = _mm_add_ps(*pSource1, source2);
-
-                source1P += 4;
-                source2P += 4;
-                destP += 4;
-            }
-        } else if (!source2Aligned && !destAligned) { // both source2 and dest not aligned
-            while (group--) {
-                pSource1 = reinterpret_cast<__m128*>(const_cast<float*>(source1P));
-                source2 = _mm_loadu_ps(source2P);
-                dest = _mm_add_ps(*pSource1, source2);
-                _mm_storeu_ps(destP, dest);
-
-                source1P += 4;
-                source2P += 4;
-                destP += 4;
-            }
-        }
-
-        // Non-SSE handling for remaining frames which is less than 4.
-        n %= 4;
-        while (n) {
-            *destP = *source1P + *source2P;
-            source1P++;
-            source2P++;
-            destP++;
-            n--;
-        }
-    } else { // if strides are not 1, rollback to normal algorithm
-#elif HAVE(ARM_NEON_INTRINSICS)
-    if ((sourceStride1 ==1) && (sourceStride2 == 1) && (destStride == 1)) {
-        int tailFrames = n % 4;
-        const float* endP = destP + n - tailFrames;
-
-        while (destP < endP) {
-            float32x4_t source1 = vld1q_f32(source1P);
-            float32x4_t source2 = vld1q_f32(source2P);
-            vst1q_f32(destP, vaddq_f32(source1, source2));
-
-            source1P += 4;
-            source2P += 4;
-            destP += 4;
-        }
-        n = tailFrames;
-    }
-#endif
-    while (n--) {
-        *destP = *source1P + *source2P;
-        source1P += sourceStride1;
-        source2P += sourceStride2;
-        destP += destStride;
-    }
-#ifdef __SSE2__
-    }
-#endif
-}
-
-void vmul(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess)
-{
-
-    int n = framesToProcess;
-
-#ifdef __SSE2__
-    if ((sourceStride1 == 1) && (sourceStride2 == 1) && (destStride == 1)) {
-        // If the source1P address is not 16-byte aligned, the first several frames (at most three) should be processed separately.
-        while ((reinterpret_cast<uintptr_t>(source1P) & 0x0F) && n) {
-            *destP = *source1P * *source2P;
-            source1P++;
-            source2P++;
-            destP++;
-            n--;
-        }
-
-        // Now the source1P address aligned and start to apply SSE.
-        int tailFrames = n % 4;
-        const float* endP = destP + n - tailFrames;
-        __m128 pSource1;
-        __m128 pSource2;
-        __m128 dest;
-
-        bool source2Aligned = !(reinterpret_cast<uintptr_t>(source2P) & 0x0F);
-        bool destAligned = !(reinterpret_cast<uintptr_t>(destP) & 0x0F);
-
-#define SSE2_MULT(loadInstr, storeInstr)                   \
-            while (destP < endP)                           \
-            {                                              \
-                pSource1 = _mm_load_ps(source1P);          \
-                pSource2 = _mm_##loadInstr##_ps(source2P); \
-                dest = _mm_mul_ps(pSource1, pSource2);     \
-                _mm_##storeInstr##_ps(destP, dest);        \
-                source1P += 4;                             \
-                source2P += 4;                             \
-                destP += 4;                                \
-            }
-
-        if (source2Aligned && destAligned) // Both aligned.
-            SSE2_MULT(load, store)
-        else if (source2Aligned && !destAligned) // Source2 is aligned but dest not.
-            SSE2_MULT(load, storeu)
-        else if (!source2Aligned && destAligned) // Dest is aligned but source2 not.
-            SSE2_MULT(loadu, store)
-        else // Neither aligned.
-            SSE2_MULT(loadu, storeu)
-
-        n = tailFrames;
-    }
-#elif HAVE(ARM_NEON_INTRINSICS)
-    if ((sourceStride1 ==1) && (sourceStride2 == 1) && (destStride == 1)) {
-        int tailFrames = n % 4;
-        const float* endP = destP + n - tailFrames;
-
-        while (destP < endP) {
-            float32x4_t source1 = vld1q_f32(source1P);
-            float32x4_t source2 = vld1q_f32(source2P);
-            vst1q_f32(destP, vmulq_f32(source1, source2));
-
-            source1P += 4;
-            source2P += 4;
-            destP += 4;
-        }
-        n = tailFrames;
-    }
-#endif
-    while (n) {
-        *destP = *source1P * *source2P;
-        source1P += sourceStride1;
-        source2P += sourceStride2;
-        destP += destStride;
-        n--;
-    }
-}
-
-void zvmul(const float* real1P, const float* imag1P, const float* real2P, const float* imag2P, float* realDestP, float* imagDestP, size_t framesToProcess)
-{
-    unsigned i = 0;
-#ifdef __SSE2__
-    // Only use the SSE optimization in the very common case that all addresses are 16-byte aligned.
-    // Otherwise, fall through to the scalar code below.
-    if (!(reinterpret_cast<uintptr_t>(real1P) & 0x0F)
-        && !(reinterpret_cast<uintptr_t>(imag1P) & 0x0F)
-        && !(reinterpret_cast<uintptr_t>(real2P) & 0x0F)
-        && !(reinterpret_cast<uintptr_t>(imag2P) & 0x0F)
-        && !(reinterpret_cast<uintptr_t>(realDestP) & 0x0F)
-        && !(reinterpret_cast<uintptr_t>(imagDestP) & 0x0F)) {
-
-        unsigned endSize = framesToProcess - framesToProcess % 4;
-        while (i < endSize) {
-            __m128 real1 = _mm_load_ps(real1P + i);
-            __m128 real2 = _mm_load_ps(real2P + i);
-            __m128 imag1 = _mm_load_ps(imag1P + i);
-            __m128 imag2 = _mm_load_ps(imag2P + i);
-            __m128 real = _mm_mul_ps(real1, real2);
-            real = _mm_sub_ps(real, _mm_mul_ps(imag1, imag2));
-            __m128 imag = _mm_mul_ps(real1, imag2);
-            imag = _mm_add_ps(imag, _mm_mul_ps(imag1, real2));
-            _mm_store_ps(realDestP + i, real);
-            _mm_store_ps(imagDestP + i, imag);
-            i += 4;
-        }
-    }
-#elif HAVE(ARM_NEON_INTRINSICS)
-        unsigned endSize = framesToProcess - framesToProcess % 4;
-        while (i < endSize) {
-            float32x4_t real1 = vld1q_f32(real1P + i);
-            float32x4_t real2 = vld1q_f32(real2P + i);
-            float32x4_t imag1 = vld1q_f32(imag1P + i);
-            float32x4_t imag2 = vld1q_f32(imag2P + i);
-
-            float32x4_t realResult = vmlsq_f32(vmulq_f32(real1, real2), imag1, imag2);
-            float32x4_t imagResult = vmlaq_f32(vmulq_f32(real1, imag2), imag1, real2);
-
-            vst1q_f32(realDestP + i, realResult);
-            vst1q_f32(imagDestP + i, imagResult);
-
-            i += 4;
-        }
-#endif
-    for (; i < framesToProcess; ++i) {
-        // Read and compute result before storing them, in case the
-        // destination is the same as one of the sources.
-        float realResult = real1P[i] * real2P[i] - imag1P[i] * imag2P[i];
-        float imagResult = real1P[i] * imag2P[i] + imag1P[i] * real2P[i];
-
-        realDestP[i] = realResult;
-        imagDestP[i] = imagResult;
-    }
-}
-
-void vsvesq(const float* sourceP, int sourceStride, float* sumP, size_t framesToProcess)
-{
-    int n = framesToProcess;
-    float sum = 0;
-
-#ifdef __SSE2__
-    if (sourceStride == 1) {
-        // If the sourceP address is not 16-byte aligned, the first several frames (at most three) should be processed separately.
-        while ((reinterpret_cast<uintptr_t>(sourceP) & 0x0F) && n) {
-            float sample = *sourceP;
-            sum += sample * sample;
-            sourceP++;
-            n--;
-        }
-
-        // Now the sourceP is aligned, use SSE.
-        int tailFrames = n % 4;
-        const float* endP = sourceP + n - tailFrames;
-        __m128 source;
-        __m128 mSum = _mm_setzero_ps();
-
-        while (sourceP < endP) {
-            source = _mm_load_ps(sourceP);
-            source = _mm_mul_ps(source, source);
-            mSum = _mm_add_ps(mSum, source);
-            sourceP += 4;
-        }
-
-        // Summarize the SSE results.
-        const float* groupSumP = reinterpret_cast<float*>(&mSum);
-        sum += groupSumP[0] + groupSumP[1] + groupSumP[2] + groupSumP[3];
-
-        n = tailFrames;
-    }
-#elif HAVE(ARM_NEON_INTRINSICS)
-    if (sourceStride == 1) {
-        int tailFrames = n % 4;
-        const float* endP = sourceP + n - tailFrames;
-
-        float32x4_t fourSum = vdupq_n_f32(0);
-        while (sourceP < endP) {
-            float32x4_t source = vld1q_f32(sourceP);
-            fourSum = vmlaq_f32(fourSum, source, source);
-            sourceP += 4;
-        }
-        float32x2_t twoSum = vadd_f32(vget_low_f32(fourSum), vget_high_f32(fourSum));
-
-        float groupSum[2];
-        vst1_f32(groupSum, twoSum);
-        sum += groupSum[0] + groupSum[1];
-
-        n = tailFrames;
-    }
-#endif
-
-    while (n--) {
-        float sample = *sourceP;
-        sum += sample * sample;
-        sourceP += sourceStride;
-    }
-
-    ASSERT(sumP);
-    *sumP = sum;
-}
-
-void vmaxmgv(const float* sourceP, int sourceStride, float* maxP, size_t framesToProcess)
-{
-    int n = framesToProcess;
-    float max = 0;
-
-#ifdef __SSE2__
-    if (sourceStride == 1) {
-        // If the sourceP address is not 16-byte aligned, the first several frames (at most three) should be processed separately.
-        while ((reinterpret_cast<uintptr_t>(sourceP) & 0x0F) && n) {
-            max = std::max(max, fabsf(*sourceP));
-            sourceP++;
-            n--;
-        }
-
-        // Now the sourceP is aligned, use SSE.
-        int tailFrames = n % 4;
-        const float* endP = sourceP + n - tailFrames;
-        __m128 source;
-        __m128 mMax = _mm_setzero_ps();
-        int mask = 0x7FFFFFFF;
-        __m128 mMask = _mm_set1_ps(*reinterpret_cast<float*>(&mask));
-
-        while (sourceP < endP) {
-            source = _mm_load_ps(sourceP);
-            // Calculate the absolute value by anding source with mask, the sign bit is set to 0.
-            source = _mm_and_ps(source, mMask);
-            mMax = _mm_max_ps(mMax, source);
-            sourceP += 4;
-        }
-
-        // Get max from the SSE results.
-        const float* groupMaxP = reinterpret_cast<float*>(&mMax);
-        max = std::max(max, groupMaxP[0]);
-        max = std::max(max, groupMaxP[1]);
-        max = std::max(max, groupMaxP[2]);
-        max = std::max(max, groupMaxP[3]);
-
-        n = tailFrames;
-    }
-#elif HAVE(ARM_NEON_INTRINSICS)
-    if (sourceStride == 1) {
-        int tailFrames = n % 4;
-        const float* endP = sourceP + n - tailFrames;
-
-        float32x4_t fourMax = vdupq_n_f32(0);
-        while (sourceP < endP) {
-            float32x4_t source = vld1q_f32(sourceP);
-            fourMax = vmaxq_f32(fourMax, vabsq_f32(source));
-            sourceP += 4;
-        }
-        float32x2_t twoMax = vmax_f32(vget_low_f32(fourMax), vget_high_f32(fourMax));
-
-        float groupMax[2];
-        vst1_f32(groupMax, twoMax);
-        max = std::max(groupMax[0], groupMax[1]);
-
-        n = tailFrames;
-    }
-#endif
-
-    while (n--) {
-        max = std::max(max, fabsf(*sourceP));
-        sourceP += sourceStride;
-    }
-
-    ASSERT(maxP);
-    *maxP = max;
-}
-
-void vclip(const float* sourceP, int sourceStride, const float* lowThresholdP, const float* highThresholdP, float* destP, int destStride, size_t framesToProcess)
-{
-    int n = framesToProcess;
-    float lowThreshold = *lowThresholdP;
-    float highThreshold = *highThresholdP;
-
-    // FIXME: Optimize for SSE2.
-#if HAVE(ARM_NEON_INTRINSICS)
-    if ((sourceStride == 1) && (destStride == 1)) {
-        int tailFrames = n % 4;
-        const float* endP = destP + n - tailFrames;
-
-        float32x4_t low = vdupq_n_f32(lowThreshold);
-        float32x4_t high = vdupq_n_f32(highThreshold);
-        while (destP < endP) {
-            float32x4_t source = vld1q_f32(sourceP);
-            vst1q_f32(destP, vmaxq_f32(vminq_f32(source, high), low));
-            sourceP += 4;
-            destP += 4;
-        }
-        n = tailFrames;
-    }
-#endif
-    while (n--) {
-        *destP = std::max(std::min(*sourceP, highThreshold), lowThreshold);
-        sourceP += sourceStride;
-        destP += destStride;
-    }
-}
-
-#endif // OS(MACOSX)
-
-} // namespace VectorMath
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/VectorMath.h b/Source/core/platform/audio/VectorMath.h
deleted file mode 100644
index 863bc4b..0000000
--- a/Source/core/platform/audio/VectorMath.h
+++ /dev/null
@@ -1,59 +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 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 VectorMath_h
-#define VectorMath_h
-
-// Defines the interface for several vector math functions whose implementation will ideally be optimized.
-
-namespace WebCore {
-
-namespace VectorMath {
-
-// Vector scalar multiply and then add.
-void vsma(const float* sourceP, int sourceStride, const float* scale, float* destP, int destStride, size_t framesToProcess);
-
-void vsmul(const float* sourceP, int sourceStride, const float* scale, float* destP, int destStride, size_t framesToProcess);
-void vadd(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess);
-
-// Finds the maximum magnitude of a float vector.
-void vmaxmgv(const float* sourceP, int sourceStride, float* maxP, size_t framesToProcess);
-
-// Sums the squares of a float vector's elements.
-void vsvesq(const float* sourceP, int sourceStride, float* sumP, size_t framesToProcess);
-
-// For an element-by-element multiply of two float vectors.
-void vmul(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess);
-
-// Multiplies two complex vectors.
-void zvmul(const float* real1P, const float* imag1P, const float* real2P, const float* imag2P, float* realDestP, float* imagDestP, size_t framesToProcess);
-
-// Copies elements while clipping values to the threshold inputs.
-void vclip(const float* sourceP, int sourceStride, const float* lowThresholdP, const float* highThresholdP, float* destP, int destStride, size_t framesToProcess);
-
-} // namespace VectorMath
-
-} // namespace WebCore
-
-#endif // VectorMath_h
diff --git a/Source/core/platform/audio/ZeroPole.cpp b/Source/core/platform/audio/ZeroPole.cpp
deleted file mode 100644
index 86daf4e..0000000
--- a/Source/core/platform/audio/ZeroPole.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/ZeroPole.h"
-
-#include "core/platform/audio/DenormalDisabler.h"
-
-namespace WebCore {
-
-void ZeroPole::process(const float *source, float *destination, unsigned framesToProcess)
-{
-    float zero = m_zero;
-    float pole = m_pole;
-
-    // Gain compensation to make 0dB @ 0Hz
-    const float k1 = 1 / (1 - zero);
-    const float k2 = 1 - pole;
-
-    // Member variables to locals.
-    float lastX = m_lastX;
-    float lastY = m_lastY;
-
-    while (framesToProcess--) {
-        float input = *source++;
-
-        // Zero
-        float output1 = k1 * (input - zero * lastX);
-        lastX = input;
-
-        // Pole
-        float output2 = k2 * output1 + pole * lastY;
-        lastY = output2;
-
-        *destination++ = output2;
-    }
-
-    // Locals to member variables. Flush denormals here so we don't
-    // slow down the inner loop above.
-    m_lastX = DenormalDisabler::flushDenormalFloatToZero(lastX);
-    m_lastY = DenormalDisabler::flushDenormalFloatToZero(lastY);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/ZeroPole.h b/Source/core/platform/audio/ZeroPole.h
deleted file mode 100644
index a6de4e2..0000000
--- a/Source/core/platform/audio/ZeroPole.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 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.
- *
- * 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 ZeroPole_h
-#define ZeroPole_h
-
-namespace WebCore {
-
-// ZeroPole is a simple filter with one zero and one pole.
-
-class ZeroPole {
-public:
-    ZeroPole()
-        : m_zero(0)
-        , m_pole(0)
-        , m_lastX(0)
-        , m_lastY(0)
-    {
-    }
-
-    void process(const float *source, float *destination, unsigned framesToProcess);
-
-    // Reset filter state.
-    void reset() { m_lastX = 0; m_lastY = 0; }
-
-    void setZero(float zero) { m_zero = zero; }
-    void setPole(float pole) { m_pole = pole; }
-
-    float zero() const { return m_zero; }
-    float pole() const { return m_pole; }
-
-private:
-    float m_zero;
-    float m_pole;
-    float m_lastX;
-    float m_lastY;
-};
-
-} // namespace WebCore
-
-#endif // ZeroPole_h
diff --git a/Source/core/platform/audio/chromium/AudioBusChromium.cpp b/Source/core/platform/audio/chromium/AudioBusChromium.cpp
deleted file mode 100644
index 08bab5a..0000000
--- a/Source/core/platform/audio/chromium/AudioBusChromium.cpp
+++ /dev/null
@@ -1,79 +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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/AudioBus.h"
-
-#include "public/platform/Platform.h"
-#include "public/platform/WebAudioBus.h"
-
-namespace WebCore {
-
-PassRefPtr<AudioBus> decodeAudioFileData(const char* data, size_t size, double sampleRate)
-{
-    WebKit::WebAudioBus webAudioBus;
-    if (WebKit::Platform::current()->loadAudioResource(&webAudioBus, data, size, sampleRate))
-        return webAudioBus.release();
-    return 0;
-}
-
-PassRefPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float sampleRate)
-{
-    const WebKit::WebData& resource = WebKit::Platform::current()->loadResource(name);
-    if (resource.isEmpty())
-        return 0;
-
-    // FIXME: the sampleRate parameter is ignored. It should be removed from the API.
-    RefPtr<AudioBus> audioBus = decodeAudioFileData(resource.data(), resource.size(), sampleRate);
-
-    if (!audioBus.get())
-        return 0;
-
-    // If the bus is already at the requested sample-rate then return as is.
-    if (audioBus->sampleRate() == sampleRate)
-        return audioBus;
-
-    return AudioBus::createBySampleRateConverting(audioBus.get(), false, sampleRate);
-}
-
-PassRefPtr<AudioBus> createBusFromInMemoryAudioFile(const void* data, size_t dataSize, bool mixToMono, float sampleRate)
-{
-    // FIXME: the sampleRate parameter is ignored. It should be removed from the API.
-    RefPtr<AudioBus> audioBus = decodeAudioFileData(static_cast<const char*>(data), dataSize, sampleRate);
-    if (!audioBus.get())
-        return 0;
-
-    // If the bus needs no conversion then return as is.
-    if ((!mixToMono || audioBus->numberOfChannels() == 1) && audioBus->sampleRate() == sampleRate)
-        return audioBus;
-
-    return AudioBus::createBySampleRateConverting(audioBus.get(), mixToMono, sampleRate);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp b/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp
deleted file mode 100644
index 42ead25..0000000
--- a/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp
+++ /dev/null
@@ -1,180 +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.
- * 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.
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#include "core/platform/audio/chromium/AudioDestinationChromium.h"
-
-#include "core/platform/audio/AudioFIFO.h"
-#include "core/platform/audio/AudioPullFIFO.h"
-#include "public/platform/Platform.h"
-
-namespace WebCore {
-
-// Buffer size at which the web audio engine will render.
-const unsigned renderBufferSize = 128;
-
-// Size of the FIFO
-const size_t fifoSize = 8192;
-
-// Factory method: Chromium-implementation
-PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
-{
-    return adoptPtr(new AudioDestinationChromium(callback, inputDeviceId, numberOfInputChannels, numberOfOutputChannels, sampleRate));
-}
-
-AudioDestinationChromium::AudioDestinationChromium(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
-    : m_callback(callback)
-    , m_numberOfOutputChannels(numberOfOutputChannels)
-    , m_inputBus(AudioBus::create(numberOfInputChannels, renderBufferSize))
-    , m_renderBus(AudioBus::create(numberOfOutputChannels, renderBufferSize, false))
-    , m_sampleRate(sampleRate)
-    , m_isPlaying(false)
-{
-    // Use the optimal buffer size recommended by the audio backend.
-    m_callbackBufferSize = WebKit::Platform::current()->audioHardwareBufferSize();
-
-#if OS(ANDROID)
-    // The optimum low-latency hardware buffer size is usually too small on Android for WebAudio to
-    // render without glitching. So, if it is small, use a larger size. If it was already large, use
-    // the requested size.
-    //
-    // Since WebAudio renders in 128-frame blocks, the small buffer sizes (144 for a Galaxy Nexus),
-    // cause significant processing jitter. Sometimes multiple blocks will processed, but other
-    // times will not be since the FIFO can satisfy the request. By using a larger
-    // callbackBufferSize, we smooth out the jitter.
-    const size_t kSmallBufferSize = 1024;
-    const size_t kDefaultCallbackBufferSize = 2048;
-
-    if (m_callbackBufferSize <= kSmallBufferSize)
-        m_callbackBufferSize = kDefaultCallbackBufferSize;
-#endif
-
-    // Quick exit if the requested size is too large.
-    ASSERT(m_callbackBufferSize + renderBufferSize <= fifoSize);
-    if (m_callbackBufferSize + renderBufferSize > fifoSize)
-        return;
-
-    m_audioDevice = adoptPtr(WebKit::Platform::current()->createAudioDevice(m_callbackBufferSize, numberOfInputChannels, numberOfOutputChannels, sampleRate, this, inputDeviceId));
-    ASSERT(m_audioDevice);
-
-    // Create a FIFO to handle the possibility of the callback size
-    // not being a multiple of the render size. If the FIFO already
-    // contains enough data, the data will be provided directly.
-    // Otherwise, the FIFO will call the provider enough times to
-    // satisfy the request for data.
-    m_fifo = adoptPtr(new AudioPullFIFO(*this, numberOfOutputChannels, fifoSize, renderBufferSize));
-
-    // Input buffering.
-    m_inputFifo = adoptPtr(new AudioFIFO(numberOfInputChannels, fifoSize));
-
-    // If the callback size does not match the render size, then we need to buffer some
-    // extra silence for the input. Otherwise, we can over-consume the input FIFO.
-    if (m_callbackBufferSize != renderBufferSize) {
-        // FIXME: handle multi-channel input and don't hard-code to stereo.
-        RefPtr<AudioBus> silence = AudioBus::create(2, renderBufferSize);
-        m_inputFifo->push(silence.get());
-    }
-}
-
-AudioDestinationChromium::~AudioDestinationChromium()
-{
-    stop();
-}
-
-void AudioDestinationChromium::start()
-{
-    if (!m_isPlaying && m_audioDevice) {
-        m_audioDevice->start();
-        m_isPlaying = true;
-    }
-}
-
-void AudioDestinationChromium::stop()
-{
-    if (m_isPlaying && m_audioDevice) {
-        m_audioDevice->stop();
-        m_isPlaying = false;
-    }
-}
-
-float AudioDestination::hardwareSampleRate()
-{
-    return static_cast<float>(WebKit::Platform::current()->audioHardwareSampleRate());
-}
-
-unsigned long AudioDestination::maxChannelCount()
-{
-    return static_cast<float>(WebKit::Platform::current()->audioHardwareOutputChannels());
-}
-
-void AudioDestinationChromium::render(const WebKit::WebVector<float*>& sourceData, const WebKit::WebVector<float*>& audioData, size_t numberOfFrames)
-{
-    bool isNumberOfChannelsGood = audioData.size() == m_numberOfOutputChannels;
-    if (!isNumberOfChannelsGood) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    bool isBufferSizeGood = numberOfFrames == m_callbackBufferSize;
-    if (!isBufferSizeGood) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    // Buffer optional live input.
-    if (sourceData.size() >= 2) {
-        // FIXME: handle multi-channel input and don't hard-code to stereo.
-        RefPtr<AudioBus> wrapperBus = AudioBus::create(2, numberOfFrames, false);
-        wrapperBus->setChannelMemory(0, sourceData[0], numberOfFrames);
-        wrapperBus->setChannelMemory(1, sourceData[1], numberOfFrames);
-        m_inputFifo->push(wrapperBus.get());
-    }
-
-    for (unsigned i = 0; i < m_numberOfOutputChannels; ++i)
-        m_renderBus->setChannelMemory(i, audioData[i], numberOfFrames);
-
-    m_fifo->consume(m_renderBus.get(), numberOfFrames);
-}
-
-void AudioDestinationChromium::provideInput(AudioBus* bus, size_t framesToProcess)
-{
-    AudioBus* sourceBus = 0;
-    if (m_inputFifo->framesInFifo() >= framesToProcess) {
-        m_inputFifo->consume(m_inputBus.get(), framesToProcess);
-        sourceBus = m_inputBus.get();
-    }
-
-    m_callback.render(sourceBus, bus, framesToProcess);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/chromium/AudioDestinationChromium.h b/Source/core/platform/audio/chromium/AudioDestinationChromium.h
deleted file mode 100644
index 253556a..0000000
--- a/Source/core/platform/audio/chromium/AudioDestinationChromium.h
+++ /dev/null
@@ -1,79 +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.
- * 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.
- *
- * 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 AudioDestinationChromium_h
-#define AudioDestinationChromium_h
-
-#include "core/platform/audio/AudioBus.h"
-#include "core/platform/audio/AudioDestination.h"
-#include "core/platform/audio/AudioIOCallback.h"
-#include "core/platform/audio/AudioSourceProvider.h"
-#include "public/platform/WebAudioDevice.h"
-#include "public/platform/WebVector.h"
-
-namespace WebCore {
-
-class AudioFIFO;
-class AudioPullFIFO;
-
-// An AudioDestination using Chromium's audio system
-
-class AudioDestinationChromium : public AudioDestination, public WebKit::WebAudioDevice::RenderCallback, public AudioSourceProvider {
-public:
-    AudioDestinationChromium(AudioIOCallback&, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate);
-    virtual ~AudioDestinationChromium();
-
-    virtual void start();
-    virtual void stop();
-    bool isPlaying() { return m_isPlaying; }
-
-    float sampleRate() const { return m_sampleRate; }
-
-    // WebKit::WebAudioDevice::RenderCallback
-    virtual void render(const WebKit::WebVector<float*>& sourceData, const WebKit::WebVector<float*>& audioData, size_t numberOfFrames);
-
-    // WebCore::AudioSourceProvider
-    virtual void provideInput(AudioBus*, size_t framesToProcess);
-
-private:
-    AudioIOCallback& m_callback;
-    unsigned m_numberOfOutputChannels;
-    RefPtr<AudioBus> m_inputBus;
-    RefPtr<AudioBus> m_renderBus;
-    float m_sampleRate;
-    bool m_isPlaying;
-    OwnPtr<WebKit::WebAudioDevice> m_audioDevice;
-    size_t m_callbackBufferSize;
-
-    OwnPtr<AudioFIFO> m_inputFifo;
-    OwnPtr<AudioPullFIFO> m_fifo;
-};
-
-} // namespace WebCore
-
-#endif // AudioDestinationChromium_h
diff --git a/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp b/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp
deleted file mode 100644
index 6e501ed..0000000
--- a/Source/core/platform/audio/chromium/FFTFrameOpenMAXDLAndroid.cpp
+++ /dev/null
@@ -1,208 +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:
- *
- * 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"
-
-#if ENABLE(WEB_AUDIO)
-
-#if OS(ANDROID) && USE(WEBAUDIO_OPENMAX_DL_FFT)
-
-#include "core/platform/audio/FFTFrame.h"
-
-#include "core/platform/audio/AudioArray.h"
-#include "core/platform/audio/VectorMath.h"
-#include "dl/sp/api/armSP.h"
-#include "dl/sp/api/omxSP.h"
-
-#include "wtf/MathExtras.h"
-
-namespace WebCore {
-
-const unsigned kMaxFFTPow2Size = 15;
-
-// Normal constructor: allocates for a given fftSize.
-FFTFrame::FFTFrame(unsigned fftSize)
-    : m_FFTSize(fftSize)
-    , m_log2FFTSize(static_cast<unsigned>(log2(fftSize)))
-    , m_forwardContext(0)
-    , m_inverseContext(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_forwardContext = contextForSize(m_log2FFTSize);
-    m_inverseContext = contextForSize(m_log2FFTSize);
-}
-
-// Creates a blank/empty frame (interpolate() must later be called).
-FFTFrame::FFTFrame()
-    : m_FFTSize(0)
-    , m_log2FFTSize(0)
-    , m_forwardContext(0)
-    , m_inverseContext(0)
-{
-}
-
-// Copy constructor.
-FFTFrame::FFTFrame(const FFTFrame& frame)
-    : m_FFTSize(frame.m_FFTSize)
-    , m_log2FFTSize(frame.m_log2FFTSize)
-    , m_forwardContext(0)
-    , m_inverseContext(0)
-    , m_complexData(frame.m_FFTSize)
-    , m_realData(frame.m_FFTSize / 2)
-    , m_imagData(frame.m_FFTSize / 2)
-{
-    m_forwardContext = contextForSize(m_log2FFTSize);
-    m_inverseContext = contextForSize(m_log2FFTSize);
-
-    // Copy/setup frame data.
-    unsigned nbytes = sizeof(float) * (m_FFTSize / 2);
-    memcpy(realData(), frame.realData(), nbytes);
-    memcpy(imagData(), frame.imagData(), nbytes);
-}
-
-void FFTFrame::initialize()
-{
-}
-
-void FFTFrame::cleanup()
-{
-}
-
-FFTFrame::~FFTFrame()
-{
-    if (m_forwardContext)
-        free(m_forwardContext);
-    if (m_inverseContext)
-        free(m_inverseContext);
-}
-
-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();
-
-    unsigned halfSize = fftSize() / 2;
-    float real0 = realP1[0];
-    float imag0 = imagP1[0];
-
-    VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize);
-
-    // Multiply the packed DC/nyquist component
-    realP1[0] = real0 * realP2[0];
-    imagP1[0] = imag0 * imagP2[0];
-}
-
-void FFTFrame::doFFT(const float* data)
-{
-    ASSERT(m_forwardContext);
-
-    if (m_forwardContext) {
-        AudioFloatArray complexFFT(m_FFTSize + 2);
-
-        omxSP_FFTFwd_RToCCS_F32_Sfs(data, complexFFT.data(), m_forwardContext);
-
-        unsigned len = m_FFTSize / 2;
-
-        // Split FFT data into real and imaginary arrays.
-        const float* c = complexFFT.data();
-        float* real = m_realData.data();
-        float* imag = m_imagData.data();
-        for (unsigned k = 1; k < len; ++k) {
-            int index = 2 * k;
-            real[k] = c[index];
-            imag[k] = c[index + 1];
-        }
-        real[0] = c[0];
-        imag[0] = c[m_FFTSize];
-    }
-}
-
-void FFTFrame::doInverseFFT(float* data)
-{
-    ASSERT(m_inverseContext);
-
-    if (m_inverseContext) {
-        AudioFloatArray fftDataArray(m_FFTSize + 2);
-
-        unsigned len = m_FFTSize / 2;
-
-        // Pack the real and imaginary data into the complex array format
-        float* fftData = fftDataArray.data();
-        const float* real = m_realData.data();
-        const float* imag = m_imagData.data();
-        for (unsigned k = 1; k < len; ++k) {
-            int index = 2 * k;
-            fftData[index] = real[k];
-            fftData[index + 1] = imag[k];
-        }
-        fftData[0] = real[0];
-        fftData[1] = 0;
-        fftData[m_FFTSize] = imag[0];
-        fftData[m_FFTSize + 1] = 0;
-
-        omxSP_FFTInv_CCSToR_F32_Sfs(fftData, data, m_inverseContext);
-    }
-}
-
-float* FFTFrame::realData() const
-{
-    return const_cast<float*>(m_realData.data());
-}
-
-float* FFTFrame::imagData() const
-{
-    return const_cast<float*>(m_imagData.data());
-}
-
-OMXFFTSpec_R_F32* FFTFrame::contextForSize(unsigned log2FFTSize)
-{
-    ASSERT(log2FFTSize);
-    ASSERT(log2FFTSize <= kMaxFFTPow2Size);
-    int bufSize;
-    OMXResult status = omxSP_FFTGetBufSize_R_F32(log2FFTSize, &bufSize);
-
-    if (status == OMX_Sts_NoErr) {
-        OMXFFTSpec_R_F32* context = static_cast<OMXFFTSpec_R_F32*>(malloc(bufSize));
-        omxSP_FFTInit_R_F32(context, log2FFTSize);
-        return context;
-    }
-
-    return 0;
-}
-
-} // namespace WebCore
-
-#endif // #if OS(ANDROID) && !USE(WEBAUDIO_OPENMAX_DL_FFT)
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp b/Source/core/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp
deleted file mode 100644
index 59f182f..0000000
--- a/Source/core/platform/audio/ffmpeg/FFTFrameFFMPEG.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 FFmpeg's RDFT algorithm,
-// suitable for use on Windows and Linux.
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#if USE(WEBAUDIO_FFMPEG)
-
-#include "core/platform/audio/FFTFrame.h"
-
-#include "core/platform/audio/VectorMath.h"
-
-extern "C" {
-    #include <libavcodec/avfft.h>
-}
-
-#include "wtf/MathExtras.h"
-
-namespace {
-
-struct FFTComplexProxy {
-    int16_t re;
-    int16_t im;
-};
-
-struct FFTContextProxy {
-    int nbits;
-    int inverse;
-    uint16_t* revtab;
-    FFTComplexProxy* tmpBuf;
-    int mdctSize;
-    int mdctBits;
-    void* tcos;
-    void* tsin;
-    void (*fftPermute)();
-    void (*fftCalc)();
-    void (*imdctCalc)();
-    void (*imdctHalf)();
-    void (*mdctCalc)();
-    void (*mdctCalcw)();
-    int fftPermutation;
-    int mdctPermutation;
-};
-
-struct RDFTContextProxy {
-    int nbits;
-    int inverse;
-    int signConvention;
-    const void* tcos;
-    const void* tsin;
-    FFTContextProxy fft;
-    void (*rdft_calc)();
-};
-
-}
-
-namespace WebCore {
-
-const int kMaxFFTPow2Size = 24;
-
-// Normal constructor: allocates for a given fftSize.
-FFTFrame::FFTFrame(unsigned fftSize)
-    : m_FFTSize(fftSize)
-    , m_log2FFTSize(static_cast<unsigned>(log2(fftSize)))
-    , m_forwardContext(0)
-    , m_inverseContext(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_forwardContext = contextForSize(fftSize, DFT_R2C);
-    m_inverseContext = contextForSize(fftSize, IDFT_C2R);
-}
-
-// Creates a blank/empty frame (interpolate() must later be called).
-FFTFrame::FFTFrame()
-    : m_FFTSize(0)
-    , m_log2FFTSize(0)
-    , m_forwardContext(0)
-    , m_inverseContext(0)
-{
-}
-
-// Copy constructor.
-FFTFrame::FFTFrame(const FFTFrame& frame)
-    : m_FFTSize(frame.m_FFTSize)
-    , m_log2FFTSize(frame.m_log2FFTSize)
-    , m_forwardContext(0)
-    , m_inverseContext(0)
-    , m_complexData(frame.m_FFTSize)
-    , m_realData(frame.m_FFTSize / 2)
-    , m_imagData(frame.m_FFTSize / 2)
-{
-    m_forwardContext = contextForSize(m_FFTSize, DFT_R2C);
-    m_inverseContext = contextForSize(m_FFTSize, IDFT_C2R);
-
-    // Copy/setup frame data.
-    unsigned nbytes = sizeof(float) * (m_FFTSize / 2);
-    memcpy(realData(), frame.realData(), nbytes);
-    memcpy(imagData(), frame.imagData(), nbytes);
-}
-
-void FFTFrame::initialize()
-{
-}
-
-void FFTFrame::cleanup()
-{
-}
-
-FFTFrame::~FFTFrame()
-{
-    av_rdft_end(m_forwardContext);
-    av_rdft_end(m_inverseContext);
-}
-
-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();
-
-    unsigned halfSize = fftSize() / 2;
-    float real0 = realP1[0];
-    float imag0 = imagP1[0];
-
-    VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize);
-
-    // Multiply the packed DC/nyquist component
-    realP1[0] = real0 * realP2[0];
-    imagP1[0] = imag0 * imagP2[0];
-
-    // Scale accounts the peculiar scaling of vecLib on the Mac.
-    // This ensures the right scaling all the way back to inverse FFT.
-    // FIXME: if we change the scaling on the Mac then this scale
-    // factor will need to change too.
-    float scale = 0.5f;
-
-    VectorMath::vsmul(realP1, 1, &scale, realP1, 1, halfSize);
-    VectorMath::vsmul(imagP1, 1, &scale, imagP1, 1, halfSize);
-}
-
-void FFTFrame::doFFT(const float* data)
-{
-    // Copy since processing is in-place.
-    float* p = m_complexData.data();
-    memcpy(p, data, sizeof(float) * m_FFTSize);
-
-    // Compute Forward transform.
-    av_rdft_calc(m_forwardContext, p);
-
-    // De-interleave to separate real and complex arrays.
-    int len = m_FFTSize / 2;
-
-    // FIXME: see above comment in multiply() about scaling.
-    const float scale = 2.0f;
-
-    for (int i = 0; i < len; ++i) {
-        int baseComplexIndex = 2 * i;
-        // m_realData[0] is the DC component and m_imagData[0] is the nyquist component
-        // since the interleaved complex data is packed.
-        m_realData[i] = scale * p[baseComplexIndex];
-        m_imagData[i] = scale * p[baseComplexIndex + 1];
-    }
-}
-
-void FFTFrame::doInverseFFT(float* data)
-{
-    // Prepare interleaved data.
-    float* interleavedData = getUpToDateComplexData();
-
-    // Compute inverse transform.
-    av_rdft_calc(m_inverseContext, interleavedData);
-
-    // Scale so that a forward then inverse FFT yields exactly the original data.
-    const float scale = 1.0 / m_FFTSize;
-    VectorMath::vsmul(interleavedData, 1, &scale, data, 1, m_FFTSize);
-}
-
-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());
-}
-
-RDFTContext* FFTFrame::contextForSize(unsigned fftSize, int trans)
-{
-    // FIXME: This is non-optimal. Ideally, we'd like to share the contexts for FFTFrames of the same size.
-    // But FFmpeg's RDFT uses a scratch buffer inside the context and so they are not thread-safe.
-    // We could improve this by sharing the FFTFrames on a per-thread basis.
-    ASSERT(fftSize);
-    int pow2size = static_cast<int>(log2(fftSize));
-    ASSERT(pow2size < kMaxFFTPow2Size);
-
-    RDFTContext* context = av_rdft_init(pow2size, (RDFTransformType)trans);
-    return context;
-}
-
-} // namespace WebCore
-
-#endif // !OS(MACOSX) && USE(WEBAUDIO_FFMPEG)
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/ipp/FFTFrameIPP.cpp b/Source/core/platform/audio/ipp/FFTFrameIPP.cpp
deleted file mode 100644
index fa25a9f..0000000
--- a/Source/core/platform/audio/ipp/FFTFrameIPP.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2012 Intel 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 IPP's DFT algorithm,
-// suitable for use on Linux.
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#if USE(WEBAUDIO_IPP)
-
-#include "core/platform/audio/FFTFrame.h"
-
-#include "core/platform/audio/VectorMath.h"
-
-#include "wtf/MathExtras.h"
-
-namespace WebCore {
-
-const unsigned maximumFFTPower2Size = 24;
-
-// Normal constructor: allocates for a given fftSize.
-FFTFrame::FFTFrame(unsigned fftSize)
-    : m_FFTSize(fftSize)
-    , m_log2FFTSize(static_cast<unsigned>(log2(fftSize)))
-    , m_complexData(fftSize)
-    , m_realData(fftSize / 2)
-    , m_imagData(fftSize / 2)
-{
-    // We only allow power of two.
-    ASSERT(1UL << m_log2FFTSize == m_FFTSize);
-    ASSERT(m_log2FFTSize <= maximumFFTPower2Size);
-
-    ippsDFTInitAlloc_R_32f(&m_DFTSpec, m_FFTSize, IPP_FFT_NODIV_BY_ANY, ippAlgHintFast);
-    int bufferSize = 0;
-    ippsDFTGetBufSize_R_32f(m_DFTSpec, &bufferSize);
-    m_buffer = ippsMalloc_8u(bufferSize);
-}
-
-// Creates a blank/empty frame (interpolate() must later be called).
-FFTFrame::FFTFrame()
-    : m_FFTSize(0)
-    , m_log2FFTSize(0)
-{
-}
-
-// Copy constructor.
-FFTFrame::FFTFrame(const FFTFrame& frame)
-    : m_FFTSize(frame.m_FFTSize)
-    , m_log2FFTSize(frame.m_log2FFTSize)
-    , m_complexData(frame.m_FFTSize)
-    , m_realData(frame.m_FFTSize / 2)
-    , m_imagData(frame.m_FFTSize / 2)
-{
-    ippsDFTInitAlloc_R_32f(&m_DFTSpec, m_FFTSize, IPP_FFT_NODIV_BY_ANY, ippAlgHintFast);
-    int bufferSize = 0;
-    ippsDFTGetBufSize_R_32f(m_DFTSpec, &bufferSize);
-    m_buffer = ippsMalloc_8u(bufferSize);
-
-    // Copy/setup frame data.
-    unsigned numberOfBytes = sizeof(float) * m_FFTSize;
-    memcpy(realData(), frame.realData(), numberOfBytes);
-    memcpy(imagData(), frame.imagData(), numberOfBytes);
-}
-
-void FFTFrame::initialize()
-{
-}
-
-void FFTFrame::cleanup()
-{
-}
-
-FFTFrame::~FFTFrame()
-{
-    ippsFree(m_buffer);
-    ippsDFTFree_R_32f(m_DFTSpec);
-}
-
-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();
-
-    unsigned halfSize = fftSize() / 2;
-    float real0 = realP1[0];
-    float imag0 = imagP1[0];
-
-    VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize);
-
-    // Multiply the packed DC/nyquist component
-    realP1[0] = real0 * realP2[0];
-    imagP1[0] = imag0 * imagP2[0];
-
-    // Scale accounts the peculiar scaling of vecLib on the Mac.
-    // This ensures the right scaling all the way back to inverse FFT.
-    // FIXME: if we change the scaling on the Mac then this scale
-    // factor will need to change too.
-    float scale = 0.5f;
-
-    VectorMath::vsmul(realP1, 1, &scale, realP1, 1, halfSize);
-    VectorMath::vsmul(imagP1, 1, &scale, imagP1, 1, halfSize);
-}
-
-void FFTFrame::doFFT(const float* data)
-{
-    Ipp32f* complexP = m_complexData.data();
-
-    // Compute Forward transform to perm format.
-    ippsDFTFwd_RToPerm_32f(reinterpret_cast<Ipp32f*>(const_cast<float*>(data)), complexP, m_DFTSpec, m_buffer);
-
-    const Ipp32f scale = 2.0f;
-
-    ippsMulC_32f_I(scale, complexP, m_FFTSize);
-
-    Ipp32f* realP = m_realData.data();
-    Ipp32f* imagP = m_imagData.data();
-    ippsCplxToReal_32fc(reinterpret_cast<Ipp32fc*>(complexP), realP, imagP, m_FFTSize >> 1);
-}
-
-void FFTFrame::doInverseFFT(float* data)
-{
-    Ipp32f* complexP = getUpToDateComplexData();
-
-    // Compute inverse transform.
-    ippsDFTInv_PermToR_32f(complexP, reinterpret_cast<Ipp32f*>(data), m_DFTSpec, m_buffer);
-
-    // Scale so that a forward then inverse FFT yields exactly the original data.
-    const float scale = 1.0 / (2 * m_FFTSize);
-
-    ippsMulC_32f_I(scale, reinterpret_cast<Ipp32f*>(data), m_FFTSize);
-}
-
-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()
-{
-    int len = m_FFTSize >> 1;
-    // Merge the real and imagimary vectors to complex vector.
-    Ipp32f* realP = m_realData.data();
-    Ipp32f* imagP = m_imagData.data();
-    Ipp32fc* complexP = reinterpret_cast<Ipp32fc*>(m_complexData.data());
-    ippsRealToCplx_32f(realP, imagP, complexP, len);
-
-    return const_cast<float*>(m_complexData.data());
-}
-
-} // namespace WebCore
-
-#endif // USE(WEBAUDIO_IPP)
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/mac/FFTFrameMac.cpp b/Source/core/platform/audio/mac/FFTFrameMac.cpp
deleted file mode 100644
index 344f953..0000000
--- a/Source/core/platform/audio/mac/FFTFrameMac.cpp
+++ /dev/null
@@ -1,193 +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.
- * 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.
- *
- * 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.
- */
-
-// Mac OS X - specific FFTFrame implementation
-
-#include "config.h"
-
-#if ENABLE(WEB_AUDIO)
-
-#if OS(MACOSX) && !USE(WEBAUDIO_FFMPEG)
-
-#include "core/platform/audio/FFTFrame.h"
-
-#include "core/platform/audio/VectorMath.h"
-
-namespace WebCore {
-
-const int kMaxFFTPow2Size = 24;
-
-FFTSetup* FFTFrame::fftSetups = 0;
-
-// Normal constructor: allocates for a given fftSize
-FFTFrame::FFTFrame(unsigned fftSize)
-    : m_realData(fftSize)
-    , m_imagData(fftSize)
-{
-    m_FFTSize = fftSize;
-    m_log2FFTSize = static_cast<unsigned>(log2(fftSize));
-
-    // We only allow power of two
-    ASSERT(1UL << m_log2FFTSize == m_FFTSize);
-
-    // Lazily create and share fftSetup with other frames
-    m_FFTSetup = fftSetupForSize(fftSize);
-
-    // Setup frame data
-    m_frame.realp = m_realData.data();
-    m_frame.imagp = m_imagData.data();
-}
-
-// Creates a blank/empty frame (interpolate() must later be called)
-FFTFrame::FFTFrame()
-    : m_realData(0)
-    , m_imagData(0)
-{
-    // Later will be set to correct values when interpolate() is called
-    m_frame.realp = 0;
-    m_frame.imagp = 0;
-
-    m_FFTSize = 0;
-    m_log2FFTSize = 0;
-}
-
-// Copy constructor
-FFTFrame::FFTFrame(const FFTFrame& frame)
-    : m_FFTSize(frame.m_FFTSize)
-    , m_log2FFTSize(frame.m_log2FFTSize)
-    , m_FFTSetup(frame.m_FFTSetup)
-    , m_realData(frame.m_FFTSize)
-    , m_imagData(frame.m_FFTSize)
-{
-    // Setup frame data
-    m_frame.realp = m_realData.data();
-    m_frame.imagp = m_imagData.data();
-
-    // Copy/setup frame data
-    unsigned nbytes = sizeof(float) * m_FFTSize;
-    memcpy(realData(), frame.m_frame.realp, nbytes);
-    memcpy(imagData(), frame.m_frame.imagp, nbytes);
-}
-
-FFTFrame::~FFTFrame()
-{
-}
-
-void FFTFrame::multiply(const FFTFrame& frame)
-{
-    FFTFrame& frame1 = *this;
-    const FFTFrame& frame2 = frame;
-
-    float* realP1 = frame1.realData();
-    float* imagP1 = frame1.imagData();
-    const float* realP2 = frame2.realData();
-    const float* imagP2 = frame2.imagData();
-
-    unsigned halfSize = m_FFTSize / 2;
-    float real0 = realP1[0];
-    float imag0 = imagP1[0];
-
-    // Complex multiply
-    VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize);
-
-    // Multiply the packed DC/nyquist component
-    realP1[0] = real0 * realP2[0];
-    imagP1[0] = imag0 * imagP2[0];
-
-    // Scale accounts for vecLib's peculiar scaling
-    // This ensures the right scaling all the way back to inverse FFT
-    float scale = 0.5f;
-
-    VectorMath::vsmul(realP1, 1, &scale, realP1, 1, halfSize);
-    VectorMath::vsmul(imagP1, 1, &scale, imagP1, 1, halfSize);
-}
-
-void FFTFrame::doFFT(const float* data)
-{
-    vDSP_ctoz((DSPComplex*)data, 2, &m_frame, 1, m_FFTSize / 2);
-    vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_FORWARD);
-}
-
-void FFTFrame::doInverseFFT(float* data)
-{
-    vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_INVERSE);
-    vDSP_ztoc(&m_frame, 1, (DSPComplex*)data, 2, m_FFTSize / 2);
-
-    // Do final scaling so that x == IFFT(FFT(x))
-    float scale = 0.5f / m_FFTSize;
-    vDSP_vsmul(data, 1, &scale, data, 1, m_FFTSize);
-}
-
-FFTSetup FFTFrame::fftSetupForSize(unsigned fftSize)
-{
-    if (!fftSetups) {
-        fftSetups = (FFTSetup*)malloc(sizeof(FFTSetup) * kMaxFFTPow2Size);
-        memset(fftSetups, 0, sizeof(FFTSetup) * kMaxFFTPow2Size);
-    }
-
-    int pow2size = static_cast<int>(log2(fftSize));
-    ASSERT(pow2size < kMaxFFTPow2Size);
-    if (!fftSetups[pow2size])
-        fftSetups[pow2size] = vDSP_create_fftsetup(pow2size, FFT_RADIX2);
-
-    return fftSetups[pow2size];
-}
-
-void FFTFrame::initialize()
-{
-}
-
-void FFTFrame::cleanup()
-{
-    if (!fftSetups)
-        return;
-
-    for (int i = 0; i < kMaxFFTPow2Size; ++i) {
-        if (fftSetups[i])
-            vDSP_destroy_fftsetup(fftSetups[i]);
-    }
-
-    free(fftSetups);
-    fftSetups = 0;
-}
-
-float* FFTFrame::realData() const
-{
-    return m_frame.realp;
-}
-
-float* FFTFrame::imagData() const
-{
-    return m_frame.imagp;
-}
-
-} // namespace WebCore
-
-#endif // #if OS(MACOSX) && !USE(WEBAUDIO_FFMPEG)
-
-#endif // ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/audio/resources/Composite.wav b/Source/core/platform/audio/resources/Composite.wav
deleted file mode 100644
index fab198d..0000000
--- a/Source/core/platform/audio/resources/Composite.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P000.wav
deleted file mode 100644
index 57f2ef3..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P015.wav
deleted file mode 100644
index 3ecea33..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P030.wav
deleted file mode 100644
index 7320802..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P045.wav
deleted file mode 100644
index 1a10d9a..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P060.wav
deleted file mode 100644
index 9b12c22..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P075.wav
deleted file mode 100644
index 3153bb8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P090.wav
deleted file mode 100644
index 3282da9..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P315.wav
deleted file mode 100644
index b999852..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P330.wav
deleted file mode 100644
index 53a03b6..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P345.wav
deleted file mode 100644
index 16d5766..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T000_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P000.wav
deleted file mode 100644
index 3788e16..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P015.wav
deleted file mode 100644
index ad2efb6..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P030.wav
deleted file mode 100644
index ee86702..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P045.wav
deleted file mode 100644
index 98ff82e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P060.wav
deleted file mode 100644
index 98ff82e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P075.wav
deleted file mode 100644
index 98ff82e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P090.wav
deleted file mode 100644
index 98ff82e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P315.wav
deleted file mode 100644
index 10bdf78..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P330.wav
deleted file mode 100644
index c8398a4..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P345.wav
deleted file mode 100644
index 82b92a8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T015_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P000.wav
deleted file mode 100644
index 8b8714c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P015.wav
deleted file mode 100644
index 882efd4..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P030.wav
deleted file mode 100644
index abd99e6..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P045.wav
deleted file mode 100644
index 28765be..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P060.wav
deleted file mode 100644
index 42c1445..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P075.wav
deleted file mode 100644
index 42c1445..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P090.wav
deleted file mode 100644
index 42c1445..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P315.wav
deleted file mode 100644
index 99b00f7..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P330.wav
deleted file mode 100644
index f81bee2..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P345.wav
deleted file mode 100644
index 139d0cb..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T030_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P000.wav
deleted file mode 100644
index 68b7b4f..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P015.wav
deleted file mode 100644
index d6773ae..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P030.wav
deleted file mode 100644
index 9e786bb..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P045.wav
deleted file mode 100644
index fbef2f3..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P060.wav
deleted file mode 100644
index fbef2f3..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P075.wav
deleted file mode 100644
index fbef2f3..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P090.wav
deleted file mode 100644
index fbef2f3..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P315.wav
deleted file mode 100644
index 3c53b76..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P330.wav
deleted file mode 100644
index e4524c0..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P345.wav
deleted file mode 100644
index ff12535..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T045_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P000.wav
deleted file mode 100644
index 5bb1b17..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P015.wav
deleted file mode 100644
index 47e0209..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P030.wav
deleted file mode 100644
index 536b4ac..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P045.wav
deleted file mode 100644
index 05152ad..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P060.wav
deleted file mode 100644
index 221637b..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P075.wav
deleted file mode 100644
index 7d6d07f..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P090.wav
deleted file mode 100644
index 7d6d07f..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P315.wav
deleted file mode 100644
index a4eca78..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P330.wav
deleted file mode 100644
index 37393c2..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P345.wav
deleted file mode 100644
index 3d56e26..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T060_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P000.wav
deleted file mode 100644
index 2159f3d..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P015.wav
deleted file mode 100644
index 8b689f6..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P030.wav
deleted file mode 100644
index 9ee8ac5..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P045.wav
deleted file mode 100644
index 88124e9..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P060.wav
deleted file mode 100644
index 88124e9..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P075.wav
deleted file mode 100644
index 88124e9..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P090.wav
deleted file mode 100644
index 88124e9..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P315.wav
deleted file mode 100644
index 59441a6..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P330.wav
deleted file mode 100644
index 7cac0f5..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P345.wav
deleted file mode 100644
index dc28d64..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T075_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P000.wav
deleted file mode 100644
index ae7e583..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P015.wav
deleted file mode 100644
index 509449e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P030.wav
deleted file mode 100644
index e23b20c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P045.wav
deleted file mode 100644
index cf247b9..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P060.wav
deleted file mode 100644
index f49d520..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P075.wav
deleted file mode 100644
index f49d520..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P090.wav
deleted file mode 100644
index f49d520..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P315.wav
deleted file mode 100644
index e5472f1..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P330.wav
deleted file mode 100644
index 8e1af83..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P345.wav
deleted file mode 100644
index c477193..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T090_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P000.wav
deleted file mode 100644
index 4236e08..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P015.wav
deleted file mode 100644
index 2461fb0..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P030.wav
deleted file mode 100644
index 11d549b..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P045.wav
deleted file mode 100644
index 0aa100e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P060.wav
deleted file mode 100644
index 0aa100e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P075.wav
deleted file mode 100644
index 0aa100e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P090.wav
deleted file mode 100644
index 0aa100e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P315.wav
deleted file mode 100644
index 572e602..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P330.wav
deleted file mode 100644
index 7f41da3..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P345.wav
deleted file mode 100644
index d0101b8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T105_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P000.wav
deleted file mode 100644
index 800fbd7..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P015.wav
deleted file mode 100644
index 9b35e72..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P030.wav
deleted file mode 100644
index bb58c4e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P045.wav
deleted file mode 100644
index 8963e3e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P060.wav
deleted file mode 100644
index 22241ee..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P075.wav
deleted file mode 100644
index 9e4fee0..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P090.wav
deleted file mode 100644
index 9e4fee0..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P315.wav
deleted file mode 100644
index 95976c6..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P330.wav
deleted file mode 100644
index 8fc55f1..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P345.wav
deleted file mode 100644
index eeeb702..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T120_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P000.wav
deleted file mode 100644
index 1847d8d..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P015.wav
deleted file mode 100644
index 52e812c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P030.wav
deleted file mode 100644
index 32ca344..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P045.wav
deleted file mode 100644
index 3de60c8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P060.wav
deleted file mode 100644
index 3de60c8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P075.wav
deleted file mode 100644
index 3de60c8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P090.wav
deleted file mode 100644
index 3de60c8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P315.wav
deleted file mode 100644
index 2668e41..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P330.wav
deleted file mode 100644
index e69670b..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P345.wav
deleted file mode 100644
index 1cc48ee..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T135_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P000.wav
deleted file mode 100644
index 252968b..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P015.wav
deleted file mode 100644
index 50aff3c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P030.wav
deleted file mode 100644
index 3abd6e8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P045.wav
deleted file mode 100644
index 3f0d5ef..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P060.wav
deleted file mode 100644
index 616f760..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P075.wav
deleted file mode 100644
index 616f760..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P090.wav
deleted file mode 100644
index 616f760..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P315.wav
deleted file mode 100644
index bfb6032..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P330.wav
deleted file mode 100644
index 1983cdb..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P345.wav
deleted file mode 100644
index 27c0762..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T150_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P000.wav
deleted file mode 100644
index b04391b..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P015.wav
deleted file mode 100644
index 5955612..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P030.wav
deleted file mode 100644
index af5d83a..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P045.wav
deleted file mode 100644
index a592f71..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P060.wav
deleted file mode 100644
index a592f71..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P075.wav
deleted file mode 100644
index a592f71..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P090.wav
deleted file mode 100644
index a592f71..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P315.wav
deleted file mode 100644
index a985aa1..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P330.wav
deleted file mode 100644
index a8b83d1..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P345.wav
deleted file mode 100644
index 7e649a3..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T165_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P000.wav
deleted file mode 100644
index b74985c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P015.wav
deleted file mode 100644
index e112ee0..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P030.wav
deleted file mode 100644
index ac842cc..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P045.wav
deleted file mode 100644
index 95c3a6d..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P060.wav
deleted file mode 100644
index 610eedb..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P075.wav
deleted file mode 100644
index d4a57bf..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P090.wav
deleted file mode 100644
index d4a57bf..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P315.wav
deleted file mode 100644
index bd6e4f8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P330.wav
deleted file mode 100644
index 7d4be6f..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P345.wav
deleted file mode 100644
index b7ef81a..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T180_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P000.wav
deleted file mode 100644
index 0c4af2a..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P015.wav
deleted file mode 100644
index dd7a505..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P030.wav
deleted file mode 100644
index e169049..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P045.wav
deleted file mode 100644
index 49008a0..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P060.wav
deleted file mode 100644
index 49008a0..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P075.wav
deleted file mode 100644
index 49008a0..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P090.wav
deleted file mode 100644
index 49008a0..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P315.wav
deleted file mode 100644
index 1e7d478..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P330.wav
deleted file mode 100644
index 2a77d74..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P345.wav
deleted file mode 100644
index 843b928..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T195_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P000.wav
deleted file mode 100644
index 770af17..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P015.wav
deleted file mode 100644
index 437a1c6..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P030.wav
deleted file mode 100644
index f0d9d8e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P045.wav
deleted file mode 100644
index cd4ae55..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P060.wav
deleted file mode 100644
index 7dd5a1a..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P075.wav
deleted file mode 100644
index 7dd5a1a..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P090.wav
deleted file mode 100644
index 7dd5a1a..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P315.wav
deleted file mode 100644
index bfac19d..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P330.wav
deleted file mode 100644
index 8b3e086..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P345.wav
deleted file mode 100644
index 8b4da46..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T210_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P000.wav
deleted file mode 100644
index b6d4703..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P015.wav
deleted file mode 100644
index 0ff35e9..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P030.wav
deleted file mode 100644
index e934c78..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P045.wav
deleted file mode 100644
index c931e3c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P060.wav
deleted file mode 100644
index c931e3c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P075.wav
deleted file mode 100644
index c931e3c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P090.wav
deleted file mode 100644
index c931e3c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P315.wav
deleted file mode 100644
index f999966..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P330.wav
deleted file mode 100644
index d958590..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P345.wav
deleted file mode 100644
index ac06260..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T225_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P000.wav
deleted file mode 100644
index b720ed1..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P015.wav
deleted file mode 100644
index b48852a..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P030.wav
deleted file mode 100644
index 92c7ef0..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P045.wav
deleted file mode 100644
index 2d5ff65..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P060.wav
deleted file mode 100644
index 07dcfde..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P075.wav
deleted file mode 100644
index 283e250..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P090.wav
deleted file mode 100644
index 283e250..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P315.wav
deleted file mode 100644
index b99ad7d..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P330.wav
deleted file mode 100644
index 4886915..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P345.wav
deleted file mode 100644
index c932833..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T240_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P000.wav
deleted file mode 100644
index b204def..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P015.wav
deleted file mode 100644
index fa48113..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P030.wav
deleted file mode 100644
index 2e2de70..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P045.wav
deleted file mode 100644
index 685f102..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P060.wav
deleted file mode 100644
index 685f102..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P075.wav
deleted file mode 100644
index 685f102..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P090.wav
deleted file mode 100644
index 685f102..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P315.wav
deleted file mode 100644
index c7cce6e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P330.wav
deleted file mode 100644
index 93a6b8a..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P345.wav
deleted file mode 100644
index efc72bc..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T255_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P000.wav
deleted file mode 100644
index 8f49078..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P015.wav
deleted file mode 100644
index 96510f7..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P030.wav
deleted file mode 100644
index 60b84f4..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P045.wav
deleted file mode 100644
index ec995e6..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P060.wav
deleted file mode 100644
index e287d0e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P075.wav
deleted file mode 100644
index e287d0e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P090.wav
deleted file mode 100644
index e287d0e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P315.wav
deleted file mode 100644
index 01f0921..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P330.wav
deleted file mode 100644
index 380e707..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P345.wav
deleted file mode 100644
index 124a534..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T270_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P000.wav
deleted file mode 100644
index 1a577f3..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P015.wav
deleted file mode 100644
index ce698bb..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P030.wav
deleted file mode 100644
index 8d5134f..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P045.wav
deleted file mode 100644
index 583c6ed..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P060.wav
deleted file mode 100644
index 583c6ed..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P075.wav
deleted file mode 100644
index 583c6ed..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P090.wav
deleted file mode 100644
index 583c6ed..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P315.wav
deleted file mode 100644
index 7b1b43b..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P330.wav
deleted file mode 100644
index e9ed7ed..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P345.wav
deleted file mode 100644
index 6ce83ed..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T285_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P000.wav
deleted file mode 100644
index b4ea6bf..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P015.wav
deleted file mode 100644
index 76d5b71..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P030.wav
deleted file mode 100644
index 04ee003..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P045.wav
deleted file mode 100644
index 22d7413..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P060.wav
deleted file mode 100644
index 1b35018..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P075.wav
deleted file mode 100644
index 2f55df8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P090.wav
deleted file mode 100644
index 2f55df8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P315.wav
deleted file mode 100644
index 7bcc8a4..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P330.wav
deleted file mode 100644
index a3bacf3..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P345.wav
deleted file mode 100644
index bdfba2d..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T300_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P000.wav
deleted file mode 100644
index 719320c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P015.wav
deleted file mode 100644
index 5d366fc..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P030.wav
deleted file mode 100644
index e10e88b..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P045.wav
deleted file mode 100644
index ecb4b50..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P060.wav
deleted file mode 100644
index ecb4b50..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P075.wav
deleted file mode 100644
index ecb4b50..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P090.wav
deleted file mode 100644
index ecb4b50..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P315.wav
deleted file mode 100644
index 35c44d4..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P330.wav
deleted file mode 100644
index 8fe859b..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P345.wav
deleted file mode 100644
index 3e44b83..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T315_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P000.wav
deleted file mode 100644
index e878220..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P015.wav
deleted file mode 100644
index 7628cbc..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P030.wav
deleted file mode 100644
index 7c4430c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P045.wav
deleted file mode 100644
index 55e3c5e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P060.wav
deleted file mode 100644
index 563313e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P075.wav
deleted file mode 100644
index 563313e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P090.wav
deleted file mode 100644
index 563313e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P315.wav
deleted file mode 100644
index 3eccc16..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P330.wav
deleted file mode 100644
index fd3f5e1..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P345.wav
deleted file mode 100644
index 5937c59..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T330_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P000.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P000.wav
deleted file mode 100644
index 99dc851..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P000.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P015.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P015.wav
deleted file mode 100644
index 28994d5..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P015.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P030.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P030.wav
deleted file mode 100644
index beb24a2..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P030.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P045.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P045.wav
deleted file mode 100644
index f840c59..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P045.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P060.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P060.wav
deleted file mode 100644
index f840c59..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P060.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P075.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P075.wav
deleted file mode 100644
index f840c59..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P075.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P090.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P090.wav
deleted file mode 100644
index f840c59..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P090.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P315.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P315.wav
deleted file mode 100644
index 68baa8e..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P315.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P330.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P330.wav
deleted file mode 100644
index 6cb01b8..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P330.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P345.wav b/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P345.wav
deleted file mode 100644
index b2ae88c..0000000
--- a/Source/core/platform/audio/resources/IRC_Composite_C_R0195_T345_P345.wav
+++ /dev/null
Binary files differ
diff --git a/Source/core/platform/chromium/ChromiumDataObject.cpp b/Source/core/platform/chromium/ChromiumDataObject.cpp
index 196fb38..78086a5 100644
--- a/Source/core/platform/chromium/ChromiumDataObject.cpp
+++ b/Source/core/platform/chromium/ChromiumDataObject.cpp
@@ -35,8 +35,9 @@
 #include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/dom/DataTransferItem.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/platform/chromium/ClipboardMimeTypes.h"
-#include "core/platform/chromium/ClipboardUtilitiesChromium.h"
+#include "core/platform/Pasteboard.h"
+#include "platform/clipboard/ClipboardMimeTypes.h"
+#include "platform/clipboard/ClipboardUtilities.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebClipboard.h"
 
@@ -45,9 +46,10 @@
 PassRefPtr<ChromiumDataObject> ChromiumDataObject::createFromPasteboard(PasteMode pasteMode)
 {
     RefPtr<ChromiumDataObject> dataObject = create();
-    uint64_t sequenceNumber = WebKit::Platform::current()->clipboard()->sequenceNumber(currentPasteboardBuffer());
+    WebKit::WebClipboard::Buffer buffer = Pasteboard::generalPasteboard()->buffer();
+    uint64_t sequenceNumber = WebKit::Platform::current()->clipboard()->sequenceNumber(buffer);
     bool ignored;
-    WebKit::WebVector<WebKit::WebString> webTypes = WebKit::Platform::current()->clipboard()->readAvailableTypes(currentPasteboardBuffer(), &ignored);
+    WebKit::WebVector<WebKit::WebString> webTypes = WebKit::Platform::current()->clipboard()->readAvailableTypes(buffer, &ignored);
     ListHashSet<String> types;
     for (size_t i = 0; i < webTypes.size(); ++i)
         types.add(webTypes[i]);
@@ -103,7 +105,7 @@
     return item;
 }
 
-PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(PassRefPtr<File> file, ScriptExecutionContext* context)
+PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(PassRefPtr<File> file)
 {
     if (!file)
         return 0;
diff --git a/Source/core/platform/chromium/ChromiumDataObject.h b/Source/core/platform/chromium/ChromiumDataObject.h
index 7d47e00..63afbc8 100644
--- a/Source/core/platform/chromium/ChromiumDataObject.h
+++ b/Source/core/platform/chromium/ChromiumDataObject.h
@@ -31,9 +31,9 @@
 #ifndef ChromiumDataObject_h
 #define ChromiumDataObject_h
 
-#include "core/platform/Supplementable.h"
 #include "core/platform/chromium/ChromiumDataObjectItem.h"
-#include "core/platform/chromium/PasteMode.h"
+#include "platform/PasteMode.h"
+#include "platform/Supplementable.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
@@ -64,7 +64,7 @@
     void deleteItem(unsigned long index);
     void clearAll();
     PassRefPtr<ChromiumDataObjectItem> add(const String& data, const String& type, ExceptionState&);
-    PassRefPtr<ChromiumDataObjectItem> add(PassRefPtr<File>, ScriptExecutionContext*);
+    PassRefPtr<ChromiumDataObjectItem> add(PassRefPtr<File>);
 
     // WebCore helpers.
     void clearData(const String& type);
diff --git a/Source/core/platform/chromium/ChromiumDataObjectItem.cpp b/Source/core/platform/chromium/ChromiumDataObjectItem.cpp
index e123149..601bc60 100644
--- a/Source/core/platform/chromium/ChromiumDataObjectItem.cpp
+++ b/Source/core/platform/chromium/ChromiumDataObjectItem.cpp
@@ -35,10 +35,9 @@
 #include "core/dom/StringCallback.h"
 #include "core/fileapi/Blob.h"
 #include "core/fileapi/File.h"
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/chromium/ClipboardMimeTypes.h"
-#include "core/platform/chromium/ClipboardUtilitiesChromium.h"
-
+#include "core/platform/Pasteboard.h"
+#include "platform/SharedBuffer.h"
+#include "platform/clipboard/ClipboardMimeTypes.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebClipboard.h"
 
@@ -105,7 +104,7 @@
 {
 }
 
-void ChromiumDataObjectItem::getAsString(PassRefPtr<StringCallback> callback, ScriptExecutionContext* context) const
+void ChromiumDataObjectItem::getAsString(PassRefPtr<StringCallback> callback, ExecutionContext* context) const
 {
     if (!callback || kind() != DataTransferItem::kindString)
         return;
@@ -145,7 +144,7 @@
         OwnPtr<BlobData> blobData = BlobData::create();
         blobData->appendData(rawData, 0, -1);
         blobData->setContentType(mimeTypeImagePng);
-        return Blob::create(blobData.release(), data->size());
+        return Blob::create(BlobDataHandle::create(blobData.release(), data->size()));
     }
 
     return 0;
@@ -160,18 +159,19 @@
 
     ASSERT(m_source == PasteboardSource);
 
+    WebKit::WebClipboard::Buffer buffer = Pasteboard::generalPasteboard()->buffer();
     String data;
     // This is ugly but there's no real alternative.
     if (m_type == mimeTypeTextPlain)
-        data = WebKit::Platform::current()->clipboard()->readPlainText(currentPasteboardBuffer());
+        data = WebKit::Platform::current()->clipboard()->readPlainText(buffer);
     else if (m_type == mimeTypeTextHTML) {
         WebKit::WebURL ignoredSourceURL;
         unsigned ignored;
-        data = WebKit::Platform::current()->clipboard()->readHTML(currentPasteboardBuffer(), &ignoredSourceURL, &ignored, &ignored);
+        data = WebKit::Platform::current()->clipboard()->readHTML(buffer, &ignoredSourceURL, &ignored, &ignored);
     } else
-        data = WebKit::Platform::current()->clipboard()->readCustomData(currentPasteboardBuffer(), m_type);
+        data = WebKit::Platform::current()->clipboard()->readCustomData(buffer, m_type);
 
-    return WebKit::Platform::current()->clipboard()->sequenceNumber(currentPasteboardBuffer()) == m_sequenceNumber ? data : String();
+    return WebKit::Platform::current()->clipboard()->sequenceNumber(buffer) == m_sequenceNumber ? data : String();
 }
 
 bool ChromiumDataObjectItem::isFilename() const
diff --git a/Source/core/platform/chromium/ChromiumDataObjectItem.h b/Source/core/platform/chromium/ChromiumDataObjectItem.h
index 82956b3..486a53e 100644
--- a/Source/core/platform/chromium/ChromiumDataObjectItem.h
+++ b/Source/core/platform/chromium/ChromiumDataObjectItem.h
@@ -32,7 +32,7 @@
 #define ChromiumDataObjectItem_h
 
 #include "core/fileapi/File.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "weborigin/KURL.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
@@ -41,7 +41,7 @@
 namespace WebCore {
 
 class Blob;
-class ScriptExecutionContext;
+class ExecutionContext;
 class StringCallback;
 
 class ChromiumDataObjectItem : public RefCounted<ChromiumDataObjectItem> {
@@ -55,7 +55,7 @@
 
     String kind() const { return m_kind; }
     String type() const { return m_type; }
-    void getAsString(PassRefPtr<StringCallback>, ScriptExecutionContext*) const;
+    void getAsString(PassRefPtr<StringCallback>, ExecutionContext*) const;
     PassRefPtr<Blob> getAsFile() const;
 
     // Used to support legacy DataTransfer APIs and renderer->browser serialization.
diff --git a/Source/core/platform/chromium/ClipboardChromium.cpp b/Source/core/platform/chromium/ClipboardChromium.cpp
deleted file mode 100644
index 211e7cd..0000000
--- a/Source/core/platform/chromium/ClipboardChromium.cpp
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2008, 2009 Google Inc.
- *
- * 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,
- * 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/ClipboardChromium.h"
-
-#include "HTMLNames.h"
-#include "bindings/v8/ExceptionState.h"
-#include "core/dom/DataTransferItemList.h"
-#include "core/dom/Document.h"
-#include "core/dom/Element.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/dom/StringCallback.h"
-#include "core/editing/markup.h"
-#include "core/fetch/ImageResource.h"
-#include "core/fileapi/File.h"
-#include "core/fileapi/FileList.h"
-#include "core/page/Frame.h"
-#include "core/platform/DragData.h"
-#include "core/platform/MIMETypeRegistry.h"
-#include "core/platform/chromium/ChromiumDataObject.h"
-#include "core/platform/chromium/ChromiumDataObjectItem.h"
-#include "core/platform/chromium/ClipboardMimeTypes.h"
-#include "core/platform/chromium/ClipboardUtilitiesChromium.h"
-#include "core/platform/graphics/Image.h"
-#include "core/rendering/RenderImage.h"
-
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-namespace {
-
-// A wrapper class that invalidates a DataTransferItemList when the associated Clipboard object goes out of scope.
-class DataTransferItemListPolicyWrapper : public DataTransferItemList {
-public:
-    static PassRefPtr<DataTransferItemListPolicyWrapper> create(PassRefPtr<ClipboardChromium>, PassRefPtr<ChromiumDataObject>);
-    virtual ~DataTransferItemListPolicyWrapper();
-
-    virtual size_t length() const;
-    virtual PassRefPtr<DataTransferItem> item(unsigned long index) OVERRIDE;
-    virtual void deleteItem(unsigned long index, ExceptionState&) OVERRIDE;
-    virtual void clear() OVERRIDE;
-    virtual PassRefPtr<DataTransferItem> add(const String& data, const String& type, ExceptionState&) OVERRIDE;
-    virtual PassRefPtr<DataTransferItem> add(PassRefPtr<File>) OVERRIDE;
-
-private:
-    DataTransferItemListPolicyWrapper(PassRefPtr<ClipboardChromium>, PassRefPtr<ChromiumDataObject>);
-
-    RefPtr<ClipboardChromium> m_clipboard;
-    RefPtr<ChromiumDataObject> m_dataObject;
-};
-
-
-PassRefPtr<DataTransferItemListPolicyWrapper> DataTransferItemListPolicyWrapper::create(
-    PassRefPtr<ClipboardChromium> clipboard, PassRefPtr<ChromiumDataObject> list)
-{
-    return adoptRef(new DataTransferItemListPolicyWrapper(clipboard, list));
-}
-
-DataTransferItemListPolicyWrapper::~DataTransferItemListPolicyWrapper()
-{
-}
-
-size_t DataTransferItemListPolicyWrapper::length() const
-{
-    if (!m_clipboard->canReadTypes())
-        return 0;
-    return m_dataObject->length();
-}
-
-PassRefPtr<DataTransferItem> DataTransferItemListPolicyWrapper::item(unsigned long index)
-{
-    if (!m_clipboard->canReadTypes())
-        return 0;
-    RefPtr<ChromiumDataObjectItem> item = m_dataObject->item(index);
-    if (!item)
-        return 0;
-
-    return DataTransferItemPolicyWrapper::create(m_clipboard, item);
-}
-
-void DataTransferItemListPolicyWrapper::deleteItem(unsigned long index, ExceptionState& es)
-{
-    if (!m_clipboard->canWriteData()) {
-        es.throwUninformativeAndGenericDOMException(InvalidStateError);
-        return;
-    }
-    m_dataObject->deleteItem(index);
-}
-
-void DataTransferItemListPolicyWrapper::clear()
-{
-    if (!m_clipboard->canWriteData())
-        return;
-    m_dataObject->clearAll();
-}
-
-PassRefPtr<DataTransferItem> DataTransferItemListPolicyWrapper::add(const String& data, const String& type, ExceptionState& es)
-{
-    if (!m_clipboard->canWriteData())
-        return 0;
-    RefPtr<ChromiumDataObjectItem> item = m_dataObject->add(data, type, es);
-    if (!item)
-        return 0;
-    return DataTransferItemPolicyWrapper::create(m_clipboard, item);
-}
-
-PassRefPtr<DataTransferItem> DataTransferItemListPolicyWrapper::add(PassRefPtr<File> file)
-{
-    if (!m_clipboard->canWriteData())
-        return 0;
-    RefPtr<ChromiumDataObjectItem> item = m_dataObject->add(file, m_clipboard->frame()->document()->scriptExecutionContext());
-    if (!item)
-        return 0;
-    return DataTransferItemPolicyWrapper::create(m_clipboard, item);
-}
-
-DataTransferItemListPolicyWrapper::DataTransferItemListPolicyWrapper(
-    PassRefPtr<ClipboardChromium> clipboard, PassRefPtr<ChromiumDataObject> dataObject)
-    : m_clipboard(clipboard)
-    , m_dataObject(dataObject)
-{
-}
-
-} // namespace
-
-PassRefPtr<DataTransferItemPolicyWrapper> DataTransferItemPolicyWrapper::create(
-    PassRefPtr<ClipboardChromium> clipboard, PassRefPtr<ChromiumDataObjectItem> item)
-{
-    return adoptRef(new DataTransferItemPolicyWrapper(clipboard, item));
-}
-
-DataTransferItemPolicyWrapper::~DataTransferItemPolicyWrapper()
-{
-}
-
-String DataTransferItemPolicyWrapper::kind() const
-{
-    if (!m_clipboard->canReadTypes())
-        return String();
-    return m_item->kind();
-}
-
-String DataTransferItemPolicyWrapper::type() const
-{
-    if (!m_clipboard->canReadTypes())
-        return String();
-    return m_item->type();
-}
-
-void DataTransferItemPolicyWrapper::getAsString(PassRefPtr<StringCallback> callback) const
-{
-    if (!m_clipboard->canReadData())
-        return;
-
-    m_item->getAsString(callback, m_clipboard->frame()->document()->scriptExecutionContext());
-}
-
-PassRefPtr<Blob> DataTransferItemPolicyWrapper::getAsFile() const
-{
-    if (!m_clipboard->canReadData())
-        return 0;
-
-    return m_item->getAsFile();
-}
-
-DataTransferItemPolicyWrapper::DataTransferItemPolicyWrapper(
-    PassRefPtr<ClipboardChromium> clipboard, PassRefPtr<ChromiumDataObjectItem> item)
-    : m_clipboard(clipboard)
-    , m_item(item)
-{
-}
-
-using namespace HTMLNames;
-
-// We provide the IE clipboard types (URL and Text), and the clipboard types specified in the WHATWG Web Applications 1.0 draft
-// see http://www.whatwg.org/specs/web-apps/current-work/ Section 6.3.5.3
-
-static String normalizeType(const String& type, bool* convertToURL = 0)
-{
-    String cleanType = type.stripWhiteSpace().lower();
-    if (cleanType == mimeTypeText || cleanType.startsWith(mimeTypeTextPlainEtc))
-        return mimeTypeTextPlain;
-    if (cleanType == mimeTypeURL) {
-        if (convertToURL)
-          *convertToURL = true;
-        return mimeTypeTextURIList;
-    }
-    return cleanType;
-}
-
-PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData* dragData, Frame* frame)
-{
-    return ClipboardChromium::create(DragAndDrop, dragData->platformData(), policy, frame);
-}
-
-ClipboardChromium::ClipboardChromium(ClipboardType clipboardType,
-                                     PassRefPtr<ChromiumDataObject> dataObject,
-                                     ClipboardAccessPolicy policy,
-                                     Frame* frame)
-    : Clipboard(policy, clipboardType)
-    , m_dataObject(dataObject)
-    , m_frame(frame)
-{
-}
-
-ClipboardChromium::~ClipboardChromium()
-{
-    if (m_dragImage)
-        m_dragImage->removeClient(this);
-}
-
-PassRefPtr<ClipboardChromium> ClipboardChromium::create(ClipboardType clipboardType,
-    PassRefPtr<ChromiumDataObject> dataObject, ClipboardAccessPolicy policy, Frame* frame)
-{
-    return adoptRef(new ClipboardChromium(clipboardType, dataObject, policy, frame));
-}
-
-void ClipboardChromium::clearData(const String& type)
-{
-    if (!canWriteData())
-        return;
-
-    m_dataObject->clearData(normalizeType(type));
-}
-
-void ClipboardChromium::clearAllData()
-{
-    if (!canWriteData())
-        return;
-
-    m_dataObject->clearAll();
-}
-
-String ClipboardChromium::getData(const String& type) const
-{
-    if (!canReadData())
-        return String();
-
-    bool convertToURL = false;
-    String data = m_dataObject->getData(normalizeType(type, &convertToURL));
-    if (!convertToURL)
-        return data;
-    return convertURIListToURL(data);
-}
-
-bool ClipboardChromium::setData(const String& type, const String& data)
-{
-    if (!canWriteData())
-        return false;
-
-    return m_dataObject->setData(normalizeType(type), data);
-}
-
-// extensions beyond IE's API
-ListHashSet<String> ClipboardChromium::types() const
-{
-    if (!canReadTypes())
-        return ListHashSet<String>();
-
-    return m_dataObject->types();
-}
-
-PassRefPtr<FileList> ClipboardChromium::files() const
-{
-    RefPtr<FileList> files = FileList::create();
-    if (!canReadData())
-        return files.release();
-
-    for (size_t i = 0; i < m_dataObject->length(); ++i) {
-        if (m_dataObject->item(i)->kind() == DataTransferItem::kindFile) {
-            RefPtr<Blob> blob = m_dataObject->item(i)->getAsFile();
-            if (blob && blob->isFile())
-                files->append(toFile(blob.get()));
-        }
-    }
-
-    return files.release();
-}
-
-void ClipboardChromium::setDragImage(ImageResource* image, Node* node, const IntPoint& loc)
-{
-    if (!canSetDragImage())
-        return;
-
-    if (m_dragImage)
-        m_dragImage->removeClient(this);
-    m_dragImage = image;
-    if (m_dragImage)
-        m_dragImage->addClient(this);
-
-    m_dragLoc = loc;
-    m_dragImageElement = node;
-}
-
-void ClipboardChromium::setDragImage(ImageResource* img, const IntPoint& loc)
-{
-    setDragImage(img, 0, loc);
-}
-
-void ClipboardChromium::setDragImageElement(Node* node, const IntPoint& loc)
-{
-    setDragImage(0, node, loc);
-}
-
-PassOwnPtr<DragImage> ClipboardChromium::createDragImage(IntPoint& loc) const
-{
-    if (m_dragImageElement) {
-        if (m_frame) {
-            loc = m_dragLoc;
-            return m_frame->nodeImage(m_dragImageElement.get());
-        }
-    } else if (m_dragImage) {
-        loc = m_dragLoc;
-        return DragImage::create(m_dragImage->image());
-    }
-    return nullptr;
-}
-
-static ImageResource* getImageResource(Element* element)
-{
-    // Attempt to pull ImageResource from element
-    ASSERT(element);
-    RenderObject* renderer = element->renderer();
-    if (!renderer || !renderer->isImage())
-        return 0;
-
-    RenderImage* image = toRenderImage(renderer);
-    if (image->cachedImage() && !image->cachedImage()->errorOccurred())
-        return image->cachedImage();
-
-    return 0;
-}
-
-static void writeImageToDataObject(ChromiumDataObject* dataObject, Element* element,
-                                   const KURL& url)
-{
-    // Shove image data into a DataObject for use as a file
-    ImageResource* cachedImage = getImageResource(element);
-    if (!cachedImage || !cachedImage->imageForRenderer(element->renderer()) || !cachedImage->isLoaded())
-        return;
-
-    SharedBuffer* imageBuffer = cachedImage->imageForRenderer(element->renderer())->data();
-    if (!imageBuffer || !imageBuffer->size())
-        return;
-
-    String imageExtension = cachedImage->image()->filenameExtension();
-    ASSERT(!imageExtension.isEmpty());
-
-    // Determine the filename for the file contents of the image.
-    String filename = cachedImage->response().suggestedFilename();
-    if (filename.isEmpty())
-        filename = url.lastPathComponent();
-
-    String fileExtension;
-    if (filename.isEmpty()) {
-        filename = element->getAttribute(altAttr);
-    } else {
-        // Strip any existing extension. Assume that alt text is usually not a filename.
-        int extensionIndex = filename.reverseFind('.');
-        if (extensionIndex != -1) {
-            fileExtension = filename.substring(extensionIndex + 1);
-            filename.truncate(extensionIndex);
-        }
-    }
-
-    if (!fileExtension.isEmpty() && fileExtension != imageExtension) {
-        String imageMimeType = MIMETypeRegistry::getMIMETypeForExtension(imageExtension);
-        ASSERT(imageMimeType.startsWith("image/"));
-        // Use the file extension only if it has imageMimeType: it's untrustworthy otherwise.
-        if (imageMimeType == MIMETypeRegistry::getMIMETypeForExtension(fileExtension))
-            imageExtension = fileExtension;
-    }
-
-    imageExtension = "." + imageExtension;
-    ClipboardChromium::validateFilename(filename, imageExtension);
-
-    dataObject->addSharedBuffer(filename + imageExtension, imageBuffer);
-}
-
-void ClipboardChromium::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame)
-{
-    if (!m_dataObject)
-        return;
-
-    m_dataObject->setURLAndTitle(url, title);
-
-    // Write the bytes in the image to the file format.
-    writeImageToDataObject(m_dataObject.get(), element, url);
-
-    // Put img tag on the clipboard referencing the image
-    m_dataObject->setData(mimeTypeTextHTML, createMarkup(element, IncludeNode, 0, ResolveAllURLs));
-}
-
-void ClipboardChromium::writeURL(const KURL& url, const String& title, Frame*)
-{
-    if (!m_dataObject)
-        return;
-    ASSERT(!url.isEmpty());
-
-    m_dataObject->setURLAndTitle(url, title);
-
-    // The URL can also be used as plain text.
-    m_dataObject->setData(mimeTypeTextPlain, url.string());
-
-    // The URL can also be used as an HTML fragment.
-    m_dataObject->setHTMLAndBaseURL(urlToMarkup(url, title), url);
-}
-
-void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame)
-{
-    ASSERT(selectedRange);
-    if (!m_dataObject)
-         return;
-
-    m_dataObject->setHTMLAndBaseURL(createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs), frame->document()->url());
-
-    String str = frame->selectedTextForClipboard();
-#if OS(WIN)
-    replaceNewlinesWithWindowsStyleNewlines(str);
-#endif
-    replaceNBSPWithSpace(str);
-    m_dataObject->setData(mimeTypeTextPlain, str);
-}
-
-void ClipboardChromium::writePlainText(const String& text)
-{
-    if (!m_dataObject)
-        return;
-
-    String str = text;
-#if OS(WIN)
-    replaceNewlinesWithWindowsStyleNewlines(str);
-#endif
-    replaceNBSPWithSpace(str);
-
-    m_dataObject->setData(mimeTypeTextPlain, str);
-}
-
-bool ClipboardChromium::hasData()
-{
-    ASSERT(isForDragAndDrop());
-
-    return m_dataObject->length() > 0;
-}
-
-PassRefPtr<DataTransferItemList> ClipboardChromium::items()
-{
-    // FIXME: According to the spec, we are supposed to return the same collection of items each
-    // time. We now return a wrapper that always wraps the *same* set of items, so JS shouldn't be
-    // able to tell, but we probably still want to fix this.
-    return DataTransferItemListPolicyWrapper::create(this, m_dataObject);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/ClipboardChromium.h b/Source/core/platform/chromium/ClipboardChromium.h
deleted file mode 100644
index 4cc1416..0000000
--- a/Source/core/platform/chromium/ClipboardChromium.h
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright (c) 2008, 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 ClipboardChromium_h
-#define ClipboardChromium_h
-
-#include "core/dom/Clipboard.h"
-#include "core/dom/DataTransferItem.h"
-#include "core/fetch/ImageResourceClient.h"
-#include "core/platform/chromium/ChromiumDataObject.h"
-
-namespace WebCore {
-
-class ImageResource;
-    class ChromiumDataObjectItem;
-    class ClipboardChromium;
-    class Frame;
-    class IntPoint;
-
-    // A wrapper class that invalidates a DataTransferItem when the associated Clipboard object goes out of scope.
-    class DataTransferItemPolicyWrapper : public DataTransferItem {
-    public:
-        static PassRefPtr<DataTransferItemPolicyWrapper> create(PassRefPtr<ClipboardChromium>, PassRefPtr<ChromiumDataObjectItem>);
-        virtual ~DataTransferItemPolicyWrapper();
-
-        virtual String kind() const OVERRIDE;
-        virtual String type() const OVERRIDE;
-        virtual void getAsString(PassRefPtr<StringCallback>) const OVERRIDE;
-        virtual PassRefPtr<Blob> getAsFile() const OVERRIDE;
-
-        ClipboardChromium* clipboard() { return m_clipboard.get(); }
-        ChromiumDataObjectItem* dataObjectItem() { return m_item.get(); }
-
-    private:
-        DataTransferItemPolicyWrapper(PassRefPtr<ClipboardChromium>, PassRefPtr<ChromiumDataObjectItem>);
-
-        RefPtr<ClipboardChromium> m_clipboard;
-        RefPtr<ChromiumDataObjectItem> m_item;
-    };
-
-    class ClipboardChromium : public Clipboard, public ImageResourceClient {
-        WTF_MAKE_FAST_ALLOCATED;
-    public:
-        ~ClipboardChromium();
-
-        static PassRefPtr<ClipboardChromium> create(
-            ClipboardType, PassRefPtr<ChromiumDataObject>, ClipboardAccessPolicy, Frame*);
-
-        // Validates a filename (without the extension) and the extension. This removes any invalid
-        // file system characters as well as making sure the path + extension is not bigger than
-        // allowed by the file system.
-        static void validateFilename(String& name, String& extension);
-
-        virtual void clearData(const String& type);
-        void clearAllData();
-        String getData(const String& type) const;
-        bool setData(const String& type, const String& data);
-        bool platformClipboardChanged() const;
-
-        // extensions beyond IE's API
-        virtual ListHashSet<String> types() const;
-        virtual PassRefPtr<FileList> files() const;
-
-        void setDragImage(ImageResource*, const IntPoint&);
-        void setDragImageElement(Node*, const IntPoint&);
-
-        PassRefPtr<ChromiumDataObject> dataObject()
-        {
-            return m_dataObject;
-        }
-
-        virtual PassOwnPtr<DragImage> createDragImage(IntPoint& dragLoc) const;
-        virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
-        virtual void writeURL(const KURL&, const String&, Frame*);
-        virtual void writeRange(Range*, Frame*);
-        virtual void writePlainText(const String&);
-
-        virtual bool hasData();
-
-        virtual PassRefPtr<DataTransferItemList> items();
-        Frame* frame() const { return m_frame; }
-
-    private:
-        ClipboardChromium(ClipboardType, PassRefPtr<ChromiumDataObject>, ClipboardAccessPolicy, Frame*);
-
-        void resetFromClipboard();
-        void setDragImage(ImageResource*, Node*, const IntPoint&);
-        RefPtr<ChromiumDataObject> m_dataObject;
-        Frame* m_frame;
-    };
-
-} // namespace WebCore
-
-#endif // ClipboardChromium_h
diff --git a/Source/core/platform/chromium/ClipboardChromiumPosix.cpp b/Source/core/platform/chromium/ClipboardChromiumPosix.cpp
deleted file mode 100644
index ee5b741..0000000
--- a/Source/core/platform/chromium/ClipboardChromiumPosix.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Google Inc.
- *
- * 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,
- * 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/ClipboardChromium.h"
-
-namespace WebCore {
-
-// On POSIX systems, the typical filename length limit is 255 character units. HFS+'s limit is
-// actually 255 Unicode characters using Apple's modification of Normzliation Form D, but the
-// differences aren't really worth dealing with here.
-static const unsigned maxFilenameLength = 255;
-
-static bool isInvalidFileCharacter(UChar c)
-{
-    // HFS+ disallows '/' and Linux systems also disallow null. For sanity's sake we'll also
-    // disallow control characters.
-    return c < ' ' || c == 0x7F || c == '/';
-}
-
-void ClipboardChromium::validateFilename(String& name, String& extension)
-{
-    // Remove any invalid file system characters, especially "/".
-    name = name.removeCharacters(&isInvalidFileCharacter);
-    extension = extension.removeCharacters(&isInvalidFileCharacter);
-
-    // Remove a ridiculously-long extension.
-    if (extension.length() >= maxFilenameLength)
-        extension = String();
-
-    // Truncate an overly-long filename, reserving one character for a dot.
-    name.truncate(maxFilenameLength - extension.length() - 1);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/ClipboardChromiumTest.cpp b/Source/core/platform/chromium/ClipboardChromiumTest.cpp
deleted file mode 100644
index 8bbaf5a..0000000
--- a/Source/core/platform/chromium/ClipboardChromiumTest.cpp
+++ /dev/null
@@ -1,89 +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/chromium/ClipboardChromium.h"
-
-#include <gtest/gtest.h>
-
-using namespace WebCore;
-
-namespace {
-
-#if OS(WIN)
-const char invalidCharacters[] = "\x00/\\:*?\"<>|";
-#else
-const char invalidCharacters[] =
-    "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
-    "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
-    "\x7f/";
-#endif
-const char longString[] =
-    "0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,"
-    "75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352";
-
-TEST(ClipboardChromiumTest, Normal)
-{
-    String name = "name";
-    String extension = "ext";
-    ClipboardChromium::validateFilename(name, extension);
-    EXPECT_EQ("name", name);
-    EXPECT_EQ("ext", extension);
-}
-
-TEST(ClipboardChromiumTest, InvalidCharacters)
-{
-    String name = "na" + String(invalidCharacters, arraysize(invalidCharacters)) + "me";
-    String extension = "e" + String(invalidCharacters, arraysize(invalidCharacters)) + "xt";
-    ClipboardChromium::validateFilename(name, extension);
-    EXPECT_EQ("name", name);
-    EXPECT_EQ("ext", extension);
-}
-
-TEST(ClipboardChromiumTest, ExtensionTooLong)
-{
-    String name;
-    String extension = String(longString) + longString;
-    ClipboardChromium::validateFilename(name, extension);
-    EXPECT_EQ(String(), extension);
-}
-
-TEST(ClipboardChromiumTest, NamePlusExtensionTooLong)
-{
-    String name = String(longString) + longString;
-    String extension = longString;
-    ClipboardChromium::validateFilename(name, extension);
-    EXPECT_EQ("0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,109", name);
-    EXPECT_EQ(longString, extension);
-    EXPECT_EQ(254u, name.length() + extension.length());
-}
-
-} // anonymous namespace
diff --git a/Source/core/platform/chromium/ClipboardChromiumWin.cpp b/Source/core/platform/chromium/ClipboardChromiumWin.cpp
deleted file mode 100644
index 176462d..0000000
--- a/Source/core/platform/chromium/ClipboardChromiumWin.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Google Inc.
- *
- * 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,
- * 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/ClipboardChromium.h"
-
-#include <shlwapi.h>
-
-namespace WebCore {
-
-// FAT32 and NTFS both limit filenames to a maximum of 255 characters.
-static const unsigned maxFilenameLength = 255;
-
-// Returns true if the specified character is not valid in a file name. This
-// is intended for use with removeCharacters.
-static bool isInvalidFileCharacter(UChar c)
-{
-    return (PathGetCharType(c) & (GCT_LFNCHAR | GCT_SHORTCHAR)) == 0;
-}
-
-void ClipboardChromium::validateFilename(String& name, String& extension)
-{
-    // Remove any invalid file system characters.
-    name = name.removeCharacters(&isInvalidFileCharacter);
-    extension = extension.removeCharacters(&isInvalidFileCharacter);
-
-    if (extension.length() >= maxFilenameLength)
-        extension = String();
-
-    // Truncate overly-long filenames, reserving one character for a dot.
-    name.truncate(maxFilenameLength - extension.length() - 1);
-}
-
-}  // namespace WebCore
diff --git a/Source/core/platform/chromium/ClipboardMimeTypes.cpp b/Source/core/platform/chromium/ClipboardMimeTypes.cpp
deleted file mode 100644
index 75b9195..0000000
--- a/Source/core/platform/chromium/ClipboardMimeTypes.cpp
+++ /dev/null
@@ -1,46 +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/chromium/ClipboardMimeTypes.h"
-
-namespace WebCore {
-
-const char mimeTypeText[] = "text";
-const char mimeTypeTextPlain[] = "text/plain";
-const char mimeTypeTextPlainEtc[] = "text/plain;";
-const char mimeTypeTextHTML[] = "text/html";
-const char mimeTypeURL[] = "url";
-const char mimeTypeTextURIList[] = "text/uri-list";
-const char mimeTypeDownloadURL[] = "downloadurl";
-const char mimeTypeFiles[] = "Files";
-const char mimeTypeImagePng[] = "image/png";
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/ClipboardMimeTypes.h b/Source/core/platform/chromium/ClipboardMimeTypes.h
deleted file mode 100644
index 3e4ab50..0000000
--- a/Source/core/platform/chromium/ClipboardMimeTypes.h
+++ /dev/null
@@ -1,48 +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 ClipboardMimeTypes_h
-#define ClipboardMimeTypes_h
-
-namespace WebCore {
-
-extern const char mimeTypeText[];
-extern const char mimeTypeTextPlain[];
-extern const char mimeTypeTextPlainEtc[];
-extern const char mimeTypeTextHTML[];
-extern const char mimeTypeURL[];
-extern const char mimeTypeTextURIList[];
-extern const char mimeTypeDownloadURL[];
-extern const char mimeTypeFiles[];
-extern const char mimeTypeImagePng[];
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp b/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp
deleted file mode 100644
index 6d86b7e..0000000
--- a/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2008, 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
- * 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/chromium/ClipboardUtilitiesChromium.h"
-
-#include "core/platform/Pasteboard.h"
-#include "public/platform/WebClipboard.h"
-#include "weborigin/KURL.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-WebKit::WebClipboard::Buffer currentPasteboardBuffer()
-{
-    return Pasteboard::generalPasteboard()->isSelectionMode() ?
-        WebKit::WebClipboard::BufferSelection :
-        WebKit::WebClipboard::BufferStandard;
-}
-
-#if OS(WIN)
-void replaceNewlinesWithWindowsStyleNewlines(String& str)
-{
-    DEFINE_STATIC_LOCAL(String, windowsNewline, ("\r\n"));
-    StringBuilder result;
-    for (unsigned index = 0; index < str.length(); ++index) {
-        if (str[index] != '\n' || (index > 0 && str[index - 1] == '\r'))
-            result.append(str[index]);
-        else
-            result.append(windowsNewline);
-    }
-    str = result.toString();
-}
-#endif
-
-void replaceNBSPWithSpace(String& str)
-{
-    static const UChar NonBreakingSpaceCharacter = 0xA0;
-    static const UChar SpaceCharacter = ' ';
-    str.replace(NonBreakingSpaceCharacter, SpaceCharacter);
-}
-
-String convertURIListToURL(const String& uriList)
-{
-    Vector<String> items;
-    // Line separator is \r\n per RFC 2483 - however, for compatibility
-    // reasons we allow just \n here.
-    uriList.split('\n', items);
-    // Process the input and return the first valid URL. In case no URLs can
-    // be found, return an empty string. This is in line with the HTML5 spec.
-    for (size_t i = 0; i < items.size(); ++i) {
-        String& line = items[i];
-        line = line.stripWhiteSpace();
-        if (line.isEmpty())
-            continue;
-        if (line[0] == '#')
-            continue;
-        KURL url = KURL(ParsedURLString, line);
-        if (url.isValid())
-            return url;
-    }
-    return String();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/ClipboardUtilitiesChromium.h b/Source/core/platform/chromium/ClipboardUtilitiesChromium.h
deleted file mode 100644
index 1a9cb3d..0000000
--- a/Source/core/platform/chromium/ClipboardUtilitiesChromium.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2008, 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
- * 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 ClipboardUtilitiesChromium_h
-#define ClipboardUtilitiesChromium_h
-
-#include "public/platform/WebClipboard.h"
-#include "wtf/Forward.h"
-
-namespace WebCore {
-
-class KURL;
-
-WebKit::WebClipboard::Buffer currentPasteboardBuffer();
-#if OS(WIN)
-void replaceNewlinesWithWindowsStyleNewlines(String&);
-#endif
-void replaceNBSPWithSpace(String&);
-String convertURIListToURL(const String& uriList);
-
-} // namespace WebCore
-
-#endif // ClipboardUtilitiesChromium_h
diff --git a/Source/core/platform/chromium/FileSystemChromium.cpp b/Source/core/platform/chromium/FileSystemChromium.cpp
deleted file mode 100644
index e3d1853..0000000
--- a/Source/core/platform/chromium/FileSystemChromium.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2008, 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
- * 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/FileSystem.h"
-
-#include "core/platform/FileMetadata.h"
-#include "core/platform/NotImplemented.h"
-
-#include "public/platform/Platform.h"
-#include "public/platform/WebFileInfo.h"
-#include "public/platform/WebFileUtilities.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-bool getFileSize(const String& path, long long& result)
-{
-    FileMetadata metadata;
-    if (!getFileMetadata(path, metadata))
-        return false;
-    result = metadata.length;
-    return true;
-}
-
-bool getFileModificationTime(const String& path, time_t& result)
-{
-    FileMetadata metadata;
-    if (!getFileMetadata(path, metadata))
-        return false;
-    result = metadata.modificationTime;
-    return true;
-}
-
-bool getFileMetadata(const String& path, FileMetadata& metadata)
-{
-    WebKit::WebFileInfo webFileInfo;
-    if (!WebKit::Platform::current()->fileUtilities()->getFileInfo(path, webFileInfo))
-        return false;
-    metadata.modificationTime = webFileInfo.modificationTime;
-    metadata.length = webFileInfo.length;
-    metadata.type = static_cast<FileMetadata::Type>(webFileInfo.type);
-    return true;
-}
-
-String directoryName(const String& path)
-{
-    return WebKit::Platform::current()->fileUtilities()->directoryName(path);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/FramelessScrollViewClient.h b/Source/core/platform/chromium/FramelessScrollViewClient.h
index a5c9474..048dd45 100644
--- a/Source/core/platform/chromium/FramelessScrollViewClient.h
+++ b/Source/core/platform/chromium/FramelessScrollViewClient.h
@@ -31,7 +31,7 @@
 #ifndef FramelessScrollViewClient_h
 #define FramelessScrollViewClient_h
 
-#include "core/platform/HostWindow.h"
+#include "platform/HostWindow.h"
 
 namespace WebCore {
     class FramelessScrollView;
diff --git a/Source/core/platform/chromium/PasteMode.h b/Source/core/platform/chromium/PasteMode.h
deleted file mode 100644
index 351e5d4..0000000
--- a/Source/core/platform/chromium/PasteMode.h
+++ /dev/null
@@ -1,43 +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 PasteMode_h
-#define PasteMode_h
-
-namespace WebCore {
-
-enum PasteMode {
-    AllMimeTypes,
-    PlainTextOnly,
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/platform/chromium/PlatformKeyboardEventChromium.cpp b/Source/core/platform/chromium/PlatformKeyboardEventChromium.cpp
deleted file mode 100644
index 228686b..0000000
--- a/Source/core/platform/chromium/PlatformKeyboardEventChromium.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2008, 2009 Google Inc.
- *
- * 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,
- * 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/PlatformKeyboardEvent.h"
-
-#if OS(WIN)
-#include <windows.h>
-#elif OS(MACOSX)
-#import <Carbon/Carbon.h>
-#else
-#include "core/platform/NotImplemented.h"
-#endif
-
-namespace WebCore {
-
-#if OS(WIN)
-static const unsigned short HIGH_BIT_MASK_SHORT = 0x8000;
-#endif
-
-void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type)
-{
-#if OS(WIN)
-    // No KeyDown events on Windows to disambiguate.
-    ASSERT_NOT_REACHED();
-#else
-    // Can only change type from KeyDown to RawKeyDown or Char, as we lack information for other conversions.
-    ASSERT(m_type == PlatformEvent::KeyDown);
-    ASSERT(type == PlatformEvent::RawKeyDown || type == PlatformEvent::Char);
-    m_type = type;
-
-    if (type == RawKeyDown) {
-        m_text = String();
-        m_unmodifiedText = String();
-    } else {
-        m_keyIdentifier = String();
-        m_windowsVirtualKeyCode = 0;
-#if OS(MACOSX)
-        if (m_text.length() == 1 && (m_text[0U] >= 0xF700 && m_text[0U] <= 0xF7FF)) {
-            // According to NSEvents.h, OpenStep reserves the range 0xF700-0xF8FF for function keys. However, some actual private use characters
-            // happen to be in this range, e.g. the Apple logo (Option+Shift+K).
-            // 0xF7FF is an arbitrary cut-off.
-            m_text = String();
-            m_unmodifiedText = String();
-        }
-#endif
-    }
-#endif
-}
-
-bool PlatformKeyboardEvent::currentCapsLockState()
-{
-#if OS(WIN)
-    // FIXME: Does this even work inside the sandbox?
-    return GetKeyState(VK_CAPITAL) & 1;
-#elif OS(MACOSX)
-    return GetCurrentKeyModifiers() & alphaLock;
-#else
-    notImplemented();
-    return false;
-#endif
-}
-
-void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey)
-{
-#if OS(WIN)
-    shiftKey = GetKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT;
-    ctrlKey = GetKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT;
-    altKey = GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT;
-    metaKey = false;
-#elif OS(MACOSX)
-    UInt32 currentModifiers = GetCurrentKeyModifiers();
-    shiftKey = currentModifiers & ::shiftKey;
-    ctrlKey = currentModifiers & ::controlKey;
-    altKey = currentModifiers & ::optionKey;
-    metaKey = currentModifiers & ::cmdKey;
-#else
-    shiftKey = false;
-    ctrlKey = false;
-    altKey = false;
-    metaKey = false;
-    notImplemented();
-#endif
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/PlatformScreenChromium.cpp b/Source/core/platform/chromium/PlatformScreenChromium.cpp
index b33c37b..db81caa 100644
--- a/Source/core/platform/chromium/PlatformScreenChromium.cpp
+++ b/Source/core/platform/chromium/PlatformScreenChromium.cpp
@@ -31,9 +31,9 @@
 #include "config.h"
 #include "core/platform/PlatformScreen.h"
 
-#include "core/platform/HostWindow.h"
-#include "core/platform/ScrollView.h"
-#include "core/platform/graphics/FloatRect.h"
+#include "platform/HostWindow.h"
+#include "platform/Widget.h"
+#include "platform/geometry/FloatRect.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebScreenInfo.h"
 
@@ -43,7 +43,7 @@
 {
     if (!widget)
         return 0;
-    ScrollView* root = widget->root();
+    Widget* root = widget->root();
     if (!root)
         return 0;
     return root->hostWindow();
diff --git a/Source/core/platform/chromium/Prerender.cpp b/Source/core/platform/chromium/Prerender.cpp
deleted file mode 100644
index 3b17885..0000000
--- a/Source/core/platform/chromium/Prerender.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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:
- *
- *     * 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/PrerenderClient.h"
-#include "core/platform/chromium/Prerender.h"
-
-#include "public/platform/Platform.h"
-#include "public/platform/WebPrerender.h"
-#include "public/platform/WebPrerenderingSupport.h"
-#include "public/platform/WebReferrerPolicy.h"
-#include "public/platform/WebString.h"
-#include "public/platform/WebURL.h"
-
-namespace WebCore {
-
-Prerender::Prerender(PrerenderClient* client, const KURL& url, const String& referrer, ReferrerPolicy policy)
-    : m_client(client)
-    , m_url(url)
-    , m_referrer(referrer)
-    , m_referrerPolicy(policy)
-    , m_isActive(false)
-{
-}
-
-Prerender::~Prerender()
-{
-}
-
-void Prerender::removeClient()
-{
-    m_client = 0;
-}
-
-void Prerender::add()
-{
-    ASSERT(!m_isActive);
-    m_isActive = true;
-    WebKit::WebPrerenderingSupport* platform = WebKit::WebPrerenderingSupport::current();
-    if (!platform)
-        return;
-    platform->add(WebKit::WebPrerender(this));
-}
-
-void Prerender::cancel()
-{
-    // The LinkLoader and the Document (via Prerenderer) share ownership of
-    // the Prerender, so it may have been abandoned by the Prerenderer and
-    // then later canceled by the LinkLoader.
-    if (!m_isActive)
-        return;
-    m_isActive = false;
-    WebKit::WebPrerenderingSupport* platform = WebKit::WebPrerenderingSupport::current();
-    if (!platform)
-        return;
-    platform->cancel(WebKit::WebPrerender(this));
-}
-
-void Prerender::abandon()
-{
-    // The LinkLoader and the Document (via Prerenderer) share ownership of
-    // the Prerender, so it may have been canceled by the LinkLoader and
-    // then later abandoned by the Prerenderer.
-    if (!m_isActive)
-        return;
-    m_isActive = false;
-    WebKit::WebPrerenderingSupport* platform = WebKit::WebPrerenderingSupport::current();
-    if (!platform)
-        return;
-    platform->abandon(WebKit::WebPrerender(this));
-}
-
-void Prerender::suspend()
-{
-    abandon();
-}
-
-void Prerender::resume()
-{
-    add();
-}
-
-void Prerender::didStartPrerender()
-{
-    if (m_client)
-        m_client->didStartPrerender();
-}
-
-void Prerender::didStopPrerender()
-{
-    if (m_client)
-        m_client->didStopPrerender();
-}
-
-void Prerender::didSendLoadForPrerender()
-{
-    if (m_client)
-        m_client->didSendLoadForPrerender();
-}
-
-void Prerender::didSendDOMContentLoadedForPrerender()
-{
-    if (m_client)
-        m_client->didSendDOMContentLoadedForPrerender();
-}
-
-}
diff --git a/Source/core/platform/chromium/Prerender.h b/Source/core/platform/chromium/Prerender.h
deleted file mode 100644
index 8177f0b..0000000
--- a/Source/core/platform/chromium/Prerender.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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:
- *
- *     * 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 Prerender_h
-#define Prerender_h
-
-#include "weborigin/KURL.h"
-#include "weborigin/ReferrerPolicy.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebKit {
-class WebPrerender;
-}
-
-namespace WebCore {
-
-class PrerenderClient;
-
-class Prerender : public RefCounted<Prerender> {
-    WTF_MAKE_NONCOPYABLE(Prerender);
-public:
-    class ExtraData : public RefCounted<ExtraData> {
-    public:
-        virtual ~ExtraData() { }
-    };
-
-    Prerender(PrerenderClient*, const KURL&, const String& referrer, ReferrerPolicy);
-    ~Prerender();
-
-    void removeClient();
-
-    void add();
-    void cancel();
-    void abandon();
-    void suspend();
-    void resume();
-
-    const KURL& url() const { return m_url; }
-    const String& referrer() const { return m_referrer; }
-    ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; }
-
-    void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData; }
-    ExtraData* extraData() { return m_extraData.get(); }
-
-    void didStartPrerender();
-    void didStopPrerender();
-    void didSendLoadForPrerender();
-    void didSendDOMContentLoadedForPrerender();
-
-private:
-    PrerenderClient* m_client;
-
-    const KURL m_url;
-    const String m_referrer;
-    const ReferrerPolicy m_referrerPolicy;
-
-    bool m_isActive;
-
-    RefPtr<ExtraData> m_extraData;
-};
-
-}
-
-#endif // Prerender_h
diff --git a/Source/core/platform/chromium/PrerenderHandle.cpp b/Source/core/platform/chromium/PrerenderHandle.cpp
deleted file mode 100644
index 2f9c086..0000000
--- a/Source/core/platform/chromium/PrerenderHandle.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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:
- *
- *     * 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/PrerenderHandle.h"
-
-#include "core/platform/chromium/Prerender.h"
-#include "weborigin/ReferrerPolicy.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class KURL;
-
-PassRefPtr<PrerenderHandle> PrerenderHandle::create(PrerenderClient* client, const KURL& url, const String& referrer, ReferrerPolicy policy)
-{
-    return adoptRef(new PrerenderHandle(client, url, referrer, policy));
-}
-
-PrerenderHandle::PrerenderHandle(PrerenderClient* client, const KURL& url, const String& referrer, ReferrerPolicy policy)
-    : m_prerender(adoptRef(new Prerender(client, url, referrer, policy)))
-{
-}
-
-PrerenderHandle::~PrerenderHandle()
-{
-    m_prerender->removeClient();
-}
-
-Prerender* PrerenderHandle::prerender()
-{
-    return m_prerender.get();
-}
-
-void PrerenderHandle::removeClient()
-{
-    prerender()->removeClient();
-}
-
-void PrerenderHandle::add()
-{
-    prerender()->add();
-}
-
-void PrerenderHandle::cancel()
-{
-    prerender()->cancel();
-}
-
-void PrerenderHandle::abandon()
-{
-    prerender()->abandon();
-}
-
-void PrerenderHandle::suspend()
-{
-    prerender()->suspend();
-}
-
-void PrerenderHandle::resume()
-{
-    prerender()->resume();
-}
-
-const KURL& PrerenderHandle::url() const
-{
-    return m_prerender->url();
-}
-
-const String& PrerenderHandle::referrer() const
-{
-    return m_prerender->url();
-}
-
-ReferrerPolicy PrerenderHandle::referrerPolicy() const
-{
-    return m_prerender->referrerPolicy();
-}
-
-}
diff --git a/Source/core/platform/chromium/SSLKeyGeneratorChromium.cpp b/Source/core/platform/chromium/SSLKeyGeneratorChromium.cpp
deleted file mode 100644
index 80ef10b..0000000
--- a/Source/core/platform/chromium/SSLKeyGeneratorChromium.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2008, 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
- * 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/SSLKeyGenerator.h"
-
-#include "public/platform/Platform.h"
-#include "public/platform/WebString.h"
-#include "public/platform/WebURL.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-// These are defined in webkit/api/src/LocalizedStrings.cpp.
-String keygenMenuHighGradeKeySize();
-String keygenMenuMediumGradeKeySize();
-
-void getSupportedKeySizes(Vector<String>& sizes)
-{
-    sizes.resize(2);
-    sizes[0] = keygenMenuHighGradeKeySize();
-    sizes[1] = keygenMenuMediumGradeKeySize();
-}
-
-String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const KURL& url)
-{
-    return WebKit::Platform::current()->signedPublicKeyAndChallengeString(keySizeIndex,
-                                                                          WebKit::WebString(challengeString),
-                                                                          WebKit::WebURL(url));
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/SharedTimerChromium.cpp b/Source/core/platform/chromium/SharedTimerChromium.cpp
deleted file mode 100644
index 95c04c4..0000000
--- a/Source/core/platform/chromium/SharedTimerChromium.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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,
- * 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/SharedTimer.h"
-
-#include "public/platform/Platform.h"
-
-namespace WebCore {
-
-void setSharedTimerFiredFunction(void (*f)())
-{
-    WebKit::Platform::current()->setSharedTimerFiredFunction(f);
-}
-
-void setSharedTimerFireInterval(double fireTime)
-{
-    WebKit::Platform::current()->setSharedTimerFireInterval(fireTime);
-}
-
-void stopSharedTimer()
-{
-    WebKit::Platform::current()->stopSharedTimer();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/SoundChromiumPosix.cpp b/Source/core/platform/chromium/SoundChromiumPosix.cpp
deleted file mode 100644
index 163d123..0000000
--- a/Source/core/platform/chromium/SoundChromiumPosix.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2008, 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
- * 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/Sound.h"
-
-#include "core/platform/NotImplemented.h"
-
-namespace WebCore {
-
-void systemBeep()
-{
-    notImplemented();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/SoundChromiumWin.cpp b/Source/core/platform/chromium/SoundChromiumWin.cpp
deleted file mode 100644
index 6a73dec..0000000
--- a/Source/core/platform/chromium/SoundChromiumWin.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2008, 2009 Google Inc.
- *
- * 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,
- * 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/Sound.h"
-
-#include <windows.h>
-
-namespace WebCore {
-
-void systemBeep()
-{
-    MessageBeep(static_cast<UINT>(-1));
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/StatsCounterChromium.cpp b/Source/core/platform/chromium/StatsCounterChromium.cpp
deleted file mode 100644
index 28f3564..0000000
--- a/Source/core/platform/chromium/StatsCounterChromium.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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:
- *
- *     * 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/StatsCounter.h"
-
-#include "public/platform/Platform.h"
-
-namespace WebCore {
-
-void StatsCounter::incrementStatsCounter(const char* counterName)
-{
-    WebKit::Platform::current()->incrementStatsCounter(counterName);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/SuddenTerminationChromium.cpp b/Source/core/platform/chromium/SuddenTerminationChromium.cpp
deleted file mode 100644
index fdd7e7d..0000000
--- a/Source/core/platform/chromium/SuddenTerminationChromium.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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
- * 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/SuddenTermination.h"
-
-#include "public/platform/Platform.h"
-
-namespace WebCore {
-
-void disableSuddenTermination()
-{
-    WebKit::Platform::current()->suddenTerminationChanged(false);
-}
-
-void enableSuddenTermination()
-{
-    WebKit::Platform::current()->suddenTerminationChanged(true);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/chromium/TraceEvent.h b/Source/core/platform/chromium/TraceEvent.h
deleted file mode 100644
index d56a1da..0000000
--- a/Source/core/platform/chromium/TraceEvent.h
+++ /dev/null
@@ -1,911 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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.
- */
-
-// Trace events are for tracking application performance and resource usage.
-// Macros are provided to track:
-//    Begin and end of function calls
-//    Counters
-//
-// Events are issued against categories. Whereas LOG's
-// categories are statically defined, TRACE categories are created
-// implicitly with a string. For example:
-//   TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent")
-//
-// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope:
-//   TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly")
-//   doSomethingCostly()
-//   TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly")
-// Note: our tools can't always determine the correct BEGIN/END pairs unless
-// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you need them
-// to be in separate scopes.
-//
-// A common use case is to trace entire function scopes. This
-// issues a trace BEGIN and END automatically:
-//   void doSomethingCostly() {
-//     TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly");
-//     ...
-//   }
-//
-// Additional parameters can be associated with an event:
-//   void doSomethingCostly2(int howMuch) {
-//     TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly",
-//         "howMuch", howMuch);
-//     ...
-//   }
-//
-// The trace system will automatically add to this information the
-// current process id, thread id, and a timestamp in microseconds.
-//
-// To trace an asynchronous procedure such as an IPC send/receive, use ASYNC_BEGIN and
-// ASYNC_END:
-//   [single threaded sender code]
-//     static int send_count = 0;
-//     ++send_count;
-//     TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count);
-//     Send(new MyMessage(send_count));
-//   [receive code]
-//     void OnMyMessage(send_count) {
-//       TRACE_EVENT_ASYNC_END0("ipc", "message", send_count);
-//     }
-// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs.
-// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process. Pointers can
-// be used for the ID parameter, and they will be mangled internally so that
-// the same pointer on two different processes will not match. For example:
-//   class MyTracedClass {
-//    public:
-//     MyTracedClass() {
-//       TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this);
-//     }
-//     ~MyTracedClass() {
-//       TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this);
-//     }
-//   }
-//
-// Trace event also supports counters, which is a way to track a quantity
-// as it varies over time. Counters are created with the following macro:
-//   TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue);
-//
-// Counters are process-specific. The macro itself can be issued from any
-// thread, however.
-//
-// Sometimes, you want to track two counters at once. You can do this with two
-// counter macros:
-//   TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]);
-//   TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]);
-// Or you can do it with a combined macro:
-//   TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter",
-//       "bytesPinned", g_myCounterValue[0],
-//       "bytesAllocated", g_myCounterValue[1]);
-// This indicates to the tracing UI that these counters should be displayed
-// in a single graph, as a summed area chart.
-//
-// Since counters are in a global namespace, you may want to disembiguate with a
-// unique ID, by using the TRACE_COUNTER_ID* variations.
-//
-// By default, trace collection is compiled in, but turned off at runtime.
-// Collecting trace data is the responsibility of the embedding
-// application. In Chrome's case, navigating to about:tracing will turn on
-// tracing and display data collected across all active processes.
-//
-//
-// Memory scoping note:
-// Tracing copies the pointers, not the string content, of the strings passed
-// in for category, name, and arg_names. Thus, the following code will
-// cause problems:
-//     char* str = strdup("impprtantName");
-//     TRACE_EVENT_INSTANT0("SUBSYSTEM", str);  // BAD!
-//     free(str);                   // Trace system now has dangling pointer
-//
-// To avoid this issue with the |name| and |arg_name| parameters, use the
-// TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime overhead.
-// Notes: The category must always be in a long-lived char* (i.e. static const).
-//        The |arg_values|, when used, are always deep copied with the _COPY
-//        macros.
-//
-// When are string argument values copied:
-// const char* arg_values are only referenced by default:
-//     TRACE_EVENT1("category", "name",
-//                  "arg1", "literal string is only referenced");
-// Use TRACE_STR_COPY to force copying of a const char*:
-//     TRACE_EVENT1("category", "name",
-//                  "arg1", TRACE_STR_COPY("string will be copied"));
-// std::string arg_values are always copied:
-//     TRACE_EVENT1("category", "name",
-//                  "arg1", std::string("string will be copied"));
-//
-//
-// Thread Safety:
-// A thread safe singleton and mutex are used for thread safety. Category
-// enabled flags are used to limit the performance impact when the system
-// is not enabled.
-//
-// TRACE_EVENT macros first cache a pointer to a category. The categories are
-// statically allocated and safe at all times, even after exit. Fetching a
-// category is protected by the TraceLog::lock_. Multiple threads initializing
-// the static variable is safe, as they will be serialized by the lock and
-// multiple calls will return the same pointer to the category.
-//
-// Then the category_enabled flag is checked. This is a unsigned char, and
-// not intended to be multithread safe. It optimizes access to addTraceEvent
-// which is threadsafe internally via TraceLog::lock_. The enabled flag may
-// cause some threads to incorrectly call or skip calling addTraceEvent near
-// the time of the system being enabled or disabled. This is acceptable as
-// we tolerate some data loss while the system is being enabled/disabled and
-// because addTraceEvent is threadsafe internally and checks the enabled state
-// again under lock.
-//
-// Without the use of these static category pointers and enabled flags all
-// trace points would carry a significant performance cost of aquiring a lock
-// and resolving the category.
-
-#ifndef TraceEvent_h
-#define TraceEvent_h
-
-#include "core/platform/EventTracer.h"
-
-#include "wtf/DynamicAnnotations.h"
-#include "wtf/UnusedParam.h"
-#include "wtf/text/CString.h"
-
-// By default, const char* argument values are assumed to have long-lived scope
-// and will not be copied. Use this macro to force a const char* to be copied.
-#define TRACE_STR_COPY(str) \
-    WebCore::TraceEvent::TraceStringWithCopy(str)
-
-// By default, uint64 ID argument values are not mangled with the Process ID in
-// TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling.
-#define TRACE_ID_MANGLE(id) \
-    TraceID::ForceMangle(id)
-
-// By default, pointers are mangled with the Process ID in TRACE_EVENT_ASYNC
-// macros. Use this macro to prevent Process ID mangling.
-#define TRACE_ID_DONT_MANGLE(id) \
-    TraceID::DontMangle(id)
-
-// Records a pair of begin and end events called "name" for the current
-// scope, with 0, 1 or 2 associated arguments. If the category is not
-// enabled, then this does nothing.
-// - category and name strings must have application lifetime (statics or
-//   literals). They may not include " chars.
-#define TRACE_EVENT0(category, name) \
-    INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name)
-#define TRACE_EVENT1(category, name, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val)
-#define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val, \
-        arg2_name, arg2_val)
-
-// Records a single event called "name" immediately, with 0, 1 or 2
-// associated arguments. If the category is not enabled, then this
-// does nothing.
-// - category and name strings must have application lifetime (statics or
-//   literals). They may not include " chars.
-#define TRACE_EVENT_INSTANT0(category, name) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
-        category, name, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
-        category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \
-        arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
-        category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
-        arg2_name, arg2_val)
-#define TRACE_EVENT_COPY_INSTANT0(category, name) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
-        category, name, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_INSTANT1(category, name, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
-        category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_INSTANT2(category, name, arg1_name, arg1_val, \
-        arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
-        category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \
-        arg2_name, arg2_val)
-
-// Records a single BEGIN event called "name" immediately, with 0, 1 or 2
-// associated arguments. If the category is not enabled, then this
-// does nothing.
-// - category and name strings must have application lifetime (statics or
-//   literals). They may not include " chars.
-#define TRACE_EVENT_BEGIN0(category, name) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
-        category, name, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
-        category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val, \
-        arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
-        category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
-        arg2_name, arg2_val)
-#define TRACE_EVENT_COPY_BEGIN0(category, name) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
-        category, name, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
-        category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val, \
-        arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_BEGIN, \
-        category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \
-        arg2_name, arg2_val)
-
-// Records a single END event for "name" immediately. If the category
-// is not enabled, then this does nothing.
-// - category and name strings must have application lifetime (statics or
-//   literals). They may not include " chars.
-#define TRACE_EVENT_END0(category, name) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
-        category, name, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_END1(category, name, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
-        category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_END2(category, name, arg1_name, arg1_val, \
-        arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
-        category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
-        arg2_name, arg2_val)
-#define TRACE_EVENT_COPY_END0(category, name) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
-        category, name, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
-        category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val, \
-        arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \
-        category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \
-        arg2_name, arg2_val)
-
-// Records the value of a counter called "name" immediately. Value
-// must be representable as a 32 bit integer.
-// - category and name strings must have application lifetime (statics or
-//   literals). They may not include " chars.
-#define TRACE_COUNTER1(category, name, value) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \
-        category, name, TRACE_EVENT_FLAG_NONE, \
-        "value", static_cast<int>(value))
-#define TRACE_COPY_COUNTER1(category, name, value) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \
-        category, name, TRACE_EVENT_FLAG_COPY, \
-        "value", static_cast<int>(value))
-
-// Records the values of a multi-parted counter called "name" immediately.
-// The UI will treat value1 and value2 as parts of a whole, displaying their
-// values as a stacked-bar chart.
-// - category and name strings must have application lifetime (statics or
-//   literals). They may not include " chars.
-#define TRACE_COUNTER2(category, name, value1_name, value1_val, \
-        value2_name, value2_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \
-        category, name, TRACE_EVENT_FLAG_NONE, \
-        value1_name, static_cast<int>(value1_val), \
-        value2_name, static_cast<int>(value2_val))
-#define TRACE_COPY_COUNTER2(category, name, value1_name, value1_val, \
-        value2_name, value2_val) \
-    INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \
-        category, name, TRACE_EVENT_FLAG_COPY, \
-        value1_name, static_cast<int>(value1_val), \
-        value2_name, static_cast<int>(value2_val))
-
-// Records the value of a counter called "name" immediately. Value
-// must be representable as a 32 bit integer.
-// - category and name strings must have application lifetime (statics or
-//   literals). They may not include " chars.
-// - |id| is used to disambiguate counters with the same name. It must either
-//   be a pointer or an integer value up to 64 bits. If it's a pointer, the bits
-//   will be xored with a hash of the process ID so that the same pointer on
-//   two different processes will not collide.
-#define TRACE_COUNTER_ID1(category, name, id, value) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \
-        category, name, id, TRACE_EVENT_FLAG_NONE, \
-        "value", static_cast<int>(value))
-#define TRACE_COPY_COUNTER_ID1(category, name, id, value) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \
-        category, name, id, TRACE_EVENT_FLAG_COPY, \
-        "value", static_cast<int>(value))
-
-// Records the values of a multi-parted counter called "name" immediately.
-// The UI will treat value1 and value2 as parts of a whole, displaying their
-// values as a stacked-bar chart.
-// - category and name strings must have application lifetime (statics or
-//   literals). They may not include " chars.
-// - |id| is used to disambiguate counters with the same name. It must either
-//   be a pointer or an integer value up to 64 bits. If it's a pointer, the bits
-//   will be xored with a hash of the process ID so that the same pointer on
-//   two different processes will not collide.
-#define TRACE_COUNTER_ID2(category, name, id, value1_name, value1_val, \
-        value2_name, value2_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \
-        category, name, id, TRACE_EVENT_FLAG_NONE, \
-        value1_name, static_cast<int>(value1_val), \
-        value2_name, static_cast<int>(value2_val))
-#define TRACE_COPY_COUNTER_ID2(category, name, id, value1_name, value1_val, \
-        value2_name, value2_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \
-        category, name, id, TRACE_EVENT_FLAG_COPY, \
-        value1_name, static_cast<int>(value1_val), \
-        value2_name, static_cast<int>(value2_val))
-
-// Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2
-// associated arguments. If the category is not enabled, then this
-// does nothing.
-// - category and name strings must have application lifetime (statics or
-//   literals). They may not include " chars.
-// - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event. ASYNC
-//   events are considered to match if their category, name and id values all
-//   match. |id| must either be a pointer or an integer value up to 64 bits. If
-//   it's a pointer, the bits will be xored with a hash of the process ID so
-//   that the same pointer on two different processes will not collide.
-// An asynchronous operation can consist of multiple phases. The first phase is
-// defined by the ASYNC_BEGIN calls. Additional phases can be defined using the
-// ASYNC_STEP_BEGIN macros. When the operation completes, call ASYNC_END.
-// An async operation can span threads and processes, but all events in that
-// operation must use the same |name| and |id|. Each event can have its own
-// args.
-#define TRACE_EVENT_ASYNC_BEGIN0(category, name, id) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
-        category, name, id, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
-        category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
-        arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
-        category, name, id, TRACE_EVENT_FLAG_NONE, \
-        arg1_name, arg1_val, arg2_name, arg2_val)
-#define TRACE_EVENT_COPY_ASYNC_BEGIN0(category, name, id) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
-        category, name, id, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
-        category, name, id, TRACE_EVENT_FLAG_COPY, \
-        arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \
-        arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
-        category, name, id, TRACE_EVENT_FLAG_COPY, \
-        arg1_name, arg1_val, arg2_name, arg2_val)
-
-// Records a single ASYNC_STEP event for |step| immediately. If the category
-// is not enabled, then this does nothing. The |name| and |id| must match the
-// ASYNC_BEGIN event above. The |step| param identifies this step within the
-// async event. This should be called at the beginning of the next phase of an
-// asynchronous operation.
-#define TRACE_EVENT_ASYNC_STEP0(category, name, id, step) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \
-        category, name, id, TRACE_EVENT_FLAG_NONE, "step", step)
-#define TRACE_EVENT_ASYNC_STEP1(category, name, id, step, \
-                                      arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \
-        category, name, id, TRACE_EVENT_FLAG_NONE, "step", step, \
-        arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_ASYNC_STEP0(category, name, id, step) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \
-        category, name, id, TRACE_EVENT_FLAG_COPY, "step", step)
-#define TRACE_EVENT_COPY_ASYNC_STEP1(category, name, id, step, \
-        arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP, \
-        category, name, id, TRACE_EVENT_FLAG_COPY, "step", step, \
-        arg1_name, arg1_val)
-
-// Records a single ASYNC_END event for "name" immediately. If the category
-// is not enabled, then this does nothing.
-#define TRACE_EVENT_ASYNC_END0(category, name, id) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
-        category, name, id, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
-        category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
-        arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
-        category, name, id, TRACE_EVENT_FLAG_NONE, \
-        arg1_name, arg1_val, arg2_name, arg2_val)
-#define TRACE_EVENT_COPY_ASYNC_END0(category, name, id) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
-        category, name, id, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
-        category, name, id, TRACE_EVENT_FLAG_COPY, \
-        arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, arg1_val, \
-        arg2_name, arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
-        category, name, id, TRACE_EVENT_FLAG_COPY, \
-        arg1_name, arg1_val, arg2_name, arg2_val)
-
-// Creates a scope of a sampling state with the given category and name (both must
-// be constant strings). These states are intended for a sampling profiler.
-// Implementation note: we store category and name together because we don't
-// want the inconsistency/expense of storing two pointers.
-// |thread_bucket| is [0..2] and is used to statically isolate samples in one
-// thread from others.
-//
-// {  // The sampling state is set within this scope.
-//    TRACE_EVENT_SAMPLING_STATE_SCOPE_FOR_BUCKET(0, "category", "name");
-//    ...;
-// }
-#define TRACE_EVENT_SCOPED_SAMPLING_STATE_FOR_BUCKET(bucket_number, category, name) \
-    TraceEvent::SamplingStateScope<bucket_number> traceEventSamplingScope(category "\0" name);
-
-// Returns a current sampling state of the given bucket.
-// The format of the returned string is "category\0name".
-#define TRACE_EVENT_GET_SAMPLING_STATE_FOR_BUCKET(bucket_number) \
-    TraceEvent::SamplingStateScope<bucket_number>::current()
-
-// Sets a current sampling state of the given bucket.
-// |category| and |name| have to be constant strings.
-#define TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(bucket_number, category, name) \
-    TraceEvent::SamplingStateScope<bucket_number>::set(category "\0" name)
-
-// Sets a current sampling state of the given bucket.
-// |categoryAndName| doesn't need to be a constant string.
-// The format of the string is "category\0name".
-#define TRACE_EVENT_SET_NONCONST_SAMPLING_STATE_FOR_BUCKET(bucket_number, categoryAndName) \
-    TraceEvent::SamplingStateScope<bucket_number>::set(categoryAndName)
-
-// Syntactic sugars for the sampling tracing in the main thread.
-#define TRACE_EVENT_SCOPED_SAMPLING_STATE(category, name) \
-    TRACE_EVENT_SCOPED_SAMPLING_STATE_FOR_BUCKET(0, category, name)
-#define TRACE_EVENT_GET_SAMPLING_STATE() \
-    TRACE_EVENT_GET_SAMPLING_STATE_FOR_BUCKET(0)
-#define TRACE_EVENT_SET_SAMPLING_STATE(category, name) \
-    TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(0, category, name)
-#define TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(categoryAndName) \
-    TRACE_EVENT_SET_NONCONST_SAMPLING_STATE_FOR_BUCKET(0, categoryAndName)
-
-// Macros to track the life time and value of arbitrary client objects.
-// See also TraceTrackableObject.
-#define TRACE_EVENT_OBJECT_CREATED_WITH_ID(categoryGroup, name, id) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_CREATE_OBJECT, \
-        categoryGroup, name, TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE)
-
-#define TRACE_EVENT_OBJECT_DELETED_WITH_ID(categoryGroup, name, id) \
-    INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_DELETE_OBJECT, \
-        categoryGroup, name, TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE)
-
-////////////////////////////////////////////////////////////////////////////////
-// Implementation specific tracing API definitions.
-
-// Get a pointer to the enabled state of the given trace category. Only
-// long-lived literal strings should be given as the category name. The returned
-// pointer can be held permanently in a local static for example. If the
-// unsigned char is non-zero, tracing is enabled. If tracing is enabled,
-// TRACE_EVENT_API_ADD_TRACE_EVENT can be called. It's OK if tracing is disabled
-// between the load of the tracing state and the call to
-// TRACE_EVENT_API_ADD_TRACE_EVENT, because this flag only provides an early out
-// for best performance when tracing is disabled.
-// const unsigned char*
-//     TRACE_EVENT_API_GET_CATEGORY_ENABLED(const char* category_name)
-#define TRACE_EVENT_API_GET_CATEGORY_ENABLED \
-    WebCore::EventTracer::getTraceCategoryEnabledFlag
-
-// Add a trace event to the platform tracing system.
-// void TRACE_EVENT_API_ADD_TRACE_EVENT(
-//                    char phase,
-//                    const unsigned char* category_enabled,
-//                    const char* name,
-//                    unsigned long long id,
-//                    int num_args,
-//                    const char** arg_names,
-//                    const unsigned char* arg_types,
-//                    const unsigned long long* arg_values,
-//                    unsigned char flags)
-#define TRACE_EVENT_API_ADD_TRACE_EVENT \
-    WebCore::EventTracer::addTraceEvent
-
-////////////////////////////////////////////////////////////////////////////////
-
-// Implementation detail: trace event macros create temporary variables
-// to keep instrumentation overhead low. These macros give each temporary
-// variable a unique name based on the line number to prevent name collissions.
-#define INTERNAL_TRACE_EVENT_UID3(a, b) \
-    trace_event_unique_##a##b
-#define INTERNAL_TRACE_EVENT_UID2(a, b) \
-    INTERNAL_TRACE_EVENT_UID3(a, b)
-#define INTERNALTRACEEVENTUID(name_prefix) \
-    INTERNAL_TRACE_EVENT_UID2(name_prefix, __LINE__)
-
-// Implementation detail: internal macro to create static category.
-// - WTF_ANNOTATE_BENIGN_RACE, see Thread Safety above.
-#define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category) \
-    static const unsigned char* INTERNALTRACEEVENTUID(catstatic) = 0; \
-    WTF_ANNOTATE_BENIGN_RACE(&INTERNALTRACEEVENTUID(catstatic), \
-                             "trace_event category"); \
-    if (!INTERNALTRACEEVENTUID(catstatic)) \
-      INTERNALTRACEEVENTUID(catstatic) = \
-          TRACE_EVENT_API_GET_CATEGORY_ENABLED(category);
-
-// Implementation detail: internal macro to create static category and add
-// event if the category is enabled.
-#define INTERNAL_TRACE_EVENT_ADD(phase, category, name, flags, ...) \
-    do { \
-        INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \
-        if (*INTERNALTRACEEVENTUID(catstatic)) { \
-            WebCore::TraceEvent::addTraceEvent( \
-                phase, INTERNALTRACEEVENTUID(catstatic), name, \
-                WebCore::TraceEvent::noEventId, flags, ##__VA_ARGS__); \
-        } \
-    } while (0)
-
-// Implementation detail: internal macro to create static category and add begin
-// event if the category is enabled. Also adds the end event when the scope
-// ends.
-#define INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, ...) \
-    INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \
-    WebCore::TraceEvent::TraceEndOnScopeClose \
-        INTERNALTRACEEVENTUID(profileScope); \
-    if (*INTERNALTRACEEVENTUID(catstatic)) { \
-      WebCore::TraceEvent::addTraceEvent( \
-          TRACE_EVENT_PHASE_BEGIN, \
-          INTERNALTRACEEVENTUID(catstatic), \
-          name, WebCore::TraceEvent::noEventId, \
-          TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__); \
-      INTERNALTRACEEVENTUID(profileScope).initialize( \
-          INTERNALTRACEEVENTUID(catstatic), name); \
-    }
-
-// Implementation detail: internal macro to create static category and add
-// event if the category is enabled.
-#define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category, name, id, flags, \
-                                         ...) \
-    do { \
-        INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \
-        if (*INTERNALTRACEEVENTUID(catstatic)) { \
-            unsigned char traceEventFlags = flags | TRACE_EVENT_FLAG_HAS_ID; \
-            WebCore::TraceEvent::TraceID traceEventTraceID( \
-                id, &traceEventFlags); \
-            WebCore::TraceEvent::addTraceEvent( \
-                phase, INTERNALTRACEEVENTUID(catstatic), \
-                name, traceEventTraceID.data(), traceEventFlags, \
-                ##__VA_ARGS__); \
-        } \
-    } while (0)
-
-// Notes regarding the following definitions:
-// New values can be added and propagated to third party libraries, but existing
-// definitions must never be changed, because third party libraries may use old
-// definitions.
-
-// Phase indicates the nature of an event entry. E.g. part of a begin/end pair.
-#define TRACE_EVENT_PHASE_BEGIN    ('B')
-#define TRACE_EVENT_PHASE_END      ('E')
-#define TRACE_EVENT_PHASE_INSTANT  ('I')
-#define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S')
-#define TRACE_EVENT_PHASE_ASYNC_STEP  ('T')
-#define TRACE_EVENT_PHASE_ASYNC_END   ('F')
-#define TRACE_EVENT_PHASE_METADATA ('M')
-#define TRACE_EVENT_PHASE_COUNTER  ('C')
-#define TRACE_EVENT_PHASE_SAMPLE  ('P')
-#define TRACE_EVENT_PHASE_CREATE_OBJECT ('N')
-#define TRACE_EVENT_PHASE_DELETE_OBJECT ('D')
-
-// Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT.
-#define TRACE_EVENT_FLAG_NONE        (static_cast<unsigned char>(0))
-#define TRACE_EVENT_FLAG_COPY        (static_cast<unsigned char>(1 << 0))
-#define TRACE_EVENT_FLAG_HAS_ID      (static_cast<unsigned char>(1 << 1))
-#define TRACE_EVENT_FLAG_MANGLE_ID   (static_cast<unsigned char>(1 << 2))
-
-// Type values for identifying types in the TraceValue union.
-#define TRACE_VALUE_TYPE_BOOL         (static_cast<unsigned char>(1))
-#define TRACE_VALUE_TYPE_UINT         (static_cast<unsigned char>(2))
-#define TRACE_VALUE_TYPE_INT          (static_cast<unsigned char>(3))
-#define TRACE_VALUE_TYPE_DOUBLE       (static_cast<unsigned char>(4))
-#define TRACE_VALUE_TYPE_POINTER      (static_cast<unsigned char>(5))
-#define TRACE_VALUE_TYPE_STRING       (static_cast<unsigned char>(6))
-#define TRACE_VALUE_TYPE_COPY_STRING  (static_cast<unsigned char>(7))
-
-
-namespace WebCore {
-
-namespace TraceEvent {
-
-// Specify these values when the corresponding argument of addTraceEvent is not
-// used.
-const int zeroNumArgs = 0;
-const unsigned long long noEventId = 0;
-
-// TraceID encapsulates an ID that can either be an integer or pointer. Pointers
-// are mangled with the Process ID so that they are unlikely to collide when the
-// same pointer is used on different processes.
-class TraceID {
-public:
-    template<bool dummyMangle> class MangleBehavior {
-    public:
-        template<typename T> explicit MangleBehavior(T id) : m_data(reinterpret_cast<unsigned long long>(id)) { }
-        unsigned long long data() const { return m_data; }
-    private:
-        unsigned long long m_data;
-    };
-    typedef MangleBehavior<false> DontMangle;
-    typedef MangleBehavior<true> ForceMangle;
-
-    TraceID(const void* id, unsigned char* flags) :
-        m_data(static_cast<unsigned long long>(reinterpret_cast<unsigned long>(id)))
-    {
-        *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
-    }
-    TraceID(ForceMangle id, unsigned char* flags) : m_data(id.data())
-    {
-        *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
-    }
-    TraceID(DontMangle id, unsigned char* flags) : m_data(id.data()) { UNUSED_PARAM(flags); }
-    TraceID(unsigned long long id, unsigned char* flags) : m_data(id) { UNUSED_PARAM(flags); }
-    TraceID(unsigned long id, unsigned char* flags) : m_data(id) { UNUSED_PARAM(flags); }
-    TraceID(unsigned id, unsigned char* flags) : m_data(id) { UNUSED_PARAM(flags); }
-    TraceID(unsigned short id, unsigned char* flags) : m_data(id) { UNUSED_PARAM(flags); }
-    TraceID(unsigned char id, unsigned char* flags) : m_data(id) { UNUSED_PARAM(flags); }
-    TraceID(long long id, unsigned char* flags) :
-        m_data(static_cast<unsigned long long>(id)) { UNUSED_PARAM(flags); }
-    TraceID(long id, unsigned char* flags) :
-        m_data(static_cast<unsigned long long>(id)) { UNUSED_PARAM(flags); }
-    TraceID(int id, unsigned char* flags) :
-        m_data(static_cast<unsigned long long>(id)) { UNUSED_PARAM(flags); }
-    TraceID(short id, unsigned char* flags) :
-        m_data(static_cast<unsigned long long>(id)) { UNUSED_PARAM(flags); }
-    TraceID(signed char id, unsigned char* flags) :
-        m_data(static_cast<unsigned long long>(id)) { UNUSED_PARAM(flags); }
-
-    unsigned long long data() const { return m_data; }
-
-private:
-    unsigned long long m_data;
-};
-
-// Simple union to store various types as unsigned long long.
-union TraceValueUnion {
-    bool m_bool;
-    unsigned long long m_uint;
-    long long m_int;
-    double m_double;
-    const void* m_pointer;
-    const char* m_string;
-};
-
-// Simple container for const char* that should be copied instead of retained.
-class TraceStringWithCopy {
-public:
-    explicit TraceStringWithCopy(const char* str) : m_str(str) { }
-    operator const char* () const { return m_str; }
-private:
-    const char* m_str;
-};
-
-// Define setTraceValue for each allowed type. It stores the type and
-// value in the return arguments. This allows this API to avoid declaring any
-// structures so that it is portable to third_party libraries.
-#define INTERNAL_DECLARE_SET_TRACE_VALUE(actual_type, \
-                                         union_member, \
-                                         value_type_id) \
-    static inline void setTraceValue(actual_type arg, \
-                                     unsigned char* type, \
-                                     unsigned long long* value) { \
-        TraceValueUnion typeValue; \
-        typeValue.union_member = arg; \
-        *type = value_type_id; \
-        *value = typeValue.m_uint; \
-    }
-// Simpler form for int types that can be safely casted.
-#define INTERNAL_DECLARE_SET_TRACE_VALUE_INT(actual_type, \
-                                             value_type_id) \
-    static inline void setTraceValue(actual_type arg, \
-                                     unsigned char* type, \
-                                     unsigned long long* value) { \
-        *type = value_type_id; \
-        *value = static_cast<unsigned long long>(arg); \
-    }
-
-INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned long long, TRACE_VALUE_TYPE_UINT)
-INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned int, TRACE_VALUE_TYPE_UINT)
-INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned short, TRACE_VALUE_TYPE_UINT)
-INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned char, TRACE_VALUE_TYPE_UINT)
-INTERNAL_DECLARE_SET_TRACE_VALUE_INT(long long, TRACE_VALUE_TYPE_INT)
-INTERNAL_DECLARE_SET_TRACE_VALUE_INT(int, TRACE_VALUE_TYPE_INT)
-INTERNAL_DECLARE_SET_TRACE_VALUE_INT(short, TRACE_VALUE_TYPE_INT)
-INTERNAL_DECLARE_SET_TRACE_VALUE_INT(signed char, TRACE_VALUE_TYPE_INT)
-INTERNAL_DECLARE_SET_TRACE_VALUE(bool, m_bool, TRACE_VALUE_TYPE_BOOL)
-INTERNAL_DECLARE_SET_TRACE_VALUE(double, m_double, TRACE_VALUE_TYPE_DOUBLE)
-INTERNAL_DECLARE_SET_TRACE_VALUE(const void*, m_pointer,
-                                 TRACE_VALUE_TYPE_POINTER)
-INTERNAL_DECLARE_SET_TRACE_VALUE(const char*, m_string,
-                                 TRACE_VALUE_TYPE_STRING)
-INTERNAL_DECLARE_SET_TRACE_VALUE(const TraceStringWithCopy&, m_string,
-                                 TRACE_VALUE_TYPE_COPY_STRING)
-
-#undef INTERNAL_DECLARE_SET_TRACE_VALUE
-#undef INTERNAL_DECLARE_SET_TRACE_VALUE_INT
-
-// WTF::String version of setTraceValue so that trace arguments can be strings.
-static inline void setTraceValue(const WTF::CString& arg,
-                                 unsigned char* type,
-                                 unsigned long long* value) {
-    TraceValueUnion typeValue;
-    typeValue.m_string = arg.data();
-    *type = TRACE_VALUE_TYPE_COPY_STRING;
-    *value = typeValue.m_uint;
-}
-
-// These addTraceEvent template functions are defined here instead of in the
-// macro, because the arg values could be temporary string objects. In order to
-// store pointers to the internal c_str and pass through to the tracing API, the
-// arg values must live throughout these procedures.
-
-static inline void addTraceEvent(char phase,
-                                const unsigned char* categoryEnabled,
-                                const char* name,
-                                unsigned long long id,
-                                unsigned char flags) {
-    TRACE_EVENT_API_ADD_TRACE_EVENT(
-        phase, categoryEnabled, name, id,
-        zeroNumArgs, 0, 0, 0,
-        flags);
-}
-
-template<class ARG1_TYPE>
-static inline void addTraceEvent(char phase,
-                                const unsigned char* categoryEnabled,
-                                const char* name,
-                                unsigned long long id,
-                                unsigned char flags,
-                                const char* arg1Name,
-                                const ARG1_TYPE& arg1Val) {
-    const int numArgs = 1;
-    unsigned char argTypes[1];
-    unsigned long long argValues[1];
-    setTraceValue(arg1Val, &argTypes[0], &argValues[0]);
-    TRACE_EVENT_API_ADD_TRACE_EVENT(
-        phase, categoryEnabled, name, id,
-        numArgs, &arg1Name, argTypes, argValues,
-        flags);
-}
-
-template<class ARG1_TYPE, class ARG2_TYPE>
-static inline void addTraceEvent(char phase,
-                                const unsigned char* categoryEnabled,
-                                const char* name,
-                                unsigned long long id,
-                                unsigned char flags,
-                                const char* arg1Name,
-                                const ARG1_TYPE& arg1Val,
-                                const char* arg2Name,
-                                const ARG2_TYPE& arg2Val) {
-    const int numArgs = 2;
-    const char* argNames[2] = { arg1Name, arg2Name };
-    unsigned char argTypes[2];
-    unsigned long long argValues[2];
-    setTraceValue(arg1Val, &argTypes[0], &argValues[0]);
-    setTraceValue(arg2Val, &argTypes[1], &argValues[1]);
-    return TRACE_EVENT_API_ADD_TRACE_EVENT(
-        phase, categoryEnabled, name, id,
-        numArgs, argNames, argTypes, argValues,
-        flags);
-}
-
-// Used by TRACE_EVENTx macro. Do not use directly.
-class TraceEndOnScopeClose {
-public:
-    // Note: members of m_data intentionally left uninitialized. See initialize.
-    TraceEndOnScopeClose() : m_pdata(0) { }
-    ~TraceEndOnScopeClose()
-    {
-        if (m_pdata)
-            addEventIfEnabled();
-    }
-
-    void initialize(const unsigned char* categoryEnabled,
-                    const char* name)
-    {
-        m_data.categoryEnabled = categoryEnabled;
-        m_data.name = name;
-        m_pdata = &m_data;
-    }
-
-private:
-    // Add the end event if the category is still enabled.
-    void addEventIfEnabled()
-    {
-        // Only called when m_pdata is non-null.
-        if (*m_pdata->categoryEnabled) {
-            TRACE_EVENT_API_ADD_TRACE_EVENT(
-                TRACE_EVENT_PHASE_END,
-                m_pdata->categoryEnabled,
-                m_pdata->name, noEventId,
-                zeroNumArgs, 0, 0, 0,
-                TRACE_EVENT_FLAG_NONE);
-        }
-    }
-
-    // This Data struct workaround is to avoid initializing all the members
-    // in Data during construction of this object, since this object is always
-    // constructed, even when tracing is disabled. If the members of Data were
-    // members of this class instead, compiler warnings occur about potential
-    // uninitialized accesses.
-    struct Data {
-        const unsigned char* categoryEnabled;
-        const char* name;
-    };
-    Data* m_pdata;
-    Data m_data;
-};
-
-// TraceEventSamplingStateScope records the current sampling state
-// and sets a new sampling state. When the scope exists, it restores
-// the sampling state having recorded.
-template<size_t BucketNumber>
-class SamplingStateScope {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    SamplingStateScope(const char* categoryAndName)
-    {
-        m_previousState = SamplingStateScope<BucketNumber>::current();
-        SamplingStateScope<BucketNumber>::set(categoryAndName);
-    }
-
-    ~SamplingStateScope()
-    {
-        SamplingStateScope<BucketNumber>::set(m_previousState);
-    }
-
-    // FIXME: Make load/store to traceSamplingState[] thread-safe and atomic.
-    static inline const char* current()
-    {
-        return reinterpret_cast<const char*>(*WebCore::traceSamplingState[BucketNumber]);
-    }
-    static inline void set(const char* categoryAndName)
-    {
-        *WebCore::traceSamplingState[BucketNumber] = reinterpret_cast<long>(const_cast<char*>(categoryAndName));
-    }
-
-private:
-    const char* m_previousState;
-};
-
-template<typename IDType> class TraceScopedTrackableObject {
-    WTF_MAKE_NONCOPYABLE(TraceScopedTrackableObject);
-public:
-    TraceScopedTrackableObject(const char* categoryGroup, const char* name, IDType id)
-        : m_categoryGroup(categoryGroup), m_name(name), m_id(id)
-    {
-        TRACE_EVENT_OBJECT_CREATED_WITH_ID(m_categoryGroup, m_name, m_id);
-    }
-
-    ~TraceScopedTrackableObject()
-    {
-        TRACE_EVENT_OBJECT_DELETED_WITH_ID(m_categoryGroup, m_name, m_id);
-    }
-
-private:
-    const char* m_categoryGroup;
-    const char* m_name;
-    IDType m_id;
-};
-
-} // namespace TraceEvent
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/platform/chromium/support/Platform.cpp b/Source/core/platform/chromium/support/Platform.cpp
deleted file mode 100644
index bf87d3e..0000000
--- a/Source/core/platform/chromium/support/Platform.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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:
- *
- *     * 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 "public/platform/Platform.h"
-
-namespace WebKit {
-
-static Platform* s_platform = 0;
-
-void Platform::initialize(Platform* platform)
-{
-    s_platform = platform;
-}
-
-void Platform::shutdown()
-{
-    s_platform = 0;
-}
-
-Platform* Platform::current()
-{
-    return s_platform;
-}
-
-} // namespace WebKit
diff --git a/Source/core/platform/chromium/support/WebAudioBus.cpp b/Source/core/platform/chromium/support/WebAudioBus.cpp
deleted file mode 100644
index 56f7770..0000000
--- a/Source/core/platform/chromium/support/WebAudioBus.cpp
+++ /dev/null
@@ -1,151 +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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "public/platform/WebAudioBus.h"
-
-#if ENABLE(WEB_AUDIO)
-#include "core/platform/audio/AudioBus.h"
-#else
-#include "wtf/ThreadSafeRefCounted.h"
-
-namespace WebCore {
-class AudioBus : public ThreadSafeRefCounted<AudioBus> {
-};
-} // namespace WebCore
-#endif
-
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-class WebAudioBusPrivate : public AudioBus {
-};
-
-void WebAudioBus::initialize(unsigned numberOfChannels, size_t length, double sampleRate)
-{
-#if ENABLE(WEB_AUDIO)
-    RefPtr<AudioBus> audioBus = AudioBus::create(numberOfChannels, length);
-    audioBus->setSampleRate(sampleRate);
-
-    if (m_private)
-        (static_cast<AudioBus*>(m_private))->deref();
-
-    audioBus->ref();
-    m_private = static_cast<WebAudioBusPrivate*>(audioBus.get());
-#else
-    ASSERT_NOT_REACHED();
-#endif
-}
-
-void WebAudioBus::resizeSmaller(size_t newLength)
-{
-#if ENABLE(WEB_AUDIO)
-    ASSERT(m_private);
-    if (m_private) {
-        ASSERT(newLength <= length());
-        m_private->resizeSmaller(newLength);
-    }
-#else
-    ASSERT_NOT_REACHED();
-#endif
-}
-
-void WebAudioBus::reset()
-{
-#if ENABLE(WEB_AUDIO)
-    if (m_private) {
-        (static_cast<AudioBus*>(m_private))->deref();
-        m_private = 0;
-    }
-#else
-    ASSERT_NOT_REACHED();
-#endif
-}
-
-unsigned WebAudioBus::numberOfChannels() const
-{
-#if ENABLE(WEB_AUDIO)
-    if (!m_private)
-        return 0;
-    return m_private->numberOfChannels();
-#else
-    ASSERT_NOT_REACHED();
-    return 0;
-#endif
-}
-
-size_t WebAudioBus::length() const
-{
-#if ENABLE(WEB_AUDIO)
-    if (!m_private)
-        return 0;
-    return m_private->length();
-#else
-    ASSERT_NOT_REACHED();
-    return 0;
-#endif
-}
-
-double WebAudioBus::sampleRate() const
-{
-#if ENABLE(WEB_AUDIO)
-    if (!m_private)
-        return 0;
-    return m_private->sampleRate();
-#else
-    ASSERT_NOT_REACHED();
-    return 0;
-#endif
-}
-
-float* WebAudioBus::channelData(unsigned channelIndex)
-{
-#if ENABLE(WEB_AUDIO)
-    if (!m_private)
-        return 0;
-    ASSERT(channelIndex < numberOfChannels());
-    return m_private->channel(channelIndex)->mutableData();
-#else
-    ASSERT_NOT_REACHED();
-    return 0;
-#endif
-}
-
-PassRefPtr<AudioBus> WebAudioBus::release()
-{
-#if ENABLE(WEB_AUDIO)
-    RefPtr<AudioBus> audioBus(adoptRef(static_cast<AudioBus*>(m_private)));
-    m_private = 0;
-    return audioBus;
-#else
-    ASSERT_NOT_REACHED();
-    return 0;
-#endif
-}
-
-} // namespace WebKit
diff --git a/Source/core/platform/chromium/support/WebCString.cpp b/Source/core/platform/chromium/support/WebCString.cpp
deleted file mode 100644
index a48abb4..0000000
--- a/Source/core/platform/chromium/support/WebCString.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * 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:
- *
- *     * 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 "public/platform/WebCString.h"
-
-#include "public/platform/WebString.h"
-#include "wtf/text/CString.h"
-#include <string.h>
-
-namespace WebKit {
-
-int WebCString::compare(const WebCString& other) const
-{
-    // A null string is always less than a non null one.
-    if (isNull() != other.isNull())
-        return isNull() ? -1 : 1;
-
-    if (isNull())
-        return 0; // Both WebStrings are null.
-
-    return strcmp(m_private->data(), other.m_private->data());
-}
-
-void WebCString::reset()
-{
-    m_private.reset();
-}
-
-void WebCString::assign(const WebCString& other)
-{
-    assign(other.m_private.get());
-}
-
-void WebCString::assign(const char* data, size_t length)
-{
-    char* newData;
-    RefPtr<WTF::CStringBuffer> buffer =
-        WTF::CString::newUninitialized(length, newData).buffer();
-    memcpy(newData, data, length);
-    assign(buffer.get());
-}
-
-size_t WebCString::length() const
-{
-    return m_private.isNull() ? 0 : m_private->length();
-}
-
-const char* WebCString::data() const
-{
-    return m_private.isNull() ? 0 : m_private->data();
-}
-
-WebString WebCString::utf16() const
-{
-    return WebString::fromUTF8(data(), length());
-}
-
-WebCString::WebCString(const WTF::CString& s)
-{
-    assign(s.buffer());
-}
-
-WebCString& WebCString::operator=(const WTF::CString& s)
-{
-    assign(s.buffer());
-    return *this;
-}
-
-WebCString::operator WTF::CString() const
-{
-    return m_private.get();
-}
-
-void WebCString::assign(WTF::CStringBuffer* p)
-{
-    m_private = p;
-}
-
-} // namespace WebKit
diff --git a/Source/core/platform/chromium/support/WebCrypto.cpp b/Source/core/platform/chromium/support/WebCrypto.cpp
index db3a0ff..f2d4bc9 100644
--- a/Source/core/platform/chromium/support/WebCrypto.cpp
+++ b/Source/core/platform/chromium/support/WebCrypto.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "public/platform/WebCrypto.h"
 
-#include "modules/crypto/CryptoResult.h"
+#include "core/platform/CryptoResult.h"
 #include "public/platform/WebArrayBuffer.h"
 #include <string.h>
 
diff --git a/Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp b/Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp
index 464dbae..2a4805b 100644
--- a/Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp
+++ b/Source/core/platform/chromium/support/WebCryptoAlgorithm.cpp
@@ -113,6 +113,20 @@
     return 0;
 }
 
+const WebCryptoAesGcmParams* WebCryptoAlgorithm::aesGcmParams() const
+{
+    if (paramsType() == WebCryptoAlgorithmParamsTypeAesGcmParams)
+        return static_cast<WebCryptoAesGcmParams*>(m_private->params.get());
+    return 0;
+}
+
+const WebCryptoRsaOaepParams* WebCryptoAlgorithm::rsaOaepParams() const
+{
+    if (paramsType() == WebCryptoAlgorithmParamsTypeRsaOaepParams)
+        return static_cast<WebCryptoRsaOaepParams*>(m_private->params.get());
+    return 0;
+}
+
 void WebCryptoAlgorithm::assign(const WebCryptoAlgorithm& other)
 {
     m_private = other.m_private;
diff --git a/Source/core/platform/chromium/support/WebData.cpp b/Source/core/platform/chromium/support/WebData.cpp
deleted file mode 100644
index 737bad7..0000000
--- a/Source/core/platform/chromium/support/WebData.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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
- * 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 "public/platform/WebData.h"
-
-#include "core/platform/SharedBuffer.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-class WebDataPrivate : public SharedBuffer {
-};
-
-void WebData::reset()
-{
-    if (m_private) {
-        m_private->deref();
-        m_private = 0;
-    }
-}
-
-void WebData::assign(const WebData& other)
-{
-    WebDataPrivate* p = const_cast<WebDataPrivate*>(other.m_private);
-    if (p)
-        p->ref();
-    assign(p);
-}
-
-void WebData::assign(const char* data, size_t size)
-{
-    assign(static_cast<WebDataPrivate*>(
-        SharedBuffer::create(data, size).leakRef()));
-}
-
-size_t WebData::size() const
-{
-    if (!m_private)
-        return 0;
-    return const_cast<WebDataPrivate*>(m_private)->size();
-}
-
-const char* WebData::data() const
-{
-    if (!m_private)
-        return 0;
-    return const_cast<WebDataPrivate*>(m_private)->data();
-}
-
-WebData::WebData(const PassRefPtr<SharedBuffer>& buffer)
-    : m_private(static_cast<WebDataPrivate*>(buffer.leakRef()))
-{
-}
-
-WebData& WebData::operator=(const PassRefPtr<SharedBuffer>& buffer)
-{
-    assign(static_cast<WebDataPrivate*>(buffer.leakRef()));
-    return *this;
-}
-
-WebData::operator PassRefPtr<SharedBuffer>() const
-{
-    return PassRefPtr<SharedBuffer>(const_cast<WebDataPrivate*>(m_private));
-}
-
-WebData::operator RefPtr<SharedBuffer>() const
-{
-    return PassRefPtr<SharedBuffer>(const_cast<WebDataPrivate*>(m_private));
-}
-
-void WebData::assign(WebDataPrivate* p)
-{
-    // p is already ref'd for us by the caller
-    if (m_private)
-        m_private->deref();
-    m_private = p;
-}
-
-} // namespace WebKit
diff --git a/Source/core/platform/chromium/support/WebFileSystemCallbacks.cpp b/Source/core/platform/chromium/support/WebFileSystemCallbacks.cpp
index 2430c54..e5d564c 100644
--- a/Source/core/platform/chromium/support/WebFileSystemCallbacks.cpp
+++ b/Source/core/platform/chromium/support/WebFileSystemCallbacks.cpp
@@ -32,7 +32,7 @@
 #include "public/platform/WebFileSystemCallbacks.h"
 
 #include "core/platform/AsyncFileSystemCallbacks.h"
-#include "core/platform/FileMetadata.h"
+#include "platform/FileMetadata.h"
 #include "public/platform/WebFileInfo.h"
 #include "public/platform/WebFileSystem.h"
 #include "public/platform/WebFileSystemEntry.h"
diff --git a/Source/core/platform/chromium/support/WebHTTPBody.cpp b/Source/core/platform/chromium/support/WebHTTPBody.cpp
index 0b1116d..4736cf0 100644
--- a/Source/core/platform/chromium/support/WebHTTPBody.cpp
+++ b/Source/core/platform/chromium/support/WebHTTPBody.cpp
@@ -31,8 +31,8 @@
 #include "config.h"
 #include "public/platform/WebHTTPBody.h"
 
-#include "core/platform/FileSystem.h"
 #include "core/platform/network/FormData.h"
+#include "platform/FileMetadata.h"
 
 using namespace WebCore;
 
@@ -79,8 +79,6 @@
     result.fileStart = 0;
     result.fileLength = 0;
     result.modificationTime = invalidFileTime();
-    result.url = KURL();
-    result.blobURL = KURL();
     result.blobUUID.reset();
 
     switch (element.m_type) {
@@ -97,13 +95,11 @@
         break;
     case FormDataElement::encodedBlob:
         result.type = Element::TypeBlob;
-        result.url = element.m_url; // DEPRECATED, should be able to remove after https://codereview.chromium.org/23223003/ lands
-        result.blobURL = element.m_url; // FIXME: deprecate this.
+        result.blobUUID = element.m_blobUUID;
         break;
-    case FormDataElement::encodedURL:
+    case FormDataElement::encodedFileSystemURL:
         result.type = Element::TypeFileSystemURL;
-        result.url = element.m_url; // DEPRECATED
-        result.fileSystemURL = element.m_url;
+        result.fileSystemURL = element.m_fileSystemURL;
         result.fileStart = element.m_fileStart;
         result.fileLength = element.m_fileLength;
         result.modificationTime = element.m_expectedFileModificationTime;
@@ -141,19 +137,13 @@
     // Currently we only support filesystem URL.
     ASSERT(KURL(url).protocolIs("filesystem"));
     ensureMutable();
-    m_private->appendURLRange(url, start, length, modificationTime);
+    m_private->appendFileSystemURLRange(url, start, length, modificationTime);
 }
 
-void WebHTTPBody::appendURLRange(const WebURL& url, long long start, long long length, double modificationTime)
+void WebHTTPBody::appendBlob(const WebString& uuid)
 {
-    appendFileSystemURLRange(url, start, length, modificationTime);
-}
-
-void WebHTTPBody::appendBlob(const WebURL& blobURL)
-{
-    ASSERT(KURL(blobURL).protocolIs("blob"));
     ensureMutable();
-    m_private->appendBlob(blobURL);
+    m_private->appendBlob(uuid, 0);
 }
 
 long long WebHTTPBody::identifier() const
diff --git a/Source/core/platform/chromium/support/WebMediaStream.cpp b/Source/core/platform/chromium/support/WebMediaStream.cpp
index d7ddd7b..43e7b79 100644
--- a/Source/core/platform/chromium/support/WebMediaStream.cpp
+++ b/Source/core/platform/chromium/support/WebMediaStream.cpp
@@ -26,10 +26,10 @@
 
 #include "public/platform/WebMediaStream.h"
 
-#include "core/platform/UUID.h"
 #include "core/platform/mediastream/MediaStreamComponent.h"
 #include "core/platform/mediastream/MediaStreamDescriptor.h"
 #include "core/platform/mediastream/MediaStreamSource.h"
+#include "platform/UUID.h"
 #include "public/platform/WebMediaStreamSource.h"
 #include "public/platform/WebMediaStreamTrack.h"
 #include "public/platform/WebString.h"
diff --git a/Source/core/platform/chromium/support/WebMediaStreamSource.cpp b/Source/core/platform/chromium/support/WebMediaStreamSource.cpp
index 96646ff..a1b607b 100644
--- a/Source/core/platform/chromium/support/WebMediaStreamSource.cpp
+++ b/Source/core/platform/chromium/support/WebMediaStreamSource.cpp
@@ -32,7 +32,7 @@
 
 #include "public/platform/WebMediaStreamSource.h"
 
-#include "core/platform/audio/AudioBus.h"
+#include "platform/audio/AudioBus.h"
 #include "core/platform/mediastream/MediaConstraints.h"
 #include "core/platform/mediastream/MediaStreamSource.h"
 #include "public/platform/WebAudioDestinationConsumer.h"
diff --git a/Source/core/platform/chromium/support/WebMediaStreamTrack.cpp b/Source/core/platform/chromium/support/WebMediaStreamTrack.cpp
index 8da7cbd..c7e6721 100644
--- a/Source/core/platform/chromium/support/WebMediaStreamTrack.cpp
+++ b/Source/core/platform/chromium/support/WebMediaStreamTrack.cpp
@@ -28,16 +28,30 @@
 
 #include "core/platform/mediastream/MediaStreamComponent.h"
 #include "core/platform/mediastream/MediaStreamSource.h"
+#include "public/platform/WebAudioSourceProvider.h"
 #include "public/platform/WebMediaStream.h"
 #include "public/platform/WebMediaStreamSource.h"
 #include "public/platform/WebString.h"
-#include "public/web/WebAudioSourceProvider.h"
 #include "wtf/Vector.h"
 
 using namespace WebCore;
 
 namespace WebKit {
 
+namespace {
+
+class ExtraDataContainer : public MediaStreamComponent::ExtraData {
+public:
+    explicit ExtraDataContainer(PassOwnPtr<WebMediaStreamTrack::ExtraData> extraData) : m_extraData(extraData) { }
+
+    WebMediaStreamTrack::ExtraData* extraData() { return m_extraData.get(); }
+
+private:
+    OwnPtr<WebMediaStreamTrack::ExtraData> m_extraData;
+};
+
+} // namespace
+
 WebMediaStreamTrack::WebMediaStreamTrack(PassRefPtr<WebCore::MediaStreamComponent> mediaStreamComponent)
     : m_private(mediaStreamComponent)
 {
@@ -103,6 +117,19 @@
     return WebMediaStreamSource(m_private->source());
 }
 
+WebMediaStreamTrack::ExtraData* WebMediaStreamTrack::extraData() const
+{
+    RefPtr<MediaStreamComponent::ExtraData> data = m_private->extraData();
+    if (!data)
+        return 0;
+    return static_cast<ExtraDataContainer*>(data.get())->extraData();
+}
+
+void WebMediaStreamTrack::setExtraData(ExtraData* extraData)
+{
+    m_private->setExtraData(adoptRef(new ExtraDataContainer(adoptPtr(extraData))));
+}
+
 void WebMediaStreamTrack::setSourceProvider(WebAudioSourceProvider* provider)
 {
 #if ENABLE(WEB_AUDIO)
diff --git a/Source/core/platform/chromium/support/WebPrerender.cpp b/Source/core/platform/chromium/support/WebPrerender.cpp
index 55d354e..adf9410 100644
--- a/Source/core/platform/chromium/support/WebPrerender.cpp
+++ b/Source/core/platform/chromium/support/WebPrerender.cpp
@@ -30,9 +30,9 @@
 
 #include "config.h"
 #include "public/platform/WebPrerender.h"
-#include "wtf/PassRefPtr.h"
 
-#include "core/platform/chromium/Prerender.h"
+#include "core/platform/Prerender.h"
+#include "wtf/PassRefPtr.h"
 
 namespace WebKit {
 
diff --git a/Source/core/platform/chromium/support/WebScrollbarImpl.cpp b/Source/core/platform/chromium/support/WebScrollbarImpl.cpp
index 6e5258d..53b0d49 100644
--- a/Source/core/platform/chromium/support/WebScrollbarImpl.cpp
+++ b/Source/core/platform/chromium/support/WebScrollbarImpl.cpp
@@ -27,7 +27,7 @@
 #include "core/platform/chromium/support/WebScrollbarImpl.h"
 
 #include "core/platform/Scrollbar.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
 
 namespace WebKit {
 
diff --git a/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.cpp b/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.cpp
index bd6780d..333a564 100644
--- a/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.cpp
+++ b/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.cpp
@@ -73,14 +73,14 @@
     return m_scrollbar->location();
 }
 
-ScrollView* WebScrollbarThemeClientImpl::parent() const
+Widget* WebScrollbarThemeClientImpl::parent() const
 {
     // Unused by Chromium scrollbar themes.
     ASSERT_NOT_REACHED();
     return 0;
 }
 
-ScrollView* WebScrollbarThemeClientImpl::root() const
+Widget* WebScrollbarThemeClientImpl::root() const
 {
     // Unused by Chromium scrollbar themes.
     ASSERT_NOT_REACHED();
diff --git a/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.h b/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.h
index 3c08004..30e7738 100644
--- a/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.h
+++ b/Source/core/platform/chromium/support/WebScrollbarThemeClientImpl.h
@@ -26,9 +26,9 @@
 #ifndef WebScrollbarThemeClientImpl_h
 #define WebScrollbarThemeClientImpl_h
 
-#include "core/platform/ScrollbarThemeClient.h"
-#include "wtf/Noncopyable.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
 #include "public/platform/WebScrollbar.h"
+#include "wtf/Noncopyable.h"
 
 namespace WebCore {
 class ScrollView;
@@ -49,8 +49,8 @@
     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 Widget* parent() const OVERRIDE;
+    virtual Widget* root() const OVERRIDE;
     virtual void setFrameRect(const IntRect&) OVERRIDE;
     virtual IntRect frameRect() const OVERRIDE;
     virtual void invalidate() OVERRIDE;
diff --git a/Source/core/platform/chromium/support/WebSocketStreamError.cpp b/Source/core/platform/chromium/support/WebSocketStreamError.cpp
deleted file mode 100644
index 43d6b08..0000000
--- a/Source/core/platform/chromium/support/WebSocketStreamError.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2013 Intel 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 "public/platform/WebSocketStreamError.h"
-
-#include "core/platform/network/SocketStreamError.h"
-#include "public/platform/WebString.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void WebSocketStreamError::assign(int code, const WebString& message)
-{
-    m_private = SocketStreamError::create(code, message);
-}
-
-void WebSocketStreamError::assign(const WebSocketStreamError& other)
-{
-    m_private = other.m_private;
-}
-
-void WebSocketStreamError::reset()
-{
-    m_private.reset();
-}
-
-WebSocketStreamError::WebSocketStreamError(PassRefPtr<SocketStreamError> error)
-{
-    m_private = error;
-}
-
-WebSocketStreamError& WebSocketStreamError::operator=(PassRefPtr<SocketStreamError> error)
-{
-    m_private = error;
-    return *this;
-}
-
-WebSocketStreamError::operator PassRefPtr<SocketStreamError>() const
-{
-    return m_private.get();
-}
-
-}
diff --git a/Source/core/platform/chromium/support/WebString.cpp b/Source/core/platform/chromium/support/WebString.cpp
deleted file mode 100644
index c3ed5db..0000000
--- a/Source/core/platform/chromium/support/WebString.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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
- * 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 "public/platform/WebString.h"
-
-#include "public/platform/WebCString.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/StringUTF8Adaptor.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebKit {
-
-void WebString::reset()
-{
-    m_private.reset();
-}
-
-void WebString::assign(const WebString& other)
-{
-    assign(other.m_private.get());
-}
-
-void WebString::assign(const WebUChar* data, size_t length)
-{
-    assign(StringImpl::create8BitIfPossible(data, length).get());
-}
-
-size_t WebString::length() const
-{
-    return m_private.isNull() ? 0 : m_private->length();
-}
-
-WebUChar WebString::at(unsigned i) const
-{
-    ASSERT(!m_private.isNull());
-    return (*m_private.get())[i];
-}
-
-bool WebString::is8Bit() const
-{
-    return m_private->is8Bit();
-}
-
-const WebLChar* WebString::data8() const
-{
-    return !m_private.isNull() && is8Bit() ? m_private->characters8() : 0;
-}
-
-const WebUChar* WebString::data16() const
-{
-    return !m_private.isNull() && !is8Bit() ? m_private->characters16() : 0;
-}
-
-std::string WebString::utf8() const
-{
-    StringUTF8Adaptor utf8(m_private.get());
-    return std::string(utf8.data(), utf8.length());
-}
-
-WebString WebString::fromUTF8(const char* data, size_t length)
-{
-    return String::fromUTF8(data, length);
-}
-
-WebString WebString::fromUTF8(const char* data)
-{
-    return String::fromUTF8(data);
-}
-
-std::string WebString::latin1() const
-{
-    String string(m_private.get());
-
-    if (string.isEmpty())
-        return std::string();
-
-    if (string.is8Bit())
-        return std::string(reinterpret_cast<const char*>(string.characters8()), string.length());
-
-    WebCString latin1 = string.latin1();
-    return std::string(latin1.data(), latin1.length());
-}
-
-WebString WebString::fromLatin1(const WebLChar* data, size_t length)
-{
-    return String(data, length);
-}
-
-bool WebString::equals(const WebString& s) const
-{
-    return equal(m_private.get(), s.m_private.get());
-}
-
-WebString::WebString(const WTF::String& s)
-{
-    m_private = s.impl();
-}
-
-WebString& WebString::operator=(const WTF::String& s)
-{
-    assign(s.impl());
-    return *this;
-}
-
-WebString::operator WTF::String() const
-{
-    return m_private.get();
-}
-
-WebString::WebString(const WTF::AtomicString& s)
-{
-    assign(s.string());
-}
-
-WebString& WebString::operator=(const WTF::AtomicString& s)
-{
-    assign(s.string());
-    return *this;
-}
-
-WebString::operator WTF::AtomicString() const
-{
-    return WTF::AtomicString(m_private.get());
-}
-
-void WebString::assign(WTF::StringImpl* p)
-{
-    m_private = p;
-}
-
-} // namespace WebKit
diff --git a/Source/core/platform/chromium/support/WebTransformKeyframe.cpp b/Source/core/platform/chromium/support/WebTransformKeyframe.cpp
index 4e4c285..12eb5ff 100644
--- a/Source/core/platform/chromium/support/WebTransformKeyframe.cpp
+++ b/Source/core/platform/chromium/support/WebTransformKeyframe.cpp
@@ -24,10 +24,11 @@
 
 #include "config.h"
 #include "public/platform/WebTransformKeyframe.h"
+#include "wtf/PassOwnPtr.h"
 
 namespace WebKit {
 
-WebTransformKeyframe::WebTransformKeyframe(double time, WebTransformOperations* value)
+WebTransformKeyframe::WebTransformKeyframe(double time, PassOwnPtr<WebTransformOperations> value)
     : m_time(time)
     , m_value(value)
 {
diff --git a/Source/core/platform/chromium/support/WebURL.cpp b/Source/core/platform/chromium/support/WebURL.cpp
deleted file mode 100644
index 5af208e..0000000
--- a/Source/core/platform/chromium/support/WebURL.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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
- * 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 "public/platform/WebURL.h"
-
-#include "weborigin/KURL.h"
-
-namespace WebKit {
-
-WebURL::WebURL(const WebCore::KURL& url)
-    : m_string(url.string())
-    , m_parsed(url.parsed())
-    , m_isValid(url.isValid())
-{
-}
-
-WebURL& WebURL::operator=(const WebCore::KURL& url)
-{
-    m_string = url.string();
-    m_parsed = url.parsed();
-    m_isValid = url.isValid();
-    return *this;
-}
-
-WebURL::operator WebCore::KURL() const
-{
-    return WebCore::KURL(m_string, m_parsed, m_isValid);
-}
-
-} // namespace WebKit
diff --git a/Source/core/platform/chromium/support/WebURLError.cpp b/Source/core/platform/chromium/support/WebURLError.cpp
deleted file mode 100644
index a236af2..0000000
--- a/Source/core/platform/chromium/support/WebURLError.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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
- * 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 "public/platform/WebURLError.h"
-
-#include "core/platform/network/ResourceError.h"
-#include "weborigin/KURL.h"
-#include "wtf/text/CString.h"
-
-using namespace WebCore;
-
-namespace WebKit {
-
-WebURLError::WebURLError(const ResourceError& error)
-{
-    *this = error;
-}
-
-WebURLError& WebURLError::operator=(const ResourceError& error)
-{
-    if (error.isNull())
-        *this = WebURLError();
-    else {
-        domain = error.domain();
-        reason = error.errorCode();
-        unreachableURL = KURL(ParsedURLString, error.failingURL());
-        isCancellation = error.isCancellation();
-        localizedDescription = error.localizedDescription();
-    }
-    return *this;
-}
-
-WebURLError::operator ResourceError() const
-{
-    if (!reason)
-        return ResourceError();
-    CString spec = unreachableURL.spec();
-    ResourceError resourceError = ResourceError(domain, reason,
-                                                String::fromUTF8(spec.data(),
-                                                spec.length()),
-                                                localizedDescription);
-    resourceError.setIsCancellation(isCancellation);
-    return resourceError;
-}
-
-} // namespace WebKit
diff --git a/Source/core/platform/chromium/support/WebURLRequest.cpp b/Source/core/platform/chromium/support/WebURLRequest.cpp
index 9751d56..f996a70 100644
--- a/Source/core/platform/chromium/support/WebURLRequest.cpp
+++ b/Source/core/platform/chromium/support/WebURLRequest.cpp
@@ -186,9 +186,7 @@
 
 void WebURLRequest::clearHTTPHeaderField(const WebString& name)
 {
-    // FIXME: Add a clearHTTPHeaderField method to ResourceRequest.
-    const HTTPHeaderMap& map = m_private->m_resourceRequest->httpHeaderFields();
-    const_cast<HTTPHeaderMap*>(&map)->remove(name);
+    m_private->m_resourceRequest->clearHTTPHeaderField(name);
 }
 
 void WebURLRequest::visitHTTPHeaderFields(WebHTTPHeaderVisitor* visitor) const
diff --git a/Source/core/platform/chromium/support/WebURLResponse.cpp b/Source/core/platform/chromium/support/WebURLResponse.cpp
index a69027b..84d4033 100644
--- a/Source/core/platform/chromium/support/WebURLResponse.cpp
+++ b/Source/core/platform/chromium/support/WebURLResponse.cpp
@@ -261,9 +261,7 @@
 
 void WebURLResponse::clearHTTPHeaderField(const WebString& name)
 {
-    // FIXME: Add a clearHTTPHeaderField method to ResourceResponse.
-    const HTTPHeaderMap& map = m_private->m_resourceResponse->httpHeaderFields();
-    const_cast<HTTPHeaderMap*>(&map)->remove(name);
+    m_private->m_resourceResponse->clearHTTPHeaderField(name);
 }
 
 void WebURLResponse::visitHTTPHeaderFields(WebHTTPHeaderVisitor* visitor) const
diff --git a/Source/core/platform/cocoa/KeyEventCocoa.h b/Source/core/platform/cocoa/KeyEventCocoa.h
deleted file mode 100644
index f45c593..0000000
--- a/Source/core/platform/cocoa/KeyEventCocoa.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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,
- * 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 KeyEventCocoa_h
-#define KeyEventCocoa_h
-
-#include "wtf/Forward.h"
-
-namespace WebCore {
-
-String keyIdentifierForCharCode(unichar charCode);
-
-int windowsKeyCodeForKeyCode(uint16_t keyCode);
-int windowsKeyCodeForCharCode(unichar charCode);
-
-}
-
-#endif
diff --git a/Source/core/platform/cocoa/KeyEventCocoa.mm b/Source/core/platform/cocoa/KeyEventCocoa.mm
deleted file mode 100644
index 1180578..0000000
--- a/Source/core/platform/cocoa/KeyEventCocoa.mm
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 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,
- * 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 "config.h"
-#import "core/platform/cocoa/KeyEventCocoa.h"
-
-#import "core/platform/Logging.h"
-#import "core/platform/WindowsKeyboardCodes.h"
-#import <wtf/ASCIICType.h>
-#import <wtf/text/WTFString.h>
-
-using namespace WTF;
-
-namespace WebCore {
-
-String keyIdentifierForCharCode(unichar charCode)
-{
-    switch (charCode) {
-        // Each identifier listed in the DOM spec is listed here.
-        // Many are simply commented out since they do not appear on standard Macintosh keyboards
-        // or are on a key that doesn't have a corresponding character.
-
-        // "Accept"
-        // "AllCandidates"
-
-        // "Alt"
-        case NSMenuFunctionKey:
-            return "Alt";
-
-        // "Apps"
-        // "BrowserBack"
-        // "BrowserForward"
-        // "BrowserHome"
-        // "BrowserRefresh"
-        // "BrowserSearch"
-        // "BrowserStop"
-        // "CapsLock"
-
-        // "Clear"
-        case NSClearLineFunctionKey:
-            return "Clear";
-
-        // "CodeInput"
-        // "Compose"
-        // "Control"
-        // "Crsel"
-        // "Convert"
-        // "Copy"
-        // "Cut"
-
-        // "Down"
-        case NSDownArrowFunctionKey:
-            return "Down";
-        // "End"
-        case NSEndFunctionKey:
-            return "End";
-        // "Enter"
-        case 0x3: case 0xA: case 0xD: // Macintosh calls the one on the main keyboard Return, but Windows calls it Enter, so we'll do the same for the DOM
-            return "Enter";
-
-        // "EraseEof"
-
-        // "Execute"
-        case NSExecuteFunctionKey:
-            return "Execute";
-
-        // "Exsel"
-
-        // "F1"
-        case NSF1FunctionKey:
-            return "F1";
-        // "F2"
-        case NSF2FunctionKey:
-            return "F2";
-        // "F3"
-        case NSF3FunctionKey:
-            return "F3";
-        // "F4"
-        case NSF4FunctionKey:
-            return "F4";
-        // "F5"
-        case NSF5FunctionKey:
-            return "F5";
-        // "F6"
-        case NSF6FunctionKey:
-            return "F6";
-        // "F7"
-        case NSF7FunctionKey:
-            return "F7";
-        // "F8"
-        case NSF8FunctionKey:
-            return "F8";
-        // "F9"
-        case NSF9FunctionKey:
-            return "F9";
-        // "F10"
-        case NSF10FunctionKey:
-            return "F10";
-        // "F11"
-        case NSF11FunctionKey:
-            return "F11";
-        // "F12"
-        case NSF12FunctionKey:
-            return "F12";
-        // "F13"
-        case NSF13FunctionKey:
-            return "F13";
-        // "F14"
-        case NSF14FunctionKey:
-            return "F14";
-        // "F15"
-        case NSF15FunctionKey:
-            return "F15";
-        // "F16"
-        case NSF16FunctionKey:
-            return "F16";
-        // "F17"
-        case NSF17FunctionKey:
-            return "F17";
-        // "F18"
-        case NSF18FunctionKey:
-            return "F18";
-        // "F19"
-        case NSF19FunctionKey:
-            return "F19";
-        // "F20"
-        case NSF20FunctionKey:
-            return "F20";
-        // "F21"
-        case NSF21FunctionKey:
-            return "F21";
-        // "F22"
-        case NSF22FunctionKey:
-            return "F22";
-        // "F23"
-        case NSF23FunctionKey:
-            return "F23";
-        // "F24"
-        case NSF24FunctionKey:
-            return "F24";
-
-        // "FinalMode"
-
-        // "Find"
-        case NSFindFunctionKey:
-            return "Find";
-
-        // "FullWidth"
-        // "HalfWidth"
-        // "HangulMode"
-        // "HanjaMode"
-
-        // "Help"
-        case NSHelpFunctionKey:
-            return "Help";
-
-        // "Hiragana"
-
-        // "Home"
-        case NSHomeFunctionKey:
-            return "Home";
-        // "Insert"
-        case NSInsertFunctionKey:
-            return "Insert";
-
-        // "JapaneseHiragana"
-        // "JapaneseKatakana"
-        // "JapaneseRomaji"
-        // "JunjaMode"
-        // "KanaMode"
-        // "KanjiMode"
-        // "Katakana"
-        // "LaunchApplication1"
-        // "LaunchApplication2"
-        // "LaunchMail"
-
-        // "Left"
-        case NSLeftArrowFunctionKey:
-            return "Left";
-
-        // "Meta"
-        // "MediaNextTrack"
-        // "MediaPlayPause"
-        // "MediaPreviousTrack"
-        // "MediaStop"
-
-        // "ModeChange"
-        case NSModeSwitchFunctionKey:
-            return "ModeChange";
-
-        // "Nonconvert"
-        // "NumLock"
-
-        // "PageDown"
-        case NSPageDownFunctionKey:
-            return "PageDown";
-        // "PageUp"
-        case NSPageUpFunctionKey:
-            return "PageUp";
-
-        // "Paste"
-
-        // "Pause"
-        case NSPauseFunctionKey:
-            return "Pause";
-
-        // "Play"
-        // "PreviousCandidate"
-
-        // "PrintScreen"
-        case NSPrintScreenFunctionKey:
-            return "PrintScreen";
-
-        // "Process"
-        // "Props"
-
-        // "Right"
-        case NSRightArrowFunctionKey:
-            return "Right";
-
-        // "RomanCharacters"
-
-        // "Scroll"
-        case NSScrollLockFunctionKey:
-            return "Scroll";
-        // "Select"
-        case NSSelectFunctionKey:
-            return "Select";
-
-        // "SelectMedia"
-        // "Shift"
-
-        // "Stop"
-        case NSStopFunctionKey:
-            return "Stop";
-        // "Up"
-        case NSUpArrowFunctionKey:
-            return "Up";
-        // "Undo"
-        case NSUndoFunctionKey:
-            return "Undo";
-
-        // "VolumeDown"
-        // "VolumeMute"
-        // "VolumeUp"
-        // "Win"
-        // "Zoom"
-
-        // More function keys, not in the key identifier specification.
-        case NSF25FunctionKey:
-            return "F25";
-        case NSF26FunctionKey:
-            return "F26";
-        case NSF27FunctionKey:
-            return "F27";
-        case NSF28FunctionKey:
-            return "F28";
-        case NSF29FunctionKey:
-            return "F29";
-        case NSF30FunctionKey:
-            return "F30";
-        case NSF31FunctionKey:
-            return "F31";
-        case NSF32FunctionKey:
-            return "F32";
-        case NSF33FunctionKey:
-            return "F33";
-        case NSF34FunctionKey:
-            return "F34";
-        case NSF35FunctionKey:
-            return "F35";
-
-        // Turn 0x7F into 0x08, because backspace needs to always be 0x08.
-        case 0x7F:
-            return "U+0008";
-        // Standard says that DEL becomes U+007F.
-        case NSDeleteFunctionKey:
-            return "U+007F";
-
-        // Always use 0x09 for tab instead of AppKit's backtab character.
-        case NSBackTabCharacter:
-            return "U+0009";
-
-        case NSBeginFunctionKey:
-        case NSBreakFunctionKey:
-        case NSClearDisplayFunctionKey:
-        case NSDeleteCharFunctionKey:
-        case NSDeleteLineFunctionKey:
-        case NSInsertCharFunctionKey:
-        case NSInsertLineFunctionKey:
-        case NSNextFunctionKey:
-        case NSPrevFunctionKey:
-        case NSPrintFunctionKey:
-        case NSRedoFunctionKey:
-        case NSResetFunctionKey:
-        case NSSysReqFunctionKey:
-        case NSSystemFunctionKey:
-        case NSUserFunctionKey:
-            // FIXME: We should use something other than the vendor-area Unicode values for the above keys.
-            // For now, just fall through to the default.
-        default:
-            return String::format("U+%04X", toASCIIUpper(charCode));
-    }
-}
-
-int windowsKeyCodeForKeyCode(uint16_t keyCode)
-{
-    static const int windowsKeyCode[] = {
-        /* 0 */ VK_A,
-        /* 1 */ VK_S,
-        /* 2 */ VK_D,
-        /* 3 */ VK_F,
-        /* 4 */ VK_H,
-        /* 5 */ VK_G,
-        /* 6 */ VK_Z,
-        /* 7 */ VK_X,
-        /* 8 */ VK_C,
-        /* 9 */ VK_V,
-        /* 0x0A */ VK_OEM_3, // "Section" - key to the left from 1 (ISO Keyboard Only)
-        /* 0x0B */ VK_B,
-        /* 0x0C */ VK_Q,
-        /* 0x0D */ VK_W,
-        /* 0x0E */ VK_E,
-        /* 0x0F */ VK_R,
-        /* 0x10 */ VK_Y,
-        /* 0x11 */ VK_T,
-        /* 0x12 */ VK_1,
-        /* 0x13 */ VK_2,
-        /* 0x14 */ VK_3,
-        /* 0x15 */ VK_4,
-        /* 0x16 */ VK_6,
-        /* 0x17 */ VK_5,
-        /* 0x18 */ VK_OEM_PLUS, // =+
-        /* 0x19 */ VK_9,
-        /* 0x1A */ VK_7,
-        /* 0x1B */ VK_OEM_MINUS, // -_
-        /* 0x1C */ VK_8,
-        /* 0x1D */ VK_0,
-        /* 0x1E */ VK_OEM_6, // ]}
-        /* 0x1F */ VK_O,
-        /* 0x20 */ VK_U,
-        /* 0x21 */ VK_OEM_4, // {[
-        /* 0x22 */ VK_I,
-        /* 0x23 */ VK_P,
-        /* 0x24 */ VK_RETURN, // Return
-        /* 0x25 */ VK_L,
-        /* 0x26 */ VK_J,
-        /* 0x27 */ VK_OEM_7, // '"
-        /* 0x28 */ VK_K,
-        /* 0x29 */ VK_OEM_1, // ;:
-        /* 0x2A */ VK_OEM_5, // \|
-        /* 0x2B */ VK_OEM_COMMA, // ,<
-        /* 0x2C */ VK_OEM_2, // /?
-        /* 0x2D */ VK_N,
-        /* 0x2E */ VK_M,
-        /* 0x2F */ VK_OEM_PERIOD, // .>
-        /* 0x30 */ VK_TAB,
-        /* 0x31 */ VK_SPACE,
-        /* 0x32 */ VK_OEM_3, // `~
-        /* 0x33 */ VK_BACK, // Backspace
-        /* 0x34 */ 0, // n/a
-        /* 0x35 */ VK_ESCAPE,
-        /* 0x36 */ VK_APPS, // Right Command
-        /* 0x37 */ VK_LWIN, // Left Command
-        /* 0x38 */ VK_LSHIFT, // Left Shift
-        /* 0x39 */ VK_CAPITAL, // Caps Lock
-        /* 0x3A */ VK_LMENU, // Left Option
-        /* 0x3B */ VK_LCONTROL, // Left Ctrl
-        /* 0x3C */ VK_RSHIFT, // Right Shift
-        /* 0x3D */ VK_RMENU, // Right Option
-        /* 0x3E */ VK_RCONTROL, // Right Ctrl
-        /* 0x3F */ 0, // fn
-        /* 0x40 */ VK_F17,
-        /* 0x41 */ VK_DECIMAL, // Num Pad .
-        /* 0x42 */ 0, // n/a
-        /* 0x43 */ VK_MULTIPLY, // Num Pad *
-        /* 0x44 */ 0, // n/a
-        /* 0x45 */ VK_ADD, // Num Pad +
-        /* 0x46 */ 0, // n/a
-        /* 0x47 */ VK_CLEAR, // Num Pad Clear
-        /* 0x48 */ VK_VOLUME_UP,
-        /* 0x49 */ VK_VOLUME_DOWN,
-        /* 0x4A */ VK_VOLUME_MUTE,
-        /* 0x4B */ VK_DIVIDE, // Num Pad /
-        /* 0x4C */ VK_RETURN, // Num Pad Enter
-        /* 0x4D */ 0, // n/a
-        /* 0x4E */ VK_SUBTRACT, // Num Pad -
-        /* 0x4F */ VK_F18,
-        /* 0x50 */ VK_F19,
-        /* 0x51 */ VK_OEM_PLUS, // Num Pad =. There is no such key on common PC keyboards, mapping to normal "+=".
-        /* 0x52 */ VK_NUMPAD0,
-        /* 0x53 */ VK_NUMPAD1,
-        /* 0x54 */ VK_NUMPAD2,
-        /* 0x55 */ VK_NUMPAD3,
-        /* 0x56 */ VK_NUMPAD4,
-        /* 0x57 */ VK_NUMPAD5,
-        /* 0x58 */ VK_NUMPAD6,
-        /* 0x59 */ VK_NUMPAD7,
-        /* 0x5A */ VK_F20,
-        /* 0x5B */ VK_NUMPAD8,
-        /* 0x5C */ VK_NUMPAD9,
-        /* 0x5D */ 0, // Yen (JIS Keyboard Only)
-        /* 0x5E */ 0, // Underscore (JIS Keyboard Only)
-        /* 0x5F */ 0, // KeypadComma (JIS Keyboard Only)
-        /* 0x60 */ VK_F5,
-        /* 0x61 */ VK_F6,
-        /* 0x62 */ VK_F7,
-        /* 0x63 */ VK_F3,
-        /* 0x64 */ VK_F8,
-        /* 0x65 */ VK_F9,
-        /* 0x66 */ 0, // Eisu (JIS Keyboard Only)
-        /* 0x67 */ VK_F11,
-        /* 0x68 */ 0, // Kana (JIS Keyboard Only)
-        /* 0x69 */ VK_F13,
-        /* 0x6A */ VK_F16,
-        /* 0x6B */ VK_F14,
-        /* 0x6C */ 0, // n/a
-        /* 0x6D */ VK_F10,
-        /* 0x6E */ 0, // n/a (Windows95 key?)
-        /* 0x6F */ VK_F12,
-        /* 0x70 */ 0, // n/a
-        /* 0x71 */ VK_F15,
-        /* 0x72 */ VK_INSERT, // Help
-        /* 0x73 */ VK_HOME, // Home
-        /* 0x74 */ VK_PRIOR, // Page Up
-        /* 0x75 */ VK_DELETE, // Forward Delete
-        /* 0x76 */ VK_F4,
-        /* 0x77 */ VK_END, // End
-        /* 0x78 */ VK_F2,
-        /* 0x79 */ VK_NEXT, // Page Down
-        /* 0x7A */ VK_F1,
-        /* 0x7B */ VK_LEFT, // Left Arrow
-        /* 0x7C */ VK_RIGHT, // Right Arrow
-        /* 0x7D */ VK_DOWN, // Down Arrow
-        /* 0x7E */ VK_UP, // Up Arrow
-        /* 0x7F */ 0 // n/a
-    };
-
-    if (keyCode >= 0x80)
-        return 0;
-
-     return windowsKeyCode[keyCode];
-}
-
-int windowsKeyCodeForCharCode(unichar charCode)
-{
-    switch (charCode) {
-
-        case 'a': case 'A': return VK_A; 
-        case 'b': case 'B': return VK_B; 
-        case 'c': case 'C': return VK_C; 
-        case 'd': case 'D': return VK_D; 
-        case 'e': case 'E': return VK_E; 
-        case 'f': case 'F': return VK_F; 
-        case 'g': case 'G': return VK_G; 
-        case 'h': case 'H': return VK_H; 
-        case 'i': case 'I': return VK_I; 
-        case 'j': case 'J': return VK_J; 
-        case 'k': case 'K': return VK_K; 
-        case 'l': case 'L': return VK_L; 
-        case 'm': case 'M': return VK_M; 
-        case 'n': case 'N': return VK_N; 
-        case 'o': case 'O': return VK_O; 
-        case 'p': case 'P': return VK_P; 
-        case 'q': case 'Q': return VK_Q; 
-        case 'r': case 'R': return VK_R; 
-        case 's': case 'S': return VK_S; 
-        case 't': case 'T': return VK_T; 
-        case 'u': case 'U': return VK_U; 
-        case 'v': case 'V': return VK_V; 
-        case 'w': case 'W': return VK_W; 
-        case 'x': case 'X': return VK_X; 
-        case 'y': case 'Y': return VK_Y; 
-        case 'z': case 'Z': return VK_Z; 
-
-        // AppKit generates Unicode PUA character codes for some function keys; using these when key code is not known.
-        case NSPauseFunctionKey: return VK_PAUSE;
-        case NSSelectFunctionKey: return VK_SELECT;
-        case NSPrintFunctionKey: return VK_PRINT;
-        case NSExecuteFunctionKey: return VK_EXECUTE;
-        case NSPrintScreenFunctionKey: return VK_SNAPSHOT;
-        case NSInsertFunctionKey: return VK_INSERT;
-
-        case NSF21FunctionKey: return VK_F21;
-        case NSF22FunctionKey: return VK_F22;
-        case NSF23FunctionKey: return VK_F23;
-        case NSF24FunctionKey: return VK_F24;
-        case NSScrollLockFunctionKey: return VK_SCROLL;
-
-        // This is for U.S. keyboard mapping, and doesn't necessarily make sense for different keyboard layouts.
-        // For example, '"' on Windows Russian layout is VK_2, not VK_OEM_7.
-        case ';': case ':': return VK_OEM_1; 
-        case '=': case '+': return VK_OEM_PLUS; 
-        case ',': case '<': return VK_OEM_COMMA; 
-        case '-': case '_': return VK_OEM_MINUS; 
-        case '.': case '>': return VK_OEM_PERIOD; 
-        case '/': case '?': return VK_OEM_2; 
-        case '`': case '~': return VK_OEM_3; 
-        case '[': case '{': return VK_OEM_4; 
-        case '\\': case '|': return VK_OEM_5; 
-        case ']': case '}': return VK_OEM_6; 
-        case '\'': case '"': return VK_OEM_7; 
-
-    }
-
-    return 0;
-}
-
-}
diff --git a/Source/core/platform/graphics/ANGLEWebKitBridge.cpp b/Source/core/platform/graphics/ANGLEWebKitBridge.cpp
deleted file mode 100644
index 4b5021d..0000000
--- a/Source/core/platform/graphics/ANGLEWebKitBridge.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2010 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,
- * 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/graphics/ANGLEWebKitBridge.h"
-#include "wtf/OwnArrayPtr.h"
-
-namespace WebCore {
-
-typedef size_t ANGLEGetInfoType;
-
-inline static ANGLEGetInfoType getValidationResultValue(const ShHandle compiler, ShShaderInfo shaderInfo)
-{
-    ANGLEGetInfoType value = 0;
-    ShGetInfo(compiler, shaderInfo, &value);
-    return value;
-}
-
-static bool getSymbolInfo(ShHandle compiler, ShShaderInfo symbolType, Vector<ANGLEShaderSymbol>& symbols)
-{
-    ShShaderInfo symbolMaxNameLengthType;
-
-    switch (symbolType) {
-    case SH_ACTIVE_ATTRIBUTES:
-        symbolMaxNameLengthType = SH_ACTIVE_ATTRIBUTE_MAX_LENGTH;
-        break;
-    case SH_ACTIVE_UNIFORMS:
-        symbolMaxNameLengthType = SH_ACTIVE_UNIFORM_MAX_LENGTH;
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-
-    ANGLEGetInfoType numSymbols = getValidationResultValue(compiler, symbolType);
-
-    ANGLEGetInfoType maxNameLength = getValidationResultValue(compiler, symbolMaxNameLengthType);
-    if (maxNameLength <= 1)
-        return false;
-
-    ANGLEGetInfoType maxMappedNameLength = getValidationResultValue(compiler, SH_MAPPED_NAME_MAX_LENGTH);
-    if (maxMappedNameLength <= 1)
-        return false;
-
-    // The maximum allowed symbol name length is 256 characters.
-    Vector<char, 256> nameBuffer(maxNameLength);
-    Vector<char, 256> mappedNameBuffer(maxMappedNameLength);
-
-    for (ANGLEGetInfoType i = 0; i < numSymbols; ++i) {
-        ANGLEShaderSymbol symbol;
-        ANGLEGetInfoType nameLength = 0;
-        switch (symbolType) {
-        case SH_ACTIVE_ATTRIBUTES:
-            symbol.symbolType = SHADER_SYMBOL_TYPE_ATTRIBUTE;
-#if ANGLE_SH_VERSION >= 112
-            ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &symbol.precision, &symbol.staticUse, nameBuffer.data(), mappedNameBuffer.data());
-#else
-            ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &symbol.precision, nameBuffer.data(), mappedNameBuffer.data());
-#endif
-            break;
-        case SH_ACTIVE_UNIFORMS:
-            symbol.symbolType = SHADER_SYMBOL_TYPE_UNIFORM;
-#if ANGLE_SH_VERSION >= 112
-            ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &symbol.precision, &symbol.staticUse, nameBuffer.data(), mappedNameBuffer.data());
-#else
-            ShGetVariableInfo(compiler, symbolType, i, &nameLength, &symbol.size, &symbol.dataType, &symbol.precision, nameBuffer.data(), mappedNameBuffer.data());
-#endif
-            break;
-        default:
-            ASSERT_NOT_REACHED();
-            return false;
-        }
-        if (!nameLength)
-            return false;
-
-        // The ShGetActive* calls above are guaranteed to produce null-terminated strings for
-        // nameBuffer and mappedNameBuffer. Also, the character set for symbol names
-        // is a subset of Latin-1 as specified by the OpenGL ES Shading Language, Section 3.1 and
-        // WebGL, Section "Characters Outside the GLSL Source Character Set".
-
-        String name = String(nameBuffer.data());
-        String mappedName = String(mappedNameBuffer.data());
-
-        // ANGLE returns array names in the format "array[0]".
-        // The only way to know if a symbol is an array is to check if it ends with "[0]".
-        // We can't check the size because regular symbols and arrays of length 1 both have a size of 1.
-        symbol.isArray = name.endsWith("[0]") && mappedName.endsWith("[0]");
-        if (symbol.isArray) {
-            // Add a symbol for the array name without the "[0]" suffix.
-            name.truncate(name.length() - 3);
-            mappedName.truncate(mappedName.length() - 3);
-        }
-
-        symbol.name = name;
-        symbol.mappedName = mappedName;
-        symbols.append(symbol);
-
-        if (symbol.isArray) {
-            // Add symbols for each array element.
-            symbol.isArray = false;
-            for (int i = 0; i < symbol.size; i++) {
-                String arrayBrackets = "[" + String::number(i) + "]";
-                symbol.name = name + arrayBrackets;
-                symbol.mappedName = mappedName + arrayBrackets;
-                symbols.append(symbol);
-            }
-        }
-    }
-    return true;
-}
-
-ANGLEWebKitBridge::ANGLEWebKitBridge(ShShaderOutput shaderOutput, ShShaderSpec shaderSpec)
-    : builtCompilers(false)
-    , m_fragmentCompiler(0)
-    , m_vertexCompiler(0)
-    , m_shaderOutput(shaderOutput)
-    , m_shaderSpec(shaderSpec)
-{
-    // This is a no-op if it's already initialized.
-    ShInitialize();
-}
-
-ANGLEWebKitBridge::~ANGLEWebKitBridge()
-{
-    cleanupCompilers();
-}
-
-void ANGLEWebKitBridge::cleanupCompilers()
-{
-    if (m_fragmentCompiler)
-        ShDestruct(m_fragmentCompiler);
-    m_fragmentCompiler = 0;
-    if (m_vertexCompiler)
-        ShDestruct(m_vertexCompiler);
-    m_vertexCompiler = 0;
-
-    builtCompilers = false;
-}
-
-void ANGLEWebKitBridge::setResources(ShBuiltInResources resources)
-{
-    // Resources are (possibly) changing - cleanup compilers if we had them already
-    cleanupCompilers();
-
-    m_resources = resources;
-}
-
-bool ANGLEWebKitBridge::compileShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog, Vector<ANGLEShaderSymbol>& symbols, int extraCompileOptions)
-{
-    if (!builtCompilers) {
-        m_fragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, m_shaderSpec, m_shaderOutput, &m_resources);
-        m_vertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, m_shaderSpec, m_shaderOutput, &m_resources);
-        if (!m_fragmentCompiler || !m_vertexCompiler) {
-            cleanupCompilers();
-            return false;
-        }
-
-        builtCompilers = true;
-    }
-
-    ShHandle compiler;
-
-    if (shaderType == SHADER_TYPE_VERTEX)
-        compiler = m_vertexCompiler;
-    else
-        compiler = m_fragmentCompiler;
-
-    const char* const shaderSourceStrings[] = { shaderSource };
-
-#if ANGLE_SH_VERSION >= 111
-    bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, SH_OBJECT_CODE | SH_VARIABLES | extraCompileOptions);
-#else
-    bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, SH_OBJECT_CODE | SH_ATTRIBUTES_UNIFORMS | extraCompileOptions);
-#endif
-    if (!validateSuccess) {
-        int logSize = getValidationResultValue(compiler, SH_INFO_LOG_LENGTH);
-        if (logSize > 1) {
-            OwnArrayPtr<char> logBuffer = adoptArrayPtr(new char[logSize]);
-            if (logBuffer) {
-                ShGetInfoLog(compiler, logBuffer.get());
-                shaderValidationLog = logBuffer.get();
-            }
-        }
-        return false;
-    }
-
-    int translationLength = getValidationResultValue(compiler, SH_OBJECT_CODE_LENGTH);
-    if (translationLength > 1) {
-        OwnArrayPtr<char> translationBuffer = adoptArrayPtr(new char[translationLength]);
-        if (!translationBuffer)
-            return false;
-        ShGetObjectCode(compiler, translationBuffer.get());
-        translatedShaderSource = translationBuffer.get();
-    }
-
-    if (!getSymbolInfo(compiler, SH_ACTIVE_ATTRIBUTES, symbols))
-        return false;
-    if (!getSymbolInfo(compiler, SH_ACTIVE_UNIFORMS, symbols))
-        return false;
-
-    return true;
-}
-
-}
diff --git a/Source/core/platform/graphics/ANGLEWebKitBridge.h b/Source/core/platform/graphics/ANGLEWebKitBridge.h
deleted file mode 100644
index d41c830..0000000
--- a/Source/core/platform/graphics/ANGLEWebKitBridge.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2010 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,
- * 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 ANGLEWebKitBridge_h
-#define ANGLEWebKitBridge_h
-
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
-
-#include "ShaderLang.h"
-
-namespace WebCore {
-
-enum ANGLEShaderType {
-    SHADER_TYPE_VERTEX = SH_VERTEX_SHADER,
-    SHADER_TYPE_FRAGMENT = SH_FRAGMENT_SHADER,
-};
-
-enum ANGLEShaderSymbolType {
-    SHADER_SYMBOL_TYPE_ATTRIBUTE,
-    SHADER_SYMBOL_TYPE_UNIFORM
-};
-
-struct ANGLEShaderSymbol {
-    ANGLEShaderSymbolType symbolType;
-    String name;
-    String mappedName;
-    ShDataType dataType;
-    int size;
-    bool isArray;
-    ShPrecisionType precision;
-#if ANGLE_SH_VERSION >= 112
-    int staticUse;
-#endif
-
-    bool isSampler() const
-    {
-        return symbolType == SHADER_SYMBOL_TYPE_UNIFORM
-            && (dataType == SH_SAMPLER_2D
-            || dataType == SH_SAMPLER_CUBE
-            || dataType == SH_SAMPLER_2D_RECT_ARB
-            || dataType == SH_SAMPLER_EXTERNAL_OES);
-    }
-};
-
-class ANGLEWebKitBridge {
-public:
-
-    ANGLEWebKitBridge(ShShaderOutput = SH_GLSL_OUTPUT, ShShaderSpec = SH_WEBGL_SPEC);
-    ~ANGLEWebKitBridge();
-
-    ShBuiltInResources getResources() { return m_resources; }
-    void setResources(ShBuiltInResources);
-
-    bool compileShaderSource(const char* shaderSource, ANGLEShaderType, String& translatedShaderSource, String& shaderValidationLog, Vector<ANGLEShaderSymbol>& symbols, int extraCompileOptions = 0);
-
-private:
-
-    void cleanupCompilers();
-
-    bool builtCompilers;
-
-    ShHandle m_fragmentCompiler;
-    ShHandle m_vertexCompiler;
-
-    ShShaderOutput m_shaderOutput;
-    ShShaderSpec m_shaderSpec;
-
-    ShBuiltInResources m_resources;
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/platform/graphics/BitmapImage.cpp b/Source/core/platform/graphics/BitmapImage.cpp
index 00320fb..10f6be4 100644
--- a/Source/core/platform/graphics/BitmapImage.cpp
+++ b/Source/core/platform/graphics/BitmapImage.cpp
@@ -27,12 +27,12 @@
 #include "config.h"
 #include "core/platform/graphics/BitmapImage.h"
 
-#include "core/platform/Timer.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/ImageObserver.h"
 #include "core/platform/graphics/skia/NativeImageSkia.h"
 #include "core/platform/graphics/skia/SkiaUtils.h"
+#include "platform/Timer.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/Vector.h"
@@ -49,8 +49,6 @@
     , m_repetitionCountStatus(Unknown)
     , m_repetitionsComplete(0)
     , m_desiredFrameStartTime(0)
-    , m_decodedSize(0)
-    , m_decodedPropertiesSize(0)
     , m_frameCount(0)
     , m_isSolidColor(false)
     , m_checkedForSolidColor(false)
@@ -72,8 +70,6 @@
     , m_repetitionCount(cAnimationNone)
     , m_repetitionCountStatus(Unknown)
     , m_repetitionsComplete(0)
-    , m_decodedSize(nativeImage->decodedSize())
-    , m_decodedPropertiesSize(0)
     , m_frameCount(1)
     , m_isSolidColor(false)
     , m_checkedForSolidColor(false)
@@ -135,12 +131,6 @@
     m_isSolidColor = false;
     m_checkedForSolidColor = false;
 
-    ASSERT(m_decodedSize >= frameBytesCleared);
-    m_decodedSize -= frameBytesCleared;
-    if (frameBytesCleared > 0) {
-        frameBytesCleared += m_decodedPropertiesSize;
-        m_decodedPropertiesSize = 0;
-    }
     if (frameBytesCleared && imageObserver())
         imageObserver()->decodedSizeChanged(this, -safeCast<int>(frameBytesCleared));
 }
@@ -168,34 +158,13 @@
         m_hasUniformFrameSize = false;
     if (m_frames[index].m_frame) {
         int deltaBytes = safeCast<int>(m_frames[index].m_frameBytes);
-        m_decodedSize += deltaBytes;
         // The fully-decoded frame will subsume the partially decoded data used
         // to determine image properties.
-        deltaBytes -= m_decodedPropertiesSize;
-        m_decodedPropertiesSize = 0;
         if (imageObserver())
             imageObserver()->decodedSizeChanged(this, deltaBytes);
     }
 }
 
-void BitmapImage::didDecodeProperties() const
-{
-    if (m_decodedSize)
-        return;
-    size_t updatedSize = m_source.bytesDecodedToDetermineProperties();
-    if (m_decodedPropertiesSize == updatedSize)
-        return;
-    int deltaBytes = updatedSize - m_decodedPropertiesSize;
-#if !ASSERT_DISABLED
-    bool overflow = updatedSize > m_decodedPropertiesSize && deltaBytes < 0;
-    bool underflow = updatedSize < m_decodedPropertiesSize && deltaBytes > 0;
-    ASSERT(!overflow && !underflow);
-#endif
-    m_decodedPropertiesSize = updatedSize;
-    if (imageObserver())
-        imageObserver()->decodedSizeChanged(this, deltaBytes);
-}
-
 void BitmapImage::updateSize() const
 {
     if (!m_sizeAvailable || m_haveSize)
@@ -204,7 +173,6 @@
     m_size = m_source.size();
     m_sizeRespectingOrientation = m_source.size(RespectImageOrientation);
     m_haveSize = true;
-    didDecodeProperties();
 }
 
 IntSize BitmapImage::size() const
@@ -224,19 +192,19 @@
     if (!m_currentFrame || m_hasUniformFrameSize)
         return size();
     IntSize frameSize = m_source.frameSizeAtIndex(m_currentFrame);
-    didDecodeProperties();
     return frameSize;
 }
 
 bool BitmapImage::getHotSpot(IntPoint& hotSpot) const
 {
     bool result = m_source.getHotSpot(hotSpot);
-    didDecodeProperties();
     return result;
 }
 
 bool BitmapImage::dataChanged(bool allDataReceived)
 {
+    TRACE_EVENT0("webkit", "BitmapImage::dataChanged");
+
     // Clear all partially-decoded frames. For most image formats, there is only
     // one frame, but at least GIF and ICO can have more. With GIFs, the frames
     // come in order and we ask to decode them in order, waiting to request a
@@ -335,7 +303,6 @@
         m_frameCount = m_source.frameCount();
         // If decoder is not initialized yet, m_source.frameCount() returns 0.
         if (m_frameCount) {
-            didDecodeProperties();
             m_haveFrameCount = true;
         }
     }
@@ -348,7 +315,6 @@
         return true;
 
     m_sizeAvailable = m_source.isSizeAvailable();
-    didDecodeProperties();
 
     return m_sizeAvailable;
 }
@@ -438,7 +404,6 @@
         // decoder will default to cAnimationLoopOnce, and we'll try and read
         // the count again once the whole image is decoded.
         m_repetitionCount = m_source.repetitionCount();
-        didDecodeProperties();
         m_repetitionCountStatus = (imageKnownToBeComplete || m_repetitionCount == cAnimationNone) ? Certain : Uncertain;
     }
     return m_repetitionCount;
@@ -565,13 +530,6 @@
     destroyDecodedDataIfNecessary();
 }
 
-unsigned BitmapImage::decodedSize() const
-{
-    return m_decodedSize;
-}
-
-
-
 void BitmapImage::advanceAnimation(Timer<BitmapImage>*)
 {
     internalAdvanceAnimation(false);
diff --git a/Source/core/platform/graphics/BitmapImage.h b/Source/core/platform/graphics/BitmapImage.h
index 6914f23..70b40f4 100644
--- a/Source/core/platform/graphics/BitmapImage.h
+++ b/Source/core/platform/graphics/BitmapImage.h
@@ -31,9 +31,9 @@
 #include "core/platform/graphics/Color.h"
 #include "core/platform/graphics/FrameData.h"
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/ImageOrientation.h"
 #include "core/platform/graphics/ImageSource.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/graphics/ImageOrientation.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
@@ -75,8 +75,6 @@
     virtual void stopAnimation() OVERRIDE;
     virtual void resetAnimation() OVERRIDE;
 
-    virtual unsigned decodedSize() const OVERRIDE;
-
     virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE;
     virtual bool currentFrameKnownToBeOpaque() OVERRIDE;
 
@@ -137,12 +135,6 @@
     // Whether or not size is available yet.
     bool isSizeAvailable();
 
-    // Called after asking the source for any information that may require
-    // decoding part of the image (e.g., the image size).  We need to report
-    // the partially decoded data to our observer so it has an accurate
-    // account of the BitmapImage's memory usage.
-    void didDecodeProperties() const;
-
     // Animation.
     int repetitionCount(bool imageKnownToBeComplete);  // |imageKnownToBeComplete| should be set if the caller knows the entire image has been decoded.
     bool shouldAnimate();
@@ -179,8 +171,6 @@
 
     Color m_solidColor;  // If we're a 1x1 solid color, this is the color to use to fill.
 
-    unsigned m_decodedSize; // The current size of all decoded frames.
-    mutable unsigned m_decodedPropertiesSize; // The size of data decoded by the source to determine image properties (e.g. size, frame count, etc).
     size_t m_frameCount;
 
     bool m_isSolidColor : 1; // Whether or not we are a 1x1 solid image.
diff --git a/Source/core/platform/graphics/BitmapImageTest.cpp b/Source/core/platform/graphics/BitmapImageTest.cpp
index 0a12c5e..b5c9b2c 100644
--- a/Source/core/platform/graphics/BitmapImageTest.cpp
+++ b/Source/core/platform/graphics/BitmapImageTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/platform/graphics/BitmapImage.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/ImageObserver.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
@@ -70,6 +70,7 @@
     size_t frameCount() { return m_image->frameCount(); }
     void setCurrentFrame(size_t frame) { m_image->m_currentFrame = frame; }
     size_t frameDecodedSize(size_t frame) { return m_image->m_frames[frame].m_frameBytes; }
+    size_t decodedFramesCount() const { return m_image->m_frames.size(); }
 
     void loadImage(const char* fileName)
     {
@@ -77,13 +78,27 @@
         ASSERT_TRUE(imageData.get());
 
         m_image->setData(imageData, true);
-        EXPECT_EQ(0u, m_image->decodedSize());
+        EXPECT_EQ(0u, decodedSize());
 
         size_t frameCount = m_image->frameCount();
         for (size_t i = 0; i < frameCount; ++i)
             m_image->frameAtIndex(i);
     }
 
+    size_t decodedSize()
+    {
+        // In the context of this test, the following loop will give the correct result, but only because the test
+        // forces all frames to be decoded in loadImage() above. There is no general guarantee that frameDecodedSize()
+        // is up-to-date. Because of how multi frame images (like GIF) work, requesting one frame to be decoded may
+        // require other previous frames to be decoded as well. In those cases frameDecodedSize() wouldn't return the
+        // correct thing for the previous frame because the decoded size wouldn't have propagated upwards to the
+        // BitmapImage frame cache.
+        size_t size = 0;
+        for (size_t i = 0; i < decodedFramesCount(); ++i)
+            size += frameDecodedSize(i);
+        return size;
+    }
+
 protected:
     virtual void SetUp() OVERRIDE
     {
@@ -97,7 +112,7 @@
 TEST_F(BitmapImageTest, destroyDecodedDataExceptCurrentFrame)
 {
     loadImage("/LayoutTests/fast/images/resources/animated-10color.gif");
-    size_t totalSize = m_image->decodedSize();
+    size_t totalSize = decodedSize();
     size_t frame = frameCount() / 2;
     setCurrentFrame(frame);
     size_t size = frameDecodedSize(frame);
@@ -109,11 +124,11 @@
 TEST_F(BitmapImageTest, destroyAllDecodedData)
 {
     loadImage("/LayoutTests/fast/images/resources/animated-10color.gif");
-    size_t decodedSize = m_image->decodedSize();
-    EXPECT_GT(decodedSize, 0u);
+    size_t totalSize = decodedSize();
+    EXPECT_GT(totalSize, 0u);
     destroyDecodedData(true);
-    EXPECT_EQ(-static_cast<int>(decodedSize), m_imageObserver.m_lastDecodedSizeChangedDelta);
-    EXPECT_EQ(0u, m_image->decodedSize());
+    EXPECT_EQ(-static_cast<int>(totalSize), m_imageObserver.m_lastDecodedSizeChangedDelta);
+    EXPECT_EQ(0u, decodedSize());
 }
 
 } // namespace
diff --git a/Source/core/platform/graphics/ContentDecryptionModule.cpp b/Source/core/platform/graphics/ContentDecryptionModule.cpp
index e83486d..a10dde1 100644
--- a/Source/core/platform/graphics/ContentDecryptionModule.cpp
+++ b/Source/core/platform/graphics/ContentDecryptionModule.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/platform/graphics/ContentDecryptionModule.h"
 
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
 #include "core/platform/graphics/ContentDecryptionModuleSession.h"
 #include "public/platform/Platform.h"
 
diff --git a/Source/core/platform/graphics/ContentDecryptionModuleSession.cpp b/Source/core/platform/graphics/ContentDecryptionModuleSession.cpp
index 60d3ac1..9ff8729 100644
--- a/Source/core/platform/graphics/ContentDecryptionModuleSession.cpp
+++ b/Source/core/platform/graphics/ContentDecryptionModuleSession.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/platform/graphics/ContentDecryptionModuleSession.h"
 
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebContentDecryptionModule.h"
 #include "public/platform/WebURL.h"
diff --git a/Source/core/platform/graphics/CrossfadeGeneratedImage.cpp b/Source/core/platform/graphics/CrossfadeGeneratedImage.cpp
index 46ff30e..b9acd4b 100644
--- a/Source/core/platform/graphics/CrossfadeGeneratedImage.cpp
+++ b/Source/core/platform/graphics/CrossfadeGeneratedImage.cpp
@@ -26,9 +26,9 @@
 #include "config.h"
 #include "core/platform/graphics/CrossfadeGeneratedImage.h"
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/ImageBuffer.h"
+#include "platform/geometry/FloatRect.h"
 
 using namespace std;
 
@@ -93,7 +93,7 @@
     drawCrossfade(context);
 }
 
-void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const FloatSize& scale, const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
+void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const FloatSize& scale, const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode, const IntSize& repeatSpacing)
 {
     OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(m_size, 1, context->isAccelerated() ? Accelerated : Unaccelerated);
     if (!imageBuffer)
@@ -104,7 +104,7 @@
     drawCrossfade(graphicsContext);
 
     // Tile the image buffer into the context.
-    imageBuffer->drawPattern(context, srcRect, scale, phase, compositeOp, dstRect, blendMode);
+    imageBuffer->drawPattern(context, srcRect, scale, phase, compositeOp, dstRect, blendMode, repeatSpacing);
 }
 
 }
diff --git a/Source/core/platform/graphics/CrossfadeGeneratedImage.h b/Source/core/platform/graphics/CrossfadeGeneratedImage.h
index 4090d7a..372461d 100644
--- a/Source/core/platform/graphics/CrossfadeGeneratedImage.h
+++ b/Source/core/platform/graphics/CrossfadeGeneratedImage.h
@@ -29,7 +29,7 @@
 #include "core/platform/graphics/GeneratedImage.h"
 #include "core/platform/graphics/Image.h"
 #include "core/platform/graphics/ImageObserver.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/RefPtr.h"
 
 namespace WebCore {
@@ -55,7 +55,7 @@
         CompositeOperator, BlendMode) OVERRIDE;
     virtual void drawPattern(GraphicsContext*, const FloatRect&,
         const FloatSize&, const FloatPoint&, CompositeOperator,
-        const FloatRect&, BlendMode) OVERRIDE;
+        const FloatRect&, BlendMode, const IntSize& repeatSpacing) OVERRIDE;
 
     CrossfadeGeneratedImage(Image* fromImage, Image* toImage, float percentage, IntSize crossfadeSize, const IntSize&);
 
diff --git a/Source/core/platform/graphics/DrawLooper.cpp b/Source/core/platform/graphics/DrawLooper.cpp
index 461db1c..270419b 100644
--- a/Source/core/platform/graphics/DrawLooper.cpp
+++ b/Source/core/platform/graphics/DrawLooper.cpp
@@ -32,7 +32,7 @@
 #include "core/platform/graphics/DrawLooper.h"
 
 #include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/FloatSize.h"
+#include "platform/geometry/FloatSize.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "third_party/skia/include/core/SkColorFilter.h"
 #include "third_party/skia/include/core/SkDrawLooper.h"
diff --git a/Source/core/platform/graphics/Extensions3D.cpp b/Source/core/platform/graphics/Extensions3D.cpp
index 22833b3..bd888e9 100644
--- a/Source/core/platform/graphics/Extensions3D.cpp
+++ b/Source/core/platform/graphics/Extensions3D.cpp
@@ -27,7 +27,7 @@
 
 #include "core/platform/graphics/Extensions3D.h"
 
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
 #include "core/platform/graphics/GraphicsContext3D.h"
 #include "public/platform/WebGraphicsContext3D.h"
 #include "wtf/text/CString.h"
diff --git a/Source/core/platform/graphics/FloatPoint.cpp b/Source/core/platform/graphics/FloatPoint.cpp
deleted file mode 100644
index d92d6ab..0000000
--- a/Source/core/platform/graphics/FloatPoint.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2004, 2006, 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2005 Nokia.  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,
- * 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/graphics/FloatPoint.h"
-
-#include <math.h>
-#include <limits>
-#include "core/platform/FloatConversion.h"
-#include "core/platform/graphics/IntPoint.h"
-#include "core/platform/graphics/LayoutPoint.h"
-#include "core/platform/graphics/LayoutSize.h"
-#include "core/platform/graphics/skia/SkiaUtils.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
-#include "third_party/skia/include/core/SkPoint.h"
-
-namespace WebCore {
-
-FloatPoint::FloatPoint(const IntPoint& p) : m_x(p.x()), m_y(p.y())
-{
-}
-
-FloatPoint::FloatPoint(const LayoutPoint& p) : m_x(p.x()), m_y(p.y())
-{
-}
-
-void FloatPoint::normalize()
-{
-    float tempLength = length();
-
-    if (tempLength) {
-        m_x /= tempLength;
-        m_y /= tempLength;
-    }
-}
-
-float FloatPoint::slopeAngleRadians() const
-{
-    return atan2f(m_y, m_x);
-}
-
-float FloatPoint::length() const
-{
-    return sqrtf(lengthSquared());
-}
-
-void FloatPoint::move(const LayoutSize& size)
-{
-    m_x += size.width();
-    m_y += size.height();
-}
-
-void FloatPoint::moveBy(const LayoutPoint& point)
-{
-    m_x += point.x();
-    m_y += point.y();
-}
-
-FloatPoint::operator SkPoint() const
-{
-    SkPoint p = { WebCoreFloatToSkScalar(m_x), WebCoreFloatToSkScalar(m_y) };
-    return p;
-}
-
-FloatPoint FloatPoint::matrixTransform(const AffineTransform& transform) const
-{
-    double newX, newY;
-    transform.map(static_cast<double>(m_x), static_cast<double>(m_y), newX, newY);
-    return narrowPrecision(newX, newY);
-}
-
-FloatPoint FloatPoint::matrixTransform(const TransformationMatrix& transform) const
-{
-    double newX, newY;
-    transform.map(static_cast<double>(m_x), static_cast<double>(m_y), newX, newY);
-    return narrowPrecision(newX, newY);
-}
-
-FloatPoint FloatPoint::narrowPrecision(double x, double y)
-{
-    return FloatPoint(narrowPrecisionToFloat(x), narrowPrecisionToFloat(y));
-}
-
-float findSlope(const FloatPoint& p1, const FloatPoint& p2, float& c)
-{
-    if (p2.x() == p1.x())
-        return std::numeric_limits<float>::infinity();
-
-    // y = mx + c
-    float slope = (p2.y() - p1.y()) / (p2.x() - p1.x());
-    c = p1.y() - slope * p1.x();
-    return slope;
-}
-
-bool findIntersection(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& d1, const FloatPoint& d2, FloatPoint& intersection)
-{
-    float pOffset = 0;
-    float pSlope = findSlope(p1, p2, pOffset);
-
-    float dOffset = 0;
-    float dSlope = findSlope(d1, d2, dOffset);
-
-    if (dSlope == pSlope)
-        return false;
-
-    if (pSlope == std::numeric_limits<float>::infinity()) {
-        intersection.setX(p1.x());
-        intersection.setY(dSlope * intersection.x() + dOffset);
-        return true;
-    }
-    if (dSlope == std::numeric_limits<float>::infinity()) {
-        intersection.setX(d1.x());
-        intersection.setY(pSlope * intersection.x() + pOffset);
-        return true;
-    }
-
-    // Find x at intersection, where ys overlap; x = (c' - c) / (m - m')
-    intersection.setX((dOffset - pOffset) / (pSlope - dSlope));
-    intersection.setY(pSlope * intersection.x() + pOffset);
-    return true;
-}
-
-}
diff --git a/Source/core/platform/graphics/FloatPoint.h b/Source/core/platform/graphics/FloatPoint.h
deleted file mode 100644
index 9ddbc2b..0000000
--- a/Source/core/platform/graphics/FloatPoint.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (C) 2004, 2006, 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2005 Nokia.  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,
- * 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 FloatPoint_h
-#define FloatPoint_h
-
-#include "core/platform/graphics/FloatSize.h"
-#include "core/platform/graphics/IntPoint.h"
-#include "wtf/MathExtras.h"
-#include <algorithm>
-
-#if OS(MACOSX)
-typedef struct CGPoint CGPoint;
-
-#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
-typedef struct CGPoint NSPoint;
-#else
-typedef struct _NSPoint NSPoint;
-#endif
-#endif
-
-struct SkPoint;
-
-namespace WebCore {
-
-class AffineTransform;
-class TransformationMatrix;
-class IntPoint;
-class IntSize;
-class LayoutPoint;
-class LayoutSize;
-
-class FloatPoint {
-public:
-    FloatPoint() : m_x(0), m_y(0) { }
-    FloatPoint(float x, float y) : m_x(x), m_y(y) { }
-    FloatPoint(const IntPoint&);
-    FloatPoint(const LayoutPoint&);
-    explicit FloatPoint(const FloatSize& size) : m_x(size.width()), m_y(size.height()) { }
-
-    static FloatPoint zero() { return FloatPoint(); }
-
-    static FloatPoint narrowPrecision(double x, double y);
-
-    float x() const { return m_x; }
-    float y() const { return m_y; }
-
-    void setX(float x) { m_x = x; }
-    void setY(float y) { m_y = y; }
-    void set(float x, float y)
-    {
-        m_x = x;
-        m_y = y;
-    }
-    void move(float dx, float dy)
-    {
-        m_x += dx;
-        m_y += dy;
-    }
-    void move(const IntSize& a)
-    {
-        m_x += a.width();
-        m_y += a.height();
-    }
-    void move(const LayoutSize&);
-    void move(const FloatSize& a)
-    {
-        m_x += a.width();
-        m_y += a.height();
-    }
-    void moveBy(const IntPoint& a)
-    {
-        m_x += a.x();
-        m_y += a.y();
-    }
-    void moveBy(const LayoutPoint&);
-    void moveBy(const FloatPoint& a)
-    {
-        m_x += a.x();
-        m_y += a.y();
-    }
-    void scale(float sx, float sy)
-    {
-        m_x *= sx;
-        m_y *= sy;
-    }
-
-    void normalize();
-
-    float dot(const FloatPoint& a) const
-    {
-        return m_x * a.x() + m_y * a.y();
-    }
-
-    float slopeAngleRadians() const;
-    float length() const;
-    float lengthSquared() const
-    {
-        return m_x * m_x + m_y * m_y;
-    }
-
-    FloatPoint expandedTo(const FloatPoint& other) const
-    {
-        return FloatPoint(std::max(m_x, other.m_x), std::max(m_y, other.m_y));
-    }
-
-    FloatPoint transposedPoint() const
-    {
-        return FloatPoint(m_y, m_x);
-    }
-
-#if OS(MACOSX)
-    FloatPoint(const CGPoint&);
-    operator CGPoint() const;
-#if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
-    FloatPoint(const NSPoint&);
-    operator NSPoint() const;
-#endif
-#endif
-
-    operator SkPoint() const;
-
-    FloatPoint matrixTransform(const TransformationMatrix&) const;
-    FloatPoint matrixTransform(const AffineTransform&) const;
-
-private:
-    float m_x, m_y;
-};
-
-
-inline FloatPoint& operator+=(FloatPoint& a, const FloatSize& b)
-{
-    a.move(b.width(), b.height());
-    return a;
-}
-
-inline FloatPoint& operator+=(FloatPoint& a, const FloatPoint& b)
-{
-    a.move(b.x(), b.y());
-    return a;
-}
-
-inline FloatPoint& operator-=(FloatPoint& a, const FloatSize& b)
-{
-    a.move(-b.width(), -b.height());
-    return a;
-}
-
-inline FloatPoint operator+(const FloatPoint& a, const FloatSize& b)
-{
-    return FloatPoint(a.x() + b.width(), a.y() + b.height());
-}
-
-inline FloatPoint operator+(const FloatPoint& a, const FloatPoint& b)
-{
-    return FloatPoint(a.x() + b.x(), a.y() + b.y());
-}
-
-inline FloatSize operator-(const FloatPoint& a, const FloatPoint& b)
-{
-    return FloatSize(a.x() - b.x(), a.y() - b.y());
-}
-
-inline FloatPoint operator-(const FloatPoint& a, const FloatSize& b)
-{
-    return FloatPoint(a.x() - b.width(), a.y() - b.height());
-}
-
-inline FloatPoint operator-(const FloatPoint& a)
-{
-    return FloatPoint(-a.x(), -a.y());
-}
-
-inline bool operator==(const FloatPoint& a, const FloatPoint& b)
-{
-    return a.x() == b.x() && a.y() == b.y();
-}
-
-inline bool operator!=(const FloatPoint& a, const FloatPoint& b)
-{
-    return a.x() != b.x() || a.y() != b.y();
-}
-
-inline float operator*(const FloatPoint& a, const FloatPoint& b)
-{
-    // dot product
-    return a.dot(b);
-}
-
-inline IntPoint roundedIntPoint(const FloatPoint& p)
-{
-    return IntPoint(clampToInteger(roundf(p.x())), clampToInteger(roundf(p.y())));
-}
-
-inline IntPoint flooredIntPoint(const FloatPoint& p)
-{
-    return IntPoint(clampToInteger(floorf(p.x())), clampToInteger(floorf(p.y())));
-}
-
-inline IntPoint ceiledIntPoint(const FloatPoint& p)
-{
-    return IntPoint(clampToInteger(ceilf(p.x())), clampToInteger(ceilf(p.y())));
-}
-
-inline IntSize flooredIntSize(const FloatPoint& p)
-{
-    return IntSize(clampToInteger(floorf(p.x())), clampToInteger(floorf(p.y())));
-}
-
-inline FloatSize toFloatSize(const FloatPoint& a)
-{
-    return FloatSize(a.x(), a.y());
-}
-
-float findSlope(const FloatPoint& p1, const FloatPoint& p2, float& c);
-
-// Find point where lines through the two pairs of points intersect. Returns false if the lines don't intersect.
-bool findIntersection(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& d1, const FloatPoint& d2, FloatPoint& intersection);
-
-}
-
-#endif
diff --git a/Source/core/platform/graphics/FloatPoint3D.cpp b/Source/core/platform/graphics/FloatPoint3D.cpp
deleted file mode 100644
index 75bc4ab..0000000
--- a/Source/core/platform/graphics/FloatPoint3D.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005 Rob Buis <buis@kde.org>
-                  2005 Eric Seidel <eric@webkit.org>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library 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
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    aint with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-
-#include "core/platform/graphics/FloatPoint3D.h"
-
-#include <math.h>
-
-namespace WebCore {
-
-void FloatPoint3D::normalize()
-{
-    float tempLength = length();
-
-    if (tempLength) {
-        m_x /= tempLength;
-        m_y /= tempLength;
-        m_z /= tempLength;
-    }
-}
-
-} // namespace WebCore
-
diff --git a/Source/core/platform/graphics/FloatPoint3D.h b/Source/core/platform/graphics/FloatPoint3D.h
deleted file mode 100644
index 2a136c9..0000000
--- a/Source/core/platform/graphics/FloatPoint3D.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
-    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005 Rob Buis <buis@kde.org>
-                  2005 Eric Seidel <eric@webkit.org>
-                  2010 Zoltan Herczeg <zherczeg@webkit.org>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library 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
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    aint with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef FloatPoint3D_h
-#define FloatPoint3D_h
-
-#include "core/platform/graphics/FloatPoint.h"
-
-namespace WebCore {
-
-class FloatPoint3D {
-public:
-    FloatPoint3D()
-        : m_x(0)
-        , m_y(0)
-        , m_z(0)
-    {
-    }
-
-    FloatPoint3D(float x, float y, float z)
-        : m_x(x)
-        , m_y(y)
-        , m_z(z)
-    {
-    }
-
-    FloatPoint3D(const FloatPoint& p)
-        : m_x(p.x())
-        , m_y(p.y())
-        , m_z(0)
-    {
-    }
-
-    FloatPoint3D(const FloatPoint3D& p)
-        : m_x(p.x())
-        , m_y(p.y())
-        , m_z(p.z())
-    {
-    }
-
-    float x() const { return m_x; }
-    void setX(float x) { m_x = x; }
-
-    float y() const { return m_y; }
-    void setY(float y) { m_y = y; }
-
-    float z() const { return m_z; }
-    void setZ(float z) { m_z = z; }
-    void set(float x, float y, float z)
-    {
-        m_x = x;
-        m_y = y;
-        m_z = z;
-    }
-    void move(float dx, float dy, float dz)
-    {
-        m_x += dx;
-        m_y += dy;
-        m_z += dz;
-    }
-    void scale(float sx, float sy, float sz)
-    {
-        m_x *= sx;
-        m_y *= sy;
-        m_z *= sz;
-    }
-
-    bool isZero() const
-    {
-        return !m_x && !m_y && !m_z;
-    }
-
-    void normalize();
-
-    float dot(const FloatPoint3D& a) const
-    {
-        return m_x * a.x() + m_y * a.y() + m_z * a.z();
-    }
-
-    // Sets this FloatPoint3D to the cross product of the passed two.
-    // It is safe for "this" to be the same as either or both of the
-    // arguments.
-    void cross(const FloatPoint3D& a, const FloatPoint3D& b)
-    {
-        float x = a.y() * b.z() - a.z() * b.y();
-        float y = a.z() * b.x() - a.x() * b.z();
-        float z = a.x() * b.y() - a.y() * b.x();
-        m_x = x;
-        m_y = y;
-        m_z = z;
-    }
-
-    // Convenience function returning "this cross point" as a
-    // stack-allocated result.
-    FloatPoint3D cross(const FloatPoint3D& point) const
-    {
-        FloatPoint3D result;
-        result.cross(*this, point);
-        return result;
-    }
-
-    float lengthSquared() const { return this->dot(*this); }
-    float length() const { return sqrtf(lengthSquared()); }
-
-    float distanceTo(const FloatPoint3D& a) const;
-
-private:
-    float m_x;
-    float m_y;
-    float m_z;
-};
-
-inline FloatPoint3D& operator +=(FloatPoint3D& a, const FloatPoint3D& b)
-{
-    a.move(b.x(), b.y(), b.z());
-    return a;
-}
-
-inline FloatPoint3D& operator -=(FloatPoint3D& a, const FloatPoint3D& b)
-{
-    a.move(-b.x(), -b.y(), -b.z());
-    return a;
-}
-
-inline FloatPoint3D operator+(const FloatPoint3D& a, const FloatPoint3D& b)
-{
-    return FloatPoint3D(a.x() + b.x(), a.y() + b.y(), a.z() + b.z());
-}
-
-inline FloatPoint3D operator-(const FloatPoint3D& a, const FloatPoint3D& b)
-{
-    return FloatPoint3D(a.x() - b.x(), a.y() - b.y(), a.z() - b.z());
-}
-
-inline bool operator==(const FloatPoint3D& a, const FloatPoint3D& b)
-{
-    return a.x() == b.x() && a.y() == b.y() && a.z() == b.z();
-}
-
-inline bool operator!=(const FloatPoint3D& a, const FloatPoint3D& b)
-{
-    return a.x() != b.x() || a.y() != b.y() || a.z() != b.z();
-}
-
-inline float operator*(const FloatPoint3D& a, const FloatPoint3D& b)
-{
-    // dot product
-    return a.dot(b);
-}
-
-inline FloatPoint3D operator*(float k, const FloatPoint3D& v)
-{
-    return FloatPoint3D(k * v.x(), k * v.y(), k * v.z());
-}
-
-inline FloatPoint3D operator*(const FloatPoint3D& v, float k)
-{
-    return FloatPoint3D(k * v.x(), k * v.y(), k * v.z());
-}
-
-inline float FloatPoint3D::distanceTo(const FloatPoint3D& a) const
-{
-    return (*this - a).length();
-}
-
-} // namespace WebCore
-
-#endif // FloatPoint3D_h
diff --git a/Source/core/platform/graphics/FloatPolygon.h b/Source/core/platform/graphics/FloatPolygon.h
index c2ab193..acf033f 100644
--- a/Source/core/platform/graphics/FloatPolygon.h
+++ b/Source/core/platform/graphics/FloatPolygon.h
@@ -30,10 +30,10 @@
 #ifndef FloatPolygon_h
 #define FloatPolygon_h
 
-#include "core/platform/PODIntervalTree.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/WindRule.h"
+#include "platform/PODIntervalTree.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/platform/graphics/FloatQuad.cpp b/Source/core/platform/graphics/FloatQuad.cpp
deleted file mode 100644
index 0a7e092..0000000
--- a/Source/core/platform/graphics/FloatQuad.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2013 Xidorn Quan (quanxunzhen@gmail.com)
- *
- * 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.
- * 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.
- *
- * 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/graphics/FloatQuad.h"
-
-#include <algorithm>
-#include <limits>
-
-using namespace std;
-
-namespace WebCore {
-
-static inline float min4(float a, float b, float c, float d)
-{
-    return min(min(a, b), min(c, d));
-}
-
-static inline float max4(float a, float b, float c, float d)
-{
-    return max(max(a, b), max(c, d));
-}
-
-inline float dot(const FloatSize& a, const FloatSize& b)
-{
-    return a.width() * b.width() + a.height() * b.height();
-}
-
-inline float determinant(const FloatSize& a, const FloatSize& b)
-{
-    return a.width() * b.height() - a.height() * b.width();
-}
-
-inline bool isPointInTriangle(const FloatPoint& p, const FloatPoint& t1, const FloatPoint& t2, const FloatPoint& t3)
-{
-    // Compute vectors
-    FloatSize v0 = t3 - t1;
-    FloatSize v1 = t2 - t1;
-    FloatSize v2 = p - t1;
-
-    // Compute dot products
-    float dot00 = dot(v0, v0);
-    float dot01 = dot(v0, v1);
-    float dot02 = dot(v0, v2);
-    float dot11 = dot(v1, v1);
-    float dot12 = dot(v1, v2);
-
-    // Compute barycentric coordinates
-    float invDenom = 1.0f / (dot00 * dot11 - dot01 * dot01);
-    float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
-    float v = (dot00 * dot12 - dot01 * dot02) * invDenom;
-
-    // Check if point is in triangle
-    return (u >= 0) && (v >= 0) && (u + v <= 1);
-}
-
-FloatRect FloatQuad::boundingBox() const
-{
-    float left   = min4(m_p1.x(), m_p2.x(), m_p3.x(), m_p4.x());
-    float top    = min4(m_p1.y(), m_p2.y(), m_p3.y(), m_p4.y());
-
-    float right  = max4(m_p1.x(), m_p2.x(), m_p3.x(), m_p4.x());
-    float bottom = max4(m_p1.y(), m_p2.y(), m_p3.y(), m_p4.y());
-
-    return FloatRect(left, top, right - left, bottom - top);
-}
-
-static inline bool withinEpsilon(float a, float b)
-{
-    return fabs(a - b) < numeric_limits<float>::epsilon();
-}
-
-bool FloatQuad::isRectilinear() const
-{
-    return (withinEpsilon(m_p1.x(), m_p2.x()) && withinEpsilon(m_p2.y(), m_p3.y()) && withinEpsilon(m_p3.x(), m_p4.x()) && withinEpsilon(m_p4.y(), m_p1.y()))
-        || (withinEpsilon(m_p1.y(), m_p2.y()) && withinEpsilon(m_p2.x(), m_p3.x()) && withinEpsilon(m_p3.y(), m_p4.y()) && withinEpsilon(m_p4.x(), m_p1.x()));
-}
-
-bool FloatQuad::containsPoint(const FloatPoint& p) const
-{
-    return isPointInTriangle(p, m_p1, m_p2, m_p3) || isPointInTriangle(p, m_p1, m_p3, m_p4);
-}
-
-// Note that we only handle convex quads here.
-bool FloatQuad::containsQuad(const FloatQuad& other) const
-{
-    return containsPoint(other.p1()) && containsPoint(other.p2()) && containsPoint(other.p3()) && containsPoint(other.p4());
-}
-
-static inline FloatPoint rightMostCornerToVector(const FloatRect& rect, const FloatSize& vector)
-{
-    // Return the corner of the rectangle that if it is to the left of the vector
-    // would mean all of the rectangle is to the left of the vector.
-    // The vector here represents the side between two points in a clockwise convex polygon.
-    //
-    //  Q  XXX
-    // QQQ XXX   If the lower left corner of X is left of the vector that goes from the top corner of Q to
-    //  QQQ      the right corner of Q, then all of X is left of the vector, and intersection impossible.
-    //   Q
-    //
-    FloatPoint point;
-    if (vector.width() >= 0)
-        point.setY(rect.maxY());
-    else
-        point.setY(rect.y());
-    if (vector.height() >= 0)
-        point.setX(rect.x());
-    else
-        point.setX(rect.maxX());
-    return point;
-}
-
-bool FloatQuad::intersectsRect(const FloatRect& rect) const
-{
-    // For each side of the quad clockwise we check if the rectangle is to the left of it
-    // since only content on the right can onlap with the quad.
-    // This only works if the quad is convex.
-    FloatSize v1, v2, v3, v4;
-
-    // Ensure we use clockwise vectors.
-    if (!isCounterclockwise()) {
-        v1 = m_p2 - m_p1;
-        v2 = m_p3 - m_p2;
-        v3 = m_p4 - m_p3;
-        v4 = m_p1 - m_p4;
-    } else {
-        v1 = m_p4 - m_p1;
-        v2 = m_p1 - m_p2;
-        v3 = m_p2 - m_p3;
-        v4 = m_p3 - m_p4;
-    }
-
-    FloatPoint p = rightMostCornerToVector(rect, v1);
-    if (determinant(v1, p - m_p1) < 0)
-        return false;
-
-    p = rightMostCornerToVector(rect, v2);
-    if (determinant(v2, p - m_p2) < 0)
-        return false;
-
-    p = rightMostCornerToVector(rect, v3);
-    if (determinant(v3, p - m_p3) < 0)
-        return false;
-
-    p = rightMostCornerToVector(rect, v4);
-    if (determinant(v4, p - m_p4) < 0)
-        return false;
-
-    // If not all of the rectangle is outside one of the quad's four sides, then that means at least
-    // a part of the rectangle is overlapping the quad.
-    return true;
-}
-
-// Tests whether the line is contained by or intersected with the circle.
-static inline bool lineIntersectsCircle(const FloatPoint& center, float radius, const FloatPoint& p0, const FloatPoint& p1)
-{
-    float x0 = p0.x() - center.x(), y0 = p0.y() - center.y();
-    float x1 = p1.x() - center.x(), y1 = p1.y() - center.y();
-    float radius2 = radius * radius;
-    if ((x0 * x0 + y0 * y0) <= radius2 || (x1 * x1 + y1 * y1) <= radius2)
-        return true;
-    if (p0 == p1)
-        return false;
-
-    float a = y0 - y1;
-    float b = x1 - x0;
-    float c = x0 * y1 - x1 * y0;
-    float distance2 = c * c / (a * a + b * b);
-    // If distance between the center point and the line > the radius,
-    // the line doesn't cross (or is contained by) the ellipse.
-    if (distance2 > radius2)
-        return false;
-
-    // The nearest point on the line is between p0 and p1?
-    float x = - a * c / (a * a + b * b);
-    float y = - b * c / (a * a + b * b);
-    return (((x0 <= x && x <= x1) || (x0 >= x && x >= x1))
-        && ((y0 <= y && y <= y1) || (y1 <= y && y <= y0)));
-}
-
-bool FloatQuad::intersectsCircle(const FloatPoint& center, float radius) const
-{
-    return containsPoint(center) // The circle may be totally contained by the quad.
-        || lineIntersectsCircle(center, radius, m_p1, m_p2)
-        || lineIntersectsCircle(center, radius, m_p2, m_p3)
-        || lineIntersectsCircle(center, radius, m_p3, m_p4)
-        || lineIntersectsCircle(center, radius, m_p4, m_p1);
-}
-
-bool FloatQuad::intersectsEllipse(const FloatPoint& center, const FloatSize& radii) const
-{
-    // Transform the ellipse to an origin-centered circle whose radius is the product of major radius and minor radius.
-    // Here we apply the same transformation to the quad.
-    FloatQuad transformedQuad(*this);
-    transformedQuad.move(-center.x(), -center.y());
-    transformedQuad.scale(radii.height(), radii.width());
-
-    FloatPoint originPoint;
-    return transformedQuad.intersectsCircle(originPoint, radii.height() * radii.width());
-
-}
-
-bool FloatQuad::isCounterclockwise() const
-{
-    // Return if the two first vectors are turning clockwise. If the quad is convex then all following vectors will turn the same way.
-    return determinant(m_p2 - m_p1, m_p3 - m_p2) < 0;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/graphics/FloatQuad.h b/Source/core/platform/graphics/FloatQuad.h
deleted file mode 100644
index 3a8e822..0000000
--- a/Source/core/platform/graphics/FloatQuad.h
+++ /dev/null
@@ -1,180 +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.
- * 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.
- *
- * 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 FloatQuad_h
-#define FloatQuad_h
-
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/IntRect.h"
-
-namespace WebCore {
-
-// A FloatQuad is a collection of 4 points, often representing the result of
-// mapping a rectangle through transforms. When initialized from a rect, the
-// points are in clockwise order from top left.
-class FloatQuad {
-public:
-    FloatQuad()
-    {
-    }
-
-    FloatQuad(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& p3, const FloatPoint& p4)
-        : m_p1(p1)
-        , m_p2(p2)
-        , m_p3(p3)
-        , m_p4(p4)
-    {
-    }
-
-    FloatQuad(const FloatRect& inRect)
-        : m_p1(inRect.location())
-        , m_p2(inRect.maxX(), inRect.y())
-        , m_p3(inRect.maxX(), inRect.maxY())
-        , m_p4(inRect.x(), inRect.maxY())
-    {
-    }
-
-    FloatPoint p1() const { return m_p1; }
-    FloatPoint p2() const { return m_p2; }
-    FloatPoint p3() const { return m_p3; }
-    FloatPoint p4() const { return m_p4; }
-
-    void setP1(const FloatPoint& p) { m_p1 = p; }
-    void setP2(const FloatPoint& p) { m_p2 = p; }
-    void setP3(const FloatPoint& p) { m_p3 = p; }
-    void setP4(const FloatPoint& p) { m_p4 = p; }
-
-    // isEmpty tests that the bounding box is empty. This will not identify
-    // "slanted" empty quads.
-    bool isEmpty() const { return boundingBox().isEmpty(); }
-
-    // Tests whether this quad can be losslessly represented by a FloatRect,
-    // that is, if two edges are parallel to the x-axis and the other two
-    // are parallel to the y-axis. If this method returns true, the
-    // corresponding FloatRect can be retrieved with boundingBox().
-    bool isRectilinear() const;
-
-    // Tests whether the given point is inside, or on an edge or corner of this quad.
-    bool containsPoint(const FloatPoint&) const;
-
-    // Tests whether the four corners of other are inside, or coincident with the sides of this quad.
-    // Note that this only works for convex quads, but that includes all quads that originate
-    // from transformed rects.
-    bool containsQuad(const FloatQuad&) const;
-
-    // Tests whether any part of the rectangle intersects with this quad.
-    // This only works for convex quads.
-    bool intersectsRect(const FloatRect&) const;
-
-    // Test whether any part of the circle/ellipse intersects with this quad.
-    // Note that these two functions only work for convex quads.
-    bool intersectsCircle(const FloatPoint& center, float radius) const;
-    bool intersectsEllipse(const FloatPoint& center, const FloatSize& radii) const;
-
-    // The center of the quad. If the quad is the result of a affine-transformed rectangle this is the same as the original center transformed.
-    FloatPoint center() const
-    {
-        return FloatPoint((m_p1.x() + m_p2.x() + m_p3.x() + m_p4.x()) / 4.0,
-                          (m_p1.y() + m_p2.y() + m_p3.y() + m_p4.y()) / 4.0);
-    }
-
-    FloatRect boundingBox() const;
-    IntRect enclosingBoundingBox() const
-    {
-        return enclosingIntRect(boundingBox());
-    }
-
-    void move(const FloatSize& offset)
-    {
-        m_p1 += offset;
-        m_p2 += offset;
-        m_p3 += offset;
-        m_p4 += offset;
-    }
-
-    void move(float dx, float dy)
-    {
-        m_p1.move(dx, dy);
-        m_p2.move(dx, dy);
-        m_p3.move(dx, dy);
-        m_p4.move(dx, dy);
-    }
-
-    void scale(float dx, float dy)
-    {
-        m_p1.scale(dx, dy);
-        m_p2.scale(dx, dy);
-        m_p3.scale(dx, dy);
-        m_p4.scale(dx, dy);
-    }
-
-    // Tests whether points are in clock-wise, or counter clock-wise order.
-    // Note that output is undefined when all points are colinear.
-    bool isCounterclockwise() const;
-
-private:
-    FloatPoint m_p1;
-    FloatPoint m_p2;
-    FloatPoint m_p3;
-    FloatPoint m_p4;
-};
-
-inline FloatQuad& operator+=(FloatQuad& a, const FloatSize& b)
-{
-    a.move(b);
-    return a;
-}
-
-inline FloatQuad& operator-=(FloatQuad& a, const FloatSize& b)
-{
-    a.move(-b.width(), -b.height());
-    return a;
-}
-
-inline bool operator==(const FloatQuad& a, const FloatQuad& b)
-{
-    return a.p1() == b.p1() &&
-           a.p2() == b.p2() &&
-           a.p3() == b.p3() &&
-           a.p4() == b.p4();
-}
-
-inline bool operator!=(const FloatQuad& a, const FloatQuad& b)
-{
-    return a.p1() != b.p1() ||
-           a.p2() != b.p2() ||
-           a.p3() != b.p3() ||
-           a.p4() != b.p4();
-}
-
-}   // namespace WebCore
-
-
-#endif // FloatQuad_h
-
diff --git a/Source/core/platform/graphics/FloatRect.cpp b/Source/core/platform/graphics/FloatRect.cpp
deleted file mode 100644
index d37da05..0000000
--- a/Source/core/platform/graphics/FloatRect.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2005 Nokia.  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,
- * 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/graphics/FloatRect.h"
-
-#include "core/platform/FloatConversion.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/LayoutRect.h"
-#include "third_party/skia/include/core/SkRect.h"
-#include "wtf/MathExtras.h"
-
-#include <algorithm>
-#include <math.h>
-
-using std::max;
-using std::min;
-
-namespace WebCore {
-
-FloatRect::FloatRect(const IntRect& r) : m_location(r.location()), m_size(r.size())
-{
-}
-
-FloatRect::FloatRect(const LayoutRect& r) : m_location(r.location()), m_size(r.size())
-{
-}
-
-FloatRect::FloatRect(const SkRect& r) : m_location(r.fLeft, r.fTop), m_size(r.width(), r.height())
-{
-}
-
-FloatRect FloatRect::narrowPrecision(double x, double y, double width, double height)
-{
-    return FloatRect(narrowPrecisionToFloat(x), narrowPrecisionToFloat(y), narrowPrecisionToFloat(width), narrowPrecisionToFloat(height));
-}
-
-bool FloatRect::isExpressibleAsIntRect() const
-{
-    return isWithinIntRange(x()) && isWithinIntRange(y())
-        && isWithinIntRange(width()) && isWithinIntRange(height())
-        && isWithinIntRange(maxX()) && isWithinIntRange(maxY());
-}
-
-bool FloatRect::intersects(const FloatRect& other) const
-{
-    // Checking emptiness handles negative widths as well as zero.
-    return !isEmpty() && !other.isEmpty()
-        && x() < other.maxX() && other.x() < maxX()
-        && y() < other.maxY() && other.y() < maxY();
-}
-
-bool FloatRect::contains(const FloatRect& other) const
-{
-    return x() <= other.x() && maxX() >= other.maxX()
-        && y() <= other.y() && maxY() >= other.maxY();
-}
-
-bool FloatRect::contains(const FloatPoint& point, ContainsMode containsMode) const
-{
-    if (containsMode == InsideOrOnStroke)
-        return contains(point.x(), point.y());
-    return x() < point.x() && maxX() > point.x() && y() < point.y() && maxY() > point.y();
-}
-
-void FloatRect::intersect(const FloatRect& other)
-{
-    float l = max(x(), other.x());
-    float t = max(y(), other.y());
-    float r = min(maxX(), other.maxX());
-    float b = min(maxY(), other.maxY());
-
-    // Return a clean empty rectangle for non-intersecting cases.
-    if (l >= r || t >= b) {
-        l = 0;
-        t = 0;
-        r = 0;
-        b = 0;
-    }
-
-    setLocationAndSizeFromEdges(l, t, r, b);
-}
-
-void FloatRect::unite(const FloatRect& other)
-{
-    // Handle empty special cases first.
-    if (other.isEmpty())
-        return;
-    if (isEmpty()) {
-        *this = other;
-        return;
-    }
-
-    uniteEvenIfEmpty(other);
-}
-
-void FloatRect::uniteEvenIfEmpty(const FloatRect& other)
-{
-    float minX = min(x(), other.x());
-    float minY = min(y(), other.y());
-    float maxX = max(this->maxX(), other.maxX());
-    float maxY = max(this->maxY(), other.maxY());
-
-    setLocationAndSizeFromEdges(minX, minY, maxX, maxY);
-}
-
-void FloatRect::uniteIfNonZero(const FloatRect& other)
-{
-    // Handle empty special cases first.
-    if (other.isZero())
-        return;
-    if (isZero()) {
-        *this = other;
-        return;
-    }
-
-    uniteEvenIfEmpty(other);
-}
-
-void FloatRect::extend(const FloatPoint& p)
-{
-    float minX = min(x(), p.x());
-    float minY = min(y(), p.y());
-    float maxX = max(this->maxX(), p.x());
-    float maxY = max(this->maxY(), p.y());
-
-    setLocationAndSizeFromEdges(minX, minY, maxX, maxY);
-}
-
-void FloatRect::scale(float sx, float sy)
-{
-    m_location.setX(x() * sx);
-    m_location.setY(y() * sy);
-    m_size.setWidth(width() * sx);
-    m_size.setHeight(height() * sy);
-}
-
-FloatRect unionRect(const Vector<FloatRect>& rects)
-{
-    FloatRect result;
-
-    size_t count = rects.size();
-    for (size_t i = 0; i < count; ++i)
-        result.unite(rects[i]);
-
-    return result;
-}
-
-void FloatRect::fitToPoints(const FloatPoint& p0, const FloatPoint& p1)
-{
-    float left = min(p0.x(), p1.x());
-    float top = min(p0.y(), p1.y());
-    float right = max(p0.x(), p1.x());
-    float bottom = max(p0.y(), p1.y());
-
-    setLocationAndSizeFromEdges(left, top, right, bottom);
-}
-
-namespace {
-// Helpers for 3- and 4-way max and min.
-
-template <typename T>
-T min3(const T& v1, const T& v2, const T& v3)
-{
-    return min(min(v1, v2), v3);
-}
-
-template <typename T>
-T max3(const T& v1, const T& v2, const T& v3)
-{
-    return max(max(v1, v2), v3);
-}
-
-template <typename T>
-T min4(const T& v1, const T& v2, const T& v3, const T& v4)
-{
-    return min(min(v1, v2), min(v3, v4));
-}
-
-template <typename T>
-T max4(const T& v1, const T& v2, const T& v3, const T& v4)
-{
-    return max(max(v1, v2), max(v3, v4));
-}
-
-} // anonymous namespace
-
-void FloatRect::fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const FloatPoint& p2)
-{
-    float left = min3(p0.x(), p1.x(), p2.x());
-    float top = min3(p0.y(), p1.y(), p2.y());
-    float right = max3(p0.x(), p1.x(), p2.x());
-    float bottom = max3(p0.y(), p1.y(), p2.y());
-
-    setLocationAndSizeFromEdges(left, top, right, bottom);
-}
-
-void FloatRect::fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& p3)
-{
-    float left = min4(p0.x(), p1.x(), p2.x(), p3.x());
-    float top = min4(p0.y(), p1.y(), p2.y(), p3.y());
-    float right = max4(p0.x(), p1.x(), p2.x(), p3.x());
-    float bottom = max4(p0.y(), p1.y(), p2.y(), p3.y());
-
-    setLocationAndSizeFromEdges(left, top, right, bottom);
-}
-
-FloatRect::operator SkRect() const
-{
-    SkRect rect = { x(), y(), maxX(), maxY() };
-    return rect;
-}
-
-IntRect enclosingIntRect(const FloatRect& rect)
-{
-    IntPoint location = flooredIntPoint(rect.minXMinYCorner());
-    IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner());
-
-    return IntRect(location, maxPoint - location);
-}
-
-IntRect enclosedIntRect(const FloatRect& rect)
-{
-    IntPoint location = ceiledIntPoint(rect.minXMinYCorner());
-    IntPoint maxPoint = flooredIntPoint(rect.maxXMaxYCorner());
-    IntSize size = maxPoint - location;
-    size.clampNegativeToZero();
-
-    return IntRect(location, size);
-}
-
-IntRect roundedIntRect(const FloatRect& rect)
-{
-    return IntRect(roundedIntPoint(rect.location()), roundedIntSize(rect.size()));
-}
-
-FloatRect mapRect(const FloatRect& r, const FloatRect& srcRect, const FloatRect& destRect)
-{
-    if (srcRect.width() == 0 || srcRect.height() == 0)
-        return FloatRect();
-
-    float widthScale = destRect.width() / srcRect.width();
-    float heightScale = destRect.height() / srcRect.height();
-    return FloatRect(destRect.x() + (r.x() - srcRect.x()) * widthScale,
-                     destRect.y() + (r.y() - srcRect.y()) * heightScale,
-                     r.width() * widthScale, r.height() * heightScale);
-}
-
-}
diff --git a/Source/core/platform/graphics/FloatRect.h b/Source/core/platform/graphics/FloatRect.h
deleted file mode 100644
index e0b631f..0000000
--- a/Source/core/platform/graphics/FloatRect.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2005 Nokia.  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,
- * 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 FloatRect_h
-#define FloatRect_h
-
-#include "core/platform/graphics/FloatPoint.h"
-#include "wtf/Vector.h"
-
-#if OS(MACOSX)
-typedef struct CGRect CGRect;
-#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
-typedef struct CGRect NSRect;
-#else
-typedef struct _NSRect NSRect;
-#endif
-#endif
-
-struct SkRect;
-
-namespace WebCore {
-
-class LayoutRect;
-class IntRect;
-class IntPoint;
-
-class FloatRect {
-public:
-    enum ContainsMode {
-        InsideOrOnStroke,
-        InsideButNotOnStroke
-    };
-
-    FloatRect() { }
-    FloatRect(const FloatPoint& location, const FloatSize& size)
-        : m_location(location), m_size(size) { }
-    FloatRect(float x, float y, float width, float height)
-        : m_location(FloatPoint(x, y)), m_size(FloatSize(width, height)) { }
-    FloatRect(const IntRect&);
-    FloatRect(const LayoutRect&);
-    FloatRect(const SkRect&);
-
-    static FloatRect narrowPrecision(double x, double y, double width, double height);
-
-    FloatPoint location() const { return m_location; }
-    FloatSize size() const { return m_size; }
-
-    void setLocation(const FloatPoint& location) { m_location = location; }
-    void setSize(const FloatSize& size) { m_size = size; }
-
-    float x() const { return m_location.x(); }
-    float y() const { return m_location.y(); }
-    float maxX() const { return x() + width(); }
-    float maxY() const { return y() + height(); }
-    float width() const { return m_size.width(); }
-    float height() const { return m_size.height(); }
-
-    void setX(float x) { m_location.setX(x); }
-    void setY(float y) { m_location.setY(y); }
-    void setWidth(float width) { m_size.setWidth(width); }
-    void setHeight(float height) { m_size.setHeight(height); }
-
-    bool isEmpty() const { return m_size.isEmpty(); }
-    bool isZero() const { return m_size.isZero(); }
-    bool isExpressibleAsIntRect() const;
-
-    FloatPoint center() const { return FloatPoint(x() + width() / 2, y() + height() / 2); }
-
-    void move(const FloatSize& delta) { m_location += delta; }
-    void moveBy(const FloatPoint& delta) { m_location.move(delta.x(), delta.y()); }
-    void move(float dx, float dy) { m_location.move(dx, dy); }
-
-    void expand(const FloatSize& size) { m_size += size; }
-    void expand(float dw, float dh) { m_size.expand(dw, dh); }
-    void contract(const FloatSize& size) { m_size -= size; }
-    void contract(float dw, float dh) { m_size.expand(-dw, -dh); }
-
-    void shiftXEdgeTo(float edge)
-    {
-        float delta = edge - x();
-        setX(edge);
-        setWidth(std::max(0.0f, width() - delta));
-    }
-    void shiftMaxXEdgeTo(float edge)
-    {
-        float delta = edge - maxX();
-        setWidth(std::max(0.0f, width() + delta));
-    }
-    void shiftYEdgeTo(float edge)
-    {
-        float delta = edge - y();
-        setY(edge);
-        setHeight(std::max(0.0f, height() - delta));
-    }
-    void shiftMaxYEdgeTo(float edge)
-    {
-        float delta = edge - maxY();
-        setHeight(std::max(0.0f, height() + delta));
-    }
-
-    FloatPoint minXMinYCorner() const { return m_location; } // typically topLeft
-    FloatPoint maxXMinYCorner() const { return FloatPoint(m_location.x() + m_size.width(), m_location.y()); } // typically topRight
-    FloatPoint minXMaxYCorner() const { return FloatPoint(m_location.x(), m_location.y() + m_size.height()); } // typically bottomLeft
-    FloatPoint maxXMaxYCorner() const { return FloatPoint(m_location.x() + m_size.width(), m_location.y() + m_size.height()); } // typically bottomRight
-
-    bool intersects(const FloatRect&) const;
-    bool contains(const FloatRect&) const;
-    bool contains(const FloatPoint&, ContainsMode = InsideOrOnStroke) const;
-
-    void intersect(const FloatRect&);
-    void unite(const FloatRect&);
-    void uniteEvenIfEmpty(const FloatRect&);
-    void uniteIfNonZero(const FloatRect&);
-    void extend(const FloatPoint&);
-
-    // Note, this doesn't match what IntRect::contains(IntPoint&) does; the int version
-    // is really checking for containment of 1x1 rect, but that doesn't make sense with floats.
-    bool contains(float px, float py) const
-        { return px >= x() && px <= maxX() && py >= y() && py <= maxY(); }
-
-    void inflateX(float dx) {
-        m_location.setX(m_location.x() - dx);
-        m_size.setWidth(m_size.width() + dx + dx);
-    }
-    void inflateY(float dy) {
-        m_location.setY(m_location.y() - dy);
-        m_size.setHeight(m_size.height() + dy + dy);
-    }
-    void inflate(float d) { inflateX(d); inflateY(d); }
-    void scale(float s) { scale(s, s); }
-    void scale(float sx, float sy);
-
-    FloatRect transposedRect() const { return FloatRect(m_location.transposedPoint(), m_size.transposedSize()); }
-
-    // Re-initializes this rectangle to fit the sets of passed points.
-    void fitToPoints(const FloatPoint& p0, const FloatPoint& p1);
-    void fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const FloatPoint& p2);
-    void fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& p3);
-
-#if OS(MACOSX)
-    FloatRect(const CGRect&);
-    operator CGRect() const;
-#if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
-    FloatRect(const NSRect&);
-    operator NSRect() const;
-#endif
-#endif
-
-    operator SkRect() const;
-
-private:
-    FloatPoint m_location;
-    FloatSize m_size;
-
-    void setLocationAndSizeFromEdges(float left, float top, float right, float bottom)
-    {
-        m_location.set(left, top);
-        m_size.setWidth(right - left);
-        m_size.setHeight(bottom - top);
-    }
-};
-
-inline FloatRect intersection(const FloatRect& a, const FloatRect& b)
-{
-    FloatRect c = a;
-    c.intersect(b);
-    return c;
-}
-
-inline FloatRect unionRect(const FloatRect& a, const FloatRect& b)
-{
-    FloatRect c = a;
-    c.unite(b);
-    return c;
-}
-
-FloatRect unionRect(const Vector<FloatRect>&);
-
-inline FloatRect& operator+=(FloatRect& a, const FloatRect& b)
-{
-    a.move(b.x(), b.y());
-    a.setWidth(a.width() + b.width());
-    a.setHeight(a.height() + b.height());
-    return a;
-}
-
-inline FloatRect operator+(const FloatRect& a, const FloatRect& b)
-{
-    FloatRect c = a;
-    c += b;
-    return c;
-}
-
-inline bool operator==(const FloatRect& a, const FloatRect& b)
-{
-    return a.location() == b.location() && a.size() == b.size();
-}
-
-inline bool operator!=(const FloatRect& a, const FloatRect& b)
-{
-    return a.location() != b.location() || a.size() != b.size();
-}
-
-IntRect enclosingIntRect(const FloatRect&);
-
-// Returns a valid IntRect contained within the given FloatRect.
-IntRect enclosedIntRect(const FloatRect&);
-
-IntRect roundedIntRect(const FloatRect&);
-
-// Map rect r from srcRect to an equivalent rect in destRect.
-FloatRect mapRect(const FloatRect& r, const FloatRect& srcRect, const FloatRect& destRect);
-
-}
-
-#endif
diff --git a/Source/core/platform/graphics/FloatSize.cpp b/Source/core/platform/graphics/FloatSize.cpp
deleted file mode 100644
index f3283b2..0000000
--- a/Source/core/platform/graphics/FloatSize.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2005 Nokia.  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,
- * 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/graphics/FloatSize.h"
-
-#include <math.h>
-#include <limits>
-#include "core/platform/FloatConversion.h"
-#include "core/platform/graphics/IntSize.h"
-#include "core/platform/graphics/LayoutSize.h"
-
-using namespace std;
-
-namespace WebCore {
-
-FloatSize::FloatSize(const IntSize& size) : m_width(size.width()), m_height(size.height())
-{
-}
-
-FloatSize::FloatSize(const LayoutSize& size) : m_width(size.width()), m_height(size.height())
-{
-}
-
-float FloatSize::diagonalLength() const
-{
-    return sqrtf(diagonalLengthSquared());
-}
-
-bool FloatSize::isZero() const
-{
-    return fabs(m_width) < numeric_limits<float>::epsilon() && fabs(m_height) < numeric_limits<float>::epsilon();
-}
-
-bool FloatSize::isExpressibleAsIntSize() const
-{
-    return isWithinIntRange(m_width) && isWithinIntRange(m_height);
-}
-
-FloatSize FloatSize::narrowPrecision(double width, double height)
-{
-    return FloatSize(narrowPrecisionToFloat(width), narrowPrecisionToFloat(height));
-}
-
-}
diff --git a/Source/core/platform/graphics/FloatSize.h b/Source/core/platform/graphics/FloatSize.h
deleted file mode 100644
index 320fa67..0000000
--- a/Source/core/platform/graphics/FloatSize.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2005 Nokia.  All rights reserved.
- *               2008 Eric Seidel <eric@webkit.org>
- *
- * 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,
- * 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 FloatSize_h
-#define FloatSize_h
-
-#include "core/platform/graphics/IntPoint.h"
-#include "wtf/MathExtras.h"
-
-
-#if OS(MACOSX)
-typedef struct CGSize CGSize;
-
-#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
-typedef struct CGSize NSSize;
-#else
-typedef struct _NSSize NSSize;
-#endif
-#endif
-
-namespace WebCore {
-
-class IntSize;
-class LayoutSize;
-
-class FloatSize {
-public:
-    FloatSize() : m_width(0), m_height(0) { }
-    FloatSize(float width, float height) : m_width(width), m_height(height) { }
-    FloatSize(const IntSize&);
-    FloatSize(const LayoutSize&);
-
-    static FloatSize narrowPrecision(double width, double height);
-
-    float width() const { return m_width; }
-    float height() const { return m_height; }
-
-    void setWidth(float width) { m_width = width; }
-    void setHeight(float height) { m_height = height; }
-
-    bool isEmpty() const { return m_width <= 0 || m_height <= 0; }
-    bool isZero() const;
-    bool isExpressibleAsIntSize() const;
-
-    float aspectRatio() const { return m_width / m_height; }
-
-    void expand(float width, float height)
-    {
-        m_width += width;
-        m_height += height;
-    }
-
-    void scale(float s) { scale(s, s); }
-
-    void scale(float scaleX, float scaleY)
-    {
-        m_width *= scaleX;
-        m_height *= scaleY;
-    }
-
-    FloatSize expandedTo(const FloatSize& other) const
-    {
-        return FloatSize(m_width > other.m_width ? m_width : other.m_width,
-            m_height > other.m_height ? m_height : other.m_height);
-    }
-
-    FloatSize shrunkTo(const FloatSize& other) const
-    {
-       return FloatSize(m_width < other.m_width ? m_width : other.m_width,
-           m_height < other.m_height ? m_height : other.m_height);
-    }
-
-    float diagonalLength() const;
-    float diagonalLengthSquared() const
-    {
-        return m_width * m_width + m_height * m_height;
-    }
-
-    FloatSize transposedSize() const
-    {
-        return FloatSize(m_height, m_width);
-    }
-
-#if OS(MACOSX)
-    explicit FloatSize(const CGSize&); // don't do this implicitly since it's lossy
-    operator CGSize() const;
-#if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
-    explicit FloatSize(const NSSize &); // don't do this implicitly since it's lossy
-    operator NSSize() const;
-#endif
-#endif
-
-private:
-    float m_width, m_height;
-};
-
-inline FloatSize& operator+=(FloatSize& a, const FloatSize& b)
-{
-    a.setWidth(a.width() + b.width());
-    a.setHeight(a.height() + b.height());
-    return a;
-}
-
-inline FloatSize& operator-=(FloatSize& a, const FloatSize& b)
-{
-    a.setWidth(a.width() - b.width());
-    a.setHeight(a.height() - b.height());
-    return a;
-}
-
-inline FloatSize operator+(const FloatSize& a, const FloatSize& b)
-{
-    return FloatSize(a.width() + b.width(), a.height() + b.height());
-}
-
-inline FloatSize operator-(const FloatSize& a, const FloatSize& b)
-{
-    return FloatSize(a.width() - b.width(), a.height() - b.height());
-}
-
-inline FloatSize operator-(const FloatSize& size)
-{
-    return FloatSize(-size.width(), -size.height());
-}
-
-inline FloatSize operator*(const FloatSize& a, const float b)
-{
-    return FloatSize(a.width() * b, a.height() * b);
-}
-
-inline FloatSize operator*(const float a, const FloatSize& b)
-{
-    return FloatSize(a * b.width(), a * b.height());
-}
-
-inline bool operator==(const FloatSize& a, const FloatSize& b)
-{
-    return a.width() == b.width() && a.height() == b.height();
-}
-
-inline bool operator!=(const FloatSize& a, const FloatSize& b)
-{
-    return a.width() != b.width() || a.height() != b.height();
-}
-
-inline IntSize roundedIntSize(const FloatSize& p)
-{
-    return IntSize(clampToInteger(roundf(p.width())), clampToInteger(roundf(p.height())));
-}
-
-inline IntSize flooredIntSize(const FloatSize& p)
-{
-    return IntSize(clampToInteger(floorf(p.width())), clampToInteger(floorf(p.height())));
-}
-
-inline IntSize expandedIntSize(const FloatSize& p)
-{
-    return IntSize(clampToInteger(ceilf(p.width())), clampToInteger(ceilf(p.height())));
-}
-
-inline IntPoint flooredIntPoint(const FloatSize& p)
-{
-    return IntPoint(clampToInteger(floorf(p.width())), clampToInteger(floorf(p.height())));
-}
-
-} // namespace WebCore
-
-#endif // FloatSize_h
diff --git a/Source/core/platform/graphics/Font.cpp b/Source/core/platform/graphics/Font.cpp
index bdf6843..e0cb2e1 100644
--- a/Source/core/platform/graphics/Font.cpp
+++ b/Source/core/platform/graphics/Font.cpp
@@ -24,10 +24,9 @@
 #include "config.h"
 #include "core/platform/graphics/Font.h"
 
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/platform/graphics/WidthIterator.h"
-#include "core/platform/text/transcoder/FontTranscoder.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/graphics/TextRun.h"
 #include "wtf/MainThread.h"
 #include "wtf/MathExtras.h"
 #include "wtf/StdLibExtras.h"
@@ -40,7 +39,7 @@
 namespace WTF {
 
 // allow compilation of OwnPtr<TextLayout> in source files that don't have access to the TextLayout class definition
-template <> void deleteOwnedPtr<WebCore::TextLayout>(WebCore::TextLayout* ptr)
+void OwnedPtrDeleter<WebCore::TextLayout>::deletePtr(WebCore::TextLayout* ptr)
 {
     WebCore::Font::deleteLayout(ptr);
 }
@@ -93,7 +92,6 @@
     : m_letterSpacing(0)
     , m_wordSpacing(0)
     , m_isPlatformFont(false)
-    , m_needsTranscoding(false)
     , m_typesettingFeatures(0)
 {
 }
@@ -103,7 +101,6 @@
     , m_letterSpacing(letterSpacing)
     , m_wordSpacing(wordSpacing)
     , m_isPlatformFont(false)
-    , m_needsTranscoding(fontTranscoder().needsTranscoding(fd))
     , m_typesettingFeatures(computeTypesettingFeatures())
 {
 }
@@ -117,7 +114,6 @@
 {
     m_fontDescription.setUsePrinterFont(isPrinterFont);
     m_fontDescription.setFontSmoothing(fontSmoothingMode);
-    m_needsTranscoding = fontTranscoder().needsTranscoding(fontDescription());
     m_fontFallbackList->setPlatformFont(fontData);
 }
 
@@ -127,7 +123,6 @@
     , m_letterSpacing(other.m_letterSpacing)
     , m_wordSpacing(other.m_wordSpacing)
     , m_isPlatformFont(other.m_isPlatformFont)
-    , m_needsTranscoding(other.m_needsTranscoding)
     , m_typesettingFeatures(computeTypesettingFeatures())
 {
 }
@@ -139,7 +134,6 @@
     m_letterSpacing = other.m_letterSpacing;
     m_wordSpacing = other.m_wordSpacing;
     m_isPlatformFont = other.m_isPlatformFont;
-    m_needsTranscoding = other.m_needsTranscoding;
     m_typesettingFeatures = other.m_typesettingFeatures;
     return *this;
 }
diff --git a/Source/core/platform/graphics/Font.h b/Source/core/platform/graphics/Font.h
index 9e83145..1b08ec3 100644
--- a/Source/core/platform/graphics/Font.h
+++ b/Source/core/platform/graphics/Font.h
@@ -29,7 +29,7 @@
 #include "core/platform/graphics/FontFallbackList.h"
 #include "core/platform/graphics/SimpleFontData.h"
 #include "core/platform/graphics/TypesettingFeatures.h"
-#include "core/platform/text/TextDirection.h"
+#include "platform/text/TextDirection.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
 #include "wtf/MathExtras.h"
@@ -232,7 +232,6 @@
     static String normalizeSpaces(const LChar*, unsigned length);
     static String normalizeSpaces(const UChar*, unsigned length);
 
-    bool needsTranscoding() const { return m_needsTranscoding; }
     FontFallbackList* fontList() const { return m_fontFallbackList.get(); }
 
     void willUseFontData() const;
@@ -292,7 +291,6 @@
     float m_letterSpacing;
     float m_wordSpacing;
     bool m_isPlatformFont;
-    bool m_needsTranscoding;
     mutable unsigned m_typesettingFeatures : 2; // (TypesettingFeatures) Caches values computed from m_fontDescription.
 };
 
@@ -335,7 +333,9 @@
 
 namespace WTF {
 
-template <> void deleteOwnedPtr<WebCore::TextLayout>(WebCore::TextLayout*);
+template <> struct OwnedPtrDeleter<WebCore::TextLayout> {
+    static void deletePtr(WebCore::TextLayout*);
+};
 
 }
 
diff --git a/Source/core/platform/graphics/FontBaseline.h b/Source/core/platform/graphics/FontBaseline.h
deleted file mode 100644
index 7e416f9..0000000
--- a/Source/core/platform/graphics/FontBaseline.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2010 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,
- * 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 FontBaseline_h
-#define FontBaseline_h
-
-namespace WebCore {
-
-enum FontBaseline { AlphabeticBaseline, IdeographicBaseline };
-
-} // namespace WebCore
-
-#endif // FontBaseline_h
diff --git a/Source/core/platform/graphics/FontCache.cpp b/Source/core/platform/graphics/FontCache.cpp
index 52afec6..fa58bfc 100644
--- a/Source/core/platform/graphics/FontCache.cpp
+++ b/Source/core/platform/graphics/FontCache.cpp
@@ -36,6 +36,8 @@
 #include "core/platform/graphics/FontFallbackList.h"
 #include "core/platform/graphics/FontPlatformData.h"
 #include "core/platform/graphics/FontSelector.h"
+#include "core/platform/graphics/FontSmoothingMode.h"
+#include "core/platform/graphics/TextRenderingMode.h"
 #include "core/platform/graphics/opentype/OpenTypeVerticalData.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashTableDeletedValueType.h"
@@ -64,15 +66,34 @@
 struct FontPlatformDataCacheKey {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), float size = 0, unsigned weight = 0, bool italic = false,
-        bool isPrinterFont = false, FontOrientation orientation = Horizontal, FontWidthVariant widthVariant = RegularWidth)
-        : m_size(size * s_fontSizePrecisionMultiplier)
-        , m_weight(weight)
-        , m_family(family)
-        , m_italic(italic)
-        , m_printerFont(isPrinterFont)
-        , m_orientation(orientation)
-        , m_widthVariant(widthVariant)
+    FontPlatformDataCacheKey()
+        : m_family(AtomicString())
+        , m_size(0)
+        , m_weight(0)
+        , m_italic(false)
+        , m_printerFont(false)
+        , m_orientation(Horizontal)
+        , m_widthVariant(RegularWidth)
+        , m_textRenderingMode(AutoTextRendering)
+        , m_fontSmoothingMode(AutoSmoothing)
+    {
+    }
+
+    FontPlatformDataCacheKey(const AtomicString& family, float size, const FontDescription& fontDescription)
+        : m_family(family)
+        , m_size(size * FontCache::s_fontSizePrecisionMultiplier)
+        , m_weight(fontDescription.weight())
+        , m_italic(fontDescription.italic())
+        , m_printerFont(fontDescription.usePrinterFont())
+        , m_orientation(fontDescription.orientation())
+        , m_widthVariant(fontDescription.widthVariant())
+        , m_textRenderingMode(fontDescription.textRenderingMode())
+// -webkit-font-smoothing actually controls AppleFontSmoothing for CoreGraphics.
+#if OS(MACOSX)
+        , m_fontSmoothingMode(fontDescription.fontSmoothing())
+#else
+        , m_fontSmoothingMode(AutoSmoothing)
+#endif
     {
     }
 
@@ -81,24 +102,28 @@
 
     bool operator==(const FontPlatformDataCacheKey& other) const
     {
-        return equalIgnoringCase(m_family, other.m_family) && m_size == other.m_size
-            && m_weight == other.m_weight && m_italic == other.m_italic && m_printerFont == other.m_printerFont
-            && m_orientation == other.m_orientation && m_widthVariant == other.m_widthVariant;
+        return equalIgnoringCase(m_family, other.m_family)
+            && m_size == other.m_size
+            && m_weight == other.m_weight
+            && m_italic == other.m_italic
+            && m_printerFont == other.m_printerFont
+            && m_orientation == other.m_orientation
+            && m_widthVariant == other.m_widthVariant
+            && m_textRenderingMode == other.m_textRenderingMode
+            && m_fontSmoothingMode == other.m_fontSmoothingMode;
     }
 
+    AtomicString m_family;
     unsigned m_size;
     unsigned m_weight;
-    AtomicString m_family;
     bool m_italic;
     bool m_printerFont;
     FontOrientation m_orientation;
     FontWidthVariant m_widthVariant;
+    TextRenderingMode m_textRenderingMode;
+    FontSmoothingMode m_fontSmoothingMode;
 
 private:
-    // Multiplying the floating point size by 100 gives two decimal
-    // point precision which should be sufficient.
-    static const unsigned s_fontSizePrecisionMultiplier = 100;
-
     static unsigned hashTableDeletedSize() { return 0xFFFFFFFFU; }
 };
 
@@ -109,7 +134,11 @@
         fontKey.m_size,
         fontKey.m_weight,
         fontKey.m_widthVariant,
-        static_cast<unsigned>(fontKey.m_orientation) << 2 | static_cast<unsigned>(fontKey.m_italic) << 1 | static_cast<unsigned>(fontKey.m_printerFont)
+        static_cast<unsigned>(fontKey.m_fontSmoothingMode) << 5 | // bits 5-6
+        static_cast<unsigned>(fontKey.m_textRenderingMode) << 3 | // bits 3-4
+        static_cast<unsigned>(fontKey.m_orientation) << 2 | // bit 2
+        static_cast<unsigned>(fontKey.m_italic) << 1 | // bit 1
+        static_cast<unsigned>(fontKey.m_printerFont) // bit 0
     };
     return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
 }
@@ -130,7 +159,7 @@
 
 struct FontPlatformDataCacheKeyTraits : WTF::SimpleClassHashTraits<FontPlatformDataCacheKey> { };
 
-typedef HashMap<FontPlatformDataCacheKey, FontPlatformData*, FontPlatformDataCacheKeyHash, FontPlatformDataCacheKeyTraits> FontPlatformDataCache;
+typedef HashMap<FontPlatformDataCacheKey, OwnPtr<FontPlatformData>, FontPlatformDataCacheKeyHash, FontPlatformDataCacheKeyTraits> FontPlatformDataCache;
 
 static FontPlatformDataCache* gFontPlatformDataCache = 0;
 
@@ -203,8 +232,7 @@
 }
 
 FontPlatformData* FontCache::getFontResourcePlatformData(const FontDescription& fontDescription,
-                                                       const AtomicString& passedFamilyName,
-                                                       bool checkingAlternateName)
+    const AtomicString& passedFamilyName, bool checkingAlternateName)
 {
 #if OS(WIN) && ENABLE(OPENTYPE_VERTICAL)
     // Leading "@" in the font name enables Windows vertical flow flag for the font.
@@ -226,29 +254,27 @@
         fontSize = fontDescription.computedSize();
     else
         fontSize = fontDescription.computedPixelSize();
-    FontPlatformDataCacheKey key(familyName, fontSize, fontDescription.weight(), fontDescription.italic(),
-
-        fontDescription.usePrinterFont(), fontDescription.orientation(), fontDescription.widthVariant());
+    FontPlatformDataCacheKey key(familyName, fontSize, fontDescription);
     FontPlatformData* result = 0;
     bool foundResult;
     FontPlatformDataCache::iterator it = gFontPlatformDataCache->find(key);
     if (it == gFontPlatformDataCache->end()) {
-        result = createFontPlatformData(fontDescription, familyName);
-        gFontPlatformDataCache->set(key, result);
+        result = createFontPlatformData(fontDescription, familyName, fontSize);
+        gFontPlatformDataCache->set(key, adoptPtr(result));
         foundResult = result;
     } else {
-        result = it->value;
+        result = it->value.get();
         foundResult = true;
     }
 
     if (!foundResult && !checkingAlternateName) {
-        // We were unable to find a font.  We have a small set of fonts that we alias to other names,
-        // e.g., Arial/Helvetica, Courier/Courier New, etc.  Try looking up the font under the aliased name.
+        // We were unable to find a font. We have a small set of fonts that we alias to other names,
+        // e.g., Arial/Helvetica, Courier/Courier New, etc. Try looking up the font under the aliased name.
         const AtomicString& alternateName = alternateFamilyName(familyName);
         if (!alternateName.isEmpty())
             result = getFontResourcePlatformData(fontDescription, alternateName, true);
         if (result)
-            gFontPlatformDataCache->set(key, new FontPlatformData(*result)); // Cache the result under the old name.
+            gFontPlatformDataCache->set(key, adoptPtr(new FontPlatformData(*result))); // Cache the result under the old name.
     }
 
     return result;
@@ -368,9 +394,9 @@
         gInactiveFontData->remove(result.get()->value.first);
     }
 
-    if (shouldRetain == Retain)
+    if (shouldRetain == Retain) {
         result.get()->value.second++;
-    else if (!result.get()->value.second) {
+    } else if (!result.get()->value.second) {
         // If shouldRetain is DoNotRetain and count is 0, we want to remove the fontData from
         // gInactiveFontData (above) and re-add here to update LRU position.
         gInactiveFontData->add(result.get()->value.first);
@@ -415,7 +441,7 @@
     if (!gInactiveFontData || m_purgePreventCount)
         return;
 
-    static bool isPurging;  // Guard against reentry when e.g. a deleted FontData releases its small caps FontData.
+    static bool isPurging; // Guard against reentry when e.g. a deleted FontData releases its small caps FontData.
     if (isPurging)
         return;
 
@@ -446,13 +472,13 @@
         keysToRemove.reserveInitialCapacity(gFontPlatformDataCache->size());
         FontPlatformDataCache::iterator platformDataEnd = gFontPlatformDataCache->end();
         for (FontPlatformDataCache::iterator platformData = gFontPlatformDataCache->begin(); platformData != platformDataEnd; ++platformData) {
-            if (platformData->value && !gFontDataCache->contains(*platformData->value))
+            if (platformData->value && !gFontDataCache->contains(*platformData->value.get()))
                 keysToRemove.append(platformData->key);
         }
 
         size_t keysToRemoveCount = keysToRemove.size();
         for (size_t i = 0; i < keysToRemoveCount; ++i)
-            delete gFontPlatformDataCache->take(keysToRemove[i]);
+            gFontPlatformDataCache->remove(keysToRemove[i]);
     }
 
 #if ENABLE(OPENTYPE_VERTICAL)
@@ -522,13 +548,14 @@
     if (!currFamily)
         familyIndex = cAllFamiliesScanned;
 
-    if (!result)
+    if (!result) {
         // We didn't find a font. Try to find a similar font using our own specific knowledge about our platform.
         // For example on OS X, we know to map any families containing the words Arabic, Pashto, or Urdu to the
         // Geeza Pro font.
         result = getSimilarFontPlatformData(font);
+    }
 
-    if (!result && startIndex == 0) {
+    if (!result && !startIndex) {
         // If it's the primary font that we couldn't find, we try the following. In all other cases, we will
         // just use per-character system fallback.
 
@@ -538,7 +565,7 @@
                 return data.release();
         }
 
-        // Still no result.  Hand back our last resort fallback font.
+        // Still no result. Hand back our last resort fallback font.
         result = getLastResortFallbackFont(font.fontDescription());
     }
     return result.release();
@@ -578,7 +605,6 @@
     }
 
     if (gFontPlatformDataCache) {
-        deleteAllValues(*gFontPlatformDataCache);
         delete gFontPlatformDataCache;
         gFontPlatformDataCache = new FontPlatformDataCache;
     }
diff --git a/Source/core/platform/graphics/FontCache.h b/Source/core/platform/graphics/FontCache.h
index 882b5ee..2289553 100644
--- a/Source/core/platform/graphics/FontCache.h
+++ b/Source/core/platform/graphics/FontCache.h
@@ -106,12 +106,20 @@
     PassRefPtr<OpenTypeVerticalData> getVerticalData(const FontFileKey&, const FontPlatformData&);
 #endif
 
+#if OS(ANDROID)
+    static AtomicString getGenericFamilyNameForScript(const AtomicString& familyName, UScriptCode);
+#else
     struct SimpleFontFamily {
         String name;
         bool isBold;
         bool isItalic;
     };
     static void getFontFamilyForCharacter(UChar32, const char* preferredLocale, SimpleFontFamily*);
+#endif
+
+    // Multiplying the floating point size by 100 gives two decimal
+    // point precision which should be sufficient.
+    static const unsigned s_fontSizePrecisionMultiplier = 100;
 
 private:
     FontCache();
@@ -132,7 +140,7 @@
 
     // These methods are implemented by each platform.
     PassRefPtr<SimpleFontData> getSimilarFontPlatformData(const Font&);
-    FontPlatformData* createFontPlatformData(const FontDescription&, const AtomicString& family);
+    FontPlatformData* createFontPlatformData(const FontDescription&, const AtomicString& family, float fontSize);
 
     // Implemented on skia platforms.
     SkTypeface* createTypeface(const FontDescription&, const AtomicString& family, CString& name);
diff --git a/Source/core/platform/graphics/FontCustomPlatformData.h b/Source/core/platform/graphics/FontCustomPlatformData.h
index f07a117..7a040e4 100644
--- a/Source/core/platform/graphics/FontCustomPlatformData.h
+++ b/Source/core/platform/graphics/FontCustomPlatformData.h
@@ -64,7 +64,7 @@
     static PassOwnPtr<FontCustomPlatformData> create(SharedBuffer*);
     ~FontCustomPlatformData();
 
-    FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
+    FontPlatformData fontPlatformData(float size, bool bold, bool italic, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
 
     static bool supportsFormat(const String&);
 
diff --git a/Source/core/platform/graphics/FontData.cpp b/Source/core/platform/graphics/FontData.cpp
deleted file mode 100644
index 6044933..0000000
--- a/Source/core/platform/graphics/FontData.cpp
+++ /dev/null
@@ -1,35 +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 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,
- * 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/graphics/FontData.h"
-
-namespace WebCore {
-
-FontData::~FontData()
-{
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/graphics/FontData.h b/Source/core/platform/graphics/FontData.h
deleted file mode 100644
index f4d64ab..0000000
--- a/Source/core/platform/graphics/FontData.h
+++ /dev/null
@@ -1,69 +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 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,
- * 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 FontData_h
-#define FontData_h
-
-#include "wtf/FastAllocBase.h"
-#include "wtf/Forward.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/unicode/Unicode.h"
-
-namespace WebCore {
-
-class SimpleFontData;
-
-class FontData : public RefCounted<FontData> {
-    WTF_MAKE_NONCOPYABLE(FontData); WTF_MAKE_FAST_ALLOCATED;
-public:
-    FontData()
-        : m_maxGlyphPageTreeLevel(0)
-    {
-    }
-
-    virtual ~FontData();
-
-    virtual const SimpleFontData* fontDataForCharacter(UChar32) const = 0;
-    virtual bool containsCharacters(const UChar*, int length) const = 0;
-    virtual bool isCustomFont() const = 0;
-    virtual bool isLoading() const = 0;
-    virtual bool isSegmented() const = 0;
-
-    void setMaxGlyphPageTreeLevel(unsigned level) const { m_maxGlyphPageTreeLevel = level; }
-    unsigned maxGlyphPageTreeLevel() const { return m_maxGlyphPageTreeLevel; }
-
-#ifndef NDEBUG
-    virtual String description() const = 0;
-#endif
-
-private:
-    mutable unsigned m_maxGlyphPageTreeLevel;
-};
-
-} // namespace WebCore
-
-#endif // FontData_h
diff --git a/Source/core/platform/graphics/FontDescription.h b/Source/core/platform/graphics/FontDescription.h
index 7aa1522..d2e4f2e 100644
--- a/Source/core/platform/graphics/FontDescription.h
+++ b/Source/core/platform/graphics/FontDescription.h
@@ -26,14 +26,14 @@
 #define FontDescription_h
 
 #include "FontFamilyNames.h"
-#include "core/platform/graphics/FontFamily.h"
-#include "core/platform/graphics/FontFeatureSettings.h"
 #include "core/platform/graphics/FontOrientation.h"
 #include "core/platform/graphics/FontSmoothingMode.h"
 #include "core/platform/graphics/FontTraitsMask.h"
 #include "core/platform/graphics/FontWidthVariant.h"
 #include "core/platform/graphics/TextRenderingMode.h"
-#include "core/platform/text/NonCJKGlyphOrientation.h"
+#include "platform/fonts/FontFamily.h"
+#include "platform/fonts/FontFeatureSettings.h"
+#include "platform/text/NonCJKGlyphOrientation.h"
 #include "wtf/MathExtras.h"
 
 #include "wtf/RefPtr.h"
diff --git a/Source/core/platform/graphics/FontFallbackList.cpp b/Source/core/platform/graphics/FontFallbackList.cpp
index a68e8ba..9152bf8 100644
--- a/Source/core/platform/graphics/FontFallbackList.cpp
+++ b/Source/core/platform/graphics/FontFallbackList.cpp
@@ -103,6 +103,30 @@
     return false;
 }
 
+const FontData* FontFallbackList::primaryFontData(const Font* f) const
+{
+    for (unsigned fontIndex = 0; ; ++fontIndex) {
+        const FontData* fontData = fontDataAt(f, fontIndex);
+        if (!fontData) {
+            // All fonts are custom fonts and are loading. Return the first FontData.
+            // FIXME: Correct fallback to the default font.
+            return fontDataAt(f, 0);
+        }
+
+        // When a custom font is loading, we should use the correct fallback font to layout the text.
+        // Here skip the temporary font for the loading custom font which may not act as the correct fallback font.
+        if (!fontData->isLoadingFallback())
+            return fontData;
+
+        // Begin to load the first custom font if needed.
+        if (!fontIndex) {
+            const SimpleFontData* simpleFontData = fontData->fontDataForCharacter(' ');
+            if (simpleFontData)
+                simpleFontData->beginLoadIfNeeded();
+        }
+    }
+}
+
 const FontData* FontFallbackList::fontDataAt(const Font* font, unsigned realizedFontIndex) const
 {
     if (realizedFontIndex < m_fontList.size())
diff --git a/Source/core/platform/graphics/FontFallbackList.h b/Source/core/platform/graphics/FontFallbackList.h
index a952158..9f4a4d3 100644
--- a/Source/core/platform/graphics/FontFallbackList.h
+++ b/Source/core/platform/graphics/FontFallbackList.h
@@ -88,15 +88,12 @@
     const SimpleFontData* primarySimpleFontData(const Font* f)
     {
         ASSERT(isMainThread());
-        if (!m_cachedPrimarySimpleFontData) {
+        if (!m_cachedPrimarySimpleFontData)
             m_cachedPrimarySimpleFontData = primaryFontData(f)->fontDataForCharacter(' ');
-            if (m_cachedPrimarySimpleFontData)
-                m_cachedPrimarySimpleFontData->beginLoadIfNeeded();
-        }
         return m_cachedPrimarySimpleFontData;
     }
 
-    const FontData* primaryFontData(const Font* f) const { return fontDataAt(f, 0); }
+    const FontData* primaryFontData(const Font*) const;
     const FontData* fontDataAt(const Font*, unsigned index) const;
 
     void setPlatformFont(const FontPlatformData&);
diff --git a/Source/core/platform/graphics/FontFamily.cpp b/Source/core/platform/graphics/FontFamily.cpp
deleted file mode 100644
index 513c2bf..0000000
--- a/Source/core/platform/graphics/FontFamily.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2004, 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 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,
- * 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/graphics/FontFamily.h"
-
-namespace WebCore {
-
-bool operator==(const FontFamily& a, const FontFamily& b)
-{
-    if (a.family() != b.family())
-        return false;
-    const FontFamily* ap;
-    const FontFamily* bp;
-    for (ap = a.next(), bp = b.next(); ap != bp; ap = ap->next(), bp = bp->next()) {
-        if (!ap || !bp)
-            return false;
-        if (ap->family() != bp->family())
-            return false;
-    }
-    return true;
-}
-
-}
diff --git a/Source/core/platform/graphics/FontFamily.h b/Source/core/platform/graphics/FontFamily.h
deleted file mode 100644
index 6c032ed..0000000
--- a/Source/core/platform/graphics/FontFamily.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 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 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,
- * 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 FontFamily_h
-#define FontFamily_h
-
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-class SharedFontFamily;
-
-class FontFamily {
-public:
-    FontFamily() { }
-    ~FontFamily();
-
-    void setFamily(const AtomicString& family) { m_family = family; }
-    const AtomicString& family() const { return m_family; }
-    bool familyIsEmpty() const { return m_family.isEmpty(); }
-
-    const FontFamily* next() const;
-
-    void appendFamily(PassRefPtr<SharedFontFamily>);
-    PassRefPtr<SharedFontFamily> releaseNext();
-
-private:
-    AtomicString m_family;
-    RefPtr<SharedFontFamily> m_next;
-};
-
-class SharedFontFamily : public FontFamily, public RefCounted<SharedFontFamily> {
-public:
-    static PassRefPtr<SharedFontFamily> create()
-    {
-        return adoptRef(new SharedFontFamily);
-    }
-
-private:
-    SharedFontFamily() { }
-};
-
-bool operator==(const FontFamily&, const FontFamily&);
-inline bool operator!=(const FontFamily& a, const FontFamily& b) { return !(a == b); }
-
-inline FontFamily::~FontFamily()
-{
-    RefPtr<SharedFontFamily> reaper = m_next.release();
-    while (reaper && reaper->hasOneRef())
-        reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper
-}
-
-inline const FontFamily* FontFamily::next() const
-{
-    return m_next.get();
-}
-
-inline void FontFamily::appendFamily(PassRefPtr<SharedFontFamily> family)
-{
-    m_next = family;
-}
-
-inline PassRefPtr<SharedFontFamily> FontFamily::releaseNext()
-{
-    return m_next.release();
-}
-
-}
-
-#endif
diff --git a/Source/core/platform/graphics/FontFastPath.cpp b/Source/core/platform/graphics/FontFastPath.cpp
index aae868a..db9684d 100644
--- a/Source/core/platform/graphics/FontFastPath.cpp
+++ b/Source/core/platform/graphics/FontFastPath.cpp
@@ -23,14 +23,14 @@
 #include "config.h"
 #include "core/platform/graphics/Font.h"
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/FontFallbackList.h"
 #include "core/platform/graphics/GlyphBuffer.h"
 #include "core/platform/graphics/GlyphPageTreeNode.h"
 #include "core/platform/graphics/SimpleFontData.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/platform/graphics/WidthIterator.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/graphics/TextRun.h"
 #include "wtf/MainThread.h"
 #include "wtf/MathExtras.h"
 #include "wtf/unicode/CharacterNames.h"
diff --git a/Source/core/platform/graphics/FontFeatureSettings.cpp b/Source/core/platform/graphics/FontFeatureSettings.cpp
deleted file mode 100644
index 8ea3ee3..0000000
--- a/Source/core/platform/graphics/FontFeatureSettings.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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,
- * 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/graphics/FontFeatureSettings.h"
-
-namespace WebCore {
-
-FontFeature::FontFeature(const AtomicString& tag, int value)
-    : m_tag(tag)
-    , m_value(value)
-{
-}
-
-bool FontFeature::operator==(const FontFeature& other)
-{
-    return m_tag == other.m_tag && m_value == other.m_value;
-}
-
-FontFeatureSettings::FontFeatureSettings()
-{
-}
-
-}
diff --git a/Source/core/platform/graphics/FontFeatureSettings.h b/Source/core/platform/graphics/FontFeatureSettings.h
deleted file mode 100644
index b40c4bf..0000000
--- a/Source/core/platform/graphics/FontFeatureSettings.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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,
- * 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 FontFeatureSettings_h
-#define FontFeatureSettings_h
-
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-class FontFeature {
-public:
-    FontFeature(const AtomicString& tag, int value);
-    bool operator==(const FontFeature&);
-
-    const AtomicString& tag() const { return m_tag; }
-    int value() const { return m_value; }
-
-private:
-    AtomicString m_tag;
-    const int m_value;
-};
-
-class FontFeatureSettings : public RefCounted<FontFeatureSettings> {
-public:
-    static PassRefPtr<FontFeatureSettings> create()
-    {
-        return adoptRef(new FontFeatureSettings());
-    }
-    void append(const FontFeature& feature) { m_list.append(feature); }
-    size_t size() const { return m_list.size(); }
-    const FontFeature& operator[](int index) const { return m_list[index]; }
-    const FontFeature& at(size_t index) const { return m_list.at(index); }
-
-private:
-    FontFeatureSettings();
-    Vector<FontFeature> m_list;
-};
-
-}
-
-#endif // FontFeatureSettings_h
diff --git a/Source/core/platform/graphics/FontMetrics.h b/Source/core/platform/graphics/FontMetrics.h
index 5f0073a..dbf1636 100644
--- a/Source/core/platform/graphics/FontMetrics.h
+++ b/Source/core/platform/graphics/FontMetrics.h
@@ -20,7 +20,7 @@
 #ifndef FontMetrics_h
 #define FontMetrics_h
 
-#include "core/platform/graphics/FontBaseline.h"
+#include "platform/fonts/FontBaseline.h"
 #include "wtf/MathExtras.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/FrameData.cpp b/Source/core/platform/graphics/FrameData.cpp
index 17b4085..4554fe4 100644
--- a/Source/core/platform/graphics/FrameData.cpp
+++ b/Source/core/platform/graphics/FrameData.cpp
@@ -53,6 +53,7 @@
         m_haveMetadata = false;
 
     m_orientation = DefaultImageOrientation;
+    m_frameBytes = 0;
 
     if (m_frame) {
         m_frame.clear();
diff --git a/Source/core/platform/graphics/FrameData.h b/Source/core/platform/graphics/FrameData.h
index a2c2381..f27857f 100644
--- a/Source/core/platform/graphics/FrameData.h
+++ b/Source/core/platform/graphics/FrameData.h
@@ -28,7 +28,7 @@
 #ifndef FrameData_h
 #define FrameData_h
 
-#include "core/platform/graphics/ImageOrientation.h"
+#include "platform/graphics/ImageOrientation.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/RefPtr.h"
 #include "wtf/VectorTraits.h"
diff --git a/Source/core/platform/graphics/GeneratedImage.cpp b/Source/core/platform/graphics/GeneratedImage.cpp
index bb7aa0b..2aafe39 100644
--- a/Source/core/platform/graphics/GeneratedImage.cpp
+++ b/Source/core/platform/graphics/GeneratedImage.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/platform/graphics/GeneratedImage.h"
 
-#include "core/platform/graphics/FloatSize.h"
+#include "platform/geometry/FloatSize.h"
 
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/GeneratedImage.h b/Source/core/platform/graphics/GeneratedImage.h
index 8c5bfb1..f009c08 100644
--- a/Source/core/platform/graphics/GeneratedImage.h
+++ b/Source/core/platform/graphics/GeneratedImage.h
@@ -27,7 +27,7 @@
 #define GeneratedImage_h
 
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/RefPtr.h"
 
 namespace WebCore {
@@ -46,12 +46,11 @@
 
     // Assume that generated content has no decoded data we need to worry about
     virtual void destroyDecodedData(bool) OVERRIDE { }
-    virtual unsigned decodedSize() const OVERRIDE { return 0; }
 
 protected:
     virtual void drawPattern(GraphicsContext*, const FloatRect&,
         const FloatSize&, const FloatPoint&, CompositeOperator,
-        const FloatRect&, BlendMode) OVERRIDE = 0;
+        const FloatRect&, BlendMode, const IntSize& repeatSpacing) OVERRIDE = 0;
 
     // FIXME: Implement this to be less conservative.
     virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; }
diff --git a/Source/core/platform/graphics/GeneratorGeneratedImage.cpp b/Source/core/platform/graphics/GeneratorGeneratedImage.cpp
index 149bc1b..cc124b1 100644
--- a/Source/core/platform/graphics/GeneratorGeneratedImage.cpp
+++ b/Source/core/platform/graphics/GeneratorGeneratedImage.cpp
@@ -26,8 +26,8 @@
 #include "config.h"
 #include "core/platform/graphics/GeneratorGeneratedImage.h"
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
+#include "platform/geometry/FloatRect.h"
 
 #define SKIA_MAX_PATTERN_SIZE 32767
 
@@ -100,7 +100,7 @@
 }
 
 void GeneratorGeneratedImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const FloatSize& scale,
-    const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode blendMode)
+    const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode blendMode, const IntSize& repeatSpacing)
 {
     // Allow the generator to provide visually-equivalent tiling parameters for better performance.
     IntSize adjustedSize = m_size;
@@ -139,7 +139,7 @@
     }
 
     // Tile the image buffer into the context.
-    m_cachedImageBuffer->drawPattern(destContext, adjustedSrcRect, scaleWithoutCTM, phase, compositeOp, destRect, blendMode);
+    m_cachedImageBuffer->drawPattern(destContext, adjustedSrcRect, scaleWithoutCTM, phase, compositeOp, destRect, blendMode, repeatSpacing);
     m_cacheTimer.restart();
 }
 
diff --git a/Source/core/platform/graphics/GeneratorGeneratedImage.h b/Source/core/platform/graphics/GeneratorGeneratedImage.h
index 1b7b0f3..6c9e878 100644
--- a/Source/core/platform/graphics/GeneratorGeneratedImage.h
+++ b/Source/core/platform/graphics/GeneratorGeneratedImage.h
@@ -26,12 +26,12 @@
 #ifndef GeneratorGeneratedImage_h
 #define GeneratorGeneratedImage_h
 
-#include "core/platform/Timer.h"
 #include "core/platform/graphics/GeneratedImage.h"
 #include "core/platform/graphics/Gradient.h"
 #include "core/platform/graphics/Image.h"
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/Timer.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/RefPtr.h"
 
 namespace WebCore {
@@ -55,7 +55,7 @@
         CompositeOperator, BlendMode) OVERRIDE;
     virtual void drawPattern(GraphicsContext*, const FloatRect&,
         const FloatSize&, const FloatPoint&, CompositeOperator,
-        const FloatRect&, BlendMode) OVERRIDE;
+        const FloatRect&, BlendMode, const IntSize& repeatSpacing) OVERRIDE;
 
     void drawPatternWithoutCache(GraphicsContext*, const FloatRect&, const FloatSize&,
         const FloatPoint&, CompositeOperator, const FloatRect&, BlendMode);
diff --git a/Source/core/platform/graphics/GlyphBuffer.h b/Source/core/platform/graphics/GlyphBuffer.h
index b580615..4dcf46f 100644
--- a/Source/core/platform/graphics/GlyphBuffer.h
+++ b/Source/core/platform/graphics/GlyphBuffer.h
@@ -30,8 +30,8 @@
 #ifndef GlyphBuffer_h
 #define GlyphBuffer_h
 
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/Glyph.h"
+#include "platform/geometry/FloatSize.h"
 #include "wtf/UnusedParam.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/platform/graphics/GlyphMetricsMap.h b/Source/core/platform/graphics/GlyphMetricsMap.h
index 64245a2..40f8814 100644
--- a/Source/core/platform/graphics/GlyphMetricsMap.h
+++ b/Source/core/platform/graphics/GlyphMetricsMap.h
@@ -30,6 +30,7 @@
 #define GlyphMetricsMap_h
 
 #include "core/platform/graphics/Glyph.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/Assertions.h"
 #include "wtf/HashMap.h"
 #include "wtf/OwnPtr.h"
diff --git a/Source/core/platform/graphics/Gradient.cpp b/Source/core/platform/graphics/Gradient.cpp
index 30e1cac..9f76aaa 100644
--- a/Source/core/platform/graphics/Gradient.cpp
+++ b/Source/core/platform/graphics/Gradient.cpp
@@ -29,9 +29,9 @@
 #include "core/platform/graphics/Gradient.h"
 
 #include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/skia/SkiaUtils.h"
+#include "platform/geometry/FloatRect.h"
 #include "third_party/skia/include/core/SkColorShader.h"
 #include "third_party/skia/include/core/SkShader.h"
 #include "third_party/skia/include/effects/SkGradientShader.h"
@@ -182,7 +182,7 @@
 
     m_gradientSpaceTransformation = gradientSpaceTransformation;
     if (m_gradient)
-        m_gradient->setLocalMatrix(m_gradientSpaceTransformation);
+        m_gradient->setLocalMatrix(affineTransformToSkMatrix(m_gradientSpaceTransformation));
 
     invalidateHash();
 }
@@ -356,7 +356,7 @@
         // use last color, since our "geometry" was degenerate (e.g. radius==0)
         m_gradient = adoptRef(new SkColorShader(colors[countUsed - 1]));
     } else {
-        m_gradient->setLocalMatrix(m_gradientSpaceTransformation);
+        m_gradient->setLocalMatrix(affineTransformToSkMatrix(m_gradientSpaceTransformation));
     }
     return m_gradient.get();
 }
diff --git a/Source/core/platform/graphics/Gradient.h b/Source/core/platform/graphics/Gradient.h
index 3c4d7d0..3021d89 100644
--- a/Source/core/platform/graphics/Gradient.h
+++ b/Source/core/platform/graphics/Gradient.h
@@ -29,9 +29,9 @@
 #ifndef Gradient_h
 #define Gradient_h
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/platform/graphics/GraphicsTypes.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/platform/graphics/GraphicsContext.cpp b/Source/core/platform/graphics/GraphicsContext.cpp
index e845bbd..fe47067 100644
--- a/Source/core/platform/graphics/GraphicsContext.cpp
+++ b/Source/core/platform/graphics/GraphicsContext.cpp
@@ -30,11 +30,11 @@
 #include "core/platform/graphics/BitmapImage.h"
 #include "core/platform/graphics/Gradient.h"
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/RoundedRect.h"
-#include "core/platform/graphics/TextRunIterator.h"
 #include "core/platform/graphics/skia/SkiaUtils.h"
-#include "core/platform/text/BidiResolver.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/geometry/RoundedRect.h"
+#include "platform/graphics/TextRunIterator.h"
+#include "platform/text/BidiResolver.h"
 #include "third_party/skia/include/core/SkAnnotation.h"
 #include "third_party/skia/include/core/SkColorFilter.h"
 #include "third_party/skia/include/core/SkData.h"
@@ -43,7 +43,7 @@
 #include "third_party/skia/include/core/SkRefCnt.h"
 #include "third_party/skia/include/effects/SkBlurMaskFilter.h"
 #include "third_party/skia/include/effects/SkCornerPathEffect.h"
-#include "third_party/skia/include/effects/SkLumaXfermode.h"
+#include "third_party/skia/include/effects/SkLumaColorFilter.h"
 #include "weborigin/KURL.h"
 #include "wtf/Assertions.h"
 #include "wtf/MathExtras.h"
@@ -378,9 +378,17 @@
     m_state->m_xferMode = WebCoreCompositeToSkiaComposite(compositeOperation, blendMode);
 }
 
-void GraphicsContext::setColorSpaceConversion(ColorSpace srcColorSpace, ColorSpace dstColorSpace)
+SkColorFilter* GraphicsContext::colorFilter()
 {
-    m_state->m_colorFilter = ImageBuffer::createColorSpaceFilter(srcColorSpace, dstColorSpace);
+    return m_state->m_colorFilter.get();
+}
+
+void GraphicsContext::setColorFilter(ColorFilter colorFilter)
+{
+    // We only support one active color filter at the moment. If (when) this becomes a problem,
+    // we should switch to using color filter chains (Skia work in progress).
+    ASSERT(!m_state->m_colorFilter);
+    m_state->m_colorFilter = WebCoreColorFilterToSkiaColorFilter(colorFilter);
 }
 
 bool GraphicsContext::readPixels(SkBitmap* bitmap, int x, int y, SkCanvas::Config8888 config8888)
@@ -413,10 +421,10 @@
 
 void GraphicsContext::beginTransparencyLayer(float opacity, const FloatRect* bounds)
 {
-    beginTransparencyLayer(opacity, m_state->m_compositeOperator, bounds);
+    beginLayer(opacity, m_state->m_compositeOperator, bounds);
 }
 
-void GraphicsContext::beginTransparencyLayer(float opacity, CompositeOperator op, const FloatRect* bounds)
+void GraphicsContext::beginLayer(float opacity, CompositeOperator op, const FloatRect* bounds, ColorFilter colorFilter)
 {
     if (paintingDisabled())
         return;
@@ -429,8 +437,8 @@
 
     SkPaint layerPaint;
     layerPaint.setAlpha(static_cast<unsigned char>(opacity * 255));
-    RefPtr<SkXfermode> xferMode = WebCoreCompositeToSkiaComposite(op, m_state->m_blendMode);
-    layerPaint.setXfermode(xferMode.get());
+    layerPaint.setXfermode(WebCoreCompositeToSkiaComposite(op, m_state->m_blendMode).get());
+    layerPaint.setColorFilter(WebCoreColorFilterToSkiaColorFilter(colorFilter).get());
 
     if (bounds) {
         SkRect skBounds = WebCoreFloatRectToSKRect(*bounds);
@@ -439,26 +447,6 @@
         saveLayer(0, &layerPaint, saveFlags);
     }
 
-
-#if !ASSERT_DISABLED
-    ++m_layerCount;
-#endif
-}
-
-void GraphicsContext::beginMaskedLayer(const FloatRect& bounds, MaskType maskType)
-{
-    if (paintingDisabled())
-        return;
-
-    SkPaint layerPaint;
-    RefPtr<SkXfermode> xferMode = adoptRef(maskType == AlphaMaskType
-        ? SkXfermode::Create(SkXfermode::kSrcIn_Mode)
-        : SkLumaMaskXfermode::Create(SkXfermode::kSrcIn_Mode));
-    layerPaint.setXfermode(xferMode.get());
-
-    SkRect skBounds = WebCoreFloatRectToSKRect(bounds);
-    saveLayer(&skBounds, &layerPaint);
-
 #if !ASSERT_DISABLED
     ++m_layerCount;
 #endif
@@ -1014,7 +1002,7 @@
         setImageInterpolationQuality(previousInterpolationQuality);
 }
 
-void GraphicsContext::drawTiledImage(Image* image, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLowQualityScale, BlendMode blendMode)
+void GraphicsContext::drawTiledImage(Image* image, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op, bool useLowQualityScale, BlendMode blendMode, const IntSize& repeatSpacing)
 {
     if (paintingDisabled() || !image)
         return;
@@ -1022,10 +1010,10 @@
     if (useLowQualityScale) {
         InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
         setImageInterpolationQuality(InterpolationLow);
-        image->drawTiled(this, destRect, srcPoint, tileSize, op, blendMode);
+        image->drawTiled(this, destRect, srcPoint, tileSize, op, blendMode, repeatSpacing);
         setImageInterpolationQuality(previousInterpolationQuality);
     } else {
-        image->drawTiled(this, destRect, srcPoint, tileSize, op, blendMode);
+        image->drawTiled(this, destRect, srcPoint, tileSize, op, blendMode, repeatSpacing);
     }
 }
 
@@ -1725,8 +1713,6 @@
 
     if (!SkXfermode::IsMode(m_state->m_xferMode.get(), SkXfermode::kSrcOver_Mode))
         paint->setXfermode(m_state->m_xferMode.get());
-    if (this->drawLuminanceMask())
-        paint->setXfermode(SkLumaMaskXfermode::Create(SkXfermode::kSrcOver_Mode));
 
     if (m_state->m_looper)
         paint->setLooper(m_state->m_looper.get());
@@ -1768,6 +1754,26 @@
         SkIntToScalar(bottomLeft.height()));
 }
 
+PassRefPtr<SkColorFilter> GraphicsContext::WebCoreColorFilterToSkiaColorFilter(ColorFilter colorFilter)
+{
+    switch (colorFilter) {
+    case ColorFilterLuminanceToAlpha:
+        return adoptRef(SkLumaColorFilter::Create());
+    case ColorFilterLinearRGBToSRGB:
+        return ImageBuffer::createColorSpaceFilter(ColorSpaceLinearRGB, ColorSpaceDeviceRGB);
+    case ColorFilterSRGBToLinearRGB:
+        return ImageBuffer::createColorSpaceFilter(ColorSpaceDeviceRGB, ColorSpaceLinearRGB);
+    case ColorFilterNone:
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+
+    return 0;
+}
+
+
 #if OS(MACOSX)
 CGColorSpaceRef deviceRGBColorSpaceRef()
 {
diff --git a/Source/core/platform/graphics/GraphicsContext.h b/Source/core/platform/graphics/GraphicsContext.h
index 28b7088..b4bf146 100644
--- a/Source/core/platform/graphics/GraphicsContext.h
+++ b/Source/core/platform/graphics/GraphicsContext.h
@@ -28,16 +28,17 @@
 #ifndef GraphicsContext_h
 #define GraphicsContext_h
 
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/graphics/DashArray.h"
 #include "core/platform/graphics/DrawLooper.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/GraphicsContextAnnotation.h"
 #include "core/platform/graphics/GraphicsContextState.h"
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/platform/graphics/ImageOrientation.h"
 #include "core/platform/graphics/skia/OpaqueRegionSkia.h"
+#include "core/platform/graphics/skia/SkiaUtils.h"
+#include "platform/TraceEvent.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/graphics/ImageOrientation.h"
 // TODO(robertphillips): replace this include with "class SkBaseDevice;"
 #include "third_party/skia/include/core/SkDevice.h"
 #include "wtf/FastAllocBase.h"
@@ -164,9 +165,6 @@
     CompositeOperator compositeOperation() const { return m_state->m_compositeOperator; }
     BlendMode blendModeOperation() const { return m_state->m_blendMode; }
 
-    void setDrawLuminanceMask(bool drawLuminanceMask) { m_state->m_drawLuminanceMask = drawLuminanceMask; }
-    bool drawLuminanceMask() const { return m_state->m_drawLuminanceMask; }
-
     // Change the way document markers are rendered.
     // Any deviceScaleFactor higher than 1.5 is enough to justify setting this flag.
     void setUseHighResMarkers(bool isHighRes) { m_useHighResMarker = isHighRes; }
@@ -203,7 +201,8 @@
     AnnotationModeFlags annotationMode() const { return m_annotationMode; }
     void setAnnotationMode(const AnnotationModeFlags mode) { m_annotationMode = mode; }
 
-    void setColorSpaceConversion(ColorSpace srcColorSpace, ColorSpace dstColorSpace);
+    SkColorFilter* colorFilter();
+    void setColorFilter(ColorFilter);
     // ---------- End state management methods -----------------
 
     // Get the contents of the image buffer
@@ -251,7 +250,7 @@
     void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
 
     void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
-        CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false, BlendMode = BlendModeNormal);
+        CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false, BlendMode = BlendModeNormal, const IntSize& repeatSpacing = IntSize());
     void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect,
         const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile,
         CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
@@ -302,8 +301,7 @@
     void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle);
 
     void beginTransparencyLayer(float opacity, const FloatRect* = 0);
-    void beginTransparencyLayer(float opacity, CompositeOperator, const FloatRect* = 0);
-    void beginMaskedLayer(const FloatRect&, MaskType = AlphaMaskType);
+    void beginLayer(float opacity, CompositeOperator, const FloatRect* = 0, ColorFilter = ColorFilterNone);
     void endLayer();
 
     bool hasShadow() const;
@@ -339,8 +337,8 @@
     // ---------- Transformation methods -----------------
     enum IncludeDeviceScale { DefinitelyIncludeDeviceScale, PossiblyIncludeDeviceScale };
     AffineTransform getCTM(IncludeDeviceScale includeScale = PossiblyIncludeDeviceScale) const;
-    void concatCTM(const AffineTransform& affine) { concat(affine); }
-    void setCTM(const AffineTransform& affine) { setMatrix(affine); }
+    void concatCTM(const AffineTransform& affine) { concat(affineTransformToSkMatrix(affine)); }
+    void setCTM(const AffineTransform& affine) { setMatrix(affineTransformToSkMatrix(affine)); }
     void setMatrix(const SkMatrix&);
 
     void scale(const FloatSize&);
@@ -374,6 +372,8 @@
     static void setPathFromConvexPoints(SkPath*, size_t, const FloatPoint*);
     static void setRadii(SkVector*, IntSize, IntSize, IntSize, IntSize);
 
+    static PassRefPtr<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFilter);
+
 #if OS(MACOSX)
     static inline int getFocusRingOutset(int offset) { return offset + 2; }
 #else
diff --git a/Source/core/platform/graphics/GraphicsContext3D.cpp b/Source/core/platform/graphics/GraphicsContext3D.cpp
index 3d64928..7641de7 100644
--- a/Source/core/platform/graphics/GraphicsContext3D.cpp
+++ b/Source/core/platform/graphics/GraphicsContext3D.cpp
@@ -41,8 +41,8 @@
 #include "third_party/skia/include/gpu/GrContext.h"
 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
 #include "wtf/CPU.h"
-#include "wtf/OwnArrayPtr.h"
-#include "wtf/PassOwnArrayPtr.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/StringHash.h"
 #include "wtf/text/WTFString.h"
@@ -68,15 +68,10 @@
 void getDrawingParameters(DrawingBuffer* drawingBuffer, WebKit::WebGraphicsContext3D* graphicsContext3D,
                           Platform3DObject* frameBufferId, int* width, int* height)
 {
-    if (drawingBuffer) {
-        *frameBufferId = drawingBuffer->framebuffer();
-        *width = drawingBuffer->size().width();
-        *height = drawingBuffer->size().height();
-    } else {
-        *frameBufferId = 0;
-        *width = graphicsContext3D->width();
-        *height = graphicsContext3D->height();
-    }
+    ASSERT(drawingBuffer);
+    *frameBufferId = drawingBuffer->framebuffer();
+    *width = drawingBuffer->size().width();
+    *height = drawingBuffer->size().height();
 }
 
 } // anonymous namespace
@@ -572,14 +567,6 @@
 
 DELEGATE_TO_WEBCONTEXT_4(viewport, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei)
 
-void GraphicsContext3D::reshape(int width, int height)
-{
-    if (width == m_impl->width() && height == m_impl->height())
-        return;
-
-    m_impl->reshape(width, height);
-}
-
 void GraphicsContext3D::markContextChanged()
 {
     m_layerComposited = false;
diff --git a/Source/core/platform/graphics/GraphicsContext3D.h b/Source/core/platform/graphics/GraphicsContext3D.h
index 7e7fe4d..91efcc6 100644
--- a/Source/core/platform/graphics/GraphicsContext3D.h
+++ b/Source/core/platform/graphics/GraphicsContext3D.h
@@ -29,16 +29,15 @@
 #include "core/platform/graphics/Extensions3D.h"
 #include "core/platform/graphics/GraphicsTypes3D.h"
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "weborigin/KURL.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/Noncopyable.h"
-#include "wtf/OwnArrayPtr.h"
 #include "wtf/OwnPtr.h"
-#include "wtf/PassOwnArrayPtr.h"
+#include "wtf/PassOwnPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/text/WTFString.h"
 
@@ -665,8 +664,6 @@
 
     void viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height);
 
-    void reshape(int width, int height);
-
     void markContextChanged();
     void markLayerComposited();
     bool layerComposited() const;
diff --git a/Source/core/platform/graphics/GraphicsContext3DImagePacking.cpp b/Source/core/platform/graphics/GraphicsContext3DImagePacking.cpp
index fdcbfb0..7351e0e 100644
--- a/Source/core/platform/graphics/GraphicsContext3DImagePacking.cpp
+++ b/Source/core/platform/graphics/GraphicsContext3DImagePacking.cpp
@@ -1309,7 +1309,7 @@
     void* const m_dstStart;
     const int m_srcStride, m_dstStride;
     bool m_success;
-    OwnArrayPtr<uint8_t> m_unpackedIntermediateSrcData;
+    OwnPtr<uint8_t[]> m_unpackedIntermediateSrcData;
 };
 
 void FormatConverter::convert(GraphicsContext3D::DataFormat srcFormat, GraphicsContext3D::DataFormat dstFormat, GraphicsContext3D::AlphaOp alphaOp)
diff --git a/Source/core/platform/graphics/GraphicsContextState.h b/Source/core/platform/graphics/GraphicsContextState.h
index ea27cb7..eed9fd5 100644
--- a/Source/core/platform/graphics/GraphicsContextState.h
+++ b/Source/core/platform/graphics/GraphicsContextState.h
@@ -65,7 +65,6 @@
         , m_shouldAntialias(true)
         , m_shouldSmoothFonts(true)
         , m_shouldClampToSourceRect(true)
-        , m_drawLuminanceMask(false)
     {
     }
 
@@ -86,7 +85,6 @@
         , m_shouldAntialias(other.m_shouldAntialias)
         , m_shouldSmoothFonts(other.m_shouldSmoothFonts)
         , m_shouldClampToSourceRect(other.m_shouldClampToSourceRect)
-        , m_drawLuminanceMask(other.m_drawLuminanceMask)
     {
     }
 
@@ -140,7 +138,6 @@
     bool m_shouldAntialias : 1;
     bool m_shouldSmoothFonts : 1;
     bool m_shouldClampToSourceRect : 1;
-    bool m_drawLuminanceMask : 1;
 };
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/GraphicsLayer.cpp b/Source/core/platform/graphics/GraphicsLayer.cpp
index 464a217..ef861b8 100644
--- a/Source/core/platform/graphics/GraphicsLayer.cpp
+++ b/Source/core/platform/graphics/GraphicsLayer.cpp
@@ -30,16 +30,15 @@
 #include "SkImageFilter.h"
 #include "SkMatrix44.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/GraphicsLayerFactory.h"
-#include "core/platform/graphics/LayoutRect.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/text/TextStream.h"
-
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/LayoutRect.h"
+#include "platform/text/TextStream.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
@@ -909,9 +908,11 @@
         return;
 
     m_contentsClippingMaskLayer = contentsClippingMaskLayer;
+    WebLayer* contentsLayer = contentsLayerIfRegistered();
+    if (!contentsLayer)
+        return;
     WebLayer* contentsClippingMaskWebLayer = m_contentsClippingMaskLayer ? m_contentsClippingMaskLayer->platformLayer() : 0;
-    if (hasContentsLayer())
-        contentsLayer()->setMaskLayer(contentsClippingMaskWebLayer);
+    contentsLayer->setMaskLayer(contentsClippingMaskWebLayer);
     updateContentsRect();
 }
 
@@ -1136,36 +1137,20 @@
 
 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;
-        FilterOutsets outsets = filters.outsets();
-        builder.setCropOffset(FloatSize(outsets.left(), outsets.top()));
-        RefPtr<SkImageFilter> imageFilter = builder.build(filters);
-        m_layer->layer()->setFilter(imageFilter.get());
-    } else {
-        OwnPtr<WebFilterOperations> webFilters = adoptPtr(Platform::current()->compositorSupport()->createFilterOperations());
-        if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, *webFilters)) {
-            // Make sure the filters are removed from the platform layer, as they are
-            // going to fallback to software mode.
-            webFilters->clear();
-            m_layer->layer()->setFilters(*webFilters);
-            m_filters = FilterOperations();
-            return false;
-        }
+    SkiaImageFilterBuilder builder;
+    OwnPtr<WebFilterOperations> webFilters = adoptPtr(Platform::current()->compositorSupport()->createFilterOperations());
+    FilterOutsets outsets = filters.outsets();
+    builder.setCropOffset(FloatSize(outsets.left(), outsets.top()));
+    if (!builder.buildFilterOperations(filters, webFilters.get())) {
+        // Make sure the filters are removed from the platform layer, as they are
+        // going to fallback to software mode.
+        webFilters->clear();
         m_layer->layer()->setFilters(*webFilters);
+        m_filters = FilterOperations();
+        return false;
     }
 
+    m_layer->layer()->setFilters(*webFilters);
     m_filters = filters;
     return true;
 }
diff --git a/Source/core/platform/graphics/GraphicsLayer.h b/Source/core/platform/graphics/GraphicsLayer.h
index a2b6629..3c6e092 100644
--- a/Source/core/platform/graphics/GraphicsLayer.h
+++ b/Source/core/platform/graphics/GraphicsLayer.h
@@ -28,15 +28,14 @@
 #define GraphicsLayer_h
 
 #include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatPoint3D.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/GraphicsLayerClient.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.h"
 #include "core/platform/graphics/filters/FilterOperations.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
-
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatPoint3D.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/transforms/TransformationMatrix.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/platform/graphics/GraphicsLayerClient.h b/Source/core/platform/graphics/GraphicsLayerClient.h
index 282cf0c..4c10e48 100644
--- a/Source/core/platform/graphics/GraphicsLayerClient.h
+++ b/Source/core/platform/graphics/GraphicsLayerClient.h
@@ -77,7 +77,7 @@
     virtual String debugName(const GraphicsLayer*) = 0;
 
 #ifndef NDEBUG
-    // RenderLayerBacking overrides this to verify that it is not
+    // CompositedLayerMapping overrides this to verify that it is not
     // currently painting contents. An ASSERT fails, if it is.
     // This is executed in GraphicsLayer construction and destruction
     // to verify that we don't create or destroy GraphicsLayers
diff --git a/Source/core/platform/graphics/GraphicsTypes.h b/Source/core/platform/graphics/GraphicsTypes.h
index f836979..5338129 100644
--- a/Source/core/platform/graphics/GraphicsTypes.h
+++ b/Source/core/platform/graphics/GraphicsTypes.h
@@ -116,7 +116,12 @@
 };
 typedef unsigned TextDrawingModeFlags;
 
-enum MaskType { AlphaMaskType, LuminanceMaskType };
+enum ColorFilter {
+    ColorFilterNone,
+    ColorFilterLuminanceToAlpha,
+    ColorFilterSRGBToLinearRGB,
+    ColorFilterLinearRGBToSRGB
+};
 
 String compositeOperatorName(CompositeOperator, BlendMode);
 bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, BlendMode&);
diff --git a/Source/core/platform/graphics/Image.cpp b/Source/core/platform/graphics/Image.cpp
index 36a219c..880f22d 100644
--- a/Source/core/platform/graphics/Image.cpp
+++ b/Source/core/platform/graphics/Image.cpp
@@ -29,16 +29,16 @@
 
 #include "core/platform/Length.h"
 #include "core/platform/MIMETypeRegistry.h"
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/graphics/BitmapImage.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/GraphicsTypes.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/SharedBuffer.h"
+#include "platform/TraceEvent.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/geometry/IntRect.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebData.h"
 #include "wtf/MainThread.h"
@@ -123,7 +123,7 @@
     draw(ctx, dstRect, srcRect, op, blendMode);
 }
 
-void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, CompositeOperator op, BlendMode blendMode)
+void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, CompositeOperator op, BlendMode blendMode, const IntSize& repeatSpacing)
 {
     if (mayFillWithSolidColor()) {
         fillWithSolidColor(ctxt, destRect, solidColor(), op);
@@ -142,9 +142,10 @@
     FloatSize scale(scaledTileSize.width() / intrinsicTileSize.width(),
                     scaledTileSize.height() / intrinsicTileSize.height());
 
+    FloatSize actualTileSize(scaledTileSize.width() + repeatSpacing.width(), scaledTileSize.height() + repeatSpacing.height());
     FloatRect oneTileRect;
-    oneTileRect.setX(destRect.x() + fmodf(fmodf(-srcPoint.x(), scaledTileSize.width()) - scaledTileSize.width(), scaledTileSize.width()));
-    oneTileRect.setY(destRect.y() + fmodf(fmodf(-srcPoint.y(), scaledTileSize.height()) - scaledTileSize.height(), scaledTileSize.height()));
+    oneTileRect.setX(destRect.x() + fmodf(fmodf(-srcPoint.x(), actualTileSize.width()) - actualTileSize.width(), actualTileSize.width()));
+    oneTileRect.setY(destRect.y() + fmodf(fmodf(-srcPoint.y(), actualTileSize.height()) - actualTileSize.height(), actualTileSize.height()));
     oneTileRect.setSize(scaledTileSize);
 
     // Check and see if a single draw of the image can cover the entire area we are supposed to tile.
@@ -159,7 +160,7 @@
     }
 
     FloatRect tileRect(FloatPoint(), intrinsicTileSize);
-    drawPattern(ctxt, tileRect, scale, oneTileRect.location(), op, destRect, blendMode);
+    drawPattern(ctxt, tileRect, scale, oneTileRect.location(), op, destRect, blendMode, repeatSpacing);
 
     startAnimation();
 }
@@ -224,11 +225,11 @@
 }
 
 void Image::drawPattern(GraphicsContext* context, const FloatRect& floatSrcRect, const FloatSize& scale,
-    const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode blendMode)
+    const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode blendMode, const IntSize& repeatSpacing)
 {
     TRACE_EVENT0("skia", "Image::drawPattern");
     if (RefPtr<NativeImageSkia> bitmap = nativeImageForCurrentFrame())
-        bitmap->drawPattern(context, adjustForNegativeSize(floatSrcRect), scale, phase, compositeOp, destRect, blendMode);
+        bitmap->drawPattern(context, adjustForNegativeSize(floatSrcRect), scale, phase, compositeOp, destRect, blendMode, repeatSpacing);
 }
 
 void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
diff --git a/Source/core/platform/graphics/Image.h b/Source/core/platform/graphics/Image.h
index 222866e..868fe53 100644
--- a/Source/core/platform/graphics/Image.h
+++ b/Source/core/platform/graphics/Image.h
@@ -29,9 +29,9 @@
 
 #include "core/platform/graphics/Color.h"
 #include "core/platform/graphics/GraphicsTypes.h"
-#include "core/platform/graphics/ImageOrientation.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/skia/NativeImageSkia.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/graphics/ImageOrientation.h"
 #include "third_party/skia/include/core/SkXfermode.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
@@ -92,7 +92,6 @@
     virtual String filenameExtension() const { return String(); } // null string if unknown
 
     virtual void destroyDecodedData(bool destroyAll) = 0;
-    virtual unsigned decodedSize() const = 0;
 
     SharedBuffer* data() { return m_encodedImageData.get(); }
 
@@ -112,7 +111,7 @@
 
     virtual void drawPattern(GraphicsContext*, const FloatRect&,
         const FloatSize&, const FloatPoint& phase, CompositeOperator,
-        const FloatRect&, BlendMode = BlendModeNormal);
+        const FloatRect&, BlendMode = BlendModeNormal, const IntSize& repeatSpacing = IntSize());
 
 #if !ASSERT_DISABLED
     virtual bool notSolidColor() { return true; }
@@ -127,7 +126,7 @@
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode) = 0;
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, BlendMode, RespectImageOrientationEnum);
     void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize,
-        CompositeOperator, BlendMode);
+        CompositeOperator, BlendMode, const IntSize& repeatSpacing);
     void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, CompositeOperator);
 
     // Supporting tiled drawing
diff --git a/Source/core/platform/graphics/ImageBuffer.cpp b/Source/core/platform/graphics/ImageBuffer.cpp
index 8d40ea9..ede72e9 100644
--- a/Source/core/platform/graphics/ImageBuffer.cpp
+++ b/Source/core/platform/graphics/ImageBuffer.cpp
@@ -39,7 +39,6 @@
 #include "core/platform/graphics/Extensions3D.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/GraphicsContext3D.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/chromium/Canvas2DLayerBridge.h"
 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h"
 #include "core/platform/graphics/skia/NativeImageSkia.h"
@@ -47,6 +46,7 @@
 #include "core/platform/image-encoders/skia/JPEGImageEncoder.h"
 #include "core/platform/image-encoders/skia/PNGImageEncoder.h"
 #include "core/platform/image-encoders/skia/WEBPImageEncoder.h"
+#include "platform/geometry/IntRect.h"
 #include "public/platform/Platform.h"
 #include "skia/ext/platform_canvas.h"
 #include "third_party/skia/include/core/SkBitmapDevice.h"
@@ -257,14 +257,14 @@
 }
 
 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const FloatSize& scale,
-    const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
+    const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode, const IntSize& repeatSpacing)
 {
     if (!isValid())
         return;
 
     const SkBitmap& bitmap = *m_context->bitmap();
     RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsCopy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap));
-    image->drawPattern(context, srcRect, scale, phase, op, destRect, blendMode);
+    image->drawPattern(context, srcRect, scale, phase, op, destRect, blendMode, repeatSpacing);
 }
 
 static const Vector<uint8_t>& getLinearRgbLUT()
diff --git a/Source/core/platform/graphics/ImageBuffer.h b/Source/core/platform/graphics/ImageBuffer.h
index 5c2d771..9f13b8c 100644
--- a/Source/core/platform/graphics/ImageBuffer.h
+++ b/Source/core/platform/graphics/ImageBuffer.h
@@ -29,13 +29,13 @@
 #define ImageBuffer_h
 
 #include "core/platform/graphics/ColorSpace.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/GraphicsTypes.h"
 #include "core/platform/graphics/GraphicsTypes3D.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/platform/graphics/chromium/Canvas2DLayerBridge.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/Forward.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
@@ -130,7 +130,7 @@
     bool isValid() const;
 
     void draw(GraphicsContext*, const FloatRect&, const FloatRect& = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false);
-    void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const FloatPoint&, CompositeOperator, const FloatRect&, BlendMode);
+    void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const FloatPoint&, CompositeOperator, const FloatRect&, BlendMode, const IntSize& repeatSpacing = IntSize());
     static PassRefPtr<SkColorFilter> createColorSpaceFilter(ColorSpace srcColorSpace, ColorSpace dstColorSpace);
 
     friend class GraphicsContext;
diff --git a/Source/core/platform/graphics/ImageOrientation.cpp b/Source/core/platform/graphics/ImageOrientation.cpp
deleted file mode 100644
index ecd998d..0000000
--- a/Source/core/platform/graphics/ImageOrientation.cpp
+++ /dev/null
@@ -1,62 +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.
- */
-
-#include "config.h"
-#include "core/platform/graphics/ImageOrientation.h"
-
-#include "core/platform/graphics/transforms/AffineTransform.h"
-
-namespace WebCore {
-
-AffineTransform ImageOrientation::transformFromDefault(const FloatSize& drawnSize) const
-{
-    float w = drawnSize.width();
-    float h = drawnSize.height();
-
-    switch (m_orientation) {
-    case OriginTopLeft:
-        return AffineTransform();
-    case OriginTopRight:
-        return AffineTransform(-1,  0,  0,  1,  w, 0);
-    case OriginBottomRight:
-        return AffineTransform(-1,  0,  0, -1,  w, h);
-    case OriginBottomLeft:
-        return AffineTransform( 1,  0,  0, -1,  0, h);
-    case OriginLeftTop:
-        return AffineTransform( 0,  1,  1,  0,  0, 0);
-    case OriginRightTop:
-        return AffineTransform( 0,  1, -1,  0,  w, 0);
-    case OriginRightBottom:
-        return AffineTransform( 0, -1, -1,  0,  w, h);
-    case OriginLeftBottom:
-        return AffineTransform( 0, -1,  1,  0,  0, h);
-    }
-
-    ASSERT_NOT_REACHED();
-    return AffineTransform();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/graphics/ImageOrientation.h b/Source/core/platform/graphics/ImageOrientation.h
deleted file mode 100644
index b184dc2..0000000
--- a/Source/core/platform/graphics/ImageOrientation.h
+++ /dev/null
@@ -1,92 +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.
- */
-
-#ifndef ImageOrientation_h
-#define ImageOrientation_h
-
-namespace WebCore {
-
-class AffineTransform;
-class FloatSize;
-
-// This enum intentionally matches the orientation values from the EXIF spec.
-// See JEITA CP-3451, page 18. http://www.exif.org/Exif2-2.PDF
-enum ImageOrientationEnum {
-    // "TopLeft" means that the 0 row starts at the Top, the 0 column starts at the Left.
-    OriginTopLeft = 1, // default
-    OriginTopRight = 2, // mirror along y-axis
-    OriginBottomRight = 3, // 180 degree rotation
-    OriginBottomLeft = 4, // mirror along the x-axis
-    OriginLeftTop = 5, // mirror along x-axis + 270 degree CW rotation
-    OriginRightTop = 6, // 90 degree CW rotation
-    OriginRightBottom = 7, // mirror along x-axis + 90 degree CW rotation
-    OriginLeftBottom = 8, // 270 degree CW rotation
-    // All other values are "reserved" as of EXIF 2.2
-    DefaultImageOrientation = OriginTopLeft,
-};
-
-enum RespectImageOrientationEnum {
-    DoNotRespectImageOrientation = 0,
-    RespectImageOrientation = 1
-};
-
-class ImageOrientation {
-public:
-    ImageOrientation(ImageOrientationEnum orientation = DefaultImageOrientation)
-        : m_orientation(orientation)
-    {
-    }
-
-    bool usesWidthAsHeight() const
-    {
-        // Values 5 through 8 all flip the width/height.
-        return m_orientation >= OriginLeftTop;
-    }
-
-    // ImageOrientationEnum currently matches EXIF values, however code outside
-    // this function should never assume that.
-    static ImageOrientation fromEXIFValue(int exifValue)
-    {
-        // Values direct from images may be invalid, in which case we use the default.
-        if (exifValue < OriginTopLeft || exifValue > OriginLeftBottom)
-            return DefaultImageOrientation;
-        return static_cast<ImageOrientationEnum>(exifValue);
-    }
-
-    // This transform can be used for drawing an image according to the orientation.
-    // It should be used in a right-handed coordinate system.
-    AffineTransform transformFromDefault(const FloatSize& drawnSize) const;
-
-    inline bool operator==(const ImageOrientation& other) const { return other.m_orientation == m_orientation; }
-    inline bool operator!=(const ImageOrientation& other) const { return !(*this == other); }
-
-private:
-    // FIXME: This only needs to be one byte.
-    ImageOrientationEnum m_orientation;
-};
-
-} // namespace WebCore
-
-#endif // ImageOrientation_h
diff --git a/Source/core/platform/graphics/ImageSource.cpp b/Source/core/platform/graphics/ImageSource.cpp
index 66b79b0..7839aa5 100644
--- a/Source/core/platform/graphics/ImageSource.cpp
+++ b/Source/core/platform/graphics/ImageSource.cpp
@@ -28,9 +28,9 @@
 #include "config.h"
 #include "core/platform/graphics/ImageSource.h"
 
-#include "core/platform/graphics/ImageOrientation.h"
 #include "core/platform/graphics/chromium/DeferredImageDecoder.h"
 #include "core/platform/image-decoders/ImageDecoder.h"
+#include "platform/graphics/ImageOrientation.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
 
@@ -101,11 +101,6 @@
     return m_decoder ? m_decoder->hotSpot(hotSpot) : false;
 }
 
-size_t ImageSource::bytesDecodedToDetermineProperties() const
-{
-    return 0;
-}
-
 int ImageSource::repetitionCount()
 {
     return m_decoder ? m_decoder->repetitionCount() : cAnimationNone;
diff --git a/Source/core/platform/graphics/ImageSource.h b/Source/core/platform/graphics/ImageSource.h
index 2a78d71..c1baca6 100644
--- a/Source/core/platform/graphics/ImageSource.h
+++ b/Source/core/platform/graphics/ImageSource.h
@@ -26,7 +26,7 @@
 #ifndef ImageSource_h
 #define ImageSource_h
 
-#include "core/platform/graphics/ImageOrientation.h"
+#include "platform/graphics/ImageOrientation.h"
 #include "wtf/Forward.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/OwnPtr.h"
@@ -106,8 +106,6 @@
 
     bool getHotSpot(IntPoint&) const;
 
-    size_t bytesDecodedToDetermineProperties() const;
-
     int repetitionCount();
 
     size_t frameCount() const;
diff --git a/Source/core/platform/graphics/InbandTextTrackPrivateClient.h b/Source/core/platform/graphics/InbandTextTrackPrivateClient.h
index 4473c8a..e0e3ca1 100644
--- a/Source/core/platform/graphics/InbandTextTrackPrivateClient.h
+++ b/Source/core/platform/graphics/InbandTextTrackPrivateClient.h
@@ -34,89 +34,11 @@
 
 class InbandTextTrackPrivate;
 
-class GenericCueData {
-    WTF_MAKE_NONCOPYABLE(GenericCueData); WTF_MAKE_FAST_ALLOCATED;
-public:
-    GenericCueData()
-        : m_startTime(0)
-        , m_endTime(0)
-        , m_line(-1)
-        , m_position(-1)
-        , m_size(-1)
-        , m_align(None)
-        , m_baseFontSize(0)
-        , m_relativeFontSize(0)
-    {
-    }
-    virtual ~GenericCueData() { }
-
-    double startTime() const { return m_startTime; }
-    void setStartTime(double startTime) { m_startTime = startTime; }
-
-    double endTime() const { return m_endTime; }
-    void setEndTime(double endTime) { m_endTime = endTime; }
-
-    String id() const { return m_id; }
-    void setId(String id) { m_id = id; }
-
-    String content() const { return m_content; }
-    void setContent(String content) { m_content = content; }
-
-    double line() const { return m_line; }
-    void setLine(double line) { m_line = line; }
-
-    double position() const { return m_position; }
-    void setPosition(double position) { m_position = position; }
-
-    double size() const { return m_size; }
-    void setSize(double size) { m_size = size; }
-
-    enum Alignment {
-        None,
-        Start,
-        Middle,
-        End
-    };
-    Alignment align() const { return m_align; }
-    void setAlign(Alignment align) { m_align = align; }
-
-    String fontName() const { return m_fontName; }
-    void setFontName(String fontName) { m_fontName = fontName; }
-
-    double baseFontSize() const { return m_baseFontSize; }
-    void setBaseFontSize(double baseFontSize) { m_baseFontSize = baseFontSize; }
-
-    double relativeFontSize() const { return m_relativeFontSize; }
-    void setRelativeFontSize(double relativeFontSize) { m_relativeFontSize = relativeFontSize; }
-
-    Color foregroundColor() const { return m_foregroundColor; }
-    void setForegroundColor(RGBA32 color) { m_foregroundColor.setRGB(color); }
-
-    Color backgroundColor() const { return m_backgroundColor; }
-    void setBackgroundColor(RGBA32 color) { m_backgroundColor.setRGB(color); }
-
-private:
-    double m_startTime;
-    double m_endTime;
-    String m_id;
-    String m_content;
-    double m_line;
-    double m_position;
-    double m_size;
-    Alignment m_align;
-    String m_fontName;
-    double m_baseFontSize;
-    double m_relativeFontSize;
-    Color m_foregroundColor;
-    Color m_backgroundColor;
-};
-
 class InbandTextTrackPrivateClient {
 public:
     virtual ~InbandTextTrackPrivateClient() { }
 
     virtual void addWebVTTCue(InbandTextTrackPrivate*, double /*start*/, double /*end*/, const String& /*id*/, const String& /*content*/, const String& /*settings*/) = 0;
-    virtual void addGenericCue(InbandTextTrackPrivate*, GenericCueData*) = 0;
 };
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/IntPoint.h b/Source/core/platform/graphics/IntPoint.h
deleted file mode 100644
index 80746c4..0000000
--- a/Source/core/platform/graphics/IntPoint.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 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,
- * 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 IntPoint_h
-#define IntPoint_h
-
-#include "core/platform/graphics/IntSize.h"
-#include "wtf/MathExtras.h"
-
-#if OS(MACOSX)
-typedef struct CGPoint CGPoint;
-#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
-typedef struct CGPoint NSPoint;
-#else
-typedef struct _NSPoint NSPoint;
-#endif
-#endif
-
-namespace WebCore {
-
-class IntPoint {
-public:
-    IntPoint() : m_x(0), m_y(0) { }
-    IntPoint(int x, int y) : m_x(x), m_y(y) { }
-    explicit IntPoint(const IntSize& size) : m_x(size.width()), m_y(size.height()) { }
-
-    static IntPoint zero() { return IntPoint(); }
-
-    int x() const { return m_x; }
-    int y() const { return m_y; }
-
-    void setX(int x) { m_x = x; }
-    void setY(int y) { m_y = y; }
-
-    void move(const IntSize& s) { move(s.width(), s.height()); }
-    void moveBy(const IntPoint& offset) { move(offset.x(), offset.y()); }
-    void move(int dx, int dy) { m_x += dx; m_y += dy; }
-    void scale(float sx, float sy)
-    {
-        m_x = lroundf(static_cast<float>(m_x * sx));
-        m_y = lroundf(static_cast<float>(m_y * sy));
-    }
-
-    IntPoint expandedTo(const IntPoint& other) const
-    {
-        return IntPoint(m_x > other.m_x ? m_x : other.m_x,
-            m_y > other.m_y ? m_y : other.m_y);
-    }
-
-    IntPoint shrunkTo(const IntPoint& other) const
-    {
-        return IntPoint(m_x < other.m_x ? m_x : other.m_x,
-            m_y < other.m_y ? m_y : other.m_y);
-    }
-
-    int distanceSquaredToPoint(const IntPoint&) const;
-
-    void clampNegativeToZero()
-    {
-        *this = expandedTo(zero());
-    }
-
-    IntPoint transposedPoint() const
-    {
-        return IntPoint(m_y, m_x);
-    }
-
-#if OS(MACOSX)
-    explicit IntPoint(const CGPoint&); // don't do this implicitly since it's lossy
-    operator CGPoint() const;
-
-#if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
-    explicit IntPoint(const NSPoint&); // don't do this implicitly since it's lossy
-    operator NSPoint() const;
-#endif
-#endif
-
-private:
-    int m_x, m_y;
-};
-
-inline IntPoint& operator+=(IntPoint& a, const IntSize& b)
-{
-    a.move(b.width(), b.height());
-    return a;
-}
-
-inline IntPoint& operator-=(IntPoint& a, const IntSize& b)
-{
-    a.move(-b.width(), -b.height());
-    return a;
-}
-
-inline IntPoint operator+(const IntPoint& a, const IntSize& b)
-{
-    return IntPoint(a.x() + b.width(), a.y() + b.height());
-}
-
-inline IntPoint operator+(const IntPoint& a, const IntPoint& b)
-{
-    return IntPoint(a.x() + b.x(), a.y() + b.y());
-}
-
-inline IntSize operator-(const IntPoint& a, const IntPoint& b)
-{
-    return IntSize(a.x() - b.x(), a.y() - b.y());
-}
-
-inline IntPoint operator-(const IntPoint& a, const IntSize& b)
-{
-    return IntPoint(a.x() - b.width(), a.y() - b.height());
-}
-
-inline IntPoint operator-(const IntPoint& point)
-{
-    return IntPoint(-point.x(), -point.y());
-}
-
-inline bool operator==(const IntPoint& a, const IntPoint& b)
-{
-    return a.x() == b.x() && a.y() == b.y();
-}
-
-inline bool operator!=(const IntPoint& a, const IntPoint& b)
-{
-    return a.x() != b.x() || a.y() != b.y();
-}
-
-inline IntSize toIntSize(const IntPoint& a)
-{
-    return IntSize(a.x(), a.y());
-}
-
-inline int IntPoint::distanceSquaredToPoint(const IntPoint& point) const
-{
-    return ((*this) - point).diagonalLengthSquared();
-}
-
-} // namespace WebCore
-
-#endif // IntPoint_h
diff --git a/Source/core/platform/graphics/IntRect.cpp b/Source/core/platform/graphics/IntRect.cpp
deleted file mode 100644
index d8f2ad0..0000000
--- a/Source/core/platform/graphics/IntRect.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2009 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.
- */
-
-#include "config.h"
-#include "core/platform/graphics/IntRect.h"
-
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/LayoutRect.h"
-#include "third_party/skia/include/core/SkRect.h"
-
-#include <algorithm>
-
-using std::max;
-using std::min;
-
-namespace WebCore {
-
-IntRect::IntRect(const FloatRect& r)
-    : m_location(clampToInteger(r.x()), clampToInteger(r.y()))
-    , m_size(clampToInteger(r.width()), clampToInteger(r.height()))
-{
-}
-
-IntRect::IntRect(const LayoutRect& r)
-    : m_location(r.x(), r.y())
-    , m_size(r.width(), r.height())
-{
-}
-
-bool IntRect::intersects(const IntRect& other) const
-{
-    // Checking emptiness handles negative widths as well as zero.
-    return !isEmpty() && !other.isEmpty()
-        && x() < other.maxX() && other.x() < maxX()
-        && y() < other.maxY() && other.y() < maxY();
-}
-
-bool IntRect::contains(const IntRect& other) const
-{
-    return x() <= other.x() && maxX() >= other.maxX()
-        && y() <= other.y() && maxY() >= other.maxY();
-}
-
-void IntRect::intersect(const IntRect& other)
-{
-    int l = max(x(), other.x());
-    int t = max(y(), other.y());
-    int r = min(maxX(), other.maxX());
-    int b = min(maxY(), other.maxY());
-
-    // Return a clean empty rectangle for non-intersecting cases.
-    if (l >= r || t >= b) {
-        l = 0;
-        t = 0;
-        r = 0;
-        b = 0;
-    }
-
-    m_location.setX(l);
-    m_location.setY(t);
-    m_size.setWidth(r - l);
-    m_size.setHeight(b - t);
-}
-
-void IntRect::unite(const IntRect& other)
-{
-    // Handle empty special cases first.
-    if (other.isEmpty())
-        return;
-    if (isEmpty()) {
-        *this = other;
-        return;
-    }
-
-    int l = min(x(), other.x());
-    int t = min(y(), other.y());
-    int r = max(maxX(), other.maxX());
-    int b = max(maxY(), other.maxY());
-
-    m_location.setX(l);
-    m_location.setY(t);
-    m_size.setWidth(r - l);
-    m_size.setHeight(b - t);
-}
-
-void IntRect::uniteIfNonZero(const IntRect& other)
-{
-    // Handle empty special cases first.
-    if (!other.width() && !other.height())
-        return;
-    if (!width() && !height()) {
-        *this = other;
-        return;
-    }
-
-    int left = min(x(), other.x());
-    int top = min(y(), other.y());
-    int right = max(maxX(), other.maxX());
-    int bottom = max(maxY(), other.maxY());
-
-    m_location.setX(left);
-    m_location.setY(top);
-    m_size.setWidth(right - left);
-    m_size.setHeight(bottom - top);
-}
-
-void IntRect::scale(float s)
-{
-    m_location.setX((int)(x() * s));
-    m_location.setY((int)(y() * s));
-    m_size.setWidth((int)(width() * s));
-    m_size.setHeight((int)(height() * s));
-}
-
-static inline int distanceToInterval(int pos, int start, int end)
-{
-    if (pos < start)
-        return start - pos;
-    if (pos > end)
-        return end - pos;
-    return 0;
-}
-
-IntSize IntRect::differenceToPoint(const IntPoint& point) const
-{
-    int xdistance = distanceToInterval(point.x(), x(), maxX());
-    int ydistance = distanceToInterval(point.y(), y(), maxY());
-    return IntSize(xdistance, ydistance);
-}
-
-IntRect::operator SkIRect() const
-{
-    SkIRect rect = { x(), y(), maxX(), maxY() };
-    return rect;
-}
-
-IntRect::operator SkRect() const
-{
-    SkRect rect;
-    rect.set(SkIntToScalar(x()), SkIntToScalar(y()), SkIntToScalar(maxX()), SkIntToScalar(maxY()));
-    return rect;
-}
-
-IntRect unionRect(const Vector<IntRect>& rects)
-{
-    IntRect result;
-
-    size_t count = rects.size();
-    for (size_t i = 0; i < count; ++i)
-        result.unite(rects[i]);
-
-    return result;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/graphics/IntRect.h b/Source/core/platform/graphics/IntRect.h
deleted file mode 100644
index a2e3492..0000000
--- a/Source/core/platform/graphics/IntRect.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2009 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 IntRect_h
-#define IntRect_h
-
-#include "core/platform/graphics/IntPoint.h"
-#include "wtf/FastAllocBase.h"
-#include "wtf/Vector.h"
-
-#if OS(MACOSX)
-typedef struct CGRect CGRect;
-
-#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
-typedef struct CGRect NSRect;
-#else
-typedef struct _NSRect NSRect;
-#endif
-#endif
-
-struct SkRect;
-struct SkIRect;
-
-namespace WebCore {
-
-class FloatRect;
-class LayoutRect;
-
-class IntRect {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    IntRect() { }
-    IntRect(const IntPoint& location, const IntSize& size)
-        : m_location(location), m_size(size) { }
-    IntRect(int x, int y, int width, int height)
-        : m_location(IntPoint(x, y)), m_size(IntSize(width, height)) { }
-
-    explicit IntRect(const FloatRect&); // don't do this implicitly since it's lossy
-    explicit IntRect(const LayoutRect&); // don't do this implicitly since it's lossy
-
-    IntPoint location() const { return m_location; }
-    IntSize size() const { return m_size; }
-
-    void setLocation(const IntPoint& location) { m_location = location; }
-    void setSize(const IntSize& size) { m_size = size; }
-
-    int x() const { return m_location.x(); }
-    int y() const { return m_location.y(); }
-    int maxX() const { return x() + width(); }
-    int maxY() const { return y() + height(); }
-    int width() const { return m_size.width(); }
-    int height() const { return m_size.height(); }
-
-    void setX(int x) { m_location.setX(x); }
-    void setY(int y) { m_location.setY(y); }
-    void setWidth(int width) { m_size.setWidth(width); }
-    void setHeight(int height) { m_size.setHeight(height); }
-
-    bool isEmpty() const { return m_size.isEmpty(); }
-
-    // NOTE: The result is rounded to integer values, and thus may be not the exact
-    // center point.
-    IntPoint center() const { return IntPoint(x() + width() / 2, y() + height() / 2); }
-
-    void move(const IntSize& size) { m_location += size; }
-    void moveBy(const IntPoint& offset) { m_location.move(offset.x(), offset.y()); }
-    void move(int dx, int dy) { m_location.move(dx, dy); }
-
-    void expand(const IntSize& size) { m_size += size; }
-    void expand(int dw, int dh) { m_size.expand(dw, dh); }
-    void contract(const IntSize& size) { m_size -= size; }
-    void contract(int dw, int dh) { m_size.expand(-dw, -dh); }
-
-    void shiftXEdgeTo(int edge)
-    {
-        int delta = edge - x();
-        setX(edge);
-        setWidth(std::max(0, width() - delta));
-    }
-    void shiftMaxXEdgeTo(int edge)
-    {
-        int delta = edge - maxX();
-        setWidth(std::max(0, width() + delta));
-    }
-    void shiftYEdgeTo(int edge)
-    {
-        int delta = edge - y();
-        setY(edge);
-        setHeight(std::max(0, height() - delta));
-    }
-    void shiftMaxYEdgeTo(int edge)
-    {
-        int delta = edge - maxY();
-        setHeight(std::max(0, height() + delta));
-    }
-
-    IntPoint minXMinYCorner() const { return m_location; } // typically topLeft
-    IntPoint maxXMinYCorner() const { return IntPoint(m_location.x() + m_size.width(), m_location.y()); } // typically topRight
-    IntPoint minXMaxYCorner() const { return IntPoint(m_location.x(), m_location.y() + m_size.height()); } // typically bottomLeft
-    IntPoint maxXMaxYCorner() const { return IntPoint(m_location.x() + m_size.width(), m_location.y() + m_size.height()); } // typically bottomRight
-
-    bool intersects(const IntRect&) const;
-    bool contains(const IntRect&) const;
-
-    // This checks to see if the rect contains x,y in the traditional sense.
-    // Equivalent to checking if the rect contains a 1x1 rect below and to the right of (px,py).
-    bool contains(int px, int py) const
-        { return px >= x() && px < maxX() && py >= y() && py < maxY(); }
-    bool contains(const IntPoint& point) const { return contains(point.x(), point.y()); }
-
-    void intersect(const IntRect&);
-    void unite(const IntRect&);
-    void uniteIfNonZero(const IntRect&);
-
-    void inflateX(int dx)
-    {
-        m_location.setX(m_location.x() - dx);
-        m_size.setWidth(m_size.width() + dx + dx);
-    }
-    void inflateY(int dy)
-    {
-        m_location.setY(m_location.y() - dy);
-        m_size.setHeight(m_size.height() + dy + dy);
-    }
-    void inflate(int d) { inflateX(d); inflateY(d); }
-    void scale(float s);
-
-    IntSize differenceToPoint(const IntPoint&) const;
-    int distanceSquaredToPoint(const IntPoint& p) const { return differenceToPoint(p).diagonalLengthSquared(); }
-
-    IntRect transposedRect() const { return IntRect(m_location.transposedPoint(), m_size.transposedSize()); }
-
-#if OS(MACOSX)
-    operator CGRect() const;
-#if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
-    operator NSRect() const;
-#endif
-#endif
-
-    operator SkRect() const;
-    operator SkIRect() const;
-
-private:
-    IntPoint m_location;
-    IntSize m_size;
-};
-
-inline IntRect intersection(const IntRect& a, const IntRect& b)
-{
-    IntRect c = a;
-    c.intersect(b);
-    return c;
-}
-
-inline IntRect unionRect(const IntRect& a, const IntRect& b)
-{
-    IntRect c = a;
-    c.unite(b);
-    return c;
-}
-
-IntRect unionRect(const Vector<IntRect>&);
-
-inline bool operator==(const IntRect& a, const IntRect& b)
-{
-    return a.location() == b.location() && a.size() == b.size();
-}
-
-inline bool operator!=(const IntRect& a, const IntRect& b)
-{
-    return a.location() != b.location() || a.size() != b.size();
-}
-
-#if OS(MACOSX)
-IntRect enclosingIntRect(const CGRect&);
-#if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
-IntRect enclosingIntRect(const NSRect&);
-#endif
-#endif
-
-} // namespace WebCore
-
-#endif // IntRect_h
diff --git a/Source/core/platform/graphics/IntRectExtent.h b/Source/core/platform/graphics/IntRectExtent.h
deleted file mode 100644
index 197779a..0000000
--- a/Source/core/platform/graphics/IntRectExtent.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2013 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDER “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 HOLDER 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 IntRectExtent_h
-#define IntRectExtent_h
-
-#include "core/platform/graphics/LayoutRect.h"
-
-namespace WebCore {
-
-class IntRectExtent {
-public:
-    IntRectExtent()
-        : m_top(0)
-        , m_right(0)
-        , m_bottom(0)
-        , m_left(0)
-    {
-    }
-
-    IntRectExtent(int top, int right, int bottom, int left)
-        : m_top(top)
-        , m_right(right)
-        , m_bottom(bottom)
-        , m_left(left)
-    {
-    }
-
-    int top() const { return m_top; }
-    void setTop(int top) { m_top = top; }
-
-    int right() const { return m_right; }
-    void setRight(int right) { m_right = right; }
-
-    int bottom() const { return m_bottom; }
-    void setBottom(int bottom) { m_bottom = bottom; }
-
-    int left() const { return m_left; }
-    void setLeft(int left) { m_left = left; }
-
-    bool isZero() const { return !left() && !right() && !top() && !bottom(); }
-
-    void expandRect(LayoutRect& rect) const
-    {
-        if (isZero())
-            return;
-
-        rect.move(-left(), -top());
-        rect.expand(left() + right(), top() + bottom());
-    }
-
-private:
-    int m_top;
-    int m_right;
-    int m_bottom;
-    int m_left;
-};
-
-inline bool operator==(const IntRectExtent& a, const IntRectExtent& b)
-{
-    return a.top() == b.top()
-        && a.right() == b.right()
-        && a.bottom() == b.bottom()
-        && a.left() == b.left();
-}
-
-inline bool operator!=(const IntRectExtent& a, const IntRectExtent& b)
-{
-    return !(a == b);
-}
-
-inline void operator+=(IntRectExtent& a, const IntRectExtent& b)
-{
-    a.setTop(a.top() + b.top());
-    a.setRight(a.right() + b.right());
-    a.setBottom(a.bottom() + b.bottom());
-    a.setLeft(a.left() + b.left());
-}
-
-} // namespace WebCore
-
-
-#endif // IntRectExtent_h
diff --git a/Source/core/platform/graphics/IntSize.h b/Source/core/platform/graphics/IntSize.h
deleted file mode 100644
index 44d6c72..0000000
--- a/Source/core/platform/graphics/IntSize.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, 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 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,
- * 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 IntSize_h
-#define IntSize_h
-
-#if OS(MACOSX)
-typedef struct CGSize CGSize;
-
-#ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
-typedef struct CGSize NSSize;
-#else
-typedef struct _NSSize NSSize;
-#endif
-#endif
-
-namespace WebCore {
-
-class IntSize {
-public:
-    IntSize() : m_width(0), m_height(0) { }
-    IntSize(int width, int height) : m_width(width), m_height(height) { }
-
-    int width() const { return m_width; }
-    int height() const { return m_height; }
-
-    void setWidth(int width) { m_width = width; }
-    void setHeight(int height) { m_height = height; }
-
-    bool isEmpty() const { return m_width <= 0 || m_height <= 0; }
-    bool isZero() const { return !m_width && !m_height; }
-
-    float aspectRatio() const { return static_cast<float>(m_width) / static_cast<float>(m_height); }
-
-    void expand(int width, int height)
-    {
-        m_width += width;
-        m_height += height;
-    }
-
-    void scale(float widthScale, float heightScale)
-    {
-        m_width = static_cast<int>(static_cast<float>(m_width) * widthScale);
-        m_height = static_cast<int>(static_cast<float>(m_height) * heightScale);
-    }
-
-    void scale(float scale)
-    {
-        this->scale(scale, scale);
-    }
-
-    IntSize expandedTo(const IntSize& other) const
-    {
-        return IntSize(m_width > other.m_width ? m_width : other.m_width,
-            m_height > other.m_height ? m_height : other.m_height);
-    }
-
-    IntSize shrunkTo(const IntSize& other) const
-    {
-        return IntSize(m_width < other.m_width ? m_width : other.m_width,
-            m_height < other.m_height ? m_height : other.m_height);
-    }
-
-    void clampNegativeToZero()
-    {
-        *this = expandedTo(IntSize());
-    }
-
-    void clampToMinimumSize(const IntSize& minimumSize)
-    {
-        if (m_width < minimumSize.width())
-            m_width = minimumSize.width();
-        if (m_height < minimumSize.height())
-            m_height = minimumSize.height();
-    }
-
-    int area() const
-    {
-        return m_width * m_height;
-    }
-
-    int diagonalLengthSquared() const
-    {
-        return m_width * m_width + m_height * m_height;
-    }
-
-    IntSize transposedSize() const
-    {
-        return IntSize(m_height, m_width);
-    }
-
-#if OS(MACOSX)
-    explicit IntSize(const CGSize&); // don't do this implicitly since it's lossy
-    operator CGSize() const;
-
-#if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES)
-    explicit IntSize(const NSSize &); // don't do this implicitly since it's lossy
-    operator NSSize() const;
-#endif
-#endif
-
-private:
-    int m_width, m_height;
-};
-
-inline IntSize& operator+=(IntSize& a, const IntSize& b)
-{
-    a.setWidth(a.width() + b.width());
-    a.setHeight(a.height() + b.height());
-    return a;
-}
-
-inline IntSize& operator-=(IntSize& a, const IntSize& b)
-{
-    a.setWidth(a.width() - b.width());
-    a.setHeight(a.height() - b.height());
-    return a;
-}
-
-inline IntSize operator+(const IntSize& a, const IntSize& b)
-{
-    return IntSize(a.width() + b.width(), a.height() + b.height());
-}
-
-inline IntSize operator-(const IntSize& a, const IntSize& b)
-{
-    return IntSize(a.width() - b.width(), a.height() - b.height());
-}
-
-inline IntSize operator-(const IntSize& size)
-{
-    return IntSize(-size.width(), -size.height());
-}
-
-inline bool operator==(const IntSize& a, const IntSize& b)
-{
-    return a.width() == b.width() && a.height() == b.height();
-}
-
-inline bool operator!=(const IntSize& a, const IntSize& b)
-{
-    return a.width() != b.width() || a.height() != b.height();
-}
-
-} // namespace WebCore
-
-#endif // IntSize_h
diff --git a/Source/core/platform/graphics/IntSizeHash.h b/Source/core/platform/graphics/IntSizeHash.h
index 71f2640..c80f4d2 100644
--- a/Source/core/platform/graphics/IntSizeHash.h
+++ b/Source/core/platform/graphics/IntSizeHash.h
@@ -20,7 +20,7 @@
 #ifndef IntSizeHash_h
 #define IntSizeHash_h
 
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
 
diff --git a/Source/core/platform/graphics/LayoutBoxExtent.cpp b/Source/core/platform/graphics/LayoutBoxExtent.cpp
deleted file mode 100644
index 2c3422b..0000000
--- a/Source/core/platform/graphics/LayoutBoxExtent.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * 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:
- *
- *     * 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/graphics/LayoutBoxExtent.h"
-
-#include "wtf/Assertions.h"
-
-namespace WebCore {
-
-LayoutUnit LayoutBoxExtent::logicalTop(WritingMode writingMode) const
-{
-    return isHorizontalWritingMode(writingMode) ? m_top : m_left;
-}
-
-LayoutUnit LayoutBoxExtent::logicalBottom(WritingMode writingMode) const
-{
-    return isHorizontalWritingMode(writingMode) ? m_bottom : m_right;
-}
-
-LayoutUnit LayoutBoxExtent::logicalLeft(WritingMode writingMode) const
-{
-    return isHorizontalWritingMode(writingMode) ? m_left : m_top;
-}
-
-LayoutUnit LayoutBoxExtent::logicalRight(WritingMode writingMode) const
-{
-    return isHorizontalWritingMode(writingMode) ? m_right : m_bottom;
-}
-
-LayoutUnit LayoutBoxExtent::before(WritingMode writingMode) const
-{
-    switch (writingMode) {
-    case TopToBottomWritingMode:
-        return m_top;
-    case BottomToTopWritingMode:
-        return m_bottom;
-    case LeftToRightWritingMode:
-        return m_left;
-    case RightToLeftWritingMode:
-        return m_right;
-    }
-    ASSERT_NOT_REACHED();
-    return m_top;
-}
-
-LayoutUnit LayoutBoxExtent::after(WritingMode writingMode) const
-{
-    switch (writingMode) {
-    case TopToBottomWritingMode:
-        return m_bottom;
-    case BottomToTopWritingMode:
-        return m_top;
-    case LeftToRightWritingMode:
-        return m_right;
-    case RightToLeftWritingMode:
-        return m_left;
-    }
-    ASSERT_NOT_REACHED();
-    return m_bottom;
-}
-
-LayoutUnit LayoutBoxExtent::start(WritingMode writingMode, TextDirection direction) const
-{
-    if (isHorizontalWritingMode(writingMode))
-        return isLeftToRightDirection(direction) ? m_left : m_right;
-    return isLeftToRightDirection(direction) ? m_top : m_bottom;
-}
-
-LayoutUnit LayoutBoxExtent::end(WritingMode writingMode, TextDirection direction) const
-{
-    if (isHorizontalWritingMode(writingMode))
-        return isLeftToRightDirection(direction) ? m_right : m_left;
-    return isLeftToRightDirection(direction) ? m_bottom : m_top;
-}
-
-void LayoutBoxExtent::setBefore(WritingMode writingMode, LayoutUnit value)
-{
-    switch (writingMode) {
-    case TopToBottomWritingMode:
-        m_top = value;
-        break;
-    case BottomToTopWritingMode:
-        m_bottom = value;
-        break;
-    case LeftToRightWritingMode:
-        m_left = value;
-        break;
-    case RightToLeftWritingMode:
-        m_right = value;
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-        m_top = value;
-    }
-}
-
-void LayoutBoxExtent::setAfter(WritingMode writingMode, LayoutUnit value)
-{
-    switch (writingMode) {
-    case TopToBottomWritingMode:
-        m_bottom = value;
-        break;
-    case BottomToTopWritingMode:
-        m_top = value;
-        break;
-    case LeftToRightWritingMode:
-        m_right = value;
-        break;
-    case RightToLeftWritingMode:
-        m_left = value;
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-        m_bottom = value;
-    }
-}
-
-void LayoutBoxExtent::setStart(WritingMode writingMode, TextDirection direction, LayoutUnit value)
-{
-    if (isHorizontalWritingMode(writingMode)) {
-        if (isLeftToRightDirection(direction))
-            m_left = value;
-        else
-            m_right = value;
-    } else {
-        if (isLeftToRightDirection(direction))
-            m_top = value;
-        else
-            m_bottom = value;
-    }
-}
-
-void LayoutBoxExtent::setEnd(WritingMode writingMode, TextDirection direction, LayoutUnit value)
-{
-    if (isHorizontalWritingMode(writingMode)) {
-        if (isLeftToRightDirection(direction))
-            m_right = value;
-        else
-            m_left = value;
-    } else {
-        if (isLeftToRightDirection(direction))
-            m_bottom = value;
-        else
-            m_top = value;
-    }
-}
-
-LayoutUnit& LayoutBoxExtent::mutableLogicalLeft(WritingMode writingMode)
-{
-    return isHorizontalWritingMode(writingMode) ? m_left : m_top;
-}
-
-LayoutUnit& LayoutBoxExtent::mutableLogicalRight(WritingMode writingMode)
-{
-    return isHorizontalWritingMode(writingMode) ? m_right : m_bottom;
-}
-
-LayoutUnit& LayoutBoxExtent::mutableBefore(WritingMode writingMode)
-{
-    return isHorizontalWritingMode(writingMode) ? (isFlippedBlocksWritingMode(writingMode) ? m_bottom : m_top) :
-                                                  (isFlippedBlocksWritingMode(writingMode) ? m_right: m_left);
-}
-
-LayoutUnit& LayoutBoxExtent::mutableAfter(WritingMode writingMode)
-{
-    return isHorizontalWritingMode(writingMode) ? (isFlippedBlocksWritingMode(writingMode) ? m_top : m_bottom) :
-                                                  (isFlippedBlocksWritingMode(writingMode) ? m_left: m_right);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/graphics/LayoutBoxExtent.h b/Source/core/platform/graphics/LayoutBoxExtent.h
deleted file mode 100644
index c35d2d9..0000000
--- a/Source/core/platform/graphics/LayoutBoxExtent.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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:
- *
- *     * 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 LayoutBoxExtent_h
-#define LayoutBoxExtent_h
-
-#include "core/platform/LayoutUnit.h"
-#include "core/platform/text/TextDirection.h"
-#include "core/platform/text/WritingMode.h"
-
-namespace WebCore {
-
-class LayoutBoxExtent {
-public:
-    LayoutBoxExtent() : m_top(0), m_right(0), m_bottom(0), m_left(0) { }
-    LayoutBoxExtent(LayoutUnit top, LayoutUnit right, LayoutUnit bottom, LayoutUnit left)
-        : m_top(top), m_right(right), m_bottom(bottom), m_left(left) { }
-
-    inline LayoutUnit top() const { return m_top; }
-    inline LayoutUnit right() const { return m_right; }
-    inline LayoutUnit bottom() const { return m_bottom; }
-    inline LayoutUnit left() const { return m_left; }
-
-    inline void setTop(LayoutUnit value) { m_top = value; }
-    inline void setRight(LayoutUnit value) { m_right = value; }
-    inline void setBottom(LayoutUnit value) { m_bottom = value; }
-    inline void setLeft(LayoutUnit value) { m_left = value; }
-
-    LayoutUnit logicalTop(WritingMode) const;
-    LayoutUnit logicalBottom(WritingMode) const;
-    LayoutUnit logicalLeft(WritingMode) const;
-    LayoutUnit logicalRight(WritingMode) const;
-
-    LayoutUnit before(WritingMode) const;
-    LayoutUnit after(WritingMode) const;
-    LayoutUnit start(WritingMode, TextDirection) const;
-    LayoutUnit end(WritingMode, TextDirection) const;
-
-    void setBefore(WritingMode, LayoutUnit);
-    void setAfter(WritingMode, LayoutUnit);
-    void setStart(WritingMode, TextDirection, LayoutUnit);
-    void setEnd(WritingMode, TextDirection, LayoutUnit);
-
-    LayoutUnit& mutableLogicalLeft(WritingMode);
-    LayoutUnit& mutableLogicalRight(WritingMode);
-
-    LayoutUnit& mutableBefore(WritingMode);
-    LayoutUnit& mutableAfter(WritingMode);
-
-private:
-    LayoutUnit m_top;
-    LayoutUnit m_right;
-    LayoutUnit m_bottom;
-    LayoutUnit m_left;
-};
-
-} // namespace WebCore
-
-#endif // LayoutBoxExtent_h
diff --git a/Source/core/platform/graphics/LayoutPoint.h b/Source/core/platform/graphics/LayoutPoint.h
deleted file mode 100644
index e5de27c..0000000
--- a/Source/core/platform/graphics/LayoutPoint.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * 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:
- *
- *     * 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 LayoutPoint_h
-#define LayoutPoint_h
-
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/LayoutSize.h"
-#include "wtf/MathExtras.h"
-
-namespace WebCore {
-
-class LayoutPoint {
-public:
-    LayoutPoint() : m_x(0), m_y(0) { }
-    LayoutPoint(LayoutUnit x, LayoutUnit y) : m_x(x), m_y(y) { }
-    LayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { }
-    explicit LayoutPoint(const FloatPoint& size) : m_x(size.x()), m_y(size.y()) { }
-    explicit LayoutPoint(const LayoutSize& size) : m_x(size.width()), m_y(size.height()) { }
-
-    static LayoutPoint zero() { return LayoutPoint(); }
-
-    LayoutUnit x() const { return m_x; }
-    LayoutUnit y() const { return m_y; }
-
-    void setX(LayoutUnit x) { m_x = x; }
-    void setY(LayoutUnit y) { m_y = y; }
-
-    void move(const LayoutSize& s) { move(s.width(), s.height()); }
-    void moveBy(const LayoutPoint& offset) { move(offset.x(), offset.y()); }
-    void move(LayoutUnit dx, LayoutUnit dy) { m_x += dx; m_y += dy; }
-    void scale(float sx, float sy)
-    {
-        m_x *= sx;
-        m_y *= sy;
-    }
-
-    LayoutPoint expandedTo(const LayoutPoint& other) const
-    {
-        return LayoutPoint(std::max(m_x, other.m_x), std::max(m_y, other.m_y));
-    }
-
-    LayoutPoint shrunkTo(const LayoutPoint& other) const
-    {
-        return LayoutPoint(std::min(m_x, other.m_x), std::min(m_y, other.m_y));
-    }
-
-    void clampNegativeToZero()
-    {
-        *this = expandedTo(zero());
-    }
-
-    LayoutPoint transposedPoint() const
-    {
-        return LayoutPoint(m_y, m_x);
-    }
-
-private:
-    LayoutUnit m_x, m_y;
-};
-
-inline LayoutPoint& operator+=(LayoutPoint& a, const LayoutSize& b)
-{
-    a.move(b.width(), b.height());
-    return a;
-}
-
-inline LayoutPoint& operator-=(LayoutPoint& a, const LayoutSize& b)
-{
-    a.move(-b.width(), -b.height());
-    return a;
-}
-
-inline LayoutPoint operator+(const LayoutPoint& a, const LayoutSize& b)
-{
-    return LayoutPoint(a.x() + b.width(), a.y() + b.height());
-}
-
-inline LayoutPoint operator+(const LayoutPoint& a, const LayoutPoint& b)
-{
-    return LayoutPoint(a.x() + b.x(), a.y() + b.y());
-}
-
-inline LayoutSize operator-(const LayoutPoint& a, const LayoutPoint& b)
-{
-    return LayoutSize(a.x() - b.x(), a.y() - b.y());
-}
-
-inline LayoutPoint operator-(const LayoutPoint& a, const LayoutSize& b)
-{
-    return LayoutPoint(a.x() - b.width(), a.y() - b.height());
-}
-
-inline LayoutPoint operator-(const LayoutPoint& point)
-{
-    return LayoutPoint(-point.x(), -point.y());
-}
-
-inline bool operator==(const LayoutPoint& a, const LayoutPoint& b)
-{
-    return a.x() == b.x() && a.y() == b.y();
-}
-
-inline bool operator!=(const LayoutPoint& a, const LayoutPoint& b)
-{
-    return a.x() != b.x() || a.y() != b.y();
-}
-
-inline LayoutPoint toPoint(const LayoutSize& size)
-{
-    return LayoutPoint(size.width(), size.height());
-}
-
-inline LayoutPoint toLayoutPoint(const LayoutSize& p)
-{
-    return LayoutPoint(p.width(), p.height());
-}
-
-inline LayoutSize toSize(const LayoutPoint& a)
-{
-    return LayoutSize(a.x(), a.y());
-}
-
-inline IntPoint flooredIntPoint(const LayoutPoint& point)
-{
-    return IntPoint(point.x().floor(), point.y().floor());
-}
-
-inline IntPoint roundedIntPoint(const LayoutPoint& point)
-{
-    return IntPoint(point.x().round(), point.y().round());
-}
-
-inline IntPoint roundedIntPoint(const LayoutSize& size)
-{
-    return IntPoint(size.width().round(), size.height().round());
-}
-
-inline IntPoint ceiledIntPoint(const LayoutPoint& point)
-{
-    return IntPoint(point.x().ceil(), point.y().ceil());
-}
-
-inline LayoutPoint flooredLayoutPoint(const FloatPoint& p)
-{
-    return LayoutPoint(LayoutUnit::fromFloatFloor(p.x()), LayoutUnit::fromFloatFloor(p.y()));
-}
-
-inline LayoutPoint ceiledLayoutPoint(const FloatPoint& p)
-{
-    return LayoutPoint(LayoutUnit::fromFloatCeil(p.x()), LayoutUnit::fromFloatCeil(p.y()));
-}
-
-inline IntSize pixelSnappedIntSize(const LayoutSize& s, const LayoutPoint& p)
-{
-    return IntSize(snapSizeToPixel(s.width(), p.x()), snapSizeToPixel(s.height(), p.y()));
-}
-
-inline LayoutPoint roundedLayoutPoint(const FloatPoint& p)
-{
-    return LayoutPoint(p);
-}
-
-inline LayoutSize toLayoutSize(const LayoutPoint& p)
-{
-    return LayoutSize(p.x(), p.y());
-}
-
-inline LayoutPoint flooredLayoutPoint(const FloatSize& s)
-{
-    return flooredLayoutPoint(FloatPoint(s));
-}
-
-
-} // namespace WebCore
-
-#endif // LayoutPoint_h
diff --git a/Source/core/platform/graphics/LayoutRect.cpp b/Source/core/platform/graphics/LayoutRect.cpp
deleted file mode 100644
index a3c0b00..0000000
--- a/Source/core/platform/graphics/LayoutRect.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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:
- *
- *     * 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/graphics/LayoutRect.h"
-
-#include <algorithm>
-#include "core/platform/LayoutUnit.h"
-#include "core/platform/graphics/FloatRect.h"
-
-using std::max;
-using std::min;
-
-namespace WebCore {
-
-LayoutRect::LayoutRect(const FloatRect& r)
-    : m_location(LayoutPoint(r.location()))
-    , m_size(LayoutSize(r.size()))
-{
-}
-
-bool LayoutRect::intersects(const LayoutRect& other) const
-{
-    // Checking emptiness handles negative widths as well as zero.
-    return !isEmpty() && !other.isEmpty()
-        && x() < other.maxX() && other.x() < maxX()
-        && y() < other.maxY() && other.y() < maxY();
-}
-
-bool LayoutRect::contains(const LayoutRect& other) const
-{
-    return x() <= other.x() && maxX() >= other.maxX()
-        && y() <= other.y() && maxY() >= other.maxY();
-}
-
-void LayoutRect::intersect(const LayoutRect& other)
-{
-    LayoutPoint newLocation(max(x(), other.x()), max(y(), other.y()));
-    LayoutPoint newMaxPoint(min(maxX(), other.maxX()), min(maxY(), other.maxY()));
-
-    // Return a clean empty rectangle for non-intersecting cases.
-    if (newLocation.x() >= newMaxPoint.x() || newLocation.y() >= newMaxPoint.y()) {
-        newLocation = LayoutPoint(0, 0);
-        newMaxPoint = LayoutPoint(0, 0);
-    }
-
-    m_location = newLocation;
-    m_size = newMaxPoint - newLocation;
-}
-
-void LayoutRect::unite(const LayoutRect& other)
-{
-    // Handle empty special cases first.
-    if (other.isEmpty())
-        return;
-    if (isEmpty()) {
-        *this = other;
-        return;
-    }
-
-    LayoutPoint newLocation(min(x(), other.x()), min(y(), other.y()));
-    LayoutPoint newMaxPoint(max(maxX(), other.maxX()), max(maxY(), other.maxY()));
-
-    m_location = newLocation;
-    m_size = newMaxPoint - newLocation;
-}
-
-void LayoutRect::uniteIfNonZero(const LayoutRect& other)
-{
-    // Handle empty special cases first.
-    if (!other.width() && !other.height())
-        return;
-    if (!width() && !height()) {
-        *this = other;
-        return;
-    }
-
-    LayoutPoint newLocation(min(x(), other.x()), min(y(), other.y()));
-    LayoutPoint newMaxPoint(max(maxX(), other.maxX()), max(maxY(), other.maxY()));
-
-    m_location = newLocation;
-    m_size = newMaxPoint - newLocation;
-}
-
-void LayoutRect::scale(float s)
-{
-    m_location.scale(s, s);
-    m_size.scale(s);
-}
-
-void LayoutRect::scale(float xAxisScale, float yAxisScale)
-{
-    m_location.scale(xAxisScale, yAxisScale);
-    m_size.scale(xAxisScale, yAxisScale);
-}
-
-LayoutRect unionRect(const Vector<LayoutRect>& rects)
-{
-    LayoutRect result;
-
-    size_t count = rects.size();
-    for (size_t i = 0; i < count; ++i)
-        result.unite(rects[i]);
-
-    return result;
-}
-
-IntRect enclosingIntRect(const LayoutRect& rect)
-{
-    IntPoint location = flooredIntPoint(rect.minXMinYCorner());
-    IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner());
-
-    return IntRect(location, maxPoint - location);
-}
-
-LayoutRect enclosingLayoutRect(const FloatRect& rect)
-{
-    LayoutPoint location = flooredLayoutPoint(rect.minXMinYCorner());
-    LayoutPoint maxPoint = ceiledLayoutPoint(rect.maxXMaxYCorner());
-    return LayoutRect(location, maxPoint - location);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/graphics/LayoutRect.h b/Source/core/platform/graphics/LayoutRect.h
deleted file mode 100644
index dc46a9b..0000000
--- a/Source/core/platform/graphics/LayoutRect.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * 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:
- *
- *     * 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 LayoutRect_h
-#define LayoutRect_h
-
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/LayoutBoxExtent.h"
-#include "core/platform/graphics/LayoutPoint.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class FloatRect;
-
-class LayoutRect {
-public:
-    LayoutRect() { }
-    LayoutRect(const LayoutPoint& location, const LayoutSize& size)
-        : m_location(location), m_size(size) { }
-    LayoutRect(LayoutUnit x, LayoutUnit y, LayoutUnit width, LayoutUnit height)
-        : m_location(LayoutPoint(x, y)), m_size(LayoutSize(width, height)) { }
-    LayoutRect(const FloatPoint& location, const FloatSize& size)
-        : m_location(location), m_size(size) { }
-    LayoutRect(const IntRect& rect) : m_location(rect.location()), m_size(rect.size()) { }
-
-    explicit LayoutRect(const FloatRect&); // don't do this implicitly since it's lossy
-
-    LayoutPoint location() const { return m_location; }
-    LayoutSize size() const { return m_size; }
-
-    IntPoint pixelSnappedLocation() const { return roundedIntPoint(m_location); }
-    IntSize pixelSnappedSize() const { return IntSize(snapSizeToPixel(m_size.width(), m_location.x()), snapSizeToPixel(m_size.height(), m_location.y())); }
-
-    void setLocation(const LayoutPoint& location) { m_location = location; }
-    void setSize(const LayoutSize& size) { m_size = size; }
-
-    LayoutUnit x() const { return m_location.x(); }
-    LayoutUnit y() const { return m_location.y(); }
-    LayoutUnit maxX() const { return x() + width(); }
-    LayoutUnit maxY() const { return y() + height(); }
-    LayoutUnit width() const { return m_size.width(); }
-    LayoutUnit height() const { return m_size.height(); }
-
-    int pixelSnappedX() const { return x().round(); }
-    int pixelSnappedY() const { return y().round(); }
-    int pixelSnappedWidth() const { return snapSizeToPixel(width(), x()); }
-    int pixelSnappedHeight() const { return snapSizeToPixel(height(), y()); }
-    int pixelSnappedMaxX() const { return (m_location.x() + m_size.width()).round(); }
-    int pixelSnappedMaxY() const { return (m_location.y() + m_size.height()).round(); }
-
-    void setX(LayoutUnit x) { m_location.setX(x); }
-    void setY(LayoutUnit y) { m_location.setY(y); }
-    void setWidth(LayoutUnit width) { m_size.setWidth(width); }
-    void setHeight(LayoutUnit height) { m_size.setHeight(height); }
-
-    bool isEmpty() const { return m_size.isEmpty(); }
-
-    // NOTE: The result is rounded to integer values, and thus may be not the exact
-    // center point.
-    LayoutPoint center() const { return LayoutPoint(x() + width() / 2, y() + height() / 2); }
-
-    void move(const LayoutSize& size) { m_location += size; }
-    void moveBy(const LayoutPoint& offset) { m_location.move(offset.x(), offset.y()); }
-    void move(LayoutUnit dx, LayoutUnit dy) { m_location.move(dx, dy); }
-
-    void expand(const LayoutSize& size) { m_size += size; }
-    void expand(const LayoutBoxExtent& box)
-    {
-        m_location.move(-box.left(), -box.top());
-        m_size.expand(box.left() + box.right(), box.top() + box.bottom());
-    }
-    void expand(LayoutUnit dw, LayoutUnit dh) { m_size.expand(dw, dh); }
-    void contract(const LayoutSize& size) { m_size -= size; }
-    void contract(const LayoutBoxExtent& box)
-    {
-        m_location.move(box.left(), box.top());
-        m_size.shrink(box.left() + box.right(), box.top() + box.bottom());
-    }
-    void contract(LayoutUnit dw, LayoutUnit dh) { m_size.expand(-dw, -dh); }
-
-    void shiftXEdgeTo(LayoutUnit edge)
-    {
-        LayoutUnit delta = edge - x();
-        setX(edge);
-        setWidth(std::max<LayoutUnit>(0, width() - delta));
-    }
-    void shiftMaxXEdgeTo(LayoutUnit edge)
-    {
-        LayoutUnit delta = edge - maxX();
-        setWidth(std::max<LayoutUnit>(0, width() + delta));
-    }
-    void shiftYEdgeTo(LayoutUnit edge)
-    {
-        LayoutUnit delta = edge - y();
-        setY(edge);
-        setHeight(std::max<LayoutUnit>(0, height() - delta));
-    }
-    void shiftMaxYEdgeTo(LayoutUnit edge)
-    {
-        LayoutUnit delta = edge - maxY();
-        setHeight(std::max<LayoutUnit>(0, height() + delta));
-    }
-
-    LayoutPoint minXMinYCorner() const { return m_location; } // typically topLeft
-    LayoutPoint maxXMinYCorner() const { return LayoutPoint(m_location.x() + m_size.width(), m_location.y()); } // typically topRight
-    LayoutPoint minXMaxYCorner() const { return LayoutPoint(m_location.x(), m_location.y() + m_size.height()); } // typically bottomLeft
-    LayoutPoint maxXMaxYCorner() const { return LayoutPoint(m_location.x() + m_size.width(), m_location.y() + m_size.height()); } // typically bottomRight
-
-    bool intersects(const LayoutRect&) const;
-    bool contains(const LayoutRect&) const;
-
-    // This checks to see if the rect contains x,y in the traditional sense.
-    // Equivalent to checking if the rect contains a 1x1 rect below and to the right of (px,py).
-    bool contains(LayoutUnit px, LayoutUnit py) const
-        { return px >= x() && px < maxX() && py >= y() && py < maxY(); }
-    bool contains(const LayoutPoint& point) const { return contains(point.x(), point.y()); }
-
-    void intersect(const LayoutRect&);
-    void unite(const LayoutRect&);
-    void uniteIfNonZero(const LayoutRect&);
-
-    void inflateX(LayoutUnit dx)
-    {
-        m_location.setX(m_location.x() - dx);
-        m_size.setWidth(m_size.width() + dx + dx);
-    }
-    void inflateY(LayoutUnit dy)
-    {
-        m_location.setY(m_location.y() - dy);
-        m_size.setHeight(m_size.height() + dy + dy);
-    }
-    void inflate(LayoutUnit d) { inflateX(d); inflateY(d); }
-    void scale(float s);
-    void scale(float xAxisScale, float yAxisScale);
-
-    LayoutRect transposedRect() const { return LayoutRect(m_location.transposedPoint(), m_size.transposedSize()); }
-
-    static LayoutRect infiniteRect()
-    {
-        // Return a rect that is slightly smaller than the true max rect to allow pixelSnapping to round up to the nearest IntRect without overflowing.
-        return LayoutRect(LayoutUnit::nearlyMin() / 2, LayoutUnit::nearlyMin() / 2, LayoutUnit::nearlyMax(), LayoutUnit::nearlyMax());
-    }
-
-private:
-    LayoutPoint m_location;
-    LayoutSize m_size;
-};
-
-inline LayoutRect intersection(const LayoutRect& a, const LayoutRect& b)
-{
-    LayoutRect c = a;
-    c.intersect(b);
-    return c;
-}
-
-inline LayoutRect unionRect(const LayoutRect& a, const LayoutRect& b)
-{
-    LayoutRect c = a;
-    c.unite(b);
-    return c;
-}
-
-LayoutRect unionRect(const Vector<LayoutRect>&);
-
-inline bool operator==(const LayoutRect& a, const LayoutRect& b)
-{
-    return a.location() == b.location() && a.size() == b.size();
-}
-
-inline bool operator!=(const LayoutRect& a, const LayoutRect& b)
-{
-    return a.location() != b.location() || a.size() != b.size();
-}
-
-inline IntRect pixelSnappedIntRect(const LayoutRect& rect)
-{
-    return IntRect(roundedIntPoint(rect.location()), IntSize(snapSizeToPixel(rect.width(), rect.x()),
-                                                             snapSizeToPixel(rect.height(), rect.y())));
-}
-
-IntRect enclosingIntRect(const LayoutRect&);
-LayoutRect enclosingLayoutRect(const FloatRect&);
-
-
-inline IntRect pixelSnappedIntRect(LayoutUnit left, LayoutUnit top, LayoutUnit width, LayoutUnit height)
-{
-    return IntRect(left.round(), top.round(), snapSizeToPixel(width, left), snapSizeToPixel(height, top));
-}
-
-inline IntRect pixelSnappedIntRectFromEdges(LayoutUnit left, LayoutUnit top, LayoutUnit right, LayoutUnit bottom)
-{
-    return IntRect(left.round(), top.round(), snapSizeToPixel(right - left, left), snapSizeToPixel(bottom - top, top));
-}
-
-inline IntRect pixelSnappedIntRect(LayoutPoint location, LayoutSize size)
-{
-    return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location));
-}
-
-} // namespace WebCore
-
-#endif // LayoutRect_h
diff --git a/Source/core/platform/graphics/LayoutSize.h b/Source/core/platform/graphics/LayoutSize.h
deleted file mode 100644
index 3844e6b..0000000
--- a/Source/core/platform/graphics/LayoutSize.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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:
- *
- *     * 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 LayoutSize_h
-#define LayoutSize_h
-
-#include "core/platform/LayoutUnit.h"
-#include "core/platform/graphics/FloatSize.h"
-#include "core/platform/graphics/IntSize.h"
-
-namespace WebCore {
-
-class LayoutPoint;
-
-enum AspectRatioFit {
-    AspectRatioFitShrink,
-    AspectRatioFitGrow
-};
-
-class LayoutSize {
-public:
-    LayoutSize() : m_width(0), m_height(0) { }
-    LayoutSize(const IntSize& size) : m_width(size.width()), m_height(size.height()) { }
-    LayoutSize(LayoutUnit width, LayoutUnit height) : m_width(width), m_height(height) { }
-
-    explicit LayoutSize(const FloatSize& size) : m_width(size.width()), m_height(size.height()) { }
-
-    LayoutUnit width() const { return m_width; }
-    LayoutUnit height() const { return m_height; }
-
-    void setWidth(LayoutUnit width) { m_width = width; }
-    void setHeight(LayoutUnit height) { m_height = height; }
-
-    bool isEmpty() const { return m_width <= 0 || m_height <= 0; }
-    bool isZero() const { return !m_width && !m_height; }
-
-    float aspectRatio() const { return static_cast<float>(m_width) / static_cast<float>(m_height); }
-
-    void expand(LayoutUnit width, LayoutUnit height)
-    {
-        m_width += width;
-        m_height += height;
-    }
-
-    void shrink(LayoutUnit width, LayoutUnit height)
-    {
-        m_width -= width;
-        m_height -= height;
-    }
-
-    void scale(float scale)
-    {
-        m_width *= scale;
-        m_height *= scale;
-    }
-
-    void scale(float widthScale, float heightScale)
-    {
-        m_width *= widthScale;
-        m_height *= heightScale;
-    }
-
-    LayoutSize expandedTo(const LayoutSize& other) const
-    {
-        return LayoutSize(m_width > other.m_width ? m_width : other.m_width,
-            m_height > other.m_height ? m_height : other.m_height);
-    }
-
-    LayoutSize shrunkTo(const LayoutSize& other) const
-    {
-        return LayoutSize(m_width < other.m_width ? m_width : other.m_width,
-            m_height < other.m_height ? m_height : other.m_height);
-    }
-
-    void clampNegativeToZero()
-    {
-        *this = expandedTo(LayoutSize());
-    }
-
-    void clampToMinimumSize(const LayoutSize& minimumSize)
-    {
-        if (m_width < minimumSize.width())
-            m_width = minimumSize.width();
-        if (m_height < minimumSize.height())
-            m_height = minimumSize.height();
-    }
-
-    LayoutSize transposedSize() const
-    {
-        return LayoutSize(m_height, m_width);
-    }
-
-    LayoutSize fitToAspectRatio(const LayoutSize& aspectRatio, AspectRatioFit fit) const
-    {
-        float heightScale = height().toFloat() / aspectRatio.height().toFloat();
-        float widthScale = width().toFloat() / aspectRatio.width().toFloat();
-        if ((widthScale > heightScale) != (fit == AspectRatioFitGrow))
-            return LayoutSize(height() * aspectRatio.width() / aspectRatio.height(), height());
-        return LayoutSize(width(), width() * aspectRatio.height() / aspectRatio.width());
-    }
-
-private:
-    LayoutUnit m_width, m_height;
-};
-
-inline LayoutSize& operator+=(LayoutSize& a, const LayoutSize& b)
-{
-    a.setWidth(a.width() + b.width());
-    a.setHeight(a.height() + b.height());
-    return a;
-}
-
-inline LayoutSize& operator-=(LayoutSize& a, const LayoutSize& b)
-{
-    a.setWidth(a.width() - b.width());
-    a.setHeight(a.height() - b.height());
-    return a;
-}
-
-inline LayoutSize operator+(const LayoutSize& a, const LayoutSize& b)
-{
-    return LayoutSize(a.width() + b.width(), a.height() + b.height());
-}
-
-inline LayoutSize operator-(const LayoutSize& a, const LayoutSize& b)
-{
-    return LayoutSize(a.width() - b.width(), a.height() - b.height());
-}
-
-inline LayoutSize operator-(const LayoutSize& size)
-{
-    return LayoutSize(-size.width(), -size.height());
-}
-
-inline bool operator==(const LayoutSize& a, const LayoutSize& b)
-{
-    return a.width() == b.width() && a.height() == b.height();
-}
-
-inline bool operator!=(const LayoutSize& a, const LayoutSize& b)
-{
-    return a.width() != b.width() || a.height() != b.height();
-}
-
-inline IntSize flooredIntSize(const LayoutSize& s)
-{
-    return IntSize(s.width().floor(), s.height().floor());
-}
-
-inline IntSize roundedIntSize(const LayoutSize& s)
-{
-    return IntSize(s.width().round(), s.height().round());
-}
-
-inline LayoutSize roundedLayoutSize(const FloatSize& s)
-{
-    return LayoutSize(s);
-}
-
-} // namespace WebCore
-
-#endif // LayoutSize_h
diff --git a/Source/core/platform/graphics/MediaPlayer.h b/Source/core/platform/graphics/MediaPlayer.h
index e84467e..4a96690 100644
--- a/Source/core/platform/graphics/MediaPlayer.h
+++ b/Source/core/platform/graphics/MediaPlayer.h
@@ -66,6 +66,8 @@
     // the play/pause status changed
     virtual void mediaPlayerPlaybackStateChanged() = 0;
 
+    virtual void mediaPlayerRequestFullscreen() = 0;
+
     virtual void mediaPlayerRequestSeek(double) = 0;
 
 // Presentation-related methods
diff --git a/Source/core/platform/graphics/OWNERS b/Source/core/platform/graphics/OWNERS
deleted file mode 100644
index 94e7e03..0000000
--- a/Source/core/platform/graphics/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-per-file BitmapImage.*=pkasting@chromium.org

-per-file Image.*=pkasting@chromium.org

-per-file ImageSource.*=pkasting@chromium.org
\ No newline at end of file
diff --git a/Source/core/platform/graphics/Path.cpp b/Source/core/platform/graphics/Path.cpp
index baaa013..f9d62a4 100644
--- a/Source/core/platform/graphics/Path.cpp
+++ b/Source/core/platform/graphics/Path.cpp
@@ -31,11 +31,11 @@
 #include "core/platform/graphics/Path.h"
 
 #include <math.h>
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/skia/SkiaUtils.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "third_party/skia/include/core/SkPath.h"
 #include "third_party/skia/include/core/SkPathMeasure.h"
 #include "third_party/skia/include/pathops/SkPathOps.h"
@@ -147,7 +147,7 @@
 
 void Path::transform(const AffineTransform& xform)
 {
-    m_path.transform(xform);
+    m_path.transform(affineTransformToSkMatrix(xform));
 }
 
 float Path::length() const
@@ -277,7 +277,7 @@
     m_path.close();
 }
 
-void Path::addArc(const FloatPoint& p, float radius, float startAngle, float endAngle, bool anticlockwise)
+void Path::addEllipse(const FloatPoint& p, float radiusX, float radiusY, float startAngle, float endAngle, bool anticlockwise)
 {
     ASSERT(std::abs(endAngle - startAngle) < 4 * piFloat);
     ASSERT(startAngle >= 0 && startAngle < 2 * piFloat);
@@ -285,11 +285,12 @@
 
     SkScalar cx = WebCoreFloatToSkScalar(p.x());
     SkScalar cy = WebCoreFloatToSkScalar(p.y());
-    SkScalar radiusScalar = WebCoreFloatToSkScalar(radius);
+    SkScalar radiusXScalar = WebCoreFloatToSkScalar(radiusX);
+    SkScalar radiusYScalar = WebCoreFloatToSkScalar(radiusY);
     SkScalar s360 = SkIntToScalar(360);
 
     SkRect oval;
-    oval.set(cx - radiusScalar, cy - radiusScalar, cx + radiusScalar, cy + radiusScalar);
+    oval.set(cx - radiusXScalar, cy - radiusYScalar, cx + radiusXScalar, cy + radiusYScalar);
 
     float sweep = endAngle - startAngle;
     SkScalar startDegrees = WebCoreFloatToSkScalar(startAngle * 180 / piFloat);
@@ -316,6 +317,11 @@
     m_path.arcTo(oval, startDegrees, sweepDegrees, false);
 }
 
+void Path::addArc(const FloatPoint& p, float radius, float startAngle, float endAngle, bool anticlockwise)
+{
+    addEllipse(p, radius, radius, startAngle, endAngle, anticlockwise);
+}
+
 void Path::addRect(const FloatRect& rect)
 {
     m_path.addRect(rect);
@@ -343,11 +349,11 @@
     }
 
     // Add an arc after the relevant transform.
-    AffineTransform ellipseTransform = AffineTransform::translation(p.x(), p.y()).rotate(rad2deg(rotation)).scale(radiusX, radiusY);
+    AffineTransform ellipseTransform = AffineTransform::translation(p.x(), p.y()).rotate(rad2deg(rotation));
     ASSERT(ellipseTransform.isInvertible());
     AffineTransform inverseEllipseTransform = ellipseTransform.inverse();
     transform(inverseEllipseTransform);
-    addArc(FloatPoint::zero(), 1 /* unit circle */, startAngle, endAngle, anticlockwise);
+    addEllipse(FloatPoint::zero(), radiusX, radiusY, startAngle, endAngle, anticlockwise);
     transform(ellipseTransform);
 }
 
diff --git a/Source/core/platform/graphics/Path.h b/Source/core/platform/graphics/Path.h
index 5a1e658..eacf5bd 100644
--- a/Source/core/platform/graphics/Path.h
+++ b/Source/core/platform/graphics/Path.h
@@ -29,8 +29,8 @@
 #ifndef Path_h
 #define Path_h
 
-#include "core/platform/graphics/RoundedRect.h"
 #include "core/platform/graphics/WindRule.h"
+#include "platform/geometry/RoundedRect.h"
 #include "third_party/skia/include/core/SkPath.h"
 #include "wtf/FastAllocBase.h"
 #include "wtf/Forward.h"
@@ -124,6 +124,8 @@
     bool unionPath(const Path& other);
 
 private:
+    void addEllipse(const FloatPoint&, float radiusX, float radiusY, float startAngle, float endAngle, bool anticlockwise);
+
     SkPath m_path;
 };
 
diff --git a/Source/core/platform/graphics/PathTraversalState.cpp b/Source/core/platform/graphics/PathTraversalState.cpp
deleted file mode 100644
index 532fbae..0000000
--- a/Source/core/platform/graphics/PathTraversalState.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Eric Seidel <eric@webkit.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/platform/graphics/PathTraversalState.h"
-
-#include "wtf/MathExtras.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-static const float kPathSegmentLengthTolerance = 0.00001f;
-
-static inline FloatPoint midPoint(const FloatPoint& first, const FloatPoint& second)
-{
-    return FloatPoint((first.x() + second.x()) / 2.0f, (first.y() + second.y()) / 2.0f);
-}
-
-static inline float distanceLine(const FloatPoint& start, const FloatPoint& end)
-{
-    return sqrtf((end.x() - start.x()) * (end.x() - start.x()) + (end.y() - start.y()) * (end.y() - start.y()));
-}
-
-struct QuadraticBezier {
-    QuadraticBezier() { }
-    QuadraticBezier(const FloatPoint& s, const FloatPoint& c, const FloatPoint& e)
-        : start(s)
-        , control(c)
-        , end(e)
-    {
-    }
-
-    float approximateDistance() const
-    {
-        return distanceLine(start, control) + distanceLine(control, end);
-    }
-
-    void split(QuadraticBezier& left, QuadraticBezier& right) const
-    {
-        left.control = midPoint(start, control);
-        right.control = midPoint(control, end);
-
-        FloatPoint leftControlToRightControl = midPoint(left.control, right.control);
-        left.end = leftControlToRightControl;
-        right.start = leftControlToRightControl;
-
-        left.start = start;
-        right.end = end;
-    }
-
-    FloatPoint start;
-    FloatPoint control;
-    FloatPoint end;
-};
-
-struct CubicBezier {
-    CubicBezier() { }
-    CubicBezier(const FloatPoint& s, const FloatPoint& c1, const FloatPoint& c2, const FloatPoint& e)
-        : start(s)
-        , control1(c1)
-        , control2(c2)
-        , end(e)
-    {
-    }
-
-    float approximateDistance() const
-    {
-        return distanceLine(start, control1) + distanceLine(control1, control2) + distanceLine(control2, end);
-    }
-
-    void split(CubicBezier& left, CubicBezier& right) const
-    {
-        FloatPoint startToControl1 = midPoint(control1, control2);
-
-        left.start = start;
-        left.control1 = midPoint(start, control1);
-        left.control2 = midPoint(left.control1, startToControl1);
-
-        right.control2 = midPoint(control2, end);
-        right.control1 = midPoint(right.control2, startToControl1);
-        right.end = end;
-
-        FloatPoint leftControl2ToRightControl1 = midPoint(left.control2, right.control1);
-        left.end = leftControl2ToRightControl1;
-        right.start = leftControl2ToRightControl1;
-    }
-
-    FloatPoint start;
-    FloatPoint control1;
-    FloatPoint control2;
-    FloatPoint end;
-};
-
-// FIXME: This function is possibly very slow due to the ifs required for proper path measuring
-// A simple speed-up would be to use an additional boolean template parameter to control whether
-// to use the "fast" version of this function with no PathTraversalState updating, vs. the slow
-// version which does update the PathTraversalState.  We'll have to shark it to see if that's necessary.
-// Another check which is possible up-front (to send us down the fast path) would be to check if
-// approximateDistance() + current total distance > desired distance
-template<class CurveType>
-static float curveLength(PathTraversalState& traversalState, CurveType curve)
-{
-    static const unsigned curveStackDepthLimit = 20;
-
-    Vector<CurveType> curveStack;
-    curveStack.append(curve);
-
-    float totalLength = 0;
-    do {
-        float length = curve.approximateDistance();
-        if ((length - distanceLine(curve.start, curve.end)) > kPathSegmentLengthTolerance && curveStack.size() <= curveStackDepthLimit) {
-            CurveType leftCurve;
-            CurveType rightCurve;
-            curve.split(leftCurve, rightCurve);
-            curve = leftCurve;
-            curveStack.append(rightCurve);
-        } else {
-            totalLength += length;
-            if (traversalState.m_action == PathTraversalState::TraversalPointAtLength
-             || traversalState.m_action == PathTraversalState::TraversalNormalAngleAtLength) {
-                traversalState.m_previous = curve.start;
-                traversalState.m_current = curve.end;
-                if (traversalState.m_totalLength + totalLength > traversalState.m_desiredLength)
-                    return totalLength;
-            }
-            curve = curveStack.last();
-            curveStack.removeLast();
-        }
-    } while (!curveStack.isEmpty());
-
-    return totalLength;
-}
-
-PathTraversalState::PathTraversalState(PathTraversalAction action)
-    : m_action(action)
-    , m_success(false)
-    , m_totalLength(0)
-    , m_segmentIndex(0)
-    , m_desiredLength(0)
-    , m_normalAngle(0)
-{
-}
-
-float PathTraversalState::closeSubpath()
-{
-    float distance = distanceLine(m_current, m_start);
-    m_current = m_control1 = m_control2 = m_start;
-    return distance;
-}
-
-float PathTraversalState::moveTo(const FloatPoint& point)
-{
-    m_current = m_start = m_control1 = m_control2 = point;
-    return 0;
-}
-
-float PathTraversalState::lineTo(const FloatPoint& point)
-{
-    float distance = distanceLine(m_current, point);
-    m_current = m_control1 = m_control2 = point;
-    return distance;
-}
-
-float PathTraversalState::quadraticBezierTo(const FloatPoint& newControl, const FloatPoint& newEnd)
-{
-    float distance = curveLength<QuadraticBezier>(*this, QuadraticBezier(m_current, newControl, newEnd));
-
-    m_control1 = newControl;
-    m_control2 = newEnd;
-
-    if (m_action != TraversalPointAtLength && m_action != TraversalNormalAngleAtLength)
-        m_current = newEnd;
-
-    return distance;
-}
-
-float PathTraversalState::cubicBezierTo(const FloatPoint& newControl1, const FloatPoint& newControl2, const FloatPoint& newEnd)
-{
-    float distance = curveLength<CubicBezier>(*this, CubicBezier(m_current, newControl1, newControl2, newEnd));
-
-    m_control1 = newEnd;
-    m_control2 = newControl2;
-
-    if (m_action != TraversalPointAtLength && m_action != TraversalNormalAngleAtLength)
-        m_current = newEnd;
-
-    return distance;
-}
-
-void PathTraversalState::processSegment()
-{
-    if (m_action == TraversalSegmentAtLength && m_totalLength >= m_desiredLength)
-        m_success = true;
-
-    if ((m_action == TraversalPointAtLength || m_action == TraversalNormalAngleAtLength) && m_totalLength >= m_desiredLength) {
-        float slope = FloatPoint(m_current - m_previous).slopeAngleRadians();
-        if (m_action == TraversalPointAtLength) {
-            float offset = m_desiredLength - m_totalLength;
-            m_current.move(offset * cosf(slope), offset * sinf(slope));
-        } else
-            m_normalAngle = rad2deg(slope);
-        m_success = true;
-    }
-    m_previous = m_current;
-}
-
-}
-
diff --git a/Source/core/platform/graphics/PathTraversalState.h b/Source/core/platform/graphics/PathTraversalState.h
deleted file mode 100644
index 19498be..0000000
--- a/Source/core/platform/graphics/PathTraversalState.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Eric Seidel <eric@webkit.org>
- *
- * 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,
- * 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 PathTraversalState_h
-#define PathTraversalState_h
-
-#include "core/platform/graphics/FloatPoint.h"
-
-namespace WebCore {
-
-class PathTraversalState {
-public:
-    enum PathTraversalAction {
-        TraversalTotalLength,
-        TraversalPointAtLength,
-        TraversalSegmentAtLength,
-        TraversalNormalAngleAtLength
-    };
-
-    PathTraversalState(PathTraversalAction);
-
-    float closeSubpath();
-    float moveTo(const FloatPoint&);
-    float lineTo(const FloatPoint&);
-    float quadraticBezierTo(const FloatPoint& newControl, const FloatPoint& newEnd);
-    float cubicBezierTo(const FloatPoint& newControl1, const FloatPoint& newControl2, const FloatPoint& newEnd);
-
-    void processSegment();
-
-public:
-    PathTraversalAction m_action;
-    bool m_success;
-
-    FloatPoint m_current;
-    FloatPoint m_start;
-    FloatPoint m_control1;
-    FloatPoint m_control2;
-
-    float m_totalLength;
-    unsigned m_segmentIndex;
-    float m_desiredLength;
-
-    // For normal calculations
-    FloatPoint m_previous;
-    float m_normalAngle; // degrees
-};
-}
-
-#endif
diff --git a/Source/core/platform/graphics/Pattern.cpp b/Source/core/platform/graphics/Pattern.cpp
index 58159fe..61ae7ce 100644
--- a/Source/core/platform/graphics/Pattern.cpp
+++ b/Source/core/platform/graphics/Pattern.cpp
@@ -33,6 +33,7 @@
 #include "SkColorShader.h"
 #include "SkShader.h"
 #include "core/platform/graphics/Image.h"
+#include "core/platform/graphics/skia/SkiaUtils.h"
 
 namespace WebCore {
 
@@ -88,7 +89,7 @@
         m_externalMemoryAllocated = static_cast<int>(std::min(static_cast<size_t>(INT_MAX), bm2.getSafeSize()));
         v8::V8::AdjustAmountOfExternalAllocatedMemory(m_externalMemoryAllocated);
     }
-    m_pattern->setLocalMatrix(m_patternSpaceTransformation);
+    m_pattern->setLocalMatrix(affineTransformToSkMatrix(m_patternSpaceTransformation));
     return m_pattern.get();
 }
 
@@ -96,7 +97,7 @@
 {
     m_patternSpaceTransformation = patternSpaceTransformation;
     if (m_pattern)
-        m_pattern->setLocalMatrix(m_patternSpaceTransformation);
+        m_pattern->setLocalMatrix(affineTransformToSkMatrix(m_patternSpaceTransformation));
 }
 
 }
diff --git a/Source/core/platform/graphics/Pattern.h b/Source/core/platform/graphics/Pattern.h
index 925e91d..4df132c 100644
--- a/Source/core/platform/graphics/Pattern.h
+++ b/Source/core/platform/graphics/Pattern.h
@@ -31,7 +31,7 @@
 
 #include "SkShader.h"
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/transforms/AffineTransform.h"
 
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
diff --git a/Source/core/platform/graphics/Region.cpp b/Source/core/platform/graphics/Region.cpp
deleted file mode 100644
index 148e838..0000000
--- a/Source/core/platform/graphics/Region.cpp
+++ /dev/null
@@ -1,611 +0,0 @@
-/*
- * Copyright (C) 2010, 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 INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/platform/graphics/Region.h"
-
-#include <stdio.h>
-
-// A region class based on the paper "Scanline Coherent Shape Algebra"
-// by Jonathan E. Steinhart from the book "Graphics Gems II".
-//
-// This implementation uses two vectors instead of linked list, and
-// also compresses regions when possible.
-
-namespace WebCore {
-
-Region::Region()
-{
-}
-
-Region::Region(const IntRect& rect)
-    : m_bounds(rect)
-    , m_shape(rect)
-{
-}
-
-Vector<IntRect> Region::rects() const
-{
-    Vector<IntRect> rects;
-
-    for (Shape::SpanIterator span = m_shape.spans_begin(), end = m_shape.spans_end(); span != end && span + 1 != end; ++span) {
-        int y = span->y;
-        int height = (span + 1)->y - y;
-
-        for (Shape::SegmentIterator segment = m_shape.segments_begin(span), end = m_shape.segments_end(span); segment != end && segment + 1 != end; segment += 2) {
-            int x = *segment;
-            int width = *(segment + 1) - x;
-
-            rects.append(IntRect(x, y, width, height));
-        }
-    }
-
-    return rects;
-}
-
-bool Region::contains(const Region& region) const
-{
-    if (!m_bounds.contains(region.m_bounds))
-        return false;
-
-    return Shape::compareShapes<Shape::CompareContainsOperation>(m_shape, region.m_shape);
-}
-
-bool Region::contains(const IntPoint& point) const
-{
-    if (!m_bounds.contains(point))
-        return false;
-
-    for (Shape::SpanIterator span = m_shape.spans_begin(), end = m_shape.spans_end(); span != end && span + 1 != end; ++span) {
-        int y = span->y;
-        int maxY = (span + 1)->y;
-
-        if (y > point.y())
-            break;
-        if (maxY <= point.y())
-            continue;
-
-        for (Shape::SegmentIterator segment = m_shape.segments_begin(span), end = m_shape.segments_end(span); segment != end && segment + 1 != end; segment += 2) {
-            int x = *segment;
-            int maxX = *(segment + 1);
-
-            if (x > point.x())
-                break;
-            if (maxX > point.x())
-                return true;
-        }
-    }
-
-    return false;
-}
-
-bool Region::intersects(const Region& region) const
-{
-    if (!m_bounds.intersects(region.m_bounds))
-        return false;
-
-    return Shape::compareShapes<Shape::CompareIntersectsOperation>(m_shape, region.m_shape);
-}
-
-unsigned Region::totalArea() const
-{
-    Vector<IntRect> rects = this->rects();
-    size_t size = rects.size();
-    unsigned totalArea = 0;
-
-    for (size_t i = 0; i < size; ++i) {
-        IntRect rect = rects[i];
-        totalArea += (rect.width() * rect.height());
-    }
-
-    return totalArea;
-}
-
-template<typename CompareOperation>
-bool Region::Shape::compareShapes(const Shape& aShape, const Shape& bShape)
-{
-    bool result = CompareOperation::defaultResult;
-
-    Shape::SpanIterator aSpan = aShape.spans_begin();
-    Shape::SpanIterator aSpanEnd = aShape.spans_end();
-    Shape::SpanIterator bSpan = bShape.spans_begin();
-    Shape::SpanIterator bSpanEnd = bShape.spans_end();
-
-    bool aHadSegmentInPreviousSpan = false;
-    bool bHadSegmentInPreviousSpan = false;
-    while (aSpan != aSpanEnd && aSpan + 1 != aSpanEnd && bSpan != bSpanEnd && bSpan + 1 != bSpanEnd) {
-        int aY = aSpan->y;
-        int aMaxY = (aSpan + 1)->y;
-        int bY = bSpan->y;
-        int bMaxY = (bSpan + 1)->y;
-
-        Shape::SegmentIterator aSegment = aShape.segments_begin(aSpan);
-        Shape::SegmentIterator aSegmentEnd = aShape.segments_end(aSpan);
-        Shape::SegmentIterator bSegment = bShape.segments_begin(bSpan);
-        Shape::SegmentIterator bSegmentEnd = bShape.segments_end(bSpan);
-
-        // Look for a non-overlapping part of the spans. If B had a segment in its previous span, then we already tested A against B within that span.
-        bool aHasSegmentInSpan = aSegment != aSegmentEnd;
-        bool bHasSegmentInSpan = bSegment != bSegmentEnd;
-        if (aY < bY && !bHadSegmentInPreviousSpan && aHasSegmentInSpan && CompareOperation::aOutsideB(result))
-            return result;
-        if (bY < aY && !aHadSegmentInPreviousSpan && bHasSegmentInSpan && CompareOperation::bOutsideA(result))
-            return result;
-
-        aHadSegmentInPreviousSpan = aHasSegmentInSpan;
-        bHadSegmentInPreviousSpan = bHasSegmentInSpan;
-
-        bool spansOverlap = bMaxY > aY && bY < aMaxY;
-        if (spansOverlap) {
-            while (aSegment != aSegmentEnd && bSegment != bSegmentEnd) {
-                int aX = *aSegment;
-                int aMaxX = *(aSegment + 1);
-                int bX = *bSegment;
-                int bMaxX = *(bSegment + 1);
-
-                bool segmentsOverlap = bMaxX > aX && bX < aMaxX;
-                if (segmentsOverlap && CompareOperation::aOverlapsB(result))
-                    return result;
-                if (aX < bX && CompareOperation::aOutsideB(result))
-                    return result;
-                if (bX < aX && CompareOperation::bOutsideA(result))
-                    return result;
-
-                if (aMaxX < bMaxX)
-                    aSegment += 2;
-                else if (bMaxX < aMaxX)
-                    bSegment += 2;
-                else {
-                    aSegment += 2;
-                    bSegment += 2;
-                }
-            }
-
-            if (aSegment != aSegmentEnd && CompareOperation::aOutsideB(result))
-                return result;
-            if (bSegment != bSegmentEnd && CompareOperation::bOutsideA(result))
-                return result;
-        }
-
-        if (aMaxY < bMaxY)
-            aSpan += 1;
-        else if (bMaxY < aMaxY)
-            bSpan += 1;
-        else {
-            aSpan += 1;
-            bSpan += 1;
-        }
-    }
-
-    if (aSpan != aSpanEnd && aSpan + 1 != aSpanEnd && CompareOperation::aOutsideB(result))
-        return result;
-    if (bSpan != bSpanEnd && bSpan + 1 != bSpanEnd && CompareOperation::bOutsideA(result))
-        return result;
-
-    return result;
-}
-
-struct Region::Shape::CompareContainsOperation {
-    const static bool defaultResult = true;
-    inline static bool aOutsideB(bool& /* result */) { return false; }
-    inline static bool bOutsideA(bool& result) { result = false; return true; }
-    inline static bool aOverlapsB(bool& /* result */) { return false; }
-};
-
-struct Region::Shape::CompareIntersectsOperation {
-    const static bool defaultResult = false;
-    inline static bool aOutsideB(bool& /* result */) { return false; }
-    inline static bool bOutsideA(bool& /* result */) { return false; }
-    inline static bool aOverlapsB(bool& result) { result = true; return true; }
-};
-
-Region::Shape::Shape()
-{
-}
-
-Region::Shape::Shape(const IntRect& rect)
-{
-    appendSpan(rect.y());
-    appendSegment(rect.x());
-    appendSegment(rect.maxX());
-    appendSpan(rect.maxY());
-}
-
-void Region::Shape::appendSpan(int y)
-{
-    m_spans.append(Span(y, m_segments.size()));
-}
-
-bool Region::Shape::canCoalesce(SegmentIterator begin, SegmentIterator end)
-{
-    if (m_spans.isEmpty())
-        return false;
-
-    SegmentIterator lastSpanBegin = m_segments.data() + m_spans.last().segmentIndex;
-    SegmentIterator lastSpanEnd = m_segments.data() + m_segments.size();
-
-    // Check if both spans have an equal number of segments.
-    if (lastSpanEnd - lastSpanBegin != end - begin)
-        return false;
-
-    // Check if both spans are equal.
-    if (!std::equal(begin, end, lastSpanBegin))
-        return false;
-
-    // Since the segments are equal the second segment can just be ignored.
-    return true;
-}
-
-void Region::Shape::appendSpan(int y, SegmentIterator begin, SegmentIterator end)
-{
-    if (canCoalesce(begin, end))
-        return;
-
-    appendSpan(y);
-    m_segments.appendRange(begin, end);
-}
-
-void Region::Shape::appendSpans(const Shape& shape, SpanIterator begin, SpanIterator end)
-{
-    for (SpanIterator it = begin; it != end; ++it)
-        appendSpan(it->y, shape.segments_begin(it), shape.segments_end(it));
-}
-
-void Region::Shape::appendSegment(int x)
-{
-    m_segments.append(x);
-}
-
-Region::Shape::SpanIterator Region::Shape::spans_begin() const
-{
-    return m_spans.data();
-}
-
-Region::Shape::SpanIterator Region::Shape::spans_end() const
-{
-    return m_spans.data() + m_spans.size();
-}
-
-Region::Shape::SegmentIterator Region::Shape::segments_begin(SpanIterator it) const
-{
-    ASSERT(it >= m_spans.data());
-    ASSERT(it < m_spans.data() + m_spans.size());
-
-    // Check if this span has any segments.
-    if (it->segmentIndex == m_segments.size())
-        return 0;
-
-    return &m_segments[it->segmentIndex];
-}
-
-Region::Shape::SegmentIterator Region::Shape::segments_end(SpanIterator it) const
-{
-    ASSERT(it >= m_spans.data());
-    ASSERT(it < m_spans.data() + m_spans.size());
-
-    // Check if this span has any segments.
-    if (it->segmentIndex == m_segments.size())
-        return 0;
-
-    ASSERT(it + 1 < m_spans.data() + m_spans.size());
-    size_t segmentIndex = (it + 1)->segmentIndex;
-
-    ASSERT_WITH_SECURITY_IMPLICATION(segmentIndex <= m_segments.size());
-    return m_segments.data() + segmentIndex;
-}
-
-#ifndef NDEBUG
-void Region::Shape::dump() const
-{
-    for (Shape::SpanIterator span = spans_begin(), end = spans_end(); span != end; ++span) {
-        printf("%6d: (", span->y);
-
-        for (Shape::SegmentIterator segment = segments_begin(span), end = segments_end(span); segment != end; ++segment)
-            printf("%d ", *segment);
-        printf(")\n");
-    }
-
-    printf("\n");
-}
-#endif
-
-IntRect Region::Shape::bounds() const
-{
-    if (isEmpty())
-        return IntRect();
-
-    SpanIterator span = spans_begin();
-    int minY = span->y;
-
-    SpanIterator lastSpan = spans_end() - 1;
-    int maxY = lastSpan->y;
-
-    int minX = std::numeric_limits<int>::max();
-    int maxX = std::numeric_limits<int>::min();
-
-    while (span != lastSpan) {
-        SegmentIterator firstSegment = segments_begin(span);
-        SegmentIterator lastSegment = segments_end(span) - 1;
-
-        if (firstSegment && lastSegment) {
-            ASSERT(firstSegment != lastSegment);
-
-            if (*firstSegment < minX)
-                minX = *firstSegment;
-
-            if (*lastSegment > maxX)
-                maxX = *lastSegment;
-        }
-
-        ++span;
-    }
-
-    ASSERT(minX <= maxX);
-    ASSERT(minY <= maxY);
-
-    return IntRect(minX, minY, maxX - minX, maxY - minY);
-}
-
-void Region::Shape::translate(const IntSize& offset)
-{
-    for (size_t i = 0; i < m_segments.size(); ++i)
-        m_segments[i] += offset.width();
-    for (size_t i = 0; i < m_spans.size(); ++i)
-        m_spans[i].y += offset.height();
-}
-
-void Region::Shape::swap(Shape& other)
-{
-    m_segments.swap(other.m_segments);
-    m_spans.swap(other.m_spans);
-}
-
-enum {
-    Shape1,
-    Shape2,
-};
-
-template<typename Operation>
-Region::Shape Region::Shape::shapeOperation(const Shape& shape1, const Shape& shape2)
-{
-    COMPILE_ASSERT(!(!Operation::shouldAddRemainingSegmentsFromSpan1 && Operation::shouldAddRemainingSegmentsFromSpan2), invalid_segment_combination);
-    COMPILE_ASSERT(!(!Operation::shouldAddRemainingSpansFromShape1 && Operation::shouldAddRemainingSpansFromShape2), invalid_span_combination);
-
-    Shape result;
-    if (Operation::trySimpleOperation(shape1, shape2, result))
-        return result;
-
-    SpanIterator spans1 = shape1.spans_begin();
-    SpanIterator spans1End = shape1.spans_end();
-
-    SpanIterator spans2 = shape2.spans_begin();
-    SpanIterator spans2End = shape2.spans_end();
-
-    SegmentIterator segments1 = 0;
-    SegmentIterator segments1End = 0;
-
-    SegmentIterator segments2 = 0;
-    SegmentIterator segments2End = 0;
-
-    // Iterate over all spans.
-    while (spans1 != spans1End && spans2 != spans2End) {
-        int y = 0;
-        int test = spans1->y - spans2->y;
-
-        if (test <= 0) {
-            y = spans1->y;
-
-            segments1 = shape1.segments_begin(spans1);
-            segments1End = shape1.segments_end(spans1);
-            ++spans1;
-        }
-        if (test >= 0) {
-            y = spans2->y;
-
-            segments2 = shape2.segments_begin(spans2);
-            segments2End = shape2.segments_end(spans2);
-            ++spans2;
-        }
-
-        int flag = 0;
-        int oldFlag = 0;
-
-        SegmentIterator s1 = segments1;
-        SegmentIterator s2 = segments2;
-
-        Vector<int, 32> segments;
-
-        // Now iterate over the segments in each span and construct a new vector of segments.
-        while (s1 != segments1End && s2 != segments2End) {
-            int test = *s1 - *s2;
-            int x;
-
-            if (test <= 0) {
-                x = *s1;
-                flag = flag ^ 1;
-                ++s1;
-            }
-            if (test >= 0) {
-                x = *s2;
-                flag = flag ^ 2;
-                ++s2;
-            }
-
-            if (flag == Operation::opCode || oldFlag == Operation::opCode)
-                segments.append(x);
-
-            oldFlag = flag;
-        }
-
-        // Add any remaining segments.
-        if (Operation::shouldAddRemainingSegmentsFromSpan1 && s1 != segments1End)
-            segments.appendRange(s1, segments1End);
-        else if (Operation::shouldAddRemainingSegmentsFromSpan2 && s2 != segments2End)
-            segments.appendRange(s2, segments2End);
-
-        // Add the span.
-        if (!segments.isEmpty() || !result.isEmpty())
-            result.appendSpan(y, segments.data(), segments.data() + segments.size());
-    }
-
-    // Add any remaining spans.
-    if (Operation::shouldAddRemainingSpansFromShape1 && spans1 != spans1End)
-        result.appendSpans(shape1, spans1, spans1End);
-    else if (Operation::shouldAddRemainingSpansFromShape2 && spans2 != spans2End)
-        result.appendSpans(shape2, spans2, spans2End);
-
-    return result;
-}
-
-struct Region::Shape::UnionOperation {
-    static bool trySimpleOperation(const Shape& shape1, const Shape& shape2, Shape& result)
-    {
-        if (shape1.isEmpty()) {
-            result = shape2;
-            return true;
-        }
-
-        return false;
-    }
-
-    static const int opCode = 0;
-
-    static const bool shouldAddRemainingSegmentsFromSpan1 = true;
-    static const bool shouldAddRemainingSegmentsFromSpan2 = true;
-    static const bool shouldAddRemainingSpansFromShape1 = true;
-    static const bool shouldAddRemainingSpansFromShape2 = true;
-};
-
-Region::Shape Region::Shape::unionShapes(const Shape& shape1, const Shape& shape2)
-{
-    return shapeOperation<UnionOperation>(shape1, shape2);
-}
-
-struct Region::Shape::IntersectOperation {
-    static bool trySimpleOperation(const Shape&, const Shape&, Shape&)
-    {
-        return false;
-    }
-
-    static const int opCode = 3;
-
-    static const bool shouldAddRemainingSegmentsFromSpan1 = false;
-    static const bool shouldAddRemainingSegmentsFromSpan2 = false;
-    static const bool shouldAddRemainingSpansFromShape1 = false;
-    static const bool shouldAddRemainingSpansFromShape2 = false;
-};
-
-Region::Shape Region::Shape::intersectShapes(const Shape& shape1, const Shape& shape2)
-{
-    return shapeOperation<IntersectOperation>(shape1, shape2);
-}
-
-struct Region::Shape::SubtractOperation {
-    static bool trySimpleOperation(const Shape&, const Shape&, Region::Shape&)
-    {
-        return false;
-    }
-
-    static const int opCode = 1;
-
-    static const bool shouldAddRemainingSegmentsFromSpan1 = true;
-    static const bool shouldAddRemainingSegmentsFromSpan2 = false;
-    static const bool shouldAddRemainingSpansFromShape1 = true;
-    static const bool shouldAddRemainingSpansFromShape2 = false;
-};
-
-Region::Shape Region::Shape::subtractShapes(const Shape& shape1, const Shape& shape2)
-{
-    return shapeOperation<SubtractOperation>(shape1, shape2);
-}
-
-#ifndef NDEBUG
-void Region::dump() const
-{
-    printf("Bounds: (%d, %d, %d, %d)\n",
-           m_bounds.x(), m_bounds.y(), m_bounds.width(), m_bounds.height());
-    m_shape.dump();
-}
-#endif
-
-void Region::intersect(const Region& region)
-{
-    if (m_bounds.isEmpty())
-        return;
-    if (!m_bounds.intersects(region.m_bounds)) {
-        m_shape = Shape();
-        m_bounds = IntRect();
-        return;
-    }
-
-    Shape intersectedShape = Shape::intersectShapes(m_shape, region.m_shape);
-
-    m_shape.swap(intersectedShape);
-    m_bounds = m_shape.bounds();
-}
-
-void Region::unite(const Region& region)
-{
-    if (region.isEmpty())
-        return;
-    if (isRect() && m_bounds.contains(region.m_bounds))
-        return;
-    if (region.isRect() && region.m_bounds.contains(m_bounds)) {
-        m_shape = region.m_shape;
-        m_bounds = region.m_bounds;
-        return;
-    }
-    // FIXME: We may want another way to construct a Region without doing this test when we expect it to be false.
-    if (!isRect() && contains(region))
-        return;
-
-    Shape unitedShape = Shape::unionShapes(m_shape, region.m_shape);
-
-    m_shape.swap(unitedShape);
-    m_bounds.unite(region.m_bounds);
-}
-
-void Region::subtract(const Region& region)
-{
-    if (m_bounds.isEmpty())
-        return;
-    if (region.isEmpty())
-        return;
-    if (!m_bounds.intersects(region.m_bounds))
-        return;
-
-    Shape subtractedShape = Shape::subtractShapes(m_shape, region.m_shape);
-
-    m_shape.swap(subtractedShape);
-    m_bounds = m_shape.bounds();
-}
-
-void Region::translate(const IntSize& offset)
-{
-    m_bounds.move(offset);
-    m_shape.translate(offset);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/graphics/Region.h b/Source/core/platform/graphics/Region.h
deleted file mode 100644
index 9e8406c..0000000
--- a/Source/core/platform/graphics/Region.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2010, 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 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 Region_h
-#define Region_h
-
-#include "core/platform/graphics/IntRect.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class Region {
-public:
-    Region();
-    Region(const IntRect&);
-
-    IntRect bounds() const { return m_bounds; }
-    bool isEmpty() const { return m_bounds.isEmpty(); }
-    bool isRect() const { return m_shape.isRect(); }
-
-    Vector<IntRect> rects() const;
-
-    void unite(const Region&);
-    void intersect(const Region&);
-    void subtract(const Region&);
-
-    void translate(const IntSize&);
-
-    // Returns true if the query region is a subset of this region.
-    bool contains(const Region&) const;
-
-    bool contains(const IntPoint&) const;
-
-    // Returns true if the query region intersects any part of this region.
-    bool intersects(const Region&) const;
-
-    unsigned totalArea() const;
-
-#ifndef NDEBUG
-    void dump() const;
-#endif
-
-private:
-    struct Span {
-        Span(int y, size_t segmentIndex)
-            : y(y), segmentIndex(segmentIndex)
-        {
-        }
-
-        int y;
-        size_t segmentIndex;
-    };
-
-    class Shape {
-    public:
-        Shape();
-        Shape(const IntRect&);
-
-        IntRect bounds() const;
-        bool isEmpty() const { return m_spans.isEmpty(); }
-        bool isRect() const { return m_spans.size() <= 2 && m_segments.size() <= 2; }
-
-        typedef const Span* SpanIterator;
-        SpanIterator spans_begin() const;
-        SpanIterator spans_end() const;
-
-        typedef const int* SegmentIterator;
-        SegmentIterator segments_begin(SpanIterator) const;
-        SegmentIterator segments_end(SpanIterator) const;
-
-        static Shape unionShapes(const Shape& shape1, const Shape& shape2);
-        static Shape intersectShapes(const Shape& shape1, const Shape& shape2);
-        static Shape subtractShapes(const Shape& shape1, const Shape& shape2);
-
-        void translate(const IntSize&);
-        void swap(Shape&);
-
-        struct CompareContainsOperation;
-        struct CompareIntersectsOperation;
-
-        template<typename CompareOperation>
-        static bool compareShapes(const Shape& shape1, const Shape& shape2);
-
-#ifndef NDEBUG
-        void dump() const;
-#endif
-
-    private:
-        struct UnionOperation;
-        struct IntersectOperation;
-        struct SubtractOperation;
-
-        template<typename Operation>
-        static Shape shapeOperation(const Shape& shape1, const Shape& shape2);
-
-        void appendSegment(int x);
-        void appendSpan(int y);
-        void appendSpan(int y, SegmentIterator begin, SegmentIterator end);
-        void appendSpans(const Shape&, SpanIterator begin, SpanIterator end);
-
-        bool canCoalesce(SegmentIterator begin, SegmentIterator end);
-
-        Vector<int, 32> m_segments;
-        Vector<Span, 16> m_spans;
-
-        friend bool operator==(const Shape&, const Shape&);
-    };
-
-    IntRect m_bounds;
-    Shape m_shape;
-
-    friend bool operator==(const Region&, const Region&);
-    friend bool operator==(const Shape&, const Shape&);
-    friend bool operator==(const Span&, const Span&);
-};
-
-static inline Region intersect(const Region& a, const Region& b)
-{
-    Region result(a);
-    result.intersect(b);
-
-    return result;
-}
-
-static inline Region subtract(const Region& a, const Region& b)
-{
-    Region result(a);
-    result.subtract(b);
-
-    return result;
-}
-
-static inline Region translate(const Region& region, const IntSize& offset)
-{
-    Region result(region);
-    result.translate(offset);
-
-    return result;
-}
-
-inline bool operator==(const Region& a, const Region& b)
-{
-    return a.m_bounds == b.m_bounds && a.m_shape == b.m_shape;
-}
-
-inline bool operator==(const Region::Shape& a, const Region::Shape& b)
-{
-    return a.m_spans == b.m_spans && a.m_segments == b.m_segments;
-}
-
-inline bool operator==(const Region::Span& a, const Region::Span& b)
-{
-    return a.y == b.y && a.segmentIndex == b.segmentIndex;
-}
-
-} // namespace WebCore
-
-#endif // Region_h
diff --git a/Source/core/platform/graphics/RoundedRect.cpp b/Source/core/platform/graphics/RoundedRect.cpp
deleted file mode 100644
index 4ef8261..0000000
--- a/Source/core/platform/graphics/RoundedRect.cpp
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Google Inc. All rights reserved.
- * Copyright (C) 2013 Xidorn Quan (quanxunzhen@gmail.com)
- *
- * 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/graphics/RoundedRect.h"
-#include "wtf/Assertions.h"
-
-#include <algorithm>
-
-using namespace std;
-
-namespace WebCore {
-
-bool RoundedRect::Radii::isZero() const
-{
-    return m_topLeft.isZero() && m_topRight.isZero() && m_bottomLeft.isZero() && m_bottomRight.isZero();
-}
-
-void RoundedRect::Radii::scale(float factor)
-{
-    if (factor == 1)
-        return;
-
-    // If either radius on a corner becomes zero, reset both radii on that corner.
-    m_topLeft.scale(factor);
-    if (!m_topLeft.width() || !m_topLeft.height())
-        m_topLeft = IntSize();
-    m_topRight.scale(factor);
-    if (!m_topRight.width() || !m_topRight.height())
-        m_topRight = IntSize();
-    m_bottomLeft.scale(factor);
-    if (!m_bottomLeft.width() || !m_bottomLeft.height())
-        m_bottomLeft = IntSize();
-    m_bottomRight.scale(factor);
-    if (!m_bottomRight.width() || !m_bottomRight.height())
-        m_bottomRight = IntSize();
-
-}
-
-void RoundedRect::Radii::expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth)
-{
-    if (m_topLeft.width() > 0 && m_topLeft.height() > 0) {
-        m_topLeft.setWidth(max<int>(0, m_topLeft.width() + leftWidth));
-        m_topLeft.setHeight(max<int>(0, m_topLeft.height() + topWidth));
-    }
-    if (m_topRight.width() > 0 && m_topRight.height() > 0) {
-        m_topRight.setWidth(max<int>(0, m_topRight.width() + rightWidth));
-        m_topRight.setHeight(max<int>(0, m_topRight.height() + topWidth));
-    }
-    if (m_bottomLeft.width() > 0 && m_bottomLeft.height() > 0) {
-        m_bottomLeft.setWidth(max<int>(0, m_bottomLeft.width() + leftWidth));
-        m_bottomLeft.setHeight(max<int>(0, m_bottomLeft.height() + bottomWidth));
-    }
-    if (m_bottomRight.width() > 0 && m_bottomRight.height() > 0) {
-        m_bottomRight.setWidth(max<int>(0, m_bottomRight.width() + rightWidth));
-        m_bottomRight.setHeight(max<int>(0, m_bottomRight.height() + bottomWidth));
-    }
-}
-
-void RoundedRect::inflateWithRadii(int size)
-{
-    IntRect old = m_rect;
-
-    m_rect.inflate(size);
-    // Considering the inflation factor of shorter size to scale the radii seems appropriate here
-    float factor;
-    if (m_rect.width() < m_rect.height())
-        factor = old.width() ? (float)m_rect.width() / old.width() : int(0);
-    else
-        factor = old.height() ? (float)m_rect.height() / old.height() : int(0);
-
-    m_radii.scale(factor);
-}
-
-void RoundedRect::Radii::includeLogicalEdges(const RoundedRect::Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
-{
-    if (includeLogicalLeftEdge) {
-        if (isHorizontal)
-            m_bottomLeft = edges.bottomLeft();
-        else
-            m_topRight = edges.topRight();
-        m_topLeft = edges.topLeft();
-    }
-
-    if (includeLogicalRightEdge) {
-        if (isHorizontal)
-            m_topRight = edges.topRight();
-        else
-            m_bottomLeft = edges.bottomLeft();
-        m_bottomRight = edges.bottomRight();
-    }
-}
-
-void RoundedRect::Radii::excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge)
-{
-    if (excludeLogicalLeftEdge) {
-        if (isHorizontal)
-            m_bottomLeft = IntSize();
-        else
-            m_topRight = IntSize();
-        m_topLeft = IntSize();
-    }
-
-    if (excludeLogicalRightEdge) {
-        if (isHorizontal)
-            m_topRight = IntSize();
-        else
-            m_bottomLeft = IntSize();
-        m_bottomRight = IntSize();
-    }
-}
-
-RoundedRect::RoundedRect(int x, int y, int width, int height)
-    : m_rect(x, y, width, height)
-{
-}
-
-RoundedRect::RoundedRect(const IntRect& rect, const Radii& radii)
-    : m_rect(rect)
-    , m_radii(radii)
-{
-}
-
-RoundedRect::RoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight)
-    : m_rect(rect)
-    , m_radii(topLeft, topRight, bottomLeft, bottomRight)
-{
-}
-
-IntRect RoundedRect::radiusCenterRect() const
-{
-    ASSERT(isRenderable());
-    int minX = m_rect.x() + max(m_radii.topLeft().width(), m_radii.bottomLeft().width());
-    int minY = m_rect.y() + max(m_radii.topLeft().height(), m_radii.topRight().height());
-    int maxX = m_rect.maxX() - max(m_radii.topRight().width(), m_radii.bottomRight().width());
-    int maxY = m_rect.maxY() - max(m_radii.bottomLeft().height(), m_radii.bottomRight().height());
-    return IntRect(minX, minY, maxX - minX, maxY - minY);
-}
-
-void RoundedRect::includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
-{
-    m_radii.includeLogicalEdges(edges, isHorizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
-}
-
-void RoundedRect::excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge)
-{
-    m_radii.excludeLogicalEdges(isHorizontal, excludeLogicalLeftEdge, excludeLogicalRightEdge);
-}
-
-bool RoundedRect::isRenderable() const
-{
-    return m_radii.topLeft().width() + m_radii.topRight().width() <= m_rect.width()
-        && m_radii.bottomLeft().width() + m_radii.bottomRight().width() <= m_rect.width()
-        && m_radii.topLeft().height() + m_radii.bottomLeft().height() <= m_rect.height()
-        && m_radii.topRight().height() + m_radii.bottomRight().height() <= m_rect.height();
-}
-
-void RoundedRect::adjustRadii()
-{
-    int maxRadiusWidth = std::max(m_radii.topLeft().width() + m_radii.topRight().width(), m_radii.bottomLeft().width() + m_radii.bottomRight().width());
-    int maxRadiusHeight = std::max(m_radii.topLeft().height() + m_radii.bottomLeft().height(), m_radii.topRight().height() + m_radii.bottomRight().height());
-
-    if (maxRadiusWidth <= 0 || maxRadiusHeight <= 0) {
-        m_radii.scale(0.0f);
-        return;
-    }
-    float widthRatio = static_cast<float>(m_rect.width()) / maxRadiusWidth;
-    float heightRatio = static_cast<float>(m_rect.height()) / maxRadiusHeight;
-    m_radii.scale(widthRatio < heightRatio ? widthRatio : heightRatio);
-}
-
-bool RoundedRect::intersectsQuad(const FloatQuad& quad) const
-{
-    FloatRect rect(m_rect);
-    if (!quad.intersectsRect(rect))
-        return false;
-
-    const IntSize& topLeft = m_radii.topLeft();
-    if (!topLeft.isEmpty()) {
-        FloatRect rect(m_rect.x(), m_rect.y(), topLeft.width(), topLeft.height());
-        if (quad.intersectsRect(rect)) {
-            FloatPoint center(m_rect.x() + topLeft.width(), m_rect.y() + topLeft.height());
-            FloatSize size(topLeft.width(), topLeft.height());
-            if (!quad.intersectsEllipse(center, size))
-                return false;
-        }
-    }
-
-    const IntSize& topRight = m_radii.topRight();
-    if (!topRight.isEmpty()) {
-        FloatRect rect(m_rect.maxX() - topRight.width(), m_rect.y(), topRight.width(), topRight.height());
-        if (quad.intersectsRect(rect)) {
-            FloatPoint center(m_rect.maxX() - topRight.width(), m_rect.y() + topRight.height());
-            FloatSize size(topRight.width(), topRight.height());
-            if (!quad.intersectsEllipse(center, size))
-                return false;
-        }
-    }
-
-    const IntSize& bottomLeft = m_radii.bottomLeft();
-    if (!bottomLeft.isEmpty()) {
-        FloatRect rect(m_rect.x(), m_rect.maxY() - bottomLeft.height(), bottomLeft.width(), bottomLeft.height());
-        if (quad.intersectsRect(rect)) {
-            FloatPoint center(m_rect.x() + bottomLeft.width(), m_rect.maxY() - bottomLeft.height());
-            FloatSize size(bottomLeft.width(), bottomLeft.height());
-            if (!quad.intersectsEllipse(center, size))
-                return false;
-        }
-    }
-
-    const IntSize& bottomRight = m_radii.bottomRight();
-    if (!bottomRight.isEmpty()) {
-        FloatRect rect(m_rect.maxX() - bottomRight.width(), m_rect.maxY() - bottomRight.height(), bottomRight.width(), bottomRight.height());
-        if (quad.intersectsRect(rect)) {
-            FloatPoint center(m_rect.maxX() - bottomRight.width(), m_rect.maxY() - bottomRight.height());
-            FloatSize size(bottomRight.width(), bottomRight.height());
-            if (!quad.intersectsEllipse(center, size))
-                return false;
-        }
-    }
-
-    return true;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/graphics/RoundedRect.h b/Source/core/platform/graphics/RoundedRect.h
deleted file mode 100644
index 80c84f4..0000000
--- a/Source/core/platform/graphics/RoundedRect.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved.
- * 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.
- */
-
-#ifndef RoundedRect_h
-#define RoundedRect_h
-
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/IntRect.h"
-
-namespace WebCore {
-
-
-class RoundedRect {
-public:
-    class Radii {
-    public:
-        Radii() {}
-        Radii(const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight)
-            : m_topLeft(topLeft)
-            , m_topRight(topRight)
-            , m_bottomLeft(bottomLeft)
-            , m_bottomRight(bottomRight)
-        {
-        }
-
-        void setTopLeft(const IntSize& size) { m_topLeft = size; }
-        void setTopRight(const IntSize& size) { m_topRight = size; }
-        void setBottomLeft(const IntSize& size) { m_bottomLeft = size; }
-        void setBottomRight(const IntSize& size) { m_bottomRight = size; }
-        const IntSize& topLeft() const { return m_topLeft; }
-        const IntSize& topRight() const { return m_topRight; }
-        const IntSize& bottomLeft() const { return m_bottomLeft; }
-        const IntSize& bottomRight() const { return m_bottomRight; }
-
-        bool isZero() const;
-
-        void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
-        void excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge);
-
-        void scale(float factor);
-        void expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth);
-        void expand(int size) { expand(size, size, size, size); }
-        void shrink(int topWidth, int bottomWidth, int leftWidth, int rightWidth) { expand(-topWidth, -bottomWidth, -leftWidth, -rightWidth); }
-        void shrink(int size) { shrink(size, size, size, size); }
-
-    private:
-        IntSize m_topLeft;
-        IntSize m_topRight;
-        IntSize m_bottomLeft;
-        IntSize m_bottomRight;
-    };
-
-    explicit RoundedRect(const IntRect&, const Radii& = Radii());
-    RoundedRect(int x, int y, int width, int height);
-    RoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
-
-    const IntRect& rect() const { return m_rect; }
-    const Radii& radii() const { return m_radii; }
-    bool isRounded() const { return !m_radii.isZero(); }
-    bool isEmpty() const { return m_rect.isEmpty(); }
-
-    // Returns a quickly computed rect enclosed by the rounded rect.
-    IntRect radiusCenterRect() const;
-
-    void setRect(const IntRect& rect) { m_rect = rect; }
-    void setRadii(const Radii& radii) { m_radii = radii; }
-
-    void move(const IntSize& size) { m_rect.move(size); }
-    void inflate(int size) { m_rect.inflate(size);  }
-    void inflateWithRadii(int size);
-    void expandRadii(int size) { m_radii.expand(size); }
-    void shrinkRadii(int size) { m_radii.shrink(size); }
-
-    void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
-    void excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge);
-
-    bool isRenderable() const;
-    void adjustRadii();
-
-    // Tests whether the quad intersects any part of this rounded rectangle.
-    // This only works for convex quads.
-    bool intersectsQuad(const FloatQuad&) const;
-
-private:
-    IntRect m_rect;
-    Radii m_radii;
-};
-
-inline bool operator==(const RoundedRect::Radii& a, const RoundedRect::Radii& b)
-{
-    return a.topLeft() == b.topLeft() && a.topRight() == b.topRight() && a.bottomLeft() == b.bottomLeft() && a.bottomRight() == b.bottomRight();
-}
-
-inline bool operator!=(const RoundedRect::Radii& a, const RoundedRect::Radii& b)
-{
-    return !(a == b);
-}
-
-inline bool operator==(const RoundedRect& a, const RoundedRect& b)
-{
-    return a.rect() == b.rect() && a.radii() == b.radii();
-}
-
-
-} // namespace WebCore
-
-#endif // RoundedRect_h
diff --git a/Source/core/platform/graphics/RoundedRectTest.cpp b/Source/core/platform/graphics/RoundedRectTest.cpp
deleted file mode 100644
index 2bdccb8..0000000
--- a/Source/core/platform/graphics/RoundedRectTest.cpp
+++ /dev/null
@@ -1,84 +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.
- */
-
-#include "config.h"
-#include "core/platform/graphics/RoundedRect.h"
-
-#include "core/platform/graphics/IntRect.h"
-
-#include <gtest/gtest.h>
-
-using namespace WebCore;
-
-namespace WebCore {
-
-// FIXME: Move this somewhere more generic.
-void PrintTo(const IntRect& rect, std::ostream* os)
-{
-    *os << "IntRect("
-        << rect.x() << ", "
-        << rect.y() << ", "
-        << rect.width() << ", "
-        << rect.height() << ")";
-}
-
-} // namespace WebCore
-
-namespace {
-
-TEST(RoundedRectTest, RadiusCenterRectZeroRadius)
-{
-    RoundedRect rr(100, 200, 300, 400);
-    EXPECT_TRUE(rr.rect().contains(rr.radiusCenterRect()));
-    EXPECT_EQ(IntRect(100, 200, 300, 400), rr.radiusCenterRect());
-}
-
-TEST(RoundedRectTest, RadiusCenterRectEqualRadius)
-{
-    RoundedRect rr(IntRect(100, 200, 300, 400), IntSize(10, 10), IntSize(10, 10), IntSize(10, 10), IntSize(10, 10));
-    EXPECT_TRUE(rr.rect().contains(rr.radiusCenterRect()));
-    EXPECT_EQ(IntRect(110, 210, 280, 380), rr.radiusCenterRect());
-}
-
-TEST(RoundedRectTest, RadiusCenterRectUnequalRadius)
-{
-    RoundedRect rr(IntRect(100, 200, 300, 400), IntSize(5, 5), IntSize(10, 10), IntSize(15, 15), IntSize(20, 20));
-    EXPECT_TRUE(rr.rect().contains(rr.radiusCenterRect()));
-    EXPECT_EQ(IntRect(115, 210, 265, 370), rr.radiusCenterRect());
-}
-
-TEST(RoundedRectTest, RadiusCenterRectElliptical)
-{
-    RoundedRect rr(IntRect(100, 200, 300, 400), IntSize(20, 10), IntSize(20, 10), IntSize(10, 20), IntSize(10, 20));
-    EXPECT_TRUE(rr.rect().contains(rr.radiusCenterRect()));
-    EXPECT_EQ(IntRect(120, 210, 260, 370), rr.radiusCenterRect());
-}
-
-} // namespace
diff --git a/Source/core/platform/graphics/SegmentedFontData.cpp b/Source/core/platform/graphics/SegmentedFontData.cpp
index 0272081..0804c2e 100644
--- a/Source/core/platform/graphics/SegmentedFontData.cpp
+++ b/Source/core/platform/graphics/SegmentedFontData.cpp
@@ -84,6 +84,17 @@
     return false;
 }
 
+// Returns true only if all of the sub fonts are loadingFallback.
+bool SegmentedFontData::isLoadingFallback() const
+{
+    Vector<FontDataRange>::const_iterator end = m_ranges.end();
+    for (Vector<FontDataRange>::const_iterator it = m_ranges.begin(); it != end; ++it) {
+        if (!it->fontData()->isLoadingFallback())
+            return false;
+    }
+    return true;
+}
+
 bool SegmentedFontData::isSegmented() const
 {
     return true;
diff --git a/Source/core/platform/graphics/SegmentedFontData.h b/Source/core/platform/graphics/SegmentedFontData.h
index dda2960..58e8042 100644
--- a/Source/core/platform/graphics/SegmentedFontData.h
+++ b/Source/core/platform/graphics/SegmentedFontData.h
@@ -26,7 +26,7 @@
 #ifndef SegmentedFontData_h
 #define SegmentedFontData_h
 
-#include "core/platform/graphics/FontData.h"
+#include "platform/fonts/FontData.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
@@ -68,12 +68,13 @@
 private:
     SegmentedFontData() { }
 
-    virtual const SimpleFontData* fontDataForCharacter(UChar32) const;
-    virtual bool containsCharacters(const UChar*, int length) const;
+    virtual const SimpleFontData* fontDataForCharacter(UChar32) const OVERRIDE;
+    virtual bool containsCharacters(const UChar*, int length) const OVERRIDE;
 
-    virtual bool isCustomFont() const;
-    virtual bool isLoading() const;
-    virtual bool isSegmented() const;
+    virtual bool isCustomFont() const OVERRIDE;
+    virtual bool isLoading() const OVERRIDE;
+    virtual bool isLoadingFallback() const OVERRIDE;
+    virtual bool isSegmented() const OVERRIDE;
 
     bool containsCharacter(UChar32) const;
 
diff --git a/Source/core/platform/graphics/ShadowBlur.h b/Source/core/platform/graphics/ShadowBlur.h
index eb94a05..a93eb02 100644
--- a/Source/core/platform/graphics/ShadowBlur.h
+++ b/Source/core/platform/graphics/ShadowBlur.h
@@ -30,7 +30,7 @@
 #define ShadowBlur_h
 
 #include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/FloatSize.h"
+#include "platform/geometry/FloatSize.h"
 
 #include "wtf/Noncopyable.h"
 
diff --git a/Source/core/platform/graphics/SimpleFontData.h b/Source/core/platform/graphics/SimpleFontData.h
index ebcf8ab..9acc79d 100644
--- a/Source/core/platform/graphics/SimpleFontData.h
+++ b/Source/core/platform/graphics/SimpleFontData.h
@@ -24,18 +24,18 @@
 #ifndef SimpleFontData_h
 #define SimpleFontData_h
 
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/FontBaseline.h"
-#include "core/platform/graphics/FontData.h"
 #include "core/platform/graphics/FontMetrics.h"
 #include "core/platform/graphics/FontPlatformData.h"
 #include "core/platform/graphics/GlyphBuffer.h"
 #include "core/platform/graphics/GlyphMetricsMap.h"
 #include "core/platform/graphics/GlyphPageTreeNode.h"
+#include "platform/fonts/FontBaseline.h"
+#include "platform/fonts/FontData.h"
 #if ENABLE(OPENTYPE_VERTICAL)
 #include "core/platform/graphics/opentype/OpenTypeVerticalData.h"
 #endif
 #include "core/platform/graphics/TypesettingFeatures.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/StringHash.h"
@@ -147,8 +147,8 @@
     Glyph zeroGlyph() const { return m_zeroGlyph; }
     void setZeroGlyph(Glyph zeroGlyph) { m_zeroGlyph = zeroGlyph; }
 
-    virtual const SimpleFontData* fontDataForCharacter(UChar32) const;
-    virtual bool containsCharacters(const UChar*, int length) const;
+    virtual const SimpleFontData* fontDataForCharacter(UChar32) const OVERRIDE;
+    virtual bool containsCharacters(const UChar*, int length) const OVERRIDE;
 
     Glyph glyphForCharacter(UChar32) const;
 
@@ -157,11 +157,11 @@
 
     AdditionalFontData* fontData() const { return m_fontData.get(); }
     bool isSVGFont() const { return m_fontData; }
-    bool isLoadingFallback() const { return m_customFontData.isLoadingFallback; }
 
-    virtual bool isCustomFont() const { return m_customFontData.isCustomFont; }
-    virtual bool isLoading() const { return m_customFontData.isLoadingFallback && m_customFontData.isUsed; }
-    virtual bool isSegmented() const;
+    virtual bool isCustomFont() const OVERRIDE { return m_customFontData.isCustomFont; }
+    virtual bool isLoading() const OVERRIDE { return m_customFontData.isLoadingFallback && m_customFontData.isUsed; }
+    virtual bool isLoadingFallback() const OVERRIDE { return m_customFontData.isLoadingFallback; }
+    virtual bool isSegmented() const OVERRIDE;
 
     const GlyphData& missingGlyphData() const { return m_missingGlyphData; }
     void setMissingGlyphData(const GlyphData& glyphData) { m_missingGlyphData = glyphData; }
diff --git a/Source/core/platform/graphics/StringTruncator.cpp b/Source/core/platform/graphics/StringTruncator.cpp
index 650db60..33a8525 100644
--- a/Source/core/platform/graphics/StringTruncator.cpp
+++ b/Source/core/platform/graphics/StringTruncator.cpp
@@ -30,8 +30,8 @@
 #include "core/platform/graphics/StringTruncator.h"
 
 #include "core/platform/graphics/Font.h"
-#include "core/platform/graphics/TextRun.h"
-#include "core/platform/text/TextBreakIterator.h"
+#include "platform/graphics/TextRun.h"
+#include "platform/text/TextBreakIterator.h"
 #include "wtf/Assertions.h"
 #include "wtf/unicode/CharacterNames.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/platform/graphics/StrokeData.cpp b/Source/core/platform/graphics/StrokeData.cpp
index 039df5e..772f3ca 100644
--- a/Source/core/platform/graphics/StrokeData.cpp
+++ b/Source/core/platform/graphics/StrokeData.cpp
@@ -28,8 +28,8 @@
 
 #include "config.h"
 #include "core/platform/graphics/StrokeData.h"
-#include "wtf/OwnArrayPtr.h"
-#include "wtf/PassOwnArrayPtr.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
 
@@ -49,7 +49,7 @@
     }
 
     size_t count = !(dashLength % 2) ? dashLength : dashLength * 2;
-    OwnArrayPtr<SkScalar> intervals = adoptArrayPtr(new SkScalar[count]);
+    OwnPtr<SkScalar[]> intervals = adoptArrayPtr(new SkScalar[count]);
 
     for (unsigned i = 0; i < count; i++)
         intervals[i] = dashes[i % dashLength];
diff --git a/Source/core/platform/graphics/SurrogatePairAwareTextIterator.cpp b/Source/core/platform/graphics/SurrogatePairAwareTextIterator.cpp
deleted file mode 100644
index 3952418..0000000
--- a/Source/core/platform/graphics/SurrogatePairAwareTextIterator.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Holger Hans Peter Freyther
- * Copyright (C) Research In Motion Limited 2011. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "core/platform/graphics/SurrogatePairAwareTextIterator.h"
-
-#include <unicode/unorm.h>
-
-using namespace WTF;
-using namespace Unicode;
-
-namespace WebCore {
-
-SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator(const UChar* characters, int currentCharacter, int lastCharacter, int endCharacter)
-    : m_characters(characters)
-    , m_currentCharacter(currentCharacter)
-    , m_lastCharacter(lastCharacter)
-    , m_endCharacter(endCharacter)
-{
-}
-
-bool SurrogatePairAwareTextIterator::consumeSlowCase(UChar32& character, unsigned& clusterLength)
-{
-    if (character <= 0x30FE) {
-        // Deal with Hiragana and Katakana voiced and semi-voiced syllables.
-        // Normalize into composed form, and then look for glyph with base + combined mark.
-        // Check above for character range to minimize performance impact.
-        if (UChar32 normalized = normalizeVoicingMarks()) {
-            character = normalized;
-            clusterLength = 2;
-        }
-        return true;
-    }
-
-    if (!U16_IS_SURROGATE(character))
-        return true;
-
-    // If we have a surrogate pair, make sure it starts with the high part.
-    if (!U16_IS_SURROGATE_LEAD(character))
-        return false;
-
-    // Do we have a surrogate pair? If so, determine the full Unicode (32 bit) code point before glyph lookup.
-    // Make sure we have another character and it's a low surrogate.
-    if (m_currentCharacter + 1 >= m_endCharacter)
-        return false;
-
-    UChar low = m_characters[1];
-    if (!U16_IS_TRAIL(low))
-        return false;
-
-    character = U16_GET_SUPPLEMENTARY(character, low);
-    clusterLength = 2;
-    return true;
-}
-
-UChar32 SurrogatePairAwareTextIterator::normalizeVoicingMarks()
-{
-    // According to http://www.unicode.org/Public/UNIDATA/UCD.html#Canonical_Combining_Class_Values
-    static const uint8_t hiraganaKatakanaVoicingMarksCombiningClass = 8;
-
-    if (m_currentCharacter + 1 >= m_endCharacter)
-        return 0;
-
-    if (combiningClass(m_characters[1]) == hiraganaKatakanaVoicingMarksCombiningClass) {
-        // Normalize into composed form using 3.2 rules.
-        UChar normalizedCharacters[2] = { 0, 0 };
-        UErrorCode uStatus = U_ZERO_ERROR;
-        int32_t resultLength = unorm_normalize(m_characters, 2, UNORM_NFC, UNORM_UNICODE_3_2, &normalizedCharacters[0], 2, &uStatus);
-        if (resultLength == 1 && !uStatus)
-            return normalizedCharacters[0];
-    }
-
-    return 0;
-}
-
-}
diff --git a/Source/core/platform/graphics/SurrogatePairAwareTextIterator.h b/Source/core/platform/graphics/SurrogatePairAwareTextIterator.h
deleted file mode 100644
index 7cf7340..0000000
--- a/Source/core/platform/graphics/SurrogatePairAwareTextIterator.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) Research In Motion Limited 2011. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef SurrogatePairAwareTextIterator_h
-#define SurrogatePairAwareTextIterator_h
-
-#include "wtf/unicode/CharacterNames.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class SurrogatePairAwareTextIterator {
-public:
-    // The passed in UChar pointer starts at 'currentCharacter'. The iterator operatoes on the range [currentCharacter, lastCharacter].
-    // 'endCharacter' denotes the maximum length of the UChar array, which might exceed 'lastCharacter'.
-    SurrogatePairAwareTextIterator(const UChar*, int currentCharacter, int lastCharacter, int endCharacter);
-
-    inline bool consume(UChar32& character, unsigned& clusterLength)
-    {
-        if (m_currentCharacter >= m_lastCharacter)
-            return false;
-
-        character = *m_characters;
-        clusterLength = 1;
-
-        if (character < HiraganaLetterSmallA)
-            return true;
-
-        return consumeSlowCase(character, clusterLength);
-    }
-
-    void advance(unsigned advanceLength)
-    {
-        m_characters += advanceLength;
-        m_currentCharacter += advanceLength;
-    }
-
-    int currentCharacter() const { return m_currentCharacter; }
-    const UChar* characters() const { return m_characters; }
-
-private:
-    bool consumeSlowCase(UChar32&, unsigned&);
-    UChar32 normalizeVoicingMarks();
-
-    const UChar* m_characters;
-    int m_currentCharacter;
-    int m_lastCharacter;
-    int m_endCharacter;
-};
-
-}
-
-#endif
diff --git a/Source/core/platform/graphics/TextRun.cpp b/Source/core/platform/graphics/TextRun.cpp
deleted file mode 100644
index 03b032b..0000000
--- a/Source/core/platform/graphics/TextRun.cpp
+++ /dev/null
@@ -1,71 +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 INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/platform/graphics/TextRun.h"
-
-namespace WebCore {
-
-struct ExpectedTextRunSize {
-    const void* pointer;
-    int integers[2];
-    float float1;
-    float float2;
-    float float3;
-    uint32_t bitfields : 10;
-    unsigned anUnsigned;
-    RefPtr<TextRun::RenderingContext> renderingContext;
-};
-
-COMPILE_ASSERT(sizeof(TextRun) == sizeof(ExpectedTextRunSize), TextRun_is_not_of_expected_size);
-
-bool TextRun::s_allowsRoundingHacks = false;
-
-void TextRun::setAllowsRoundingHacks(bool allowsRoundingHacks)
-{
-    s_allowsRoundingHacks = allowsRoundingHacks;
-}
-
-void TextRun::setText(const String& string)
-{
-    m_len = string.length();
-    if (!m_len) {
-        m_data.characters8 = 0;
-        m_is8Bit = true;
-        return;
-    }
-    m_is8Bit = string.is8Bit();
-    if (m_is8Bit)
-        m_data.characters8 = string.characters8();
-    else
-        m_data.characters16 = string.characters16();
-}
-
-bool TextRun::allowsRoundingHacks()
-{
-    return s_allowsRoundingHacks;
-}
-
-}
diff --git a/Source/core/platform/graphics/TextRun.h b/Source/core/platform/graphics/TextRun.h
deleted file mode 100644
index 3f2836e..0000000
--- a/Source/core/platform/graphics/TextRun.h
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
- *           (C) 2000 Antti Koivisto (koivisto@kde.org)
- *           (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2006, 2007, 2011 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef TextRun_h
-#define TextRun_h
-
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/text/TextDirection.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class FloatPoint;
-class Font;
-class GraphicsContext;
-class GlyphBuffer;
-class SimpleFontData;
-struct GlyphData;
-struct WidthIterator;
-
-class TextRun {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    enum ExpansionBehaviorFlags {
-        ForbidTrailingExpansion = 0 << 0,
-        AllowTrailingExpansion = 1 << 0,
-        ForbidLeadingExpansion = 0 << 1,
-        AllowLeadingExpansion = 1 << 1,
-    };
-
-    typedef unsigned ExpansionBehavior;
-
-    enum RoundingHackFlags {
-        NoRounding = 0,
-        RunRounding = 1 << 0,
-        WordRounding = 1 << 1,
-    };
-
-    typedef unsigned RoundingHacks;
-
-    TextRun(const LChar* c, unsigned len, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
-        : m_charactersLength(len)
-        , m_len(len)
-        , m_xpos(xpos)
-        , m_horizontalGlyphStretch(1)
-        , m_expansion(expansion)
-        , m_expansionBehavior(expansionBehavior)
-        , m_is8Bit(true)
-        , m_allowTabs(false)
-        , m_direction(direction)
-        , m_directionalOverride(directionalOverride)
-        , m_characterScanForCodePath(characterScanForCodePath)
-        , m_applyRunRounding((roundingHacks & RunRounding) && s_allowsRoundingHacks)
-        , m_applyWordRounding((roundingHacks & WordRounding) && s_allowsRoundingHacks)
-        , m_disableSpacing(false)
-        , m_tabSize(0)
-    {
-        m_data.characters8 = c;
-    }
-
-    TextRun(const UChar* c, unsigned len, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
-        : m_charactersLength(len)
-        , m_len(len)
-        , m_xpos(xpos)
-        , m_horizontalGlyphStretch(1)
-        , m_expansion(expansion)
-        , m_expansionBehavior(expansionBehavior)
-        , m_is8Bit(false)
-        , m_allowTabs(false)
-        , m_direction(direction)
-        , m_directionalOverride(directionalOverride)
-        , m_characterScanForCodePath(characterScanForCodePath)
-        , m_applyRunRounding((roundingHacks & RunRounding) && s_allowsRoundingHacks)
-        , m_applyWordRounding((roundingHacks & WordRounding) && s_allowsRoundingHacks)
-        , m_disableSpacing(false)
-        , m_tabSize(0)
-    {
-        m_data.characters16 = c;
-    }
-
-    TextRun(const String& string, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
-        : m_charactersLength(string.length())
-        , m_len(string.length())
-        , m_xpos(xpos)
-        , m_horizontalGlyphStretch(1)
-        , m_expansion(expansion)
-        , m_expansionBehavior(expansionBehavior)
-        , m_allowTabs(false)
-        , m_direction(direction)
-        , m_directionalOverride(directionalOverride)
-        , m_characterScanForCodePath(characterScanForCodePath)
-        , m_applyRunRounding((roundingHacks & RunRounding) && s_allowsRoundingHacks)
-        , m_applyWordRounding((roundingHacks & WordRounding) && s_allowsRoundingHacks)
-        , m_disableSpacing(false)
-        , m_tabSize(0)
-    {
-        if (!m_charactersLength) {
-            m_is8Bit = true;
-            m_data.characters8 = 0;
-        } else if (string.is8Bit()) {
-            m_data.characters8 = string.characters8();
-            m_is8Bit = true;
-        } else {
-            m_data.characters16 = string.characters16();
-            m_is8Bit = false;
-        }
-    }
-
-    TextRun(const StringView& string, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
-        : m_charactersLength(string.length())
-        , m_len(string.length())
-        , m_xpos(xpos)
-        , m_horizontalGlyphStretch(1)
-        , m_expansion(expansion)
-        , m_expansionBehavior(expansionBehavior)
-        , m_allowTabs(false)
-        , m_direction(direction)
-        , m_directionalOverride(directionalOverride)
-        , m_characterScanForCodePath(characterScanForCodePath)
-        , m_applyRunRounding((roundingHacks & RunRounding) && s_allowsRoundingHacks)
-        , m_applyWordRounding((roundingHacks & WordRounding) && s_allowsRoundingHacks)
-        , m_disableSpacing(false)
-        , m_tabSize(0)
-    {
-        if (!m_charactersLength) {
-            m_is8Bit = true;
-            m_data.characters8 = 0;
-        } else if (string.is8Bit()) {
-            m_data.characters8 = string.characters8();
-            m_is8Bit = true;
-        } else {
-            m_data.characters16 = string.characters16();
-            m_is8Bit = false;
-        }
-    }
-
-    TextRun subRun(unsigned startOffset, unsigned length) const
-    {
-        ASSERT(startOffset < m_len);
-
-        TextRun result = *this;
-
-        if (is8Bit()) {
-            result.setText(data8(startOffset), length);
-            return result;
-        }
-        result.setText(data16(startOffset), length);
-        return result;
-    }
-
-    UChar operator[](unsigned i) const { ASSERT_WITH_SECURITY_IMPLICATION(i < m_len); return is8Bit() ? m_data.characters8[i] :m_data.characters16[i]; }
-    const LChar* data8(unsigned i) const { ASSERT_WITH_SECURITY_IMPLICATION(i < m_len); ASSERT(is8Bit()); return &m_data.characters8[i]; }
-    const UChar* data16(unsigned i) const { ASSERT_WITH_SECURITY_IMPLICATION(i < m_len); ASSERT(!is8Bit()); return &m_data.characters16[i]; }
-
-    const LChar* characters8() const { ASSERT(is8Bit()); return m_data.characters8; }
-    const UChar* characters16() const { ASSERT(!is8Bit()); return m_data.characters16; }
-
-    bool is8Bit() const { return m_is8Bit; }
-    int length() const { return m_len; }
-    int charactersLength() const { return m_charactersLength; }
-
-    void setText(const LChar* c, unsigned len) { m_data.characters8 = c; m_len = len; m_is8Bit = true;}
-    void setText(const UChar* c, unsigned len) { m_data.characters16 = c; m_len = len; m_is8Bit = false;}
-    void setText(const String&);
-    void setCharactersLength(unsigned charactersLength) { m_charactersLength = charactersLength; }
-
-    float horizontalGlyphStretch() const { return m_horizontalGlyphStretch; }
-    void setHorizontalGlyphStretch(float scale) { m_horizontalGlyphStretch = scale; }
-
-    bool allowTabs() const { return m_allowTabs; }
-    unsigned tabSize() const { return m_tabSize; }
-    void setTabSize(bool, unsigned);
-
-    float xPos() const { return m_xpos; }
-    void setXPos(float xPos) { m_xpos = xPos; }
-    float expansion() const { return m_expansion; }
-    bool allowsLeadingExpansion() const { return m_expansionBehavior & AllowLeadingExpansion; }
-    bool allowsTrailingExpansion() const { return m_expansionBehavior & AllowTrailingExpansion; }
-    TextDirection direction() const { return static_cast<TextDirection>(m_direction); }
-    bool rtl() const { return m_direction == RTL; }
-    bool ltr() const { return m_direction == LTR; }
-    bool directionalOverride() const { return m_directionalOverride; }
-    bool characterScanForCodePath() const { return m_characterScanForCodePath; }
-    bool applyRunRounding() const { return m_applyRunRounding; }
-    bool applyWordRounding() const { return m_applyWordRounding; }
-    bool spacingDisabled() const { return m_disableSpacing; }
-
-    void disableSpacing() { m_disableSpacing = true; }
-    void disableRoundingHacks() { m_applyRunRounding = m_applyWordRounding = false; }
-    void setDirection(TextDirection direction) { m_direction = direction; }
-    void setDirectionalOverride(bool override) { m_directionalOverride = override; }
-    void setCharacterScanForCodePath(bool scan) { m_characterScanForCodePath = scan; }
-
-    class RenderingContext : public RefCounted<RenderingContext> {
-    public:
-        virtual ~RenderingContext() { }
-
-        virtual GlyphData glyphDataForCharacter(const Font&, const TextRun&, WidthIterator&, UChar32 character, bool mirror, int currentCharacter, unsigned& advanceLength) = 0;
-        virtual void drawSVGGlyphs(GraphicsContext*, const TextRun&, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const = 0;
-        virtual float floatWidthUsingSVGFont(const Font&, const TextRun&, int& charsConsumed, String& glyphName) const = 0;
-    };
-
-    RenderingContext* renderingContext() const { return m_renderingContext.get(); }
-    void setRenderingContext(PassRefPtr<RenderingContext> context) { m_renderingContext = context; }
-
-    static void setAllowsRoundingHacks(bool);
-    static bool allowsRoundingHacks();
-
-private:
-    static bool s_allowsRoundingHacks;
-
-    union {
-        const LChar* characters8;
-        const UChar* characters16;
-    } m_data;
-    unsigned m_charactersLength; // Marks the end of the characters buffer. Default equals to m_len.
-    unsigned m_len;
-
-    // m_xpos is the x position relative to the left start of the text line, not relative to the left
-    // start of the containing block. In the case of right alignment or center alignment, left start of
-    // the text line is not the same as left start of the containing block.
-    float m_xpos;
-    float m_horizontalGlyphStretch;
-
-    float m_expansion;
-    ExpansionBehavior m_expansionBehavior : 2;
-    unsigned m_is8Bit : 1;
-    unsigned m_allowTabs : 1;
-    unsigned m_direction : 1;
-    unsigned m_directionalOverride : 1; // Was this direction set by an override character.
-    unsigned m_characterScanForCodePath : 1;
-    unsigned m_applyRunRounding : 1;
-    unsigned m_applyWordRounding : 1;
-    unsigned m_disableSpacing : 1;
-    unsigned m_tabSize;
-    RefPtr<RenderingContext> m_renderingContext;
-};
-
-inline void TextRun::setTabSize(bool allow, unsigned size)
-{
-    m_allowTabs = allow;
-    m_tabSize = size;
-}
-
-// Container for parameters needed to paint TextRun.
-struct TextRunPaintInfo {
-    explicit TextRunPaintInfo(const TextRun& r)
-        : run(r)
-        , from(0)
-        , to(r.length())
-    {
-    }
-
-    const TextRun& run;
-    int from;
-    int to;
-    FloatRect bounds;
-};
-
-}
-#endif
diff --git a/Source/core/platform/graphics/TextRunIterator.h b/Source/core/platform/graphics/TextRunIterator.h
deleted file mode 100644
index fa044ce..0000000
--- a/Source/core/platform/graphics/TextRunIterator.h
+++ /dev/null
@@ -1,78 +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 TextRunIterator_h
-#define TextRunIterator_h
-
-#include "core/platform/graphics/TextRun.h"
-
-namespace WebCore {
-
-class TextRunIterator {
-public:
-    TextRunIterator()
-        : m_textRun(0)
-        , m_offset(0)
-    {
-    }
-
-    TextRunIterator(const TextRun* textRun, unsigned offset)
-        : m_textRun(textRun)
-        , m_offset(offset)
-    {
-    }
-
-    TextRunIterator(const TextRunIterator& other)
-        : m_textRun(other.m_textRun)
-        , m_offset(other.m_offset)
-    {
-    }
-
-    unsigned offset() const { return m_offset; }
-    void increment() { m_offset++; }
-    bool atEnd() const { return !m_textRun || m_offset >= m_textRun->length(); }
-    UChar current() const { return (*m_textRun)[m_offset]; }
-    WTF::Unicode::Direction direction() const { return atEnd() ? WTF::Unicode::OtherNeutral : WTF::Unicode::direction(current()); }
-    bool atParagraphSeparator() const { return current() == '\n'; }
-
-    bool operator==(const TextRunIterator& other)
-    {
-        return m_offset == other.m_offset && m_textRun == other.m_textRun;
-    }
-
-    bool operator!=(const TextRunIterator& other) { return !operator==(other); }
-
-private:
-    const TextRun* m_textRun;
-    int m_offset;
-};
-
-
-} // namespace WebCore
-
-#endif // TextRunIterator_h
diff --git a/Source/core/platform/graphics/UnitBezier.h b/Source/core/platform/graphics/UnitBezier.h
deleted file mode 100644
index ad7c3a8..0000000
--- a/Source/core/platform/graphics/UnitBezier.h
+++ /dev/null
@@ -1,130 +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 UnitBezier_h
-#define UnitBezier_h
-
-#include "wtf/Assertions.h"
-#include <math.h>
-
-namespace WebCore {
-
-struct UnitBezier {
-    UnitBezier(double p1x, double p1y, double p2x, double p2y)
-    {
-        // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).
-        cx = 3.0 * p1x;
-        bx = 3.0 * (p2x - p1x) - cx;
-        ax = 1.0 - cx -bx;
-
-        cy = 3.0 * p1y;
-        by = 3.0 * (p2y - p1y) - cy;
-        ay = 1.0 - cy - by;
-    }
-
-    double sampleCurveX(double t)
-    {
-        // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.
-        return ((ax * t + bx) * t + cx) * t;
-    }
-
-    double sampleCurveY(double t)
-    {
-        return ((ay * t + by) * t + cy) * t;
-    }
-
-    double sampleCurveDerivativeX(double t)
-    {
-        return (3.0 * ax * t + 2.0 * bx) * t + cx;
-    }
-
-    // Given an x value, find a parametric value it came from.
-    double solveCurveX(double x, double epsilon)
-    {
-        ASSERT(x >= 0.0);
-        ASSERT(x <= 1.0);
-
-        double t0;
-        double t1;
-        double t2;
-        double x2;
-        double d2;
-        int i;
-
-        // First try a few iterations of Newton's method -- normally very fast.
-        for (t2 = x, i = 0; i < 8; i++) {
-            x2 = sampleCurveX(t2) - x;
-            if (fabs (x2) < epsilon)
-                return t2;
-            d2 = sampleCurveDerivativeX(t2);
-            if (fabs(d2) < 1e-6)
-                break;
-            t2 = t2 - x2 / d2;
-        }
-
-        // Fall back to the bisection method for reliability.
-        t0 = 0.0;
-        t1 = 1.0;
-        t2 = x;
-
-        while (t0 < t1) {
-            x2 = sampleCurveX(t2);
-            if (fabs(x2 - x) < epsilon)
-                return t2;
-            if (x > x2)
-                t0 = t2;
-            else
-                t1 = t2;
-            t2 = (t1 - t0) * .5 + t0;
-        }
-
-        // Failure.
-        return t2;
-    }
-
-    // Evaluates y at the given x. The epsilon parameter provides a hint as to the required
-    // accuracy and is not guaranteed.
-    double solve(double x, double epsilon)
-    {
-        if (x < 0.0)
-            return 0.0;
-        if (x > 1.0)
-            return 1.0;
-        return sampleCurveY(solveCurveX(x, epsilon));
-    }
-
-private:
-    double ax;
-    double bx;
-    double cx;
-
-    double ay;
-    double by;
-    double cy;
-};
-
-} // namespace WebCore
-
-#endif // UnitBezier_h
diff --git a/Source/core/platform/graphics/UnitBezierTest.cpp b/Source/core/platform/graphics/UnitBezierTest.cpp
deleted file mode 100644
index 2df0d68..0000000
--- a/Source/core/platform/graphics/UnitBezierTest.cpp
+++ /dev/null
@@ -1,74 +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:
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "core/platform/graphics/UnitBezier.h"
-
-#include <gtest/gtest.h>
-
-using namespace WebCore;
-
-namespace {
-
-TEST(UnitBezierTest, BasicUse)
-{
-    UnitBezier bezier(0.5, 1.0, 0.5, 1.0);
-    EXPECT_EQ(0.875, bezier.solve(0.5, 0.005));
-}
-
-TEST(UnitBezierTest, Overshoot)
-{
-    UnitBezier bezier(0.5, 2.0, 0.5, 2.0);
-    EXPECT_EQ(1.625, bezier.solve(0.5, 0.005));
-}
-
-TEST(UnitBezierTest, Undershoot)
-{
-    UnitBezier bezier(0.5, -1.0, 0.5, -1.0);
-    EXPECT_EQ(-0.625, bezier.solve(0.5, 0.005));
-}
-
-TEST(UnitBezierTest, InputAtEdgeOfRange)
-{
-    UnitBezier bezier(0.5, 1.0, 0.5, 1.0);
-    EXPECT_EQ(0.0, bezier.solve(0.0, 0.005));
-    EXPECT_EQ(1.0, bezier.solve(1.0, 0.005));
-}
-
-TEST(UnitBezierTest, InputOutOfRange)
-{
-    UnitBezier bezier(0.5, 1.0, 0.5, 1.0);
-    EXPECT_EQ(0.0, bezier.solve(-1.0, 0.005));
-    EXPECT_EQ(1.0, bezier.solve(2.0, 0.005));
-}
-
-TEST(UnitBezierTest, InputOutOfRangeLargeEpsilon)
-{
-    UnitBezier bezier(0.5, 1.0, 0.5, 1.0);
-    EXPECT_EQ(0.0, bezier.solve(-1.0, 1.0));
-    EXPECT_EQ(1.0, bezier.solve(2.0, 1.0));
-}
-
-} // namespace
diff --git a/Source/core/platform/graphics/WidthCache.h b/Source/core/platform/graphics/WidthCache.h
index 65d72f4..a621e9d 100644
--- a/Source/core/platform/graphics/WidthCache.h
+++ b/Source/core/platform/graphics/WidthCache.h
@@ -26,7 +26,7 @@
 #ifndef WidthCache_h
 #define WidthCache_h
 
-#include "core/platform/graphics/TextRun.h"
+#include "platform/graphics/TextRun.h"
 #include "wtf/Forward.h"
 #include "wtf/HashFunctions.h"
 #include "wtf/HashSet.h"
diff --git a/Source/core/platform/graphics/WidthIterator.cpp b/Source/core/platform/graphics/WidthIterator.cpp
index 4e41ebf..9f21587 100644
--- a/Source/core/platform/graphics/WidthIterator.cpp
+++ b/Source/core/platform/graphics/WidthIterator.cpp
@@ -26,7 +26,7 @@
 #include "core/platform/graphics/GlyphBuffer.h"
 #include "core/platform/graphics/Latin1TextIterator.h"
 #include "core/platform/graphics/SimpleFontData.h"
-#include "core/platform/graphics/SurrogatePairAwareTextIterator.h"
+#include "platform/text/SurrogatePairAwareTextIterator.h"
 #include "wtf/MathExtras.h"
 
 using namespace WTF;
diff --git a/Source/core/platform/graphics/WidthIterator.h b/Source/core/platform/graphics/WidthIterator.h
index 929fc11..9f4f288 100644
--- a/Source/core/platform/graphics/WidthIterator.h
+++ b/Source/core/platform/graphics/WidthIterator.h
@@ -24,7 +24,7 @@
 
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/SVGGlyph.h"
-#include "core/platform/graphics/TextRun.h"
+#include "platform/graphics/TextRun.h"
 #include "wtf/HashSet.h"
 #include "wtf/unicode/Unicode.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/platform/graphics/cg/FloatPointCG.cpp b/Source/core/platform/graphics/cg/FloatPointCG.cpp
index a45fbd8..4fb7675 100644
--- a/Source/core/platform/graphics/cg/FloatPointCG.cpp
+++ b/Source/core/platform/graphics/cg/FloatPointCG.cpp
@@ -25,7 +25,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/FloatPoint.h"
+#include "platform/geometry/FloatPoint.h"
 
 #include <ApplicationServices/ApplicationServices.h>
 
diff --git a/Source/core/platform/graphics/cg/FloatRectCG.cpp b/Source/core/platform/graphics/cg/FloatRectCG.cpp
index 35bea88..6f74b6c 100644
--- a/Source/core/platform/graphics/cg/FloatRectCG.cpp
+++ b/Source/core/platform/graphics/cg/FloatRectCG.cpp
@@ -25,7 +25,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/FloatRect.h"
+#include "platform/geometry/FloatRect.h"
 
 #include <ApplicationServices/ApplicationServices.h>
 
diff --git a/Source/core/platform/graphics/cg/FloatSizeCG.cpp b/Source/core/platform/graphics/cg/FloatSizeCG.cpp
index 0c19837..cd17d4f 100644
--- a/Source/core/platform/graphics/cg/FloatSizeCG.cpp
+++ b/Source/core/platform/graphics/cg/FloatSizeCG.cpp
@@ -25,7 +25,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/FloatSize.h"
+#include "platform/geometry/FloatSize.h"
 
 #include <ApplicationServices/ApplicationServices.h>
 
diff --git a/Source/core/platform/graphics/cg/IntPointCG.cpp b/Source/core/platform/graphics/cg/IntPointCG.cpp
index aca2d87..ee60682 100644
--- a/Source/core/platform/graphics/cg/IntPointCG.cpp
+++ b/Source/core/platform/graphics/cg/IntPointCG.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/geometry/IntPoint.h"
 
 #include <ApplicationServices/ApplicationServices.h>
 
diff --git a/Source/core/platform/graphics/cg/IntRectCG.cpp b/Source/core/platform/graphics/cg/IntRectCG.cpp
index 0044cfa..6a6c8fe 100644
--- a/Source/core/platform/graphics/cg/IntRectCG.cpp
+++ b/Source/core/platform/graphics/cg/IntRectCG.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
 
 #include <ApplicationServices/ApplicationServices.h>
 
diff --git a/Source/core/platform/graphics/cg/IntSizeCG.cpp b/Source/core/platform/graphics/cg/IntSizeCG.cpp
index 1a8a548..4dabb81 100644
--- a/Source/core/platform/graphics/cg/IntSizeCG.cpp
+++ b/Source/core/platform/graphics/cg/IntSizeCG.cpp
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 
 #include <ApplicationServices/ApplicationServices.h>
 
diff --git a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp
index 3ef11a0..1532d4f 100644
--- a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp
@@ -30,11 +30,11 @@
 #include "GrContext.h"
 #include "SkDevice.h"
 #include "SkSurface.h"
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/graphics/GraphicsContext3D.h"
 #include "core/platform/graphics/GraphicsLayer.h"
 #include "core/platform/graphics/chromium/Canvas2DLayerManager.h"
 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h"
+#include "platform/TraceEvent.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCompositorSupport.h"
 #include "public/platform/WebGraphicsContext3D.h"
@@ -81,12 +81,12 @@
     if (!surface.get()) {
         return PassRefPtr<Canvas2DLayerBridge>();
     }
-    SkDeferredCanvas* canvas = SkDeferredCanvas::Create(surface.get());
-    RefPtr<Canvas2DLayerBridge> layerBridge = adoptRef(new Canvas2DLayerBridge(context, canvas, opacityMode));
+    RefPtr<SkDeferredCanvas> canvas = adoptRef(SkDeferredCanvas::Create(surface.get()));
+    RefPtr<Canvas2DLayerBridge> layerBridge = adoptRef(new Canvas2DLayerBridge(context, canvas.release(), opacityMode));
     return layerBridge.release();
 }
 
-Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context, SkDeferredCanvas* canvas, OpacityMode opacityMode)
+Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context, PassRefPtr<SkDeferredCanvas> canvas, OpacityMode opacityMode)
     : m_canvas(canvas)
     , m_context(context)
     , m_bytesAllocated(0)
diff --git a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
index ca6cb1a..3760891 100644
--- a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
@@ -29,7 +29,7 @@
 #include "SkDeferredCanvas.h"
 #include "SkImage.h"
 #include "core/platform/graphics/GraphicsContext3D.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 #include "public/platform/WebExternalTextureLayer.h"
 #include "public/platform/WebExternalTextureLayerClient.h"
 #include "public/platform/WebExternalTextureMailbox.h"
@@ -102,7 +102,7 @@
 protected:
     void destroy();
     friend class Canvas2DLayerBridgePtr;
-    Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, SkDeferredCanvas*, OpacityMode);
+    Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, PassRefPtr<SkDeferredCanvas>, OpacityMode);
     void setRateLimitingEnabled(bool);
 
     RefPtr<SkDeferredCanvas> m_canvas;
diff --git a/Source/core/platform/graphics/chromium/Canvas2DLayerBridgeTest.cpp b/Source/core/platform/graphics/chromium/Canvas2DLayerBridgeTest.cpp
index 6517b53..cd5c874 100644
--- a/Source/core/platform/graphics/chromium/Canvas2DLayerBridgeTest.cpp
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerBridgeTest.cpp
@@ -29,7 +29,7 @@
 #include "SkDeferredCanvas.h"
 #include "SkSurface.h"
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/tests/FakeWebGraphicsContext3D.h"
+#include "core/platform/testing/FakeWebGraphicsContext3D.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebThread.h"
 #include "third_party/skia/include/core/SkDevice.h"
@@ -51,8 +51,6 @@
     MOCK_METHOD0(flush, void(void));
     MOCK_METHOD0(createTexture, unsigned(void));
     MOCK_METHOD1(deleteTexture, void(unsigned));
-
-    virtual GrGLInterface* onCreateGrGLInterface() OVERRIDE { return 0; }
 };
 
 class FakeCanvas2DLayerBridge : public Canvas2DLayerBridge {
diff --git a/Source/core/platform/graphics/chromium/Canvas2DLayerManagerTest.cpp b/Source/core/platform/graphics/chromium/Canvas2DLayerManagerTest.cpp
index 9eb2670..dd49989 100644
--- a/Source/core/platform/graphics/chromium/Canvas2DLayerManagerTest.cpp
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerManagerTest.cpp
@@ -29,7 +29,7 @@
 #include "SkDevice.h"
 #include "SkSurface.h"
 #include "core/platform/graphics/GraphicsContext3D.h"
-#include "core/tests/FakeWebGraphicsContext3D.h"
+#include "core/platform/testing/FakeWebGraphicsContext3D.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebThread.h"
 
diff --git a/Source/core/platform/graphics/chromium/CrossProcessFontLoading.mm b/Source/core/platform/graphics/chromium/CrossProcessFontLoading.mm
index 0394e78..129f005 100644
--- a/Source/core/platform/graphics/chromium/CrossProcessFontLoading.mm
+++ b/Source/core/platform/graphics/chromium/CrossProcessFontLoading.mm
@@ -31,7 +31,7 @@
 
 #import <AppKit/NSFont.h>
 #import "core/platform/graphics/FontPlatformData.h"
-#include "core/platform/LinkHash.h"
+#include "platform/LinkHash.h"
 #import "public/platform/mac/WebSandboxSupport.h"
 #import "public/platform/Platform.h"
 #import "wtf/HashMap.h"
diff --git a/Source/core/platform/graphics/chromium/DeferredImageDecoder.h b/Source/core/platform/graphics/chromium/DeferredImageDecoder.h
index 9f3d40e..521ad80 100644
--- a/Source/core/platform/graphics/chromium/DeferredImageDecoder.h
+++ b/Source/core/platform/graphics/chromium/DeferredImageDecoder.h
@@ -28,8 +28,8 @@
 
 #include "SkBitmap.h"
 #include "core/platform/graphics/ImageSource.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/platform/image-decoders/ImageDecoder.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/Forward.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/Vector.h"
diff --git a/Source/core/platform/graphics/chromium/DeferredImageDecoderTest.cpp b/Source/core/platform/graphics/chromium/DeferredImageDecoderTest.cpp
index 8dd3939..3e03450 100644
--- a/Source/core/platform/graphics/chromium/DeferredImageDecoderTest.cpp
+++ b/Source/core/platform/graphics/chromium/DeferredImageDecoderTest.cpp
@@ -29,7 +29,7 @@
 #include "SkBitmapDevice.h"
 #include "SkCanvas.h"
 #include "SkPicture.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/chromium/ImageDecodingStore.h"
 #include "core/platform/graphics/chromium/test/MockImageDecoder.h"
 #include "core/platform/graphics/skia/NativeImageSkia.h"
diff --git a/Source/core/platform/graphics/chromium/FontCacheAndroid.cpp b/Source/core/platform/graphics/chromium/FontCacheAndroid.cpp
index 2cf212a..f8e2ded 100644
--- a/Source/core/platform/graphics/chromium/FontCacheAndroid.cpp
+++ b/Source/core/platform/graphics/chromium/FontCacheAndroid.cpp
@@ -39,12 +39,64 @@
 
 namespace WebCore {
 
+static AtomicString getFamilyNameForCharacter(UChar32 c, UScriptCode script)
+{
+    // This is a hack to use the preferred font for CJK scripts.
+    // FIXME: Use new Skia API once Android system supports per-family and per-script fallback fonts.
+    const char* locale;
+    switch (script) {
+    case USCRIPT_SIMPLIFIED_HAN:
+        locale = "zh-CN";
+        break;
+    case USCRIPT_TRADITIONAL_HAN:
+        locale = "zh-TW";
+        break;
+    case USCRIPT_KATAKANA_OR_HIRAGANA:
+        locale = "ja";
+        break;
+    case USCRIPT_HANGUL:
+        locale = "ko";
+        break;
+    default:
+        locale = 0;
+        break;
+    }
+
+    SkString skiaFamilyName;
+    if (!SkGetFallbackFamilyNameForChar(c, locale, &skiaFamilyName) || skiaFamilyName.isEmpty())
+        return AtomicString();
+    return skiaFamilyName.c_str();
+}
+
 PassRefPtr<SimpleFontData> FontCache::getFontDataForCharacter(const Font& font, UChar32 c)
 {
-    SkString skiaFamilyName;
-    if (!SkGetFallbackFamilyNameForChar(c, &skiaFamilyName) || skiaFamilyName.isEmpty())
+    AtomicString familyName = getFamilyNameForCharacter(c, font.fontDescription().script());
+    if (familyName.isEmpty())
         return 0;
-    return getFontResourceData(getFontResourcePlatformData(font.fontDescription(), AtomicString(skiaFamilyName.c_str()), DoNotRetain), DoNotRetain);
+    return getFontResourceData(getFontResourcePlatformData(font.fontDescription(), familyName, DoNotRetain), DoNotRetain);
+}
+
+// static
+AtomicString FontCache::getGenericFamilyNameForScript(const AtomicString& familyName, UScriptCode script)
+{
+    // This is a hack to use the preferred font for CJK scripts.
+    // FIXME: Use new Skia API once Android system supports per-family and per-script fallback fonts.
+    UChar32 examplerChar;
+    switch (script) {
+    case USCRIPT_SIMPLIFIED_HAN:
+    case USCRIPT_TRADITIONAL_HAN:
+    case USCRIPT_KATAKANA_OR_HIRAGANA:
+        examplerChar = 0x4E00; // A common character in Japanese and Chinese.
+        break;
+    case USCRIPT_HANGUL:
+        examplerChar = 0xAC00;
+        break;
+    default:
+        // For other scripts, use the default generic family mapping logic.
+        return familyName;
+    }
+
+    return getFamilyNameForCharacter(examplerChar, script);
 }
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/chromium/FontCacheChromiumWin.cpp b/Source/core/platform/graphics/chromium/FontCacheChromiumWin.cpp
index 1bd99e9..a89c355 100644
--- a/Source/core/platform/graphics/chromium/FontCacheChromiumWin.cpp
+++ b/Source/core/platform/graphics/chromium/FontCacheChromiumWin.cpp
@@ -33,12 +33,12 @@
 #include "core/platform/graphics/FontCache.h"
 
 #include <unicode/uniset.h>
-#include "core/platform/LayoutTestSupport.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/SimpleFontData.h"
 #include "core/platform/graphics/chromium/FontPlatformDataChromiumWin.h"
 #include "core/platform/graphics/chromium/FontUtilsChromiumWin.h"
-#include "core/platform/win/HWndDC.h"
+#include "platform/LayoutTestSupport.h"
+#include "platform/win/HWndDC.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
 #include "wtf/text/StringHash.h"
@@ -290,9 +290,11 @@
         return true;
     }
 
-    static Vector<char, 512> glyphsetBuffer;
-    glyphsetBuffer.resize(GetFontUnicodeRanges(hdc, 0));
-    GLYPHSET* glyphset = reinterpret_cast<GLYPHSET*>(glyphsetBuffer.data());
+    static Vector<char, 512>* gGlyphsetBuffer = 0;
+    if (!gGlyphsetBuffer)
+        gGlyphsetBuffer = new Vector<char, 512>();
+    gGlyphsetBuffer->resize(GetFontUnicodeRanges(hdc, 0));
+    GLYPHSET* glyphset = reinterpret_cast<GLYPHSET*>(gGlyphsetBuffer->data());
     // In addition, refering to the OS/2 table and converting the codepage list
     // to the coverage map might be faster.
     count = GetFontUnicodeRanges(hdc, glyphset);
@@ -531,9 +533,9 @@
     // FIXME: Would be even better to somehow get the user's default font here.
     // For now we'll pick the default that the user would get without changing
     // any prefs.
-    static AtomicString timesStr("Times New Roman");
-    static AtomicString courierStr("Courier New");
-    static AtomicString arialStr("Arial");
+    DEFINE_STATIC_LOCAL(AtomicString, timesStr, "Times New Roman");
+    DEFINE_STATIC_LOCAL(AtomicString, courierStr, "Courier New");
+    DEFINE_STATIC_LOCAL(AtomicString, arialStr, "Arial");
 
     AtomicString& fontStr = timesStr;
     if (generic == FontDescription::SansSerifFamily)
@@ -610,7 +612,7 @@
     copyToVector(procData.m_traitsMasks, traitsMasks);
 }
 
-FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
+FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family, float fontSize)
 {
     LOGFONT winfont = {0};
     FillLogFont(fontDescription, &winfont);
@@ -639,9 +641,7 @@
         }
     }
 
-    return new FontPlatformData(hfont,
-                                fontDescription.computedPixelSize(),
-                                fontDescription.orientation());
+    return new FontPlatformData(hfont, fontSize, fontDescription.orientation());
 }
 
 }
diff --git a/Source/core/platform/graphics/chromium/FontChromiumWin.cpp b/Source/core/platform/graphics/chromium/FontChromiumWin.cpp
index 814ff39..b68ad27 100644
--- a/Source/core/platform/graphics/chromium/FontChromiumWin.cpp
+++ b/Source/core/platform/graphics/chromium/FontChromiumWin.cpp
@@ -32,7 +32,7 @@
 #include "config.h"
 #include "core/platform/graphics/Font.h"
 
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
 #include "core/platform/graphics/FontFallbackList.h"
 #include "core/platform/graphics/GlyphBuffer.h"
 #include "core/platform/graphics/GraphicsContext.h"
@@ -177,8 +177,8 @@
 }
 
 void Font::drawComplexText(GraphicsContext* graphicsContext,
-                           const TextRunPaintInfo& runInfo,
-                           const FloatPoint& point) const
+    const TextRunPaintInfo& runInfo,
+    const FloatPoint& point) const
 {
     UniscribeHelperTextRun state(runInfo.run, *this);
 
@@ -191,7 +191,7 @@
     HDC hdc = 0;
     // Uniscribe counts the coordinates from the upper left, while WebKit uses
     // the baseline, so we have to subtract off the ascent.
-    state.draw(graphicsContext, hdc, lroundf(point.x()), lroundf(point.y() - fontMetrics().ascent()), runInfo.bounds, runInfo.from, runInfo.to);
+    state.draw(graphicsContext, primaryFont()->platformData(), hdc, lroundf(point.x()), lroundf(point.y() - fontMetrics().ascent()), runInfo.bounds, runInfo.from, runInfo.to);
 }
 
 void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRunPaintInfo& /* runInfo */, const AtomicString& /* mark */, const FloatPoint& /* point */) const
diff --git a/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp b/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
index 30f96c6..3dea684 100644
--- a/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
+++ b/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp
@@ -32,32 +32,60 @@
 #include "config.h"
 #include "core/platform/graphics/FontPlatformData.h"
 
-#include <windows.h>
-#include <mlang.h>
-#include <objidl.h>
-#include "core/platform/LayoutTestSupport.h"
-#include "core/platform/SharedBuffer.h"
+#include "RuntimeEnabledFeatures.h"
+#include "SkPaint.h"
+#include "SkTypeface.h"
+#include "SkTypeface_win.h"
 #include "core/platform/graphics/FontCache.h"
+#include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/skia/SkiaFontWin.h"
-#include "core/platform/win/HWndDC.h"
+#include "platform/LayoutTestSupport.h"
+#include "platform/SharedBuffer.h"
+#include "platform/win/HWndDC.h"
 #include "public/platform/Platform.h"
 #include "public/platform/win/WebSandboxSupport.h"
-#include "third_party/skia/include/core/SkPaint.h"
-#include "third_party/skia/include/core/SkTypeface.h"
-#include "third_party/skia/include/ports/SkTypeface_win.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/StdLibExtras.h"
+#include <mlang.h>
+#include <objidl.h>
+#include <windows.h>
 
 namespace WebCore {
 
-#if !ENABLE(GDI_FONTS_ON_WINDOWS)
-void FontPlatformData::setupPaint(SkPaint* paint) const
+void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext* context) const
 {
-    const float ts = m_size >= 0 ? m_size : 12;
-    paint->setTextSize(SkFloatToScalar(m_size));
+    const float ts = m_textSize >= 0 ? m_textSize : 12;
+    paint->setTextSize(SkFloatToScalar(m_textSize));
     paint->setTypeface(typeface());
+    paint->setFakeBoldText(m_fakeBold);
+    paint->setTextSkewX(m_fakeItalic ? -SK_Scalar1 / 4 : 0);
+    if (RuntimeEnabledFeatures::subpixelFontScalingEnabled())
+        paint->setSubpixelText(true);
+
+    // Only set painting flags when we're actually painting.
+    if (context) {
+        int textFlags = paintTextFlags();
+        if (!context->couldUseLCDRenderedText()) {
+            textFlags &= ~SkPaint::kLCDRenderText_Flag;
+            // If we *just* clear our request for LCD, then GDI seems to
+            // sometimes give us AA text, and sometimes give us BW text. Since the
+            // original intent was LCD, we want to force AA (rather than BW), so we
+            // add a special bit to tell Skia to do its best to avoid the BW: by
+            // drawing LCD offscreen and downsampling that to AA.
+            textFlags |= SkPaint::kGenA8FromLCD_Flag;
+        }
+
+        static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag |
+            SkPaint::kLCDRenderText_Flag |
+            SkPaint::kGenA8FromLCD_Flag;
+
+        SkASSERT(!(textFlags & ~textFlagsMask));
+        uint32_t flags = paint->getFlags();
+        flags &= ~textFlagsMask;
+        flags |= textFlags;
+        paint->setFlags(flags);
+    }
 }
-#endif
 
 // Lookup the current system settings for font smoothing.
 // We cache these values for performance, but if the browser has a way to be
@@ -144,7 +172,9 @@
 
 FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType)
     : m_font(0)
-    , m_size(-1)
+    , m_textSize(-1)
+    , m_fakeBold(false)
+    , m_fakeItalic(false)
     , m_orientation(Horizontal)
     , m_scriptCache(0)
     , m_typeface(SkTypeface::RefDefault())
@@ -155,7 +185,9 @@
 
 FontPlatformData::FontPlatformData()
     : m_font(0)
-    , m_size(0)
+    , m_textSize(0)
+    , m_fakeBold(false)
+    , m_fakeItalic(false)
     , m_orientation(Horizontal)
     , m_scriptCache(0)
     , m_typeface(SkTypeface::RefDefault())
@@ -164,20 +196,26 @@
 {
 }
 
+#if ENABLE(GDI_FONTS_ON_WINDOWS)
 FontPlatformData::FontPlatformData(HFONT font, float size, FontOrientation orientation)
     : m_font(RefCountedHFONT::create(font))
-    , m_size(size)
+    , m_textSize(size)
+    , m_fakeBold(false)
+    , m_fakeItalic(false)
     , m_orientation(orientation)
     , m_scriptCache(0)
     , m_typeface(CreateTypefaceFromHFont(font, 0, &m_paintTextFlags))
     , m_isHashTableDeletedValue(false)
 {
 }
+#endif
 
 // FIXME: this constructor is needed for SVG fonts but doesn't seem to do much
 FontPlatformData::FontPlatformData(float size, bool bold, bool oblique)
     : m_font(0)
-    , m_size(size)
+    , m_textSize(size)
+    , m_fakeBold(false)
+    , m_fakeItalic(false)
     , m_orientation(Horizontal)
     , m_scriptCache(0)
     , m_typeface(SkTypeface::RefDefault())
@@ -188,7 +226,9 @@
 
 FontPlatformData::FontPlatformData(const FontPlatformData& data)
     : m_font(data.m_font)
-    , m_size(data.m_size)
+    , m_textSize(data.m_textSize)
+    , m_fakeBold(data.m_fakeBold)
+    , m_fakeItalic(data.m_fakeItalic)
     , m_orientation(data.m_orientation)
     , m_scriptCache(0)
     , m_typeface(data.m_typeface)
@@ -199,7 +239,9 @@
 
 FontPlatformData::FontPlatformData(const FontPlatformData& data, float textSize)
     : m_font(data.m_font)
-    , m_size(textSize)
+    , m_textSize(textSize)
+    , m_fakeBold(data.m_fakeBold)
+    , m_fakeItalic(data.m_fakeItalic)
     , m_orientation(data.m_orientation)
     , m_scriptCache(0)
     , m_typeface(data.m_typeface)
@@ -210,7 +252,9 @@
 
 FontPlatformData::FontPlatformData(SkTypeface* tf, const char* family, float textSize, bool fakeBold, bool fakeItalic, FontOrientation orientation)
     : m_font(0)
-    , m_size(textSize)
+    , m_textSize(textSize)
+    , m_fakeBold(fakeBold)
+    , m_fakeItalic(fakeItalic)
     , m_orientation(orientation)
     , m_scriptCache(0)
     , m_typeface(tf)
@@ -231,7 +275,9 @@
 {
     if (this != &data) {
         m_font = data.m_font;
-        m_size = data.m_size;
+        m_textSize = data.m_textSize;
+        m_fakeBold = data.m_fakeBold;
+        m_fakeItalic = data.m_fakeItalic;
         m_orientation = data.m_orientation;
         m_typeface = data.m_typeface;
         m_paintTextFlags = data.m_paintTextFlags;
diff --git a/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.h b/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.h
index e2a5c05..baa58fb 100644
--- a/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.h
+++ b/Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.h
@@ -34,12 +34,12 @@
 
 #include "config.h"
 
-#include "../ports/SkTypeface_win.h"
 #include "SkPaint.h"
 #include "SkTypeface.h"
-#include "core/platform/SharedBuffer.h"
+#include "SkTypeface_win.h"
 #include "core/platform/graphics/FontOrientation.h"
 #include "core/platform/graphics/opentype/OpenTypeVerticalData.h"
+#include "platform/SharedBuffer.h"
 #include "wtf/Forward.h"
 #include "wtf/HashTableDeletedValueType.h"
 #include "wtf/OwnPtr.h"
@@ -59,6 +59,7 @@
 PassRefPtr<SkTypeface> CreateTypefaceFromHFont(HFONT, int* size, int* paintTextFlags);
 
 class FontDescription;
+class GraphicsContext;
 
 class FontPlatformData {
 public:
@@ -69,16 +70,16 @@
     // set everything to NULL.
     FontPlatformData(WTF::HashTableDeletedValueType);
     FontPlatformData();
+#if ENABLE(GDI_FONTS_ON_WINDOWS)
     // This constructor takes ownership of the HFONT
     FontPlatformData(HFONT, float size, FontOrientation);
+#endif
     FontPlatformData(float size, bool bold, bool oblique);
     FontPlatformData(const FontPlatformData&);
     FontPlatformData(const FontPlatformData&, float textSize);
     FontPlatformData(SkTypeface*, const char* name, float textSize, bool fakeBold, bool fakeItalic, FontOrientation = Horizontal);
 
-#if !ENABLE(GDI_FONTS_ON_WINDOWS)
-    void setupPaint(SkPaint*) const;
-#endif
+    void setupPaint(SkPaint*, GraphicsContext* = 0) const;
 
     FontPlatformData& operator=(const FontPlatformData&);
 
@@ -88,7 +89,7 @@
 
     bool isFixedPitch() const;
     HFONT hfont() const { return m_font ? m_font->hfont() : 0; }
-    float size() const { return m_size; }
+    float size() const { return m_textSize; }
     SkTypeface* typeface() const { return m_typeface.get(); }
     int paintTextFlags() const { return m_paintTextFlags; }
 
@@ -97,14 +98,18 @@
     FontOrientation orientation() const { return m_orientation; }
     void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
 
+#if ENABLE(GDI_FONTS_ON_WINDOWS)
     unsigned hash() const
     {
         return m_font ? m_font->hash() : NULL;
     }
+#else
+    unsigned hash() const;
+#endif
 
     bool operator==(const FontPlatformData& other) const
     {
-        return m_font == other.m_font && m_size == other.m_size && m_orientation == other.m_orientation;
+        return m_font == other.m_font && m_textSize == other.m_textSize && m_fakeBold == other.m_fakeBold && m_fakeItalic == other.m_fakeItalic && m_orientation == other.m_orientation;
     }
 
 #if ENABLE(OPENTYPE_VERTICAL)
@@ -156,8 +161,10 @@
     };
 
     RefPtr<RefCountedHFONT> m_font;
-    float m_size;  // Point size of the font in pixels.
+    float m_textSize; // Point size of the font in pixels.
     FontOrientation m_orientation;
+    bool m_fakeBold;
+    bool m_fakeItalic;
 
     RefPtr<SkTypeface> m_typeface; // cached from m_font
     int m_paintTextFlags; // cached from m_font
diff --git a/Source/core/platform/graphics/chromium/FontUtilsChromiumWin.cpp b/Source/core/platform/graphics/chromium/FontUtilsChromiumWin.cpp
index a73198a..553ebfe 100644
--- a/Source/core/platform/graphics/chromium/FontUtilsChromiumWin.cpp
+++ b/Source/core/platform/graphics/chromium/FontUtilsChromiumWin.cpp
@@ -36,7 +36,7 @@
 #include <unicode/locid.h>
 #include <unicode/uchar.h>
 #include "core/platform/graphics/chromium/UniscribeHelper.h"
-#include "core/platform/win/HWndDC.h"
+#include "platform/win/HWndDC.h"
 #include "wtf/HashMap.h"
 #include "wtf/text/StringHash.h"
 #include "wtf/text/WTFString.h"
@@ -401,22 +401,24 @@
     ASSERT(*family);
 
     // It does not matter that we leak font data when we exit.
-    static FontDataCache fontDataCache;
+    static FontDataCache* gFontDataCache = 0;
+    if (!gFontDataCache)
+        gFontDataCache = new FontDataCache();
 
     // FIXME: This comes up pretty high in the profile so that
     // we need to measure whether using SHA256 (after coercing all the
     // fields to char*) is faster than String::format.
     String fontKey = String::format("%1d:%d:%ls", style, logfont->lfHeight, family);
-    FontDataCache::iterator iter = fontDataCache.find(fontKey);
+    FontDataCache::iterator iter = gFontDataCache->find(fontKey);
     FontData* derived;
-    if (iter == fontDataCache.end()) {
+    if (iter == gFontDataCache->end()) {
         ASSERT(wcslen(family) < LF_FACESIZE);
         wcscpy_s(logfont->lfFaceName, LF_FACESIZE, family);
         // FIXME: CreateFontIndirect always comes up with
         // a font even if there's no font matching the name. Need to
         // check it against what we actually want (as is done in
         // FontCacheWin.cpp)
-        FontDataCache::AddResult entry = fontDataCache.add(fontKey, FontData());
+        FontDataCache::AddResult entry = gFontDataCache->add(fontKey, FontData());
         derived = &entry.iterator->value;
         derived->hfont = CreateFontIndirect(logfont);
         // GetAscent may return kUndefinedAscent, but we still want to
diff --git a/Source/core/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp b/Source/core/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp
index cd9eb6b..3620101 100644
--- a/Source/core/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp
+++ b/Source/core/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp
@@ -37,8 +37,8 @@
 #include "core/platform/graphics/SimpleFontData.h"
 #include "core/platform/graphics/chromium/FontPlatformDataChromiumWin.h"
 #include "core/platform/graphics/chromium/UniscribeHelperTextRun.h"
-#include "core/platform/win/HWndDC.h"
-#include "core/platform/win/SystemInfo.h"
+#include "platform/win/HWndDC.h"
+#include "platform/win/SystemInfo.h"
 
 namespace WebCore {
 
@@ -169,6 +169,8 @@
                 // If initSpaceGlyph fails, spaceGlyph stays 0 (= glyph is not present).
                 initSpaceGlyph(fontData->platformData().hfont(), dc, &spaceGlyph);
                 spaceGlyphInitialized = true;
+                if (spaceGlyph)
+                    haveGlyphs = true;
             }
             glyph = spaceGlyph;
         } else if (glyph == invalidGlyph) {
diff --git a/Source/core/platform/graphics/chromium/ImageDecodingStore.cpp b/Source/core/platform/graphics/chromium/ImageDecodingStore.cpp
index e827e56..7a0c321 100644
--- a/Source/core/platform/graphics/chromium/ImageDecodingStore.cpp
+++ b/Source/core/platform/graphics/chromium/ImageDecodingStore.cpp
@@ -26,8 +26,8 @@
 #include "config.h"
 #include "core/platform/graphics/chromium/ImageDecodingStore.h"
 
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/graphics/chromium/ScaledImageFragment.h"
+#include "platform/TraceEvent.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/chromium/ImageDecodingStoreTest.cpp b/Source/core/platform/graphics/chromium/ImageDecodingStoreTest.cpp
index 4a7d7d5..3c2d95a 100644
--- a/Source/core/platform/graphics/chromium/ImageDecodingStoreTest.cpp
+++ b/Source/core/platform/graphics/chromium/ImageDecodingStoreTest.cpp
@@ -27,7 +27,7 @@
 
 #include "core/platform/graphics/chromium/ImageDecodingStore.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/chromium/ImageFrameGenerator.h"
 #include "core/platform/graphics/chromium/test/MockDiscardablePixelRef.h"
 #include "core/platform/graphics/chromium/test/MockImageDecoder.h"
diff --git a/Source/core/platform/graphics/chromium/ImageFrameGenerator.cpp b/Source/core/platform/graphics/chromium/ImageFrameGenerator.cpp
index 802cf37..cbabaf0 100644
--- a/Source/core/platform/graphics/chromium/ImageFrameGenerator.cpp
+++ b/Source/core/platform/graphics/chromium/ImageFrameGenerator.cpp
@@ -27,12 +27,12 @@
 
 #include "core/platform/graphics/chromium/ImageFrameGenerator.h"
 
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/graphics/chromium/DiscardablePixelRef.h"
 #include "core/platform/graphics/chromium/ImageDecodingStore.h"
 #include "core/platform/graphics/chromium/ScaledImageFragment.h"
 #include "core/platform/image-decoders/ImageDecoder.h"
+#include "platform/SharedBuffer.h"
+#include "platform/TraceEvent.h"
 
 #include "skia/ext/image_operations.h"
 
diff --git a/Source/core/platform/graphics/chromium/ImageFrameGeneratorTest.cpp b/Source/core/platform/graphics/chromium/ImageFrameGeneratorTest.cpp
index 66ad11a..05e19c0 100644
--- a/Source/core/platform/graphics/chromium/ImageFrameGeneratorTest.cpp
+++ b/Source/core/platform/graphics/chromium/ImageFrameGeneratorTest.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/platform/graphics/chromium/ImageFrameGenerator.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/chromium/ImageDecodingStore.h"
 #include "core/platform/graphics/chromium/test/MockImageDecoder.h"
 #include "wtf/Threading.h"
diff --git a/Source/core/platform/graphics/chromium/LazyDecodingPixelRef.cpp b/Source/core/platform/graphics/chromium/LazyDecodingPixelRef.cpp
index 5bcf14e..26cfa18 100644
--- a/Source/core/platform/graphics/chromium/LazyDecodingPixelRef.cpp
+++ b/Source/core/platform/graphics/chromium/LazyDecodingPixelRef.cpp
@@ -27,9 +27,9 @@
 #include "core/platform/graphics/chromium/LazyDecodingPixelRef.h"
 
 #include "SkData.h"
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/graphics/chromium/ImageDecodingStore.h"
 #include "core/platform/graphics/chromium/ImageFrameGenerator.h"
+#include "platform/TraceEvent.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp b/Source/core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp
index dc10374..820a18b 100644
--- a/Source/core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp
+++ b/Source/core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp
@@ -26,10 +26,10 @@
 
 #include "core/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.h"
 
-#include "core/platform/EventTracer.h"
 #include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/EventTracer.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "public/platform/WebFloatRect.h"
 #include "public/platform/WebRect.h"
 
diff --git a/Source/core/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp b/Source/core/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp
index 07125c2..0e9d41d 100644
--- a/Source/core/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp
+++ b/Source/core/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp
@@ -36,12 +36,12 @@
 #include <objidl.h>
 #include <unicode/uchar.h>
 #include <unicode/unorm.h>
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/FontDescription.h"
 #include "core/platform/graphics/chromium/FontPlatformDataChromiumWin.h"
-#include "core/platform/win/HWndDC.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/win/HWndDC.h"
 #include "wtf/MathExtras.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/chromium/ThreadSafeDataTransport.cpp b/Source/core/platform/graphics/chromium/ThreadSafeDataTransport.cpp
index aebad67..cdc1236 100644
--- a/Source/core/platform/graphics/chromium/ThreadSafeDataTransport.cpp
+++ b/Source/core/platform/graphics/chromium/ThreadSafeDataTransport.cpp
@@ -27,7 +27,7 @@
 
 #include "core/platform/graphics/chromium/ThreadSafeDataTransport.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/chromium/ThreadSafeDataTransportTest.cpp b/Source/core/platform/graphics/chromium/ThreadSafeDataTransportTest.cpp
index f1ad89c..88193e0 100644
--- a/Source/core/platform/graphics/chromium/ThreadSafeDataTransportTest.cpp
+++ b/Source/core/platform/graphics/chromium/ThreadSafeDataTransportTest.cpp
@@ -27,7 +27,7 @@
 
 #include "core/platform/graphics/chromium/ThreadSafeDataTransport.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include <gtest/gtest.h>
 
 using namespace WebCore;
diff --git a/Source/core/platform/graphics/chromium/TransformSkMatrix44Conversions.cpp b/Source/core/platform/graphics/chromium/TransformSkMatrix44Conversions.cpp
index 1972d2c..7e5d5b0 100644
--- a/Source/core/platform/graphics/chromium/TransformSkMatrix44Conversions.cpp
+++ b/Source/core/platform/graphics/chromium/TransformSkMatrix44Conversions.cpp
@@ -26,7 +26,7 @@
 
 #include "core/platform/graphics/chromium/TransformSkMatrix44Conversions.h"
 
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
+#include "platform/transforms/TransformationMatrix.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/chromium/TransparencyWin.cpp b/Source/core/platform/graphics/chromium/TransparencyWin.cpp
index 539cde4..63dcc0c 100644
--- a/Source/core/platform/graphics/chromium/TransparencyWin.cpp
+++ b/Source/core/platform/graphics/chromium/TransparencyWin.cpp
@@ -35,7 +35,8 @@
 #include "core/platform/graphics/ImageBuffer.h"
 #include "core/platform/graphics/SimpleFontData.h"
 #include "core/platform/graphics/chromium/TransparencyWin.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "core/platform/graphics/skia/SkiaUtils.h"
+#include "platform/transforms/AffineTransform.h"
 
 #include "SkColorPriv.h"
 #include "skia/ext/platform_canvas.h"
@@ -80,7 +81,7 @@
     // Create a temporary canvas for the compositing into the destination.
     SkBitmap* destBmp = const_cast<SkBitmap*>(&bitmapForContext(destContext));
     SkCanvas destCanvas(*destBmp);
-    destCanvas.setMatrix(matrix);
+    destCanvas.setMatrix(affineTransformToSkMatrix(matrix));
 
     for (int i = devices.size() - 1; i >= 0; i--) {
         const SkBitmap& srcBmp = devices[i].device->accessBitmap(false);
diff --git a/Source/core/platform/graphics/chromium/TransparencyWin.h b/Source/core/platform/graphics/chromium/TransparencyWin.h
index ab5bbfe..71e0c86 100644
--- a/Source/core/platform/graphics/chromium/TransparencyWin.h
+++ b/Source/core/platform/graphics/chromium/TransparencyWin.h
@@ -34,7 +34,7 @@
 #include <windows.h>
 
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/transforms/AffineTransform.h"
 
 #include "wtf/Noncopyable.h"
 #include "wtf/OwnPtr.h"
diff --git a/Source/core/platform/graphics/chromium/UniscribeHelper.cpp b/Source/core/platform/graphics/chromium/UniscribeHelper.cpp
index 1794a02..9354c46 100644
--- a/Source/core/platform/graphics/chromium/UniscribeHelper.cpp
+++ b/Source/core/platform/graphics/chromium/UniscribeHelper.cpp
@@ -36,7 +36,7 @@
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/chromium/FontUtilsChromiumWin.h"
 #include "core/platform/graphics/skia/SkiaFontWin.h"
-#include "core/platform/win/HWndDC.h"
+#include "platform/win/HWndDC.h"
 #include "third_party/skia/include/core/SkPoint.h"
 #include "wtf/Assertions.h"
 
@@ -324,10 +324,9 @@
     return 0;
 }
 
-void UniscribeHelper::draw(GraphicsContext* graphicsContext, HDC dc,
-                           int x, int y,
-                           const FloatRect& textRect,
-                           int from, int to)
+void UniscribeHelper::draw(GraphicsContext* graphicsContext,
+    const FontPlatformData& fontPlatformData, HDC dc, int x, int y,
+    const FloatRect& textRect, int from, int to)
 {
     HGDIOBJ oldFont = 0;
     int curX = x;
@@ -423,13 +422,14 @@
                 origin.fX = curX + + innerOffset;
                 origin.fY = y + m_ascent;
                 paintSkiaText(graphicsContext,
-                              shaping.m_hfont,
-                              glyphCount,
-                              &shaping.m_glyphs[fromGlyph],
-                              advances,
-                              &shaping.m_offsets[fromGlyph],
-                              origin,
-                              textRect);
+                    fontPlatformData,
+                    shaping.m_hfont,
+                    glyphCount,
+                    &shaping.m_glyphs[fromGlyph],
+                    advances,
+                    &shaping.m_offsets[fromGlyph],
+                    origin,
+                    textRect);
                 textOutOk = true;
 
                 if (!textOutOk && 0 == executions) {
diff --git a/Source/core/platform/graphics/chromium/UniscribeHelper.h b/Source/core/platform/graphics/chromium/UniscribeHelper.h
index 66826ad..8a724c6 100644
--- a/Source/core/platform/graphics/chromium/UniscribeHelper.h
+++ b/Source/core/platform/graphics/chromium/UniscribeHelper.h
@@ -46,6 +46,7 @@
 
 class FloatRect;
 class FontFeatureSettings;
+class FontPlatformData;
 class GraphicsContext;
 
 const unsigned cUniscribeHelperStackRuns = 8;
@@ -197,10 +198,9 @@
     // be pre-set.
     //
     // The y position is the upper left corner, NOT the baseline.
-    void draw(GraphicsContext* graphicsContext, HDC dc,
-              int x, int y,
-              const FloatRect& textRect,
-              int from, int to);
+    void draw(GraphicsContext*, const FontPlatformData&, HDC,
+        int x, int y, const FloatRect& textRect,
+        int from, int to);
 
     // Returns the first glyph assigned to the character at the given offset.
     // This function is used to retrieve glyph information when Uniscribe is
diff --git a/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.cpp b/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.cpp
index 1733f8e..57fbf17 100644
--- a/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.cpp
+++ b/Source/core/platform/graphics/chromium/UniscribeHelperTextRun.cpp
@@ -33,8 +33,8 @@
 
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/SimpleFontData.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/platform/graphics/chromium/FontPlatformDataChromiumWin.h"
+#include "platform/graphics/TextRun.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/filters/FEBlend.cpp b/Source/core/platform/graphics/filters/FEBlend.cpp
index 78d2bec..838e39e 100644
--- a/Source/core/platform/graphics/filters/FEBlend.cpp
+++ b/Source/core/platform/graphics/filters/FEBlend.cpp
@@ -29,9 +29,8 @@
 
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/filters/Filter.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
-
+#include "platform/text/TextStream.h"
 #include "wtf/Uint8ClampedArray.h"
 
 #include "SkBitmapSource.h"
diff --git a/Source/core/platform/graphics/filters/FEColorMatrix.cpp b/Source/core/platform/graphics/filters/FEColorMatrix.cpp
index 4d8c45a..6a08134 100644
--- a/Source/core/platform/graphics/filters/FEColorMatrix.cpp
+++ b/Source/core/platform/graphics/filters/FEColorMatrix.cpp
@@ -29,9 +29,8 @@
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
 #include "core/platform/graphics/skia/NativeImageSkia.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
-
+#include "platform/text/TextStream.h"
 #include "wtf/MathExtras.h"
 #include "wtf/Uint8ClampedArray.h"
 
@@ -285,7 +284,7 @@
 {
     RefPtr<SkImageFilter> input(builder->build(inputEffect(0), operatingColorSpace()));
     SkAutoTUnref<SkColorFilter> filter(createColorFilter(m_type, m_values.data()));
-    SkIRect rect = getCropRect(builder->cropOffset());
+    SkImageFilter::CropRect rect = getCropRect(builder->cropOffset());
     return adoptRef(SkColorFilterImageFilter::Create(filter, input.get(), &rect));
 }
 
diff --git a/Source/core/platform/graphics/filters/FEComponentTransfer.cpp b/Source/core/platform/graphics/filters/FEComponentTransfer.cpp
index 18f783a..a766546 100644
--- a/Source/core/platform/graphics/filters/FEComponentTransfer.cpp
+++ b/Source/core/platform/graphics/filters/FEComponentTransfer.cpp
@@ -28,9 +28,8 @@
 
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/filters/Filter.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
-
+#include "platform/text/TextStream.h"
 #include "wtf/MathExtras.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/Uint8ClampedArray.h"
@@ -211,7 +210,7 @@
 
     SkAutoTUnref<SkColorFilter> colorFilter(SkTableColorFilter::CreateARGB(aValues, rValues, gValues, bValues));
 
-    SkIRect cropRect = getCropRect(builder->cropOffset());
+    SkImageFilter::CropRect cropRect = getCropRect(builder->cropOffset());
     return adoptRef(SkColorFilterImageFilter::Create(colorFilter, input.get(), &cropRect));
 }
 
diff --git a/Source/core/platform/graphics/filters/FEComposite.cpp b/Source/core/platform/graphics/filters/FEComposite.cpp
index c8d996a..26acdbe 100644
--- a/Source/core/platform/graphics/filters/FEComposite.cpp
+++ b/Source/core/platform/graphics/filters/FEComposite.cpp
@@ -33,8 +33,8 @@
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h"
 #include "core/platform/graphics/filters/Filter.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
+#include "platform/text/TextStream.h"
 #include "third_party/skia/include/core/SkDevice.h"
 
 #include "wtf/Uint8ClampedArray.h"
@@ -45,7 +45,7 @@
 
 class CompositeImageFilter : public SkImageFilter {
 public:
-    CompositeImageFilter(SkXfermode::Mode mode, SkImageFilter* background, SkImageFilter* foreground, const SkIRect* cropRect) : SkImageFilter(background, foreground, cropRect), m_mode(mode)
+    CompositeImageFilter(SkXfermode::Mode mode, SkImageFilter* background, SkImageFilter* foreground, const CropRect* cropRect) : SkImageFilter(background, foreground, cropRect), m_mode(mode)
     {
     }
 
@@ -412,7 +412,7 @@
         SkAutoTUnref<SkXfermode> mode(SkArithmeticMode::Create(SkFloatToScalar(m_k1), SkFloatToScalar(m_k2), SkFloatToScalar(m_k3), SkFloatToScalar(m_k4)));
         return adoptRef(new SkXfermodeImageFilter(mode, background.get(), foreground.get()));
     }
-    SkIRect cropRect = getCropRect(builder->cropOffset());
+    SkImageFilter::CropRect cropRect = getCropRect(builder->cropOffset());
     return adoptRef(new CompositeImageFilter(toXfermode(m_type), background.get(), foreground.get(), &cropRect));
 }
 
diff --git a/Source/core/platform/graphics/filters/FEConvolveMatrix.cpp b/Source/core/platform/graphics/filters/FEConvolveMatrix.cpp
index 2753555..0112c0a 100644
--- a/Source/core/platform/graphics/filters/FEConvolveMatrix.cpp
+++ b/Source/core/platform/graphics/filters/FEConvolveMatrix.cpp
@@ -27,10 +27,9 @@
 #include "core/platform/graphics/filters/FEConvolveMatrix.h"
 
 #include "core/platform/graphics/filters/Filter.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
-
-#include "wtf/OwnArrayPtr.h"
+#include "platform/text/TextStream.h"
+#include "wtf/OwnPtr.h"
 #include "wtf/ParallelJobs.h"
 #include "wtf/Uint8ClampedArray.h"
 
@@ -527,7 +526,7 @@
     SkIPoint target = SkIPoint::Make(m_targetOffset.x(), m_targetOffset.y());
     SkMatrixConvolutionImageFilter::TileMode tileMode = toSkiaTileMode(m_edgeMode);
     bool convolveAlpha = !m_preserveAlpha;
-    OwnArrayPtr<SkScalar> kernel = adoptArrayPtr(new SkScalar[numElements]);
+    OwnPtr<SkScalar[]> kernel = adoptArrayPtr(new SkScalar[numElements]);
     for (int i = 0; i < numElements; ++i)
         kernel[i] = SkFloatToScalar(m_kernelMatrix[numElements - 1 - i]);
     return adoptRef(new SkMatrixConvolutionImageFilter(kernelSize, kernel.get(), gain, bias, target, tileMode, convolveAlpha, input.get()));
diff --git a/Source/core/platform/graphics/filters/FEConvolveMatrix.h b/Source/core/platform/graphics/filters/FEConvolveMatrix.h
index d9f0ca6..1e6f4d5 100644
--- a/Source/core/platform/graphics/filters/FEConvolveMatrix.h
+++ b/Source/core/platform/graphics/filters/FEConvolveMatrix.h
@@ -24,10 +24,10 @@
 #ifndef FEConvolveMatrix_h
 #define FEConvolveMatrix_h
 
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/FilterEffect.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatSize.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/filters/FEDiffuseLighting.cpp b/Source/core/platform/graphics/filters/FEDiffuseLighting.cpp
index 0333f48..b44da5b 100644
--- a/Source/core/platform/graphics/filters/FEDiffuseLighting.cpp
+++ b/Source/core/platform/graphics/filters/FEDiffuseLighting.cpp
@@ -25,8 +25,8 @@
 #include "core/platform/graphics/filters/FEDiffuseLighting.h"
 
 #include "core/platform/graphics/filters/LightSource.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
+#include "platform/text/TextStream.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/filters/FEDisplacementMap.cpp b/Source/core/platform/graphics/filters/FEDisplacementMap.cpp
index 67853d8..fdf68a8 100644
--- a/Source/core/platform/graphics/filters/FEDisplacementMap.cpp
+++ b/Source/core/platform/graphics/filters/FEDisplacementMap.cpp
@@ -28,9 +28,8 @@
 
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/filters/Filter.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
-
+#include "platform/text/TextStream.h"
 #include "wtf/Uint8ClampedArray.h"
 
 #include "SkBitmapSource.h"
diff --git a/Source/core/platform/graphics/filters/FEDropShadow.cpp b/Source/core/platform/graphics/filters/FEDropShadow.cpp
index 4f77df3..f2e840d 100644
--- a/Source/core/platform/graphics/filters/FEDropShadow.cpp
+++ b/Source/core/platform/graphics/filters/FEDropShadow.cpp
@@ -25,8 +25,8 @@
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/filters/FEGaussianBlur.h"
 #include "core/platform/graphics/filters/Filter.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
+#include "platform/text/TextStream.h"
 #include "third_party/skia/include/core/SkColorFilter.h"
 #include "third_party/skia/include/effects/SkBlurImageFilter.h"
 
diff --git a/Source/core/platform/graphics/filters/FEFlood.cpp b/Source/core/platform/graphics/filters/FEFlood.cpp
index ce8cc99..318763f 100644
--- a/Source/core/platform/graphics/filters/FEFlood.cpp
+++ b/Source/core/platform/graphics/filters/FEFlood.cpp
@@ -30,15 +30,15 @@
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
+#include "platform/text/TextStream.h"
 #include "third_party/skia/include/core/SkDevice.h"
 
 namespace {
 
 class FloodImageFilter : public SkImageFilter {
 public:
-    FloodImageFilter(const SkColor& color, const SkIRect* cropRect)
+    FloodImageFilter(const SkColor& color, const CropRect* cropRect)
         : SkImageFilter(0, 0, cropRect)
         , m_color(color)
     {
@@ -139,7 +139,7 @@
 {
     Color color = colorWithOverrideAlpha(floodColor().rgb(), floodOpacity());
 
-    SkIRect rect = getCropRect(builder->cropOffset());
+    SkImageFilter::CropRect rect = getCropRect(builder->cropOffset());
     return adoptRef(new FloodImageFilter(color.rgb(), &rect));
 }
 
diff --git a/Source/core/platform/graphics/filters/FEGaussianBlur.cpp b/Source/core/platform/graphics/filters/FEGaussianBlur.cpp
index 8c63185..20d322a 100644
--- a/Source/core/platform/graphics/filters/FEGaussianBlur.cpp
+++ b/Source/core/platform/graphics/filters/FEGaussianBlur.cpp
@@ -31,9 +31,8 @@
 #include "core/platform/graphics/cpu/arm/filters/FEGaussianBlurNEON.h"
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
-
+#include "platform/text/TextStream.h"
 #include "wtf/MathExtras.h"
 #include "wtf/ParallelJobs.h"
 #include "wtf/Uint8ClampedArray.h"
@@ -343,7 +342,7 @@
     RefPtr<SkImageFilter> input(builder->build(inputEffect(0), operatingColorSpace()));
     float stdX = filter()->applyHorizontalScale(m_stdX);
     float stdY = filter()->applyVerticalScale(m_stdY);
-    SkIRect rect = getCropRect(builder->cropOffset());
+    SkImageFilter::CropRect rect = getCropRect(builder->cropOffset());
     return adoptRef(new SkBlurImageFilter(SkFloatToScalar(stdX), SkFloatToScalar(stdY), input.get(), &rect));
 }
 
diff --git a/Source/core/platform/graphics/filters/FELighting.cpp b/Source/core/platform/graphics/filters/FELighting.cpp
index 7482550..aa17504 100644
--- a/Source/core/platform/graphics/filters/FELighting.cpp
+++ b/Source/core/platform/graphics/filters/FELighting.cpp
@@ -416,7 +416,7 @@
 
 PassRefPtr<SkImageFilter> FELighting::createImageFilter(SkiaImageFilterBuilder* builder)
 {
-    SkIRect rect = getCropRect(builder->cropOffset());
+    SkImageFilter::CropRect rect = getCropRect(builder->cropOffset());
     RefPtr<SkImageFilter> input(builder ? builder->build(inputEffect(0), operatingColorSpace()) : 0);
     switch (m_lightSource->type()) {
     case LS_DISTANT: {
diff --git a/Source/core/platform/graphics/filters/FEMerge.cpp b/Source/core/platform/graphics/filters/FEMerge.cpp
index 2dd3bbf..0d2b39f 100644
--- a/Source/core/platform/graphics/filters/FEMerge.cpp
+++ b/Source/core/platform/graphics/filters/FEMerge.cpp
@@ -28,9 +28,9 @@
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
-#include "wtf/OwnArrayPtr.h"
+#include "platform/text/TextStream.h"
+#include "wtf/OwnPtr.h"
 
 namespace WebCore {
 
@@ -64,13 +64,14 @@
 {
     unsigned size = numberOfEffectInputs();
 
-    OwnArrayPtr<RefPtr<SkImageFilter> > inputRefs = adoptArrayPtr(new RefPtr<SkImageFilter>[size]);
-    OwnArrayPtr<SkImageFilter*> inputs = adoptArrayPtr(new SkImageFilter*[size]);
+    OwnPtr<RefPtr<SkImageFilter>[]> inputRefs = adoptArrayPtr(new RefPtr<SkImageFilter>[size]);
+    OwnPtr<SkImageFilter*[]> inputs = adoptArrayPtr(new SkImageFilter*[size]);
     for (unsigned i = 0; i < size; ++i) {
         inputRefs[i] = builder->build(inputEffect(i), operatingColorSpace());
         inputs[i] = inputRefs[i].get();
     }
-    return adoptRef(new SkMergeImageFilter(inputs.get(), size));
+    SkImageFilter::CropRect rect = getCropRect(builder->cropOffset());
+    return adoptRef(new SkMergeImageFilter(inputs.get(), size, 0, &rect));
 }
 
 TextStream& FEMerge::externalRepresentation(TextStream& ts, int indent) const
diff --git a/Source/core/platform/graphics/filters/FEMorphology.cpp b/Source/core/platform/graphics/filters/FEMorphology.cpp
index 5ccbe69..e163218 100644
--- a/Source/core/platform/graphics/filters/FEMorphology.cpp
+++ b/Source/core/platform/graphics/filters/FEMorphology.cpp
@@ -28,10 +28,8 @@
 
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
-
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
-
+#include "platform/text/TextStream.h"
 #include "wtf/ParallelJobs.h"
 #include "wtf/Uint8ClampedArray.h"
 #include "wtf/Vector.h"
@@ -272,9 +270,10 @@
     RefPtr<SkImageFilter> input(builder->build(inputEffect(0), operatingColorSpace()));
     SkScalar radiusX = SkFloatToScalar(filter()->applyHorizontalScale(m_radiusX));
     SkScalar radiusY = SkFloatToScalar(filter()->applyVerticalScale(m_radiusY));
+    SkImageFilter::CropRect rect = getCropRect(builder->cropOffset());
     if (m_type == FEMORPHOLOGY_OPERATOR_DILATE)
-        return adoptRef(new SkDilateImageFilter(radiusX, radiusY, input.get()));
-    return adoptRef(new SkErodeImageFilter(radiusX, radiusY, input.get()));
+        return adoptRef(new SkDilateImageFilter(radiusX, radiusY, input.get(), &rect));
+    return adoptRef(new SkErodeImageFilter(radiusX, radiusY, input.get(), &rect));
 }
 
 static TextStream& operator<<(TextStream& ts, const MorphologyOperatorType& type)
diff --git a/Source/core/platform/graphics/filters/FEOffset.cpp b/Source/core/platform/graphics/filters/FEOffset.cpp
index c89f4da..39b2cbd 100644
--- a/Source/core/platform/graphics/filters/FEOffset.cpp
+++ b/Source/core/platform/graphics/filters/FEOffset.cpp
@@ -32,15 +32,15 @@
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
+#include "platform/text/TextStream.h"
 #include "third_party/skia/include/core/SkDevice.h"
 
 namespace WebCore {
 
 class OffsetImageFilter : public SkImageFilter {
 public:
-    OffsetImageFilter(SkScalar dx, SkScalar dy, SkImageFilter* input, const SkIRect* cropRect = 0) : SkImageFilter(input, cropRect), m_dx(dx), m_dy(dy)
+    OffsetImageFilter(SkScalar dx, SkScalar dy, SkImageFilter* input, const CropRect* cropRect = 0) : SkImageFilter(input, cropRect), m_dx(dx), m_dy(dy)
     {
     }
 
@@ -165,7 +165,7 @@
 {
     RefPtr<SkImageFilter> input(builder->build(inputEffect(0), operatingColorSpace()));
     Filter* filter = this->filter();
-    SkIRect cropRect = getCropRect(builder->cropOffset());
+    SkImageFilter::CropRect cropRect = getCropRect(builder->cropOffset());
     return adoptRef(new OffsetImageFilter(SkFloatToScalar(filter->applyHorizontalScale(m_dx)), SkFloatToScalar(filter->applyVerticalScale(m_dy)), input.get(), &cropRect));
 }
 
diff --git a/Source/core/platform/graphics/filters/FESpecularLighting.cpp b/Source/core/platform/graphics/filters/FESpecularLighting.cpp
index 7c450e5..3e7f162 100644
--- a/Source/core/platform/graphics/filters/FESpecularLighting.cpp
+++ b/Source/core/platform/graphics/filters/FESpecularLighting.cpp
@@ -25,8 +25,8 @@
 #include "core/platform/graphics/filters/FESpecularLighting.h"
 
 #include "core/platform/graphics/filters/LightSource.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
+#include "platform/text/TextStream.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/filters/FETile.cpp b/Source/core/platform/graphics/filters/FETile.cpp
index 14b647c..2abf649 100644
--- a/Source/core/platform/graphics/filters/FETile.cpp
+++ b/Source/core/platform/graphics/filters/FETile.cpp
@@ -30,10 +30,10 @@
 #include "core/platform/graphics/Pattern.h"
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/SkiaImageFilterBuilder.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
 #include "core/rendering/svg/SVGRenderingContext.h"
+#include "platform/text/TextStream.h"
+#include "platform/transforms/AffineTransform.h"
 #include "third_party/skia/include/core/SkDevice.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/filters/FETurbulence.cpp b/Source/core/platform/graphics/filters/FETurbulence.cpp
index 29e0779..3dd5c48 100644
--- a/Source/core/platform/graphics/filters/FETurbulence.cpp
+++ b/Source/core/platform/graphics/filters/FETurbulence.cpp
@@ -29,9 +29,8 @@
 #include "SkPerlinNoiseShader.h"
 #include "SkRectShaderImageFilter.h"
 #include "core/platform/graphics/filters/Filter.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
-
+#include "platform/text/TextStream.h"
 #include "wtf/MathExtras.h"
 #include "wtf/ParallelJobs.h"
 #include "wtf/Uint8ClampedArray.h"
diff --git a/Source/core/platform/graphics/filters/Filter.h b/Source/core/platform/graphics/filters/Filter.h
index 1ac9e1c..53787df 100644
--- a/Source/core/platform/graphics/filters/Filter.h
+++ b/Source/core/platform/graphics/filters/Filter.h
@@ -21,9 +21,9 @@
 #ifndef Filter_h
 #define Filter_h
 
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/ImageBuffer.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/FloatSize.h"
 #include "wtf/RefCounted.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/filters/FilterEffect.cpp b/Source/core/platform/graphics/filters/FilterEffect.cpp
index 5972bcd..d69f044 100644
--- a/Source/core/platform/graphics/filters/FilterEffect.cpp
+++ b/Source/core/platform/graphics/filters/FilterEffect.cpp
@@ -481,17 +481,31 @@
     return 0;
 }
 
-SkIRect FilterEffect::getCropRect(const FloatSize& cropOffset) const
+SkImageFilter::CropRect FilterEffect::getCropRect(const FloatSize& cropOffset) const
 {
-    SkIRect rect;
+    SkRect rect = SkRect::MakeEmpty();
+    uint32_t flags = 0;
     FloatRect boundaries = effectBoundaries();
     FloatSize resolution = filter()->filterResolution();
     boundaries.scale(resolution.width(), resolution.height());
-    rect.fLeft = hasX() ? static_cast<int>(boundaries.x()) + cropOffset.width() : 0;
-    rect.fTop = hasY() ? static_cast<int>(boundaries.y()) + cropOffset.height() : 0;
-    rect.fRight = hasWidth() ? rect.fLeft + static_cast<int>(boundaries.width()) : SK_MaxS32;
-    rect.fBottom = hasHeight() ? rect.fTop + static_cast<int>(boundaries.height()) : SK_MaxS32;
-    return rect;
+    boundaries.move(cropOffset);
+    if (hasX()) {
+        rect.fLeft = boundaries.x();
+        flags |= SkImageFilter::CropRect::kHasLeft_CropEdge;
+    }
+    if (hasY()) {
+        rect.fTop = boundaries.y();
+        flags |= SkImageFilter::CropRect::kHasTop_CropEdge;
+    }
+    if (hasWidth()) {
+        rect.fRight = rect.fLeft + boundaries.width();
+        flags |= SkImageFilter::CropRect::kHasRight_CropEdge;
+    }
+    if (hasHeight()) {
+        rect.fBottom = rect.fTop + boundaries.height();
+        flags |= SkImageFilter::CropRect::kHasBottom_CropEdge;
+    }
+    return SkImageFilter::CropRect(rect, flags);
 }
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/filters/FilterEffect.h b/Source/core/platform/graphics/filters/FilterEffect.h
index 2aabe06..44dd7d6 100644
--- a/Source/core/platform/graphics/filters/FilterEffect.h
+++ b/Source/core/platform/graphics/filters/FilterEffect.h
@@ -24,8 +24,10 @@
 #define FilterEffect_h
 
 #include "core/platform/graphics/ColorSpace.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/IntRect.h"
+
+#include "third_party/skia/include/core/SkImageFilter.h"
 
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefCounted.h"
@@ -35,8 +37,6 @@
 
 static const float kMaxFilterSize = 5000.0f;
 
-class SkImageFilter;
-
 namespace WebCore {
 
 class Filter;
@@ -170,7 +170,7 @@
 
     // If a pre-multiplied image, check every pixel for validity and correct if necessary.
     void forceValidPreMultipliedPixels();
-    SkIRect getCropRect(const FloatSize& cropOffset) const;
+    SkImageFilter::CropRect getCropRect(const FloatSize& cropOffset) const;
 
 private:
     virtual void applySoftware() = 0;
diff --git a/Source/core/platform/graphics/filters/FilterOperation.cpp b/Source/core/platform/graphics/filters/FilterOperation.cpp
index 8b06964..5439dbe 100644
--- a/Source/core/platform/graphics/filters/FilterOperation.cpp
+++ b/Source/core/platform/graphics/filters/FilterOperation.cpp
@@ -118,11 +118,11 @@
     LengthType lengthType = m_stdDeviation.type();
 
     if (blendToPassthrough)
-        return BlurFilterOperation::create(Length(lengthType).blend(m_stdDeviation, progress), m_type);
+        return BlurFilterOperation::create(Length(lengthType).blend(m_stdDeviation, progress, ValueRangeNonNegative), m_type);
 
     const BlurFilterOperation* fromOp = static_cast<const BlurFilterOperation*>(from);
     Length fromLength = fromOp ? fromOp->m_stdDeviation : Length(lengthType);
-    return BlurFilterOperation::create(m_stdDeviation.blend(fromLength, progress), m_type);
+    return BlurFilterOperation::create(m_stdDeviation.blend(fromLength, progress, ValueRangeNonNegative), m_type);
 }
 
 PassRefPtr<FilterOperation> DropShadowFilterOperation::blend(const FilterOperation* from, double progress, bool blendToPassthrough)
diff --git a/Source/core/platform/graphics/filters/FilterOperations.cpp b/Source/core/platform/graphics/filters/FilterOperations.cpp
index 8857a23..5b67b8a 100644
--- a/Source/core/platform/graphics/filters/FilterOperations.cpp
+++ b/Source/core/platform/graphics/filters/FilterOperations.cpp
@@ -27,8 +27,8 @@
 #include "core/platform/graphics/filters/FilterOperations.h"
 
 #include "core/css/LengthFunctions.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/platform/graphics/filters/FEGaussianBlur.h"
+#include "platform/geometry/IntSize.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/filters/FilterOperations.h b/Source/core/platform/graphics/filters/FilterOperations.h
index a1f0cfc..22064be 100644
--- a/Source/core/platform/graphics/filters/FilterOperations.h
+++ b/Source/core/platform/graphics/filters/FilterOperations.h
@@ -26,8 +26,8 @@
 #ifndef FilterOperations_h
 #define FilterOperations_h
 
-#include "core/platform/graphics/IntRectExtent.h"
 #include "core/platform/graphics/filters/FilterOperation.h"
+#include "platform/geometry/IntRectExtent.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/platform/graphics/filters/LightSource.h b/Source/core/platform/graphics/filters/LightSource.h
index e47e850..e6ece4a 100644
--- a/Source/core/platform/graphics/filters/LightSource.h
+++ b/Source/core/platform/graphics/filters/LightSource.h
@@ -24,7 +24,7 @@
 #ifndef LightSource_h
 #define LightSource_h
 
-#include "core/platform/graphics/FloatPoint3D.h"
+#include "platform/geometry/FloatPoint3D.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 
diff --git a/Source/core/platform/graphics/filters/PointLightSource.cpp b/Source/core/platform/graphics/filters/PointLightSource.cpp
index 232787c..e924acc 100644
--- a/Source/core/platform/graphics/filters/PointLightSource.cpp
+++ b/Source/core/platform/graphics/filters/PointLightSource.cpp
@@ -32,7 +32,7 @@
 
 #include "core/platform/graphics/filters/PointLightSource.h"
 
-#include "core/platform/text/TextStream.h"
+#include "platform/text/TextStream.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/filters/ReferenceFilter.h b/Source/core/platform/graphics/filters/ReferenceFilter.h
index 7bc87dc..ab1d817 100644
--- a/Source/core/platform/graphics/filters/ReferenceFilter.h
+++ b/Source/core/platform/graphics/filters/ReferenceFilter.h
@@ -31,8 +31,8 @@
 #ifndef ReferenceFilter_h
 #define ReferenceFilter_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/filters/Filter.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
 
diff --git a/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp b/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp
index 49a686a..9527d6a 100644
--- a/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp
+++ b/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.cpp
@@ -35,124 +35,10 @@
 #include "core/platform/graphics/filters/FilterEffect.h"
 #include "core/platform/graphics/filters/FilterOperations.h"
 #include "core/platform/graphics/filters/SourceGraphic.h"
+#include "public/platform/WebPoint.h"
 
 namespace {
 
-void getBrightnessMatrix(float amount, SkScalar matrix[20])
-{
-    memset(matrix, 0, 20 * sizeof(SkScalar));
-    matrix[0] = matrix[6] = matrix[12] = amount;
-    matrix[18] = 1;
-}
-
-void getContrastMatrix(float amount, SkScalar matrix[20])
-{
-    memset(matrix, 0, 20 * sizeof(SkScalar));
-    matrix[0] = matrix[6] = matrix[12] = amount;
-    matrix[4] = matrix[9] = matrix[14] = (-0.5f * amount + 0.5f) * 255;
-    matrix[18] = 1;
-}
-
-void getSaturateMatrix(float amount, SkScalar matrix[20])
-{
-    // Note, these values are computed to ensure matrixNeedsClamping is false
-    // for amount in [0..1]
-    matrix[0] = 0.213f + 0.787f * amount;
-    matrix[1] = 0.715f - 0.715f * amount;
-    matrix[2] = 1.f - (matrix[0] + matrix[1]);
-    matrix[3] = matrix[4] = 0;
-    matrix[5] = 0.213f - 0.213f * amount;
-    matrix[6] = 0.715f + 0.285f * amount;
-    matrix[7] = 1.f - (matrix[5] + matrix[6]);
-    matrix[8] = matrix[9] = 0;
-    matrix[10] = 0.213f - 0.213f * amount;
-    matrix[11] = 0.715f - 0.715f * amount;
-    matrix[12] = 1.f - (matrix[10] + matrix[11]);
-    matrix[13] = matrix[14] = 0;
-    matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
-    matrix[18] = 1;
-}
-
-void getHueRotateMatrix(float hue, SkScalar matrix[20])
-{
-    float cosHue = cosf(hue * piFloat / 180);
-    float sinHue = sinf(hue * piFloat / 180);
-    matrix[0] = 0.213f + cosHue * 0.787f - sinHue * 0.213f;
-    matrix[1] = 0.715f - cosHue * 0.715f - sinHue * 0.715f;
-    matrix[2] = 0.072f - cosHue * 0.072f + sinHue * 0.928f;
-    matrix[3] = matrix[4] = 0;
-    matrix[5] = 0.213f - cosHue * 0.213f + sinHue * 0.143f;
-    matrix[6] = 0.715f + cosHue * 0.285f + sinHue * 0.140f;
-    matrix[7] = 0.072f - cosHue * 0.072f - sinHue * 0.283f;
-    matrix[8] = matrix[9] = 0;
-    matrix[10] = 0.213f - cosHue * 0.213f - sinHue * 0.787f;
-    matrix[11] = 0.715f - cosHue * 0.715f + sinHue * 0.715f;
-    matrix[12] = 0.072f + cosHue * 0.928f + sinHue * 0.072f;
-    matrix[13] = matrix[14] = 0;
-    matrix[15] = matrix[16] = matrix[17] = 0;
-    matrix[18] = 1;
-    matrix[19] = 0;
-}
-
-void getInvertMatrix(float amount, SkScalar matrix[20])
-{
-    memset(matrix, 0, 20 * sizeof(SkScalar));
-    matrix[0] = matrix[6] = matrix[12] = 1 - 2 * amount;
-    matrix[4] = matrix[9] = matrix[14] = amount * 255;
-    matrix[18] = 1;
-}
-
-void getOpacityMatrix(float amount, SkScalar matrix[20])
-{
-    memset(matrix, 0, 20 * sizeof(SkScalar));
-    matrix[0] = matrix[6] = matrix[12] = 1;
-    matrix[18] = amount;
-}
-
-void getGrayscaleMatrix(float amount, SkScalar matrix[20])
-{
-    // Note, these values are computed to ensure matrixNeedsClamping is false
-    // for amount in [0..1]
-    matrix[0] = 0.2126f + 0.7874f * amount;
-    matrix[1] = 0.7152f - 0.7152f * amount;
-    matrix[2] = 1.f - (matrix[0] + matrix[1]);
-    matrix[3] = matrix[4] = 0;
-
-    matrix[5] = 0.2126f - 0.2126f * amount;
-    matrix[6] = 0.7152f + 0.2848f * amount;
-    matrix[7] = 1.f - (matrix[5] + matrix[6]);
-    matrix[8] = matrix[9] = 0;
-
-    matrix[10] = 0.2126f - 0.2126f * amount;
-    matrix[11] = 0.7152f - 0.7152f * amount;
-    matrix[12] = 1.f - (matrix[10] + matrix[11]);
-    matrix[13] = matrix[14] = 0;
-
-    matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
-    matrix[18] = 1;
-}
-
-void getSepiaMatrix(float amount, SkScalar matrix[20])
-{
-    matrix[0] = 0.393f + 0.607f * amount;
-    matrix[1] = 0.769f - 0.769f * amount;
-    matrix[2] = 0.189f - 0.189f * amount;
-    matrix[3] = matrix[4] = 0;
-
-    matrix[5] = 0.349f - 0.349f * amount;
-    matrix[6] = 0.686f + 0.314f * amount;
-    matrix[7] = 0.168f - 0.168f * amount;
-    matrix[8] = matrix[9] = 0;
-
-    matrix[10] = 0.272f - 0.272f * amount;
-    matrix[11] = 0.534f - 0.534f * amount;
-    matrix[12] = 0.131f + 0.869f * amount;
-    matrix[13] = matrix[14] = 0;
-
-    matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
-    matrix[18] = 1;
-}
-
 PassRefPtr<SkImageFilter> createMatrixImageFilter(SkScalar matrix[20], SkImageFilter* input)
 {
     RefPtr<SkColorFilter> colorFilter(adoptRef(new SkColorMatrixFilter(matrix)));
@@ -199,26 +85,36 @@
     return adoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), input));
 }
 
-PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::build(const FilterOperations& operations)
+bool SkiaImageFilterBuilder::buildFilterOperations(const FilterOperations& operations, WebKit::WebFilterOperations* filters)
 {
-    RefPtr<SkImageFilter> filter;
-    SkScalar matrix[20];
+    if (!filters)
+        return false;
+
     ColorSpace currentColorSpace = ColorSpaceDeviceRGB;
+
+    RefPtr<SkImageFilter> noopFilter;
+    SkScalar matrix[20];
+    memset(matrix, 0, 20 * sizeof(SkScalar));
+    matrix[0] = matrix[6] = matrix[12] = matrix[18] = 1.f;
+    noopFilter = createMatrixImageFilter(matrix, 0);
+
     for (size_t i = 0; i < operations.size(); ++i) {
         const FilterOperation& op = *operations.at(i);
         switch (op.getOperationType()) {
         case FilterOperation::REFERENCE: {
+            RefPtr<SkImageFilter> filter;
             const ReferenceFilterOperation* referenceFilterOperation = static_cast<const ReferenceFilterOperation*>(&op);
             ReferenceFilter* referenceFilter = referenceFilterOperation->filter();
             if (referenceFilter && referenceFilter->lastEffect()) {
                 FilterEffect* filterEffect = referenceFilter->lastEffect();
-                // Link SourceGraphic to the previous filter in the chain.
-                // We don't know what color space the interior nodes will request, so we have to populate the map with both options.
-                // (Only one of these will actually have a color transform on it.)
+                // Link SourceGraphic to a noop filter that serves as a placholder for
+                // the previous filter in the chain. We don't know what color space the
+                // interior nodes will request, so we have to populate the map with both
+                // options. (Only one of these will actually have a color transform on it.)
                 FilterColorSpacePair deviceKey(referenceFilter->sourceGraphic(), ColorSpaceDeviceRGB);
                 FilterColorSpacePair linearKey(referenceFilter->sourceGraphic(), ColorSpaceLinearRGB);
-                m_map.set(deviceKey, transformColorSpace(filter.get(), currentColorSpace, ColorSpaceDeviceRGB));
-                m_map.set(linearKey, transformColorSpace(filter.get(), currentColorSpace, ColorSpaceLinearRGB));
+                m_map.set(deviceKey, transformColorSpace(noopFilter.get(), currentColorSpace, ColorSpaceDeviceRGB));
+                m_map.set(linearKey, transformColorSpace(noopFilter.get(), currentColorSpace, ColorSpaceLinearRGB));
 
                 currentColorSpace = filterEffect->operatingColorSpace();
                 filter = SkiaImageFilterBuilder::build(filterEffect, currentColorSpace);
@@ -226,70 +122,69 @@
                 // sure we don't keep it in the map anymore.
                 m_map.remove(deviceKey);
                 m_map.remove(linearKey);
+                filters->appendReferenceFilter(filter.get());
             }
             break;
         }
-        case FilterOperation::GRAYSCALE: {
-            float amount = static_cast<const BasicColorMatrixFilterOperation*>(&op)->amount();
-            getGrayscaleMatrix(1 - amount, matrix);
-            filter = createMatrixImageFilter(matrix, filter.get());
-            break;
-        }
-        case FilterOperation::SEPIA: {
-            float amount = static_cast<const BasicColorMatrixFilterOperation*>(&op)->amount();
-            getSepiaMatrix(1 - amount, matrix);
-            filter = createMatrixImageFilter(matrix, filter.get());
-            break;
-        }
-        case FilterOperation::SATURATE: {
-            float amount = static_cast<const BasicColorMatrixFilterOperation*>(&op)->amount();
-            getSaturateMatrix(amount, matrix);
-            filter = createMatrixImageFilter(matrix, filter.get());
-            break;
-        }
+        case FilterOperation::GRAYSCALE:
+        case FilterOperation::SEPIA:
+        case FilterOperation::SATURATE:
         case FilterOperation::HUE_ROTATE: {
             float amount = static_cast<const BasicColorMatrixFilterOperation*>(&op)->amount();
-            getHueRotateMatrix(amount, matrix);
-            filter = createMatrixImageFilter(matrix, filter.get());
+            switch (op.getOperationType()) {
+            case FilterOperation::GRAYSCALE:
+                filters->appendGrayscaleFilter(amount);
+                break;
+            case FilterOperation::SEPIA:
+                filters->appendSepiaFilter(amount);
+                break;
+            case FilterOperation::SATURATE:
+                filters->appendSaturateFilter(amount);
+                break;
+            case FilterOperation::HUE_ROTATE:
+                filters->appendHueRotateFilter(amount);
+                break;
+            default:
+                ASSERT_NOT_REACHED();
+            }
             break;
         }
-        case FilterOperation::INVERT: {
-            float amount = static_cast<const BasicComponentTransferFilterOperation*>(&op)->amount();
-            getInvertMatrix(amount, matrix);
-            filter = createMatrixImageFilter(matrix, filter.get());
-            break;
-        }
-        case FilterOperation::OPACITY: {
-            float amount = static_cast<const BasicComponentTransferFilterOperation*>(&op)->amount();
-            getOpacityMatrix(amount, matrix);
-            filter = createMatrixImageFilter(matrix, filter.get());
-            break;
-        }
-        case FilterOperation::BRIGHTNESS: {
-            float amount = static_cast<const BasicComponentTransferFilterOperation*>(&op)->amount();
-            getBrightnessMatrix(amount, matrix);
-            filter = createMatrixImageFilter(matrix, filter.get());
-            break;
-        }
+        case FilterOperation::INVERT:
+        case FilterOperation::OPACITY:
+        case FilterOperation::BRIGHTNESS:
         case FilterOperation::CONTRAST: {
             float amount = static_cast<const BasicComponentTransferFilterOperation*>(&op)->amount();
-            getContrastMatrix(amount, matrix);
-            filter = createMatrixImageFilter(matrix, filter.get());
+            switch (op.getOperationType()) {
+            case FilterOperation::INVERT:
+                filters->appendInvertFilter(amount);
+                break;
+            case FilterOperation::OPACITY:
+                filters->appendOpacityFilter(amount);
+                break;
+            case FilterOperation::BRIGHTNESS:
+                filters->appendBrightnessFilter(amount);
+                break;
+            case FilterOperation::CONTRAST:
+                filters->appendContrastFilter(amount);
+                break;
+            default:
+                ASSERT_NOT_REACHED();
+            }
             break;
         }
         case FilterOperation::BLUR: {
             float pixelRadius = static_cast<const BlurFilterOperation*>(&op)->stdDeviation().getFloatValue();
-            filter = adoptRef(new SkBlurImageFilter(pixelRadius, pixelRadius, filter.get()));
+            filters->appendBlurFilter(pixelRadius);
             break;
         }
         case FilterOperation::DROP_SHADOW: {
             const DropShadowFilterOperation* drop = static_cast<const DropShadowFilterOperation*>(&op);
-            filter = adoptRef(new SkDropShadowImageFilter(SkIntToScalar(drop->x()), SkIntToScalar(drop->y()), SkIntToScalar(drop->stdDeviation()), drop->color().rgb(), filter.get()));
+            filters->appendDropShadowFilter(WebKit::WebPoint(drop->x(), drop->y()), drop->stdDeviation(), drop->color().rgb());
             break;
         }
         case FilterOperation::VALIDATED_CUSTOM:
         case FilterOperation::CUSTOM:
-            // Not supported.
+            return false; // Not supported.
         case FilterOperation::PASSTHROUGH:
         case FilterOperation::NONE:
             break;
@@ -297,9 +192,12 @@
     }
     if (currentColorSpace != ColorSpaceDeviceRGB) {
         // Transform to device color space at the end of processing, if required
-        filter = transformColorSpace(filter.get(), currentColorSpace, ColorSpaceDeviceRGB);
+        RefPtr<SkImageFilter> filter;
+        filter = transformColorSpace(noopFilter.get(), currentColorSpace, ColorSpaceDeviceRGB);
+        if (filter != noopFilter)
+            filters->appendReferenceFilter(filter.get());
     }
-    return filter.release();
+    return true;
 }
 
 };
diff --git a/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.h b/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.h
index f16dc22..9fdf34a 100644
--- a/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.h
+++ b/Source/core/platform/graphics/filters/SkiaImageFilterBuilder.h
@@ -27,7 +27,8 @@
 #define SkiaImageFilterBuilder_h
 
 #include "core/platform/graphics/ColorSpace.h"
-#include "core/platform/graphics/FloatSize.h"
+#include "platform/geometry/FloatSize.h"
+#include "public/platform/WebFilterOperations.h"
 #include "wtf/HashMap.h"
 
 class SkImageFilter;
@@ -42,7 +43,7 @@
     ~SkiaImageFilterBuilder();
 
     PassRefPtr<SkImageFilter> build(FilterEffect*, ColorSpace);
-    PassRefPtr<SkImageFilter> build(const FilterOperations&);
+    bool buildFilterOperations(const FilterOperations&, WebKit::WebFilterOperations*);
 
     PassRefPtr<SkImageFilter> transformColorSpace(
         SkImageFilter* input, ColorSpace srcColorSpace, ColorSpace dstColorSpace);
diff --git a/Source/core/platform/graphics/filters/SourceAlpha.cpp b/Source/core/platform/graphics/filters/SourceAlpha.cpp
index 3eb1228..4070da6 100644
--- a/Source/core/platform/graphics/filters/SourceAlpha.cpp
+++ b/Source/core/platform/graphics/filters/SourceAlpha.cpp
@@ -25,8 +25,8 @@
 #include "core/platform/graphics/Color.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/filters/Filter.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
+#include "platform/text/TextStream.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/platform/graphics/filters/SourceGraphic.cpp b/Source/core/platform/graphics/filters/SourceGraphic.cpp
index 2a1ced8..ef2f255 100644
--- a/Source/core/platform/graphics/filters/SourceGraphic.cpp
+++ b/Source/core/platform/graphics/filters/SourceGraphic.cpp
@@ -24,8 +24,8 @@
 
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/filters/Filter.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
+#include "platform/text/TextStream.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/platform/graphics/filters/SpotLightSource.cpp b/Source/core/platform/graphics/filters/SpotLightSource.cpp
index 7ffe750..6efa993 100644
--- a/Source/core/platform/graphics/filters/SpotLightSource.cpp
+++ b/Source/core/platform/graphics/filters/SpotLightSource.cpp
@@ -33,7 +33,7 @@
 
 #include "core/platform/graphics/filters/SpotLightSource.h"
 
-#include "core/platform/text/TextStream.h"
+#include "platform/text/TextStream.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/filters/custom/CustomFilterGlobalContext.cpp b/Source/core/platform/graphics/filters/custom/CustomFilterGlobalContext.cpp
index 07b0aa0..8088f08 100644
--- a/Source/core/platform/graphics/filters/custom/CustomFilterGlobalContext.cpp
+++ b/Source/core/platform/graphics/filters/custom/CustomFilterGlobalContext.cpp
@@ -46,23 +46,23 @@
         iter->value->detachFromGlobalContext();
 }
 
-ANGLEWebKitBridge* CustomFilterGlobalContext::webglShaderValidator()
+ANGLEPlatformBridge* CustomFilterGlobalContext::webglShaderValidator()
 {
     if (!m_webglShaderValidator)
         m_webglShaderValidator = createShaderValidator(SH_WEBGL_SPEC);
     return m_webglShaderValidator.get();
 }
 
-ANGLEWebKitBridge* CustomFilterGlobalContext::mixShaderValidator()
+ANGLEPlatformBridge* CustomFilterGlobalContext::mixShaderValidator()
 {
     if (!m_mixShaderValidator)
         m_mixShaderValidator = createShaderValidator(SH_CSS_SHADERS_SPEC);
     return m_mixShaderValidator.get();
 }
 
-PassOwnPtr<ANGLEWebKitBridge> CustomFilterGlobalContext::createShaderValidator(ShShaderSpec shaderSpec)
+PassOwnPtr<ANGLEPlatformBridge> CustomFilterGlobalContext::createShaderValidator(ShShaderSpec shaderSpec)
 {
-    OwnPtr<ANGLEWebKitBridge> validator = adoptPtr(new ANGLEWebKitBridge(SH_ESSL_OUTPUT, shaderSpec));
+    OwnPtr<ANGLEPlatformBridge> validator = adoptPtr(new ANGLEPlatformBridge(SH_ESSL_OUTPUT, shaderSpec));
     ShBuiltInResources resources;
     ShInitBuiltInResources(&resources);
     validator->setResources(resources);
diff --git a/Source/core/platform/graphics/filters/custom/CustomFilterGlobalContext.h b/Source/core/platform/graphics/filters/custom/CustomFilterGlobalContext.h
index 8d4d0f2..c417b89 100644
--- a/Source/core/platform/graphics/filters/custom/CustomFilterGlobalContext.h
+++ b/Source/core/platform/graphics/filters/custom/CustomFilterGlobalContext.h
@@ -30,8 +30,8 @@
 #ifndef CustomFilterGlobalContext_h
 #define CustomFilterGlobalContext_h
 
-#include "core/platform/graphics/ANGLEWebKitBridge.h"
 #include "core/platform/graphics/filters/custom/CustomFilterProgramInfo.h"
+#include "platform/graphics/angle/ANGLEPlatformBridge.h"
 #include "wtf/HashMap.h"
 #include "wtf/RefPtr.h"
 
@@ -51,7 +51,7 @@
 
     // CSS shaders not referenced from the CSS mix function should be validated just like regular WebGL shaders.
     // This ANGLE validator uses the SH_WEBGL_SPEC flag.
-    ANGLEWebKitBridge* webglShaderValidator();
+    ANGLEPlatformBridge* webglShaderValidator();
 
     // CSS shaders referenced from the CSS mix function should be validated slightly differently than WebGL shaders.
     // This ANGLE validator uses the SH_CSS_SHADERS_SPEC flag.
@@ -61,18 +61,18 @@
     // - The "css_" prefix is reserved.
     // - In the translated source that ANGLE returns, ANGLE renames the author's "main" function to "css_main".
     // The complete details are documented in ANGLE/ShaderLang.h.
-    ANGLEWebKitBridge* mixShaderValidator();
+    ANGLEPlatformBridge* mixShaderValidator();
 
     void prepareContextIfNeeded();
 
     PassRefPtr<CustomFilterValidatedProgram> getValidatedProgram(const CustomFilterProgramInfo&);
     void removeValidatedProgram(const CustomFilterValidatedProgram*);
 private:
-    static PassOwnPtr<ANGLEWebKitBridge> createShaderValidator(ShShaderSpec);
+    static PassOwnPtr<ANGLEPlatformBridge> createShaderValidator(ShShaderSpec);
 
     RefPtr<GraphicsContext3D> m_context;
-    OwnPtr<ANGLEWebKitBridge> m_webglShaderValidator;
-    OwnPtr<ANGLEWebKitBridge> m_mixShaderValidator;
+    OwnPtr<ANGLEPlatformBridge> m_webglShaderValidator;
+    OwnPtr<ANGLEPlatformBridge> m_mixShaderValidator;
     CustomFilterValidatedProgramsMap m_programs;
 };
 
diff --git a/Source/core/platform/graphics/filters/custom/CustomFilterMesh.h b/Source/core/platform/graphics/filters/custom/CustomFilterMesh.h
index 022479f..045742d 100644
--- a/Source/core/platform/graphics/filters/custom/CustomFilterMesh.h
+++ b/Source/core/platform/graphics/filters/custom/CustomFilterMesh.h
@@ -30,9 +30,9 @@
 #ifndef CustomFilterMesh_h
 #define CustomFilterMesh_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsTypes3D.h"
 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/RefCounted.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/filters/custom/CustomFilterMeshGenerator.h b/Source/core/platform/graphics/filters/custom/CustomFilterMeshGenerator.h
index 2928a80..0975086 100644
--- a/Source/core/platform/graphics/filters/custom/CustomFilterMeshGenerator.h
+++ b/Source/core/platform/graphics/filters/custom/CustomFilterMeshGenerator.h
@@ -30,9 +30,9 @@
 #ifndef CustomFilterMeshGenerator_h
 #define CustomFilterMeshGenerator_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
+#include "platform/geometry/FloatRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/filters/custom/CustomFilterOperation.h b/Source/core/platform/graphics/filters/custom/CustomFilterOperation.h
index 1ef7d70..f7aa39f 100644
--- a/Source/core/platform/graphics/filters/custom/CustomFilterOperation.h
+++ b/Source/core/platform/graphics/filters/custom/CustomFilterOperation.h
@@ -30,11 +30,11 @@
 #ifndef CustomFilterOperation_h
 #define CustomFilterOperation_h
 
-#include "core/platform/graphics/LayoutSize.h"
 #include "core/platform/graphics/filters/FilterOperation.h"
 #include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
 #include "core/platform/graphics/filters/custom/CustomFilterParameterList.h"
 #include "core/platform/graphics/filters/custom/CustomFilterProgram.h"
+#include "platform/geometry/LayoutSize.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/filters/custom/CustomFilterParameterList.h b/Source/core/platform/graphics/filters/custom/CustomFilterParameterList.h
index f9e7270..8aeabff 100644
--- a/Source/core/platform/graphics/filters/custom/CustomFilterParameterList.h
+++ b/Source/core/platform/graphics/filters/custom/CustomFilterParameterList.h
@@ -30,7 +30,7 @@
 #ifndef CustomFilterParameterList_h
 #define CustomFilterParameterList_h
 
-#include "core/platform/graphics/LayoutSize.h"
+#include "platform/geometry/LayoutSize.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/filters/custom/CustomFilterRenderer.cpp b/Source/core/platform/graphics/filters/custom/CustomFilterRenderer.cpp
index 1088225..5f288ee 100644
--- a/Source/core/platform/graphics/filters/custom/CustomFilterRenderer.cpp
+++ b/Source/core/platform/graphics/filters/custom/CustomFilterRenderer.cpp
@@ -41,7 +41,7 @@
 #include "core/platform/graphics/filters/custom/CustomFilterNumberParameter.h"
 #include "core/platform/graphics/filters/custom/CustomFilterParameter.h"
 #include "core/platform/graphics/filters/custom/CustomFilterTransformParameter.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
+#include "platform/transforms/TransformationMatrix.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/filters/custom/CustomFilterRenderer.h b/Source/core/platform/graphics/filters/custom/CustomFilterRenderer.h
index eeb6808..828dce8 100644
--- a/Source/core/platform/graphics/filters/custom/CustomFilterRenderer.h
+++ b/Source/core/platform/graphics/filters/custom/CustomFilterRenderer.h
@@ -33,9 +33,9 @@
 #define CustomFilterRenderer_h
 
 #include "core/platform/graphics/GraphicsTypes3D.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
 #include "core/platform/graphics/filters/custom/CustomFilterParameterList.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
 
diff --git a/Source/core/platform/graphics/filters/custom/CustomFilterTransformParameter.h b/Source/core/platform/graphics/filters/custom/CustomFilterTransformParameter.h
index 71abf75..32188fc 100644
--- a/Source/core/platform/graphics/filters/custom/CustomFilterTransformParameter.h
+++ b/Source/core/platform/graphics/filters/custom/CustomFilterTransformParameter.h
@@ -30,9 +30,9 @@
 #ifndef CustomFilterTransformParameter_h
 #define CustomFilterTransformParameter_h
 
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/filters/custom/CustomFilterParameter.h"
 #include "core/platform/graphics/transforms/TransformOperations.h"
+#include "platform/geometry/FloatSize.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/filters/custom/CustomFilterValidatedProgram.cpp b/Source/core/platform/graphics/filters/custom/CustomFilterValidatedProgram.cpp
index 35aa68e..a880429 100644
--- a/Source/core/platform/graphics/filters/custom/CustomFilterValidatedProgram.cpp
+++ b/Source/core/platform/graphics/filters/custom/CustomFilterValidatedProgram.cpp
@@ -31,11 +31,11 @@
 
 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h"
 
-#include "core/platform/NotImplemented.h"
-#include "core/platform/graphics/ANGLEWebKitBridge.h"
 #include "core/platform/graphics/filters/custom/CustomFilterConstants.h"
 #include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h"
 #include "core/platform/graphics/filters/custom/CustomFilterProgramInfo.h"
+#include "platform/NotImplemented.h"
+#include "platform/graphics/angle/ANGLEPlatformBridge.h"
 #include "wtf/HashMap.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/StringHash.h"
@@ -172,7 +172,7 @@
 
     // Shaders referenced from the CSS mix function use a different validator than regular WebGL shaders. See core/platform/graphics/filters/custom/CustomFilterGlobalContext.h for more details.
     bool blendsElementTexture = (programInfo.programType() == PROGRAM_TYPE_BLENDS_ELEMENT_TEXTURE);
-    ANGLEWebKitBridge* validator = blendsElementTexture ? m_globalContext->mixShaderValidator() : m_globalContext->webglShaderValidator();
+    ANGLEPlatformBridge* validator = blendsElementTexture ? m_globalContext->mixShaderValidator() : m_globalContext->webglShaderValidator();
     String vertexShaderLog, fragmentShaderLog;
     Vector<ANGLEShaderSymbol> symbols;
     bool vertexShaderValid = validator->compileShaderSource(originalVertexShader.utf8().data(), SHADER_TYPE_VERTEX, m_validatedVertexShader, vertexShaderLog, symbols);
diff --git a/Source/core/platform/graphics/filters/custom/FECustomFilter.cpp b/Source/core/platform/graphics/filters/custom/FECustomFilter.cpp
index 23f68e1..68600ed 100644
--- a/Source/core/platform/graphics/filters/custom/FECustomFilter.cpp
+++ b/Source/core/platform/graphics/filters/custom/FECustomFilter.cpp
@@ -37,9 +37,8 @@
 #include "core/platform/graphics/GraphicsContext3D.h"
 #include "core/platform/graphics/filters/custom/CustomFilterRenderer.h"
 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderTreeAsText.h"
-
+#include "platform/text/TextStream.h"
 #include "wtf/Uint8ClampedArray.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/gpu/DrawingBuffer.cpp b/Source/core/platform/graphics/gpu/DrawingBuffer.cpp
index 8155797..0c5a28d 100644
--- a/Source/core/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/Source/core/platform/graphics/gpu/DrawingBuffer.cpp
@@ -33,10 +33,10 @@
 #include "core/platform/graphics/gpu/DrawingBuffer.h"
 
 #include <algorithm>
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/graphics/Extensions3D.h"
 #include "core/platform/graphics/GraphicsContext3D.h"
 #include "core/platform/graphics/GraphicsLayer.h"
+#include "platform/TraceEvent.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCompositorSupport.h"
 #include "public/platform/WebExternalBitmap.h"
diff --git a/Source/core/platform/graphics/gpu/DrawingBuffer.h b/Source/core/platform/graphics/gpu/DrawingBuffer.h
index a6f11d8..e9cfc1c 100644
--- a/Source/core/platform/graphics/gpu/DrawingBuffer.h
+++ b/Source/core/platform/graphics/gpu/DrawingBuffer.h
@@ -33,7 +33,7 @@
 
 #include "core/platform/graphics/GraphicsContext3D.h"
 #include "core/platform/graphics/GraphicsTypes3D.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 
 #include "public/platform/WebExternalTextureLayerClient.h"
 #include "public/platform/WebExternalTextureMailbox.h"
diff --git a/Source/core/platform/graphics/gpu/DrawingBufferTest.cpp b/Source/core/platform/graphics/gpu/DrawingBufferTest.cpp
index 7b39310..29e54b4 100644
--- a/Source/core/platform/graphics/gpu/DrawingBufferTest.cpp
+++ b/Source/core/platform/graphics/gpu/DrawingBufferTest.cpp
@@ -33,7 +33,7 @@
 #include "core/platform/graphics/gpu/DrawingBuffer.h"
 
 #include "core/platform/graphics/GraphicsContext3D.h"
-#include "core/tests/FakeWebGraphicsContext3D.h"
+#include "core/platform/testing/FakeWebGraphicsContext3D.h"
 #include "public/platform/Platform.h"
 #include "wtf/RefPtr.h"
 
diff --git a/Source/core/platform/graphics/harfbuzz/FontHarfBuzz.cpp b/Source/core/platform/graphics/harfbuzz/FontHarfBuzz.cpp
index f5ab673..2df6897 100644
--- a/Source/core/platform/graphics/harfbuzz/FontHarfBuzz.cpp
+++ b/Source/core/platform/graphics/harfbuzz/FontHarfBuzz.cpp
@@ -31,12 +31,12 @@
 #include "config.h"
 #include "core/platform/graphics/Font.h"
 
-#include "core/platform/NotImplemented.h"
-#include "core/platform/graphics/FloatRect.h"
+#include "platform/NotImplemented.h"
 #include "core/platform/graphics/GlyphBuffer.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/SimpleFontData.h"
 #include "core/platform/graphics/harfbuzz/HarfBuzzShaper.h"
+#include "platform/geometry/FloatRect.h"
 
 #include "SkPaint.h"
 #include "SkTemplates.h"
@@ -77,12 +77,21 @@
     SkPoint* vPosEnd = storage3.get();
 
     bool isVertical = font->platformData().orientation() == Vertical;
+    SkScalar verticalPosCompensation = isVertical ? SkFloatToScalar((font->fontMetrics().floatHeight() - font->fontMetrics().floatAscent()) / 2) : 0;
     for (int i = 0; i < numGlyphs; i++) {
         SkScalar myWidth = SkFloatToScalar(adv[i].width());
         pos[i].set(x, y);
         if (isVertical) {
-            vPosBegin[i].set(x + myWidth, y);
-            vPosEnd[i].set(x + myWidth, y - myWidth);
+            // In vertical mode, we need to align the left of ideographics to the vertical baseline.
+            // (Note vertical/horizontal are in absolute orientation, that is, here x is vertical.)
+            // However, when the glyph is drawn in drawTextOnPath(), the baseline is the horizontal path,
+            // so the ideographics will look shifted to the bottom-right direction because the ascent is
+            // applied vertically. Compensate the position so that ascent will look like to be applied
+            // horizontally.
+            SkScalar bottom = x + myWidth - verticalPosCompensation;
+            SkScalar left = y + verticalPosCompensation;
+            vPosBegin[i].set(bottom, left);
+            vPosEnd[i].set(bottom, left - myWidth);
         }
         x += myWidth;
         y += SkFloatToScalar(adv[i].height());
diff --git a/Source/core/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp b/Source/core/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp
index e86b341..4910756 100644
--- a/Source/core/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp
+++ b/Source/core/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp
@@ -34,7 +34,7 @@
 #include "RuntimeEnabledFeatures.h"
 #include "SkPaint.h"
 #include "SkTypeface.h"
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
 #include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/harfbuzz/HarfBuzzFace.h"
 
@@ -123,7 +123,7 @@
     , m_fakeItalic(src.m_fakeItalic)
     , m_orientation(src.m_orientation)
     , m_style(src.m_style)
-    , m_harfBuzzFace(src.m_harfBuzzFace)
+    , m_harfBuzzFace(0)
     , m_isHashTableDeletedValue(false)
 {
 }
@@ -149,7 +149,7 @@
     , m_fakeBold(src.m_fakeBold)
     , m_fakeItalic(src.m_fakeItalic)
     , m_orientation(src.m_orientation)
-    , m_harfBuzzFace(src.m_harfBuzzFace)
+    , m_harfBuzzFace(0)
     , m_isHashTableDeletedValue(false)
 {
     querySystemForRenderStyle();
@@ -175,7 +175,7 @@
     m_textSize = src.m_textSize;
     m_fakeBold = src.m_fakeBold;
     m_fakeItalic = src.m_fakeItalic;
-    m_harfBuzzFace = src.m_harfBuzzFace;
+    m_harfBuzzFace = 0;
     m_orientation = src.m_orientation;
     m_style = src.m_style;
     m_emSizeInFontUnits = src.m_emSizeInFontUnits;
@@ -240,21 +240,6 @@
         && m_isHashTableDeletedValue == a.m_isHashTableDeletedValue;
 }
 
-unsigned FontPlatformData::hash() const
-{
-    unsigned h = SkTypeface::UniqueID(m_typeface.get());
-    h ^= 0x01010101 * ((static_cast<int>(m_orientation) << 2) | (static_cast<int>(m_fakeBold) << 1) | static_cast<int>(m_fakeItalic));
-
-    // This memcpy is to avoid a reinterpret_cast that breaks strict-aliasing
-    // rules. Memcpy is generally optimized enough so that performance doesn't
-    // matter here.
-    uint32_t textSizeBytes;
-    memcpy(&textSizeBytes, &m_textSize, sizeof(uint32_t));
-    h ^= textSizeBytes;
-
-    return h;
-}
-
 bool FontPlatformData::isFixedPitch() const
 {
     notImplemented();
diff --git a/Source/core/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h b/Source/core/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h
index 7f94d60..0d8ce95 100644
--- a/Source/core/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h
+++ b/Source/core/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h
@@ -32,7 +32,7 @@
 #define FontPlatformDataHarfBuzz_h
 
 #include "SkPaint.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/FontOrientation.h"
 #include "core/platform/graphics/chromium/FontRenderStyle.h"
 #include "core/platform/graphics/opentype/OpenTypeVerticalData.h"
diff --git a/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp b/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp
index 8e22570..2594792 100644
--- a/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp
+++ b/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp
@@ -33,10 +33,10 @@
 
 #include "RuntimeEnabledFeatures.h"
 #include "core/platform/graphics/Font.h"
-#include "core/platform/graphics/SurrogatePairAwareTextIterator.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/platform/graphics/harfbuzz/HarfBuzzFace.h"
 #include "hb-icu.h"
+#include "platform/graphics/TextRun.h"
+#include "platform/text/SurrogatePairAwareTextIterator.h"
 #include "wtf/MathExtras.h"
 #include "wtf/unicode/Unicode.h"
 #include "wtf/Vector.h"
@@ -323,9 +323,9 @@
     return position;
 }
 
-static void normalizeCharacters(const TextRun& run, UChar* destination, int length)
+static void normalizeCharacters(const TextRun& run, unsigned length, UChar* destination, unsigned* destinationLength)
 {
-    int position = 0;
+    unsigned position = 0;
     bool error = false;
     const UChar* source;
     String stringFor8BitRun;
@@ -335,18 +335,17 @@
     } else
         source = run.characters16();
 
+    *destinationLength = 0;
     while (position < length) {
         UChar32 character;
-        int nextPosition = position;
-        U16_NEXT(source, nextPosition, length, character);
+        U16_NEXT(source, position, length, character);
         // Don't normalize tabs as they are not treated as spaces for word-end.
         if (Font::treatAsSpace(character) && character != '\t')
             character = ' ';
         else if (Font::treatAsZeroWidthSpaceInComplexScript(character))
             character = zeroWidthSpace;
-        U16_APPEND(destination, position, length, character, error);
+        U16_APPEND(destination, *destinationLength, length, character, error);
         ASSERT_UNUSED(error, !error);
-        position = nextPosition;
     }
 }
 
@@ -363,8 +362,7 @@
     , m_toIndex(m_run.length())
 {
     m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]);
-    m_normalizedBufferLength = m_run.length();
-    normalizeCharacters(m_run, m_normalizedBuffer.get(), m_normalizedBufferLength);
+    normalizeCharacters(m_run, m_run.length(), m_normalizedBuffer.get(), &m_normalizedBufferLength);
     setPadding(m_run.expansion());
     setFontFeatures();
 }
@@ -373,15 +371,15 @@
 {
 }
 
-static void normalizeSpacesAndMirrorChars(const UChar* source, UChar* destination, int length, HarfBuzzShaper::NormalizeMode normalizeMode)
+static void normalizeSpacesAndMirrorChars(const UChar* source, unsigned length, UChar* destination, unsigned* destinationLength, HarfBuzzShaper::NormalizeMode normalizeMode)
 {
     int position = 0;
     bool error = false;
     // Iterate characters in source and mirror character if needed.
+    *destinationLength = 0;
     while (position < length) {
         UChar32 character;
-        int nextPosition = position;
-        U16_NEXT(source, nextPosition, length, character);
+        U16_NEXT(source, position, length, character);
         // Don't normalize tabs as they are not treated as spaces for word-end
         if (Font::treatAsSpace(character) && character != '\t')
             character = ' ';
@@ -389,9 +387,8 @@
             character = zeroWidthSpace;
         else if (normalizeMode == HarfBuzzShaper::NormalizeMirrorChars)
             character = u_charMirror(character);
-        U16_APPEND(destination, position, length, character, error);
+        U16_APPEND(destination, *destinationLength, length, character, error);
         ASSERT_UNUSED(error, !error);
-        position = nextPosition;
     }
 }
 
@@ -436,16 +433,17 @@
     }
 
     const UChar* sourceText;
+    unsigned sourceLength;
     if (normalizedString.isEmpty()) {
-        m_normalizedBufferLength = m_run.length();
+        sourceLength = m_run.length();
         sourceText = runCharacters;
     } else {
-        m_normalizedBufferLength = normalizedString.length();
+        sourceLength = normalizedString.length();
         sourceText = normalizedString.getBuffer();
     }
 
-    m_normalizedBuffer = adoptArrayPtr(new UChar[m_normalizedBufferLength + 1]);
-    normalizeSpacesAndMirrorChars(sourceText, m_normalizedBuffer.get(), m_normalizedBufferLength, normalizeMode);
+    m_normalizedBuffer = adoptArrayPtr(new UChar[sourceLength + 1]);
+    normalizeSpacesAndMirrorChars(sourceText, sourceLength, m_normalizedBuffer.get(), &m_normalizedBufferLength, normalizeMode);
 }
 
 bool HarfBuzzShaper::isWordEnd(unsigned index)
@@ -673,8 +671,7 @@
         hb_buffer_add_utf16(harfBuzzBuffer.get(), &preContext, 1, 1, 0);
 
         if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->startIndex()])) {
-            String upperText = String(m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters());
-            upperText.makeUpper();
+            String upperText = String(m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters()).upper();
             currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData;
             ASSERT(!upperText.is8Bit()); // m_normalizedBuffer is 16 bit, therefore upperText is 16 bit, even after we call makeUpper().
             hb_buffer_add_utf16(harfBuzzBuffer.get(), upperText.characters16(), currentRun->numCharacters(), 0, currentRun->numCharacters());
diff --git a/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.h b/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.h
index c906262..5c006bc 100644
--- a/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.h
+++ b/Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.h
@@ -31,12 +31,11 @@
 #ifndef HarfBuzzShaper_h
 #define HarfBuzzShaper_h
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/platform/graphics/GlyphBuffer.h"
-#include "core/platform/graphics/TextRun.h"
 #include "hb.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/graphics/TextRun.h"
 #include "wtf/HashSet.h"
-#include "wtf/OwnArrayPtr.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/unicode/CharacterNames.h"
@@ -133,7 +132,7 @@
     GlyphBufferAdvance createGlyphBufferAdvance(float, float);
 
     const Font* m_font;
-    OwnArrayPtr<UChar> m_normalizedBuffer;
+    OwnPtr<UChar[]> m_normalizedBuffer;
     unsigned m_normalizedBufferLength;
     const TextRun& m_run;
 
diff --git a/Source/core/platform/graphics/mac/ComplexTextController.cpp b/Source/core/platform/graphics/mac/ComplexTextController.cpp
index 8811f4b..4c01a72 100644
--- a/Source/core/platform/graphics/mac/ComplexTextController.cpp
+++ b/Source/core/platform/graphics/mac/ComplexTextController.cpp
@@ -26,12 +26,12 @@
 #include "core/platform/graphics/mac/ComplexTextController.h"
 
 #include <ApplicationServices/ApplicationServices.h>
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/Font.h"
-#include "core/platform/graphics/TextRun.h"
-#include "core/platform/text/TextBreakIterator.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/RenderText.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/graphics/TextRun.h"
+#include "platform/text/TextBreakIterator.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/unicode/CharacterNames.h"
 
@@ -206,10 +206,10 @@
                 int stringLength = complexTextRun.stringLength();
                 TextBreakIterator* cursorPositionIterator = cursorMovementIterator(complexTextRun.characters(), stringLength);
                 int clusterStart;
-                if (isTextBreak(cursorPositionIterator, hitIndex))
+                if (cursorPositionIterator->isBoundary(hitIndex))
                     clusterStart = hitIndex;
                 else {
-                    clusterStart = textBreakPreceding(cursorPositionIterator, hitIndex);
+                    clusterStart = cursorPositionIterator->preceding(hitIndex);
                     if (clusterStart == TextBreakDone)
                         clusterStart = 0;
                 }
@@ -217,7 +217,7 @@
                 if (!includePartialGlyphs)
                     return complexTextRun.stringLocation() + clusterStart;
 
-                int clusterEnd = textBreakFollowing(cursorPositionIterator, hitIndex);
+                int clusterEnd = cursorPositionIterator->following(hitIndex);
                 if (clusterEnd == TextBreakDone)
                     clusterEnd = stringLength;
 
diff --git a/Source/core/platform/graphics/mac/ComplexTextControllerCoreText.mm b/Source/core/platform/graphics/mac/ComplexTextControllerCoreText.mm
index c5be0bb..17257db 100644
--- a/Source/core/platform/graphics/mac/ComplexTextControllerCoreText.mm
+++ b/Source/core/platform/graphics/mac/ComplexTextControllerCoreText.mm
@@ -28,7 +28,7 @@
 
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/FontCache.h"
-#include "core/platform/graphics/TextRun.h"
+#include "platform/graphics/TextRun.h"
 
 #include <ApplicationServices/ApplicationServices.h>
 #import <AvailabilityMacros.h>
diff --git a/Source/core/platform/graphics/mac/FloatPointMac.mm b/Source/core/platform/graphics/mac/FloatPointMac.mm
index 35ae7b0..811c08a 100644
--- a/Source/core/platform/graphics/mac/FloatPointMac.mm
+++ b/Source/core/platform/graphics/mac/FloatPointMac.mm
@@ -25,7 +25,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/FloatPoint.h"
+#include "platform/geometry/FloatPoint.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/mac/FloatRectMac.mm b/Source/core/platform/graphics/mac/FloatRectMac.mm
index 869f107..0b070dd 100644
--- a/Source/core/platform/graphics/mac/FloatRectMac.mm
+++ b/Source/core/platform/graphics/mac/FloatRectMac.mm
@@ -25,7 +25,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/FloatRect.h"
+#include "platform/geometry/FloatRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/mac/FloatSizeMac.mm b/Source/core/platform/graphics/mac/FloatSizeMac.mm
index fe63813..ceee89a 100644
--- a/Source/core/platform/graphics/mac/FloatSizeMac.mm
+++ b/Source/core/platform/graphics/mac/FloatSizeMac.mm
@@ -25,7 +25,7 @@
  */
  
 #include "config.h"
-#include "core/platform/graphics/FloatSize.h"
+#include "platform/geometry/FloatSize.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/mac/FontCacheMac.mm b/Source/core/platform/graphics/mac/FontCacheMac.mm
index 78c410e..2af329c 100644
--- a/Source/core/platform/graphics/mac/FontCacheMac.mm
+++ b/Source/core/platform/graphics/mac/FontCacheMac.mm
@@ -217,11 +217,11 @@
     [WebFontCache getTraits:traitsMasks inFamily:familyName];
 }
 
-FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
+FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family, float fontSize)
 {
     NSFontTraitMask traits = fontDescription.italic() ? NSFontItalicTrait : 0;
     NSInteger weight = toAppKitFontWeight(fontDescription.weight());
-    float size = fontDescription.computedPixelSize();
+    float size = fontSize;
 
     NSFont *nsFont = [WebFontCache fontWithFamily:family traits:traits weight:weight size:size];
     if (!nsFont)
diff --git a/Source/core/platform/graphics/mac/FontComplexTextMac.cpp b/Source/core/platform/graphics/mac/FontComplexTextMac.cpp
index 00235e6..3e41e65 100644
--- a/Source/core/platform/graphics/mac/FontComplexTextMac.cpp
+++ b/Source/core/platform/graphics/mac/FontComplexTextMac.cpp
@@ -28,10 +28,10 @@
 #include "core/platform/graphics/FontFallbackList.h"
 #include "core/platform/graphics/GlyphBuffer.h"
 #include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/SimpleFontData.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/platform/graphics/mac/ComplexTextController.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/graphics/TextRun.h"
 #include "wtf/MathExtras.h"
 
 #include "core/platform/graphics/harfbuzz/HarfBuzzShaper.h"
diff --git a/Source/core/platform/graphics/mac/FontCustomPlatformDataMac.cpp b/Source/core/platform/graphics/mac/FontCustomPlatformDataMac.cpp
index add7003..850a643 100644
--- a/Source/core/platform/graphics/mac/FontCustomPlatformDataMac.cpp
+++ b/Source/core/platform/graphics/mac/FontCustomPlatformDataMac.cpp
@@ -21,7 +21,7 @@
 #include "config.h"
 #include "core/platform/graphics/FontCustomPlatformData.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/FontPlatformData.h"
 #include "core/platform/graphics/opentype/OpenTypeSanitizer.h"
 #include "core/platform/graphics/skia/SkiaSharedBufferStream.h"
@@ -43,7 +43,7 @@
 {
 }
 
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant)
+FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant widthVariant)
 {
     return FontPlatformData(m_cgFont.get(), size, bold, italic, orientation, widthVariant);
 }
diff --git a/Source/core/platform/graphics/mac/FontMac.cpp b/Source/core/platform/graphics/mac/FontMac.cpp
index eb349ca..38f747c 100644
--- a/Source/core/platform/graphics/mac/FontMac.cpp
+++ b/Source/core/platform/graphics/mac/FontMac.cpp
@@ -31,11 +31,11 @@
 #include "config.h"
 #include "core/platform/graphics/Font.h"
 
-#include "core/platform/LayoutTestSupport.h"
 #include "core/platform/graphics/FontSmoothingMode.h"
 #include "core/platform/graphics/GlyphBuffer.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/SimpleFontData.h"
+#include "platform/LayoutTestSupport.h"
 
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/core/SkPaint.h"
diff --git a/Source/core/platform/graphics/mac/IntPointMac.mm b/Source/core/platform/graphics/mac/IntPointMac.mm
index 9955770..353c228 100644
--- a/Source/core/platform/graphics/mac/IntPointMac.mm
+++ b/Source/core/platform/graphics/mac/IntPointMac.mm
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/IntPoint.h"
+#include "platform/geometry/IntPoint.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/mac/IntRectMac.mm b/Source/core/platform/graphics/mac/IntRectMac.mm
index b421470..66ecee9 100644
--- a/Source/core/platform/graphics/mac/IntRectMac.mm
+++ b/Source/core/platform/graphics/mac/IntRectMac.mm
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/mac/IntSizeMac.mm b/Source/core/platform/graphics/mac/IntSizeMac.mm
index 06f07f8..2a9d100 100644
--- a/Source/core/platform/graphics/mac/IntSizeMac.mm
+++ b/Source/core/platform/graphics/mac/IntSizeMac.mm
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/mac/SimpleFontDataMac.mm b/Source/core/platform/graphics/mac/SimpleFontDataMac.mm
index 01f4d39..df004cf 100644
--- a/Source/core/platform/graphics/mac/SimpleFontDataMac.mm
+++ b/Source/core/platform/graphics/mac/SimpleFontDataMac.mm
@@ -31,13 +31,13 @@
 #import <ApplicationServices/ApplicationServices.h>
 #import <float.h>
 #import <unicode/uchar.h>
-#import "core/platform/SharedBuffer.h"
+#import "platform/SharedBuffer.h"
 #import "core/platform/graphics/Color.h"
-#import "core/platform/graphics/FloatRect.h"
 #import "core/platform/graphics/Font.h"
 #import "core/platform/graphics/FontCache.h"
 #import "core/platform/graphics/FontDescription.h"
 #import "core/platform/mac/BlockExceptions.h"
+#import "platform/geometry/FloatRect.h"
 #import <wtf/Assertions.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/StdLibExtras.h>
diff --git a/Source/core/platform/graphics/opentype/OpenTypeSanitizer.cpp b/Source/core/platform/graphics/opentype/OpenTypeSanitizer.cpp
index 20d4442..deaccfa 100644
--- a/Source/core/platform/graphics/opentype/OpenTypeSanitizer.cpp
+++ b/Source/core/platform/graphics/opentype/OpenTypeSanitizer.cpp
@@ -32,10 +32,9 @@
 #include "core/platform/graphics/opentype/OpenTypeSanitizer.h"
 
 #include "RuntimeEnabledFeatures.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "opentype-sanitiser.h"
 #include "ots-memory-stream.h"
-#include "wtf/OwnArrayPtr.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/opentype/OpenTypeTypes.h b/Source/core/platform/graphics/opentype/OpenTypeTypes.h
index c4a945b..25a3a81 100644
--- a/Source/core/platform/graphics/opentype/OpenTypeTypes.h
+++ b/Source/core/platform/graphics/opentype/OpenTypeTypes.h
@@ -25,7 +25,7 @@
 #ifndef OpenTypeTypes_h
 #define OpenTypeTypes_h
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "wtf/ByteOrder.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/opentype/OpenTypeUtilities.cpp b/Source/core/platform/graphics/opentype/OpenTypeUtilities.cpp
index f16410d..b451403 100644
--- a/Source/core/platform/graphics/opentype/OpenTypeUtilities.cpp
+++ b/Source/core/platform/graphics/opentype/OpenTypeUtilities.cpp
@@ -27,7 +27,7 @@
 #include "config.h"
 #include "core/platform/graphics/opentype/OpenTypeUtilities.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/opentype/OpenTypeVerticalData.cpp b/Source/core/platform/graphics/opentype/OpenTypeVerticalData.cpp
index d60fbd7..107fa28 100644
--- a/Source/core/platform/graphics/opentype/OpenTypeVerticalData.cpp
+++ b/Source/core/platform/graphics/opentype/OpenTypeVerticalData.cpp
@@ -26,11 +26,11 @@
 #if ENABLE(OPENTYPE_VERTICAL)
 #include "core/platform/graphics/opentype/OpenTypeVerticalData.h"
 
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/graphics/FloatRect.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/GlyphPage.h"
 #include "core/platform/graphics/SimpleFontData.h"
 #include "core/platform/graphics/opentype/OpenTypeTypes.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/RefPtr.h"
 
 using namespace std;
diff --git a/Source/core/platform/graphics/skia/FontCacheSkia.cpp b/Source/core/platform/graphics/skia/FontCacheSkia.cpp
index 958b60d..0194efc 100644
--- a/Source/core/platform/graphics/skia/FontCacheSkia.cpp
+++ b/Source/core/platform/graphics/skia/FontCacheSkia.cpp
@@ -32,7 +32,7 @@
 
 #include "SkFontMgr.h"
 #include "SkTypeface.h"
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/FontDescription.h"
@@ -158,7 +158,7 @@
 }
 
 #if !OS(WIN)
-FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
+FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family, float fontSize)
 {
     CString name;
     SkTypeface* tf = createTypeface(fontDescription, family, name);
@@ -167,7 +167,7 @@
 
     FontPlatformData* result = new FontPlatformData(tf,
         name.data(),
-        fontDescription.computedSize(),
+        fontSize,
         fontDescription.weight() >= FontWeightBold && !tf->isBold(),
         fontDescription.italic() && !tf->isItalic(),
         fontDescription.orientation());
diff --git a/Source/core/platform/graphics/skia/FontCacheSkiaWin.cpp b/Source/core/platform/graphics/skia/FontCacheSkiaWin.cpp
index 35cb920..3536cb8 100644
--- a/Source/core/platform/graphics/skia/FontCacheSkiaWin.cpp
+++ b/Source/core/platform/graphics/skia/FontCacheSkiaWin.cpp
@@ -32,9 +32,10 @@
 #include "config.h"
 #include "core/platform/graphics/FontCache.h"
 
+#include "RuntimeEnabledFeatures.h"
 #include "SkFontMgr.h"
 #include "SkTypeface_win.h"
-#include "core/platform/NotImplemented.h"
+#include "platform/NotImplemented.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/SimpleFontData.h"
 #include "core/platform/graphics/chromium/FontPlatformDataChromiumWin.h"
@@ -45,7 +46,16 @@
 FontCache::FontCache()
     : m_purgePreventCount(0)
 {
-    m_fontManager = adoptPtr(SkFontMgr_New_GDI());
+    SkFontMgr* fontManager = 0;
+
+    // Prefer DirectWrite (if runtime feature is enabled) but fallback
+    // to GDI on platforms where DirectWrite is not supported.
+    if (RuntimeEnabledFeatures::directWriteEnabled())
+        fontManager = SkFontMgr_New_DirectWrite();
+    if (!fontManager)
+        fontManager = SkFontMgr_New_GDI();
+
+    m_fontManager = adoptPtr(fontManager);
 }
 
 
@@ -189,7 +199,7 @@
     return matchesRequestedFamily;
 }
 
-FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
+FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family, float fontSize)
 {
     CString name;
     SkTypeface* tf = createTypeface(fontDescription, family, name);
@@ -208,7 +218,7 @@
 
     FontPlatformData* result = new FontPlatformData(tf,
         name.data(),
-        fontDescription.computedSize(),
+        fontSize,
         fontDescription.weight() >= FontWeightBold && !tf->isBold(),
         fontDescription.italic() && !tf->isItalic(),
         fontDescription.orientation());
diff --git a/Source/core/platform/graphics/skia/FontCustomPlatformDataSkia.cpp b/Source/core/platform/graphics/skia/FontCustomPlatformDataSkia.cpp
index 0794a9c..964e141 100644
--- a/Source/core/platform/graphics/skia/FontCustomPlatformDataSkia.cpp
+++ b/Source/core/platform/graphics/skia/FontCustomPlatformDataSkia.cpp
@@ -33,9 +33,9 @@
 #include "config.h"
 #include "core/platform/graphics/FontCustomPlatformData.h"
 
-#include "core/platform/LayoutTestSupport.h"
-#include "core/platform/NotImplemented.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/LayoutTestSupport.h"
+#include "platform/NotImplemented.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/FontPlatformData.h"
 #include "core/platform/graphics/opentype/OpenTypeSanitizer.h"
 #include "core/platform/graphics/skia/SkiaSharedBufferStream.h"
@@ -54,7 +54,7 @@
 {
 }
 
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant)
+FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant)
 {
     ASSERT(m_typeface);
     return FontPlatformData(m_typeface.get(), "", size, bold && !m_typeface->isBold(), italic && !m_typeface->isItalic(), orientation);
diff --git a/Source/core/platform/graphics/skia/FontPlatformDataSkia.cpp b/Source/core/platform/graphics/skia/FontPlatformDataSkia.cpp
index 33c5662..f5dfd8f 100644
--- a/Source/core/platform/graphics/skia/FontPlatformDataSkia.cpp
+++ b/Source/core/platform/graphics/skia/FontPlatformDataSkia.cpp
@@ -37,6 +37,24 @@
 
 namespace WebCore {
 
+#if (!ENABLE(GDI_FONTS_ON_WINDOWS) || !OS(WIN)) && !OS(MACOSX)
+unsigned FontPlatformData::hash() const
+{
+    unsigned h = SkTypeface::UniqueID(m_typeface.get());
+    h ^= 0x01010101 * ((static_cast<int>(m_orientation) << 2) | (static_cast<int>(m_fakeBold) << 1) | static_cast<int>(m_fakeItalic));
+
+    // This memcpy is to avoid a reinterpret_cast that breaks strict-aliasing
+    // rules. Memcpy is generally optimized enough so that performance doesn't
+    // matter here.
+    uint32_t textSizeBytes;
+    memcpy(&textSizeBytes, &m_textSize, sizeof(uint32_t));
+    h ^= textSizeBytes;
+
+    return h;
+}
+
+#endif
+
 #if ENABLE(OPENTYPE_VERTICAL)
 PassRefPtr<OpenTypeVerticalData> FontPlatformData::verticalData() const
 {
diff --git a/Source/core/platform/graphics/skia/NativeImageSkia.cpp b/Source/core/platform/graphics/skia/NativeImageSkia.cpp
index 279fbed..94268c2 100644
--- a/Source/core/platform/graphics/skia/NativeImageSkia.cpp
+++ b/Source/core/platform/graphics/skia/NativeImageSkia.cpp
@@ -32,23 +32,22 @@
 #include "core/platform/graphics/skia/NativeImageSkia.h"
 
 #include "core/platform/PlatformInstrumentation.h"
-#include "core/platform/chromium/TraceEvent.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/Image.h"
 #include "core/platform/graphics/chromium/DeferredImageDecoder.h"
 #include "core/platform/graphics/skia/SkiaUtils.h"
+#include "platform/TraceEvent.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/FloatSize.h"
 #include "skia/ext/image_operations.h"
 #include "third_party/skia/include/core/SkMatrix.h"
 #include "third_party/skia/include/core/SkPaint.h"
 #include "third_party/skia/include/core/SkScalar.h"
 #include "third_party/skia/include/core/SkShader.h"
-#include "third_party/skia/include/effects/SkLumaXfermode.h"
 
-#include <limits>
 #include <math.h>
+#include <limits>
 
 namespace WebCore {
 
@@ -325,11 +324,8 @@
 {
     TRACE_EVENT0("skia", "NativeImageSkia::draw");
     SkPaint paint;
-    if (context->drawLuminanceMask()) {
-        paint.setXfermode(SkLumaMaskXfermode::Create(SkXfermode::kSrcOver_Mode));
-    } else {
-        paint.setXfermode(compOp.get());
-    }
+    paint.setXfermode(compOp.get());
+    paint.setColorFilter(context->colorFilter());
     paint.setAlpha(context->getNormalizedAlpha());
     paint.setLooper(context->drawLooper());
     // only antialias if we're rotated or skewed
@@ -385,6 +381,20 @@
     context->didDrawRect(destRect, paint, &bitmap());
 }
 
+static SkBitmap createBitmapWithSpace(const SkBitmap& bitmap, int spaceWidth, int spaceHeight)
+{
+    SkBitmap result;
+    result.setConfig(bitmap.getConfig(),
+        bitmap.width() + spaceWidth,
+        bitmap.height() + spaceHeight);
+    result.allocPixels();
+
+    result.eraseColor(SK_ColorTRANSPARENT);
+    bitmap.copyPixelsTo(reinterpret_cast<uint8_t*>(result.getPixels()), result.rowBytes() * result.height(), result.rowBytes());
+
+    return result;
+}
+
 void NativeImageSkia::drawPattern(
     GraphicsContext* context,
     const FloatRect& floatSrcRect,
@@ -392,7 +402,8 @@
     const FloatPoint& phase,
     CompositeOperator compositeOp,
     const FloatRect& destRect,
-    BlendMode blendMode) const
+    BlendMode blendMode,
+    const IntSize& repeatSpacing) const
 {
     FloatRect normSrcRect = floatSrcRect;
     normSrcRect.intersect(FloatRect(0, 0, bitmap().width(), bitmap().height()));
@@ -440,7 +451,13 @@
         // fragment is slightly larger to align to integer
         // boundaries.
         SkBitmap resampled = extractScaledImageFragment(normSrcRect, scaleX, scaleY, &scaledSrcRect);
-        shader = adoptRef(SkShader::CreateBitmapShader(resampled, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode));
+        if (repeatSpacing.isZero()) {
+            shader = adoptRef(SkShader::CreateBitmapShader(resampled, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode));
+        } else {
+            shader = adoptRef(SkShader::CreateBitmapShader(
+                createBitmapWithSpace(resampled, repeatSpacing.width() * ctmScaleX, repeatSpacing.height() * ctmScaleY),
+                SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode));
+        }
 
         // Since we just resized the bitmap, we need to remove the scale
         // applied to the pixels in the bitmap shader. This means we need
@@ -453,7 +470,14 @@
         // No need to resample before drawing.
         SkBitmap srcSubset;
         bitmap().extractSubset(&srcSubset, enclosingIntRect(normSrcRect));
-        shader = adoptRef(SkShader::CreateBitmapShader(srcSubset, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode));
+        if (repeatSpacing.isZero()) {
+            shader = adoptRef(SkShader::CreateBitmapShader(srcSubset, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode));
+        } else {
+            shader = adoptRef(SkShader::CreateBitmapShader(
+                createBitmapWithSpace(srcSubset, repeatSpacing.width() * ctmScaleX, repeatSpacing.height() * ctmScaleY),
+                SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode));
+        }
+
         // Because no resizing occurred, the shader transform should be
         // set to the pattern's transform, which just includes scale.
         shaderTransform.setScale(scale.width(), scale.height());
@@ -470,11 +494,8 @@
 
     SkPaint paint;
     paint.setShader(shader.get());
-    if (context->drawLuminanceMask()) {
-        paint.setXfermode(SkLumaMaskXfermode::Create(SkXfermode::kSrcOver_Mode));
-    } else {
-        paint.setXfermode(WebCoreCompositeToSkiaComposite(compositeOp, blendMode).get());
-    }
+    paint.setXfermode(WebCoreCompositeToSkiaComposite(compositeOp, blendMode).get());
+    paint.setColorFilter(context->colorFilter());
 
     paint.setFilterBitmap(resampling == LinearResampling);
     if (useBicubicFilter)
diff --git a/Source/core/platform/graphics/skia/NativeImageSkia.h b/Source/core/platform/graphics/skia/NativeImageSkia.h
index 683e91e..f16cdfe 100644
--- a/Source/core/platform/graphics/skia/NativeImageSkia.h
+++ b/Source/core/platform/graphics/skia/NativeImageSkia.h
@@ -36,6 +36,7 @@
 #include "SkSize.h"
 #include "SkXfermode.h"
 #include "core/platform/graphics/GraphicsTypes.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/Forward.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
@@ -134,7 +135,8 @@
         const FloatPoint& phase,
         CompositeOperator,
         const FloatRect& destRect,
-        BlendMode) const;
+        BlendMode,
+        const IntSize& repeatSpacing) const;
 
 private:
     NativeImageSkia();
diff --git a/Source/core/platform/graphics/skia/OpaqueRegionSkia.h b/Source/core/platform/graphics/skia/OpaqueRegionSkia.h
index 34a2277..35c63e5 100644
--- a/Source/core/platform/graphics/skia/OpaqueRegionSkia.h
+++ b/Source/core/platform/graphics/skia/OpaqueRegionSkia.h
@@ -31,7 +31,7 @@
 #ifndef OpaqueRegionSkia_h
 #define OpaqueRegionSkia_h
 
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
 
 #include "SkBitmap.h"
 #include "SkCanvas.h"
diff --git a/Source/core/platform/graphics/skia/SimpleFontDataSkia.cpp b/Source/core/platform/graphics/skia/SimpleFontDataSkia.cpp
index 6a89201..fee552b 100644
--- a/Source/core/platform/graphics/skia/SimpleFontDataSkia.cpp
+++ b/Source/core/platform/graphics/skia/SimpleFontDataSkia.cpp
@@ -33,15 +33,16 @@
 
 #include <unicode/normlzr.h>
 #include "SkPaint.h"
+#include "SkPath.h"
 #include "SkTypeface.h"
 #include "SkTypes.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/FontDescription.h"
 #include "core/platform/graphics/chromium/VDMXParser.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/unicode/Unicode.h"
 
 #if OS(WIN)
-#include "core/platform/win/HWndDC.h"
+#include "platform/win/HWndDC.h"
 #endif
 
 namespace WebCore {
@@ -213,6 +214,27 @@
     m_treatAsFixedPitch = platformData().isFixedPitch();
 }
 
+static inline void getSkiaBoundsForGlyph(SkPaint& paint, Glyph glyph, SkRect& bounds)
+{
+    paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+
+    SkPath path;
+    paint.getTextPath(&glyph, sizeof(glyph), 0, 0, &path);
+    bounds = path.getBounds();
+
+    // FIXME(eae): getBounds currently returns an empty rect for bitmap
+    // fonts so fall back on the old behavior. Once fixed in Skia this
+    // fallback can go away.
+    if (bounds.isEmpty())
+        paint.measureText(&glyph, 2, &bounds);
+
+    if (!paint.isSubpixelText()) {
+        SkIRect ir;
+        bounds.round(&ir);
+        bounds.set(ir);
+    }
+}
+
 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
 {
     if (!m_platformData.size())
@@ -221,17 +243,10 @@
     SkASSERT(sizeof(glyph) == 2); // compile-time assert
 
     SkPaint paint;
-
     m_platformData.setupPaint(&paint);
 
-    paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
     SkRect bounds;
-    paint.measureText(&glyph, 2, &bounds);
-    if (!paint.isSubpixelText()) {
-        SkIRect ir;
-        bounds.round(&ir);
-        bounds.set(ir);
-    }
+    getSkiaBoundsForGlyph(paint, glyph, bounds);
     return FloatRect(bounds);
 }
 
diff --git a/Source/core/platform/graphics/skia/SkiaFontWin.cpp b/Source/core/platform/graphics/skia/SkiaFontWin.cpp
index 6622321..893b3fa 100644
--- a/Source/core/platform/graphics/skia/SkiaFontWin.cpp
+++ b/Source/core/platform/graphics/skia/SkiaFontWin.cpp
@@ -36,7 +36,7 @@
 #include "core/platform/graphics/Pattern.h"
 #include "core/platform/graphics/SimpleFontData.h"
 #include "core/platform/graphics/chromium/FontPlatformDataChromiumWin.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/transforms/AffineTransform.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/core/SkDevice.h"
 #include "third_party/skia/include/core/SkPaint.h"
@@ -85,53 +85,28 @@
     }
 }
 
-static void setupPaintForFont(SkPaint* paint, GraphicsContext* context,
-                              SkTypeface* face, float size, uint32_t textFlags)
-{
-    paint->setTextSize(SkFloatToScalar(size));
-    paint->setTypeface(face);
-
-    if (!context->couldUseLCDRenderedText()) {
-        textFlags &= ~SkPaint::kLCDRenderText_Flag;
-        // If we *just* clear our request for LCD, then GDI seems to
-        // sometimes give us AA text, and sometimes give us BW text. Since the
-        // original intent was LCD, we want to force AA (rather than BW), so we
-        // add a special bit to tell Skia to do its best to avoid the BW: by
-        // drawing LCD offscreen and downsampling that to AA.
-        textFlags |= SkPaint::kGenA8FromLCD_Flag;
-    }
-
-    static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag |
-                                          SkPaint::kLCDRenderText_Flag |
-                                          SkPaint::kGenA8FromLCD_Flag;
-
-    // now copy in just the text flags
-    SkASSERT(!(textFlags & ~textFlagsMask));
-    uint32_t flags = paint->getFlags();
-    flags &= ~textFlagsMask;
-    flags |= textFlags;
-    paint->setFlags(flags);
-}
-
-static void paintSkiaText(GraphicsContext* context, HFONT hfont,
-                          SkTypeface* face, float size, uint32_t textFlags,
-                          int numGlyphs,
-                          const WORD* glyphs,
-                          const int* advances,
-                          const GOFFSET* offsets,
-                          const SkPoint& origin,
-                          const SkRect& textRect)
+static void paintSkiaText(GraphicsContext* context,
+    const FontPlatformData& data,
+    SkTypeface* face, float size, uint32_t textFlags,
+    int numGlyphs,
+    const WORD* glyphs,
+    const int* advances,
+    const GOFFSET* offsets,
+    const SkPoint& origin,
+    const SkRect& textRect)
 {
     TextDrawingModeFlags textMode = context->textDrawingMode();
-    // Ensure font load for printing, because PDF device needs it.
-    if (context->isPrintingDevice())
-        FontPlatformData::ensureFontLoaded(hfont);
 
     // Filling (if necessary). This is the common case.
     SkPaint paint;
     context->setupPaintForFilling(&paint);
     paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
-    setupPaintForFont(&paint, context, face, size, textFlags);
+    data.setupPaint(&paint, context);
+
+    // FIXME: Only needed to support the HFONT based paintSkiaText
+    // version where a new typeface is created from the HFONT.
+    // As such it can go away once the HFONT code path is removed.
+    paint.setTypeface(face);
 
     bool didFill = false;
 
@@ -148,7 +123,8 @@
         paint.reset();
         context->setupPaintForStroking(&paint);
         paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
-        setupPaintForFont(&paint, context, face, size, textFlags);
+        data.setupPaint(&paint, context);
+        paint.setTypeface(face);
 
         if (didFill) {
             // If there is a shadow and we filled above, there will already be
@@ -178,23 +154,29 @@
                    const SkPoint& origin,
                    const SkRect& textRect)
 {
-    paintSkiaText(context, data.hfont(), data.typeface(), data.size(), data.paintTextFlags(),
+    paintSkiaText(context, data, data.typeface(), data.size(), data.paintTextFlags(),
                   numGlyphs, glyphs, advances, offsets, origin, textRect);
 }
 
 void paintSkiaText(GraphicsContext* context,
-                   HFONT hfont,
-                   int numGlyphs,
-                   const WORD* glyphs,
-                   const int* advances,
-                   const GOFFSET* offsets,
-                   const SkPoint& origin,
-                   const SkRect& textRect)
+    const FontPlatformData& data,
+    HFONT hfont,
+    int numGlyphs,
+    const WORD* glyphs,
+    const int* advances,
+    const GOFFSET* offsets,
+    const SkPoint& origin,
+    const SkRect& textRect)
 {
     int size;
     int paintTextFlags;
+
+    // Ensure font load for printing, because PDF device needs it.
+    if (context->isPrintingDevice())
+        FontPlatformData::ensureFontLoaded(hfont);
+
     RefPtr<SkTypeface> face = CreateTypefaceFromHFont(hfont, &size, &paintTextFlags);
-    paintSkiaText(context, hfont, face.get(), size, paintTextFlags, numGlyphs, glyphs, advances, offsets, origin, textRect);
+    paintSkiaText(context, data, face.get(), size, paintTextFlags, numGlyphs, glyphs, advances, offsets, origin, textRect);
 }
 
 }  // namespace WebCore
diff --git a/Source/core/platform/graphics/skia/SkiaFontWin.h b/Source/core/platform/graphics/skia/SkiaFontWin.h
index 5e41a0d..b5253ba 100644
--- a/Source/core/platform/graphics/skia/SkiaFontWin.h
+++ b/Source/core/platform/graphics/skia/SkiaFontWin.h
@@ -58,13 +58,14 @@
 // Note: this is less efficient than calling the version with FontPlatformData,
 // as that caches the SkTypeface object.
 void paintSkiaText(GraphicsContext*,
-                   HFONT,
-                   int numGlyphs,
-                   const WORD* glyphs,
-                   const int* advances,
-                   const GOFFSET* offsets,
-                   const SkPoint& origin,
-                   const SkRect& textRect);
+    const FontPlatformData&,
+    HFONT,
+    int numGlyphs,
+    const WORD* glyphs,
+    const int* advances,
+    const GOFFSET* offsets,
+    const SkPoint& origin,
+    const SkRect& textRect);
 
 }  // namespace WebCore
 
diff --git a/Source/core/platform/graphics/skia/SkiaSharedBufferStream.cpp b/Source/core/platform/graphics/skia/SkiaSharedBufferStream.cpp
index 6c28b85..c5a9cec 100644
--- a/Source/core/platform/graphics/skia/SkiaSharedBufferStream.cpp
+++ b/Source/core/platform/graphics/skia/SkiaSharedBufferStream.cpp
@@ -32,7 +32,7 @@
 #include "core/platform/graphics/skia/SkiaSharedBufferStream.h"
 
 #include "third_party/skia/include/core/SkStream.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include <algorithm>
 #include <cstring>
 
diff --git a/Source/core/platform/graphics/skia/SkiaSharedBufferStream.h b/Source/core/platform/graphics/skia/SkiaSharedBufferStream.h
index 4ffe203..81bc469 100644
--- a/Source/core/platform/graphics/skia/SkiaSharedBufferStream.h
+++ b/Source/core/platform/graphics/skia/SkiaSharedBufferStream.h
@@ -31,7 +31,7 @@
 #ifndef SkiaSharedBufferStream_h
 #define SkiaSharedBufferStream_h
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "third_party/skia/include/core/SkStream.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/platform/graphics/skia/SkiaUtils.cpp b/Source/core/platform/graphics/skia/SkiaUtils.cpp
index b094167..9eb8128 100644
--- a/Source/core/platform/graphics/skia/SkiaUtils.cpp
+++ b/Source/core/platform/graphics/skia/SkiaUtils.cpp
@@ -33,7 +33,6 @@
 #include "core/platform/graphics/skia/SkiaUtils.h"
 
 #include "SkColorPriv.h"
-#include "SkMatrix.h"
 #include "SkRegion.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/ImageBuffer.h"
@@ -181,4 +180,24 @@
     return rgn.setPath(scaledPath, clip);
 }
 
+SkMatrix affineTransformToSkMatrix(const AffineTransform& source)
+{
+    SkMatrix result;
+
+    result.setScaleX(WebCoreDoubleToSkScalar(source.a()));
+    result.setSkewX(WebCoreDoubleToSkScalar(source.c()));
+    result.setTranslateX(WebCoreDoubleToSkScalar(source.e()));
+
+    result.setScaleY(WebCoreDoubleToSkScalar(source.d()));
+    result.setSkewY(WebCoreDoubleToSkScalar(source.b()));
+    result.setTranslateY(WebCoreDoubleToSkScalar(source.f()));
+
+    // FIXME: Set perspective properly.
+    result.setPerspX(0);
+    result.setPerspY(0);
+    result.set(SkMatrix::kMPersp2, SK_Scalar1);
+
+    return result;
+}
+
 }  // namespace WebCore
diff --git a/Source/core/platform/graphics/skia/SkiaUtils.h b/Source/core/platform/graphics/skia/SkiaUtils.h
index be27592..664c5be 100644
--- a/Source/core/platform/graphics/skia/SkiaUtils.h
+++ b/Source/core/platform/graphics/skia/SkiaUtils.h
@@ -33,16 +33,23 @@
 #ifndef SkiaUtils_h
 #define SkiaUtils_h
 
+#include "SkMatrix.h"
 #include "SkPath.h"
 #include "SkXfermode.h"
-#include "core/platform/graphics/GraphicsContext.h"
+#include "core/platform/graphics/Color.h"
+#include "core/platform/graphics/GraphicsTypes.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/MathExtras.h"
+#include "wtf/PassRefPtr.h"
 
 class SkCanvas;
 class SkRegion;
 
 namespace WebCore {
 
+class GraphicsContext;
+
 PassRefPtr<SkXfermode> WebCoreCompositeToSkiaComposite(CompositeOperator, BlendMode = BlendModeNormal);
 
 // move this guy into SkColor.h
@@ -78,6 +85,8 @@
 // Determine if a given WebKit point is contained in a path
 bool SkPathContainsPoint(const SkPath&, const FloatPoint&, SkPath::FillType);
 
+SkMatrix affineTransformToSkMatrix(const AffineTransform&);
+
 }  // namespace WebCore
 
 #endif  // SkiaUtils_h
diff --git a/Source/core/platform/graphics/transforms/AffineTransform.cpp b/Source/core/platform/graphics/transforms/AffineTransform.cpp
deleted file mode 100644
index 277018f..0000000
--- a/Source/core/platform/graphics/transforms/AffineTransform.cpp
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
- *               2010 Dirk Schulze <krit@webkit.org>
- * 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:
- * 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,
- * 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/graphics/transforms/AffineTransform.h"
-
-#include "core/platform/FloatConversion.h"
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/skia/SkiaUtils.h"
-
-#include "wtf/MathExtras.h"
-
-namespace WebCore {
-
-AffineTransform::AffineTransform()
-{
-    setMatrix(1, 0, 0, 1, 0, 0);
-}
-
-AffineTransform::AffineTransform(double a, double b, double c, double d, double e, double f)
-{
-    setMatrix(a, b, c, d, e, f);
-}
-
-void AffineTransform::makeIdentity()
-{
-    setMatrix(1, 0, 0, 1, 0, 0);
-}
-
-void AffineTransform::setMatrix(double a, double b, double c, double d, double e, double f)
-{
-    m_transform[0] = a;
-    m_transform[1] = b;
-    m_transform[2] = c;
-    m_transform[3] = d;
-    m_transform[4] = e;
-    m_transform[5] = f;
-}
-
-bool AffineTransform::isIdentity() const
-{
-    return (m_transform[0] == 1 && m_transform[1] == 0
-         && m_transform[2] == 0 && m_transform[3] == 1
-         && m_transform[4] == 0 && m_transform[5] == 0);
-}
-
-double AffineTransform::xScale() const
-{
-    return sqrt(m_transform[0] * m_transform[0] + m_transform[1] * m_transform[1]);
-}
-
-double AffineTransform::yScale() const
-{
-    return sqrt(m_transform[2] * m_transform[2] + m_transform[3] * m_transform[3]);
-}
-
-double AffineTransform::det() const
-{
-    return m_transform[0] * m_transform[3] - m_transform[1] * m_transform[2];
-}
-
-bool AffineTransform::isInvertible() const
-{
-    return det() != 0.0;
-}
-
-AffineTransform AffineTransform::inverse() const
-{
-    double determinant = det();
-    if (determinant == 0.0)
-        return AffineTransform();
-
-    AffineTransform result;
-    if (isIdentityOrTranslation()) {
-        result.m_transform[4] = -m_transform[4];
-        result.m_transform[5] = -m_transform[5];
-        return result;
-    }
-
-    result.m_transform[0] = m_transform[3] / determinant;
-    result.m_transform[1] = -m_transform[1] / determinant;
-    result.m_transform[2] = -m_transform[2] / determinant;
-    result.m_transform[3] = m_transform[0] / determinant;
-    result.m_transform[4] = (m_transform[2] * m_transform[5]
-                           - m_transform[3] * m_transform[4]) / determinant;
-    result.m_transform[5] = (m_transform[1] * m_transform[4]
-                           - m_transform[0] * m_transform[5]) / determinant;
-
-    return result;
-}
-
-
-// Multiplies this AffineTransform by the provided AffineTransform - i.e.
-// this = this * other;
-AffineTransform& AffineTransform::multiply(const AffineTransform& other)
-{
-    AffineTransform trans;
-
-    trans.m_transform[0] = other.m_transform[0] * m_transform[0] + other.m_transform[1] * m_transform[2];
-    trans.m_transform[1] = other.m_transform[0] * m_transform[1] + other.m_transform[1] * m_transform[3];
-    trans.m_transform[2] = other.m_transform[2] * m_transform[0] + other.m_transform[3] * m_transform[2];
-    trans.m_transform[3] = other.m_transform[2] * m_transform[1] + other.m_transform[3] * m_transform[3];
-    trans.m_transform[4] = other.m_transform[4] * m_transform[0] + other.m_transform[5] * m_transform[2] + m_transform[4];
-    trans.m_transform[5] = other.m_transform[4] * m_transform[1] + other.m_transform[5] * m_transform[3] + m_transform[5];
-
-    setMatrix(trans.m_transform);
-    return *this;
-}
-
-AffineTransform& AffineTransform::rotate(double a)
-{
-    // angle is in degree. Switch to radian
-    a = deg2rad(a);
-    double cosAngle = cos(a);
-    double sinAngle = sin(a);
-    AffineTransform rot(cosAngle, sinAngle, -sinAngle, cosAngle, 0, 0);
-
-    multiply(rot);
-    return *this;
-}
-
-AffineTransform& AffineTransform::scale(double s)
-{
-    return scale(s, s);
-}
-
-AffineTransform& AffineTransform::scale(double sx, double sy)
-{
-    m_transform[0] *= sx;
-    m_transform[1] *= sx;
-    m_transform[2] *= sy;
-    m_transform[3] *= sy;
-    return *this;
-}
-
-// *this = *this * translation
-AffineTransform& AffineTransform::translate(double tx, double ty)
-{
-    if (isIdentityOrTranslation()) {
-        m_transform[4] += tx;
-        m_transform[5] += ty;
-        return *this;
-    }
-
-    m_transform[4] += tx * m_transform[0] + ty * m_transform[2];
-    m_transform[5] += tx * m_transform[1] + ty * m_transform[3];
-    return *this;
-}
-
-AffineTransform& AffineTransform::scaleNonUniform(double sx, double sy)
-{
-    return scale(sx, sy);
-}
-
-AffineTransform& AffineTransform::rotateFromVector(double x, double y)
-{
-    return rotate(rad2deg(atan2(y, x)));
-}
-
-AffineTransform& AffineTransform::flipX()
-{
-    return scale(-1, 1);
-}
-
-AffineTransform& AffineTransform::flipY()
-{
-    return scale(1, -1);
-}
-
-AffineTransform& AffineTransform::shear(double sx, double sy)
-{
-    double a = m_transform[0];
-    double b = m_transform[1];
-
-    m_transform[0] += sy * m_transform[2];
-    m_transform[1] += sy * m_transform[3];
-    m_transform[2] += sx * a;
-    m_transform[3] += sx * b;
-
-    return *this;
-}
-
-AffineTransform& AffineTransform::skew(double angleX, double angleY)
-{
-    return shear(tan(deg2rad(angleX)), tan(deg2rad(angleY)));
-}
-
-AffineTransform& AffineTransform::skewX(double angle)
-{
-    return shear(tan(deg2rad(angle)), 0);
-}
-
-AffineTransform& AffineTransform::skewY(double angle)
-{
-    return shear(0, tan(deg2rad(angle)));
-}
-
-AffineTransform makeMapBetweenRects(const FloatRect& source, const FloatRect& dest)
-{
-    AffineTransform transform;
-    transform.translate(dest.x() - source.x(), dest.y() - source.y());
-    transform.scale(dest.width() / source.width(), dest.height() / source.height());
-    return transform;
-}
-
-void AffineTransform::map(double x, double y, double& x2, double& y2) const
-{
-    x2 = (m_transform[0] * x + m_transform[2] * y + m_transform[4]);
-    y2 = (m_transform[1] * x + m_transform[3] * y + m_transform[5]);
-}
-
-IntPoint AffineTransform::mapPoint(const IntPoint& point) const
-{
-    double x2, y2;
-    map(point.x(), point.y(), x2, y2);
-
-    // Round the point.
-    return IntPoint(lround(x2), lround(y2));
-}
-
-FloatPoint AffineTransform::mapPoint(const FloatPoint& point) const
-{
-    double x2, y2;
-    map(point.x(), point.y(), x2, y2);
-
-    return FloatPoint(narrowPrecisionToFloat(x2), narrowPrecisionToFloat(y2));
-}
-
-IntSize AffineTransform::mapSize(const IntSize& size) const
-{
-    double width2 = size.width() * xScale();
-    double height2 = size.height() * yScale();
-
-    return IntSize(lround(width2), lround(height2));
-}
-
-FloatSize AffineTransform::mapSize(const FloatSize& size) const
-{
-    double width2 = size.width() * xScale();
-    double height2 = size.height() * yScale();
-
-    return FloatSize(narrowPrecisionToFloat(width2), narrowPrecisionToFloat(height2));
-}
-
-IntRect AffineTransform::mapRect(const IntRect &rect) const
-{
-    return enclosingIntRect(mapRect(FloatRect(rect)));
-}
-
-FloatRect AffineTransform::mapRect(const FloatRect& rect) const
-{
-    if (isIdentityOrTranslation()) {
-        FloatRect mappedRect(rect);
-        mappedRect.move(narrowPrecisionToFloat(m_transform[4]), narrowPrecisionToFloat(m_transform[5]));
-        return mappedRect;
-    }
-
-    FloatQuad result;
-    result.setP1(mapPoint(rect.location()));
-    result.setP2(mapPoint(FloatPoint(rect.maxX(), rect.y())));
-    result.setP3(mapPoint(FloatPoint(rect.maxX(), rect.maxY())));
-    result.setP4(mapPoint(FloatPoint(rect.x(), rect.maxY())));
-    return result.boundingBox();
-}
-
-FloatQuad AffineTransform::mapQuad(const FloatQuad& q) const
-{
-    if (isIdentityOrTranslation()) {
-        FloatQuad mappedQuad(q);
-        mappedQuad.move(narrowPrecisionToFloat(m_transform[4]), narrowPrecisionToFloat(m_transform[5]));
-        return mappedQuad;
-    }
-
-    FloatQuad result;
-    result.setP1(mapPoint(q.p1()));
-    result.setP2(mapPoint(q.p2()));
-    result.setP3(mapPoint(q.p3()));
-    result.setP4(mapPoint(q.p4()));
-    return result;
-}
-
-void AffineTransform::blend(const AffineTransform& from, double progress)
-{
-    DecomposedType srA, srB;
-
-    from.decompose(srA);
-    this->decompose(srB);
-
-    // If x-axis of one is flipped, and y-axis of the other, convert to an unflipped rotation.
-    if ((srA.scaleX < 0 && srB.scaleY < 0) || (srA.scaleY < 0 &&  srB.scaleX < 0)) {
-        srA.scaleX = -srA.scaleX;
-        srA.scaleY = -srA.scaleY;
-        srA.angle += srA.angle < 0 ? piDouble : -piDouble;
-    }
-
-    // Don't rotate the long way around.
-    srA.angle = fmod(srA.angle, 2 * piDouble);
-    srB.angle = fmod(srB.angle, 2 * piDouble);
-
-    if (fabs(srA.angle - srB.angle) > piDouble) {
-        if (srA.angle > srB.angle)
-            srA.angle -= piDouble * 2;
-        else
-            srB.angle -= piDouble * 2;
-    }
-
-    srA.scaleX += progress * (srB.scaleX - srA.scaleX);
-    srA.scaleY += progress * (srB.scaleY - srA.scaleY);
-    srA.angle += progress * (srB.angle - srA.angle);
-    srA.remainderA += progress * (srB.remainderA - srA.remainderA);
-    srA.remainderB += progress * (srB.remainderB - srA.remainderB);
-    srA.remainderC += progress * (srB.remainderC - srA.remainderC);
-    srA.remainderD += progress * (srB.remainderD - srA.remainderD);
-    srA.translateX += progress * (srB.translateX - srA.translateX);
-    srA.translateY += progress * (srB.translateY - srA.translateY);
-
-    this->recompose(srA);
-}
-
-TransformationMatrix AffineTransform::toTransformationMatrix() const
-{
-    return TransformationMatrix(m_transform[0], m_transform[1], m_transform[2],
-                                m_transform[3], m_transform[4], m_transform[5]);
-}
-
-AffineTransform::operator SkMatrix() const
-{
-    SkMatrix result;
-
-    result.setScaleX(WebCoreDoubleToSkScalar(a()));
-    result.setSkewX(WebCoreDoubleToSkScalar(c()));
-    result.setTranslateX(WebCoreDoubleToSkScalar(e()));
-
-    result.setScaleY(WebCoreDoubleToSkScalar(d()));
-    result.setSkewY(WebCoreDoubleToSkScalar(b()));
-    result.setTranslateY(WebCoreDoubleToSkScalar(f()));
-
-    // FIXME: Set perspective properly.
-    result.setPerspX(0);
-    result.setPerspY(0);
-    result.set(SkMatrix::kMPersp2, SK_Scalar1);
-
-    return result;
-}
-
-bool AffineTransform::decompose(DecomposedType& decomp) const
-{
-    AffineTransform m(*this);
-
-    // Compute scaling factors
-    double sx = xScale();
-    double sy = yScale();
-
-    // Compute cross product of transformed unit vectors. If negative,
-    // one axis was flipped.
-    if (m.a() * m.d() - m.c() * m.b() < 0) {
-        // Flip axis with minimum unit vector dot product
-        if (m.a() < m.d())
-            sx = -sx;
-        else
-            sy = -sy;
-    }
-
-    // Remove scale from matrix
-    m.scale(1 / sx, 1 / sy);
-
-    // Compute rotation
-    double angle = atan2(m.b(), m.a());
-
-    // Remove rotation from matrix
-    m.rotate(rad2deg(-angle));
-
-    // Return results
-    decomp.scaleX = sx;
-    decomp.scaleY = sy;
-    decomp.angle = angle;
-    decomp.remainderA = m.a();
-    decomp.remainderB = m.b();
-    decomp.remainderC = m.c();
-    decomp.remainderD = m.d();
-    decomp.translateX = m.e();
-    decomp.translateY = m.f();
-
-    return true;
-}
-
-void AffineTransform::recompose(const DecomposedType& decomp)
-{
-    this->setA(decomp.remainderA);
-    this->setB(decomp.remainderB);
-    this->setC(decomp.remainderC);
-    this->setD(decomp.remainderD);
-    this->setE(decomp.translateX);
-    this->setF(decomp.translateY);
-    this->rotate(rad2deg(decomp.angle));
-    this->scale(decomp.scaleX, decomp.scaleY);
-}
-
-}
diff --git a/Source/core/platform/graphics/transforms/AffineTransform.h b/Source/core/platform/graphics/transforms/AffineTransform.h
deleted file mode 100644
index 536fa66..0000000
--- a/Source/core/platform/graphics/transforms/AffineTransform.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
- *               2010 Dirk Schulze <krit@webkit.org>
- *
- * 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,
- * 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 AffineTransform_h
-#define AffineTransform_h
-
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
-
-#include <string.h> // for memcpy
-#include "wtf/FastAllocBase.h"
-
-#include <SkMatrix.h>
-
-namespace WebCore {
-
-class FloatPoint;
-class FloatQuad;
-class FloatRect;
-class IntPoint;
-class IntRect;
-class TransformationMatrix;
-
-class AffineTransform {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    typedef double Transform[6];
-
-    AffineTransform();
-    AffineTransform(double a, double b, double c, double d, double e, double f);
-
-    void setMatrix(double a, double b, double c, double d, double e, double f);
-
-    void map(double x, double y, double& x2, double& y2) const;
-
-    // Rounds the mapped point to the nearest integer value.
-    IntPoint mapPoint(const IntPoint&) const;
-
-    FloatPoint mapPoint(const FloatPoint&) const;
-
-    IntSize mapSize(const IntSize&) const;
-
-    FloatSize mapSize(const FloatSize&) const;
-
-    // Rounds the resulting mapped rectangle out. This is helpful for bounding
-    // box computations but may not be what is wanted in other contexts.
-    IntRect mapRect(const IntRect&) const;
-
-    FloatRect mapRect(const FloatRect&) const;
-    FloatQuad mapQuad(const FloatQuad&) const;
-
-    bool isIdentity() const;
-
-    double a() const { return m_transform[0]; }
-    void setA(double a) { m_transform[0] = a; }
-    double b() const { return m_transform[1]; }
-    void setB(double b) { m_transform[1] = b; }
-    double c() const { return m_transform[2]; }
-    void setC(double c) { m_transform[2] = c; }
-    double d() const { return m_transform[3]; }
-    void setD(double d) { m_transform[3] = d; }
-    double e() const { return m_transform[4]; }
-    void setE(double e) { m_transform[4] = e; }
-    double f() const { return m_transform[5]; }
-    void setF(double f) { m_transform[5] = f; }
-
-    void makeIdentity();
-
-    AffineTransform& multiply(const AffineTransform& other);
-    AffineTransform& scale(double);
-    AffineTransform& scale(double sx, double sy);
-    AffineTransform& scaleNonUniform(double sx, double sy);
-    AffineTransform& rotate(double d);
-    AffineTransform& rotateFromVector(double x, double y);
-    AffineTransform& translate(double tx, double ty);
-    AffineTransform& shear(double sx, double sy);
-    AffineTransform& flipX();
-    AffineTransform& flipY();
-    AffineTransform& skew(double angleX, double angleY);
-    AffineTransform& skewX(double angle);
-    AffineTransform& skewY(double angle);
-
-    double xScale() const;
-    double yScale() const;
-
-    double det() const;
-    bool isInvertible() const;
-    AffineTransform inverse() const;
-
-    void blend(const AffineTransform& from, double progress);
-
-    TransformationMatrix toTransformationMatrix() const;
-
-    bool isIdentityOrTranslation() const
-    {
-        return m_transform[0] == 1 && m_transform[1] == 0 && m_transform[2] == 0 && m_transform[3] == 1;
-    }
-
-    bool isIdentityOrTranslationOrFlipped() const
-    {
-        return m_transform[0] == 1 && m_transform[1] == 0 && m_transform[2] == 0 && (m_transform[3] == 1 || m_transform[3] == -1);
-    }
-
-    bool preservesAxisAlignment() const
-    {
-        return (m_transform[1] == 0 && m_transform[2] == 0) || (m_transform[0] == 0 && m_transform[3] == 0);
-    }
-
-    bool operator== (const AffineTransform& m2) const
-    {
-        return (m_transform[0] == m2.m_transform[0]
-             && m_transform[1] == m2.m_transform[1]
-             && m_transform[2] == m2.m_transform[2]
-             && m_transform[3] == m2.m_transform[3]
-             && m_transform[4] == m2.m_transform[4]
-             && m_transform[5] == m2.m_transform[5]);
-    }
-
-    bool operator!=(const AffineTransform& other) const { return !(*this == other); }
-
-    // *this = *this * t (i.e., a multRight)
-    AffineTransform& operator*=(const AffineTransform& t)
-    {
-        return multiply(t);
-    }
-
-    // result = *this * t (i.e., a multRight)
-    AffineTransform operator*(const AffineTransform& t) const
-    {
-        AffineTransform result = *this;
-        result *= t;
-        return result;
-    }
-
-    operator SkMatrix() const;
-
-    static AffineTransform translation(double x, double y)
-    {
-        return AffineTransform(1, 0, 0, 1, x, y);
-    }
-
-    // decompose the matrix into its component parts
-    typedef struct {
-        double scaleX, scaleY;
-        double angle;
-        double remainderA, remainderB, remainderC, remainderD;
-        double translateX, translateY;
-    } DecomposedType;
-
-    bool decompose(DecomposedType&) const;
-    void recompose(const DecomposedType&);
-
-private:
-    void setMatrix(const Transform m)
-    {
-        if (m && m != m_transform)
-            memcpy(m_transform, m, sizeof(Transform));
-    }
-
-    Transform m_transform;
-};
-
-AffineTransform makeMapBetweenRects(const FloatRect& source, const FloatRect& dest);
-
-}
-
-#endif
diff --git a/Source/core/platform/graphics/transforms/MatrixTransformOperation.h b/Source/core/platform/graphics/transforms/MatrixTransformOperation.h
index 4dc125a..56b0606 100644
--- a/Source/core/platform/graphics/transforms/MatrixTransformOperation.h
+++ b/Source/core/platform/graphics/transforms/MatrixTransformOperation.h
@@ -26,7 +26,7 @@
 #define MatrixTransformOperation_h
 
 #include "core/platform/graphics/transforms/TransformOperation.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
+#include "platform/transforms/TransformationMatrix.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/graphics/transforms/TransformOperation.h b/Source/core/platform/graphics/transforms/TransformOperation.h
index 5223964..9cbf12a 100644
--- a/Source/core/platform/graphics/transforms/TransformOperation.h
+++ b/Source/core/platform/graphics/transforms/TransformOperation.h
@@ -25,8 +25,8 @@
 #ifndef TransformOperation_h
 #define TransformOperation_h
 
-#include "core/platform/graphics/FloatSize.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/transforms/TransformationMatrix.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 
diff --git a/Source/core/platform/graphics/transforms/TransformOperations.h b/Source/core/platform/graphics/transforms/TransformOperations.h
index 2f65012..0578336 100644
--- a/Source/core/platform/graphics/transforms/TransformOperations.h
+++ b/Source/core/platform/graphics/transforms/TransformOperations.h
@@ -25,8 +25,8 @@
 #ifndef TransformOperations_h
 #define TransformOperations_h
 
-#include "core/platform/graphics/LayoutSize.h"
 #include "core/platform/graphics/transforms/TransformOperation.h"
+#include "platform/geometry/LayoutSize.h"
 #include "wtf/RefPtr.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/platform/graphics/transforms/TransformState.h b/Source/core/platform/graphics/transforms/TransformState.h
index 638e417..49307f7 100644
--- a/Source/core/platform/graphics/transforms/TransformState.h
+++ b/Source/core/platform/graphics/transforms/TransformState.h
@@ -26,12 +26,12 @@
 #ifndef TransformState_h
 #define TransformState_h
 
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/IntSize.h"
-#include "core/platform/graphics/LayoutSize.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
+#include "platform/transforms/AffineTransform.h"
+#include "platform/transforms/TransformationMatrix.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/geometry/LayoutSize.h"
 #include "wtf/OwnPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/graphics/transforms/TransformationMatrix.cpp b/Source/core/platform/graphics/transforms/TransformationMatrix.cpp
deleted file mode 100644
index e95936b..0000000
--- a/Source/core/platform/graphics/transforms/TransformationMatrix.cpp
+++ /dev/null
@@ -1,1531 +0,0 @@
-/*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2009 Torch Mobile, Inc.
- * 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:
- * 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,
- * 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/graphics/transforms/TransformationMatrix.h"
-
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/LayoutRect.h"
-#include "core/platform/graphics/skia/SkiaUtils.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
-
-#include "wtf/Assertions.h"
-#include "wtf/MathExtras.h"
-
-#if CPU(X86_64)
-#include <emmintrin.h>
-#endif
-
-using namespace std;
-
-namespace WebCore {
-
-//
-// Supporting Math Functions
-//
-// This is a set of function from various places (attributed inline) to do things like
-// inversion and decomposition of a 4x4 matrix. They are used throughout the code
-//
-
-//
-// Adapted from Matrix Inversion by Richard Carling, Graphics Gems <http://tog.acm.org/GraphicsGems/index.html>.
-
-// EULA: The Graphics Gems code is copyright-protected. In other words, you cannot claim the text of the code
-// as your own and resell it. Using the code is permitted in any program, product, or library, non-commercial
-// or commercial. Giving credit is not required, though is a nice gesture. The code comes as-is, and if there
-// are any flaws or problems with any Gems code, nobody involved with Gems - authors, editors, publishers, or
-// webmasters - are to be held responsible. Basically, don't be a jerk, and remember that anything free comes
-// with no guarantee.
-
-// A clarification about the storage of matrix elements
-//
-// This class uses a 2 dimensional array internally to store the elements of the matrix.  The first index into
-// the array refers to the column that the element lies in; the second index refers to the row.
-//
-// In other words, this is the layout of the matrix:
-//
-// | m_matrix[0][0] m_matrix[1][0] m_matrix[2][0] m_matrix[3][0] |
-// | m_matrix[0][1] m_matrix[1][1] m_matrix[2][1] m_matrix[3][1] |
-// | m_matrix[0][2] m_matrix[1][2] m_matrix[2][2] m_matrix[3][2] |
-// | m_matrix[0][3] m_matrix[1][3] m_matrix[2][3] m_matrix[3][3] |
-
-typedef double Vector4[4];
-typedef double Vector3[3];
-
-const double SMALL_NUMBER = 1.e-8;
-
-// inverse(original_matrix, inverse_matrix)
-//
-// calculate the inverse of a 4x4 matrix
-//
-// -1
-// A  = ___1__ adjoint A
-//       det A
-
-//  double = determinant2x2(double a, double b, double c, double d)
-//
-//  calculate the determinant of a 2x2 matrix.
-
-static double determinant2x2(double a, double b, double c, double d)
-{
-    return a * d - b * c;
-}
-
-//  double = determinant3x3(a1, a2, a3, b1, b2, b3, c1, c2, c3)
-//
-//  Calculate the determinant of a 3x3 matrix
-//  in the form
-//
-//      | a1,  b1,  c1 |
-//      | a2,  b2,  c2 |
-//      | a3,  b3,  c3 |
-
-static double determinant3x3(double a1, double a2, double a3, double b1, double b2, double b3, double c1, double c2, double c3)
-{
-    return a1 * determinant2x2(b2, b3, c2, c3)
-         - b1 * determinant2x2(a2, a3, c2, c3)
-         + c1 * determinant2x2(a2, a3, b2, b3);
-}
-
-//  double = determinant4x4(matrix)
-//
-//  calculate the determinant of a 4x4 matrix.
-
-static double determinant4x4(const TransformationMatrix::Matrix4& m)
-{
-    // Assign to individual variable names to aid selecting
-    // correct elements
-
-    double a1 = m[0][0];
-    double b1 = m[0][1];
-    double c1 = m[0][2];
-    double d1 = m[0][3];
-
-    double a2 = m[1][0];
-    double b2 = m[1][1];
-    double c2 = m[1][2];
-    double d2 = m[1][3];
-
-    double a3 = m[2][0];
-    double b3 = m[2][1];
-    double c3 = m[2][2];
-    double d3 = m[2][3];
-
-    double a4 = m[3][0];
-    double b4 = m[3][1];
-    double c4 = m[3][2];
-    double d4 = m[3][3];
-
-    return a1 * determinant3x3(b2, b3, b4, c2, c3, c4, d2, d3, d4)
-         - b1 * determinant3x3(a2, a3, a4, c2, c3, c4, d2, d3, d4)
-         + c1 * determinant3x3(a2, a3, a4, b2, b3, b4, d2, d3, d4)
-         - d1 * determinant3x3(a2, a3, a4, b2, b3, b4, c2, c3, c4);
-}
-
-// adjoint( original_matrix, inverse_matrix )
-//
-//   calculate the adjoint of a 4x4 matrix
-//
-//    Let  a   denote the minor determinant of matrix A obtained by
-//         ij
-//
-//    deleting the ith row and jth column from A.
-//
-//                  i+j
-//   Let  b   = (-1)    a
-//        ij            ji
-//
-//  The matrix B = (b  ) is the adjoint of A
-//                   ij
-
-static void adjoint(const TransformationMatrix::Matrix4& matrix, TransformationMatrix::Matrix4& result)
-{
-    // Assign to individual variable names to aid
-    // selecting correct values
-    double a1 = matrix[0][0];
-    double b1 = matrix[0][1];
-    double c1 = matrix[0][2];
-    double d1 = matrix[0][3];
-
-    double a2 = matrix[1][0];
-    double b2 = matrix[1][1];
-    double c2 = matrix[1][2];
-    double d2 = matrix[1][3];
-
-    double a3 = matrix[2][0];
-    double b3 = matrix[2][1];
-    double c3 = matrix[2][2];
-    double d3 = matrix[2][3];
-
-    double a4 = matrix[3][0];
-    double b4 = matrix[3][1];
-    double c4 = matrix[3][2];
-    double d4 = matrix[3][3];
-
-    // Row column labeling reversed since we transpose rows & columns
-    result[0][0]  =   determinant3x3(b2, b3, b4, c2, c3, c4, d2, d3, d4);
-    result[1][0]  = - determinant3x3(a2, a3, a4, c2, c3, c4, d2, d3, d4);
-    result[2][0]  =   determinant3x3(a2, a3, a4, b2, b3, b4, d2, d3, d4);
-    result[3][0]  = - determinant3x3(a2, a3, a4, b2, b3, b4, c2, c3, c4);
-
-    result[0][1]  = - determinant3x3(b1, b3, b4, c1, c3, c4, d1, d3, d4);
-    result[1][1]  =   determinant3x3(a1, a3, a4, c1, c3, c4, d1, d3, d4);
-    result[2][1]  = - determinant3x3(a1, a3, a4, b1, b3, b4, d1, d3, d4);
-    result[3][1]  =   determinant3x3(a1, a3, a4, b1, b3, b4, c1, c3, c4);
-
-    result[0][2]  =   determinant3x3(b1, b2, b4, c1, c2, c4, d1, d2, d4);
-    result[1][2]  = - determinant3x3(a1, a2, a4, c1, c2, c4, d1, d2, d4);
-    result[2][2]  =   determinant3x3(a1, a2, a4, b1, b2, b4, d1, d2, d4);
-    result[3][2]  = - determinant3x3(a1, a2, a4, b1, b2, b4, c1, c2, c4);
-
-    result[0][3]  = - determinant3x3(b1, b2, b3, c1, c2, c3, d1, d2, d3);
-    result[1][3]  =   determinant3x3(a1, a2, a3, c1, c2, c3, d1, d2, d3);
-    result[2][3]  = - determinant3x3(a1, a2, a3, b1, b2, b3, d1, d2, d3);
-    result[3][3]  =   determinant3x3(a1, a2, a3, b1, b2, b3, c1, c2, c3);
-}
-
-// Returns false if the matrix is not invertible
-static bool inverse(const TransformationMatrix::Matrix4& matrix, TransformationMatrix::Matrix4& result)
-{
-    // Calculate the adjoint matrix
-    adjoint(matrix, result);
-
-    // Calculate the 4x4 determinant
-    // If the determinant is zero,
-    // then the inverse matrix is not unique.
-    double det = determinant4x4(matrix);
-
-    if (fabs(det) < SMALL_NUMBER)
-        return false;
-
-    // Scale the adjoint matrix to get the inverse
-
-    for (int i = 0; i < 4; i++)
-        for (int j = 0; j < 4; j++)
-            result[i][j] = result[i][j] / det;
-
-    return true;
-}
-
-// End of code adapted from Matrix Inversion by Richard Carling
-
-// Perform a decomposition on the passed matrix, return false if unsuccessful
-// From Graphics Gems: unmatrix.c
-
-// Transpose rotation portion of matrix a, return b
-static void transposeMatrix4(const TransformationMatrix::Matrix4& a, TransformationMatrix::Matrix4& b)
-{
-    for (int i = 0; i < 4; i++)
-        for (int j = 0; j < 4; j++)
-            b[i][j] = a[j][i];
-}
-
-// Multiply a homogeneous point by a matrix and return the transformed point
-static void v4MulPointByMatrix(const Vector4 p, const TransformationMatrix::Matrix4& m, Vector4 result)
-{
-    result[0] = (p[0] * m[0][0]) + (p[1] * m[1][0]) +
-                (p[2] * m[2][0]) + (p[3] * m[3][0]);
-    result[1] = (p[0] * m[0][1]) + (p[1] * m[1][1]) +
-                (p[2] * m[2][1]) + (p[3] * m[3][1]);
-    result[2] = (p[0] * m[0][2]) + (p[1] * m[1][2]) +
-                (p[2] * m[2][2]) + (p[3] * m[3][2]);
-    result[3] = (p[0] * m[0][3]) + (p[1] * m[1][3]) +
-                (p[2] * m[2][3]) + (p[3] * m[3][3]);
-}
-
-static double v3Length(Vector3 a)
-{
-    return sqrt((a[0] * a[0]) + (a[1] * a[1]) + (a[2] * a[2]));
-}
-
-static void v3Scale(Vector3 v, double desiredLength)
-{
-    double len = v3Length(v);
-    if (len != 0) {
-        double l = desiredLength / len;
-        v[0] *= l;
-        v[1] *= l;
-        v[2] *= l;
-    }
-}
-
-static double v3Dot(const Vector3 a, const Vector3 b)
-{
-    return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);
-}
-
-// Make a linear combination of two vectors and return the result.
-// result = (a * ascl) + (b * bscl)
-static void v3Combine(const Vector3 a, const Vector3 b, Vector3 result, double ascl, double bscl)
-{
-    result[0] = (ascl * a[0]) + (bscl * b[0]);
-    result[1] = (ascl * a[1]) + (bscl * b[1]);
-    result[2] = (ascl * a[2]) + (bscl * b[2]);
-}
-
-// Return the cross product result = a cross b */
-static void v3Cross(const Vector3 a, const Vector3 b, Vector3 result)
-{
-    result[0] = (a[1] * b[2]) - (a[2] * b[1]);
-    result[1] = (a[2] * b[0]) - (a[0] * b[2]);
-    result[2] = (a[0] * b[1]) - (a[1] * b[0]);
-}
-
-static bool decompose(const TransformationMatrix::Matrix4& mat, TransformationMatrix::DecomposedType& result)
-{
-    TransformationMatrix::Matrix4 localMatrix;
-    memcpy(localMatrix, mat, sizeof(TransformationMatrix::Matrix4));
-
-    // Normalize the matrix.
-    if (localMatrix[3][3] == 0)
-        return false;
-
-    int i, j;
-    for (i = 0; i < 4; i++)
-        for (j = 0; j < 4; j++)
-            localMatrix[i][j] /= localMatrix[3][3];
-
-    // perspectiveMatrix is used to solve for perspective, but it also provides
-    // an easy way to test for singularity of the upper 3x3 component.
-    TransformationMatrix::Matrix4 perspectiveMatrix;
-    memcpy(perspectiveMatrix, localMatrix, sizeof(TransformationMatrix::Matrix4));
-    for (i = 0; i < 3; i++)
-        perspectiveMatrix[i][3] = 0;
-    perspectiveMatrix[3][3] = 1;
-
-    if (determinant4x4(perspectiveMatrix) == 0)
-        return false;
-
-    // First, isolate perspective.  This is the messiest.
-    if (localMatrix[0][3] != 0 || localMatrix[1][3] != 0 || localMatrix[2][3] != 0) {
-        // rightHandSide is the right hand side of the equation.
-        Vector4 rightHandSide;
-        rightHandSide[0] = localMatrix[0][3];
-        rightHandSide[1] = localMatrix[1][3];
-        rightHandSide[2] = localMatrix[2][3];
-        rightHandSide[3] = localMatrix[3][3];
-
-        // Solve the equation by inverting perspectiveMatrix and multiplying
-        // rightHandSide by the inverse.  (This is the easiest way, not
-        // necessarily the best.)
-        TransformationMatrix::Matrix4 inversePerspectiveMatrix, transposedInversePerspectiveMatrix;
-        inverse(perspectiveMatrix, inversePerspectiveMatrix);
-        transposeMatrix4(inversePerspectiveMatrix, transposedInversePerspectiveMatrix);
-
-        Vector4 perspectivePoint;
-        v4MulPointByMatrix(rightHandSide, transposedInversePerspectiveMatrix, perspectivePoint);
-
-        result.perspectiveX = perspectivePoint[0];
-        result.perspectiveY = perspectivePoint[1];
-        result.perspectiveZ = perspectivePoint[2];
-        result.perspectiveW = perspectivePoint[3];
-
-        // Clear the perspective partition
-        localMatrix[0][3] = localMatrix[1][3] = localMatrix[2][3] = 0;
-        localMatrix[3][3] = 1;
-    } else {
-        // No perspective.
-        result.perspectiveX = result.perspectiveY = result.perspectiveZ = 0;
-        result.perspectiveW = 1;
-    }
-
-    // Next take care of translation (easy).
-    result.translateX = localMatrix[3][0];
-    localMatrix[3][0] = 0;
-    result.translateY = localMatrix[3][1];
-    localMatrix[3][1] = 0;
-    result.translateZ = localMatrix[3][2];
-    localMatrix[3][2] = 0;
-
-    // Vector4 type and functions need to be added to the common set.
-    Vector3 row[3], pdum3;
-
-    // Now get scale and shear.
-    for (i = 0; i < 3; i++) {
-        row[i][0] = localMatrix[i][0];
-        row[i][1] = localMatrix[i][1];
-        row[i][2] = localMatrix[i][2];
-    }
-
-    // Compute X scale factor and normalize first row.
-    result.scaleX = v3Length(row[0]);
-    v3Scale(row[0], 1.0);
-
-    // Compute XY shear factor and make 2nd row orthogonal to 1st.
-    result.skewXY = v3Dot(row[0], row[1]);
-    v3Combine(row[1], row[0], row[1], 1.0, -result.skewXY);
-
-    // Now, compute Y scale and normalize 2nd row.
-    result.scaleY = v3Length(row[1]);
-    v3Scale(row[1], 1.0);
-    result.skewXY /= result.scaleY;
-
-    // Compute XZ and YZ shears, orthogonalize 3rd row.
-    result.skewXZ = v3Dot(row[0], row[2]);
-    v3Combine(row[2], row[0], row[2], 1.0, -result.skewXZ);
-    result.skewYZ = v3Dot(row[1], row[2]);
-    v3Combine(row[2], row[1], row[2], 1.0, -result.skewYZ);
-
-    // Next, get Z scale and normalize 3rd row.
-    result.scaleZ = v3Length(row[2]);
-    v3Scale(row[2], 1.0);
-    result.skewXZ /= result.scaleZ;
-    result.skewYZ /= result.scaleZ;
-
-    // At this point, the matrix (in rows[]) is orthonormal.
-    // Check for a coordinate system flip.  If the determinant
-    // is -1, then negate the matrix and the scaling factors.
-    v3Cross(row[1], row[2], pdum3);
-    if (v3Dot(row[0], pdum3) < 0) {
-
-        result.scaleX *= -1;
-        result.scaleY *= -1;
-        result.scaleZ *= -1;
-
-        for (i = 0; i < 3; i++) {
-            row[i][0] *= -1;
-            row[i][1] *= -1;
-            row[i][2] *= -1;
-        }
-    }
-
-    // Now, get the rotations out, as described in the gem.
-
-    // FIXME - Add the ability to return either quaternions (which are
-    // easier to recompose with) or Euler angles (rx, ry, rz), which
-    // are easier for authors to deal with. The latter will only be useful
-    // when we fix https://bugs.webkit.org/show_bug.cgi?id=23799, so I
-    // will leave the Euler angle code here for now.
-
-    // ret.rotateY = asin(-row[0][2]);
-    // if (cos(ret.rotateY) != 0) {
-    //     ret.rotateX = atan2(row[1][2], row[2][2]);
-    //     ret.rotateZ = atan2(row[0][1], row[0][0]);
-    // } else {
-    //     ret.rotateX = atan2(-row[2][0], row[1][1]);
-    //     ret.rotateZ = 0;
-    // }
-
-    double s, t, x, y, z, w;
-
-    t = row[0][0] + row[1][1] + row[2][2] + 1.0;
-
-    if (t > 1e-4) {
-        s = 0.5 / sqrt(t);
-        w = 0.25 / s;
-        x = (row[2][1] - row[1][2]) * s;
-        y = (row[0][2] - row[2][0]) * s;
-        z = (row[1][0] - row[0][1]) * s;
-    } else if (row[0][0] > row[1][1] && row[0][0] > row[2][2]) {
-        s = sqrt (1.0 + row[0][0] - row[1][1] - row[2][2]) * 2.0; // S=4*qx
-        x = 0.25 * s;
-        y = (row[0][1] + row[1][0]) / s;
-        z = (row[0][2] + row[2][0]) / s;
-        w = (row[2][1] - row[1][2]) / s;
-    } else if (row[1][1] > row[2][2]) {
-        s = sqrt (1.0 + row[1][1] - row[0][0] - row[2][2]) * 2.0; // S=4*qy
-        x = (row[0][1] + row[1][0]) / s;
-        y = 0.25 * s;
-        z = (row[1][2] + row[2][1]) / s;
-        w = (row[0][2] - row[2][0]) / s;
-    } else {
-        s = sqrt(1.0 + row[2][2] - row[0][0] - row[1][1]) * 2.0; // S=4*qz
-        x = (row[0][2] + row[2][0]) / s;
-        y = (row[1][2] + row[2][1]) / s;
-        z = 0.25 * s;
-        w = (row[1][0] - row[0][1]) / s;
-    }
-
-    result.quaternionX = x;
-    result.quaternionY = y;
-    result.quaternionZ = z;
-    result.quaternionW = w;
-
-    return true;
-}
-
-// Perform a spherical linear interpolation between the two
-// passed quaternions with 0 <= t <= 1
-static void slerp(double qa[4], const double qb[4], double t)
-{
-    double ax, ay, az, aw;
-    double bx, by, bz, bw;
-    double cx, cy, cz, cw;
-    double angle;
-    double th, invth, scale, invscale;
-
-    ax = qa[0]; ay = qa[1]; az = qa[2]; aw = qa[3];
-    bx = qb[0]; by = qb[1]; bz = qb[2]; bw = qb[3];
-
-    angle = ax * bx + ay * by + az * bz + aw * bw;
-
-    if (angle < 0.0) {
-        ax = -ax; ay = -ay;
-        az = -az; aw = -aw;
-        angle = -angle;
-    }
-
-    if (angle + 1.0 > .05) {
-        if (1.0 - angle >= .05) {
-            th = acos (angle);
-            invth = 1.0 / sin (th);
-            scale = sin (th * (1.0 - t)) * invth;
-            invscale = sin (th * t) * invth;
-        } else {
-            scale = 1.0 - t;
-            invscale = t;
-        }
-    } else {
-        bx = -ay;
-        by = ax;
-        bz = -aw;
-        bw = az;
-        scale = sin(piDouble * (.5 - t));
-        invscale = sin (piDouble * t);
-    }
-
-    cx = ax * scale + bx * invscale;
-    cy = ay * scale + by * invscale;
-    cz = az * scale + bz * invscale;
-    cw = aw * scale + bw * invscale;
-
-    qa[0] = cx; qa[1] = cy; qa[2] = cz; qa[3] = cw;
-}
-
-// End of Supporting Math Functions
-
-TransformationMatrix::TransformationMatrix(const AffineTransform& t)
-{
-    setMatrix(t.a(), t.b(), t.c(), t.d(), t.e(), t.f());
-}
-
-TransformationMatrix& TransformationMatrix::scale(double s)
-{
-    return scaleNonUniform(s, s);
-}
-
-TransformationMatrix& TransformationMatrix::rotateFromVector(double x, double y)
-{
-    return rotate(rad2deg(atan2(y, x)));
-}
-
-TransformationMatrix& TransformationMatrix::flipX()
-{
-    return scaleNonUniform(-1.0, 1.0);
-}
-
-TransformationMatrix& TransformationMatrix::flipY()
-{
-    return scaleNonUniform(1.0, -1.0);
-}
-
-FloatPoint TransformationMatrix::projectPoint(const FloatPoint& p, bool* clamped) const
-{
-    // This is basically raytracing. We have a point in the destination
-    // plane with z=0, and we cast a ray parallel to the z-axis from that
-    // point to find the z-position at which it intersects the z=0 plane
-    // with the transform applied. Once we have that point we apply the
-    // inverse transform to find the corresponding point in the source
-    // space.
-    //
-    // Given a plane with normal Pn, and a ray starting at point R0 and
-    // with direction defined by the vector Rd, we can find the
-    // intersection point as a distance d from R0 in units of Rd by:
-    //
-    // d = -dot (Pn', R0) / dot (Pn', Rd)
-    if (clamped)
-        *clamped = false;
-
-    if (m33() == 0) {
-        // In this case, the projection plane is parallel to the ray we are trying to
-        // trace, and there is no well-defined value for the projection.
-        return FloatPoint();
-    }
-
-    double x = p.x();
-    double y = p.y();
-    double z = -(m13() * x + m23() * y + m43()) / m33();
-
-    // FIXME: use multVecMatrix()
-    double outX = x * m11() + y * m21() + z * m31() + m41();
-    double outY = x * m12() + y * m22() + z * m32() + m42();
-
-    double w = x * m14() + y * m24() + z * m34() + m44();
-    if (w <= 0) {
-        // Using int max causes overflow when other code uses the projected point. To
-        // represent infinity yet reduce the risk of overflow, we use a large but
-        // not-too-large number here when clamping.
-        const int largeNumber = 100000000 / kFixedPointDenominator;
-        outX = copysign(largeNumber, outX);
-        outY = copysign(largeNumber, outY);
-        if (clamped)
-            *clamped = true;
-    } else if (w != 1) {
-        outX /= w;
-        outY /= w;
-    }
-
-    return FloatPoint(static_cast<float>(outX), static_cast<float>(outY));
-}
-
-FloatQuad TransformationMatrix::projectQuad(const FloatQuad& q, bool* clamped) const
-{
-    FloatQuad projectedQuad;
-
-    bool clamped1 = false;
-    bool clamped2 = false;
-    bool clamped3 = false;
-    bool clamped4 = false;
-
-    projectedQuad.setP1(projectPoint(q.p1(), &clamped1));
-    projectedQuad.setP2(projectPoint(q.p2(), &clamped2));
-    projectedQuad.setP3(projectPoint(q.p3(), &clamped3));
-    projectedQuad.setP4(projectPoint(q.p4(), &clamped4));
-
-    if (clamped)
-        *clamped = clamped1 || clamped2 || clamped3 || clamped4;
-
-    // If all points on the quad had w < 0, then the entire quad would not be visible to the projected surface.
-    bool everythingWasClipped = clamped1 && clamped2 && clamped3 && clamped4;
-    if (everythingWasClipped)
-        return FloatQuad();
-
-    return projectedQuad;
-}
-
-static float clampEdgeValue(float f)
-{
-    ASSERT(!std::isnan(f));
-    return min<float>(max<float>(f, -LayoutUnit::max() / 2), LayoutUnit::max() / 2);
-}
-
-LayoutRect TransformationMatrix::clampedBoundsOfProjectedQuad(const FloatQuad& q) const
-{
-    FloatRect mappedQuadBounds = projectQuad(q).boundingBox();
-
-    float left = clampEdgeValue(floorf(mappedQuadBounds.x()));
-    float top = clampEdgeValue(floorf(mappedQuadBounds.y()));
-
-    float right;
-    if (std::isinf(mappedQuadBounds.x()) && std::isinf(mappedQuadBounds.width()))
-        right = LayoutUnit::max() / 2;
-    else
-        right = clampEdgeValue(ceilf(mappedQuadBounds.maxX()));
-
-    float bottom;
-    if (std::isinf(mappedQuadBounds.y()) && std::isinf(mappedQuadBounds.height()))
-        bottom = LayoutUnit::max() / 2;
-    else
-        bottom = clampEdgeValue(ceilf(mappedQuadBounds.maxY()));
-
-    return LayoutRect(LayoutUnit::clamp(left), LayoutUnit::clamp(top),  LayoutUnit::clamp(right - left), LayoutUnit::clamp(bottom - top));
-}
-
-FloatPoint TransformationMatrix::mapPoint(const FloatPoint& p) const
-{
-    if (isIdentityOrTranslation())
-        return FloatPoint(p.x() + static_cast<float>(m_matrix[3][0]), p.y() + static_cast<float>(m_matrix[3][1]));
-
-    return internalMapPoint(p);
-}
-
-FloatPoint3D TransformationMatrix::mapPoint(const FloatPoint3D& p) const
-{
-    if (isIdentityOrTranslation())
-        return FloatPoint3D(p.x() + static_cast<float>(m_matrix[3][0]),
-                            p.y() + static_cast<float>(m_matrix[3][1]),
-                            p.z() + static_cast<float>(m_matrix[3][2]));
-
-    return internalMapPoint(p);
-}
-
-IntRect TransformationMatrix::mapRect(const IntRect &rect) const
-{
-    return enclosingIntRect(mapRect(FloatRect(rect)));
-}
-
-LayoutRect TransformationMatrix::mapRect(const LayoutRect& r) const
-{
-    return enclosingLayoutRect(mapRect(FloatRect(r)));
-}
-
-FloatRect TransformationMatrix::mapRect(const FloatRect& r) const
-{
-    if (isIdentityOrTranslation()) {
-        FloatRect mappedRect(r);
-        mappedRect.move(static_cast<float>(m_matrix[3][0]), static_cast<float>(m_matrix[3][1]));
-        return mappedRect;
-    }
-
-    FloatQuad result;
-
-    float maxX = r.maxX();
-    float maxY = r.maxY();
-    result.setP1(internalMapPoint(FloatPoint(r.x(), r.y())));
-    result.setP2(internalMapPoint(FloatPoint(maxX, r.y())));
-    result.setP3(internalMapPoint(FloatPoint(maxX, maxY)));
-    result.setP4(internalMapPoint(FloatPoint(r.x(), maxY)));
-
-    return result.boundingBox();
-}
-
-FloatQuad TransformationMatrix::mapQuad(const FloatQuad& q) const
-{
-    if (isIdentityOrTranslation()) {
-        FloatQuad mappedQuad(q);
-        mappedQuad.move(static_cast<float>(m_matrix[3][0]), static_cast<float>(m_matrix[3][1]));
-        return mappedQuad;
-    }
-
-    FloatQuad result;
-    result.setP1(internalMapPoint(q.p1()));
-    result.setP2(internalMapPoint(q.p2()));
-    result.setP3(internalMapPoint(q.p3()));
-    result.setP4(internalMapPoint(q.p4()));
-    return result;
-}
-
-TransformationMatrix& TransformationMatrix::scaleNonUniform(double sx, double sy)
-{
-    m_matrix[0][0] *= sx;
-    m_matrix[0][1] *= sx;
-    m_matrix[0][2] *= sx;
-    m_matrix[0][3] *= sx;
-
-    m_matrix[1][0] *= sy;
-    m_matrix[1][1] *= sy;
-    m_matrix[1][2] *= sy;
-    m_matrix[1][3] *= sy;
-    return *this;
-}
-
-TransformationMatrix& TransformationMatrix::scale3d(double sx, double sy, double sz)
-{
-    scaleNonUniform(sx, sy);
-
-    m_matrix[2][0] *= sz;
-    m_matrix[2][1] *= sz;
-    m_matrix[2][2] *= sz;
-    m_matrix[2][3] *= sz;
-    return *this;
-}
-
-TransformationMatrix& TransformationMatrix::rotate3d(double x, double y, double z, double angle)
-{
-    // Normalize the axis of rotation
-    double length = sqrt(x * x + y * y + z * z);
-    if (length == 0) {
-        // A direction vector that cannot be normalized, such as [0, 0, 0], will cause the rotation to not be applied.
-        return *this;
-    } else if (length != 1) {
-        x /= length;
-        y /= length;
-        z /= length;
-    }
-
-    // Angles are in degrees. Switch to radians.
-    angle = deg2rad(angle);
-
-    double sinTheta = sin(angle);
-    double cosTheta = cos(angle);
-
-    TransformationMatrix mat;
-
-    // Optimize cases where the axis is along a major axis
-    if (x == 1.0 && y == 0.0 && z == 0.0) {
-        mat.m_matrix[0][0] = 1.0;
-        mat.m_matrix[0][1] = 0.0;
-        mat.m_matrix[0][2] = 0.0;
-        mat.m_matrix[1][0] = 0.0;
-        mat.m_matrix[1][1] = cosTheta;
-        mat.m_matrix[1][2] = sinTheta;
-        mat.m_matrix[2][0] = 0.0;
-        mat.m_matrix[2][1] = -sinTheta;
-        mat.m_matrix[2][2] = cosTheta;
-        mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0;
-        mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0;
-        mat.m_matrix[3][3] = 1.0;
-    } else if (x == 0.0 && y == 1.0 && z == 0.0) {
-        mat.m_matrix[0][0] = cosTheta;
-        mat.m_matrix[0][1] = 0.0;
-        mat.m_matrix[0][2] = -sinTheta;
-        mat.m_matrix[1][0] = 0.0;
-        mat.m_matrix[1][1] = 1.0;
-        mat.m_matrix[1][2] = 0.0;
-        mat.m_matrix[2][0] = sinTheta;
-        mat.m_matrix[2][1] = 0.0;
-        mat.m_matrix[2][2] = cosTheta;
-        mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0;
-        mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0;
-        mat.m_matrix[3][3] = 1.0;
-    } else if (x == 0.0 && y == 0.0 && z == 1.0) {
-        mat.m_matrix[0][0] = cosTheta;
-        mat.m_matrix[0][1] = sinTheta;
-        mat.m_matrix[0][2] = 0.0;
-        mat.m_matrix[1][0] = -sinTheta;
-        mat.m_matrix[1][1] = cosTheta;
-        mat.m_matrix[1][2] = 0.0;
-        mat.m_matrix[2][0] = 0.0;
-        mat.m_matrix[2][1] = 0.0;
-        mat.m_matrix[2][2] = 1.0;
-        mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0;
-        mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0;
-        mat.m_matrix[3][3] = 1.0;
-    } else {
-        // This case is the rotation about an arbitrary unit vector.
-        //
-        // Formula is adapted from Wikipedia article on Rotation matrix,
-        // http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle
-        //
-        // An alternate resource with the same matrix: http://www.fastgraph.com/makegames/3drotation/
-        //
-        double oneMinusCosTheta = 1 - cosTheta;
-        mat.m_matrix[0][0] = cosTheta + x * x * oneMinusCosTheta;
-        mat.m_matrix[0][1] = y * x * oneMinusCosTheta + z * sinTheta;
-        mat.m_matrix[0][2] = z * x * oneMinusCosTheta - y * sinTheta;
-        mat.m_matrix[1][0] = x * y * oneMinusCosTheta - z * sinTheta;
-        mat.m_matrix[1][1] = cosTheta + y * y * oneMinusCosTheta;
-        mat.m_matrix[1][2] = z * y * oneMinusCosTheta + x * sinTheta;
-        mat.m_matrix[2][0] = x * z * oneMinusCosTheta + y * sinTheta;
-        mat.m_matrix[2][1] = y * z * oneMinusCosTheta - x * sinTheta;
-        mat.m_matrix[2][2] = cosTheta + z * z * oneMinusCosTheta;
-        mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0;
-        mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0;
-        mat.m_matrix[3][3] = 1.0;
-    }
-    multiply(mat);
-    return *this;
-}
-
-TransformationMatrix& TransformationMatrix::rotate3d(double rx, double ry, double rz)
-{
-    // Angles are in degrees. Switch to radians.
-    rx = deg2rad(rx);
-    ry = deg2rad(ry);
-    rz = deg2rad(rz);
-
-    TransformationMatrix mat;
-
-    double sinTheta = sin(rz);
-    double cosTheta = cos(rz);
-
-    mat.m_matrix[0][0] = cosTheta;
-    mat.m_matrix[0][1] = sinTheta;
-    mat.m_matrix[0][2] = 0.0;
-    mat.m_matrix[1][0] = -sinTheta;
-    mat.m_matrix[1][1] = cosTheta;
-    mat.m_matrix[1][2] = 0.0;
-    mat.m_matrix[2][0] = 0.0;
-    mat.m_matrix[2][1] = 0.0;
-    mat.m_matrix[2][2] = 1.0;
-    mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0;
-    mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0;
-    mat.m_matrix[3][3] = 1.0;
-
-    TransformationMatrix rmat(mat);
-
-    sinTheta = sin(ry);
-    cosTheta = cos(ry);
-
-    mat.m_matrix[0][0] = cosTheta;
-    mat.m_matrix[0][1] = 0.0;
-    mat.m_matrix[0][2] = -sinTheta;
-    mat.m_matrix[1][0] = 0.0;
-    mat.m_matrix[1][1] = 1.0;
-    mat.m_matrix[1][2] = 0.0;
-    mat.m_matrix[2][0] = sinTheta;
-    mat.m_matrix[2][1] = 0.0;
-    mat.m_matrix[2][2] = cosTheta;
-    mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0;
-    mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0;
-    mat.m_matrix[3][3] = 1.0;
-
-    rmat.multiply(mat);
-
-    sinTheta = sin(rx);
-    cosTheta = cos(rx);
-
-    mat.m_matrix[0][0] = 1.0;
-    mat.m_matrix[0][1] = 0.0;
-    mat.m_matrix[0][2] = 0.0;
-    mat.m_matrix[1][0] = 0.0;
-    mat.m_matrix[1][1] = cosTheta;
-    mat.m_matrix[1][2] = sinTheta;
-    mat.m_matrix[2][0] = 0.0;
-    mat.m_matrix[2][1] = -sinTheta;
-    mat.m_matrix[2][2] = cosTheta;
-    mat.m_matrix[0][3] = mat.m_matrix[1][3] = mat.m_matrix[2][3] = 0.0;
-    mat.m_matrix[3][0] = mat.m_matrix[3][1] = mat.m_matrix[3][2] = 0.0;
-    mat.m_matrix[3][3] = 1.0;
-
-    rmat.multiply(mat);
-
-    multiply(rmat);
-    return *this;
-}
-
-TransformationMatrix& TransformationMatrix::translate(double tx, double ty)
-{
-    m_matrix[3][0] += tx * m_matrix[0][0] + ty * m_matrix[1][0];
-    m_matrix[3][1] += tx * m_matrix[0][1] + ty * m_matrix[1][1];
-    m_matrix[3][2] += tx * m_matrix[0][2] + ty * m_matrix[1][2];
-    m_matrix[3][3] += tx * m_matrix[0][3] + ty * m_matrix[1][3];
-    return *this;
-}
-
-TransformationMatrix& TransformationMatrix::translate3d(double tx, double ty, double tz)
-{
-    m_matrix[3][0] += tx * m_matrix[0][0] + ty * m_matrix[1][0] + tz * m_matrix[2][0];
-    m_matrix[3][1] += tx * m_matrix[0][1] + ty * m_matrix[1][1] + tz * m_matrix[2][1];
-    m_matrix[3][2] += tx * m_matrix[0][2] + ty * m_matrix[1][2] + tz * m_matrix[2][2];
-    m_matrix[3][3] += tx * m_matrix[0][3] + ty * m_matrix[1][3] + tz * m_matrix[2][3];
-    return *this;
-}
-
-TransformationMatrix& TransformationMatrix::translateRight(double tx, double ty)
-{
-    if (tx != 0) {
-        m_matrix[0][0] +=  m_matrix[0][3] * tx;
-        m_matrix[1][0] +=  m_matrix[1][3] * tx;
-        m_matrix[2][0] +=  m_matrix[2][3] * tx;
-        m_matrix[3][0] +=  m_matrix[3][3] * tx;
-    }
-
-    if (ty != 0) {
-        m_matrix[0][1] +=  m_matrix[0][3] * ty;
-        m_matrix[1][1] +=  m_matrix[1][3] * ty;
-        m_matrix[2][1] +=  m_matrix[2][3] * ty;
-        m_matrix[3][1] +=  m_matrix[3][3] * ty;
-    }
-
-    return *this;
-}
-
-TransformationMatrix& TransformationMatrix::translateRight3d(double tx, double ty, double tz)
-{
-    translateRight(tx, ty);
-    if (tz != 0) {
-        m_matrix[0][2] +=  m_matrix[0][3] * tz;
-        m_matrix[1][2] +=  m_matrix[1][3] * tz;
-        m_matrix[2][2] +=  m_matrix[2][3] * tz;
-        m_matrix[3][2] +=  m_matrix[3][3] * tz;
-    }
-
-    return *this;
-}
-
-TransformationMatrix& TransformationMatrix::skew(double sx, double sy)
-{
-    // angles are in degrees. Switch to radians
-    sx = deg2rad(sx);
-    sy = deg2rad(sy);
-
-    TransformationMatrix mat;
-    mat.m_matrix[0][1] = tan(sy); // note that the y shear goes in the first row
-    mat.m_matrix[1][0] = tan(sx); // and the x shear in the second row
-
-    multiply(mat);
-    return *this;
-}
-
-TransformationMatrix& TransformationMatrix::applyPerspective(double p)
-{
-    TransformationMatrix mat;
-    if (p != 0)
-        mat.m_matrix[2][3] = -1/p;
-
-    multiply(mat);
-    return *this;
-}
-
-TransformationMatrix TransformationMatrix::rectToRect(const FloatRect& from, const FloatRect& to)
-{
-    ASSERT(!from.isEmpty());
-    return TransformationMatrix(to.width() / from.width(),
-                                0, 0,
-                                to.height() / from.height(),
-                                to.x() - from.x(),
-                                to.y() - from.y());
-}
-
-// this = mat * this.
-TransformationMatrix& TransformationMatrix::multiply(const TransformationMatrix& mat)
-{
-#if CPU(APPLE_ARMV7S)
-    double* leftMatrix = &(m_matrix[0][0]);
-    const double* rightMatrix = &(mat.m_matrix[0][0]);
-    asm volatile (// First row of leftMatrix.
-        "mov        r3, %[leftMatrix]\n\t"
-        "vld1.64    { d16-d19 }, [%[leftMatrix], :128]!\n\t"
-        "vld1.64    { d0-d3}, [%[rightMatrix], :128]!\n\t"
-        "vmul.f64   d4, d0, d16\n\t"
-        "vld1.64    { d20-d23 }, [%[leftMatrix], :128]!\n\t"
-        "vmla.f64   d4, d1, d20\n\t"
-        "vld1.64    { d24-d27 }, [%[leftMatrix], :128]!\n\t"
-        "vmla.f64   d4, d2, d24\n\t"
-        "vld1.64    { d28-d31 }, [%[leftMatrix], :128]!\n\t"
-        "vmla.f64   d4, d3, d28\n\t"
-
-        "vmul.f64   d5, d0, d17\n\t"
-        "vmla.f64   d5, d1, d21\n\t"
-        "vmla.f64   d5, d2, d25\n\t"
-        "vmla.f64   d5, d3, d29\n\t"
-
-        "vmul.f64   d6, d0, d18\n\t"
-        "vmla.f64   d6, d1, d22\n\t"
-        "vmla.f64   d6, d2, d26\n\t"
-        "vmla.f64   d6, d3, d30\n\t"
-
-        "vmul.f64   d7, d0, d19\n\t"
-        "vmla.f64   d7, d1, d23\n\t"
-        "vmla.f64   d7, d2, d27\n\t"
-        "vmla.f64   d7, d3, d31\n\t"
-        "vld1.64    { d0-d3}, [%[rightMatrix], :128]!\n\t"
-        "vst1.64    { d4-d7 }, [r3, :128]!\n\t"
-
-        // Second row of leftMatrix.
-        "vmul.f64   d4, d0, d16\n\t"
-        "vmla.f64   d4, d1, d20\n\t"
-        "vmla.f64   d4, d2, d24\n\t"
-        "vmla.f64   d4, d3, d28\n\t"
-
-        "vmul.f64   d5, d0, d17\n\t"
-        "vmla.f64   d5, d1, d21\n\t"
-        "vmla.f64   d5, d2, d25\n\t"
-        "vmla.f64   d5, d3, d29\n\t"
-
-        "vmul.f64   d6, d0, d18\n\t"
-        "vmla.f64   d6, d1, d22\n\t"
-        "vmla.f64   d6, d2, d26\n\t"
-        "vmla.f64   d6, d3, d30\n\t"
-
-        "vmul.f64   d7, d0, d19\n\t"
-        "vmla.f64   d7, d1, d23\n\t"
-        "vmla.f64   d7, d2, d27\n\t"
-        "vmla.f64   d7, d3, d31\n\t"
-        "vld1.64    { d0-d3}, [%[rightMatrix], :128]!\n\t"
-        "vst1.64    { d4-d7 }, [r3, :128]!\n\t"
-
-        // Third row of leftMatrix.
-        "vmul.f64   d4, d0, d16\n\t"
-        "vmla.f64   d4, d1, d20\n\t"
-        "vmla.f64   d4, d2, d24\n\t"
-        "vmla.f64   d4, d3, d28\n\t"
-
-        "vmul.f64   d5, d0, d17\n\t"
-        "vmla.f64   d5, d1, d21\n\t"
-        "vmla.f64   d5, d2, d25\n\t"
-        "vmla.f64   d5, d3, d29\n\t"
-
-        "vmul.f64   d6, d0, d18\n\t"
-        "vmla.f64   d6, d1, d22\n\t"
-        "vmla.f64   d6, d2, d26\n\t"
-        "vmla.f64   d6, d3, d30\n\t"
-
-        "vmul.f64   d7, d0, d19\n\t"
-        "vmla.f64   d7, d1, d23\n\t"
-        "vmla.f64   d7, d2, d27\n\t"
-        "vmla.f64   d7, d3, d31\n\t"
-        "vld1.64    { d0-d3}, [%[rightMatrix], :128]\n\t"
-        "vst1.64    { d4-d7 }, [r3, :128]!\n\t"
-
-        // Fourth and last row of leftMatrix.
-        "vmul.f64   d4, d0, d16\n\t"
-        "vmla.f64   d4, d1, d20\n\t"
-        "vmla.f64   d4, d2, d24\n\t"
-        "vmla.f64   d4, d3, d28\n\t"
-
-        "vmul.f64   d5, d0, d17\n\t"
-        "vmla.f64   d5, d1, d21\n\t"
-        "vmla.f64   d5, d2, d25\n\t"
-        "vmla.f64   d5, d3, d29\n\t"
-
-        "vmul.f64   d6, d0, d18\n\t"
-        "vmla.f64   d6, d1, d22\n\t"
-        "vmla.f64   d6, d2, d26\n\t"
-        "vmla.f64   d6, d3, d30\n\t"
-
-        "vmul.f64   d7, d0, d19\n\t"
-        "vmla.f64   d7, d1, d23\n\t"
-        "vmla.f64   d7, d2, d27\n\t"
-        "vmla.f64   d7, d3, d31\n\t"
-        "vst1.64    { d4-d7 }, [r3, :128]\n\t"
-        : [leftMatrix]"+r"(leftMatrix), [rightMatrix]"+r"(rightMatrix)
-        :
-        : "memory", "r3", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31");
-#elif defined(TRANSFORMATION_MATRIX_USE_X86_64_SSE2)
-    // x86_64 has 16 XMM registers which is enough to do the multiplication fully in registers.
-    __m128d matrixBlockA = _mm_load_pd(&(m_matrix[0][0]));
-    __m128d matrixBlockC = _mm_load_pd(&(m_matrix[1][0]));
-    __m128d matrixBlockE = _mm_load_pd(&(m_matrix[2][0]));
-    __m128d matrixBlockG = _mm_load_pd(&(m_matrix[3][0]));
-
-    // First row.
-    __m128d otherMatrixFirstParam = _mm_set1_pd(mat.m_matrix[0][0]);
-    __m128d otherMatrixSecondParam = _mm_set1_pd(mat.m_matrix[0][1]);
-    __m128d otherMatrixThirdParam = _mm_set1_pd(mat.m_matrix[0][2]);
-    __m128d otherMatrixFourthParam = _mm_set1_pd(mat.m_matrix[0][3]);
-
-    // output00 and output01.
-    __m128d accumulator = _mm_mul_pd(matrixBlockA, otherMatrixFirstParam);
-    __m128d temp1 = _mm_mul_pd(matrixBlockC, otherMatrixSecondParam);
-    __m128d temp2 = _mm_mul_pd(matrixBlockE, otherMatrixThirdParam);
-    __m128d temp3 = _mm_mul_pd(matrixBlockG, otherMatrixFourthParam);
-
-    __m128d matrixBlockB = _mm_load_pd(&(m_matrix[0][2]));
-    __m128d matrixBlockD = _mm_load_pd(&(m_matrix[1][2]));
-    __m128d matrixBlockF = _mm_load_pd(&(m_matrix[2][2]));
-    __m128d matrixBlockH = _mm_load_pd(&(m_matrix[3][2]));
-
-    accumulator = _mm_add_pd(accumulator, temp1);
-    accumulator = _mm_add_pd(accumulator, temp2);
-    accumulator = _mm_add_pd(accumulator, temp3);
-    _mm_store_pd(&m_matrix[0][0], accumulator);
-
-    // output02 and output03.
-    accumulator = _mm_mul_pd(matrixBlockB, otherMatrixFirstParam);
-    temp1 = _mm_mul_pd(matrixBlockD, otherMatrixSecondParam);
-    temp2 = _mm_mul_pd(matrixBlockF, otherMatrixThirdParam);
-    temp3 = _mm_mul_pd(matrixBlockH, otherMatrixFourthParam);
-
-    accumulator = _mm_add_pd(accumulator, temp1);
-    accumulator = _mm_add_pd(accumulator, temp2);
-    accumulator = _mm_add_pd(accumulator, temp3);
-    _mm_store_pd(&m_matrix[0][2], accumulator);
-
-    // Second row.
-    otherMatrixFirstParam = _mm_set1_pd(mat.m_matrix[1][0]);
-    otherMatrixSecondParam = _mm_set1_pd(mat.m_matrix[1][1]);
-    otherMatrixThirdParam = _mm_set1_pd(mat.m_matrix[1][2]);
-    otherMatrixFourthParam = _mm_set1_pd(mat.m_matrix[1][3]);
-
-    // output10 and output11.
-    accumulator = _mm_mul_pd(matrixBlockA, otherMatrixFirstParam);
-    temp1 = _mm_mul_pd(matrixBlockC, otherMatrixSecondParam);
-    temp2 = _mm_mul_pd(matrixBlockE, otherMatrixThirdParam);
-    temp3 = _mm_mul_pd(matrixBlockG, otherMatrixFourthParam);
-
-    accumulator = _mm_add_pd(accumulator, temp1);
-    accumulator = _mm_add_pd(accumulator, temp2);
-    accumulator = _mm_add_pd(accumulator, temp3);
-    _mm_store_pd(&m_matrix[1][0], accumulator);
-
-    // output12 and output13.
-    accumulator = _mm_mul_pd(matrixBlockB, otherMatrixFirstParam);
-    temp1 = _mm_mul_pd(matrixBlockD, otherMatrixSecondParam);
-    temp2 = _mm_mul_pd(matrixBlockF, otherMatrixThirdParam);
-    temp3 = _mm_mul_pd(matrixBlockH, otherMatrixFourthParam);
-
-    accumulator = _mm_add_pd(accumulator, temp1);
-    accumulator = _mm_add_pd(accumulator, temp2);
-    accumulator = _mm_add_pd(accumulator, temp3);
-    _mm_store_pd(&m_matrix[1][2], accumulator);
-
-    // Third row.
-    otherMatrixFirstParam = _mm_set1_pd(mat.m_matrix[2][0]);
-    otherMatrixSecondParam = _mm_set1_pd(mat.m_matrix[2][1]);
-    otherMatrixThirdParam = _mm_set1_pd(mat.m_matrix[2][2]);
-    otherMatrixFourthParam = _mm_set1_pd(mat.m_matrix[2][3]);
-
-    // output20 and output21.
-    accumulator = _mm_mul_pd(matrixBlockA, otherMatrixFirstParam);
-    temp1 = _mm_mul_pd(matrixBlockC, otherMatrixSecondParam);
-    temp2 = _mm_mul_pd(matrixBlockE, otherMatrixThirdParam);
-    temp3 = _mm_mul_pd(matrixBlockG, otherMatrixFourthParam);
-
-    accumulator = _mm_add_pd(accumulator, temp1);
-    accumulator = _mm_add_pd(accumulator, temp2);
-    accumulator = _mm_add_pd(accumulator, temp3);
-    _mm_store_pd(&m_matrix[2][0], accumulator);
-
-    // output22 and output23.
-    accumulator = _mm_mul_pd(matrixBlockB, otherMatrixFirstParam);
-    temp1 = _mm_mul_pd(matrixBlockD, otherMatrixSecondParam);
-    temp2 = _mm_mul_pd(matrixBlockF, otherMatrixThirdParam);
-    temp3 = _mm_mul_pd(matrixBlockH, otherMatrixFourthParam);
-
-    accumulator = _mm_add_pd(accumulator, temp1);
-    accumulator = _mm_add_pd(accumulator, temp2);
-    accumulator = _mm_add_pd(accumulator, temp3);
-    _mm_store_pd(&m_matrix[2][2], accumulator);
-
-    // Fourth row.
-    otherMatrixFirstParam = _mm_set1_pd(mat.m_matrix[3][0]);
-    otherMatrixSecondParam = _mm_set1_pd(mat.m_matrix[3][1]);
-    otherMatrixThirdParam = _mm_set1_pd(mat.m_matrix[3][2]);
-    otherMatrixFourthParam = _mm_set1_pd(mat.m_matrix[3][3]);
-
-    // output30 and output31.
-    accumulator = _mm_mul_pd(matrixBlockA, otherMatrixFirstParam);
-    temp1 = _mm_mul_pd(matrixBlockC, otherMatrixSecondParam);
-    temp2 = _mm_mul_pd(matrixBlockE, otherMatrixThirdParam);
-    temp3 = _mm_mul_pd(matrixBlockG, otherMatrixFourthParam);
-
-    accumulator = _mm_add_pd(accumulator, temp1);
-    accumulator = _mm_add_pd(accumulator, temp2);
-    accumulator = _mm_add_pd(accumulator, temp3);
-    _mm_store_pd(&m_matrix[3][0], accumulator);
-
-    // output32 and output33.
-    accumulator = _mm_mul_pd(matrixBlockB, otherMatrixFirstParam);
-    temp1 = _mm_mul_pd(matrixBlockD, otherMatrixSecondParam);
-    temp2 = _mm_mul_pd(matrixBlockF, otherMatrixThirdParam);
-    temp3 = _mm_mul_pd(matrixBlockH, otherMatrixFourthParam);
-
-    accumulator = _mm_add_pd(accumulator, temp1);
-    accumulator = _mm_add_pd(accumulator, temp2);
-    accumulator = _mm_add_pd(accumulator, temp3);
-    _mm_store_pd(&m_matrix[3][2], accumulator);
-#else
-    Matrix4 tmp;
-
-    tmp[0][0] = (mat.m_matrix[0][0] * m_matrix[0][0] + mat.m_matrix[0][1] * m_matrix[1][0]
-               + mat.m_matrix[0][2] * m_matrix[2][0] + mat.m_matrix[0][3] * m_matrix[3][0]);
-    tmp[0][1] = (mat.m_matrix[0][0] * m_matrix[0][1] + mat.m_matrix[0][1] * m_matrix[1][1]
-               + mat.m_matrix[0][2] * m_matrix[2][1] + mat.m_matrix[0][3] * m_matrix[3][1]);
-    tmp[0][2] = (mat.m_matrix[0][0] * m_matrix[0][2] + mat.m_matrix[0][1] * m_matrix[1][2]
-               + mat.m_matrix[0][2] * m_matrix[2][2] + mat.m_matrix[0][3] * m_matrix[3][2]);
-    tmp[0][3] = (mat.m_matrix[0][0] * m_matrix[0][3] + mat.m_matrix[0][1] * m_matrix[1][3]
-               + mat.m_matrix[0][2] * m_matrix[2][3] + mat.m_matrix[0][3] * m_matrix[3][3]);
-
-    tmp[1][0] = (mat.m_matrix[1][0] * m_matrix[0][0] + mat.m_matrix[1][1] * m_matrix[1][0]
-               + mat.m_matrix[1][2] * m_matrix[2][0] + mat.m_matrix[1][3] * m_matrix[3][0]);
-    tmp[1][1] = (mat.m_matrix[1][0] * m_matrix[0][1] + mat.m_matrix[1][1] * m_matrix[1][1]
-               + mat.m_matrix[1][2] * m_matrix[2][1] + mat.m_matrix[1][3] * m_matrix[3][1]);
-    tmp[1][2] = (mat.m_matrix[1][0] * m_matrix[0][2] + mat.m_matrix[1][1] * m_matrix[1][2]
-               + mat.m_matrix[1][2] * m_matrix[2][2] + mat.m_matrix[1][3] * m_matrix[3][2]);
-    tmp[1][3] = (mat.m_matrix[1][0] * m_matrix[0][3] + mat.m_matrix[1][1] * m_matrix[1][3]
-               + mat.m_matrix[1][2] * m_matrix[2][3] + mat.m_matrix[1][3] * m_matrix[3][3]);
-
-    tmp[2][0] = (mat.m_matrix[2][0] * m_matrix[0][0] + mat.m_matrix[2][1] * m_matrix[1][0]
-               + mat.m_matrix[2][2] * m_matrix[2][0] + mat.m_matrix[2][3] * m_matrix[3][0]);
-    tmp[2][1] = (mat.m_matrix[2][0] * m_matrix[0][1] + mat.m_matrix[2][1] * m_matrix[1][1]
-               + mat.m_matrix[2][2] * m_matrix[2][1] + mat.m_matrix[2][3] * m_matrix[3][1]);
-    tmp[2][2] = (mat.m_matrix[2][0] * m_matrix[0][2] + mat.m_matrix[2][1] * m_matrix[1][2]
-               + mat.m_matrix[2][2] * m_matrix[2][2] + mat.m_matrix[2][3] * m_matrix[3][2]);
-    tmp[2][3] = (mat.m_matrix[2][0] * m_matrix[0][3] + mat.m_matrix[2][1] * m_matrix[1][3]
-               + mat.m_matrix[2][2] * m_matrix[2][3] + mat.m_matrix[2][3] * m_matrix[3][3]);
-
-    tmp[3][0] = (mat.m_matrix[3][0] * m_matrix[0][0] + mat.m_matrix[3][1] * m_matrix[1][0]
-               + mat.m_matrix[3][2] * m_matrix[2][0] + mat.m_matrix[3][3] * m_matrix[3][0]);
-    tmp[3][1] = (mat.m_matrix[3][0] * m_matrix[0][1] + mat.m_matrix[3][1] * m_matrix[1][1]
-               + mat.m_matrix[3][2] * m_matrix[2][1] + mat.m_matrix[3][3] * m_matrix[3][1]);
-    tmp[3][2] = (mat.m_matrix[3][0] * m_matrix[0][2] + mat.m_matrix[3][1] * m_matrix[1][2]
-               + mat.m_matrix[3][2] * m_matrix[2][2] + mat.m_matrix[3][3] * m_matrix[3][2]);
-    tmp[3][3] = (mat.m_matrix[3][0] * m_matrix[0][3] + mat.m_matrix[3][1] * m_matrix[1][3]
-               + mat.m_matrix[3][2] * m_matrix[2][3] + mat.m_matrix[3][3] * m_matrix[3][3]);
-
-    setMatrix(tmp);
-#endif
-    return *this;
-}
-
-void TransformationMatrix::multVecMatrix(double x, double y, double& resultX, double& resultY) const
-{
-    resultX = m_matrix[3][0] + x * m_matrix[0][0] + y * m_matrix[1][0];
-    resultY = m_matrix[3][1] + x * m_matrix[0][1] + y * m_matrix[1][1];
-    double w = m_matrix[3][3] + x * m_matrix[0][3] + y * m_matrix[1][3];
-    if (w != 1 && w != 0) {
-        resultX /= w;
-        resultY /= w;
-    }
-}
-
-void TransformationMatrix::multVecMatrix(double x, double y, double z, double& resultX, double& resultY, double& resultZ) const
-{
-    resultX = m_matrix[3][0] + x * m_matrix[0][0] + y * m_matrix[1][0] + z * m_matrix[2][0];
-    resultY = m_matrix[3][1] + x * m_matrix[0][1] + y * m_matrix[1][1] + z * m_matrix[2][1];
-    resultZ = m_matrix[3][2] + x * m_matrix[0][2] + y * m_matrix[1][2] + z * m_matrix[2][2];
-    double w = m_matrix[3][3] + x * m_matrix[0][3] + y * m_matrix[1][3] + z * m_matrix[2][3];
-    if (w != 1 && w != 0) {
-        resultX /= w;
-        resultY /= w;
-        resultZ /= w;
-    }
-}
-
-bool TransformationMatrix::isInvertible() const
-{
-    if (isIdentityOrTranslation())
-        return true;
-
-    double det = WebCore::determinant4x4(m_matrix);
-
-    if (fabs(det) < SMALL_NUMBER)
-        return false;
-
-    return true;
-}
-
-TransformationMatrix TransformationMatrix::inverse() const
-{
-    if (isIdentityOrTranslation()) {
-        // identity matrix
-        if (m_matrix[3][0] == 0 && m_matrix[3][1] == 0 && m_matrix[3][2] == 0)
-            return TransformationMatrix();
-
-        // translation
-        return TransformationMatrix(1, 0, 0, 0,
-                                    0, 1, 0, 0,
-                                    0, 0, 1, 0,
-                                    -m_matrix[3][0], -m_matrix[3][1], -m_matrix[3][2], 1);
-    }
-
-    TransformationMatrix invMat;
-    bool inverted = WebCore::inverse(m_matrix, invMat.m_matrix);
-    if (!inverted)
-        return TransformationMatrix();
-
-    return invMat;
-}
-
-void TransformationMatrix::makeAffine()
-{
-    m_matrix[0][2] = 0;
-    m_matrix[0][3] = 0;
-
-    m_matrix[1][2] = 0;
-    m_matrix[1][3] = 0;
-
-    m_matrix[2][0] = 0;
-    m_matrix[2][1] = 0;
-    m_matrix[2][2] = 1;
-    m_matrix[2][3] = 0;
-
-    m_matrix[3][2] = 0;
-    m_matrix[3][3] = 1;
-}
-
-AffineTransform TransformationMatrix::toAffineTransform() const
-{
-    return AffineTransform(m_matrix[0][0], m_matrix[0][1], m_matrix[1][0],
-                           m_matrix[1][1], m_matrix[3][0], m_matrix[3][1]);
-}
-
-TransformationMatrix::operator SkMatrix() const
-{
-    SkMatrix result;
-
-    result.setScaleX(WebCoreDoubleToSkScalar(a()));
-    result.setSkewX(WebCoreDoubleToSkScalar(c()));
-    result.setTranslateX(WebCoreDoubleToSkScalar(e()));
-
-    result.setScaleY(WebCoreDoubleToSkScalar(d()));
-    result.setSkewY(WebCoreDoubleToSkScalar(b()));
-    result.setTranslateY(WebCoreDoubleToSkScalar(f()));
-
-    // FIXME: Set perspective properly.
-    result.setPerspX(0);
-    result.setPerspY(0);
-    result.set(SkMatrix::kMPersp2, SK_Scalar1);
-
-    return result;
-}
-
-static inline void blendFloat(double& from, double to, double progress)
-{
-    if (from != to)
-        from = from + (to - from) * progress;
-}
-
-void TransformationMatrix::blend(const TransformationMatrix& from, double progress)
-{
-    if (from.isIdentity() && isIdentity())
-        return;
-
-    // decompose
-    DecomposedType fromDecomp;
-    DecomposedType toDecomp;
-    from.decompose(fromDecomp);
-    decompose(toDecomp);
-
-    // interpolate
-    blendFloat(fromDecomp.scaleX, toDecomp.scaleX, progress);
-    blendFloat(fromDecomp.scaleY, toDecomp.scaleY, progress);
-    blendFloat(fromDecomp.scaleZ, toDecomp.scaleZ, progress);
-    blendFloat(fromDecomp.skewXY, toDecomp.skewXY, progress);
-    blendFloat(fromDecomp.skewXZ, toDecomp.skewXZ, progress);
-    blendFloat(fromDecomp.skewYZ, toDecomp.skewYZ, progress);
-    blendFloat(fromDecomp.translateX, toDecomp.translateX, progress);
-    blendFloat(fromDecomp.translateY, toDecomp.translateY, progress);
-    blendFloat(fromDecomp.translateZ, toDecomp.translateZ, progress);
-    blendFloat(fromDecomp.perspectiveX, toDecomp.perspectiveX, progress);
-    blendFloat(fromDecomp.perspectiveY, toDecomp.perspectiveY, progress);
-    blendFloat(fromDecomp.perspectiveZ, toDecomp.perspectiveZ, progress);
-    blendFloat(fromDecomp.perspectiveW, toDecomp.perspectiveW, progress);
-
-    slerp(&fromDecomp.quaternionX, &toDecomp.quaternionX, progress);
-
-    // recompose
-    recompose(fromDecomp);
-}
-
-bool TransformationMatrix::decompose(DecomposedType& decomp) const
-{
-    if (isIdentity()) {
-        memset(&decomp, 0, sizeof(decomp));
-        decomp.perspectiveW = 1;
-        decomp.scaleX = 1;
-        decomp.scaleY = 1;
-        decomp.scaleZ = 1;
-    }
-
-    if (!WebCore::decompose(m_matrix, decomp))
-        return false;
-    return true;
-}
-
-void TransformationMatrix::recompose(const DecomposedType& decomp)
-{
-    makeIdentity();
-
-    // first apply perspective
-    m_matrix[0][3] = decomp.perspectiveX;
-    m_matrix[1][3] = decomp.perspectiveY;
-    m_matrix[2][3] = decomp.perspectiveZ;
-    m_matrix[3][3] = decomp.perspectiveW;
-
-    // now translate
-    translate3d(decomp.translateX, decomp.translateY, decomp.translateZ);
-
-    // apply rotation
-    double xx = decomp.quaternionX * decomp.quaternionX;
-    double xy = decomp.quaternionX * decomp.quaternionY;
-    double xz = decomp.quaternionX * decomp.quaternionZ;
-    double xw = decomp.quaternionX * decomp.quaternionW;
-    double yy = decomp.quaternionY * decomp.quaternionY;
-    double yz = decomp.quaternionY * decomp.quaternionZ;
-    double yw = decomp.quaternionY * decomp.quaternionW;
-    double zz = decomp.quaternionZ * decomp.quaternionZ;
-    double zw = decomp.quaternionZ * decomp.quaternionW;
-
-    // Construct a composite rotation matrix from the quaternion values
-    TransformationMatrix rotationMatrix(1 - 2 * (yy + zz), 2 * (xy - zw), 2 * (xz + yw), 0,
-                           2 * (xy + zw), 1 - 2 * (xx + zz), 2 * (yz - xw), 0,
-                           2 * (xz - yw), 2 * (yz + xw), 1 - 2 * (xx + yy), 0,
-                           0, 0, 0, 1);
-
-    multiply(rotationMatrix);
-
-    // now apply skew
-    if (decomp.skewYZ) {
-        TransformationMatrix tmp;
-        tmp.setM32(decomp.skewYZ);
-        multiply(tmp);
-    }
-
-    if (decomp.skewXZ) {
-        TransformationMatrix tmp;
-        tmp.setM31(decomp.skewXZ);
-        multiply(tmp);
-    }
-
-    if (decomp.skewXY) {
-        TransformationMatrix tmp;
-        tmp.setM21(decomp.skewXY);
-        multiply(tmp);
-    }
-
-    // finally, apply scale
-    scale3d(decomp.scaleX, decomp.scaleY, decomp.scaleZ);
-}
-
-bool TransformationMatrix::isIntegerTranslation() const
-{
-    if (!isIdentityOrTranslation())
-        return false;
-
-    // Check for translate Z.
-    if (m_matrix[3][2])
-        return false;
-
-    // Check for non-integer translate X/Y.
-    if (static_cast<int>(m_matrix[3][0]) != m_matrix[3][0] || static_cast<int>(m_matrix[3][1]) != m_matrix[3][1])
-        return false;
-
-    return true;
-}
-
-TransformationMatrix TransformationMatrix::to2dTransform() const
-{
-    return TransformationMatrix(m_matrix[0][0], m_matrix[0][1], 0, m_matrix[0][3],
-                                m_matrix[1][0], m_matrix[1][1], 0, m_matrix[1][3],
-                                0, 0, 1, 0,
-                                m_matrix[3][0], m_matrix[3][1], 0, m_matrix[3][3]);
-}
-
-void TransformationMatrix::toColumnMajorFloatArray(FloatMatrix4& result) const
-{
-    result[0] = m11();
-    result[1] = m12();
-    result[2] = m13();
-    result[3] = m14();
-    result[4] = m21();
-    result[5] = m22();
-    result[6] = m23();
-    result[7] = m24();
-    result[8] = m31();
-    result[9] = m32();
-    result[10] = m33();
-    result[11] = m34();
-    result[12] = m41();
-    result[13] = m42();
-    result[14] = m43();
-    result[15] = m44();
-}
-
-bool TransformationMatrix::isBackFaceVisible() const
-{
-    // Back-face visibility is determined by transforming the normal vector (0, 0, 1) and
-    // checking the sign of the resulting z component. However, normals cannot be
-    // transformed by the original matrix, they require being transformed by the
-    // inverse-transpose.
-    //
-    // Since we know we will be using (0, 0, 1), and we only care about the z-component of
-    // the transformed normal, then we only need the m33() element of the
-    // inverse-transpose. Therefore we do not need the transpose.
-    //
-    // Additionally, if we only need the m33() element, we do not need to compute a full
-    // inverse. Instead, knowing the inverse of a matrix is adjoint(matrix) / determinant,
-    // we can simply compute the m33() of the adjoint (adjugate) matrix, without computing
-    // the full adjoint.
-
-    double determinant = WebCore::determinant4x4(m_matrix);
-
-    // If the matrix is not invertible, then we assume its backface is not visible.
-    if (fabs(determinant) < SMALL_NUMBER)
-        return false;
-
-    double cofactor33 = determinant3x3(m11(), m12(), m14(), m21(), m22(), m24(), m41(), m42(), m44());
-    double zComponentOfTransformedNormal = cofactor33 / determinant;
-
-    return zComponentOfTransformedNormal < 0;
-}
-
-}
diff --git a/Source/core/platform/graphics/transforms/TransformationMatrix.h b/Source/core/platform/graphics/transforms/TransformationMatrix.h
deleted file mode 100644
index c28546b..0000000
--- a/Source/core/platform/graphics/transforms/TransformationMatrix.h
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Copyright (C) 2005, 2006 Apple Computer, 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,
- * 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 TransformationMatrix_h
-#define TransformationMatrix_h
-
-#include <SkMatrix.h>
-#include <string.h> //for memcpy
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatPoint3D.h"
-#include "core/platform/graphics/IntPoint.h"
-#include "wtf/CPU.h"
-#include "wtf/FastAllocBase.h"
-
-namespace WebCore {
-
-class AffineTransform;
-class IntRect;
-class LayoutRect;
-class FloatRect;
-class FloatQuad;
-
-#if CPU(X86_64)
-#define TRANSFORMATION_MATRIX_USE_X86_64_SSE2
-#endif
-
-class TransformationMatrix {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-
-#if CPU(APPLE_ARMV7S) || defined(TRANSFORMATION_MATRIX_USE_X86_64_SSE2)
-#if COMPILER(MSVC)
-    __declspec(align(16)) typedef double Matrix4[4][4];
-#else
-    typedef double Matrix4[4][4] __attribute__((aligned (16)));
-#endif
-#else
-    typedef double Matrix4[4][4];
-#endif
-
-    TransformationMatrix() { makeIdentity(); }
-    TransformationMatrix(const AffineTransform& t);
-    TransformationMatrix(const TransformationMatrix& t) { *this = t; }
-    TransformationMatrix(double a, double b, double c, double d, double e, double f) { setMatrix(a, b, c, d, e, f); }
-    TransformationMatrix(double m11, double m12, double m13, double m14,
-                         double m21, double m22, double m23, double m24,
-                         double m31, double m32, double m33, double m34,
-                         double m41, double m42, double m43, double m44)
-    {
-        setMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
-    }
-
-    void setMatrix(double a, double b, double c, double d, double e, double f)
-    {
-        m_matrix[0][0] = a; m_matrix[0][1] = b; m_matrix[0][2] = 0; m_matrix[0][3] = 0;
-        m_matrix[1][0] = c; m_matrix[1][1] = d; m_matrix[1][2] = 0; m_matrix[1][3] = 0;
-        m_matrix[2][0] = 0; m_matrix[2][1] = 0; m_matrix[2][2] = 1; m_matrix[2][3] = 0;
-        m_matrix[3][0] = e; m_matrix[3][1] = f; m_matrix[3][2] = 0; m_matrix[3][3] = 1;
-    }
-
-    void setMatrix(double m11, double m12, double m13, double m14,
-                   double m21, double m22, double m23, double m24,
-                   double m31, double m32, double m33, double m34,
-                   double m41, double m42, double m43, double m44)
-    {
-        m_matrix[0][0] = m11; m_matrix[0][1] = m12; m_matrix[0][2] = m13; m_matrix[0][3] = m14;
-        m_matrix[1][0] = m21; m_matrix[1][1] = m22; m_matrix[1][2] = m23; m_matrix[1][3] = m24;
-        m_matrix[2][0] = m31; m_matrix[2][1] = m32; m_matrix[2][2] = m33; m_matrix[2][3] = m34;
-        m_matrix[3][0] = m41; m_matrix[3][1] = m42; m_matrix[3][2] = m43; m_matrix[3][3] = m44;
-    }
-
-    TransformationMatrix& operator =(const TransformationMatrix &t)
-    {
-        setMatrix(t.m_matrix);
-        return *this;
-    }
-
-    TransformationMatrix& makeIdentity()
-    {
-        setMatrix(1, 0, 0, 0,  0, 1, 0, 0,  0, 0, 1, 0,  0, 0, 0, 1);
-        return *this;
-    }
-
-    bool isIdentity() const
-    {
-        return m_matrix[0][0] == 1 && m_matrix[0][1] == 0 && m_matrix[0][2] == 0 && m_matrix[0][3] == 0 &&
-               m_matrix[1][0] == 0 && m_matrix[1][1] == 1 && m_matrix[1][2] == 0 && m_matrix[1][3] == 0 &&
-               m_matrix[2][0] == 0 && m_matrix[2][1] == 0 && m_matrix[2][2] == 1 && m_matrix[2][3] == 0 &&
-               m_matrix[3][0] == 0 && m_matrix[3][1] == 0 && m_matrix[3][2] == 0 && m_matrix[3][3] == 1;
-    }
-
-    // This form preserves the double math from input to output
-    void map(double x, double y, double& x2, double& y2) const { multVecMatrix(x, y, x2, y2); }
-
-    // Map a 3D point through the transform, returning a 3D point.
-    FloatPoint3D mapPoint(const FloatPoint3D&) const;
-
-    // Map a 2D point through the transform, returning a 2D point.
-    // Note that this ignores the z component, effectively projecting the point into the z=0 plane.
-    FloatPoint mapPoint(const FloatPoint&) const;
-
-    // Like the version above, except that it rounds the mapped point to the nearest integer value.
-    IntPoint mapPoint(const IntPoint& p) const
-    {
-        return roundedIntPoint(mapPoint(FloatPoint(p)));
-    }
-
-    // If the matrix has 3D components, the z component of the result is
-    // dropped, effectively projecting the rect into the z=0 plane
-    FloatRect mapRect(const FloatRect&) const;
-
-    // Rounds the resulting mapped rectangle out. This is helpful for bounding
-    // box computations but may not be what is wanted in other contexts.
-    IntRect mapRect(const IntRect&) const;
-    LayoutRect mapRect(const LayoutRect&) const;
-
-    // If the matrix has 3D components, the z component of the result is
-    // dropped, effectively projecting the quad into the z=0 plane
-    FloatQuad mapQuad(const FloatQuad&) const;
-
-    // Map a point on the z=0 plane into a point on
-    // the plane with with the transform applied, by extending
-    // a ray perpendicular to the source plane and computing
-    // the local x,y position of the point where that ray intersects
-    // with the destination plane.
-    FloatPoint projectPoint(const FloatPoint&, bool* clamped = 0) const;
-    // Projects the four corners of the quad
-    FloatQuad projectQuad(const FloatQuad&,  bool* clamped = 0) const;
-    // Projects the four corners of the quad and takes a bounding box,
-    // while sanitizing values created when the w component is negative.
-    LayoutRect clampedBoundsOfProjectedQuad(const FloatQuad&) const;
-
-    double m11() const { return m_matrix[0][0]; }
-    void setM11(double f) { m_matrix[0][0] = f; }
-    double m12() const { return m_matrix[0][1]; }
-    void setM12(double f) { m_matrix[0][1] = f; }
-    double m13() const { return m_matrix[0][2]; }
-    void setM13(double f) { m_matrix[0][2] = f; }
-    double m14() const { return m_matrix[0][3]; }
-    void setM14(double f) { m_matrix[0][3] = f; }
-    double m21() const { return m_matrix[1][0]; }
-    void setM21(double f) { m_matrix[1][0] = f; }
-    double m22() const { return m_matrix[1][1]; }
-    void setM22(double f) { m_matrix[1][1] = f; }
-    double m23() const { return m_matrix[1][2]; }
-    void setM23(double f) { m_matrix[1][2] = f; }
-    double m24() const { return m_matrix[1][3]; }
-    void setM24(double f) { m_matrix[1][3] = f; }
-    double m31() const { return m_matrix[2][0]; }
-    void setM31(double f) { m_matrix[2][0] = f; }
-    double m32() const { return m_matrix[2][1]; }
-    void setM32(double f) { m_matrix[2][1] = f; }
-    double m33() const { return m_matrix[2][2]; }
-    void setM33(double f) { m_matrix[2][2] = f; }
-    double m34() const { return m_matrix[2][3]; }
-    void setM34(double f) { m_matrix[2][3] = f; }
-    double m41() const { return m_matrix[3][0]; }
-    void setM41(double f) { m_matrix[3][0] = f; }
-    double m42() const { return m_matrix[3][1]; }
-    void setM42(double f) { m_matrix[3][1] = f; }
-    double m43() const { return m_matrix[3][2]; }
-    void setM43(double f) { m_matrix[3][2] = f; }
-    double m44() const { return m_matrix[3][3]; }
-    void setM44(double f) { m_matrix[3][3] = f; }
-
-    double a() const { return m_matrix[0][0]; }
-    void setA(double a) { m_matrix[0][0] = a; }
-
-    double b() const { return m_matrix[0][1]; }
-    void setB(double b) { m_matrix[0][1] = b; }
-
-    double c() const { return m_matrix[1][0]; }
-    void setC(double c) { m_matrix[1][0] = c; }
-
-    double d() const { return m_matrix[1][1]; }
-    void setD(double d) { m_matrix[1][1] = d; }
-
-    double e() const { return m_matrix[3][0]; }
-    void setE(double e) { m_matrix[3][0] = e; }
-
-    double f() const { return m_matrix[3][1]; }
-    void setF(double f) { m_matrix[3][1] = f; }
-
-    // this = mat * this.
-    TransformationMatrix& multiply(const TransformationMatrix&);
-
-    TransformationMatrix& scale(double);
-    TransformationMatrix& scaleNonUniform(double sx, double sy);
-    TransformationMatrix& scale3d(double sx, double sy, double sz);
-
-    TransformationMatrix& rotate(double d) { return rotate3d(0, 0, d); }
-    TransformationMatrix& rotateFromVector(double x, double y);
-    TransformationMatrix& rotate3d(double rx, double ry, double rz);
-
-    // The vector (x,y,z) is normalized if it's not already. A vector of
-    // (0,0,0) uses a vector of (0,0,1).
-    TransformationMatrix& rotate3d(double x, double y, double z, double angle);
-
-    TransformationMatrix& translate(double tx, double ty);
-    TransformationMatrix& translate3d(double tx, double ty, double tz);
-
-    // translation added with a post-multiply
-    TransformationMatrix& translateRight(double tx, double ty);
-    TransformationMatrix& translateRight3d(double tx, double ty, double tz);
-
-    TransformationMatrix& flipX();
-    TransformationMatrix& flipY();
-    TransformationMatrix& skew(double angleX, double angleY);
-    TransformationMatrix& skewX(double angle) { return skew(angle, 0); }
-    TransformationMatrix& skewY(double angle) { return skew(0, angle); }
-
-    TransformationMatrix& applyPerspective(double p);
-    bool hasPerspective() const { return m_matrix[2][3] != 0.0f; }
-
-    // returns a transformation that maps a rect to a rect
-    static TransformationMatrix rectToRect(const FloatRect&, const FloatRect&);
-
-    bool isInvertible() const;
-
-    // This method returns the identity matrix if it is not invertible.
-    // Use isInvertible() before calling this if you need to know.
-    TransformationMatrix inverse() const;
-
-    // decompose the matrix into its component parts
-    typedef struct {
-        double scaleX, scaleY, scaleZ;
-        double skewXY, skewXZ, skewYZ;
-        double quaternionX, quaternionY, quaternionZ, quaternionW;
-        double translateX, translateY, translateZ;
-        double perspectiveX, perspectiveY, perspectiveZ, perspectiveW;
-    } DecomposedType;
-
-    bool decompose(DecomposedType& decomp) const;
-    void recompose(const DecomposedType& decomp);
-
-    void blend(const TransformationMatrix& from, double progress);
-
-    bool isAffine() const
-    {
-        return (m13() == 0 && m14() == 0 && m23() == 0 && m24() == 0 &&
-                m31() == 0 && m32() == 0 && m33() == 1 && m34() == 0 && m43() == 0 && m44() == 1);
-    }
-
-    // Throw away the non-affine parts of the matrix (lossy!)
-    void makeAffine();
-
-    AffineTransform toAffineTransform() const;
-
-    bool operator==(const TransformationMatrix& m2) const
-    {
-        return (m_matrix[0][0] == m2.m_matrix[0][0] &&
-                m_matrix[0][1] == m2.m_matrix[0][1] &&
-                m_matrix[0][2] == m2.m_matrix[0][2] &&
-                m_matrix[0][3] == m2.m_matrix[0][3] &&
-                m_matrix[1][0] == m2.m_matrix[1][0] &&
-                m_matrix[1][1] == m2.m_matrix[1][1] &&
-                m_matrix[1][2] == m2.m_matrix[1][2] &&
-                m_matrix[1][3] == m2.m_matrix[1][3] &&
-                m_matrix[2][0] == m2.m_matrix[2][0] &&
-                m_matrix[2][1] == m2.m_matrix[2][1] &&
-                m_matrix[2][2] == m2.m_matrix[2][2] &&
-                m_matrix[2][3] == m2.m_matrix[2][3] &&
-                m_matrix[3][0] == m2.m_matrix[3][0] &&
-                m_matrix[3][1] == m2.m_matrix[3][1] &&
-                m_matrix[3][2] == m2.m_matrix[3][2] &&
-                m_matrix[3][3] == m2.m_matrix[3][3]);
-    }
-
-    bool operator!=(const TransformationMatrix& other) const { return !(*this == other); }
-
-    // *this = *this * t
-    TransformationMatrix& operator*=(const TransformationMatrix& t)
-    {
-        return multiply(t);
-    }
-
-    // result = *this * t
-    TransformationMatrix operator*(const TransformationMatrix& t) const
-    {
-        TransformationMatrix result = *this;
-        result.multiply(t);
-        return result;
-    }
-
-    operator SkMatrix() const;
-
-    bool isIdentityOrTranslation() const
-    {
-        return m_matrix[0][0] == 1 && m_matrix[0][1] == 0 && m_matrix[0][2] == 0 && m_matrix[0][3] == 0
-            && m_matrix[1][0] == 0 && m_matrix[1][1] == 1 && m_matrix[1][2] == 0 && m_matrix[1][3] == 0
-            && m_matrix[2][0] == 0 && m_matrix[2][1] == 0 && m_matrix[2][2] == 1 && m_matrix[2][3] == 0
-            && m_matrix[3][3] == 1;
-    }
-
-    bool isIntegerTranslation() const;
-
-    // This method returns the matrix without 3D components.
-    TransformationMatrix to2dTransform() const;
-
-    typedef float FloatMatrix4[16];
-    void toColumnMajorFloatArray(FloatMatrix4& result) const;
-
-    // A local-space layer is implicitly defined at the z = 0 plane, with its front side
-    // facing the positive z-axis (i.e. a camera looking along the negative z-axis sees
-    // the front side of the layer). This function checks if the transformed layer's back
-    // face would be visible to a camera looking along the negative z-axis in the target space.
-    bool isBackFaceVisible() const;
-
-private:
-    // multiply passed 2D point by matrix (assume z=0)
-    void multVecMatrix(double x, double y, double& dstX, double& dstY) const;
-    FloatPoint internalMapPoint(const FloatPoint& sourcePoint) const
-    {
-        double resultX;
-        double resultY;
-        multVecMatrix(sourcePoint.x(), sourcePoint.y(), resultX, resultY);
-        return FloatPoint(static_cast<float>(resultX), static_cast<float>(resultY));
-    }
-
-    // multiply passed 3D point by matrix
-    void multVecMatrix(double x, double y, double z, double& dstX, double& dstY, double& dstZ) const;
-    FloatPoint3D internalMapPoint(const FloatPoint3D& sourcePoint) const
-    {
-        double resultX;
-        double resultY;
-        double resultZ;
-        multVecMatrix(sourcePoint.x(), sourcePoint.y(), sourcePoint.z(), resultX, resultY, resultZ);
-        return FloatPoint3D(static_cast<float>(resultX), static_cast<float>(resultY), static_cast<float>(resultZ));
-    }
-
-    void setMatrix(const Matrix4 m)
-    {
-        if (m && m != m_matrix)
-            memcpy(m_matrix, m, sizeof(Matrix4));
-    }
-
-    Matrix4 m_matrix;
-};
-
-} // namespace WebCore
-
-#endif // TransformationMatrix_h
diff --git a/Source/core/platform/graphics/transforms/TranslateTransformOperation.cpp b/Source/core/platform/graphics/transforms/TranslateTransformOperation.cpp
index ba53b87..1b98c22 100644
--- a/Source/core/platform/graphics/transforms/TranslateTransformOperation.cpp
+++ b/Source/core/platform/graphics/transforms/TranslateTransformOperation.cpp
@@ -31,13 +31,13 @@
 
     const Length zeroLength(0, Fixed);
     if (blendToIdentity)
-        return TranslateTransformOperation::create(zeroLength.blend(m_x, progress), zeroLength.blend(m_y, progress), zeroLength.blend(m_z, progress), m_type);
+        return TranslateTransformOperation::create(zeroLength.blend(m_x, progress, ValueRangeAll), zeroLength.blend(m_y, progress, ValueRangeAll), zeroLength.blend(m_z, progress, ValueRangeAll), m_type);
 
     const TranslateTransformOperation* fromOp = static_cast<const TranslateTransformOperation*>(from);
     Length fromX = fromOp ? fromOp->m_x : zeroLength;
     Length fromY = fromOp ? fromOp->m_y : zeroLength;
     Length fromZ = fromOp ? fromOp->m_z : zeroLength;
-    return TranslateTransformOperation::create(m_x.blend(fromX, progress), m_y.blend(fromY, progress), m_z.blend(fromZ, progress), m_type);
+    return TranslateTransformOperation::create(m_x.blend(fromX, progress, ValueRangeAll), m_y.blend(fromY, progress, ValueRangeAll), m_z.blend(fromZ, progress, ValueRangeAll), m_type);
 }
 
 } // namespace WebCore
diff --git a/Source/core/platform/graphics/win/FontCustomPlatformDataWin.cpp b/Source/core/platform/graphics/win/FontCustomPlatformDataWin.cpp
index 004b9e2..1a94b10 100644
--- a/Source/core/platform/graphics/win/FontCustomPlatformDataWin.cpp
+++ b/Source/core/platform/graphics/win/FontCustomPlatformDataWin.cpp
@@ -31,9 +31,9 @@
 #include "config.h"
 #include "core/platform/graphics/FontCustomPlatformData.h"
 
-#include "core/platform/LayoutTestSupport.h"
-#include "core/platform/NotImplemented.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/LayoutTestSupport.h"
+#include "platform/NotImplemented.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/FontPlatformData.h"
 #include "core/platform/graphics/opentype/OpenTypeSanitizer.h"
 #include "core/platform/graphics/opentype/OpenTypeUtilities.h"
@@ -73,7 +73,7 @@
         RemoveFontMemResourceEx(m_fontReference);
 }
 
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant)
+FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold, bool italic, FontOrientation orientation, FontWidthVariant)
 {
     ASSERT(m_fontReference);
 
@@ -90,7 +90,7 @@
 
     // FIXME: almost identical to FillLogFont in FontCacheWin.cpp.
     // Need to refactor.
-    logFont.lfHeight = -size;
+    logFont.lfHeight = -static_cast<int>(size);
     logFont.lfWidth = 0;
     logFont.lfEscapement = 0;
     logFont.lfOrientation = 0;
diff --git a/Source/core/platform/image-decoders/ImageDecoder.cpp b/Source/core/platform/image-decoders/ImageDecoder.cpp
index 7bae661..7b9938b 100644
--- a/Source/core/platform/image-decoders/ImageDecoder.cpp
+++ b/Source/core/platform/image-decoders/ImageDecoder.cpp
@@ -21,7 +21,7 @@
 #include "config.h"
 #include "core/platform/image-decoders/ImageDecoder.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/image-decoders/bmp/BMPImageDecoder.h"
 #include "core/platform/image-decoders/gif/GIFImageDecoder.h"
 #include "core/platform/image-decoders/ico/ICOImageDecoder.h"
diff --git a/Source/core/platform/image-decoders/ImageDecoder.h b/Source/core/platform/image-decoders/ImageDecoder.h
index 99f926c..43db16e 100644
--- a/Source/core/platform/image-decoders/ImageDecoder.h
+++ b/Source/core/platform/image-decoders/ImageDecoder.h
@@ -29,10 +29,10 @@
 
 #include "SkColorPriv.h"
 #include "core/platform/PlatformScreen.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/graphics/ImageSource.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/skia/NativeImageSkia.h"
+#include "platform/geometry/IntRect.h"
 #include "public/platform/Platform.h"
 #include "wtf/Assertions.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/platform/image-decoders/OWNERS b/Source/core/platform/image-decoders/OWNERS
deleted file mode 100644
index bf426d6..0000000
--- a/Source/core/platform/image-decoders/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-pkasting@chromium.org
diff --git a/Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp b/Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp
index 9a69d66..f9984a5 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp
+++ b/Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp
@@ -135,8 +135,7 @@
     return ImageDecoder::setFailed();
 }
 
-// FIXME: Can the intermediate |rowBuffer| be avoided?
-bool GIFImageDecoder::haveDecodedRow(size_t frameIndex, const Vector<unsigned char>& rowBuffer, size_t width, size_t rowNumber, unsigned repeatCount, bool writeTransparentPixels)
+bool GIFImageDecoder::haveDecodedRow(size_t frameIndex, GIFRow::const_iterator rowBegin, size_t width, size_t rowNumber, unsigned repeatCount, bool writeTransparentPixels)
 {
     const GIFFrameContext* frameContext = m_reader->frameContext(frameIndex);
     // The pixel data and coordinates supplied to us are relative to the frame's
@@ -149,7 +148,7 @@
     const int yBegin = frameContext->yOffset() + rowNumber;
     const int xEnd = std::min(static_cast<int>(frameContext->xOffset() + width), size().width());
     const int yEnd = std::min(static_cast<int>(frameContext->yOffset() + rowNumber + repeatCount), size().height());
-    if (rowBuffer.isEmpty() || (xBegin < 0) || (yBegin < 0) || (xEnd <= xBegin) || (yEnd <= yBegin))
+    if (!width || (xBegin < 0) || (yBegin < 0) || (xEnd <= xBegin) || (yEnd <= yBegin))
         return true;
 
     const GIFColorMap::Table& colorTable = frameContext->localColorMap().isDefined() ? frameContext->localColorMap().table() : m_reader->globalColorMap().table();
@@ -165,8 +164,7 @@
         return false;
 
     const size_t transparentPixel = frameContext->transparentPixel();
-    Vector<unsigned char>::const_iterator rowBegin = rowBuffer.begin();
-    Vector<unsigned char>::const_iterator rowEnd = rowBegin + (xEnd - xBegin);
+    GIFRow::const_iterator rowEnd = rowBegin + (xEnd - xBegin);
     ImageFrame::PixelData* currentAddress = buffer.getAddr(xBegin, yBegin);
 
     // We may or may not need to write transparent pixels to the buffer.
diff --git a/Source/core/platform/image-decoders/gif/GIFImageDecoder.h b/Source/core/platform/image-decoders/gif/GIFImageDecoder.h
index 5c946a2..27733fa 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageDecoder.h
+++ b/Source/core/platform/image-decoders/gif/GIFImageDecoder.h
@@ -31,6 +31,8 @@
 
 class GIFImageReader;
 
+typedef Vector<unsigned char> GIFRow;
+
 namespace WebCore {
 
     // This class decodes the GIF image format.
@@ -57,7 +59,7 @@
         virtual bool setFailed() OVERRIDE;
 
         // Callbacks from the GIF reader.
-        bool haveDecodedRow(size_t frameIndex, const Vector<unsigned char>& rowBuffer, size_t width, size_t rowNumber, unsigned repeatCount, bool writeTransparentPixels);
+        bool haveDecodedRow(size_t frameIndex, GIFRow::const_iterator rowBegin, size_t width, size_t rowNumber, unsigned repeatCount, bool writeTransparentPixels);
         bool frameComplete(size_t frameIndex);
 
         // For testing.
diff --git a/Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp b/Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp
index a38879b..9c89225 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp
+++ b/Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp
@@ -32,7 +32,7 @@
 
 #include "core/platform/image-decoders/gif/GIFImageDecoder.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebData.h"
 #include "public/platform/WebSize.h"
@@ -451,3 +451,46 @@
     EXPECT_EQ(ImageFrame::FrameComplete, firstFrame->status());
     EXPECT_EQ(baselineHashes[0], hashSkBitmap(firstFrame->getSkBitmap()));
 }
+
+// The first LZW codes in the image are invalid values that try to create a loop
+// in the dictionary. Decoding should fail, but not infinitely loop or corrupt memory.
+TEST(GIFImageDecoderTest, badInitialCode)
+{
+    RefPtr<SharedBuffer> testData = readFile("/Source/core/platform/image-decoders/testing/bad-initial-code.gif");
+    ASSERT_TRUE(testData.get());
+
+    OwnPtr<GIFImageDecoder> testDecoder(createDecoder());
+    testDecoder->setData(testData.get(), true);
+    EXPECT_EQ(1u, testDecoder->frameCount());
+    ASSERT_TRUE(testDecoder->frameBufferAtIndex(0));
+    EXPECT_TRUE(testDecoder->failed());
+}
+
+// The image has an invalid LZW code that exceeds dictionary size. Decoding should fail.
+TEST(GIFImageDecoderTest, badCode)
+{
+    RefPtr<SharedBuffer> testData = readFile("/Source/core/platform/image-decoders/testing/bad-code.gif");
+    ASSERT_TRUE(testData.get());
+
+    OwnPtr<GIFImageDecoder> testDecoder(createDecoder());
+    testDecoder->setData(testData.get(), true);
+    EXPECT_EQ(1u, testDecoder->frameCount());
+    ASSERT_TRUE(testDecoder->frameBufferAtIndex(0));
+    EXPECT_TRUE(testDecoder->failed());
+}
+
+TEST(GIFImageDecoderTest, invalidDisposalMethod)
+{
+    OwnPtr<GIFImageDecoder> decoder = createDecoder();
+
+    // The image has 2 frames, with disposal method 4 and 5, respectively.
+    RefPtr<SharedBuffer> data = readFile("/Source/web/tests/data/invalid-disposal-method.gif");
+    ASSERT_TRUE(data.get());
+    decoder->setData(data.get(), true);
+
+    EXPECT_EQ(2u, decoder->frameCount());
+    // Disposal method 4 is converted to ImageFrame::DisposeOverwritePrevious.
+    EXPECT_EQ(ImageFrame::DisposeOverwritePrevious, decoder->frameBufferAtIndex(0)->disposalMethod());
+    // Disposal method 5 is ignored.
+    EXPECT_EQ(ImageFrame::DisposeNotSpecified, decoder->frameBufferAtIndex(1)->disposalMethod());
+}
diff --git a/Source/core/platform/image-decoders/gif/GIFImageReader.cpp b/Source/core/platform/image-decoders/gif/GIFImageReader.cpp
index 7716ced..b933855 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageReader.cpp
+++ b/Source/core/platform/image-decoders/gif/GIFImageReader.cpp
@@ -98,7 +98,7 @@
 #define GETINT16(p)   ((p)[1]<<8|(p)[0])
 
 // Send the data to the display front-end.
-bool GIFLZWContext::outputRow()
+bool GIFLZWContext::outputRow(GIFRow::const_iterator rowBegin)
 {
     int drowStart = irow;
     int drowEnd = irow;
@@ -148,7 +148,7 @@
         return true;
 
     // CALLBACK: Let the client know we have decoded a row.
-    if (!m_client->haveDecodedRow(m_frameContext->frameId(), rowBuffer, m_frameContext->width(),
+    if (!m_client->haveDecodedRow(m_frameContext->frameId(), rowBegin, m_frameContext->width(),
         drowStart, drowEnd - drowStart + 1, m_frameContext->progressiveDisplay() && m_frameContext->interlaced() && ipass > 1))
         return false;
 
@@ -202,24 +202,12 @@
 // Otherwise, decoding failed; returns false in this case, which will always cause the GIFImageReader to set the "decode failed" flag.
 bool GIFLZWContext::doLZW(const unsigned char* block, size_t bytesInBlock)
 {
-    int code;
-    int incode;
-    const unsigned char *ch;
+    const size_t width = m_frameContext->width();
 
     if (rowIter == rowBuffer.end())
         return true;
 
-#define OUTPUT_ROW \
-    do { \
-        if (!outputRow()) \
-            return false; \
-        rowsRemaining--; \
-        rowIter = rowBuffer.begin(); \
-        if (!rowsRemaining) \
-            return true; \
-    } while (0)
-
-    for (ch = block; bytesInBlock-- > 0; ch++) {
+    for (const unsigned char* ch = block; bytesInBlock-- > 0; ch++) {
         // Feed the next byte into the decoder's 32-bit input buffer.
         datum += ((int) *ch) << bits;
         bits += 8;
@@ -227,7 +215,7 @@
         // Check for underflow of decoder's 32-bit input buffer.
         while (bits >= codesize) {
             // Get the leading variable-length symbol from the data stream.
-            code = datum & codemask;
+            int code = datum & codemask;
             datum >>= codesize;
             bits -= codesize;
 
@@ -248,66 +236,72 @@
                 return false;
             }
 
-            if (oldcode == -1) {
-                *rowIter++ = suffix[code];
-                if (rowIter == rowBuffer.end())
-                    OUTPUT_ROW;
-
-                firstchar = oldcode = code;
-                continue;
-            }
-
-            incode = code;
-            if (code >= avail) {
-                stack[stackp++] = firstchar;
+            const int tempCode = code;
+            unsigned short codeLength = 0;
+            if (code < avail) {
+                // This is a pre-existing code, so we already know what it
+                // encodes.
+                codeLength = suffixLength[code];
+                rowIter += codeLength;
+            } else if (code == avail && oldcode != -1) {
+                // This is a new code just being added to the dictionary.
+                // It must encode the contents of the previous code, plus
+                // the first character of the previous code again.
+                codeLength = suffixLength[oldcode] + 1;
+                rowIter += codeLength;
+                *--rowIter = firstchar;
                 code = oldcode;
-
-                if (stackp == MAX_BYTES)
-                    return false;
+            } else {
+                // This is an invalid code. The dictionary is just initialized
+                // and the code is incomplete. We don't know how to handle
+                // this case.
+                return false;
             }
 
             while (code >= clearCode) {
-                if (code >= MAX_BYTES || code == prefix[code])
-                    return false;
-
-                // Even though suffix[] only holds characters through suffix[avail - 1],
-                // allowing code >= avail here lets us be more tolerant of malformed
-                // data. As long as code < MAX_BYTES, the only risk is a garbled image,
-                // which is no worse than refusing to display it.
-                stack[stackp++] = suffix[code];
+                *--rowIter = suffix[code];
                 code = prefix[code];
-
-                if (stackp == MAX_BYTES)
-                    return false;
             }
 
-            stack[stackp++] = firstchar = suffix[code];
+            *--rowIter = firstchar = suffix[code];
 
-            // Define a new codeword in the dictionary.
-            if (avail < 4096) {
+            // Define a new codeword in the dictionary as long as we've read
+            // more than one value from the stream.
+            if (avail < MAX_DICTIONARY_ENTRIES && oldcode != -1) {
                 prefix[avail] = oldcode;
                 suffix[avail] = firstchar;
-                avail++;
+                suffixLength[avail] = suffixLength[oldcode] + 1;
+                ++avail;
 
                 // If we've used up all the codewords of a given length
                 // increase the length of codewords by one bit, but don't
-                // exceed the specified maximum codeword size of 12 bits.
-                if ((!(avail & codemask)) && (avail < 4096)) {
-                    codesize++;
+                // exceed the specified maximum codeword size.
+                if (!(avail & codemask) && avail < MAX_DICTIONARY_ENTRIES) {
+                    ++codesize;
                     codemask += avail;
                 }
             }
-            oldcode = incode;
+            oldcode = tempCode;
+            rowIter += codeLength;
 
-            // Copy the decoded data out to the scanline buffer.
-            do {
-                *rowIter++ = stack[--stackp];
-                if (rowIter == rowBuffer.end())
-                    OUTPUT_ROW;
-            } while (stackp > 0);
+            // Output as many rows as possible.
+            GIFRow::iterator rowBegin = rowBuffer.begin();
+            for (; rowBegin + width <= rowIter; rowBegin += width) {
+                if (!outputRow(rowBegin))
+                    return false;
+                rowsRemaining--;
+                if (!rowsRemaining)
+                    return true;
+            }
+
+            if (rowBegin != rowBuffer.begin()) {
+                // Move the remaining bytes to the beginning of the buffer.
+                const size_t bytesToCopy = rowIter - rowBegin;
+                memcpy(rowBuffer.begin(), rowBegin, bytesToCopy);
+                rowIter = rowBuffer.begin() + bytesToCopy;
+            }
         }
     }
-
     return true;
 }
 
@@ -316,12 +310,12 @@
     if (!m_isDefined || !m_table.isEmpty())
         return;
 
-    RELEASE_ASSERT(m_position + m_colors * GIF_COLORS <= length);
+    RELEASE_ASSERT(m_position + m_colors * BYTES_PER_COLORMAP_ENTRY <= length);
     const unsigned char* srcColormap = data + m_position;
     m_table.resize(m_colors);
     for (Table::iterator iter = m_table.begin(); iter != m_table.end(); ++iter) {
         *iter = SkPackARGB32NoCheck(255, srcColormap[0], srcColormap[1], srcColormap[2]);
-        srcColormap += GIF_COLORS;
+        srcColormap += BYTES_PER_COLORMAP_ENTRY;
     }
 }
 
@@ -456,7 +450,7 @@
 
             if ((currentComponent[4] & 0x80) && globalColorMapColors > 0) { /* global map */
                 m_globalColorMap.setTablePositionAndSize(dataPosition, globalColorMapColors);
-                GETN(GIF_COLORS * globalColorMapColors, GIFGlobalColormap);
+                GETN(BYTES_PER_COLORMAP_ENTRY * globalColorMapColors, GIFGlobalColormap);
                 break;
             }
 
@@ -556,11 +550,13 @@
             // NOTE: This relies on the values in the FrameDisposalMethod enum
             // matching those in the GIF spec!
             int disposalMethod = ((*currentComponent) >> 2) & 0x7;
-            currentFrame->setDisposalMethod(static_cast<WebCore::ImageFrame::DisposalMethod>(disposalMethod));
-            // Some specs say that disposal method 3 is "overwrite previous", others that setting
-            // the third bit of the field (i.e. method 4) is. We map both to the same value.
-            if (disposalMethod == 4)
+            if (disposalMethod < 4) {
+                currentFrame->setDisposalMethod(static_cast<WebCore::ImageFrame::DisposalMethod>(disposalMethod));
+            } else if (disposalMethod == 4) {
+                // Some specs say that disposal method 3 is "overwrite previous", others that setting
+                // the third bit of the field (i.e. method 4) is. We map both to the same value.
                 currentFrame->setDisposalMethod(WebCore::ImageFrame::DisposeOverwritePrevious);
+            }
             currentFrame->setDelayTime(GETINT16(currentComponent + 1) * 10);
             GETN(1, GIFConsumeBlock);
             break;
@@ -694,7 +690,7 @@
                 // The three low-order bits of currentComponent[8] specify the bits per pixel.
                 const size_t numColors = 2 << (currentComponent[8] & 0x7);
                 currentFrame->localColorMap().setTablePositionAndSize(dataPosition, numColors);
-                GETN(GIF_COLORS * numColors, GIFImageColormap);
+                GETN(BYTES_PER_COLORMAP_ENTRY * numColors, GIFImageColormap);
                 break;
             }
 
@@ -758,14 +754,10 @@
     ASSERT(m_frameContext->isDataSizeDefined() && m_frameContext->isHeaderDefined());
 
     // Since we use a codesize of 1 more than the datasize, we need to ensure
-    // that our datasize is strictly less than the MAX_LZW_BITS value (12).
-    // This sets the largest possible codemask correctly at 4095.
-    if (m_frameContext->dataSize() >= MAX_LZW_BITS)
+    // that our datasize is strictly less than the MAX_DICTIONARY_ENTRY_BITS.
+    if (m_frameContext->dataSize() >= MAX_DICTIONARY_ENTRY_BITS)
         return false;
     clearCode = 1 << m_frameContext->dataSize();
-    if (clearCode >= MAX_BYTES)
-        return false;
-
     avail = clearCode + 2;
     oldcode = -1;
     codesize = m_frameContext->dataSize() + 1;
@@ -774,18 +766,36 @@
     ipass = m_frameContext->interlaced() ? 1 : 0;
     irow = 0;
 
-    // Initialize output row buffer.
-    rowBuffer.resize(m_frameContext->width());
+    // We want to know the longest sequence encodable by a dictionary with
+    // MAX_DICTIONARY_ENTRIES entries. If we ignore the need to encode the base
+    // values themselves at the beginning of the dictionary, as well as the need
+    // for a clear code or a termination code, we could use every entry to
+    // encode a series of multiple values. If the input value stream looked
+    // like "AAAAA..." (a long string of just one value), the first dictionary
+    // entry would encode AA, the next AAA, the next AAAA, and so forth. Thus
+    // the longest sequence would be MAX_DICTIONARY_ENTRIES + 1 values.
+    //
+    // However, we have to account for reserved entries. The first |datasize|
+    // bits are reserved for the base values, and the next two entries are
+    // reserved for the clear code and termination code. In theory a GIF can
+    // set the datasize to 0, meaning we have just two reserved entries, making
+    // the longest sequence (MAX_DICTIONARY_ENTIRES + 1) - 2 values long. Since
+    // each value is a byte, this is also the number of bytes in the longest
+    // encodable sequence.
+    const size_t maxBytes = MAX_DICTIONARY_ENTRIES - 1;
+
+    // Now allocate the output buffer. We decode directly into this buffer
+    // until we have at least one row worth of data, then call outputRow().
+    // This means worst case we may have (row width - 1) bytes in the buffer
+    // and then decode a sequence |maxBytes| long to append.
+    rowBuffer.resize(m_frameContext->width() - 1 + maxBytes);
     rowIter = rowBuffer.begin();
     rowsRemaining = m_frameContext->height();
 
     // Clearing the whole suffix table lets us be more tolerant of bad data.
-    memset(suffix, 0, sizeof(suffix));
-
-    // Clearing the whole prefix table to prevent uninitialized access.
-    memset(prefix, 0, sizeof(prefix));
-    for (int i = 0; i < clearCode; i++)
+    for (int i = 0; i < clearCode; ++i) {
         suffix[i] = i;
-    stackp = 0;
+        suffixLength[i] = 1;
+    }
     return true;
 }
diff --git a/Source/core/platform/image-decoders/gif/GIFImageReader.h b/Source/core/platform/image-decoders/gif/GIFImageReader.h
index 1197dd3..ef85725 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageReader.h
+++ b/Source/core/platform/image-decoders/gif/GIFImageReader.h
@@ -40,16 +40,16 @@
 
 // Define ourselves as the clientPtr.  Mozilla just hacked their C++ callback class into this old C decoder,
 // so we will too.
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/image-decoders/gif/GIFImageDecoder.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
 
-#define MAX_LZW_BITS          12
-#define MAX_BYTES           4097 /* 2^MAX_LZW_BITS+1 */
-#define MAX_COLORS           256
-#define GIF_COLORS             3
+#define MAX_DICTIONARY_ENTRY_BITS 12
+#define MAX_DICTIONARY_ENTRIES    4096 // 2^MAX_DICTIONARY_ENTRY_BITS
+#define MAX_COLORS                256
+#define BYTES_PER_COLORMAP_ENTRY  3
 
 const int cLoopCountNotSeen = -2;
 
@@ -95,14 +95,13 @@
         , ipass(0)
         , irow(0)
         , rowsRemaining(0)
-        , stackp(0)
         , rowIter(0)
         , m_client(client)
         , m_frameContext(frameContext)
     { }
 
     bool prepareToDecode();
-    bool outputRow();
+    bool outputRow(GIFRow::const_iterator rowBegin);
     bool doLZW(const unsigned char* block, size_t bytesInBlock);
     bool hasRemainingRows() { return rowsRemaining; }
 
@@ -120,13 +119,11 @@
     size_t irow; // Current output row, starting at zero.
     size_t rowsRemaining; // Rows remaining to be output.
 
-    unsigned short prefix[MAX_BYTES];
-    unsigned char suffix[MAX_BYTES];
-    unsigned char stack[MAX_BYTES];
-    Vector<unsigned char> rowBuffer; // Single scanline temporary buffer.
-
-    size_t stackp; // Current stack pointer.
-    Vector<unsigned char>::iterator rowIter;
+    unsigned short prefix[MAX_DICTIONARY_ENTRIES];
+    unsigned char suffix[MAX_DICTIONARY_ENTRIES];
+    unsigned short suffixLength[MAX_DICTIONARY_ENTRIES];
+    GIFRow rowBuffer; // Single scanline temporary buffer.
+    GIFRow::iterator rowIter;
 
     // Initialized during construction and read-only.
     WebCore::GIFImageDecoder* m_client;
diff --git a/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
index 52e7fd5..4a19be5 100644
--- a/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
+++ b/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -631,7 +631,8 @@
     unsigned scaleNumerator = static_cast<unsigned>(floor(sqrt(
         // MSVC needs explicit parameter type for sqrt().
         static_cast<float>(m_maxDecodedBytes * scaleDenominator * scaleDenominator / originalBytes))));
-    m_decodedSize = IntSize(scaleNumerator * width / scaleDenominator, scaleNumerator * height / scaleDenominator);
+    m_decodedSize = IntSize((scaleNumerator * width + scaleDenominator - 1) / scaleDenominator,
+        (scaleNumerator * height + scaleDenominator - 1) / scaleDenominator);
 
     // The image is too big to be downsampled by libjpeg.
     // FIXME: Post-process to downsample the image.
@@ -725,6 +726,9 @@
     // Initialize the framebuffer if needed.
     ImageFrame& buffer = m_frameBufferCache[0];
     if (buffer.status() == ImageFrame::FrameEmpty) {
+        ASSERT(info->output_width == m_decodedSize.width());
+        ASSERT(info->output_height == m_decodedSize.height());
+
         if (!buffer.setSize(info->output_width, info->output_height))
             return setFailed();
         buffer.setStatus(ImageFrame::FramePartial);
diff --git a/Source/core/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp b/Source/core/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
index 1ebc8ef..9c2f95a 100644
--- a/Source/core/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
+++ b/Source/core/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp
@@ -32,7 +32,7 @@
 
 #include "core/platform/image-decoders/jpeg/JPEGImageDecoder.h"
 
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebData.h"
 #include "public/platform/WebSize.h"
@@ -64,9 +64,9 @@
 
 } // namespace
 
-void downsample(size_t maxDecodedBytes, unsigned* outputWidth, unsigned* outputHeight)
+void downsample(size_t maxDecodedBytes, unsigned* outputWidth, unsigned* outputHeight, const char* imageFilePath)
 {
-    RefPtr<SharedBuffer> data = readFile("/LayoutTests/fast/images/resources/lenna.jpg");
+    RefPtr<SharedBuffer> data = readFile(imageFilePath);
     ASSERT_TRUE(data.get());
 
     OwnPtr<JPEGImageDecoder> decoder = createDecoder(maxDecodedBytes);
@@ -87,52 +87,99 @@
     EXPECT_TRUE(decoder->failed());
 }
 
-// Tests that JPEG decoder can downsample from 1/8 to 7/8.
-TEST(JPEGImageDecoderTest, downsample1Over8To7Over8)
+// Tests that JPEG decoder can downsample image whose width and height are multiple of 8,
+// to ensure we compute the correct decodedSize and pass correct parameters to libjpeg to
+// output image with the expected size.
+TEST(JPEGImageDecoderTest, downsampleImageSizeMultipleOf8)
 {
+    const char* jpegFile = "/LayoutTests/fast/images/resources/lenna.jpg"; // 256x256
     unsigned outputWidth, outputHeight;
 
     // 1/8 downsample.
-    downsample(40 * 40 * 4, &outputWidth, &outputHeight);
+    downsample(40 * 40 * 4, &outputWidth, &outputHeight, jpegFile);
     EXPECT_EQ(32u, outputWidth);
     EXPECT_EQ(32u, outputHeight);
 
     // 2/8 downsample.
-    downsample(70 * 70 * 4, &outputWidth, &outputHeight);
+    downsample(70 * 70 * 4, &outputWidth, &outputHeight, jpegFile);
     EXPECT_EQ(64u, outputWidth);
     EXPECT_EQ(64u, outputHeight);
 
     // 3/8 downsample.
-    downsample(100 * 100 * 4, &outputWidth, &outputHeight);
+    downsample(100 * 100 * 4, &outputWidth, &outputHeight, jpegFile);
     EXPECT_EQ(96u, outputWidth);
     EXPECT_EQ(96u, outputHeight);
 
     // 4/8 downsample.
-    downsample(130 * 130 * 4, &outputWidth, &outputHeight);
+    downsample(130 * 130 * 4, &outputWidth, &outputHeight, jpegFile);
     EXPECT_EQ(128u, outputWidth);
     EXPECT_EQ(128u, outputHeight);
 
     // 5/8 downsample.
-    downsample(170 * 170 * 4, &outputWidth, &outputHeight);
+    downsample(170 * 170 * 4, &outputWidth, &outputHeight, jpegFile);
     EXPECT_EQ(160u, outputWidth);
     EXPECT_EQ(160u, outputHeight);
 
     // 6/8 downsample.
-    downsample(200 * 200 * 4, &outputWidth, &outputHeight);
+    downsample(200 * 200 * 4, &outputWidth, &outputHeight, jpegFile);
     EXPECT_EQ(192u, outputWidth);
     EXPECT_EQ(192u, outputHeight);
 
     // 7/8 downsample.
-    downsample(230 * 230 * 4, &outputWidth, &outputHeight);
+    downsample(230 * 230 * 4, &outputWidth, &outputHeight, jpegFile);
     EXPECT_EQ(224u, outputWidth);
     EXPECT_EQ(224u, outputHeight);
 }
 
+// Tests that JPEG decoder can downsample image whose width and height are not multiple of 8.
+// Ensures that we round decodedSize and scale_num using the same algorithm as that of libjpeg.
+TEST(JPEGImageDecoderTest, downsampleImageSizeNotMultipleOf8)
+{
+    const char* jpegFile = "/LayoutTests/fast/images/resources/icc-v2-gbr.jpg"; // 275x207
+    unsigned outputWidth, outputHeight;
+
+    // 1/8 downsample.
+    downsample(40 * 40 * 4, &outputWidth, &outputHeight, jpegFile);
+    EXPECT_EQ(35u, outputWidth);
+    EXPECT_EQ(26u, outputHeight);
+
+    // 2/8 downsample.
+    downsample(70 * 70 * 4, &outputWidth, &outputHeight, jpegFile);
+    EXPECT_EQ(69u, outputWidth);
+    EXPECT_EQ(52u, outputHeight);
+
+    // 3/8 downsample.
+    downsample(100 * 100 * 4, &outputWidth, &outputHeight, jpegFile);
+    EXPECT_EQ(104u, outputWidth);
+    EXPECT_EQ(78u, outputHeight);
+
+    // 4/8 downsample.
+    downsample(130 * 130 * 4, &outputWidth, &outputHeight, jpegFile);
+    EXPECT_EQ(138u, outputWidth);
+    EXPECT_EQ(104u, outputHeight);
+
+    // 5/8 downsample.
+    downsample(170 * 170 * 4, &outputWidth, &outputHeight, jpegFile);
+    EXPECT_EQ(172u, outputWidth);
+    EXPECT_EQ(130u, outputHeight);
+
+    // 6/8 downsample.
+    downsample(200 * 200 * 4, &outputWidth, &outputHeight, jpegFile);
+    EXPECT_EQ(207u, outputWidth);
+    EXPECT_EQ(156u, outputHeight);
+
+    // 7/8 downsample.
+    downsample(230 * 230 * 4, &outputWidth, &outputHeight, jpegFile);
+    EXPECT_EQ(241u, outputWidth);
+    EXPECT_EQ(182u, outputHeight);
+}
+
 // Tests that upsampling is not allowed.
 TEST(JPEGImageDecoderTest, upsample)
 {
+    const char* jpegFile = "/LayoutTests/fast/images/resources/lenna.jpg"; // 256x256
     unsigned outputWidth, outputHeight;
-    downsample(1000 * 1000, &outputWidth, &outputHeight);
+    downsample(1000 * 1000, &outputWidth, &outputHeight, jpegFile);
     EXPECT_EQ(256u, outputWidth);
     EXPECT_EQ(256u, outputHeight);
 }
diff --git a/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp b/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp
index c695afb..f9e58e9 100644
--- a/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp
+++ b/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -40,7 +40,7 @@
 #include "core/platform/image-decoders/png/PNGImageDecoder.h"
 
 #include "core/platform/PlatformInstrumentation.h"
-#include "wtf/OwnArrayPtr.h"
+#include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 
 #include "png.h"
@@ -211,7 +211,7 @@
     png_bytep m_interlaceBuffer;
 #if USE(QCMSLIB)
     qcms_transform* m_transform;
-    OwnArrayPtr<png_byte> m_rowBuffer;
+    OwnPtr<png_byte[]> m_rowBuffer;
 #endif
 };
 
diff --git a/Source/core/platform/image-decoders/testing/bad-code.gif b/Source/core/platform/image-decoders/testing/bad-code.gif
new file mode 100644
index 0000000..ed519e7
--- /dev/null
+++ b/Source/core/platform/image-decoders/testing/bad-code.gif
Binary files differ
diff --git a/Source/core/platform/image-decoders/testing/bad-initial-code.gif b/Source/core/platform/image-decoders/testing/bad-initial-code.gif
new file mode 100644
index 0000000..3dc27ec
--- /dev/null
+++ b/Source/core/platform/image-decoders/testing/bad-initial-code.gif
Binary files differ
diff --git a/Source/core/platform/image-decoders/webp/WEBPImageDecoder.cpp b/Source/core/platform/image-decoders/webp/WEBPImageDecoder.cpp
index 84bfd9d..68cb0ff 100644
--- a/Source/core/platform/image-decoders/webp/WEBPImageDecoder.cpp
+++ b/Source/core/platform/image-decoders/webp/WEBPImageDecoder.cpp
@@ -190,6 +190,9 @@
 
 bool WEBPImageDecoder::updateDemuxer()
 {
+    if (failed())
+        return false;
+
     if (m_haveAlreadyParsedThisData)
         return true;
 
diff --git a/Source/core/platform/image-decoders/webp/WEBPImageDecoderTest.cpp b/Source/core/platform/image-decoders/webp/WEBPImageDecoderTest.cpp
index 54db2d5..5fbfbf3 100644
--- a/Source/core/platform/image-decoders/webp/WEBPImageDecoderTest.cpp
+++ b/Source/core/platform/image-decoders/webp/WEBPImageDecoderTest.cpp
@@ -33,7 +33,7 @@
 #include "core/platform/image-decoders/webp/WEBPImageDecoder.h"
 
 #include "RuntimeEnabledFeatures.h"
-#include "core/platform/SharedBuffer.h"
+#include "platform/SharedBuffer.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebData.h"
 #include "public/platform/WebSize.h"
@@ -349,6 +349,29 @@
     EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount());
 }
 
+// Reproduce a crash that used to happen for a specific file with specific sequence of method calls.
+TEST_F(AnimatedWebPTests, reproCrash)
+{
+    OwnPtr<WEBPImageDecoder> decoder = createDecoder();
+
+    RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/invalid_vp8_vp8x.webp");
+    ASSERT_TRUE(fullData.get());
+
+    // Parse partial data up to which error in bitstream is not detected.
+    const size_t partialSize = 32768;
+    ASSERT_GT(fullData->size(), partialSize);
+    RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), partialSize);
+    decoder->setData(data.get(), false);
+    EXPECT_EQ(1u, decoder->frameCount());
+
+    // Parse full data now. The error in bitstream should now be detected.
+    decoder->setData(fullData.get(), true);
+    EXPECT_EQ(0u, decoder->frameCount());
+    ImageFrame* frame = decoder->frameBufferAtIndex(0);
+    EXPECT_FALSE(frame);
+    EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount());
+}
+
 TEST_F(AnimatedWebPTests, progressiveDecode)
 {
     RefPtr<SharedBuffer> fullData = readFile("/LayoutTests/fast/images/resources/webp-animated.webp");
diff --git a/Source/core/platform/image-encoders/skia/JPEGImageEncoder.cpp b/Source/core/platform/image-encoders/skia/JPEGImageEncoder.cpp
index f19c5c1..de34c98 100644
--- a/Source/core/platform/image-encoders/skia/JPEGImageEncoder.cpp
+++ b/Source/core/platform/image-encoders/skia/JPEGImageEncoder.cpp
@@ -34,7 +34,7 @@
 #include "SkBitmap.h"
 #include "SkColorPriv.h"
 #include "core/html/ImageData.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 extern "C" {
 #include <setjmp.h>
 #include <stdio.h> // jpeglib.h needs stdio.h FILE
diff --git a/Source/core/platform/image-encoders/skia/PNGImageEncoder.cpp b/Source/core/platform/image-encoders/skia/PNGImageEncoder.cpp
index 31e1322..edb1e46 100644
--- a/Source/core/platform/image-encoders/skia/PNGImageEncoder.cpp
+++ b/Source/core/platform/image-encoders/skia/PNGImageEncoder.cpp
@@ -35,7 +35,7 @@
 #include "SkColorPriv.h"
 #include "SkUnPreMultiply.h"
 #include "core/html/ImageData.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 extern "C" {
 #include "png.h"
 }
diff --git a/Source/core/platform/image-encoders/skia/WEBPImageEncoder.cpp b/Source/core/platform/image-encoders/skia/WEBPImageEncoder.cpp
index 78cb5aa..a45e321 100644
--- a/Source/core/platform/image-encoders/skia/WEBPImageEncoder.cpp
+++ b/Source/core/platform/image-encoders/skia/WEBPImageEncoder.cpp
@@ -33,7 +33,7 @@
 
 #include "SkBitmap.h"
 #include "core/html/ImageData.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 #include "webp/encode.h"
 
 typedef int (*WebPImporter)(WebPPicture* const, const uint8_t* const data, int rowStride);
diff --git a/Source/core/platform/mac/FoundationExtras.h b/Source/core/platform/mac/FoundationExtras.h
deleted file mode 100644
index 39b12ea..0000000
--- a/Source/core/platform/mac/FoundationExtras.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2004 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,
- * 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 <CoreFoundation/CFBase.h>
-#import <Foundation/NSObject.h>
-
-// Use HardAutorelease to return an object made by a CoreFoundation
-// "create" or "copy" function as an autoreleased and garbage collected
-// object. CF objects need to be "made collectable" for autorelease to work
-// properly under GC.
-
-static inline id HardAutorelease(CFTypeRef object)
-{
-    if (object)
-        CFMakeCollectable(object);
-    [(id)object autorelease];
-    return (id)object;
-}
diff --git a/Source/core/platform/mac/NSScrollerImpDetails.mm b/Source/core/platform/mac/NSScrollerImpDetails.mm
index 7556d76..a5f09c5 100644
--- a/Source/core/platform/mac/NSScrollerImpDetails.mm
+++ b/Source/core/platform/mac/NSScrollerImpDetails.mm
@@ -27,7 +27,6 @@
 
 #include "config.h"
 #include "RuntimeEnabledFeatures.h"
-#include "core/page/Settings.h"
 #include "core/platform/mac/NSScrollerImpDetails.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/mac/ScrollAnimatorMac.h b/Source/core/platform/mac/ScrollAnimatorMac.h
index 4d03966..6b58ac4 100644
--- a/Source/core/platform/mac/ScrollAnimatorMac.h
+++ b/Source/core/platform/mac/ScrollAnimatorMac.h
@@ -27,11 +27,11 @@
 #define ScrollAnimatorMac_h
 
 #include "core/platform/ScrollAnimator.h"
-#include "core/platform/Timer.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatSize.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/platform/mac/ScrollElasticityController.h"
+#include "platform/Timer.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/geometry/IntRect.h"
 #include "wtf/RetainPtr.h"
 
 OBJC_CLASS WebScrollAnimationHelperDelegate;
diff --git a/Source/core/platform/mac/ScrollAnimatorMac.mm b/Source/core/platform/mac/ScrollAnimatorMac.mm
index a03cc70..2d9a1e0 100644
--- a/Source/core/platform/mac/ScrollAnimatorMac.mm
+++ b/Source/core/platform/mac/ScrollAnimatorMac.mm
@@ -27,17 +27,17 @@
 
 #include "core/platform/mac/ScrollAnimatorMac.h"
 
-#include "core/platform/PlatformGestureEvent.h"
-#include "core/platform/PlatformWheelEvent.h"
 #include "core/platform/ScrollView.h"
 #include "core/platform/ScrollableArea.h"
 #include "core/platform/ScrollbarTheme.h"
 #include "core/platform/ScrollbarThemeMacCommon.h"
 #include "core/platform/ScrollbarThemeMacOverlayAPI.h"
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/platform/mac/BlockExceptions.h"
 #include "core/platform/mac/EmptyProtocolDefinitions.h"
 #include "core/platform/mac/NSScrollerImpDetails.h"
+#include "platform/PlatformGestureEvent.h"
+#include "platform/PlatformWheelEvent.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/MainThread.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/UnusedParam.h"
diff --git a/Source/core/platform/mac/ScrollElasticityController.h b/Source/core/platform/mac/ScrollElasticityController.h
index 7fde5e9..180e79c 100644
--- a/Source/core/platform/mac/ScrollElasticityController.h
+++ b/Source/core/platform/mac/ScrollElasticityController.h
@@ -28,9 +28,9 @@
 
 #if USE(RUBBER_BANDING)
 
-#include "core/platform/ScrollTypes.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatSize.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/scroll/ScrollTypes.h"
 #include "wtf/Noncopyable.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/mac/ScrollElasticityController.mm b/Source/core/platform/mac/ScrollElasticityController.mm
index 58165c6..f2693a7 100644
--- a/Source/core/platform/mac/ScrollElasticityController.mm
+++ b/Source/core/platform/mac/ScrollElasticityController.mm
@@ -26,9 +26,9 @@
 #include "config.h"
 #include "core/platform/mac/ScrollElasticityController.h"
 
+#include "platform/PlatformWheelEvent.h"
 #include <sys/sysctl.h>
 #include <sys/time.h>
-#include "core/platform/PlatformWheelEvent.h"
 
 #if USE(RUBBER_BANDING)
 
@@ -184,8 +184,13 @@
     PlatformWheelEventPhase momentumPhase = wheelEvent.momentumPhase();
 
     // If we are starting momentum scrolling then do some setup.
-    if (!m_momentumScrollInProgress && (momentumPhase == PlatformWheelEventPhaseBegan || momentumPhase == PlatformWheelEventPhaseChanged))
+    if (!m_momentumScrollInProgress && (momentumPhase == PlatformWheelEventPhaseBegan || momentumPhase == PlatformWheelEventPhaseChanged)) {
         m_momentumScrollInProgress = true;
+        // Start the snap rubber band timer if it's not running. This is needed to
+        // snap back from the over scroll caused by momentum events.
+        if (!m_snapRubberbandTimerIsActive && m_startTime == 0)
+            snapRubberBand();
+    }
 
     CFTimeInterval timeDelta = wheelEvent.timestamp() - m_lastMomentumScrollTimestamp;
     if (m_inScrollGesture || m_momentumScrollInProgress) {
diff --git a/Source/core/platform/mediastream/MediaStreamCenter.cpp b/Source/core/platform/mediastream/MediaStreamCenter.cpp
index 0818082..c626977 100644
--- a/Source/core/platform/mediastream/MediaStreamCenter.cpp
+++ b/Source/core/platform/mediastream/MediaStreamCenter.cpp
@@ -88,13 +88,13 @@
 
 void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor* stream)
 {
-    if (m_private) {
+    if (m_private)
         m_private->didStopLocalMediaStream(stream);
-        for (unsigned i = 0; i < stream->numberOfAudioComponents(); i++)
-            stream->audioComponent(i)->source()->setReadyState(MediaStreamSource::ReadyStateEnded);
-        for (unsigned i = 0; i < stream->numberOfVideoComponents(); i++)
-            stream->videoComponent(i)->source()->setReadyState(MediaStreamSource::ReadyStateEnded);
-    }
+}
+
+bool MediaStreamCenter::didStopMediaStreamTrack(MediaStreamComponent* track)
+{
+    return m_private && m_private->didStopMediaStreamTrack(track);
 }
 
 void MediaStreamCenter::didCreateMediaStream(MediaStreamDescriptor* stream)
diff --git a/Source/core/platform/mediastream/MediaStreamCenter.h b/Source/core/platform/mediastream/MediaStreamCenter.h
index b215dec..28ee46a 100644
--- a/Source/core/platform/mediastream/MediaStreamCenter.h
+++ b/Source/core/platform/mediastream/MediaStreamCenter.h
@@ -62,6 +62,7 @@
     bool didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*);
     bool didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*);
     void didStopLocalMediaStream(MediaStreamDescriptor*);
+    bool didStopMediaStreamTrack(MediaStreamComponent*);
     void didCreateMediaStream(MediaStreamDescriptor*);
 
     // WebKit::WebMediaStreamCenterClient
diff --git a/Source/core/platform/mediastream/MediaStreamComponent.cpp b/Source/core/platform/mediastream/MediaStreamComponent.cpp
index 722366e..60a7a85 100644
--- a/Source/core/platform/mediastream/MediaStreamComponent.cpp
+++ b/Source/core/platform/mediastream/MediaStreamComponent.cpp
@@ -33,10 +33,10 @@
 
 #include "core/platform/mediastream/MediaStreamComponent.h"
 
-#include "core/platform/UUID.h"
-#include "core/platform/audio/AudioBus.h"
+#include "platform/audio/AudioBus.h"
 #include "core/platform/mediastream/MediaStreamSource.h"
-#include "public/web/WebAudioSourceProvider.h"
+#include "platform/UUID.h"
+#include "public/platform/WebAudioSourceProvider.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/mediastream/MediaStreamComponent.h b/Source/core/platform/mediastream/MediaStreamComponent.h
index 90a9dee..e683ac0 100644
--- a/Source/core/platform/mediastream/MediaStreamComponent.h
+++ b/Source/core/platform/mediastream/MediaStreamComponent.h
@@ -32,7 +32,7 @@
 #ifndef MediaStreamComponent_h
 #define MediaStreamComponent_h
 
-#include "core/platform/audio/AudioSourceProvider.h"
+#include "platform/audio/AudioSourceProvider.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/ThreadingPrimitives.h"
@@ -49,6 +49,11 @@
 
 class MediaStreamComponent : public RefCounted<MediaStreamComponent> {
 public:
+    class ExtraData : public RefCounted<ExtraData> {
+    public:
+        virtual ~ExtraData() { }
+    };
+
     static PassRefPtr<MediaStreamComponent> create(PassRefPtr<MediaStreamSource>);
     static PassRefPtr<MediaStreamComponent> create(const String& id, PassRefPtr<MediaStreamSource>);
     static PassRefPtr<MediaStreamComponent> create(MediaStreamDescriptor*, PassRefPtr<MediaStreamSource>);
@@ -67,6 +72,9 @@
     void setSourceProvider(WebKit::WebAudioSourceProvider* provider) { m_sourceProvider.wrap(provider); }
 #endif // ENABLE(WEB_AUDIO)
 
+    ExtraData* extraData() const { return m_extraData.get(); }
+    void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData; }
+
 private:
     MediaStreamComponent(const String& id, MediaStreamDescriptor*, PassRefPtr<MediaStreamSource>);
 
@@ -101,6 +109,7 @@
     RefPtr<MediaStreamSource> m_source;
     String m_id;
     bool m_enabled;
+    RefPtr<ExtraData> m_extraData;
 };
 
 typedef Vector<RefPtr<MediaStreamComponent> > MediaStreamComponentVector;
diff --git a/Source/core/platform/mediastream/MediaStreamDescriptor.cpp b/Source/core/platform/mediastream/MediaStreamDescriptor.cpp
index cb1ae44..bb67f40 100644
--- a/Source/core/platform/mediastream/MediaStreamDescriptor.cpp
+++ b/Source/core/platform/mediastream/MediaStreamDescriptor.cpp
@@ -33,9 +33,9 @@
 
 #include "core/platform/mediastream/MediaStreamDescriptor.h"
 
-#include "core/platform/UUID.h"
 #include "core/platform/mediastream/MediaStreamComponent.h"
 #include "core/platform/mediastream/MediaStreamSource.h"
+#include "platform/UUID.h"
 #include "wtf/RefCounted.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/platform/mediastream/MediaStreamSource.h b/Source/core/platform/mediastream/MediaStreamSource.h
index 5fdeed5..11989f7 100644
--- a/Source/core/platform/mediastream/MediaStreamSource.h
+++ b/Source/core/platform/mediastream/MediaStreamSource.h
@@ -32,7 +32,7 @@
 #ifndef MediaStreamSource_h
 #define MediaStreamSource_h
 
-#include "core/platform/audio/AudioDestinationConsumer.h"
+#include "platform/audio/AudioDestinationConsumer.h"
 #include "core/platform/mediastream/MediaConstraints.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
diff --git a/Source/core/platform/midi/MIDIAccessor.cpp b/Source/core/platform/midi/MIDIAccessor.cpp
deleted file mode 100644
index 83fc83a..0000000
--- a/Source/core/platform/midi/MIDIAccessor.cpp
+++ /dev/null
@@ -1,89 +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.
- */
-
-#include "config.h"
-#include "core/platform/midi/MIDIAccessor.h"
-
-#include "core/platform/midi/MIDIAccessorClient.h"
-#include "public/platform/Platform.h"
-#include "public/platform/WebMIDIAccessor.h"
-#include "wtf/text/WTFString.h"
-
-using WebKit::WebString;
-
-namespace WebCore {
-
-// Factory method
-PassOwnPtr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client)
-{
-    return adoptPtr(new MIDIAccessor(client));
-}
-
-MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client)
-    : m_client(client)
-{
-    ASSERT(client);
-
-    m_accessor = adoptPtr(WebKit::Platform::current()->createMIDIAccessor(this));
-
-    ASSERT(m_accessor);
-}
-
-void MIDIAccessor::startSession()
-{
-    m_accessor->startSession();
-}
-
-void MIDIAccessor::sendMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp)
-{
-    m_accessor->sendMIDIData(portIndex, data, length, timeStamp);
-}
-
-void MIDIAccessor::didAddInputPort(const WebString& id, const WebString& manufacturer, const WebString& name, const WebString& version)
-{
-    m_client->didAddInputPort(id, manufacturer, name, version);
-}
-
-void MIDIAccessor::didAddOutputPort(const WebString& id, const WebString& manufacturer, const WebString& name, const WebString& version)
-{
-    m_client->didAddOutputPort(id, manufacturer, name, version);
-}
-
-void MIDIAccessor::didStartSession(bool success)
-{
-    m_client->didStartSession(success);
-}
-
-void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp)
-{
-    m_client->didReceiveMIDIData(portIndex, data, length, timeStamp);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/midi/MIDIAccessor.h b/Source/core/platform/midi/MIDIAccessor.h
deleted file mode 100644
index 2204afe..0000000
--- a/Source/core/platform/midi/MIDIAccessor.h
+++ /dev/null
@@ -1,67 +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 MIDIAccessor_h
-#define MIDIAccessor_h
-
-#include "public/platform/WebMIDIAccessor.h"
-#include "public/platform/WebMIDIAccessorClient.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebCore {
-
-class MIDIAccessorClient;
-
-class MIDIAccessor : public WebKit::WebMIDIAccessorClient {
-public:
-    static PassOwnPtr<MIDIAccessor> create(MIDIAccessorClient*);
-
-    virtual ~MIDIAccessor() { }
-
-    void startSession();
-    void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp);
-
-    // WebKit::WebMIDIAccessorClient
-    virtual void didAddInputPort(const WebKit::WebString& id, const WebKit::WebString& manufacturer, const WebKit::WebString& name, const WebKit::WebString& version) OVERRIDE;
-    virtual void didAddOutputPort(const WebKit::WebString& id, const WebKit::WebString& manufacturer, const WebKit::WebString& name, const WebKit::WebString& version) OVERRIDE;
-    virtual void didStartSession(bool success) OVERRIDE;
-    virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp) OVERRIDE;
-
-private:
-    explicit MIDIAccessor(MIDIAccessorClient*);
-
-    MIDIAccessorClient* m_client;
-    OwnPtr<WebKit::WebMIDIAccessor> m_accessor;
-};
-
-} // namespace WebCore
-
-#endif // MIDIAccessor_h
diff --git a/Source/core/platform/midi/MIDIAccessorClient.h b/Source/core/platform/midi/MIDIAccessorClient.h
deleted file mode 100644
index 450b8f6..0000000
--- a/Source/core/platform/midi/MIDIAccessorClient.h
+++ /dev/null
@@ -1,49 +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 MIDIAccessorClient_h
-#define MIDIAccessorClient_h
-
-#include "wtf/Forward.h"
-
-namespace WebCore {
-
-class MIDIAccessorClient {
-public:
-    virtual void didAddInputPort(const String& id, const String& manufacturer, const String& name, const String& version) = 0;
-    virtual void didAddOutputPort(const String& id, const String& manufacturer, const String& name, const String& version) = 0;
-
-    virtual void didStartSession(bool success) = 0;
-    virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp) = 0;
-};
-
-} // namespace WebCore
-
-#endif // MIDIAccessorClient_h
diff --git a/Source/core/platform/midi/OWNERS b/Source/core/platform/midi/OWNERS
deleted file mode 100644
index 88c0a7f..0000000
--- a/Source/core/platform/midi/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-kouhei@chromium.org
-toyoshim@chromium.org
diff --git a/Source/core/platform/mock/DeviceOrientationClientMock.cpp b/Source/core/platform/mock/DeviceOrientationClientMock.cpp
deleted file mode 100644
index 9156629..0000000
--- a/Source/core/platform/mock/DeviceOrientationClientMock.cpp
+++ /dev/null
@@ -1,72 +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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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/mock/DeviceOrientationClientMock.h"
-
-#include "core/dom/DeviceOrientationController.h"
-
-namespace WebCore {
-
-DeviceOrientationClientMock::DeviceOrientationClientMock()
-    : m_controller(0)
-    , m_timer(this, &DeviceOrientationClientMock::timerFired)
-    , m_isUpdating(false)
-{
-}
-
-void DeviceOrientationClientMock::setController(DeviceOrientationController* controller)
-{
-    ASSERT(!m_controller);
-    m_controller = controller;
-    ASSERT(m_controller);
-}
-
-void DeviceOrientationClientMock::startUpdating()
-{
-    m_isUpdating = true;
-}
-
-void DeviceOrientationClientMock::stopUpdating()
-{
-    m_isUpdating = false;
-    m_timer.stop();
-}
-
-void DeviceOrientationClientMock::setOrientation(PassRefPtr<DeviceOrientationData> orientation)
-{
-    m_orientation = orientation;
-    if (m_isUpdating && !m_timer.isActive())
-        m_timer.startOneShot(0);
-}
-
-void DeviceOrientationClientMock::timerFired(Timer<DeviceOrientationClientMock>* timer)
-{
-    ASSERT_UNUSED(timer, timer == &m_timer);
-    m_timer.stop();
-    m_controller->didChangeDeviceOrientation(m_orientation.get());
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/mock/DeviceOrientationClientMock.h b/Source/core/platform/mock/DeviceOrientationClientMock.h
deleted file mode 100644
index e532f17..0000000
--- a/Source/core/platform/mock/DeviceOrientationClientMock.h
+++ /dev/null
@@ -1,67 +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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 DeviceOrientationClientMock_h
-#define DeviceOrientationClientMock_h
-
-#include "core/dom/DeviceOrientationClient.h"
-#include "core/platform/Timer.h"
-#include "modules/device_orientation/DeviceOrientationData.h"
-
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-
-namespace WebCore {
-
-class DeviceOrientationController;
-
-// A mock implementation of DeviceOrientationClient used to test the feature in
-// DumpRenderTree. Embedders should should configure the Page object to use this
-// client when running DumpRenderTree.
-class DeviceOrientationClientMock : public DeviceOrientationClient {
-public:
-    DeviceOrientationClientMock();
-
-    // DeviceOrientationClient
-    virtual void setController(DeviceOrientationController*) OVERRIDE;
-    virtual void startUpdating() OVERRIDE;
-    virtual void stopUpdating() OVERRIDE;
-    virtual DeviceOrientationData* lastOrientation() const OVERRIDE { return m_orientation.get(); }
-    virtual void deviceOrientationControllerDestroyed() OVERRIDE { }
-
-    void setOrientation(PassRefPtr<DeviceOrientationData>);
-
-private:
-    void timerFired(Timer<DeviceOrientationClientMock>*);
-
-    RefPtr<DeviceOrientationData> m_orientation;
-    DeviceOrientationController* m_controller;
-    Timer<DeviceOrientationClientMock> m_timer;
-    bool m_isUpdating;
-};
-
-} // namespace WebCore
-
-#endif // DeviceOrientationClientMock_h
diff --git a/Source/core/platform/mock/GeolocationClientMock.h b/Source/core/platform/mock/GeolocationClientMock.h
index b3eec87..884184d 100644
--- a/Source/core/platform/mock/GeolocationClientMock.h
+++ b/Source/core/platform/mock/GeolocationClientMock.h
@@ -32,8 +32,8 @@
 #ifndef GeolocationClientMock_h
 #define GeolocationClientMock_h
 
-#include "core/platform/Timer.h"
 #include "modules/geolocation/GeolocationClient.h"
+#include "platform/Timer.h"
 #include "wtf/HashSet.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/platform/mock/MIDIClientMock.cpp b/Source/core/platform/mock/MIDIClientMock.cpp
deleted file mode 100644
index b5c603c..0000000
--- a/Source/core/platform/mock/MIDIClientMock.cpp
+++ /dev/null
@@ -1,66 +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.
- */
-
-#include "config.h"
-#include "core/platform/mock/MIDIClientMock.h"
-
-#include "modules/webmidi/MIDIAccess.h"
-
-namespace WebCore {
-
-MIDIClientMock::MIDIClientMock()
-    : m_allowed(false)
-{
-}
-
-MIDIClientMock::~MIDIClientMock()
-{
-}
-
-void MIDIClientMock::setSysExPermission(bool allowed)
-{
-    m_allowed = allowed;
-}
-
-void MIDIClientMock::resetMock()
-{
-    m_allowed = false;
-}
-
-void MIDIClientMock::requestSysExPermission(PassRefPtr<MIDIAccess> access)
-{
-    access->setSysExEnabled(m_allowed);
-}
-
-void MIDIClientMock::cancelSysExPermissionRequest(MIDIAccess*)
-{
-}
-
-} // WebCore
diff --git a/Source/core/platform/mock/MIDIClientMock.h b/Source/core/platform/mock/MIDIClientMock.h
deleted file mode 100644
index 7276c85..0000000
--- a/Source/core/platform/mock/MIDIClientMock.h
+++ /dev/null
@@ -1,56 +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 MIDIClientMock_h
-#define MIDIClientMock_h
-
-#include "modules/webmidi/MIDIClient.h"
-
-namespace WebCore {
-
-class MIDIClientMock : public MIDIClient {
-public:
-    MIDIClientMock();
-    virtual ~MIDIClientMock();
-
-    void setSysExPermission(bool);
-    void resetMock();
-
-    // MIDIClient
-    virtual void requestSysExPermission(PassRefPtr<MIDIAccess>) OVERRIDE;
-    virtual void cancelSysExPermissionRequest(MIDIAccess*) OVERRIDE;
-
-private:
-    bool m_allowed;
-};
-
-} // namespace WebCore
-
-#endif // MIDIClient_h
diff --git a/Source/core/platform/mock/PlatformSpeechSynthesizerMock.h b/Source/core/platform/mock/PlatformSpeechSynthesizerMock.h
index 7dada05..9a48361 100644
--- a/Source/core/platform/mock/PlatformSpeechSynthesizerMock.h
+++ b/Source/core/platform/mock/PlatformSpeechSynthesizerMock.h
@@ -27,7 +27,7 @@
 #define PlatformSpeechSynthesizerMock_h
 
 #include "core/platform/PlatformSpeechSynthesizer.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/mock/ScrollbarThemeMock.cpp b/Source/core/platform/mock/ScrollbarThemeMock.cpp
index 28f9ce6..fcd357b 100644
--- a/Source/core/platform/mock/ScrollbarThemeMock.cpp
+++ b/Source/core/platform/mock/ScrollbarThemeMock.cpp
@@ -27,7 +27,7 @@
 #include "core/platform/mock/ScrollbarThemeMock.h"
 
 #include "RuntimeEnabledFeatures.h"
-#include "core/platform/Scrollbar.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
 
 namespace WebCore {
 
diff --git a/Source/core/platform/network/BlobData.cpp b/Source/core/platform/network/BlobData.cpp
index 9b9ab90..2818372 100644
--- a/Source/core/platform/network/BlobData.cpp
+++ b/Source/core/platform/network/BlobData.cpp
@@ -32,7 +32,7 @@
 #include "core/platform/network/BlobData.h"
 
 #include "core/fileapi/BlobRegistry.h"
-#include "core/fileapi/BlobURL.h"
+#include "platform/UUID.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/PassRefPtr.h"
@@ -55,7 +55,7 @@
 {
     data->detachFromCurrentThread();
     path = path.isolatedCopy();
-    url = url.copy();
+    fileSystemURL = fileSystemURL.copy();
 }
 
 PassOwnPtr<BlobData> BlobData::create()
@@ -86,12 +86,12 @@
     m_items.append(BlobDataItem(path, offset, length, expectedModificationTime));
 }
 
-void BlobData::appendBlob(const KURL& url, long long offset, long long length)
+void BlobData::appendBlob(PassRefPtr<BlobDataHandle> dataHandle, long long offset, long long length)
 {
-    m_items.append(BlobDataItem(url, offset, length));
+    m_items.append(BlobDataItem(dataHandle, offset, length));
 }
 
-void BlobData::appendURL(const KURL& url, long long offset, long long length, double expectedModificationTime)
+void BlobData::appendFileSystemURL(const KURL& url, long long offset, long long length, double expectedModificationTime)
 {
     m_items.append(BlobDataItem(url, offset, length, expectedModificationTime));
 }
@@ -101,17 +101,32 @@
     m_items.swap(items);
 }
 
+BlobDataHandle::BlobDataHandle()
+    : m_uuid(createCanonicalUUIDString())
+    , m_size(0)
+{
+    BlobRegistry::registerBlobData(m_uuid, BlobData::create());
+}
 
 BlobDataHandle::BlobDataHandle(PassOwnPtr<BlobData> data, long long size)
+    : m_uuid(createCanonicalUUIDString())
+    , m_type(data->contentType().isolatedCopy())
+    , m_size(size)
 {
-    UNUSED_PARAM(size);
-    m_internalURL = BlobURL::createInternalURL();
-    BlobRegistry::registerBlobURL(m_internalURL, data);
+    BlobRegistry::registerBlobData(m_uuid, data);
+}
+
+BlobDataHandle::BlobDataHandle(const String& uuid, const String& type, long long size)
+    : m_uuid(uuid.isolatedCopy())
+    , m_type(type.isolatedCopy())
+    , m_size(size)
+{
+    BlobRegistry::addBlobDataRef(m_uuid);
 }
 
 BlobDataHandle::~BlobDataHandle()
 {
-    BlobRegistry::unregisterBlobURL(m_internalURL);
+    BlobRegistry::removeBlobDataRef(m_uuid);
 }
 
 } // namespace WebCore
diff --git a/Source/core/platform/network/BlobData.h b/Source/core/platform/network/BlobData.h
index 11ed658..91e0d1b 100644
--- a/Source/core/platform/network/BlobData.h
+++ b/Source/core/platform/network/BlobData.h
@@ -31,7 +31,7 @@
 #ifndef BlobData_h
 #define BlobData_h
 
-#include "core/platform/FileSystem.h"
+#include "platform/FileMetadata.h"
 #include "weborigin/KURL.h"
 #include "wtf/Forward.h"
 #include "wtf/PassOwnPtr.h"
@@ -40,6 +40,8 @@
 
 namespace WebCore {
 
+class BlobDataHandle;
+
 class RawData : public ThreadSafeRefCounted<RawData> {
 public:
     static PassRefPtr<RawData> create()
@@ -102,19 +104,19 @@
     }
 
     // Constructor for Blob type.
-    BlobDataItem(const KURL& url, long long offset, long long length)
+    BlobDataItem(PassRefPtr<BlobDataHandle> blobDataHandle, long long offset, long long length)
         : type(Blob)
-        , url(url)
+        , blobDataHandle(blobDataHandle)
         , offset(offset)
         , length(length)
         , expectedModificationTime(invalidFileTime())
     {
     }
 
-    // Constructor for URL type (e.g. FileSystem files).
-    BlobDataItem(const KURL& url, long long offset, long long length, double expectedModificationTime)
-        : type(URL)
-        , url(url)
+    // Constructor for FileSystem file type.
+    BlobDataItem(const KURL& fileSystemURL, long long offset, long long length, double expectedModificationTime)
+        : type(FileSystemURL)
+        , fileSystemURL(fileSystemURL)
         , offset(offset)
         , length(length)
         , expectedModificationTime(expectedModificationTime)
@@ -128,17 +130,13 @@
         Data,
         File,
         Blob,
-        URL
+        FileSystemURL
     } type;
 
-    // For Data type.
-    RefPtr<RawData> data;
-
-    // For File type.
-    String path;
-
-    // For Blob or URL type.
-    KURL url;
+    RefPtr<RawData> data; // For Data type.
+    String path; // For File type.
+    KURL fileSystemURL; // For FileSystemURL type.
+    RefPtr<BlobDataHandle> blobDataHandle; // For Blob type.
 
     long long offset;
     long long length;
@@ -180,8 +178,8 @@
     void appendData(PassRefPtr<RawData>, long long offset, long long length);
     void appendFile(const String& path);
     void appendFile(const String& path, long long offset, long long length, double expectedModificationTime);
-    void appendBlob(const KURL&, long long offset, long long length);
-    void appendURL(const KURL&, long long offset, long long length, double expectedModificationTime);
+    void appendBlob(PassRefPtr<BlobDataHandle>, long long offset, long long length);
+    void appendFileSystemURL(const KURL&, long long offset, long long length, double expectedModificationTime);
 
 private:
     friend class BlobRegistryImpl;
@@ -197,21 +195,41 @@
     BlobDataItemList m_items;
 };
 
-// FIXME: This class is mostly place holder until I get farther along with
-// https://bugs.webkit.org/show_bug.cgi?id=108733 and more specifically with landing
-// https://codereview.chromium.org/11192017/.
+
 class BlobDataHandle : public ThreadSafeRefCounted<BlobDataHandle> {
 public:
+    // For empty blob construction.
+    static PassRefPtr<BlobDataHandle> create()
+    {
+        return adoptRef(new BlobDataHandle());
+    }
+
+    // For initial creation.
     static PassRefPtr<BlobDataHandle> create(PassOwnPtr<BlobData> data, long long size)
     {
         return adoptRef(new BlobDataHandle(data, size));
     }
 
+    // For deserialization of script values and ipc messages.
+    static PassRefPtr<BlobDataHandle> create(const String& uuid, const String& type, long long size)
+    {
+        return adoptRef(new BlobDataHandle(uuid, type, size));
+    }
+
+    String uuid() const { return m_uuid.isolatedCopy(); }
+    String type() const { return m_type.isolatedCopy(); }
+    unsigned long long size() { return m_size; }
+
     ~BlobDataHandle();
 
 private:
+    BlobDataHandle();
     BlobDataHandle(PassOwnPtr<BlobData>, long long size);
-    KURL m_internalURL;
+    BlobDataHandle(const String& uuid, const String& type, long long size);
+
+    const String m_uuid;
+    const String m_type;
+    const long long m_size;
 };
 
 } // namespace WebCore
diff --git a/Source/core/platform/network/DNS.cpp b/Source/core/platform/network/DNS.cpp
deleted file mode 100644
index 7c18e41..0000000
--- a/Source/core/platform/network/DNS.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2008 Collin Jackson  <collinj@webkit.org>
- * 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:
- * 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 COMPUTER, 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/platform/network/DNS.h"
-
-#include "public/platform/Platform.h"
-#include "public/platform/WebPrescientNetworking.h"
-
-namespace WebCore {
-
-void prefetchDNS(const String& hostname)
-{
-    WebKit::WebPrescientNetworking* prescientNetworking = WebKit::Platform::current()->prescientNetworking();
-
-    if (!prescientNetworking)
-        return;
-
-    prescientNetworking->prefetchDNS(hostname);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/network/DNS.h b/Source/core/platform/network/DNS.h
deleted file mode 100644
index 7d05e5c..0000000
--- a/Source/core/platform/network/DNS.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2008 Collin Jackson  <collinj@webkit.org>
- * 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:
- * 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 COMPUTER, 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 DNS_h
-#define DNS_h
-
-#include "wtf/Forward.h"
-
-namespace WebCore {
-
-void prefetchDNS(const String& hostname);
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/platform/network/FormData.cpp b/Source/core/platform/network/FormData.cpp
index 6967f83..b9cdf76 100644
--- a/Source/core/platform/network/FormData.cpp
+++ b/Source/core/platform/network/FormData.cpp
@@ -23,10 +23,10 @@
 #include "core/platform/network/FormData.h"
 
 #include "core/fileapi/File.h"
-#include "core/html/FormDataList.h"
-#include "core/platform/FileSystem.h"
 #include "core/platform/network/BlobData.h"
 #include "core/platform/network/FormDataBuilder.h"
+#include "core/platform/network/FormDataList.h"
+#include "platform/FileMetadata.h"
 #include "wtf/text/TextEncoding.h"
 
 namespace WebCore {
@@ -80,14 +80,14 @@
 PassRefPtr<FormData> FormData::create(const FormDataList& list, const WTF::TextEncoding& encoding, EncodingType encodingType)
 {
     RefPtr<FormData> result = create();
-    result->appendKeyValuePairItems(list, encoding, false, 0, encodingType);
+    result->appendKeyValuePairItems(list, encoding, false, encodingType);
     return result.release();
 }
 
-PassRefPtr<FormData> FormData::createMultiPart(const FormDataList& list, const WTF::TextEncoding& encoding, Document* document)
+PassRefPtr<FormData> FormData::createMultiPart(const FormDataList& list, const WTF::TextEncoding& encoding)
 {
     RefPtr<FormData> result = create();
-    result->appendKeyValuePairItems(list, encoding, true, document);
+    result->appendKeyValuePairItems(list, encoding, true);
     return result.release();
 }
 
@@ -114,10 +114,10 @@
             formData->m_elements.uncheckedAppend(FormDataElement(e.m_filename, e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime));
             break;
         case FormDataElement::encodedBlob:
-            formData->m_elements.uncheckedAppend(FormDataElement(e.m_url));
+            formData->m_elements.uncheckedAppend(FormDataElement(e.m_blobUUID, e.m_optionalBlobDataHandle));
             break;
-        case FormDataElement::encodedURL:
-            formData->m_elements.uncheckedAppend(FormDataElement(e.m_url, e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime));
+        case FormDataElement::encodedFileSystemURL:
+            formData->m_elements.uncheckedAppend(FormDataElement(e.m_fileSystemURL, e.m_fileStart, e.m_fileLength, e.m_expectedFileModificationTime));
             break;
         }
     }
@@ -144,22 +144,22 @@
     m_elements.append(FormDataElement(filename, start, length, expectedModificationTime));
 }
 
-void FormData::appendBlob(const KURL& blobURL)
+void FormData::appendBlob(const String& uuid, PassRefPtr<BlobDataHandle> optionalHandle)
 {
-    m_elements.append(FormDataElement(blobURL));
+    m_elements.append(FormDataElement(uuid, optionalHandle));
 }
 
-void FormData::appendURL(const KURL& url)
+void FormData::appendFileSystemURL(const KURL& url)
 {
     m_elements.append(FormDataElement(url, 0, BlobDataItem::toEndOfFile, invalidFileTime()));
 }
 
-void FormData::appendURLRange(const KURL& url, long long start, long long length, double expectedModificationTime)
+void FormData::appendFileSystemURLRange(const KURL& url, long long start, long long length, double expectedModificationTime)
 {
     m_elements.append(FormDataElement(url, start, length, expectedModificationTime));
 }
 
-void FormData::appendKeyValuePairItems(const FormDataList& list, const WTF::TextEncoding& encoding, bool isMultiPartForm, Document* document, EncodingType encodingType)
+void FormData::appendKeyValuePairItems(const FormDataList& list, const WTF::TextEncoding& encoding, bool isMultiPartForm, EncodingType encodingType)
 {
     if (isMultiPartForm)
         m_boundary = FormDataBuilder::generateUniqueBoundaryString();
@@ -218,10 +218,10 @@
                     if (!file->path().isEmpty())
                         appendFile(file->path());
                     if (!file->fileSystemURL().isEmpty())
-                        appendURL(file->fileSystemURL());
+                        appendFileSystemURL(file->fileSystemURL());
+                } else {
+                    appendBlob(value.blob()->uuid(), value.blob()->blobDataHandle());
                 }
-                else
-                    appendBlob(value.blob()->url());
             } else
                 appendData(value.data().data(), value.data().length());
             appendData("\r\n", 2);
diff --git a/Source/core/platform/network/FormData.h b/Source/core/platform/network/FormData.h
index d524a73..1215941 100644
--- a/Source/core/platform/network/FormData.h
+++ b/Source/core/platform/network/FormData.h
@@ -20,6 +20,7 @@
 #ifndef FormData_h
 #define FormData_h
 
+#include "core/platform/network/BlobData.h"
 #include "weborigin/KURL.h"
 #include "wtf/Forward.h"
 #include "wtf/RefCounted.h"
@@ -32,7 +33,7 @@
 
 namespace WebCore {
 
-class Document;
+class BlobDataHandle;
 class FormDataList;
 
 class FormDataElement {
@@ -41,18 +42,20 @@
     explicit FormDataElement(const Vector<char>& array) : m_type(data), m_data(array) { }
 
     FormDataElement(const String& filename, long long fileStart, long long fileLength, double expectedFileModificationTime) : m_type(encodedFile), m_filename(filename), m_fileStart(fileStart), m_fileLength(fileLength), m_expectedFileModificationTime(expectedFileModificationTime) { }
-    explicit FormDataElement(const KURL& blobURL) : m_type(encodedBlob), m_url(blobURL) { }
-    FormDataElement(const KURL& url, long long start, long long length, double expectedFileModificationTime) : m_type(encodedURL), m_url(url), m_fileStart(start), m_fileLength(length), m_expectedFileModificationTime(expectedFileModificationTime) { }
+    explicit FormDataElement(const String& blobUUID, PassRefPtr<BlobDataHandle> optionalHandle) : m_type(encodedBlob), m_blobUUID(blobUUID), m_optionalBlobDataHandle(optionalHandle) { }
+    FormDataElement(const KURL& fileSystemURL, long long start, long long length, double expectedFileModificationTime) : m_type(encodedFileSystemURL), m_fileSystemURL(fileSystemURL), m_fileStart(start), m_fileLength(length), m_expectedFileModificationTime(expectedFileModificationTime) { }
 
     enum Type {
         data,
-        encodedFile
-        , encodedBlob
-        , encodedURL
+        encodedFile,
+        encodedBlob,
+        encodedFileSystemURL
     } m_type;
     Vector<char> m_data;
     String m_filename;
-    KURL m_url; // For Blob or URL.
+    String m_blobUUID;
+    RefPtr<BlobDataHandle> m_optionalBlobDataHandle;
+    KURL m_fileSystemURL;
     long long m_fileStart;
     long long m_fileLength;
     double m_expectedFileModificationTime;
@@ -70,9 +73,9 @@
     if (a.m_type == FormDataElement::encodedFile)
         return a.m_filename == b.m_filename && a.m_fileStart == b.m_fileStart && a.m_fileLength == b.m_fileLength && a.m_expectedFileModificationTime == b.m_expectedFileModificationTime;
     if (a.m_type == FormDataElement::encodedBlob)
-        return a.m_url == b.m_url;
-    if (a.m_type == FormDataElement::encodedURL)
-        return a.m_url == b.m_url;
+        return a.m_blobUUID == b.m_blobUUID;
+    if (a.m_type == FormDataElement::encodedFileSystemURL)
+        return a.m_fileSystemURL == b.m_fileSystemURL;
 
     return true;
 }
@@ -95,7 +98,7 @@
     static PassRefPtr<FormData> create(const CString&);
     static PassRefPtr<FormData> create(const Vector<char>&);
     static PassRefPtr<FormData> create(const FormDataList&, const WTF::TextEncoding&, EncodingType = FormURLEncoded);
-    static PassRefPtr<FormData> createMultiPart(const FormDataList&, const WTF::TextEncoding&, Document*);
+    static PassRefPtr<FormData> createMultiPart(const FormDataList&, const WTF::TextEncoding&);
     PassRefPtr<FormData> copy() const;
     PassRefPtr<FormData> deepCopy() const;
     ~FormData();
@@ -103,9 +106,9 @@
     void appendData(const void* data, size_t);
     void appendFile(const String& filePath);
     void appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime);
-    void appendBlob(const KURL& blobURL);
-    void appendURL(const KURL&);
-    void appendURLRange(const KURL&, long long start, long long length, double expectedModificationTime);
+    void appendBlob(const String& blobUUID, PassRefPtr<BlobDataHandle> optionalHandle);
+    void appendFileSystemURL(const KURL&);
+    void appendFileSystemURLRange(const KURL&, long long start, long long length, double expectedModificationTime);
 
     void flatten(Vector<char>&) const; // omits files
     String flattenToString() const; // omits files
@@ -138,7 +141,7 @@
     FormData();
     FormData(const FormData&);
 
-    void appendKeyValuePairItems(const FormDataList&, const WTF::TextEncoding&, bool isMultiPartForm, Document*, EncodingType = FormURLEncoded);
+    void appendKeyValuePairItems(const FormDataList&, const WTF::TextEncoding&, bool isMultiPartForm, EncodingType = FormURLEncoded);
 
     Vector<FormDataElement> m_elements;
 
diff --git a/Source/core/platform/network/FormDataBuilder.cpp b/Source/core/platform/network/FormDataBuilder.cpp
index 3dbcd3a..5321f3b 100644
--- a/Source/core/platform/network/FormDataBuilder.cpp
+++ b/Source/core/platform/network/FormDataBuilder.cpp
@@ -25,9 +25,8 @@
 #include "config.h"
 #include "core/platform/network/FormDataBuilder.h"
 
-#include "core/dom/Document.h"
+#include "wtf/CryptographicallyRandomNumber.h"
 #include "wtf/HexNumber.h"
-#include "wtf/RandomNumber.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/TextEncoding.h"
 #include <limits>
@@ -75,7 +74,7 @@
     }
 }
 
-WTF::TextEncoding FormDataBuilder::encodingFromAcceptCharset(const String& acceptCharset, Document* document)
+WTF::TextEncoding FormDataBuilder::encodingFromAcceptCharset(const String& acceptCharset, const String& inputEncoding, const String& defaultCharset)
 {
     String normalizedAcceptCharset = acceptCharset;
     normalizedAcceptCharset.replace(',', ' ');
@@ -91,7 +90,14 @@
             return encoding;
     }
 
-    return document->inputEncoding();
+    if (inputEncoding.isEmpty()) {
+        if (defaultCharset.isEmpty())
+            return WTF::UTF8Encoding();
+
+        return defaultCharset;
+    }
+
+    return inputEncoding;
 }
 
 Vector<char> FormDataBuilder::generateUniqueBoundaryString()
@@ -123,7 +129,7 @@
     Vector<char> randomBytes;
 
     for (unsigned i = 0; i < 4; ++i) {
-        unsigned randomness = static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0));
+        uint32_t randomness = cryptographicallyRandomNumber();
         randomBytes.append(alphaNumericEncodingMap[(randomness >> 24) & 0x3F]);
         randomBytes.append(alphaNumericEncodingMap[(randomness >> 16) & 0x3F]);
         randomBytes.append(alphaNumericEncodingMap[(randomness >> 8) & 0x3F]);
diff --git a/Source/core/platform/network/FormDataBuilder.h b/Source/core/platform/network/FormDataBuilder.h
index ef9786e..5aaa375 100644
--- a/Source/core/platform/network/FormDataBuilder.h
+++ b/Source/core/platform/network/FormDataBuilder.h
@@ -30,12 +30,10 @@
 
 namespace WebCore {
 
-class Document;
-
 class FormDataBuilder {
     WTF_MAKE_NONCOPYABLE(FormDataBuilder);
 public:
-    static WTF::TextEncoding encodingFromAcceptCharset(const String& acceptCharset, Document* document);
+    static WTF::TextEncoding encodingFromAcceptCharset(const String& acceptCharset, const String& inputEncoding, const String& defaultCharset);
 
     // Helper functions used by HTMLFormElement for multi-part form data
     static Vector<char> generateUniqueBoundaryString();
diff --git a/Source/core/platform/network/FormDataList.cpp b/Source/core/platform/network/FormDataList.cpp
new file mode 100644
index 0000000..7715f35
--- /dev/null
+++ b/Source/core/platform/network/FormDataList.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2005, 2006, 2008 Apple Inc. 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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "core/platform/network/FormDataList.h"
+
+#include "platform/text/LineEnding.h"
+
+namespace WebCore {
+
+FormDataList::FormDataList(const WTF::TextEncoding& c)
+    : m_encoding(c)
+{
+}
+
+void FormDataList::appendString(const String& string)
+{
+    CString encodedString = m_encoding.encode(string, WTF::EntitiesForUnencodables);
+    m_items.append(normalizeLineEndingsToCRLF(encodedString));
+}
+
+void FormDataList::appendString(const CString& string)
+{
+    m_items.append(string);
+}
+
+void FormDataList::appendBlob(PassRefPtr<Blob> blob, const String& filename)
+{
+    m_items.append(Item(blob, filename));
+}
+
+} // namespace
diff --git a/Source/core/html/FormDataList.h b/Source/core/platform/network/FormDataList.h
similarity index 100%
rename from Source/core/html/FormDataList.h
rename to Source/core/platform/network/FormDataList.h
diff --git a/Source/core/platform/network/HTTPHeaderMap.cpp b/Source/core/platform/network/HTTPHeaderMap.cpp
deleted file mode 100644
index 3ca4299..0000000
--- a/Source/core/platform/network/HTTPHeaderMap.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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
- * 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/network/HTTPHeaderMap.h"
-
-#include <utility>
-
-using namespace std;
-
-namespace WebCore {
-
-HTTPHeaderMap::HTTPHeaderMap()
-{
-}
-
-HTTPHeaderMap::~HTTPHeaderMap()
-{
-}
-
-PassOwnPtr<CrossThreadHTTPHeaderMapData> HTTPHeaderMap::copyData() const
-{
-    OwnPtr<CrossThreadHTTPHeaderMapData> data = adoptPtr(new CrossThreadHTTPHeaderMapData());
-    data->reserveInitialCapacity(size());
-
-    HTTPHeaderMap::const_iterator end_it = end();
-    for (HTTPHeaderMap::const_iterator it = begin(); it != end_it; ++it)
-        data->uncheckedAppend(make_pair(it->key.string().isolatedCopy(), it->value.string().isolatedCopy()));
-
-    return data.release();
-}
-
-void HTTPHeaderMap::adopt(PassOwnPtr<CrossThreadHTTPHeaderMapData> data)
-{
-    clear();
-    size_t dataSize = data->size();
-    for (size_t index = 0; index < dataSize; ++index) {
-        pair<String, String>& header = (*data)[index];
-        set(header.first, header.second);
-    }
-}
-
-AtomicString HTTPHeaderMap::get(const AtomicString& name) const
-{
-    return HashMap<AtomicString, AtomicString, CaseFoldingHash>::get(name);
-}
-
-HTTPHeaderMap::AddResult HTTPHeaderMap::add(const AtomicString& name, const AtomicString& value)
-{
-    return HashMap<AtomicString, AtomicString, CaseFoldingHash>::add(name, value);
-}
-
-// Adapter that allows the HashMap to take C strings as keys.
-struct CaseFoldingCStringTranslator {
-    static unsigned hash(const char* cString)
-    {
-        return CaseFoldingHash::hash(cString, strlen(cString));
-    }
-
-    static bool equal(const AtomicString& key, const char* cString)
-    {
-        return equalIgnoringCase(key, cString);
-    }
-
-    static void translate(AtomicString& location, const char* cString, unsigned /*hash*/)
-    {
-        location = AtomicString(cString);
-    }
-};
-
-AtomicString HTTPHeaderMap::get(const char* name) const
-{
-    const_iterator i = find<CaseFoldingCStringTranslator>(name);
-    if (i == end())
-        return nullAtom;
-    return i->value;
-}
-
-bool HTTPHeaderMap::contains(const char* name) const
-{
-    return find<CaseFoldingCStringTranslator>(name) != end();
-}
-
-HTTPHeaderMap::AddResult HTTPHeaderMap::add(const char* name, const AtomicString& value)
-{
-    return HashMap<AtomicString, AtomicString, CaseFoldingHash>::add<CaseFoldingCStringTranslator>(name, value);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/network/HTTPHeaderMap.h b/Source/core/platform/network/HTTPHeaderMap.h
deleted file mode 100644
index cbf798d..0000000
--- a/Source/core/platform/network/HTTPHeaderMap.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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 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,
- * 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 HTTPHeaderMap_h
-#define HTTPHeaderMap_h
-
-#include <utility>
-#include "wtf/HashMap.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/Vector.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/AtomicStringHash.h"
-#include "wtf/text/StringHash.h"
-
-namespace WebCore {
-
-    typedef Vector<std::pair<String, String> > CrossThreadHTTPHeaderMapData;
-
-    // FIXME: Not every header fits into a map. Notably, multiple Set-Cookie header fields are needed to set multiple cookies.
-    class HTTPHeaderMap : public HashMap<AtomicString, AtomicString, CaseFoldingHash> {
-    public:
-        HTTPHeaderMap();
-        ~HTTPHeaderMap();
-
-        // Gets a copy of the data suitable for passing to another thread.
-        PassOwnPtr<CrossThreadHTTPHeaderMapData> copyData() const;
-
-        void adopt(PassOwnPtr<CrossThreadHTTPHeaderMapData>);
-
-        AtomicString get(const AtomicString& name) const;
-
-        AddResult add(const AtomicString& name, const AtomicString& value);
-
-        // Alternate accessors that are faster than converting the char* to AtomicString first.
-        bool contains(const char*) const;
-        AtomicString get(const char*) const;
-        AddResult add(const char* name, const AtomicString& value);
-
-    };
-
-} // namespace WebCore
-
-#endif // HTTPHeaderMap_h
diff --git a/Source/core/platform/network/HTTPParsers.cpp b/Source/core/platform/network/HTTPParsers.cpp
deleted file mode 100644
index cc2b296..0000000
--- a/Source/core/platform/network/HTTPParsers.cpp
+++ /dev/null
@@ -1,687 +0,0 @@
-/*
- * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * 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.
- * 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.
- *
- * 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/network/HTTPParsers.h"
-
-#include "core/page/ContentSecurityPolicy.h"
-#include "wtf/DateMath.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/WTFString.h"
-#include "wtf/unicode/CharacterNames.h"
-
-using namespace WTF;
-
-namespace WebCore {
-
-// true if there is more to parse, after incrementing pos past whitespace.
-// Note: Might return pos == str.length()
-static inline bool skipWhiteSpace(const String& str, unsigned& pos, bool fromHttpEquivMeta)
-{
-    unsigned len = str.length();
-
-    if (fromHttpEquivMeta) {
-        while (pos < len && str[pos] <= ' ')
-            ++pos;
-    } else {
-        while (pos < len && (str[pos] == '\t' || str[pos] == ' '))
-            ++pos;
-    }
-
-    return pos < len;
-}
-
-// Returns true if the function can match the whole token (case insensitive)
-// incrementing pos on match, otherwise leaving pos unchanged.
-// Note: Might return pos == str.length()
-static inline bool skipToken(const String& str, unsigned& pos, const char* token)
-{
-    unsigned len = str.length();
-    unsigned current = pos;
-
-    while (current < len && *token) {
-        if (toASCIILower(str[current]) != *token++)
-            return false;
-        ++current;
-    }
-
-    if (*token)
-        return false;
-
-    pos = current;
-    return true;
-}
-
-// True if the expected equals sign is seen and there is more to follow.
-static inline bool skipEquals(const String& str, unsigned &pos)
-{
-    return skipWhiteSpace(str, pos, false) && str[pos++] == '=' && skipWhiteSpace(str, pos, false);
-}
-
-// True if a value present, incrementing pos to next space or semicolon, if any.
-// Note: might return pos == str.length().
-static inline bool skipValue(const String& str, unsigned& pos)
-{
-    unsigned start = pos;
-    unsigned len = str.length();
-    while (pos < len) {
-        if (str[pos] == ' ' || str[pos] == '\t' || str[pos] == ';')
-            break;
-        ++pos;
-    }
-    return pos != start;
-}
-
-bool isValidHTTPHeaderValue(const String& name)
-{
-    // FIXME: This should really match name against
-    // field-value in section 4.2 of RFC 2616.
-
-    return name.containsOnlyLatin1() && !name.contains('\r') && !name.contains('\n');
-}
-
-// See RFC 2616, Section 2.2.
-bool isValidHTTPToken(const String& characters)
-{
-    if (characters.isEmpty())
-        return false;
-    for (unsigned i = 0; i < characters.length(); ++i) {
-        UChar c = characters[i];
-        if (c <= 0x20 || c >= 0x7F
-            || c == '(' || c == ')' || c == '<' || c == '>' || c == '@'
-            || c == ',' || c == ';' || c == ':' || c == '\\' || c == '"'
-            || c == '/' || c == '[' || c == ']' || c == '?' || c == '='
-            || c == '{' || c == '}')
-        return false;
-    }
-    return true;
-}
-
-static const size_t maxInputSampleSize = 128;
-static String trimInputSample(const char* p, size_t length)
-{
-    String s = String(p, std::min<size_t>(length, maxInputSampleSize));
-    if (length > maxInputSampleSize)
-        s.append(horizontalEllipsis);
-    return s;
-}
-
-ContentDispositionType contentDispositionType(const String& contentDisposition)
-{
-    if (contentDisposition.isEmpty())
-        return ContentDispositionNone;
-
-    Vector<String> parameters;
-    contentDisposition.split(';', parameters);
-
-    if (parameters.isEmpty())
-        return ContentDispositionNone;
-
-    String dispositionType = parameters[0];
-    dispositionType.stripWhiteSpace();
-
-    if (equalIgnoringCase(dispositionType, "inline"))
-        return ContentDispositionInline;
-
-    // Some broken sites just send bogus headers like
-    //
-    //   Content-Disposition: ; filename="file"
-    //   Content-Disposition: filename="file"
-    //   Content-Disposition: name="file"
-    //
-    // without a disposition token... screen those out.
-    if (!isValidHTTPToken(dispositionType))
-        return ContentDispositionNone;
-
-    // We have a content-disposition of "attachment" or unknown.
-    // RFC 2183, section 2.8 says that an unknown disposition
-    // value should be treated as "attachment"
-    return ContentDispositionAttachment;
-}
-
-bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url)
-{
-    unsigned len = refresh.length();
-    unsigned pos = 0;
-
-    if (!skipWhiteSpace(refresh, pos, fromHttpEquivMeta))
-        return false;
-
-    while (pos != len && refresh[pos] != ',' && refresh[pos] != ';')
-        ++pos;
-
-    if (pos == len) { // no URL
-        url = String();
-        bool ok;
-        delay = refresh.stripWhiteSpace().toDouble(&ok);
-        return ok;
-    } else {
-        bool ok;
-        delay = refresh.left(pos).stripWhiteSpace().toDouble(&ok);
-        if (!ok)
-            return false;
-
-        ++pos;
-        skipWhiteSpace(refresh, pos, fromHttpEquivMeta);
-        unsigned urlStartPos = pos;
-        if (refresh.find("url", urlStartPos, false) == urlStartPos) {
-            urlStartPos += 3;
-            skipWhiteSpace(refresh, urlStartPos, fromHttpEquivMeta);
-            if (refresh[urlStartPos] == '=') {
-                ++urlStartPos;
-                skipWhiteSpace(refresh, urlStartPos, fromHttpEquivMeta);
-            } else
-                urlStartPos = pos;  // e.g. "Refresh: 0; url.html"
-        }
-
-        unsigned urlEndPos = len;
-
-        if (refresh[urlStartPos] == '"' || refresh[urlStartPos] == '\'') {
-            UChar quotationMark = refresh[urlStartPos];
-            urlStartPos++;
-            while (urlEndPos > urlStartPos) {
-                urlEndPos--;
-                if (refresh[urlEndPos] == quotationMark)
-                    break;
-            }
-
-            // https://bugs.webkit.org/show_bug.cgi?id=27868
-            // Sometimes there is no closing quote for the end of the URL even though there was an opening quote.
-            // If we looped over the entire alleged URL string back to the opening quote, just go ahead and use everything
-            // after the opening quote instead.
-            if (urlEndPos == urlStartPos)
-                urlEndPos = len;
-        }
-
-        url = refresh.substring(urlStartPos, urlEndPos - urlStartPos).stripWhiteSpace();
-        return true;
-    }
-}
-
-double parseDate(const String& value)
-{
-    return parseDateFromNullTerminatedCharacters(value.utf8().data());
-}
-
-// FIXME: This function doesn't comply with RFC 6266.
-// For example, this function doesn't handle the interaction between " and ;
-// that arises from quoted-string, nor does this function properly unquote
-// attribute values. Further this function appears to process parameter names
-// in a case-sensitive manner. (There are likely other bugs as well.)
-String filenameFromHTTPContentDisposition(const String& value)
-{
-    Vector<String> keyValuePairs;
-    value.split(';', keyValuePairs);
-
-    unsigned length = keyValuePairs.size();
-    for (unsigned i = 0; i < length; i++) {
-        size_t valueStartPos = keyValuePairs[i].find('=');
-        if (valueStartPos == kNotFound)
-            continue;
-
-        String key = keyValuePairs[i].left(valueStartPos).stripWhiteSpace();
-
-        if (key.isEmpty() || key != "filename")
-            continue;
-
-        String value = keyValuePairs[i].substring(valueStartPos + 1).stripWhiteSpace();
-
-        // Remove quotes if there are any
-        if (value[0] == '\"')
-            value = value.substring(1, value.length() - 2);
-
-        return value;
-    }
-
-    return String();
-}
-
-String extractMIMETypeFromMediaType(const String& mediaType)
-{
-    StringBuilder mimeType;
-    unsigned length = mediaType.length();
-    mimeType.reserveCapacity(length);
-    for (unsigned i = 0; i < length; i++) {
-        UChar c = mediaType[i];
-
-        if (c == ';')
-            break;
-
-        // While RFC 2616 does not allow it, other browsers allow multiple values in the HTTP media
-        // type header field, Content-Type. In such cases, the media type string passed here may contain
-        // the multiple values separated by commas. For now, this code ignores text after the first comma,
-        // which prevents it from simply failing to parse such types altogether. Later for better
-        // compatibility we could consider using the first or last valid MIME type instead.
-        // See https://bugs.webkit.org/show_bug.cgi?id=25352 for more discussion.
-        if (c == ',')
-            break;
-
-        // FIXME: The following is not correct. RFC 2616 allows linear white space before and
-        // after the MIME type, but not within the MIME type itself. And linear white space
-        // includes only a few specific ASCII characters; a small subset of isSpaceOrNewline.
-        // See https://bugs.webkit.org/show_bug.cgi?id=8644 for a bug tracking part of this.
-        if (isSpaceOrNewline(c))
-            continue;
-
-        mimeType.append(c);
-    }
-
-    if (mimeType.length() == length)
-        return mediaType;
-    return mimeType.toString();
-}
-
-String extractCharsetFromMediaType(const String& mediaType)
-{
-    unsigned int pos, len;
-    findCharsetInMediaType(mediaType, pos, len);
-    return mediaType.substring(pos, len);
-}
-
-void findCharsetInMediaType(const String& mediaType, unsigned int& charsetPos, unsigned int& charsetLen, unsigned int start)
-{
-    charsetPos = start;
-    charsetLen = 0;
-
-    size_t pos = start;
-    unsigned length = mediaType.length();
-
-    while (pos < length) {
-        pos = mediaType.find("charset", pos, false);
-        if (pos == kNotFound || !pos) {
-            charsetLen = 0;
-            return;
-        }
-
-        // is what we found a beginning of a word?
-        if (mediaType[pos-1] > ' ' && mediaType[pos-1] != ';') {
-            pos += 7;
-            continue;
-        }
-
-        pos += 7;
-
-        // skip whitespace
-        while (pos != length && mediaType[pos] <= ' ')
-            ++pos;
-
-        if (mediaType[pos++] != '=') // this "charset" substring wasn't a parameter name, but there may be others
-            continue;
-
-        while (pos != length && (mediaType[pos] <= ' ' || mediaType[pos] == '"' || mediaType[pos] == '\''))
-            ++pos;
-
-        // we don't handle spaces within quoted parameter values, because charset names cannot have any
-        unsigned endpos = pos;
-        while (pos != length && mediaType[endpos] > ' ' && mediaType[endpos] != '"' && mediaType[endpos] != '\'' && mediaType[endpos] != ';')
-            ++endpos;
-
-        charsetPos = pos;
-        charsetLen = endpos - pos;
-        return;
-    }
-}
-
-ContentSecurityPolicy::ReflectedXSSDisposition parseXSSProtectionHeader(const String& header, String& failureReason, unsigned& failurePosition, String& reportURL)
-{
-    DEFINE_STATIC_LOCAL(String, failureReasonInvalidToggle, ("expected 0 or 1"));
-    DEFINE_STATIC_LOCAL(String, failureReasonInvalidSeparator, ("expected semicolon"));
-    DEFINE_STATIC_LOCAL(String, failureReasonInvalidEquals, ("expected equals sign"));
-    DEFINE_STATIC_LOCAL(String, failureReasonInvalidMode, ("invalid mode directive"));
-    DEFINE_STATIC_LOCAL(String, failureReasonInvalidReport, ("invalid report directive"));
-    DEFINE_STATIC_LOCAL(String, failureReasonDuplicateMode, ("duplicate mode directive"));
-    DEFINE_STATIC_LOCAL(String, failureReasonDuplicateReport, ("duplicate report directive"));
-    DEFINE_STATIC_LOCAL(String, failureReasonInvalidDirective, ("unrecognized directive"));
-
-    unsigned pos = 0;
-
-    if (!skipWhiteSpace(header, pos, false))
-        return ContentSecurityPolicy::ReflectedXSSUnset;
-
-    if (header[pos] == '0')
-        return ContentSecurityPolicy::AllowReflectedXSS;
-
-    if (header[pos++] != '1') {
-        failureReason = failureReasonInvalidToggle;
-        return ContentSecurityPolicy::ReflectedXSSInvalid;
-    }
-
-    ContentSecurityPolicy::ReflectedXSSDisposition result = ContentSecurityPolicy::FilterReflectedXSS;
-    bool modeDirectiveSeen = false;
-    bool reportDirectiveSeen = false;
-
-    while (1) {
-        // At end of previous directive: consume whitespace, semicolon, and whitespace.
-        if (!skipWhiteSpace(header, pos, false))
-            return result;
-
-        if (header[pos++] != ';') {
-            failureReason = failureReasonInvalidSeparator;
-            failurePosition = pos;
-            return ContentSecurityPolicy::ReflectedXSSInvalid;
-        }
-
-        if (!skipWhiteSpace(header, pos, false))
-            return result;
-
-        // At start of next directive.
-        if (skipToken(header, pos, "mode")) {
-            if (modeDirectiveSeen) {
-                failureReason = failureReasonDuplicateMode;
-                failurePosition = pos;
-                return ContentSecurityPolicy::ReflectedXSSInvalid;
-            }
-            modeDirectiveSeen = true;
-            if (!skipEquals(header, pos)) {
-                failureReason = failureReasonInvalidEquals;
-                failurePosition = pos;
-                return ContentSecurityPolicy::ReflectedXSSInvalid;
-            }
-            if (!skipToken(header, pos, "block")) {
-                failureReason = failureReasonInvalidMode;
-                failurePosition = pos;
-                return ContentSecurityPolicy::ReflectedXSSInvalid;
-            }
-            result = ContentSecurityPolicy::BlockReflectedXSS;
-        } else if (skipToken(header, pos, "report")) {
-            if (reportDirectiveSeen) {
-                failureReason = failureReasonDuplicateReport;
-                failurePosition = pos;
-                return ContentSecurityPolicy::ReflectedXSSInvalid;
-            }
-            reportDirectiveSeen = true;
-            if (!skipEquals(header, pos)) {
-                failureReason = failureReasonInvalidEquals;
-                failurePosition = pos;
-                return ContentSecurityPolicy::ReflectedXSSInvalid;
-            }
-            size_t startPos = pos;
-            if (!skipValue(header, pos)) {
-                failureReason = failureReasonInvalidReport;
-                failurePosition = pos;
-                return ContentSecurityPolicy::ReflectedXSSInvalid;
-            }
-            reportURL = header.substring(startPos, pos - startPos);
-            failurePosition = startPos; // If later semantic check deems unacceptable.
-        } else {
-            failureReason = failureReasonInvalidDirective;
-            failurePosition = pos;
-            return ContentSecurityPolicy::ReflectedXSSInvalid;
-        }
-    }
-}
-
-ContentTypeOptionsDisposition parseContentTypeOptionsHeader(const String& header)
-{
-    if (header.stripWhiteSpace().lower() == "nosniff")
-        return ContentTypeOptionsNosniff;
-    return ContentTypeOptionsNone;
-}
-
-String extractReasonPhraseFromHTTPStatusLine(const String& statusLine)
-{
-    size_t spacePos = statusLine.find(' ');
-    // Remove status code from the status line.
-    spacePos = statusLine.find(' ', spacePos + 1);
-    return statusLine.substring(spacePos + 1);
-}
-
-XFrameOptionsDisposition parseXFrameOptionsHeader(const String& header)
-{
-    XFrameOptionsDisposition result = XFrameOptionsNone;
-
-    if (header.isEmpty())
-        return result;
-
-    Vector<String> headers;
-    header.split(',', headers);
-
-    for (size_t i = 0; i < headers.size(); i++) {
-        String currentHeader = headers[i].stripWhiteSpace();
-        XFrameOptionsDisposition currentValue = XFrameOptionsNone;
-        if (equalIgnoringCase(currentHeader, "deny"))
-            currentValue = XFrameOptionsDeny;
-        else if (equalIgnoringCase(currentHeader, "sameorigin"))
-            currentValue = XFrameOptionsSameOrigin;
-        else if (equalIgnoringCase(currentHeader, "allowall"))
-            currentValue = XFrameOptionsAllowAll;
-        else
-            currentValue = XFrameOptionsInvalid;
-
-        if (result == XFrameOptionsNone)
-            result = currentValue;
-        else if (result != currentValue)
-            return XFrameOptionsConflict;
-    }
-    return result;
-}
-
-bool parseRange(const String& range, long long& rangeOffset, long long& rangeEnd, long long& rangeSuffixLength)
-{
-    // The format of "Range" header is defined in RFC 2616 Section 14.35.1.
-    // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1
-    // We don't support multiple range requests.
-
-    rangeOffset = rangeEnd = rangeSuffixLength = -1;
-
-    // The "bytes" unit identifier should be present.
-    static const char bytesStart[] = "bytes=";
-    if (!range.startsWith(bytesStart, false))
-        return false;
-    String byteRange = range.substring(sizeof(bytesStart) - 1);
-
-    // The '-' character needs to be present.
-    int index = byteRange.find('-');
-    if (index == -1)
-        return false;
-
-    // If the '-' character is at the beginning, the suffix length, which specifies the last N bytes, is provided.
-    // Example:
-    //     -500
-    if (!index) {
-        String suffixLengthString = byteRange.substring(index + 1).stripWhiteSpace();
-        bool ok;
-        long long value = suffixLengthString.toInt64Strict(&ok);
-        if (ok)
-            rangeSuffixLength = value;
-        return true;
-    }
-
-    // Otherwise, the first-byte-position and the last-byte-position are provied.
-    // Examples:
-    //     0-499
-    //     500-
-    String firstBytePosStr = byteRange.left(index).stripWhiteSpace();
-    bool ok;
-    long long firstBytePos = firstBytePosStr.toInt64Strict(&ok);
-    if (!ok)
-        return false;
-
-    String lastBytePosStr = byteRange.substring(index + 1).stripWhiteSpace();
-    long long lastBytePos = -1;
-    if (!lastBytePosStr.isEmpty()) {
-        lastBytePos = lastBytePosStr.toInt64Strict(&ok);
-        if (!ok)
-            return false;
-    }
-
-    if (firstBytePos < 0 || !(lastBytePos == -1 || lastBytePos >= firstBytePos))
-        return false;
-
-    rangeOffset = firstBytePos;
-    rangeEnd = lastBytePos;
-    return true;
-}
-
-// HTTP/1.1 - RFC 2616
-// http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1
-// Request-Line = Method SP Request-URI SP HTTP-Version CRLF
-size_t parseHTTPRequestLine(const char* data, size_t length, String& failureReason, String& method, String& url, HTTPVersion& httpVersion)
-{
-    method = String();
-    url = String();
-    httpVersion = Unknown;
-
-    const char* space1 = 0;
-    const char* space2 = 0;
-    const char* p;
-    size_t consumedLength;
-
-    for (p = data, consumedLength = 0; consumedLength < length; p++, consumedLength++) {
-        if (*p == ' ') {
-            if (!space1)
-                space1 = p;
-            else if (!space2)
-                space2 = p;
-        } else if (*p == '\n')
-            break;
-    }
-
-    // Haven't finished header line.
-    if (consumedLength == length) {
-        failureReason = "Incomplete Request Line";
-        return 0;
-    }
-
-    // RequestLine does not contain 3 parts.
-    if (!space1 || !space2) {
-        failureReason = "Request Line does not appear to contain: <Method> <Url> <HTTPVersion>.";
-        return 0;
-    }
-
-    // The line must end with "\r\n".
-    const char* end = p + 1;
-    if (*(end - 2) != '\r') {
-        failureReason = "Request line does not end with CRLF";
-        return 0;
-    }
-
-    // Request Method.
-    method = String(data, space1 - data); // For length subtract 1 for space, but add 1 for data being the first character.
-
-    // Request URI.
-    url = String(space1 + 1, space2 - space1 - 1); // For length subtract 1 for space.
-
-    // HTTP Version.
-    String httpVersionString(space2 + 1, end - space2 - 3); // For length subtract 1 for space, and 2 for "\r\n".
-    if (httpVersionString.length() != 8 || !httpVersionString.startsWith("HTTP/1."))
-        httpVersion = Unknown;
-    else if (httpVersionString[7] == '0')
-        httpVersion = HTTP_1_0;
-    else if (httpVersionString[7] == '1')
-        httpVersion = HTTP_1_1;
-    else
-        httpVersion = Unknown;
-
-    return end - data;
-}
-
-size_t parseHTTPHeader(const char* start, size_t length, String& failureReason, AtomicString& nameStr, String& valueStr)
-{
-    const char* p = start;
-    const char* end = start + length;
-
-    Vector<char> name;
-    Vector<char> value;
-    nameStr = AtomicString();
-    valueStr = String();
-
-    for (; p < end; p++) {
-        switch (*p) {
-        case '\r':
-            if (name.isEmpty()) {
-                if (p + 1 < end && *(p + 1) == '\n')
-                    return (p + 2) - start;
-                failureReason = "CR doesn't follow LF at " + trimInputSample(p, end - p);
-                return 0;
-            }
-            failureReason = "Unexpected CR in name at " + trimInputSample(name.data(), name.size());
-            return 0;
-        case '\n':
-            failureReason = "Unexpected LF in name at " + trimInputSample(name.data(), name.size());
-            return 0;
-        case ':':
-            break;
-        default:
-            name.append(*p);
-            continue;
-        }
-        if (*p == ':') {
-            ++p;
-            break;
-        }
-    }
-
-    for (; p < end && *p == 0x20; p++) { }
-
-    for (; p < end; p++) {
-        switch (*p) {
-        case '\r':
-            break;
-        case '\n':
-            failureReason = "Unexpected LF in value at " + trimInputSample(value.data(), value.size());
-            return 0;
-        default:
-            value.append(*p);
-        }
-        if (*p == '\r') {
-            ++p;
-            break;
-        }
-    }
-    if (p >= end || *p != '\n') {
-        failureReason = "CR doesn't follow LF after value at " + trimInputSample(p, end - p);
-        return 0;
-    }
-    nameStr = AtomicString::fromUTF8(name.data(), name.size());
-    valueStr = String::fromUTF8(value.data(), value.size());
-    if (nameStr.isNull()) {
-        failureReason = "Invalid UTF-8 sequence in header name";
-        return 0;
-    }
-    if (valueStr.isNull()) {
-        failureReason = "Invalid UTF-8 sequence in header value";
-        return 0;
-    }
-    return p - start;
-}
-
-size_t parseHTTPRequestBody(const char* data, size_t length, Vector<unsigned char>& body)
-{
-    body.clear();
-    body.append(data, length);
-
-    return length;
-}
-
-}
diff --git a/Source/core/platform/network/HTTPParsers.h b/Source/core/platform/network/HTTPParsers.h
deleted file mode 100644
index c705f89..0000000
--- a/Source/core/platform/network/HTTPParsers.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * 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.
- * 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.
- *
- * 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 HTTPParsers_h
-#define HTTPParsers_h
-
-#include "core/page/ContentSecurityPolicy.h"
-#include "wtf/Forward.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class HTTPHeaderMap;
-class ResourceResponseBase;
-
-typedef enum {
-    ContentDispositionNone,
-    ContentDispositionInline,
-    ContentDispositionAttachment,
-    ContentDispositionOther
-} ContentDispositionType;
-
-enum ContentTypeOptionsDisposition {
-    ContentTypeOptionsNone,
-    ContentTypeOptionsNosniff
-};
-
-enum XFrameOptionsDisposition {
-    XFrameOptionsNone,
-    XFrameOptionsDeny,
-    XFrameOptionsSameOrigin,
-    XFrameOptionsAllowAll,
-    XFrameOptionsInvalid,
-    XFrameOptionsConflict
-};
-
-ContentDispositionType contentDispositionType(const String&);
-bool isValidHTTPHeaderValue(const String&);
-bool isValidHTTPToken(const String&);
-bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url);
-double parseDate(const String&);
-String filenameFromHTTPContentDisposition(const String&);
-String extractMIMETypeFromMediaType(const String&);
-String extractCharsetFromMediaType(const String&);
-void findCharsetInMediaType(const String& mediaType, unsigned int& charsetPos, unsigned int& charsetLen, unsigned int start = 0);
-ContentSecurityPolicy::ReflectedXSSDisposition parseXSSProtectionHeader(const String& header, String& failureReason, unsigned& failurePosition, String& reportURL);
-String extractReasonPhraseFromHTTPStatusLine(const String&);
-XFrameOptionsDisposition parseXFrameOptionsHeader(const String&);
-
-// -1 could be set to one of the return parameters to indicate the value is not specified.
-bool parseRange(const String&, long long& rangeOffset, long long& rangeEnd, long long& rangeSuffixLength);
-
-ContentTypeOptionsDisposition parseContentTypeOptionsHeader(const String& header);
-
-// Parsing Complete HTTP Messages.
-enum HTTPVersion { Unknown, HTTP_1_0, HTTP_1_1 };
-size_t parseHTTPRequestLine(const char* data, size_t length, String& failureReason, String& method, String& url, HTTPVersion&);
-size_t parseHTTPHeader(const char* data, size_t length, String& failureReason, AtomicString& nameStr, String& valueStr);
-size_t parseHTTPRequestBody(const char* data, size_t length, Vector<unsigned char>& body);
-
-}
-
-#endif
diff --git a/Source/core/platform/network/HTTPRequest.cpp b/Source/core/platform/network/HTTPRequest.cpp
deleted file mode 100644
index a61fa89..0000000
--- a/Source/core/platform/network/HTTPRequest.cpp
+++ /dev/null
@@ -1,118 +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 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/platform/network/HTTPRequest.h"
-
-#include "wtf/text/CString.h"
-
-namespace WebCore {
-
-PassRefPtr<HTTPRequest> HTTPRequest::parseHTTPRequestFromBuffer(const char* data, size_t length, String& failureReason)
-{
-    if (!length) {
-        failureReason = "No data to parse.";
-        return 0;
-    }
-
-    // Request we will be building.
-    RefPtr<HTTPRequest> request = HTTPRequest::create();
-
-    // Advance a pointer through the data as needed.
-    const char* pos = data;
-    size_t remainingLength = length;
-
-    // 1. Parse Method + URL.
-    size_t requestLineLength = request->parseRequestLine(pos, remainingLength, failureReason);
-    if (!requestLineLength)
-        return 0;
-    pos += requestLineLength;
-    remainingLength -= requestLineLength;
-
-    // 2. Parse HTTP Headers.
-    size_t headersLength = request->parseHeaders(pos, remainingLength, failureReason);
-    if (!headersLength)
-        return 0;
-    pos += headersLength;
-    remainingLength -= headersLength;
-
-    // 3. Parse HTTP Data.
-    size_t dataLength = request->parseRequestBody(pos, remainingLength);
-    pos += dataLength;
-    remainingLength -= dataLength;
-
-    // We should have processed the entire input.
-    ASSERT(!remainingLength);
-    return request.release();
-}
-
-size_t HTTPRequest::parseRequestLine(const char* data, size_t length, String& failureReason)
-{
-    String url;
-    size_t result = parseHTTPRequestLine(data, length, failureReason, m_requestMethod, url, m_httpVersion);
-    m_url = KURL(KURL(), url);
-    return result;
-}
-
-size_t HTTPRequest::parseHeaders(const char* data, size_t length, String& failureReason)
-{
-    const char* p = data;
-    const char* end = data + length;
-    AtomicString name;
-    String value;
-    for (; p < data + length; p++) {
-        size_t consumedLength = parseHTTPHeader(p, end - p, failureReason, name, value);
-        if (!consumedLength)
-            return 0;
-        p += consumedLength;
-        if (name.isEmpty())
-            break;
-        m_headerFields.add(name, value);
-    }
-    return p - data;
-}
-
-size_t HTTPRequest::parseRequestBody(const char* data, size_t length)
-{
-    return parseHTTPRequestBody(data, length, m_body);
-}
-
-HTTPRequest::HTTPRequest()
-    : m_httpVersion(Unknown)
-{
-}
-
-HTTPRequest::HTTPRequest(const String& requestMethod, const KURL& url, HTTPVersion version)
-    : m_url(url)
-    , m_httpVersion(version)
-    , m_requestMethod(requestMethod)
-{
-}
-
-HTTPRequest::~HTTPRequest()
-{
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/network/HTTPRequest.h b/Source/core/platform/network/HTTPRequest.h
deleted file mode 100644
index b1e5d33..0000000
--- a/Source/core/platform/network/HTTPRequest.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc.  All rights reserved.
- * 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:
- *
- *     * 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 HTTPRequest_h
-#define HTTPRequest_h
-
-#include "core/platform/network/HTTPHeaderMap.h"
-#include "core/platform/network/HTTPParsers.h"
-#include "weborigin/KURL.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class HTTPRequest : public RefCounted<HTTPRequest> {
-public:
-    static PassRefPtr<HTTPRequest> create() { return adoptRef(new HTTPRequest()); }
-    static PassRefPtr<HTTPRequest> create(const String& requestMethod, const KURL& url, HTTPVersion version) { return adoptRef(new HTTPRequest(requestMethod, url, version)); }
-    static PassRefPtr<HTTPRequest> parseHTTPRequestFromBuffer(const char* data, size_t length, String& failureReason);
-    virtual ~HTTPRequest();
-
-    String requestMethod() const { return m_requestMethod; }
-    void setRequestMethod(const String& method) { m_requestMethod = method; }
-
-    KURL url() const { return m_url; }
-    void setURL(const KURL& url) { m_url = url; }
-
-    const Vector<unsigned char>& body() const { return m_body; }
-
-    const HTTPHeaderMap& headerFields() const { return m_headerFields; }
-    void addHeaderField(const AtomicString& name, const String& value) { m_headerFields.add(name, value); }
-    void addHeaderField(const char* name, const String& value) { m_headerFields.add(name, value); }
-
-protected:
-    HTTPRequest();
-    HTTPRequest(const String& requestMethod, const KURL&, HTTPVersion);
-
-    // Parsing helpers.
-    size_t parseRequestLine(const char* data, size_t length, String& failureReason);
-    size_t parseHeaders(const char* data, size_t length, String& failureReason);
-    size_t parseRequestBody(const char* data, size_t length);
-
-    KURL m_url;
-    HTTPVersion m_httpVersion;
-    String m_requestMethod;
-    HTTPHeaderMap m_headerFields;
-    Vector<unsigned char> m_body;
-};
-
-} // namespace WebCore
-
-#endif // HTTPRequest_h
diff --git a/Source/core/platform/network/MIMEHeader.cpp b/Source/core/platform/network/MIMEHeader.cpp
deleted file mode 100644
index 168db89..0000000
--- a/Source/core/platform/network/MIMEHeader.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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/network/MIMEHeader.h"
-
-#include "core/platform/SharedBufferChunkReader.h"
-#include "core/platform/network/ParsedContentType.h"
-#include "wtf/HashMap.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/StringConcatenate.h"
-#include "wtf/text/StringHash.h"
-
-namespace WebCore {
-
-typedef HashMap<String, String> KeyValueMap;
-
-static KeyValueMap retrieveKeyValuePairs(WebCore::SharedBufferChunkReader* buffer)
-{
-    KeyValueMap keyValuePairs;
-    String line;
-    String key;
-    StringBuilder value;
-    while (!(line = buffer->nextChunkAsUTF8StringWithLatin1Fallback()).isNull()) {
-        if (line.isEmpty())
-            break; // Empty line means end of key/value section.
-        if (line[0] == '\t') {
-            ASSERT(!key.isEmpty());
-            value.append(line.substring(1));
-            continue;
-        }
-        // New key/value, store the previous one if any.
-        if (!key.isEmpty()) {
-            if (keyValuePairs.find(key) != keyValuePairs.end())
-                LOG_ERROR("Key duplicate found in MIME header. Key is '%s', previous value replaced.", key.ascii().data());
-            keyValuePairs.add(key, value.toString().stripWhiteSpace());
-            key = String();
-            value.clear();
-        }
-        size_t semiColonIndex = line.find(':');
-        if (semiColonIndex == kNotFound) {
-            // This is not a key value pair, ignore.
-            continue;
-        }
-        key = line.substring(0, semiColonIndex).lower().stripWhiteSpace();
-        value.append(line.substring(semiColonIndex + 1));
-    }
-    // Store the last property if there is one.
-    if (!key.isEmpty())
-        keyValuePairs.set(key, value.toString().stripWhiteSpace());
-    return keyValuePairs;
-}
-
-PassRefPtr<MIMEHeader> MIMEHeader::parseHeader(SharedBufferChunkReader* buffer)
-{
-    RefPtr<MIMEHeader> mimeHeader = adoptRef(new MIMEHeader);
-    KeyValueMap keyValuePairs = retrieveKeyValuePairs(buffer);
-    KeyValueMap::iterator mimeParametersIterator = keyValuePairs.find("content-type");
-    if (mimeParametersIterator != keyValuePairs.end()) {
-        ParsedContentType parsedContentType(mimeParametersIterator->value);
-        mimeHeader->m_contentType = parsedContentType.mimeType();
-        if (!mimeHeader->isMultipart())
-            mimeHeader->m_charset = parsedContentType.charset().stripWhiteSpace();
-        else {
-            mimeHeader->m_multipartType = parsedContentType.parameterValueForName("type");
-            mimeHeader->m_endOfPartBoundary = parsedContentType.parameterValueForName("boundary");
-            if (mimeHeader->m_endOfPartBoundary.isNull()) {
-                LOG_ERROR("No boundary found in multipart MIME header.");
-                return 0;
-            }
-            mimeHeader->m_endOfPartBoundary.insert("--", 0);
-            mimeHeader->m_endOfDocumentBoundary = mimeHeader->m_endOfPartBoundary;
-            mimeHeader->m_endOfDocumentBoundary.append("--");
-        }
-    }
-
-    mimeParametersIterator = keyValuePairs.find("content-transfer-encoding");
-    if (mimeParametersIterator != keyValuePairs.end())
-        mimeHeader->m_contentTransferEncoding = parseContentTransferEncoding(mimeParametersIterator->value);
-
-    mimeParametersIterator = keyValuePairs.find("content-location");
-    if (mimeParametersIterator != keyValuePairs.end())
-        mimeHeader->m_contentLocation = mimeParametersIterator->value;
-
-    return mimeHeader.release();
-}
-
-MIMEHeader::Encoding MIMEHeader::parseContentTransferEncoding(const String& text)
-{
-    String encoding = text.stripWhiteSpace().lower();
-    if (encoding == "base64")
-        return Base64;
-    if (encoding == "quoted-printable")
-        return QuotedPrintable;
-    if (encoding == "8bit")
-        return EightBit;
-    if (encoding == "7bit")
-        return SevenBit;
-    if (encoding == "binary")
-        return Binary;
-    LOG_ERROR("Unknown encoding '%s' found in MIME header.", text.ascii().data());
-    return Unknown;
-}
-
-MIMEHeader::MIMEHeader()
-    : m_contentTransferEncoding(Unknown)
-{
-}
-
-}
diff --git a/Source/core/platform/network/MIMEHeader.h b/Source/core/platform/network/MIMEHeader.h
deleted file mode 100644
index 2a724c3..0000000
--- a/Source/core/platform/network/MIMEHeader.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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 MIMEHeader_h
-#define MIMEHeader_h
-
-#include "wtf/HashMap.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class SharedBufferChunkReader;
-
-// FIXME: This class is a limited MIME parser used to parse the MIME headers of MHTML files.
-class MIMEHeader : public RefCounted<MIMEHeader> {
-public:
-    enum Encoding {
-        QuotedPrintable,
-        Base64,
-        EightBit,
-        SevenBit,
-        Binary,
-        Unknown
-    };
-
-    static PassRefPtr<MIMEHeader> parseHeader(SharedBufferChunkReader* crLFLineReader);
-
-    bool isMultipart() const { return m_contentType.startsWith("multipart/"); }
-
-    String contentType() const { return m_contentType; }
-    String charset() const { return m_charset; }
-    Encoding contentTransferEncoding() const { return m_contentTransferEncoding; }
-    String contentLocation() const { return m_contentLocation; }
-
-    // Multi-part type and boundaries are only valid for multipart MIME headers.
-    String multiPartType() const { return m_multipartType; }
-    String endOfPartBoundary() const { return m_endOfPartBoundary; }
-    String endOfDocumentBoundary() const { return m_endOfDocumentBoundary; }
-
-private:
-    MIMEHeader();
-
-    static Encoding parseContentTransferEncoding(const String&);
-
-    String m_contentType;
-    String m_charset;
-    Encoding m_contentTransferEncoding;
-    String m_contentLocation;
-    String m_multipartType;
-    String m_endOfPartBoundary;
-    String m_endOfDocumentBoundary;
-};
-
-}
-
-#endif
diff --git a/Source/core/platform/network/NetworkStateNotifier.cpp b/Source/core/platform/network/NetworkStateNotifier.cpp
deleted file mode 100644
index 94cb9d0..0000000
--- a/Source/core/platform/network/NetworkStateNotifier.cpp
+++ /dev/null
@@ -1,60 +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.
- */
-
-#include "config.h"
-#include "core/platform/network/NetworkStateNotifier.h"
-
-#include "wtf/Assertions.h"
-#include "wtf/StdLibExtras.h"
-#include "wtf/Threading.h"
-
-namespace WebCore {
-
-NetworkStateNotifier& networkStateNotifier()
-{
-    AtomicallyInitializedStatic(NetworkStateNotifier*, networkStateNotifier = new NetworkStateNotifier);
-
-    return *networkStateNotifier;
-}
-
-void NetworkStateNotifier::setNetworkStateChangedFunction(void(*function)())
-{
-    ASSERT(!m_networkStateChangedFunction);
-
-    m_networkStateChangedFunction = function;
-}
-
-void NetworkStateNotifier::setOnLine(bool onLine)
-{
-    if (m_isOnLine == onLine)
-        return;
-
-    m_isOnLine = onLine;
-
-    if (m_networkStateChangedFunction)
-        m_networkStateChangedFunction();
-}
-
-}
diff --git a/Source/core/platform/network/NetworkStateNotifier.h b/Source/core/platform/network/NetworkStateNotifier.h
deleted file mode 100644
index f5af308..0000000
--- a/Source/core/platform/network/NetworkStateNotifier.h
+++ /dev/null
@@ -1,62 +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 NetworkStateNotifier_h
-#define NetworkStateNotifier_h
-
-#include "wtf/FastAllocBase.h"
-#include "wtf/Noncopyable.h"
-
-namespace WebCore {
-
-class NetworkStateNotifier {
-    WTF_MAKE_NONCOPYABLE(NetworkStateNotifier); WTF_MAKE_FAST_ALLOCATED;
-public:
-    NetworkStateNotifier();
-    void setNetworkStateChangedFunction(void (*)());
-
-    bool onLine() const { return m_isOnLine; }
-    void setOnLine(bool);
-
-private:
-    bool m_isOnLine;
-    void (*m_networkStateChangedFunction)();
-
-    void updateState();
-};
-
-inline NetworkStateNotifier::NetworkStateNotifier()
-    : m_isOnLine(true)
-    , m_networkStateChangedFunction(0)
-{
-}
-
-inline void NetworkStateNotifier::updateState() { }
-
-NetworkStateNotifier& networkStateNotifier();
-
-};
-
-#endif // NetworkStateNotifier_h
diff --git a/Source/core/platform/network/ParsedContentType.cpp b/Source/core/platform/network/ParsedContentType.cpp
deleted file mode 100644
index 101d5a7..0000000
--- a/Source/core/platform/network/ParsedContentType.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
- /*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2012 Intel Corporation. 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/network/ParsedContentType.h"
-
-#include "wtf/text/CString.h"
-#include "wtf/text/StringBuilder.h"
-
-namespace WebCore {
-
-class DummyParsedContentType {
-public:
-    void setContentType(const SubstringRange&) const { }
-    void setContentTypeParameter(const SubstringRange&, const SubstringRange&) const { }
-};
-
-static void skipSpaces(const String& input, unsigned& startIndex)
-{
-    while (startIndex < input.length() && input[startIndex] == ' ')
-        ++startIndex;
-}
-
-static SubstringRange parseParameterPart(const String& input, unsigned& startIndex)
-{
-    unsigned inputLength = input.length();
-    unsigned tokenStart = startIndex;
-    unsigned& tokenEnd = startIndex;
-
-    if (tokenEnd >= inputLength)
-        return SubstringRange();
-
-    bool quoted = input[tokenStart] == '\"';
-    bool escape = false;
-
-    while (tokenEnd < inputLength) {
-        UChar c = input[tokenEnd];
-        if (quoted && tokenStart != tokenEnd && c == '\"' && !escape)
-            return SubstringRange(tokenStart + 1, tokenEnd++ - tokenStart - 1);
-        if (!quoted && (c == ';' || c == '='))
-            return SubstringRange(tokenStart, tokenEnd - tokenStart);
-        escape = !escape && c == '\\';
-        ++tokenEnd;
-    }
-
-    if (quoted)
-        return SubstringRange();
-    return SubstringRange(tokenStart, tokenEnd - tokenStart);
-}
-
-static String substringForRange(const String& string, const SubstringRange& range)
-{
-    return string.substring(range.first, range.second);
-}
-
-// From http://tools.ietf.org/html/rfc2045#section-5.1:
-//
-// content := "Content-Type" ":" type "/" subtype
-//            *(";" parameter)
-//            ; Matching of media type and subtype
-//            ; is ALWAYS case-insensitive.
-//
-// type := discrete-type / composite-type
-//
-// discrete-type := "text" / "image" / "audio" / "video" /
-//                  "application" / extension-token
-//
-// composite-type := "message" / "multipart" / extension-token
-//
-// extension-token := ietf-token / x-token
-//
-// ietf-token := <An extension token defined by a
-//                standards-track RFC and registered
-//                with IANA.>
-//
-// x-token := <The two characters "X-" or "x-" followed, with
-//             no intervening white space, by any token>
-//
-// subtype := extension-token / iana-token
-//
-// iana-token := <A publicly-defined extension token. Tokens
-//                of this form must be registered with IANA
-//                as specified in RFC 2048.>
-//
-// parameter := attribute "=" value
-//
-// attribute := token
-//              ; Matching of attributes
-//              ; is ALWAYS case-insensitive.
-//
-// value := token / quoted-string
-//
-// token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
-//             or tspecials>
-//
-// tspecials :=  "(" / ")" / "<" / ">" / "@" /
-//               "," / ";" / ":" / "\" / <">
-//               "/" / "[" / "]" / "?" / "="
-//               ; Must be in quoted-string,
-//               ; to use within parameter values
-
-template <class ReceiverType>
-bool parseContentType(const String& contentType, ReceiverType& receiver)
-{
-    unsigned index = 0;
-    unsigned contentTypeLength = contentType.length();
-    skipSpaces(contentType, index);
-    if (index >= contentTypeLength)  {
-        LOG_ERROR("Invalid Content-Type string '%s'", contentType.ascii().data());
-        return false;
-    }
-
-    // There should not be any quoted strings until we reach the parameters.
-    size_t semiColonIndex = contentType.find(';', index);
-    if (semiColonIndex == kNotFound) {
-        receiver.setContentType(SubstringRange(index, contentTypeLength - index));
-        return true;
-    }
-
-    receiver.setContentType(SubstringRange(index, semiColonIndex - index));
-    index = semiColonIndex + 1;
-    while (true) {
-        skipSpaces(contentType, index);
-        SubstringRange keyRange = parseParameterPart(contentType, index);
-        if (!keyRange.second || index >= contentTypeLength) {
-            LOG_ERROR("Invalid Content-Type parameter name. (at %i)", index);
-            return false;
-        }
-
-        // Should we tolerate spaces here?
-        if (contentType[index++] != '=' || index >= contentTypeLength) {
-            LOG_ERROR("Invalid Content-Type malformed parameter (at %i).", index);
-            return false;
-        }
-
-        // Should we tolerate spaces here?
-        SubstringRange valueRange = parseParameterPart(contentType, index);
-
-        if (!valueRange.second) {
-            LOG_ERROR("Invalid Content-Type, invalid parameter value (at %i, for '%s').", index, substringForRange(contentType, keyRange).stripWhiteSpace().ascii().data());
-            return false;
-        }
-
-        // Should we tolerate spaces here?
-        if (index < contentTypeLength && contentType[index++] != ';') {
-            LOG_ERROR("Invalid Content-Type, invalid character at the end of key/value parameter (at %i).", index);
-            return false;
-        }
-
-        receiver.setContentTypeParameter(keyRange, valueRange);
-
-        if (index >= contentTypeLength)
-            return true;
-    }
-
-    return true;
-}
-
-bool isValidContentType(const String& contentType)
-{
-    if (contentType.contains('\r') || contentType.contains('\n'))
-        return false;
-
-    DummyParsedContentType parsedContentType = DummyParsedContentType();
-    return parseContentType<DummyParsedContentType>(contentType, parsedContentType);
-}
-
-ParsedContentType::ParsedContentType(const String& contentType)
-    : m_contentType(contentType.stripWhiteSpace())
-{
-    parseContentType<ParsedContentType>(m_contentType, *this);
-}
-
-String ParsedContentType::charset() const
-{
-    return parameterValueForName("charset");
-}
-
-String ParsedContentType::parameterValueForName(const String& name) const
-{
-    return m_parameters.get(name);
-}
-
-size_t ParsedContentType::parameterCount() const
-{
-    return m_parameters.size();
-}
-
-void ParsedContentType::setContentType(const SubstringRange& contentRange)
-{
-    m_mimeType = substringForRange(m_contentType, contentRange).stripWhiteSpace();
-}
-
-void ParsedContentType::setContentTypeParameter(const SubstringRange& key, const SubstringRange& value)
-{
-    m_parameters.set(substringForRange(m_contentType, key), substringForRange(m_contentType, value));
-}
-
-}
diff --git a/Source/core/platform/network/ParsedContentType.h b/Source/core/platform/network/ParsedContentType.h
deleted file mode 100644
index c463c19..0000000
--- a/Source/core/platform/network/ParsedContentType.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2012 Intel Corporation. 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 ParsedContentType_h
-#define ParsedContentType_h
-
-#include "wtf/HashMap.h"
-#include "wtf/text/StringHash.h"
-
-namespace WebCore {
-
-// <index, length>
-typedef std::pair<unsigned, unsigned> SubstringRange;
-bool isValidContentType(const String&);
-
-// FIXME: add support for comments.
-class ParsedContentType {
-public:
-    explicit ParsedContentType(const String&);
-
-    String mimeType() const { return m_mimeType; }
-    String charset() const;
-
-    // Note that in the case of multiple values for the same name, the last value is returned.
-    String parameterValueForName(const String&) const;
-    size_t parameterCount() const;
-
-private:
-    template<class ReceiverType>
-    friend bool parseContentType(const String&, ReceiverType&);
-    void setContentType(const SubstringRange&);
-    void setContentTypeParameter(const SubstringRange&, const SubstringRange&);
-
-    typedef HashMap<String, String> KeyValuePairs;
-    String m_contentType;
-    KeyValuePairs m_parameters;
-    String m_mimeType;
-};
-
-}
-
-#endif
diff --git a/Source/core/platform/network/ProxyServer.cpp b/Source/core/platform/network/ProxyServer.cpp
deleted file mode 100644
index e9b589b..0000000
--- a/Source/core/platform/network/ProxyServer.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#include "config.h"
-#include "core/platform/network/ProxyServer.h"
-
-#include "wtf/text/StringBuilder.h"
-
-namespace WebCore {
-
-static void appendProxyServerString(StringBuilder& builder, const ProxyServer& proxyServer)
-{
-    switch (proxyServer.type()) {
-    case ProxyServer::Direct:
-        builder.append("DIRECT");
-        return;
-    case ProxyServer::HTTP:
-    case ProxyServer::HTTPS:
-        builder.append("PROXY");
-        break;
-    case ProxyServer::SOCKS:
-        builder.append("SOCKS");
-        break;
-    }
-
-    builder.append(' ');
-
-    ASSERT(!proxyServer.hostName().isNull());
-    builder.append(proxyServer.hostName());
-
-    builder.append(':');
-    ASSERT(proxyServer.port() != -1);
-    builder.appendNumber(proxyServer.port());
-}
-
-String toString(const Vector<ProxyServer>& proxyServers)
-{
-    if (proxyServers.isEmpty())
-        return "DIRECT";
-
-    StringBuilder stringBuilder;
-    for (size_t i = 0; i < proxyServers.size(); ++i) {
-        if (i)
-            stringBuilder.append("; ");
-
-        appendProxyServerString(stringBuilder, proxyServers[i]);
-    }
-
-    return stringBuilder.toString();
-}
-
-
-} // namespace WebCore
diff --git a/Source/core/platform/network/ProxyServer.h b/Source/core/platform/network/ProxyServer.h
deleted file mode 100644
index d46a883..0000000
--- a/Source/core/platform/network/ProxyServer.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2010 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 ProxyServer_h
-#define ProxyServer_h
-
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class KURL;
-class NetworkingContext;
-
-// Represents a single proxy server.
-class ProxyServer {
-public:
-    enum Type {
-        Direct,
-        HTTP,
-        HTTPS,
-        SOCKS,
-    };
-
-    ProxyServer()
-        : m_type(Direct)
-        , m_port(-1)
-    {
-    }
-
-    ProxyServer(Type type, const String& hostName, int port)
-        : m_type(type)
-        , m_hostName(hostName)
-        , m_port(port)
-    {
-    }
-
-    Type type() const { return m_type; }
-    const String& hostName() const { return m_hostName; }
-    int port() const { return m_port; }
-
-private:
-    Type m_type;
-    String m_hostName;
-    int m_port;
-};
-
-// Return a vector of proxy servers for the given URL.
-Vector<ProxyServer> proxyServersForURL(const KURL&, const NetworkingContext*);
-
-// Converts the given vector of proxy servers to a PAC string, as described in
-// http://web.archive.org/web/20060424005037/wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html
-String toString(const Vector<ProxyServer>&);
-
-} // namespace WebCore
-
-#endif // ProxyServer_h
diff --git a/Source/core/platform/network/ResourceError.cpp b/Source/core/platform/network/ResourceError.cpp
deleted file mode 100644
index 0ee01b3..0000000
--- a/Source/core/platform/network/ResourceError.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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 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,
- * 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/network/ResourceError.h"
-
-#include "public/platform/Platform.h"
-#include "public/platform/WebURL.h"
-#include "public/platform/WebURLError.h"
-#include "weborigin/KURL.h"
-
-namespace WebCore {
-
-const char* const errorDomainWebKitInternal = "WebKitInternal";
-
-ResourceError ResourceError::cancelledError(const String& failingURL)
-{
-    return WebKit::Platform::current()->cancelledError(KURL(ParsedURLString, failingURL));
-}
-
-ResourceError ResourceError::copy() const
-{
-    ResourceError errorCopy;
-    errorCopy.m_domain = m_domain.isolatedCopy();
-    errorCopy.m_errorCode = m_errorCode;
-    errorCopy.m_failingURL = m_failingURL.isolatedCopy();
-    errorCopy.m_localizedDescription = m_localizedDescription.isolatedCopy();
-    errorCopy.m_isNull = m_isNull;
-    errorCopy.m_isCancellation = m_isCancellation;
-    errorCopy.m_isTimeout = m_isTimeout;
-    return errorCopy;
-}
-
-bool ResourceError::compare(const ResourceError& a, const ResourceError& b)
-{
-    if (a.isNull() && b.isNull())
-        return true;
-
-    if (a.isNull() || b.isNull())
-        return false;
-
-    if (a.domain() != b.domain())
-        return false;
-
-    if (a.errorCode() != b.errorCode())
-        return false;
-
-    if (a.failingURL() != b.failingURL())
-        return false;
-
-    if (a.localizedDescription() != b.localizedDescription())
-        return false;
-
-    if (a.isCancellation() != b.isCancellation())
-        return false;
-
-    if (a.isTimeout() != b.isTimeout())
-        return false;
-
-    return true;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/network/ResourceError.h b/Source/core/platform/network/ResourceError.h
deleted file mode 100644
index ec1d3a8..0000000
--- a/Source/core/platform/network/ResourceError.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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 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,
- * 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 ResourceError_h
-#define ResourceError_h
-
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-extern const char* const errorDomainWebKitInternal; // Used for errors that won't be exposed to clients.
-
-class ResourceError {
-public:
-    static ResourceError cancelledError(const String& failingURL);
-
-    ResourceError()
-        : m_errorCode(0)
-        , m_isNull(true)
-        , m_isCancellation(false)
-        , m_isTimeout(false)
-    {
-    }
-
-    ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription)
-        : m_domain(domain)
-        , m_errorCode(errorCode)
-        , m_failingURL(failingURL)
-        , m_localizedDescription(localizedDescription)
-        , m_isNull(false)
-        , m_isCancellation(false)
-        , m_isTimeout(false)
-    {
-    }
-
-    // Makes a deep copy. Useful for when you need to use a ResourceError on another thread.
-    ResourceError copy() const;
-
-    bool isNull() const { return m_isNull; }
-
-    const String& domain() const { return m_domain; }
-    int errorCode() const { return m_errorCode; }
-    const String& failingURL() const { return m_failingURL; }
-    const String& localizedDescription() const { return m_localizedDescription; }
-
-    void setIsCancellation(bool isCancellation) { m_isCancellation = isCancellation; }
-    bool isCancellation() const { return m_isCancellation; }
-
-    void setIsTimeout(bool isTimeout) { m_isTimeout = isTimeout; }
-    bool isTimeout() const { return m_isTimeout; }
-
-    static bool compare(const ResourceError&, const ResourceError&);
-
-private:
-    String m_domain;
-    int m_errorCode;
-    String m_failingURL;
-    String m_localizedDescription;
-    bool m_isNull;
-    bool m_isCancellation;
-    bool m_isTimeout;
-};
-
-inline bool operator==(const ResourceError& a, const ResourceError& b) { return ResourceError::compare(a, b); }
-inline bool operator!=(const ResourceError& a, const ResourceError& b) { return !(a == b); }
-
-} // namespace WebCore
-
-#endif // ResourceError_h
diff --git a/Source/core/platform/network/ResourceLoadInfo.h b/Source/core/platform/network/ResourceLoadInfo.h
index 0e9926c..32758b5 100644
--- a/Source/core/platform/network/ResourceLoadInfo.h
+++ b/Source/core/platform/network/ResourceLoadInfo.h
@@ -27,7 +27,7 @@
 #ifndef ResourceLoadInfo_h
 #define ResourceLoadInfo_h
 
-#include "core/platform/network/HTTPHeaderMap.h"
+#include "platform/network/HTTPHeaderMap.h"
 #include "wtf/RefCounted.h"
 
 namespace WebCore {
diff --git a/Source/core/platform/network/ResourceRequest.cpp b/Source/core/platform/network/ResourceRequest.cpp
index 670d1fa..cea73a1 100644
--- a/Source/core/platform/network/ResourceRequest.cpp
+++ b/Source/core/platform/network/ResourceRequest.cpp
@@ -247,6 +247,11 @@
         addHTTPHeaderField(it->key, it->value);
 }
 
+void ResourceRequest::clearHTTPHeaderField(const AtomicString& name)
+{
+    m_httpHeaderFields.remove(name);
+}
+
 bool equalIgnoringHeaderFields(const ResourceRequest& a, const ResourceRequest& b)
 {
     if (a.url() != b.url())
diff --git a/Source/core/platform/network/ResourceRequest.h b/Source/core/platform/network/ResourceRequest.h
index d54305a..9332c9c 100644
--- a/Source/core/platform/network/ResourceRequest.h
+++ b/Source/core/platform/network/ResourceRequest.h
@@ -29,8 +29,8 @@
 #define ResourceRequest_h
 
 #include "core/platform/network/FormData.h"
-#include "core/platform/network/HTTPHeaderMap.h"
 #include "core/platform/network/ResourceLoadPriority.h"
+#include "platform/network/HTTPHeaderMap.h"
 #include "weborigin/KURL.h"
 #include "wtf/OwnPtr.h"
 
@@ -127,6 +127,7 @@
         void setHTTPHeaderField(const char* name, const String& value);
         void addHTTPHeaderField(const AtomicString& name, const String& value);
         void addHTTPHeaderFields(const HTTPHeaderMap& headerFields);
+        void clearHTTPHeaderField(const AtomicString& name);
 
         void clearHTTPAuthorization();
 
diff --git a/Source/core/platform/network/ResourceResponse.cpp b/Source/core/platform/network/ResourceResponse.cpp
index 2b27a64..5b33ce8 100644
--- a/Source/core/platform/network/ResourceResponse.cpp
+++ b/Source/core/platform/network/ResourceResponse.cpp
@@ -27,7 +27,7 @@
 #include "config.h"
 #include "core/platform/network/ResourceResponse.h"
 
-#include "core/platform/network/HTTPParsers.h"
+#include "platform/network/HTTPParsers.h"
 #include "core/platform/network/ResourceResponse.h"
 #include "wtf/CurrentTime.h"
 #include "wtf/MathExtras.h"
@@ -315,6 +315,11 @@
         result.iterator->value = result.iterator->value + ", " + value;
 }
 
+void ResourceResponse::clearHTTPHeaderField(const AtomicString& name)
+{
+    m_httpHeaderFields.remove(name);
+}
+
 const HTTPHeaderMap& ResourceResponse::httpHeaderFields() const
 {
     return m_httpHeaderFields;
diff --git a/Source/core/platform/network/ResourceResponse.h b/Source/core/platform/network/ResourceResponse.h
index 7ce23ae..18f41ee 100644
--- a/Source/core/platform/network/ResourceResponse.h
+++ b/Source/core/platform/network/ResourceResponse.h
@@ -28,9 +28,9 @@
 #define ResourceResponse_h
 
 #include "core/platform/network/BlobData.h"
-#include "core/platform/network/HTTPHeaderMap.h"
 #include "core/platform/network/ResourceLoadInfo.h"
 #include "core/platform/network/ResourceLoadTiming.h"
+#include "platform/network/HTTPHeaderMap.h"
 #include "weborigin/KURL.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
@@ -88,6 +88,7 @@
     String httpHeaderField(const char* name) const;
     void setHTTPHeaderField(const AtomicString& name, const String& value);
     void addHTTPHeaderField(const AtomicString& name, const String& value);
+    void clearHTTPHeaderField(const AtomicString& name);
     const HTTPHeaderMap& httpHeaderFields() const;
 
     bool isMultipart() const { return mimeType() == "multipart/x-mixed-replace"; }
diff --git a/Source/core/platform/network/SocketStreamError.cpp b/Source/core/platform/network/SocketStreamError.cpp
deleted file mode 100644
index 7f746c8..0000000
--- a/Source/core/platform/network/SocketStreamError.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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
- * 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/network/SocketStreamError.h"
-
-namespace WebCore {
-
-bool SocketStreamError::compare(const SocketStreamError& a, const SocketStreamError& b)
-{
-    if (a.isNull() && b.isNull())
-        return true;
-
-    if (a.isNull() || b.isNull())
-        return false;
-
-    if (a.errorCode() != b.errorCode())
-        return false;
-
-    if (a.failingURL() != b.failingURL())
-        return false;
-
-    if (a.localizedDescription() != b.localizedDescription())
-        return false;
-
-    return true;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/network/SocketStreamError.h b/Source/core/platform/network/SocketStreamError.h
deleted file mode 100644
index d4554c6..0000000
--- a/Source/core/platform/network/SocketStreamError.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2009 Apple 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
- * 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 SocketStreamError_h
-#define SocketStreamError_h
-
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class SocketStreamError : public RefCounted<SocketStreamError> {
-public:
-    static PassRefPtr<SocketStreamError> create(int errorCode, const String& errorMessage)
-    {
-        return adoptRef(new SocketStreamError(errorCode, errorMessage));
-    }
-
-    bool isNull() const { return m_isNull; }
-
-    int errorCode() const { return m_errorCode; }
-    const String& failingURL() const { return m_failingURL; }
-    const String& localizedDescription() const { return m_localizedDescription; }
-
-    static bool compare(const SocketStreamError&, const SocketStreamError&);
-
-private:
-    explicit SocketStreamError(int errorCode, const String& errorMessage)
-        : m_errorCode(errorCode)
-        , m_localizedDescription(errorMessage)
-        , m_isNull(false)
-    {
-    }
-
-    int m_errorCode;
-    String m_failingURL; // FIXME: Can this be deleted since it is always empty?
-    String m_localizedDescription;
-    bool m_isNull;
-};
-
-inline bool operator==(const SocketStreamError& a, const SocketStreamError& b) { return SocketStreamError::compare(a, b); }
-inline bool operator!=(const SocketStreamError& a, const SocketStreamError& b) { return !(a == b); }
-
-}  // namespace WebCore
-
-#endif  // SocketStreamError_h
diff --git a/Source/core/platform/network/SocketStreamHandle.cpp b/Source/core/platform/network/SocketStreamHandle.cpp
deleted file mode 100644
index 47b3eae..0000000
--- a/Source/core/platform/network/SocketStreamHandle.cpp
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (C) 2009, 2011, 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:
- *
- *     * 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/network/SocketStreamHandle.h"
-
-#include "core/platform/Logging.h"
-#include "core/platform/NotImplemented.h"
-#include "core/platform/network/SocketStreamError.h"
-#include "core/platform/network/SocketStreamHandleClient.h"
-#include "core/platform/network/SocketStreamHandleInternal.h"
-#include "public/platform/Platform.h"
-#include "public/platform/WebData.h"
-#include "public/platform/WebSocketStreamError.h"
-#include "public/platform/WebSocketStreamHandle.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebCore {
-
-static const unsigned int bufferSize = 100 * 1024 * 1024;
-
-SocketStreamHandleInternal::SocketStreamHandleInternal(SocketStreamHandle* handle)
-    : m_handle(handle)
-    , m_maxPendingSendAllowed(0)
-    , m_pendingAmountSent(0)
-{
-}
-
-SocketStreamHandleInternal::~SocketStreamHandleInternal()
-{
-    m_handle = 0;
-}
-
-void SocketStreamHandleInternal::connect(const KURL& url)
-{
-    m_socket = adoptPtr(WebKit::Platform::current()->createSocketStreamHandle());
-    LOG(Network, "SocketStreamHandleInternal %p connect()", this);
-    ASSERT(m_socket);
-    ASSERT(m_handle);
-    if (m_handle->m_client)
-        m_handle->m_client->willOpenSocketStream(m_handle);
-    m_socket->connect(url, this);
-}
-
-int SocketStreamHandleInternal::send(const char* data, int len)
-{
-    LOG(Network, "SocketStreamHandleInternal %p send() len=%d", this, len);
-    // FIXME: |m_socket| should not be null here, but it seems that there is the
-    // case. We should figure out such a path and fix it rather than checking
-    // null here.
-    if (!m_socket) {
-        LOG(Network, "SocketStreamHandleInternal %p send() m_socket is NULL", this);
-        return 0;
-    }
-    if (m_pendingAmountSent + len > m_maxPendingSendAllowed)
-        len = m_maxPendingSendAllowed - m_pendingAmountSent;
-
-    if (len <= 0)
-        return len;
-    WebKit::WebData webdata(data, len);
-    if (m_socket->send(webdata)) {
-        m_pendingAmountSent += len;
-        LOG(Network, "SocketStreamHandleInternal %p send() Sent %d bytes", this, len);
-        return len;
-    }
-    LOG(Network, "SocketStreamHandleInternal %p send() m_socket->send() failed", this);
-    return 0;
-}
-
-void SocketStreamHandleInternal::close()
-{
-    LOG(Network, "SocketStreamHandleInternal %p close()", this);
-    if (m_socket)
-        m_socket->close();
-}
-
-void SocketStreamHandleInternal::didOpenStream(WebKit::WebSocketStreamHandle* socketHandle, int maxPendingSendAllowed)
-{
-    LOG(Network, "SocketStreamHandleInternal %p didOpenStream() maxPendingSendAllowed=%d", this, maxPendingSendAllowed);
-    ASSERT(maxPendingSendAllowed > 0);
-    if (m_handle && m_socket) {
-        ASSERT(socketHandle == m_socket.get());
-        m_maxPendingSendAllowed = maxPendingSendAllowed;
-        m_handle->m_state = SocketStreamHandle::Open;
-        if (m_handle->m_client) {
-            m_handle->m_client->didOpenSocketStream(m_handle);
-            return;
-        }
-    }
-    LOG(Network, "SocketStreamHandleInternal %p didOpenStream() m_handle or m_socket is NULL", this);
-}
-
-void SocketStreamHandleInternal::didSendData(WebKit::WebSocketStreamHandle* socketHandle, int amountSent)
-{
-    LOG(Network, "SocketStreamHandleInternal %p didSendData() amountSent=%d", this, amountSent);
-    ASSERT(amountSent > 0);
-    if (m_handle && m_socket) {
-        ASSERT(socketHandle == m_socket.get());
-        m_pendingAmountSent -= amountSent;
-        ASSERT(m_pendingAmountSent >= 0);
-        m_handle->sendPendingData();
-    }
-}
-
-void SocketStreamHandleInternal::didReceiveData(WebKit::WebSocketStreamHandle* socketHandle, const WebKit::WebData& data)
-{
-    LOG(Network, "SocketStreamHandleInternal %p didReceiveData() Received %lu bytes", this, static_cast<unsigned long>(data.size()));
-    if (m_handle && m_socket) {
-        ASSERT(socketHandle == m_socket.get());
-        if (m_handle->m_client)
-            m_handle->m_client->didReceiveSocketStreamData(m_handle, data.data(), data.size());
-    }
-}
-
-void SocketStreamHandleInternal::didClose(WebKit::WebSocketStreamHandle* socketHandle)
-{
-    LOG(Network, "SocketStreamHandleInternal %p didClose()", this);
-    if (m_handle && m_socket) {
-        ASSERT(socketHandle == m_socket.get());
-        m_socket.clear();
-        SocketStreamHandle* h = m_handle;
-        m_handle = 0;
-        if (h->m_client)
-            h->m_client->didCloseSocketStream(h);
-    }
-}
-
-void SocketStreamHandleInternal::didFail(WebKit::WebSocketStreamHandle* socketHandle, const WebKit::WebSocketStreamError& err)
-{
-    LOG(Network, "SocketStreamHandleInternal %p didFail()", this);
-    if (m_handle && m_socket) {
-        ASSERT(socketHandle == m_socket.get());
-        if (m_handle->m_client)
-            m_handle->m_client->didFailSocketStream(m_handle, *(PassRefPtr<SocketStreamError>(err)));
-    }
-}
-
-// SocketStreamHandle ----------------------------------------------------------
-
-SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient* client)
-    : m_url(url)
-    , m_client(client)
-    , m_state(Connecting)
-{
-    m_internal = SocketStreamHandleInternal::create(this);
-    m_internal->connect(m_url);
-}
-
-SocketStreamHandle::~SocketStreamHandle()
-{
-    setClient(0);
-    m_internal.clear();
-}
-
-SocketStreamHandle::SocketStreamState SocketStreamHandle::state() const
-{
-    return m_state;
-}
-
-bool SocketStreamHandle::send(const char* data, int length)
-{
-    if (m_state == Connecting || m_state == Closing)
-        return false;
-    if (!m_buffer.isEmpty()) {
-        if (m_buffer.size() + length > bufferSize) {
-            // FIXME: report error to indicate that buffer has no more space.
-            return false;
-        }
-        m_buffer.append(data, length);
-        if (m_client)
-            m_client->didUpdateBufferedAmount(static_cast<SocketStreamHandle*>(this), bufferedAmount());
-        return true;
-    }
-    int bytesWritten = 0;
-    if (m_state == Open)
-        bytesWritten = sendInternal(data, length);
-    if (bytesWritten < 0)
-        return false;
-    if (m_buffer.size() + length - bytesWritten > bufferSize) {
-        // FIXME: report error to indicate that buffer has no more space.
-        return false;
-    }
-    if (bytesWritten < length) {
-        m_buffer.append(data + bytesWritten, length - bytesWritten);
-        if (m_client)
-            m_client->didUpdateBufferedAmount(static_cast<SocketStreamHandle*>(this), bufferedAmount());
-    }
-    return true;
-}
-
-void SocketStreamHandle::close()
-{
-    if (m_state == Closed)
-        return;
-    m_state = Closing;
-    if (!m_buffer.isEmpty())
-        return;
-    disconnect();
-}
-
-void SocketStreamHandle::disconnect()
-{
-    RefPtr<SocketStreamHandle> protect(static_cast<SocketStreamHandle*>(this)); // closeInternal calls the client, which may make the handle get deallocated immediately.
-
-    closeInternal();
-    m_state = Closed;
-}
-
-void SocketStreamHandle::setClient(SocketStreamHandleClient* client)
-{
-    ASSERT(!client || (!m_client && m_state == Connecting));
-    m_client = client;
-}
-
-bool SocketStreamHandle::sendPendingData()
-{
-    if (m_state != Open && m_state != Closing)
-        return false;
-    if (m_buffer.isEmpty()) {
-        if (m_state == Open)
-            return false;
-        if (m_state == Closing) {
-            disconnect();
-            return false;
-        }
-    }
-    bool pending;
-    do {
-        int bytesWritten = sendInternal(m_buffer.firstBlockData(), m_buffer.firstBlockSize());
-        pending = bytesWritten != static_cast<int>(m_buffer.firstBlockSize());
-        if (bytesWritten <= 0)
-            return false;
-        ASSERT(m_buffer.size() - bytesWritten <= bufferSize);
-        m_buffer.consume(bytesWritten);
-    } while (!pending && !m_buffer.isEmpty());
-    if (m_client)
-        m_client->didUpdateBufferedAmount(static_cast<SocketStreamHandle*>(this), bufferedAmount());
-    return true;
-}
-
-int SocketStreamHandle::sendInternal(const char* buf, int len)
-{
-    if (!m_internal)
-        return 0;
-    return m_internal->send(buf, len);
-}
-
-void SocketStreamHandle::closeInternal()
-{
-    if (m_internal)
-        m_internal->close();
-}
-
-}  // namespace WebCore
diff --git a/Source/core/platform/network/SocketStreamHandle.h b/Source/core/platform/network/SocketStreamHandle.h
deleted file mode 100644
index 091027b..0000000
--- a/Source/core/platform/network/SocketStreamHandle.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2009, 2011, 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:
- *
- *     * 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 SocketStreamHandle_h
-#define SocketStreamHandle_h
-
-#include "weborigin/KURL.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/StreamBuffer.h"
-
-namespace WebCore {
-
-class SocketStreamHandleClient;
-class SocketStreamHandleInternal;
-
-class SocketStreamHandle : public RefCounted<SocketStreamHandle> {
-public:
-    enum SocketStreamState { Connecting, Open, Closing, Closed };
-
-    static PassRefPtr<SocketStreamHandle> create(const KURL& url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(url, client)); }
-
-    virtual ~SocketStreamHandle();
-    SocketStreamState state() const;
-
-    bool send(const char* data, int length);
-    void close(); // Disconnect after all data in buffer are sent.
-    void disconnect();
-    size_t bufferedAmount() const { return m_buffer.size(); }
-
-    SocketStreamHandleClient* client() const { return m_client; }
-    void setClient(SocketStreamHandleClient*);
-
-private:
-    SocketStreamHandle(const KURL&, SocketStreamHandleClient*);
-
-    bool sendPendingData();
-
-    int sendInternal(const char* data, int length);
-    void closeInternal();
-
-    KURL m_url;
-    SocketStreamHandleClient* m_client;
-    StreamBuffer<char, 1024 * 1024> m_buffer;
-    SocketStreamState m_state;
-
-    friend class SocketStreamHandleInternal;
-    OwnPtr<SocketStreamHandleInternal> m_internal;
-};
-
-} // namespace WebCore
-
-#endif  // SocketStreamHandle_h
diff --git a/Source/core/platform/network/SocketStreamHandleClient.h b/Source/core/platform/network/SocketStreamHandleClient.h
deleted file mode 100644
index 6958fb5..0000000
--- a/Source/core/platform/network/SocketStreamHandleClient.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2009, 2011, 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:
- *
- *     * 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 SocketStreamHandleClient_h
-#define SocketStreamHandleClient_h
-
-namespace WebCore {
-
-    class KURL;
-    class SocketStreamError;
-    class SocketStreamHandle;
-
-    class SocketStreamHandleClient {
-    public:
-        virtual ~SocketStreamHandleClient() { }
-
-        virtual void willOpenSocketStream(SocketStreamHandle*) { }
-        virtual void didOpenSocketStream(SocketStreamHandle*) { }
-        virtual void didCloseSocketStream(SocketStreamHandle*) { }
-        virtual void didReceiveSocketStreamData(SocketStreamHandle*, const char* /*data*/, int /*length*/) { }
-        virtual void didUpdateBufferedAmount(SocketStreamHandle*, size_t /*bufferedAmount*/) { }
-
-        virtual void didFailSocketStream(SocketStreamHandle*, const SocketStreamError&) { }
-    };
-
-}  // namespace WebCore
-
-#endif  // SocketStreamHandleClient_h
diff --git a/Source/core/platform/network/SocketStreamHandleInternal.h b/Source/core/platform/network/SocketStreamHandleInternal.h
deleted file mode 100644
index 55f5de0..0000000
--- a/Source/core/platform/network/SocketStreamHandleInternal.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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:
- *
- *     * 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 SocketStreamHandleInternal_h
-#define SocketStreamHandleInternal_h
-
-#include "core/platform/network/SocketStreamHandle.h"
-#include "public/platform/WebSocketStreamHandleClient.h"
-#include "public/platform/WebURL.h"
-#include "wtf/PassOwnPtr.h"
-
-namespace WebKit {
-
-class WebData;
-class WebSocketStreamError;
-class WebSocketStreamHandle;
-
-}
-
-namespace WebCore {
-
-class SocketStreamHandleInternal : public WebKit::WebSocketStreamHandleClient {
-public:
-    static PassOwnPtr<SocketStreamHandleInternal> create(SocketStreamHandle* handle)
-    {
-        return adoptPtr(new SocketStreamHandleInternal(handle));
-    }
-    virtual ~SocketStreamHandleInternal();
-
-    void connect(const KURL&);
-    int send(const char*, int);
-    void close();
-
-    virtual void didOpenStream(WebKit::WebSocketStreamHandle*, int);
-    virtual void didSendData(WebKit::WebSocketStreamHandle*, int);
-    virtual void didReceiveData(WebKit::WebSocketStreamHandle*, const WebKit::WebData&);
-    virtual void didClose(WebKit::WebSocketStreamHandle*);
-    virtual void didFail(WebKit::WebSocketStreamHandle*, const WebKit::WebSocketStreamError&);
-
-    static WebKit::WebSocketStreamHandle* toWebSocketStreamHandle(SocketStreamHandle* handle)
-    {
-        if (handle && handle->m_internal)
-            return handle->m_internal->m_socket.get();
-        return 0;
-    }
-
-private:
-    explicit SocketStreamHandleInternal(SocketStreamHandle*);
-
-    SocketStreamHandle* m_handle;
-    OwnPtr<WebKit::WebSocketStreamHandle> m_socket;
-    int m_maxPendingSendAllowed;
-    int m_pendingAmountSent;
-};
-
-} // namespace WebCore
-
-#endif // SocketStreamHandleInternal_h
diff --git a/Source/core/platform/sql/SQLValue.cpp b/Source/core/platform/sql/SQLValue.cpp
deleted file mode 100644
index bba0b4e..0000000
--- a/Source/core/platform/sql/SQLValue.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following condition
- * 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.
- * 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.
- *
- * 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/sql/SQLValue.h"
-
-namespace WebCore {
-
-SQLValue::SQLValue(const SQLValue& val)
-    : m_type(val.m_type)
-    , m_number(val.m_number)
-    , m_string(val.m_string.isolatedCopy())
-{
-}
-
-String SQLValue::string() const
-{
-    ASSERT(m_type == StringValue);
-
-    // Must return a copy since ref-shared Strings are not thread safe
-    return m_string.isolatedCopy();
-}
-
-double SQLValue::number() const
-{
-    ASSERT(m_type == NumberValue);
-
-    return m_number;
-}
-
-}
diff --git a/Source/core/platform/sql/SQLValue.h b/Source/core/platform/sql/SQLValue.h
deleted file mode 100644
index e0069d0..0000000
--- a/Source/core/platform/sql/SQLValue.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following condition
- * 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.
- * 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.
- *
- * 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 SQLValue_h
-#define SQLValue_h
-
-#include "wtf/Threading.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-    class SQLValue {
-    public:
-        enum Type { NullValue, NumberValue, StringValue };
-
-        SQLValue() : m_type(NullValue), m_number(0.0) { }
-        SQLValue(double number) : m_type(NumberValue), m_number(number) { }
-        SQLValue(const String& s) : m_type(StringValue), m_number(0.0), m_string(s) { }
-        SQLValue(const SQLValue&);
-
-        Type type() const { return m_type; }
-
-        String string() const;
-        double number() const;
-
-    private:
-        Type m_type;
-        double m_number;
-        String m_string;
-    };
-};
-
-#endif
diff --git a/Source/core/platform/sql/SQLiteAuthorizer.cpp b/Source/core/platform/sql/SQLiteAuthorizer.cpp
deleted file mode 100644
index 37db87f..0000000
--- a/Source/core/platform/sql/SQLiteAuthorizer.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following condition
- * 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.
- * 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.
- *
- * 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 "modules/webdatabase/DatabaseAuthorizer.h"
-
-#include <sqlite3.h>
-
-namespace WebCore {
-
-const int SQLAuthAllow = SQLITE_OK;
-const int SQLAuthIgnore = SQLITE_IGNORE;
-const int SQLAuthDeny = SQLITE_DENY;
-
-} // namespace WebCore
diff --git a/Source/core/platform/sql/SQLiteDatabase.cpp b/Source/core/platform/sql/SQLiteDatabase.cpp
deleted file mode 100644
index 8aa6689..0000000
--- a/Source/core/platform/sql/SQLiteDatabase.cpp
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
- *
- * 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,
- * 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/sql/SQLiteDatabase.h"
-
-#include <sqlite3.h>
-#include "core/platform/Logging.h"
-#include "core/platform/sql/SQLiteFileSystem.h"
-#include "core/platform/sql/SQLiteStatement.h"
-#include "modules/webdatabase/DatabaseAuthorizer.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
-#include "wtf/Threading.h"
-
-namespace WebCore {
-
-const int SQLResultDone = SQLITE_DONE;
-const int SQLResultError = SQLITE_ERROR;
-const int SQLResultOk = SQLITE_OK;
-const int SQLResultRow = SQLITE_ROW;
-const int SQLResultSchema = SQLITE_SCHEMA;
-const int SQLResultFull = SQLITE_FULL;
-const int SQLResultInterrupt = SQLITE_INTERRUPT;
-const int SQLResultConstraint = SQLITE_CONSTRAINT;
-
-static const char notOpenErrorMessage[] = "database is not open";
-
-SQLiteDatabase::SQLiteDatabase()
-    : m_db(0)
-    , m_pageSize(-1)
-    , m_transactionInProgress(false)
-    , m_sharable(false)
-    , m_openingThread(0)
-    , m_interrupted(false)
-    , m_openError(SQLITE_ERROR)
-    , m_openErrorMessage()
-    , m_lastChangesCount(0)
-{
-}
-
-SQLiteDatabase::~SQLiteDatabase()
-{
-    close();
-}
-
-bool SQLiteDatabase::open(const String& filename, bool forWebSQLDatabase)
-{
-    close();
-
-    m_openError = SQLiteFileSystem::openDatabase(filename, &m_db, forWebSQLDatabase);
-    if (m_openError != SQLITE_OK) {
-        m_openErrorMessage = m_db ? sqlite3_errmsg(m_db) : "sqlite_open returned null";
-        LOG_ERROR("SQLite database failed to load from %s\nCause - %s", filename.ascii().data(),
-            m_openErrorMessage.data());
-        sqlite3_close(m_db);
-        m_db = 0;
-        return false;
-    }
-
-    m_openError = sqlite3_extended_result_codes(m_db, 1);
-    if (m_openError != SQLITE_OK) {
-        m_openErrorMessage = sqlite3_errmsg(m_db);
-        LOG_ERROR("SQLite database error when enabling extended errors - %s", m_openErrorMessage.data());
-        sqlite3_close(m_db);
-        m_db = 0;
-        return false;
-    }
-
-    if (isOpen())
-        m_openingThread = currentThread();
-    else
-        m_openErrorMessage = "sqlite_open returned null";
-
-    if (!SQLiteStatement(*this, "PRAGMA temp_store = MEMORY;").executeCommand())
-        LOG_ERROR("SQLite database could not set temp_store to memory");
-
-    return isOpen();
-}
-
-void SQLiteDatabase::close()
-{
-    if (m_db) {
-        // FIXME: This is being called on the main thread during JS GC. <rdar://problem/5739818>
-        // ASSERT(currentThread() == m_openingThread);
-        sqlite3* db = m_db;
-        {
-            MutexLocker locker(m_databaseClosingMutex);
-            m_db = 0;
-        }
-        sqlite3_close(db);
-    }
-
-    m_openingThread = 0;
-    m_openError = SQLITE_ERROR;
-    m_openErrorMessage = CString();
-}
-
-void SQLiteDatabase::interrupt()
-{
-    m_interrupted = true;
-    while (!m_lockingMutex.tryLock()) {
-        MutexLocker locker(m_databaseClosingMutex);
-        if (!m_db)
-            return;
-        sqlite3_interrupt(m_db);
-        yield();
-    }
-
-    m_lockingMutex.unlock();
-}
-
-bool SQLiteDatabase::isInterrupted()
-{
-    ASSERT(!m_lockingMutex.tryLock());
-    return m_interrupted;
-}
-
-void SQLiteDatabase::setFullsync(bool fsync)
-{
-    if (fsync)
-        executeCommand("PRAGMA fullfsync = 1;");
-    else
-        executeCommand("PRAGMA fullfsync = 0;");
-}
-
-int64_t SQLiteDatabase::maximumSize()
-{
-    int64_t maxPageCount = 0;
-
-    {
-        MutexLocker locker(m_authorizerLock);
-        enableAuthorizer(false);
-        SQLiteStatement statement(*this, "PRAGMA max_page_count");
-        maxPageCount = statement.getColumnInt64(0);
-        enableAuthorizer(true);
-    }
-
-    return maxPageCount * pageSize();
-}
-
-void SQLiteDatabase::setMaximumSize(int64_t size)
-{
-    if (size < 0)
-        size = 0;
-
-    int currentPageSize = pageSize();
-
-    ASSERT(currentPageSize || !m_db);
-    int64_t newMaxPageCount = currentPageSize ? size / currentPageSize : 0;
-
-    MutexLocker locker(m_authorizerLock);
-    enableAuthorizer(false);
-
-    SQLiteStatement statement(*this, "PRAGMA max_page_count = " + String::number(newMaxPageCount));
-    statement.prepare();
-    if (statement.step() != SQLResultRow)
-#if OS(WIN)
-        LOG_ERROR("Failed to set maximum size of database to %I64i bytes", static_cast<long long>(size));
-#else
-        LOG_ERROR("Failed to set maximum size of database to %lli bytes", static_cast<long long>(size));
-#endif
-
-    enableAuthorizer(true);
-
-}
-
-int SQLiteDatabase::pageSize()
-{
-    // Since the page size of a database is locked in at creation and therefore cannot be dynamic,
-    // we can cache the value for future use
-    if (m_pageSize == -1) {
-        MutexLocker locker(m_authorizerLock);
-        enableAuthorizer(false);
-
-        SQLiteStatement statement(*this, "PRAGMA page_size");
-        m_pageSize = statement.getColumnInt(0);
-
-        enableAuthorizer(true);
-    }
-
-    return m_pageSize;
-}
-
-int64_t SQLiteDatabase::freeSpaceSize()
-{
-    int64_t freelistCount = 0;
-
-    {
-        MutexLocker locker(m_authorizerLock);
-        enableAuthorizer(false);
-        // Note: freelist_count was added in SQLite 3.4.1.
-        SQLiteStatement statement(*this, "PRAGMA freelist_count");
-        freelistCount = statement.getColumnInt64(0);
-        enableAuthorizer(true);
-    }
-
-    return freelistCount * pageSize();
-}
-
-int64_t SQLiteDatabase::totalSize()
-{
-    int64_t pageCount = 0;
-
-    {
-        MutexLocker locker(m_authorizerLock);
-        enableAuthorizer(false);
-        SQLiteStatement statement(*this, "PRAGMA page_count");
-        pageCount = statement.getColumnInt64(0);
-        enableAuthorizer(true);
-    }
-
-    return pageCount * pageSize();
-}
-
-void SQLiteDatabase::setSynchronous(SynchronousPragma sync)
-{
-    executeCommand("PRAGMA synchronous = " + String::number(sync));
-}
-
-void SQLiteDatabase::setBusyTimeout(int ms)
-{
-    if (m_db)
-        sqlite3_busy_timeout(m_db, ms);
-    else
-        LOG(SQLDatabase, "BusyTimeout set on non-open database");
-}
-
-void SQLiteDatabase::setBusyHandler(int(*handler)(void*, int))
-{
-    if (m_db)
-        sqlite3_busy_handler(m_db, handler, NULL);
-    else
-        LOG(SQLDatabase, "Busy handler set on non-open database");
-}
-
-bool SQLiteDatabase::executeCommand(const String& sql)
-{
-    return SQLiteStatement(*this, sql).executeCommand();
-}
-
-bool SQLiteDatabase::returnsAtLeastOneResult(const String& sql)
-{
-    return SQLiteStatement(*this, sql).returnsAtLeastOneResult();
-}
-
-bool SQLiteDatabase::tableExists(const String& tablename)
-{
-    if (!isOpen())
-        return false;
-
-    String statement = "SELECT name FROM sqlite_master WHERE type = 'table' AND name = '" + tablename + "';";
-
-    SQLiteStatement sql(*this, statement);
-    sql.prepare();
-    return sql.step() == SQLITE_ROW;
-}
-
-void SQLiteDatabase::clearAllTables()
-{
-    String query = "SELECT name FROM sqlite_master WHERE type='table';";
-    Vector<String> tables;
-    if (!SQLiteStatement(*this, query).returnTextResults(0, tables)) {
-        LOG(SQLDatabase, "Unable to retrieve list of tables from database");
-        return;
-    }
-
-    for (Vector<String>::iterator table = tables.begin(); table != tables.end(); ++table ) {
-        if (*table == "sqlite_sequence")
-            continue;
-        if (!executeCommand("DROP TABLE " + *table))
-            LOG(SQLDatabase, "Unable to drop table %s", (*table).ascii().data());
-    }
-}
-
-int SQLiteDatabase::runVacuumCommand()
-{
-    if (!executeCommand("VACUUM;"))
-        LOG(SQLDatabase, "Unable to vacuum database - %s", lastErrorMsg());
-    return lastError();
-}
-
-int SQLiteDatabase::runIncrementalVacuumCommand()
-{
-    MutexLocker locker(m_authorizerLock);
-    enableAuthorizer(false);
-
-    if (!executeCommand("PRAGMA incremental_vacuum"))
-        LOG(SQLDatabase, "Unable to run incremental vacuum - %s", lastErrorMsg());
-
-    enableAuthorizer(true);
-    return lastError();
-}
-
-int64_t SQLiteDatabase::lastInsertRowID()
-{
-    if (!m_db)
-        return 0;
-    return sqlite3_last_insert_rowid(m_db);
-}
-
-void SQLiteDatabase::updateLastChangesCount()
-{
-    if (!m_db)
-        return;
-
-    m_lastChangesCount = sqlite3_total_changes(m_db);
-}
-
-int SQLiteDatabase::lastChanges()
-{
-    if (!m_db)
-        return 0;
-
-    return sqlite3_total_changes(m_db) - m_lastChangesCount;
-}
-
-int SQLiteDatabase::lastError()
-{
-    return m_db ? sqlite3_errcode(m_db) : m_openError;
-}
-
-const char* SQLiteDatabase::lastErrorMsg()
-{
-    if (m_db)
-        return sqlite3_errmsg(m_db);
-    return m_openErrorMessage.isNull() ? notOpenErrorMessage : m_openErrorMessage.data();
-}
-
-#ifndef NDEBUG
-void SQLiteDatabase::disableThreadingChecks()
-{
-    // This doesn't guarantee that SQList was compiled with -DTHREADSAFE, or that you haven't turned off the mutexes.
-#if SQLITE_VERSION_NUMBER >= 3003001
-    m_sharable = true;
-#else
-    ASSERT(0); // Your SQLite doesn't support sharing handles across threads.
-#endif
-}
-#endif
-
-int SQLiteDatabase::authorizerFunction(void* userData, int actionCode, const char* parameter1, const char* parameter2, const char* /*databaseName*/, const char* /*trigger_or_view*/)
-{
-    DatabaseAuthorizer* auth = static_cast<DatabaseAuthorizer*>(userData);
-    ASSERT(auth);
-
-    switch (actionCode) {
-        case SQLITE_CREATE_INDEX:
-            return auth->createIndex(parameter1, parameter2);
-        case SQLITE_CREATE_TABLE:
-            return auth->createTable(parameter1);
-        case SQLITE_CREATE_TEMP_INDEX:
-            return auth->createTempIndex(parameter1, parameter2);
-        case SQLITE_CREATE_TEMP_TABLE:
-            return auth->createTempTable(parameter1);
-        case SQLITE_CREATE_TEMP_TRIGGER:
-            return auth->createTempTrigger(parameter1, parameter2);
-        case SQLITE_CREATE_TEMP_VIEW:
-            return auth->createTempView(parameter1);
-        case SQLITE_CREATE_TRIGGER:
-            return auth->createTrigger(parameter1, parameter2);
-        case SQLITE_CREATE_VIEW:
-            return auth->createView(parameter1);
-        case SQLITE_DELETE:
-            return auth->allowDelete(parameter1);
-        case SQLITE_DROP_INDEX:
-            return auth->dropIndex(parameter1, parameter2);
-        case SQLITE_DROP_TABLE:
-            return auth->dropTable(parameter1);
-        case SQLITE_DROP_TEMP_INDEX:
-            return auth->dropTempIndex(parameter1, parameter2);
-        case SQLITE_DROP_TEMP_TABLE:
-            return auth->dropTempTable(parameter1);
-        case SQLITE_DROP_TEMP_TRIGGER:
-            return auth->dropTempTrigger(parameter1, parameter2);
-        case SQLITE_DROP_TEMP_VIEW:
-            return auth->dropTempView(parameter1);
-        case SQLITE_DROP_TRIGGER:
-            return auth->dropTrigger(parameter1, parameter2);
-        case SQLITE_DROP_VIEW:
-            return auth->dropView(parameter1);
-        case SQLITE_INSERT:
-            return auth->allowInsert(parameter1);
-        case SQLITE_PRAGMA:
-            return auth->allowPragma(parameter1, parameter2);
-        case SQLITE_READ:
-            return auth->allowRead(parameter1, parameter2);
-        case SQLITE_SELECT:
-            return auth->allowSelect();
-        case SQLITE_TRANSACTION:
-            return auth->allowTransaction();
-        case SQLITE_UPDATE:
-            return auth->allowUpdate(parameter1, parameter2);
-        case SQLITE_ATTACH:
-            return auth->allowAttach(parameter1);
-        case SQLITE_DETACH:
-            return auth->allowDetach(parameter1);
-        case SQLITE_ALTER_TABLE:
-            return auth->allowAlterTable(parameter1, parameter2);
-        case SQLITE_REINDEX:
-            return auth->allowReindex(parameter1);
-#if SQLITE_VERSION_NUMBER >= 3003013
-        case SQLITE_ANALYZE:
-            return auth->allowAnalyze(parameter1);
-        case SQLITE_CREATE_VTABLE:
-            return auth->createVTable(parameter1, parameter2);
-        case SQLITE_DROP_VTABLE:
-            return auth->dropVTable(parameter1, parameter2);
-        case SQLITE_FUNCTION:
-            return auth->allowFunction(parameter2);
-#endif
-        default:
-            ASSERT_NOT_REACHED();
-            return SQLAuthDeny;
-    }
-}
-
-void SQLiteDatabase::setAuthorizer(PassRefPtr<DatabaseAuthorizer> auth)
-{
-    if (!m_db) {
-        LOG_ERROR("Attempt to set an authorizer on a non-open SQL database");
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    MutexLocker locker(m_authorizerLock);
-
-    m_authorizer = auth;
-
-    enableAuthorizer(true);
-}
-
-void SQLiteDatabase::enableAuthorizer(bool enable)
-{
-    if (m_authorizer && enable)
-        sqlite3_set_authorizer(m_db, SQLiteDatabase::authorizerFunction, m_authorizer.get());
-    else
-        sqlite3_set_authorizer(m_db, NULL, 0);
-}
-
-bool SQLiteDatabase::isAutoCommitOn() const
-{
-    return sqlite3_get_autocommit(m_db);
-}
-
-bool SQLiteDatabase::turnOnIncrementalAutoVacuum()
-{
-    SQLiteStatement statement(*this, "PRAGMA auto_vacuum");
-    int autoVacuumMode = statement.getColumnInt(0);
-    int error = lastError();
-
-    // Check if we got an error while trying to get the value of the auto_vacuum flag.
-    // If we got a SQLITE_BUSY error, then there's probably another transaction in
-    // progress on this database. In this case, keep the current value of the
-    // auto_vacuum flag and try to set it to INCREMENTAL the next time we open this
-    // database. If the error is not SQLITE_BUSY, then we probably ran into a more
-    // serious problem and should return false (to log an error message).
-    if (error != SQLITE_ROW)
-        return false;
-
-    switch (autoVacuumMode) {
-    case AutoVacuumIncremental:
-        return true;
-    case AutoVacuumFull:
-        return executeCommand("PRAGMA auto_vacuum = 2");
-    case AutoVacuumNone:
-    default:
-        if (!executeCommand("PRAGMA auto_vacuum = 2"))
-            return false;
-        runVacuumCommand();
-        error = lastError();
-        return (error == SQLITE_OK);
-    }
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/sql/SQLiteDatabase.h b/Source/core/platform/sql/SQLiteDatabase.h
deleted file mode 100644
index e2d52ee..0000000
--- a/Source/core/platform/sql/SQLiteDatabase.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
- *
- * 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,
- * 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 SQLiteDatabase_h
-#define SQLiteDatabase_h
-
-#include "wtf/Threading.h"
-#include "wtf/ThreadingPrimitives.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
-
-#if COMPILER(MSVC)
-#pragma warning(disable: 4800)
-#endif
-
-struct sqlite3;
-
-namespace WebCore {
-
-class DatabaseAuthorizer;
-class SQLiteStatement;
-class SQLiteTransaction;
-
-extern const int SQLResultDone;
-extern const int SQLResultError;
-extern const int SQLResultOk;
-extern const int SQLResultRow;
-extern const int SQLResultSchema;
-extern const int SQLResultFull;
-extern const int SQLResultInterrupt;
-extern const int SQLResultConstraint;
-
-class SQLiteDatabase {
-    WTF_MAKE_NONCOPYABLE(SQLiteDatabase);
-    friend class SQLiteTransaction;
-public:
-    SQLiteDatabase();
-    ~SQLiteDatabase();
-
-    bool open(const String& filename, bool forWebSQLDatabase = false);
-    bool isOpen() const { return m_db; }
-    void close();
-    void interrupt();
-    bool isInterrupted();
-
-    void updateLastChangesCount();
-
-    bool executeCommand(const String&);
-    bool returnsAtLeastOneResult(const String&);
-
-    bool tableExists(const String&);
-    void clearAllTables();
-    int runVacuumCommand();
-    int runIncrementalVacuumCommand();
-
-    bool transactionInProgress() const { return m_transactionInProgress; }
-
-    int64_t lastInsertRowID();
-    int lastChanges();
-
-    void setBusyTimeout(int ms);
-    void setBusyHandler(int(*)(void*, int));
-
-    void setFullsync(bool);
-
-    // Gets/sets the maximum size in bytes
-    // Depending on per-database attributes, the size will only be settable in units that are the page size of the database, which is established at creation
-    // These chunks will never be anything other than 512, 1024, 2048, 4096, 8192, 16384, or 32768 bytes in size.
-    // setMaximumSize() will round the size down to the next smallest chunk if the passed size doesn't align.
-    int64_t maximumSize();
-    void setMaximumSize(int64_t);
-
-    // Gets the number of unused bytes in the database file.
-    int64_t freeSpaceSize();
-    int64_t totalSize();
-
-    // The SQLite SYNCHRONOUS pragma can be either FULL, NORMAL, or OFF
-    // FULL - Any writing calls to the DB block until the data is actually on the disk surface
-    // NORMAL - SQLite pauses at some critical moments when writing, but much less than FULL
-    // OFF - Calls return immediately after the data has been passed to disk
-    enum SynchronousPragma { SyncOff = 0, SyncNormal = 1, SyncFull = 2 };
-    void setSynchronous(SynchronousPragma);
-
-    int lastError();
-    const char* lastErrorMsg();
-
-    sqlite3* sqlite3Handle() const {
-        ASSERT(m_sharable || currentThread() == m_openingThread || !m_db);
-        return m_db;
-    }
-
-    void setAuthorizer(PassRefPtr<DatabaseAuthorizer>);
-
-    Mutex& databaseMutex() { return m_lockingMutex; }
-    bool isAutoCommitOn() const;
-
-    // The SQLite AUTO_VACUUM pragma can be either NONE, FULL, or INCREMENTAL.
-    // NONE - SQLite does not do any vacuuming
-    // FULL - SQLite moves all empty pages to the end of the DB file and truncates
-    //        the file to remove those pages after every transaction. This option
-    //        requires SQLite to store additional information about each page in
-    //        the database file.
-    // INCREMENTAL - SQLite stores extra information for each page in the database
-    //               file, but removes the empty pages only when PRAGMA INCREMANTAL_VACUUM
-    //               is called.
-    enum AutoVacuumPragma { AutoVacuumNone = 0, AutoVacuumFull = 1, AutoVacuumIncremental = 2 };
-    bool turnOnIncrementalAutoVacuum();
-
-    // Set this flag to allow access from multiple threads.  Not all multi-threaded accesses are safe!
-    // See http://www.sqlite.org/cvstrac/wiki?p=MultiThreading for more info.
-#ifndef NDEBUG
-    void disableThreadingChecks();
-#else
-    void disableThreadingChecks() {}
-#endif
-
-private:
-    static int authorizerFunction(void*, int, const char*, const char*, const char*, const char*);
-
-    void enableAuthorizer(bool enable);
-
-    int pageSize();
-
-    sqlite3* m_db;
-    int m_pageSize;
-
-    bool m_transactionInProgress;
-    bool m_sharable;
-
-    Mutex m_authorizerLock;
-    RefPtr<DatabaseAuthorizer> m_authorizer;
-
-    Mutex m_lockingMutex;
-    ThreadIdentifier m_openingThread;
-
-    Mutex m_databaseClosingMutex;
-    bool m_interrupted;
-
-    int m_openError;
-    CString m_openErrorMessage;
-
-    int m_lastChangesCount;
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/platform/sql/SQLiteFileSystem.h b/Source/core/platform/sql/SQLiteFileSystem.h
deleted file mode 100644
index f3b1b59..0000000
--- a/Source/core/platform/sql/SQLiteFileSystem.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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
- * 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 SQLiteFileSystem_h
-#define SQLiteFileSystem_h
-
-#include "wtf/Threading.h"
-#include "wtf/text/WTFString.h"
-
-struct sqlite3;
-
-namespace WebCore {
-
-class SQLiteDatabase;
-
-// A class that abstracts the file system related operations required
-// by the WebKit database code.
-class SQLiteFileSystem {
-public:
-    // Registers a user-defined SQLite VFS.
-    static void registerSQLiteVFS();
-
-    // Opens a database file.
-    //
-    // filemame - The name of the database file.
-    // database - The SQLite structure that represents the database stored
-    //            in the given file.
-    // forWebSQLDatabase - True, if and only if we're opening a Web SQL Database file.
-    //                     Used by Chromium to determine if the DB file needs to be opened
-    //                     using a custom VFS.
-    static int openDatabase(const String& filename, sqlite3** database, bool forWebSQLDatabase);
-
-    // Returns the file name for a database.
-    //
-    // dbDir - The directory where all databases are stored.
-    // dbName - The name of the database.
-    // originIdentifier - The origin that wants to use this database.
-    // db - A database with a number generator used to create unique file names.
-    static String getFileNameForNewDatabase(const String& dbDir, const String& dbName,
-                                            const String& originIdentifier, SQLiteDatabase* db);
-
-    // Creates an absolute file path given a directory and a file name.
-    //
-    // path - The directory.
-    // fileName - The file name.
-    static String appendDatabaseFileNameToPath(const String& path, const String& fileName);
-
-    // Makes sure the given directory exists, by creating all missing directories
-    // on the given path.
-    //
-    // path - The directory.
-    static bool ensureDatabaseDirectoryExists(const String& path);
-
-    // If 'checkPathOnly' is false, then this method only checks if the given file exists.
-    // If 'checkPathOnly' is true, then this method makes sure all directories on the
-    // given path exist by creating the missing ones, and does not check if the file
-    // itself exists.
-    //
-    // Sometimes we expect a DB file to exist; other times, we're OK with creating a new
-    // DB file, but we want to make sure that the directory in which we want to put the
-    // new DB file exists. This method covers both cases.
-    //
-    // fileName - The file name.
-    // checkPathOnly - If true, we only make sure that the given directory exists.
-    //                 If false, we only check if the file exists.
-    static bool ensureDatabaseFileExists(const String& fileName, bool checkPathOnly);
-
-    // Deletes an empty database directory.
-    //
-    // path - The directory.
-    static bool deleteEmptyDatabaseDirectory(const String& path);
-
-    // Deletes a database file.
-    //
-    // fileName - The file name.
-    static bool deleteDatabaseFile(const String& fileName);
-
-    // Returns the size of the database file.
-    //
-    // fileName - The file name.
-    static long long getDatabaseFileSize(const String& fileName);
-
-private:
-    // do not instantiate this class
-    SQLiteFileSystem();
-}; // class SQLiteFileSystem
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/platform/sql/SQLiteStatement.cpp b/Source/core/platform/sql/SQLiteStatement.cpp
deleted file mode 100644
index 137d8a4..0000000
--- a/Source/core/platform/sql/SQLiteStatement.cpp
+++ /dev/null
@@ -1,534 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 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 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,
- * 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/sql/SQLiteStatement.h"
-
-#include <sqlite3.h>
-#include "core/platform/Logging.h"
-#include "core/platform/sql/SQLValue.h"
-#include "wtf/Assertions.h"
-#include "wtf/text/CString.h"
-
-// SQLite 3.6.16 makes sqlite3_prepare_v2 automatically retry preparing the statement
-// once if the database scheme has changed. We rely on this behavior.
-#if SQLITE_VERSION_NUMBER < 3006016
-#error SQLite version 3.6.16 or newer is required
-#endif
-
-namespace WebCore {
-
-SQLiteStatement::SQLiteStatement(SQLiteDatabase& db, const String& sql)
-    : m_database(db)
-    , m_query(sql)
-    , m_statement(0)
-#ifndef NDEBUG
-    , m_isPrepared(false)
-#endif
-{
-}
-
-SQLiteStatement::~SQLiteStatement()
-{
-    finalize();
-}
-
-int SQLiteStatement::prepare()
-{
-    ASSERT(!m_isPrepared);
-
-    MutexLocker databaseLock(m_database.databaseMutex());
-    if (m_database.isInterrupted())
-        return SQLITE_INTERRUPT;
-
-    CString query = m_query.stripWhiteSpace().utf8();
-
-    LOG(SQLDatabase, "SQL - prepare - %s", query.data());
-
-    // Pass the length of the string including the null character to sqlite3_prepare_v2;
-    // this lets SQLite avoid an extra string copy.
-    size_t lengthIncludingNullCharacter = query.length() + 1;
-
-    const char* tail;
-    int error = sqlite3_prepare_v2(m_database.sqlite3Handle(), query.data(), lengthIncludingNullCharacter, &m_statement, &tail);
-
-    if (error != SQLITE_OK)
-        LOG(SQLDatabase, "sqlite3_prepare16 failed (%i)\n%s\n%s", error, query.data(), sqlite3_errmsg(m_database.sqlite3Handle()));
-
-    if (tail && *tail)
-        error = SQLITE_ERROR;
-
-#ifndef NDEBUG
-    m_isPrepared = error == SQLITE_OK;
-#endif
-    return error;
-}
-
-int SQLiteStatement::step()
-{
-    MutexLocker databaseLock(m_database.databaseMutex());
-    if (m_database.isInterrupted())
-        return SQLITE_INTERRUPT;
-    //ASSERT(m_isPrepared);
-
-    if (!m_statement)
-        return SQLITE_OK;
-
-    // The database needs to update its last changes count before each statement
-    // in order to compute properly the lastChanges() return value.
-    m_database.updateLastChangesCount();
-
-    LOG(SQLDatabase, "SQL - step - %s", m_query.ascii().data());
-    int error = sqlite3_step(m_statement);
-    if (error != SQLITE_DONE && error != SQLITE_ROW) {
-        LOG(SQLDatabase, "sqlite3_step failed (%i)\nQuery - %s\nError - %s",
-            error, m_query.ascii().data(), sqlite3_errmsg(m_database.sqlite3Handle()));
-    }
-
-    return error;
-}
-
-int SQLiteStatement::finalize()
-{
-#ifndef NDEBUG
-    m_isPrepared = false;
-#endif
-    if (!m_statement)
-        return SQLITE_OK;
-    LOG(SQLDatabase, "SQL - finalize - %s", m_query.ascii().data());
-    int result = sqlite3_finalize(m_statement);
-    m_statement = 0;
-    return result;
-}
-
-int SQLiteStatement::reset()
-{
-    ASSERT(m_isPrepared);
-    if (!m_statement)
-        return SQLITE_OK;
-    LOG(SQLDatabase, "SQL - reset - %s", m_query.ascii().data());
-    return sqlite3_reset(m_statement);
-}
-
-bool SQLiteStatement::executeCommand()
-{
-    if (!m_statement && prepare() != SQLITE_OK)
-        return false;
-    ASSERT(m_isPrepared);
-    if (step() != SQLITE_DONE) {
-        finalize();
-        return false;
-    }
-    finalize();
-    return true;
-}
-
-bool SQLiteStatement::returnsAtLeastOneResult()
-{
-    if (!m_statement && prepare() != SQLITE_OK)
-        return false;
-    ASSERT(m_isPrepared);
-    if (step() != SQLITE_ROW) {
-        finalize();
-        return false;
-    }
-    finalize();
-    return true;
-
-}
-
-int SQLiteStatement::bindBlob(int index, const void* blob, int size)
-{
-    ASSERT(m_isPrepared);
-    ASSERT(index > 0);
-    ASSERT(static_cast<unsigned>(index) <= bindParameterCount());
-    ASSERT(blob);
-    ASSERT(size >= 0);
-
-    if (!m_statement)
-        return SQLITE_ERROR;
-
-    return sqlite3_bind_blob(m_statement, index, blob, size, SQLITE_TRANSIENT);
-}
-
-int SQLiteStatement::bindBlob(int index, const String& text)
-{
-    // SQLite treats uses zero pointers to represent null strings, which means we need to make sure to map null WTFStrings to zero pointers.
-    ASSERT(!String().charactersWithNullTermination().data());
-    return bindBlob(index, text.charactersWithNullTermination().data(), text.length() * sizeof(UChar));
-}
-
-int SQLiteStatement::bindText(int index, const String& text)
-{
-    ASSERT(m_isPrepared);
-    ASSERT(index > 0);
-    ASSERT(static_cast<unsigned>(index) <= bindParameterCount());
-
-    // SQLite treats uses zero pointers to represent null strings, which means we need to make sure to map null WTFStrings to zero pointers.
-    ASSERT(!String().charactersWithNullTermination().data());
-    return sqlite3_bind_text16(m_statement, index, text.charactersWithNullTermination().data(), sizeof(UChar) * text.length(), SQLITE_TRANSIENT);
-}
-
-int SQLiteStatement::bindInt(int index, int integer)
-{
-    ASSERT(m_isPrepared);
-    ASSERT(index > 0);
-    ASSERT(static_cast<unsigned>(index) <= bindParameterCount());
-
-    return sqlite3_bind_int(m_statement, index, integer);
-}
-
-int SQLiteStatement::bindInt64(int index, int64_t integer)
-{
-    ASSERT(m_isPrepared);
-    ASSERT(index > 0);
-    ASSERT(static_cast<unsigned>(index) <= bindParameterCount());
-
-    return sqlite3_bind_int64(m_statement, index, integer);
-}
-
-int SQLiteStatement::bindDouble(int index, double number)
-{
-    ASSERT(m_isPrepared);
-    ASSERT(index > 0);
-    ASSERT(static_cast<unsigned>(index) <= bindParameterCount());
-
-    return sqlite3_bind_double(m_statement, index, number);
-}
-
-int SQLiteStatement::bindNull(int index)
-{
-    ASSERT(m_isPrepared);
-    ASSERT(index > 0);
-    ASSERT(static_cast<unsigned>(index) <= bindParameterCount());
-
-    return sqlite3_bind_null(m_statement, index);
-}
-
-int SQLiteStatement::bindValue(int index, const SQLValue& value)
-{
-    switch (value.type()) {
-        case SQLValue::StringValue:
-            return bindText(index, value.string());
-        case SQLValue::NumberValue:
-            return bindDouble(index, value.number());
-        case SQLValue::NullValue:
-            return bindNull(index);
-    }
-
-    ASSERT_NOT_REACHED();
-    return SQLITE_ERROR;
-}
-
-unsigned SQLiteStatement::bindParameterCount() const
-{
-    ASSERT(m_isPrepared);
-    if (!m_statement)
-        return 0;
-    return sqlite3_bind_parameter_count(m_statement);
-}
-
-int SQLiteStatement::columnCount()
-{
-    ASSERT(m_isPrepared);
-    if (!m_statement)
-        return 0;
-    return sqlite3_data_count(m_statement);
-}
-
-bool SQLiteStatement::isColumnNull(int col)
-{
-    ASSERT(col >= 0);
-    if (!m_statement)
-        if (prepareAndStep() != SQLITE_ROW)
-            return false;
-    if (columnCount() <= col)
-        return false;
-
-    return sqlite3_column_type(m_statement, col) == SQLITE_NULL;
-}
-
-bool SQLiteStatement::isColumnDeclaredAsBlob(int col)
-{
-    ASSERT(col >= 0);
-    if (!m_statement) {
-        if (prepare() != SQLITE_OK)
-            return false;
-    }
-
-    return equalIgnoringCase(String("BLOB"), String(reinterpret_cast<const UChar*>(sqlite3_column_decltype16(m_statement, col))));
-}
-
-String SQLiteStatement::getColumnName(int col)
-{
-    ASSERT(col >= 0);
-    if (!m_statement)
-        if (prepareAndStep() != SQLITE_ROW)
-            return String();
-    if (columnCount() <= col)
-        return String();
-    return String(reinterpret_cast<const UChar*>(sqlite3_column_name16(m_statement, col)));
-}
-
-SQLValue SQLiteStatement::getColumnValue(int col)
-{
-    ASSERT(col >= 0);
-    if (!m_statement)
-        if (prepareAndStep() != SQLITE_ROW)
-            return SQLValue();
-    if (columnCount() <= col)
-        return SQLValue();
-
-    // SQLite is typed per value. optional column types are
-    // "(mostly) ignored"
-    sqlite3_value* value = sqlite3_column_value(m_statement, col);
-    switch (sqlite3_value_type(value)) {
-        case SQLITE_INTEGER:    // SQLValue and JS don't represent integers, so use FLOAT -case
-        case SQLITE_FLOAT:
-            return SQLValue(sqlite3_value_double(value));
-        case SQLITE_BLOB:       // SQLValue and JS don't represent blobs, so use TEXT -case
-        case SQLITE_TEXT: {
-            const UChar* string = reinterpret_cast<const UChar*>(sqlite3_value_text16(value));
-            unsigned length = WTF::lengthOfNullTerminatedString(string);
-            return SQLValue(StringImpl::create8BitIfPossible(string, length));
-        }
-        case SQLITE_NULL:
-            return SQLValue();
-        default:
-            break;
-    }
-    ASSERT_NOT_REACHED();
-    return SQLValue();
-}
-
-String SQLiteStatement::getColumnText(int col)
-{
-    ASSERT(col >= 0);
-    if (!m_statement)
-        if (prepareAndStep() != SQLITE_ROW)
-            return String();
-    if (columnCount() <= col)
-        return String();
-    const UChar* string = reinterpret_cast<const UChar*>(sqlite3_column_text16(m_statement, col));
-    return StringImpl::create8BitIfPossible(string, sqlite3_column_bytes16(m_statement, col) / sizeof(UChar));
-}
-
-double SQLiteStatement::getColumnDouble(int col)
-{
-    ASSERT(col >= 0);
-    if (!m_statement)
-        if (prepareAndStep() != SQLITE_ROW)
-            return 0.0;
-    if (columnCount() <= col)
-        return 0.0;
-    return sqlite3_column_double(m_statement, col);
-}
-
-int SQLiteStatement::getColumnInt(int col)
-{
-    ASSERT(col >= 0);
-    if (!m_statement)
-        if (prepareAndStep() != SQLITE_ROW)
-            return 0;
-    if (columnCount() <= col)
-        return 0;
-    return sqlite3_column_int(m_statement, col);
-}
-
-int64_t SQLiteStatement::getColumnInt64(int col)
-{
-    ASSERT(col >= 0);
-    if (!m_statement)
-        if (prepareAndStep() != SQLITE_ROW)
-            return 0;
-    if (columnCount() <= col)
-        return 0;
-    return sqlite3_column_int64(m_statement, col);
-}
-
-String SQLiteStatement::getColumnBlobAsString(int col)
-{
-    ASSERT(col >= 0);
-
-    if (!m_statement && prepareAndStep() != SQLITE_ROW)
-        return String();
-
-    if (columnCount() <= col)
-        return String();
-
-    const void* blob = sqlite3_column_blob(m_statement, col);
-    if (!blob)
-        return String();
-
-    int size = sqlite3_column_bytes(m_statement, col);
-    if (size < 0)
-        return String();
-
-    ASSERT(!(size % sizeof(UChar)));
-    return String(static_cast<const UChar*>(blob), size / sizeof(UChar));
-}
-
-void SQLiteStatement::getColumnBlobAsVector(int col, Vector<char>& result)
-{
-    ASSERT(col >= 0);
-
-    if (!m_statement && prepareAndStep() != SQLITE_ROW) {
-        result.clear();
-        return;
-    }
-
-    if (columnCount() <= col) {
-        result.clear();
-        return;
-    }
-
-    const void* blob = sqlite3_column_blob(m_statement, col);
-    if (!blob) {
-        result.clear();
-        return;
-    }
-
-    int size = sqlite3_column_bytes(m_statement, col);
-    result.resize((size_t)size);
-    for (int i = 0; i < size; ++i)
-        result[i] = (static_cast<const unsigned char*>(blob))[i];
-}
-
-const void* SQLiteStatement::getColumnBlob(int col, int& size)
-{
-    ASSERT(col >= 0);
-
-    size = 0;
-
-    if (finalize() != SQLITE_OK)
-        LOG(SQLDatabase, "Finalize failed");
-    if (prepare() != SQLITE_OK) {
-        LOG(SQLDatabase, "Prepare failed");
-        return 0;
-    }
-    if (step() != SQLITE_ROW) {
-        LOG(SQLDatabase, "Step wasn't a row");
-        return 0;
-    }
-
-    if (columnCount() <= col)
-        return 0;
-
-    const void* blob = sqlite3_column_blob(m_statement, col);
-    if (!blob)
-        return 0;
-
-    size = sqlite3_column_bytes(m_statement, col);
-    return blob;
-}
-
-bool SQLiteStatement::returnTextResults(int col, Vector<String>& v)
-{
-    ASSERT(col >= 0);
-
-    v.clear();
-
-    if (m_statement)
-        finalize();
-    if (prepare() != SQLITE_OK)
-        return false;
-
-    while (step() == SQLITE_ROW)
-        v.append(getColumnText(col));
-    bool result = true;
-    if (m_database.lastError() != SQLITE_DONE) {
-        result = false;
-        LOG(SQLDatabase, "Error reading results from database query %s", m_query.ascii().data());
-    }
-    finalize();
-    return result;
-}
-
-bool SQLiteStatement::returnIntResults(int col, Vector<int>& v)
-{
-    v.clear();
-
-    if (m_statement)
-        finalize();
-    if (prepare() != SQLITE_OK)
-        return false;
-
-    while (step() == SQLITE_ROW)
-        v.append(getColumnInt(col));
-    bool result = true;
-    if (m_database.lastError() != SQLITE_DONE) {
-        result = false;
-        LOG(SQLDatabase, "Error reading results from database query %s", m_query.ascii().data());
-    }
-    finalize();
-    return result;
-}
-
-bool SQLiteStatement::returnInt64Results(int col, Vector<int64_t>& v)
-{
-    v.clear();
-
-    if (m_statement)
-        finalize();
-    if (prepare() != SQLITE_OK)
-        return false;
-
-    while (step() == SQLITE_ROW)
-        v.append(getColumnInt64(col));
-    bool result = true;
-    if (m_database.lastError() != SQLITE_DONE) {
-        result = false;
-        LOG(SQLDatabase, "Error reading results from database query %s", m_query.ascii().data());
-    }
-    finalize();
-    return result;
-}
-
-bool SQLiteStatement::returnDoubleResults(int col, Vector<double>& v)
-{
-    v.clear();
-
-    if (m_statement)
-        finalize();
-    if (prepare() != SQLITE_OK)
-        return false;
-
-    while (step() == SQLITE_ROW)
-        v.append(getColumnDouble(col));
-    bool result = true;
-    if (m_database.lastError() != SQLITE_DONE) {
-        result = false;
-        LOG(SQLDatabase, "Error reading results from database query %s", m_query.ascii().data());
-    }
-    finalize();
-    return result;
-}
-
-bool SQLiteStatement::isExpired()
-{
-    return !m_statement || sqlite3_expired(m_statement);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/sql/SQLiteStatement.h b/Source/core/platform/sql/SQLiteStatement.h
deleted file mode 100644
index e8b5c1e..0000000
--- a/Source/core/platform/sql/SQLiteStatement.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 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 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,
- * 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 SQLiteStatement_h
-#define SQLiteStatement_h
-
-#include "core/platform/sql/SQLiteDatabase.h"
-
-struct sqlite3_stmt;
-
-namespace WebCore {
-
-class SQLValue;
-
-class SQLiteStatement {
-    WTF_MAKE_NONCOPYABLE(SQLiteStatement); WTF_MAKE_FAST_ALLOCATED;
-public:
-    SQLiteStatement(SQLiteDatabase&, const String&);
-    ~SQLiteStatement();
-
-    int prepare();
-    int bindBlob(int index, const void* blob, int size);
-    int bindBlob(int index, const String&);
-    int bindText(int index, const String&);
-    int bindInt(int index, int);
-    int bindInt64(int index, int64_t);
-    int bindDouble(int index, double);
-    int bindNull(int index);
-    int bindValue(int index, const SQLValue&);
-    unsigned bindParameterCount() const;
-
-    int step();
-    int finalize();
-    int reset();
-
-    int prepareAndStep() { if (int error = prepare()) return error; return step(); }
-
-    // prepares, steps, and finalizes the query.
-    // returns true if all 3 steps succeed with step() returning SQLITE_DONE
-    // returns false otherwise
-    bool executeCommand();
-
-    // prepares, steps, and finalizes.
-    // returns true is step() returns SQLITE_ROW
-    // returns false otherwise
-    bool returnsAtLeastOneResult();
-
-    bool isExpired();
-
-    // Returns -1 on last-step failing.  Otherwise, returns number of rows
-    // returned in the last step()
-    int columnCount();
-
-    bool isColumnNull(int col);
-    bool isColumnDeclaredAsBlob(int col);
-    String getColumnName(int col);
-    SQLValue getColumnValue(int col);
-    String getColumnText(int col);
-    double getColumnDouble(int col);
-    int getColumnInt(int col);
-    int64_t getColumnInt64(int col);
-    const void* getColumnBlob(int col, int& size);
-    String getColumnBlobAsString(int col);
-    void getColumnBlobAsVector(int col, Vector<char>&);
-
-    bool returnTextResults(int col, Vector<String>&);
-    bool returnIntResults(int col, Vector<int>&);
-    bool returnInt64Results(int col, Vector<int64_t>&);
-    bool returnDoubleResults(int col, Vector<double>&);
-
-    SQLiteDatabase* database() { return &m_database; }
-
-    const String& query() const { return m_query; }
-
-private:
-    SQLiteDatabase& m_database;
-    String m_query;
-    sqlite3_stmt* m_statement;
-#ifndef NDEBUG
-    bool m_isPrepared;
-#endif
-};
-
-} // namespace WebCore
-
-#endif // SQLiteStatement_h
diff --git a/Source/core/platform/sql/SQLiteTransaction.cpp b/Source/core/platform/sql/SQLiteTransaction.cpp
deleted file mode 100644
index c319d47..0000000
--- a/Source/core/platform/sql/SQLiteTransaction.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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,
- * 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/sql/SQLiteTransaction.h"
-
-#include "core/platform/sql/SQLiteDatabase.h"
-
-namespace WebCore {
-
-SQLiteTransaction::SQLiteTransaction(SQLiteDatabase& db, bool readOnly)
-    : m_db(db)
-    , m_inProgress(false)
-    , m_readOnly(readOnly)
-{
-}
-
-SQLiteTransaction::~SQLiteTransaction()
-{
-    if (m_inProgress)
-        rollback();
-}
-
-void SQLiteTransaction::begin()
-{
-    if (!m_inProgress) {
-        ASSERT(!m_db.m_transactionInProgress);
-        // Call BEGIN IMMEDIATE for a write transaction to acquire
-        // a RESERVED lock on the DB file. Otherwise, another write
-        // transaction (on another connection) could make changes
-        // to the same DB file before this transaction gets to execute
-        // any statements. If that happens, this transaction will fail.
-        // http://www.sqlite.org/lang_transaction.html
-        // http://www.sqlite.org/lockingv3.html#locking
-        if (m_readOnly)
-            m_inProgress = m_db.executeCommand("BEGIN");
-        else
-            m_inProgress = m_db.executeCommand("BEGIN IMMEDIATE");
-        m_db.m_transactionInProgress = m_inProgress;
-    }
-}
-
-void SQLiteTransaction::commit()
-{
-    if (m_inProgress) {
-        ASSERT(m_db.m_transactionInProgress);
-        m_inProgress = !m_db.executeCommand("COMMIT");
-        m_db.m_transactionInProgress = m_inProgress;
-    }
-}
-
-void SQLiteTransaction::rollback()
-{
-    // We do not use the 'm_inProgress = m_db.executeCommand("ROLLBACK")' construct here,
-    // because m_inProgress should always be set to false after a ROLLBACK, and
-    // m_db.executeCommand("ROLLBACK") can sometimes harmlessly fail, thus returning
-    // a non-zero/true result (http://www.sqlite.org/lang_transaction.html).
-    if (m_inProgress) {
-        ASSERT(m_db.m_transactionInProgress);
-        m_db.executeCommand("ROLLBACK");
-        m_inProgress = false;
-        m_db.m_transactionInProgress = false;
-    }
-}
-
-void SQLiteTransaction::stop()
-{
-    if (m_inProgress) {
-        m_inProgress = false;
-        m_db.m_transactionInProgress = false;
-    }
-}
-
-bool SQLiteTransaction::wasRolledBackBySqlite() const
-{
-    // According to http://www.sqlite.org/c3ref/get_autocommit.html,
-    // the auto-commit flag should be off in the middle of a transaction
-    return m_inProgress && m_db.isAutoCommitOn();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/sql/SQLiteTransaction.h b/Source/core/platform/sql/SQLiteTransaction.h
deleted file mode 100644
index 9a9bf71..0000000
--- a/Source/core/platform/sql/SQLiteTransaction.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Computer, 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,
- * 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 SQLiteTransaction_h
-#define SQLiteTransaction_h
-
-#include "wtf/FastAllocBase.h"
-#include "wtf/Noncopyable.h"
-
-namespace WebCore {
-
-class SQLiteDatabase;
-
-class SQLiteTransaction {
-    WTF_MAKE_NONCOPYABLE(SQLiteTransaction); WTF_MAKE_FAST_ALLOCATED;
-public:
-    SQLiteTransaction(SQLiteDatabase& db, bool readOnly = false);
-    ~SQLiteTransaction();
-
-    void begin();
-    void commit();
-    void rollback();
-    void stop();
-
-    bool inProgress() const { return m_inProgress; }
-    bool wasRolledBackBySqlite() const;
-private:
-    SQLiteDatabase& m_db;
-    bool m_inProgress;
-    bool m_readOnly;
-};
-
-} // namespace WebCore
-
-#endif // SQLiteTransation_H
diff --git a/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp b/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp
deleted file mode 100644
index 0673127..0000000
--- a/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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
- * 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/sql/SQLiteFileSystem.h"
-
-#include <sqlite3.h>
-#include "public/platform/Platform.h"
-#include "wtf/text/CString.h"
-
-// SQLiteFileSystem::registerSQLiteVFS() is implemented in the
-// platform-specific files SQLiteFileSystemChromium{Win|Posix}.cpp
-namespace WebCore {
-
-SQLiteFileSystem::SQLiteFileSystem()
-{
-}
-
-int SQLiteFileSystem::openDatabase(const String& filename, sqlite3** database, bool forWebSQLDatabase)
-{
-    if (!forWebSQLDatabase)
-        return sqlite3_open(filename.utf8().data(), database);
-
-    return sqlite3_open_v2(filename.utf8().data(), database, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, "chromium_vfs");
-}
-
-String SQLiteFileSystem::getFileNameForNewDatabase(
-  const String&, const String& dbName, const String &originIdentifier, SQLiteDatabase*)
-{
-    // Not used by Chromium's DatabaseTracker implementation
-    ASSERT_NOT_REACHED();
-    return String();
-}
-
-String SQLiteFileSystem::appendDatabaseFileNameToPath(const String&, const String& fileName)
-{
-    // Not used by Chromium's DatabaseTracker implementation
-    ASSERT_NOT_REACHED();
-    return String();
-}
-
-bool SQLiteFileSystem::ensureDatabaseDirectoryExists(const String&)
-{
-    // Not used by Chromium's DatabaseTracker implementation
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
-bool SQLiteFileSystem::ensureDatabaseFileExists(const String&, bool)
-{
-    // Not used by Chromium's DatabaseTracker implementation
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
-bool SQLiteFileSystem::deleteEmptyDatabaseDirectory(const String&)
-{
-    // Not used by Chromium's DatabaseTracker implementation
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
-bool SQLiteFileSystem::deleteDatabaseFile(const String& fileName)
-{
-    return (WebKit::Platform::current()->databaseDeleteFile(fileName, false) == SQLITE_OK);
-}
-
-long long SQLiteFileSystem::getDatabaseFileSize(const String& fileName)
-{
-    return WebKit::Platform::current()->databaseGetFileSize(fileName);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp b/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp
deleted file mode 100644
index 2500230..0000000
--- a/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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
- * 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/sql/SQLiteFileSystem.h"
-
-#include <sqlite3.h>
-#include "public/platform/Platform.h"
-
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-
-using namespace WebCore;
-
-// Defined in Chromium's codebase in third_party/sqlite/src/os_unix.c
-extern "C" {
-void chromium_sqlite3_initialize_unix_sqlite3_file(sqlite3_file* file);
-int chromium_sqlite3_fill_in_unix_sqlite3_file(sqlite3_vfs* vfs, int fd, int dirfd, sqlite3_file* file, const char* fileName, int noLock);
-int chromium_sqlite3_get_reusable_file_handle(sqlite3_file* file, const char* fileName, int flags, int* fd);
-void chromium_sqlite3_update_reusable_file_handle(sqlite3_file* file, int fd, int flags);
-void chromium_sqlite3_destroy_reusable_file_handle(sqlite3_file* file);
-}
-
-// Chromium's Posix implementation of SQLite VFS
-namespace {
-
-// Opens a file.
-//
-// vfs - pointer to the sqlite3_vfs object.
-// fileName - the name of the file.
-// id - the structure that will manipulate the newly opened file.
-// desiredFlags - the desired open mode flags.
-// usedFlags - the actual open mode flags that were used.
-int chromiumOpen(sqlite3_vfs* vfs, const char* fileName,
-                 sqlite3_file* id, int desiredFlags, int* usedFlags)
-{
-    chromium_sqlite3_initialize_unix_sqlite3_file(id);
-    int fd = -1;
-    int result = chromium_sqlite3_get_reusable_file_handle(id, fileName, desiredFlags, &fd);
-    if (result != SQLITE_OK)
-        return result;
-
-    if (fd < 0) {
-        fd = WebKit::Platform::current()->databaseOpenFile(String(fileName), desiredFlags);
-        if ((fd < 0) && (desiredFlags & SQLITE_OPEN_READWRITE)) {
-            int newFlags = (desiredFlags & ~(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)) | SQLITE_OPEN_READONLY;
-            fd = WebKit::Platform::current()->databaseOpenFile(String(fileName), newFlags);
-        }
-    }
-    if (fd < 0) {
-        chromium_sqlite3_destroy_reusable_file_handle(id);
-        return SQLITE_CANTOPEN;
-    }
-
-    if (usedFlags)
-        *usedFlags = desiredFlags;
-    chromium_sqlite3_update_reusable_file_handle(id, fd, desiredFlags);
-
-    fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
-
-    // The mask 0x00007F00 gives us the 7 bits that determine the type of the file SQLite is trying to open.
-    int fileType = desiredFlags & 0x00007F00;
-    int noLock = (fileType != SQLITE_OPEN_MAIN_DB);
-    result = chromium_sqlite3_fill_in_unix_sqlite3_file(vfs, fd, -1, id, fileName, noLock);
-    if (result != SQLITE_OK)
-        chromium_sqlite3_destroy_reusable_file_handle(id);
-    return result;
-}
-
-// Deletes the given file.
-//
-// vfs - pointer to the sqlite3_vfs object.
-// fileName - the name of the file.
-// syncDir - determines if the directory to which this file belongs
-//           should be synched after the file is deleted.
-int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir)
-{
-    return WebKit::Platform::current()->databaseDeleteFile(String(fileName), syncDir);
-}
-
-// Check the existance and status of the given file.
-//
-// vfs - pointer to the sqlite3_vfs object.
-// fileName - the name of the file.
-// flag - the type of test to make on this file.
-// res - the result.
-int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res)
-{
-    int attr = static_cast<int>(WebKit::Platform::current()->databaseGetFileAttributes(String(fileName)));
-    if (attr < 0) {
-        *res = 0;
-        return SQLITE_OK;
-    }
-
-    switch (flag) {
-    case SQLITE_ACCESS_EXISTS:
-        *res = 1;   // if the file doesn't exist, attr < 0
-        break;
-    case SQLITE_ACCESS_READWRITE:
-        *res = (attr & W_OK) && (attr & R_OK);
-        break;
-    case SQLITE_ACCESS_READ:
-        *res = (attr & R_OK);
-        break;
-    default:
-        return SQLITE_ERROR;
-    }
-
-    return SQLITE_OK;
-}
-
-// Turns a relative pathname into a full pathname.
-//
-// vfs - pointer to the sqlite3_vfs object.
-// relativePath - the relative path.
-// bufSize - the size of the output buffer in bytes.
-// absolutePath - the output buffer where the absolute path will be stored.
-int chromiumFullPathname(sqlite3_vfs* vfs, const char* relativePath,
-                         int, char* absolutePath)
-{
-    // The renderer process doesn't need to know the absolute path of the file
-    sqlite3_snprintf(vfs->mxPathname, absolutePath, "%s", relativePath);
-    return SQLITE_OK;
-}
-
-#ifndef SQLITE_OMIT_LOAD_EXTENSION
-// Returns NULL, thus disallowing loading libraries in the renderer process.
-//
-// vfs - pointer to the sqlite3_vfs object.
-// fileName - the name of the shared library file.
-void* chromiumDlOpen(sqlite3_vfs*, const char*)
-{
-    return 0;
-}
-#else
-#define chromiumDlOpen 0
-#endif // SQLITE_OMIT_LOAD_EXTENSION
-
-} // namespace
-
-namespace WebCore {
-
-void SQLiteFileSystem::registerSQLiteVFS()
-{
-    sqlite3_vfs* unix_vfs = sqlite3_vfs_find("unix");
-    static sqlite3_vfs chromium_vfs = {
-        1,
-        unix_vfs->szOsFile,
-        unix_vfs->mxPathname,
-        0,
-        "chromium_vfs",
-        unix_vfs->pAppData,
-        chromiumOpen,
-        chromiumDelete,
-        chromiumAccess,
-        chromiumFullPathname,
-        chromiumDlOpen,
-        unix_vfs->xDlError,
-        unix_vfs->xDlSym,
-        unix_vfs->xDlClose,
-        unix_vfs->xRandomness,
-        unix_vfs->xSleep,
-        unix_vfs->xCurrentTime,
-        unix_vfs->xGetLastError
-    };
-    sqlite3_vfs_register(&chromium_vfs, 0);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp b/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp
deleted file mode 100644
index 5487018..0000000
--- a/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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
- * 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/sql/SQLiteFileSystem.h"
-
-#include <windows.h>
-#include <sqlite3.h>
-#include "public/platform/Platform.h"
-
-using namespace WebCore;
-
-// Defined in Chromium's codebase in third_party/sqlite/src/os_win.c
-extern "C" {
-int chromium_sqlite3_initialize_win_sqlite3_file(sqlite3_file* file, HANDLE handle);
-}
-
-// Chromium's Windows implementation of SQLite VFS
-namespace {
-
-// Opens a file.
-//
-// vfs - pointer to the sqlite3_vfs object.
-// fileName - the name of the file.
-// id - the structure that will manipulate the newly opened file.
-// desiredFlags - the desired open mode flags.
-// usedFlags - the actual open mode flags that were used.
-int chromiumOpen(sqlite3_vfs*, const char* fileName,
-                 sqlite3_file* id, int desiredFlags, int* usedFlags)
-{
-    HANDLE h = WebKit::Platform::current()->databaseOpenFile(String(fileName), desiredFlags);
-    if (h == INVALID_HANDLE_VALUE) {
-        if (desiredFlags & SQLITE_OPEN_READWRITE) {
-            int newFlags = (desiredFlags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE;
-            return chromiumOpen(0, fileName, id, newFlags, usedFlags);
-        } else
-            return SQLITE_CANTOPEN;
-    }
-    if (usedFlags) {
-        if (desiredFlags & SQLITE_OPEN_READWRITE)
-            *usedFlags = SQLITE_OPEN_READWRITE;
-        else
-            *usedFlags = SQLITE_OPEN_READONLY;
-    }
-
-    chromium_sqlite3_initialize_win_sqlite3_file(id, h);
-    return SQLITE_OK;
-}
-
-// Deletes the given file.
-//
-// vfs - pointer to the sqlite3_vfs object.
-// fileName - the name of the file.
-// syncDir - determines if the directory to which this file belongs
-//           should be synched after the file is deleted.
-int chromiumDelete(sqlite3_vfs*, const char* fileName, int)
-{
-    return WebKit::Platform::current()->databaseDeleteFile(String(fileName), false);
-}
-
-// Check the existance and status of the given file.
-//
-// vfs - pointer to the sqlite3_vfs object.
-// fileName - the name of the file.
-// flag - the type of test to make on this file.
-// res - the result.
-int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res)
-{
-    DWORD attr = WebKit::Platform::current()->databaseGetFileAttributes(String(fileName));
-    switch (flag) {
-    case SQLITE_ACCESS_READ:
-    case SQLITE_ACCESS_EXISTS:
-        *res = (attr != INVALID_FILE_ATTRIBUTES);
-        break;
-    case SQLITE_ACCESS_READWRITE:
-        *res = ((attr & FILE_ATTRIBUTE_READONLY) == 0);
-        break;
-    default:
-        return SQLITE_ERROR;
-    }
-
-    return SQLITE_OK;
-}
-
-// Turns a relative pathname into a full pathname.
-//
-// vfs - pointer to the sqlite3_vfs object.
-// relativePath - the relative path.
-// bufSize - the size of the output buffer in bytes.
-// absolutePath - the output buffer where the absolute path will be stored.
-int chromiumFullPathname(sqlite3_vfs* vfs, const char* relativePath,
-                         int, char* absolutePath)
-{
-    // The renderer process doesn't need to know the absolute path of the file
-    sqlite3_snprintf(vfs->mxPathname, absolutePath, "%s", relativePath);
-    return SQLITE_OK;
-}
-
-#ifndef SQLITE_OMIT_LOAD_EXTENSION
-// Returns NULL, thus disallowing loading libraries in the renderer process.
-//
-// vfs - pointer to the sqlite3_vfs object.
-// fileName - the name of the shared library file.
-void* chromiumDlOpen(sqlite3_vfs*, const char*)
-{
-    return 0;
-}
-#else
-#define chromiumDlOpen 0
-#endif // SQLITE_OMIT_LOAD_EXTENSION
-
-} // namespace
-
-namespace WebCore {
-
-void SQLiteFileSystem::registerSQLiteVFS()
-{
-    sqlite3_vfs* win32_vfs = sqlite3_vfs_find("win32");
-    static sqlite3_vfs chromium_vfs = {
-        1,
-        win32_vfs->szOsFile,
-        win32_vfs->mxPathname,
-        0,
-        "chromium_vfs",
-        win32_vfs->pAppData,
-        chromiumOpen,
-        chromiumDelete,
-        chromiumAccess,
-        chromiumFullPathname,
-        chromiumDlOpen,
-        win32_vfs->xDlError,
-        win32_vfs->xDlSym,
-        win32_vfs->xDlClose,
-        win32_vfs->xRandomness,
-        win32_vfs->xSleep,
-        win32_vfs->xCurrentTime,
-        win32_vfs->xGetLastError
-    };
-    sqlite3_vfs_register(&chromium_vfs, 0);
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/testing/FakeWebGraphicsContext3D.h b/Source/core/platform/testing/FakeWebGraphicsContext3D.h
new file mode 100644
index 0000000..3bbebc5
--- /dev/null
+++ b/Source/core/platform/testing/FakeWebGraphicsContext3D.h
@@ -0,0 +1,268 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 FakeWebGraphicsContext3D_h
+#define FakeWebGraphicsContext3D_h
+
+#include "core/platform/graphics/GraphicsContext3D.h"
+#include "public/platform/WebGraphicsContext3D.h"
+
+namespace WebKit {
+
+// WebGraphicsContext3D base class for use in WebKit unit tests.
+// All operations are no-ops (returning 0 if necessary).
+class FakeWebGraphicsContext3D : public WebGraphicsContext3D {
+public:
+    FakeWebGraphicsContext3D()
+        : m_nextTextureId(1)
+    {
+    }
+
+    virtual bool makeContextCurrent() { return true; }
+
+    virtual void prepareTexture() { }
+
+    virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) { }
+
+    virtual void synthesizeGLError(WGC3Denum) { }
+
+    virtual bool isContextLost() { return false; }
+
+    virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, WGC3Denum access) { return 0; }
+    virtual void unmapBufferSubDataCHROMIUM(const void*) { }
+    virtual void* mapTexSubImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, WGC3Denum access) { return 0; }
+    virtual void unmapTexSubImage2DCHROMIUM(const void*) { }
+
+    virtual void setVisibilityCHROMIUM(bool visible) { }
+
+    virtual void discardFramebufferEXT(WGC3Denum target, WGC3Dsizei numAttachments, const WGC3Denum* attachments) { }
+    virtual void ensureFramebufferCHROMIUM() { }
+
+    virtual void setMemoryAllocationChangedCallbackCHROMIUM(WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) { }
+
+    virtual WebString getRequestableExtensionsCHROMIUM() { return WebString(); }
+    virtual void requestExtensionCHROMIUM(const char*) { }
+
+    virtual void blitFramebufferCHROMIUM(WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, WGC3Dbitfield mask, WGC3Denum filter) { }
+    virtual void renderbufferStorageMultisampleCHROMIUM(WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) { }
+
+    virtual void activeTexture(WGC3Denum texture) { }
+    virtual void attachShader(WebGLId program, WebGLId shader) { }
+    virtual void bindAttribLocation(WebGLId program, WGC3Duint index, const WGC3Dchar* name) { }
+    virtual void bindBuffer(WGC3Denum target, WebGLId buffer) { }
+    virtual void bindFramebuffer(WGC3Denum target, WebGLId framebuffer) { }
+    virtual void bindRenderbuffer(WGC3Denum target, WebGLId renderbuffer) { }
+    virtual void bindTexture(WGC3Denum target, WebGLId texture) { }
+    virtual void blendColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) { }
+    virtual void blendEquation(WGC3Denum mode) { }
+    virtual void blendEquationSeparate(WGC3Denum modeRGB, WGC3Denum modeAlpha) { }
+    virtual void blendFunc(WGC3Denum sfactor, WGC3Denum dfactor) { }
+    virtual void blendFuncSeparate(WGC3Denum srcRGB, WGC3Denum dstRGB, WGC3Denum srcAlpha, WGC3Denum dstAlpha) { }
+
+    virtual void bufferData(WGC3Denum target, WGC3Dsizeiptr size, const void* data, WGC3Denum usage) { }
+    virtual void bufferSubData(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, const void* data) { }
+
+    virtual WGC3Denum checkFramebufferStatus(WGC3Denum target)
+    {
+        return WebCore::GraphicsContext3D::FRAMEBUFFER_COMPLETE;
+    }
+
+    virtual void clear(WGC3Dbitfield mask) { }
+    virtual void clearColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) { }
+    virtual void clearDepth(WGC3Dclampf depth) { }
+    virtual void clearStencil(WGC3Dint s) { }
+    virtual void colorMask(WGC3Dboolean red, WGC3Dboolean green, WGC3Dboolean blue, WGC3Dboolean alpha) { }
+    virtual void compileShader(WebGLId shader) { }
+
+    virtual void compressedTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Dsizei imageSize, const void* data) { }
+    virtual void compressedTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Dsizei imageSize, const void* data) { }
+    virtual void copyTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border) { }
+    virtual void copyTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) { }
+    virtual void cullFace(WGC3Denum mode) { }
+    virtual void depthFunc(WGC3Denum func) { }
+    virtual void depthMask(WGC3Dboolean flag) { }
+    virtual void depthRange(WGC3Dclampf zNear, WGC3Dclampf zFar) { }
+    virtual void detachShader(WebGLId program, WebGLId shader) { }
+    virtual void disable(WGC3Denum cap) { }
+    virtual void disableVertexAttribArray(WGC3Duint index) { }
+    virtual void drawArrays(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count) { }
+    virtual void drawElements(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset) { }
+
+    virtual void enable(WGC3Denum cap) { }
+    virtual void enableVertexAttribArray(WGC3Duint index) { }
+    virtual void finish() { }
+    virtual void flush() { }
+    virtual void framebufferRenderbuffer(WGC3Denum target, WGC3Denum attachment, WGC3Denum renderbuffertarget, WebGLId renderbuffer) { }
+    virtual void framebufferTexture2D(WGC3Denum target, WGC3Denum attachment, WGC3Denum textarget, WebGLId texture, WGC3Dint level) { }
+    virtual void frontFace(WGC3Denum mode) { }
+    virtual void generateMipmap(WGC3Denum target) { }
+
+    virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&) { return false; }
+    virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&) { return false; }
+    virtual void getAttachedShaders(WebGLId program, WGC3Dsizei maxCount, WGC3Dsizei* count, WebGLId* shaders) { }
+    virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name) { return 0; }
+    virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value) { }
+    virtual void getBufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { }
+    virtual Attributes getContextAttributes() { return m_attrs; }
+    virtual WGC3Denum getError() { return 0; }
+    virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value) { }
+    virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, WGC3Denum attachment, WGC3Denum pname, WGC3Dint* value) { }
+
+    virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value)
+    {
+        if (pname == WebCore::GraphicsContext3D::MAX_TEXTURE_SIZE)
+            *value = 1024;
+    }
+
+    virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value)
+    {
+        if (pname == WebCore::GraphicsContext3D::LINK_STATUS)
+            *value = 1;
+    }
+
+    virtual WebString getProgramInfoLog(WebGLId program) { return WebString(); }
+    virtual void getRenderbufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { }
+
+    virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value)
+    {
+        if (pname == WebCore::GraphicsContext3D::COMPILE_STATUS)
+            *value = 1;
+    }
+
+    virtual WebString getShaderInfoLog(WebGLId shader) { return WebString(); }
+    virtual void getShaderPrecisionFormat(WGC3Denum shadertype, WGC3Denum precisiontype, WGC3Dint* range, WGC3Dint* precision) { }
+    virtual WebString getShaderSource(WebGLId shader) { return WebString(); }
+    virtual WebString getString(WGC3Denum name) { return WebString(); }
+    virtual void getTexParameterfv(WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value) { }
+    virtual void getTexParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { }
+    virtual void getUniformfv(WebGLId program, WGC3Dint location, WGC3Dfloat* value) { }
+    virtual void getUniformiv(WebGLId program, WGC3Dint location, WGC3Dint* value) { }
+    virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name) { return 0; }
+    virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, WGC3Dfloat* value) { }
+    virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, WGC3Dint* value) { }
+    virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) { return 0; }
+
+    virtual void hint(WGC3Denum target, WGC3Denum mode) { }
+    virtual WGC3Dboolean isBuffer(WebGLId buffer) { return false; }
+    virtual WGC3Dboolean isEnabled(WGC3Denum cap) { return false; }
+    virtual WGC3Dboolean isFramebuffer(WebGLId framebuffer) { return false; }
+    virtual WGC3Dboolean isProgram(WebGLId program) { return false; }
+    virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer) { return false; }
+    virtual WGC3Dboolean isShader(WebGLId shader) { return false; }
+    virtual WGC3Dboolean isTexture(WebGLId texture) { return false; }
+    virtual void lineWidth(WGC3Dfloat) { }
+    virtual void linkProgram(WebGLId program) { }
+    virtual void pixelStorei(WGC3Denum pname, WGC3Dint param) { }
+    virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units) { }
+
+    virtual void readPixels(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, void* pixels) { }
+
+    virtual void releaseShaderCompiler() { }
+
+    virtual void renderbufferStorage(WGC3Denum target, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) { }
+    virtual void sampleCoverage(WGC3Dclampf value, WGC3Dboolean invert) { }
+    virtual void scissor(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) { }
+    virtual void shaderSource(WebGLId shader, const WGC3Dchar* string) { }
+    virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask) { }
+    virtual void stencilFuncSeparate(WGC3Denum face, WGC3Denum func, WGC3Dint ref, WGC3Duint mask) { }
+    virtual void stencilMask(WGC3Duint mask) { }
+    virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask) { }
+    virtual void stencilOp(WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) { }
+    virtual void stencilOpSeparate(WGC3Denum face, WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) { }
+
+    virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) { }
+
+    virtual void texParameterf(WGC3Denum target, WGC3Denum pname, WGC3Dfloat param) { }
+    virtual void texParameteri(WGC3Denum target, WGC3Denum pname, WGC3Dint param) { }
+
+    virtual void texSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, const void* pixels) { }
+
+    virtual void uniform1f(WGC3Dint location, WGC3Dfloat x) { }
+    virtual void uniform1fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) { }
+    virtual void uniform1i(WGC3Dint location, WGC3Dint x) { }
+    virtual void uniform1iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) { }
+    virtual void uniform2f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y) { }
+    virtual void uniform2fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) { }
+    virtual void uniform2i(WGC3Dint location, WGC3Dint x, WGC3Dint y) { }
+    virtual void uniform2iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) { }
+    virtual void uniform3f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z) { }
+    virtual void uniform3fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) { }
+    virtual void uniform3i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z) { }
+    virtual void uniform3iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) { }
+    virtual void uniform4f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w) { }
+    virtual void uniform4fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) { }
+    virtual void uniform4i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z, WGC3Dint w) { }
+    virtual void uniform4iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) { }
+    virtual void uniformMatrix2fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) { }
+    virtual void uniformMatrix3fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) { }
+    virtual void uniformMatrix4fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) { }
+
+    virtual void useProgram(WebGLId program) { }
+    virtual void validateProgram(WebGLId program) { }
+
+    virtual void vertexAttrib1f(WGC3Duint index, WGC3Dfloat x) { }
+    virtual void vertexAttrib1fv(WGC3Duint index, const WGC3Dfloat* values) { }
+    virtual void vertexAttrib2f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y) { }
+    virtual void vertexAttrib2fv(WGC3Duint index, const WGC3Dfloat* values) { }
+    virtual void vertexAttrib3f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z) { }
+    virtual void vertexAttrib3fv(WGC3Duint index, const WGC3Dfloat* values) { }
+    virtual void vertexAttrib4f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w) { }
+    virtual void vertexAttrib4fv(WGC3Duint index, const WGC3Dfloat* values) { }
+    virtual void vertexAttribPointer(WGC3Duint index, WGC3Dint size, WGC3Denum type, WGC3Dboolean normalized, WGC3Dsizei stride, WGC3Dintptr offset) { }
+
+    virtual void viewport(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) { }
+
+    virtual WebGLId createBuffer() { return 1; }
+    virtual WebGLId createFramebuffer() { return 1; }
+    virtual WebGLId createProgram() { return 1; }
+    virtual WebGLId createRenderbuffer() { return 1; }
+    virtual WebGLId createShader(WGC3Denum) { return 1; }
+    virtual WebGLId createTexture() { return m_nextTextureId++; }
+
+    virtual void deleteBuffer(WebGLId) { }
+    virtual void deleteFramebuffer(WebGLId) { }
+    virtual void deleteProgram(WebGLId) { }
+    virtual void deleteRenderbuffer(WebGLId) { }
+    virtual void deleteShader(WebGLId) { }
+    virtual void deleteTexture(WebGLId) { }
+
+    virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, WGC3Dint width, WGC3Dint height) { }
+
+    virtual WebGLId createQueryEXT() { return 1; }
+    virtual void deleteQueryEXT(WebGLId) { }
+    virtual GC3Dboolean isQueryEXT(WebGLId) { return true; }
+    virtual void beginQueryEXT(GC3Denum, WebGLId) { }
+    virtual void endQueryEXT(GC3Denum) { }
+    virtual void getQueryivEXT(GC3Denum, GC3Denum, GC3Dint*) { }
+    virtual void getQueryObjectuivEXT(WebGLId, GC3Denum, GC3Duint*) { }
+
+protected:
+    unsigned m_nextTextureId;
+    Attributes m_attrs;
+};
+
+} // namespace WebKit
+
+#endif // FakeWebGraphicsContext3D_h
diff --git a/Source/core/platform/text/AtomicStringKeyedMRUCache.h b/Source/core/platform/text/AtomicStringKeyedMRUCache.h
deleted file mode 100644
index 5b734e9..0000000
--- a/Source/core/platform/text/AtomicStringKeyedMRUCache.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2010 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 AtomicStringKeyedMRUCache_h
-#define AtomicStringKeyedMRUCache_h
-
-#include "wtf/text/AtomicString.h"
-
-namespace WebCore {
-
-template<typename T, size_t capacity = 4>
-class AtomicStringKeyedMRUCache {
-public:
-    T get(const AtomicString& key)
-    {
-        if (key.isNull()) {
-            DEFINE_STATIC_LOCAL(T, valueForNull, (createValueForNullKey()));
-            return valueForNull;
-        }
-
-        for (size_t i = 0; i < m_cache.size(); ++i) {
-            if (m_cache[i].first == key) {
-                size_t foundIndex = i;
-                if (foundIndex + 1 < m_cache.size()) {
-                    Entry entry = m_cache[foundIndex];
-                    m_cache.remove(foundIndex);
-                    foundIndex = m_cache.size();
-                    m_cache.append(entry);
-                }
-                return m_cache[foundIndex].second;
-            }
-        }
-        if (m_cache.size() == capacity)
-            m_cache.remove(0);
-
-        m_cache.append(std::make_pair(key, createValueForKey(key)));
-        return m_cache.last().second;
-    }
-
-private:
-    T createValueForNullKey();
-    T createValueForKey(const AtomicString&);
-
-    typedef pair<AtomicString, T> Entry;
-    typedef Vector<Entry, capacity> Cache;
-    Cache m_cache;
-};
-
-}
-
-#endif // AtomicStringKeyedMRUCache_h
diff --git a/Source/core/platform/text/BidiContext.cpp b/Source/core/platform/text/BidiContext.cpp
deleted file mode 100644
index fa12626..0000000
--- a/Source/core/platform/text/BidiContext.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2003, 2004, 2006, 2007, 2009, 2010 Apple Inc. All right reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "core/platform/text/BidiContext.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-using namespace WTF::Unicode;
-
-struct SameSizeAsBidiContext : public RefCounted<SameSizeAsBidiContext> {
-    uint32_t bitfields : 16;
-    void* parent;
-};
-
-COMPILE_ASSERT(sizeof(BidiContext) == sizeof(SameSizeAsBidiContext), BidiContext_should_stay_small);
-
-inline PassRefPtr<BidiContext> BidiContext::createUncached(unsigned char level, Direction direction, bool override, BidiEmbeddingSource source, BidiContext* parent)
-{
-    return adoptRef(new BidiContext(level, direction, override, source, parent));
-}
-
-PassRefPtr<BidiContext> BidiContext::create(unsigned char level, Direction direction, bool override, BidiEmbeddingSource source, BidiContext* parent)
-{
-    ASSERT(direction == (level % 2 ? RightToLeft : LeftToRight));
-
-    if (parent)
-        return createUncached(level, direction, override, source, parent);
-
-    ASSERT(level <= 1);
-    if (!level) {
-        if (!override) {
-            static BidiContext* ltrContext = createUncached(0, LeftToRight, false, FromStyleOrDOM, 0).leakRef();
-            return ltrContext;
-        }
-
-        static BidiContext* ltrOverrideContext = createUncached(0, LeftToRight, true, FromStyleOrDOM, 0).leakRef();
-        return ltrOverrideContext;
-    }
-
-    if (!override) {
-        static BidiContext* rtlContext = createUncached(1, RightToLeft, false, FromStyleOrDOM, 0).leakRef();
-        return rtlContext;
-    }
-
-    static BidiContext* rtlOverrideContext = createUncached(1, RightToLeft, true, FromStyleOrDOM, 0).leakRef();
-    return rtlOverrideContext;
-}
-
-static inline PassRefPtr<BidiContext> copyContextAndRebaselineLevel(BidiContext* context, BidiContext* parent)
-{
-    ASSERT(context);
-    unsigned char newLevel = parent ? parent->level() : 0;
-    if (context->dir() == RightToLeft)
-        newLevel = nextGreaterOddLevel(newLevel);
-    else if (parent)
-        newLevel = nextGreaterEvenLevel(newLevel);
-
-    return BidiContext::create(newLevel, context->dir(), context->override(), context->source(), parent);
-}
-
-// The BidiContext stack must be immutable -- they're re-used for re-layout after
-// DOM modification/editing -- so we copy all the non-unicode contexts, and
-// recalculate their levels.
-PassRefPtr<BidiContext> BidiContext::copyStackRemovingUnicodeEmbeddingContexts()
-{
-    Vector<BidiContext*, 64> contexts;
-    for (BidiContext* iter = this; iter; iter = iter->parent()) {
-        if (iter->source() != FromUnicode)
-            contexts.append(iter);
-    }
-    ASSERT(contexts.size());
-
-    RefPtr<BidiContext> topContext = copyContextAndRebaselineLevel(contexts.last(), 0);
-    for (int i = contexts.size() - 1; i > 0; --i)
-        topContext = copyContextAndRebaselineLevel(contexts[i - 1], topContext.get());
-
-    return topContext.release();
-}
-
-bool operator==(const BidiContext& c1, const BidiContext& c2)
-{
-    if (&c1 == &c2)
-        return true;
-    if (c1.level() != c2.level() || c1.override() != c2.override() || c1.dir() != c2.dir() || c1.source() != c2.source())
-        return false;
-    if (!c1.parent())
-        return !c2.parent();
-    return c2.parent() && *c1.parent() == *c2.parent();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/text/BidiContext.h b/Source/core/platform/text/BidiContext.h
deleted file mode 100644
index c701e88..0000000
--- a/Source/core/platform/text/BidiContext.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2003, 2004, 2006, 2007, 2009, 2010 Apple Inc. All right reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef BidiContext_h
-#define BidiContext_h
-
-#include "wtf/Assertions.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
-#include "wtf/RefPtr.h"
-#include "wtf/unicode/Unicode.h"
-
-namespace WebCore {
-
-enum BidiEmbeddingSource {
-    FromStyleOrDOM,
-    FromUnicode
-};
-
-// Used to keep track of explicit embeddings.
-class BidiContext : public RefCounted<BidiContext> {
-public:
-    static PassRefPtr<BidiContext> create(unsigned char level, WTF::Unicode::Direction, bool override = false, BidiEmbeddingSource = FromStyleOrDOM, BidiContext* parent = 0);
-
-    BidiContext* parent() const { return m_parent.get(); }
-    unsigned char level() const { return m_level; }
-    WTF::Unicode::Direction dir() const { return static_cast<WTF::Unicode::Direction>(m_direction); }
-    bool override() const { return m_override; }
-    BidiEmbeddingSource source() const { return static_cast<BidiEmbeddingSource>(m_source); }
-
-    PassRefPtr<BidiContext> copyStackRemovingUnicodeEmbeddingContexts();
-private:
-    BidiContext(unsigned char level, WTF::Unicode::Direction direction, bool override, BidiEmbeddingSource source, BidiContext* parent)
-        : m_level(level)
-        , m_direction(direction)
-        , m_override(override)
-        , m_source(source)
-        , m_parent(parent)
-    {
-    }
-
-    static PassRefPtr<BidiContext> createUncached(unsigned char level, WTF::Unicode::Direction, bool override, BidiEmbeddingSource, BidiContext* parent);
-
-    unsigned m_level : 6; // The maximium bidi level is 62: http://unicode.org/reports/tr9/#Explicit_Levels_and_Directions
-    unsigned m_direction : 5; // Direction
-    unsigned m_override : 1;
-    unsigned m_source : 1; // BidiEmbeddingSource
-    RefPtr<BidiContext> m_parent;
-};
-
-inline unsigned char nextGreaterOddLevel(unsigned char level)
-{
-    return (level + 1) | 1;
-}
-
-inline unsigned char nextGreaterEvenLevel(unsigned char level)
-{
-    return (level + 2) & ~1;
-}
-
-bool operator==(const BidiContext&, const BidiContext&);
-
-} // namespace WebCore
-
-#endif // BidiContext_h
diff --git a/Source/core/platform/text/BidiResolver.h b/Source/core/platform/text/BidiResolver.h
deleted file mode 100644
index 435612e..0000000
--- a/Source/core/platform/text/BidiResolver.h
+++ /dev/null
@@ -1,960 +0,0 @@
-/*
- * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2003, 2004, 2006, 2007, 2008 Apple Inc.  All right reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef BidiResolver_h
-#define BidiResolver_h
-
-#include "core/platform/text/BidiContext.h"
-#include "core/platform/text/BidiRunList.h"
-#include "core/platform/text/TextDirection.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-template <class Iterator> struct MidpointState {
-    MidpointState()
-    {
-        reset();
-    }
-
-    void reset()
-    {
-        numMidpoints = 0;
-        currentMidpoint = 0;
-        betweenMidpoints = false;
-    }
-
-    // The goal is to reuse the line state across multiple
-    // lines so we just keep an array around for midpoints and never clear it across multiple
-    // lines.  We track the number of items and position using the two other variables.
-    Vector<Iterator> midpoints;
-    unsigned numMidpoints;
-    unsigned currentMidpoint;
-    bool betweenMidpoints;
-};
-
-// The BidiStatus at a given position (typically the end of a line) can
-// be cached and then used to restart bidi resolution at that position.
-struct BidiStatus {
-    BidiStatus()
-        : eor(WTF::Unicode::OtherNeutral)
-        , lastStrong(WTF::Unicode::OtherNeutral)
-        , last(WTF::Unicode::OtherNeutral)
-    {
-    }
-
-    // Creates a BidiStatus representing a new paragraph root with a default direction.
-    // Uses TextDirection as it only has two possibilities instead of WTF::Unicode::Direction which has 19.
-    BidiStatus(TextDirection textDirection, bool isOverride)
-    {
-        WTF::Unicode::Direction direction = textDirection == LTR ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
-        eor = lastStrong = last = direction;
-        context = BidiContext::create(textDirection == LTR ? 0 : 1, direction, isOverride);
-    }
-
-    BidiStatus(WTF::Unicode::Direction eorDir, WTF::Unicode::Direction lastStrongDir, WTF::Unicode::Direction lastDir, PassRefPtr<BidiContext> bidiContext)
-        : eor(eorDir)
-        , lastStrong(lastStrongDir)
-        , last(lastDir)
-        , context(bidiContext)
-    {
-    }
-
-    WTF::Unicode::Direction eor;
-    WTF::Unicode::Direction lastStrong;
-    WTF::Unicode::Direction last;
-    RefPtr<BidiContext> context;
-};
-
-class BidiEmbedding {
-public:
-    BidiEmbedding(WTF::Unicode::Direction direction, BidiEmbeddingSource source)
-    : m_direction(direction)
-    , m_source(source)
-    {
-    }
-
-    WTF::Unicode::Direction direction() const { return m_direction; }
-    BidiEmbeddingSource source() const { return m_source; }
-private:
-    WTF::Unicode::Direction m_direction;
-    BidiEmbeddingSource m_source;
-};
-
-inline bool operator==(const BidiStatus& status1, const BidiStatus& status2)
-{
-    return status1.eor == status2.eor && status1.last == status2.last && status1.lastStrong == status2.lastStrong && *(status1.context) == *(status2.context);
-}
-
-inline bool operator!=(const BidiStatus& status1, const BidiStatus& status2)
-{
-    return !(status1 == status2);
-}
-
-struct BidiCharacterRun {
-    BidiCharacterRun(int start, int stop, BidiContext* context, WTF::Unicode::Direction dir)
-        : m_override(context->override())
-        , m_next(0)
-        , m_start(start)
-        , m_stop(stop)
-    {
-        if (dir == WTF::Unicode::OtherNeutral)
-            dir = context->dir();
-
-        m_level = context->level();
-
-        // add level of run (cases I1 & I2)
-        if (m_level % 2) {
-            if (dir == WTF::Unicode::LeftToRight || dir == WTF::Unicode::ArabicNumber || dir == WTF::Unicode::EuropeanNumber)
-                m_level++;
-        } else {
-            if (dir == WTF::Unicode::RightToLeft)
-                m_level++;
-            else if (dir == WTF::Unicode::ArabicNumber || dir == WTF::Unicode::EuropeanNumber)
-                m_level += 2;
-        }
-    }
-
-    int start() const { return m_start; }
-    int stop() const { return m_stop; }
-    unsigned char level() const { return m_level; }
-    bool reversed(bool visuallyOrdered) { return m_level % 2 && !visuallyOrdered; }
-    bool dirOverride(bool visuallyOrdered) { return m_override || visuallyOrdered; }
-
-    BidiCharacterRun* next() const { return m_next; }
-    void setNext(BidiCharacterRun* next) { m_next = next; }
-
-    // Do not add anything apart from bitfields until after m_next. See https://bugs.webkit.org/show_bug.cgi?id=100173
-    bool m_override : 1;
-    bool m_hasHyphen : 1; // Used by BidiRun subclass which is a layering violation but enables us to save 8 bytes per object on 64-bit.
-    bool m_startsSegment : 1; // Same comment as m_hasHyphen.
-    unsigned char m_level;
-    BidiCharacterRun* m_next;
-    int m_start;
-    int m_stop;
-};
-
-enum VisualDirectionOverride {
-    NoVisualOverride,
-    VisualLeftToRightOverride,
-    VisualRightToLeftOverride
-};
-
-// BidiResolver is WebKit's implementation of the Unicode Bidi Algorithm
-// http://unicode.org/reports/tr9
-template <class Iterator, class Run> class BidiResolver {
-    WTF_MAKE_NONCOPYABLE(BidiResolver);
-public:
-    BidiResolver()
-        : m_direction(WTF::Unicode::OtherNeutral)
-        , m_reachedEndOfLine(false)
-        , m_emptyRun(true)
-        , m_nestedIsolateCount(0)
-    {
-    }
-
-#ifndef NDEBUG
-    ~BidiResolver();
-#endif
-
-    const Iterator& position() const { return m_current; }
-    Iterator& position() { return m_current; }
-    void setPositionIgnoringNestedIsolates(const Iterator& position) { m_current = position; }
-    void setPosition(const Iterator& position, unsigned nestedIsolatedCount)
-    {
-        m_current = position;
-        m_nestedIsolateCount = nestedIsolatedCount;
-    }
-
-    BidiContext* context() const { return m_status.context.get(); }
-    void setContext(PassRefPtr<BidiContext> c) { m_status.context = c; }
-
-    void setLastDir(WTF::Unicode::Direction lastDir) { m_status.last = lastDir; }
-    void setLastStrongDir(WTF::Unicode::Direction lastStrongDir) { m_status.lastStrong = lastStrongDir; }
-    void setEorDir(WTF::Unicode::Direction eorDir) { m_status.eor = eorDir; }
-
-    WTF::Unicode::Direction dir() const { return m_direction; }
-    void setDir(WTF::Unicode::Direction d) { m_direction = d; }
-
-    const BidiStatus& status() const { return m_status; }
-    void setStatus(const BidiStatus s) { m_status = s; }
-
-    MidpointState<Iterator>& midpointState() { return m_midpointState; }
-
-    // The current algorithm handles nested isolates one layer of nesting at a time.
-    // But when we layout each isolated span, we will walk into (and ignore) all
-    // child isolated spans.
-    void enterIsolate() { m_nestedIsolateCount++; }
-    void exitIsolate() { ASSERT(m_nestedIsolateCount >= 1); m_nestedIsolateCount--; }
-    bool inIsolate() const { return m_nestedIsolateCount; }
-
-    void embed(WTF::Unicode::Direction, BidiEmbeddingSource);
-    bool commitExplicitEmbedding();
-
-    void createBidiRunsForLine(const Iterator& end, VisualDirectionOverride = NoVisualOverride, bool hardLineBreak = false);
-
-    BidiRunList<Run>& runs() { return m_runs; }
-
-    // FIXME: This used to be part of deleteRuns() but was a layering violation.
-    // It's unclear if this is still needed.
-    void markCurrentRunEmpty() { m_emptyRun = true; }
-
-    Vector<Run*>& isolatedRuns() { return m_isolatedRuns; }
-
-    bool isEndOfParagraph(const Iterator& end) { return m_current == end || m_current.atEnd(); }
-
-    TextDirection determineParagraphDirectionality(bool* hasStrongDirectionality = 0);
-
-protected:
-    void increment() { m_current.increment(); }
-    // FIXME: Instead of InlineBidiResolvers subclassing this method, we should
-    // pass in some sort of Traits object which knows how to create runs for appending.
-    void appendRun();
-
-    Iterator m_current;
-    // sor and eor are "start of run" and "end of run" respectively and correpond
-    // to abreviations used in UBA spec: http://unicode.org/reports/tr9/#BD7
-    Iterator m_sor; // Points to the first character in the current run.
-    Iterator m_eor; // Points to the last character in the current run.
-    Iterator m_last;
-    BidiStatus m_status;
-    WTF::Unicode::Direction m_direction;
-    Iterator endOfLine;
-    bool m_reachedEndOfLine;
-    Iterator m_lastBeforeET; // Before a EuropeanNumberTerminator
-    bool m_emptyRun;
-
-    // FIXME: This should not belong to the resolver, but rather be passed
-    // into createBidiRunsForLine by the caller.
-    BidiRunList<Run> m_runs;
-
-    MidpointState<Iterator> m_midpointState;
-
-    unsigned m_nestedIsolateCount;
-    Vector<Run*> m_isolatedRuns;
-
-private:
-    void raiseExplicitEmbeddingLevel(WTF::Unicode::Direction from, WTF::Unicode::Direction to);
-    void lowerExplicitEmbeddingLevel(WTF::Unicode::Direction from);
-    void checkDirectionInLowerRaiseEmbeddingLevel();
-
-    void updateStatusLastFromCurrentDirection(WTF::Unicode::Direction);
-    void reorderRunsFromLevels();
-
-    Vector<BidiEmbedding, 8> m_currentExplicitEmbeddingSequence;
-};
-
-#ifndef NDEBUG
-template <class Iterator, class Run>
-BidiResolver<Iterator, Run>::~BidiResolver()
-{
-    // The owner of this resolver should have handled the isolated runs.
-    ASSERT(m_isolatedRuns.isEmpty());
-}
-#endif
-
-template <class Iterator, class Run>
-void BidiResolver<Iterator, Run>::appendRun()
-{
-    if (!m_emptyRun && !m_eor.atEnd()) {
-        unsigned startOffset = m_sor.offset();
-        unsigned endOffset = m_eor.offset();
-
-        if (!endOfLine.atEnd() && endOffset >= endOfLine.offset()) {
-            m_reachedEndOfLine = true;
-            endOffset = endOfLine.offset();
-        }
-
-        if (endOffset >= startOffset)
-            m_runs.addRun(new Run(startOffset, endOffset + 1, context(), m_direction));
-
-        m_eor.increment();
-        m_sor = m_eor;
-    }
-
-    m_direction = WTF::Unicode::OtherNeutral;
-    m_status.eor = WTF::Unicode::OtherNeutral;
-}
-
-template <class Iterator, class Run>
-void BidiResolver<Iterator, Run>::embed(WTF::Unicode::Direction dir, BidiEmbeddingSource source)
-{
-    // Isolated spans compute base directionality during their own UBA run.
-    // Do not insert fake embed characters once we enter an isolated span.
-    ASSERT(!inIsolate());
-    using namespace WTF::Unicode;
-
-    ASSERT(dir == PopDirectionalFormat || dir == LeftToRightEmbedding || dir == LeftToRightOverride || dir == RightToLeftEmbedding || dir == RightToLeftOverride);
-    m_currentExplicitEmbeddingSequence.append(BidiEmbedding(dir, source));
-}
-
-template <class Iterator, class Run>
-void BidiResolver<Iterator, Run>::checkDirectionInLowerRaiseEmbeddingLevel()
-{
-    using namespace WTF::Unicode;
-
-    ASSERT(m_status.eor != OtherNeutral || m_eor.atEnd());
-    ASSERT(m_status.last != NonSpacingMark
-        && m_status.last != BoundaryNeutral
-        && m_status.last != RightToLeftEmbedding
-        && m_status.last != LeftToRightEmbedding
-        && m_status.last != RightToLeftOverride
-        && m_status.last != LeftToRightOverride
-        && m_status.last != PopDirectionalFormat);
-    if (m_direction == OtherNeutral)
-        m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft;
-}
-
-template <class Iterator, class Run>
-void BidiResolver<Iterator, Run>::lowerExplicitEmbeddingLevel(WTF::Unicode::Direction from)
-{
-    using namespace WTF::Unicode;
-
-    if (!m_emptyRun && m_eor != m_last) {
-        checkDirectionInLowerRaiseEmbeddingLevel();
-        // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
-        if (from == LeftToRight) {
-            // bidi.sor ... bidi.eor ... bidi.last L
-            if (m_status.eor == EuropeanNumber) {
-                if (m_status.lastStrong != LeftToRight) {
-                    m_direction = EuropeanNumber;
-                    appendRun();
-                }
-            } else if (m_status.eor == ArabicNumber) {
-                m_direction = ArabicNumber;
-                appendRun();
-            } else if (m_status.lastStrong != LeftToRight) {
-                appendRun();
-                m_direction = LeftToRight;
-            }
-        } else if (m_status.eor == EuropeanNumber || m_status.eor == ArabicNumber || m_status.lastStrong == LeftToRight) {
-            appendRun();
-            m_direction = RightToLeft;
-        }
-        m_eor = m_last;
-    }
-
-    appendRun();
-    m_emptyRun = true;
-
-    // sor for the new run is determined by the higher level (rule X10)
-    setLastDir(from);
-    setLastStrongDir(from);
-    m_eor = Iterator();
-}
-
-template <class Iterator, class Run>
-void BidiResolver<Iterator, Run>::raiseExplicitEmbeddingLevel(WTF::Unicode::Direction from, WTF::Unicode::Direction to)
-{
-    using namespace WTF::Unicode;
-
-    if (!m_emptyRun && m_eor != m_last) {
-        checkDirectionInLowerRaiseEmbeddingLevel();
-        // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
-        if (to == LeftToRight) {
-            // bidi.sor ... bidi.eor ... bidi.last L
-            if (m_status.eor == EuropeanNumber) {
-                if (m_status.lastStrong != LeftToRight) {
-                    m_direction = EuropeanNumber;
-                    appendRun();
-                }
-            } else if (m_status.eor == ArabicNumber) {
-                m_direction = ArabicNumber;
-                appendRun();
-            } else if (m_status.lastStrong != LeftToRight && from == LeftToRight) {
-                appendRun();
-                m_direction = LeftToRight;
-            }
-        } else if (m_status.eor == ArabicNumber
-            || (m_status.eor == EuropeanNumber && (m_status.lastStrong != LeftToRight || from == RightToLeft))
-            || (m_status.eor != EuropeanNumber && m_status.lastStrong == LeftToRight && from == RightToLeft)) {
-            appendRun();
-            m_direction = RightToLeft;
-        }
-        m_eor = m_last;
-    }
-
-    appendRun();
-    m_emptyRun = true;
-
-    setLastDir(to);
-    setLastStrongDir(to);
-    m_eor = Iterator();
-}
-
-template <class Iterator, class Run>
-bool BidiResolver<Iterator, Run>::commitExplicitEmbedding()
-{
-    // When we're "inIsolate()" we're resolving the parent context which
-    // ignores (skips over) the isolated content, including embedding levels.
-    // We should never accrue embedding levels while skipping over isolated content.
-    ASSERT(!inIsolate() || m_currentExplicitEmbeddingSequence.isEmpty());
-
-    using namespace WTF::Unicode;
-
-    unsigned char fromLevel = context()->level();
-    RefPtr<BidiContext> toContext = context();
-
-    for (size_t i = 0; i < m_currentExplicitEmbeddingSequence.size(); ++i) {
-        BidiEmbedding embedding = m_currentExplicitEmbeddingSequence[i];
-        if (embedding.direction() == PopDirectionalFormat) {
-            if (BidiContext* parentContext = toContext->parent())
-                toContext = parentContext;
-        } else {
-            Direction direction = (embedding.direction() == RightToLeftEmbedding || embedding.direction() == RightToLeftOverride) ? RightToLeft : LeftToRight;
-            bool override = embedding.direction() == LeftToRightOverride || embedding.direction() == RightToLeftOverride;
-            unsigned char level = toContext->level();
-            if (direction == RightToLeft)
-                level = nextGreaterOddLevel(level);
-            else
-                level = nextGreaterEvenLevel(level);
-            if (level < 61)
-                toContext = BidiContext::create(level, direction, override, embedding.source(), toContext.get());
-        }
-    }
-
-    unsigned char toLevel = toContext->level();
-
-    if (toLevel > fromLevel)
-        raiseExplicitEmbeddingLevel(fromLevel % 2 ? RightToLeft : LeftToRight, toLevel % 2 ? RightToLeft : LeftToRight);
-    else if (toLevel < fromLevel)
-        lowerExplicitEmbeddingLevel(fromLevel % 2 ? RightToLeft : LeftToRight);
-
-    setContext(toContext);
-
-    m_currentExplicitEmbeddingSequence.clear();
-
-    return fromLevel != toLevel;
-}
-
-template <class Iterator, class Run>
-inline void BidiResolver<Iterator, Run>::updateStatusLastFromCurrentDirection(WTF::Unicode::Direction dirCurrent)
-{
-    using namespace WTF::Unicode;
-    switch (dirCurrent) {
-    case EuropeanNumberTerminator:
-        if (m_status.last != EuropeanNumber)
-            m_status.last = EuropeanNumberTerminator;
-        break;
-    case EuropeanNumberSeparator:
-    case CommonNumberSeparator:
-    case SegmentSeparator:
-    case WhiteSpaceNeutral:
-    case OtherNeutral:
-        switch (m_status.last) {
-        case LeftToRight:
-        case RightToLeft:
-        case RightToLeftArabic:
-        case EuropeanNumber:
-        case ArabicNumber:
-            m_status.last = dirCurrent;
-            break;
-        default:
-            m_status.last = OtherNeutral;
-        }
-        break;
-    case NonSpacingMark:
-    case BoundaryNeutral:
-    case RightToLeftEmbedding:
-    case LeftToRightEmbedding:
-    case RightToLeftOverride:
-    case LeftToRightOverride:
-    case PopDirectionalFormat:
-        // ignore these
-        break;
-    case EuropeanNumber:
-        // fall through
-    default:
-        m_status.last = dirCurrent;
-    }
-}
-
-template <class Iterator, class Run>
-inline void BidiResolver<Iterator, Run>::reorderRunsFromLevels()
-{
-    unsigned char levelLow = 128;
-    unsigned char levelHigh = 0;
-    for (Run* run = m_runs.firstRun(); run; run = run->next()) {
-        levelHigh = std::max(run->level(), levelHigh);
-        levelLow = std::min(run->level(), levelLow);
-    }
-
-    // This implements reordering of the line (L2 according to Bidi spec):
-    // http://unicode.org/reports/tr9/#L2
-    // L2. From the highest level found in the text to the lowest odd level on each line,
-    // reverse any contiguous sequence of characters that are at that level or higher.
-
-    // Reversing is only done up to the lowest odd level.
-    if (!(levelLow % 2))
-        levelLow++;
-
-    unsigned count = m_runs.runCount() - 1;
-
-    while (levelHigh >= levelLow) {
-        unsigned i = 0;
-        Run* run = m_runs.firstRun();
-        while (i < count) {
-            for (;i < count && run && run->level() < levelHigh; i++)
-                run = run->next();
-            unsigned start = i;
-            for (;i <= count && run && run->level() >= levelHigh; i++)
-                run = run->next();
-            unsigned end = i - 1;
-            m_runs.reverseRuns(start, end);
-        }
-        levelHigh--;
-    }
-}
-
-template <class Iterator, class Run>
-TextDirection BidiResolver<Iterator, Run>::determineParagraphDirectionality(bool* hasStrongDirectionality)
-{
-    while (!m_current.atEnd()) {
-        if (inIsolate()) {
-            increment();
-            continue;
-        }
-        if (m_current.atParagraphSeparator())
-            break;
-        if (UChar current = m_current.current()) {
-            WTF::Unicode::Direction charDirection = WTF::Unicode::direction(current);
-            if (charDirection == WTF::Unicode::LeftToRight) {
-                if (hasStrongDirectionality)
-                    *hasStrongDirectionality = true;
-                return LTR;
-            }
-            if (charDirection == WTF::Unicode::RightToLeft || charDirection == WTF::Unicode::RightToLeftArabic) {
-                if (hasStrongDirectionality)
-                    *hasStrongDirectionality = true;
-                return RTL;
-            }
-        }
-        increment();
-    }
-    if (hasStrongDirectionality)
-        *hasStrongDirectionality = false;
-    return LTR;
-}
-
-template <class Iterator, class Run>
-void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, VisualDirectionOverride override, bool hardLineBreak)
-{
-    using namespace WTF::Unicode;
-
-    ASSERT(m_direction == OtherNeutral);
-
-    if (override != NoVisualOverride) {
-        m_emptyRun = false;
-        m_sor = m_current;
-        m_eor = Iterator();
-        while (m_current != end && !m_current.atEnd()) {
-            m_eor = m_current;
-            increment();
-        }
-        m_direction = override == VisualLeftToRightOverride ? LeftToRight : RightToLeft;
-        appendRun();
-        m_runs.setLogicallyLastRun(m_runs.lastRun());
-        if (override == VisualRightToLeftOverride)
-            m_runs.reverseRuns(0, m_runs.runCount() - 1);
-        return;
-    }
-
-    m_emptyRun = true;
-
-    m_eor = Iterator();
-
-    m_last = m_current;
-    bool lastParagraphEnded = false;
-    BidiResolver<Iterator, Run> stateAtEnd;
-
-    while (true) {
-        if (inIsolate() && m_emptyRun) {
-            m_sor = m_current;
-            m_emptyRun = false;
-        }
-
-        if (!lastParagraphEnded && isEndOfParagraph(end)) {
-            if (m_emptyRun)
-                break;
-
-            stateAtEnd.m_status = m_status;
-            stateAtEnd.m_sor = m_sor;
-            stateAtEnd.m_eor = m_eor;
-            stateAtEnd.m_last = m_last;
-            stateAtEnd.m_reachedEndOfLine = m_reachedEndOfLine;
-            stateAtEnd.m_lastBeforeET = m_lastBeforeET;
-            stateAtEnd.m_emptyRun = m_emptyRun;
-            endOfLine = m_last;
-            lastParagraphEnded = true;
-        }
-        Direction dirCurrent;
-        if (lastParagraphEnded && (hardLineBreak || m_current.atEnd())) {
-            BidiContext* c = context();
-            if (hardLineBreak) {
-                // A deviation from the Unicode Bidi Algorithm in order to match
-                // WinIE and user expectations: hard line breaks reset bidi state
-                // coming from unicode bidi control characters, but not those from
-                // DOM nodes with specified directionality
-                stateAtEnd.setContext(c->copyStackRemovingUnicodeEmbeddingContexts());
-
-                dirCurrent = stateAtEnd.context()->dir();
-                stateAtEnd.setEorDir(dirCurrent);
-                stateAtEnd.setLastDir(dirCurrent);
-                stateAtEnd.setLastStrongDir(dirCurrent);
-            } else {
-                while (c->parent())
-                    c = c->parent();
-                dirCurrent = c->dir();
-            }
-        } else {
-            dirCurrent = m_current.direction();
-            if (context()->override()
-                    && dirCurrent != RightToLeftEmbedding
-                    && dirCurrent != LeftToRightEmbedding
-                    && dirCurrent != RightToLeftOverride
-                    && dirCurrent != LeftToRightOverride
-                    && dirCurrent != PopDirectionalFormat)
-                dirCurrent = context()->dir();
-            else if (dirCurrent == NonSpacingMark)
-                dirCurrent = m_status.last;
-        }
-
-        // We ignore all character directionality while in unicode-bidi: isolate spans.
-        // We'll handle ordering the isolated characters in a second pass.
-        if (inIsolate())
-            dirCurrent = OtherNeutral;
-
-        ASSERT(m_status.eor != OtherNeutral || m_eor.atEnd());
-        switch (dirCurrent) {
-
-        // embedding and overrides (X1-X9 in the Bidi specs)
-        case RightToLeftEmbedding:
-        case LeftToRightEmbedding:
-        case RightToLeftOverride:
-        case LeftToRightOverride:
-        case PopDirectionalFormat:
-            embed(dirCurrent, FromUnicode);
-            commitExplicitEmbedding();
-            break;
-
-        // strong types
-        case LeftToRight:
-            switch(m_status.last) {
-                case RightToLeft:
-                case RightToLeftArabic:
-                case EuropeanNumber:
-                case ArabicNumber:
-                    if (m_status.last != EuropeanNumber || m_status.lastStrong != LeftToRight)
-                        appendRun();
-                    break;
-                case LeftToRight:
-                    break;
-                case EuropeanNumberSeparator:
-                case EuropeanNumberTerminator:
-                case CommonNumberSeparator:
-                case BoundaryNeutral:
-                case BlockSeparator:
-                case SegmentSeparator:
-                case WhiteSpaceNeutral:
-                case OtherNeutral:
-                    if (m_status.eor == EuropeanNumber) {
-                        if (m_status.lastStrong != LeftToRight) {
-                            // the numbers need to be on a higher embedding level, so let's close that run
-                            m_direction = EuropeanNumber;
-                            appendRun();
-                            if (context()->dir() != LeftToRight) {
-                                // the neutrals take the embedding direction, which is R
-                                m_eor = m_last;
-                                m_direction = RightToLeft;
-                                appendRun();
-                            }
-                        }
-                    } else if (m_status.eor == ArabicNumber) {
-                        // Arabic numbers are always on a higher embedding level, so let's close that run
-                        m_direction = ArabicNumber;
-                        appendRun();
-                        if (context()->dir() != LeftToRight) {
-                            // the neutrals take the embedding direction, which is R
-                            m_eor = m_last;
-                            m_direction = RightToLeft;
-                            appendRun();
-                        }
-                    } else if (m_status.lastStrong != LeftToRight) {
-                        //last stuff takes embedding dir
-                        if (context()->dir() == RightToLeft) {
-                            m_eor = m_last;
-                            m_direction = RightToLeft;
-                        }
-                        appendRun();
-                    }
-                default:
-                    break;
-            }
-            m_eor = m_current;
-            m_status.eor = LeftToRight;
-            m_status.lastStrong = LeftToRight;
-            m_direction = LeftToRight;
-            break;
-        case RightToLeftArabic:
-        case RightToLeft:
-            switch (m_status.last) {
-                case LeftToRight:
-                case EuropeanNumber:
-                case ArabicNumber:
-                    appendRun();
-                case RightToLeft:
-                case RightToLeftArabic:
-                    break;
-                case EuropeanNumberSeparator:
-                case EuropeanNumberTerminator:
-                case CommonNumberSeparator:
-                case BoundaryNeutral:
-                case BlockSeparator:
-                case SegmentSeparator:
-                case WhiteSpaceNeutral:
-                case OtherNeutral:
-                    if (m_status.eor == EuropeanNumber) {
-                        if (m_status.lastStrong == LeftToRight && context()->dir() == LeftToRight)
-                            m_eor = m_last;
-                        appendRun();
-                    } else if (m_status.eor == ArabicNumber)
-                        appendRun();
-                    else if (m_status.lastStrong == LeftToRight) {
-                        if (context()->dir() == LeftToRight)
-                            m_eor = m_last;
-                        appendRun();
-                    }
-                default:
-                    break;
-            }
-            m_eor = m_current;
-            m_status.eor = RightToLeft;
-            m_status.lastStrong = dirCurrent;
-            m_direction = RightToLeft;
-            break;
-
-            // weak types:
-
-        case EuropeanNumber:
-            if (m_status.lastStrong != RightToLeftArabic) {
-                // if last strong was AL change EN to AN
-                switch (m_status.last) {
-                    case EuropeanNumber:
-                    case LeftToRight:
-                        break;
-                    case RightToLeft:
-                    case RightToLeftArabic:
-                    case ArabicNumber:
-                        m_eor = m_last;
-                        appendRun();
-                        m_direction = EuropeanNumber;
-                        break;
-                    case EuropeanNumberSeparator:
-                    case CommonNumberSeparator:
-                        if (m_status.eor == EuropeanNumber)
-                            break;
-                    case EuropeanNumberTerminator:
-                    case BoundaryNeutral:
-                    case BlockSeparator:
-                    case SegmentSeparator:
-                    case WhiteSpaceNeutral:
-                    case OtherNeutral:
-                        if (m_status.eor == EuropeanNumber) {
-                            if (m_status.lastStrong == RightToLeft) {
-                                // ENs on both sides behave like Rs, so the neutrals should be R.
-                                // Terminate the EN run.
-                                appendRun();
-                                // Make an R run.
-                                m_eor = m_status.last == EuropeanNumberTerminator ? m_lastBeforeET : m_last;
-                                m_direction = RightToLeft;
-                                appendRun();
-                                // Begin a new EN run.
-                                m_direction = EuropeanNumber;
-                            }
-                        } else if (m_status.eor == ArabicNumber) {
-                            // Terminate the AN run.
-                            appendRun();
-                            if (m_status.lastStrong == RightToLeft || context()->dir() == RightToLeft) {
-                                // Make an R run.
-                                m_eor = m_status.last == EuropeanNumberTerminator ? m_lastBeforeET : m_last;
-                                m_direction = RightToLeft;
-                                appendRun();
-                                // Begin a new EN run.
-                                m_direction = EuropeanNumber;
-                            }
-                        } else if (m_status.lastStrong == RightToLeft) {
-                            // Extend the R run to include the neutrals.
-                            m_eor = m_status.last == EuropeanNumberTerminator ? m_lastBeforeET : m_last;
-                            m_direction = RightToLeft;
-                            appendRun();
-                            // Begin a new EN run.
-                            m_direction = EuropeanNumber;
-                        }
-                    default:
-                        break;
-                }
-                m_eor = m_current;
-                m_status.eor = EuropeanNumber;
-                if (m_direction == OtherNeutral)
-                    m_direction = LeftToRight;
-                break;
-            }
-        case ArabicNumber:
-            dirCurrent = ArabicNumber;
-            switch (m_status.last) {
-                case LeftToRight:
-                    if (context()->dir() == LeftToRight)
-                        appendRun();
-                    break;
-                case ArabicNumber:
-                    break;
-                case RightToLeft:
-                case RightToLeftArabic:
-                case EuropeanNumber:
-                    m_eor = m_last;
-                    appendRun();
-                    break;
-                case CommonNumberSeparator:
-                    if (m_status.eor == ArabicNumber)
-                        break;
-                case EuropeanNumberSeparator:
-                case EuropeanNumberTerminator:
-                case BoundaryNeutral:
-                case BlockSeparator:
-                case SegmentSeparator:
-                case WhiteSpaceNeutral:
-                case OtherNeutral:
-                    if (m_status.eor == ArabicNumber
-                        || (m_status.eor == EuropeanNumber && (m_status.lastStrong == RightToLeft || context()->dir() == RightToLeft))
-                        || (m_status.eor != EuropeanNumber && m_status.lastStrong == LeftToRight && context()->dir() == RightToLeft)) {
-                        // Terminate the run before the neutrals.
-                        appendRun();
-                        // Begin an R run for the neutrals.
-                        m_direction = RightToLeft;
-                    } else if (m_direction == OtherNeutral)
-                        m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft;
-                    m_eor = m_last;
-                    appendRun();
-                default:
-                    break;
-            }
-            m_eor = m_current;
-            m_status.eor = ArabicNumber;
-            if (m_direction == OtherNeutral)
-                m_direction = ArabicNumber;
-            break;
-        case EuropeanNumberSeparator:
-        case CommonNumberSeparator:
-            break;
-        case EuropeanNumberTerminator:
-            if (m_status.last == EuropeanNumber) {
-                dirCurrent = EuropeanNumber;
-                m_eor = m_current;
-                m_status.eor = dirCurrent;
-            } else if (m_status.last != EuropeanNumberTerminator)
-                m_lastBeforeET = m_emptyRun ? m_eor : m_last;
-            break;
-
-        // boundary neutrals should be ignored
-        case BoundaryNeutral:
-            if (m_eor == m_last)
-                m_eor = m_current;
-            break;
-            // neutrals
-        case BlockSeparator:
-            // ### what do we do with newline and paragraph seperators that come to here?
-            break;
-        case SegmentSeparator:
-            // ### implement rule L1
-            break;
-        case WhiteSpaceNeutral:
-            break;
-        case OtherNeutral:
-            break;
-        default:
-            break;
-        }
-
-        if (lastParagraphEnded && m_eor == m_current) {
-            if (!m_reachedEndOfLine) {
-                m_eor = endOfLine;
-                switch (m_status.eor) {
-                    case LeftToRight:
-                    case RightToLeft:
-                    case ArabicNumber:
-                        m_direction = m_status.eor;
-                        break;
-                    case EuropeanNumber:
-                        m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : EuropeanNumber;
-                        break;
-                    default:
-                        ASSERT_NOT_REACHED();
-                }
-                appendRun();
-            }
-            m_current = end;
-            m_status = stateAtEnd.m_status;
-            m_sor = stateAtEnd.m_sor;
-            m_eor = stateAtEnd.m_eor;
-            m_last = stateAtEnd.m_last;
-            m_reachedEndOfLine = stateAtEnd.m_reachedEndOfLine;
-            m_lastBeforeET = stateAtEnd.m_lastBeforeET;
-            m_emptyRun = stateAtEnd.m_emptyRun;
-            m_direction = OtherNeutral;
-            break;
-        }
-
-        updateStatusLastFromCurrentDirection(dirCurrent);
-        m_last = m_current;
-
-        if (m_emptyRun) {
-            m_sor = m_current;
-            m_emptyRun = false;
-        }
-
-        increment();
-        if (!m_currentExplicitEmbeddingSequence.isEmpty()) {
-            bool committed = commitExplicitEmbedding();
-            if (committed && lastParagraphEnded) {
-                m_current = end;
-                m_status = stateAtEnd.m_status;
-                m_sor = stateAtEnd.m_sor;
-                m_eor = stateAtEnd.m_eor;
-                m_last = stateAtEnd.m_last;
-                m_reachedEndOfLine = stateAtEnd.m_reachedEndOfLine;
-                m_lastBeforeET = stateAtEnd.m_lastBeforeET;
-                m_emptyRun = stateAtEnd.m_emptyRun;
-                m_direction = OtherNeutral;
-                break;
-            }
-        }
-    }
-
-    m_runs.setLogicallyLastRun(m_runs.lastRun());
-    reorderRunsFromLevels();
-    endOfLine = Iterator();
-}
-
-} // namespace WebCore
-
-#endif // BidiResolver_h
diff --git a/Source/core/platform/text/BidiRunList.h b/Source/core/platform/text/BidiRunList.h
deleted file mode 100644
index e4d701e..0000000
--- a/Source/core/platform/text/BidiRunList.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2003, 2004, 2006, 2007, 2008 Apple Inc.  All right reserved.
- * Copyright (C) 2011 Google, Inc.  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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef BidiRunList_h
-#define BidiRunList_h
-
-#include "wtf/Noncopyable.h"
-
-namespace WebCore {
-
-template <class Run>
-class BidiRunList {
-    WTF_MAKE_NONCOPYABLE(BidiRunList);
-public:
-    BidiRunList()
-        : m_firstRun(0)
-        , m_lastRun(0)
-        , m_logicallyLastRun(0)
-        , m_runCount(0)
-    {
-    }
-
-    // FIXME: Once BidiResolver no longer owns the BidiRunList,
-    // then ~BidiRunList should call deleteRuns() automatically.
-
-    Run* firstRun() const { return m_firstRun; }
-    Run* lastRun() const { return m_lastRun; }
-    Run* logicallyLastRun() const { return m_logicallyLastRun; }
-    unsigned runCount() const { return m_runCount; }
-
-    void addRun(Run*);
-    void prependRun(Run*);
-
-    void moveRunToEnd(Run*);
-    void moveRunToBeginning(Run*);
-
-    void deleteRuns();
-    void reverseRuns(unsigned start, unsigned end);
-    void reorderRunsFromLevels();
-
-    void setLogicallyLastRun(Run* run) { m_logicallyLastRun = run; }
-
-    void replaceRunWithRuns(Run* toReplace, BidiRunList<Run>& newRuns);
-
-private:
-    void clearWithoutDestroyingRuns();
-
-    Run* m_firstRun;
-    Run* m_lastRun;
-    Run* m_logicallyLastRun;
-    unsigned m_runCount;
-};
-
-template <class Run>
-inline void BidiRunList<Run>::addRun(Run* run)
-{
-    if (!m_firstRun)
-        m_firstRun = run;
-    else
-        m_lastRun->m_next = run;
-    m_lastRun = run;
-    m_runCount++;
-}
-
-template <class Run>
-inline void BidiRunList<Run>::prependRun(Run* run)
-{
-    ASSERT(!run->m_next);
-
-    if (!m_lastRun)
-        m_lastRun = run;
-    else
-        run->m_next = m_firstRun;
-    m_firstRun = run;
-    m_runCount++;
-}
-
-template <class Run>
-inline void BidiRunList<Run>::moveRunToEnd(Run* run)
-{
-    ASSERT(m_firstRun);
-    ASSERT(m_lastRun);
-    ASSERT(run->m_next);
-
-    Run* current = 0;
-    Run* next = m_firstRun;
-    while (next != run) {
-        current = next;
-        next = current->next();
-    }
-
-    if (!current)
-        m_firstRun = run->next();
-    else
-        current->m_next = run->m_next;
-
-    run->m_next = 0;
-    m_lastRun->m_next = run;
-    m_lastRun = run;
-}
-
-template <class Run>
-inline void BidiRunList<Run>::moveRunToBeginning(Run* run)
-{
-    ASSERT(m_firstRun);
-    ASSERT(m_lastRun);
-    ASSERT(run != m_firstRun);
-
-    Run* current = m_firstRun;
-    Run* next = current->next();
-    while (next != run) {
-        current = next;
-        next = current->next();
-    }
-
-    current->m_next = run->m_next;
-    if (run == m_lastRun)
-        m_lastRun = current;
-
-    run->m_next = m_firstRun;
-    m_firstRun = run;
-}
-
-template <class Run>
-void BidiRunList<Run>::replaceRunWithRuns(Run* toReplace, BidiRunList<Run>& newRuns)
-{
-    ASSERT(newRuns.runCount());
-    ASSERT(m_firstRun);
-    ASSERT(toReplace);
-
-    if (m_firstRun == toReplace)
-        m_firstRun = newRuns.firstRun();
-    else {
-        // Find the run just before "toReplace" in the list of runs.
-        Run* previousRun = m_firstRun;
-        while (previousRun->next() != toReplace)
-            previousRun = previousRun->next();
-        ASSERT(previousRun);
-        previousRun->setNext(newRuns.firstRun());
-    }
-
-    newRuns.lastRun()->setNext(toReplace->next());
-
-    // Fix up any of other pointers which may now be stale.
-    if (m_lastRun == toReplace)
-        m_lastRun = newRuns.lastRun();
-    if (m_logicallyLastRun == toReplace)
-        m_logicallyLastRun = newRuns.logicallyLastRun();
-    m_runCount += newRuns.runCount() - 1; // We added the new runs and removed toReplace.
-
-    delete toReplace;
-    newRuns.clearWithoutDestroyingRuns();
-}
-
-template <class Run>
-void BidiRunList<Run>::clearWithoutDestroyingRuns()
-{
-    m_firstRun = 0;
-    m_lastRun = 0;
-    m_logicallyLastRun = 0;
-    m_runCount = 0;
-}
-
-template <class Run>
-void BidiRunList<Run>::deleteRuns()
-{
-    if (!m_firstRun)
-        return;
-
-    Run* curr = m_firstRun;
-    while (curr) {
-        Run* s = curr->next();
-        delete curr;
-        curr = s;
-    }
-
-    m_firstRun = 0;
-    m_lastRun = 0;
-    m_runCount = 0;
-}
-
-template <class Run>
-void BidiRunList<Run>::reverseRuns(unsigned start, unsigned end)
-{
-    if (start >= end)
-        return;
-
-    ASSERT(end < m_runCount);
-
-    // Get the item before the start of the runs to reverse and put it in
-    // |beforeStart|. |curr| should point to the first run to reverse.
-    Run* curr = m_firstRun;
-    Run* beforeStart = 0;
-    unsigned i = 0;
-    while (i < start) {
-        i++;
-        beforeStart = curr;
-        curr = curr->next();
-    }
-
-    Run* startRun = curr;
-    while (i < end) {
-        i++;
-        curr = curr->next();
-    }
-    Run* endRun = curr;
-    Run* afterEnd = curr->next();
-
-    i = start;
-    curr = startRun;
-    Run* newNext = afterEnd;
-    while (i <= end) {
-        // Do the reversal.
-        Run* next = curr->next();
-        curr->m_next = newNext;
-        newNext = curr;
-        curr = next;
-        i++;
-    }
-
-    // Now hook up beforeStart and afterEnd to the startRun and endRun.
-    if (beforeStart)
-        beforeStart->m_next = endRun;
-    else
-        m_firstRun = endRun;
-
-    startRun->m_next = afterEnd;
-    if (!afterEnd)
-        m_lastRun = startRun;
-}
-
-} // namespace WebCore
-
-#endif // BidiRunList
diff --git a/Source/core/platform/text/DateTimeFormat.cpp b/Source/core/platform/text/DateTimeFormat.cpp
deleted file mode 100644
index 0a02cdc..0000000
--- a/Source/core/platform/text/DateTimeFormat.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * 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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/platform/text/DateTimeFormat.h"
-
-#include "wtf/ASCIICType.h"
-#include "wtf/text/StringBuilder.h"
-
-namespace WebCore {
-
-static const DateTimeFormat::FieldType lowerCaseToFieldTypeMap[26] = {
-    DateTimeFormat::FieldTypePeriod, // a
-    DateTimeFormat::FieldTypeInvalid, // b
-    DateTimeFormat::FieldTypeLocalDayOfWeekStandAlon, // c
-    DateTimeFormat::FieldTypeDayOfMonth, // d
-    DateTimeFormat::FieldTypeLocalDayOfWeek, // e
-    DateTimeFormat::FieldTypeInvalid, // f
-    DateTimeFormat::FieldTypeModifiedJulianDay, // g
-    DateTimeFormat::FieldTypeHour12, // h
-    DateTimeFormat::FieldTypeInvalid, // i
-    DateTimeFormat::FieldTypeInvalid, // j
-    DateTimeFormat::FieldTypeHour24, // k
-    DateTimeFormat::FieldTypeInvalid, // l
-    DateTimeFormat::FieldTypeMinute, // m
-    DateTimeFormat::FieldTypeInvalid, // n
-    DateTimeFormat::FieldTypeInvalid, // o
-    DateTimeFormat::FieldTypeInvalid, // p
-    DateTimeFormat::FieldTypeQuaterStandAlone, // q
-    DateTimeFormat::FieldTypeInvalid, // r
-    DateTimeFormat::FieldTypeSecond, // s
-    DateTimeFormat::FieldTypeInvalid, // t
-    DateTimeFormat::FieldTypeExtendedYear, // u
-    DateTimeFormat::FieldTypeNonLocationZone, // v
-    DateTimeFormat::FieldTypeWeekOfYear, // w
-    DateTimeFormat::FieldTypeInvalid, // x
-    DateTimeFormat::FieldTypeYear, // y
-    DateTimeFormat::FieldTypeZone, // z
-};
-
-static const DateTimeFormat::FieldType upperCaseToFieldTypeMap[26] = {
-    DateTimeFormat::FieldTypeMillisecondsInDay, // A
-    DateTimeFormat::FieldTypeInvalid, // B
-    DateTimeFormat::FieldTypeInvalid, // C
-    DateTimeFormat::FieldTypeDayOfYear, // D
-    DateTimeFormat::FieldTypeDayOfWeek, // E
-    DateTimeFormat::FieldTypeDayOfWeekInMonth, // F
-    DateTimeFormat::FieldTypeEra, // G
-    DateTimeFormat::FieldTypeHour23, // H
-    DateTimeFormat::FieldTypeInvalid, // I
-    DateTimeFormat::FieldTypeInvalid, // J
-    DateTimeFormat::FieldTypeHour11, // K
-    DateTimeFormat::FieldTypeMonthStandAlone, // L
-    DateTimeFormat::FieldTypeMonth, // M
-    DateTimeFormat::FieldTypeInvalid, // N
-    DateTimeFormat::FieldTypeInvalid, // O
-    DateTimeFormat::FieldTypeInvalid, // P
-    DateTimeFormat::FieldTypeQuater, // Q
-    DateTimeFormat::FieldTypeInvalid, // R
-    DateTimeFormat::FieldTypeFractionalSecond, // S
-    DateTimeFormat::FieldTypeInvalid, // T
-    DateTimeFormat::FieldTypeInvalid, // U
-    DateTimeFormat::FieldTypeInvalid, // V
-    DateTimeFormat::FieldTypeWeekOfMonth, // W
-    DateTimeFormat::FieldTypeInvalid, // X
-    DateTimeFormat::FieldTypeYearOfWeekOfYear, // Y
-    DateTimeFormat::FieldTypeRFC822Zone, // Z
-};
-
-static DateTimeFormat::FieldType mapCharacterToFieldType(const UChar ch)
-{
-    if (isASCIIUpper(ch))
-        return upperCaseToFieldTypeMap[ch - 'A'];
-
-    if (isASCIILower(ch))
-        return lowerCaseToFieldTypeMap[ch - 'a'];
-
-    return DateTimeFormat::FieldTypeLiteral;
-}
-
-bool DateTimeFormat::parse(const String& source, TokenHandler& tokenHandler)
-{
-    enum State {
-        StateInQuote,
-        StateInQuoteQuote,
-        StateLiteral,
-        StateQuote,
-        StateSymbol,
-    } state = StateLiteral;
-
-    FieldType fieldType = FieldTypeLiteral;
-    StringBuilder literalBuffer;
-    int fieldCounter = 0;
-
-    for (unsigned int index = 0; index < source.length(); ++index) {
-        const UChar ch = source[index];
-        switch (state) {
-        case StateInQuote:
-            if (ch == '\'') {
-                state = StateInQuoteQuote;
-                break;
-            }
-
-            literalBuffer.append(ch);
-            break;
-
-        case StateInQuoteQuote:
-            if (ch == '\'') {
-                literalBuffer.append('\'');
-                state = StateInQuote;
-                break;
-            }
-
-            fieldType = mapCharacterToFieldType(ch);
-            if (fieldType == FieldTypeInvalid)
-                return false;
-
-            if (fieldType == FieldTypeLiteral) {
-                literalBuffer.append(ch);
-                state = StateLiteral;
-                break;
-            }
-
-            if (literalBuffer.length()) {
-                tokenHandler.visitLiteral(literalBuffer.toString());
-                literalBuffer.clear();
-            }
-
-            fieldCounter = 1;
-            state = StateSymbol;
-            break;
-
-        case StateLiteral:
-            if (ch == '\'') {
-                state = StateQuote;
-                break;
-            }
-
-            fieldType = mapCharacterToFieldType(ch);
-            if (fieldType == FieldTypeInvalid)
-                return false;
-
-            if (fieldType == FieldTypeLiteral) {
-                literalBuffer.append(ch);
-                break;
-            }
-
-            if (literalBuffer.length()) {
-                tokenHandler.visitLiteral(literalBuffer.toString());
-                literalBuffer.clear();
-            }
-
-            fieldCounter = 1;
-            state = StateSymbol;
-            break;
-
-        case StateQuote:
-            literalBuffer.append(ch);
-            state = ch == '\'' ? StateLiteral : StateInQuote;
-            break;
-
-        case StateSymbol: {
-            ASSERT(fieldType != FieldTypeInvalid);
-            ASSERT(fieldType != FieldTypeLiteral);
-            ASSERT(literalBuffer.isEmpty());
-
-            FieldType fieldType2 = mapCharacterToFieldType(ch);
-            if (fieldType2 == FieldTypeInvalid)
-                return false;
-
-            if (fieldType == fieldType2) {
-                ++fieldCounter;
-                break;
-            }
-
-            tokenHandler.visitField(fieldType, fieldCounter);
-
-            if (fieldType2 == FieldTypeLiteral) {
-                if (ch == '\'')
-                    state = StateQuote;
-                else {
-                    literalBuffer.append(ch);
-                    state = StateLiteral;
-                }
-                break;
-            }
-
-            fieldCounter = 1;
-            fieldType = fieldType2;
-            break;
-        }
-        }
-    }
-
-    ASSERT(fieldType != FieldTypeInvalid);
-
-    switch (state) {
-    case StateLiteral:
-    case StateInQuoteQuote:
-        if (literalBuffer.length())
-            tokenHandler.visitLiteral(literalBuffer.toString());
-        return true;
-
-    case StateQuote:
-    case StateInQuote:
-        if (literalBuffer.length())
-            tokenHandler.visitLiteral(literalBuffer.toString());
-        return false;
-
-    case StateSymbol:
-        ASSERT(fieldType != FieldTypeLiteral);
-        ASSERT(!literalBuffer.length());
-        tokenHandler.visitField(fieldType, fieldCounter);
-        return true;
-    }
-
-    ASSERT_NOT_REACHED();
-    return false;
-}
-
-static bool isASCIIAlphabetOrQuote(UChar ch)
-{
-    return isASCIIAlpha(ch) || ch == '\'';
-}
-
-void DateTimeFormat::quoteAndAppendLiteral(const String& literal, StringBuilder& buffer)
-{
-    if (literal.length() <= 0)
-        return;
-
-    if (literal.find(isASCIIAlphabetOrQuote) == kNotFound) {
-        buffer.append(literal);
-        return;
-    }
-
-    if (literal.find('\'') == kNotFound) {
-        buffer.append("'");
-        buffer.append(literal);
-        buffer.append("'");
-        return;
-    }
-
-    for (unsigned i = 0; i < literal.length(); ++i) {
-        if (literal[i] == '\'')
-            buffer.append("''");
-        else {
-            String escaped = literal.substring(i);
-            escaped.replace("'", "''");
-            buffer.append("'");
-            buffer.append(escaped);
-            buffer.append("'");
-            return;
-        }
-    }
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/text/DateTimeFormat.h b/Source/core/platform/text/DateTimeFormat.h
deleted file mode 100644
index 729212a..0000000
--- a/Source/core/platform/text/DateTimeFormat.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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 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 DateTimeFormat_h
-#define DateTimeFormat_h
-
-#include "wtf/Forward.h"
-
-namespace WebCore {
-
-// DateTimeFormat parses date time format defined in Unicode Technical
-// standard 35, Locale Data Markup Language (LDML)[1].
-// [1] LDML http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns
-class DateTimeFormat {
-public:
-    enum FieldType {
-        FieldTypeInvalid,
-        FieldTypeLiteral,
-
-        // Era: AD
-        FieldTypeEra = 'G',
-
-        // Year: 1996
-        FieldTypeYear = 'y',
-        FieldTypeYearOfWeekOfYear = 'Y',
-        FieldTypeExtendedYear = 'u',
-
-        // Quater: Q2
-        FieldTypeQuater = 'Q',
-        FieldTypeQuaterStandAlone = 'q',
-
-        // Month: September
-        FieldTypeMonth = 'M',
-        FieldTypeMonthStandAlone = 'L',
-
-        // Week: 42
-        FieldTypeWeekOfYear = 'w',
-        FieldTypeWeekOfMonth = 'W',
-
-        // Day: 12
-        FieldTypeDayOfMonth = 'd',
-        FieldTypeDayOfYear = 'D',
-        FieldTypeDayOfWeekInMonth = 'F',
-        FieldTypeModifiedJulianDay = 'g',
-
-        // Week Day: Tuesday
-        FieldTypeDayOfWeek = 'E',
-        FieldTypeLocalDayOfWeek = 'e',
-        FieldTypeLocalDayOfWeekStandAlon = 'c',
-
-        // Period: AM or PM
-        FieldTypePeriod = 'a',
-
-        // Hour: 7
-        FieldTypeHour12 = 'h',
-        FieldTypeHour23 = 'H',
-        FieldTypeHour11 = 'K',
-        FieldTypeHour24 = 'k',
-
-        // Minute: 59
-        FieldTypeMinute = 'm',
-
-        // Second: 12
-        FieldTypeSecond = 's',
-        FieldTypeFractionalSecond = 'S',
-        FieldTypeMillisecondsInDay = 'A',
-
-        // Zone: PDT
-        FieldTypeZone = 'z',
-        FieldTypeRFC822Zone = 'Z',
-        FieldTypeNonLocationZone = 'v',
-    };
-
-    class TokenHandler {
-    public:
-        virtual ~TokenHandler() { }
-        virtual void visitField(FieldType, int numberOfPatternCharacters) = 0;
-        virtual void visitLiteral(const String&) = 0;
-    };
-
-    // Returns true if succeeded, false if failed.
-    static bool parse(const String&, TokenHandler&);
-    static void quoteAndAppendLiteral(const String&, StringBuilder&);
-};
-
-} // namespace WebCore
-
-#endif // DateTimeFormat_h
diff --git a/Source/core/platform/text/DateTimeFormatTest.cpp b/Source/core/platform/text/DateTimeFormatTest.cpp
deleted file mode 100644
index aeccc80..0000000
--- a/Source/core/platform/text/DateTimeFormatTest.cpp
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * 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 INC. AND ITS CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/platform/text/DateTimeFormat.h"
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-#include "wtf/text/CString.h"
-#include "wtf/text/StringBuilder.h"
-#include <gtest/gtest.h>
-
-using namespace WebCore;
-
-class DateTimeFormatTest : public ::testing::Test {
-public:
-    typedef DateTimeFormat::FieldType FieldType;
-
-    struct Token {
-        String string;
-        int count;
-        FieldType fieldType;
-
-        Token(FieldType fieldType, int count = 1)
-            : count(count)
-            , fieldType(fieldType)
-        {
-            ASSERT(fieldType != DateTimeFormat::FieldTypeLiteral);
-        }
-
-        Token(const String& string)
-            : string(string)
-            , count(0)
-            , fieldType(DateTimeFormat::FieldTypeLiteral)
-        {
-        }
-
-        bool operator==(const Token& other) const
-        {
-            return fieldType == other.fieldType && count == other.count && string == other.string;
-        }
-
-        String toString() const
-        {
-            switch (fieldType) {
-            case DateTimeFormat::FieldTypeInvalid:
-                return "*invalid*";
-            case DateTimeFormat::FieldTypeLiteral: {
-                StringBuilder builder;
-                builder.append('"');
-                builder.append(string);
-                builder.append('"');
-                return builder.toString();
-            }
-            default:
-                return String::format("Token(%d, %d)", fieldType, count);
-            }
-        }
-    };
-
-    class Tokens {
-    public:
-        Tokens() { }
-
-        explicit Tokens(const Vector<Token> tokens)
-            : m_tokens(tokens)
-        {
-        }
-
-        explicit Tokens(const String& string)
-        {
-            m_tokens.append(Token(string));
-        }
-
-        explicit Tokens(Token token1)
-        {
-            m_tokens.append(token1);
-        }
-
-        Tokens(Token token1, Token token2)
-        {
-            m_tokens.append(token1);
-            m_tokens.append(token2);
-        }
-
-        Tokens(Token token1, Token token2, Token token3)
-        {
-            m_tokens.append(token1);
-            m_tokens.append(token2);
-            m_tokens.append(token3);
-        }
-
-        Tokens(Token token1, Token token2, Token token3, Token token4)
-        {
-            m_tokens.append(token1);
-            m_tokens.append(token2);
-            m_tokens.append(token3);
-            m_tokens.append(token4);
-        }
-
-        Tokens(Token token1, Token token2, Token token3, Token token4, Token token5)
-        {
-            m_tokens.append(token1);
-            m_tokens.append(token2);
-            m_tokens.append(token3);
-            m_tokens.append(token4);
-            m_tokens.append(token5);
-        }
-
-        Tokens(Token token1, Token token2, Token token3, Token token4, Token token5, Token token6)
-        {
-            m_tokens.append(token1);
-            m_tokens.append(token2);
-            m_tokens.append(token3);
-            m_tokens.append(token4);
-            m_tokens.append(token5);
-            m_tokens.append(token6);
-        }
-
-        bool operator==(const Tokens& other) const
-        {
-            return m_tokens == other.m_tokens;
-        }
-
-        String toString() const
-        {
-            StringBuilder builder;
-            builder.append("Tokens(");
-            for (unsigned index = 0; index < m_tokens.size(); ++index) {
-                if (index)
-                    builder.append(",");
-                builder.append(m_tokens[index].toString());
-            }
-            builder.append(")");
-            return builder.toString();
-        }
-
-    private:
-        Vector<Token> m_tokens;
-    };
-
-protected:
-    Tokens parse(const String& formatString)
-    {
-        TokenHandler handler;
-        if (!DateTimeFormat::parse(formatString, handler))
-            return Tokens(Token("*failed*"));
-        return handler.tokens();
-    }
-
-    FieldType single(const char ch)
-    {
-        char formatString[2];
-        formatString[0] = ch;
-        formatString[1] = 0;
-        TokenHandler handler;
-        if (!DateTimeFormat::parse(formatString, handler))
-            return DateTimeFormat::FieldTypeInvalid;
-        return handler.fieldType(0);
-    }
-
-private:
-    class TokenHandler : public DateTimeFormat::TokenHandler {
-    public:
-        virtual ~TokenHandler() { }
-
-        FieldType fieldType(int index) const
-        {
-            return index >=0 && index < static_cast<int>(m_tokens.size()) ? m_tokens[index].fieldType : DateTimeFormat::FieldTypeInvalid;
-        }
-
-        Tokens tokens() const { return Tokens(m_tokens); }
-
-    private:
-        virtual void visitField(FieldType fieldType, int count) OVERRIDE
-        {
-            m_tokens.append(Token(fieldType, count));
-        }
-
-        virtual void visitLiteral(const String& string) OVERRIDE
-        {
-            m_tokens.append(Token(string));
-        }
-
-        Vector<Token> m_tokens;
-    };
-};
-
-std::ostream& operator<<(std::ostream& os, const DateTimeFormatTest::Tokens& tokens)
-{
-    return os << tokens.toString().ascii().data();
-}
-
-TEST_F(DateTimeFormatTest, CommonPattern)
-{
-    EXPECT_EQ(Tokens(), parse(""));
-
-    EXPECT_EQ(
-        Tokens(
-            Token(DateTimeFormat::FieldTypeYear, 4), Token("-"),
-            Token(DateTimeFormat::FieldTypeMonth, 2), Token("-"),
-            Token(DateTimeFormat::FieldTypeDayOfMonth, 2)),
-        parse("yyyy-MM-dd"));
-
-    EXPECT_EQ(
-        Tokens(
-            Token(DateTimeFormat::FieldTypeHour24, 2), Token(":"),
-            Token(DateTimeFormat::FieldTypeMinute, 2), Token(":"),
-            Token(DateTimeFormat::FieldTypeSecond, 2)),
-        parse("kk:mm:ss"));
-
-    EXPECT_EQ(
-        Tokens(
-            Token(DateTimeFormat::FieldTypeHour12), Token(":"),
-            Token(DateTimeFormat::FieldTypeMinute), Token(" "),
-            Token(DateTimeFormat::FieldTypePeriod)),
-        parse("h:m a"));
-
-    EXPECT_EQ(
-        Tokens(
-            Token(DateTimeFormat::FieldTypeYear), Token("Nen "),
-            Token(DateTimeFormat::FieldTypeMonth), Token("Getsu "),
-            Token(DateTimeFormat::FieldTypeDayOfMonth), Token("Nichi")),
-        parse("y'Nen' M'Getsu' d'Nichi'"));
-}
-
-TEST_F(DateTimeFormatTest, MissingClosingQuote)
-{
-    EXPECT_EQ(Tokens("*failed*"), parse("'foo"));
-    EXPECT_EQ(Tokens("*failed*"), parse("fo'o"));
-    EXPECT_EQ(Tokens("*failed*"), parse("foo'"));
-}
-
-TEST_F(DateTimeFormatTest, Quote)
-{
-    EXPECT_EQ(Tokens("FooBar"), parse("'FooBar'"));
-    EXPECT_EQ(Tokens("'"), parse("''"));
-    EXPECT_EQ(Tokens("'-'"), parse("''-''"));
-    EXPECT_EQ(Tokens("Foo'Bar"), parse("'Foo''Bar'"));
-    EXPECT_EQ(
-        Tokens(Token(DateTimeFormat::FieldTypeEra), Token("'s")),
-        parse("G'''s'"));
-    EXPECT_EQ(
-        Tokens(Token(DateTimeFormat::FieldTypeEra), Token("'"), Token(DateTimeFormat::FieldTypeSecond)),
-        parse("G''s"));
-}
-
-TEST_F(DateTimeFormatTest, SingleLowerCaseCharacter)
-{
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('b'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeLocalDayOfWeekStandAlon, single('c'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeDayOfMonth, single('d'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeLocalDayOfWeek, single('e'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeModifiedJulianDay, single('g'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeHour12, single('h'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeHour24, single('k'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeMinute, single('m'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeQuaterStandAlone, single('q'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeSecond, single('s'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeExtendedYear, single('u'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeNonLocationZone, single('v'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeWeekOfMonth, single('W'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeYear, single('y'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeZone, single('z'));
-}
-
-TEST_F(DateTimeFormatTest, SingleLowerCaseInvalid)
-{
-    EXPECT_EQ(DateTimeFormat::FieldTypePeriod, single('a'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('f'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('i'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('j'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('l'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('n'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('o'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('p'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('r'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('t'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('x'));
-}
-
-TEST_F(DateTimeFormatTest, SingleUpperCaseCharacter)
-{
-    EXPECT_EQ(DateTimeFormat::FieldTypeMillisecondsInDay, single('A'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeDayOfYear, single('D'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeDayOfWeek, single('E'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeDayOfWeekInMonth, single('F'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeEra, single('G'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeHour23, single('H'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeHour11, single('K'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeMonthStandAlone, single('L'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeMonth, single('M'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeQuater, single('Q'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeFractionalSecond, single('S'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeWeekOfYear, single('w'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeYearOfWeekOfYear, single('Y'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeRFC822Zone, single('Z'));
-}
-
-TEST_F(DateTimeFormatTest, SingleUpperCaseInvalid)
-{
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('B'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('C'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('I'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('J'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('N'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('O'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('P'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('R'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('T'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('U'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('V'));
-    EXPECT_EQ(DateTimeFormat::FieldTypeInvalid, single('X'));
-}
-
-#endif
diff --git a/Source/core/platform/text/DecodeEscapeSequences.h b/Source/core/platform/text/DecodeEscapeSequences.h
deleted file mode 100644
index 81b43e3..0000000
--- a/Source/core/platform/text/DecodeEscapeSequences.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All Rights Reserved.
- * 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.
- * 3. 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 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 DecodeEscapeSequences_h
-#define DecodeEscapeSequences_h
-
-#include "wtf/ASCIICType.h"
-#include "wtf/Assertions.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/TextEncoding.h"
-
-namespace WebCore {
-
-// See <http://en.wikipedia.org/wiki/Percent-encoding#Non-standard_implementations>.
-struct Unicode16BitEscapeSequence {
-    enum { sequenceSize = 6 }; // e.g. %u26C4
-    static size_t findInString(const String& string, size_t startPosition) { return string.find("%u", startPosition); }
-    static size_t findEndOfRun(const String& string, size_t startPosition, size_t endPosition)
-    {
-        size_t runEnd = startPosition;
-        while (endPosition - runEnd >= sequenceSize && string[runEnd] == '%' && string[runEnd + 1] == 'u'
-               && isASCIIHexDigit(string[runEnd + 2]) && isASCIIHexDigit(string[runEnd + 3])
-               && isASCIIHexDigit(string[runEnd + 4]) && isASCIIHexDigit(string[runEnd + 5])) {
-            runEnd += sequenceSize;
-        }
-        return runEnd;
-    }
-
-    template<typename CharType>
-    static String decodeRun(const CharType* run, size_t runLength, const WTF::TextEncoding&)
-    {
-        // Each %u-escape sequence represents a UTF-16 code unit.
-        // See <http://www.w3.org/International/iri-edit/draft-duerst-iri.html#anchor29>.
-        // For 16-bit escape sequences, we know that findEndOfRun() has given us a contiguous run of sequences
-        // without any intervening characters, so decode the run without additional checks.
-        size_t numberOfSequences = runLength / sequenceSize;
-        StringBuilder builder;
-        builder.reserveCapacity(numberOfSequences);
-        while (numberOfSequences--) {
-            UChar codeUnit = (toASCIIHexValue(run[2]) << 12) | (toASCIIHexValue(run[3]) << 8) | (toASCIIHexValue(run[4]) << 4) | toASCIIHexValue(run[5]);
-            builder.append(codeUnit);
-            run += sequenceSize;
-        }
-        return builder.toString();
-    }
-};
-
-struct URLEscapeSequence {
-    enum { sequenceSize = 3 }; // e.g. %41
-    static size_t findInString(const String& string, size_t startPosition) { return string.find('%', startPosition); }
-    static size_t findEndOfRun(const String& string, size_t startPosition, size_t endPosition)
-    {
-        // Make the simplifying assumption that supported encodings may have up to two unescaped characters
-        // in the range 0x40 - 0x7F as the trailing bytes of their sequences which need to be passed into the
-        // decoder as part of the run. In other words, we end the run at the first value outside of the
-        // 0x40 - 0x7F range, after two values in this range, or at a %-sign that does not introduce a valid
-        // escape sequence.
-        size_t runEnd = startPosition;
-        int numberOfTrailingCharacters = 0;
-        while (runEnd < endPosition) {
-            if (string[runEnd] == '%') {
-                if (endPosition - runEnd >= sequenceSize && isASCIIHexDigit(string[runEnd + 1]) && isASCIIHexDigit(string[runEnd + 2])) {
-                    runEnd += sequenceSize;
-                    numberOfTrailingCharacters = 0;
-                } else
-                    break;
-            } else if (string[runEnd] >= 0x40 && string[runEnd] <= 0x7F && numberOfTrailingCharacters < 2) {
-                runEnd += 1;
-                numberOfTrailingCharacters += 1;
-            } else
-                break;
-        }
-        return runEnd;
-    }
-
-    template<typename CharType>
-    static String decodeRun(const CharType* run, size_t runLength, const WTF::TextEncoding& encoding)
-    {
-        // For URL escape sequences, we know that findEndOfRun() has given us a run where every %-sign introduces
-        // a valid escape sequence, but there may be characters between the sequences.
-        Vector<char, 512> buffer;
-        buffer.resize(runLength); // Unescaping hex sequences only makes the length smaller.
-        char* p = buffer.data();
-        const CharType* runEnd = run + runLength;
-        while (run < runEnd) {
-            if (run[0] == '%') {
-                *p++ = (toASCIIHexValue(run[1]) << 4) | toASCIIHexValue(run[2]);
-                run += sequenceSize;
-            } else {
-                *p++ = run[0];
-                run += 1;
-            }
-        }
-        ASSERT(buffer.size() >= static_cast<size_t>(p - buffer.data())); // Prove buffer not overrun.
-        return (encoding.isValid() ? encoding : UTF8Encoding()).decode(buffer.data(), p - buffer.data());
-    }
-};
-
-template<typename EscapeSequence>
-String decodeEscapeSequences(const String& string, const WTF::TextEncoding& encoding)
-{
-    StringBuilder result;
-    size_t length = string.length();
-    size_t decodedPosition = 0;
-    size_t searchPosition = 0;
-    size_t encodedRunPosition;
-    while ((encodedRunPosition = EscapeSequence::findInString(string, searchPosition)) != kNotFound) {
-        size_t encodedRunEnd = EscapeSequence::findEndOfRun(string, encodedRunPosition, length);
-        searchPosition = encodedRunEnd;
-        if (encodedRunEnd == encodedRunPosition) {
-            ++searchPosition;
-            continue;
-        }
-
-        String decoded = string.is8Bit() ?
-            EscapeSequence::decodeRun(string.characters8() + encodedRunPosition, encodedRunEnd - encodedRunPosition, encoding) :
-            EscapeSequence::decodeRun(string.characters16() + encodedRunPosition, encodedRunEnd - encodedRunPosition, encoding);
-
-        if (decoded.isEmpty())
-            continue;
-
-        result.append(string, decodedPosition, encodedRunPosition - decodedPosition);
-        result.append(decoded);
-        decodedPosition = encodedRunEnd;
-    }
-    result.append(string, decodedPosition, length - decodedPosition);
-    return result.toString();
-}
-
-} // namespace WebCore
-
-#endif // DecodeEscapeSequences_h
diff --git a/Source/core/platform/text/LineBreakIteratorPoolICU.h b/Source/core/platform/text/LineBreakIteratorPoolICU.h
deleted file mode 100644
index b7a0f0b..0000000
--- a/Source/core/platform/text/LineBreakIteratorPoolICU.h
+++ /dev/null
@@ -1,111 +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 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 LineBreakIteratorPoolICU_h
-#define LineBreakIteratorPoolICU_h
-
-#include <unicode/ubrk.h>
-#include "core/platform/text/TextBreakIteratorInternalICU.h"
-#include "wtf/Assertions.h"
-#include "wtf/HashMap.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/CString.h"
-#include "wtf/ThreadSpecific.h"
-
-namespace WebCore {
-
-class LineBreakIteratorPool {
-    WTF_MAKE_NONCOPYABLE(LineBreakIteratorPool);
-public:
-    static LineBreakIteratorPool& sharedPool()
-    {
-        static WTF::ThreadSpecific<LineBreakIteratorPool>* pool = new WTF::ThreadSpecific<LineBreakIteratorPool>;
-        return **pool;
-    }
-
-    static PassOwnPtr<LineBreakIteratorPool> create() { return adoptPtr(new LineBreakIteratorPool); }
-
-    UBreakIterator* take(const AtomicString& locale)
-    {
-        UBreakIterator* iterator = 0;
-        for (size_t i = 0; i < m_pool.size(); ++i) {
-            if (m_pool[i].first == locale) {
-                iterator = m_pool[i].second;
-                m_pool.remove(i);
-                break;
-            }
-        }
-
-        if (!iterator) {
-            UErrorCode openStatus = U_ZERO_ERROR;
-            bool localeIsEmpty = locale.isEmpty();
-            iterator = ubrk_open(UBRK_LINE, localeIsEmpty ? currentTextBreakLocaleID() : locale.string().utf8().data(), 0, 0, &openStatus);
-            // locale comes from a web page and it can be invalid, leading ICU
-            // to fail, in which case we fall back to the default locale.
-            if (!localeIsEmpty && U_FAILURE(openStatus)) {
-                openStatus = U_ZERO_ERROR;
-                iterator = ubrk_open(UBRK_LINE, currentTextBreakLocaleID(), 0, 0, &openStatus);
-            }
-
-            if (U_FAILURE(openStatus)) {
-                LOG_ERROR("ubrk_open failed with status %d", openStatus);
-                return 0;
-            }
-        }
-
-        ASSERT(!m_vendedIterators.contains(iterator));
-        m_vendedIterators.set(iterator, locale);
-        return iterator;
-    }
-
-    void put(UBreakIterator* iterator)
-    {
-        ASSERT_ARG(iterator, m_vendedIterators.contains(iterator));
-
-        if (m_pool.size() == capacity) {
-            ubrk_close(m_pool[0].second);
-            m_pool.remove(0);
-        }
-
-        m_pool.append(Entry(m_vendedIterators.take(iterator), iterator));
-    }
-
-private:
-    LineBreakIteratorPool() { }
-
-    static const size_t capacity = 4;
-
-    typedef pair<AtomicString, UBreakIterator*> Entry;
-    typedef Vector<Entry, capacity> Pool;
-    Pool m_pool;
-    HashMap<UBreakIterator*, AtomicString> m_vendedIterators;
-
-    friend WTF::ThreadSpecific<LineBreakIteratorPool>::operator LineBreakIteratorPool*();
-};
-
-}
-
-#endif
diff --git a/Source/core/platform/text/LineEnding.cpp b/Source/core/platform/text/LineEnding.cpp
deleted file mode 100644
index 53d8be3..0000000
--- a/Source/core/platform/text/LineEnding.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
- * 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/text/LineEnding.h"
-
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
-
-namespace {
-
-class OutputBuffer {
-public:
-    virtual char* allocate(size_t size) = 0;
-    virtual void copy(const CString&) = 0;
-    virtual ~OutputBuffer() { }
-};
-
-class CStringBuffer : public OutputBuffer {
-public:
-    CStringBuffer(CString& buffer)
-        : m_buffer(buffer)
-    {
-    }
-    virtual ~CStringBuffer() { }
-
-    virtual char* allocate(size_t size)
-    {
-        char* ptr;
-        m_buffer = CString::newUninitialized(size, ptr);
-        return ptr;
-    }
-
-    virtual void copy(const CString& source)
-    {
-        m_buffer = source;
-    }
-
-    const CString& buffer() const { return m_buffer; }
-
-private:
-    CString m_buffer;
-};
-
-class VectorCharAppendBuffer : public OutputBuffer {
-public:
-    VectorCharAppendBuffer(Vector<char>& buffer)
-        : m_buffer(buffer)
-    {
-    }
-    virtual ~VectorCharAppendBuffer() { }
-
-    virtual char* allocate(size_t size)
-    {
-        size_t oldSize = m_buffer.size();
-        m_buffer.grow(oldSize + size);
-        return m_buffer.data() + oldSize;
-    }
-
-    virtual void copy(const CString& source)
-    {
-        m_buffer.append(source.data(), source.length());
-    }
-
-private:
-    Vector<char>& m_buffer;
-};
-
-void internalNormalizeLineEndingsToCRLF(const CString& from, OutputBuffer& buffer)
-{
-    // Compute the new length.
-    size_t newLen = 0;
-    const char* p = from.data();
-    while (char c = *p++) {
-        if (c == '\r') {
-            // Safe to look ahead because of trailing '\0'.
-            if (*p != '\n') {
-                // Turn CR into CRLF.
-                newLen += 2;
-            }
-        } else if (c == '\n') {
-            // Turn LF into CRLF.
-            newLen += 2;
-        } else {
-            // Leave other characters alone.
-            newLen += 1;
-        }
-    }
-    if (newLen < from.length())
-        return;
-
-    if (newLen == from.length()) {
-        buffer.copy(from);
-        return;
-    }
-
-    p = from.data();
-    char* q = buffer.allocate(newLen);
-
-    // Make a copy of the string.
-    while (char c = *p++) {
-        if (c == '\r') {
-            // Safe to look ahead because of trailing '\0'.
-            if (*p != '\n') {
-                // Turn CR into CRLF.
-                *q++ = '\r';
-                *q++ = '\n';
-            }
-        } else if (c == '\n') {
-            // Turn LF into CRLF.
-            *q++ = '\r';
-            *q++ = '\n';
-        } else {
-            // Leave other characters alone.
-            *q++ = c;
-        }
-    }
-}
-
-};
-
-namespace WebCore {
-
-void normalizeToCROrLF(const CString& from, Vector<char>& result, bool toCR);
-
-// Normalize all line-endings to CR or LF.
-void normalizeToCROrLF(const CString& from, Vector<char>& result, bool toCR)
-{
-    // Compute the new length.
-    size_t newLen = 0;
-    bool needFix = false;
-    const char* p = from.data();
-    char fromEndingChar = toCR ? '\n' : '\r';
-    char toEndingChar = toCR ? '\r' : '\n';
-    while (char c = *p++) {
-        if (c == '\r' && *p == '\n') {
-            // Turn CRLF into CR or LF.
-            p++;
-            needFix = true;
-        } else if (c == fromEndingChar) {
-            // Turn CR/LF into LF/CR.
-            needFix = true;
-        }
-        newLen += 1;
-    }
-
-    // Grow the result buffer.
-    p = from.data();
-    size_t oldResultSize = result.size();
-    result.grow(oldResultSize + newLen);
-    char* q = result.data() + oldResultSize;
-
-    // If no need to fix the string, just copy the string over.
-    if (!needFix) {
-        memcpy(q, p, from.length());
-        return;
-    }
-
-    // Make a copy of the string.
-    while (char c = *p++) {
-        if (c == '\r' && *p == '\n') {
-            // Turn CRLF or CR into CR or LF.
-            p++;
-            *q++ = toEndingChar;
-        } else if (c == fromEndingChar) {
-            // Turn CR/LF into LF/CR.
-            *q++ = toEndingChar;
-        } else {
-            // Leave other characters alone.
-            *q++ = c;
-        }
-    }
-}
-
-CString normalizeLineEndingsToCRLF(const CString& from)
-{
-    CString result;
-    CStringBuffer buffer(result);
-    internalNormalizeLineEndingsToCRLF(from, buffer);
-    return buffer.buffer();
-}
-
-void normalizeLineEndingsToCR(const CString& from, Vector<char>& result)
-{
-    normalizeToCROrLF(from, result, true);
-}
-
-void normalizeLineEndingsToLF(const CString& from, Vector<char>& result)
-{
-    normalizeToCROrLF(from, result, false);
-}
-
-void normalizeLineEndingsToNative(const CString& from, Vector<char>& result)
-{
-#if OS(WIN)
-    VectorCharAppendBuffer buffer(result);
-    internalNormalizeLineEndingsToCRLF(from, buffer);
-#else
-    normalizeLineEndingsToLF(from, result);
-#endif
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/text/LineEnding.h b/Source/core/platform/text/LineEnding.h
deleted file mode 100644
index e49912d..0000000
--- a/Source/core/platform/text/LineEnding.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
- * 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 LineEnding_h
-#define LineEnding_h
-
-#include "wtf/Forward.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-// Normalize all line-endings in the given string to CRLF.
-CString normalizeLineEndingsToCRLF(const CString& from);
-
-// Normalize all line-endings in the given string to CR and append the result to the given buffer.
-void normalizeLineEndingsToCR(const CString& from, Vector<char>& result);
-
-// Normalize all line-endings in the given string to LF and append the result to the given buffer.
-void normalizeLineEndingsToLF(const CString& from, Vector<char>& result);
-
-// Normalize all line-endings in the given string to the native line-endings and append the result to the given buffer.
-// (Normalize to CRLF on Windows and normalize to LF on all other platforms.)
-void normalizeLineEndingsToNative(const CString& from, Vector<char>& result);
-
-} // namespace WebCore
-
-#endif // LineEnding_h
diff --git a/Source/core/platform/text/LocaleICU.cpp b/Source/core/platform/text/LocaleICU.cpp
deleted file mode 100644
index 7b5efcd..0000000
--- a/Source/core/platform/text/LocaleICU.cpp
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright (C) 2011,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:
- *
- *     * 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/text/LocaleICU.h"
-
-#include <unicode/udatpg.h>
-#include <unicode/uloc.h>
-#include <limits>
-#include "wtf/DateMath.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/text/StringBuffer.h"
-#include "wtf/text/StringBuilder.h"
-
-using namespace icu;
-using namespace std;
-
-namespace WebCore {
-
-PassOwnPtr<Locale> Locale::create(const AtomicString& locale)
-{
-    return LocaleICU::create(locale.string().utf8().data());
-}
-
-LocaleICU::LocaleICU(const char* locale)
-    : m_locale(locale)
-    , m_numberFormat(0)
-    , m_shortDateFormat(0)
-    , m_didCreateDecimalFormat(false)
-    , m_didCreateShortDateFormat(false)
-#if ENABLE(CALENDAR_PICKER)
-    , m_firstDayOfWeek(0)
-#endif
-    , m_mediumTimeFormat(0)
-    , m_shortTimeFormat(0)
-    , m_didCreateTimeFormat(false)
-{
-}
-
-LocaleICU::~LocaleICU()
-{
-    unum_close(m_numberFormat);
-    udat_close(m_shortDateFormat);
-    udat_close(m_mediumTimeFormat);
-    udat_close(m_shortTimeFormat);
-}
-
-PassOwnPtr<LocaleICU> LocaleICU::create(const char* localeString)
-{
-    return adoptPtr(new LocaleICU(localeString));
-}
-
-String LocaleICU::decimalSymbol(UNumberFormatSymbol symbol)
-{
-    UErrorCode status = U_ZERO_ERROR;
-    int32_t bufferLength = unum_getSymbol(m_numberFormat, symbol, 0, 0, &status);
-    ASSERT(U_SUCCESS(status) || status == U_BUFFER_OVERFLOW_ERROR);
-    if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR)
-        return String();
-    StringBuffer<UChar> buffer(bufferLength);
-    status = U_ZERO_ERROR;
-    unum_getSymbol(m_numberFormat, symbol, buffer.characters(), bufferLength, &status);
-    if (U_FAILURE(status))
-        return String();
-    return String::adopt(buffer);
-}
-
-String LocaleICU::decimalTextAttribute(UNumberFormatTextAttribute tag)
-{
-    UErrorCode status = U_ZERO_ERROR;
-    int32_t bufferLength = unum_getTextAttribute(m_numberFormat, tag, 0, 0, &status);
-    ASSERT(U_SUCCESS(status) || status == U_BUFFER_OVERFLOW_ERROR);
-    if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR)
-        return String();
-    StringBuffer<UChar> buffer(bufferLength);
-    status = U_ZERO_ERROR;
-    unum_getTextAttribute(m_numberFormat, tag, buffer.characters(), bufferLength, &status);
-    ASSERT(U_SUCCESS(status));
-    if (U_FAILURE(status))
-        return String();
-    return String::adopt(buffer);
-}
-
-void LocaleICU::initializeLocaleData()
-{
-    if (m_didCreateDecimalFormat)
-        return;
-    m_didCreateDecimalFormat = true;
-    UErrorCode status = U_ZERO_ERROR;
-    m_numberFormat = unum_open(UNUM_DECIMAL, 0, 0, m_locale.data(), 0, &status);
-    if (!U_SUCCESS(status))
-        return;
-
-    Vector<String, DecimalSymbolsSize> symbols;
-    symbols.append(decimalSymbol(UNUM_ZERO_DIGIT_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_ONE_DIGIT_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_TWO_DIGIT_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_THREE_DIGIT_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_FOUR_DIGIT_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_FIVE_DIGIT_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_SIX_DIGIT_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_SEVEN_DIGIT_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_EIGHT_DIGIT_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_NINE_DIGIT_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_DECIMAL_SEPARATOR_SYMBOL));
-    symbols.append(decimalSymbol(UNUM_GROUPING_SEPARATOR_SYMBOL));
-    ASSERT(symbols.size() == DecimalSymbolsSize);
-    setLocaleData(symbols, decimalTextAttribute(UNUM_POSITIVE_PREFIX), decimalTextAttribute(UNUM_POSITIVE_SUFFIX), decimalTextAttribute(UNUM_NEGATIVE_PREFIX), decimalTextAttribute(UNUM_NEGATIVE_SUFFIX));
-}
-
-bool LocaleICU::initializeShortDateFormat()
-{
-    if (m_didCreateShortDateFormat)
-        return m_shortDateFormat;
-    m_shortDateFormat = openDateFormat(UDAT_NONE, UDAT_SHORT);
-    m_didCreateShortDateFormat = true;
-    return m_shortDateFormat;
-}
-
-UDateFormat* LocaleICU::openDateFormat(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle) const
-{
-    const UChar gmtTimezone[3] = {'G', 'M', 'T'};
-    UErrorCode status = U_ZERO_ERROR;
-    return udat_open(timeStyle, dateStyle, m_locale.data(), gmtTimezone, WTF_ARRAY_LENGTH(gmtTimezone), 0, -1, &status);
-}
-
-static String getDateFormatPattern(const UDateFormat* dateFormat)
-{
-    if (!dateFormat)
-        return emptyString();
-
-    UErrorCode status = U_ZERO_ERROR;
-    int32_t length = udat_toPattern(dateFormat, TRUE, 0, 0, &status);
-    if (status != U_BUFFER_OVERFLOW_ERROR || !length)
-        return emptyString();
-    StringBuffer<UChar> buffer(length);
-    status = U_ZERO_ERROR;
-    udat_toPattern(dateFormat, TRUE, buffer.characters(), length, &status);
-    if (U_FAILURE(status))
-        return emptyString();
-    return String::adopt(buffer);
-}
-
-PassOwnPtr<Vector<String> > LocaleICU::createLabelVector(const UDateFormat* dateFormat, UDateFormatSymbolType type, int32_t startIndex, int32_t size)
-{
-    if (!dateFormat)
-        return PassOwnPtr<Vector<String> >();
-    if (udat_countSymbols(dateFormat, type) != startIndex + size)
-        return PassOwnPtr<Vector<String> >();
-
-    OwnPtr<Vector<String> > labels = adoptPtr(new Vector<String>());
-    labels->reserveCapacity(size);
-    for (int32_t i = 0; i < size; ++i) {
-        UErrorCode status = U_ZERO_ERROR;
-        int32_t length = udat_getSymbols(dateFormat, type, startIndex + i, 0, 0, &status);
-        if (status != U_BUFFER_OVERFLOW_ERROR)
-            return PassOwnPtr<Vector<String> >();
-        StringBuffer<UChar> buffer(length);
-        status = U_ZERO_ERROR;
-        udat_getSymbols(dateFormat, type, startIndex + i, buffer.characters(), length, &status);
-        if (U_FAILURE(status))
-            return PassOwnPtr<Vector<String> >();
-        labels->append(String::adopt(buffer));
-    }
-    return labels.release();
-}
-
-#if ENABLE(CALENDAR_PICKER)
-static PassOwnPtr<Vector<String> > createFallbackWeekDayShortLabels()
-{
-    OwnPtr<Vector<String> > labels = adoptPtr(new Vector<String>());
-    labels->reserveCapacity(7);
-    labels->append("Sun");
-    labels->append("Mon");
-    labels->append("Tue");
-    labels->append("Wed");
-    labels->append("Thu");
-    labels->append("Fri");
-    labels->append("Sat");
-    return labels.release();
-}
-
-void LocaleICU::initializeCalendar()
-{
-    if (m_weekDayShortLabels)
-        return;
-
-    if (!initializeShortDateFormat()) {
-        m_firstDayOfWeek = 0;
-        m_weekDayShortLabels = createFallbackWeekDayShortLabels();
-        return;
-    }
-    m_firstDayOfWeek = ucal_getAttribute(udat_getCalendar(m_shortDateFormat), UCAL_FIRST_DAY_OF_WEEK) - UCAL_SUNDAY;
-
-    m_weekDayShortLabels = createLabelVector(m_shortDateFormat, UDAT_SHORT_WEEKDAYS, UCAL_SUNDAY, 7);
-    if (!m_weekDayShortLabels)
-        m_weekDayShortLabels = createFallbackWeekDayShortLabels();
-}
-#endif
-
-static PassOwnPtr<Vector<String> > createFallbackMonthLabels()
-{
-    OwnPtr<Vector<String> > labels = adoptPtr(new Vector<String>());
-    labels->reserveCapacity(WTF_ARRAY_LENGTH(WTF::monthFullName));
-    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthFullName); ++i)
-        labels->append(WTF::monthFullName[i]);
-    return labels.release();
-}
-
-const Vector<String>& LocaleICU::monthLabels()
-{
-    if (m_monthLabels)
-        return *m_monthLabels;
-    if (initializeShortDateFormat()) {
-        m_monthLabels = createLabelVector(m_shortDateFormat, UDAT_MONTHS, UCAL_JANUARY, 12);
-        if (m_monthLabels)
-            return *m_monthLabels;
-    }
-    m_monthLabels = createFallbackMonthLabels();
-    return *m_monthLabels;
-}
-
-#if ENABLE(CALENDAR_PICKER)
-const Vector<String>& LocaleICU::weekDayShortLabels()
-{
-    initializeCalendar();
-    return *m_weekDayShortLabels;
-}
-
-unsigned LocaleICU::firstDayOfWeek()
-{
-    initializeCalendar();
-    return m_firstDayOfWeek;
-}
-
-bool LocaleICU::isRTL()
-{
-    UErrorCode status = U_ZERO_ERROR;
-    return uloc_getCharacterOrientation(m_locale.data(), &status) == ULOC_LAYOUT_RTL;
-}
-#endif
-
-static PassOwnPtr<Vector<String> > createFallbackAMPMLabels()
-{
-    OwnPtr<Vector<String> > labels = adoptPtr(new Vector<String>());
-    labels->reserveCapacity(2);
-    labels->append("AM");
-    labels->append("PM");
-    return labels.release();
-}
-
-void LocaleICU::initializeDateTimeFormat()
-{
-    if (m_didCreateTimeFormat)
-        return;
-
-    // We assume ICU medium time pattern and short time pattern are compatible
-    // with LDML, because ICU specific pattern character "V" doesn't appear
-    // in both medium and short time pattern.
-    m_mediumTimeFormat = openDateFormat(UDAT_MEDIUM, UDAT_NONE);
-    m_timeFormatWithSeconds = getDateFormatPattern(m_mediumTimeFormat);
-
-    m_shortTimeFormat = openDateFormat(UDAT_SHORT, UDAT_NONE);
-    m_timeFormatWithoutSeconds = getDateFormatPattern(m_shortTimeFormat);
-
-    UDateFormat* dateTimeFormatWithSeconds = openDateFormat(UDAT_MEDIUM, UDAT_SHORT);
-    m_dateTimeFormatWithSeconds = getDateFormatPattern(dateTimeFormatWithSeconds);
-    udat_close(dateTimeFormatWithSeconds);
-
-    UDateFormat* dateTimeFormatWithoutSeconds = openDateFormat(UDAT_SHORT, UDAT_SHORT);
-    m_dateTimeFormatWithoutSeconds = getDateFormatPattern(dateTimeFormatWithoutSeconds);
-    udat_close(dateTimeFormatWithoutSeconds);
-
-    OwnPtr<Vector<String> > timeAMPMLabels = createLabelVector(m_mediumTimeFormat, UDAT_AM_PMS, UCAL_AM, 2);
-    if (!timeAMPMLabels)
-        timeAMPMLabels = createFallbackAMPMLabels();
-    m_timeAMPMLabels = *timeAMPMLabels;
-
-    m_didCreateTimeFormat = true;
-}
-
-String LocaleICU::dateFormat()
-{
-    if (!m_dateFormat.isNull())
-        return m_dateFormat;
-    if (!initializeShortDateFormat())
-        return "yyyy-MM-dd";
-    m_dateFormat = getDateFormatPattern(m_shortDateFormat);
-    return m_dateFormat;
-}
-
-static String getFormatForSkeleton(const char* locale, const String& skeleton)
-{
-    String format = "yyyy-MM";
-    UErrorCode status = U_ZERO_ERROR;
-    UDateTimePatternGenerator* patternGenerator = udatpg_open(locale, &status);
-    if (!patternGenerator)
-        return format;
-    status = U_ZERO_ERROR;
-    Vector<UChar> skeletonCharacters;
-    skeleton.appendTo(skeletonCharacters);
-    int32_t length = udatpg_getBestPattern(patternGenerator, skeletonCharacters.data(), skeletonCharacters.size(), 0, 0, &status);
-    if (status == U_BUFFER_OVERFLOW_ERROR && length) {
-        StringBuffer<UChar> buffer(length);
-        status = U_ZERO_ERROR;
-        udatpg_getBestPattern(patternGenerator, skeletonCharacters.data(), skeletonCharacters.size(), buffer.characters(), length, &status);
-        if (U_SUCCESS(status))
-            format = String::adopt(buffer);
-    }
-    udatpg_close(patternGenerator);
-    return format;
-}
-
-String LocaleICU::monthFormat()
-{
-    if (!m_monthFormat.isNull())
-        return m_monthFormat;
-    // Gets a format for "MMMM" because Windows API always provides formats for
-    // "MMMM" in some locales.
-    m_monthFormat = getFormatForSkeleton(m_locale.data(), "yyyyMMMM");
-    return m_monthFormat;
-}
-
-String LocaleICU::shortMonthFormat()
-{
-    if (!m_shortMonthFormat.isNull())
-        return m_shortMonthFormat;
-    m_shortMonthFormat = getFormatForSkeleton(m_locale.data(), "yyyyMMM");
-    return m_shortMonthFormat;
-}
-
-String LocaleICU::timeFormat()
-{
-    initializeDateTimeFormat();
-    return m_timeFormatWithSeconds;
-}
-
-String LocaleICU::shortTimeFormat()
-{
-    initializeDateTimeFormat();
-    return m_timeFormatWithoutSeconds;
-}
-
-String LocaleICU::dateTimeFormatWithSeconds()
-{
-    initializeDateTimeFormat();
-    return m_dateTimeFormatWithSeconds;
-}
-
-String LocaleICU::dateTimeFormatWithoutSeconds()
-{
-    initializeDateTimeFormat();
-    return m_dateTimeFormatWithoutSeconds;
-}
-
-const Vector<String>& LocaleICU::shortMonthLabels()
-{
-    if (!m_shortMonthLabels.isEmpty())
-        return m_shortMonthLabels;
-    if (initializeShortDateFormat()) {
-        if (OwnPtr<Vector<String> > labels = createLabelVector(m_shortDateFormat, UDAT_SHORT_MONTHS, UCAL_JANUARY, 12)) {
-            m_shortMonthLabels = *labels;
-            return m_shortMonthLabels;
-        }
-    }
-    m_shortMonthLabels.reserveCapacity(WTF_ARRAY_LENGTH(WTF::monthName));
-    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthName); ++i)
-        m_shortMonthLabels.append(WTF::monthName[i]);
-    return m_shortMonthLabels;
-}
-
-const Vector<String>& LocaleICU::standAloneMonthLabels()
-{
-    if (!m_standAloneMonthLabels.isEmpty())
-        return m_standAloneMonthLabels;
-    if (initializeShortDateFormat()) {
-        if (OwnPtr<Vector<String> > labels = createLabelVector(m_shortDateFormat, UDAT_STANDALONE_MONTHS, UCAL_JANUARY, 12)) {
-            m_standAloneMonthLabels = *labels;
-            return m_standAloneMonthLabels;
-        }
-    }
-    m_standAloneMonthLabels = monthLabels();
-    return m_standAloneMonthLabels;
-}
-
-const Vector<String>& LocaleICU::shortStandAloneMonthLabels()
-{
-    if (!m_shortStandAloneMonthLabels.isEmpty())
-        return m_shortStandAloneMonthLabels;
-    if (initializeShortDateFormat()) {
-        if (OwnPtr<Vector<String> > labels = createLabelVector(m_shortDateFormat, UDAT_STANDALONE_SHORT_MONTHS, UCAL_JANUARY, 12)) {
-            m_shortStandAloneMonthLabels = *labels;
-            return m_shortStandAloneMonthLabels;
-        }
-    }
-    m_shortStandAloneMonthLabels = shortMonthLabels();
-    return m_shortStandAloneMonthLabels;
-}
-
-const Vector<String>& LocaleICU::timeAMPMLabels()
-{
-    initializeDateTimeFormat();
-    return m_timeAMPMLabels;
-}
-
-} // namespace WebCore
-
diff --git a/Source/core/platform/text/LocaleICU.h b/Source/core/platform/text/LocaleICU.h
deleted file mode 100644
index 772992c..0000000
--- a/Source/core/platform/text/LocaleICU.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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:
- *
- *     * 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 LocaleICU_h
-#define LocaleICU_h
-
-#include <unicode/udat.h>
-#include <unicode/unum.h>
-#include "core/platform/DateComponents.h"
-#include "core/platform/text/PlatformLocale.h"
-#include "wtf/Forward.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-// We should use this class only for LocalizedNumberICU.cpp, LocalizedDateICU.cpp,
-// and LocalizedNumberICUTest.cpp.
-class LocaleICU : public Locale {
-public:
-    static PassOwnPtr<LocaleICU> create(const char* localeString);
-    virtual ~LocaleICU();
-
-#if ENABLE(CALENDAR_PICKER)
-    virtual const Vector<String>& weekDayShortLabels() OVERRIDE;
-    virtual unsigned firstDayOfWeek() OVERRIDE;
-    virtual bool isRTL() OVERRIDE;
-#endif
-    virtual String dateFormat() OVERRIDE;
-    virtual String monthFormat() OVERRIDE;
-    virtual String shortMonthFormat() OVERRIDE;
-    virtual String timeFormat() OVERRIDE;
-    virtual String shortTimeFormat() OVERRIDE;
-    virtual String dateTimeFormatWithSeconds() OVERRIDE;
-    virtual String dateTimeFormatWithoutSeconds() OVERRIDE;
-    virtual const Vector<String>& monthLabels() OVERRIDE;
-    virtual const Vector<String>& shortMonthLabels() OVERRIDE;
-    virtual const Vector<String>& standAloneMonthLabels() OVERRIDE;
-    virtual const Vector<String>& shortStandAloneMonthLabels() OVERRIDE;
-    virtual const Vector<String>& timeAMPMLabels() OVERRIDE;
-
-private:
-    explicit LocaleICU(const char*);
-    String decimalSymbol(UNumberFormatSymbol);
-    String decimalTextAttribute(UNumberFormatTextAttribute);
-    virtual void initializeLocaleData() OVERRIDE;
-
-    bool detectSignAndGetDigitRange(const String& input, bool& isNegative, unsigned& startIndex, unsigned& endIndex);
-    unsigned matchedDecimalSymbolIndex(const String& input, unsigned& position);
-
-    bool initializeShortDateFormat();
-    UDateFormat* openDateFormat(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle) const;
-
-#if ENABLE(CALENDAR_PICKER)
-    void initializeCalendar();
-#endif
-
-    PassOwnPtr<Vector<String> > createLabelVector(const UDateFormat*, UDateFormatSymbolType, int32_t startIndex, int32_t size);
-    void initializeDateTimeFormat();
-
-    CString m_locale;
-    UNumberFormat* m_numberFormat;
-    UDateFormat* m_shortDateFormat;
-    bool m_didCreateDecimalFormat;
-    bool m_didCreateShortDateFormat;
-
-#if ENABLE(CALENDAR_PICKER)
-    OwnPtr<Vector<String> > m_weekDayShortLabels;
-    unsigned m_firstDayOfWeek;
-#endif
-    OwnPtr<Vector<String> > m_monthLabels;
-    String m_dateFormat;
-    String m_monthFormat;
-    String m_shortMonthFormat;
-    String m_timeFormatWithSeconds;
-    String m_timeFormatWithoutSeconds;
-    String m_dateTimeFormatWithSeconds;
-    String m_dateTimeFormatWithoutSeconds;
-    UDateFormat* m_mediumTimeFormat;
-    UDateFormat* m_shortTimeFormat;
-    Vector<String> m_shortMonthLabels;
-    Vector<String> m_standAloneMonthLabels;
-    Vector<String> m_shortStandAloneMonthLabels;
-    Vector<String> m_timeAMPMLabels;
-    bool m_didCreateTimeFormat;
-};
-
-} // namespace WebCore
-#endif
diff --git a/Source/core/platform/text/LocaleToScriptMapping.h b/Source/core/platform/text/LocaleToScriptMapping.h
deleted file mode 100644
index 2d270ec..0000000
--- a/Source/core/platform/text/LocaleToScriptMapping.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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 LocaleToScriptMapping_h
-#define LocaleToScriptMapping_h
-
-#include "wtf/Forward.h"
-#include "wtf/unicode/Unicode.h"
-
-namespace WebCore {
-
-UScriptCode localeToScriptCodeForFontSelection(const String&);
-UScriptCode scriptNameToCode(const String&);
-
-}
-
-#endif
diff --git a/Source/core/platform/text/LocaleToScriptMappingDefault.cpp b/Source/core/platform/text/LocaleToScriptMappingDefault.cpp
deleted file mode 100644
index 197d87a..0000000
--- a/Source/core/platform/text/LocaleToScriptMappingDefault.cpp
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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/text/LocaleToScriptMapping.h"
-
-#include "wtf/HashMap.h"
-#include "wtf/HashSet.h"
-#include "wtf/text/StringHash.h"
-
-namespace WebCore {
-
-UScriptCode scriptNameToCode(const String& scriptName)
-{
-    struct ScriptNameCode {
-        const char* name;
-        UScriptCode code;
-    };
-
-    // This generally maps an ISO 15924 script code to its UScriptCode, but certain families of script codes are
-    // treated as a single script for assigning a per-script font in Settings. For example, "hira" is mapped to
-    // USCRIPT_KATAKANA_OR_HIRAGANA instead of USCRIPT_HIRAGANA, since we want all Japanese scripts to be rendered
-    // using the same font setting.
-    static const ScriptNameCode scriptNameCodeList[] = {
-        { "zyyy", USCRIPT_COMMON },
-        { "qaai", USCRIPT_INHERITED },
-        { "arab", USCRIPT_ARABIC },
-        { "armn", USCRIPT_ARMENIAN },
-        { "beng", USCRIPT_BENGALI },
-        { "bopo", USCRIPT_BOPOMOFO },
-        { "cher", USCRIPT_CHEROKEE },
-        { "copt", USCRIPT_COPTIC },
-        { "cyrl", USCRIPT_CYRILLIC },
-        { "dsrt", USCRIPT_DESERET },
-        { "deva", USCRIPT_DEVANAGARI },
-        { "ethi", USCRIPT_ETHIOPIC },
-        { "geor", USCRIPT_GEORGIAN },
-        { "goth", USCRIPT_GOTHIC },
-        { "grek", USCRIPT_GREEK },
-        { "gujr", USCRIPT_GUJARATI },
-        { "guru", USCRIPT_GURMUKHI },
-        { "hani", USCRIPT_HAN },
-        { "hang", USCRIPT_HANGUL },
-        { "hebr", USCRIPT_HEBREW },
-        { "hira", USCRIPT_KATAKANA_OR_HIRAGANA },
-        { "knda", USCRIPT_KANNADA },
-        { "kana", USCRIPT_KATAKANA_OR_HIRAGANA },
-        { "khmr", USCRIPT_KHMER },
-        { "laoo", USCRIPT_LAO },
-        { "latn", USCRIPT_LATIN },
-        { "mlym", USCRIPT_MALAYALAM },
-        { "mong", USCRIPT_MONGOLIAN },
-        { "mymr", USCRIPT_MYANMAR },
-        { "ogam", USCRIPT_OGHAM },
-        { "ital", USCRIPT_OLD_ITALIC },
-        { "orya", USCRIPT_ORIYA },
-        { "runr", USCRIPT_RUNIC },
-        { "sinh", USCRIPT_SINHALA },
-        { "syrc", USCRIPT_SYRIAC },
-        { "taml", USCRIPT_TAMIL },
-        { "telu", USCRIPT_TELUGU },
-        { "thaa", USCRIPT_THAANA },
-        { "thai", USCRIPT_THAI },
-        { "tibt", USCRIPT_TIBETAN },
-        { "cans", USCRIPT_CANADIAN_ABORIGINAL },
-        { "yiii", USCRIPT_YI },
-        { "tglg", USCRIPT_TAGALOG },
-        { "hano", USCRIPT_HANUNOO },
-        { "buhd", USCRIPT_BUHID },
-        { "tagb", USCRIPT_TAGBANWA },
-        { "brai", USCRIPT_BRAILLE },
-        { "cprt", USCRIPT_CYPRIOT },
-        { "limb", USCRIPT_LIMBU },
-        { "linb", USCRIPT_LINEAR_B },
-        { "osma", USCRIPT_OSMANYA },
-        { "shaw", USCRIPT_SHAVIAN },
-        { "tale", USCRIPT_TAI_LE },
-        { "ugar", USCRIPT_UGARITIC },
-        { "hrkt", USCRIPT_KATAKANA_OR_HIRAGANA },
-        { "bugi", USCRIPT_BUGINESE },
-        { "glag", USCRIPT_GLAGOLITIC },
-        { "khar", USCRIPT_KHAROSHTHI },
-        { "sylo", USCRIPT_SYLOTI_NAGRI },
-        { "talu", USCRIPT_NEW_TAI_LUE },
-        { "tfng", USCRIPT_TIFINAGH },
-        { "xpeo", USCRIPT_OLD_PERSIAN },
-        { "bali", USCRIPT_BALINESE },
-        { "batk", USCRIPT_BATAK },
-        { "blis", USCRIPT_BLISSYMBOLS },
-        { "brah", USCRIPT_BRAHMI },
-        { "cham", USCRIPT_CHAM },
-        { "cirt", USCRIPT_CIRTH },
-        { "cyrs", USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC },
-        { "egyd", USCRIPT_DEMOTIC_EGYPTIAN },
-        { "egyh", USCRIPT_HIERATIC_EGYPTIAN },
-        { "egyp", USCRIPT_EGYPTIAN_HIEROGLYPHS },
-        { "geok", USCRIPT_KHUTSURI },
-        { "hans", USCRIPT_SIMPLIFIED_HAN },
-        { "hant", USCRIPT_TRADITIONAL_HAN },
-        { "hmng", USCRIPT_PAHAWH_HMONG },
-        { "hung", USCRIPT_OLD_HUNGARIAN },
-        { "inds", USCRIPT_HARAPPAN_INDUS },
-        { "java", USCRIPT_JAVANESE },
-        { "kali", USCRIPT_KAYAH_LI },
-        { "latf", USCRIPT_LATIN_FRAKTUR },
-        { "latg", USCRIPT_LATIN_GAELIC },
-        { "lepc", USCRIPT_LEPCHA },
-        { "lina", USCRIPT_LINEAR_A },
-        { "mand", USCRIPT_MANDAEAN },
-        { "maya", USCRIPT_MAYAN_HIEROGLYPHS },
-        { "mero", USCRIPT_MEROITIC },
-        { "nkoo", USCRIPT_NKO },
-        { "orkh", USCRIPT_ORKHON },
-        { "perm", USCRIPT_OLD_PERMIC },
-        { "phag", USCRIPT_PHAGS_PA },
-        { "phnx", USCRIPT_PHOENICIAN },
-        { "plrd", USCRIPT_PHONETIC_POLLARD },
-        { "roro", USCRIPT_RONGORONGO },
-        { "sara", USCRIPT_SARATI },
-        { "syre", USCRIPT_ESTRANGELO_SYRIAC },
-        { "syrj", USCRIPT_WESTERN_SYRIAC },
-        { "syrn", USCRIPT_EASTERN_SYRIAC },
-        { "teng", USCRIPT_TENGWAR },
-        { "vaii", USCRIPT_VAI },
-        { "visp", USCRIPT_VISIBLE_SPEECH },
-        { "xsux", USCRIPT_CUNEIFORM },
-        { "jpan", USCRIPT_KATAKANA_OR_HIRAGANA },
-        { "kore", USCRIPT_HANGUL },
-        { "zxxx", USCRIPT_UNWRITTEN_LANGUAGES },
-        { "zzzz", USCRIPT_UNKNOWN }
-    };
-
-    typedef HashMap<String, UScriptCode> ScriptNameCodeMap;
-    DEFINE_STATIC_LOCAL(ScriptNameCodeMap, scriptNameCodeMap, ());
-    if (scriptNameCodeMap.isEmpty()) {
-        for (size_t i = 0; i < sizeof(scriptNameCodeList) / sizeof(scriptNameCodeList[0]); ++i)
-            scriptNameCodeMap.set(scriptNameCodeList[i].name, scriptNameCodeList[i].code);
-    }
-
-    HashMap<String, UScriptCode>::iterator it = scriptNameCodeMap.find(scriptName.lower());
-    if (it != scriptNameCodeMap.end())
-        return it->value;
-    return USCRIPT_INVALID_CODE;
-}
-
-UScriptCode localeToScriptCodeForFontSelection(const String& locale)
-{
-    struct LocaleScript {
-        const char* locale;
-        UScriptCode script;
-    };
-
-    static const LocaleScript localeScriptList[] = {
-        { "aa", USCRIPT_LATIN },
-        { "ab", USCRIPT_CYRILLIC },
-        { "ady", USCRIPT_CYRILLIC },
-        { "af", USCRIPT_LATIN },
-        { "ak", USCRIPT_LATIN },
-        { "am", USCRIPT_ETHIOPIC },
-        { "ar", USCRIPT_ARABIC },
-        { "as", USCRIPT_BENGALI },
-        { "ast", USCRIPT_LATIN },
-        { "av", USCRIPT_CYRILLIC },
-        { "ay", USCRIPT_LATIN },
-        { "az", USCRIPT_LATIN },
-        { "ba", USCRIPT_CYRILLIC },
-        { "be", USCRIPT_CYRILLIC },
-        { "bg", USCRIPT_CYRILLIC },
-        { "bi", USCRIPT_LATIN },
-        { "bn", USCRIPT_BENGALI },
-        { "bo", USCRIPT_TIBETAN },
-        { "bs", USCRIPT_LATIN },
-        { "ca", USCRIPT_LATIN },
-        { "ce", USCRIPT_CYRILLIC },
-        { "ceb", USCRIPT_LATIN },
-        { "ch", USCRIPT_LATIN },
-        { "chk", USCRIPT_LATIN },
-        { "cs", USCRIPT_LATIN },
-        { "cy", USCRIPT_LATIN },
-        { "da", USCRIPT_LATIN },
-        { "de", USCRIPT_LATIN },
-        { "dv", USCRIPT_THAANA },
-        { "dz", USCRIPT_TIBETAN },
-        { "ee", USCRIPT_LATIN },
-        { "efi", USCRIPT_LATIN },
-        { "el", USCRIPT_GREEK },
-        { "en", USCRIPT_LATIN },
-        { "es", USCRIPT_LATIN },
-        { "et", USCRIPT_LATIN },
-        { "eu", USCRIPT_LATIN },
-        { "fa", USCRIPT_ARABIC },
-        { "fi", USCRIPT_LATIN },
-        { "fil", USCRIPT_LATIN },
-        { "fj", USCRIPT_LATIN },
-        { "fo", USCRIPT_LATIN },
-        { "fr", USCRIPT_LATIN },
-        { "fur", USCRIPT_LATIN },
-        { "fy", USCRIPT_LATIN },
-        { "ga", USCRIPT_LATIN },
-        { "gaa", USCRIPT_LATIN },
-        { "gd", USCRIPT_LATIN },
-        { "gil", USCRIPT_LATIN },
-        { "gl", USCRIPT_LATIN },
-        { "gn", USCRIPT_LATIN },
-        { "gsw", USCRIPT_LATIN },
-        { "gu", USCRIPT_GUJARATI },
-        { "ha", USCRIPT_LATIN },
-        { "haw", USCRIPT_LATIN },
-        { "he", USCRIPT_HEBREW },
-        { "hi", USCRIPT_DEVANAGARI },
-        { "hil", USCRIPT_LATIN },
-        { "ho", USCRIPT_LATIN },
-        { "hr", USCRIPT_LATIN },
-        { "ht", USCRIPT_LATIN },
-        { "hu", USCRIPT_LATIN },
-        { "hy", USCRIPT_ARMENIAN },
-        { "id", USCRIPT_LATIN },
-        { "ig", USCRIPT_LATIN },
-        { "ii", USCRIPT_YI },
-        { "ilo", USCRIPT_LATIN },
-        { "inh", USCRIPT_CYRILLIC },
-        { "is", USCRIPT_LATIN },
-        { "it", USCRIPT_LATIN },
-        { "iu", USCRIPT_CANADIAN_ABORIGINAL },
-        { "ja", USCRIPT_KATAKANA_OR_HIRAGANA },
-        { "jv", USCRIPT_LATIN },
-        { "ka", USCRIPT_GEORGIAN },
-        { "kaj", USCRIPT_LATIN },
-        { "kam", USCRIPT_LATIN },
-        { "kbd", USCRIPT_CYRILLIC },
-        { "kha", USCRIPT_LATIN },
-        { "kk", USCRIPT_CYRILLIC },
-        { "kl", USCRIPT_LATIN },
-        { "km", USCRIPT_KHMER },
-        { "kn", USCRIPT_KANNADA },
-        { "ko", USCRIPT_HANGUL },
-        { "kok", USCRIPT_DEVANAGARI },
-        { "kos", USCRIPT_LATIN },
-        { "kpe", USCRIPT_LATIN },
-        { "krc", USCRIPT_CYRILLIC },
-        { "ks", USCRIPT_ARABIC },
-        { "ku", USCRIPT_ARABIC },
-        { "kum", USCRIPT_CYRILLIC },
-        { "ky", USCRIPT_CYRILLIC },
-        { "la", USCRIPT_LATIN },
-        { "lah", USCRIPT_ARABIC },
-        { "lb", USCRIPT_LATIN },
-        { "lez", USCRIPT_CYRILLIC },
-        { "ln", USCRIPT_LATIN },
-        { "lo", USCRIPT_LAO },
-        { "lt", USCRIPT_LATIN },
-        { "lv", USCRIPT_LATIN },
-        { "mai", USCRIPT_DEVANAGARI },
-        { "mdf", USCRIPT_CYRILLIC },
-        { "mg", USCRIPT_LATIN },
-        { "mh", USCRIPT_LATIN },
-        { "mi", USCRIPT_LATIN },
-        { "mk", USCRIPT_CYRILLIC },
-        { "ml", USCRIPT_MALAYALAM },
-        { "mn", USCRIPT_CYRILLIC },
-        { "mr", USCRIPT_DEVANAGARI },
-        { "ms", USCRIPT_LATIN },
-        { "mt", USCRIPT_LATIN },
-        { "my", USCRIPT_MYANMAR },
-        { "myv", USCRIPT_CYRILLIC },
-        { "na", USCRIPT_LATIN },
-        { "nb", USCRIPT_LATIN },
-        { "ne", USCRIPT_DEVANAGARI },
-        { "niu", USCRIPT_LATIN },
-        { "nl", USCRIPT_LATIN },
-        { "nn", USCRIPT_LATIN },
-        { "nr", USCRIPT_LATIN },
-        { "nso", USCRIPT_LATIN },
-        { "ny", USCRIPT_LATIN },
-        { "oc", USCRIPT_LATIN },
-        { "om", USCRIPT_LATIN },
-        { "or", USCRIPT_ORIYA },
-        { "os", USCRIPT_CYRILLIC },
-        { "pa", USCRIPT_GURMUKHI },
-        { "pag", USCRIPT_LATIN },
-        { "pap", USCRIPT_LATIN },
-        { "pau", USCRIPT_LATIN },
-        { "pl", USCRIPT_LATIN },
-        { "pon", USCRIPT_LATIN },
-        { "ps", USCRIPT_ARABIC },
-        { "pt", USCRIPT_LATIN },
-        { "qu", USCRIPT_LATIN },
-        { "rm", USCRIPT_LATIN },
-        { "rn", USCRIPT_LATIN },
-        { "ro", USCRIPT_LATIN },
-        { "ru", USCRIPT_CYRILLIC },
-        { "rw", USCRIPT_LATIN },
-        { "sa", USCRIPT_DEVANAGARI },
-        { "sah", USCRIPT_CYRILLIC },
-        { "sat", USCRIPT_LATIN },
-        { "sd", USCRIPT_ARABIC },
-        { "se", USCRIPT_LATIN },
-        { "sg", USCRIPT_LATIN },
-        { "si", USCRIPT_SINHALA },
-        { "sid", USCRIPT_LATIN },
-        { "sk", USCRIPT_LATIN },
-        { "sl", USCRIPT_LATIN },
-        { "sm", USCRIPT_LATIN },
-        { "so", USCRIPT_LATIN },
-        { "sq", USCRIPT_LATIN },
-        { "sr", USCRIPT_CYRILLIC },
-        { "ss", USCRIPT_LATIN },
-        { "st", USCRIPT_LATIN },
-        { "su", USCRIPT_LATIN },
-        { "sv", USCRIPT_LATIN },
-        { "sw", USCRIPT_LATIN },
-        { "ta", USCRIPT_TAMIL },
-        { "te", USCRIPT_TELUGU },
-        { "tet", USCRIPT_LATIN },
-        { "tg", USCRIPT_CYRILLIC },
-        { "th", USCRIPT_THAI },
-        { "ti", USCRIPT_ETHIOPIC },
-        { "tig", USCRIPT_ETHIOPIC },
-        { "tk", USCRIPT_LATIN },
-        { "tkl", USCRIPT_LATIN },
-        { "tl", USCRIPT_LATIN },
-        { "tn", USCRIPT_LATIN },
-        { "to", USCRIPT_LATIN },
-        { "tpi", USCRIPT_LATIN },
-        { "tr", USCRIPT_LATIN },
-        { "trv", USCRIPT_LATIN },
-        { "ts", USCRIPT_LATIN },
-        { "tt", USCRIPT_CYRILLIC },
-        { "tvl", USCRIPT_LATIN },
-        { "tw", USCRIPT_LATIN },
-        { "ty", USCRIPT_LATIN },
-        { "tyv", USCRIPT_CYRILLIC },
-        { "udm", USCRIPT_CYRILLIC },
-        { "ug", USCRIPT_ARABIC },
-        { "uk", USCRIPT_CYRILLIC },
-        { "und", USCRIPT_LATIN },
-        { "ur", USCRIPT_ARABIC },
-        { "uz", USCRIPT_CYRILLIC },
-        { "ve", USCRIPT_LATIN },
-        { "vi", USCRIPT_LATIN },
-        { "wal", USCRIPT_ETHIOPIC },
-        { "war", USCRIPT_LATIN },
-        { "wo", USCRIPT_LATIN },
-        { "xh", USCRIPT_LATIN },
-        { "yap", USCRIPT_LATIN },
-        { "yo", USCRIPT_LATIN },
-        { "za", USCRIPT_LATIN },
-        { "zh", USCRIPT_SIMPLIFIED_HAN },
-        { "zh_hk", USCRIPT_TRADITIONAL_HAN },
-        { "zh_tw", USCRIPT_TRADITIONAL_HAN },
-        { "zu", USCRIPT_LATIN }
-    };
-
-    typedef HashMap<String, UScriptCode> LocaleScriptMap;
-    DEFINE_STATIC_LOCAL(LocaleScriptMap, localeScriptMap, ());
-    if (localeScriptMap.isEmpty()) {
-        for (size_t i = 0; i < sizeof(localeScriptList) / sizeof(localeScriptList[0]); ++i)
-            localeScriptMap.set(localeScriptList[i].locale, localeScriptList[i].script);
-    }
-
-    String canonicalLocale = locale.lower().replace('-', '_');
-    while (!canonicalLocale.isEmpty()) {
-        HashMap<String, UScriptCode>::iterator it = localeScriptMap.find(canonicalLocale);
-        if (it != localeScriptMap.end())
-            return it->value;
-        size_t pos = canonicalLocale.reverseFind('_');
-        if (pos == kNotFound)
-            break;
-        UScriptCode code = scriptNameToCode(canonicalLocale.substring(pos + 1));
-        if (code != USCRIPT_INVALID_CODE && code != USCRIPT_UNKNOWN)
-            return code;
-        canonicalLocale = canonicalLocale.substring(0, pos);
-    }
-    return USCRIPT_COMMON;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/text/NonCJKGlyphOrientation.h b/Source/core/platform/text/NonCJKGlyphOrientation.h
deleted file mode 100644
index 515c23b..0000000
--- a/Source/core/platform/text/NonCJKGlyphOrientation.h
+++ /dev/null
@@ -1,35 +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 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 NonCJKGlyphOrientation_h
-#define NonCJKGlyphOrientation_h
-
-namespace WebCore {
-
-enum NonCJKGlyphOrientation { NonCJKGlyphOrientationVerticalRight, NonCJKGlyphOrientationUpright };
-
-}
-
-#endif // NonCJKGlyphOrientation_h
diff --git a/Source/core/platform/text/ParserUtilities.h b/Source/core/platform/text/ParserUtilities.h
deleted file mode 100644
index 6548759..0000000
--- a/Source/core/platform/text/ParserUtilities.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- * Copyright (C) 2002, 2003 The Karbon Developers
- * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef ParserUtilities_h
-#define ParserUtilities_h
-
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-template<typename CharType>
-inline bool skipString(const CharType*& ptr, const CharType* end, const CharType* name, int length)
-{
-    if (end - ptr < length)
-        return false;
-    if (memcmp(name, ptr, sizeof(CharType) * length))
-        return false;
-    ptr += length;
-    return true;
-}
-
-inline bool skipString(const UChar*& ptr, const UChar* end, const LChar* name, int length)
-{
-    if (end - ptr < length)
-        return false;
-    for (int i = 0; i < length; ++i) {
-        if (ptr[i] != name[i])
-            return false;
-    }
-    ptr += length;
-    return true;
-}
-
-template<typename CharType>
-inline bool skipString(const CharType*& ptr, const CharType* end, const char* str)
-{
-    int length = strlen(str);
-    if (end - ptr < length)
-        return false;
-    for (int i = 0; i < length; ++i) {
-        if (ptr[i] != str[i])
-            return false;
-    }
-    ptr += length;
-    return true;
-}
-
-} // namspace WebCore
-
-#endif // ParserUtilities_h
diff --git a/Source/core/platform/text/PlatformLocale.cpp b/Source/core/platform/text/PlatformLocale.cpp
deleted file mode 100644
index ef0ad72..0000000
--- a/Source/core/platform/text/PlatformLocale.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Copyright (C) 2011,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:
- *
- *     * 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/text/PlatformLocale.h"
-
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/text/DateTimeFormat.h"
-#include "public/platform/Platform.h"
-#include "wtf/text/StringBuilder.h"
-
-namespace WebCore {
-
-using WebKit::Platform;
-using WebKit::WebLocalizedString;
-
-class DateTimeStringBuilder : private DateTimeFormat::TokenHandler {
-    WTF_MAKE_NONCOPYABLE(DateTimeStringBuilder);
-
-public:
-    // The argument objects must be alive until this object dies.
-    DateTimeStringBuilder(Locale&, const DateComponents&);
-
-    bool build(const String&);
-    String toString();
-
-private:
-    // DateTimeFormat::TokenHandler functions.
-    virtual void visitField(DateTimeFormat::FieldType, int) OVERRIDE FINAL;
-    virtual void visitLiteral(const String&) OVERRIDE FINAL;
-
-    String zeroPadString(const String&, size_t width);
-    void appendNumber(int number, size_t width);
-
-    StringBuilder m_builder;
-    Locale& m_localizer;
-    const DateComponents& m_date;
-};
-
-DateTimeStringBuilder::DateTimeStringBuilder(Locale& localizer, const DateComponents& date)
-    : m_localizer(localizer)
-    , m_date(date)
-{
-}
-
-bool DateTimeStringBuilder::build(const String& formatString)
-{
-    m_builder.reserveCapacity(formatString.length());
-    return DateTimeFormat::parse(formatString, *this);
-}
-
-String DateTimeStringBuilder::zeroPadString(const String& string, size_t width)
-{
-    if (string.length() >= width)
-        return string;
-    StringBuilder zeroPaddedStringBuilder;
-    zeroPaddedStringBuilder.reserveCapacity(width);
-    for (size_t i = string.length(); i < width; ++i)
-        zeroPaddedStringBuilder.append("0");
-    zeroPaddedStringBuilder.append(string);
-    return zeroPaddedStringBuilder.toString();
-}
-
-void DateTimeStringBuilder::appendNumber(int number, size_t width)
-{
-    String zeroPaddedNumberString = zeroPadString(String::number(number), width);
-    m_builder.append(m_localizer.convertToLocalizedNumber(zeroPaddedNumberString));
-}
-
-void DateTimeStringBuilder::visitField(DateTimeFormat::FieldType fieldType, int numberOfPatternCharacters)
-{
-    switch (fieldType) {
-    case DateTimeFormat::FieldTypeYear:
-        // Always use padding width of 4 so it matches DateTimeEditElement.
-        appendNumber(m_date.fullYear(), 4);
-        return;
-    case DateTimeFormat::FieldTypeMonth:
-        if (numberOfPatternCharacters == 3)
-            m_builder.append(m_localizer.shortMonthLabels()[m_date.month()]);
-        else if (numberOfPatternCharacters == 4)
-            m_builder.append(m_localizer.monthLabels()[m_date.month()]);
-        else {
-            // Always use padding width of 2 so it matches DateTimeEditElement.
-            appendNumber(m_date.month() + 1, 2);
-        }
-        return;
-    case DateTimeFormat::FieldTypeMonthStandAlone:
-        if (numberOfPatternCharacters == 3)
-            m_builder.append(m_localizer.shortStandAloneMonthLabels()[m_date.month()]);
-        else if (numberOfPatternCharacters == 4)
-            m_builder.append(m_localizer.standAloneMonthLabels()[m_date.month()]);
-        else {
-            // Always use padding width of 2 so it matches DateTimeEditElement.
-            appendNumber(m_date.month() + 1, 2);
-        }
-        return;
-    case DateTimeFormat::FieldTypeDayOfMonth:
-        // Always use padding width of 2 so it matches DateTimeEditElement.
-        appendNumber(m_date.monthDay(), 2);
-        return;
-    case DateTimeFormat::FieldTypeWeekOfYear:
-        // Always use padding width of 2 so it matches DateTimeEditElement.
-        appendNumber(m_date.week(), 2);
-        return;
-    case DateTimeFormat::FieldTypePeriod:
-        m_builder.append(m_localizer.timeAMPMLabels()[(m_date.hour() >= 12 ? 1 : 0)]);
-        return;
-    case DateTimeFormat::FieldTypeHour12: {
-        int hour12 = m_date.hour() % 12;
-        if (!hour12)
-            hour12 = 12;
-        appendNumber(hour12, numberOfPatternCharacters);
-        return;
-    }
-    case DateTimeFormat::FieldTypeHour23:
-        appendNumber(m_date.hour(), numberOfPatternCharacters);
-        return;
-    case DateTimeFormat::FieldTypeHour11:
-        appendNumber(m_date.hour() % 12, numberOfPatternCharacters);
-        return;
-    case DateTimeFormat::FieldTypeHour24: {
-        int hour24 = m_date.hour();
-        if (!hour24)
-            hour24 = 24;
-        appendNumber(hour24, numberOfPatternCharacters);
-        return;
-    }
-    case DateTimeFormat::FieldTypeMinute:
-        appendNumber(m_date.minute(), numberOfPatternCharacters);
-        return;
-    case DateTimeFormat::FieldTypeSecond:
-        if (!m_date.millisecond())
-            appendNumber(m_date.second(), numberOfPatternCharacters);
-        else {
-            double second = m_date.second() + m_date.millisecond() / 1000.0;
-            String zeroPaddedSecondString = zeroPadString(String::format("%.03f", second), numberOfPatternCharacters + 4);
-            m_builder.append(m_localizer.convertToLocalizedNumber(zeroPaddedSecondString));
-        }
-        return;
-    default:
-        return;
-    }
-}
-
-void DateTimeStringBuilder::visitLiteral(const String& text)
-{
-    ASSERT(text.length());
-    m_builder.append(text);
-}
-
-String DateTimeStringBuilder::toString()
-{
-    return m_builder.toString();
-}
-
-Locale::~Locale()
-{
-}
-
-String Locale::queryString(WebLocalizedString::Name name)
-{
-    // FIXME: Returns a string locazlied for this locale.
-    return Platform::current()->queryLocalizedString(name);
-}
-
-String Locale::queryString(WebLocalizedString::Name name, const String& parameter)
-{
-    // FIXME: Returns a string locazlied for this locale.
-    return Platform::current()->queryLocalizedString(name, parameter);
-}
-
-String Locale::queryString(WebLocalizedString::Name name, const String& parameter1, const String& parameter2)
-{
-    // FIXME: Returns a string locazlied for this locale.
-    return Platform::current()->queryLocalizedString(name, parameter1, parameter2);
-}
-
-String Locale::validationMessageTooLongText(unsigned valueLength, int maxLength)
-{
-    return queryString(WebLocalizedString::ValidationTooLong, convertToLocalizedNumber(String::number(valueLength)), convertToLocalizedNumber(String::number(maxLength)));
-}
-
-void Locale::setLocaleData(const Vector<String, DecimalSymbolsSize>& symbols, const String& positivePrefix, const String& positiveSuffix, const String& negativePrefix, const String& negativeSuffix)
-{
-    for (size_t i = 0; i < symbols.size(); ++i) {
-        ASSERT(!symbols[i].isEmpty());
-        m_decimalSymbols[i] = symbols[i];
-    }
-    m_positivePrefix = positivePrefix;
-    m_positiveSuffix = positiveSuffix;
-    m_negativePrefix = negativePrefix;
-    m_negativeSuffix = negativeSuffix;
-    ASSERT(!m_positivePrefix.isEmpty() || !m_positiveSuffix.isEmpty() || !m_negativePrefix.isEmpty() || !m_negativeSuffix.isEmpty());
-    m_hasLocaleData = true;
-}
-
-String Locale::convertToLocalizedNumber(const String& input)
-{
-    initializeLocaleData();
-    if (!m_hasLocaleData || input.isEmpty())
-        return input;
-
-    unsigned i = 0;
-    bool isNegative = false;
-    StringBuilder builder;
-    builder.reserveCapacity(input.length());
-
-    if (input[0] == '-') {
-        ++i;
-        isNegative = true;
-        builder.append(m_negativePrefix);
-    } else
-        builder.append(m_positivePrefix);
-
-    for (; i < input.length(); ++i) {
-        switch (input[i]) {
-        case '0':
-        case '1':
-        case '2':
-        case '3':
-        case '4':
-        case '5':
-        case '6':
-        case '7':
-        case '8':
-        case '9':
-            builder.append(m_decimalSymbols[input[i] - '0']);
-            break;
-        case '.':
-            builder.append(m_decimalSymbols[DecimalSeparatorIndex]);
-            break;
-        default:
-            ASSERT_NOT_REACHED();
-        }
-    }
-
-    builder.append(isNegative ? m_negativeSuffix : m_positiveSuffix);
-
-    return builder.toString();
-}
-
-static bool matches(const String& text, unsigned position, const String& part)
-{
-    if (part.isEmpty())
-        return true;
-    if (position + part.length() > text.length())
-        return false;
-    for (unsigned i = 0; i < part.length(); ++i) {
-        if (text[position + i] != part[i])
-            return false;
-    }
-    return true;
-}
-
-bool Locale::detectSignAndGetDigitRange(const String& input, bool& isNegative, unsigned& startIndex, unsigned& endIndex)
-{
-    startIndex = 0;
-    endIndex = input.length();
-    if (m_negativePrefix.isEmpty() && m_negativeSuffix.isEmpty()) {
-        if (input.startsWith(m_positivePrefix) && input.endsWith(m_positiveSuffix)) {
-            isNegative = false;
-            startIndex = m_positivePrefix.length();
-            endIndex -= m_positiveSuffix.length();
-        } else
-            isNegative = true;
-    } else {
-        if (input.startsWith(m_negativePrefix) && input.endsWith(m_negativeSuffix)) {
-            isNegative = true;
-            startIndex = m_negativePrefix.length();
-            endIndex -= m_negativeSuffix.length();
-        } else {
-            isNegative = false;
-            if (input.startsWith(m_positivePrefix) && input.endsWith(m_positiveSuffix)) {
-                startIndex = m_positivePrefix.length();
-                endIndex -= m_positiveSuffix.length();
-            } else
-                return false;
-        }
-    }
-    return true;
-}
-
-unsigned Locale::matchedDecimalSymbolIndex(const String& input, unsigned& position)
-{
-    for (unsigned symbolIndex = 0; symbolIndex < DecimalSymbolsSize; ++symbolIndex) {
-        if (m_decimalSymbols[symbolIndex].length() && matches(input, position, m_decimalSymbols[symbolIndex])) {
-            position += m_decimalSymbols[symbolIndex].length();
-            return symbolIndex;
-        }
-    }
-    return DecimalSymbolsSize;
-}
-
-String Locale::convertFromLocalizedNumber(const String& localized)
-{
-    initializeLocaleData();
-    String input = localized.stripWhiteSpace();
-    if (!m_hasLocaleData || input.isEmpty())
-        return input;
-
-    bool isNegative;
-    unsigned startIndex;
-    unsigned endIndex;
-    if (!detectSignAndGetDigitRange(input, isNegative, startIndex, endIndex))
-        return input;
-
-    StringBuilder builder;
-    builder.reserveCapacity(input.length());
-    if (isNegative)
-        builder.append("-");
-    for (unsigned i = startIndex; i < endIndex;) {
-        unsigned symbolIndex = matchedDecimalSymbolIndex(input, i);
-        if (symbolIndex >= DecimalSymbolsSize)
-            return input;
-        if (symbolIndex == DecimalSeparatorIndex)
-            builder.append('.');
-        else if (symbolIndex == GroupSeparatorIndex)
-            return input;
-        else
-            builder.append(static_cast<UChar>('0' + symbolIndex));
-    }
-    return builder.toString();
-}
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-String Locale::localizedDecimalSeparator()
-{
-    initializeLocaleData();
-    return m_decimalSymbols[DecimalSeparatorIndex];
-}
-#endif
-
-String Locale::formatDateTime(const DateComponents& date, FormatType formatType)
-{
-    if (date.type() == DateComponents::Invalid)
-        return String();
-
-    DateTimeStringBuilder builder(*this, date);
-    switch (date.type()) {
-    case DateComponents::Time:
-        builder.build(formatType == FormatTypeShort ? shortTimeFormat() : timeFormat());
-        break;
-    case DateComponents::Date:
-        builder.build(dateFormat());
-        break;
-    case DateComponents::Month:
-        builder.build(formatType == FormatTypeShort ? shortMonthFormat() : monthFormat());
-        break;
-    case DateComponents::Week:
-        builder.build(weekFormatInLDML());
-        break;
-    case DateComponents::DateTime:
-    case DateComponents::DateTimeLocal:
-        builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSeconds() : dateTimeFormatWithSeconds());
-        break;
-    case DateComponents::Invalid:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-    return builder.toString();
-}
-
-}
diff --git a/Source/core/platform/text/PlatformLocale.h b/Source/core/platform/text/PlatformLocale.h
deleted file mode 100644
index 45e40e6..0000000
--- a/Source/core/platform/text/PlatformLocale.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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 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 PlatformLocale_h
-#define PlatformLocale_h
-
-#include "core/platform/DateComponents.h"
-#include "core/platform/Language.h"
-#include "public/platform/WebLocalizedString.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class Locale {
-    WTF_MAKE_NONCOPYABLE(Locale);
-
-public:
-    static PassOwnPtr<Locale> create(const AtomicString& localeIdentifier);
-    static PassOwnPtr<Locale> createDefault();
-
-    String queryString(WebKit::WebLocalizedString::Name);
-    String queryString(WebKit::WebLocalizedString::Name, const String& parameter);
-    String queryString(WebKit::WebLocalizedString::Name, const String& parameter1, const String& parameter2);
-    String validationMessageTooLongText(unsigned valueLength, int maxLength);
-
-    // Converts the specified number string to another number string localized
-    // for this Locale locale. The input string must conform to HTML
-    // floating-point numbers, and is not empty.
-    String convertToLocalizedNumber(const String&);
-
-    // Converts the specified localized number string to a number string in the
-    // HTML floating-point number format. The input string is provided by a end
-    // user, and might not be a number string. It's ok that the function returns
-    // a string which is not conforms to the HTML floating-point number format,
-    // callers of this function are responsible to check the format of the
-    // resultant string.
-    String convertFromLocalizedNumber(const String&);
-
-#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
-    // Returns localized decimal separator, e.g. "." for English, "," for French.
-    String localizedDecimalSeparator();
-#endif
-
-    // Returns date format in Unicode TR35 LDML[1] containing day of month,
-    // month, and year, e.g. "dd/mm/yyyy"
-    // [1] LDML http://unicode.org/reports/tr35/#Date_Format_Patterns
-    virtual String dateFormat() = 0;
-
-    // Returns a year-month format in Unicode TR35 LDML.
-    virtual String monthFormat() = 0;
-
-    // Returns a year-month format using short month lanel in Unicode TR35 LDML.
-    virtual String shortMonthFormat() = 0;
-
-    // Returns time format in Unicode TR35 LDML[1] containing hour, minute, and
-    // second with optional period(AM/PM), e.g. "h:mm:ss a"
-    // [1] LDML http://unicode.org/reports/tr35/#Date_Format_Patterns
-    virtual String timeFormat() = 0;
-
-    // Returns time format in Unicode TR35 LDML containing hour, and minute
-    // with optional period(AM/PM), e.g. "h:mm a"
-    // Note: Some platforms return same value as timeFormat().
-    virtual String shortTimeFormat() = 0;
-
-    // Returns a date-time format in Unicode TR35 LDML. It should have a seconds
-    // field.
-    virtual String dateTimeFormatWithSeconds() = 0;
-
-    // Returns a date-time format in Unicode TR35 LDML. It should have no seconds
-    // field.
-    virtual String dateTimeFormatWithoutSeconds() = 0;
-
-    // Returns a vector of string of which size is 12. The first item is a
-    // localized string of Jan and the last item is a localized string of
-    // Dec. These strings should be short.
-    virtual const Vector<String>& shortMonthLabels() = 0;
-
-    // Returns a vector of string of which size is 12. The first item is a
-    // stand-alone localized string of January and the last item is a
-    // stand-alone localized string of December. These strings should not be
-    // abbreviations.
-    virtual const Vector<String>& standAloneMonthLabels() = 0;
-
-    // Stand-alone month version of shortMonthLabels.
-    virtual const Vector<String>& shortStandAloneMonthLabels() = 0;
-
-    // Returns localized period field(AM/PM) strings.
-    virtual const Vector<String>& timeAMPMLabels() = 0;
-
-    // Returns a vector of string of which size is 12. The first item is a
-    // localized string of January, and the last item is a localized string of
-    // December. These strings should not be abbreviations.
-    virtual const Vector<String>& monthLabels() = 0;
-
-#if ENABLE(CALENDAR_PICKER)
-    // Returns a vector of string of which size is 7. The first item is a
-    // localized short string of Monday, and the last item is a localized
-    // short string of Saturday. These strings should be short.
-    virtual const Vector<String>& weekDayShortLabels() = 0;
-
-    // The first day of a week. 0 is Sunday, and 6 is Saturday.
-    virtual unsigned firstDayOfWeek() = 0;
-
-    // Returns true if people use right-to-left writing in the locale for this
-    // object.
-    virtual bool isRTL() = 0;
-#endif
-
-    enum FormatType { FormatTypeUnspecified, FormatTypeShort, FormatTypeMedium };
-
-    // Serializes the specified date into a formatted date string to
-    // display to the user. If an implementation doesn't support
-    // localized dates the function should return an empty string.
-    // FormatType can be used to specify if you want the short format.
-    String formatDateTime(const DateComponents&, FormatType = FormatTypeUnspecified);
-
-    virtual ~Locale();
-
-protected:
-    enum {
-        // 0-9 for digits.
-        DecimalSeparatorIndex = 10,
-        GroupSeparatorIndex = 11,
-        DecimalSymbolsSize
-    };
-
-    Locale() : m_hasLocaleData(false) { }
-    virtual void initializeLocaleData() = 0;
-    void setLocaleData(const Vector<String, DecimalSymbolsSize>&, const String& positivePrefix, const String& positiveSuffix, const String& negativePrefix, const String& negativeSuffix);
-
-private:
-    bool detectSignAndGetDigitRange(const String& input, bool& isNegative, unsigned& startIndex, unsigned& endIndex);
-    unsigned matchedDecimalSymbolIndex(const String& input, unsigned& position);
-
-    String m_decimalSymbols[DecimalSymbolsSize];
-    String m_positivePrefix;
-    String m_positiveSuffix;
-    String m_negativePrefix;
-    String m_negativeSuffix;
-    bool m_hasLocaleData;
-};
-
-inline PassOwnPtr<Locale> Locale::createDefault()
-{
-    return Locale::create(defaultLanguage());
-}
-
-}
-#endif
diff --git a/Source/core/platform/text/QuotedPrintable.cpp b/Source/core/platform/text/QuotedPrintable.cpp
deleted file mode 100644
index 547a77c..0000000
--- a/Source/core/platform/text/QuotedPrintable.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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/text/QuotedPrintable.h"
-
-#include "wtf/ASCIICType.h"
-
-namespace WebCore {
-
-static const size_t maximumLineLength = 76;
-
-static const char crlfLineEnding[] = "\r\n";
-
-static size_t lengthOfLineEndingAtIndex(const char* input, size_t inputLength, size_t index)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(index < inputLength);
-    if (input[index] == '\n')
-        return 1; // Single LF.
-
-    if (input[index] == '\r') {
-        if ((index + 1) == inputLength || input[index + 1] != '\n')
-            return 1; // Single CR (Classic Mac OS).
-        return 2; // CR-LF.
-    }
-
-    return 0;
-}
-
-void quotedPrintableEncode(const Vector<char>& in, Vector<char>& out)
-{
-    quotedPrintableEncode(in.data(), in.size(), out);
-}
-
-void quotedPrintableEncode(const char* input, size_t inputLength, Vector<char>& out)
-{
-    out.clear();
-    out.reserveCapacity(inputLength);
-    size_t currentLineLength = 0;
-    for (size_t i = 0; i < inputLength; ++i) {
-        bool isLastCharacter = (i == inputLength - 1);
-        char currentCharacter = input[i];
-        bool requiresEncoding = false;
-        // All non-printable ASCII characters and = require encoding.
-        if ((currentCharacter < ' ' || currentCharacter > '~' || currentCharacter == '=') && currentCharacter != '\t')
-            requiresEncoding = true;
-
-        // Space and tab characters have to be encoded if they appear at the end of a line.
-        if (!requiresEncoding && (currentCharacter == '\t' || currentCharacter == ' ') && (isLastCharacter || lengthOfLineEndingAtIndex(input, inputLength, i + 1)))
-            requiresEncoding = true;
-
-        // End of line should be converted to CR-LF sequences.
-        if (!isLastCharacter) {
-            size_t lengthOfLineEnding = lengthOfLineEndingAtIndex(input, inputLength, i);
-            if (lengthOfLineEnding) {
-                out.append(crlfLineEnding, strlen(crlfLineEnding));
-                currentLineLength = 0;
-                i += (lengthOfLineEnding - 1); // -1 because we'll ++ in the for() above.
-                continue;
-            }
-        }
-
-        size_t lengthOfEncodedCharacter = 1;
-        if (requiresEncoding)
-            lengthOfEncodedCharacter += 2;
-        if (!isLastCharacter)
-            lengthOfEncodedCharacter += 1; // + 1 for the = (soft line break).
-
-        // Insert a soft line break if necessary.
-        if (currentLineLength + lengthOfEncodedCharacter > maximumLineLength) {
-            out.append('=');
-            out.append(crlfLineEnding, strlen(crlfLineEnding));
-            currentLineLength = 0;
-        }
-
-        // Finally, insert the actual character(s).
-        if (requiresEncoding) {
-            out.append('=');
-            out.append(upperNibbleToASCIIHexDigit(currentCharacter));
-            out.append(lowerNibbleToASCIIHexDigit(currentCharacter));
-            currentLineLength += 3;
-        } else {
-            out.append(currentCharacter);
-            currentLineLength++;
-        }
-    }
-}
-
-void quotedPrintableDecode(const Vector<char>& in, Vector<char>& out)
-{
-    quotedPrintableDecode(in.data(), in.size(), out);
-}
-
-void quotedPrintableDecode(const char* data, size_t dataLength, Vector<char>& out)
-{
-    out.clear();
-    if (!dataLength)
-        return;
-
-    for (size_t i = 0; i < dataLength; ++i) {
-        char currentCharacter = data[i];
-        if (currentCharacter != '=') {
-            out.append(currentCharacter);
-            continue;
-        }
-        // We are dealing with a '=xx' sequence.
-        if (dataLength - i < 3) {
-            // Unfinished = sequence, append as is.
-            out.append(currentCharacter);
-            continue;
-        }
-        char upperCharacter = data[++i];
-        char lowerCharacter = data[++i];
-        if (upperCharacter == '\r' && lowerCharacter == '\n')
-            continue;
-
-        if (!isASCIIHexDigit(upperCharacter) || !isASCIIHexDigit(lowerCharacter)) {
-            // Invalid sequence, = followed by non hex digits, just insert the characters as is.
-            out.append('=');
-            out.append(upperCharacter);
-            out.append(lowerCharacter);
-            continue;
-        }
-        out.append(static_cast<char>(toASCIIHexValue(upperCharacter, lowerCharacter)));
-    }
-}
-
-}
diff --git a/Source/core/platform/text/QuotedPrintable.h b/Source/core/platform/text/QuotedPrintable.h
deleted file mode 100644
index 5cbd85b..0000000
--- a/Source/core/platform/text/QuotedPrintable.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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 QuotedPrintable_h
-#define QuotedPrintable_h
-
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-void quotedPrintableEncode(const Vector<char>&, Vector<char>&);
-void quotedPrintableEncode(const char*, size_t, Vector<char>&);
-
-void quotedPrintableDecode(const Vector<char>&, Vector<char>&);
-void quotedPrintableDecode(const char*, size_t, Vector<char>&);
-
-} // namespace WebCore
-
-#endif // QuotedPrintable_h
diff --git a/Source/core/platform/text/SegmentedString.cpp b/Source/core/platform/text/SegmentedString.cpp
deleted file mode 100644
index 628cf92..0000000
--- a/Source/core/platform/text/SegmentedString.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
-    Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. 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
-    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
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include "core/platform/text/SegmentedString.h"
-
-namespace WebCore {
-
-SegmentedString::SegmentedString(const SegmentedString& other)
-    : m_pushedChar1(other.m_pushedChar1)
-    , m_pushedChar2(other.m_pushedChar2)
-    , m_currentString(other.m_currentString)
-    , m_numberOfCharactersConsumedPriorToCurrentString(other.m_numberOfCharactersConsumedPriorToCurrentString)
-    , m_numberOfCharactersConsumedPriorToCurrentLine(other.m_numberOfCharactersConsumedPriorToCurrentLine)
-    , m_currentLine(other.m_currentLine)
-    , m_substrings(other.m_substrings)
-    , m_closed(other.m_closed)
-    , m_empty(other.m_empty)
-    , m_fastPathFlags(other.m_fastPathFlags)
-    , m_advanceFunc(other.m_advanceFunc)
-    , m_advanceAndUpdateLineNumberFunc(other.m_advanceAndUpdateLineNumberFunc)
-{
-    if (m_pushedChar2)
-        m_currentChar = m_pushedChar2;
-    else if (m_pushedChar1)
-        m_currentChar = m_pushedChar1;
-    else
-        m_currentChar = m_currentString.m_length ? m_currentString.getCurrentChar() : 0;
-}
-
-const SegmentedString& SegmentedString::operator=(const SegmentedString& other)
-{
-    m_pushedChar1 = other.m_pushedChar1;
-    m_pushedChar2 = other.m_pushedChar2;
-    m_currentString = other.m_currentString;
-    m_substrings = other.m_substrings;
-    if (m_pushedChar2)
-        m_currentChar = m_pushedChar2;
-    else if (m_pushedChar1)
-        m_currentChar = m_pushedChar1;
-    else
-        m_currentChar = m_currentString.m_length ? m_currentString.getCurrentChar() : 0;
-
-    m_closed = other.m_closed;
-    m_empty = other.m_empty;
-    m_fastPathFlags = other.m_fastPathFlags;
-    m_numberOfCharactersConsumedPriorToCurrentString = other.m_numberOfCharactersConsumedPriorToCurrentString;
-    m_numberOfCharactersConsumedPriorToCurrentLine = other.m_numberOfCharactersConsumedPriorToCurrentLine;
-    m_currentLine = other.m_currentLine;
-
-    m_advanceFunc = other.m_advanceFunc;
-    m_advanceAndUpdateLineNumberFunc = other.m_advanceAndUpdateLineNumberFunc;
-
-    return *this;
-}
-
-unsigned SegmentedString::length() const
-{
-    unsigned length = m_currentString.m_length;
-    if (m_pushedChar1) {
-        ++length;
-        if (m_pushedChar2)
-            ++length;
-    }
-    if (isComposite()) {
-        Deque<SegmentedSubstring>::const_iterator it = m_substrings.begin();
-        Deque<SegmentedSubstring>::const_iterator e = m_substrings.end();
-        for (; it != e; ++it)
-            length += it->m_length;
-    }
-    return length;
-}
-
-void SegmentedString::setExcludeLineNumbers()
-{
-    m_currentString.setExcludeLineNumbers();
-    if (isComposite()) {
-        Deque<SegmentedSubstring>::iterator it = m_substrings.begin();
-        Deque<SegmentedSubstring>::iterator e = m_substrings.end();
-        for (; it != e; ++it)
-            it->setExcludeLineNumbers();
-    }
-}
-
-void SegmentedString::clear()
-{
-    m_pushedChar1 = 0;
-    m_pushedChar2 = 0;
-    m_currentChar = 0;
-    m_currentString.clear();
-    m_numberOfCharactersConsumedPriorToCurrentString = 0;
-    m_numberOfCharactersConsumedPriorToCurrentLine = 0;
-    m_currentLine = 0;
-    m_substrings.clear();
-    m_closed = false;
-    m_empty = true;
-    m_fastPathFlags = NoFastPath;
-    m_advanceFunc = &SegmentedString::advanceEmpty;
-    m_advanceAndUpdateLineNumberFunc = &SegmentedString::advanceEmpty;
-}
-
-void SegmentedString::append(const SegmentedSubstring& s)
-{
-    ASSERT(!m_closed);
-    if (!s.m_length)
-        return;
-
-    if (!m_currentString.m_length) {
-        m_numberOfCharactersConsumedPriorToCurrentString += m_currentString.numberOfCharactersConsumed();
-        m_currentString = s;
-        updateAdvanceFunctionPointers();
-    } else
-        m_substrings.append(s);
-    m_empty = false;
-}
-
-void SegmentedString::prepend(const SegmentedSubstring& s)
-{
-    ASSERT(!escaped());
-    ASSERT(!s.numberOfCharactersConsumed());
-    if (!s.m_length)
-        return;
-
-    // FIXME: We're assuming that the prepend were originally consumed by
-    //        this SegmentedString.  We're also ASSERTing that s is a fresh
-    //        SegmentedSubstring.  These assumptions are sufficient for our
-    //        current use, but we might need to handle the more elaborate
-    //        cases in the future.
-    m_numberOfCharactersConsumedPriorToCurrentString += m_currentString.numberOfCharactersConsumed();
-    m_numberOfCharactersConsumedPriorToCurrentString -= s.m_length;
-    if (!m_currentString.m_length) {
-        m_currentString = s;
-        updateAdvanceFunctionPointers();
-    } else {
-        // Shift our m_currentString into our list.
-        m_substrings.prepend(m_currentString);
-        m_currentString = s;
-        updateAdvanceFunctionPointers();
-    }
-    m_empty = false;
-}
-
-void SegmentedString::close()
-{
-    // Closing a stream twice is likely a coding mistake.
-    ASSERT(!m_closed);
-    m_closed = true;
-}
-
-void SegmentedString::append(const SegmentedString& s)
-{
-    ASSERT(!m_closed);
-    ASSERT(!s.escaped());
-    append(s.m_currentString);
-    if (s.isComposite()) {
-        Deque<SegmentedSubstring>::const_iterator it = s.m_substrings.begin();
-        Deque<SegmentedSubstring>::const_iterator e = s.m_substrings.end();
-        for (; it != e; ++it)
-            append(*it);
-    }
-    m_currentChar = m_pushedChar1 ? m_pushedChar1 : (m_currentString.m_length ? m_currentString.getCurrentChar() : 0);
-}
-
-void SegmentedString::prepend(const SegmentedString& s)
-{
-    ASSERT(!escaped());
-    ASSERT(!s.escaped());
-    if (s.isComposite()) {
-        Deque<SegmentedSubstring>::const_reverse_iterator it = s.m_substrings.rbegin();
-        Deque<SegmentedSubstring>::const_reverse_iterator e = s.m_substrings.rend();
-        for (; it != e; ++it)
-            prepend(*it);
-    }
-    prepend(s.m_currentString);
-    m_currentChar = m_pushedChar1 ? m_pushedChar1 : (m_currentString.m_length ? m_currentString.getCurrentChar() : 0);
-}
-
-void SegmentedString::advanceSubstring()
-{
-    if (isComposite()) {
-        m_numberOfCharactersConsumedPriorToCurrentString += m_currentString.numberOfCharactersConsumed();
-        m_currentString = m_substrings.takeFirst();
-        // If we've previously consumed some characters of the non-current
-        // string, we now account for those characters as part of the current
-        // string, not as part of "prior to current string."
-        m_numberOfCharactersConsumedPriorToCurrentString -= m_currentString.numberOfCharactersConsumed();
-        updateAdvanceFunctionPointers();
-    } else {
-        m_currentString.clear();
-        m_empty = true;
-        m_fastPathFlags = NoFastPath;
-        m_advanceFunc = &SegmentedString::advanceEmpty;
-        m_advanceAndUpdateLineNumberFunc = &SegmentedString::advanceEmpty;
-    }
-}
-
-String SegmentedString::toString() const
-{
-    StringBuilder result;
-    if (m_pushedChar1) {
-        result.append(m_pushedChar1);
-        if (m_pushedChar2)
-            result.append(m_pushedChar2);
-    }
-    m_currentString.appendTo(result);
-    if (isComposite()) {
-        Deque<SegmentedSubstring>::const_iterator it = m_substrings.begin();
-        Deque<SegmentedSubstring>::const_iterator e = m_substrings.end();
-        for (; it != e; ++it)
-            it->appendTo(result);
-    }
-    return result.toString();
-}
-
-void SegmentedString::advance(unsigned count, UChar* consumedCharacters)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(count <= length());
-    for (unsigned i = 0; i < count; ++i) {
-        consumedCharacters[i] = currentChar();
-        advance();
-    }
-}
-
-void SegmentedString::advance8()
-{
-    ASSERT(!m_pushedChar1);
-    decrementAndCheckLength();
-    m_currentChar = m_currentString.incrementAndGetCurrentChar8();
-}
-
-void SegmentedString::advance16()
-{
-    ASSERT(!m_pushedChar1);
-    decrementAndCheckLength();
-    m_currentChar = m_currentString.incrementAndGetCurrentChar16();
-}
-
-void SegmentedString::advanceAndUpdateLineNumber8()
-{
-    ASSERT(!m_pushedChar1);
-    ASSERT(m_currentString.getCurrentChar() == m_currentChar);
-    if (m_currentChar == '\n') {
-        ++m_currentLine;
-        m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed() + 1;
-    }
-    decrementAndCheckLength();
-    m_currentChar = m_currentString.incrementAndGetCurrentChar8();
-}
-
-void SegmentedString::advanceAndUpdateLineNumber16()
-{
-    ASSERT(!m_pushedChar1);
-    ASSERT(m_currentString.getCurrentChar() == m_currentChar);
-    if (m_currentChar == '\n') {
-        ++m_currentLine;
-        m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed() + 1;
-    }
-    decrementAndCheckLength();
-    m_currentChar = m_currentString.incrementAndGetCurrentChar16();
-}
-
-void SegmentedString::advanceSlowCase()
-{
-    if (m_pushedChar1) {
-        m_pushedChar1 = m_pushedChar2;
-        m_pushedChar2 = 0;
-
-        if (m_pushedChar1) {
-            m_currentChar = m_pushedChar1;
-            return;
-        }
-
-        updateAdvanceFunctionPointers();
-    } else if (m_currentString.m_length) {
-        if (--m_currentString.m_length == 0)
-            advanceSubstring();
-    } else if (!isComposite()) {
-        m_currentString.clear();
-        m_empty = true;
-        m_fastPathFlags = NoFastPath;
-        m_advanceFunc = &SegmentedString::advanceEmpty;
-        m_advanceAndUpdateLineNumberFunc = &SegmentedString::advanceEmpty;
-    }
-    m_currentChar = m_currentString.m_length ? m_currentString.getCurrentChar() : 0;
-}
-
-void SegmentedString::advanceAndUpdateLineNumberSlowCase()
-{
-    if (m_pushedChar1) {
-        m_pushedChar1 = m_pushedChar2;
-        m_pushedChar2 = 0;
-
-        if (m_pushedChar1) {
-            m_currentChar = m_pushedChar1;
-            return;
-        }
-
-        updateAdvanceFunctionPointers();
-    } else if (m_currentString.m_length) {
-        if (m_currentString.getCurrentChar() == '\n' && m_currentString.doNotExcludeLineNumbers()) {
-            ++m_currentLine;
-            // Plus 1 because numberOfCharactersConsumed value hasn't incremented yet; it does with m_length decrement below.
-            m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed() + 1;
-        }
-        if (--m_currentString.m_length == 0)
-            advanceSubstring();
-        else
-            m_currentString.incrementAndGetCurrentChar(); // Only need the ++
-    } else if (!isComposite()) {
-        m_currentString.clear();
-        m_empty = true;
-        m_fastPathFlags = NoFastPath;
-        m_advanceFunc = &SegmentedString::advanceEmpty;
-        m_advanceAndUpdateLineNumberFunc = &SegmentedString::advanceEmpty;
-    }
-
-    m_currentChar = m_currentString.m_length ? m_currentString.getCurrentChar() : 0;
-}
-
-void SegmentedString::advanceEmpty()
-{
-    ASSERT(!m_currentString.m_length && !isComposite());
-    m_currentChar = 0;
-}
-
-void SegmentedString::updateSlowCaseFunctionPointers()
-{
-    m_fastPathFlags = NoFastPath;
-    m_advanceFunc = &SegmentedString::advanceSlowCase;
-    m_advanceAndUpdateLineNumberFunc = &SegmentedString::advanceAndUpdateLineNumberSlowCase;
-}
-
-OrdinalNumber SegmentedString::currentLine() const
-{
-    return OrdinalNumber::fromZeroBasedInt(m_currentLine);
-}
-
-OrdinalNumber SegmentedString::currentColumn() const
-{
-    int zeroBasedColumn = numberOfCharactersConsumed() - m_numberOfCharactersConsumedPriorToCurrentLine;
-    return OrdinalNumber::fromZeroBasedInt(zeroBasedColumn);
-}
-
-void SegmentedString::setCurrentPosition(OrdinalNumber line, OrdinalNumber columnAftreProlog, int prologLength)
-{
-    m_currentLine = line.zeroBasedInt();
-    m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed() + prologLength - columnAftreProlog.zeroBasedInt();
-}
-
-}
diff --git a/Source/core/platform/text/SegmentedString.h b/Source/core/platform/text/SegmentedString.h
deleted file mode 100644
index 43647f0..0000000
--- a/Source/core/platform/text/SegmentedString.h
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
-    Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. 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
-    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
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef SegmentedString_h
-#define SegmentedString_h
-
-#include "wtf/Deque.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/TextPosition.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class SegmentedString;
-
-class SegmentedSubstring {
-public:
-    SegmentedSubstring()
-        : m_length(0)
-        , m_doNotExcludeLineNumbers(true)
-        , m_is8Bit(false)
-    {
-        m_data.string16Ptr = 0;
-    }
-
-    SegmentedSubstring(const String& str)
-        : m_length(str.length())
-        , m_doNotExcludeLineNumbers(true)
-        , m_string(str)
-    {
-        if (m_length) {
-            if (m_string.is8Bit()) {
-                m_is8Bit = true;
-                m_data.string8Ptr = m_string.characters8();
-            } else {
-                m_is8Bit = false;
-                m_data.string16Ptr = m_string.characters16();
-            }
-        } else
-            m_is8Bit = false;
-    }
-
-    void clear() { m_length = 0; m_data.string16Ptr = 0; m_is8Bit = false;}
-
-    bool is8Bit() { return m_is8Bit; }
-
-    bool excludeLineNumbers() const { return !m_doNotExcludeLineNumbers; }
-    bool doNotExcludeLineNumbers() const { return m_doNotExcludeLineNumbers; }
-
-    void setExcludeLineNumbers() { m_doNotExcludeLineNumbers = false; }
-
-    int numberOfCharactersConsumed() const { return m_string.length() - m_length; }
-
-    void appendTo(StringBuilder& builder) const
-    {
-        int offset = m_string.length() - m_length;
-
-        if (!offset) {
-            if (m_length)
-                builder.append(m_string);
-        } else
-            builder.append(m_string.substring(offset, m_length));
-    }
-
-    UChar getCurrentChar8()
-    {
-        return *m_data.string8Ptr;
-    }
-
-    UChar getCurrentChar16()
-    {
-        return m_data.string16Ptr ? *m_data.string16Ptr : 0;
-    }
-
-    UChar incrementAndGetCurrentChar8()
-    {
-        ASSERT(m_data.string8Ptr);
-        return *++m_data.string8Ptr;
-    }
-
-    UChar incrementAndGetCurrentChar16()
-    {
-        ASSERT(m_data.string16Ptr);
-        return *++m_data.string16Ptr;
-    }
-
-    String currentSubString(unsigned length)
-    {
-        int offset = m_string.length() - m_length;
-        return m_string.substring(offset, length);
-    }
-
-    ALWAYS_INLINE UChar getCurrentChar()
-    {
-        ASSERT(m_length);
-        if (is8Bit())
-            return getCurrentChar8();
-        return getCurrentChar16();
-    }
-
-    ALWAYS_INLINE UChar incrementAndGetCurrentChar()
-    {
-        ASSERT(m_length);
-        if (is8Bit())
-            return incrementAndGetCurrentChar8();
-        return incrementAndGetCurrentChar16();
-    }
-
-public:
-    union {
-        const LChar* string8Ptr;
-        const UChar* string16Ptr;
-    } m_data;
-    int m_length;
-
-private:
-    bool m_doNotExcludeLineNumbers;
-    bool m_is8Bit;
-    String m_string;
-};
-
-class SegmentedString {
-public:
-    SegmentedString()
-        : m_pushedChar1(0)
-        , m_pushedChar2(0)
-        , m_currentChar(0)
-        , m_numberOfCharactersConsumedPriorToCurrentString(0)
-        , m_numberOfCharactersConsumedPriorToCurrentLine(0)
-        , m_currentLine(0)
-        , m_closed(false)
-        , m_empty(true)
-        , m_fastPathFlags(NoFastPath)
-        , m_advanceFunc(&SegmentedString::advanceEmpty)
-        , m_advanceAndUpdateLineNumberFunc(&SegmentedString::advanceEmpty)
-    {
-    }
-
-    SegmentedString(const String& str)
-        : m_pushedChar1(0)
-        , m_pushedChar2(0)
-        , m_currentString(str)
-        , m_currentChar(0)
-        , m_numberOfCharactersConsumedPriorToCurrentString(0)
-        , m_numberOfCharactersConsumedPriorToCurrentLine(0)
-        , m_currentLine(0)
-        , m_closed(false)
-        , m_empty(!str.length())
-        , m_fastPathFlags(NoFastPath)
-    {
-        if (m_currentString.m_length)
-            m_currentChar = m_currentString.getCurrentChar();
-        updateAdvanceFunctionPointers();
-    }
-
-    SegmentedString(const SegmentedString&);
-
-    const SegmentedString& operator=(const SegmentedString&);
-
-    void clear();
-    void close();
-
-    void append(const SegmentedString&);
-    void prepend(const SegmentedString&);
-
-    bool excludeLineNumbers() const { return m_currentString.excludeLineNumbers(); }
-    void setExcludeLineNumbers();
-
-    void push(UChar c)
-    {
-        if (!m_pushedChar1) {
-            m_pushedChar1 = c;
-            m_currentChar = m_pushedChar1 ? m_pushedChar1 : m_currentString.getCurrentChar();
-            updateSlowCaseFunctionPointers();
-        } else {
-            ASSERT(!m_pushedChar2);
-            m_pushedChar2 = c;
-        }
-    }
-
-    bool isEmpty() const { return m_empty; }
-    unsigned length() const;
-
-    bool isClosed() const { return m_closed; }
-
-    enum LookAheadResult {
-        DidNotMatch,
-        DidMatch,
-        NotEnoughCharacters,
-    };
-
-    LookAheadResult lookAhead(const String& string) { return lookAheadInline(string, true); }
-    LookAheadResult lookAheadIgnoringCase(const String& string) { return lookAheadInline(string, false); }
-
-    void advance()
-    {
-        if (m_fastPathFlags & Use8BitAdvance) {
-            ASSERT(!m_pushedChar1);
-            bool haveOneCharacterLeft = (--m_currentString.m_length == 1);
-            m_currentChar = m_currentString.incrementAndGetCurrentChar8();
-
-            if (!haveOneCharacterLeft)
-                return;
-
-            updateSlowCaseFunctionPointers();
-
-            return;
-        }
-
-        (this->*m_advanceFunc)();
-    }
-
-    inline void advanceAndUpdateLineNumber()
-    {
-        if (m_fastPathFlags & Use8BitAdvance) {
-            ASSERT(!m_pushedChar1);
-
-            bool haveNewLine = (m_currentChar == '\n') & !!(m_fastPathFlags & Use8BitAdvanceAndUpdateLineNumbers);
-            bool haveOneCharacterLeft = (--m_currentString.m_length == 1);
-
-            m_currentChar = m_currentString.incrementAndGetCurrentChar8();
-
-            if (!(haveNewLine | haveOneCharacterLeft))
-                return;
-
-            if (haveNewLine) {
-                ++m_currentLine;
-                m_numberOfCharactersConsumedPriorToCurrentLine =  m_numberOfCharactersConsumedPriorToCurrentString + m_currentString.numberOfCharactersConsumed();
-            }
-
-            if (haveOneCharacterLeft)
-                updateSlowCaseFunctionPointers();
-
-            return;
-        }
-
-        (this->*m_advanceAndUpdateLineNumberFunc)();
-    }
-
-    void advanceAndASSERT(UChar expectedCharacter)
-    {
-        ASSERT_UNUSED(expectedCharacter, currentChar() == expectedCharacter);
-        advance();
-    }
-
-    void advanceAndASSERTIgnoringCase(UChar expectedCharacter)
-    {
-        ASSERT_UNUSED(expectedCharacter, WTF::Unicode::foldCase(currentChar()) == WTF::Unicode::foldCase(expectedCharacter));
-        advance();
-    }
-
-    void advancePastNonNewline()
-    {
-        ASSERT(currentChar() != '\n');
-        advance();
-    }
-
-    void advancePastNewlineAndUpdateLineNumber()
-    {
-        ASSERT(currentChar() == '\n');
-        if (!m_pushedChar1 && m_currentString.m_length > 1) {
-            int newLineFlag = m_currentString.doNotExcludeLineNumbers();
-            m_currentLine += newLineFlag;
-            if (newLineFlag)
-                m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed() + 1;
-            decrementAndCheckLength();
-            m_currentChar = m_currentString.incrementAndGetCurrentChar();
-            return;
-        }
-        advanceAndUpdateLineNumberSlowCase();
-    }
-
-    // Writes the consumed characters into consumedCharacters, which must
-    // have space for at least |count| characters.
-    void advance(unsigned count, UChar* consumedCharacters);
-
-    bool escaped() const { return m_pushedChar1; }
-
-    int numberOfCharactersConsumed() const
-    {
-        int numberOfPushedCharacters = 0;
-        if (m_pushedChar1) {
-            ++numberOfPushedCharacters;
-            if (m_pushedChar2)
-                ++numberOfPushedCharacters;
-        }
-        return m_numberOfCharactersConsumedPriorToCurrentString + m_currentString.numberOfCharactersConsumed() - numberOfPushedCharacters;
-    }
-
-    String toString() const;
-
-    UChar currentChar() const { return m_currentChar; }
-
-    // The method is moderately slow, comparing to currentLine method.
-    OrdinalNumber currentColumn() const;
-    OrdinalNumber currentLine() const;
-    // Sets value of line/column variables. Column is specified indirectly by a parameter columnAftreProlog
-    // which is a value of column that we should get after a prolog (first prologLength characters) has been consumed.
-    void setCurrentPosition(OrdinalNumber line, OrdinalNumber columnAftreProlog, int prologLength);
-
-private:
-    enum FastPathFlags {
-        NoFastPath = 0,
-        Use8BitAdvanceAndUpdateLineNumbers = 1 << 0,
-        Use8BitAdvance = 1 << 1,
-    };
-
-    void append(const SegmentedSubstring&);
-    void prepend(const SegmentedSubstring&);
-
-    void advance8();
-    void advance16();
-    void advanceAndUpdateLineNumber8();
-    void advanceAndUpdateLineNumber16();
-    void advanceSlowCase();
-    void advanceAndUpdateLineNumberSlowCase();
-    void advanceEmpty();
-    void advanceSubstring();
-
-    void updateSlowCaseFunctionPointers();
-
-    void decrementAndCheckLength()
-    {
-        ASSERT(m_currentString.m_length > 1);
-        if (--m_currentString.m_length == 1)
-            updateSlowCaseFunctionPointers();
-    }
-
-    void updateAdvanceFunctionPointers()
-    {
-        if ((m_currentString.m_length > 1) && !m_pushedChar1) {
-            if (m_currentString.is8Bit()) {
-                m_advanceFunc = &SegmentedString::advance8;
-                m_fastPathFlags = Use8BitAdvance;
-                if (m_currentString.doNotExcludeLineNumbers()) {
-                    m_advanceAndUpdateLineNumberFunc = &SegmentedString::advanceAndUpdateLineNumber8;
-                    m_fastPathFlags |= Use8BitAdvanceAndUpdateLineNumbers;
-                } else
-                    m_advanceAndUpdateLineNumberFunc = &SegmentedString::advance8;
-                return;
-            }
-
-            m_advanceFunc = &SegmentedString::advance16;
-            m_fastPathFlags = NoFastPath;
-            if (m_currentString.doNotExcludeLineNumbers())
-                m_advanceAndUpdateLineNumberFunc = &SegmentedString::advanceAndUpdateLineNumber16;
-            else
-                m_advanceAndUpdateLineNumberFunc = &SegmentedString::advance16;
-            return;
-        }
-
-        if (!m_currentString.m_length && !isComposite()) {
-            m_advanceFunc = &SegmentedString::advanceEmpty;
-            m_fastPathFlags = NoFastPath;
-            m_advanceAndUpdateLineNumberFunc = &SegmentedString::advanceEmpty;
-        }
-
-        updateSlowCaseFunctionPointers();
-    }
-
-    inline LookAheadResult lookAheadInline(const String& string, bool caseSensitive)
-    {
-        if (!m_pushedChar1 && string.length() <= static_cast<unsigned>(m_currentString.m_length)) {
-            String currentSubstring = m_currentString.currentSubString(string.length());
-            if (currentSubstring.startsWith(string, caseSensitive))
-                return DidMatch;
-            return DidNotMatch;
-        }
-        return lookAheadSlowCase(string, caseSensitive);
-    }
-
-    LookAheadResult lookAheadSlowCase(const String& string, bool caseSensitive)
-    {
-        unsigned count = string.length();
-        if (count > length())
-            return NotEnoughCharacters;
-        UChar* consumedCharacters;
-        String consumedString = String::createUninitialized(count, consumedCharacters);
-        advance(count, consumedCharacters);
-        LookAheadResult result = DidNotMatch;
-        if (consumedString.startsWith(string, caseSensitive))
-            result = DidMatch;
-        prepend(SegmentedString(consumedString));
-        return result;
-    }
-
-    bool isComposite() const { return !m_substrings.isEmpty(); }
-
-    UChar m_pushedChar1;
-    UChar m_pushedChar2;
-    SegmentedSubstring m_currentString;
-    UChar m_currentChar;
-    int m_numberOfCharactersConsumedPriorToCurrentString;
-    int m_numberOfCharactersConsumedPriorToCurrentLine;
-    int m_currentLine;
-    Deque<SegmentedSubstring> m_substrings;
-    bool m_closed;
-    bool m_empty;
-    unsigned char m_fastPathFlags;
-    void (SegmentedString::*m_advanceFunc)();
-    void (SegmentedString::*m_advanceAndUpdateLineNumberFunc)();
-};
-
-}
-
-#endif
diff --git a/Source/core/platform/text/SuffixTree.h b/Source/core/platform/text/SuffixTree.h
deleted file mode 100644
index cad0a9f..0000000
--- a/Source/core/platform/text/SuffixTree.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2010 Adam Barth. 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 COMPUTER, 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 SuffixTree_h
-#define SuffixTree_h
-
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class UnicodeCodebook {
-public:
-    static int codeWord(UChar c) { return c; }
-    enum { codeSize = 1 << 8 * sizeof(UChar) };
-};
-
-class ASCIICodebook {
-public:
-    static int codeWord(UChar c) { return c & (codeSize - 1); }
-    enum { codeSize = 1 << (8 * sizeof(char) - 1) };
-};
-
-template<typename Codebook>
-class SuffixTree {
-public:
-    SuffixTree(const String& text, unsigned depth)
-        : m_depth(depth)
-        , m_leaf(true)
-    {
-        build(text);
-    }
-
-    bool mightContain(const String& query)
-    {
-        Node* current = &m_root;
-        int limit = std::min(m_depth, query.length());
-        for (int i = 0; i < limit; ++i) {
-            current = current->at(Codebook::codeWord(query[i]));
-            if (!current)
-                return false;
-        }
-        return true;
-    }
-
-private:
-    class Node {
-    public:
-        Node(bool isLeaf = false)
-        {
-            m_children.resize(Codebook::codeSize);
-            m_children.fill(0);
-            m_isLeaf = isLeaf;
-        }
-
-        ~Node()
-        {
-            for (unsigned i = 0; i < m_children.size(); ++i) {
-                Node* child = m_children.at(i);
-                if (child && !child->m_isLeaf)
-                    delete child;
-            }
-        }
-
-        Node*& at(int codeWord) { return m_children.at(codeWord); }
-
-    private:
-        typedef Vector<Node*, Codebook::codeSize> ChildrenVector;
-
-        ChildrenVector m_children;
-        bool m_isLeaf;
-    };
-
-    void build(const String& text)
-    {
-        for (unsigned base = 0; base < text.length(); ++base) {
-            Node* current = &m_root;
-            unsigned limit = std::min(base + m_depth, text.length());
-            for (unsigned offset = 0; base + offset < limit; ++offset) {
-                ASSERT(current != &m_leaf);
-                Node*& child = current->at(Codebook::codeWord(text[base + offset]));
-                if (!child)
-                    child = base + offset + 1 == limit ? &m_leaf : new Node();
-                current = child;
-            }
-        }
-    }
-
-    Node m_root;
-    unsigned m_depth;
-
-    // Instead of allocating a fresh empty leaf node for ever leaf in the tree
-    // (there can be a lot of these), we alias all the leaves to this "static"
-    // leaf node.
-    Node m_leaf;
-};
-
-} // namespace WebCore
-
-#endif // SuffixTree_h
diff --git a/Source/core/platform/text/TextBoundaries.cpp b/Source/core/platform/text/TextBoundaries.cpp
deleted file mode 100644
index df638b6..0000000
--- a/Source/core/platform/text/TextBoundaries.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Dominik Röttsches <dominik.roettsches@access-company.com>
- *
- * 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,
- * 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/text/TextBoundaries.h"
-
-#include "core/platform/text/TextBreakIterator.h"
-#include "wtf/text/StringImpl.h"
-#include "wtf/unicode/Unicode.h"
-
-using namespace WTF;
-using namespace Unicode;
-
-namespace WebCore {
-
-int endOfFirstWordBoundaryContext(const UChar* characters, int length)
-{
-    for (int i = 0; i < length; ) {
-        int first = i;
-        UChar32 ch;
-        U16_NEXT(characters, i, length, ch);
-        if (!requiresContextForWordBoundary(ch))
-            return first;
-    }
-    return length;
-}
-
-int startOfLastWordBoundaryContext(const UChar* characters, int length)
-{
-    for (int i = length; i > 0; ) {
-        int last = i;
-        UChar32 ch;
-        U16_PREV(characters, 0, i, ch);
-        if (!requiresContextForWordBoundary(ch))
-            return last;
-    }
-    return 0;
-}
-
-int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward)
-{
-    TextBreakIterator* it = wordBreakIterator(chars, len);
-
-    if (forward) {
-        position = textBreakFollowing(it, position);
-        while (position != TextBreakDone) {
-            // We stop searching when the character preceeding the break
-            // is alphanumeric.
-            if (position < len && isAlphanumeric(chars[position - 1]))
-                return position;
-
-            position = textBreakFollowing(it, position);
-        }
-
-        return len;
-    } else {
-        position = textBreakPreceding(it, position);
-        while (position != TextBreakDone) {
-            // We stop searching when the character following the break
-            // is alphanumeric.
-            if (position > 0 && isAlphanumeric(chars[position]))
-                return position;
-
-            position = textBreakPreceding(it, position);
-        }
-
-        return 0;
-    }
-}
-
-void findWordBoundary(const UChar* chars, int len, int position, int* start, int* end)
-{
-    TextBreakIterator* it = wordBreakIterator(chars, len);
-    *end = textBreakFollowing(it, position);
-    if (*end < 0)
-        *end = textBreakLast(it);
-    *start = textBreakPrevious(it);
-}
-
-
-} // namespace WebCore
diff --git a/Source/core/platform/text/TextBoundaries.h b/Source/core/platform/text/TextBoundaries.h
deleted file mode 100644
index 81613e5..0000000
--- a/Source/core/platform/text/TextBoundaries.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2004, 2006 Apple Computer, 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,
- * 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 TextBoundaries_h
-#define TextBoundaries_h
-
-#include "wtf/unicode/Unicode.h"
-
-namespace WebCore {
-
-    inline bool requiresContextForWordBoundary(UChar32 ch)
-    {
-        return WTF::Unicode::hasLineBreakingPropertyComplexContext(ch);
-    }
-
-    int endOfFirstWordBoundaryContext(const UChar* characters, int length);
-    int startOfLastWordBoundaryContext(const UChar* characters, int length);
-
-    void findWordBoundary(const UChar*, int len, int position, int* start, int* end);
-    int findNextWordFromIndex(const UChar*, int len, int position, bool forward);
-
-}
-
-#endif
diff --git a/Source/core/platform/text/TextBreakIterator.cpp b/Source/core/platform/text/TextBreakIterator.cpp
deleted file mode 100644
index 9af8c5c..0000000
--- a/Source/core/platform/text/TextBreakIterator.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * (C) 1999 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2007-2009 Torch Mobile, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/platform/text/TextBreakIterator.h"
-
-namespace WebCore {
-
-unsigned numGraphemeClusters(const String& string)
-{
-    unsigned stringLength = string.length();
-
-    if (!stringLength)
-        return 0;
-
-    // The only Latin-1 Extended Grapheme Cluster is CR LF
-    if (string.is8Bit() && !string.contains('\r'))
-        return stringLength;
-
-    NonSharedCharacterBreakIterator it(string);
-    if (!it)
-        return stringLength;
-
-    unsigned num = 0;
-    while (it.next() != TextBreakDone)
-        ++num;
-    return num;
-}
-
-unsigned numCharactersInGraphemeClusters(const String& string, unsigned numGraphemeClusters)
-{
-    unsigned stringLength = string.length();
-
-    if (!stringLength)
-        return 0;
-
-    // The only Latin-1 Extended Grapheme Cluster is CR LF
-    if (string.is8Bit() && !string.contains('\r'))
-        return std::min(stringLength, numGraphemeClusters);
-
-    NonSharedCharacterBreakIterator it(string);
-    if (!it)
-        return std::min(stringLength, numGraphemeClusters);
-
-    for (unsigned i = 0; i < numGraphemeClusters; ++i) {
-        if (it.next() == TextBreakDone)
-            return stringLength;
-    }
-    return it.current();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/text/TextBreakIterator.h b/Source/core/platform/text/TextBreakIterator.h
deleted file mode 100644
index d6de559..0000000
--- a/Source/core/platform/text/TextBreakIterator.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (C) 2006 Lars Knoll <lars@trolltech.com>
- * Copyright (C) 2007, 2011, 2012 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef TextBreakIterator_h
-#define TextBreakIterator_h
-
-#include "wtf/text/AtomicString.h"
-#include "wtf/unicode/Unicode.h"
-
-namespace WebCore {
-
-class TextBreakIterator;
-
-// Note: The returned iterator is good only until you get another iterator, with the exception of acquireLineBreakIterator.
-
-// This is similar to character break iterator in most cases, but is subject to
-// platform UI conventions. One notable example where this can be different
-// from character break iterator is Thai prepend characters, see bug 24342.
-// Use this for insertion point and selection manipulations.
-TextBreakIterator* cursorMovementIterator(const UChar*, int length);
-
-TextBreakIterator* wordBreakIterator(const String&, int start, int length);
-TextBreakIterator* wordBreakIterator(const UChar*, int length);
-TextBreakIterator* acquireLineBreakIterator(const LChar*, int length, const AtomicString& locale, const UChar* priorContext, unsigned priorContextLength);
-TextBreakIterator* acquireLineBreakIterator(const UChar*, int length, const AtomicString& locale, const UChar* priorContext, unsigned priorContextLength);
-void releaseLineBreakIterator(TextBreakIterator*);
-TextBreakIterator* sentenceBreakIterator(const UChar*, int length);
-
-int textBreakFirst(TextBreakIterator*);
-int textBreakLast(TextBreakIterator*);
-int textBreakNext(TextBreakIterator*);
-int textBreakPrevious(TextBreakIterator*);
-int textBreakCurrent(TextBreakIterator*);
-int textBreakPreceding(TextBreakIterator*, int);
-int textBreakFollowing(TextBreakIterator*, int);
-bool isTextBreak(TextBreakIterator*, int);
-bool isWordTextBreak(TextBreakIterator*);
-
-const int TextBreakDone = -1;
-
-class LazyLineBreakIterator {
-public:
-    LazyLineBreakIterator()
-        : m_iterator(0)
-        , m_cachedPriorContext(0)
-        , m_cachedPriorContextLength(0)
-    {
-        resetPriorContext();
-    }
-
-    LazyLineBreakIterator(String string, const AtomicString& locale = AtomicString())
-        : m_string(string)
-        , m_locale(locale)
-        , m_iterator(0)
-        , m_cachedPriorContext(0)
-        , m_cachedPriorContextLength(0)
-    {
-        resetPriorContext();
-    }
-
-    ~LazyLineBreakIterator()
-    {
-        if (m_iterator)
-            releaseLineBreakIterator(m_iterator);
-    }
-
-    String string() const { return m_string; }
-
-    UChar lastCharacter() const
-    {
-        COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);
-        return m_priorContext[1];
-    }
-
-    UChar secondToLastCharacter() const
-    {
-        COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);
-        return m_priorContext[0];
-    }
-
-    void setPriorContext(UChar last, UChar secondToLast)
-    {
-        COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);
-        m_priorContext[0] = secondToLast;
-        m_priorContext[1] = last;
-    }
-
-    void updatePriorContext(UChar last)
-    {
-        COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);
-        m_priorContext[0] = m_priorContext[1];
-        m_priorContext[1] = last;
-    }
-
-    void resetPriorContext()
-    {
-        COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);
-        m_priorContext[0] = 0;
-        m_priorContext[1] = 0;
-    }
-
-    unsigned priorContextLength() const
-    {
-        unsigned priorContextLength = 0;
-        COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);
-        if (m_priorContext[1]) {
-            ++priorContextLength;
-            if (m_priorContext[0])
-                ++priorContextLength;
-        }
-        return priorContextLength;
-    }
-
-    // Obtain text break iterator, possibly previously cached, where this iterator is (or has been)
-    // initialized to use the previously stored string as the primary breaking context and using
-    // previously stored prior context if non-empty.
-    TextBreakIterator* get(unsigned priorContextLength)
-    {
-        ASSERT(priorContextLength <= priorContextCapacity);
-        const UChar* priorContext = priorContextLength ? &m_priorContext[priorContextCapacity - priorContextLength] : 0;
-        if (!m_iterator) {
-            if (m_string.is8Bit())
-                m_iterator = acquireLineBreakIterator(m_string.characters8(), m_string.length(), m_locale, priorContext, priorContextLength);
-            else
-                m_iterator = acquireLineBreakIterator(m_string.characters16(), m_string.length(), m_locale, priorContext, priorContextLength);
-            m_cachedPriorContext = priorContext;
-            m_cachedPriorContextLength = priorContextLength;
-        } else if (priorContext != m_cachedPriorContext || priorContextLength != m_cachedPriorContextLength) {
-            this->resetStringAndReleaseIterator(m_string, m_locale);
-            return this->get(priorContextLength);
-        }
-        return m_iterator;
-    }
-
-    void resetStringAndReleaseIterator(String string, const AtomicString& locale)
-    {
-        if (m_iterator)
-            releaseLineBreakIterator(m_iterator);
-
-        m_string = string;
-        m_locale = locale;
-        m_iterator = 0;
-        m_cachedPriorContext = 0;
-        m_cachedPriorContextLength = 0;
-    }
-
-private:
-    static const unsigned priorContextCapacity = 2;
-    String m_string;
-    AtomicString m_locale;
-    TextBreakIterator* m_iterator;
-    UChar m_priorContext[priorContextCapacity];
-    const UChar* m_cachedPriorContext;
-    unsigned m_cachedPriorContextLength;
-};
-
-// Iterates over "extended grapheme clusters", as defined in UAX #29.
-// Note that platform implementations may be less sophisticated - e.g. ICU prior to
-// version 4.0 only supports "legacy grapheme clusters".
-// Use this for general text processing, e.g. string truncation.
-
-class NonSharedCharacterBreakIterator {
-    WTF_MAKE_NONCOPYABLE(NonSharedCharacterBreakIterator);
-public:
-    explicit NonSharedCharacterBreakIterator(const String&);
-    NonSharedCharacterBreakIterator(const UChar*, unsigned length);
-    ~NonSharedCharacterBreakIterator();
-
-    int next();
-    int current();
-
-    bool isBreak(int offset) const;
-    int preceding(int offset) const;
-    int following(int offset) const;
-
-    bool operator!() const
-    {
-        return !m_is8Bit && !m_iterator;
-    }
-
-private:
-    void createIteratorForBuffer(const UChar*, unsigned length);
-
-    unsigned clusterLengthStartingAt(unsigned offset) const
-    {
-        ASSERT(m_is8Bit);
-        // The only Latin-1 Extended Grapheme Cluster is CR LF
-        return isCRBeforeLF(offset) ? 2 : 1;
-    }
-
-    bool isCRBeforeLF(unsigned offset) const
-    {
-        ASSERT(m_is8Bit);
-        return m_charaters8[offset] == '\r' && offset + 1 < m_length && m_charaters8[offset + 1] == '\n';
-    }
-
-    bool isLFAfterCR(unsigned offset) const
-    {
-        ASSERT(m_is8Bit);
-        return m_charaters8[offset] == '\n' && offset >= 1 && m_charaters8[offset - 1] == '\r';
-    }
-
-    bool m_is8Bit;
-
-    // For 8 bit strings, we implement the iterator ourselves.
-    const LChar* m_charaters8;
-    unsigned m_offset;
-    unsigned m_length;
-
-    // For 16 bit strings, we use a TextBreakIterator.
-    TextBreakIterator* m_iterator;
-};
-
-// Counts the number of grapheme clusters. A surrogate pair or a sequence
-// of a non-combining character and following combining characters is
-// counted as 1 grapheme cluster.
-unsigned numGraphemeClusters(const String&);
-// Returns the number of characters which will be less than or equal to
-// the specified grapheme cluster length.
-unsigned numCharactersInGraphemeClusters(const String&, unsigned);
-
-}
-
-#endif
diff --git a/Source/core/platform/text/TextBreakIteratorICU.cpp b/Source/core/platform/text/TextBreakIteratorICU.cpp
deleted file mode 100644
index e70b19f..0000000
--- a/Source/core/platform/text/TextBreakIteratorICU.cpp
+++ /dev/null
@@ -1,829 +0,0 @@
-/*
- * Copyright (C) 2006 Lars Knoll <lars@trolltech.com>
- * Copyright (C) 2007, 2011, 2012 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "core/platform/text/TextBreakIterator.h"
-
-#include "core/platform/text/LineBreakIteratorPoolICU.h"
-#include "wtf/ThreadingPrimitives.h"
-#include "wtf/text/WTFString.h"
-
-using namespace WTF;
-using namespace std;
-
-namespace WebCore {
-
-static TextBreakIterator* ensureIterator(bool& createdIterator, TextBreakIterator*& iterator, UBreakIteratorType type)
-{
-    if (!createdIterator) {
-        UErrorCode openStatus = U_ZERO_ERROR;
-        iterator = reinterpret_cast<TextBreakIterator*>(ubrk_open(type, currentTextBreakLocaleID(), 0, 0, &openStatus));
-        createdIterator = true;
-        ASSERT_WITH_MESSAGE(U_SUCCESS(openStatus), "ICU could not open a break iterator: %s (%d)", u_errorName(openStatus), openStatus);
-    }
-    return iterator;
-}
-
-enum TextContext { NoContext, PriorContext, PrimaryContext };
-
-const int textBufferCapacity = 16;
-
-typedef struct {
-    UText text;
-    UChar buffer[textBufferCapacity];
-} UTextWithBuffer;
-
-static inline int64_t textPinIndex(int64_t& index, int64_t limit)
-{
-    if (index < 0)
-        index = 0;
-    else if (index > limit)
-        index = limit;
-    return index;
-}
-
-static inline int64_t textNativeLength(UText* text)
-{
-    return text->a + text->b;
-}
-
-// Relocate pointer from source into destination as required.
-static void textFixPointer(const UText* source, UText* destination, const void*& pointer)
-{
-    if (pointer >= source->pExtra && pointer < static_cast<char*>(source->pExtra) + source->extraSize) {
-        // Pointer references source extra buffer.
-        pointer = static_cast<char*>(destination->pExtra) + (static_cast<const char*>(pointer) - static_cast<const char*>(source->pExtra));
-    } else if (pointer >= source && pointer < reinterpret_cast<const char*>(source) + source->sizeOfStruct) {
-        // Pointer references source text structure, but not source extra buffer.
-        pointer = reinterpret_cast<char*>(destination) + (static_cast<const char*>(pointer) - reinterpret_cast<const char*>(source));
-    }
-}
-
-static UText* textClone(UText* destination, const UText* source, UBool deep, UErrorCode* status)
-{
-    ASSERT_UNUSED(deep, !deep);
-    if (U_FAILURE(*status))
-        return 0;
-    int32_t extraSize = source->extraSize;
-    destination = utext_setup(destination, extraSize, status);
-    if (U_FAILURE(*status))
-        return destination;
-    void* extraNew = destination->pExtra;
-    int32_t flags = destination->flags;
-    int sizeToCopy = min(source->sizeOfStruct, destination->sizeOfStruct);
-    memcpy(destination, source, sizeToCopy);
-    destination->pExtra = extraNew;
-    destination->flags = flags;
-    memcpy(destination->pExtra, source->pExtra, extraSize);
-    textFixPointer(source, destination, destination->context);
-    textFixPointer(source, destination, destination->p);
-    textFixPointer(source, destination, destination->q);
-    ASSERT(!destination->r);
-    const void * chunkContents = static_cast<const void*>(destination->chunkContents);
-    textFixPointer(source, destination, chunkContents);
-    destination->chunkContents = static_cast<const UChar*>(chunkContents);
-    return destination;
-}
-
-static int32_t textExtract(UText* text, int64_t start, int64_t limit, UChar* destination, int32_t destinationCapacity, UErrorCode* errorCode)
-{
-    UNUSED_PARAM(text);
-    UNUSED_PARAM(start);
-    UNUSED_PARAM(limit);
-    UNUSED_PARAM(destination);
-    UNUSED_PARAM(destinationCapacity);
-    // In the present context, this text provider is used only with ICU functions
-    // that do not perform an extract operation.
-    ASSERT_NOT_REACHED();
-    *errorCode = U_UNSUPPORTED_ERROR;
-    return 0;
-}
-
-static void textClose(UText* text)
-{
-    text->context = 0;
-}
-
-static inline TextContext textGetContext(const UText* text, int64_t nativeIndex, UBool forward)
-{
-    if (!text->b || nativeIndex > text->b)
-        return PrimaryContext;
-    if (nativeIndex == text->b)
-        return forward ? PrimaryContext : PriorContext;
-    return PriorContext;
-}
-
-static inline TextContext textLatin1GetCurrentContext(const UText* text)
-{
-    if (!text->chunkContents)
-        return NoContext;
-    return text->chunkContents == text->pExtra ? PrimaryContext : PriorContext;
-}
-
-static void textLatin1MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(text->chunkContents == text->pExtra);
-    if (forward) {
-        ASSERT(nativeIndex >= text->b && nativeIndex < nativeLength);
-        text->chunkNativeStart = nativeIndex;
-        text->chunkNativeLimit = nativeIndex + text->extraSize / sizeof(UChar);
-        if (text->chunkNativeLimit > nativeLength)
-            text->chunkNativeLimit = nativeLength;
-    } else {
-        ASSERT(nativeIndex > text->b && nativeIndex <= nativeLength);
-        text->chunkNativeLimit = nativeIndex;
-        text->chunkNativeStart = nativeIndex - text->extraSize / sizeof(UChar);
-        if (text->chunkNativeStart < text->b)
-            text->chunkNativeStart = text->b;
-    }
-    int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
-    // Ensure chunk length is well defined if computed length exceeds int32_t range.
-    ASSERT(length <= numeric_limits<int32_t>::max());
-    text->chunkLength = length <= numeric_limits<int32_t>::max() ? static_cast<int32_t>(length) : 0;
-    text->nativeIndexingLimit = text->chunkLength;
-    text->chunkOffset = forward ? 0 : text->chunkLength;
-    StringImpl::copyChars(const_cast<UChar*>(text->chunkContents), static_cast<const LChar*>(text->p) + (text->chunkNativeStart - text->b), static_cast<unsigned>(text->chunkLength));
-}
-
-static void textLatin1SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(!text->chunkContents || text->chunkContents == text->q);
-    text->chunkContents = static_cast<const UChar*>(text->pExtra);
-    textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
-}
-
-static void textLatin1MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(text->chunkContents == text->q);
-    ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
-    ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
-    ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
-    text->chunkNativeStart = 0;
-    text->chunkNativeLimit = text->b;
-    text->chunkLength = text->b;
-    text->nativeIndexingLimit = text->chunkLength;
-    int64_t offset = nativeIndex - text->chunkNativeStart;
-    // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
-    ASSERT(offset <= numeric_limits<int32_t>::max());
-    text->chunkOffset = min(offset <= numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
-}
-
-static void textLatin1SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(!text->chunkContents || text->chunkContents == text->pExtra);
-    text->chunkContents = static_cast<const UChar*>(text->q);
-    textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward);
-}
-
-static inline bool textInChunkOrOutOfRange(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward, UBool& isAccessible)
-{
-    if (forward) {
-        if (nativeIndex >= text->chunkNativeStart && nativeIndex < text->chunkNativeLimit) {
-            int64_t offset = nativeIndex - text->chunkNativeStart;
-            // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
-            ASSERT(offset <= numeric_limits<int32_t>::max());
-            text->chunkOffset = offset <= numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0;
-            isAccessible = TRUE;
-            return true;
-        }
-        if (nativeIndex >= nativeLength && text->chunkNativeLimit == nativeLength) {
-            text->chunkOffset = text->chunkLength;
-            isAccessible = FALSE;
-            return true;
-        }
-    } else {
-        if (nativeIndex > text->chunkNativeStart && nativeIndex <= text->chunkNativeLimit) {
-            int64_t offset = nativeIndex - text->chunkNativeStart;
-            // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
-            ASSERT(offset <= numeric_limits<int32_t>::max());
-            text->chunkOffset = offset <= numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0;
-            isAccessible = TRUE;
-            return true;
-        }
-        if (nativeIndex <= 0 && !text->chunkNativeStart) {
-            text->chunkOffset = 0;
-            isAccessible = FALSE;
-            return true;
-        }
-    }
-    return false;
-}
-
-static UBool textLatin1Access(UText* text, int64_t nativeIndex, UBool forward)
-{
-    if (!text->context)
-        return FALSE;
-    int64_t nativeLength = textNativeLength(text);
-    UBool isAccessible;
-    if (textInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
-        return isAccessible;
-    nativeIndex = textPinIndex(nativeIndex, nativeLength - 1);
-    TextContext currentContext = textLatin1GetCurrentContext(text);
-    TextContext newContext = textGetContext(text, nativeIndex, forward);
-    ASSERT(newContext != NoContext);
-    if (newContext == currentContext) {
-        if (currentContext == PrimaryContext) {
-            textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
-        } else {
-            textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward);
-        }
-    } else if (newContext == PrimaryContext) {
-        textLatin1SwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
-    } else {
-        ASSERT(newContext == PriorContext);
-        textLatin1SwitchToPriorContext(text, nativeIndex, nativeLength, forward);
-    }
-    return TRUE;
-}
-
-static const struct UTextFuncs textLatin1Funcs = {
-    sizeof(UTextFuncs),
-    0, 0, 0,
-    textClone,
-    textNativeLength,
-    textLatin1Access,
-    textExtract,
-    0, 0, 0, 0,
-    textClose,
-    0, 0, 0,
-};
-
-static void textInit(UText* text, const UTextFuncs* funcs, const void* string, unsigned length, const UChar* priorContext, int priorContextLength)
-{
-    text->pFuncs = funcs;
-    text->providerProperties = 1 << UTEXT_PROVIDER_STABLE_CHUNKS;
-    text->context = string;
-    text->p = string;
-    text->a = length;
-    text->q = priorContext;
-    text->b = priorContextLength;
-}
-
-static UText* textOpenLatin1(UTextWithBuffer* utWithBuffer, const LChar* string, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode* status)
-{
-    if (U_FAILURE(*status))
-        return 0;
-
-    if (!string || length > static_cast<unsigned>(numeric_limits<int32_t>::max())) {
-        *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return 0;
-    }
-    UText* text = utext_setup(&utWithBuffer->text, sizeof(utWithBuffer->buffer), status);
-    if (U_FAILURE(*status)) {
-        ASSERT(!text);
-        return 0;
-    }
-    textInit(text, &textLatin1Funcs, string, length, priorContext, priorContextLength);
-    return text;
-}
-
-static inline TextContext textUTF16GetCurrentContext(const UText* text)
-{
-    if (!text->chunkContents)
-        return NoContext;
-    return text->chunkContents == text->p ? PrimaryContext : PriorContext;
-}
-
-static void textUTF16MoveInPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(text->chunkContents == text->p);
-    ASSERT_UNUSED(forward, forward ? nativeIndex >= text->b : nativeIndex > text->b);
-    ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
-    text->chunkNativeStart = text->b;
-    text->chunkNativeLimit = nativeLength;
-    int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
-    // Ensure chunk length is well defined if computed length exceeds int32_t range.
-    ASSERT(length <= numeric_limits<int32_t>::max());
-    text->chunkLength = length <= numeric_limits<int32_t>::max() ? static_cast<int32_t>(length) : 0;
-    text->nativeIndexingLimit = text->chunkLength;
-    int64_t offset = nativeIndex - text->chunkNativeStart;
-    // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
-    ASSERT(offset <= numeric_limits<int32_t>::max());
-    text->chunkOffset = min(offset <= numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
-}
-
-static void textUTF16SwitchToPrimaryContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(!text->chunkContents || text->chunkContents == text->q);
-    text->chunkContents = static_cast<const UChar*>(text->p);
-    textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
-}
-
-static void textUTF16MoveInPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(text->chunkContents == text->q);
-    ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
-    ASSERT_UNUSED(nativeLength, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
-    ASSERT_UNUSED(forward, forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
-    text->chunkNativeStart = 0;
-    text->chunkNativeLimit = text->b;
-    text->chunkLength = text->b;
-    text->nativeIndexingLimit = text->chunkLength;
-    int64_t offset = nativeIndex - text->chunkNativeStart;
-    // Ensure chunk offset is well defined if computed offset exceeds int32_t range or chunk length.
-    ASSERT(offset <= numeric_limits<int32_t>::max());
-    text->chunkOffset = min(offset <= numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0, text->chunkLength);
-}
-
-static void textUTF16SwitchToPriorContext(UText* text, int64_t nativeIndex, int64_t nativeLength, UBool forward)
-{
-    ASSERT(!text->chunkContents || text->chunkContents == text->p);
-    text->chunkContents = static_cast<const UChar*>(text->q);
-    textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward);
-}
-
-static UBool textUTF16Access(UText* text, int64_t nativeIndex, UBool forward)
-{
-    if (!text->context)
-        return FALSE;
-    int64_t nativeLength = textNativeLength(text);
-    UBool isAccessible;
-    if (textInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
-        return isAccessible;
-    nativeIndex = textPinIndex(nativeIndex, nativeLength - 1);
-    TextContext currentContext = textUTF16GetCurrentContext(text);
-    TextContext newContext = textGetContext(text, nativeIndex, forward);
-    ASSERT(newContext != NoContext);
-    if (newContext == currentContext) {
-        if (currentContext == PrimaryContext) {
-            textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
-        } else {
-            textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward);
-        }
-    } else if (newContext == PrimaryContext) {
-        textUTF16SwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
-    } else {
-        ASSERT(newContext == PriorContext);
-        textUTF16SwitchToPriorContext(text, nativeIndex, nativeLength, forward);
-    }
-    return TRUE;
-}
-
-static const struct UTextFuncs textUTF16Funcs = {
-    sizeof(UTextFuncs),
-    0, 0, 0,
-    textClone,
-    textNativeLength,
-    textUTF16Access,
-    textExtract,
-    0, 0, 0, 0,
-    textClose,
-    0, 0, 0,
-};
-
-static UText* textOpenUTF16(UText* text, const UChar* string, unsigned length, const UChar* priorContext, int priorContextLength, UErrorCode* status)
-{
-    if (U_FAILURE(*status))
-        return 0;
-
-    if (!string || length > static_cast<unsigned>(numeric_limits<int32_t>::max())) {
-        *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return 0;
-    }
-
-    text = utext_setup(text, 0, status);
-    if (U_FAILURE(*status)) {
-        ASSERT(!text);
-        return 0;
-    }
-    textInit(text, &textUTF16Funcs, string, length, priorContext, priorContextLength);
-    return text;
-}
-
-static UText emptyText = UTEXT_INITIALIZER;
-
-static TextBreakIterator* setUpIterator(bool& createdIterator, TextBreakIterator*& iterator, UBreakIteratorType type, const UChar* string, int length)
-{
-    if (!string)
-        return 0;
-
-    iterator = ensureIterator(createdIterator, iterator, type);
-    if (!iterator)
-        return 0;
-
-    UErrorCode setTextStatus = U_ZERO_ERROR;
-    ubrk_setText(reinterpret_cast<UBreakIterator*>(iterator), string, length, &setTextStatus);
-    if (U_FAILURE(setTextStatus))
-        return 0;
-
-    return iterator;
-}
-
-static TextBreakIterator* setUpIterator(bool& createdIterator, TextBreakIterator*& iterator, UBreakIteratorType type, const LChar* string, int length)
-{
-    if (!string)
-        return 0;
-
-    iterator = ensureIterator(createdIterator, iterator, type);
-    if (!iterator)
-        return 0;
-
-    UTextWithBuffer textLocal;
-    textLocal.text = emptyText;
-    textLocal.text.extraSize = sizeof(textLocal.buffer);
-    textLocal.text.pExtra = textLocal.buffer;
-
-    UErrorCode openStatus = U_ZERO_ERROR;
-    UText* text = textOpenLatin1(&textLocal, string, length, 0, 0, &openStatus);
-    if (U_FAILURE(openStatus)) {
-        LOG_ERROR("textOpenLatin1 failed with status %d", openStatus);
-        return 0;
-    }
-
-    UErrorCode setTextStatus = U_ZERO_ERROR;
-    ubrk_setUText(reinterpret_cast<UBreakIterator*>(iterator), text, &setTextStatus);
-    if (U_FAILURE(setTextStatus)) {
-        LOG_ERROR("ubrk_setUText failed with status %d", setTextStatus);
-        // FIXME: Do we need to call utext_close(text) here?
-        return 0;
-    }
-
-    utext_close(text);
-
-    return iterator;
-}
-
-static TextBreakIterator* wordBreakIterator(const LChar* string, int length)
-{
-    static bool createdWordBreakIterator8 = false;
-    static TextBreakIterator* staticWordBreakIterator8;
-    return setUpIterator(createdWordBreakIterator8,
-        staticWordBreakIterator8, UBRK_WORD, string, length);
-}
-
-TextBreakIterator* wordBreakIterator(const UChar* string, int length)
-{
-    static bool createdWordBreakIterator16 = false;
-    static TextBreakIterator* staticWordBreakIterator16;
-    return setUpIterator(createdWordBreakIterator16,
-        staticWordBreakIterator16, UBRK_WORD, string, length);
-}
-
-TextBreakIterator* wordBreakIterator(const String& string, int start, int length)
-{
-    if (string.isEmpty())
-        return 0;
-    if (string.is8Bit())
-        return wordBreakIterator(string.characters8() + start, length);
-    return wordBreakIterator(string.characters16() + start, length);
-}
-
-TextBreakIterator* acquireLineBreakIterator(const LChar* string, int length, const AtomicString& locale, const UChar* priorContext, unsigned priorContextLength)
-{
-    UBreakIterator* iterator = LineBreakIteratorPool::sharedPool().take(locale);
-    if (!iterator)
-        return 0;
-
-    UTextWithBuffer textLocal;
-    textLocal.text = emptyText;
-    textLocal.text.extraSize = sizeof(textLocal.buffer);
-    textLocal.text.pExtra = textLocal.buffer;
-
-    UErrorCode openStatus = U_ZERO_ERROR;
-    UText* text = textOpenLatin1(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
-    if (U_FAILURE(openStatus)) {
-        LOG_ERROR("textOpenLatin1 failed with status %d", openStatus);
-        return 0;
-    }
-
-    UErrorCode setTextStatus = U_ZERO_ERROR;
-    ubrk_setUText(iterator, text, &setTextStatus);
-    if (U_FAILURE(setTextStatus)) {
-        // FIXME: Do we need to call utext_close(text) here?
-        LOG_ERROR("ubrk_setUText failed with status %d", setTextStatus);
-        return 0;
-    }
-
-    utext_close(text);
-
-    return reinterpret_cast<TextBreakIterator*>(iterator);
-}
-
-TextBreakIterator* acquireLineBreakIterator(const UChar* string, int length, const AtomicString& locale, const UChar* priorContext, unsigned priorContextLength)
-{
-    UBreakIterator* iterator = LineBreakIteratorPool::sharedPool().take(locale);
-    if (!iterator)
-        return 0;
-
-    UText textLocal = UTEXT_INITIALIZER;
-
-    UErrorCode openStatus = U_ZERO_ERROR;
-    UText* text = textOpenUTF16(&textLocal, string, length, priorContext, priorContextLength, &openStatus);
-    if (U_FAILURE(openStatus)) {
-        LOG_ERROR("textOpenUTF16 failed with status %d", openStatus);
-        return 0;
-    }
-
-    UErrorCode setTextStatus = U_ZERO_ERROR;
-    ubrk_setUText(iterator, text, &setTextStatus);
-    if (U_FAILURE(setTextStatus)) {
-        // FIXME: Do we need to call utext_close(text) here?
-        LOG_ERROR("ubrk_setUText failed with status %d", setTextStatus);
-        return 0;
-    }
-
-    utext_close(text);
-
-    return reinterpret_cast<TextBreakIterator*>(iterator);
-}
-
-void releaseLineBreakIterator(TextBreakIterator* iterator)
-{
-    ASSERT_ARG(iterator, iterator);
-
-    LineBreakIteratorPool::sharedPool().put(reinterpret_cast<UBreakIterator*>(iterator));
-}
-
-static TextBreakIterator* nonSharedCharacterBreakIterator;
-
-static inline bool compareAndSwapNonSharedCharacterBreakIterator(TextBreakIterator* expected, TextBreakIterator* newValue)
-{
-    DEFINE_STATIC_LOCAL(Mutex, nonSharedCharacterBreakIteratorMutex, ());
-    MutexLocker locker(nonSharedCharacterBreakIteratorMutex);
-    if (nonSharedCharacterBreakIterator != expected)
-        return false;
-    nonSharedCharacterBreakIterator = newValue;
-    return true;
-}
-
-NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const String& string)
-    : m_is8Bit(true)
-    , m_charaters8(0)
-    , m_offset(0)
-    , m_length(0)
-    , m_iterator(0)
-{
-    if (string.isEmpty())
-        return;
-
-    m_is8Bit = string.is8Bit();
-
-    if (m_is8Bit) {
-        m_charaters8 = string.characters8();
-        m_offset = 0;
-        m_length = string.length();
-        return;
-    }
-
-    createIteratorForBuffer(string.characters16(), string.length());
-}
-
-NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const UChar* buffer, unsigned length)
-    : m_is8Bit(false)
-    , m_charaters8(0)
-    , m_offset(0)
-    , m_length(0)
-    , m_iterator(0)
-{
-    createIteratorForBuffer(buffer, length);
-}
-
-void NonSharedCharacterBreakIterator::createIteratorForBuffer(const UChar* buffer, unsigned length)
-{
-    m_iterator = nonSharedCharacterBreakIterator;
-    bool createdIterator = m_iterator && compareAndSwapNonSharedCharacterBreakIterator(m_iterator, 0);
-    m_iterator = setUpIterator(createdIterator, m_iterator, UBRK_CHARACTER, buffer, length);
-}
-
-NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator()
-{
-    if (m_is8Bit)
-        return;
-    if (!compareAndSwapNonSharedCharacterBreakIterator(0, m_iterator))
-        ubrk_close(reinterpret_cast<UBreakIterator*>(m_iterator));
-}
-
-int NonSharedCharacterBreakIterator::next()
-{
-    if (!m_is8Bit)
-        return textBreakNext(m_iterator);
-
-    if (m_offset >= m_length)
-        return TextBreakDone;
-
-    m_offset += clusterLengthStartingAt(m_offset);
-    return m_offset;
-}
-
-int NonSharedCharacterBreakIterator::current()
-{
-    if (!m_is8Bit)
-        return textBreakCurrent(m_iterator);
-    return m_offset;
-}
-
-bool NonSharedCharacterBreakIterator::isBreak(int offset) const
-{
-    if (!m_is8Bit)
-        return isTextBreak(m_iterator, offset);
-    return !isLFAfterCR(offset);
-}
-
-int NonSharedCharacterBreakIterator::preceding(int offset) const
-{
-    if (!m_is8Bit)
-        return textBreakPreceding(m_iterator, offset);
-    if (offset <= 0)
-        return TextBreakDone;
-    if (isLFAfterCR(offset))
-        return offset - 2;
-    return offset - 1;
-}
-
-int NonSharedCharacterBreakIterator::following(int offset) const
-{
-    if (!m_is8Bit)
-        return textBreakFollowing(m_iterator, offset);
-    if (static_cast<unsigned>(offset) >= m_length)
-        return TextBreakDone;
-    return offset + clusterLengthStartingAt(offset);
-}
-
-TextBreakIterator* sentenceBreakIterator(const UChar* string, int length)
-{
-    static bool createdSentenceBreakIterator = false;
-    static TextBreakIterator* staticSentenceBreakIterator;
-    return setUpIterator(createdSentenceBreakIterator,
-        staticSentenceBreakIterator, UBRK_SENTENCE, string, length);
-}
-
-int textBreakFirst(TextBreakIterator* iterator)
-{
-    return ubrk_first(reinterpret_cast<UBreakIterator*>(iterator));
-}
-
-int textBreakLast(TextBreakIterator* iterator)
-{
-    return ubrk_last(reinterpret_cast<UBreakIterator*>(iterator));
-}
-
-int textBreakNext(TextBreakIterator* iterator)
-{
-    return ubrk_next(reinterpret_cast<UBreakIterator*>(iterator));
-}
-
-int textBreakPrevious(TextBreakIterator* iterator)
-{
-    return ubrk_previous(reinterpret_cast<UBreakIterator*>(iterator));
-}
-
-int textBreakPreceding(TextBreakIterator* iterator, int pos)
-{
-    return ubrk_preceding(reinterpret_cast<UBreakIterator*>(iterator), pos);
-}
-
-int textBreakFollowing(TextBreakIterator* iterator, int pos)
-{
-    return ubrk_following(reinterpret_cast<UBreakIterator*>(iterator), pos);
-}
-
-int textBreakCurrent(TextBreakIterator* iterator)
-{
-    return ubrk_current(reinterpret_cast<UBreakIterator*>(iterator));
-}
-
-bool isTextBreak(TextBreakIterator* iterator, int position)
-{
-    return ubrk_isBoundary(reinterpret_cast<UBreakIterator*>(iterator), position);
-}
-
-bool isWordTextBreak(TextBreakIterator* iterator)
-{
-    int ruleStatus = ubrk_getRuleStatus(reinterpret_cast<UBreakIterator*>(iterator));
-    return ruleStatus != UBRK_WORD_NONE;
-}
-
-static TextBreakIterator* setUpIteratorWithRules(bool& createdIterator, TextBreakIterator*& iterator,
-    const char* breakRules, const UChar* string, int length)
-{
-    if (!string)
-        return 0;
-
-    if (!createdIterator) {
-        UParseError parseStatus;
-        UErrorCode openStatus = U_ZERO_ERROR;
-        Vector<UChar> rules;
-        String(breakRules).appendTo(rules);
-        iterator = reinterpret_cast<TextBreakIterator*>(ubrk_openRules(rules.data(), rules.size(), 0, 0, &parseStatus, &openStatus));
-        createdIterator = true;
-        ASSERT_WITH_MESSAGE(U_SUCCESS(openStatus), "ICU could not open a break iterator: %s (%d)", u_errorName(openStatus), openStatus);
-    }
-    if (!iterator)
-        return 0;
-
-    UErrorCode setTextStatus = U_ZERO_ERROR;
-    ubrk_setText(reinterpret_cast<UBreakIterator*>(iterator), string, length, &setTextStatus);
-    if (U_FAILURE(setTextStatus))
-        return 0;
-
-    return iterator;
-}
-
-TextBreakIterator* cursorMovementIterator(const UChar* string, int length)
-{
-    // This rule set is based on character-break iterator rules of ICU 4.0
-    // <http://source.icu-project.org/repos/icu/icu/tags/release-4-0/source/data/brkitr/char.txt>.
-    // The major differences from the original ones are listed below:
-    // * Replaced '[\p{Grapheme_Cluster_Break = SpacingMark}]' with '[\p{General_Category = Spacing Mark} - $Extend]' for ICU 3.8 or earlier;
-    // * Removed rules that prevent a cursor from moving after prepend characters (Bug 24342);
-    // * Added rules that prevent a cursor from moving after virama signs of Indic languages except Tamil (Bug 15790), and;
-    // * Added rules that prevent a cursor from moving before Japanese half-width katakara voiced marks.
-    // * Added rules for regional indicator symbols.
-    static const char* kRules =
-        "$CR      = [\\p{Grapheme_Cluster_Break = CR}];"
-        "$LF      = [\\p{Grapheme_Cluster_Break = LF}];"
-        "$Control = [\\p{Grapheme_Cluster_Break = Control}];"
-        "$VoiceMarks = [\\uFF9E\\uFF9F];"  // Japanese half-width katakana voiced marks
-        "$Extend  = [\\p{Grapheme_Cluster_Break = Extend} $VoiceMarks - [\\u0E30 \\u0E32 \\u0E45 \\u0EB0 \\u0EB2]];"
-        "$SpacingMark = [[\\p{General_Category = Spacing Mark}] - $Extend];"
-        "$L       = [\\p{Grapheme_Cluster_Break = L}];"
-        "$V       = [\\p{Grapheme_Cluster_Break = V}];"
-        "$T       = [\\p{Grapheme_Cluster_Break = T}];"
-        "$LV      = [\\p{Grapheme_Cluster_Break = LV}];"
-        "$LVT     = [\\p{Grapheme_Cluster_Break = LVT}];"
-        "$Hin0    = [\\u0905-\\u0939];"    // Devanagari Letter A,...,Ha
-        "$HinV    = \\u094D;"              // Devanagari Sign Virama
-        "$Hin1    = [\\u0915-\\u0939];"    // Devanagari Letter Ka,...,Ha
-        "$Ben0    = [\\u0985-\\u09B9];"    // Bengali Letter A,...,Ha
-        "$BenV    = \\u09CD;"              // Bengali Sign Virama
-        "$Ben1    = [\\u0995-\\u09B9];"    // Bengali Letter Ka,...,Ha
-        "$Pan0    = [\\u0A05-\\u0A39];"    // Gurmukhi Letter A,...,Ha
-        "$PanV    = \\u0A4D;"              // Gurmukhi Sign Virama
-        "$Pan1    = [\\u0A15-\\u0A39];"    // Gurmukhi Letter Ka,...,Ha
-        "$Guj0    = [\\u0A85-\\u0AB9];"    // Gujarati Letter A,...,Ha
-        "$GujV    = \\u0ACD;"              // Gujarati Sign Virama
-        "$Guj1    = [\\u0A95-\\u0AB9];"    // Gujarati Letter Ka,...,Ha
-        "$Ori0    = [\\u0B05-\\u0B39];"    // Oriya Letter A,...,Ha
-        "$OriV    = \\u0B4D;"              // Oriya Sign Virama
-        "$Ori1    = [\\u0B15-\\u0B39];"    // Oriya Letter Ka,...,Ha
-        "$Tel0    = [\\u0C05-\\u0C39];"    // Telugu Letter A,...,Ha
-        "$TelV    = \\u0C4D;"              // Telugu Sign Virama
-        "$Tel1    = [\\u0C14-\\u0C39];"    // Telugu Letter Ka,...,Ha
-        "$Kan0    = [\\u0C85-\\u0CB9];"    // Kannada Letter A,...,Ha
-        "$KanV    = \\u0CCD;"              // Kannada Sign Virama
-        "$Kan1    = [\\u0C95-\\u0CB9];"    // Kannada Letter A,...,Ha
-        "$Mal0    = [\\u0D05-\\u0D39];"    // Malayalam Letter A,...,Ha
-        "$MalV    = \\u0D4D;"              // Malayalam Sign Virama
-        "$Mal1    = [\\u0D15-\\u0D39];"    // Malayalam Letter A,...,Ha
-        "$RI      = [\\U0001F1E6-\\U0001F1FF];" // Emoji regional indicators
-        "!!chain;"
-        "!!forward;"
-        "$CR $LF;"
-        "$L ($L | $V | $LV | $LVT);"
-        "($LV | $V) ($V | $T);"
-        "($LVT | $T) $T;"
-        "[^$Control $CR $LF] $Extend;"
-        "[^$Control $CR $LF] $SpacingMark;"
-        "$RI $RI / $RI;"
-        "$RI $RI;"
-        "$Hin0 $HinV $Hin1;"               // Devanagari Virama (forward)
-        "$Ben0 $BenV $Ben1;"               // Bengali Virama (forward)
-        "$Pan0 $PanV $Pan1;"               // Gurmukhi Virama (forward)
-        "$Guj0 $GujV $Guj1;"               // Gujarati Virama (forward)
-        "$Ori0 $OriV $Ori1;"               // Oriya Virama (forward)
-        "$Tel0 $TelV $Tel1;"               // Telugu Virama (forward)
-        "$Kan0 $KanV $Kan1;"               // Kannada Virama (forward)
-        "$Mal0 $MalV $Mal1;"               // Malayalam Virama (forward)
-        "!!reverse;"
-        "$LF $CR;"
-        "($L | $V | $LV | $LVT) $L;"
-        "($V | $T) ($LV | $V);"
-        "$T ($LVT | $T);"
-        "$Extend      [^$Control $CR $LF];"
-        "$SpacingMark [^$Control $CR $LF];"
-        "$RI $RI / $RI $RI;"
-        "$RI $RI;"
-        "$Hin1 $HinV $Hin0;"               // Devanagari Virama (backward)
-        "$Ben1 $BenV $Ben0;"               // Bengali Virama (backward)
-        "$Pan1 $PanV $Pan0;"               // Gurmukhi Virama (backward)
-        "$Guj1 $GujV $Guj0;"               // Gujarati Virama (backward)
-        "$Ori1 $OriV $Ori0;"               // Gujarati Virama (backward)
-        "$Tel1 $TelV $Tel0;"               // Telugu Virama (backward)
-        "$Kan1 $KanV $Kan0;"               // Kannada Virama (backward)
-        "$Mal1 $MalV $Mal0;"               // Malayalam Virama (backward)
-        "!!safe_reverse;"
-        "!!safe_forward;";
-    static bool createdCursorMovementIterator = false;
-    static TextBreakIterator* staticCursorMovementIterator;
-    return setUpIteratorWithRules(createdCursorMovementIterator, staticCursorMovementIterator, kRules, string, length);
-}
-
-}
diff --git a/Source/core/platform/text/TextBreakIteratorInternalICU.cpp b/Source/core/platform/text/TextBreakIteratorInternalICU.cpp
deleted file mode 100644
index e70f852..0000000
--- a/Source/core/platform/text/TextBreakIteratorInternalICU.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2008, 2009 Google Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-#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"
-
-namespace WebCore {
-
-static const char* UILanguage()
-{
-    // Chrome's UI language can be different from the OS UI language on Windows.
-    // We want to return Chrome's UI language here.
-    DEFINE_STATIC_LOCAL(CString, locale, (defaultLanguage().latin1()));
-    return locale.data();
-}
-
-const char* currentSearchLocaleID()
-{
-    return UILanguage();
-}
-
-const char* currentTextBreakLocaleID()
-{
-    return UILanguage();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/text/TextBreakIteratorInternalICU.h b/Source/core/platform/text/TextBreakIteratorInternalICU.h
deleted file mode 100644
index 68b7003..0000000
--- a/Source/core/platform/text/TextBreakIteratorInternalICU.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef TextBreakIteratorInternalICU_h
-#define TextBreakIteratorInternalICU_h
-
-// FIXME: Now that this handles locales for ICU, not just for text breaking,
-// this file and the various implementation files should be renamed.
-
-namespace WebCore {
-
-    const char* currentSearchLocaleID();
-    const char* currentTextBreakLocaleID();
-
-}
-
-#endif
diff --git a/Source/core/platform/text/TextCheckerClient.h b/Source/core/platform/text/TextCheckerClient.h
deleted file mode 100644
index 046bb8a..0000000
--- a/Source/core/platform/text/TextCheckerClient.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- * 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 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 TextCheckerClient_h
-#define TextCheckerClient_h
-
-#include "core/platform/text/TextChecking.h"
-#include "wtf/Forward.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-class TextCheckerClient {
-public:
-    virtual ~TextCheckerClient() {}
-
-    virtual bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const = 0;
-    virtual void checkSpellingOfString(const String&, int* misspellingLocation, int* misspellingLength) = 0;
-    virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) = 0;
-    virtual void checkGrammarOfString(const String&, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
-    virtual void requestCheckingOfString(PassRefPtr<TextCheckingRequest>) = 0;
-};
-
-}
-
-#endif // TextCheckerClient_h
diff --git a/Source/core/platform/text/TextChecking.h b/Source/core/platform/text/TextChecking.h
deleted file mode 100644
index a3d3f12..0000000
--- a/Source/core/platform/text/TextChecking.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * 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 TextChecking_h
-#define TextChecking_h
-
-#include "wtf/RefCounted.h"
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-enum TextCheckingType {
-    TextCheckingTypeNone        = 0,
-    TextCheckingTypeSpelling    = 1 << 1,
-    TextCheckingTypeGrammar     = 1 << 2,
-};
-
-typedef unsigned TextCheckingTypeMask;
-
-enum TextCheckingProcessType {
-    TextCheckingProcessBatch,
-    TextCheckingProcessIncremental
-};
-
-struct GrammarDetail {
-    int location;
-    int length;
-    Vector<String> guesses;
-    String userDescription;
-};
-
-struct TextCheckingResult {
-    TextCheckingType type;
-    int location;
-    int length;
-    Vector<GrammarDetail> details;
-    String replacement;
-    uint32_t hash;
-};
-
-const int unrequestedTextCheckingSequence = -1;
-
-class TextCheckingRequestData {
-    friend class SpellCheckRequest; // For access to m_sequence.
-public:
-    TextCheckingRequestData()
-        : m_sequence(unrequestedTextCheckingSequence)
-        , m_mask(TextCheckingTypeNone)
-        , m_processType(TextCheckingProcessIncremental)
-    { }
-    TextCheckingRequestData(int sequence, const String& text, TextCheckingTypeMask mask, TextCheckingProcessType processType, const Vector<uint32_t>& markers, const Vector<unsigned>& offsets)
-        : m_sequence(sequence)
-        , m_text(text)
-        , m_mask(mask)
-        , m_processType(processType)
-        , m_markers(markers)
-        , m_offsets(offsets)
-    { }
-
-    int sequence() const { return m_sequence; }
-    String text() const { return m_text; }
-    TextCheckingTypeMask mask() const { return m_mask; }
-    TextCheckingProcessType processType() const { return m_processType; }
-    const Vector<uint32_t>& markers() const { return m_markers; }
-    const Vector<unsigned>& offsets() const { return m_offsets; }
-
-private:
-    int m_sequence;
-    String m_text;
-    TextCheckingTypeMask m_mask;
-    TextCheckingProcessType m_processType;
-    Vector<uint32_t> m_markers;
-    Vector<unsigned> m_offsets;
-};
-
-class TextCheckingRequest : public RefCounted<TextCheckingRequest> {
-public:
-    virtual ~TextCheckingRequest() { }
-
-    virtual const TextCheckingRequestData& data() const = 0;
-    virtual void didSucceed(const Vector<TextCheckingResult>&) = 0;
-    virtual void didCancel() = 0;
-};
-
-}
-
-#endif // TextChecking_h
diff --git a/Source/core/platform/text/TextDirection.h b/Source/core/platform/text/TextDirection.h
deleted file mode 100644
index b8a52f7..0000000
--- a/Source/core/platform/text/TextDirection.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2003, 2006 Apple Computer, 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,
- * 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 TextDirection_h
-#define TextDirection_h
-
-namespace WebCore {
-
-enum TextDirection { RTL, LTR };
-
-inline bool isLeftToRightDirection(TextDirection direction) { return direction == LTR; }
-
-}
-
-#endif
diff --git a/Source/core/platform/text/TextEncodingDetector.h b/Source/core/platform/text/TextEncodingDetector.h
deleted file mode 100644
index b030040..0000000
--- a/Source/core/platform/text/TextEncodingDetector.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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
- * 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 TextEncodingDetector_h
-#define TextEncodingDetector_h
-
-namespace WTF{
-class TextEncoding;
-}
-
-namespace WebCore {
-
-// Given a sequence of bytes in |data| of length |len| and an optional
-// hintEncodingName, detect the most likely character encoding.
-// The way hintEncodingName is used is up to an implementation.
-// Currently, the only caller sets it to the parent frame encoding.
-bool detectTextEncoding(const char* data, size_t len,
-                        const char* hintEncodingName,
-                        WTF::TextEncoding* detectedEncoding);
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/platform/text/TextEncodingDetectorICU.cpp b/Source/core/platform/text/TextEncodingDetectorICU.cpp
deleted file mode 100644
index d0409d6..0000000
--- a/Source/core/platform/text/TextEncodingDetectorICU.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2008, 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
- * 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/text/TextEncodingDetector.h"
-
-#include "wtf/text/TextEncoding.h"
-#include <unicode/ucnv.h>
-#include <unicode/ucsdet.h>
-
-namespace WebCore {
-
-bool detectTextEncoding(const char* data, size_t len,
-                        const char* hintEncodingName,
-                        WTF::TextEncoding* detectedEncoding)
-{
-    *detectedEncoding = WTF::TextEncoding();
-    int matchesCount = 0;
-    UErrorCode status = U_ZERO_ERROR;
-    UCharsetDetector* detector = ucsdet_open(&status);
-    if (U_FAILURE(status))
-        return false;
-    ucsdet_enableInputFilter(detector, true);
-    ucsdet_setText(detector, data, static_cast<int32_t>(len), &status);
-    if (U_FAILURE(status))
-        return false;
-
-    // FIXME: A few things we can do other than improving
-    // the ICU detector itself.
-    // 1. Use ucsdet_detectAll and pick the most likely one given
-    // "the context" (parent-encoding, referrer encoding, etc).
-    // 2. 'Emulate' Firefox/IE's non-Universal detectors (e.g.
-    // Chinese, Japanese, Russian, Korean and Hebrew) by picking the
-    // encoding with a highest confidence among the detector-specific
-    // limited set of candidate encodings.
-    // Below is a partial implementation of the first part of what's outlined
-    // above.
-    const UCharsetMatch** matches = ucsdet_detectAll(detector, &matchesCount, &status);
-    if (U_FAILURE(status)) {
-        ucsdet_close(detector);
-        return false;
-    }
-
-    const char* encoding = 0;
-    if (hintEncodingName) {
-        WTF::TextEncoding hintEncoding(hintEncodingName);
-        // 10 is the minimum confidence value consistent with the codepoint
-        // allocation in a given encoding. The size of a chunk passed to
-        // us varies even for the same html file (apparently depending on
-        // the network load). When we're given a rather short chunk, we
-        // don't have a sufficiently reliable signal other than the fact that
-        // the chunk is consistent with a set of encodings. So, instead of
-        // setting an arbitrary threshold, we have to scan all the encodings
-        // consistent with the data.
-        const int32_t kThresold = 10;
-        for (int i = 0; i < matchesCount; ++i) {
-            int32_t confidence = ucsdet_getConfidence(matches[i], &status);
-            if (U_FAILURE(status)) {
-                status = U_ZERO_ERROR;
-                continue;
-            }
-            if (confidence < kThresold)
-                break;
-            const char* matchEncoding = ucsdet_getName(matches[i], &status);
-            if (U_FAILURE(status)) {
-                status = U_ZERO_ERROR;
-                continue;
-            }
-            if (WTF::TextEncoding(matchEncoding) == hintEncoding) {
-                encoding = hintEncodingName;
-                break;
-            }
-        }
-    }
-    // If no match is found so far, just pick the top match.
-    // This can happen, say, when a parent frame in EUC-JP refers to
-    // a child frame in Shift_JIS and both frames do NOT specify the encoding
-    // making us resort to auto-detection (when it IS turned on).
-    if (!encoding && matchesCount > 0)
-        encoding = ucsdet_getName(matches[0], &status);
-    if (U_SUCCESS(status)) {
-        *detectedEncoding = WTF::TextEncoding(encoding);
-        ucsdet_close(detector);
-        return true;
-    }
-    ucsdet_close(detector);
-    return false;
-}
-
-}
diff --git a/Source/core/platform/text/TextStream.cpp b/Source/core/platform/text/TextStream.cpp
deleted file mode 100644
index 7a48eab..0000000
--- a/Source/core/platform/text/TextStream.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2004, 2008, 2010 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,
- * 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/text/TextStream.h"
-
-#include "wtf/MathExtras.h"
-#include "wtf/StringExtras.h"
-#include "wtf/text/WTFString.h"
-
-using namespace std;
-
-namespace WebCore {
-
-static const size_t printBufferSize = 100; // large enough for any integer or floating point value in string format, including trailing null character
-
-static inline bool hasFractions(double val)
-{
-    static const double s_epsilon = 0.0001;
-    int ival = static_cast<int>(val);
-    double dval = static_cast<double>(ival);
-    return fabs(val - dval) > s_epsilon;
-}
-
-TextStream& TextStream::operator<<(bool b)
-{
-    return *this << (b ? "1" : "0");
-}
-
-TextStream& TextStream::operator<<(int i)
-{
-    m_text.appendNumber(i);
-    return *this;
-}
-
-TextStream& TextStream::operator<<(unsigned i)
-{
-    m_text.appendNumber(i);
-    return *this;
-}
-
-TextStream& TextStream::operator<<(long i)
-{
-    m_text.appendNumber(i);
-    return *this;
-}
-
-TextStream& TextStream::operator<<(unsigned long i)
-{
-    m_text.appendNumber(i);
-    return *this;
-}
-
-TextStream& TextStream::operator<<(long long i)
-{
-    m_text.appendNumber(i);
-    return *this;
-}
-
-TextStream& TextStream::operator<<(unsigned long long i)
-{
-    m_text.appendNumber(i);
-    return *this;
-}
-
-TextStream& TextStream::operator<<(float f)
-{
-    m_text.append(String::numberToStringFixedWidth(f, 2));
-    return *this;
-}
-
-TextStream& TextStream::operator<<(double d)
-{
-    m_text.append(String::numberToStringFixedWidth(d, 2));
-    return *this;
-}
-
-TextStream& TextStream::operator<<(const char* string)
-{
-    m_text.append(string);
-    return *this;
-}
-
-TextStream& TextStream::operator<<(const void* p)
-{
-    char buffer[printBufferSize];
-    snprintf(buffer, sizeof(buffer) - 1, "%p", p);
-    return *this << buffer;
-}
-
-TextStream& TextStream::operator<<(const String& string)
-{
-    m_text.append(string);
-    return *this;
-}
-
-TextStream& TextStream::operator<<(const FormatNumberRespectingIntegers& numberToFormat)
-{
-    if (hasFractions(numberToFormat.value))
-        return *this << numberToFormat.value;
-
-    m_text.appendNumber(static_cast<int>(numberToFormat.value));
-    return *this;
-}
-
-String TextStream::release()
-{
-    String result = m_text.toString();
-    m_text.clear();
-    return result;
-}
-
-}
diff --git a/Source/core/platform/text/TextStream.h b/Source/core/platform/text/TextStream.h
deleted file mode 100644
index fab4d9d..0000000
--- a/Source/core/platform/text/TextStream.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2004, 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 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,
- * 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 TextStream_h
-#define TextStream_h
-
-#include "wtf/Forward.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/unicode/Unicode.h"
-
-namespace WebCore {
-
-class TextStream {
-public:
-    struct FormatNumberRespectingIntegers {
-        FormatNumberRespectingIntegers(double number) : value(number) { }
-        double value;
-    };
-
-    TextStream& operator<<(bool);
-    TextStream& operator<<(int);
-    TextStream& operator<<(unsigned);
-    TextStream& operator<<(long);
-    TextStream& operator<<(unsigned long);
-    TextStream& operator<<(long long);
-    TextStream& operator<<(unsigned long long);
-    TextStream& operator<<(float);
-    TextStream& operator<<(double);
-    TextStream& operator<<(const char*);
-    TextStream& operator<<(const void*);
-    TextStream& operator<<(const String&);
-    TextStream& operator<<(const FormatNumberRespectingIntegers&);
-
-    String release();
-
-private:
-    StringBuilder m_text;
-};
-
-}
-
-#endif
diff --git a/Source/core/platform/text/UnicodeBidi.h b/Source/core/platform/text/UnicodeBidi.h
deleted file mode 100644
index 0785279..0000000
--- a/Source/core/platform/text/UnicodeBidi.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2011 Google, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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,
- * 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 UnicodeBidi_h
-#define UnicodeBidi_h
-
-namespace WebCore {
-
-enum EUnicodeBidi {
-    UBNormal,
-    Embed,
-    Override,
-    Isolate,
-    Plaintext,
-    IsolateOverride,
-};
-
-inline bool isIsolated(const EUnicodeBidi& unicodeBidi)
-{
-    return unicodeBidi == Isolate || unicodeBidi == IsolateOverride || unicodeBidi == Plaintext;
-}
-
-inline bool isOverride(EUnicodeBidi unicodeBidi)
-{
-    return unicodeBidi == Override || unicodeBidi == IsolateOverride;
-}
-
-}
-
-#endif
diff --git a/Source/core/platform/text/UnicodeRange.cpp b/Source/core/platform/text/UnicodeRange.cpp
deleted file mode 100644
index b9897f2..0000000
--- a/Source/core/platform/text/UnicodeRange.cpp
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Computer, Inc.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * 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.1 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
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#include "config.h"
-#include "core/platform/text/UnicodeRange.h"
-
-namespace WebCore {
-
-// This table depends on unicode range definitions.
-// Each item's index must correspond to a unicode range value
-// eg. x-cyrillic = LangGroupTable[cRangeCyrillic]
-static const char* gUnicodeRangeToLangGroupTable[] =
-{
-  "x-cyrillic",
-  "el",
-  "tr",
-  "he",
-  "ar",
-  "x-baltic",
-  "th",
-  "ko",
-  "ja",
-  "zh-CN",
-  "zh-TW",
-  "x-devanagari",
-  "x-tamil",
-  "x-armn",
-  "x-beng",
-  "x-cans",
-  "x-ethi",
-  "x-geor",
-  "x-gujr",
-  "x-guru",
-  "x-khmr",
-  "x-mlym"
-};
-
-/**********************************************************************
- * Unicode subranges as defined in unicode 3.0
- * x-western, x-central-euro, tr, x-baltic  -> latin
- *  0000 - 036f
- *  1e00 - 1eff
- *  2000 - 206f  (general punctuation)
- *  20a0 - 20cf  (currency symbols)
- *  2100 - 214f  (letterlike symbols)
- *  2150 - 218f  (Number Forms)
- * el         -> greek
- *  0370 - 03ff
- *  1f00 - 1fff
- * x-cyrillic -> cyrillic
- *  0400 - 04ff
- * he         -> hebrew
- *  0590 - 05ff
- * ar         -> arabic
- *  0600 - 06ff
- *  fb50 - fdff (arabic presentation forms)
- *  fe70 - feff (arabic presentation forms b)
- * th - thai
- *  0e00 - 0e7f
- * ko        -> korean
- *  ac00 - d7af  (hangul Syllables)
- *  1100 - 11ff    (jamo)
- *  3130 - 318f (hangul compatibility jamo)
- * ja
- *  3040 - 309f (hiragana)
- *  30a0 - 30ff (katakana)
- * zh-CN
- * zh-TW
- *
- * CJK
- *  3100 - 312f (bopomofo)
- *  31a0 - 31bf (bopomofo extended)
- *  3000 - 303f (CJK Symbols and Punctuation)
- *  2e80 - 2eff (CJK radicals supplement)
- *  2f00 - 2fdf (Kangxi Radicals)
- *  2ff0 - 2fff (Ideographic Description Characters)
- *  3190 - 319f (kanbun)
- *  3200 - 32ff (Enclosed CJK letters and Months)
- *  3300 - 33ff (CJK compatibility)
- *  3400 - 4dbf (CJK Unified Ideographs Extension A)
- *  4e00 - 9faf (CJK Unified Ideographs)
- *  f900 - fa5f (CJK Compatibility Ideographs)
- *  fe30 - fe4f (CJK compatibility Forms)
- *  ff00 - ffef (halfwidth and fullwidth forms)
- *
- * Armenian
- *  0530 - 058f
- * Sriac
- *  0700 - 074f
- * Thaana
- *  0780 - 07bf
- * Devanagari
- *  0900 - 097f
- * Bengali
- *  0980 - 09ff
- * Gurmukhi
- *  0a00 - 0a7f
- * Gujarati
- *  0a80 - 0aff
- * Oriya
- *  0b00 - 0b7f
- * Tamil
- *  0b80 - 0bff
- * Telugu
- *  0c00 - 0c7f
- * Kannada
- *  0c80 - 0cff
- * Malayalam
- *  0d00 - 0d7f
- * Sinhala
- *  0d80 - 0def
- * Lao
- *  0e80 - 0eff
- * Tibetan
- *  0f00 - 0fbf
- * Myanmar
- *  1000 - 109f
- * Georgian
- *  10a0 - 10ff
- * Ethiopic
- *  1200 - 137f
- * Cherokee
- *  13a0 - 13ff
- * Canadian Aboriginal Syllabics
- *  1400 - 167f
- * Ogham
- *  1680 - 169f
- * Runic
- *  16a0 - 16ff
- * Khmer
- *  1780 - 17ff
- * Mongolian
- *  1800 - 18af
- * Misc - superscripts and subscripts
- *  2070 - 209f
- * Misc - Combining Diacritical Marks for Symbols
- *  20d0 - 20ff
- * Misc - Arrows
- *  2190 - 21ff
- * Misc - Mathematical Operators
- *  2200 - 22ff
- * Misc - Miscellaneous Technical
- *  2300 - 23ff
- * Misc - Control picture
- *  2400 - 243f
- * Misc - Optical character recognition
- *  2440 - 2450
- * Misc - Enclose Alphanumerics
- *  2460 - 24ff
- * Misc - Box Drawing
- *  2500 - 257f
- * Misc - Block Elements
- *  2580 - 259f
- * Misc - Geometric Shapes
- *  25a0 - 25ff
- * Misc - Miscellaneous Symbols
- *  2600 - 267f
- * Misc - Dingbats
- *  2700 - 27bf
- * Misc - Braille Patterns
- *  2800 - 28ff
- * Yi Syllables
- *  a000 - a48f
- * Yi radicals
- *  a490 - a4cf
- * Alphabetic Presentation Forms
- *  fb00 - fb4f
- * Misc - Combining half Marks
- *  fe20 - fe2f
- * Misc - small form variants
- *  fe50 - fe6f
- * Misc - Specials
- *  fff0 - ffff
- *********************************************************************/
-
-static const unsigned cNumSubTables = 9;
-static const unsigned cSubTableSize = 16;
-
-static const unsigned char gUnicodeSubrangeTable[cNumSubTables][cSubTableSize] =
-{
-  { // table for X---
-    cRangeTableBase+1,  //u0xxx
-    cRangeTableBase+2,  //u1xxx
-    cRangeTableBase+3,  //u2xxx
-    cRangeSetCJK,       //u3xxx
-    cRangeSetCJK,       //u4xxx
-    cRangeSetCJK,       //u5xxx
-    cRangeSetCJK,       //u6xxx
-    cRangeSetCJK,       //u7xxx
-    cRangeSetCJK,       //u8xxx
-    cRangeSetCJK,       //u9xxx
-    cRangeTableBase+4,  //uaxxx
-    cRangeKorean,       //ubxxx
-    cRangeKorean,       //ucxxx
-    cRangeTableBase+5,  //udxxx
-    cRangePrivate,      //uexxx
-    cRangeTableBase+6   //ufxxx
-  },
-  { //table for 0X--
-    cRangeSetLatin,          //u00xx
-    cRangeSetLatin,          //u01xx
-    cRangeSetLatin,          //u02xx
-    cRangeGreek,             //u03xx     XXX 0300-036f is in fact cRangeCombiningDiacriticalMarks
-    cRangeCyrillic,          //u04xx
-    cRangeTableBase+7,       //u05xx, includes Cyrillic supplement, Hebrew, and Armenian
-    cRangeArabic,            //u06xx
-    cRangeTertiaryTable,     //u07xx
-    cRangeUnassigned,        //u08xx
-    cRangeTertiaryTable,     //u09xx
-    cRangeTertiaryTable,     //u0axx
-    cRangeTertiaryTable,     //u0bxx
-    cRangeTertiaryTable,     //u0cxx
-    cRangeTertiaryTable,     //u0dxx
-    cRangeTertiaryTable,     //u0exx
-    cRangeTibetan,           //u0fxx
-  },
-  { //table for 1x--
-    cRangeTertiaryTable,     //u10xx
-    cRangeKorean,            //u11xx
-    cRangeEthiopic,          //u12xx
-    cRangeTertiaryTable,     //u13xx
-    cRangeCanadian,          //u14xx
-    cRangeCanadian,          //u15xx
-    cRangeTertiaryTable,     //u16xx
-    cRangeKhmer,             //u17xx
-    cRangeMongolian,         //u18xx
-    cRangeUnassigned,        //u19xx
-    cRangeUnassigned,        //u1axx
-    cRangeUnassigned,        //u1bxx
-    cRangeUnassigned,        //u1cxx
-    cRangeUnassigned,        //u1dxx
-    cRangeSetLatin,          //u1exx
-    cRangeGreek,             //u1fxx
-  },
-  { //table for 2x--
-    cRangeSetLatin,          //u20xx
-    cRangeSetLatin,          //u21xx
-    cRangeMathOperators,     //u22xx
-    cRangeMiscTechnical,     //u23xx
-    cRangeControlOpticalEnclose, //u24xx
-    cRangeBoxBlockGeometrics, //u25xx
-    cRangeMiscSymbols,       //u26xx
-    cRangeDingbats,          //u27xx
-    cRangeBraillePattern,    //u28xx
-    cRangeUnassigned,        //u29xx
-    cRangeUnassigned,        //u2axx
-    cRangeUnassigned,        //u2bxx
-    cRangeUnassigned,        //u2cxx
-    cRangeUnassigned,        //u2dxx
-    cRangeSetCJK,            //u2exx
-    cRangeSetCJK,            //u2fxx
-  },
-  {  //table for ax--
-    cRangeYi,                //ua0xx
-    cRangeYi,                //ua1xx
-    cRangeYi,                //ua2xx
-    cRangeYi,                //ua3xx
-    cRangeYi,                //ua4xx
-    cRangeUnassigned,        //ua5xx
-    cRangeUnassigned,        //ua6xx
-    cRangeUnassigned,        //ua7xx
-    cRangeUnassigned,        //ua8xx
-    cRangeUnassigned,        //ua9xx
-    cRangeUnassigned,        //uaaxx
-    cRangeUnassigned,        //uabxx
-    cRangeKorean,            //uacxx
-    cRangeKorean,            //uadxx
-    cRangeKorean,            //uaexx
-    cRangeKorean,            //uafxx
-  },
-  {  //table for dx--
-    cRangeKorean,            //ud0xx
-    cRangeKorean,            //ud1xx
-    cRangeKorean,            //ud2xx
-    cRangeKorean,            //ud3xx
-    cRangeKorean,            //ud4xx
-    cRangeKorean,            //ud5xx
-    cRangeKorean,            //ud6xx
-    cRangeKorean,            //ud7xx
-    cRangeSurrogate,         //ud8xx
-    cRangeSurrogate,         //ud9xx
-    cRangeSurrogate,         //udaxx
-    cRangeSurrogate,         //udbxx
-    cRangeSurrogate,         //udcxx
-    cRangeSurrogate,         //uddxx
-    cRangeSurrogate,         //udexx
-    cRangeSurrogate,         //udfxx
-  },
-  { // table for fx--
-    cRangePrivate,           //uf0xx
-    cRangePrivate,           //uf1xx
-    cRangePrivate,           //uf2xx
-    cRangePrivate,           //uf3xx
-    cRangePrivate,           //uf4xx
-    cRangePrivate,           //uf5xx
-    cRangePrivate,           //uf6xx
-    cRangePrivate,           //uf7xx
-    cRangePrivate,           //uf8xx
-    cRangeSetCJK,            //uf9xx
-    cRangeSetCJK,            //ufaxx
-    cRangeArabic,            //ufbxx, includes alphabic presentation form
-    cRangeArabic,            //ufcxx
-    cRangeArabic,            //ufdxx
-    cRangeArabic,            //ufexx, includes Combining half marks,
-                             //                CJK compatibility forms,
-                             //                CJK compatibility forms,
-                             //                small form variants
-    cRangeTableBase+8,       //uffxx, halfwidth and fullwidth forms, includes Specials
-  },
-  { //table for 0x0500 - 0x05ff
-    cRangeCyrillic,          //u050x
-    cRangeCyrillic,          //u051x
-    cRangeCyrillic,          //u052x
-    cRangeArmenian,          //u053x
-    cRangeArmenian,          //u054x
-    cRangeArmenian,          //u055x
-    cRangeArmenian,          //u056x
-    cRangeArmenian,          //u057x
-    cRangeArmenian,          //u058x
-    cRangeHebrew,            //u059x
-    cRangeHebrew,            //u05ax
-    cRangeHebrew,            //u05bx
-    cRangeHebrew,            //u05cx
-    cRangeHebrew,            //u05dx
-    cRangeHebrew,            //u05ex
-    cRangeHebrew,            //u05fx
-  },
-  { //table for 0xff00 - 0xffff
-    cRangeSetCJK,            //uff0x, fullwidth latin
-    cRangeSetCJK,            //uff1x, fullwidth latin
-    cRangeSetCJK,            //uff2x, fullwidth latin
-    cRangeSetCJK,            //uff3x, fullwidth latin
-    cRangeSetCJK,            //uff4x, fullwidth latin
-    cRangeSetCJK,            //uff5x, fullwidth latin
-    cRangeSetCJK,            //uff6x, halfwidth katakana
-    cRangeSetCJK,            //uff7x, halfwidth katakana
-    cRangeSetCJK,            //uff8x, halfwidth katakana
-    cRangeSetCJK,            //uff9x, halfwidth katakana
-    cRangeSetCJK,            //uffax, halfwidth hangul jamo
-    cRangeSetCJK,            //uffbx, halfwidth hangul jamo
-    cRangeSetCJK,            //uffcx, halfwidth hangul jamo
-    cRangeSetCJK,            //uffdx, halfwidth hangul jamo
-    cRangeSetCJK,            //uffex, fullwidth symbols
-    cRangeSpecials,          //ufffx, Specials
-  },
-};
-
-// Most scripts between U+0700 and U+16FF are assigned a chunk of 128 (0x80)
-// code points so that the number of entries in the tertiary range
-// table for that range is obtained by dividing (0x1700 - 0x0700) by 128.
-// Exceptions: Ethiopic, Tibetan, Hangul Jamo and Canadian aboriginal
-// syllabaries take multiple chunks and Ogham and Runic share a single chunk.
-static const unsigned cTertiaryTableSize = ((0x1700 - 0x0700) / 0x80);
-
-static const unsigned char gUnicodeTertiaryRangeTable[cTertiaryTableSize] =
-{ //table for 0x0700 - 0x1600
-    cRangeSyriac,            //u070x
-    cRangeThaana,            //u078x
-    cRangeUnassigned,        //u080x  place holder(resolved in the 2ndary tab.)
-    cRangeUnassigned,        //u088x  place holder(resolved in the 2ndary tab.)
-    cRangeDevanagari,        //u090x
-    cRangeBengali,           //u098x
-    cRangeGurmukhi,          //u0a0x
-    cRangeGujarati,          //u0a8x
-    cRangeOriya,             //u0b0x
-    cRangeTamil,             //u0b8x
-    cRangeTelugu,            //u0c0x
-    cRangeKannada,           //u0c8x
-    cRangeMalayalam,         //u0d0x
-    cRangeSinhala,           //u0d8x
-    cRangeThai,              //u0e0x
-    cRangeLao,               //u0e8x
-    cRangeTibetan,           //u0f0x  place holder(resolved in the 2ndary tab.)
-    cRangeTibetan,           //u0f8x  place holder(resolved in the 2ndary tab.)
-    cRangeMyanmar,           //u100x
-    cRangeGeorgian,          //u108x
-    cRangeKorean,            //u110x  place holder(resolved in the 2ndary tab.)
-    cRangeKorean,            //u118x  place holder(resolved in the 2ndary tab.)
-    cRangeEthiopic,          //u120x  place holder(resolved in the 2ndary tab.)
-    cRangeEthiopic,          //u128x  place holder(resolved in the 2ndary tab.)
-    cRangeEthiopic,          //u130x
-    cRangeCherokee,          //u138x
-    cRangeCanadian,          //u140x  place holder(resolved in the 2ndary tab.)
-    cRangeCanadian,          //u148x  place holder(resolved in the 2ndary tab.)
-    cRangeCanadian,          //u150x  place holder(resolved in the 2ndary tab.)
-    cRangeCanadian,          //u158x  place holder(resolved in the 2ndary tab.)
-    cRangeCanadian,          //u160x
-    cRangeOghamRunic,        //u168x  this contains two scripts, Ogham & Runic
-};
-
-// A two level index is almost enough for locating a range, with the
-// exception of u03xx and u05xx. Since we don't really care about range for
-// combining diacritical marks in our font application, they are
-// not discriminated further.  Future adoption of this method for other use
-// should be aware of this limitation. The implementation can be extended if
-// there is such a need.
-// For Indic, Southeast Asian scripts and some other scripts between
-// U+0700 and U+16FF, it's extended to the third level.
-unsigned int findCharUnicodeRange(UChar32 ch)
-{
-    if (ch >= 0xFFFF)
-        return 0;
-
-    unsigned int range;
-
-    //search the first table
-    range = gUnicodeSubrangeTable[0][ch >> 12];
-
-    if (range < cRangeTableBase)
-        // we try to get a specific range
-        return range;
-
-    // otherwise, we have one more table to look at
-    range = gUnicodeSubrangeTable[range - cRangeTableBase][(ch & 0x0f00) >> 8];
-    if (range < cRangeTableBase)
-        return range;
-    if (range < cRangeTertiaryTable)
-        return gUnicodeSubrangeTable[range - cRangeTableBase][(ch & 0x00f0) >> 4];
-
-    // Yet another table to look at : U+0700 - U+16FF : 128 code point blocks
-    return gUnicodeTertiaryRangeTable[(ch - 0x0700) >> 7];
-}
-
-const char* langGroupFromUnicodeRange(unsigned char unicodeRange)
-{
-    if (cRangeSpecificItemNum > unicodeRange)
-        return gUnicodeRangeToLangGroupTable[unicodeRange];
-    return 0;
-}
-
-}
diff --git a/Source/core/platform/text/UnicodeRange.h b/Source/core/platform/text/UnicodeRange.h
deleted file mode 100644
index 4d06e83..0000000
--- a/Source/core/platform/text/UnicodeRange.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Computer, Inc.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * 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.1 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
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#ifndef UnicodeRange_H
-#define UnicodeRange_H
-
-#include "wtf/unicode/Unicode.h"
-
-namespace WebCore {
-
-// The following constants define unicode subranges
-// values below cRangeNum must be continuous so that we can map to
-// a lang group directly.
-// All ranges we care about should fit within 32 bits.
-
-// Frequently used range definitions
-const unsigned char   cRangeCyrillic =    0;
-const unsigned char   cRangeGreek    =    1;
-const unsigned char   cRangeTurkish  =    2;
-const unsigned char   cRangeHebrew   =    3;
-const unsigned char   cRangeArabic   =    4;
-const unsigned char   cRangeBaltic   =    5;
-const unsigned char   cRangeThai     =    6;
-const unsigned char   cRangeKorean   =    7;
-const unsigned char   cRangeJapanese =    8;
-const unsigned char   cRangeSChinese =    9;
-const unsigned char   cRangeTChinese =   10;
-const unsigned char   cRangeDevanagari = 11;
-const unsigned char   cRangeTamil    =   12;
-const unsigned char   cRangeArmenian =   13;
-const unsigned char   cRangeBengali  =   14;
-const unsigned char   cRangeCanadian =   15;
-const unsigned char   cRangeEthiopic =   16;
-const unsigned char   cRangeGeorgian =   17;
-const unsigned char   cRangeGujarati =   18;
-const unsigned char   cRangeGurmukhi =   19;
-const unsigned char   cRangeKhmer    =   20;
-const unsigned char   cRangeMalayalam =  21;
-
-const unsigned char   cRangeSpecificItemNum = 22;
-
-//range/rangeSet grow to this place 22-29
-
-const unsigned char   cRangeSetStart  =  30;    // range set definition starts from here
-const unsigned char   cRangeSetLatin  =  30;
-const unsigned char   cRangeSetCJK    =  31;
-const unsigned char   cRangeSetEnd    =  31;   // range set definition ends here
-
-// less frequently used range definition
-const unsigned char   cRangeSurrogate            = 32;
-const unsigned char   cRangePrivate              = 33;
-const unsigned char   cRangeMisc                 = 34;
-const unsigned char   cRangeUnassigned           = 35;
-const unsigned char   cRangeSyriac               = 36;
-const unsigned char   cRangeThaana               = 37;
-const unsigned char   cRangeOriya                = 38;
-const unsigned char   cRangeTelugu               = 39;
-const unsigned char   cRangeKannada              = 40;
-const unsigned char   cRangeSinhala              = 41;
-const unsigned char   cRangeLao                  = 42;
-const unsigned char   cRangeTibetan              = 43;
-const unsigned char   cRangeMyanmar              = 44;
-const unsigned char   cRangeCherokee             = 45;
-const unsigned char   cRangeOghamRunic           = 46;
-const unsigned char   cRangeMongolian            = 47;
-const unsigned char   cRangeMathOperators        = 48;
-const unsigned char   cRangeMiscTechnical        = 49;
-const unsigned char   cRangeControlOpticalEnclose = 50;
-const unsigned char   cRangeBoxBlockGeometrics   = 51;
-const unsigned char   cRangeMiscSymbols          = 52;
-const unsigned char   cRangeDingbats             = 53;
-const unsigned char   cRangeBraillePattern       = 54;
-const unsigned char   cRangeYi                   = 55;
-const unsigned char   cRangeCombiningDiacriticalMarks = 56;
-const unsigned char   cRangeSpecials             = 57;
-
-const unsigned char   cRangeTableBase   = 128;    //values over 127 are reserved for internal use only
-const unsigned char   cRangeTertiaryTable  = 145; // leave room for 16 subtable
-                                            // indices (cRangeTableBase + 1 ..
-                                            // cRangeTableBase + 16)
-
-
-
-unsigned int findCharUnicodeRange(UChar32 ch);
-const char* langGroupFromUnicodeRange(unsigned char unicodeRange);
-
-}
-
-#endif // UnicodeRange_H
diff --git a/Source/core/platform/text/WritingMode.h b/Source/core/platform/text/WritingMode.h
deleted file mode 100644
index 9e5d28c..0000000
--- a/Source/core/platform/text/WritingMode.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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:
- *
- *     * 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 WritingMode_h
-#define WritingMode_h
-
-namespace WebCore {
-
-enum WritingMode {
-    TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode, BottomToTopWritingMode
-};
-
-// Lines have horizontal orientation; modes horizontal-tb or horizontal-bt.
-inline bool isHorizontalWritingMode(WritingMode writingMode)
-{
-    return writingMode == TopToBottomWritingMode || writingMode == BottomToTopWritingMode;
-}
-
-// Bottom of the line occurs earlier in the block; modes vertical-lr or horizontal-bt.
-inline bool isFlippedLinesWritingMode(WritingMode writingMode)
-{
-    return writingMode == LeftToRightWritingMode || writingMode == BottomToTopWritingMode;
-}
-
-// Block progression increases in the opposite direction to normal; modes vertical-rl or horizontal-bt.
-inline bool isFlippedBlocksWritingMode(WritingMode writingMode)
-{
-    return writingMode == RightToLeftWritingMode || writingMode == BottomToTopWritingMode;
-}
-
-} // namespace WebCore
-
-#endif // WritingMode_h
diff --git a/Source/core/platform/text/cf/AtomicStringCF.cpp b/Source/core/platform/text/cf/AtomicStringCF.cpp
deleted file mode 100644
index 2ba3853..0000000
--- a/Source/core/platform/text/cf/AtomicStringCF.cpp
+++ /dev/null
@@ -1,56 +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.
- */
-
-#include "config.h"
-#include "wtf/text/AtomicString.h"
-
-#if USE(CF)
-
-#include <CoreFoundation/CoreFoundation.h>
-#include "wtf/text/CString.h"
-
-namespace WTF {
-
-PassRefPtr<StringImpl> AtomicString::add(CFStringRef string)
-{
-    if (!string)
-        return 0;
-
-    CFIndex length = CFStringGetLength(string);
-
-    if (const LChar* ptr = reinterpret_cast<const LChar*>(CFStringGetCStringPtr(string, kCFStringEncodingISOLatin1)))
-        return add(ptr, length);
-
-    if (const UniChar* ptr = CFStringGetCharactersPtr(string))
-        return add(reinterpret_cast<const UChar*>(ptr), length);
-
-    Vector<UniChar, 1024> ucharBuffer(length);
-    CFStringGetCharacters(string, CFRangeMake(0, length), ucharBuffer.data());
-    return add(reinterpret_cast<const UChar*>(ucharBuffer.data()), length);
-}
-
-} // namespace WTF
-
-#endif // USE(CF)
diff --git a/Source/core/platform/text/cf/StringCF.cpp b/Source/core/platform/text/cf/StringCF.cpp
deleted file mode 100644
index 2cb4ce7..0000000
--- a/Source/core/platform/text/cf/StringCF.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright (C) 2006, 2012 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-
-#include "wtf/text/WTFString.h"
-
-#if USE(CF)
-#include <CoreFoundation/CoreFoundation.h>
-#include "wtf/RetainPtr.h"
-
-namespace WTF {
-
-String::String(CFStringRef str)
-{
-    if (!str)
-        return;
-
-    CFIndex size = CFStringGetLength(str);
-    if (size == 0)
-        m_impl = StringImpl::empty();
-    else {
-        Vector<LChar, 1024> lcharBuffer(size);
-        CFIndex usedBufLen;
-        CFIndex convertedsize = CFStringGetBytes(str, CFRangeMake(0, size), kCFStringEncodingISOLatin1, 0, false, lcharBuffer.data(), size, &usedBufLen);
-        if ((convertedsize == size) && (usedBufLen == size)) {
-            m_impl = StringImpl::create(lcharBuffer.data(), size);
-            return;
-        }
-
-        Vector<UChar, 1024> buffer(size);
-        CFStringGetCharacters(str, CFRangeMake(0, size), (UniChar*)buffer.data());
-        m_impl = StringImpl::create(buffer.data(), size);
-    }
-}
-
-RetainPtr<CFStringRef> String::createCFString() const
-{
-    if (!m_impl)
-        return CFSTR("");
-
-    return m_impl->createCFString();
-}
-
-}
-
-#endif // USE(CF)
diff --git a/Source/core/platform/text/cf/StringImplCF.cpp b/Source/core/platform/text/cf/StringImplCF.cpp
deleted file mode 100644
index 2c2ed14..0000000
--- a/Source/core/platform/text/cf/StringImplCF.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (C) 2006, 2009, 2012 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "wtf/text/StringImpl.h"
-
-#if USE(CF)
-
-#include <CoreFoundation/CoreFoundation.h>
-#include "wtf/MainThread.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RetainPtr.h"
-#include "wtf/Threading.h"
-
-namespace WTF {
-
-namespace StringWrapperCFAllocator {
-
-    static StringImpl* currentString;
-
-    static const void* retain(const void* info)
-    {
-        return info;
-    }
-
-    NO_RETURN_DUE_TO_ASSERT
-    static void release(const void*)
-    {
-        ASSERT_NOT_REACHED();
-    }
-
-    static CFStringRef copyDescription(const void*)
-    {
-        return CFSTR("WTF::String-based allocator");
-    }
-
-    static void* allocate(CFIndex size, CFOptionFlags, void*)
-    {
-        StringImpl* underlyingString = 0;
-        if (isMainThread()) {
-            underlyingString = currentString;
-            if (underlyingString) {
-                currentString = 0;
-                underlyingString->ref(); // Balanced by call to deref in deallocate below.
-            }
-        }
-        StringImpl** header = static_cast<StringImpl**>(fastMalloc(sizeof(StringImpl*) + size));
-        *header = underlyingString;
-        return header + 1;
-    }
-
-    static void* reallocate(void* pointer, CFIndex newSize, CFOptionFlags, void*)
-    {
-        size_t newAllocationSize = sizeof(StringImpl*) + newSize;
-        StringImpl** header = static_cast<StringImpl**>(pointer) - 1;
-        ASSERT(!*header);
-        header = static_cast<StringImpl**>(fastRealloc(header, newAllocationSize));
-        return header + 1;
-    }
-
-    static void deallocateOnMainThread(void* headerPointer)
-    {
-        StringImpl** header = static_cast<StringImpl**>(headerPointer);
-        StringImpl* underlyingString = *header;
-        ASSERT(underlyingString);
-        underlyingString->deref(); // Balanced by call to ref in allocate above.
-        fastFree(header);
-    }
-
-    static void deallocate(void* pointer, void*)
-    {
-        StringImpl** header = static_cast<StringImpl**>(pointer) - 1;
-        StringImpl* underlyingString = *header;
-        if (!underlyingString)
-            fastFree(header);
-        else {
-            if (!isMainThread())
-                callOnMainThread(deallocateOnMainThread, header);
-            else {
-                underlyingString->deref(); // Balanced by call to ref in allocate above.
-                fastFree(header);
-            }
-        }
-    }
-
-    static CFIndex preferredSize(CFIndex size, CFOptionFlags, void*)
-    {
-        // FIXME: If FastMalloc provided a "good size" callback, we'd want to use it here.
-        // Note that this optimization would help performance for strings created with the
-        // allocator that are mutable, and those typically are only created by callers who
-        // make a new string using the old string's allocator, such as some of the call
-        // sites in CFURL.
-        return size;
-    }
-
-    static CFAllocatorRef create()
-    {
-        CFAllocatorContext context = { 0, 0, retain, release, copyDescription, allocate, reallocate, deallocate, preferredSize };
-        return CFAllocatorCreate(0, &context);
-    }
-
-    static CFAllocatorRef allocator()
-    {
-        static CFAllocatorRef allocator = create();
-        return allocator;
-    }
-
-}
-
-RetainPtr<CFStringRef> StringImpl::createCFString()
-{
-    // Since garbage collection isn't compatible with custom allocators, we
-    // can't use the NoCopy variants of CFStringCreate*() when GC is enabled.
-    if (!m_length || !isMainThread()) {
-        if (is8Bit())
-            return adoptCF(CFStringCreateWithBytes(0, reinterpret_cast<const UInt8*>(characters8()), m_length, kCFStringEncodingISOLatin1, false));
-        return adoptCF(CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(characters16()), m_length));
-    }
-    CFAllocatorRef allocator = StringWrapperCFAllocator::allocator();
-
-    // Put pointer to the StringImpl in a global so the allocator can store it with the CFString.
-    ASSERT(!StringWrapperCFAllocator::currentString);
-    StringWrapperCFAllocator::currentString = this;
-
-    CFStringRef string;
-    if (is8Bit())
-        string = CFStringCreateWithBytesNoCopy(allocator, reinterpret_cast<const UInt8*>(characters8()), m_length, kCFStringEncodingISOLatin1, false, kCFAllocatorNull);
-    else
-        string = CFStringCreateWithCharactersNoCopy(allocator, reinterpret_cast<const UniChar*>(characters16()), m_length, kCFAllocatorNull);
-    // CoreFoundation might not have to allocate anything, we clear currentString in case we did not execute allocate().
-    StringWrapperCFAllocator::currentString = 0;
-
-    return adoptCF(string);
-}
-
-// On StringImpl creation we could check if the allocator is the StringWrapperCFAllocator.
-// If it is, then we could find the original StringImpl and just return that. But to
-// do that we'd have to compute the offset from CFStringRef to the allocated block;
-// the CFStringRef is *not* at the start of an allocated block. Testing shows 1000x
-// more calls to createCFString than calls to the create functions with the appropriate
-// allocator, so it's probably not urgent optimize that case.
-
-}
-
-#endif // USE(CF)
diff --git a/Source/core/platform/text/mac/LocaleMac.h b/Source/core/platform/text/mac/LocaleMac.h
deleted file mode 100644
index 3d6055c..0000000
--- a/Source/core/platform/text/mac/LocaleMac.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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:
- *
- *     * 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 LocaleMac_h
-#define LocaleMac_h
-
-#include "core/platform/text/PlatformLocale.h"
-#include "wtf/Forward.h"
-#include "wtf/RetainPtr.h"
-#include "wtf/text/WTFString.h"
-#include "wtf/Vector.h"
-
-OBJC_CLASS NSCalendar;
-OBJC_CLASS NSDateFormatter;
-OBJC_CLASS NSLocale;
-
-namespace WebCore {
-
-class DateComponents;
-
-class LocaleMac : public Locale {
-public:
-    static PassOwnPtr<LocaleMac> create(const String&);
-    static PassOwnPtr<LocaleMac> create(NSLocale*);
-    ~LocaleMac();
-
-#if ENABLE(CALENDAR_PICKER)
-    virtual const Vector<String>& weekDayShortLabels() OVERRIDE;
-    virtual unsigned firstDayOfWeek() OVERRIDE;
-    virtual bool isRTL() OVERRIDE;
-#endif
-
-    virtual String dateFormat() OVERRIDE;
-    virtual String monthFormat() OVERRIDE;
-    virtual String shortMonthFormat() OVERRIDE;
-    virtual String timeFormat() OVERRIDE;
-    virtual String shortTimeFormat() OVERRIDE;
-    virtual String dateTimeFormatWithSeconds() OVERRIDE;
-    virtual String dateTimeFormatWithoutSeconds() OVERRIDE;
-    virtual const Vector<String>& monthLabels() OVERRIDE;
-    virtual const Vector<String>& shortMonthLabels() OVERRIDE;
-    virtual const Vector<String>& standAloneMonthLabels() OVERRIDE;
-    virtual const Vector<String>& shortStandAloneMonthLabels() OVERRIDE;
-    virtual const Vector<String>& timeAMPMLabels() OVERRIDE;
-
-private:
-    explicit LocaleMac(NSLocale*);
-    RetainPtr<NSDateFormatter> shortDateFormatter();
-    virtual void initializeLocaleData() OVERRIDE;
-
-    RetainPtr<NSLocale> m_locale;
-    RetainPtr<NSCalendar> m_gregorianCalendar;
-#if ENABLE(CALENDAR_PICKER)
-    Vector<String> m_weekDayShortLabels;
-#endif
-    Vector<String> m_monthLabels;
-    RetainPtr<NSDateFormatter> timeFormatter();
-    RetainPtr<NSDateFormatter> shortTimeFormatter();
-    RetainPtr<NSDateFormatter> dateTimeFormatterWithSeconds();
-    RetainPtr<NSDateFormatter> dateTimeFormatterWithoutSeconds();
-
-    String m_dateFormat;
-    String m_monthFormat;
-    String m_shortMonthFormat;
-    String m_timeFormatWithSeconds;
-    String m_timeFormatWithoutSeconds;
-    String m_dateTimeFormatWithSeconds;
-    String m_dateTimeFormatWithoutSeconds;
-    Vector<String> m_shortMonthLabels;
-    Vector<String> m_standAloneMonthLabels;
-    Vector<String> m_shortStandAloneMonthLabels;
-    Vector<String> m_timeAMPMLabels;
-    bool m_didInitializeNumberData;
-};
-
-} // namespace WebCore
-#endif
diff --git a/Source/core/platform/text/mac/LocaleMac.mm b/Source/core/platform/text/mac/LocaleMac.mm
deleted file mode 100644
index fdcb333..0000000
--- a/Source/core/platform/text/mac/LocaleMac.mm
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * 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:
- *
- *     * 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/text/mac/LocaleMac.h"
-
-#import <Foundation/NSDateFormatter.h>
-#import <Foundation/NSLocale.h>
-#include "core/platform/Language.h"
-#include "core/platform/LocalizedStrings.h"
-#include "wtf/DateMath.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/RetainPtr.h"
-#include "wtf/text/StringBuilder.h"
-
-using namespace std;
-
-namespace WebCore {
-
-static inline String languageFromLocale(const String& locale)
-{
-    String normalizedLocale = locale;
-    normalizedLocale.replace('-', '_');
-    size_t separatorPosition = normalizedLocale.find('_');
-    if (separatorPosition == kNotFound)
-        return normalizedLocale;
-    return normalizedLocale.left(separatorPosition);
-}
-
-static RetainPtr<NSLocale> determineLocale(const String& locale)
-{
-    RetainPtr<NSLocale> currentLocale = [NSLocale currentLocale];
-    String currentLocaleLanguage = languageFromLocale(String([currentLocale.get() localeIdentifier]));
-    String localeLanguage = languageFromLocale(locale);
-    if (equalIgnoringCase(currentLocaleLanguage, localeLanguage))
-        return currentLocale;
-    // It seems initWithLocaleIdentifier accepts dash-separated locale identifier.
-     return RetainPtr<NSLocale>(AdoptNS, [[NSLocale alloc] initWithLocaleIdentifier:locale]);
-}
-
-PassOwnPtr<Locale> Locale::create(const AtomicString& locale)
-{
-    return LocaleMac::create(determineLocale(locale.string()).get());
-}
-
-static RetainPtr<NSDateFormatter> createDateTimeFormatter(NSLocale* locale, NSCalendar* calendar, NSDateFormatterStyle dateStyle, NSDateFormatterStyle timeStyle)
-{
-    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
-    [formatter setLocale:locale];
-    [formatter setDateStyle:dateStyle];
-    [formatter setTimeStyle:timeStyle];
-    [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
-    [formatter setCalendar:calendar];
-    return adoptNS(formatter);
-}
-
-LocaleMac::LocaleMac(NSLocale* locale)
-    : m_locale(locale)
-    , m_gregorianCalendar(AdoptNS, [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar])
-    , m_didInitializeNumberData(false)
-{
-    NSArray* availableLanguages = [NSLocale ISOLanguageCodes];
-    // NSLocale returns a lower case NSLocaleLanguageCode so we don't have care about case.
-    NSString* language = [m_locale.get() objectForKey:NSLocaleLanguageCode];
-    if ([availableLanguages indexOfObject:language] == NSNotFound)
-        m_locale.adoptNS([[NSLocale alloc] initWithLocaleIdentifier:defaultLanguage()]);
-    [m_gregorianCalendar.get() setLocale:m_locale.get()];
-}
-
-LocaleMac::~LocaleMac()
-{
-}
-
-PassOwnPtr<LocaleMac> LocaleMac::create(const String& localeIdentifier)
-{
-    RetainPtr<NSLocale> locale = [[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier];
-    return adoptPtr(new LocaleMac(locale.get()));
-}
-
-PassOwnPtr<LocaleMac> LocaleMac::create(NSLocale* locale)
-{
-    return adoptPtr(new LocaleMac(locale));
-}
-
-RetainPtr<NSDateFormatter> LocaleMac::shortDateFormatter()
-{
-    return createDateTimeFormatter(m_locale.get(), m_gregorianCalendar.get(), NSDateFormatterShortStyle, NSDateFormatterNoStyle);
-}
-
-const Vector<String>& LocaleMac::monthLabels()
-{
-    if (!m_monthLabels.isEmpty())
-        return m_monthLabels;
-    m_monthLabels.reserveCapacity(12);
-    NSArray *array = [shortDateFormatter().get() monthSymbols];
-    if ([array count] == 12) {
-        for (unsigned i = 0; i < 12; ++i)
-            m_monthLabels.append(String([array objectAtIndex:i]));
-        return m_monthLabels;
-    }
-    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthFullName); ++i)
-        m_monthLabels.append(WTF::monthFullName[i]);
-    return m_monthLabels;
-}
-
-#if ENABLE(CALENDAR_PICKER)
-const Vector<String>& LocaleMac::weekDayShortLabels()
-{
-    if (!m_weekDayShortLabels.isEmpty())
-        return m_weekDayShortLabels;
-    m_weekDayShortLabels.reserveCapacity(7);
-    NSArray *array = [shortDateFormatter().get() shortWeekdaySymbols];
-    if ([array count] == 7) {
-        for (unsigned i = 0; i < 7; ++i)
-            m_weekDayShortLabels.append(String([array objectAtIndex:i]));
-        return m_weekDayShortLabels;
-    }
-    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::weekdayName); ++i) {
-        // weekdayName starts with Monday.
-        m_weekDayShortLabels.append(WTF::weekdayName[(i + 6) % 7]);
-    }
-    return m_weekDayShortLabels;
-}
-
-unsigned LocaleMac::firstDayOfWeek()
-{
-    // The document for NSCalendar - firstWeekday doesn't have an explanation of
-    // firstWeekday value. We can guess it by the document of NSDateComponents -
-    // weekDay, so it can be 1 through 7 and 1 is Sunday.
-    return [m_gregorianCalendar.get() firstWeekday] - 1;
-}
-
-bool LocaleMac::isRTL()
-{
-    return NSLocaleLanguageDirectionRightToLeft == [NSLocale characterDirectionForLanguage:[NSLocale canonicalLanguageIdentifierFromString:[m_locale.get() localeIdentifier]]];
-}
-#endif
-
-RetainPtr<NSDateFormatter> LocaleMac::timeFormatter()
-{
-    return createDateTimeFormatter(m_locale.get(), m_gregorianCalendar.get(), NSDateFormatterNoStyle, NSDateFormatterMediumStyle);
-}
-
-RetainPtr<NSDateFormatter> LocaleMac::shortTimeFormatter()
-{
-    return createDateTimeFormatter(m_locale.get(), m_gregorianCalendar.get(), NSDateFormatterNoStyle, NSDateFormatterShortStyle);
-}
-
-RetainPtr<NSDateFormatter> LocaleMac::dateTimeFormatterWithSeconds()
-{
-    return createDateTimeFormatter(m_locale.get(), m_gregorianCalendar.get(), NSDateFormatterShortStyle, NSDateFormatterMediumStyle);
-}
-
-RetainPtr<NSDateFormatter> LocaleMac::dateTimeFormatterWithoutSeconds()
-{
-    return createDateTimeFormatter(m_locale.get(), m_gregorianCalendar.get(), NSDateFormatterShortStyle, NSDateFormatterShortStyle);
-}
-
-String LocaleMac::dateFormat()
-{
-    if (!m_dateFormat.isNull())
-        return m_dateFormat;
-    m_dateFormat = [shortDateFormatter().get() dateFormat];
-    return m_dateFormat;
-}
-
-String LocaleMac::monthFormat()
-{
-    if (!m_monthFormat.isNull())
-        return m_monthFormat;
-    // Gets a format for "MMMM" because Windows API always provides formats for
-    // "MMMM" in some locales.
-    m_monthFormat = [NSDateFormatter dateFormatFromTemplate:@"yyyyMMMM" options:0 locale:m_locale.get()];
-    return m_monthFormat;
-}
-
-String LocaleMac::shortMonthFormat()
-{
-    if (!m_shortMonthFormat.isNull())
-        return m_shortMonthFormat;
-    m_shortMonthFormat = [NSDateFormatter dateFormatFromTemplate:@"yyyyMMM" options:0 locale:m_locale.get()];
-    return m_shortMonthFormat;
-}
-
-String LocaleMac::timeFormat()
-{
-    if (!m_timeFormatWithSeconds.isNull())
-        return m_timeFormatWithSeconds;
-    m_timeFormatWithSeconds = [timeFormatter().get() dateFormat];
-    return m_timeFormatWithSeconds;
-}
-
-String LocaleMac::shortTimeFormat()
-{
-    if (!m_timeFormatWithoutSeconds.isNull())
-        return m_timeFormatWithoutSeconds;
-    m_timeFormatWithoutSeconds = [shortTimeFormatter().get() dateFormat];
-    return m_timeFormatWithoutSeconds;
-}
-
-String LocaleMac::dateTimeFormatWithSeconds()
-{
-    if (!m_dateTimeFormatWithSeconds.isNull())
-        return m_dateTimeFormatWithSeconds;
-    m_dateTimeFormatWithSeconds = [dateTimeFormatterWithSeconds().get() dateFormat];
-    return m_dateTimeFormatWithSeconds;
-}
-
-String LocaleMac::dateTimeFormatWithoutSeconds()
-{
-    if (!m_dateTimeFormatWithoutSeconds.isNull())
-        return m_dateTimeFormatWithoutSeconds;
-    m_dateTimeFormatWithoutSeconds = [dateTimeFormatterWithoutSeconds().get() dateFormat];
-    return m_dateTimeFormatWithoutSeconds;
-}
-
-const Vector<String>& LocaleMac::shortMonthLabels()
-{
-    if (!m_shortMonthLabels.isEmpty())
-        return m_shortMonthLabels;
-    m_shortMonthLabels.reserveCapacity(12);
-    NSArray *array = [shortDateFormatter().get() shortMonthSymbols];
-    if ([array count] == 12) {
-        for (unsigned i = 0; i < 12; ++i)
-            m_shortMonthLabels.append([array objectAtIndex:i]);
-        return m_shortMonthLabels;
-    }
-    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthName); ++i)
-        m_shortMonthLabels.append(WTF::monthName[i]);
-    return m_shortMonthLabels;
-}
-
-const Vector<String>& LocaleMac::standAloneMonthLabels()
-{
-    if (!m_standAloneMonthLabels.isEmpty())
-        return m_standAloneMonthLabels;
-    NSArray *array = [shortDateFormatter().get() standaloneMonthSymbols];
-    if ([array count] == 12) {
-        m_standAloneMonthLabels.reserveCapacity(12);
-        for (unsigned i = 0; i < 12; ++i)
-            m_standAloneMonthLabels.append([array objectAtIndex:i]);
-        return m_standAloneMonthLabels;
-    }
-    m_standAloneMonthLabels = shortMonthLabels();
-    return m_standAloneMonthLabels;
-}
-
-const Vector<String>& LocaleMac::shortStandAloneMonthLabels()
-{
-    if (!m_shortStandAloneMonthLabels.isEmpty())
-        return m_shortStandAloneMonthLabels;
-    NSArray *array = [shortDateFormatter().get() shortStandaloneMonthSymbols];
-    if ([array count] == 12) {
-        m_shortStandAloneMonthLabels.reserveCapacity(12);
-        for (unsigned i = 0; i < 12; ++i)
-            m_shortStandAloneMonthLabels.append([array objectAtIndex:i]);
-        return m_shortStandAloneMonthLabels;
-    }
-    m_shortStandAloneMonthLabels = shortMonthLabels();
-    return m_shortStandAloneMonthLabels;
-}
-
-const Vector<String>& LocaleMac::timeAMPMLabels()
-{
-    if (!m_timeAMPMLabels.isEmpty())
-        return m_timeAMPMLabels;
-    m_timeAMPMLabels.reserveCapacity(2);
-    RetainPtr<NSDateFormatter> formatter = shortTimeFormatter();
-    m_timeAMPMLabels.append([formatter.get() AMSymbol]);
-    m_timeAMPMLabels.append([formatter.get() PMSymbol]);
-    return m_timeAMPMLabels;
-}
-
-void LocaleMac::initializeLocaleData()
-{
-    if (m_didInitializeNumberData)
-        return;
-    m_didInitializeNumberData = true;
-
-    RetainPtr<NSNumberFormatter> formatter(AdoptNS, [[NSNumberFormatter alloc] init]);
-    [formatter.get() setLocale:m_locale.get()];
-    [formatter.get() setNumberStyle:NSNumberFormatterDecimalStyle];
-    [formatter.get() setUsesGroupingSeparator:NO];
-
-    RetainPtr<NSNumber> sampleNumber(AdoptNS, [[NSNumber alloc] initWithDouble:9876543210]);
-    String nineToZero([formatter.get() stringFromNumber:sampleNumber.get()]);
-    if (nineToZero.length() != 10)
-        return;
-    Vector<String, DecimalSymbolsSize> symbols;
-    for (unsigned i = 0; i < 10; ++i)
-        symbols.append(nineToZero.substring(9 - i, 1));
-    ASSERT(symbols.size() == DecimalSeparatorIndex);
-    symbols.append([formatter.get() decimalSeparator]);
-    ASSERT(symbols.size() == GroupSeparatorIndex);
-    symbols.append([formatter.get() groupingSeparator]);
-    ASSERT(symbols.size() == DecimalSymbolsSize);
-
-    String positivePrefix([formatter.get() positivePrefix]);
-    String positiveSuffix([formatter.get() positiveSuffix]);
-    String negativePrefix([formatter.get() negativePrefix]);
-    String negativeSuffix([formatter.get() negativeSuffix]);
-    setLocaleData(symbols, positivePrefix, positiveSuffix, negativePrefix, negativeSuffix);
-}
-
-}
diff --git a/Source/core/platform/text/mac/StringImplMac.mm b/Source/core/platform/text/mac/StringImplMac.mm
deleted file mode 100644
index d563103..0000000
--- a/Source/core/platform/text/mac/StringImplMac.mm
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2006, 2009 Apple Inc. 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "wtf/text/StringImpl.h"
-
-#include "core/platform/mac/FoundationExtras.h"
-#include "wtf/RetainPtr.h"
-
-namespace WTF {
-
-StringImpl::operator NSString *()
-{
-    return HardAutorelease(createCFString().leakRef());
-}
-
-}
diff --git a/Source/core/platform/text/mac/StringMac.mm b/Source/core/platform/text/mac/StringMac.mm
deleted file mode 100644
index 046767d..0000000
--- a/Source/core/platform/text/mac/StringMac.mm
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (C) 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "wtf/text/WTFString.h"
-
-#include <CoreFoundation/CFString.h>
-
-namespace WTF {
-
-String::String(NSString* str)
-{
-    if (!str)
-        return;
-
-    CFIndex size = CFStringGetLength(reinterpret_cast<CFStringRef>(str));
-    if (size == 0)
-        m_impl = StringImpl::empty();
-    else {
-        Vector<LChar, 1024> lcharBuffer(size);
-        CFIndex usedBufLen;
-        CFIndex convertedsize = CFStringGetBytes(reinterpret_cast<CFStringRef>(str), CFRangeMake(0, size), kCFStringEncodingISOLatin1, 0, false, lcharBuffer.data(), size, &usedBufLen);
-        if ((convertedsize == size) && (usedBufLen == size)) {
-            m_impl = StringImpl::create(lcharBuffer.data(), size);
-            return;
-        }
-
-        Vector<UChar, 1024> ucharBuffer(size);
-        CFStringGetCharacters(reinterpret_cast<CFStringRef>(str), CFRangeMake(0, size), ucharBuffer.data());
-        m_impl = StringImpl::create(ucharBuffer.data(), size);
-    }
-}
-
-}
diff --git a/Source/core/platform/text/transcoder/FontTranscoder.cpp b/Source/core/platform/text/transcoder/FontTranscoder.cpp
deleted file mode 100644
index d4d0e32..0000000
--- a/Source/core/platform/text/transcoder/FontTranscoder.cpp
+++ /dev/null
@@ -1,106 +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/text/transcoder/FontTranscoder.h"
-
-#include "core/platform/graphics/FontDescription.h"
-#include "wtf/text/TextEncoding.h"
-#include "wtf/unicode/CharacterNames.h"
-
-namespace WebCore {
-
-FontTranscoder::FontTranscoder()
-{
-    m_converterTypes.add("MS PGothic", BackslashToYenSign);
-    UChar unicodeNameMSPGothic[] = {0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF};
-    m_converterTypes.add(AtomicString(unicodeNameMSPGothic, WTF_ARRAY_LENGTH(unicodeNameMSPGothic)), BackslashToYenSign);
-
-    m_converterTypes.add("MS PMincho", BackslashToYenSign);
-    UChar unicodeNameMSPMincho[] = {0xFF2D, 0xFF33, 0x0020, 0xFF30, 0x660E, 0x671D};
-    m_converterTypes.add(AtomicString(unicodeNameMSPMincho, WTF_ARRAY_LENGTH(unicodeNameMSPMincho)), BackslashToYenSign);
-
-    m_converterTypes.add("MS Gothic", BackslashToYenSign);
-    UChar unicodeNameMSGothic[] = {0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF};
-    m_converterTypes.add(AtomicString(unicodeNameMSGothic, WTF_ARRAY_LENGTH(unicodeNameMSGothic)), BackslashToYenSign);
-
-    m_converterTypes.add("MS Mincho", BackslashToYenSign);
-    UChar unicodeNameMSMincho[] = {0xFF2D, 0xFF33, 0x0020, 0x660E, 0x671D};
-    m_converterTypes.add(AtomicString(unicodeNameMSMincho, WTF_ARRAY_LENGTH(unicodeNameMSMincho)), BackslashToYenSign);
-
-    m_converterTypes.add("Meiryo", BackslashToYenSign);
-    UChar unicodeNameMeiryo[] = {0x30E1, 0x30A4, 0x30EA, 0x30AA};
-    m_converterTypes.add(AtomicString(unicodeNameMeiryo, WTF_ARRAY_LENGTH(unicodeNameMeiryo)), BackslashToYenSign);
-}
-
-FontTranscoder::ConverterType FontTranscoder::converterType(const FontDescription& fontDescription, const WTF::TextEncoding* encoding) const
-{
-    const AtomicString& fontFamily = fontDescription.family().family().string();
-    if (!fontFamily.isNull()) {
-        HashMap<AtomicString, ConverterType>::const_iterator found = m_converterTypes.find(fontFamily);
-        if (found != m_converterTypes.end())
-            return found->value;
-    }
-
-    // IE's default fonts for Japanese encodings change backslashes into yen signs.
-    // We emulate this behavior only when no font is explicitly specified.
-    if (encoding && encoding->backslashAsCurrencySymbol() != '\\' && !fontDescription.isSpecifiedFont())
-        return BackslashToYenSign;
-
-    return NoConversion;
-}
-
-void FontTranscoder::convert(String& text, const FontDescription& fontDescription, const WTF::TextEncoding* encoding) const
-{
-    switch (converterType(fontDescription, encoding)) {
-    case BackslashToYenSign: {
-        // FIXME: wtf/text/TextEncoding.h has similar code. We need to factor them out.
-        text.replace('\\', yenSign);
-        break;
-    }
-    case NoConversion:
-    default:
-        ASSERT_NOT_REACHED();
-    }
-}
-
-bool FontTranscoder::needsTranscoding(const FontDescription& fontDescription, const WTF::TextEncoding* encoding) const
-{
-    ConverterType type = converterType(fontDescription, encoding);
-    return type != NoConversion;
-}
-
-FontTranscoder& fontTranscoder()
-{
-    static FontTranscoder* transcoder = new FontTranscoder;
-    return *transcoder;
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/text/transcoder/FontTranscoder.h b/Source/core/platform/text/transcoder/FontTranscoder.h
deleted file mode 100644
index 8016336..0000000
--- a/Source/core/platform/text/transcoder/FontTranscoder.h
+++ /dev/null
@@ -1,71 +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 FontTranscoder_h
-#define FontTranscoder_h
-
-#include "wtf/HashMap.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/text/AtomicStringHash.h"
-
-namespace WTF{
-class TextEncoding;
-}
-
-namespace WebCore {
-
-class FontDescription;
-
-class FontTranscoder {
-    WTF_MAKE_NONCOPYABLE(FontTranscoder); WTF_MAKE_FAST_ALLOCATED;
-public:
-    void convert(String& text, const FontDescription&, const WTF::TextEncoding* = 0) const;
-    bool needsTranscoding(const FontDescription&, const WTF::TextEncoding* = 0) const;
-
-private:
-    FontTranscoder();
-    ~FontTranscoder(); // Not implemented to make sure nobody accidentally calls delete -- WebCore does not delete singletons.
-
-    enum ConverterType {
-        NoConversion, BackslashToYenSign,
-    };
-
-    ConverterType converterType(const FontDescription&, const WTF::TextEncoding*) const;
-
-    HashMap<AtomicString, ConverterType> m_converterTypes;
-
-    friend FontTranscoder& fontTranscoder();
-};
-
-FontTranscoder& fontTranscoder();
-
-} // namespace WebCore
-
-#endif // FontTranscoder_h
diff --git a/Source/core/platform/text/win/LocaleWin.cpp b/Source/core/platform/text/win/LocaleWin.cpp
deleted file mode 100644
index 811fd6d..0000000
--- a/Source/core/platform/text/win/LocaleWin.cpp
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- * 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:
- *
- *     * 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/text/win/LocaleWin.h"
-
-#include <windows.h>
-#include <limits>
-#include "core/platform/DateComponents.h"
-#include "core/platform/Language.h"
-#include "core/platform/LayoutTestSupport.h"
-#include "core/platform/LocalizedStrings.h"
-#include "core/platform/text/DateTimeFormat.h"
-#include "wtf/CurrentTime.h"
-#include "wtf/DateMath.h"
-#include "wtf/HashMap.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/text/StringBuffer.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/StringHash.h"
-
-using namespace std;
-
-namespace WebCore {
-
-typedef LCID (WINAPI* LocaleNameToLCIDPtr)(LPCWSTR, DWORD);
-typedef HashMap<String, LCID> NameToLCIDMap;
-
-static String extractLanguageCode(const String& locale)
-{
-    size_t dashPosition = locale.find('-');
-    if (dashPosition == kNotFound)
-        return locale;
-    return locale.left(dashPosition);
-}
-
-static String removeLastComponent(const String& name)
-{
-    size_t lastSeparator = name.reverseFind('-');
-    if (lastSeparator == kNotFound)
-        return emptyString();
-    return name.left(lastSeparator);
-}
-
-static void ensureNameToLCIDMap(NameToLCIDMap& map)
-{
-    if (!map.isEmpty())
-        return;
-    // http://www.microsoft.com/resources/msdn/goglobal/default.mspx
-    // We add only locales used in layout tests for now.
-    map.add("ar", 0x0001);
-    map.add("ar-eg", 0x0C01);
-    map.add("de", 0x0007);
-    map.add("de-de", 0x0407);
-    map.add("el", 0x0008);
-    map.add("el-gr", 0x0408);
-    map.add("en", 0x0009);
-    map.add("en-gb", 0x0809);
-    map.add("en-us", 0x0409);
-    map.add("fr", 0x000C);
-    map.add("fr-fr", 0x040C);
-    map.add("he", 0x000D);
-    map.add("he-il", 0x040D);
-    map.add("hi", 0x0039);
-    map.add("hi-in", 0x0439);
-    map.add("ja", 0x0011);
-    map.add("ja-jp", 0x0411);
-    map.add("ko", 0x0012);
-    map.add("ko-kr", 0x0412);
-    map.add("ru", 0x0019);
-    map.add("ru-ru", 0x0419);
-    map.add("zh-cn", 0x0804);
-    map.add("zh-tw", 0x0404);
-}
-
-// Fallback implementation of LocaleNameToLCID API. This is used for
-// testing on Windows XP.
-// FIXME: Remove this, ensureNameToLCIDMap, and removeLastComponent when we drop
-// Windows XP support.
-static LCID WINAPI convertLocaleNameToLCID(LPCWSTR name, DWORD)
-{
-    if (!name || !name[0])
-        return LOCALE_USER_DEFAULT;
-    DEFINE_STATIC_LOCAL(NameToLCIDMap, map, ());
-    ensureNameToLCIDMap(map);
-    String localeName = String(name).replace('_', '-');
-    localeName.makeLower();
-    do {
-        NameToLCIDMap::const_iterator iterator = map.find(localeName);
-        if (iterator != map.end())
-            return iterator->value;
-        localeName = removeLastComponent(localeName);
-    } while (!localeName.isEmpty());
-    return LOCALE_USER_DEFAULT;
-}
-
-static LCID LCIDFromLocaleInternal(LCID userDefaultLCID, const String& userDefaultLanguageCode, LocaleNameToLCIDPtr localeNameToLCID, String& locale)
-{
-    String localeLanguageCode = extractLanguageCode(locale);
-    if (equalIgnoringCase(localeLanguageCode, userDefaultLanguageCode))
-        return userDefaultLCID;
-    return localeNameToLCID(locale.charactersWithNullTermination().data(), 0);
-}
-
-static LCID LCIDFromLocale(const AtomicString& locale, bool defaultsForLocale)
-{
-    // LocaleNameToLCID() is available since Windows Vista.
-    LocaleNameToLCIDPtr localeNameToLCID = reinterpret_cast<LocaleNameToLCIDPtr>(::GetProcAddress(::GetModuleHandle(L"kernel32"), "LocaleNameToLCID"));
-    if (!localeNameToLCID)
-        localeNameToLCID = convertLocaleNameToLCID;
-
-    // According to MSDN, 9 is enough for LOCALE_SISO639LANGNAME.
-    const size_t languageCodeBufferSize = 9;
-    WCHAR lowercaseLanguageCode[languageCodeBufferSize];
-    ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME | (defaultsForLocale ? LOCALE_NOUSEROVERRIDE : 0), lowercaseLanguageCode, languageCodeBufferSize);
-    String userDefaultLanguageCode = String(lowercaseLanguageCode);
-
-    LCID lcid = LCIDFromLocaleInternal(LOCALE_USER_DEFAULT, userDefaultLanguageCode, localeNameToLCID, String(locale));
-    if (!lcid)
-        lcid = LCIDFromLocaleInternal(LOCALE_USER_DEFAULT, userDefaultLanguageCode, localeNameToLCID, defaultLanguage());
-    return lcid;
-}
-
-PassOwnPtr<Locale> Locale::create(const AtomicString& locale)
-{
-    // Whether the default settings for the locale should be used, ignoring user overrides.
-    bool defaultsForLocale = isRunningLayoutTest();
-    return LocaleWin::create(LCIDFromLocale(locale, defaultsForLocale), defaultsForLocale);
-}
-
-inline LocaleWin::LocaleWin(LCID lcid, bool defaultsForLocale)
-    : m_lcid(lcid)
-    , m_didInitializeNumberData(false)
-    , m_defaultsForLocale(defaultsForLocale)
-{
-#if ENABLE(CALENDAR_PICKER)
-    DWORD value = 0;
-    getLocaleInfo(LOCALE_IFIRSTDAYOFWEEK | (defaultsForLocale ? LOCALE_NOUSEROVERRIDE : 0), value);
-    // 0:Monday, ..., 6:Sunday.
-    // We need 1 for Monday, 0 for Sunday.
-    m_firstDayOfWeek = (value + 1) % 7;
-#endif
-}
-
-PassOwnPtr<LocaleWin> LocaleWin::create(LCID lcid, bool defaultsForLocale)
-{
-    return adoptPtr(new LocaleWin(lcid, defaultsForLocale));
-}
-
-LocaleWin::~LocaleWin()
-{
-}
-
-String LocaleWin::getLocaleInfoString(LCTYPE type)
-{
-    int bufferSizeWithNUL = ::GetLocaleInfo(m_lcid, type | (m_defaultsForLocale ? LOCALE_NOUSEROVERRIDE : 0), 0, 0);
-    if (bufferSizeWithNUL <= 0)
-        return String();
-    StringBuffer<UChar> buffer(bufferSizeWithNUL);
-    ::GetLocaleInfo(m_lcid, type | (m_defaultsForLocale ? LOCALE_NOUSEROVERRIDE : 0), buffer.characters(), bufferSizeWithNUL);
-    buffer.shrink(bufferSizeWithNUL - 1);
-    return String::adopt(buffer);
-}
-
-void LocaleWin::getLocaleInfo(LCTYPE type, DWORD& result)
-{
-    ::GetLocaleInfo(m_lcid, type | LOCALE_RETURN_NUMBER, reinterpret_cast<LPWSTR>(&result), sizeof(DWORD) / sizeof(TCHAR));
-}
-
-void LocaleWin::ensureShortMonthLabels()
-{
-    if (!m_shortMonthLabels.isEmpty())
-        return;
-    const LCTYPE types[12] = {
-        LOCALE_SABBREVMONTHNAME1,
-        LOCALE_SABBREVMONTHNAME2,
-        LOCALE_SABBREVMONTHNAME3,
-        LOCALE_SABBREVMONTHNAME4,
-        LOCALE_SABBREVMONTHNAME5,
-        LOCALE_SABBREVMONTHNAME6,
-        LOCALE_SABBREVMONTHNAME7,
-        LOCALE_SABBREVMONTHNAME8,
-        LOCALE_SABBREVMONTHNAME9,
-        LOCALE_SABBREVMONTHNAME10,
-        LOCALE_SABBREVMONTHNAME11,
-        LOCALE_SABBREVMONTHNAME12,
-    };
-    m_shortMonthLabels.reserveCapacity(WTF_ARRAY_LENGTH(types));
-    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(types); ++i) {
-        m_shortMonthLabels.append(getLocaleInfoString(types[i]));
-        if (m_shortMonthLabels.last().isEmpty()) {
-            m_shortMonthLabels.shrink(0);
-            m_shortMonthLabels.reserveCapacity(WTF_ARRAY_LENGTH(WTF::monthName));
-            for (unsigned m = 0; m < WTF_ARRAY_LENGTH(WTF::monthName); ++m)
-                m_shortMonthLabels.append(WTF::monthName[m]);
-            return;
-        }
-    }
-}
-
-// -------------------------------- Tokenized date format
-
-static unsigned countContinuousLetters(const String& format, unsigned index)
-{
-    unsigned count = 1;
-    UChar reference = format[index];
-    while (index + 1 < format.length()) {
-        if (format[++index] != reference)
-            break;
-        ++count;
-    }
-    return count;
-}
-
-static void commitLiteralToken(StringBuilder& literalBuffer, StringBuilder& converted)
-{
-    if (literalBuffer.length() <= 0)
-        return;
-    DateTimeFormat::quoteAndAppendLiteral(literalBuffer.toString(), converted);
-    literalBuffer.clear();
-}
-
-// This function converts Windows date/time pattern format [1][2] into LDML date
-// format pattern [3].
-//
-// i.e.
-//   We set h, H, m, s, d, dd, M, or y as is. They have same meaning in both of
-//   Windows and LDML.
-//   We need to convert the following patterns:
-//     t -> a
-//     tt -> a
-//     ddd -> EEE
-//     dddd -> EEEE
-//     g -> G
-//     gg -> ignore
-//
-// [1] http://msdn.microsoft.com/en-us/library/dd317787(v=vs.85).aspx
-// [2] http://msdn.microsoft.com/en-us/library/dd318148(v=vs.85).aspx
-// [3] LDML http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns
-static String convertWindowsDateTimeFormat(const String& format)
-{
-    StringBuilder converted;
-    StringBuilder literalBuffer;
-    bool inQuote = false;
-    bool lastQuoteCanBeLiteral = false;
-    for (unsigned i = 0; i < format.length(); ++i) {
-        UChar ch = format[i];
-        if (inQuote) {
-            if (ch == '\'') {
-                inQuote = false;
-                ASSERT(i);
-                if (lastQuoteCanBeLiteral && format[i - 1] == '\'') {
-                    literalBuffer.append('\'');
-                    lastQuoteCanBeLiteral = false;
-                } else
-                    lastQuoteCanBeLiteral = true;
-            } else
-                literalBuffer.append(ch);
-            continue;
-        }
-
-        if (ch == '\'') {
-            inQuote = true;
-            if (lastQuoteCanBeLiteral && i > 0 && format[i - 1] == '\'') {
-                literalBuffer.append(ch);
-                lastQuoteCanBeLiteral = false;
-            } else
-                lastQuoteCanBeLiteral = true;
-        } else if (isASCIIAlpha(ch)) {
-            commitLiteralToken(literalBuffer, converted);
-            unsigned symbolStart = i;
-            unsigned count = countContinuousLetters(format, i);
-            i += count - 1;
-            if (ch == 'h' || ch == 'H' || ch == 'm' || ch == 's' || ch == 'M' || ch == 'y')
-                converted.append(format, symbolStart, count);
-            else if (ch == 'd') {
-                if (count <= 2)
-                    converted.append(format, symbolStart, count);
-                else if (count == 3)
-                    converted.append("EEE");
-                else
-                    converted.append("EEEE");
-            } else if (ch == 'g') {
-                if (count == 1)
-                    converted.append('G');
-                else {
-                    // gg means imperial era in Windows.
-                    // Just ignore it.
-                }
-            } else if (ch == 't')
-                converted.append('a');
-            else
-                literalBuffer.append(format, symbolStart, count);
-        } else
-            literalBuffer.append(ch);
-    }
-    commitLiteralToken(literalBuffer, converted);
-    return converted.toString();
-}
-
-void LocaleWin::ensureMonthLabels()
-{
-    if (!m_monthLabels.isEmpty())
-        return;
-    const LCTYPE types[12] = {
-        LOCALE_SMONTHNAME1,
-        LOCALE_SMONTHNAME2,
-        LOCALE_SMONTHNAME3,
-        LOCALE_SMONTHNAME4,
-        LOCALE_SMONTHNAME5,
-        LOCALE_SMONTHNAME6,
-        LOCALE_SMONTHNAME7,
-        LOCALE_SMONTHNAME8,
-        LOCALE_SMONTHNAME9,
-        LOCALE_SMONTHNAME10,
-        LOCALE_SMONTHNAME11,
-        LOCALE_SMONTHNAME12,
-    };
-    m_monthLabels.reserveCapacity(WTF_ARRAY_LENGTH(types));
-    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(types); ++i) {
-        m_monthLabels.append(getLocaleInfoString(types[i]));
-        if (m_monthLabels.last().isEmpty()) {
-            m_monthLabels.shrink(0);
-            m_monthLabels.reserveCapacity(WTF_ARRAY_LENGTH(WTF::monthFullName));
-            for (unsigned m = 0; m < WTF_ARRAY_LENGTH(WTF::monthFullName); ++m)
-                m_monthLabels.append(WTF::monthFullName[m]);
-            return;
-        }
-    }
-}
-
-void LocaleWin::ensureWeekDayShortLabels()
-{
-    if (!m_weekDayShortLabels.isEmpty())
-        return;
-    const LCTYPE types[7] = {
-        LOCALE_SABBREVDAYNAME7, // Sunday
-        LOCALE_SABBREVDAYNAME1, // Monday
-        LOCALE_SABBREVDAYNAME2,
-        LOCALE_SABBREVDAYNAME3,
-        LOCALE_SABBREVDAYNAME4,
-        LOCALE_SABBREVDAYNAME5,
-        LOCALE_SABBREVDAYNAME6
-    };
-    m_weekDayShortLabels.reserveCapacity(WTF_ARRAY_LENGTH(types));
-    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(types); ++i) {
-        m_weekDayShortLabels.append(getLocaleInfoString(types[i]));
-        if (m_weekDayShortLabels.last().isEmpty()) {
-            m_weekDayShortLabels.shrink(0);
-            m_weekDayShortLabels.reserveCapacity(WTF_ARRAY_LENGTH(WTF::weekdayName));
-            for (unsigned w = 0; w < WTF_ARRAY_LENGTH(WTF::weekdayName); ++w) {
-                // weekdayName starts with Monday.
-                m_weekDayShortLabels.append(WTF::weekdayName[(w + 6) % 7]);
-            }
-            return;
-        }
-    }
-}
-
-const Vector<String>& LocaleWin::monthLabels()
-{
-    ensureMonthLabels();
-    return m_monthLabels;
-}
-
-#if ENABLE(CALENDAR_PICKER)
-const Vector<String>& LocaleWin::weekDayShortLabels()
-{
-    ensureWeekDayShortLabels();
-    return m_weekDayShortLabels;
-}
-
-unsigned LocaleWin::firstDayOfWeek()
-{
-    return m_firstDayOfWeek;
-}
-
-bool LocaleWin::isRTL()
-{
-    WTF::Unicode::Direction dir = WTF::Unicode::direction(monthLabels()[0][0]);
-    return dir == WTF::Unicode::RightToLeft || dir == WTF::Unicode::RightToLeftArabic;
-}
-#endif
-
-String LocaleWin::dateFormat()
-{
-    if (m_dateFormat.isNull())
-        m_dateFormat = convertWindowsDateTimeFormat(getLocaleInfoString(LOCALE_SSHORTDATE));
-    return m_dateFormat;
-}
-
-String LocaleWin::dateFormat(const String& windowsFormat)
-{
-    return convertWindowsDateTimeFormat(windowsFormat);
-}
-
-String LocaleWin::monthFormat()
-{
-    if (m_monthFormat.isNull())
-        m_monthFormat = convertWindowsDateTimeFormat(getLocaleInfoString(LOCALE_SYEARMONTH));
-    return m_monthFormat;
-}
-
-String LocaleWin::shortMonthFormat()
-{
-    if (m_shortMonthFormat.isNull())
-        m_shortMonthFormat = convertWindowsDateTimeFormat(getLocaleInfoString(LOCALE_SYEARMONTH)).replace("MMMM", "MMM");
-    return m_shortMonthFormat;
-}
-
-String LocaleWin::timeFormat()
-{
-    if (m_timeFormatWithSeconds.isNull())
-        m_timeFormatWithSeconds = convertWindowsDateTimeFormat(getLocaleInfoString(LOCALE_STIMEFORMAT));
-    return m_timeFormatWithSeconds;
-}
-
-String LocaleWin::shortTimeFormat()
-{
-    if (!m_timeFormatWithoutSeconds.isNull())
-        return m_timeFormatWithoutSeconds;
-    String format = getLocaleInfoString(LOCALE_SSHORTTIME);
-    // Vista or older Windows doesn't support LOCALE_SSHORTTIME.
-    if (format.isEmpty()) {
-        format = getLocaleInfoString(LOCALE_STIMEFORMAT);
-        StringBuilder builder;
-        builder.append(getLocaleInfoString(LOCALE_STIME));
-        builder.append("ss");
-        size_t pos = format.reverseFind(builder.toString());
-        if (pos != kNotFound)
-            format.remove(pos, builder.length());
-    }
-    m_timeFormatWithoutSeconds = convertWindowsDateTimeFormat(format);
-    return m_timeFormatWithoutSeconds;
-}
-
-String LocaleWin::dateTimeFormatWithSeconds()
-{
-    if (!m_dateTimeFormatWithSeconds.isNull())
-        return m_dateTimeFormatWithSeconds;
-    StringBuilder builder;
-    builder.append(dateFormat());
-    builder.append(' ');
-    builder.append(timeFormat());
-    m_dateTimeFormatWithSeconds = builder.toString();
-    return m_dateTimeFormatWithSeconds;
-}
-
-String LocaleWin::dateTimeFormatWithoutSeconds()
-{
-    if (!m_dateTimeFormatWithoutSeconds.isNull())
-        return m_dateTimeFormatWithoutSeconds;
-    StringBuilder builder;
-    builder.append(dateFormat());
-    builder.append(' ');
-    builder.append(shortTimeFormat());
-    m_dateTimeFormatWithoutSeconds = builder.toString();
-    return m_dateTimeFormatWithoutSeconds;
-}
-
-const Vector<String>& LocaleWin::shortMonthLabels()
-{
-    ensureShortMonthLabels();
-    return m_shortMonthLabels;
-}
-
-const Vector<String>& LocaleWin::standAloneMonthLabels()
-{
-    // Windows doesn't provide a way to get stand-alone month labels.
-    return monthLabels();
-}
-
-const Vector<String>& LocaleWin::shortStandAloneMonthLabels()
-{
-    // Windows doesn't provide a way to get stand-alone month labels.
-    return shortMonthLabels();
-}
-
-const Vector<String>& LocaleWin::timeAMPMLabels()
-{
-    if (m_timeAMPMLabels.isEmpty()) {
-        m_timeAMPMLabels.append(getLocaleInfoString(LOCALE_S1159));
-        m_timeAMPMLabels.append(getLocaleInfoString(LOCALE_S2359));
-    }
-    return m_timeAMPMLabels;
-}
-
-void LocaleWin::initializeLocaleData()
-{
-    if (m_didInitializeNumberData)
-        return;
-
-    Vector<String, DecimalSymbolsSize> symbols;
-    enum DigitSubstitution {
-        DigitSubstitutionContext = 0,
-        DigitSubstitution0to9 = 1,
-        DigitSubstitutionNative = 2,
-    };
-    DWORD digitSubstitution = DigitSubstitution0to9;
-    getLocaleInfo(LOCALE_IDIGITSUBSTITUTION, digitSubstitution);
-    if (digitSubstitution == DigitSubstitution0to9) {
-        symbols.append("0");
-        symbols.append("1");
-        symbols.append("2");
-        symbols.append("3");
-        symbols.append("4");
-        symbols.append("5");
-        symbols.append("6");
-        symbols.append("7");
-        symbols.append("8");
-        symbols.append("9");
-    } else {
-        String digits = getLocaleInfoString(LOCALE_SNATIVEDIGITS);
-        ASSERT(digits.length() >= 10);
-        for (unsigned i = 0; i < 10; ++i)
-            symbols.append(digits.substring(i, 1));
-    }
-    ASSERT(symbols.size() == DecimalSeparatorIndex);
-    symbols.append(getLocaleInfoString(LOCALE_SDECIMAL));
-    ASSERT(symbols.size() == GroupSeparatorIndex);
-    symbols.append(getLocaleInfoString(LOCALE_STHOUSAND));
-    ASSERT(symbols.size() == DecimalSymbolsSize);
-
-    String negativeSign = getLocaleInfoString(LOCALE_SNEGATIVESIGN);
-    enum NegativeFormat {
-        NegativeFormatParenthesis = 0,
-        NegativeFormatSignPrefix = 1,
-        NegativeFormatSignSpacePrefix = 2,
-        NegativeFormatSignSuffix = 3,
-        NegativeFormatSpaceSignSuffix = 4,
-    };
-    DWORD negativeFormat = NegativeFormatSignPrefix;
-    getLocaleInfo(LOCALE_INEGNUMBER, negativeFormat);
-    String negativePrefix = emptyString();
-    String negativeSuffix = emptyString();
-    switch (negativeFormat) {
-    case NegativeFormatParenthesis:
-        negativePrefix = "(";
-        negativeSuffix = ")";
-        break;
-    case NegativeFormatSignSpacePrefix:
-        negativePrefix = negativeSign + " ";
-        break;
-    case NegativeFormatSignSuffix:
-        negativeSuffix = negativeSign;
-        break;
-    case NegativeFormatSpaceSignSuffix:
-        negativeSuffix = " " + negativeSign;
-        break;
-    case NegativeFormatSignPrefix: // Fall through.
-    default:
-        negativePrefix = negativeSign;
-        break;
-    }
-    m_didInitializeNumberData = true;
-    setLocaleData(symbols, emptyString(), emptyString(), negativePrefix, negativeSuffix);
-}
-
-}
diff --git a/Source/core/platform/text/win/LocaleWin.h b/Source/core/platform/text/win/LocaleWin.h
deleted file mode 100644
index cc843ca..0000000
--- a/Source/core/platform/text/win/LocaleWin.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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:
- *
- *     * 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 LocaleWin_h
-#define LocaleWin_h
-
-#include <windows.h>
-#include "core/platform/text/PlatformLocale.h"
-#include "wtf/Forward.h"
-#include "wtf/text/WTFString.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class DateComponents;
-struct DateFormatToken;
-
-class LocaleWin : public Locale {
-public:
-    static PassOwnPtr<LocaleWin> create(LCID, bool defaultsForLocale);
-    ~LocaleWin();
-#if ENABLE(CALENDAR_PICKER)
-    virtual const Vector<String>& weekDayShortLabels() OVERRIDE;
-    virtual unsigned firstDayOfWeek() OVERRIDE;
-    virtual bool isRTL() OVERRIDE;
-#endif
-    virtual String dateFormat() OVERRIDE;
-    virtual String monthFormat() OVERRIDE;
-    virtual String shortMonthFormat() OVERRIDE;
-    virtual String timeFormat() OVERRIDE;
-    virtual String shortTimeFormat() OVERRIDE;
-    virtual String dateTimeFormatWithSeconds() OVERRIDE;
-    virtual String dateTimeFormatWithoutSeconds() OVERRIDE;
-    virtual const Vector<String>& monthLabels() OVERRIDE;
-    virtual const Vector<String>& shortMonthLabels() OVERRIDE;
-    virtual const Vector<String>& standAloneMonthLabels() OVERRIDE;
-    virtual const Vector<String>& shortStandAloneMonthLabels() OVERRIDE;
-    virtual const Vector<String>& timeAMPMLabels() OVERRIDE;
-
-    static String dateFormat(const String&);
-
-private:
-    explicit LocaleWin(LCID, bool defaultsForLocale);
-    String getLocaleInfoString(LCTYPE);
-    void getLocaleInfo(LCTYPE, DWORD&);
-    void ensureShortMonthLabels();
-    void ensureMonthLabels();
-#if ENABLE(CALENDAR_PICKER)
-    void ensureWeekDayShortLabels();
-#endif
-    // Locale function:
-    virtual void initializeLocaleData() OVERRIDE;
-
-    LCID m_lcid;
-    Vector<String> m_shortMonthLabels;
-    Vector<String> m_monthLabels;
-    String m_dateFormat;
-    String m_monthFormat;
-    String m_shortMonthFormat;
-    String m_timeFormatWithSeconds;
-    String m_timeFormatWithoutSeconds;
-    String m_dateTimeFormatWithSeconds;
-    String m_dateTimeFormatWithoutSeconds;
-    Vector<String> m_timeAMPMLabels;
-#if ENABLE(CALENDAR_PICKER)
-    Vector<String> m_weekDayShortLabels;
-    unsigned m_firstDayOfWeek;
-#endif
-    bool m_didInitializeNumberData;
-    bool m_defaultsForLocale;
-};
-
-} // namespace WebCore
-#endif
diff --git a/Source/core/platform/win/HWndDC.h b/Source/core/platform/win/HWndDC.h
deleted file mode 100644
index 53cb538..0000000
--- a/Source/core/platform/win/HWndDC.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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 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,
- * 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 HWndDC_h
-#define HWndDC_h
-
-#include <windows.h>
-#include "wtf/NonCopyable.h"
-
-namespace WebCore {
-
-class HWndDC {
-    WTF_MAKE_NONCOPYABLE(HWndDC);
-public:
-    HWndDC()
-        : m_hwnd(0)
-        , m_hdc(0)
-    {
-    }
-
-    explicit HWndDC(HWND hwnd)
-        : m_hwnd(hwnd)
-        , m_hdc(::GetDC(hwnd))
-    {
-    }
-
-    HWndDC(HWND hwnd, HRGN hrgnClip, DWORD flags)
-        : m_hwnd(hwnd)
-        , m_hdc(::GetDCEx(hwnd, hrgnClip, flags))
-    {
-    }
-
-    ~HWndDC()
-    {
-        clear();
-    }
-
-    HDC setHWnd(HWND hwnd)
-    {
-        clear();
-        m_hwnd = hwnd;
-        m_hdc = ::GetDC(hwnd);
-        return m_hdc;
-    }
-
-    void clear()
-    {
-        if (!m_hdc)
-            return;
-        ::ReleaseDC(m_hwnd, m_hdc);
-        m_hwnd = 0;
-        m_hdc = 0;
-    }
-
-    operator HDC()
-    {
-        return m_hdc;
-    }
-
-private:
-    HWND m_hwnd;
-    HDC m_hdc;
-};
-
-} // namespace WebCore
-
-#endif // HWndDC_h
diff --git a/Source/core/platform/win/SystemInfo.cpp b/Source/core/platform/win/SystemInfo.cpp
deleted file mode 100644
index b746c81..0000000
--- a/Source/core/platform/win/SystemInfo.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2009 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/platform/win/SystemInfo.h"
-
-#include <windows.h>
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-WindowsVersion windowsVersion(int* major, int* minor)
-{
-    static bool initialized = false;
-    static WindowsVersion version;
-    static int majorVersion, minorVersion;
-
-    if (!initialized) {
-        initialized = true;
-        OSVERSIONINFOEX versionInfo;
-        ZeroMemory(&versionInfo, sizeof(versionInfo));
-        versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
-        GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&versionInfo));
-        majorVersion = versionInfo.dwMajorVersion;
-        minorVersion = versionInfo.dwMinorVersion;
-
-        if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32s)
-            version = Windows3_1;
-        else if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
-            if (!minorVersion)
-                version = Windows95;
-            else
-                version = (minorVersion == 10) ? Windows98 : WindowsME;
-        } else {
-            if (majorVersion == 5) {
-                if (!minorVersion)
-                    version = Windows2000;
-                else
-                    version = (minorVersion == 1) ? WindowsXP : WindowsServer2003;
-            } else if (majorVersion >= 6) {
-                if (versionInfo.wProductType == VER_NT_WORKSTATION)
-                    version = (majorVersion == 6 && !minorVersion) ? WindowsVista : Windows7;
-                else
-                    version = WindowsServer2008;
-            } else
-                version = (majorVersion == 4) ? WindowsNT4 : WindowsNT3;
-        }
-    }
-
-    if (major)
-        *major = majorVersion;
-    if (minor)
-        *minor = minorVersion;
-    return version;
-}
-
-static String osVersionForUAString()
-{
-    int major, minor;
-    WindowsVersion version = windowsVersion(&major, &minor);
-    switch (version) {
-    case WindowsCE1:
-    case WindowsCE2:
-    case WindowsCE3:
-        return "Windows CE";
-    case WindowsCE4:
-        return "Windows CE .NET";
-    case Windows3_1:
-        return "Windows 3.1";
-    case Windows95:
-        return "Windows 95";
-    case Windows98:
-        return "Windows 98";
-    case WindowsME:
-        return "Windows 98; Win 9x 4.90";
-    case WindowsNT4:
-        return "WinNT4.0";
-    }
-
-    const char* familyName = (version >= WindowsNT3) ? "Windows NT " : "Windows CE ";
-    return familyName + String::number(major) + '.' + String::number(minor);
-}
-
-static bool isWOW64()
-{
-    static bool initialized = false;
-    static bool wow64 = false;
-
-    if (!initialized) {
-        initialized = true;
-        HMODULE kernel32Module = GetModuleHandleA("kernel32.dll");
-        if (!kernel32Module)
-            return wow64;
-        typedef BOOL (WINAPI* IsWow64ProcessFunc)(HANDLE, PBOOL);
-        IsWow64ProcessFunc isWOW64Process = reinterpret_cast<IsWow64ProcessFunc>(GetProcAddress(kernel32Module, "IsWow64Process"));
-        if (isWOW64Process) {
-            BOOL result = FALSE;
-            wow64 = isWOW64Process(GetCurrentProcess(), &result) && result;
-        }
-    }
-
-    return wow64;
-}
-
-static WORD processorArchitecture()
-{
-    static bool initialized = false;
-    static WORD architecture = PROCESSOR_ARCHITECTURE_INTEL;
-
-    if (!initialized) {
-        initialized = true;
-        HMODULE kernel32Module = GetModuleHandleA("kernel32.dll");
-        if (!kernel32Module)
-            return architecture;
-        typedef VOID (WINAPI* GetNativeSystemInfoFunc)(LPSYSTEM_INFO);
-        GetNativeSystemInfoFunc getNativeSystemInfo = reinterpret_cast<GetNativeSystemInfoFunc>(GetProcAddress(kernel32Module, "GetNativeSystemInfo"));
-        if (getNativeSystemInfo) {
-            SYSTEM_INFO systemInfo;
-            ZeroMemory(&systemInfo, sizeof(systemInfo));
-            getNativeSystemInfo(&systemInfo);
-            architecture = systemInfo.wProcessorArchitecture;
-        }
-    }
-
-    return architecture;
-}
-
-static String architectureTokenForUAString()
-{
-    if (isWOW64())
-        return "; WOW64";
-    if (processorArchitecture() == PROCESSOR_ARCHITECTURE_AMD64)
-        return "; Win64; x64";
-    if (processorArchitecture() == PROCESSOR_ARCHITECTURE_IA64)
-        return "; Win64; IA64";
-    return String();
-}
-
-String windowsVersionForUAString()
-{
-    return osVersionForUAString() + architectureTokenForUAString();
-}
-
-} // namespace WebCore
diff --git a/Source/core/platform/win/SystemInfo.h b/Source/core/platform/win/SystemInfo.h
deleted file mode 100644
index f9e79e2..0000000
--- a/Source/core/platform/win/SystemInfo.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2009 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 SystemInfo_h
-#define SystemInfo_h
-
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-// NOTE: Keep these in order so callers can do things like
-// "if (windowsVersion() >= WindowsVista) ...". It's OK to change or add values,
-// though.
-enum WindowsVersion {
-    // CE-based versions
-    WindowsCE1 = 0,
-    WindowsCE2,
-    WindowsCE3,
-    WindowsCE4,
-    WindowsCE5,
-    WindowsCE6,
-    WindowsCE7,
-    // 3.x-based versions
-    Windows3_1,
-    // 9x-based versions
-    Windows95,
-    Windows98,
-    WindowsME,
-    // NT-based versions
-    WindowsNT3,
-    WindowsNT4,
-    Windows2000,
-    WindowsXP,
-    WindowsServer2003,
-    WindowsVista,
-    WindowsServer2008,
-    Windows7,
-};
-
-// If supplied, |major| and |minor| are set to the OSVERSIONINFO::dwMajorVersion
-// and dwMinorVersion field values, respectively.
-WindowsVersion windowsVersion(int* major = 0, int* minor = 0);
-
-String windowsVersionForUAString();
-
-} // namespace WebCore
-
-#endif // SystemInfo_h
diff --git a/Source/core/plugins/DOMMimeType.cpp b/Source/core/plugins/DOMMimeType.cpp
index 709ef2c..e246848 100644
--- a/Source/core/plugins/DOMMimeType.cpp
+++ b/Source/core/plugins/DOMMimeType.cpp
@@ -20,7 +20,7 @@
 #include "core/plugins/DOMMimeType.h"
 
 #include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/plugins/DOMPlugin.h"
 #include "core/plugins/PluginData.h"
diff --git a/Source/core/plugins/DOMMimeType.h b/Source/core/plugins/DOMMimeType.h
index cf8fb89..047a635 100644
--- a/Source/core/plugins/DOMMimeType.h
+++ b/Source/core/plugins/DOMMimeType.h
@@ -21,7 +21,7 @@
 #define DOMMimeType_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/page/FrameDestructionObserver.h"
+#include "core/frame/FrameDestructionObserver.h"
 #include "core/plugins/PluginData.h"
 #include "wtf/Forward.h"
 #include "wtf/PassRefPtr.h"
diff --git a/Source/core/plugins/DOMMimeTypeArray.cpp b/Source/core/plugins/DOMMimeTypeArray.cpp
index 87f9a86..16cf19a 100644
--- a/Source/core/plugins/DOMMimeTypeArray.cpp
+++ b/Source/core/plugins/DOMMimeTypeArray.cpp
@@ -20,7 +20,7 @@
 #include "config.h"
 #include "core/plugins/DOMMimeTypeArray.h"
 
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/plugins/PluginData.h"
 #include "wtf/text/AtomicString.h"
diff --git a/Source/core/plugins/DOMMimeTypeArray.h b/Source/core/plugins/DOMMimeTypeArray.h
index d9acd83..651edee 100644
--- a/Source/core/plugins/DOMMimeTypeArray.h
+++ b/Source/core/plugins/DOMMimeTypeArray.h
@@ -22,7 +22,7 @@
 #define DOMMimeTypeArray_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/page/DOMWindowProperty.h"
+#include "core/frame/DOMWindowProperty.h"
 #include "core/plugins/DOMMimeType.h"
 #include "wtf/Forward.h"
 #include "wtf/PassRefPtr.h"
diff --git a/Source/core/plugins/DOMPlugin.h b/Source/core/plugins/DOMPlugin.h
index 7e20be1..1cc0611 100644
--- a/Source/core/plugins/DOMPlugin.h
+++ b/Source/core/plugins/DOMPlugin.h
@@ -21,7 +21,7 @@
 #define DOMPlugin_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/page/FrameDestructionObserver.h"
+#include "core/frame/FrameDestructionObserver.h"
 #include "core/plugins/DOMMimeType.h"
 #include "wtf/Forward.h"
 #include "wtf/RefCounted.h"
diff --git a/Source/core/plugins/DOMPluginArray.cpp b/Source/core/plugins/DOMPluginArray.cpp
index 11032e3..44e9269 100644
--- a/Source/core/plugins/DOMPluginArray.cpp
+++ b/Source/core/plugins/DOMPluginArray.cpp
@@ -20,7 +20,7 @@
 #include "config.h"
 #include "core/plugins/DOMPluginArray.h"
 
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/plugins/DOMPlugin.h"
 #include "core/plugins/PluginData.h"
diff --git a/Source/core/plugins/DOMPluginArray.h b/Source/core/plugins/DOMPluginArray.h
index 51eff45..922b777 100644
--- a/Source/core/plugins/DOMPluginArray.h
+++ b/Source/core/plugins/DOMPluginArray.h
@@ -22,7 +22,7 @@
 #define DOMPluginArray_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/page/DOMWindowProperty.h"
+#include "core/frame/DOMWindowProperty.h"
 #include "core/plugins/DOMPlugin.h"
 #include "wtf/Forward.h"
 #include "wtf/PassRefPtr.h"
diff --git a/Source/core/plugins/PluginOcclusionSupport.cpp b/Source/core/plugins/PluginOcclusionSupport.cpp
index 16a66d0..3fab5dc 100644
--- a/Source/core/plugins/PluginOcclusionSupport.cpp
+++ b/Source/core/plugins/PluginOcclusionSupport.cpp
@@ -35,11 +35,11 @@
 #include "core/dom/Element.h"
 #include "core/html/HTMLElement.h"
 #include "core/html/HTMLFrameOwnerElement.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
-#include "core/platform/Widget.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/RenderBox.h"
 #include "core/rendering/RenderObject.h"
+#include "platform/Widget.h"
 #include "wtf/HashSet.h"
 
 // This file provides a utility function to support rendering certain elements above plugins.
@@ -174,7 +174,7 @@
         // Check to make sure we can get both the element and the RenderObject
         // for this FrameView, if we can't just move on to the next object.
         HTMLElement* element = frameView->frame().ownerElement();
-        if (!element || element->renderer())
+        if (!element || !element->renderer())
             continue;
 
         RenderObject* iframeRenderer = element->renderer();
diff --git a/Source/core/plugins/PluginView.h b/Source/core/plugins/PluginView.h
index c25d2b1..5b1c68d 100644
--- a/Source/core/plugins/PluginView.h
+++ b/Source/core/plugins/PluginView.h
@@ -26,8 +26,8 @@
 #ifndef PluginView_h
 #define PluginView_h
 
-#include "core/platform/ScrollTypes.h"
-#include "core/platform/Widget.h"
+#include "platform/Widget.h"
+#include "platform/scroll/ScrollTypes.h"
 #include "wtf/text/WTFString.h"
 
 struct NPObject;
diff --git a/Source/core/rendering/AutoTableLayout.h b/Source/core/rendering/AutoTableLayout.h
index 4975a96..d7d07da 100644
--- a/Source/core/rendering/AutoTableLayout.h
+++ b/Source/core/rendering/AutoTableLayout.h
@@ -21,9 +21,9 @@
 #ifndef AutoTableLayout_h
 #define AutoTableLayout_h
 
-#include "core/platform/LayoutUnit.h"
 #include "core/platform/Length.h"
 #include "core/rendering/TableLayout.h"
+#include "platform/LayoutUnit.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/BidiRun.cpp b/Source/core/rendering/BidiRun.cpp
index 12e83a5..6abe403 100644
--- a/Source/core/rendering/BidiRun.cpp
+++ b/Source/core/rendering/BidiRun.cpp
@@ -23,7 +23,7 @@
 
 #include "config.h"
 #include "core/rendering/BidiRun.h"
-#include "core/platform/Partitions.h"
+#include "platform/Partitions.h"
 #include "wtf/RefCountedLeakCounter.h"
 #include "wtf/StdLibExtras.h"
 
diff --git a/Source/core/rendering/BidiRun.h b/Source/core/rendering/BidiRun.h
index abfe2d1..85f8f4a 100644
--- a/Source/core/rendering/BidiRun.h
+++ b/Source/core/rendering/BidiRun.h
@@ -24,8 +24,8 @@
 #ifndef BidiRun_h
 #define BidiRun_h
 
-#include "core/platform/text/BidiResolver.h"
 #include "core/rendering/RenderText.h"
+#include "platform/text/BidiResolver.h"
 #include "wtf/StdLibExtras.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/ClipRect.h b/Source/core/rendering/ClipRect.h
index d88eb9a..01feb66 100644
--- a/Source/core/rendering/ClipRect.h
+++ b/Source/core/rendering/ClipRect.h
@@ -26,7 +26,7 @@
 #ifndef ClipRect_h
 #define ClipRect_h
 
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 
 #include "wtf/Vector.h"
 
diff --git a/Source/core/rendering/ColumnInfo.h b/Source/core/rendering/ColumnInfo.h
index bb30a16..3972281 100644
--- a/Source/core/rendering/ColumnInfo.h
+++ b/Source/core/rendering/ColumnInfo.h
@@ -26,7 +26,7 @@
 #ifndef ColumnInfo_h
 #define ColumnInfo_h
 
-#include "core/platform/LayoutUnit.h"
+#include "platform/LayoutUnit.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/CompositedLayerMapping.cpp b/Source/core/rendering/CompositedLayerMapping.cpp
new file mode 100644
index 0000000..15d68d4
--- /dev/null
+++ b/Source/core/rendering/CompositedLayerMapping.cpp
@@ -0,0 +1,1973 @@
+/*
+ * Copyright (C) 2009, 2010, 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 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,
+ * 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/rendering/CompositedLayerMapping.h"
+
+#include "CSSPropertyNames.h"
+#include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
+#include "core/fetch/ImageResource.h"
+#include "core/html/HTMLIFrameElement.h"
+#include "core/html/HTMLMediaElement.h"
+#include "core/html/canvas/CanvasRenderingContext.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/page/Chrome.h"
+#include "core/frame/FrameView.h"
+#include "core/page/Settings.h"
+#include "core/frame/animation/AnimationController.h"
+#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/platform/graphics/FontCache.h"
+#include "core/platform/graphics/GraphicsContext.h"
+#include "core/platform/graphics/GraphicsContext3D.h"
+#include "core/platform/graphics/GraphicsLayer.h"
+#include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
+#include "core/plugins/PluginView.h"
+#include "core/rendering/FilterEffectRenderer.h"
+#include "core/rendering/RenderApplet.h"
+#include "core/rendering/RenderEmbeddedObject.h"
+#include "core/rendering/RenderIFrame.h"
+#include "core/rendering/RenderImage.h"
+#include "core/rendering/RenderLayer.h"
+#include "core/rendering/RenderLayerCompositor.h"
+#include "core/rendering/RenderVideo.h"
+#include "core/rendering/RenderView.h"
+#include "core/rendering/animation/WebAnimationProvider.h"
+#include "core/rendering/style/KeyframeList.h"
+#include "wtf/CurrentTime.h"
+#include "wtf/text/StringBuilder.h"
+
+using namespace std;
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+static IntRect clipBox(RenderBox* renderer);
+
+static IntRect contentsRect(const RenderObject* renderer)
+{
+    if (!renderer->isBox())
+        return IntRect();
+
+    return renderer->isVideo() ?
+        toRenderVideo(renderer)->videoBox() :
+        pixelSnappedIntRect(toRenderBox(renderer)->contentBoxRect());
+}
+
+static IntRect backgroundRect(const RenderObject* renderer)
+{
+    if (!renderer->isBox())
+        return IntRect();
+
+    LayoutRect rect;
+    const RenderBox* box = toRenderBox(renderer);
+    EFillBox clip = box->style()->backgroundClip();
+    switch (clip) {
+    case BorderFillBox:
+        rect = box->borderBoxRect();
+        break;
+    case PaddingFillBox:
+        rect = box->paddingBoxRect();
+        break;
+    case ContentFillBox:
+        rect = box->contentBoxRect();
+        break;
+    case TextFillBox:
+        break;
+    }
+
+    return pixelSnappedIntRect(rect);
+}
+
+static inline bool isAcceleratedCanvas(const RenderObject* renderer)
+{
+    if (renderer->isCanvas()) {
+        HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
+        if (CanvasRenderingContext* context = canvas->renderingContext())
+            return context->isAccelerated();
+    }
+    return false;
+}
+
+static bool hasBoxDecorations(const RenderStyle* style)
+{
+    return style->hasBorder() || style->hasBorderRadius() || style->hasOutline() || style->hasAppearance() || style->boxShadow() || style->hasFilter();
+}
+
+static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle* style)
+{
+    return hasBoxDecorations(style) || style->hasBackgroundImage();
+}
+
+static bool contentLayerSupportsDirectBackgroundComposition(const RenderObject* renderer)
+{
+    // No support for decorations - border, border-radius or outline.
+    // Only simple background - solid color or transparent.
+    if (hasBoxDecorationsOrBackgroundImage(renderer->style()))
+        return false;
+
+    // If there is no background, there is nothing to support.
+    if (!renderer->style()->hasBackground())
+        return true;
+
+    // Simple background that is contained within the contents rect.
+    return contentsRect(renderer).contains(backgroundRect(renderer));
+}
+
+static inline bool isAcceleratedContents(RenderObject* renderer)
+{
+    return isAcceleratedCanvas(renderer)
+        || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing())
+        || renderer->isVideo();
+}
+
+// Get the scrolling coordinator in a way that works inside CompositedLayerMapping's destructor.
+static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer* layer)
+{
+    Page* page = layer->renderer()->frame()->page();
+    if (!page)
+        return 0;
+
+    return page->scrollingCoordinator();
+}
+
+CompositedLayerMapping::CompositedLayerMapping(RenderLayer* layer)
+    : m_owningLayer(layer)
+    , m_animationProvider(adoptPtr(new WebAnimationProvider))
+    , m_artificiallyInflatedBounds(false)
+    , m_boundsConstrainedByClipping(false)
+    , m_isMainFrameRenderViewLayer(false)
+    , m_requiresOwnBackingStore(true)
+    , m_canCompositeFilters(false)
+    , m_backgroundLayerPaintsFixedRootBackground(false)
+{
+    if (layer->isRootLayer()) {
+        Frame& frame = toRenderView(renderer())->frameView()->frame();
+        Page* page = frame.page();
+        if (page && page->mainFrame() == &frame) {
+            m_isMainFrameRenderViewLayer = true;
+        }
+    }
+
+    createPrimaryGraphicsLayer();
+}
+
+CompositedLayerMapping::~CompositedLayerMapping()
+{
+    updateClippingLayers(false, false);
+    updateOverflowControlsLayers(false, false, false);
+    updateForegroundLayer(false);
+    updateBackgroundLayer(false);
+    updateMaskLayer(false);
+    updateClippingMaskLayers(false);
+    updateScrollingLayers(false);
+    destroyGraphicsLayers();
+}
+
+PassOwnPtr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(CompositingReasons reasons)
+{
+    GraphicsLayerFactory* graphicsLayerFactory = 0;
+    if (Page* page = renderer()->frame()->page())
+        graphicsLayerFactory = page->chrome().client().graphicsLayerFactory();
+
+    OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, this);
+
+    graphicsLayer->setCompositingReasons(reasons);
+
+    return graphicsLayer.release();
+}
+
+void CompositedLayerMapping::createPrimaryGraphicsLayer()
+{
+    m_graphicsLayer = createGraphicsLayer(m_owningLayer->compositingReasons());
+
+#if !OS(ANDROID)
+    if (m_isMainFrameRenderViewLayer)
+        m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true);
+#endif
+
+    updateOpacity(renderer()->style());
+    updateTransform(renderer()->style());
+    updateFilters(renderer()->style());
+
+    if (RuntimeEnabledFeatures::cssCompositingEnabled())
+        updateLayerBlendMode(renderer()->style());
+}
+
+void CompositedLayerMapping::destroyGraphicsLayers()
+{
+    if (m_graphicsLayer)
+        m_graphicsLayer->removeFromParent();
+
+    m_ancestorClippingLayer = nullptr;
+    m_graphicsLayer = nullptr;
+    m_foregroundLayer = nullptr;
+    m_backgroundLayer = nullptr;
+    m_childContainmentLayer = nullptr;
+    m_maskLayer = nullptr;
+    m_childClippingMaskLayer = nullptr;
+
+    m_scrollingLayer = nullptr;
+    m_scrollingContentsLayer = nullptr;
+}
+
+void CompositedLayerMapping::updateOpacity(const RenderStyle* style)
+{
+    m_graphicsLayer->setOpacity(compositingOpacity(style->opacity()));
+}
+
+void CompositedLayerMapping::updateTransform(const RenderStyle* style)
+{
+    // FIXME: This could use m_owningLayer->transform(), but that currently has transform-origin
+    // baked into it, and we don't want that.
+    TransformationMatrix t;
+    if (m_owningLayer->hasTransform()) {
+        style->applyTransform(t, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), RenderStyle::ExcludeTransformOrigin);
+        makeMatrixRenderable(t, compositor()->canRender3DTransforms());
+    }
+
+    m_graphicsLayer->setTransform(t);
+}
+
+void CompositedLayerMapping::updateFilters(const RenderStyle* style)
+{
+    bool didCompositeFilters = m_canCompositeFilters;
+    m_canCompositeFilters = m_graphicsLayer->setFilters(owningLayer()->computeFilterOperations(style));
+    if (didCompositeFilters != m_canCompositeFilters) {
+        //
+        // If filters used to be painted in software and are now painted in the compositor, we need to:
+        // (1) Remove the FilterEffectRenderer, which was used for painting filters in software.
+        // (2) Repaint the layer contents to remove the software-applied filter because the compositor will apply it.
+        //
+        // Similarly, if filters used to be painted in the compositor and are now painted in software, we need to:
+        // (1) Create a FilterEffectRenderer.
+        // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it.
+        //
+        m_owningLayer->updateOrRemoveFilterEffectRenderer();
+        setContentsNeedDisplay();
+    }
+}
+
+void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle*)
+{
+}
+
+void CompositedLayerMapping::updateContentsOpaque()
+{
+    // For non-root layers, background is always painted by the primary graphics layer.
+    ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer);
+    if (m_backgroundLayer) {
+        m_graphicsLayer->setContentsOpaque(false);
+        m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
+    } else {
+        m_graphicsLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
+    }
+}
+
+static bool hasNonZeroTransformOrigin(const RenderObject* renderer)
+{
+    RenderStyle* style = renderer->style();
+    return (style->transformOriginX().type() == Fixed && style->transformOriginX().value())
+        || (style->transformOriginY().type() == Fixed && style->transformOriginY().value());
+}
+
+static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer* layer)
+{
+    for (RenderLayer* curr = layer; curr; curr = curr->parent()) {
+        if (curr->hasTransform() || curr->needsCompositedScrolling())
+            return true;
+    }
+
+    return false;
+}
+
+bool CompositedLayerMapping::shouldClipCompositedBounds() const
+{
+    // Scrollbar layers use this layer for relative positioning, so don't clip.
+    if (layerForHorizontalScrollbar() || layerForVerticalScrollbar())
+        return false;
+
+    if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer))
+        return false;
+
+    return true;
+}
+
+void CompositedLayerMapping::updateCompositedBounds()
+{
+    IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);
+
+    // Clip to the size of the document or enclosing overflow-scroll layer.
+    // If this or an ancestor is transformed, we can't currently compute the correct rect to intersect with.
+    // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist.
+    if (shouldClipCompositedBounds()) {
+        RenderView* view = m_owningLayer->renderer()->view();
+        RenderLayer* rootLayer = view->layer();
+
+        LayoutRect clippingBounds;
+        if (renderer()->style()->position() == FixedPosition && renderer()->container() == view)
+            clippingBounds = view->frameView()->viewportConstrainedVisibleContentRect();
+        else
+            clippingBounds = view->unscaledDocumentRect();
+
+        if (m_owningLayer != rootLayer)
+            clippingBounds.intersect(m_owningLayer->backgroundClipRect(RenderLayer::ClipRectsContext(rootLayer, 0, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
+
+        LayoutPoint delta;
+        m_owningLayer->convertToLayerCoords(rootLayer, delta);
+        clippingBounds.move(-delta.x(), -delta.y());
+
+        layerBounds.intersect(pixelSnappedIntRect(clippingBounds));
+        m_boundsConstrainedByClipping = true;
+    } else {
+        m_boundsConstrainedByClipping = false;
+    }
+
+    // If the element has a transform-origin that has fixed lengths, and the renderer has zero size,
+    // then we need to ensure that the compositing layer has non-zero size so that we can apply
+    // the transform-origin via the GraphicsLayer anchorPoint (which is expressed as a fractional value).
+    if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) {
+        layerBounds.setWidth(1);
+        layerBounds.setHeight(1);
+        m_artificiallyInflatedBounds = true;
+    } else {
+        m_artificiallyInflatedBounds = false;
+    }
+
+    setCompositedBounds(layerBounds);
+}
+
+void CompositedLayerMapping::updateAfterWidgetResize()
+{
+    if (renderer()->isRenderPart()) {
+        if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::frameContentsCompositor(toRenderPart(renderer()))) {
+            innerCompositor->frameViewDidChangeSize();
+            innerCompositor->frameViewDidChangeLocation(contentsBox().location());
+        }
+    }
+}
+
+void CompositedLayerMapping::updateCompositingReasons()
+{
+    // All other layers owned by this mapping will have the same compositing reason
+    // for their lifetime, so they are initialized only when created.
+    m_graphicsLayer->setCompositingReasons(m_owningLayer->compositingReasons());
+}
+
+void CompositedLayerMapping::updateAfterLayout(UpdateAfterLayoutFlags flags)
+{
+    RenderLayerCompositor* layerCompositor = compositor();
+    if (!layerCompositor->compositingLayersNeedRebuild()) {
+        // Calling updateGraphicsLayerGeometry() here gives incorrect results, because the
+        // position of this layer's GraphicsLayer depends on the position of our compositing
+        // ancestor's GraphicsLayer. That cannot be determined until all the descendant
+        // RenderLayers of that ancestor have been processed via updateLayerPositions().
+        //
+        // The solution is to update compositing children of this layer here,
+        // via updateCompositingChildrenGeometry().
+        updateCompositedBounds();
+        layerCompositor->updateCompositingDescendantGeometry(m_owningLayer, m_owningLayer, flags & CompositingChildrenOnly);
+
+        if (flags & IsUpdateRoot) {
+            updateGraphicsLayerGeometry();
+            layerCompositor->updateRootLayerPosition();
+            RenderLayer* stackingContainer = m_owningLayer->enclosingStackingContainer();
+            if (!layerCompositor->compositingLayersNeedRebuild() && stackingContainer && (stackingContainer != m_owningLayer))
+                layerCompositor->updateCompositingDescendantGeometry(stackingContainer, stackingContainer, flags & CompositingChildrenOnly);
+        }
+    }
+
+    if (flags & NeedsFullRepaint && !paintsIntoCompositedAncestor())
+        setContentsNeedDisplay();
+}
+
+bool CompositedLayerMapping::updateGraphicsLayerConfiguration()
+{
+    RenderLayerCompositor* compositor = this->compositor();
+    RenderObject* renderer = this->renderer();
+
+    m_owningLayer->updateDescendantDependentFlags();
+    m_owningLayer->updateZOrderLists();
+
+    bool layerConfigChanged = false;
+    setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgroundLayer(m_owningLayer));
+
+    // The background layer is currently only used for fixed root backgrounds.
+    if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground))
+        layerConfigChanged = true;
+
+    if (updateForegroundLayer(compositor->needsContentsCompositingLayer(m_owningLayer)))
+        layerConfigChanged = true;
+
+    bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants(m_owningLayer);
+
+    // Our scrolling layer will clip.
+    if (m_owningLayer->needsCompositedScrolling())
+        needsDescendentsClippingLayer = false;
+
+    RenderLayer* scrollParent = m_owningLayer->scrollParent();
+    bool needsAncestorClip = compositor->clippedByAncestor(m_owningLayer);
+    if (scrollParent) {
+        // If our containing block is our ancestor scrolling layer, then we'll already be clipped
+        // to it via our scroll parent and we don't need an ancestor clipping layer.
+        if (m_owningLayer->renderer()->containingBlock()->enclosingLayer() == m_owningLayer->ancestorScrollingLayer())
+            needsAncestorClip = false;
+    }
+    if (updateClippingLayers(needsAncestorClip, needsDescendentsClippingLayer))
+        layerConfigChanged = true;
+
+    if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), requiresVerticalScrollbarLayer(), requiresScrollCornerLayer()))
+        layerConfigChanged = true;
+
+    if (updateScrollingLayers(m_owningLayer->needsCompositedScrolling()))
+        layerConfigChanged = true;
+
+    updateScrollParent(scrollParent);
+    updateClipParent(m_owningLayer->clipParent());
+
+    if (layerConfigChanged)
+        updateInternalHierarchy();
+
+    if (updateMaskLayer(renderer->hasMask()))
+        m_graphicsLayer->setMaskLayer(m_maskLayer.get());
+
+    bool needsChildClippingMask = renderer->style()->hasBorderRadius() && isAcceleratedContents(renderer);
+    if (updateClippingMaskLayers(needsChildClippingMask))
+        m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.get());
+
+    if (m_owningLayer->hasReflection()) {
+        if (m_owningLayer->reflectionLayer()->compositedLayerMapping()) {
+            GraphicsLayer* reflectionLayer = m_owningLayer->reflectionLayer()->compositedLayerMapping()->mainGraphicsLayer();
+            m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
+        }
+    } else {
+        m_graphicsLayer->setReplicatedByLayer(0);
+    }
+
+    updateBackgroundColor(isSimpleContainerCompositingLayer());
+
+    if (isDirectlyCompositedImage())
+        updateImageContents();
+
+    if (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing()) {
+        PluginView* pluginView = toPluginView(toRenderWidget(renderer)->widget());
+        m_graphicsLayer->setContentsToMedia(pluginView->platformLayer());
+    } else if (renderer->isVideo()) {
+        HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer->node());
+        m_graphicsLayer->setContentsToMedia(mediaElement->platformLayer());
+    } else if (isAcceleratedCanvas(renderer)) {
+        HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
+        if (CanvasRenderingContext* context = canvas->renderingContext())
+            m_graphicsLayer->setContentsToCanvas(context->platformLayer());
+        layerConfigChanged = true;
+    }
+    if (renderer->isRenderPart())
+        layerConfigChanged = RenderLayerCompositor::parentFrameContentLayers(toRenderPart(renderer));
+
+    return layerConfigChanged;
+}
+
+static IntRect clipBox(RenderBox* renderer)
+{
+    LayoutRect result = PaintInfo::infiniteRect();
+    if (renderer->hasOverflowClip())
+        result = renderer->overflowClipRect(LayoutPoint(), 0); // FIXME: Incorrect for CSS regions.
+
+    if (renderer->hasClip())
+        result.intersect(renderer->clipRect(LayoutPoint(), 0)); // FIXME: Incorrect for CSS regions.
+
+    return pixelSnappedIntRect(result);
+}
+
+void CompositedLayerMapping::updateGraphicsLayerGeometry()
+{
+    // If we haven't built z-order lists yet, wait until later.
+    if (m_owningLayer->isStackingContainer() && m_owningLayer->m_zOrderListsDirty)
+        return;
+
+    // Set transform property, if it is not animating. We have to do this here because the transform
+    // is affected by the layer dimensions.
+    if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitTransform))
+        updateTransform(renderer()->style());
+
+    // Set opacity, if it is not animating.
+    if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyOpacity))
+        updateOpacity(renderer()->style());
+
+    if (RuntimeEnabledFeatures::cssCompositingEnabled())
+        updateLayerBlendMode(renderer()->style());
+
+    bool isSimpleContainer = isSimpleContainerCompositingLayer();
+
+    m_owningLayer->updateDescendantDependentFlags();
+
+    // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer and its non-compositing
+    // descendants. So, the visibility flag for m_graphicsLayer should be true if there are any
+    // non-compositing visible layers.
+    bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCompositingDescendantLayers();
+    if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->isVideo()) {
+        HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer()->node());
+        if (mediaElement->isFullscreen())
+            contentsVisible = false;
+    }
+    m_graphicsLayer->setContentsVisible(contentsVisible);
+
+    RenderStyle* style = renderer()->style();
+    // FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959
+    bool preserves3D = style->transformStyle3D() == TransformStyle3DPreserve3D && !renderer()->hasReflection();
+    m_graphicsLayer->setPreserves3D(preserves3D);
+    m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == BackfaceVisibilityVisible);
+
+    RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer();
+
+    // We compute everything relative to the enclosing compositing layer.
+    IntRect ancestorCompositingBounds;
+    if (compAncestor) {
+        ASSERT(compAncestor->compositedLayerMapping());
+        ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->compositedLayerMapping()->compositedBounds());
+    }
+
+    IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds());
+
+    IntRect relativeCompositingBounds(localCompositingBounds);
+    IntPoint delta;
+    m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta);
+    relativeCompositingBounds.moveBy(delta);
+
+    IntPoint graphicsLayerParentLocation;
+    if (compAncestor && compAncestor->compositedLayerMapping()->hasClippingLayer()) {
+        // If the compositing ancestor has a layer to clip children, we parent in that, and therefore
+        // position relative to it.
+        IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer()));
+        graphicsLayerParentLocation = clippingBox.location();
+    } else if (compAncestor) {
+        graphicsLayerParentLocation = ancestorCompositingBounds.location();
+    } else {
+        graphicsLayerParentLocation = renderer()->view()->documentRect().location();
+    }
+
+    if (compAncestor && compAncestor->needsCompositedScrolling()) {
+        RenderBox* renderBox = toRenderBox(compAncestor->renderer());
+        IntSize scrollOffset = compAncestor->scrolledContentOffset();
+        IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop());
+        graphicsLayerParentLocation = scrollOrigin - scrollOffset;
+    }
+
+    if (compAncestor && m_ancestorClippingLayer) {
+        // Call calculateRects to get the backgroundRect which is what is used to clip the contents of this
+        // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects
+        // for a compositing layer, rootLayer is the layer itself.
+        RenderLayer::ClipRectsContext clipRectsContext(compAncestor, 0, TemporaryClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip);
+        IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundClipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions.
+        ASSERT(parentClipRect != PaintInfo::infiniteRect());
+        m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
+        m_ancestorClippingLayer->setSize(parentClipRect.size());
+
+        // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords.
+        m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - delta);
+
+        // The primary layer is then parented in, and positioned relative to this clipping layer.
+        graphicsLayerParentLocation = parentClipRect.location();
+    }
+
+    FloatSize contentsSize = relativeCompositingBounds.size();
+
+    m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
+    m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.location()));
+
+    FloatSize oldSize = m_graphicsLayer->size();
+    if (oldSize != contentsSize) {
+        m_graphicsLayer->setSize(contentsSize);
+        // Usually invalidation will happen via layout etc, but if we've affected the layer
+        // size by constraining relative to a clipping ancestor or the viewport, we
+        // have to invalidate to avoid showing stretched content.
+        if (m_boundsConstrainedByClipping)
+            m_graphicsLayer->setNeedsDisplay();
+    }
+
+    // If we have a layer that clips children, position it.
+    IntRect clippingBox;
+    if (GraphicsLayer* clipLayer = clippingLayer()) {
+        clippingBox = clipBox(toRenderBox(renderer()));
+        clipLayer->setPosition(FloatPoint(clippingBox.location() - localCompositingBounds.location()));
+        clipLayer->setSize(clippingBox.size());
+        clipLayer->setOffsetFromRenderer(toIntSize(clippingBox.location()));
+    }
+
+    if (m_maskLayer) {
+        if (m_maskLayer->size() != m_graphicsLayer->size()) {
+            m_maskLayer->setSize(m_graphicsLayer->size());
+            m_maskLayer->setNeedsDisplay();
+        }
+        m_maskLayer->setPosition(FloatPoint());
+        m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
+    }
+
+    if (m_owningLayer->hasTransform()) {
+        const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect();
+
+        // Get layout bounds in the coords of compAncestor to match relativeCompositingBounds.
+        IntRect layerBounds = IntRect(delta, borderBox.size());
+
+        // Update properties that depend on layer dimensions
+        FloatPoint3D transformOrigin = computeTransformOrigin(borderBox);
+        // Compute the anchor point, which is in the center of the renderer box unless transform-origin is set.
+        FloatPoint3D anchor(relativeCompositingBounds.width() != 0.0f ? ((layerBounds.x() - relativeCompositingBounds.x()) + transformOrigin.x()) / relativeCompositingBounds.width()  : 0.5f,
+            relativeCompositingBounds.height() != 0.0f ? ((layerBounds.y() - relativeCompositingBounds.y()) + transformOrigin.y()) / relativeCompositingBounds.height() : 0.5f,
+            transformOrigin.z());
+        m_graphicsLayer->setAnchorPoint(anchor);
+
+        RenderStyle* style = renderer()->style();
+        GraphicsLayer* clipLayer = clippingLayer();
+        if (style->hasPerspective()) {
+            TransformationMatrix t = owningLayer()->perspectiveTransform();
+
+            if (clipLayer) {
+                clipLayer->setChildrenTransform(t);
+                m_graphicsLayer->setChildrenTransform(TransformationMatrix());
+            } else {
+                m_graphicsLayer->setChildrenTransform(t);
+            }
+        } else {
+            if (clipLayer)
+                clipLayer->setChildrenTransform(TransformationMatrix());
+            else
+                m_graphicsLayer->setChildrenTransform(TransformationMatrix());
+        }
+    } else {
+        m_graphicsLayer->setAnchorPoint(FloatPoint3D(0.5f, 0.5f, 0));
+    }
+
+    if (m_foregroundLayer) {
+        FloatPoint foregroundPosition;
+        FloatSize foregroundSize = contentsSize;
+        IntSize foregroundOffset = m_graphicsLayer->offsetFromRenderer();
+        if (hasClippingLayer()) {
+            // If we have a clipping layer (which clips descendants), then the foreground layer is a child of it,
+            // so that it gets correctly sorted with children. In that case, position relative to the clipping layer.
+            foregroundSize = FloatSize(clippingBox.size());
+            foregroundOffset = toIntSize(clippingBox.location());
+        }
+
+        m_foregroundLayer->setPosition(foregroundPosition);
+        if (foregroundSize != m_foregroundLayer->size()) {
+            m_foregroundLayer->setSize(foregroundSize);
+            m_foregroundLayer->setNeedsDisplay();
+        }
+        m_foregroundLayer->setOffsetFromRenderer(foregroundOffset);
+    }
+
+    if (m_backgroundLayer) {
+        FloatPoint backgroundPosition;
+        FloatSize backgroundSize = contentsSize;
+        if (backgroundLayerPaintsFixedRootBackground()) {
+            FrameView* frameView = toRenderView(renderer())->frameView();
+            backgroundSize = frameView->visibleContentRect().size();
+        }
+        m_backgroundLayer->setPosition(backgroundPosition);
+        if (backgroundSize != m_backgroundLayer->size()) {
+            m_backgroundLayer->setSize(backgroundSize);
+            m_backgroundLayer->setNeedsDisplay();
+        }
+        m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
+    }
+
+    if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->isComposited()) {
+        CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer->reflectionLayer()->compositedLayerMapping();
+        reflectionCompositedLayerMapping->updateGraphicsLayerGeometry();
+
+        // The reflection layer has the bounds of m_owningLayer->reflectionLayer(),
+        // but the reflected layer is the bounds of this layer, so we need to position it appropriately.
+        FloatRect layerBounds = compositedBounds();
+        FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->compositedBounds();
+        reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLayerPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location()));
+    }
+
+    if (m_scrollingLayer) {
+        ASSERT(m_scrollingContentsLayer);
+        RenderBox* renderBox = toRenderBox(renderer());
+        IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect());
+        // FIXME: We should make RenderBox::clientBoxRect consider scrollbar placement.
+        if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+            clientBox.move(renderBox->verticalScrollbarWidth(), 0);
+
+        IntSize adjustedScrollOffset = m_owningLayer->adjustedScrollOffset();
+        m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCompositingBounds.location()));
+        m_scrollingLayer->setSize(clientBox.size());
+
+        IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
+        m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()));
+
+        bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
+
+        IntSize scrollSize(renderBox->scrollWidth(), renderBox->scrollHeight());
+        if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetChanged)
+            m_scrollingContentsLayer->setNeedsDisplay();
+
+        IntSize scrollingContentsOffset = toIntSize(clientBox.location() - adjustedScrollOffset);
+        if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer() || scrollSize != m_scrollingContentsLayer->size()) {
+            bool scrollingCoordinatorHandlesOffset = compositor()->scrollingLayerDidChange(m_owningLayer);
+
+            if (scrollingCoordinatorHandlesOffset)
+                m_scrollingContentsLayer->setPosition(-m_owningLayer->scrollableArea()->scrollOrigin());
+            else
+                m_scrollingContentsLayer->setPosition(FloatPoint(-adjustedScrollOffset));
+        }
+
+        m_scrollingContentsLayer->setSize(scrollSize);
+        // FIXME: The paint offset and the scroll offset should really be separate concepts.
+        m_scrollingContentsLayer->setOffsetFromRenderer(scrollingContentsOffset, GraphicsLayer::DontSetNeedsDisplay);
+
+        if (m_foregroundLayer) {
+            if (m_foregroundLayer->size() != m_scrollingContentsLayer->size())
+                m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
+            m_foregroundLayer->setNeedsDisplay();
+            m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offsetFromRenderer());
+        }
+    }
+
+    // If this layer was created just for clipping or to apply perspective, it doesn't need its own backing store.
+    setRequiresOwnBackingStore(compositor()->requiresOwnBackingStore(m_owningLayer, compAncestor));
+
+    updateContentsRect(isSimpleContainer);
+    updateBackgroundColor(isSimpleContainer);
+    updateDrawsContent(isSimpleContainer);
+    updateContentsOpaque();
+    updateAfterWidgetResize();
+    registerScrollingLayers();
+
+    updateCompositingReasons();
+}
+
+void CompositedLayerMapping::registerScrollingLayers()
+{
+    // Register fixed position layers and their containers with the scrolling coordinator.
+    ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer);
+    if (!scrollingCoordinator)
+        return;
+
+    compositor()->updateViewportConstraintStatus(m_owningLayer);
+
+    scrollingCoordinator->updateLayerPositionConstraint(m_owningLayer);
+
+    // Page scale is applied as a transform on the root render view layer. Because the scroll
+    // layer is further up in the hierarchy, we need to avoid marking the root render view
+    // layer as a container.
+    bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLayer();
+    scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSuperlayers(), isContainer);
+}
+
+void CompositedLayerMapping::updateInternalHierarchy()
+{
+    // m_foregroundLayer has to be inserted in the correct order with child layers,
+    // so it's not inserted here.
+    if (m_ancestorClippingLayer)
+        m_ancestorClippingLayer->removeAllChildren();
+
+    m_graphicsLayer->removeFromParent();
+
+    if (m_ancestorClippingLayer)
+        m_ancestorClippingLayer->addChild(m_graphicsLayer.get());
+
+    if (m_childContainmentLayer) {
+        m_childContainmentLayer->removeFromParent();
+        m_graphicsLayer->addChild(m_childContainmentLayer.get());
+    }
+
+    if (m_scrollingLayer) {
+        GraphicsLayer* superlayer = m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsLayer.get();
+        m_scrollingLayer->removeFromParent();
+        superlayer->addChild(m_scrollingLayer.get());
+    }
+
+    // The clip for child layers does not include space for overflow controls, so they exist as
+    // siblings of the clipping layer if we have one. Normal children of this layer are set as
+    // children of the clipping layer.
+    if (m_layerForHorizontalScrollbar) {
+        m_layerForHorizontalScrollbar->removeFromParent();
+        m_graphicsLayer->addChild(m_layerForHorizontalScrollbar.get());
+    }
+    if (m_layerForVerticalScrollbar) {
+        m_layerForVerticalScrollbar->removeFromParent();
+        m_graphicsLayer->addChild(m_layerForVerticalScrollbar.get());
+    }
+    if (m_layerForScrollCorner) {
+        m_layerForScrollCorner->removeFromParent();
+        m_graphicsLayer->addChild(m_layerForScrollCorner.get());
+    }
+}
+
+void CompositedLayerMapping::updateContentsRect(bool isSimpleContainer)
+{
+    IntRect contentsRect;
+    if (isSimpleContainer && renderer()->hasBackground())
+        contentsRect = backgroundBox();
+    else
+        contentsRect = contentsBox();
+
+    m_graphicsLayer->setContentsRect(contentsRect);
+}
+
+void CompositedLayerMapping::updateDrawsContent(bool isSimpleContainer)
+{
+    if (m_scrollingLayer) {
+        // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere.
+        // m_graphicsLayer only needs backing store if the non-scrolling parts (background, outlines, borders, shadows etc) need to paint.
+        // m_scrollingLayer never has backing store.
+        // m_scrollingContentsLayer only needs backing store if the scrolled contents need to paint.
+        bool hasNonScrollingPaintedContent = m_owningLayer->hasVisibleContent() && m_owningLayer->hasBoxDecorationsOrBackground();
+        m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent);
+
+        bool hasScrollingPaintedContent = m_owningLayer->hasVisibleContent() && (renderer()->hasBackground() || paintsChildren());
+        m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent);
+        return;
+    }
+
+    bool hasPaintedContent = containsPaintedContent(isSimpleContainer);
+    if (hasPaintedContent && isAcceleratedCanvas(renderer())) {
+        CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node())->renderingContext();
+        // Content layer may be null if context is lost.
+        if (WebKit::WebLayer* contentLayer = context->platformLayer()) {
+            Color bgColor;
+            if (contentLayerSupportsDirectBackgroundComposition(renderer())) {
+                bgColor = rendererBackgroundColor();
+                hasPaintedContent = false;
+            }
+            contentLayer->setBackgroundColor(bgColor.rgb());
+        }
+    }
+
+    // FIXME: we could refine this to only allocate backings for one of these layers if possible.
+    m_graphicsLayer->setDrawsContent(hasPaintedContent);
+    if (m_foregroundLayer)
+        m_foregroundLayer->setDrawsContent(hasPaintedContent);
+
+    if (m_backgroundLayer)
+        m_backgroundLayer->setDrawsContent(hasPaintedContent);
+}
+
+// Return true if the layers changed.
+bool CompositedLayerMapping::updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip)
+{
+    bool layersChanged = false;
+
+    if (needsAncestorClip) {
+        if (!m_ancestorClippingLayer) {
+            m_ancestorClippingLayer = createGraphicsLayer(CompositingReasonLayerForClip);
+            m_ancestorClippingLayer->setMasksToBounds(true);
+            layersChanged = true;
+        }
+    } else if (m_ancestorClippingLayer) {
+        m_ancestorClippingLayer->removeFromParent();
+        m_ancestorClippingLayer = nullptr;
+        layersChanged = true;
+    }
+
+    if (needsDescendantClip) {
+        // We don't need a child containment layer if we're the main frame render view
+        // layer. It's redundant as the frame clip above us will handle this clipping.
+        if (!m_childContainmentLayer && !m_isMainFrameRenderViewLayer) {
+            m_childContainmentLayer = createGraphicsLayer(CompositingReasonLayerForClip);
+            m_childContainmentLayer->setMasksToBounds(true);
+            layersChanged = true;
+        }
+    } else if (hasClippingLayer()) {
+        m_childContainmentLayer->removeFromParent();
+        m_childContainmentLayer = nullptr;
+        layersChanged = true;
+    }
+
+    return layersChanged;
+}
+
+void CompositedLayerMapping::setBackgroundLayerPaintsFixedRootBackground(bool backgroundLayerPaintsFixedRootBackground)
+{
+    m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootBackground;
+}
+
+bool CompositedLayerMapping::updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer)
+{
+    bool horizontalScrollbarLayerChanged = false;
+    if (needsHorizontalScrollbarLayer) {
+        if (!m_layerForHorizontalScrollbar) {
+            m_layerForHorizontalScrollbar = createGraphicsLayer(CompositingReasonLayerForScrollbar);
+            horizontalScrollbarLayerChanged = true;
+        }
+    } else if (m_layerForHorizontalScrollbar) {
+        m_layerForHorizontalScrollbar = nullptr;
+        horizontalScrollbarLayerChanged = true;
+    }
+
+    bool verticalScrollbarLayerChanged = false;
+    if (needsVerticalScrollbarLayer) {
+        if (!m_layerForVerticalScrollbar) {
+            m_layerForVerticalScrollbar = createGraphicsLayer(CompositingReasonLayerForScrollbar);
+            verticalScrollbarLayerChanged = true;
+        }
+    } else if (m_layerForVerticalScrollbar) {
+        m_layerForVerticalScrollbar = nullptr;
+        verticalScrollbarLayerChanged = true;
+    }
+
+    bool scrollCornerLayerChanged = false;
+    if (needsScrollCornerLayer) {
+        if (!m_layerForScrollCorner) {
+            m_layerForScrollCorner = createGraphicsLayer(CompositingReasonLayerForScrollbar);
+            scrollCornerLayerChanged = true;
+        }
+    } else if (m_layerForScrollCorner) {
+        m_layerForScrollCorner = nullptr;
+        scrollCornerLayerChanged = true;
+    }
+
+    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
+        if (horizontalScrollbarLayerChanged)
+            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer->scrollableArea(), HorizontalScrollbar);
+        if (verticalScrollbarLayerChanged)
+            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer->scrollableArea(), VerticalScrollbar);
+    }
+
+    return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || scrollCornerLayerChanged;
+}
+
+void CompositedLayerMapping::positionOverflowControlsLayers(const IntSize& offsetFromRoot)
+{
+    IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer();
+    if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
+        Scrollbar* hBar = m_owningLayer->scrollableArea()->horizontalScrollbar();
+        if (hBar) {
+            layer->setPosition(hBar->frameRect().location() - offsetFromRoot - offsetFromRenderer);
+            layer->setSize(hBar->frameRect().size());
+            if (layer->hasContentsLayer())
+                layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().size()));
+        }
+        layer->setDrawsContent(hBar && !layer->hasContentsLayer());
+    }
+
+    if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
+        Scrollbar* vBar = m_owningLayer->scrollableArea()->verticalScrollbar();
+        if (vBar) {
+            layer->setPosition(vBar->frameRect().location() - offsetFromRoot - offsetFromRenderer);
+            layer->setSize(vBar->frameRect().size());
+            if (layer->hasContentsLayer())
+                layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().size()));
+        }
+        layer->setDrawsContent(vBar && !layer->hasContentsLayer());
+    }
+
+    if (GraphicsLayer* layer = layerForScrollCorner()) {
+        const LayoutRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect();
+        layer->setPosition(scrollCornerAndResizer.location() - offsetFromRenderer);
+        layer->setSize(scrollCornerAndResizer.size());
+        layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
+    }
+}
+
+bool CompositedLayerMapping::hasUnpositionedOverflowControlsLayers() const
+{
+    if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
+        if (!layer->drawsContent())
+            return true;
+    }
+
+    if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
+        if (!layer->drawsContent())
+            return true;
+    }
+
+    if (GraphicsLayer* layer = layerForScrollCorner()) {
+        if (!layer->drawsContent())
+            return true;
+    }
+
+    return false;
+}
+
+bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer)
+{
+    bool layerChanged = false;
+    if (needsForegroundLayer) {
+        if (!m_foregroundLayer) {
+            m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForForeground);
+            m_foregroundLayer->setDrawsContent(true);
+            m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
+            layerChanged = true;
+        }
+    } else if (m_foregroundLayer) {
+        m_foregroundLayer->removeFromParent();
+        m_foregroundLayer = nullptr;
+        layerChanged = true;
+    }
+
+    if (layerChanged)
+        m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
+
+    return layerChanged;
+}
+
+bool CompositedLayerMapping::updateBackgroundLayer(bool needsBackgroundLayer)
+{
+    bool layerChanged = false;
+    if (needsBackgroundLayer) {
+        if (!m_backgroundLayer) {
+            m_backgroundLayer = createGraphicsLayer(CompositingReasonLayerForBackground);
+            m_backgroundLayer->setDrawsContent(true);
+            m_backgroundLayer->setAnchorPoint(FloatPoint3D());
+            m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground);
+#if !OS(ANDROID)
+            m_backgroundLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true);
+            m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(false);
+#endif
+            layerChanged = true;
+        }
+    } else {
+        if (m_backgroundLayer) {
+            m_backgroundLayer->removeFromParent();
+            m_backgroundLayer = nullptr;
+#if !OS(ANDROID)
+            m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true);
+#endif
+            layerChanged = true;
+        }
+    }
+
+    if (layerChanged && !m_owningLayer->renderer()->documentBeingDestroyed())
+        compositor()->rootFixedBackgroundsChanged();
+
+    return layerChanged;
+}
+
+bool CompositedLayerMapping::updateMaskLayer(bool needsMaskLayer)
+{
+    bool layerChanged = false;
+    if (needsMaskLayer) {
+        if (!m_maskLayer) {
+            m_maskLayer = createGraphicsLayer(CompositingReasonLayerForMask);
+            m_maskLayer->setDrawsContent(true);
+            m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask);
+            layerChanged = true;
+        }
+    } else if (m_maskLayer) {
+        m_maskLayer = nullptr;
+        layerChanged = true;
+    }
+
+    if (layerChanged)
+        m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
+
+    return layerChanged;
+}
+
+bool CompositedLayerMapping::updateClippingMaskLayers(bool needsChildClippingMaskLayer)
+{
+    bool layerChanged = false;
+    if (needsChildClippingMaskLayer) {
+        if (!m_childClippingMaskLayer) {
+            m_childClippingMaskLayer = createGraphicsLayer(CompositingReasonLayerForMask);
+            m_childClippingMaskLayer->setDrawsContent(true);
+            m_childClippingMaskLayer->setPaintingPhase(GraphicsLayerPaintChildClippingMask);
+            layerChanged = true;
+        }
+    } else if (m_childClippingMaskLayer) {
+        m_childClippingMaskLayer = nullptr;
+        layerChanged = true;
+    }
+    return layerChanged;
+}
+
+bool CompositedLayerMapping::updateScrollingLayers(bool needsScrollingLayers)
+{
+    ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer);
+
+    bool layerChanged = false;
+    if (needsScrollingLayers) {
+        if (!m_scrollingLayer) {
+            // Outer layer which corresponds with the scroll view.
+            m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForClip);
+            m_scrollingLayer->setDrawsContent(false);
+            m_scrollingLayer->setMasksToBounds(true);
+
+            // Inner layer which renders the content that scrolls.
+            m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLayerForScrollingContainer);
+            m_scrollingContentsLayer->setDrawsContent(true);
+            GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowContents | GraphicsLayerPaintCompositedScroll;
+            if (!m_foregroundLayer)
+                paintPhase |= GraphicsLayerPaintForeground;
+            m_scrollingContentsLayer->setPaintingPhase(paintPhase);
+            m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
+
+            layerChanged = true;
+            if (scrollingCoordinator)
+                scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLayer->scrollableArea());
+        }
+    } else if (m_scrollingLayer) {
+        m_scrollingLayer = nullptr;
+        m_scrollingContentsLayer = nullptr;
+        layerChanged = true;
+        if (scrollingCoordinator)
+            scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLayer->scrollableArea());
+    }
+
+    if (layerChanged) {
+        updateInternalHierarchy();
+        m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
+        m_graphicsLayer->setNeedsDisplay();
+        if (renderer()->view())
+            compositor()->scrollingLayerDidChange(m_owningLayer);
+    }
+
+    return layerChanged;
+}
+
+void CompositedLayerMapping::updateScrollParent(RenderLayer* scrollParent)
+{
+    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
+        if (m_ancestorClippingLayer) {
+            ASSERT(childForSuperlayers() == m_ancestorClippingLayer.get());
+            // If we have an ancestor clipping layer, it is the scroll child. The other layer that may have
+            // been the scroll child is the graphics layer. We will ensure that we clear its association
+            // with a scroll parent if it had one.
+            scrollingCoordinator->updateScrollParentForGraphicsLayer(m_ancestorClippingLayer.get(), scrollParent);
+            scrollingCoordinator->updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), 0);
+        } else {
+            ASSERT(childForSuperlayers() == m_graphicsLayer.get());
+            scrollingCoordinator->updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), scrollParent);
+        }
+    }
+}
+
+void CompositedLayerMapping::updateClipParent(RenderLayer* clipParent)
+{
+    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer))
+        scrollingCoordinator->updateClipParentForGraphicsLayer(m_graphicsLayer.get(), clipParent);
+}
+
+GraphicsLayerPaintingPhase CompositedLayerMapping::paintingPhaseForPrimaryLayer() const
+{
+    unsigned phase = 0;
+    if (!m_backgroundLayer)
+        phase |= GraphicsLayerPaintBackground;
+    if (!m_foregroundLayer)
+        phase |= GraphicsLayerPaintForeground;
+    if (!m_maskLayer)
+        phase |= GraphicsLayerPaintMask;
+
+    if (m_scrollingContentsLayer) {
+        phase &= ~GraphicsLayerPaintForeground;
+        phase |= GraphicsLayerPaintCompositedScroll;
+    }
+
+    if (m_owningLayer->compositingReasons() & CompositingReasonOverflowScrollingParent)
+        phase |= GraphicsLayerPaintCompositedScroll;
+
+    return static_cast<GraphicsLayerPaintingPhase>(phase);
+}
+
+float CompositedLayerMapping::compositingOpacity(float rendererOpacity) const
+{
+    float finalOpacity = rendererOpacity;
+
+    for (RenderLayer* curr = m_owningLayer->parent(); curr; curr = curr->parent()) {
+        // We only care about parents that are stacking contexts.
+        // Recall that opacity creates stacking context.
+        if (!curr->isStackingContainer())
+            continue;
+
+        // If we found a compositing layer, we want to compute opacity
+        // relative to it. So we can break here.
+        if (curr->isComposited())
+            break;
+
+        finalOpacity *= curr->renderer()->opacity();
+    }
+
+    return finalOpacity;
+}
+
+Color CompositedLayerMapping::rendererBackgroundColor() const
+{
+    RenderObject* backgroundRenderer = renderer();
+    if (backgroundRenderer->isRoot())
+        backgroundRenderer = backgroundRenderer->rendererForRootBackground();
+
+    return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor);
+}
+
+void CompositedLayerMapping::updateBackgroundColor(bool isSimpleContainer)
+{
+    Color backgroundColor = rendererBackgroundColor();
+    if (isSimpleContainer) {
+        m_graphicsLayer->setContentsToSolidColor(backgroundColor);
+        m_graphicsLayer->setBackgroundColor(Color());
+    } else {
+        // An unset (invalid) color will remove the solid color.
+        m_graphicsLayer->setContentsToSolidColor(Color());
+        m_graphicsLayer->setBackgroundColor(backgroundColor);
+    }
+}
+
+static bool supportsDirectBoxDecorationsComposition(const RenderObject* renderer)
+{
+    if (!GraphicsLayer::supportsBackgroundColorContent())
+        return false;
+
+    if (renderer->hasClip())
+        return false;
+
+    if (hasBoxDecorationsOrBackgroundImage(renderer->style()))
+        return false;
+
+    // FIXME: we should be able to allow backgroundComposite; However since this is not a common use case it has been deferred for now.
+    if (renderer->style()->backgroundComposite() != CompositeSourceOver)
+        return false;
+
+    if (renderer->style()->backgroundClip() == TextFillBox)
+        return false;
+
+    return true;
+}
+
+bool CompositedLayerMapping::paintsBoxDecorations() const
+{
+    if (!m_owningLayer->hasVisibleBoxDecorations())
+        return false;
+
+    if (!supportsDirectBoxDecorationsComposition(renderer()))
+        return true;
+
+    return false;
+}
+
+bool CompositedLayerMapping::paintsChildren() const
+{
+    if (m_owningLayer->hasVisibleContent() && m_owningLayer->hasNonEmptyChildRenderers())
+        return true;
+
+    if (hasVisibleNonCompositingDescendantLayers())
+        return true;
+
+    return false;
+}
+
+static bool isCompositedPlugin(RenderObject* renderer)
+{
+    return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing();
+}
+
+// A "simple container layer" is a RenderLayer which has no visible content to render.
+// It may have no children, or all its children may be themselves composited.
+// This is a useful optimization, because it allows us to avoid allocating backing store.
+bool CompositedLayerMapping::isSimpleContainerCompositingLayer() const
+{
+    RenderObject* renderObject = renderer();
+    if (renderObject->hasMask()) // masks require special treatment
+        return false;
+
+    if (renderObject->isReplaced() && !isCompositedPlugin(renderObject))
+        return false;
+
+    if (paintsBoxDecorations() || paintsChildren())
+        return false;
+
+    if (renderObject->isRenderRegion())
+        return false;
+
+    if (renderObject->node() && renderObject->node()->isDocumentNode()) {
+        // Look to see if the root object has a non-simple background
+        RenderObject* rootObject = renderObject->document().documentElement() ? renderObject->document().documentElement()->renderer() : 0;
+        if (!rootObject)
+            return false;
+
+        RenderStyle* style = rootObject->style();
+
+        // Reject anything that has a border, a border-radius or outline,
+        // or is not a simple background (no background, or solid color).
+        if (hasBoxDecorationsOrBackgroundImage(style))
+            return false;
+
+        // Now look at the body's renderer.
+        HTMLElement* body = renderObject->document().body();
+        RenderObject* bodyObject = (body && body->hasLocalName(bodyTag)) ? body->renderer() : 0;
+        if (!bodyObject)
+            return false;
+
+        style = bodyObject->style();
+
+        if (hasBoxDecorationsOrBackgroundImage(style))
+            return false;
+    }
+
+    return true;
+}
+
+static bool hasVisibleNonCompositingDescendant(RenderLayer* parent)
+{
+    // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512.
+    parent->updateLayerListsIfNeeded();
+
+#if !ASSERT_DISABLED
+    LayerListMutationDetector mutationChecker(parent);
+#endif
+
+    if (Vector<RenderLayer*>* normalFlowList = parent->normalFlowList()) {
+        size_t listSize = normalFlowList->size();
+        for (size_t i = 0; i < listSize; ++i) {
+            RenderLayer* curLayer = normalFlowList->at(i);
+            if (!curLayer->isComposited()
+                && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
+                return true;
+        }
+    }
+
+    if (parent->isStackingContainer()) {
+        if (!parent->hasVisibleDescendant())
+            return false;
+
+        // Use the m_hasCompositingDescendant bit to optimize?
+        if (Vector<RenderLayer*>* negZOrderList = parent->negZOrderList()) {
+            size_t listSize = negZOrderList->size();
+            for (size_t i = 0; i < listSize; ++i) {
+                RenderLayer* curLayer = negZOrderList->at(i);
+                if (!curLayer->isComposited()
+                    && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
+                    return true;
+            }
+        }
+
+        if (Vector<RenderLayer*>* posZOrderList = parent->posZOrderList()) {
+            size_t listSize = posZOrderList->size();
+            for (size_t i = 0; i < listSize; ++i) {
+                RenderLayer* curLayer = posZOrderList->at(i);
+                if (!curLayer->isComposited()
+                    && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
+                    return true;
+            }
+        }
+    }
+
+    return false;
+}
+
+// Conservative test for having no rendered children.
+bool CompositedLayerMapping::hasVisibleNonCompositingDescendantLayers() const
+{
+    return hasVisibleNonCompositingDescendant(m_owningLayer);
+}
+
+bool CompositedLayerMapping::containsPaintedContent(bool isSimpleContainer) const
+{
+    if (isSimpleContainer || paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer->isReflection())
+        return false;
+
+    if (isDirectlyCompositedImage())
+        return false;
+
+    // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely,
+    // and set background color on the layer in that case, instead of allocating backing store and painting.
+    if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo())
+        return m_owningLayer->hasBoxDecorationsOrBackground();
+
+    return true;
+}
+
+// An image can be directly compositing if it's the sole content of the layer, and has no box decorations
+// that require painting. Direct compositing saves backing store.
+bool CompositedLayerMapping::isDirectlyCompositedImage() const
+{
+    RenderObject* renderObject = renderer();
+
+    if (!renderObject->isImage() || m_owningLayer->hasBoxDecorationsOrBackground() || renderObject->hasClip())
+        return false;
+
+    RenderImage* imageRenderer = toRenderImage(renderObject);
+    if (ImageResource* cachedImage = imageRenderer->cachedImage()) {
+        if (!cachedImage->hasImage())
+            return false;
+
+        Image* image = cachedImage->imageForRenderer(imageRenderer);
+        if (!image->isBitmapImage())
+            return false;
+
+        return m_graphicsLayer->shouldDirectlyCompositeImage(image);
+    }
+
+    return false;
+}
+
+void CompositedLayerMapping::contentChanged(ContentChangeType changeType)
+{
+    if ((changeType == ImageChanged) && isDirectlyCompositedImage()) {
+        updateImageContents();
+        return;
+    }
+
+    if ((changeType == MaskImageChanged) && m_maskLayer) {
+        // The composited layer bounds relies on box->maskClipRect(), which changes
+        // when the mask image becomes available.
+        updateAfterLayout(CompositingChildrenOnly | IsUpdateRoot);
+    }
+
+    if ((changeType == CanvasChanged || changeType == CanvasPixelsChanged) && isAcceleratedCanvas(renderer())) {
+        m_graphicsLayer->setContentsNeedsDisplay();
+        return;
+    }
+}
+
+void CompositedLayerMapping::updateImageContents()
+{
+    ASSERT(renderer()->isImage());
+    RenderImage* imageRenderer = toRenderImage(renderer());
+
+    ImageResource* cachedImage = imageRenderer->cachedImage();
+    if (!cachedImage)
+        return;
+
+    Image* image = cachedImage->imageForRenderer(imageRenderer);
+    if (!image)
+        return;
+
+    // We have to wait until the image is fully loaded before setting it on the layer.
+    if (!cachedImage->isLoaded())
+        return;
+
+    // This is a no-op if the layer doesn't have an inner layer for the image.
+    m_graphicsLayer->setContentsToImage(image);
+    bool isSimpleContainer = false;
+    updateDrawsContent(isSimpleContainer);
+
+    // Image animation is "lazy", in that it automatically stops unless someone is drawing
+    // the image. So we have to kick the animation each time; this has the downside that the
+    // image will keep animating, even if its layer is not visible.
+    image->startAnimation();
+}
+
+FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borderBox) const
+{
+    RenderStyle* style = renderer()->style();
+
+    FloatPoint3D origin;
+    origin.setX(floatValueForLength(style->transformOriginX(), borderBox.width()));
+    origin.setY(floatValueForLength(style->transformOriginY(), borderBox.height()));
+    origin.setZ(style->transformOriginZ());
+
+    return origin;
+}
+
+FloatPoint CompositedLayerMapping::computePerspectiveOrigin(const IntRect& borderBox) const
+{
+    RenderStyle* style = renderer()->style();
+
+    float boxWidth = borderBox.width();
+    float boxHeight = borderBox.height();
+
+    FloatPoint origin;
+    origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth));
+    origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight));
+
+    return origin;
+}
+
+// Return the offset from the top-left of this compositing layer at which the renderer's contents are painted.
+IntSize CompositedLayerMapping::contentOffsetInCompostingLayer() const
+{
+    return IntSize(-m_compositedBounds.x(), -m_compositedBounds.y());
+}
+
+IntRect CompositedLayerMapping::contentsBox() const
+{
+    IntRect contentsBox = contentsRect(renderer());
+    contentsBox.move(contentOffsetInCompostingLayer());
+    return contentsBox;
+}
+
+IntRect CompositedLayerMapping::backgroundBox() const
+{
+    IntRect backgroundBox = backgroundRect(renderer());
+    backgroundBox.move(contentOffsetInCompostingLayer());
+    return backgroundBox;
+}
+
+GraphicsLayer* CompositedLayerMapping::parentForSublayers() const
+{
+    if (m_scrollingContentsLayer)
+        return m_scrollingContentsLayer.get();
+
+    return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsLayer.get();
+}
+
+GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const
+{
+    if (m_ancestorClippingLayer)
+        return m_ancestorClippingLayer.get();
+
+    return m_graphicsLayer.get();
+}
+
+void CompositedLayerMapping::setRequiresOwnBackingStore(bool requiresOwnBacking)
+{
+    if (requiresOwnBacking == m_requiresOwnBackingStore)
+        return;
+
+    m_requiresOwnBackingStore = requiresOwnBacking;
+
+    // This affects the answer to paintsIntoCompositedAncestor(), which in turn affects
+    // cached clip rects, so when it changes we have to clear clip rects on descendants.
+    m_owningLayer->clearClipRectsIncludingDescendants(PaintingClipRects);
+    m_owningLayer->repainter().computeRepaintRectsIncludingDescendants();
+
+    compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds());
+}
+
+void CompositedLayerMapping::setBlendMode(BlendMode)
+{
+}
+
+void CompositedLayerMapping::setContentsNeedDisplay()
+{
+    ASSERT(!paintsIntoCompositedAncestor());
+
+    if (m_graphicsLayer && m_graphicsLayer->drawsContent())
+        m_graphicsLayer->setNeedsDisplay();
+
+    if (m_foregroundLayer && m_foregroundLayer->drawsContent())
+        m_foregroundLayer->setNeedsDisplay();
+
+    if (m_backgroundLayer && m_backgroundLayer->drawsContent())
+        m_backgroundLayer->setNeedsDisplay();
+
+    if (m_maskLayer && m_maskLayer->drawsContent())
+        m_maskLayer->setNeedsDisplay();
+
+    if (m_childClippingMaskLayer && m_childClippingMaskLayer->drawsContent())
+        m_childClippingMaskLayer->setNeedsDisplay();
+
+    if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent())
+        m_scrollingContentsLayer->setNeedsDisplay();
+}
+
+// r is in the coordinate space of the layer's render object
+void CompositedLayerMapping::setContentsNeedDisplayInRect(const IntRect& r)
+{
+    ASSERT(!paintsIntoCompositedAncestor());
+
+    if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
+        IntRect layerDirtyRect = r;
+        layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer());
+        m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect);
+    }
+
+    if (m_foregroundLayer && m_foregroundLayer->drawsContent()) {
+        IntRect layerDirtyRect = r;
+        layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer());
+        m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect);
+    }
+
+    // FIXME: need to split out repaints for the background.
+    if (m_backgroundLayer && m_backgroundLayer->drawsContent()) {
+        IntRect layerDirtyRect = r;
+        layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer());
+        m_backgroundLayer->setNeedsDisplayInRect(layerDirtyRect);
+    }
+
+    if (m_maskLayer && m_maskLayer->drawsContent()) {
+        IntRect layerDirtyRect = r;
+        layerDirtyRect.move(-m_maskLayer->offsetFromRenderer());
+        m_maskLayer->setNeedsDisplayInRect(layerDirtyRect);
+    }
+
+    if (m_childClippingMaskLayer && m_childClippingMaskLayer->drawsContent()) {
+        IntRect layerDirtyRect = r;
+        layerDirtyRect.move(-m_childClippingMaskLayer->offsetFromRenderer());
+        m_childClippingMaskLayer->setNeedsDisplayInRect(layerDirtyRect);
+    }
+
+    if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) {
+        IntRect layerDirtyRect = r;
+        layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer());
+        m_scrollingContentsLayer->setNeedsDisplayInRect(layerDirtyRect);
+    }
+}
+
+void CompositedLayerMapping::doPaintTask(GraphicsLayerPaintInfo& paintInfo, GraphicsContext* context,
+    const IntRect& clip) // In the coords of rootLayer.
+{
+    if (paintsIntoCompositedAncestor()) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    FontCachePurgePreventer fontCachePurgePreventer;
+
+    RenderLayer::PaintLayerFlags paintFlags = 0;
+    if (paintInfo.paintingPhase & GraphicsLayerPaintBackground)
+        paintFlags |= RenderLayer::PaintLayerPaintingCompositingBackgroundPhase;
+    if (paintInfo.paintingPhase & GraphicsLayerPaintForeground)
+        paintFlags |= RenderLayer::PaintLayerPaintingCompositingForegroundPhase;
+    if (paintInfo.paintingPhase & GraphicsLayerPaintMask)
+        paintFlags |= RenderLayer::PaintLayerPaintingCompositingMaskPhase;
+    if (paintInfo.paintingPhase & GraphicsLayerPaintChildClippingMask)
+        paintFlags |= RenderLayer::PaintLayerPaintingChildClippingMaskPhase;
+    if (paintInfo.paintingPhase & GraphicsLayerPaintOverflowContents)
+        paintFlags |= RenderLayer::PaintLayerPaintingOverflowContents;
+    if (paintInfo.paintingPhase & GraphicsLayerPaintCompositedScroll)
+        paintFlags |= RenderLayer::PaintLayerPaintingCompositingScrollingPhase;
+
+    if (paintInfo.isBackgroundLayer)
+        paintFlags |= (RenderLayer::PaintLayerPaintingRootBackgroundOnly | RenderLayer::PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhase to walk child layers.
+    else if (compositor()->fixedRootBackgroundLayer())
+        paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground;
+
+    InspectorInstrumentation::willPaint(paintInfo.renderLayer->renderer());
+
+    // Note carefully: in theory it is appropriate to invoke context->save() here
+    // and restore the context after painting. For efficiency, we are assuming that
+    // it is equivalent to manually undo this offset translation, which means we are
+    // assuming that the context's space was not affected by the RenderLayer
+    // painting code.
+
+    LayoutSize offset = paintInfo.offsetFromRenderer;
+    context->translate(-offset);
+    LayoutRect relativeClip(clip);
+    relativeClip.move(offset);
+
+    // The dirtyRect is in the coords of the painting root.
+    IntRect dirtyRect = pixelSnappedIntRect(relativeClip);
+    if (!(paintInfo.paintingPhase & GraphicsLayerPaintOverflowContents))
+        dirtyRect.intersect(paintInfo.compositedBounds);
+
+#ifndef NDEBUG
+    paintInfo.renderLayer->renderer()->assertSubtreeIsLaidOut();
+#endif
+
+    // FIXME: GraphicsLayers need a way to split for RenderRegions.
+    RenderLayer::LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBehaviorNormal, LayoutSize());
+    paintInfo.renderLayer->paintLayerContents(context, paintingInfo, paintFlags);
+
+    ASSERT(!paintInfo.isBackgroundLayer || paintFlags & RenderLayer::PaintLayerPaintingRootBackgroundOnly);
+
+    if (paintInfo.renderLayer->containsDirtyOverlayScrollbars())
+        paintInfo.renderLayer->paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars);
+
+    ASSERT(!paintInfo.renderLayer->m_usedTransparency);
+
+    // Manually restore the context to its original state by applying the opposite translation.
+    context->translate(offset);
+
+    InspectorInstrumentation::didPaint(paintInfo.renderLayer->renderer(), context, clip);
+}
+
+static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
+{
+    if (!scrollbar)
+        return;
+
+    context.save();
+    const IntRect& scrollbarRect = scrollbar->frameRect();
+    context.translate(-scrollbarRect.x(), -scrollbarRect.y());
+    IntRect transformedClip = clip;
+    transformedClip.moveBy(scrollbarRect.location());
+    scrollbar->paint(&context, transformedClip);
+    context.restore();
+}
+
+// Up-call from compositing layer drawing callback.
+void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip)
+{
+#ifndef NDEBUG
+    if (Page* page = renderer()->frame()->page())
+        page->setIsPainting(true);
+#endif
+
+    if (graphicsLayer == m_graphicsLayer.get()
+        || graphicsLayer == m_foregroundLayer.get()
+        || graphicsLayer == m_backgroundLayer.get()
+        || graphicsLayer == m_maskLayer.get()
+        || graphicsLayer == m_childClippingMaskLayer.get()
+        || graphicsLayer == m_scrollingContentsLayer.get()) {
+
+        GraphicsLayerPaintInfo paintInfo;
+        paintInfo.renderLayer = m_owningLayer;
+        paintInfo.compositedBounds = compositedBounds();
+        paintInfo.offsetFromRenderer = graphicsLayer->offsetFromRenderer();
+        paintInfo.paintingPhase = paintingPhase;
+        paintInfo.isBackgroundLayer = (graphicsLayer == m_backgroundLayer);
+
+        // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
+        doPaintTask(paintInfo, &context, clip);
+    } else if (graphicsLayer == layerForHorizontalScrollbar()) {
+        paintScrollbar(m_owningLayer->scrollableArea()->horizontalScrollbar(), context, clip);
+    } else if (graphicsLayer == layerForVerticalScrollbar()) {
+        paintScrollbar(m_owningLayer->scrollableArea()->verticalScrollbar(), context, clip);
+    } else if (graphicsLayer == layerForScrollCorner()) {
+        const IntRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect();
+        context.save();
+        context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y());
+        IntRect transformedClip = clip;
+        transformedClip.moveBy(scrollCornerAndResizer.location());
+        m_owningLayer->paintScrollCorner(&context, IntPoint(), transformedClip);
+        m_owningLayer->paintResizer(&context, IntPoint(), transformedClip);
+        context.restore();
+    }
+#ifndef NDEBUG
+    if (Page* page = renderer()->frame()->page())
+        page->setIsPainting(false);
+#endif
+}
+
+void CompositedLayerMapping::didCommitChangesForLayer(const GraphicsLayer* layer) const
+{
+}
+
+bool CompositedLayerMapping::getCurrentTransform(const GraphicsLayer* graphicsLayer, TransformationMatrix& transform) const
+{
+    if (graphicsLayer != m_graphicsLayer.get())
+        return false;
+
+    if (m_owningLayer->hasTransform()) {
+        transform = m_owningLayer->currentTransform(RenderStyle::ExcludeTransformOrigin);
+        return true;
+    }
+    return false;
+}
+
+bool CompositedLayerMapping::isTrackingRepaints() const
+{
+    GraphicsLayerClient* client = compositor();
+    return client ? client->isTrackingRepaints() : false;
+}
+
+#ifndef NDEBUG
+void CompositedLayerMapping::verifyNotPainting()
+{
+    ASSERT(!renderer()->frame()->page() || !renderer()->frame()->page()->isPainting());
+}
+#endif
+
+bool CompositedLayerMapping::startAnimation(double timeOffset, const CSSAnimationData* anim, const KeyframeList& keyframes)
+{
+    bool hasTransform = renderer()->isBox() && keyframes.containsProperty(CSSPropertyWebkitTransform);
+    IntSize boxSize;
+    if (hasTransform)
+        boxSize = toRenderBox(renderer())->pixelSnappedBorderBoxRect().size();
+    WebAnimations animations(m_animationProvider->startAnimation(timeOffset, anim, keyframes, hasTransform, boxSize));
+    if (animations.isEmpty())
+        return false;
+
+    bool hasOpacity = keyframes.containsProperty(CSSPropertyOpacity);
+    bool hasFilter = keyframes.containsProperty(CSSPropertyWebkitFilter);
+    int animationId = m_animationProvider->getWebAnimationId(keyframes.animationName());
+
+    // Animating only some properties of the animation is not supported. So if the
+    // GraphicsLayer rejects any property of the animation, we have to remove the
+    // animation and return false to indicate un-accelerated animation is required.
+    if (hasTransform) {
+        if (!animations.m_transformAnimation || !m_graphicsLayer->addAnimation(animations.m_transformAnimation.get()))
+            return false;
+    }
+    if (hasOpacity) {
+        if (!animations.m_opacityAnimation || !m_graphicsLayer->addAnimation(animations.m_opacityAnimation.get())) {
+            if (hasTransform)
+                m_graphicsLayer->removeAnimation(animationId);
+            return false;
+        }
+    }
+    if (hasFilter) {
+        if (!animations.m_filterAnimation || !m_graphicsLayer->addAnimation(animations.m_filterAnimation.get())) {
+            if (hasTransform || hasOpacity)
+                m_graphicsLayer->removeAnimation(animationId);
+            return false;
+        }
+    }
+    return true;
+}
+
+void CompositedLayerMapping::animationPaused(double timeOffset, const String& animationName)
+{
+    int animationId = m_animationProvider->getWebAnimationId(animationName);
+    ASSERT(animationId);
+    m_graphicsLayer->pauseAnimation(animationId, timeOffset);
+}
+
+void CompositedLayerMapping::animationFinished(const String& animationName)
+{
+    int animationId = m_animationProvider->getWebAnimationId(animationName);
+    ASSERT(animationId);
+    m_graphicsLayer->removeAnimation(animationId);
+}
+
+bool CompositedLayerMapping::startTransition(double timeOffset, CSSPropertyID property, const RenderStyle* fromStyle, const RenderStyle* toStyle)
+{
+    ASSERT(property != CSSPropertyInvalid);
+    IntSize boxSize;
+    if (property == CSSPropertyWebkitTransform && m_owningLayer->hasTransform()) {
+        ASSERT(renderer()->isBox());
+        boxSize = toRenderBox(renderer())->pixelSnappedBorderBoxRect().size();
+    }
+    float fromOpacity = 0;
+    float toOpacity = 0;
+    if (property == CSSPropertyOpacity) {
+        fromOpacity = compositingOpacity(fromStyle->opacity());
+        toOpacity = compositingOpacity(toStyle->opacity());
+    }
+
+    // Although KeyframeAnimation can have multiple properties of the animation, ImplicitAnimation (= Transition) has only one animation property.
+    WebAnimations animations(m_animationProvider->startTransition(timeOffset, property, fromStyle,
+        toStyle, m_owningLayer->hasTransform(), m_owningLayer->hasFilter(), boxSize, fromOpacity, toOpacity));
+    if (animations.m_transformAnimation && m_graphicsLayer->addAnimation(animations.m_transformAnimation.get())) {
+        // To ensure that the correct transform is visible when the animation ends, also set the final transform.
+        updateTransform(toStyle);
+        return true;
+    }
+    if (animations.m_opacityAnimation && m_graphicsLayer->addAnimation(animations.m_opacityAnimation.get())) {
+        // To ensure that the correct opacity is visible when the animation ends, also set the final opacity.
+        updateOpacity(toStyle);
+        return true;
+    }
+    if (animations.m_filterAnimation && m_graphicsLayer->addAnimation(animations.m_filterAnimation.get())) {
+        // To ensure that the correct filter is visible when the animation ends, also set the final filter.
+        updateFilters(toStyle);
+        ASSERT_NOT_REACHED(); // Chromium compositor cannot accelerate filter yet.
+        return false;
+    }
+
+    return false;
+}
+
+void CompositedLayerMapping::transitionPaused(double timeOffset, CSSPropertyID property)
+{
+    int animationId = m_animationProvider->getWebAnimationId(property);
+    ASSERT(animationId);
+    m_graphicsLayer->pauseAnimation(animationId, timeOffset);
+}
+
+void CompositedLayerMapping::transitionFinished(CSSPropertyID property)
+{
+    int animationId = m_animationProvider->getWebAnimationId(property);
+    ASSERT(animationId);
+    m_graphicsLayer->removeAnimation(animationId);
+}
+
+void CompositedLayerMapping::notifyAnimationStarted(const GraphicsLayer*, double time)
+{
+    renderer()->animation()->notifyAnimationStarted(renderer(), time);
+}
+
+// This is used for the 'freeze' API, for testing only.
+void CompositedLayerMapping::suspendAnimations(double time)
+{
+    m_graphicsLayer->suspendAnimations(time);
+}
+
+void CompositedLayerMapping::resumeAnimations()
+{
+    m_graphicsLayer->resumeAnimations();
+}
+
+IntRect CompositedLayerMapping::compositedBounds() const
+{
+    return m_compositedBounds;
+}
+
+void CompositedLayerMapping::setCompositedBounds(const IntRect& bounds)
+{
+    m_compositedBounds = bounds;
+}
+
+CompositingLayerType CompositedLayerMapping::compositingLayerType() const
+{
+    if (m_graphicsLayer->hasContentsLayer())
+        return MediaCompositingLayer;
+
+    if (m_graphicsLayer->drawsContent())
+        return NormalCompositingLayer;
+
+    return ContainerCompositingLayer;
+}
+
+double CompositedLayerMapping::backingStoreMemoryEstimate() const
+{
+    double backingMemory;
+
+    // m_ancestorClippingLayer and m_childContainmentLayer are just used for masking or containment, so have no backing.
+    backingMemory = m_graphicsLayer->backingStoreMemoryEstimate();
+    if (m_foregroundLayer)
+        backingMemory += m_foregroundLayer->backingStoreMemoryEstimate();
+    if (m_backgroundLayer)
+        backingMemory += m_backgroundLayer->backingStoreMemoryEstimate();
+    if (m_maskLayer)
+        backingMemory += m_maskLayer->backingStoreMemoryEstimate();
+    if (m_childClippingMaskLayer)
+        backingMemory += m_childClippingMaskLayer->backingStoreMemoryEstimate();
+
+    if (m_scrollingContentsLayer)
+        backingMemory += m_scrollingContentsLayer->backingStoreMemoryEstimate();
+
+    if (m_layerForHorizontalScrollbar)
+        backingMemory += m_layerForHorizontalScrollbar->backingStoreMemoryEstimate();
+
+    if (m_layerForVerticalScrollbar)
+        backingMemory += m_layerForVerticalScrollbar->backingStoreMemoryEstimate();
+
+    if (m_layerForScrollCorner)
+        backingMemory += m_layerForScrollCorner->backingStoreMemoryEstimate();
+
+    return backingMemory;
+}
+
+String CompositedLayerMapping::debugName(const GraphicsLayer* graphicsLayer)
+{
+    String name;
+    if (graphicsLayer == m_graphicsLayer.get()) {
+        name = m_owningLayer->debugName();
+    } else if (graphicsLayer == m_ancestorClippingLayer.get()) {
+        name = "Ancestor Clipping Layer";
+    } else if (graphicsLayer == m_foregroundLayer.get()) {
+        name = m_owningLayer->debugName() + " (foreground) Layer";
+    } else if (graphicsLayer == m_backgroundLayer.get()) {
+        name = m_owningLayer->debugName() + " (background) Layer";
+    } else if (graphicsLayer == m_childContainmentLayer.get()) {
+        name = "Child Containment Layer";
+    } else if (graphicsLayer == m_maskLayer.get()) {
+        name = "Mask Layer";
+    } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
+        name = "Horizontal Scrollbar Layer";
+    } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
+        name = "Vertical Scrollbar Layer";
+    } else if (graphicsLayer == m_layerForScrollCorner.get()) {
+        name = "Scroll Corner Layer";
+    } else if (graphicsLayer == m_scrollingLayer.get()) {
+        name = "Scrolling Layer";
+    } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
+        name = "Scrolling Contents Layer";
+    } else {
+        ASSERT_NOT_REACHED();
+    }
+
+    return name;
+}
+
+} // namespace WebCore
diff --git a/Source/core/rendering/CompositedLayerMapping.h b/Source/core/rendering/CompositedLayerMapping.h
new file mode 100644
index 0000000..56cba63
--- /dev/null
+++ b/Source/core/rendering/CompositedLayerMapping.h
@@ -0,0 +1,335 @@
+/*
+ * Copyright (C) 2009, 2010, 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 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,
+ * 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 CompositedLayerMapping_h
+#define CompositedLayerMapping_h
+
+#include "core/platform/graphics/GraphicsLayer.h"
+#include "core/platform/graphics/GraphicsLayerClient.h"
+#include "core/rendering/RenderLayer.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatPoint3D.h"
+#include "platform/transforms/TransformationMatrix.h"
+
+namespace WebCore {
+
+class KeyframeList;
+class RenderLayerCompositor;
+class WebAnimationProvider;
+
+enum CompositingLayerType {
+    NormalCompositingLayer, // non-tiled layer with backing store
+    MediaCompositingLayer, // layer that contains an image, video, webGL or plugin
+    ContainerCompositingLayer // layer with no backing store
+};
+
+
+// A GraphicsLayerPaintInfo contains all the info needed to paint a partial subtree of RenderLayers into a GraphicsLayer.
+struct GraphicsLayerPaintInfo {
+    RenderLayer* renderLayer;
+
+    IntRect compositedBounds;
+
+    IntSize offsetFromRenderer;
+
+    GraphicsLayerPaintingPhase paintingPhase;
+
+    bool isBackgroundLayer;
+};
+
+// CompositedLayerMapping keeps track of how RenderLayers of the render tree correspond to
+// GraphicsLayers of the composited layer tree. Each instance of CompositedLayerMapping
+// manages a small cluster of GraphicsLayers and the references to which RenderLayers
+// and paint phases contribute to each GraphicsLayer.
+//
+// Currently (Oct. 2013) there is one CompositedLayerMapping for each RenderLayer,
+// but this is likely to evolve soon.
+class CompositedLayerMapping : public GraphicsLayerClient {
+    WTF_MAKE_NONCOPYABLE(CompositedLayerMapping); WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit CompositedLayerMapping(RenderLayer*);
+    ~CompositedLayerMapping();
+
+    RenderLayer* owningLayer() const { return m_owningLayer; }
+
+    enum UpdateAfterLayoutFlag {
+        CompositingChildrenOnly = 1 << 0,
+        NeedsFullRepaint = 1 << 1,
+        IsUpdateRoot = 1 << 2
+    };
+    typedef unsigned UpdateAfterLayoutFlags;
+    void updateAfterLayout(UpdateAfterLayoutFlags);
+
+    // Returns true if layer configuration changed.
+    bool updateGraphicsLayerConfiguration();
+    // Update graphics layer position and bounds.
+    void updateGraphicsLayerGeometry(); // make private
+    // Update whether layer needs blending.
+    void updateContentsOpaque();
+
+    GraphicsLayer* mainGraphicsLayer() const { return m_graphicsLayer.get(); }
+
+    // Layer to clip children
+    bool hasClippingLayer() const { return m_childContainmentLayer; }
+    GraphicsLayer* clippingLayer() const { return m_childContainmentLayer.get(); }
+
+    // Layer to get clipped by ancestor
+    bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer; }
+    GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer.get(); }
+
+    bool hasContentsLayer() const { return m_foregroundLayer; }
+    GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); }
+
+    GraphicsLayer* backgroundLayer() const { return m_backgroundLayer.get(); }
+    bool backgroundLayerPaintsFixedRootBackground() const { return m_backgroundLayerPaintsFixedRootBackground; }
+
+    bool hasScrollingLayer() const { return m_scrollingLayer; }
+    GraphicsLayer* scrollingLayer() const { return m_scrollingLayer.get(); }
+    GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); }
+
+    bool hasMaskLayer() const { return m_maskLayer; }
+    bool hasChildClippingMaskLayer() const { return m_childClippingMaskLayer; }
+
+    GraphicsLayer* parentForSublayers() const;
+    GraphicsLayer* childForSuperlayers() const;
+
+    // Returns true for a composited layer that has no backing store of its own, so
+    // paints into some ancestor layer.
+    bool paintsIntoCompositedAncestor() const { return !m_requiresOwnBackingStore; }
+
+    void setRequiresOwnBackingStore(bool);
+
+    void setContentsNeedDisplay();
+    // r is in the coordinate space of the layer's render object
+    void setContentsNeedDisplayInRect(const IntRect&);
+
+    // Notification from the renderer that its content changed.
+    void contentChanged(ContentChangeType);
+
+    // Interface to start, finish, suspend and resume animations and transitions
+    bool startTransition(double, CSSPropertyID, const RenderStyle* fromStyle, const RenderStyle* toStyle);
+    void transitionPaused(double timeOffset, CSSPropertyID);
+    void transitionFinished(CSSPropertyID);
+
+    bool startAnimation(double timeOffset, const CSSAnimationData*, const KeyframeList& keyframes);
+    void animationPaused(double timeOffset, const String& name);
+    void animationFinished(const String& name);
+
+    void suspendAnimations(double time = 0);
+    void resumeAnimations();
+
+    IntRect compositedBounds() const;
+    void setCompositedBounds(const IntRect&);
+    void updateCompositedBounds();
+
+    void updateAfterWidgetResize();
+    void positionOverflowControlsLayers(const IntSize& offsetFromRoot);
+    bool hasUnpositionedOverflowControlsLayers() const;
+
+    // GraphicsLayerClient interface
+    virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime) OVERRIDE;
+
+    virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip) OVERRIDE;
+
+    virtual void didCommitChangesForLayer(const GraphicsLayer*) const OVERRIDE;
+    virtual bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const OVERRIDE;
+
+    virtual bool isTrackingRepaints() const OVERRIDE;
+
+#ifndef NDEBUG
+    virtual void verifyNotPainting();
+#endif
+
+    IntRect contentsBox() const;
+    IntRect backgroundBox() const;
+
+    // For informative purposes only.
+    CompositingLayerType compositingLayerType() const;
+
+    GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
+    GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
+    GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
+
+    void updateFilters(const RenderStyle*);
+    bool canCompositeFilters() const { return m_canCompositeFilters; }
+
+    // Return an estimate of the backing store area (in pixels) allocated by this object's GraphicsLayers.
+    double backingStoreMemoryEstimate() const;
+
+    void setBlendMode(BlendMode);
+
+    virtual String debugName(const GraphicsLayer*) OVERRIDE;
+
+private:
+    void createPrimaryGraphicsLayer();
+    void destroyGraphicsLayers();
+
+    PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons);
+
+    RenderLayerModelObject* renderer() const { return m_owningLayer->renderer(); }
+    RenderLayerCompositor* compositor() const { return m_owningLayer->compositor(); }
+
+    void updateInternalHierarchy();
+    bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip);
+    bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer);
+    bool updateForegroundLayer(bool needsForegroundLayer);
+    bool updateBackgroundLayer(bool needsBackgroundLayer);
+    bool updateMaskLayer(bool needsMaskLayer);
+    bool updateClippingMaskLayers(bool needsChildClippingMaskLayer);
+    bool requiresHorizontalScrollbarLayer() const { return m_owningLayer->scrollableArea() && m_owningLayer->scrollableArea()->horizontalScrollbar(); }
+    bool requiresVerticalScrollbarLayer() const { return m_owningLayer->scrollableArea() && m_owningLayer->scrollableArea()->verticalScrollbar(); }
+    bool requiresScrollCornerLayer() const { return !m_owningLayer->scrollCornerAndResizerRect().isEmpty(); }
+    bool updateScrollingLayers(bool scrollingLayers);
+    void updateScrollParent(RenderLayer*);
+    void updateClipParent(RenderLayer*);
+    void updateDrawsContent(bool isSimpleContainer);
+    void registerScrollingLayers();
+
+    void setBackgroundLayerPaintsFixedRootBackground(bool);
+
+    GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const;
+
+    IntSize contentOffsetInCompostingLayer() const;
+    // Result is transform origin in pixels.
+    FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;
+    // Result is perspective origin in pixels.
+    FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const;
+
+    void updateOpacity(const RenderStyle*);
+    void updateTransform(const RenderStyle*);
+    void updateLayerBlendMode(const RenderStyle*);
+    // Return the opacity value that this layer should use for compositing.
+    float compositingOpacity(float rendererOpacity) const;
+
+    bool isMainFrameRenderViewLayer() const;
+
+    bool paintsBoxDecorations() const;
+    bool paintsChildren() const;
+
+    // Returns true if this compositing layer has no visible content.
+    bool isSimpleContainerCompositingLayer() const;
+    // Returns true if this layer has content that needs to be rendered by painting into the backing store.
+    bool containsPaintedContent(bool isSimpleContainer) const;
+    // Returns true if the RenderLayer just contains an image that we can composite directly.
+    bool isDirectlyCompositedImage() const;
+    void updateImageContents();
+
+    Color rendererBackgroundColor() const;
+    void updateBackgroundColor(bool isSimpleContainer);
+    void updateContentsRect(bool isSimpleContainer);
+
+    void updateCompositingReasons();
+
+    bool hasVisibleNonCompositingDescendantLayers() const;
+
+    bool shouldClipCompositedBounds() const;
+
+    void doPaintTask(GraphicsLayerPaintInfo&, GraphicsContext*, const IntRect& clip);
+
+    RenderLayer* m_owningLayer;
+
+    // The hierarchy of layers that is maintained by the CompositedLayerMapping looks like this:
+    //
+    //  + m_ancestorClippingLayer [OPTIONAL]
+    //     + m_graphicsLayer
+    //        + m_childContainmentLayer [OPTIONAL] <-OR-> m_scrollingLayer [OPTIONAL]
+    //                                                     + m_scrollingContentsLayer [OPTIONAL]
+    //
+    // We need an ancestor clipping layer if our clipping ancestor is not our ancestor in the
+    // clipping tree. Here's what that might look like.
+    //
+    // Let A = the clipping ancestor,
+    //     B = the clip descendant, and
+    //     SC = the stacking context that is the ancestor of A and B in the stacking tree.
+    //
+    // SC
+    //  + A = m_graphicsLayer
+    //  |  + m_childContainmentLayer
+    //  |     + ...
+    //  ...
+    //  |
+    //  + B = m_ancestorClippingLayer [+]
+    //     + m_graphicsLayer
+    //        + ...
+    //
+    // In this case B is clipped by another layer that doesn't happen to be its ancestor: A.
+    // So we create an ancestor clipping layer for B, [+], which ensures that B is clipped
+    // as if it had been A's descendant.
+    OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context.
+    OwnPtr<GraphicsLayer> m_graphicsLayer;
+    OwnPtr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children.
+    OwnPtr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling.
+    OwnPtr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling.
+
+    // This layer is also added to the hierarchy by the RLB, but in a different way than
+    // the layers above. It's added to m_graphicsLayer as its mask layer (naturally) if
+    // we have a mask, and isn't part of the typical hierarchy (it has no children).
+    OwnPtr<GraphicsLayer> m_maskLayer; // Only used if we have a mask.
+    OwnPtr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path.
+
+    // There are two other (optional) layers whose painting is managed by the CompositedLayerMapping,
+    // but whose position in the hierarchy is maintained by the RenderLayerCompositor. These
+    // are the foreground and background layers. The foreground layer exists if we have composited
+    // descendants with negative z-order. We need the extra layer in this case because the layer
+    // needs to draw both below (for the background, say) and above (for the normal flow content, say)
+    // the negative z-order descendants and this is impossible with a single layer. The RLC handles
+    // inserting m_foregroundLayer in the correct position in our descendant list for us (right after
+    // the neg z-order dsecendants).
+    //
+    // The background layer is only created if this is the root layer and our background is entirely
+    // fixed. In this case we want to put the background in a separate composited layer so that when
+    // we scroll, we don't have to re-raster the background into position. This layer is also inserted
+    // into the tree by the RLC as it gets a special home. This layer becomes a descendant of the
+    // frame clipping layer. That is:
+    //   ...
+    //     + frame clipping layer
+    //       + m_backgroundLayer
+    //       + frame scrolling layer
+    //         + root content layer
+    //
+    // With the hierarchy set up like this, the root content layer is able to scroll without affecting
+    // the background layer (or repainting).
+    OwnPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately.
+    OwnPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately.
+
+    OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar;
+    OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
+    OwnPtr<GraphicsLayer> m_layerForScrollCorner;
+
+    OwnPtr<WebAnimationProvider> m_animationProvider;
+
+    IntRect m_compositedBounds;
+
+    bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work
+    bool m_boundsConstrainedByClipping;
+    bool m_isMainFrameRenderViewLayer;
+    bool m_requiresOwnBackingStore;
+    bool m_canCompositeFilters;
+    bool m_backgroundLayerPaintsFixedRootBackground;
+};
+
+} // namespace WebCore
+
+#endif // CompositedLayerMapping_h
diff --git a/Source/core/rendering/CompositingReasons.h b/Source/core/rendering/CompositingReasons.h
index 47713ee..2371129 100644
--- a/Source/core/rendering/CompositingReasons.h
+++ b/Source/core/rendering/CompositingReasons.h
@@ -47,7 +47,7 @@
 // a layer if anything else in the subtree is composited.
 const uint64_t CompositingReasonRoot                                   = UINT64_C(1) << 25;
 
-// RenderLayerBacking internal hierarchy reasons
+// CompositedLayerMapping internal hierarchy reasons
 const uint64_t CompositingReasonLayerForClip                           = UINT64_C(1) << 26;
 const uint64_t CompositingReasonLayerForScrollbar                      = UINT64_C(1) << 27;
 const uint64_t CompositingReasonLayerForScrollingContainer             = UINT64_C(1) << 28;
diff --git a/Source/core/rendering/EllipsisBox.cpp b/Source/core/rendering/EllipsisBox.cpp
index c5cb7cf..9570a89 100644
--- a/Source/core/rendering/EllipsisBox.cpp
+++ b/Source/core/rendering/EllipsisBox.cpp
@@ -23,13 +23,13 @@
 #include "core/platform/graphics/DrawLooper.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/InlineTextBox.h"
 #include "core/rendering/PaintInfo.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/RootInlineBox.h"
 #include "core/rendering/style/ShadowData.h"
+#include "platform/graphics/TextRun.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/FilterEffectRenderer.cpp b/Source/core/rendering/FilterEffectRenderer.cpp
index b389aa4..fc82a76 100644
--- a/Source/core/rendering/FilterEffectRenderer.cpp
+++ b/Source/core/rendering/FilterEffectRenderer.cpp
@@ -32,7 +32,6 @@
 #include "core/fetch/DocumentResource.h"
 #include "core/fetch/DocumentResourceReference.h"
 #include "core/page/Page.h"
-#include "core/platform/FloatConversion.h"
 #include "core/platform/graphics/ColorSpace.h"
 #include "core/platform/graphics/filters/FEColorMatrix.h"
 #include "core/platform/graphics/filters/FEComponentTransfer.h"
@@ -45,9 +44,9 @@
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/svg/ReferenceFilterBuilder.h"
-
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGFilterPrimitiveStandardAttributes.h"
+#include "platform/FloatConversion.h"
 #include "wtf/MathExtras.h"
 #include <algorithm>
 
diff --git a/Source/core/rendering/FilterEffectRenderer.h b/Source/core/rendering/FilterEffectRenderer.h
index 2dfe268..2cc3281 100644
--- a/Source/core/rendering/FilterEffectRenderer.h
+++ b/Source/core/rendering/FilterEffectRenderer.h
@@ -26,16 +26,16 @@
 #ifndef FilterEffectRenderer_h
 #define FilterEffectRenderer_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/platform/graphics/IntRectExtent.h"
-#include "core/platform/graphics/LayoutRect.h"
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/FilterEffect.h"
 #include "core/platform/graphics/filters/FilterOperations.h"
 #include "core/platform/graphics/filters/SourceGraphic.h"
 #include "core/svg/graphics/filters/SVGFilterBuilder.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/IntRectExtent.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/rendering/FixedTableLayout.cpp b/Source/core/rendering/FixedTableLayout.cpp
index 2a51668..69cd248 100644
--- a/Source/core/rendering/FixedTableLayout.cpp
+++ b/Source/core/rendering/FixedTableLayout.cpp
@@ -22,11 +22,11 @@
 #include "config.h"
 #include "core/rendering/FixedTableLayout.h"
 
-#include "core/platform/LayoutUnit.h"
 #include "core/rendering/RenderTable.h"
 #include "core/rendering/RenderTableCell.h"
 #include "core/rendering/RenderTableCol.h"
 #include "core/rendering/RenderTableSection.h"
+#include "platform/LayoutUnit.h"
 
 /*
   The text below is from the CSS 2.1 specs.
diff --git a/Source/core/rendering/FloatingObjects.cpp b/Source/core/rendering/FloatingObjects.cpp
index bcd9846..b9ec441 100644
--- a/Source/core/rendering/FloatingObjects.cpp
+++ b/Source/core/rendering/FloatingObjects.cpp
@@ -374,8 +374,8 @@
     const FloatingObject* outermostFloat = adapter.outermostFloat();
     if (offsetMode == ShapeOutsideFloatShapeOffset && outermostFloat) {
         if (ShapeOutsideInfo* shapeOutside = outermostFloat->renderer()->shapeOutsideInfo()) {
-            shapeOutside->computeSegmentsForContainingBlockLine(m_renderer, outermostFloat, logicalTop, logicalHeight);
-            offset += shapeOutside->rightSegmentMarginBoxDelta();
+            shapeOutside->updateDeltasForContainingBlockLine(m_renderer, outermostFloat, logicalTop, logicalHeight);
+            offset += shapeOutside->rightMarginBoxDelta();
         }
     }
 
@@ -394,8 +394,8 @@
     const FloatingObject* outermostFloat = adapter.outermostFloat();
     if (offsetMode == ShapeOutsideFloatShapeOffset && outermostFloat) {
         if (ShapeOutsideInfo* shapeOutside = outermostFloat->renderer()->shapeOutsideInfo()) {
-            shapeOutside->computeSegmentsForContainingBlockLine(m_renderer, outermostFloat, logicalTop, logicalHeight);
-            offset += shapeOutside->leftSegmentMarginBoxDelta();
+            shapeOutside->updateDeltasForContainingBlockLine(m_renderer, outermostFloat, logicalTop, logicalHeight);
+            offset += shapeOutside->leftMarginBoxDelta();
         }
     }
 
diff --git a/Source/core/rendering/FloatingObjects.h b/Source/core/rendering/FloatingObjects.h
index 9b258e3..2d3457b 100644
--- a/Source/core/rendering/FloatingObjects.h
+++ b/Source/core/rendering/FloatingObjects.h
@@ -24,9 +24,9 @@
 #ifndef FloatingObjects_h
 #define FloatingObjects_h
 
-#include "core/platform/PODFreeListArena.h"
-#include "core/platform/PODIntervalTree.h"
 #include "core/rendering/RootInlineBox.h"
+#include "platform/PODFreeListArena.h"
+#include "platform/PODIntervalTree.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/OwnPtr.h"
 
@@ -97,6 +97,8 @@
     LayoutUnit logicalLeft(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? x() : y(); }
     LayoutUnit logicalRight(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? maxX() : maxY(); }
     LayoutUnit logicalWidth(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? width() : height(); }
+    LayoutUnit logicalHeight(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? height() : width(); }
+    LayoutSize logicalSize(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? m_frameRect.size() : m_frameRect.size().transposedSize(); }
 
     int pixelSnappedLogicalTop(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedY() : frameRect().pixelSnappedX(); }
     int pixelSnappedLogicalBottom(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedMaxY() : frameRect().pixelSnappedMaxX(); }
diff --git a/Source/core/rendering/GapRects.h b/Source/core/rendering/GapRects.h
index 48f7fec..951ad38 100644
--- a/Source/core/rendering/GapRects.h
+++ b/Source/core/rendering/GapRects.h
@@ -23,7 +23,7 @@
 #ifndef GapRects_h
 #define GapRects_h
 
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/HitTestLocation.h b/Source/core/rendering/HitTestLocation.h
index 3be7377..7edcd8e 100644
--- a/Source/core/rendering/HitTestLocation.h
+++ b/Source/core/rendering/HitTestLocation.h
@@ -22,10 +22,10 @@
 #ifndef HitTestLocation_h
 #define HitTestLocation_h
 
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/LayoutRect.h"
-#include "core/platform/graphics/RoundedRect.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/LayoutRect.h"
+#include "platform/geometry/RoundedRect.h"
 #include "wtf/Forward.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/OwnPtr.h"
diff --git a/Source/core/rendering/HitTestResult.cpp b/Source/core/rendering/HitTestResult.cpp
index f8e4caa..67b56d0 100644
--- a/Source/core/rendering/HitTestResult.cpp
+++ b/Source/core/rendering/HitTestResult.cpp
@@ -38,11 +38,12 @@
 #include "core/html/HTMLTextAreaElement.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
 #include "core/platform/Scrollbar.h"
 #include "core/rendering/HitTestLocation.h"
 #include "core/rendering/RenderImage.h"
+#include "core/rendering/RenderTextFragment.h"
 
 namespace WebCore {
 
@@ -50,6 +51,7 @@
 
 HitTestResult::HitTestResult()
     : m_isOverWidget(false)
+    , m_isFirstLetter(false)
 {
 }
 
@@ -57,12 +59,14 @@
     : m_hitTestLocation(point)
     , m_pointInInnerNodeFrame(point)
     , m_isOverWidget(false)
+    , m_isFirstLetter(false)
 {
 }
 
 HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
     : m_hitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding)
     , m_pointInInnerNodeFrame(centerPoint)
+    , m_isFirstLetter(false)
     , m_isOverWidget(false)
 {
 }
@@ -70,6 +74,7 @@
 HitTestResult::HitTestResult(const HitTestLocation& other)
     : m_hitTestLocation(other)
     , m_pointInInnerNodeFrame(m_hitTestLocation.point())
+    , m_isFirstLetter(false)
     , m_isOverWidget(false)
 {
 }
@@ -77,11 +82,13 @@
 HitTestResult::HitTestResult(const HitTestResult& other)
     : m_hitTestLocation(other.m_hitTestLocation)
     , m_innerNode(other.innerNode())
+    , m_innerPossiblyPseudoNode(other.m_innerPossiblyPseudoNode)
     , m_innerNonSharedNode(other.innerNonSharedNode())
     , m_pointInInnerNodeFrame(other.m_pointInInnerNodeFrame)
     , m_localPoint(other.localPoint())
     , m_innerURLElement(other.URLElement())
     , m_scrollbar(other.scrollbar())
+    , m_isFirstLetter(other.m_isFirstLetter)
     , m_isOverWidget(other.isOverWidget())
 {
     // Only copy the NodeSet in case of rect hit test.
@@ -96,11 +103,13 @@
 {
     m_hitTestLocation = other.m_hitTestLocation;
     m_innerNode = other.innerNode();
+    m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode();
     m_innerNonSharedNode = other.innerNonSharedNode();
     m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame;
     m_localPoint = other.localPoint();
     m_innerURLElement = other.URLElement();
     m_scrollbar = other.scrollbar();
+    m_isFirstLetter = other.m_isFirstLetter;
     m_isOverWidget = other.isOverWidget();
 
     // Only copy the NodeSet in case of rect hit test.
@@ -109,6 +118,16 @@
     return *this;
 }
 
+RenderObject* HitTestResult::renderer() const
+{
+    if (!m_innerNode)
+        return 0;
+    RenderObject* renderer = m_innerNode->renderer();
+    if (!m_isFirstLetter || !renderer || !renderer->isText() || !toRenderText(renderer)->isTextFragment())
+        return renderer;
+    return toRenderTextFragment(renderer)->firstRenderTextInFirstLetter();
+}
+
 void HitTestResult::setToNodesInDocumentTreeScope()
 {
     if (Node* node = innerNode()) {
@@ -141,6 +160,7 @@
 
 void HitTestResult::setInnerNode(Node* n)
 {
+    m_innerPossiblyPseudoNode = n;
     if (n && n->isPseudoElement())
         n = n->parentOrShadowHostNode();
     m_innerNode = n;
@@ -229,13 +249,6 @@
     return String();
 }
 
-String displayString(const String& string, const Node* node)
-{
-    if (!node)
-        return string;
-    return node->document().displayStringModifiedByEncoding(string);
-}
-
 String HitTestResult::altDisplayString() const
 {
     if (!m_innerNonSharedNode)
@@ -243,12 +256,12 @@
 
     if (m_innerNonSharedNode->hasTagName(imgTag)) {
         HTMLImageElement* image = toHTMLImageElement(m_innerNonSharedNode.get());
-        return displayString(image->getAttribute(altAttr), m_innerNonSharedNode.get());
+        return image->getAttribute(altAttr);
     }
 
     if (m_innerNonSharedNode->hasTagName(inputTag)) {
         HTMLInputElement* input = toHTMLInputElement(m_innerNonSharedNode.get());
-        return displayString(input->alt(), m_innerNonSharedNode.get());
+        return input->alt();
     }
 
     return String();
@@ -360,12 +373,17 @@
         makeRange(pos, pos).get(), DocumentMarker::MisspellingMarkers()).size() > 0;
 }
 
+bool HitTestResult::isOverLink() const
+{
+    return m_innerURLElement && m_innerURLElement->isLink();
+}
+
 String HitTestResult::titleDisplayString() const
 {
     if (!m_innerURLElement)
         return String();
 
-    return displayString(m_innerURLElement->title(), m_innerURLElement.get());
+    return m_innerURLElement->title();
 }
 
 String HitTestResult::textContent() const
@@ -439,6 +457,7 @@
 
     if (!m_innerNode && other.innerNode()) {
         m_innerNode = other.innerNode();
+        m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode();
         m_innerNonSharedNode = other.innerNonSharedNode();
         m_localPoint = other.localPoint();
         m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame;
@@ -485,9 +504,10 @@
 
 Element* HitTestResult::innerElement() const
 {
-    for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::parent(node))
+    for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::parent(node)) {
         if (node->isElementNode())
             return toElement(node);
+    }
 
     return 0;
 }
diff --git a/Source/core/rendering/HitTestResult.h b/Source/core/rendering/HitTestResult.h
index c22efab..a6cadad 100644
--- a/Source/core/rendering/HitTestResult.h
+++ b/Source/core/rendering/HitTestResult.h
@@ -22,12 +22,12 @@
 #ifndef HitTestResult_h
 #define HitTestResult_h
 
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/LayoutRect.h"
-#include "core/platform/text/TextDirection.h"
 #include "core/rendering/HitTestLocation.h"
 #include "core/rendering/HitTestRequest.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/LayoutRect.h"
+#include "platform/text/TextDirection.h"
 #include "wtf/Forward.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/OwnPtr.h"
@@ -41,6 +41,7 @@
 class Image;
 class KURL;
 class Node;
+class RenderObject;
 class RenderRegion;
 class Scrollbar;
 
@@ -58,6 +59,7 @@
     HitTestResult& operator=(const HitTestResult&);
 
     Node* innerNode() const { return m_innerNode.get(); }
+    Node* innerPossiblyPseudoNode() const { return m_innerPossiblyPseudoNode.get(); }
     Element* innerElement() const;
     Node* innerNonSharedNode() const { return m_innerNonSharedNode.get(); }
     Element* URLElement() const { return m_innerURLElement.get(); }
@@ -80,6 +82,8 @@
     const LayoutPoint& localPoint() const { return m_localPoint; }
     void setLocalPoint(const LayoutPoint& p) { m_localPoint = p; }
 
+    RenderObject* renderer() const;
+
     void setToNodesInDocumentTreeScope();
     void setToShadowHostIfInUserAgentShadowRoot();
 
@@ -89,6 +93,7 @@
     void setInnerNonSharedNode(Node*);
     void setURLElement(Element*);
     void setScrollbar(Scrollbar*);
+    void setIsFirstLetter(bool b) { m_isFirstLetter = b; }
     void setIsOverWidget(bool b) { m_isOverWidget = b; }
 
     Frame* targetFrame() const;
@@ -107,6 +112,7 @@
     bool isMisspelled() const;
     bool isContentEditable() const;
 
+    bool isOverLink() const;
     // Returns true if it is rect-based hit test and needs to continue until the rect is fully
     // enclosed by the boundaries of a node.
     bool addNodeToRectBasedTestResult(Node*, const HitTestRequest&, const HitTestLocation& pointInContainer, const LayoutRect& = LayoutRect());
@@ -127,6 +133,7 @@
     HitTestLocation m_hitTestLocation;
 
     RefPtr<Node> m_innerNode;
+    RefPtr<Node> m_innerPossiblyPseudoNode;
     RefPtr<Node> m_innerNonSharedNode;
     LayoutPoint m_pointInInnerNodeFrame; // The hit-tested point in innerNode frame coordinates.
     LayoutPoint m_localPoint; // A point in the local coordinate space of m_innerNonSharedNode's renderer. Allows us to efficiently
@@ -134,12 +141,11 @@
     RefPtr<Element> m_innerURLElement;
     RefPtr<Scrollbar> m_scrollbar;
     bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example).
+    bool m_isFirstLetter;
 
     mutable OwnPtr<NodeSet> m_rectBasedTestResult;
 };
 
-String displayString(const String&, const Node*);
-
 } // namespace WebCore
 
 #endif // HitTestResult_h
diff --git a/Source/core/rendering/HitTestingTransformState.cpp b/Source/core/rendering/HitTestingTransformState.cpp
index c7c94a6..93329a3 100644
--- a/Source/core/rendering/HitTestingTransformState.cpp
+++ b/Source/core/rendering/HitTestingTransformState.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/rendering/HitTestingTransformState.h"
 
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/HitTestingTransformState.h b/Source/core/rendering/HitTestingTransformState.h
index bd81312..86fbc40 100644
--- a/Source/core/rendering/HitTestingTransformState.h
+++ b/Source/core/rendering/HitTestingTransformState.h
@@ -26,11 +26,11 @@
 #ifndef HitTestingTransformState_h
 #define HitTestingTransformState_h
 
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/IntSize.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/transforms/AffineTransform.h"
+#include "platform/transforms/TransformationMatrix.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 
diff --git a/Source/core/rendering/ImageQualityController.cpp b/Source/core/rendering/ImageQualityController.cpp
index ebe6fd7..c21e6dc 100644
--- a/Source/core/rendering/ImageQualityController.cpp
+++ b/Source/core/rendering/ImageQualityController.cpp
@@ -31,8 +31,8 @@
 #include "config.h"
 #include "core/rendering/ImageQualityController.h"
 
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/platform/graphics/GraphicsContext.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/ImageQualityController.h b/Source/core/rendering/ImageQualityController.h
index c6487f1..3e6a4c7 100644
--- a/Source/core/rendering/ImageQualityController.h
+++ b/Source/core/rendering/ImageQualityController.h
@@ -32,11 +32,11 @@
 #define ImageQualityController_h
 
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/ImageOrientation.h"
 #include "core/platform/graphics/ImageSource.h"
-#include "core/platform/graphics/IntSize.h"
-#include "core/platform/graphics/LayoutSize.h"
 #include "core/rendering/RenderObject.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/geometry/LayoutSize.h"
+#include "platform/graphics/ImageOrientation.h"
 #include "wtf/HashMap.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/InlineBox.cpp b/Source/core/rendering/InlineBox.cpp
index fec2de0..eb32810 100644
--- a/Source/core/rendering/InlineBox.cpp
+++ b/Source/core/rendering/InlineBox.cpp
@@ -20,12 +20,12 @@
 #include "config.h"
 #include "core/rendering/InlineBox.h"
 
-#include "core/platform/Partitions.h"
 #include "core/platform/graphics/FontMetrics.h"
 #include "core/rendering/InlineFlowBox.h"
 #include "core/rendering/PaintInfo.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/RootInlineBox.h"
+#include "platform/Partitions.h"
 
 #ifndef NDEBUG
 #include <stdio.h>
diff --git a/Source/core/rendering/InlineBox.h b/Source/core/rendering/InlineBox.h
index fdb04d5..0b2856f 100644
--- a/Source/core/rendering/InlineBox.h
+++ b/Source/core/rendering/InlineBox.h
@@ -21,8 +21,8 @@
 #ifndef InlineBox_h
 #define InlineBox_h
 
-#include "core/platform/text/TextDirection.h"
 #include "core/rendering/RenderBoxModelObject.h"
+#include "platform/text/TextDirection.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp
index 2f90980..38f5c8f 100644
--- a/Source/core/rendering/InlineTextBox.cpp
+++ b/Source/core/rendering/InlineTextBox.cpp
@@ -29,7 +29,7 @@
 #include "core/dom/Text.h"
 #include "core/editing/Editor.h"
 #include "core/editing/InputMethodController.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/graphics/DrawLooper.h"
@@ -653,17 +653,6 @@
             paintSelection(context, boxOrigin, styleToUse, font, selectionFillColor);
     }
 
-    if (Frame* frame = renderer()->frame()) {
-        if (Page* page = frame->page()) {
-            // FIXME: Right now, InlineTextBoxes never call addRelevantUnpaintedObject() even though they might
-            // legitimately be unpainted if they are waiting on a slow-loading web font. We should fix that, and
-            // when we do, we will have to account for the fact the InlineTextBoxes do not always have unique
-            // renderers and Page currently relies on each unpainted object having a unique renderer.
-            if (paintInfo.phase == PaintPhaseForeground)
-                page->addRelevantRepaintedObject(renderer(), IntRect(boxOrigin.x(), boxOrigin.y(), logicalWidth(), logicalHeight()));
-        }
-    }
-
     // 2. Now paint the foreground, including text and decorations like underline/overline (in quirks mode only).
     int length = m_len;
     int maximumLength;
diff --git a/Source/core/rendering/InlineTextBox.h b/Source/core/rendering/InlineTextBox.h
index 3d6fdee..fd6198c 100644
--- a/Source/core/rendering/InlineTextBox.h
+++ b/Source/core/rendering/InlineTextBox.h
@@ -23,9 +23,9 @@
 #ifndef InlineTextBox_h
 #define InlineTextBox_h
 
-#include "core/platform/graphics/TextRun.h"
 #include "core/rendering/InlineBox.h"
 #include "core/rendering/RenderText.h" // so textRenderer() can be inline
+#include "platform/graphics/TextRun.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/LayoutRepainter.h b/Source/core/rendering/LayoutRepainter.h
index fe6129c..55fdd1e 100644
--- a/Source/core/rendering/LayoutRepainter.h
+++ b/Source/core/rendering/LayoutRepainter.h
@@ -26,7 +26,7 @@
 #ifndef LayoutRepainter_h
 #define LayoutRepainter_h
 
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/LayoutState.cpp b/Source/core/rendering/LayoutState.cpp
index 445aa35..fc87b5a 100644
--- a/Source/core/rendering/LayoutState.cpp
+++ b/Source/core/rendering/LayoutState.cpp
@@ -26,11 +26,11 @@
 #include "config.h"
 #include "core/rendering/LayoutState.h"
 
-#include "core/platform/Partitions.h"
 #include "core/rendering/ColumnInfo.h"
 #include "core/rendering/RenderInline.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderView.h"
+#include "platform/Partitions.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/LayoutState.h b/Source/core/rendering/LayoutState.h
index 3271905..2fb1e07 100644
--- a/Source/core/rendering/LayoutState.h
+++ b/Source/core/rendering/LayoutState.h
@@ -26,8 +26,8 @@
 #ifndef LayoutState_h
 #define LayoutState_h
 
-#include "core/platform/graphics/LayoutRect.h"
 #include "core/rendering/ColumnInfo.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/HashMap.h"
 #include "wtf/Noncopyable.h"
 
diff --git a/Source/core/rendering/LineWidth.cpp b/Source/core/rendering/LineWidth.cpp
index 35946fe..b18451f 100644
--- a/Source/core/rendering/LineWidth.cpp
+++ b/Source/core/rendering/LineWidth.cpp
@@ -44,8 +44,7 @@
     , m_isFirstLine(isFirstLine)
     , m_shouldIndentText(shouldIndentText)
 {
-    if (ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo())
-        m_segment = shapeInsideInfo->currentSegment();
+    updateCurrentShapeSegment();
     updateAvailableWidth();
 }
 
@@ -85,21 +84,21 @@
         if (previousFloat != newFloat && previousFloat->type() == newFloat->type()) {
             previousShapeOutsideInfo = previousFloat->renderer()->shapeOutsideInfo();
             if (previousShapeOutsideInfo)
-                previousShapeOutsideInfo->computeSegmentsForContainingBlockLine(&m_block, previousFloat, m_block.logicalHeight(), lineHeight);
+                previousShapeOutsideInfo->updateDeltasForContainingBlockLine(&m_block, previousFloat, m_block.logicalHeight(), lineHeight);
             break;
         }
     }
 
     ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo();
     if (shapeOutsideInfo)
-        shapeOutsideInfo->computeSegmentsForContainingBlockLine(&m_block, newFloat, m_block.logicalHeight(), lineHeight);
+        shapeOutsideInfo->updateDeltasForContainingBlockLine(&m_block, newFloat, m_block.logicalHeight(), lineHeight);
 
     if (newFloat->type() == FloatingObject::FloatLeft) {
         float newLeft = newFloat->logicalRight(m_block.isHorizontalWritingMode());
         if (previousShapeOutsideInfo)
-            newLeft -= previousShapeOutsideInfo->rightSegmentMarginBoxDelta();
+            newLeft -= previousShapeOutsideInfo->rightMarginBoxDelta();
         if (shapeOutsideInfo)
-            newLeft += shapeOutsideInfo->rightSegmentMarginBoxDelta();
+            newLeft += shapeOutsideInfo->rightMarginBoxDelta();
 
         if (shouldIndentText() && m_block.style()->isLeftToRightDirection())
             newLeft += floorToInt(m_block.textIndentOffset());
@@ -107,9 +106,9 @@
     } else {
         float newRight = newFloat->logicalLeft(m_block.isHorizontalWritingMode());
         if (previousShapeOutsideInfo)
-            newRight -= previousShapeOutsideInfo->leftSegmentMarginBoxDelta();
+            newRight -= previousShapeOutsideInfo->leftMarginBoxDelta();
         if (shapeOutsideInfo)
-            newRight += shapeOutsideInfo->leftSegmentMarginBoxDelta();
+            newRight += shapeOutsideInfo->leftMarginBoxDelta();
 
         if (shouldIndentText() && !m_block.style()->isLeftToRightDirection())
             newRight -= floorToInt(m_block.textIndentOffset());
@@ -158,6 +157,17 @@
         newLineRight = m_block.logicalRightOffsetForLine(floatLogicalBottom, shouldIndentText());
         newLineWidth = max(0.0f, newLineRight - newLineLeft);
         lastFloatLogicalBottom = floatLogicalBottom;
+
+        // FIXME: This code should be refactored to incorporate with the code above.
+        ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo();
+        if (shapeInsideInfo) {
+            LayoutUnit logicalOffsetFromShapeContainer = m_block.logicalOffsetFromShapeAncestorContainer(shapeInsideInfo->owner()).height();
+            LayoutUnit lineHeight = m_block.lineHeight(false, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
+            shapeInsideInfo->updateSegmentsForLine(lastFloatLogicalBottom + logicalOffsetFromShapeContainer, lineHeight);
+            updateCurrentShapeSegment();
+            updateAvailableWidth();
+        }
+
         if (newLineWidth >= m_uncommittedWidth)
             break;
     }
@@ -170,6 +180,12 @@
     }
 }
 
+void LineWidth::updateCurrentShapeSegment()
+{
+    if (ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo())
+        m_segment = shapeInsideInfo->currentSegment();
+}
+
 void LineWidth::computeAvailableWidthFromLeftAndRight()
 {
     m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth;
diff --git a/Source/core/rendering/LineWidth.h b/Source/core/rendering/LineWidth.h
index 9db6362..b8505aa 100644
--- a/Source/core/rendering/LineWidth.h
+++ b/Source/core/rendering/LineWidth.h
@@ -57,6 +57,8 @@
     void applyOverhang(RenderRubyRun*, RenderObject* startRenderer, RenderObject* endRenderer);
     void fitBelowFloats();
 
+    void updateCurrentShapeSegment();
+
     bool shouldIndentText() const { return m_shouldIndentText == IndentText; }
 
 private:
diff --git a/Source/core/rendering/OrderIterator.cpp b/Source/core/rendering/OrderIterator.cpp
index 1cda9c5..20926a5 100644
--- a/Source/core/rendering/OrderIterator.cpp
+++ b/Source/core/rendering/OrderIterator.cpp
@@ -38,7 +38,7 @@
 OrderIterator::OrderIterator(const RenderBox* containerBox)
     : m_containerBox(containerBox)
     , m_currentChild(0)
-    , m_orderValuesIterator(0)
+    , m_isReset(false)
 {
 }
 
@@ -54,12 +54,13 @@
         if (!m_currentChild) {
             if (m_orderValuesIterator == m_orderValues.end())
                 return 0;
-            if (m_orderValuesIterator) {
+
+            if (!m_isReset) {
                 ++m_orderValuesIterator;
                 if (m_orderValuesIterator == m_orderValues.end())
                     return 0;
             } else {
-                m_orderValuesIterator = m_orderValues.begin();
+                m_isReset = false;
             }
 
             m_currentChild = firstChildBox();
@@ -74,7 +75,8 @@
 void OrderIterator::reset()
 {
     m_currentChild = 0;
-    m_orderValuesIterator = 0;
+    m_orderValuesIterator = m_orderValues.begin();
+    m_isReset = true;
 }
 
 RenderBox* OrderIterator::firstChildBox()
@@ -100,34 +102,6 @@
 OrderIteratorPopulator::~OrderIteratorPopulator()
 {
     m_iterator.reset();
-
-    if (m_anyChildHasDefaultOrderValue)
-        m_iterator.m_orderValues.append(0);
-
-    if (m_iterator.m_orderValues.size() > 1)
-        removeDuplicatedOrderValues();
-
-    // Ensure that we release any extra memory we hold onto.
-    m_iterator.m_orderValues.shrinkToFit();
-}
-
-void OrderIteratorPopulator::removeDuplicatedOrderValues()
-{
-    OrderIterator::OrderValues& orderValues = m_iterator.m_orderValues;
-
-    std::sort(orderValues.begin(), orderValues.end());
-
-    int previous = orderValues[0];
-    size_t uniqueItemIndex = 0;
-    for (size_t i = 1; i < orderValues.size(); ++i) {
-        int current = orderValues[i];
-        if (current == previous)
-            continue;
-        ++uniqueItemIndex;
-        std::swap(orderValues[i], orderValues[uniqueItemIndex]);
-        previous = current;
-    }
-    orderValues.shrink(uniqueItemIndex + 1);
 }
 
 void OrderIteratorPopulator::storeChild(RenderBox* child)
@@ -139,11 +113,7 @@
 
 void OrderIteratorPopulator::collectChild(const RenderBox* child)
 {
-    // Avoid growing the vector for the common-case default value of 0.
-    if (int order = child->style()->order())
-        m_iterator.m_orderValues.append(order);
-    else
-        m_anyChildHasDefaultOrderValue = true;
+    m_iterator.m_orderValues.insert(child->style()->order());
 }
 
 } // namespace WebCore
diff --git a/Source/core/rendering/OrderIterator.h b/Source/core/rendering/OrderIterator.h
index 3f76985..2a01915 100644
--- a/Source/core/rendering/OrderIterator.h
+++ b/Source/core/rendering/OrderIterator.h
@@ -34,6 +34,8 @@
 #include "wtf/Noncopyable.h"
 #include "wtf/Vector.h"
 
+#include <set>
+
 namespace WebCore {
 
 class RenderBox;
@@ -61,22 +63,18 @@
     RenderBox* m_currentChild;
     size_t m_childIndex;
 
-    // The inline capacity for a single item is used to cover the most
-    // common case by far: if we only have the default 'order' value 0.
-    typedef Vector<int, 1> OrderValues;
+    typedef std::set<int> OrderValues;
     OrderValues m_orderValues;
-    Vector<int>::const_iterator m_orderValuesIterator;
+    OrderValues::const_iterator m_orderValuesIterator;
+    bool m_isReset;
 };
 
 class OrderIteratorPopulator {
 public:
-    OrderIteratorPopulator(OrderIterator& iterator)
+    explicit OrderIteratorPopulator(OrderIterator& iterator)
         : m_iterator(iterator)
-        , m_anyChildHasDefaultOrderValue(false)
     {
-        // Note that we don't release the memory here, we only invalidate the size.
-        // This avoids unneeded reallocation if the size ends up not changing.
-        m_iterator.m_orderValues.shrink(0);
+        m_iterator.m_orderValues.clear();
     }
 
     ~OrderIteratorPopulator();
@@ -85,10 +83,7 @@
     void collectChild(const RenderBox*);
 
 private:
-    void removeDuplicatedOrderValues();
-
     OrderIterator& m_iterator;
-    bool m_anyChildHasDefaultOrderValue;
 };
 
 } // namespace WebCore
diff --git a/Source/core/rendering/PaintInfo.h b/Source/core/rendering/PaintInfo.h
index 3f7aa80..2f9c26d 100644
--- a/Source/core/rendering/PaintInfo.h
+++ b/Source/core/rendering/PaintInfo.h
@@ -28,10 +28,10 @@
 
 #include <limits>
 #include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/graphics/IntRect.h"
-#include "core/platform/graphics/LayoutRect.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/PaintPhase.h"
+#include "platform/geometry/IntRect.h"
+#include "platform/geometry/LayoutRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/HashMap.h"
 #include "wtf/ListHashSet.h"
 
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index ecc9665..b9fabe2 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -32,11 +32,10 @@
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/transforms/TransformState.h"
 #include "core/rendering/ColumnInfo.h"
@@ -61,6 +60,7 @@
 #include "core/rendering/shapes/ShapeInsideInfo.h"
 #include "core/rendering/shapes/ShapeOutsideInfo.h"
 #include "core/rendering/svg/SVGTextRunRenderingContext.h"
+#include "platform/geometry/FloatQuad.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/TemporaryChange.h"
 
@@ -101,14 +101,12 @@
 bool RenderBlock::s_canPropagateFloatIntoSibling = false;
 
 // This class helps dispatching the 'overflow' event on layout change. overflow can be set on RenderBoxes, yet the existing code
-// only works on RenderBlocks. If this change, this class should be shared with other RenderBoxes.
+// only works on RenderBlocks. If this changes, this class should be shared with other RenderBoxes.
 class OverflowEventDispatcher {
     WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher);
 public:
     OverflowEventDispatcher(const RenderBlock* block)
         : m_block(block)
-        , m_hadHorizontalLayoutOverflow(false)
-        , m_hadVerticalLayoutOverflow(false)
     {
         m_shouldDispatchEvent = !m_block->isAnonymous() && m_block->hasOverflowClip() && m_block->document().hasListenerType(Document::OVERFLOWCHANGED_LISTENER);
         if (m_shouldDispatchEvent) {
@@ -127,9 +125,14 @@
 
         bool horizontalLayoutOverflowChanged = hasHorizontalLayoutOverflow != m_hadHorizontalLayoutOverflow;
         bool verticalLayoutOverflowChanged = hasVerticalLayoutOverflow != m_hadVerticalLayoutOverflow;
-        if (horizontalLayoutOverflowChanged || verticalLayoutOverflowChanged) {
-            if (FrameView* frameView = m_block->document().view())
-                frameView->scheduleEvent(OverflowEvent::create(horizontalLayoutOverflowChanged, hasHorizontalLayoutOverflow, verticalLayoutOverflowChanged, hasVerticalLayoutOverflow), m_block->node());
+
+        if (!horizontalLayoutOverflowChanged && !verticalLayoutOverflowChanged)
+            return;
+
+        if (FrameView* frameView = m_block->frameView()) {
+            RefPtr<OverflowEvent> event = OverflowEvent::create(horizontalLayoutOverflowChanged, hasHorizontalLayoutOverflow, verticalLayoutOverflowChanged, hasVerticalLayoutOverflow);
+            event->setTarget(m_block->node());
+            frameView->scheduleOverflowEvent(event);
         }
     }
 
@@ -1408,7 +1411,7 @@
 {
     RenderBox::imageChanged(image);
 
-    if (!parent())
+    if (!parent() || !everHadLayout())
         return;
 
     ShapeValue* shapeValue = style()->shapeInside();
@@ -1417,6 +1420,10 @@
         shapeInsideInfo->dirtyShapeSize();
         markShapeInsideDescendantsForLayout();
     }
+
+    ShapeValue* shapeOutsideValue = style()->shapeOutside();
+    if (isFloating() && shapeOutsideValue && shapeOutsideValue->image() && shapeOutsideValue->image()->data() == image)
+        parent()->setNeedsLayoutAndPrefWidthsRecalc();
 }
 
 void RenderBlock::updateShapeInsideInfoAfterStyleChange(const ShapeValue* shapeInside, const ShapeValue* oldShapeInside)
@@ -2408,12 +2415,17 @@
 {
     PaintPhase paintPhase = paintInfo.phase;
 
+    // Adjust our painting position if we're inside a scrolled layer (e.g., an overflow:auto div).
+    LayoutPoint scrolledOffset = paintOffset;
+    if (hasOverflowClip())
+        scrolledOffset.move(-scrolledContentOffset());
+
     // 1. paint background, borders etc
     if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && style()->visibility() == VISIBLE) {
         if (hasBoxDecorations())
             paintBoxDecorations(paintInfo, paintOffset);
         if (hasColumns() && !paintInfo.paintRootBackgroundOnly())
-            paintColumnRules(paintInfo, paintOffset);
+            paintColumnRules(paintInfo, scrolledOffset);
     }
 
     if (paintPhase == PaintPhaseMask && style()->visibility() == VISIBLE) {
@@ -2425,11 +2437,6 @@
     if (paintPhase == PaintPhaseBlockBackground || paintInfo.paintRootBackgroundOnly())
         return;
 
-    // Adjust our painting position if we're inside a scrolled layer (e.g., an overflow:auto div).
-    LayoutPoint scrolledOffset = paintOffset;
-    if (hasOverflowClip())
-        scrolledOffset.move(-scrolledContentOffset());
-
     // 2. paint contents
     if (paintPhase != PaintPhaseSelfOutline) {
         if (hasColumns())
@@ -3245,16 +3252,25 @@
     LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset.
     LayoutUnit logicalRightOffset; // Constant part of right offset.
     // FIXME Bug 102948: This only works for shape outside directly set on this block.
-    ShapeInsideInfo* shapeInsideInfo = this->shapeInsideInfo();
-    // FIXME: We should place the float based on its width/height.
-    if (shapeInsideInfo)
-        shapeInsideInfo->computeSegmentsForLine(logicalTopOffset, childBox->logicalHeight());
-    if (shapeInsideInfo && shapeInsideInfo->hasSegments() && shapeInsideInfo->segments().size() == 1) {
-        // FIXME Bug 102949: Add support for shapes with multipe segments.
+    ShapeInsideInfo* shapeInsideInfo = this->layoutShapeInsideInfo();
+    // FIXME: Implement behavior for right floats.
+    if (shapeInsideInfo) {
+        LayoutSize floatLogicalSize = floatingObject->logicalSize(isHorizontalWritingMode());
+        // floatingObject's logicalSize doesn't contain the actual height at this point, so we need to calculate it
+        floatLogicalSize.setHeight(logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox));
 
-        // The segment offsets are relative to the content box.
-        logicalRightOffset = logicalLeftOffset + shapeInsideInfo->segments()[0].logicalRight;
-        logicalLeftOffset += shapeInsideInfo->segments()[0].logicalLeft;
+        // FIXME: If the float doesn't fit in the shape we should push it under the content box
+        logicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(floatLogicalSize);
+        if (logicalHeight() > logicalTopOffset)
+            logicalTopOffset = logicalHeight();
+
+        SegmentList segments = shapeInsideInfo->computeSegmentsForLine(logicalTopOffset, floatLogicalSize.height());
+        // FIXME: Add support for shapes with multiple segments.
+        if (segments.size() == 1) {
+            // The segment offsets are relative to the content box.
+            logicalRightOffset = logicalLeftOffset + segments[0].logicalRight;
+            logicalLeftOffset += segments[0].logicalLeft;
+        }
     } else
         logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset);
 
@@ -3412,7 +3428,7 @@
     return true;
 }
 
-void RenderBlock::newLine(EClear clear)
+void RenderBlock::clearFloats(EClear clear)
 {
     positionNewFloats();
     // set y position
@@ -5485,8 +5501,8 @@
         // (the content inside them moves).  This matches WinIE as well, which just bottom-aligns them.
         // We also give up on finding a baseline if we have a vertical scrollbar, or if we are scrolled
         // vertically (e.g., an overflow:hidden block that has had scrollTop moved).
-        bool ignoreBaseline = (layer() && (isMarquee() || (direction == HorizontalLine ? (layer()->verticalScrollbar() || layer()->scrollYOffset())
-            : (layer()->horizontalScrollbar() || layer()->scrollXOffset())))) || (isWritingModeRoot() && !isRubyRun());
+        bool ignoreBaseline = (layer() && layer()->scrollableArea() && (isMarquee() || (direction == HorizontalLine ? (layer()->scrollableArea()->verticalScrollbar() || layer()->scrollYOffset())
+            : (layer()->scrollableArea()->horizontalScrollbar() || layer()->scrollXOffset())))) || (isWritingModeRoot() && !isRubyRun());
 
         int baselinePos = ignoreBaseline ? -1 : inlineBlockBaseline(direction);
 
@@ -5737,6 +5753,10 @@
     while (length < text.length() && shouldSkipForFirstLetter((text)[length]))
         length++;
 
+    // Bail if we didn't find a letter
+    if (text.length() && length == text.length())
+        return 0;
+
     // Account for first letter.
     length++;
 
@@ -5755,8 +5775,10 @@
     return length;
 }
 
-void RenderBlock::createFirstLetterRenderer(RenderObject* firstLetterBlock, RenderObject* currentChild)
+void RenderBlock::createFirstLetterRenderer(RenderObject* firstLetterBlock, RenderObject* currentChild, unsigned length)
 {
+    ASSERT(length && currentChild->isText());
+
     RenderObject* firstLetterContainer = currentChild->parent();
     RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetterContainer);
     RenderObject* firstLetter = 0;
@@ -5775,11 +5797,6 @@
     String oldText = textObj->originalText();
     ASSERT(oldText.impl());
 
-    unsigned length = firstLetterLength(oldText);
-
-    if (!length)
-        return;
-
     // Construct a text fragment for the text after the first letter.
     // This text fragment might be empty.
     RenderTextFragment* remainingText =
@@ -5818,12 +5835,18 @@
 
     // Drill into inlines looking for our first text child.
     RenderObject* currChild = firstLetterBlock->firstChild();
+    unsigned length = 0;
     while (currChild) {
-        if (currChild->isText())
-            break;
-        if (currChild->isListMarker())
+        if (currChild->isText()) {
+            // FIXME: If there is leading punctuation in a different RenderText than
+            // the first letter, we'll not apply the correct style to it.
+            length = firstLetterLength(toRenderText(currChild)->originalText());
+            if (length)
+                break;
             currChild = currChild->nextSibling();
-        else if (currChild->isFloatingOrOutOfFlowPositioned()) {
+        } else if (currChild->isListMarker()) {
+            currChild = currChild->nextSibling();
+        } else if (currChild->isFloatingOrOutOfFlowPositioned()) {
             if (currChild->style()->styleType() == FIRST_LETTER) {
                 currChild = currChild->firstChild();
                 break;
@@ -5856,7 +5879,7 @@
     // adding and removing children of firstLetterContainer.
     LayoutStateDisabler layoutStateDisabler(view());
 
-    createFirstLetterRenderer(firstLetterBlock, currChild);
+    createFirstLetterRenderer(firstLetterBlock, currChild, length);
 }
 
 // Helper methods for obtaining the last line, computing line counts and heights for line counts
@@ -6471,8 +6494,13 @@
             lineBox->setPaginationStrut(remainingLogicalHeight);
             lineBox->setIsFirstAfterPageBreak(true);
         }
-    } else if (remainingLogicalHeight == pageLogicalHeight && lineBox != firstRootBox())
-        lineBox->setIsFirstAfterPageBreak(true);
+    } else if (remainingLogicalHeight == pageLogicalHeight) {
+        // We're at the very top of a page or column.
+        if (lineBox != firstRootBox())
+            lineBox->setIsFirstAfterPageBreak(true);
+        if (lineBox != firstRootBox() || offsetFromLogicalTopOfFirstPage())
+            setPageBreak(logicalOffset, lineHeight);
+    }
 }
 
 bool RenderBlock::lineWidthForPaginatedLineChanged(RootInlineBox* rootBox, LayoutUnit lineDelta, RenderFlowThread* flowThread) const
diff --git a/Source/core/rendering/RenderBlock.h b/Source/core/rendering/RenderBlock.h
index 8608a82..a8360e7 100644
--- a/Source/core/rendering/RenderBlock.h
+++ b/Source/core/rendering/RenderBlock.h
@@ -23,8 +23,6 @@
 #ifndef RenderBlock_h
 #define RenderBlock_h
 
-#include "core/platform/graphics/TextRun.h"
-#include "core/platform/text/TextBreakIterator.h"
 #include "core/rendering/ColumnInfo.h"
 #include "core/rendering/FloatingObjects.h"
 #include "core/rendering/GapRects.h"
@@ -33,6 +31,8 @@
 #include "core/rendering/RootInlineBox.h"
 #include "core/rendering/shapes/ShapeInsideInfo.h"
 #include "core/rendering/style/ShapeValue.h"
+#include "platform/graphics/TextRun.h"
+#include "platform/text/TextBreakIterator.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/OwnPtr.h"
 
@@ -337,8 +337,8 @@
 
     // Accessors for logical width/height and margins in the containing block's block-flow direction.
     enum ApplyLayoutDeltaMode { ApplyLayoutDelta, DoNotApplyLayoutDelta };
-    LayoutUnit logicalWidthForChild(const RenderBox* child) { return isHorizontalWritingMode() ? child->width() : child->height(); }
-    LayoutUnit logicalHeightForChild(const RenderBox* child) { return isHorizontalWritingMode() ? child->height() : child->width(); }
+    LayoutUnit logicalWidthForChild(const RenderBox* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); }
+    LayoutUnit logicalHeightForChild(const RenderBox* child) const { return isHorizontalWritingMode() ? child->height() : child->width(); }
     LayoutUnit logicalTopForChild(const RenderBox* child) { return isHorizontalWritingMode() ? child->y() : child->x(); }
     void setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
     void setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
@@ -428,6 +428,7 @@
     }
     ShapeInsideInfo* layoutShapeInsideInfo() const;
     bool allowsShapeInsideInfoSharing() const { return !isInline() && !isFloating(); }
+    LayoutSize logicalOffsetFromShapeAncestorContainer(const RenderBlock* container) const;
     virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE;
 
     // inline-block elements paint all phases atomically. This function ensures that. Certain other elements
@@ -539,7 +540,6 @@
     void updateRegionsAndShapesAfterChildLayout(RenderFlowThread*, bool);
     void updateShapeInsideInfoAfterStyleChange(const ShapeValue*, const ShapeValue* oldShape);
     void relayoutShapeDescendantIfMoved(RenderBlock* child, LayoutSize offset);
-    LayoutSize logicalOffsetFromShapeAncestorContainer(const RenderBlock* container) const;
 
     virtual RenderObjectChildList* virtualChildren() OVERRIDE FINAL { return children(); }
     virtual const RenderObjectChildList* virtualChildren() const OVERRIDE FINAL { return children(); }
@@ -576,7 +576,7 @@
     // Called to lay out the legend for a fieldset or the ruby text of a ruby run.
     virtual RenderObject* layoutSpecialExcludedChild(bool /*relayoutChildren*/, SubtreeLayoutScope&) { return 0; }
 
-    void createFirstLetterRenderer(RenderObject* firstLetterBlock, RenderObject* currentChild);
+    void createFirstLetterRenderer(RenderObject* firstLetterBlock, RenderObject* currentChild, unsigned length);
     void updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderObject* firstLetterContainer);
 
     Node* nodeForHitTest() const;
@@ -724,7 +724,7 @@
 
     void markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit logicalBottom, RootInlineBox* highest = 0);
 
-    void newLine(EClear);
+    void clearFloats(EClear);
 
     Position positionForBox(InlineBox*, bool start = true) const;
     PositionWithAffinity positionForPointWithInlineChildren(const LayoutPoint&);
diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp
index 51faaef..5282fac 100644
--- a/Source/core/rendering/RenderBlockFlow.cpp
+++ b/Source/core/rendering/RenderBlockFlow.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/rendering/RenderBlockFlow.h"
 
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/LayoutRepainter.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderNamedFlowThread.h"
@@ -166,7 +166,7 @@
     if (updateLogicalWidthAndColumnWidth())
         relayoutChildren = true;
 
-    clearFloats();
+    rebuildFloatsFromIntruding();
 
     LayoutUnit previousHeight = logicalHeight();
     // FIXME: should this start out as borderAndPaddingLogicalHeight() + scrollbarLogicalHeight(),
@@ -563,7 +563,7 @@
     return result;
 }
 
-void RenderBlockFlow::clearFloats()
+void RenderBlockFlow::rebuildFloatsFromIntruding()
 {
     if (m_floatingObjects)
         m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode());
diff --git a/Source/core/rendering/RenderBlockFlow.h b/Source/core/rendering/RenderBlockFlow.h
index d01686e..0377315 100644
--- a/Source/core/rendering/RenderBlockFlow.h
+++ b/Source/core/rendering/RenderBlockFlow.h
@@ -56,7 +56,7 @@
     {
         LayoutUnit repaintLogicalTop = 0;
         LayoutUnit repaintLogicalBottom = 0;
-        clearFloats();
+        rebuildFloatsFromIntruding();
         layoutInlineChildren(true, repaintLogicalTop, repaintLogicalBottom);
     }
 
@@ -68,7 +68,7 @@
     void adjustPositionedBlock(RenderBox* child, const MarginInfo&);
     void adjustFloatingBlock(const MarginInfo&);
 
-    void clearFloats();
+    void rebuildFloatsFromIntruding();
 
 public:
     class MarginValues {
diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp
index 70bdd9a..d629591 100644
--- a/Source/core/rendering/RenderBlockLineLayout.cpp
+++ b/Source/core/rendering/RenderBlockLineLayout.cpp
@@ -22,7 +22,6 @@
 
 #include "config.h"
 
-#include "core/platform/text/BidiResolver.h"
 #include "core/rendering/InlineIterator.h"
 #include "core/rendering/InlineTextBox.h"
 #include "core/rendering/LineWidth.h"
@@ -41,6 +40,7 @@
 #include "core/rendering/shapes/ShapeInsideInfo.h"
 #include "core/rendering/svg/RenderSVGInlineText.h"
 #include "core/rendering/svg/SVGRootInlineBox.h"
+#include "platform/text/BidiResolver.h"
 #include "wtf/RefCountedLeakCounter.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/Vector.h"
@@ -66,48 +66,22 @@
     const Font* m_font;
 };
 
-class LineBreaker {
+class TrailingObjects {
 public:
-    LineBreaker(RenderBlock* block)
-        : m_block(block)
-    {
-        reset();
-    }
+    TrailingObjects();
+    void setTrailingWhitespace(RenderText*);
+    void clear();
+    void appendBoxIfNeeded(RenderBox*);
 
-    InlineIterator nextLineBreak(InlineBidiResolver&, LineInfo&, RenderTextInfo&, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements&);
+    enum CollapseFirstSpaceOrNot { DoNotCollapseFirstSpace, CollapseFirstSpace };
 
-    bool lineWasHyphenated() { return m_hyphenated; }
-    const Vector<RenderBox*>& positionedObjects() { return m_positionedObjects; }
-    EClear clear() { return m_clear; }
+    void updateMidpointsForTrailingBoxes(LineMidpointState&, const InlineIterator& lBreak, CollapseFirstSpaceOrNot);
+
 private:
-    void reset();
-
-    InlineIterator nextSegmentBreak(InlineBidiResolver&, LineInfo&, RenderTextInfo&, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements&);
-    void skipTrailingWhitespace(InlineIterator&, const LineInfo&);
-    void skipLeadingWhitespace(InlineBidiResolver&, LineInfo&, FloatingObject* lastFloatFromPreviousLine, LineWidth&);
-
-    RenderBlock* m_block;
-    bool m_hyphenated;
-    EClear m_clear;
-    Vector<RenderBox*> m_positionedObjects;
+    RenderText* m_whitespace;
+    Vector<RenderBox*, 4> m_boxes;
 };
 
-ShapeInsideInfo* RenderBlock::layoutShapeInsideInfo() const
-{
-    ShapeInsideInfo* shapeInsideInfo = view()->layoutState()->shapeInsideInfo();
-
-    if (!shapeInsideInfo && flowThreadContainingBlock() && allowsShapeInsideInfoSharing()) {
-        LayoutUnit lineHeight = this->lineHeight(false, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
-        // regionAtBlockOffset returns regions like an array first={0,N-1}, second={N,M-1}, ...
-        LayoutUnit offset = logicalHeight() + lineHeight - LayoutUnit(1);
-        RenderRegion* region = regionAtBlockOffset(offset);
-        if (region)
-            shapeInsideInfo = region->shapeInsideInfo();
-    }
-
-    return shapeInsideInfo;
-}
-
 class LineInfo {
 public:
     LineInfo()
@@ -154,6 +128,195 @@
     unsigned m_runsFromLeadingWhitespace;
 };
 
+static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBreak, RenderStyle* style)
+{
+    if (isFirstLine)
+        return IndentText;
+    if (isAfterHardLineBreak && style->textIndentLine() == TextIndentEachLine)
+        return IndentText;
+
+    return DoNotIndentText;
+}
+
+class LineBreaker {
+public:
+    LineBreaker(RenderBlock* block)
+        : m_block(block)
+    {
+        reset();
+    }
+
+    InlineIterator nextLineBreak(InlineBidiResolver&, LineInfo&, RenderTextInfo&, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements&);
+
+    bool lineWasHyphenated() { return m_hyphenated; }
+    const Vector<RenderBox*>& positionedObjects() { return m_positionedObjects; }
+    EClear clear() { return m_clear; }
+private:
+    void reset();
+
+    InlineIterator nextSegmentBreak(InlineBidiResolver&, LineInfo&, RenderTextInfo&, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements&);
+
+    class BreakingContext {
+    public:
+        BreakingContext(InlineBidiResolver& resolver, LineInfo& inLineInfo, LineWidth& lineWidth, RenderTextInfo& inRenderTextInfo, FloatingObject* inLastFloatFromPreviousLine, bool appliedStartWidth, RenderBlock* block)
+            : m_resolver(resolver)
+            , m_current(resolver.position())
+            , m_lineBreak(resolver.position())
+            , m_block(block)
+            , m_lastObject(m_current.m_obj)
+            , m_nextObject(0)
+            , m_currentStyle(0)
+            , m_blockStyle(block->style())
+            , m_lineInfo(inLineInfo)
+            , m_renderTextInfo(inRenderTextInfo)
+            , m_lastFloatFromPreviousLine(inLastFloatFromPreviousLine)
+            , m_width(lineWidth)
+            , m_currWS(NORMAL)
+            , m_lastWS(NORMAL)
+            , m_preservesNewline(false)
+            , m_atStart(true)
+            , m_ignoringSpaces(false)
+            , m_currentCharacterIsSpace(false)
+            , m_currentCharacterShouldCollapseIfPreWap(false)
+            , m_appliedStartWidth(appliedStartWidth)
+            , m_includeEndWidth(true)
+            , m_autoWrap(false)
+            , m_autoWrapWasEverTrueOnLine(false)
+            , m_floatsFitOnLine(true)
+            , m_collapseWhiteSpace(false)
+            , m_startingNewParagraph(m_lineInfo.previousLineBrokeCleanly())
+            , m_allowImagesToBreak(!block->document().inQuirksMode() || !block->isTableCell() || !m_blockStyle->logicalWidth().isIntrinsicOrAuto())
+            , m_atEnd(false)
+            , m_lineMidpointState(resolver.midpointState())
+        {
+            m_lineInfo.setPreviousLineBrokeCleanly(false);
+        }
+
+        void setupContext();
+
+        RenderObject* currentObject() { return m_current.m_obj; }
+        InlineIterator lineBreak() { return m_lineBreak; }
+        bool atEnd() { return m_atEnd; }
+
+        void initializeForCurrentObject();
+
+        void increment();
+
+        void handleBR(EClear&);
+        void handleOutOfFlowPositioned(Vector<RenderBox*>& positionedObjects);
+        void handleFloat();
+        void handleEmptyInline();
+        void handleReplaced();
+        bool handleText(WordMeasurements&, bool& hyphenated);
+        void commitAndUpdateLineBreakIfNeeded();
+        InlineIterator handleEndOfLine();
+
+        void clearLineBreakIfFitsOnLine()
+        {
+            if (m_width.fitsOnLine() || m_lastWS == NOWRAP)
+                m_lineBreak.clear();
+        }
+
+    private:
+        void skipTrailingWhitespace(InlineIterator&, const LineInfo&);
+
+        InlineBidiResolver& m_resolver;
+
+        InlineIterator m_current;
+        InlineIterator m_lineBreak;
+        InlineIterator m_startOfIgnoredSpaces;
+
+        RenderBlock* m_block;
+        RenderObject* m_lastObject;
+        RenderObject* m_nextObject;
+
+        RenderStyle* m_currentStyle;
+        RenderStyle* m_blockStyle;
+
+        LineInfo& m_lineInfo;
+
+        RenderTextInfo& m_renderTextInfo;
+
+        FloatingObject* m_lastFloatFromPreviousLine;
+
+        LineWidth m_width;
+
+        EWhiteSpace m_currWS;
+        EWhiteSpace m_lastWS;
+
+        bool m_preservesNewline;
+        bool m_atStart;
+        bool m_ignoringSpaces;
+        bool m_currentCharacterIsSpace;
+        bool m_currentCharacterShouldCollapseIfPreWap;
+        bool m_appliedStartWidth;
+        bool m_includeEndWidth;
+        bool m_autoWrap;
+        bool m_autoWrapWasEverTrueOnLine;
+        bool m_floatsFitOnLine;
+        bool m_collapseWhiteSpace;
+        bool m_startingNewParagraph;
+        bool m_allowImagesToBreak;
+        bool m_atEnd;
+
+        LineMidpointState& m_lineMidpointState;
+
+        TrailingObjects m_trailingObjects;
+    };
+
+    void skipLeadingWhitespace(InlineBidiResolver&, LineInfo&, FloatingObject* lastFloatFromPreviousLine, LineWidth&);
+
+    RenderBlock* m_block;
+    bool m_hyphenated;
+    EClear m_clear;
+    Vector<RenderBox*> m_positionedObjects;
+};
+
+inline void LineBreaker::BreakingContext::initializeForCurrentObject()
+{
+    m_currentStyle = m_current.m_obj->style();
+    m_nextObject = bidiNextSkippingEmptyInlines(m_block, m_current.m_obj);
+    if (m_nextObject && m_nextObject->parent() && !m_nextObject->parent()->isDescendantOf(m_current.m_obj->parent()))
+        m_includeEndWidth = true;
+
+    m_currWS = m_current.m_obj->isReplaced() ? m_current.m_obj->parent()->style()->whiteSpace() : m_currentStyle->whiteSpace();
+    m_lastWS = m_lastObject->isReplaced() ? m_lastObject->parent()->style()->whiteSpace() : m_lastObject->style()->whiteSpace();
+
+    m_autoWrap = RenderStyle::autoWrap(m_currWS);
+    m_autoWrapWasEverTrueOnLine = m_autoWrapWasEverTrueOnLine || m_autoWrap;
+
+    m_preservesNewline = m_current.m_obj->isSVGInlineText() ? false : RenderStyle::preserveNewline(m_currWS);
+
+    m_collapseWhiteSpace = RenderStyle::collapseWhiteSpace(m_currWS);
+}
+
+inline void LineBreaker::BreakingContext::increment()
+{
+    // Clear out our character space bool, since inline <pre>s don't collapse whitespace
+    // with adjacent inline normal/nowrap spans.
+    if (!m_collapseWhiteSpace)
+        m_currentCharacterIsSpace = false;
+
+    m_current.moveToStartOf(m_nextObject);
+    m_atStart = false;
+}
+
+ShapeInsideInfo* RenderBlock::layoutShapeInsideInfo() const
+{
+    ShapeInsideInfo* shapeInsideInfo = view()->layoutState()->shapeInsideInfo();
+
+    if (!shapeInsideInfo && flowThreadContainingBlock() && allowsShapeInsideInfoSharing()) {
+        LayoutUnit lineHeight = this->lineHeight(false, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
+        // regionAtBlockOffset returns regions like an array first={0,N-1}, second={N,M-1}, ...
+        LayoutUnit offset = logicalHeight() + lineHeight - LayoutUnit(1);
+        RenderRegion* region = regionAtBlockOffset(offset);
+        if (region)
+            shapeInsideInfo = region->shapeInsideInfo();
+    }
+
+    return shapeInsideInfo;
+}
+
 static inline LayoutUnit borderPaddingMarginStart(RenderInline* child)
 {
     return child->marginStart() + child->paddingStart() + child->borderStart();
@@ -832,16 +995,6 @@
     }
 }
 
-static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBreak, RenderStyle* style)
-{
-    if (isFirstLine)
-        return IndentText;
-    if (isAfterHardLineBreak && style->textIndentLine() == TextIndentEachLine)
-        return IndentText;
-
-    return DoNotIndentText;
-}
-
 static void updateLogicalInlinePositions(RenderBlock* block, float& lineLogicalLeft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight)
 {
     LayoutUnit lineLogicalHeight = block->minLineHeightForReplacedRenderer(firstLine, boxLogicalHeight);
@@ -1111,7 +1264,7 @@
     WTF::Unicode::Direction direction = textDirection == LTR ? LeftToRight : RightToLeft;
     RefPtr<BidiContext> context = BidiContext::create(textDirection == LTR ? 0 : 1, direction, isOverride, FromStyleOrDOM);
 
-    // This copies BidiStatus and may churn the ref on BidiContext. I doubt it matters.
+    // This copies BidiStatus and may churn the ref on BidiContext I doubt it matters.
     return BidiStatus(direction, direction, direction, context.release());
 }
 
@@ -1125,7 +1278,7 @@
 }
 
 // FIXME: BidiResolver should have this logic.
-static inline void constructBidiRunsForSegment(InlineBidiResolver& topResolver, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& endOfRuns, VisualDirectionOverride override, bool previousLineBrokeCleanly)
+static inline void constructBidiRunsForSegment(InlineBidiResolver& topResolver, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& endOfRuns, VisualDirectionOverride override, bool previousLineBrokeCleanly, bool isNewUBAParagraph)
 {
     // FIXME: We should pass a BidiRunList into createBidiRunsForLine instead
     // of the resolver owning the runs.
@@ -1152,9 +1305,12 @@
         InlineBidiResolver isolatedResolver;
         EUnicodeBidi unicodeBidi = isolatedInline->style()->unicodeBidi();
         TextDirection direction = isolatedInline->style()->direction();
-        if (unicodeBidi == Plaintext)
-            direction = determinePlaintextDirectionality(isolatedInline, startObj);
-        else {
+        if (unicodeBidi == Plaintext) {
+            if (isNewUBAParagraph)
+                direction = determinePlaintextDirectionality(isolatedInline, startObj);
+            else
+                direction = determinePlaintextDirectionality(isolatedInline);
+        } else {
             ASSERT(unicodeBidi == Isolate || unicodeBidi == IsolateOverride);
             direction = isolatedInline->style()->direction();
         }
@@ -1194,11 +1350,11 @@
     return segmentStart == segmentEnd;
 }
 
-static inline void constructBidiRunsForLine(const RenderBlock* block, InlineBidiResolver& topResolver, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& endOfLine, VisualDirectionOverride override, bool previousLineBrokeCleanly)
+static inline void constructBidiRunsForLine(const RenderBlock* block, InlineBidiResolver& topResolver, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& endOfLine, VisualDirectionOverride override, bool previousLineBrokeCleanly, bool isNewUBAParagraph)
 {
     ShapeInsideInfo* shapeInsideInfo = block->layoutShapeInsideInfo();
     if (!shapeInsideInfo || !shapeInsideInfo->hasSegments()) {
-        constructBidiRunsForSegment(topResolver, bidiRuns, endOfLine, override, previousLineBrokeCleanly);
+        constructBidiRunsForSegment(topResolver, bidiRuns, endOfLine, override, previousLineBrokeCleanly, isNewUBAParagraph);
         return;
     }
 
@@ -1220,7 +1376,7 @@
         }
         if (!segmentIsEmpty(segmentStart, segmentEnd)) {
             topResolver.setPosition(segmentStart, numberOfIsolateAncestors(segmentStart));
-            constructBidiRunsForSegment(topResolver, bidiRuns, segmentEnd, override, previousLineBrokeCleanly);
+            constructBidiRunsForSegment(topResolver, bidiRuns, segmentEnd, override, previousLineBrokeCleanly, isNewUBAParagraph);
         }
     }
 }
@@ -1393,7 +1549,7 @@
             // that the block really needed a full layout, we missed our chance to repaint the layer
             // before layout started.  Luckily the layer has cached the repaint rect for its original
             // position and size, and so we can use that to make a repaint happen now.
-            repaintUsingContainer(containerForRepaint(), pixelSnappedIntRect(layer()->repaintRect()));
+            repaintUsingContainer(containerForRepaint(), pixelSnappedIntRect(layer()->repainter().repaintRect()));
         }
     }
 
@@ -1424,7 +1580,7 @@
             if (lastObject->isBR()) {
                 EClear clear = lastObject->style()->clear();
                 if (clear != CNONE)
-                    newLine(clear);
+                    clearFloats(clear);
             }
         }
     }
@@ -1509,7 +1665,7 @@
     LayoutUnit lineHeight = this->lineHeight(layoutState.lineInfo().isFirstLine(), isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
 
     // FIXME: Bug 95361: It is possible for a line to grow beyond lineHeight, in which case these segments may be incorrect.
-    shapeInsideInfo->computeSegmentsForLine(LayoutSize(lineLeft, lineTop), lineHeight);
+    shapeInsideInfo->updateSegmentsForLine(LayoutSize(lineLeft, lineTop), lineHeight);
 
     pushShapeContentOverflowBelowTheContentBox(this, shapeInsideInfo, lineTop, lineHeight);
 }
@@ -1581,7 +1737,7 @@
 
     LayoutUnit lineTop = logicalLineTopInFlowThread - currentRegion->logicalTopForFlowThreadContent() + currentRegion->borderAndPaddingBefore();
     // FIXME: Shape inside on a region does not yet take into account its padding for nested flow blocks
-    shapeInsideInfo->computeSegmentsForLine(LayoutSize(0, lineTop), lineHeight);
+    shapeInsideInfo->updateSegmentsForLine(LayoutSize(0, lineTop), lineHeight);
 
     if (currentRegion->isLastRegion())
         pushShapeContentOverflowBelowTheContentBox(this, shapeInsideInfo, lineTop, lineHeight);
@@ -1590,6 +1746,16 @@
 bool RenderBlock::adjustLogicalLineTopAndLogicalHeightIfNeeded(ShapeInsideInfo* shapeInsideInfo, LayoutUnit absoluteLogicalTop, LineLayoutState& layoutState, InlineBidiResolver& resolver, FloatingObject* lastFloatFromPreviousLine, InlineIterator& end, WordMeasurements& wordMeasurements)
 {
     LayoutUnit adjustedLogicalLineTop = adjustLogicalLineTop(shapeInsideInfo, resolver.position(), end, wordMeasurements);
+
+    if (shapeInsideInfo) {
+        lastFloatFromPreviousLine = (containsFloats()) ? m_floatingObjects->set().last() : 0;
+        if (!wordMeasurements.size() && lastFloatFromPreviousLine) {
+            LayoutUnit floatLogicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(lastFloatFromPreviousLine->logicalSize(isHorizontalWritingMode()));
+            if (logicalHeight() < floatLogicalTopOffset)
+                adjustedLogicalLineTop = floatLogicalTopOffset;
+        }
+    }
+
     if (!adjustedLogicalLineTop)
         return false;
 
@@ -1600,7 +1766,6 @@
         newLogicalHeight = logicalHeight();
     }
 
-
     end = restartLayoutRunsAndFloatsInRange(logicalHeight(), newLogicalHeight, lastFloatFromPreviousLine, resolver, end);
     return true;
 }
@@ -1687,7 +1852,7 @@
             }
             // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine.
             BidiRunList<BidiRun>& bidiRuns = resolver.runs();
-            constructBidiRunsForLine(this, resolver, bidiRuns, end, override, layoutState.lineInfo().previousLineBrokeCleanly());
+            constructBidiRunsForLine(this, resolver, bidiRuns, end, override, layoutState.lineInfo().previousLineBrokeCleanly(), isNewUBAParagraph);
             ASSERT(resolver.position() == end);
 
             BidiRun* trailingSpaceRun = !layoutState.lineInfo().previousLineBrokeCleanly() ? handleTrailingSpaces(bidiRuns, resolver.context()) : 0;
@@ -1743,7 +1908,7 @@
 
         if (!layoutState.lineInfo().isEmpty()) {
             layoutState.lineInfo().setFirstLine(false);
-            newLine(lineBreaker.clear());
+            clearFloats(lineBreaker.clear());
         }
 
         if (m_floatingObjects && lastRootBox()) {
@@ -2362,7 +2527,7 @@
 // object iteration process.
 // NB. this function will insert any floating elements that would otherwise
 // be skipped but it will not position them.
-void LineBreaker::skipTrailingWhitespace(InlineIterator& iterator, const LineInfo& lineInfo)
+inline void LineBreaker::BreakingContext::skipTrailingWhitespace(InlineIterator& iterator, const LineInfo& lineInfo)
 {
     while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhitespace)) {
         RenderObject* object = iterator.m_obj;
@@ -2442,22 +2607,6 @@
     return font.width(run, fallbackFonts, &glyphOverflow);
 }
 
-class TrailingObjects {
-public:
-    TrailingObjects();
-    void setTrailingWhitespace(RenderText*);
-    void clear();
-    void appendBoxIfNeeded(RenderBox*);
-
-    enum CollapseFirstSpaceOrNot { DoNotCollapseFirstSpace, CollapseFirstSpace };
-
-    void updateMidpointsForTrailingBoxes(LineMidpointState&, const InlineIterator& lBreak, CollapseFirstSpaceOrNot);
-
-private:
-    RenderText* m_whitespace;
-    Vector<RenderBox*, 4> m_boxes;
-};
-
 TrailingObjects::TrailingObjects()
     : m_whitespace(0)
 {
@@ -2588,6 +2737,603 @@
     return iter.m_obj == renderer && iter.m_pos >= renderer->textLength();
 }
 
+inline void LineBreaker::BreakingContext::handleBR(EClear& clear)
+{
+    if (m_width.fitsOnLine()) {
+        RenderObject* br = m_current.m_obj;
+        m_lineBreak.moveToStartOf(br);
+        m_lineBreak.increment();
+
+        // A <br> always breaks a line, so don't let the line be collapsed
+        // away. Also, the space at the end of a line with a <br> does not
+        // get collapsed away. It only does this if the previous line broke
+        // cleanly. Otherwise the <br> has no effect on whether the line is
+        // empty or not.
+        if (m_startingNewParagraph)
+            m_lineInfo.setEmpty(false, m_block, &m_width);
+        m_trailingObjects.clear();
+        m_lineInfo.setPreviousLineBrokeCleanly(true);
+
+        // A <br> with clearance always needs a linebox in case the lines below it get dirtied later and
+        // need to check for floats to clear - so if we're ignoring spaces, stop ignoring them and add a
+        // run for this object.
+        if (m_ignoringSpaces && m_currentStyle->clear() != CNONE)
+            ensureLineBoxInsideIgnoredSpaces(m_lineMidpointState, br);
+
+        if (!m_lineInfo.isEmpty())
+            clear = m_currentStyle->clear();
+    }
+    m_atEnd = true;
+}
+
+inline void LineBreaker::BreakingContext::handleOutOfFlowPositioned(Vector<RenderBox*>& positionedObjects)
+{
+    // If our original display wasn't an inline type, then we can
+    // go ahead and determine our static inline position now.
+    RenderBox* box = toRenderBox(m_current.m_obj);
+    bool isInlineType = box->style()->isOriginalDisplayInlineType();
+    if (!isInlineType) {
+        m_block->setStaticInlinePositionForChild(box, m_block->logicalHeight(), m_block->startOffsetForContent(m_block->logicalHeight()));
+    } else {
+        // If our original display was an INLINE type, then we can go ahead
+        // and determine our static y position now.
+        box->layer()->setStaticBlockPosition(m_block->logicalHeight());
+    }
+
+    // If we're ignoring spaces, we have to stop and include this object and
+    // then start ignoring spaces again.
+    if (isInlineType || box->container()->isRenderInline()) {
+        if (m_ignoringSpaces)
+            ensureLineBoxInsideIgnoredSpaces(m_lineMidpointState, box);
+        m_trailingObjects.appendBoxIfNeeded(box);
+    } else {
+        positionedObjects.append(box);
+    }
+    m_width.addUncommittedWidth(inlineLogicalWidth(box));
+    // Reset prior line break context characters.
+    m_renderTextInfo.m_lineBreakIterator.resetPriorContext();
+}
+
+inline void LineBreaker::BreakingContext::handleFloat()
+{
+    RenderBox* floatBox = toRenderBox(m_current.m_obj);
+    FloatingObject* floatingObject = m_block->insertFloatingObject(floatBox);
+    // check if it fits in the current line.
+    // If it does, position it now, otherwise, position
+    // it after moving to next line (in newLine() func)
+    // FIXME: Bug 110372: Properly position multiple stacked floats with non-rectangular shape outside.
+    if (m_floatsFitOnLine && m_width.fitsOnLine(floatingObject->logicalWidth(m_block->isHorizontalWritingMode()))) {
+        m_block->positionNewFloatOnLine(floatingObject, m_lastFloatFromPreviousLine, m_lineInfo, m_width);
+        if (m_lineBreak.m_obj == m_current.m_obj) {
+            ASSERT(!m_lineBreak.m_pos);
+            m_lineBreak.increment();
+        }
+    } else {
+        m_floatsFitOnLine = false;
+    }
+    // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for floating element.
+    m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
+}
+
+inline void LineBreaker::BreakingContext::handleEmptyInline()
+{
+    // This should only end up being called on empty inlines
+    ASSERT(isEmptyInline(m_current.m_obj));
+
+    RenderInline* flowBox = toRenderInline(m_current.m_obj);
+
+    // Now that some inline flows have line boxes, if we are already ignoring spaces, we need
+    // to make sure that we stop to include this object and then start ignoring spaces again.
+    // If this object is at the start of the line, we need to behave like list markers and
+    // start ignoring spaces.
+    bool requiresLineBox = alwaysRequiresLineBox(m_current.m_obj);
+    if (requiresLineBox || requiresLineBoxForContent(flowBox, m_lineInfo)) {
+        // An empty inline that only has line-height, vertical-align or font-metrics will only get a
+        // line box to affect the height of the line if the rest of the line is not empty.
+        if (requiresLineBox)
+            m_lineInfo.setEmpty(false, m_block, &m_width);
+        if (m_ignoringSpaces) {
+            m_trailingObjects.clear();
+            ensureLineBoxInsideIgnoredSpaces(m_lineMidpointState, m_current.m_obj);
+        } else if (m_blockStyle->collapseWhiteSpace() && m_resolver.position().m_obj == m_current.m_obj
+            && shouldSkipWhitespaceAfterStartObject(m_block, m_current.m_obj, m_lineMidpointState)) {
+            // Like with list markers, we start ignoring spaces to make sure that any
+            // additional spaces we see will be discarded.
+            m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = true;
+            m_ignoringSpaces = true;
+        }
+    }
+
+    m_width.addUncommittedWidth(inlineLogicalWidth(m_current.m_obj) + borderPaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox));
+}
+
+inline void LineBreaker::BreakingContext::handleReplaced()
+{
+    RenderBox* replacedBox = toRenderBox(m_current.m_obj);
+
+    if (m_atStart)
+        m_width.updateAvailableWidth(replacedBox->logicalHeight());
+
+    // Break on replaced elements if either has normal white-space.
+    if ((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) && (!m_current.m_obj->isImage() || m_allowImagesToBreak)) {
+        m_width.commit();
+        m_lineBreak.moveToStartOf(m_current.m_obj);
+    }
+
+    if (m_ignoringSpaces)
+        stopIgnoringSpaces(m_lineMidpointState, InlineIterator(0, m_current.m_obj, 0));
+
+    m_lineInfo.setEmpty(false, m_block, &m_width);
+    m_ignoringSpaces = false;
+    m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = false;
+    m_trailingObjects.clear();
+
+    // Optimize for a common case. If we can't find whitespace after the list
+    // item, then this is all moot.
+    LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(replacedBox) + m_block->marginStartForChild(replacedBox) + m_block->marginEndForChild(replacedBox) + inlineLogicalWidth(m_current.m_obj);
+    if (m_current.m_obj->isListMarker()) {
+        if (m_blockStyle->collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, m_current.m_obj, m_lineMidpointState)) {
+            // Like with inline flows, we start ignoring spaces to make sure that any
+            // additional spaces we see will be discarded.
+            m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = true;
+            m_ignoringSpaces = true;
+        }
+        if (toRenderListMarker(m_current.m_obj)->isInside())
+            m_width.addUncommittedWidth(replacedLogicalWidth);
+    } else {
+        m_width.addUncommittedWidth(replacedLogicalWidth);
+    }
+    if (m_current.m_obj->isRubyRun())
+        m_width.applyOverhang(toRenderRubyRun(m_current.m_obj), m_lastObject, m_nextObject);
+    // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element.
+    m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
+}
+
+static inline void nextCharacter(UChar& currentCharacter, UChar& lastCharacter, UChar& secondToLastCharacter)
+{
+    secondToLastCharacter = lastCharacter;
+    lastCharacter = currentCharacter;
+}
+
+static void updateSegmentsForShapes(RenderBlock* block, const FloatingObject* lastFloatFromPreviousLine, const WordMeasurements& wordMeasurements, LineWidth& width, bool isFirstLine)
+{
+    ASSERT(lastFloatFromPreviousLine);
+
+    ShapeInsideInfo* shapeInsideInfo = block->layoutShapeInsideInfo();
+    if (!lastFloatFromPreviousLine->isPlaced() || !shapeInsideInfo)
+        return;
+
+    bool isHorizontalWritingMode = block->isHorizontalWritingMode();
+    LayoutUnit logicalOffsetFromShapeContainer = block->logicalOffsetFromShapeAncestorContainer(shapeInsideInfo->owner()).height();
+
+    LayoutUnit lineLogicalTop = block->logicalHeight() + logicalOffsetFromShapeContainer;
+    LayoutUnit lineLogicalHeight = block->lineHeight(isFirstLine, isHorizontalWritingMode ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
+    LayoutUnit lineLogicalBottom = lineLogicalTop + lineLogicalHeight;
+
+    LayoutUnit floatLogicalTop = lastFloatFromPreviousLine->logicalTop(isHorizontalWritingMode);
+    LayoutUnit floatLogicalBottom = lastFloatFromPreviousLine->logicalBottom(isHorizontalWritingMode);
+
+    bool lineOverlapsWithFloat = (floatLogicalTop < lineLogicalBottom) && (lineLogicalTop < floatLogicalBottom);
+    if (!lineOverlapsWithFloat)
+        return;
+
+    float minSegmentWidth = firstPositiveWidth(wordMeasurements);
+
+    LayoutUnit floatLogicalWidth = lastFloatFromPreviousLine->logicalWidth(isHorizontalWritingMode);
+    LayoutUnit availableLogicalWidth = block->logicalWidth() - lastFloatFromPreviousLine->logicalRight(isHorizontalWritingMode);
+    if (availableLogicalWidth < minSegmentWidth)
+        block->setLogicalHeight(floatLogicalBottom);
+
+    if (block->logicalHeight() < floatLogicalTop) {
+        shapeInsideInfo->adjustLogicalLineTop(minSegmentWidth + floatLogicalWidth);
+        block->setLogicalHeight(shapeInsideInfo->logicalLineTop() - logicalOffsetFromShapeContainer);
+    }
+
+    lineLogicalTop = block->logicalHeight() + logicalOffsetFromShapeContainer;
+
+    shapeInsideInfo->updateSegmentsForLine(lineLogicalTop, lineLogicalHeight);
+    width.updateCurrentShapeSegment();
+    width.updateAvailableWidth();
+}
+
+inline bool LineBreaker::BreakingContext::handleText(WordMeasurements& wordMeasurements, bool& hyphenated)
+{
+    if (!m_current.m_pos)
+        m_appliedStartWidth = false;
+
+    RenderText* renderText = toRenderText(m_current.m_obj);
+
+    bool isSVGText = renderText->isSVGInlineText();
+
+    if (renderText->style()->hasTextCombine() && m_current.m_obj->isCombineText() && !toRenderCombineText(m_current.m_obj)->isCombined()) {
+        RenderCombineText* combineRenderer = toRenderCombineText(m_current.m_obj);
+        combineRenderer->combineText();
+        // The length of the renderer's text may have changed. Increment stale iterator positions
+        if (iteratorIsBeyondEndOfRenderCombineText(m_lineBreak, combineRenderer)) {
+            ASSERT(iteratorIsBeyondEndOfRenderCombineText(m_resolver.position(), combineRenderer));
+            m_lineBreak.increment();
+            m_resolver.position().increment(&m_resolver);
+        }
+    }
+
+    RenderStyle* style = renderText->style(m_lineInfo.isFirstLine());
+    const Font& font = style->font();
+    bool isFixedPitch = font.isFixedPitch();
+
+    unsigned lastSpace = m_current.m_pos;
+    float wordSpacing = m_currentStyle->wordSpacing();
+    float lastSpaceWordSpacing = 0;
+    float wordSpacingForWordMeasurement = 0;
+
+    float wrapW = m_width.uncommittedWidth() + inlineLogicalWidth(m_current.m_obj, !m_appliedStartWidth, true);
+    float charWidth = 0;
+    // Auto-wrapping text should wrap in the middle of a word only if it could not wrap before the word,
+    // which is only possible if the word is the first thing on the line, that is, if |w| is zero.
+    bool breakWords = m_currentStyle->breakWords() && ((m_autoWrap && !m_width.committedWidth()) || m_currWS == PRE);
+    bool midWordBreak = false;
+    bool breakAll = m_currentStyle->wordBreak() == BreakAllWordBreak && m_autoWrap;
+    float hyphenWidth = 0;
+
+    if (isSVGText) {
+        breakWords = false;
+        breakAll = false;
+    }
+
+    if (renderText->isWordBreak()) {
+        m_width.commit();
+        m_lineBreak.moveToStartOf(m_current.m_obj);
+        ASSERT(m_current.m_pos == renderText->textLength());
+    }
+
+    if (m_renderTextInfo.m_text != renderText) {
+        m_renderTextInfo.m_text = renderText;
+        m_renderTextInfo.m_font = &font;
+        m_renderTextInfo.m_layout = font.createLayout(renderText, m_width.currentWidth(), m_collapseWhiteSpace);
+        m_renderTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(renderText->text(), style->locale());
+    } else if (m_renderTextInfo.m_layout && m_renderTextInfo.m_font != &font) {
+        m_renderTextInfo.m_font = &font;
+        m_renderTextInfo.m_layout = font.createLayout(renderText, m_width.currentWidth(), m_collapseWhiteSpace);
+    }
+
+    TextLayout* textLayout = m_renderTextInfo.m_layout.get();
+
+    // Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure
+    // words with their trailing space, then subtract its width.
+    float wordTrailingSpaceWidth = (font.typesettingFeatures() & Kerning) && !textLayout ? font.width(RenderBlock::constructTextRun(renderText, font, &space, 1, style)) + wordSpacing : 0;
+
+    UChar lastCharacter = m_renderTextInfo.m_lineBreakIterator.lastCharacter();
+    UChar secondToLastCharacter = m_renderTextInfo.m_lineBreakIterator.secondToLastCharacter();
+    for (; m_current.m_pos < renderText->textLength(); m_current.fastIncrementInTextNode()) {
+        bool previousCharacterIsSpace = m_currentCharacterIsSpace;
+        bool previousCharacterShouldCollapseIfPreWap = m_currentCharacterShouldCollapseIfPreWap;
+        UChar c = m_current.current();
+        m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = c == ' ' || c == '\t' || (!m_preservesNewline && (c == '\n'));
+
+        if (!m_collapseWhiteSpace || !m_currentCharacterIsSpace)
+            m_lineInfo.setEmpty(false, m_block, &m_width);
+
+        if (c == softHyphen && m_autoWrap && !hyphenWidth) {
+            hyphenWidth = measureHyphenWidth(renderText, font);
+            m_width.addUncommittedWidth(hyphenWidth);
+        }
+
+        bool applyWordSpacing = false;
+
+        if ((breakAll || breakWords) && !midWordBreak) {
+            wrapW += charWidth;
+            bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && m_current.m_pos + 1 < renderText->textLength() && U16_IS_TRAIL((*renderText)[m_current.m_pos + 1]);
+            charWidth = textWidth(renderText, m_current.m_pos, midWordBreakIsBeforeSurrogatePair ? 2 : 1, font, m_width.committedWidth() + wrapW, isFixedPitch, m_collapseWhiteSpace, 0, textLayout);
+            midWordBreak = m_width.committedWidth() + wrapW + charWidth > m_width.availableWidth();
+        }
+
+        bool betweenWords = c == '\n' || (m_currWS != PRE && !m_atStart && isBreakable(m_renderTextInfo.m_lineBreakIterator, m_current.m_pos, m_current.m_nextBreakablePosition));
+
+        if (betweenWords || midWordBreak) {
+            bool stoppedIgnoringSpaces = false;
+            if (m_ignoringSpaces) {
+                lastSpaceWordSpacing = 0;
+                if (!m_currentCharacterIsSpace) {
+                    // Stop ignoring spaces and begin at this
+                    // new point.
+                    m_ignoringSpaces = false;
+                    wordSpacingForWordMeasurement = 0;
+                    lastSpace = m_current.m_pos; // e.g., "Foo    goo", don't add in any of the ignored spaces.
+                    stopIgnoringSpaces(m_lineMidpointState, InlineIterator(0, m_current.m_obj, m_current.m_pos));
+                    stoppedIgnoringSpaces = true;
+                } else {
+                    // Just keep ignoring these spaces.
+                    nextCharacter(c, lastCharacter, secondToLastCharacter);
+                    continue;
+                }
+            }
+
+            wordMeasurements.grow(wordMeasurements.size() + 1);
+            WordMeasurement& wordMeasurement = wordMeasurements.last();
+
+            wordMeasurement.renderer = renderText;
+            wordMeasurement.endOffset = m_current.m_pos;
+            wordMeasurement.startOffset = lastSpace;
+
+            float additionalTmpW;
+            if (wordTrailingSpaceWidth && c == ' ')
+                additionalTmpW = textWidth(renderText, lastSpace, m_current.m_pos + 1 - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout) - wordTrailingSpaceWidth;
+            else
+                additionalTmpW = textWidth(renderText, lastSpace, m_current.m_pos - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout);
+
+            wordMeasurement.width = additionalTmpW + wordSpacingForWordMeasurement;
+            additionalTmpW += lastSpaceWordSpacing;
+            m_width.addUncommittedWidth(additionalTmpW);
+            if (!m_appliedStartWidth) {
+                m_width.addUncommittedWidth(inlineLogicalWidth(m_current.m_obj, true, false));
+                m_appliedStartWidth = true;
+            }
+
+            if (m_lastFloatFromPreviousLine)
+                updateSegmentsForShapes(m_block, m_lastFloatFromPreviousLine, wordMeasurements, m_width, m_lineInfo.isFirstLine());
+
+            applyWordSpacing = wordSpacing && m_currentCharacterIsSpace;
+
+            if (!m_width.committedWidth() && m_autoWrap && !m_width.fitsOnLine())
+                m_width.fitBelowFloats();
+
+            if (m_autoWrap || breakWords) {
+                // If we break only after white-space, consider the current character
+                // as candidate width for this line.
+                bool lineWasTooWide = false;
+                if (m_width.fitsOnLine() && m_currentCharacterIsSpace && m_currentStyle->breakOnlyAfterWhiteSpace() && !midWordBreak) {
+                    float charWidth = textWidth(renderText, m_current.m_pos, 1, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout) + (applyWordSpacing ? wordSpacing : 0);
+                    // Check if line is too big even without the extra space
+                    // at the end of the line. If it is not, do nothing.
+                    // If the line needs the extra whitespace to be too long,
+                    // then move the line break to the space and skip all
+                    // additional whitespace.
+                    if (!m_width.fitsOnLine(charWidth)) {
+                        lineWasTooWide = true;
+                        m_lineBreak.moveTo(m_current.m_obj, m_current.m_pos, m_current.m_nextBreakablePosition);
+                        skipTrailingWhitespace(m_lineBreak, m_lineInfo);
+                    }
+                }
+                if (lineWasTooWide || !m_width.fitsOnLine()) {
+                    if (m_lineBreak.atTextParagraphSeparator()) {
+                        if (!stoppedIgnoringSpaces && m_current.m_pos > 0)
+                            ensureCharacterGetsLineBox(m_lineMidpointState, m_current);
+                        m_lineBreak.increment();
+                        m_lineInfo.setPreviousLineBrokeCleanly(true);
+                        wordMeasurement.endOffset = m_lineBreak.m_pos;
+                    }
+                    if (m_lineBreak.m_obj && m_lineBreak.m_pos && m_lineBreak.m_obj->isText() && toRenderText(m_lineBreak.m_obj)->textLength() && toRenderText(m_lineBreak.m_obj)->characterAt(m_lineBreak.m_pos - 1) == softHyphen)
+                        hyphenated = true;
+                    if (m_lineBreak.m_pos && m_lineBreak.m_pos != (unsigned)wordMeasurement.endOffset && !wordMeasurement.width) {
+                        if (charWidth) {
+                            wordMeasurement.endOffset = m_lineBreak.m_pos;
+                            wordMeasurement.width = charWidth;
+                        }
+                    }
+                    // Didn't fit. Jump to the end unless there's still an opportunity to collapse whitespace.
+                    if (m_ignoringSpaces || !m_collapseWhiteSpace || !m_currentCharacterIsSpace || !previousCharacterIsSpace) {
+                        m_atEnd = true;
+                        return false;
+                    }
+                } else {
+                    if (!betweenWords || (midWordBreak && !m_autoWrap))
+                        m_width.addUncommittedWidth(-additionalTmpW);
+                    if (hyphenWidth) {
+                        // Subtract the width of the soft hyphen out since we fit on a line.
+                        m_width.addUncommittedWidth(-hyphenWidth);
+                        hyphenWidth = 0;
+                    }
+                }
+            }
+
+            if (c == '\n' && m_preservesNewline) {
+                if (!stoppedIgnoringSpaces && m_current.m_pos > 0)
+                    ensureCharacterGetsLineBox(m_lineMidpointState, m_current);
+                m_lineBreak.moveTo(m_current.m_obj, m_current.m_pos, m_current.m_nextBreakablePosition);
+                m_lineBreak.increment();
+                m_lineInfo.setPreviousLineBrokeCleanly(true);
+                return true;
+            }
+
+            if (m_autoWrap && betweenWords) {
+                m_width.commit();
+                wrapW = 0;
+                m_lineBreak.moveTo(m_current.m_obj, m_current.m_pos, m_current.m_nextBreakablePosition);
+                // Auto-wrapping text should not wrap in the middle of a word once it has had an
+                // opportunity to break after a word.
+                breakWords = false;
+            }
+
+            if (midWordBreak && !U16_IS_TRAIL(c) && !(category(c) & (Mark_NonSpacing | Mark_Enclosing | Mark_SpacingCombining))) {
+                // Remember this as a breakable position in case
+                // adding the end width forces a break.
+                m_lineBreak.moveTo(m_current.m_obj, m_current.m_pos, m_current.m_nextBreakablePosition);
+                midWordBreak &= (breakWords || breakAll);
+            }
+
+            if (betweenWords) {
+                lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0;
+                wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurement.width) ? wordSpacing : 0;
+                lastSpace = m_current.m_pos;
+            }
+
+            if (!m_ignoringSpaces && m_currentStyle->collapseWhiteSpace()) {
+                // If we encounter a newline, or if we encounter a
+                // second space, we need to go ahead and break up this
+                // run and enter a mode where we start collapsing spaces.
+                if (m_currentCharacterIsSpace && previousCharacterIsSpace) {
+                    m_ignoringSpaces = true;
+
+                    // We just entered a mode where we are ignoring
+                    // spaces. Create a midpoint to terminate the run
+                    // before the second space.
+                    startIgnoringSpaces(m_lineMidpointState, m_startOfIgnoredSpaces);
+                    m_trailingObjects.updateMidpointsForTrailingBoxes(m_lineMidpointState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace);
+                }
+            }
+        } else if (m_ignoringSpaces) {
+            // Stop ignoring spaces and begin at this
+            // new point.
+            m_ignoringSpaces = false;
+            lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0;
+            wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurements.last().width) ? wordSpacing : 0;
+            lastSpace = m_current.m_pos; // e.g., "Foo    goo", don't add in any of the ignored spaces.
+            stopIgnoringSpaces(m_lineMidpointState, InlineIterator(0, m_current.m_obj, m_current.m_pos));
+        }
+
+        if (isSVGText && m_current.m_pos > 0) {
+            // Force creation of new InlineBoxes for each absolute positioned character (those that start new text chunks).
+            if (toRenderSVGInlineText(renderText)->characterStartsNewTextChunk(m_current.m_pos))
+                ensureCharacterGetsLineBox(m_lineMidpointState, m_current);
+        }
+
+        if (m_currentCharacterIsSpace && !previousCharacterIsSpace) {
+            m_startOfIgnoredSpaces.m_obj = m_current.m_obj;
+            m_startOfIgnoredSpaces.m_pos = m_current.m_pos;
+        }
+
+        if (!m_currentCharacterIsSpace && previousCharacterShouldCollapseIfPreWap) {
+            if (m_autoWrap && m_currentStyle->breakOnlyAfterWhiteSpace())
+                m_lineBreak.moveTo(m_current.m_obj, m_current.m_pos, m_current.m_nextBreakablePosition);
+        }
+
+        if (m_collapseWhiteSpace && m_currentCharacterIsSpace && !m_ignoringSpaces)
+            m_trailingObjects.setTrailingWhitespace(toRenderText(m_current.m_obj));
+        else if (!m_currentStyle->collapseWhiteSpace() || !m_currentCharacterIsSpace)
+            m_trailingObjects.clear();
+
+        m_atStart = false;
+        nextCharacter(c, lastCharacter, secondToLastCharacter);
+    }
+
+    m_renderTextInfo.m_lineBreakIterator.setPriorContext(lastCharacter, secondToLastCharacter);
+
+    wordMeasurements.grow(wordMeasurements.size() + 1);
+    WordMeasurement& wordMeasurement = wordMeasurements.last();
+    wordMeasurement.renderer = renderText;
+
+    // IMPORTANT: current.m_pos is > length here!
+    float additionalTmpW = m_ignoringSpaces ? 0 : textWidth(renderText, lastSpace, m_current.m_pos - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout);
+    wordMeasurement.startOffset = lastSpace;
+    wordMeasurement.endOffset = m_current.m_pos;
+    wordMeasurement.width = m_ignoringSpaces ? 0 : additionalTmpW + wordSpacingForWordMeasurement;
+    additionalTmpW += lastSpaceWordSpacing;
+    m_width.addUncommittedWidth(additionalTmpW + inlineLogicalWidth(m_current.m_obj, !m_appliedStartWidth, m_includeEndWidth));
+    m_includeEndWidth = false;
+
+    if (!m_width.fitsOnLine()) {
+        if (!hyphenated && m_lineBreak.previousInSameNode() == softHyphen) {
+            hyphenated = true;
+            m_atEnd = true;
+        }
+    }
+    return false;
+}
+
+inline void LineBreaker::BreakingContext::commitAndUpdateLineBreakIfNeeded()
+{
+    bool checkForBreak = m_autoWrap;
+    if (m_width.committedWidth() && !m_width.fitsOnLine() && m_lineBreak.m_obj && m_currWS == NOWRAP) {
+        checkForBreak = true;
+    } else if (m_nextObject && m_current.m_obj->isText() && m_nextObject->isText() && !m_nextObject->isBR() && (m_autoWrap || m_nextObject->style()->autoWrap())) {
+        if (m_autoWrap && m_currentCharacterIsSpace) {
+            checkForBreak = true;
+        } else {
+            RenderText* nextText = toRenderText(m_nextObject);
+            if (nextText->textLength()) {
+                UChar c = nextText->characterAt(0);
+                // If the next item on the line is text, and if we did not end with
+                // a space, then the next text run continues our word (and so it needs to
+                // keep adding to the uncommitted width. Just update and continue.
+                checkForBreak = !m_currentCharacterIsSpace && (c == ' ' || c == '\t' || (c == '\n' && !m_nextObject->preservesNewline()));
+            } else if (nextText->isWordBreak()) {
+                checkForBreak = true;
+            }
+
+            if (!m_width.fitsOnLine() && !m_width.committedWidth())
+                m_width.fitBelowFloats();
+
+            bool canPlaceOnLine = m_width.fitsOnLine() || !m_autoWrapWasEverTrueOnLine;
+            if (canPlaceOnLine && checkForBreak) {
+                m_width.commit();
+                m_lineBreak.moveToStartOf(m_nextObject);
+            }
+        }
+    }
+
+    if (checkForBreak && !m_width.fitsOnLine()) {
+        // if we have floats, try to get below them.
+        if (m_currentCharacterIsSpace && !m_ignoringSpaces && m_currentStyle->collapseWhiteSpace())
+            m_trailingObjects.clear();
+
+        if (m_width.committedWidth()) {
+            m_atEnd = true;
+            return;
+        }
+
+        m_width.fitBelowFloats();
+
+        // |width| may have been adjusted because we got shoved down past a float (thus
+        // giving us more room), so we need to retest, and only jump to
+        // the end label if we still don't fit on the line. -dwh
+        if (!m_width.fitsOnLine()) {
+            m_atEnd = true;
+            return;
+        }
+    } else if (m_blockStyle->autoWrap() && !m_width.fitsOnLine() && !m_width.committedWidth()) {
+        // If the container autowraps but the current child does not then we still need to ensure that it
+        // wraps and moves below any floats.
+        m_width.fitBelowFloats();
+    }
+
+    if (!m_current.m_obj->isFloatingOrOutOfFlowPositioned()) {
+        m_lastObject = m_current.m_obj;
+        if (m_lastObject->isReplaced() && m_autoWrap && (!m_lastObject->isImage() || m_allowImagesToBreak) && (!m_lastObject->isListMarker() || toRenderListMarker(m_lastObject)->isInside())) {
+            m_width.commit();
+            m_lineBreak.moveToStartOf(m_nextObject);
+        }
+    }
+}
+
+InlineIterator LineBreaker::BreakingContext::handleEndOfLine()
+{
+    ShapeInsideInfo* shapeInfo = m_block->layoutShapeInsideInfo();
+    bool segmentAllowsOverflow = !shapeInfo || !shapeInfo->hasSegments();
+
+    if (m_lineBreak == m_resolver.position() && (!m_lineBreak.m_obj || !m_lineBreak.m_obj->isBR()) && segmentAllowsOverflow) {
+        // we just add as much as possible
+        if (m_blockStyle->whiteSpace() == PRE && !m_current.m_pos) {
+            m_lineBreak.moveTo(m_lastObject, m_lastObject->isText() ? m_lastObject->length() : 0);
+        } else if (m_lineBreak.m_obj) {
+            // Don't ever break in the middle of a word if we can help it.
+            // There's no room at all. We just have to be on this line,
+            // even though we'll spill out.
+            m_lineBreak.moveTo(m_current.m_obj, m_current.m_pos);
+        }
+    }
+
+    // FIXME Bug 100049: We do not need to consume input in a multi-segment line
+    // unless no segment will.
+    // make sure we consume at least one char/object.
+    if (m_lineBreak == m_resolver.position() && segmentAllowsOverflow)
+        m_lineBreak.increment();
+
+    // Sanity check our midpoints.
+    checkMidpoints(m_lineMidpointState, m_lineBreak);
+
+    m_trailingObjects.updateMidpointsForTrailingBoxes(m_lineMidpointState, m_lineBreak, TrailingObjects::CollapseFirstSpace);
+
+    // We might have made lineBreak an iterator that points past the end
+    // of the object. Do this adjustment to make it point to the start
+    // of the next object instead to avoid confusing the rest of the
+    // code.
+    if (m_lineBreak.m_pos > 0) {
+        m_lineBreak.m_pos--;
+        m_lineBreak.increment();
+    }
+
+    return m_lineBreak;
+}
+
 InlineIterator LineBreaker::nextSegmentBreak(InlineBidiResolver& resolver, LineInfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurements)
 {
     reset();
@@ -2595,8 +3341,6 @@
     ASSERT(resolver.position().root() == m_block);
 
     bool appliedStartWidth = resolver.position().m_pos > 0;
-    bool includeEndWidth = true;
-    LineMidpointState& lineMidpointState = resolver.midpointState();
 
     LineWidth width(*m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.isFirstLine(), lineInfo.previousLineBrokeCleanly(), m_block->style()));
 
@@ -2605,586 +3349,43 @@
     if (resolver.position().atEnd())
         return resolver.position();
 
-    // This variable is used only if whitespace isn't set to PRE, and it tells us whether
-    // or not we are currently ignoring whitespace.
-    bool ignoringSpaces = false;
-    InlineIterator ignoreStart;
+    BreakingContext context(resolver, lineInfo, width, renderTextInfo, lastFloatFromPreviousLine, appliedStartWidth, m_block);
 
-    // This variable tracks whether the very last character we saw was a space.  We use
-    // this to detect when we encounter a second space so we know we have to terminate
-    // a run.
-    bool currentCharacterIsSpace = false;
-    bool currentCharacterShouldCollapseIfPreWap = false;
-    TrailingObjects trailingObjects;
-
-    InlineIterator lBreak = resolver.position();
-
-    // FIXME: It is error-prone to split the position object out like this.
-    // Teach this code to work with objects instead of this split tuple.
-    InlineIterator current = resolver.position();
-    RenderObject* last = current.m_obj;
-    bool atStart = true;
-
-    bool startingNewParagraph = lineInfo.previousLineBrokeCleanly();
-    lineInfo.setPreviousLineBrokeCleanly(false);
-
-    bool autoWrapWasEverTrueOnLine = false;
-    bool floatsFitOnLine = true;
-
-    // Firefox and Opera will allow a table cell to grow to fit an image inside it under
-    // very specific circumstances (in order to match common WinIE renderings).
-    // Not supporting the quirk has caused us to mis-render some real sites. (See Bugzilla 10517.)
-    RenderStyle* blockStyle = m_block->style();
-    bool allowImagesToBreak = !m_block->document().inQuirksMode() || !m_block->isTableCell() || !blockStyle->logicalWidth().isIntrinsicOrAuto();
-
-    EWhiteSpace currWS = blockStyle->whiteSpace();
-    EWhiteSpace lastWS = currWS;
-    while (current.m_obj) {
-        RenderStyle* currentStyle = current.m_obj->style();
-        RenderObject* next = bidiNextSkippingEmptyInlines(m_block, current.m_obj);
-        if (next && next->parent() && !next->parent()->isDescendantOf(current.m_obj->parent()))
-            includeEndWidth = true;
-
-        currWS = current.m_obj->isReplaced() ? current.m_obj->parent()->style()->whiteSpace() : currentStyle->whiteSpace();
-        lastWS = last->isReplaced() ? last->parent()->style()->whiteSpace() : last->style()->whiteSpace();
-
-        bool autoWrap = RenderStyle::autoWrap(currWS);
-        autoWrapWasEverTrueOnLine = autoWrapWasEverTrueOnLine || autoWrap;
-
-        bool preserveNewline = current.m_obj->isSVGInlineText() ? false : RenderStyle::preserveNewline(currWS);
-
-        bool collapseWhiteSpace = RenderStyle::collapseWhiteSpace(currWS);
-
-        if (current.m_obj->isBR()) {
-            if (width.fitsOnLine()) {
-                lBreak.moveToStartOf(current.m_obj);
-                lBreak.increment();
-
-                // A <br> always breaks a line, so don't let the line be collapsed
-                // away. Also, the space at the end of a line with a <br> does not
-                // get collapsed away.  It only does this if the previous line broke
-                // cleanly.  Otherwise the <br> has no effect on whether the line is
-                // empty or not.
-                if (startingNewParagraph)
-                    lineInfo.setEmpty(false, m_block, &width);
-                trailingObjects.clear();
-                lineInfo.setPreviousLineBrokeCleanly(true);
-
-                // A <br> with clearance always needs a linebox in case the lines below it get dirtied later and
-                // need to check for floats to clear - so if we're ignoring spaces, stop ignoring them and add a
-                // run for this object.
-                if (ignoringSpaces && currentStyle->clear() != CNONE)
-                    ensureLineBoxInsideIgnoredSpaces(lineMidpointState, current.m_obj);
-
-                if (!lineInfo.isEmpty())
-                    m_clear = currentStyle->clear();
+    while (context.currentObject()) {
+        context.initializeForCurrentObject();
+        if (context.currentObject()->isBR()) {
+            context.handleBR(m_clear);
+        } else if (context.currentObject()->isOutOfFlowPositioned()) {
+            context.handleOutOfFlowPositioned(m_positionedObjects);
+        } else if (context.currentObject()->isFloating()) {
+            context.handleFloat();
+        } else if (context.currentObject()->isRenderInline()) {
+            context.handleEmptyInline();
+        } else if (context.currentObject()->isReplaced()) {
+            context.handleReplaced();
+        } else if (context.currentObject()->isText()) {
+            if (context.handleText(wordMeasurements, m_hyphenated)) {
+                // We've hit a hard text line break. Our line break iterator is updated, so go ahead and early return.
+                return context.lineBreak();
             }
-            goto end;
-        }
-
-        if (current.m_obj->isOutOfFlowPositioned()) {
-            // If our original display wasn't an inline type, then we can
-            // go ahead and determine our static inline position now.
-            RenderBox* box = toRenderBox(current.m_obj);
-            bool isInlineType = box->style()->isOriginalDisplayInlineType();
-            if (!isInlineType)
-                m_block->setStaticInlinePositionForChild(box, m_block->logicalHeight(), m_block->startOffsetForContent(m_block->logicalHeight()));
-            else  {
-                // If our original display was an INLINE type, then we can go ahead
-                // and determine our static y position now.
-                box->layer()->setStaticBlockPosition(m_block->logicalHeight());
-            }
-
-            // If we're ignoring spaces, we have to stop and include this object and
-            // then start ignoring spaces again.
-            if (isInlineType || current.m_obj->container()->isRenderInline()) {
-                if (ignoringSpaces)
-                    ensureLineBoxInsideIgnoredSpaces(lineMidpointState, current.m_obj);
-                trailingObjects.appendBoxIfNeeded(box);
-            } else
-                m_positionedObjects.append(box);
-            width.addUncommittedWidth(inlineLogicalWidth(current.m_obj));
-            // Reset prior line break context characters.
-            renderTextInfo.m_lineBreakIterator.resetPriorContext();
-        } else if (current.m_obj->isFloating()) {
-            RenderBox* floatBox = toRenderBox(current.m_obj);
-            FloatingObject* f = m_block->insertFloatingObject(floatBox);
-            // check if it fits in the current line.
-            // If it does, position it now, otherwise, position
-            // it after moving to next line (in newLine() func)
-            // FIXME: Bug 110372: Properly position multiple stacked floats with non-rectangular shape outside.
-            if (floatsFitOnLine && width.fitsOnLine(f->logicalWidth(m_block->isHorizontalWritingMode()))) {
-                m_block->positionNewFloatOnLine(f, lastFloatFromPreviousLine, lineInfo, width);
-                if (lBreak.m_obj == current.m_obj) {
-                    ASSERT(!lBreak.m_pos);
-                    lBreak.increment();
-                }
-            } else
-                floatsFitOnLine = false;
-            // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for floating element.
-            renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
-        } else if (current.m_obj->isRenderInline()) {
-            // Right now, we should only encounter empty inlines here.
-            ASSERT(isEmptyInline(current.m_obj));
-
-            RenderInline* flowBox = toRenderInline(current.m_obj);
-
-            // Now that some inline flows have line boxes, if we are already ignoring spaces, we need
-            // to make sure that we stop to include this object and then start ignoring spaces again.
-            // If this object is at the start of the line, we need to behave like list markers and
-            // start ignoring spaces.
-            bool requiresLineBox = alwaysRequiresLineBox(current.m_obj);
-            if (requiresLineBox || requiresLineBoxForContent(flowBox, lineInfo)) {
-                // An empty inline that only has line-height, vertical-align or font-metrics will only get a
-                // line box to affect the height of the line if the rest of the line is not empty.
-                if (requiresLineBox)
-                    lineInfo.setEmpty(false, m_block, &width);
-                if (ignoringSpaces) {
-                    trailingObjects.clear();
-                    ensureLineBoxInsideIgnoredSpaces(lineMidpointState, current.m_obj);
-                } else if (blockStyle->collapseWhiteSpace() && resolver.position().m_obj == current.m_obj
-                    && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) {
-                    // Like with list markers, we start ignoring spaces to make sure that any
-                    // additional spaces we see will be discarded.
-                    currentCharacterShouldCollapseIfPreWap = currentCharacterIsSpace = true;
-                    ignoringSpaces = true;
-                }
-            }
-
-            width.addUncommittedWidth(inlineLogicalWidth(current.m_obj) + borderPaddingMarginStart(flowBox) + borderPaddingMarginEnd(flowBox));
-        } else if (current.m_obj->isReplaced()) {
-            RenderBox* replacedBox = toRenderBox(current.m_obj);
-
-            if (atStart)
-                width.updateAvailableWidth(replacedBox->logicalHeight());
-
-            // Break on replaced elements if either has normal white-space.
-            if ((autoWrap || RenderStyle::autoWrap(lastWS)) && (!current.m_obj->isImage() || allowImagesToBreak)) {
-                width.commit();
-                lBreak.moveToStartOf(current.m_obj);
-            }
-
-            if (ignoringSpaces)
-                stopIgnoringSpaces(lineMidpointState, InlineIterator(0, current.m_obj, 0));
-
-            lineInfo.setEmpty(false, m_block, &width);
-            ignoringSpaces = false;
-            currentCharacterShouldCollapseIfPreWap = currentCharacterIsSpace = false;
-            trailingObjects.clear();
-
-            // Optimize for a common case. If we can't find whitespace after the list
-            // item, then this is all moot.
-            LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(replacedBox) + m_block->marginStartForChild(replacedBox) + m_block->marginEndForChild(replacedBox) + inlineLogicalWidth(current.m_obj);
-            if (current.m_obj->isListMarker()) {
-                if (blockStyle->collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) {
-                    // Like with inline flows, we start ignoring spaces to make sure that any
-                    // additional spaces we see will be discarded.
-                    currentCharacterShouldCollapseIfPreWap = currentCharacterIsSpace = true;
-                    ignoringSpaces = true;
-                }
-                if (toRenderListMarker(current.m_obj)->isInside())
-                    width.addUncommittedWidth(replacedLogicalWidth);
-            } else
-                width.addUncommittedWidth(replacedLogicalWidth);
-            if (current.m_obj->isRubyRun())
-                width.applyOverhang(toRenderRubyRun(current.m_obj), last, next);
-            // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element.
-            renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter);
-        } else if (current.m_obj->isText()) {
-            if (!current.m_pos)
-                appliedStartWidth = false;
-
-            RenderText* t = toRenderText(current.m_obj);
-
-            bool isSVGText = t->isSVGInlineText();
-
-            if (t->style()->hasTextCombine() && current.m_obj->isCombineText() && !toRenderCombineText(current.m_obj)->isCombined()) {
-                RenderCombineText* combineRenderer = toRenderCombineText(current.m_obj);
-                combineRenderer->combineText();
-                // The length of the renderer's text may have changed. Increment stale iterator positions
-                if (iteratorIsBeyondEndOfRenderCombineText(lBreak, combineRenderer)) {
-                    ASSERT(iteratorIsBeyondEndOfRenderCombineText(resolver.position(), combineRenderer));
-                    lBreak.increment();
-                    resolver.position().increment(&resolver);
-                }
-            }
-
-            RenderStyle* style = t->style(lineInfo.isFirstLine());
-            const Font& f = style->font();
-            bool isFixedPitch = f.isFixedPitch();
-
-            unsigned lastSpace = current.m_pos;
-            float wordSpacing = currentStyle->wordSpacing();
-            float lastSpaceWordSpacing = 0;
-            float wordSpacingForWordMeasurement = 0;
-
-            float wrapW = width.uncommittedWidth() + inlineLogicalWidth(current.m_obj, !appliedStartWidth, true);
-            float charWidth = 0;
-            // Auto-wrapping text should wrap in the middle of a word only if it could not wrap before the word,
-            // which is only possible if the word is the first thing on the line, that is, if |w| is zero.
-            bool breakWords = currentStyle->breakWords() && ((autoWrap && !width.committedWidth()) || currWS == PRE);
-            bool midWordBreak = false;
-            bool breakAll = currentStyle->wordBreak() == BreakAllWordBreak && autoWrap;
-            float hyphenWidth = 0;
-
-            if (isSVGText) {
-                breakWords = false;
-                breakAll = false;
-            }
-
-            if (t->isWordBreak()) {
-                width.commit();
-                lBreak.moveToStartOf(current.m_obj);
-                ASSERT(current.m_pos == t->textLength());
-            }
-
-            if (renderTextInfo.m_text != t) {
-                renderTextInfo.m_text = t;
-                renderTextInfo.m_font = &f;
-                renderTextInfo.m_layout = f.createLayout(t, width.currentWidth(), collapseWhiteSpace);
-                renderTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(t->text(), style->locale());
-            } else if (renderTextInfo.m_layout && renderTextInfo.m_font != &f) {
-                renderTextInfo.m_font = &f;
-                renderTextInfo.m_layout = f.createLayout(t, width.currentWidth(), collapseWhiteSpace);
-            }
-
-            TextLayout* textLayout = renderTextInfo.m_layout.get();
-
-            // Non-zero only when kerning is enabled and TextLayout isn't used, in which case we measure
-            // words with their trailing space, then subtract its width.
-            float wordTrailingSpaceWidth = (f.typesettingFeatures() & Kerning) && !textLayout ? f.width(RenderBlock::constructTextRun(t, f, &space, 1, style)) + wordSpacing : 0;
-
-            UChar lastCharacter = renderTextInfo.m_lineBreakIterator.lastCharacter();
-            UChar secondToLastCharacter = renderTextInfo.m_lineBreakIterator.secondToLastCharacter();
-            for (; current.m_pos < t->textLength(); current.fastIncrementInTextNode()) {
-                bool previousCharacterIsSpace = currentCharacterIsSpace;
-                bool previousCharacterShouldCollapseIfPreWap = currentCharacterShouldCollapseIfPreWap;
-                UChar c = current.current();
-                currentCharacterShouldCollapseIfPreWap = currentCharacterIsSpace = c == ' ' || c == '\t' || (!preserveNewline && (c == '\n'));
-
-                if (!collapseWhiteSpace || !currentCharacterIsSpace)
-                    lineInfo.setEmpty(false, m_block, &width);
-
-                if (c == softHyphen && autoWrap && !hyphenWidth) {
-                    hyphenWidth = measureHyphenWidth(t, f);
-                    width.addUncommittedWidth(hyphenWidth);
-                }
-
-                bool applyWordSpacing = false;
-
-                if ((breakAll || breakWords) && !midWordBreak) {
-                    wrapW += charWidth;
-                    bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && current.m_pos + 1 < t->textLength() && U16_IS_TRAIL((*t)[current.m_pos + 1]);
-                    charWidth = textWidth(t, current.m_pos, midWordBreakIsBeforeSurrogatePair ? 2 : 1, f, width.committedWidth() + wrapW, isFixedPitch, collapseWhiteSpace, 0, textLayout);
-                    midWordBreak = width.committedWidth() + wrapW + charWidth > width.availableWidth();
-                }
-
-                bool betweenWords = c == '\n' || (currWS != PRE && !atStart && isBreakable(renderTextInfo.m_lineBreakIterator, current.m_pos, current.m_nextBreakablePosition));
-
-                if (betweenWords || midWordBreak) {
-                    bool stoppedIgnoringSpaces = false;
-                    if (ignoringSpaces) {
-                        lastSpaceWordSpacing = 0;
-                        if (!currentCharacterIsSpace) {
-                            // Stop ignoring spaces and begin at this
-                            // new point.
-                            ignoringSpaces = false;
-                            wordSpacingForWordMeasurement = 0;
-                            lastSpace = current.m_pos; // e.g., "Foo    goo", don't add in any of the ignored spaces.
-                            stopIgnoringSpaces(lineMidpointState, InlineIterator(0, current.m_obj, current.m_pos));
-                            stoppedIgnoringSpaces = true;
-                        } else {
-                            // Just keep ignoring these spaces.
-                            goto nextCharacter;
-                        }
-                    }
-
-                    wordMeasurements.grow(wordMeasurements.size() + 1);
-                    WordMeasurement& wordMeasurement = wordMeasurements.last();
-
-                    wordMeasurement.renderer = t;
-                    wordMeasurement.endOffset = current.m_pos;
-                    wordMeasurement.startOffset = lastSpace;
-
-                    float additionalTmpW;
-                    if (wordTrailingSpaceWidth && c == ' ')
-                        additionalTmpW = textWidth(t, lastSpace, current.m_pos + 1 - lastSpace, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout) - wordTrailingSpaceWidth;
-                    else
-                        additionalTmpW = textWidth(t, lastSpace, current.m_pos - lastSpace, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout);
-
-                    wordMeasurement.width = additionalTmpW + wordSpacingForWordMeasurement;
-                    additionalTmpW += lastSpaceWordSpacing;
-                    width.addUncommittedWidth(additionalTmpW);
-                    if (!appliedStartWidth) {
-                        width.addUncommittedWidth(inlineLogicalWidth(current.m_obj, true, false));
-                        appliedStartWidth = true;
-                    }
-
-                    applyWordSpacing = wordSpacing && currentCharacterIsSpace;
-
-                    if (!width.committedWidth() && autoWrap && !width.fitsOnLine())
-                        width.fitBelowFloats();
-
-                    if (autoWrap || breakWords) {
-                        // If we break only after white-space, consider the current character
-                        // as candidate width for this line.
-                        bool lineWasTooWide = false;
-                        if (width.fitsOnLine() && currentCharacterIsSpace && currentStyle->breakOnlyAfterWhiteSpace() && !midWordBreak) {
-                            float charWidth = textWidth(t, current.m_pos, 1, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout) + (applyWordSpacing ? wordSpacing : 0);
-                            // Check if line is too big even without the extra space
-                            // at the end of the line. If it is not, do nothing.
-                            // If the line needs the extra whitespace to be too long,
-                            // then move the line break to the space and skip all
-                            // additional whitespace.
-                            if (!width.fitsOnLine(charWidth)) {
-                                lineWasTooWide = true;
-                                lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition);
-                                skipTrailingWhitespace(lBreak, lineInfo);
-                            }
-                        }
-                        if (lineWasTooWide || !width.fitsOnLine()) {
-                            if (lBreak.atTextParagraphSeparator()) {
-                                if (!stoppedIgnoringSpaces && current.m_pos > 0)
-                                    ensureCharacterGetsLineBox(lineMidpointState, current);
-                                lBreak.increment();
-                                lineInfo.setPreviousLineBrokeCleanly(true);
-                                wordMeasurement.endOffset = lBreak.m_pos;
-                            }
-                            if (lBreak.m_obj && lBreak.m_pos && lBreak.m_obj->isText() && toRenderText(lBreak.m_obj)->textLength() && toRenderText(lBreak.m_obj)->characterAt(lBreak.m_pos - 1) == softHyphen)
-                                m_hyphenated = true;
-                            if (lBreak.m_pos && lBreak.m_pos != (unsigned)wordMeasurement.endOffset && !wordMeasurement.width) {
-                                if (charWidth) {
-                                    wordMeasurement.endOffset = lBreak.m_pos;
-                                    wordMeasurement.width = charWidth;
-                                }
-                            }
-                            // Didn't fit. Jump to the end unless there's still an opportunity to collapse whitespace.
-                            if (ignoringSpaces || !collapseWhiteSpace || !currentCharacterIsSpace || !previousCharacterIsSpace)
-                                goto end;
-                        } else {
-                            if (!betweenWords || (midWordBreak && !autoWrap))
-                                width.addUncommittedWidth(-additionalTmpW);
-                            if (hyphenWidth) {
-                                // Subtract the width of the soft hyphen out since we fit on a line.
-                                width.addUncommittedWidth(-hyphenWidth);
-                                hyphenWidth = 0;
-                            }
-                        }
-                    }
-
-                    if (c == '\n' && preserveNewline) {
-                        if (!stoppedIgnoringSpaces && current.m_pos > 0)
-                            ensureCharacterGetsLineBox(lineMidpointState, current);
-                        lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition);
-                        lBreak.increment();
-                        lineInfo.setPreviousLineBrokeCleanly(true);
-                        return lBreak;
-                    }
-
-                    if (autoWrap && betweenWords) {
-                        width.commit();
-                        wrapW = 0;
-                        lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition);
-                        // Auto-wrapping text should not wrap in the middle of a word once it has had an
-                        // opportunity to break after a word.
-                        breakWords = false;
-                    }
-
-                    if (midWordBreak && !U16_IS_TRAIL(c) && !(category(c) & (Mark_NonSpacing | Mark_Enclosing | Mark_SpacingCombining))) {
-                        // Remember this as a breakable position in case
-                        // adding the end width forces a break.
-                        lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition);
-                        midWordBreak &= (breakWords || breakAll);
-                    }
-
-                    if (betweenWords) {
-                        lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0;
-                        wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurement.width) ? wordSpacing : 0;
-                        lastSpace = current.m_pos;
-                    }
-
-                    if (!ignoringSpaces && currentStyle->collapseWhiteSpace()) {
-                        // If we encounter a newline, or if we encounter a
-                        // second space, we need to go ahead and break up this
-                        // run and enter a mode where we start collapsing spaces.
-                        if (currentCharacterIsSpace && previousCharacterIsSpace) {
-                            ignoringSpaces = true;
-
-                            // We just entered a mode where we are ignoring
-                            // spaces. Create a midpoint to terminate the run
-                            // before the second space.
-                            startIgnoringSpaces(lineMidpointState, ignoreStart);
-                            trailingObjects.updateMidpointsForTrailingBoxes(lineMidpointState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace);
-                        }
-                    }
-                } else if (ignoringSpaces) {
-                    // Stop ignoring spaces and begin at this
-                    // new point.
-                    ignoringSpaces = false;
-                    lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0;
-                    wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurements.last().width) ? wordSpacing : 0;
-                    lastSpace = current.m_pos; // e.g., "Foo    goo", don't add in any of the ignored spaces.
-                    stopIgnoringSpaces(lineMidpointState, InlineIterator(0, current.m_obj, current.m_pos));
-                }
-
-                if (isSVGText && current.m_pos > 0) {
-                    // Force creation of new InlineBoxes for each absolute positioned character (those that start new text chunks).
-                    if (toRenderSVGInlineText(t)->characterStartsNewTextChunk(current.m_pos))
-                        ensureCharacterGetsLineBox(lineMidpointState, current);
-                }
-
-                if (currentCharacterIsSpace && !previousCharacterIsSpace) {
-                    ignoreStart.m_obj = current.m_obj;
-                    ignoreStart.m_pos = current.m_pos;
-                }
-
-                if (!currentCharacterIsSpace && previousCharacterShouldCollapseIfPreWap) {
-                    if (autoWrap && currentStyle->breakOnlyAfterWhiteSpace())
-                        lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition);
-                }
-
-                if (collapseWhiteSpace && currentCharacterIsSpace && !ignoringSpaces)
-                    trailingObjects.setTrailingWhitespace(toRenderText(current.m_obj));
-                else if (!currentStyle->collapseWhiteSpace() || !currentCharacterIsSpace)
-                    trailingObjects.clear();
-
-                atStart = false;
-            nextCharacter:
-                secondToLastCharacter = lastCharacter;
-                lastCharacter = c;
-            }
-
-            renderTextInfo.m_lineBreakIterator.setPriorContext(lastCharacter, secondToLastCharacter);
-
-            wordMeasurements.grow(wordMeasurements.size() + 1);
-            WordMeasurement& wordMeasurement = wordMeasurements.last();
-            wordMeasurement.renderer = t;
-
-            // IMPORTANT: current.m_pos is > length here!
-            float additionalTmpW = ignoringSpaces ? 0 : textWidth(t, lastSpace, current.m_pos - lastSpace, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout);
-            wordMeasurement.startOffset = lastSpace;
-            wordMeasurement.endOffset = current.m_pos;
-            wordMeasurement.width = ignoringSpaces ? 0 : additionalTmpW + wordSpacingForWordMeasurement;
-            additionalTmpW += lastSpaceWordSpacing;
-            width.addUncommittedWidth(additionalTmpW + inlineLogicalWidth(current.m_obj, !appliedStartWidth, includeEndWidth));
-            includeEndWidth = false;
-
-            if (!width.fitsOnLine()) {
-                if (!m_hyphenated && lBreak.previousInSameNode() == softHyphen)
-                    m_hyphenated = true;
-
-                if (m_hyphenated)
-                    goto end;
-            }
-        } else
+        } else {
             ASSERT_NOT_REACHED();
-
-        bool checkForBreak = autoWrap;
-        if (width.committedWidth() && !width.fitsOnLine() && lBreak.m_obj && currWS == NOWRAP)
-            checkForBreak = true;
-        else if (next && current.m_obj->isText() && next->isText() && !next->isBR() && (autoWrap || next->style()->autoWrap())) {
-            if (autoWrap && currentCharacterIsSpace)
-                checkForBreak = true;
-            else {
-                RenderText* nextText = toRenderText(next);
-                if (nextText->textLength()) {
-                    UChar c = nextText->characterAt(0);
-                    // If the next item on the line is text, and if we did not end with
-                    // a space, then the next text run continues our word (and so it needs to
-                    // keep adding to the uncommitted width. Just update and continue.
-                    checkForBreak = !currentCharacterIsSpace && (c == ' ' || c == '\t' || (c == '\n' && !next->preservesNewline()));
-                } else if (nextText->isWordBreak())
-                    checkForBreak = true;
-
-                if (!width.fitsOnLine() && !width.committedWidth())
-                    width.fitBelowFloats();
-
-                bool canPlaceOnLine = width.fitsOnLine() || !autoWrapWasEverTrueOnLine;
-                if (canPlaceOnLine && checkForBreak) {
-                    width.commit();
-                    lBreak.moveToStartOf(next);
-                }
-            }
         }
 
-        if (checkForBreak && !width.fitsOnLine()) {
-            // if we have floats, try to get below them.
-            if (currentCharacterIsSpace && !ignoringSpaces && currentStyle->collapseWhiteSpace())
-                trailingObjects.clear();
+        if (context.atEnd())
+            return context.handleEndOfLine();
 
-            if (width.committedWidth())
-                goto end;
+        context.commitAndUpdateLineBreakIfNeeded();
 
-            width.fitBelowFloats();
+        if (context.atEnd())
+            return context.handleEndOfLine();
 
-            // |width| may have been adjusted because we got shoved down past a float (thus
-            // giving us more room), so we need to retest, and only jump to
-            // the end label if we still don't fit on the line. -dwh
-            if (!width.fitsOnLine())
-                goto end;
-        } else if (blockStyle->autoWrap() && !width.fitsOnLine() && !width.committedWidth()) {
-            // If the container autowraps but the current child does not then we still need to ensure that it
-            // wraps and moves below any floats.
-            width.fitBelowFloats();
-        }
-
-        if (!current.m_obj->isFloatingOrOutOfFlowPositioned()) {
-            last = current.m_obj;
-            if (last->isReplaced() && autoWrap && (!last->isImage() || allowImagesToBreak) && (!last->isListMarker() || toRenderListMarker(last)->isInside())) {
-                width.commit();
-                lBreak.moveToStartOf(next);
-            }
-        }
-
-        // Clear out our character space bool, since inline <pre>s don't collapse whitespace
-        // with adjacent inline normal/nowrap spans.
-        if (!collapseWhiteSpace)
-            currentCharacterIsSpace = false;
-
-        current.moveToStartOf(next);
-        atStart = false;
+        context.increment();
     }
 
-    if (width.fitsOnLine() || lastWS == NOWRAP)
-        lBreak.clear();
+    context.clearLineBreakIfFitsOnLine();
 
- end:
-    ShapeInsideInfo* shapeInfo = m_block->layoutShapeInsideInfo();
-    bool segmentAllowsOverflow = !shapeInfo || !shapeInfo->hasSegments();
-
-    if (lBreak == resolver.position() && (!lBreak.m_obj || !lBreak.m_obj->isBR()) && segmentAllowsOverflow) {
-        // we just add as much as possible
-        if (blockStyle->whiteSpace() == PRE && !current.m_pos) {
-            lBreak.moveTo(last, last->isText() ? last->length() : 0);
-        } else if (lBreak.m_obj) {
-            // Don't ever break in the middle of a word if we can help it.
-            // There's no room at all. We just have to be on this line,
-            // even though we'll spill out.
-            lBreak.moveTo(current.m_obj, current.m_pos);
-        }
-    }
-
-    // FIXME Bug 100049: We do not need to consume input in a multi-segment line
-    // unless no segment will.
-    // make sure we consume at least one char/object.
-    if (lBreak == resolver.position() && segmentAllowsOverflow)
-        lBreak.increment();
-
-    // Sanity check our midpoints.
-    checkMidpoints(lineMidpointState, lBreak);
-
-    trailingObjects.updateMidpointsForTrailingBoxes(lineMidpointState, lBreak, TrailingObjects::CollapseFirstSpace);
-
-    // We might have made lBreak an iterator that points past the end
-    // of the object. Do this adjustment to make it point to the start
-    // of the next object instead to avoid confusing the rest of the
-    // code.
-    if (lBreak.m_pos > 0) {
-        lBreak.m_pos--;
-        lBreak.increment();
-    }
-
-    return lBreak;
+    return context.handleEndOfLine();
 }
 
 void RenderBlock::addOverflowFromInlineChildren()
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index 040172a..c24a107 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -35,10 +35,9 @@
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLTextAreaElement.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
-#include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/transforms/TransformState.h"
 #include "core/rendering/HitTestResult.h"
@@ -56,6 +55,7 @@
 #include "core/rendering/RenderTableCell.h"
 #include "core/rendering/RenderTheme.h"
 #include "core/rendering/RenderView.h"
+#include "platform/geometry/FloatQuad.h"
 
 using namespace std;
 
@@ -266,7 +266,7 @@
     }
 
     // Our opaqueness might have changed without triggering layout.
-    if (diff == StyleDifferenceRepaint || diff == StyleDifferenceRepaintIfText || diff == StyleDifferenceRepaintLayer) {
+    if (diff == StyleDifferenceRepaint || diff == StyleDifferenceRepaintIfTextOrColorChange || diff == StyleDifferenceRepaintLayer) {
         RenderObject* parentToInvalidate = parent();
         for (unsigned i = 0; i < backgroundObscurationTestMaxDepth && parentToInvalidate; ++i) {
             parentToInvalidate->invalidateBackgroundObscurationStatus();
@@ -293,6 +293,7 @@
     } else {
         ShapeOutsideInfo::removeInfo(this);
     }
+    markShapeOutsideDependentsForLayout();
 }
 
 void RenderBox::updateGridPositionAfterStyleChange(const RenderStyle* oldStyle)
@@ -408,24 +409,37 @@
     return snapSizeToPixel(offsetHeight(), y() + clientTop());
 }
 
-bool RenderBox::requiresLayoutToDetermineWidth() const
+bool RenderBox::canDetermineWidthWithoutLayout() const
 {
+    // FIXME: This optimization is incorrect as written.
+    // We need to be able to opt-in to this behavior only when
+    // it's guarentted correct.
+    // Until then disabling this optimization to be safe.
+    return false;
+
+    // FIXME: There are likely many subclasses of RenderBlockFlow which
+    // cannot determine their layout just from style!
+    // Perhaps we should create a "PlainRenderBlockFlow"
+    // and move this optimization there?
+    if (!isRenderBlockFlow()
+        // Flexbox items can be expanded beyond their width.
+        || isFlexItemIncludingDeprecated()
+        // Table Layout controls cell size and can expand beyond width.
+        || isTableCell())
+        return false;
+
     RenderStyle* style = this->style();
-    return !style->width().isFixed()
-        || !style->minWidth().isFixed()
-        || (!style->maxWidth().isUndefined() && !style->maxWidth().isFixed())
-        || !style->paddingLeft().isFixed()
-        || !style->paddingRight().isFixed()
-        || style->resize() != RESIZE_NONE
-        || style->boxSizing() == BORDER_BOX
-        || !isRenderBlock()
-        || !isRenderBlockFlow()
-        || isFlexItemIncludingDeprecated();
+    return style->width().isFixed()
+        && style->minWidth().isFixed()
+        && (style->maxWidth().isUndefined() || style->maxWidth().isFixed())
+        && style->paddingLeft().isFixed()
+        && style->paddingRight().isFixed()
+        && style->boxSizing() == CONTENT_BOX;
 }
 
 LayoutUnit RenderBox::fixedOffsetWidth() const
 {
-    ASSERT(!requiresLayoutToDetermineWidth());
+    ASSERT(canDetermineWidthWithoutLayout());
 
     RenderStyle* style = this->style();
 
@@ -442,7 +456,7 @@
 int RenderBox::scrollWidth() const
 {
     if (hasOverflowClip())
-        return layer()->scrollWidth();
+        return layer()->scrollableArea()->scrollWidth();
     // For objects with visible overflow, this matches IE.
     // FIXME: Need to work right with writing modes.
     if (style()->isLeftToRightDirection())
@@ -453,7 +467,7 @@
 int RenderBox::scrollHeight() const
 {
     if (hasOverflowClip())
-        return layer()->scrollHeight();
+        return layer()->scrollableArea()->scrollHeight();
     // For objects with visible overflow, this matches IE.
     // FIXME: Need to work right with writing modes.
     return snapSizeToPixel(max(clientHeight(), layoutOverflowRect().maxY() - borderTop()), y() + clientTop());
@@ -571,6 +585,14 @@
         rects.append(pixelSnappedIntRect(additionalOffset, size()));
 }
 
+bool RenderBox::canResize() const
+{
+    // We need a special case for <iframe> because they never have
+    // hasOverflowClip(). However, they do "implicitly" clip their contents, so
+    // we want to allow resizing them also.
+    return (hasOverflowClip() || isRenderIFrame()) && style()->resize() != RESIZE_NONE;
+}
+
 void RenderBox::addLayerHitTestRects(LayerHitTestRects& layerRects, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
 {
     LayoutPoint adjustedLayerOffset = layerOffset + locationOffset();
@@ -669,12 +691,12 @@
         return 0;
 
     if (isHorizontalWritingMode() && style()->overflowY() == OSCROLL) {
-        ASSERT(layer()->hasVerticalScrollbar());
+        ASSERT(layer()->scrollableArea() && layer()->scrollableArea()->hasVerticalScrollbar());
         return verticalScrollbarWidth();
     }
 
     if (!isHorizontalWritingMode() && style()->overflowX() == OSCROLL) {
-        ASSERT(layer()->hasHorizontalScrollbar());
+        ASSERT(layer()->scrollableArea() && layer()->scrollableArea()->hasHorizontalScrollbar());
         return horizontalScrollbarHeight();
     }
 
@@ -802,7 +824,7 @@
 RenderBox* RenderBox::findAutoscrollable(RenderObject* renderer)
 {
     while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscroll())) {
-        if (!renderer->parent() && renderer->node() == &renderer->document() && renderer->document().ownerElement())
+        if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document().ownerElement())
             renderer = renderer->document().ownerElement()->renderer();
         else
             renderer = renderer->parent();
@@ -1417,7 +1439,7 @@
             shouldDrawBackgroundInSeparateBuffer = true;
 
         // The clipOccludesNextLayers condition must be evaluated first to avoid short-circuiting.
-        if (curLayer->clipOccludesNextLayers(curLayer == fillLayer) && curLayer->hasOpaqueImage(this) && curLayer->image()->canRender(this, style()->effectiveZoom()) && curLayer->hasRepeatXY() && curLayer->blendMode() == BlendModeNormal)
+        if (curLayer->clipOccludesNextLayers(curLayer == fillLayer) && curLayer->hasOpaqueImage(this) && curLayer->image()->canRender(this, style()->effectiveZoom()) && curLayer->hasRepeatXY() && curLayer->blendMode() == BlendModeNormal && !boxShadowShouldBeAppliedToBackground(bleedAvoidance))
             break;
         curLayer = curLayer->next();
     }
@@ -2086,7 +2108,9 @@
             if (!itemChild->isListMarker())
                 continue;
             RenderBox* itemMarker = toRenderBox(itemChild);
-            if (itemMarker->requiresLayoutToDetermineWidth() && itemMarker->needsLayout()) {
+            // FIXME: canDetermineWidthWithoutLayout expects us to use fixedOffsetWidth, which this code
+            // does not do! This check is likely wrong.
+            if (!itemMarker->canDetermineWidthWithoutLayout() && itemMarker->needsLayout()) {
                 // Make sure to compute the autosized width.
                 itemMarker->layout();
             }
@@ -3329,7 +3353,6 @@
     RenderView* renderView = view();
     LayoutUnit& marginLogicalLeftValue = style()->isLeftToRightDirection() ? computedValues.m_margins.m_start : computedValues.m_margins.m_end;
     LayoutUnit& marginLogicalRightValue = style()->isLeftToRightDirection() ? computedValues.m_margins.m_end : computedValues.m_margins.m_start;
-
     if (!logicalLeftIsAuto && !logicalWidthIsAuto && !logicalRightIsAuto) {
         /*-----------------------------------------------------------------------*\
          * If none of the three is 'auto': If both 'margin-left' and 'margin-
@@ -3486,6 +3509,10 @@
         }
     }
 
+    if (containerBlock->isBox() && toRenderBox(containerBlock)->scrollsOverflowY() && containerBlock->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
+        logicalLeftValue = logicalLeftValue + toRenderBox(containerBlock)->verticalScrollbarWidth();
+    }
+
     computedValues.m_position = logicalLeftValue + marginLogicalLeftValue;
     computeLogicalLeftPositionedOffset(computedValues.m_position, this, computedValues.m_extent, containerBlock, containerLogicalWidth);
 }
diff --git a/Source/core/rendering/RenderBox.h b/Source/core/rendering/RenderBox.h
index 88d627d..924ac97 100644
--- a/Source/core/rendering/RenderBox.h
+++ b/Source/core/rendering/RenderBox.h
@@ -23,10 +23,10 @@
 #ifndef RenderBox_h
 #define RenderBox_h
 
-#include "core/platform/ScrollTypes.h"
 #include "core/rendering/RenderBoxModelObject.h"
 #include "core/rendering/RenderOverflow.h"
 #include "core/rendering/shapes/ShapeOutsideInfo.h"
+#include "platform/scroll/ScrollTypes.h"
 
 namespace WebCore {
 
@@ -171,6 +171,8 @@
     RenderBox* nextSiblingBox() const;
     RenderBox* parentBox() const;
 
+    bool canResize() const;
+
     // Visual and layout overflow are in the coordinate space of the box.  This means that they aren't purely physical directions.
     // For horizontal-tb and vertical-lr they will match physical directions, but for horizontal-bt and vertical-rl, the top/bottom and left/right
     // respectively are flipped when compared to their physical counterparts.  For example minX is on the left in vertical-lr,
@@ -216,7 +218,7 @@
     virtual int pixelSnappedOffsetWidth() const OVERRIDE FINAL;
     virtual int pixelSnappedOffsetHeight() const OVERRIDE FINAL;
 
-    bool requiresLayoutToDetermineWidth() const;
+    bool canDetermineWidthWithoutLayout() const;
     LayoutUnit fixedOffsetWidth() const;
 
     // More IE extensions.  clientWidth and clientHeight represent the interior of an object
@@ -339,24 +341,15 @@
     LayoutUnit adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit height) const;
 
     struct ComputedMarginValues {
-        ComputedMarginValues()
-            : m_before(0)
-            , m_after(0)
-            , m_start(0)
-            , m_end(0)
-        {
-        }
+        ComputedMarginValues() { }
+
         LayoutUnit m_before;
         LayoutUnit m_after;
         LayoutUnit m_start;
         LayoutUnit m_end;
     };
     struct LogicalExtentComputedValues {
-        LogicalExtentComputedValues()
-            : m_extent(0)
-            , m_position(0)
-        {
-        }
+        LogicalExtentComputedValues() { }
 
         LayoutUnit m_extent;
         LayoutUnit m_position;
@@ -598,6 +591,12 @@
         return ShapeOutsideInfo::isEnabledFor(this) ? ShapeOutsideInfo::info(this) : 0;
     }
 
+    void markShapeOutsideDependentsForLayout()
+    {
+        if (isFloating())
+            removeFloatingOrPositionedChildFromBlockLists();
+    }
+
 protected:
     virtual void willBeDestroyed();
 
diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
index 932db84..e154677 100644
--- a/Source/core/rendering/RenderBoxModelObject.cpp
+++ b/Source/core/rendering/RenderBoxModelObject.cpp
@@ -34,12 +34,12 @@
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/Path.h"
 #include "core/platform/graphics/transforms/TransformState.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/ImageQualityController.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/RenderGeometryMap.h"
 #include "core/rendering/RenderInline.h"
 #include "core/rendering/RenderLayer.h"
-#include "core/rendering/RenderLayerBacking.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderNamedFlowThread.h"
 #include "core/rendering/RenderRegion.h"
@@ -103,49 +103,49 @@
 {
     ASSERT(hasLayer());
     ASSERT(isComposited());
-    return layer()->backing()->startTransition(timeOffset, propertyId, fromStyle, toStyle);
+    return layer()->compositedLayerMapping()->startTransition(timeOffset, propertyId, fromStyle, toStyle);
 }
 
 void RenderBoxModelObject::transitionPaused(double timeOffset, CSSPropertyID propertyId)
 {
     ASSERT(hasLayer());
     ASSERT(isComposited());
-    layer()->backing()->transitionPaused(timeOffset, propertyId);
+    layer()->compositedLayerMapping()->transitionPaused(timeOffset, propertyId);
 }
 
 void RenderBoxModelObject::transitionFinished(CSSPropertyID propertyId)
 {
     ASSERT(hasLayer());
     ASSERT(isComposited());
-    layer()->backing()->transitionFinished(propertyId);
+    layer()->compositedLayerMapping()->transitionFinished(propertyId);
 }
 
 bool RenderBoxModelObject::startAnimation(double timeOffset, const CSSAnimationData* animation, const KeyframeList& keyframes)
 {
     ASSERT(hasLayer());
     ASSERT(isComposited());
-    return layer()->backing()->startAnimation(timeOffset, animation, keyframes);
+    return layer()->compositedLayerMapping()->startAnimation(timeOffset, animation, keyframes);
 }
 
 void RenderBoxModelObject::animationPaused(double timeOffset, const String& name)
 {
     ASSERT(hasLayer());
     ASSERT(isComposited());
-    layer()->backing()->animationPaused(timeOffset, name);
+    layer()->compositedLayerMapping()->animationPaused(timeOffset, name);
 }
 
 void RenderBoxModelObject::animationFinished(const String& name)
 {
     ASSERT(hasLayer());
     ASSERT(isComposited());
-    layer()->backing()->animationFinished(name);
+    layer()->compositedLayerMapping()->animationFinished(name);
 }
 
 void RenderBoxModelObject::suspendAnimations(double time)
 {
     ASSERT(hasLayer());
     ASSERT(isComposited());
-    layer()->backing()->suspendAnimations(time);
+    layer()->compositedLayerMapping()->suspendAnimations(time);
 }
 
 bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext* context, Image* image, const void* layer, const LayoutSize& size)
@@ -623,8 +623,8 @@
         // Adjust the paint rect to reflect a scrolled content box with borders at the ends.
         IntSize offset = thisBox->scrolledContentOffset();
         scrolledPaintRect.move(-offset);
-        scrolledPaintRect.setWidth(bLeft + layer()->scrollWidth() + bRight);
-        scrolledPaintRect.setHeight(borderTop() + layer()->scrollHeight() + borderBottom());
+        scrolledPaintRect.setWidth(bLeft + thisBox->scrollWidth() + bRight);
+        scrolledPaintRect.setHeight(borderTop() + thisBox->scrollHeight() + borderBottom());
     }
 
     GraphicsContextStateSaver backgroundClipStateSaver(*context, false);
@@ -742,9 +742,10 @@
             RenderObject* clientForBackgroundImage = backgroundObject ? backgroundObject : this;
             RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geometry.tileSize());
             bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.get(), bgLayer, geometry.tileSize());
-            context->setDrawLuminanceMask(bgLayer->maskSourceType() == MaskLuminance);
+            if (bgLayer->maskSourceType() == MaskLuminance)
+                context->setColorFilter(ColorFilterLuminanceToAlpha);
             context->drawTiledImage(image.get(), geometry.destRect(), geometry.relativePhase(), geometry.tileSize(),
-                compositeOp, useLowQualityScaling, bgLayer->blendMode());
+                compositeOp, useLowQualityScaling, bgLayer->blendMode(), geometry.spaceSize());
         }
     }
 
@@ -986,7 +987,18 @@
     if (!rootLayer || !rootLayer->isComposited())
         return false;
 
-    return rootLayer->backing()->backgroundLayerPaintsFixedRootBackground();
+    return rootLayer->compositedLayerMapping()->backgroundLayerPaintsFixedRootBackground();
+}
+
+static inline int getSpace(int areaSize, int tileSize)
+{
+    int numberOfTiles = areaSize / tileSize;
+    int space = -1;
+
+    if (numberOfTiles > 1)
+        space = lroundf((float)(areaSize - numberOfTiles * tileSize) / (numberOfTiles - 1));
+
+    return space;
 }
 
 void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fillLayer, const LayoutRect& paintRect,
@@ -1063,7 +1075,7 @@
 
     LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(), availableWidth, renderView, true);
     if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fillTileSize.width() > 0) {
-        long nrTiles = lroundf((float)positioningAreaSize.width() / fillTileSize.width());
+        long nrTiles = max(1l, lroundf((float)positioningAreaSize.width() / fillTileSize.width()));
 
         if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != RoundFill) {
             fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.width() / (nrTiles * fillTileSize.width()));
@@ -1072,11 +1084,12 @@
         fillTileSize.setWidth(positioningAreaSize.width() / nrTiles);
         geometry.setTileSize(fillTileSize);
         geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0);
+        geometry.setSpaceSize(IntSize());
     }
 
     LayoutUnit computedYPosition = minimumValueForLength(fillLayer->yPosition(), availableHeight, renderView, true);
     if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fillTileSize.height() > 0) {
-        long nrTiles = lroundf((float)positioningAreaSize.height() / fillTileSize.height());
+        long nrTiles = max(1l, lroundf((float)positioningAreaSize.height() / fillTileSize.height()));
 
         if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != RoundFill) {
             fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.height() / (nrTiles * fillTileSize.height()));
@@ -1085,19 +1098,49 @@
         fillTileSize.setHeight(positioningAreaSize.height() / nrTiles);
         geometry.setTileSize(fillTileSize);
         geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0);
+        geometry.setSpaceSize(IntSize());
     }
 
     if (backgroundRepeatX == RepeatFill) {
         geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0);
-    } else if (backgroundRepeatX == NoRepeatFill) {
+        geometry.setSpaceSize(IntSize());
+    } else if (backgroundRepeatX == SpaceFill && fillTileSize.width() > 0) {
+        int space = getSpace(positioningAreaSize.width(), geometry.tileSize().width());
+        int actualWidth = geometry.tileSize().width() + space;
+
+        if (space >= 0) {
+            computedXPosition = minimumValueForLength(Length(), availableWidth, renderView, true);
+            geometry.setSpaceSize(IntSize(space, 0));
+            geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXPosition + left) % actualWidth : 0);
+        } else {
+            backgroundRepeatX = NoRepeatFill;
+        }
+    }
+    if (backgroundRepeatX == NoRepeatFill) {
         int xOffset = fillLayer->backgroundXOrigin() == RightEdge ? availableWidth - computedXPosition : computedXPosition;
         geometry.setNoRepeatX(left + xOffset);
+        geometry.setSpaceSize(IntSize(0, geometry.spaceSize().height()));
     }
+
     if (backgroundRepeatY == RepeatFill) {
         geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0);
-    } else if (backgroundRepeatY == NoRepeatFill) {
+        geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0));
+    } else if (backgroundRepeatY == SpaceFill && fillTileSize.height() > 0) {
+        int space = getSpace(positioningAreaSize.height(), geometry.tileSize().height());
+        int actualHeight = geometry.tileSize().height() + space;
+
+        if (space >= 0) {
+            computedYPosition = minimumValueForLength(Length(), availableHeight, renderView, true);
+            geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), space));
+            geometry.setPhaseY(actualHeight ? actualHeight - roundToInt(computedYPosition + top) % actualHeight : 0);
+        } else {
+            backgroundRepeatY = NoRepeatFill;
+        }
+    }
+    if (backgroundRepeatY == NoRepeatFill) {
         int yOffset = fillLayer->backgroundYOrigin() == BottomEdge ? availableHeight - computedYPosition : computedYPosition;
         geometry.setNoRepeatY(top + yOffset);
+        geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0));
     }
 
     if (fixedAttachment)
@@ -1842,7 +1885,7 @@
             graphicsContext->clipRoundedRect(outerBorder);
         // isRenderable() check avoids issue described in https://bugs.webkit.org/show_bug.cgi?id=38787
         // The inside will be clipped out later (in clipBorderSideForComplexInnerPath)
-        if (innerBorder.isRenderable())
+        if (innerBorder.isRenderable() && !innerBorder.isEmpty())
             graphicsContext->clipOutRoundedRect(innerBorder);
     }
 
@@ -2306,7 +2349,9 @@
     BoxSide side, const class BorderEdge edges[])
 {
     graphicsContext->clip(calculateSideRectIncludingInner(outerBorder, edges, side));
-    graphicsContext->clipOutRoundedRect(calculateAdjustedInnerBorder(innerBorder, side));
+    RoundedRect adjustedInnerRect = calculateAdjustedInnerBorder(innerBorder, side);
+    if (!adjustedInnerRect.isEmpty())
+        graphicsContext->clipOutRoundedRect(adjustedInnerRect);
 }
 
 void RenderBoxModelObject::getBorderEdgeInfo(BorderEdge edges[], const RenderStyle* style, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
diff --git a/Source/core/rendering/RenderBoxModelObject.h b/Source/core/rendering/RenderBoxModelObject.h
index bcbaf90..7f8d320 100644
--- a/Source/core/rendering/RenderBoxModelObject.h
+++ b/Source/core/rendering/RenderBoxModelObject.h
@@ -24,9 +24,9 @@
 #ifndef RenderBoxModelObject_h
 #define RenderBoxModelObject_h
 
-#include "core/platform/graphics/LayoutRect.h"
 #include "core/rendering/RenderLayerModelObject.h"
 #include "core/rendering/style/ShadowData.h"
+#include "platform/geometry/LayoutRect.h"
 
 namespace WebCore {
 
@@ -224,6 +224,14 @@
             m_tileSize = tileSize;
         }
 
+        // Space-size represents extra width and height that may be added to
+        // the image if used as a pattern with repeat: space
+        IntSize spaceSize() const { return m_repeatSpacing; }
+        void setSpaceSize(const IntSize& repeatSpacing)
+        {
+            m_repeatSpacing = repeatSpacing;
+        }
+
         void setPhaseX(int x) { m_phase.setX(x); }
         void setPhaseY(int y) { m_phase.setY(y); }
 
@@ -238,6 +246,7 @@
         IntPoint m_destOrigin;
         IntPoint m_phase;
         IntSize m_tileSize;
+        IntSize m_repeatSpacing;
     };
 
     LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const;
diff --git a/Source/core/rendering/RenderBoxRegionInfo.h b/Source/core/rendering/RenderBoxRegionInfo.h
index 2abfa09..3bde47e 100644
--- a/Source/core/rendering/RenderBoxRegionInfo.h
+++ b/Source/core/rendering/RenderBoxRegionInfo.h
@@ -27,7 +27,7 @@
 #ifndef RenderBoxRegionInfo_h
 #define RenderBoxRegionInfo_h
 
-#include "core/platform/LayoutUnit.h"
+#include "platform/LayoutUnit.h"
 #include "wtf/FastAllocBase.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/RenderCounter.cpp b/Source/core/rendering/RenderCounter.cpp
index 224ca85..331c766 100644
--- a/Source/core/rendering/RenderCounter.cpp
+++ b/Source/core/rendering/RenderCounter.cpp
@@ -542,7 +542,7 @@
         node = node->parentNode();
     else
         node = renderer->generatingNode();
-    if (node && !node->attached())
+    if (node && !node->confusingAndOftenMisusedAttached())
         return; // No need to update if the parent is not attached yet
     for (RenderObject* descendant = renderer; descendant; descendant = descendant->nextInPreOrder(renderer))
         updateCounters(descendant);
@@ -551,7 +551,7 @@
 void RenderCounter::rendererStyleChanged(RenderObject* renderer, const RenderStyle* oldStyle, const RenderStyle* newStyle)
 {
     Node* node = renderer->generatingNode();
-    if (!node || !node->attached())
+    if (!node || !node->confusingAndOftenMisusedAttached())
         return; // cannot have generated content or if it can have, it will be handled during attaching
     const CounterDirectiveMap* newCounterDirectives;
     const CounterDirectiveMap* oldCounterDirectives;
diff --git a/Source/core/rendering/RenderDeprecatedFlexibleBox.cpp b/Source/core/rendering/RenderDeprecatedFlexibleBox.cpp
index ee4d483..fc6368d 100644
--- a/Source/core/rendering/RenderDeprecatedFlexibleBox.cpp
+++ b/Source/core/rendering/RenderDeprecatedFlexibleBox.cpp
@@ -128,11 +128,11 @@
     if (!isAnonymous()) {
         const KURL& url = document().url();
         if (url.protocolIs("chrome"))
-            UseCounter::count(&document(), UseCounter::DeprecatedFlexboxChrome);
+            UseCounter::count(document(), UseCounter::DeprecatedFlexboxChrome);
         else if (url.protocolIs("chrome-extension"))
-            UseCounter::count(&document(), UseCounter::DeprecatedFlexboxChromeExtension);
+            UseCounter::count(document(), UseCounter::DeprecatedFlexboxChromeExtension);
         else
-            UseCounter::count(&document(), UseCounter::DeprecatedFlexboxWebContent);
+            UseCounter::count(document(), UseCounter::DeprecatedFlexboxWebContent);
     }
 }
 
@@ -880,7 +880,7 @@
 
 void RenderDeprecatedFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutChildren)
 {
-    UseCounter::count(&document(), UseCounter::LineClamp);
+    UseCounter::count(document(), UseCounter::LineClamp);
 
     int maxLineCount = 0;
     for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
diff --git a/Source/core/rendering/RenderEmbeddedObject.cpp b/Source/core/rendering/RenderEmbeddedObject.cpp
index 03b6f49..a8d44f5 100644
--- a/Source/core/rendering/RenderEmbeddedObject.cpp
+++ b/Source/core/rendering/RenderEmbeddedObject.cpp
@@ -27,19 +27,19 @@
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
 #include "core/html/HTMLIFrameElement.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/LocalizedStrings.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/FontSelector.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/Path.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/plugins/PluginView.h"
 #include "core/rendering/PaintInfo.h"
 #include "core/rendering/RenderTheme.h"
 #include "core/rendering/RenderView.h"
+#include "platform/graphics/TextRun.h"
+#include "platform/text/PlatformLocale.h"
 
 namespace WebCore {
 
@@ -84,13 +84,14 @@
     return widget() && widget()->isPluginView() && toPluginView(widget())->platformLayer();
 }
 
-static String unavailablePluginReplacementText(RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason)
+static String unavailablePluginReplacementText(Node* node, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason)
 {
+    Locale& locale = node ? toElement(node)->locale() : *Locale::defaultLocale();
     switch (pluginUnavailabilityReason) {
     case RenderEmbeddedObject::PluginMissing:
-        return missingPluginText();
+        return locale.queryString(WebKit::WebLocalizedString::MissingPluginText);
     case RenderEmbeddedObject::PluginBlockedByContentSecurityPolicy:
-        return blockedPluginByContentSecurityPolicyText();
+        return locale.queryString(WebKit::WebLocalizedString::BlockedPluginText);
     }
 
     ASSERT_NOT_REACHED();
@@ -103,7 +104,7 @@
     m_showsUnavailablePluginIndicator = true;
     m_pluginUnavailabilityReason = pluginUnavailabilityReason;
 
-    m_unavailablePluginReplacementText = unavailablePluginReplacementText(pluginUnavailabilityReason);
+    m_unavailablePluginReplacementText = unavailablePluginReplacementText(node(), pluginUnavailabilityReason);
 }
 
 bool RenderEmbeddedObject::showsUnavailablePluginIndicator() const
@@ -122,20 +123,11 @@
 
 void RenderEmbeddedObject::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
-    Page* page = 0;
-    if (Frame* frame = this->frame())
-        page = frame->page();
-
     if (showsUnavailablePluginIndicator()) {
-        if (page && paintInfo.phase == PaintPhaseForeground)
-            page->addRelevantUnpaintedObject(this, visualOverflowRect());
         RenderReplaced::paint(paintInfo, paintOffset);
         return;
     }
 
-    if (page && paintInfo.phase == PaintPhaseForeground)
-        page->addRelevantRepaintedObject(this, visualOverflowRect());
-
     RenderPart::paint(paintInfo, paintOffset);
 }
 
diff --git a/Source/core/rendering/RenderFileUploadControl.cpp b/Source/core/rendering/RenderFileUploadControl.cpp
index 64c1d92..43b2c04 100644
--- a/Source/core/rendering/RenderFileUploadControl.cpp
+++ b/Source/core/rendering/RenderFileUploadControl.cpp
@@ -29,10 +29,11 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/rendering/PaintInfo.h"
 #include "core/rendering/RenderButton.h"
 #include "core/rendering/RenderTheme.h"
+#include "platform/graphics/TextRun.h"
+#include "platform/text/PlatformLocale.h"
 
 using namespace std;
 
@@ -163,7 +164,7 @@
     RenderFileUploadControl* renderer = const_cast<RenderFileUploadControl*>(this);
     float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructTextRun(renderer, font, characterAsString, style(), TextRun::AllowTrailingExpansion));
 
-    const String label = RenderTheme::theme().fileListDefaultLabel(toHTMLInputElement(node())->multiple());
+    const String label = toHTMLInputElement(node())->locale().queryString(WebKit::WebLocalizedString::FileButtonNoFileSelectedLabel);
     float defaultLabelWidth = font.width(constructTextRun(renderer, font, label, style(), TextRun::AllowTrailingExpansion));
     if (HTMLInputElement* button = uploadButton())
         if (RenderObject* buttonRenderer = button->renderer())
@@ -228,7 +229,7 @@
 {
     HTMLInputElement* input = toHTMLInputElement(node());
     ASSERT(input->files());
-    return RenderTheme::theme().fileListNameForWidth(input->files(), style()->font(), maxFilenameWidth(), input->multiple());
+    return RenderTheme::theme().fileListNameForWidth(input->locale(), input->files(), style()->font(), maxFilenameWidth());
 }
 
 } // namespace WebCore
diff --git a/Source/core/rendering/RenderFlowThread.cpp b/Source/core/rendering/RenderFlowThread.cpp
index 0ec0f06..015ef33 100644
--- a/Source/core/rendering/RenderFlowThread.cpp
+++ b/Source/core/rendering/RenderFlowThread.cpp
@@ -32,7 +32,6 @@
 #include "core/rendering/RenderFlowThread.h"
 
 #include "core/dom/Node.h"
-#include "core/platform/PODIntervalTree.h"
 #include "core/platform/graphics/transforms/TransformState.h"
 #include "core/rendering/FlowThreadController.h"
 #include "core/rendering/HitTestRequest.h"
@@ -43,6 +42,7 @@
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderRegion.h"
 #include "core/rendering/RenderView.h"
+#include "platform/PODIntervalTree.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/RenderFrame.cpp b/Source/core/rendering/RenderFrame.cpp
index c67bd0a..329ae34 100644
--- a/Source/core/rendering/RenderFrame.cpp
+++ b/Source/core/rendering/RenderFrame.cpp
@@ -25,7 +25,7 @@
 #include "core/rendering/RenderFrame.h"
 
 #include "core/html/HTMLFrameElement.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/RenderFrameSet.cpp b/Source/core/rendering/RenderFrameSet.cpp
index ba44185..aac0a4a 100644
--- a/Source/core/rendering/RenderFrameSet.cpp
+++ b/Source/core/rendering/RenderFrameSet.cpp
@@ -25,12 +25,12 @@
 #include "core/rendering/RenderFrameSet.h"
 
 #include "core/dom/Document.h"
-#include "core/events/EventNames.h"
 #include "core/events/MouseEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLDimension.h"
 #include "core/html/HTMLFrameSetElement.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/platform/Cursor.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/rendering/PaintInfo.h"
@@ -562,7 +562,7 @@
     if (!m_isResizing) {
         if (needsLayout())
             return false;
-        if (evt->type() == eventNames().mousedownEvent && evt->button() == LeftButton) {
+        if (evt->type() == EventTypeNames::mousedown && evt->button() == LeftButton) {
             FloatPoint localPos = absoluteToLocal(evt->absoluteLocation(), UseTransforms);
             startResizing(m_cols, localPos.x());
             startResizing(m_rows, localPos.y());
@@ -572,11 +572,11 @@
             }
         }
     } else {
-        if (evt->type() == eventNames().mousemoveEvent || (evt->type() == eventNames().mouseupEvent && evt->button() == LeftButton)) {
+        if (evt->type() == EventTypeNames::mousemove || (evt->type() == EventTypeNames::mouseup && evt->button() == LeftButton)) {
             FloatPoint localPos = absoluteToLocal(evt->absoluteLocation(), UseTransforms);
             continueResizing(m_cols, localPos.x());
             continueResizing(m_rows, localPos.y());
-            if (evt->type() == eventNames().mouseupEvent && evt->button() == LeftButton) {
+            if (evt->type() == EventTypeNames::mouseup && evt->button() == LeftButton) {
                 setIsResizing(false);
                 return true;
             }
diff --git a/Source/core/rendering/RenderGeometryMap.cpp b/Source/core/rendering/RenderGeometryMap.cpp
index f7dc640..b756c2a 100644
--- a/Source/core/rendering/RenderGeometryMap.cpp
+++ b/Source/core/rendering/RenderGeometryMap.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/rendering/RenderGeometryMap.h"
 
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/platform/graphics/transforms/TransformState.h"
 #include "core/rendering/RenderLayer.h"
diff --git a/Source/core/rendering/RenderGeometryMap.h b/Source/core/rendering/RenderGeometryMap.h
index 9892c8a..8049bbb 100644
--- a/Source/core/rendering/RenderGeometryMap.h
+++ b/Source/core/rendering/RenderGeometryMap.h
@@ -26,12 +26,12 @@
 #ifndef RenderGeometryMap_h
 #define RenderGeometryMap_h
 
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/IntSize.h"
-#include "core/platform/graphics/LayoutSize.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
 #include "core/rendering/RenderObject.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/geometry/LayoutSize.h"
+#include "platform/transforms/TransformationMatrix.h"
 #include "wtf/OwnPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp
index 86e84fa..2cce825 100644
--- a/Source/core/rendering/RenderGrid.cpp
+++ b/Source/core/rendering/RenderGrid.cpp
@@ -168,6 +168,7 @@
     : RenderBlock(element)
     , m_gridIsDirty(true)
     , m_orderIterator(this)
+    , m_gridItemOverflowGridArea(false)
 {
     // All of our children must be block level.
     setChildrenInline(false);
@@ -301,13 +302,13 @@
 {
     const_cast<RenderGrid*>(this)->placeItemsOnGrid();
 
-    // FIXME: This is an inefficient way to fill our sizes as it will try every grid areas, when we would
-    // only want to account for fixed grid tracks and grid items. Also this will be incorrect if we have spanning
-    // grid items.
-    for (size_t i = 0; i < gridColumnCount(); ++i) {
-        const GridTrackSize& trackSize = gridTrackSize(ForColumns, i);
-        LayoutUnit minTrackBreadth = computePreferredTrackWidth(trackSize.minTrackBreadth(), i);
-        LayoutUnit maxTrackBreadth = computePreferredTrackWidth(trackSize.maxTrackBreadth(), i);
+    GridSizingData sizingData(gridColumnCount(), gridRowCount());
+    LayoutUnit availableLogicalSpace = 0;
+    const_cast<RenderGrid*>(this)->computedUsedBreadthOfGridTracks(ForColumns, sizingData, availableLogicalSpace);
+
+    for (size_t i = 0; i < sizingData.columnTracks.size(); ++i) {
+        LayoutUnit minTrackBreadth = sizingData.columnTracks[i].m_usedBreadth;
+        LayoutUnit maxTrackBreadth = sizingData.columnTracks[i].m_maxBreadth;
         maxTrackBreadth = std::max(maxTrackBreadth, minTrackBreadth);
 
         minLogicalWidth += minTrackBreadth;
@@ -336,44 +337,14 @@
     clearPreferredLogicalWidthsDirty();
 }
 
-LayoutUnit RenderGrid::computePreferredTrackWidth(const GridLength& gridLength, size_t trackIndex) const
-{
-    if (gridLength.isFlex())
-        return 0;
-
-    const Length& length = gridLength.length();
-
-    if (length.isFixed()) {
-        // Grid areas don't have borders, margins or paddings so we don't need to account for them.
-        return length.intValue();
-    }
-
-    if (length.isMinContent()) {
-        LayoutUnit minContentSize = 0;
-        GridIterator iterator(m_grid, ForColumns, trackIndex);
-        while (RenderBox* gridItem = iterator.nextGridItem())
-            minContentSize = std::max(minContentSize, gridItem->minPreferredLogicalWidth() + marginIntrinsicLogicalWidthForChild(gridItem));
-
-        return minContentSize;
-    }
-
-    if (length.isMaxContent()) {
-        LayoutUnit maxContentSize = 0;
-        GridIterator iterator(m_grid, ForColumns, trackIndex);
-        while (RenderBox* gridItem = iterator.nextGridItem())
-            maxContentSize = std::max(maxContentSize, gridItem->maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthForChild(gridItem));
-
-        return maxContentSize;
-    }
-
-    // FIXME: css3-sizing mentions that we should resolve "definite sizes"
-    // (including <percentage> and calc()) but we don't do it elsewhere.
-    return 0;
-}
-
 void RenderGrid::computedUsedBreadthOfGridTracks(TrackSizingDirection direction, GridSizingData& sizingData)
 {
     LayoutUnit availableLogicalSpace = (direction == ForColumns) ? availableLogicalWidth() : availableLogicalHeight(IncludeMarginBorderPadding);
+    computedUsedBreadthOfGridTracks(direction, sizingData, availableLogicalSpace);
+}
+
+void RenderGrid::computedUsedBreadthOfGridTracks(TrackSizingDirection direction, GridSizingData& sizingData, LayoutUnit& availableLogicalSpace)
+{
     Vector<GridTrack>& tracks = (direction == ForColumns) ? sizingData.columnTracks : sizingData.rowTracks;
     sizingData.contentSizedTracksIndex.shrink(0);
     for (size_t i = 0; i < tracks.size(); ++i) {
@@ -559,7 +530,7 @@
     if (direction == ForColumns) {
         // FIXME: It's unclear if we should return the intrinsic width or the preferred width.
         // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
-        return child->minPreferredLogicalWidth();
+        return child->minPreferredLogicalWidth() + marginIntrinsicLogicalWidthForChild(child);
     }
 
     return logicalContentHeightForChild(child, columnTracks);
@@ -575,7 +546,7 @@
     if (direction == ForColumns) {
         // FIXME: It's unclear if we should return the intrinsic width or the preferred width.
         // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
-        return child->maxPreferredLogicalWidth();
+        return child->maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthForChild(child);
     }
 
     return logicalContentHeightForChild(child, columnTracks);
@@ -883,7 +854,7 @@
         LayoutUnit overrideContainingBlockContentLogicalHeight = gridAreaBreadthForChild(child, ForRows, sizingData.rowTracks);
 
         SubtreeLayoutScope layoutScope(child);
-        if (oldOverrideContainingBlockContentLogicalWidth != overrideContainingBlockContentLogicalWidth || (child->hasRelativeLogicalHeight() && oldOverrideContainingBlockContentLogicalHeight != overrideContainingBlockContentLogicalHeight))
+        if (oldOverrideContainingBlockContentLogicalWidth != overrideContainingBlockContentLogicalWidth || (oldOverrideContainingBlockContentLogicalHeight != overrideContainingBlockContentLogicalHeight && child->hasRelativeLogicalHeight()))
             layoutScope.setNeedsLayout(child);
 
         child->setOverrideContainingBlockContentLogicalWidth(overrideContainingBlockContentLogicalWidth);
@@ -898,6 +869,10 @@
 
         child->setLogicalLocation(findChildLogicalPosition(child, sizingData));
 
+        // For correctness, we disable some painting optimizations if we have a child overflowing its grid area.
+        m_gridItemOverflowGridArea = child->logicalHeight() > overrideContainingBlockContentLogicalHeight
+            || child->logicalWidth() > overrideContainingBlockContentLogicalWidth;
+
         // If the child moved, we have to repaint it as well as any floating/positioned
         // descendants. An exception is if we need a layout. In this case, we know we're going to
         // repaint ourselves (and the child) anyway.
@@ -1171,10 +1146,21 @@
     return GridSpan(startGridAreaIndex, endGridAreaIndex);
 }
 
+void RenderGrid::paintChildrenSlowCase(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+{
+    for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next())
+        paintChild(child, paintInfo, paintOffset);
+}
+
 void RenderGrid::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!gridIsDirty());
 
+    if (m_gridItemOverflowGridArea) {
+        paintChildrenSlowCase(paintInfo, paintOffset);
+        return;
+    }
+
     LayoutRect localRepaintRect = paintInfo.rect;
     localRepaintRect.moveBy(-paintOffset);
 
diff --git a/Source/core/rendering/RenderGrid.h b/Source/core/rendering/RenderGrid.h
index 2f9ea1f..9071e6a 100644
--- a/Source/core/rendering/RenderGrid.h
+++ b/Source/core/rendering/RenderGrid.h
@@ -69,12 +69,11 @@
     bool explicitGridDidResize(const RenderStyle*) const;
     bool namedGridLinesDefinitionDidChange(const RenderStyle*) const;
 
-    LayoutUnit computePreferredTrackWidth(const GridLength&, size_t) const;
-
     class GridIterator;
     class GridSizingData;
     enum TrackSizingDirection { ForColumns, ForRows };
     void computedUsedBreadthOfGridTracks(TrackSizingDirection, GridSizingData&);
+    void computedUsedBreadthOfGridTracks(TrackSizingDirection, GridSizingData&, LayoutUnit& availableLogicalSpace);
     LayoutUnit computeUsedBreadthOfMinLength(TrackSizingDirection, const GridLength&) const;
     LayoutUnit computeUsedBreadthOfMaxLength(TrackSizingDirection, const GridLength&, LayoutUnit usedBreadth) const;
     LayoutUnit computeUsedBreadthOfSpecifiedLength(TrackSizingDirection, const Length&) const;
@@ -128,6 +127,7 @@
     LayoutUnit gridAreaBreadthForChild(const RenderBox* child, TrackSizingDirection, const Vector<GridTrack>&) const;
 
     virtual void paintChildren(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL;
+    void paintChildrenSlowCase(PaintInfo&, const LayoutPoint&);
 
     bool gridIsDirty() const { return m_gridIsDirty; }
 
@@ -154,6 +154,7 @@
     Vector<LayoutUnit> m_columnPositions;
     HashMap<const RenderBox*, GridCoordinate> m_gridItemCoordinate;
     OrderIterator m_orderIterator;
+    bool m_gridItemOverflowGridArea;
 };
 
 inline RenderGrid* toRenderGrid(RenderObject* object)
diff --git a/Source/core/rendering/RenderHTMLCanvas.cpp b/Source/core/rendering/RenderHTMLCanvas.cpp
index cf8f519..96a06bb 100644
--- a/Source/core/rendering/RenderHTMLCanvas.cpp
+++ b/Source/core/rendering/RenderHTMLCanvas.cpp
@@ -28,8 +28,8 @@
 
 #include "core/html/HTMLCanvasElement.h"
 #include "core/html/canvas/CanvasRenderingContext.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/rendering/PaintInfo.h"
 #include "core/rendering/RenderView.h"
@@ -69,13 +69,6 @@
         paintInfo.context->clip(pixelSnappedIntRect(contentRect));
     }
 
-    if (Frame* frame = this->frame()) {
-        if (Page* page = frame->page()) {
-            if (paintInfo.phase == PaintPhaseForeground)
-                page->addRelevantRepaintedObject(this, intersection(paintRect, contentRect));
-        }
-    }
-
     bool useLowQualityScale = style()->imageRendering() == ImageRenderingOptimizeContrast;
     toHTMLCanvasElement(node())->paint(context, paintRect, useLowQualityScale);
 
diff --git a/Source/core/rendering/RenderIFrame.cpp b/Source/core/rendering/RenderIFrame.cpp
index c632870..bea0845 100644
--- a/Source/core/rendering/RenderIFrame.cpp
+++ b/Source/core/rendering/RenderIFrame.cpp
@@ -28,8 +28,8 @@
 
 #include "HTMLNames.h"
 #include "core/html/HTMLIFrameElement.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/RenderView.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/RenderImage.cpp b/Source/core/rendering/RenderImage.cpp
index 8a2c637..70479a8 100644
--- a/Source/core/rendering/RenderImage.cpp
+++ b/Source/core/rendering/RenderImage.cpp
@@ -36,7 +36,7 @@
 #include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLMapElement.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/platform/graphics/Font.h"
 #include "core/platform/graphics/FontCache.h"
@@ -59,6 +59,7 @@
     , m_needsToSetSizeForAltText(false)
     , m_didIncrementVisuallyNonEmptyPixelCount(false)
     , m_isGeneratedContent(false)
+    , m_imageDevicePixelRatio(1.0f)
 {
     updateAltText();
 }
@@ -199,9 +200,9 @@
 
 void RenderImage::updateInnerContentRect()
 {
-    // Propagate container size to image resource.
-    LayoutRect paintRect = replacedContentRect();
-    IntSize containerSize(paintRect.width(), paintRect.height());
+    // Propagate container size to the image resource.
+    LayoutRect containerRect = replacedContentRect();
+    IntSize containerSize(containerRect.width(), containerRect.height());
     if (!containerSize.isEmpty())
         m_imageResource->setContainerSizeForRenderer(containerSize);
 }
@@ -246,14 +247,14 @@
             if (!selfNeedsLayout())
                 setNeedsLayout();
         }
+    }
 
-        if (everHadLayout() && !selfNeedsLayout()) {
-            // The inner content rectangle is calculated during layout, but may need an update now
-            // (unless the box has already been scheduled for layout). In order to calculate it, we
-            // may need values from the containing block, though, so make sure that we're not too
-            // early. It may be that layout hasn't even taken place once yet.
-            updateInnerContentRect();
-        }
+    if (everHadLayout() && !selfNeedsLayout()) {
+        // The inner content rectangle is calculated during layout, but may need an update now
+        // (unless the box has already been scheduled for layout). In order to calculate it, we
+        // may need values from the containing block, though, so make sure that we're not too
+        // early. It may be that layout hasn't even taken place once yet.
+        updateInnerContentRect();
     }
 
     if (shouldRepaint) {
@@ -310,9 +311,6 @@
         if (paintInfo.phase == PaintPhaseSelection)
             return;
 
-        if (page && paintInfo.phase == PaintPhaseForeground)
-            page->addRelevantUnpaintedObject(this, visualOverflowRect());
-
         if (cWidth > 2 && cHeight > 2) {
             const int borderWidth = 1;
 
@@ -351,7 +349,6 @@
             }
 
             if (!m_altText.isEmpty()) {
-                String text = document().displayStringModifiedByEncoding(m_altText);
                 const Font& font = style()->font();
                 const FontMetrics& fontMetrics = font.fontMetrics();
                 LayoutUnit ascent = fontMetrics.ascent();
@@ -361,7 +358,7 @@
 
                 // Only draw the alt text if it'll fit within the content box,
                 // and only if it fits above the error image.
-                TextRun textRun = RenderBlock::constructTextRun(this, font, text, style());
+                TextRun textRun = RenderBlock::constructTextRun(this, font, m_altText, style());
                 LayoutUnit textWidth = font.width(textRun);
                 TextRunPaintInfo textRunPaintInfo(textRun);
                 textRunPaintInfo.bounds = FloatRect(textRectOrigin, FloatSize(textWidth, fontMetrics.height()));
@@ -375,11 +372,8 @@
         }
     } else if (m_imageResource->hasImage() && cWidth > 0 && cHeight > 0) {
         RefPtr<Image> img = m_imageResource->image(cWidth, cHeight);
-        if (!img || img->isNull()) {
-            if (page && paintInfo.phase == PaintPhaseForeground)
-                page->addRelevantUnpaintedObject(this, visualOverflowRect());
+        if (!img || img->isNull())
             return;
-        }
 
         LayoutRect contentRect = contentBoxRect();
         contentRect.moveBy(paintOffset);
@@ -393,16 +387,6 @@
 
         paintIntoRect(context, paintRect);
 
-        if (cachedImage() && page && paintInfo.phase == PaintPhaseForeground) {
-            // For now, count images as unpainted if they are still progressively loading. We may want
-            // to refine this in the future to account for the portion of the image that has painted.
-            LayoutRect visibleRect = intersection(paintRect, contentRect);
-            if (cachedImage()->isLoading())
-                page->addRelevantUnpaintedObject(this, visibleRect);
-            else
-                page->addRelevantRepaintedObject(this, visibleRect);
-        }
-
         if (clip)
             context->restore();
     }
diff --git a/Source/core/rendering/RenderImage.h b/Source/core/rendering/RenderImage.h
index 1204ea5..bdd5566 100644
--- a/Source/core/rendering/RenderImage.h
+++ b/Source/core/rendering/RenderImage.h
@@ -61,6 +61,9 @@
 
     String altText() const { return m_altText; }
 
+    inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio = factor; }
+    float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; }
+
 protected:
     virtual bool needsPreferredWidthsRecalculation() const OVERRIDE FINAL;
     virtual RenderBox* embeddedContentBox() const OVERRIDE FINAL;
@@ -112,6 +115,7 @@
     bool m_needsToSetSizeForAltText;
     bool m_didIncrementVisuallyNonEmptyPixelCount;
     bool m_isGeneratedContent;
+    float m_imageDevicePixelRatio;
 
     friend class RenderImageScaleObserver;
 };
diff --git a/Source/core/rendering/RenderImageResource.cpp b/Source/core/rendering/RenderImageResource.cpp
index 6130187..ffd1dc3 100644
--- a/Source/core/rendering/RenderImageResource.cpp
+++ b/Source/core/rendering/RenderImageResource.cpp
@@ -30,6 +30,7 @@
 
 #include "core/fetch/ImageResource.h"
 #include "core/platform/graphics/Image.h"
+#include "core/rendering/RenderImage.h"
 #include "core/rendering/RenderObject.h"
 
 namespace WebCore {
@@ -103,4 +104,14 @@
     return Image::nullImage();
 }
 
+LayoutSize RenderImageResource::getImageSize(float multiplier, ImageResource::SizeType type) const
+{
+    if (!m_cachedImage)
+        return LayoutSize();
+    LayoutSize size = m_cachedImage->imageSizeForRenderer(m_renderer, multiplier, type);
+    if (m_renderer && m_renderer->isRenderImage())
+        size.scale(toRenderImage(m_renderer)->imageDevicePixelRatio());
+    return size;
+}
+
 } // namespace WebCore
diff --git a/Source/core/rendering/RenderImageResource.h b/Source/core/rendering/RenderImageResource.h
index d5d8fca..ef2a4ae 100644
--- a/Source/core/rendering/RenderImageResource.h
+++ b/Source/core/rendering/RenderImageResource.h
@@ -29,8 +29,8 @@
 #include "core/fetch/ImageResource.h"
 #include "core/fetch/ResourcePtr.h"
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/LayoutSize.h"
 #include "core/rendering/style/StyleImage.h"
+#include "platform/geometry/LayoutSize.h"
 
 namespace WebCore {
 
@@ -63,8 +63,8 @@
     virtual bool imageHasRelativeWidth() const { return m_cachedImage ? m_cachedImage->imageHasRelativeWidth() : false; }
     virtual bool imageHasRelativeHeight() const { return m_cachedImage ? m_cachedImage->imageHasRelativeHeight() : false; }
 
-    virtual LayoutSize imageSize(float multiplier) const { return m_cachedImage ? m_cachedImage->imageSizeForRenderer(m_renderer, multiplier) : LayoutSize(); }
-    virtual LayoutSize intrinsicSize(float multiplier) const { return m_cachedImage ? m_cachedImage->imageSizeForRenderer(m_renderer, multiplier, ImageResource::IntrinsicSize) : LayoutSize(); }
+    virtual LayoutSize imageSize(float multiplier) const { return getImageSize(multiplier, ImageResource::NormalSize); }
+    virtual LayoutSize intrinsicSize(float multiplier) const { return getImageSize(multiplier, ImageResource::IntrinsicSize); }
 
     virtual WrappedImagePtr imagePtr() const { return m_cachedImage.get(); }
 
@@ -75,6 +75,7 @@
 
 private:
     static Image* nullImage();
+    LayoutSize getImageSize(float multiplier, ImageResource::SizeType) const;
 };
 
 } // namespace WebCore
diff --git a/Source/core/rendering/RenderInline.cpp b/Source/core/rendering/RenderInline.cpp
index 0ab2423..de8d002 100644
--- a/Source/core/rendering/RenderInline.cpp
+++ b/Source/core/rendering/RenderInline.cpp
@@ -26,7 +26,6 @@
 #include "core/dom/FullscreenElementStack.h"
 #include "core/page/Chrome.h"
 #include "core/page/Page.h"
-#include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/transforms/TransformState.h"
 #include "core/rendering/HitTestResult.h"
@@ -39,6 +38,7 @@
 #include "core/rendering/RenderTheme.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/style/StyleInheritedData.h"
+#include "platform/geometry/FloatQuad.h"
 
 using namespace std;
 
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index bf22001..f897b84 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -50,29 +50,18 @@
 #include "SVGNames.h"
 #include "core/css/PseudoStyleRequest.h"
 #include "core/dom/Document.h"
-#include "core/events/DocumentEventQueue.h"
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/html/HTMLFrameElement.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/page/EventHandler.h"
-#include "core/page/FocusController.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/page/UseCounter.h"
-#include "core/page/animation/AnimationController.h"
+#include "core/frame/animation/AnimationController.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
 #include "core/platform/HistogramSupport.h"
-#include "core/platform/Partitions.h"
-#include "core/platform/PlatformGestureEvent.h"
-#include "core/platform/PlatformMouseEvent.h"
-#include "core/platform/ScrollAnimator.h"
-#include "core/platform/Scrollbar.h"
-#include "core/platform/ScrollbarTheme.h"
-#include "core/platform/chromium/TraceEvent.h"
-#include "core/platform/graphics/FloatPoint3D.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/filters/ReferenceFilter.h"
 #include "core/platform/graphics/filters/SourceGraphic.h"
@@ -81,9 +70,9 @@
 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h"
 #include "core/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h"
 #include "core/platform/graphics/transforms/ScaleTransformOperation.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
 #include "core/platform/graphics/transforms/TranslateTransformOperation.h"
 #include "core/rendering/ColumnInfo.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/FilterEffectRenderer.h"
 #include "core/rendering/HitTestRequest.h"
 #include "core/rendering/HitTestResult.h"
@@ -91,7 +80,6 @@
 #include "core/rendering/RenderFlowThread.h"
 #include "core/rendering/RenderGeometryMap.h"
 #include "core/rendering/RenderInline.h"
-#include "core/rendering/RenderLayerBacking.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderReplica.h"
 #include "core/rendering/RenderScrollbar.h"
@@ -100,6 +88,11 @@
 #include "core/rendering/RenderView.h"
 #include "core/rendering/svg/ReferenceFilterBuilder.h"
 #include "core/rendering/svg/RenderSVGResourceClipper.h"
+#include "platform/Partitions.h"
+#include "platform/TraceEvent.h"
+#include "platform/geometry/FloatPoint3D.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/TransformationMatrix.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/UnusedParam.h"
 #include "wtf/text/CString.h"
@@ -112,13 +105,8 @@
 
 using namespace HTMLNames;
 
-const int MinimumWidthWhileResizing = 100;
-const int MinimumHeightWhileResizing = 40;
-const int ResizerControlExpandRatioForTouch = 2;
-
 RenderLayer::RenderLayer(RenderLayerModelObject* renderer)
-    : m_inResizeMode(false)
-    , m_normalFlowListDirty(true)
+    : m_normalFlowListDirty(true)
     , m_hasSelfPaintingLayerDescendant(false)
     , m_hasSelfPaintingLayerDescendantDirty(false)
     , m_hasOutOfFlowPositionedDescendant(false)
@@ -134,7 +122,6 @@
     , m_isRootLayer(renderer->isRenderView())
     , m_usedTransparency(false)
     , m_paintingInsideReflection(false)
-    , m_repaintStatus(NeedsNormalRepaint)
     , m_visibleContentStatusDirty(true)
     , m_hasVisibleContent(false)
     , m_visibleDescendantStatusDirty(false)
@@ -158,13 +145,9 @@
     , m_staticInlinePosition(0)
     , m_staticBlockPosition(0)
     , m_reflection(0)
-    , m_resizer(0)
     , m_enclosingPaginationLayer(0)
     , m_forceNeedsCompositedScrolling(DoNotForceCompositedScrolling)
-    // FIXME: We could lazily allocate our ScrollableArea based on style properties
-    // ('overflow', ...) but for now, we are always allocating it as it's safer.
-    , m_scrollableArea(adoptPtr(new RenderLayerScrollableArea(this)))
-
+    , m_repainter(renderer)
 {
     m_isNormalFlowOnly = shouldBeNormalFlowOnly();
     m_isSelfPaintingLayer = shouldBeSelfPaintingLayer();
@@ -178,21 +161,11 @@
         m_hasVisibleContent = renderer->style()->visibility() == VISIBLE;
     }
 
-    updateResizerAreaSet();
+    updateScrollableArea();
 }
 
 RenderLayer::~RenderLayer()
 {
-    if (inResizeMode() && !renderer()->documentBeingDestroyed()) {
-        if (Frame* frame = renderer()->frame())
-            frame->eventHandler()->resizeLayerDestroyed();
-    }
-
-    if (Frame* frame = renderer()->frame()) {
-        if (FrameView* frameView = frame->view())
-            frameView->removeResizerArea(this);
-    }
-
     if (!m_renderer->documentBeingDestroyed())
         compositor()->removeOutOfFlowPositionedLayer(this);
 
@@ -209,10 +182,7 @@
     // Child layers will be deleted by their corresponding render objects, so
     // we don't need to delete them ourselves.
 
-    clearBacking(true);
-
-    if (m_resizer)
-        m_resizer->destroy();
+    clearCompositedLayerMapping(true);
 }
 
 String RenderLayer::debugName() const
@@ -236,8 +206,8 @@
     if ((changeType == CanvasChanged || changeType == VideoChanged || changeType == FullScreenChanged) && compositor()->updateLayerCompositingState(this))
         compositor()->setCompositingLayersNeedRebuild();
 
-    if (m_backing)
-        m_backing->contentChanged(changeType);
+    if (m_compositedLayerMapping)
+        m_compositedLayerMapping->contentChanged(changeType);
 }
 
 bool RenderLayer::canRender3DTransforms() const
@@ -254,7 +224,7 @@
     if (!isComposited())
         return true;
 
-    if (!m_backing || !m_backing->canCompositeFilters())
+    if (!m_compositedLayerMapping || !m_compositedLayerMapping->canCompositeFilters())
         return true;
 
     return false;
@@ -330,35 +300,7 @@
         m_enclosingPaginationLayer = 0;
     }
 
-    if (m_hasVisibleContent) {
-        RenderView* view = renderer()->view();
-        ASSERT(view);
-        // FIXME: LayoutState does not work with RenderLayers as there is not a 1-to-1
-        // mapping between them and the RenderObjects. It would be neat to enable
-        // LayoutState outside the layout() phase and use it here.
-        ASSERT(!view->layoutStateEnabled());
-
-        RenderLayerModelObject* repaintContainer = renderer()->containerForRepaint();
-        LayoutRect oldRepaintRect = m_repaintRect;
-        LayoutRect oldOutlineBox = m_outlineBox;
-        computeRepaintRects(repaintContainer, geometryMap);
-
-        // FIXME: Should ASSERT that value calculated for m_outlineBox using the cached offset is the same
-        // as the value not using the cached offset, but we can't due to https://bugs.webkit.org/show_bug.cgi?id=37048
-        if (flags & CheckForRepaint) {
-            if (view && !view->document().printing()) {
-                if (m_repaintStatus & NeedsFullRepaint) {
-                    renderer()->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldRepaintRect));
-                    if (m_repaintRect != oldRepaintRect)
-                        renderer()->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_repaintRect));
-                } else if (shouldRepaintAfterLayout())
-                    renderer()->repaintAfterLayoutIfNeeded(repaintContainer, oldRepaintRect, oldOutlineBox, &m_repaintRect, &m_outlineBox);
-            }
-        }
-    } else
-        clearRepaintRects();
-
-    m_repaintStatus = NeedsNormalRepaint;
+    repainter().repaintAfterLayout(geometryMap, flags & CheckForRepaint);
 
     // Go ahead and update the reflection's position and size.
     if (m_reflection)
@@ -381,31 +323,18 @@
         child->updateLayerPositions(geometryMap, flags);
 
     if ((flags & UpdateCompositingLayers) && isComposited()) {
-        RenderLayerBacking::UpdateAfterLayoutFlags updateFlags = RenderLayerBacking::CompositingChildrenOnly;
+        CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedLayerMapping::CompositingChildrenOnly;
         if (flags & NeedsFullRepaintInBacking)
-            updateFlags |= RenderLayerBacking::NeedsFullRepaint;
+            updateFlags |= CompositedLayerMapping::NeedsFullRepaint;
         if (isUpdateRoot)
-            updateFlags |= RenderLayerBacking::IsUpdateRoot;
-        backing()->updateAfterLayout(updateFlags);
+            updateFlags |= CompositedLayerMapping::IsUpdateRoot;
+        compositedLayerMapping()->updateAfterLayout(updateFlags);
     }
 
     if (geometryMap)
         geometryMap->popMappingsToAncestor(parent());
 }
 
-LayoutRect RenderLayer::repaintRectIncludingNonCompositingDescendants() const
-{
-    LayoutRect repaintRect = m_repaintRect;
-    for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
-        // Don't include repaint rects for composited child layers; they will paint themselves and have a different origin.
-        if (child->isComposited())
-            continue;
-
-        repaintRect.unite(child->repaintRectIncludingNonCompositingDescendants());
-    }
-    return repaintRect;
-}
-
 void RenderLayer::setAncestorChainHasSelfPaintingLayerDescendant()
 {
     for (RenderLayer* layer = this; layer; layer = layer->parent()) {
@@ -702,35 +631,6 @@
     return true;
 }
 
-void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* geometryMap)
-{
-    ASSERT(!m_visibleContentStatusDirty);
-
-    m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer);
-    m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometryMap);
-}
-
-
-void RenderLayer::computeRepaintRectsIncludingDescendants()
-{
-    // FIXME: computeRepaintRects() has to walk up the parent chain for every layer to compute the rects.
-    // We should make this more efficient.
-    // FIXME: it's wrong to call this when layout is not up-to-date, which we do.
-    computeRepaintRects(renderer()->containerForRepaint());
-
-    for (RenderLayer* layer = firstChild(); layer; layer = layer->nextSibling())
-        layer->computeRepaintRectsIncludingDescendants();
-}
-
-void RenderLayer::clearRepaintRects()
-{
-    ASSERT(!m_hasVisibleContent);
-    ASSERT(!m_visibleContentStatusDirty);
-
-    m_repaintRect = IntRect();
-    m_outlineBox = IntRect();
-}
-
 void RenderLayer::updateLayerPositionsAfterDocumentScroll()
 {
     ASSERT(this == renderer()->view()->layer());
@@ -782,12 +682,12 @@
     if (flags & HasSeenViewportConstrainedAncestor
         || (flags & IsOverflowScroll && flags & HasSeenAncestorWithOverflowClip && !m_canSkipRepaintRectsUpdateOnScroll)) {
         // FIXME: We could track the repaint container as we walk down the tree.
-        computeRepaintRects(renderer()->containerForRepaint(), geometryMap);
+        repainter().computeRepaintRects(renderer()->containerForRepaint(), geometryMap);
     } else {
-        // Check that our cached rects are correct.
+        // Check that RenderLayerRepainter's cached rects are correct.
         // FIXME: re-enable these assertions when the issue with table cells is resolved: https://bugs.webkit.org/show_bug.cgi?id=103432
-        // ASSERT(m_repaintRect == renderer()->clippedOverflowRectForRepaint(renderer()->containerForRepaint()));
-        // ASSERT(m_outlineBox == renderer()->outlineBoundsForRepaint(renderer()->containerForRepaint(), geometryMap));
+        // ASSERT(repainter().m_repaintRect == renderer()->clippedOverflowRectForRepaint(renderer()->containerForRepaint()));
+        // ASSERT(repainter().m_outlineBox == renderer()->outlineBoundsForRepaint(renderer()->containerForRepaint(), geometryMap));
     }
 
     for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
@@ -803,7 +703,7 @@
 
 void RenderLayer::positionNewlyCreatedOverflowControls()
 {
-    if (!backing()->hasUnpositionedOverflowControlsLayers())
+    if (!compositedLayerMapping()->hasUnpositionedOverflowControlsLayers())
         return;
 
     RenderGeometryMap geometryMap(UseTransforms);
@@ -828,8 +728,8 @@
     BlendMode newBlendMode = renderer()->style()->blendMode();
     if (newBlendMode != m_blendMode) {
         m_blendMode = newBlendMode;
-        if (backing())
-            backing()->setBlendMode(newBlendMode);
+        if (compositedLayerMapping())
+            compositedLayerMapping()->setBlendMode(newBlendMode);
     }
 }
 
@@ -1016,7 +916,7 @@
 
     m_visibleContentStatusDirty = false;
     m_hasVisibleContent = true;
-    computeRepaintRects(renderer()->containerForRepaint());
+    repainter().computeRepaintRects(renderer()->containerForRepaint());
     if (!isNormalFlowOnly()) {
         // We don't collect invisible layers in z-order lists if we are not in compositing mode.
         // As we became visible, we need to dirty our stacking containers ancestors to be properly
@@ -1355,50 +1255,12 @@
 
 RenderLayer* RenderLayer::enclosingScrollableLayer() const
 {
-    for (RenderLayer* nextLayer = parent(); nextLayer; nextLayer = nextLayer->parent()) {
-        if (nextLayer->renderer()->isBox() && toRenderBox(nextLayer->renderer())->canBeScrolledAndHasScrollableArea())
-            return nextLayer;
-    }
+    if (RenderBox* enclosingScrollableBox = renderer()->enclosingScrollableBox())
+        return enclosingScrollableBox->layer();
 
     return 0;
 }
 
-IntRect RenderLayer::scrollableAreaBoundingBox() const
-{
-    return renderer()->absoluteBoundingBoxRect();
-}
-
-bool RenderLayer::userInputScrollable(ScrollbarOrientation orientation) const
-{
-    RenderBox* box = renderBox();
-    ASSERT(box);
-
-    if (box->isIntristicallyScrollable(orientation))
-        return true;
-
-    EOverflow overflowStyle = (orientation == HorizontalScrollbar) ?
-        renderer()->style()->overflowX() : renderer()->style()->overflowY();
-    return (overflowStyle == OSCROLL || overflowStyle == OAUTO || overflowStyle == OOVERLAY);
-}
-
-bool RenderLayer::shouldPlaceVerticalScrollbarOnLeft() const
-{
-    return renderer()->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft();
-}
-
-int RenderLayer::pageStep(ScrollbarOrientation orientation) const
-{
-    RenderBox* box = renderBox();
-    ASSERT(box);
-
-    int length = (orientation == HorizontalScrollbar) ?
-        box->pixelSnappedClientWidth() : box->pixelSnappedClientHeight();
-    int minPageStep = static_cast<float>(length) * ScrollableArea::minFractionToStepWhenPaging();
-    int pageStep = max(minPageStep, length - ScrollableArea::maxOverlapBetweenPages());
-
-    return max(pageStep, 1);
-}
-
 RenderLayer* RenderLayer::enclosingTransformedAncestor() const
 {
     RenderLayer* curr = parent();
@@ -1413,17 +1275,6 @@
     return layer->isNormalFlowOnly() ? layer->parent() : layer->ancestorStackingContainer();
 }
 
-inline bool RenderLayer::shouldRepaintAfterLayout() const
-{
-    if (m_repaintStatus == NeedsNormalRepaint)
-        return true;
-
-    // Composited layers that were moved during a positioned movement only
-    // layout, don't need to be repainted. They just need to be recomposited.
-    ASSERT(m_repaintStatus == NeedsFullRepaintForPositionedMovementLayout);
-    return !isComposited();
-}
-
 RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const
 {
     if (includeSelf && isComposited())
@@ -1439,11 +1290,11 @@
 
 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const
 {
-    if (includeSelf && isComposited() && !backing()->paintsIntoCompositedAncestor())
+    if (includeSelf && isComposited() && !compositedLayerMapping()->paintsIntoCompositedAncestor())
         return const_cast<RenderLayer*>(this);
 
     for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) {
-        if (curr->isComposited() && !curr->backing()->paintsIntoCompositedAncestor())
+        if (curr->isComposited() && !curr->compositedLayerMapping()->paintsIntoCompositedAncestor())
             return const_cast<RenderLayer*>(curr);
     }
 
@@ -1554,7 +1405,7 @@
         current = compositingContainer(current);
         ASSERT(current);
         if (current->transform()
-            || (current->isComposited() && !current->backing()->paintsIntoCompositedAncestor())
+            || (current->isComposited() && !current->compositedLayerMapping()->paintsIntoCompositedAncestor())
         )
             return const_cast<RenderLayer*>(current);
     }
@@ -1563,12 +1414,6 @@
     return 0;
 }
 
-LayoutPoint RenderLayer::absoluteToContents(const LayoutPoint& absolutePoint) const
-{
-    // We don't use convertToLayerCoords because it doesn't know about transforms
-    return roundedLayoutPoint(renderer()->absoluteToLocal(absolutePoint, UseTransforms));
-}
-
 bool RenderLayer::cannotBlitToWindow() const
 {
     if (isTransparent() || hasReflection() || hasTransform())
@@ -1851,7 +1696,7 @@
         RenderLayer* next = current->nextSibling();
         removeChild(current);
         m_parent->addChild(current, nextSib);
-        current->setRepaintStatus(NeedsFullRepaint);
+        current->repainter().setRepaintStatus(NeedsFullRepaint);
         // updateLayerPositions depends on hasLayer() already being false for proper layout.
         ASSERT(!renderer()->hasLayer());
         current->updateLayerPositions(0); // FIXME: use geometry map.
@@ -2032,7 +1877,7 @@
     if (box && (box->isIntristicallyScrollable(VerticalScrollbar) || box->isIntristicallyScrollable(HorizontalScrollbar)))
         return false;
 
-    return isComposited() && backing()->scrollingLayer();
+    return isComposited() && compositedLayerMapping()->scrollingLayer();
 }
 
 bool RenderLayer::needsCompositedScrolling() const
@@ -2299,12 +2144,6 @@
     RenderLayer* parentLayer = 0;
     LayoutRect newRect = rect;
 
-    // We may end up propagating a scroll event. It is important that we suspend events until
-    // the end of the function since they could delete the layer or the layer's renderer().
-    FrameView* frameView = renderer()->document().view();
-    if (frameView)
-        frameView->pauseScheduledEvents();
-
     bool restrictedByLineClamp = false;
     if (renderer()->parent()) {
         parentLayer = renderer()->parent()->enclosingLayer();
@@ -2329,7 +2168,7 @@
             newRect = LayoutRect(box->localToAbsoluteQuad(FloatQuad(FloatRect(localExposeRect)), UseTransforms).boundingBox());
         }
     } else if (!parentLayer && renderer()->isBox() && renderBox()->canBeProgramaticallyScrolled()) {
-        if (frameView) {
+        if (FrameView* frameView = renderer()->frameView()) {
             Element* ownerElement = renderer()->document().ownerElement();
 
             if (ownerElement && ownerElement->renderer()) {
@@ -2371,9 +2210,6 @@
 
     if (parentLayer)
         parentLayer->scrollRectToVisible(newRect, alignX, alignY);
-
-    if (frameView)
-        frameView->resumeScheduledEvents();
 }
 
 void RenderLayer::updateCompositingLayersAfterScroll()
@@ -2390,6 +2226,14 @@
     }
 }
 
+void RenderLayer::updateScrollableArea()
+{
+    if (requiresScrollableArea())
+        m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(renderBox()));
+    else
+        m_scrollableArea = nullptr;
+}
+
 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const LayoutRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)
 {
     // Determine the appropriate X behavior.
@@ -2489,287 +2333,27 @@
 
 void RenderLayer::resize(const PlatformEvent& evt, const LayoutSize& oldOffset)
 {
-    // FIXME: This should be possible on generated content but is not right now.
-    if (!inResizeMode() || !renderer()->canResize() || !renderer()->node())
-        return;
-
-    ASSERT(renderer()->node()->isElementNode());
-    Element* element = toElement(renderer()->node());
-    RenderBox* renderer = toRenderBox(element->renderer());
-
-    Document& document = element->document();
-
-    IntPoint pos;
-    const PlatformGestureEvent* gevt = 0;
-
-    switch (evt.type()) {
-    case PlatformEvent::MouseMoved:
-        if (!document.frame()->eventHandler()->mousePressed())
-            return;
-        pos = static_cast<const PlatformMouseEvent*>(&evt)->position();
-        break;
-    case PlatformEvent::GestureScrollUpdate:
-    case PlatformEvent::GestureScrollUpdateWithoutPropagation:
-        pos = static_cast<const PlatformGestureEvent*>(&evt)->position();
-        gevt = static_cast<const PlatformGestureEvent*>(&evt);
-        pos = gevt->position();
-        pos.move(gevt->deltaX(), gevt->deltaY());
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-
-    float zoomFactor = renderer->style()->effectiveZoom();
-
-    LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToContents(pos));
-    newOffset.setWidth(newOffset.width() / zoomFactor);
-    newOffset.setHeight(newOffset.height() / zoomFactor);
-
-    LayoutSize currentSize = LayoutSize(renderer->width() / zoomFactor, renderer->height() / zoomFactor);
-    LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
-    element->setMinimumSizeForResizing(minimumSize);
-
-    LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
-    if (renderer->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
-        newOffset.setWidth(-newOffset.width());
-        adjustedOldOffset.setWidth(-adjustedOldOffset.width());
-    }
-
-    LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;
-
-    bool isBoxSizingBorder = renderer->style()->boxSizing() == BORDER_BOX;
-
-    EResize resize = renderer->style()->resize();
-    if (resize != RESIZE_VERTICAL && difference.width()) {
-        if (element->isFormControlElement()) {
-            // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>).
-            element->setInlineStyleProperty(CSSPropertyMarginLeft, renderer->marginLeft() / zoomFactor, CSSPrimitiveValue::CSS_PX);
-            element->setInlineStyleProperty(CSSPropertyMarginRight, renderer->marginRight() / zoomFactor, CSSPrimitiveValue::CSS_PX);
-        }
-        LayoutUnit baseWidth = renderer->width() - (isBoxSizingBorder ? LayoutUnit() : renderer->borderAndPaddingWidth());
-        baseWidth = baseWidth / zoomFactor;
-        element->setInlineStyleProperty(CSSPropertyWidth, roundToInt(baseWidth + difference.width()), CSSPrimitiveValue::CSS_PX);
-    }
-
-    if (resize != RESIZE_HORIZONTAL && difference.height()) {
-        if (element->isFormControlElement()) {
-            // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>).
-            element->setInlineStyleProperty(CSSPropertyMarginTop, renderer->marginTop() / zoomFactor, CSSPrimitiveValue::CSS_PX);
-            element->setInlineStyleProperty(CSSPropertyMarginBottom, renderer->marginBottom() / zoomFactor, CSSPrimitiveValue::CSS_PX);
-        }
-        LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? LayoutUnit() : renderer->borderAndPaddingHeight());
-        baseHeight = baseHeight / zoomFactor;
-        element->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight + difference.height()), CSSPrimitiveValue::CSS_PX);
-    }
-
-    document.updateLayout();
-
-    // FIXME (Radar 4118564): We should also autoscroll the window as necessary to keep the point under the cursor in view.
+    m_scrollableArea->resize(evt, oldOffset);
 }
 
-int RenderLayer::scrollSize(ScrollbarOrientation orientation) const
+bool RenderLayer::inResizeMode() const
 {
-    IntSize scrollDimensions = scrollableArea()->maximumScrollPosition() - scrollableArea()->minimumScrollPosition();
-    return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scrollDimensions.height();
+    return m_scrollableArea->inResizeMode();
 }
 
-IntSize RenderLayer::overhangAmount() const
+void RenderLayer::setInResizeMode(bool inResizeMode)
 {
-    return IntSize();
-}
-
-bool RenderLayer::isActive() const
-{
-    Page* page = renderer()->frame()->page();
-    return page && page->focusController().isActive();
-}
-
-static int cornerStart(const RenderStyle* style, int minX, int maxX, int thickness)
-{
-    if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
-        return minX + style->borderLeftWidth();
-    return maxX - thickness - style->borderRightWidth();
-}
-
-static IntRect cornerRect(const RenderStyle* style, const Scrollbar* horizontalScrollbar, const Scrollbar* verticalScrollbar, const IntRect& bounds)
-{
-    int horizontalThickness;
-    int verticalThickness;
-    if (!verticalScrollbar && !horizontalScrollbar) {
-        // FIXME: This isn't right.  We need to know the thickness of custom scrollbars
-        // even when they don't exist in order to set the resizer square size properly.
-        horizontalThickness = ScrollbarTheme::theme()->scrollbarThickness();
-        verticalThickness = horizontalThickness;
-    } else if (verticalScrollbar && !horizontalScrollbar) {
-        horizontalThickness = verticalScrollbar->width();
-        verticalThickness = horizontalThickness;
-    } else if (horizontalScrollbar && !verticalScrollbar) {
-        verticalThickness = horizontalScrollbar->height();
-        horizontalThickness = verticalThickness;
-    } else {
-        horizontalThickness = verticalScrollbar->width();
-        verticalThickness = horizontalScrollbar->height();
-    }
-    return IntRect(cornerStart(style, bounds.x(), bounds.maxX(), horizontalThickness),
-                   bounds.maxY() - verticalThickness - style->borderBottomWidth(),
-                   horizontalThickness, verticalThickness);
-}
-
-IntRect RenderLayer::scrollCornerRect() const
-{
-    // We have a scrollbar corner when a scrollbar is visible and not filling the entire length of the box.
-    // This happens when:
-    // (a) A resizer is present and at least one scrollbar is present
-    // (b) Both scrollbars are present.
-    bool hasHorizontalBar = horizontalScrollbar();
-    bool hasVerticalBar = verticalScrollbar();
-    bool hasResizer = renderer()->style()->resize() != RESIZE_NONE;
-    if ((hasHorizontalBar && hasVerticalBar) || (hasResizer && (hasHorizontalBar || hasVerticalBar)))
-        return cornerRect(renderer()->style(), horizontalScrollbar(), verticalScrollbar(), renderBox()->pixelSnappedBorderBoxRect());
-    return IntRect();
-}
-
-IntRect RenderLayer::resizerCornerRect(const IntRect& bounds, ResizerHitTestType resizerHitTestType) const
-{
-    ASSERT(renderer()->isBox());
-    if (renderer()->style()->resize() == RESIZE_NONE)
-        return IntRect();
-    IntRect corner = cornerRect(renderer()->style(), horizontalScrollbar(), verticalScrollbar(), bounds);
-
-    if (resizerHitTestType == ResizerForTouch) {
-        // We make the resizer virtually larger for touch hit testing. With the
-        // expanding ratio k = ResizerControlExpandRatioForTouch, we first move
-        // the resizer rect (of width w & height h), by (-w * (k-1), -h * (k-1)),
-        // then expand the rect by new_w/h = w/h * k.
-        int expand_ratio = ResizerControlExpandRatioForTouch - 1;
-        corner.move(-corner.width() * expand_ratio, -corner.height() * expand_ratio);
-        corner.expand(corner.width() * expand_ratio, corner.height() * expand_ratio);
-    }
-
-    return corner;
-}
-
-IntRect RenderLayer::scrollCornerAndResizerRect() const
-{
-    RenderBox* box = renderBox();
-    if (!box)
-        return IntRect();
-    IntRect scrollCornerAndResizer = scrollCornerRect();
-    if (scrollCornerAndResizer.isEmpty())
-        scrollCornerAndResizer = resizerCornerRect(box->pixelSnappedBorderBoxRect(), ResizerForPointer);
-    return scrollCornerAndResizer;
-}
-
-bool RenderLayer::isScrollCornerVisible() const
-{
-    ASSERT(renderer()->isBox());
-    return !scrollCornerRect().isEmpty();
-}
-
-int RenderLayer::visibleHeight() const
-{
-    return m_layerSize.height();
-}
-
-int RenderLayer::visibleWidth() const
-{
-    return m_layerSize.width();
-}
-
-bool RenderLayer::shouldSuspendScrollAnimations() const
-{
-    RenderView* view = renderer()->view();
-    if (!view)
-        return true;
-    return view->frameView()->shouldSuspendScrollAnimations();
-}
-
-bool RenderLayer::scrollbarsCanBeActive() const
-{
-    RenderView* view = renderer()->view();
-    if (!view)
-        return false;
-    return view->frameView()->scrollbarsCanBeActive();
-}
-
-IntPoint RenderLayer::lastKnownMousePosition() const
-{
-    return renderer()->frame() ? renderer()->frame()->eventHandler()->lastKnownMousePosition() : IntPoint();
-}
-
-void RenderLayer::invalidateScrollCornerRect(const IntRect& rect)
-{
-    if (m_resizer)
-        m_resizer->repaintRectangle(rect);
-}
-
-// FIXME: This function is temporarily duplicated in RenderLayerScrollableArea.
-static inline RenderObject* rendererForScrollbar(RenderObject* renderer)
-{
-    if (Node* node = renderer->node()) {
-        if (ShadowRoot* shadowRoot = node->containingShadowRoot()) {
-            if (shadowRoot->type() == ShadowRoot::UserAgentShadowRoot)
-                return shadowRoot->host()->renderer();
-        }
-    }
-
-    return renderer;
-}
-
-ScrollableArea* RenderLayer::enclosingScrollableArea() const
-{
-    if (RenderLayer* scrollableLayer = enclosingScrollableLayer())
-        return scrollableLayer->scrollableArea();
-
-    // FIXME: We should return the frame view here (or possibly an ancestor frame view,
-    // if the frame view isn't scrollable.
-    return 0;
+    return m_scrollableArea->setInResizeMode(inResizeMode);
 }
 
 IntSize RenderLayer::offsetFromResizeCorner(const IntPoint& absolutePoint) const
 {
-    // Currently the resize corner is either the bottom right corner or the bottom left corner.
-    // FIXME: This assumes the location is 0, 0. Is this guaranteed to always be the case?
-    IntSize elementSize = size();
-    if (renderer()->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
-        elementSize.setWidth(0);
-    IntPoint resizerPoint = IntPoint(elementSize);
-    IntPoint localPoint = roundedIntPoint(absoluteToContents(absolutePoint));
-    return localPoint - resizerPoint;
+    return m_scrollableArea->offsetFromResizeCorner(absolutePoint);
 }
 
 bool RenderLayer::hasOverflowControls() const
 {
-    return m_scrollableArea->hasScrollbar() || m_scrollableArea->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE;
-}
-
-void RenderLayer::positionOverflowControls(const IntSize& offsetFromRoot)
-{
-    if (!m_scrollableArea->hasScrollbar() && !renderer()->canResize())
-        return;
-
-    RenderBox* box = renderBox();
-    if (!box)
-        return;
-
-    m_scrollableArea->positionOverflowControls(offsetFromRoot);
-
-    const IntRect borderBox = box->pixelSnappedBorderBoxRect();
-    if (m_resizer)
-        m_resizer->setFrameRect(resizerCornerRect(borderBox, ResizerForPointer));
-
-    if (isComposited())
-        backing()->positionOverflowControlsLayers(offsetFromRoot);
-}
-
-int RenderLayer::scrollWidth() const
-{
-    return m_scrollableArea->scrollWidth();
-}
-
-int RenderLayer::scrollHeight() const
-{
-    return m_scrollableArea->scrollHeight();
+    return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollableArea->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE);
 }
 
 void RenderLayer::updateScrollInfoAfterLayout()
@@ -2785,154 +2369,6 @@
         compositor()->setCompositingLayersNeedRebuild();
 }
 
-bool RenderLayer::overflowControlsIntersectRect(const IntRect& localRect) const
-{
-    const IntRect borderBox = renderBox()->pixelSnappedBorderBoxRect();
-
-    if (m_scrollableArea->rectForHorizontalScrollbar(borderBox).intersects(localRect))
-        return true;
-
-    if (m_scrollableArea->rectForVerticalScrollbar(borderBox).intersects(localRect))
-        return true;
-
-    if (scrollCornerRect().intersects(localRect))
-        return true;
-
-    if (resizerCornerRect(borderBox, ResizerForPointer).intersects(localRect))
-        return true;
-
-    return false;
-}
-
-void RenderLayer::paintOverflowControls(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls)
-{
-    // Don't do anything if we have no overflow.
-    if (!renderer()->hasOverflowClip())
-        return;
-
-    IntPoint adjustedPaintOffset = paintOffset;
-    if (paintingOverlayControls)
-        adjustedPaintOffset = m_cachedOverlayScrollbarOffset;
-
-    // Move the scrollbar widgets if necessary.  We normally move and resize widgets during layout, but sometimes
-    // widgets can move without layout occurring (most notably when you scroll a document that
-    // contains fixed positioned elements).
-    positionOverflowControls(toIntSize(adjustedPaintOffset));
-
-    m_scrollableArea->paintOverflowControls(context, paintOffset, damageRect, paintingOverlayControls);
-
-    if (layerForScrollCorner())
-        return;
-
-    // Paint our resizer last, since it sits on top of the scroll corner.
-    paintResizer(context, adjustedPaintOffset, damageRect);
-}
-
-void RenderLayer::paintScrollCorner(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect)
-{
-    m_scrollableArea->paintScrollCorner(context, paintOffset, damageRect);
-}
-
-void RenderLayer::drawPlatformResizerImage(GraphicsContext* context, IntRect resizerCornerRect)
-{
-    float deviceScaleFactor = WebCore::deviceScaleFactor(renderer()->frame());
-
-    RefPtr<Image> resizeCornerImage;
-    IntSize cornerResizerSize;
-    if (deviceScaleFactor >= 2) {
-        DEFINE_STATIC_LOCAL(Image*, resizeCornerImageHiRes, (Image::loadPlatformResource("textAreaResizeCorner@2x").leakRef()));
-        resizeCornerImage = resizeCornerImageHiRes;
-        cornerResizerSize = resizeCornerImage->size();
-        cornerResizerSize.scale(0.5f);
-    } else {
-        DEFINE_STATIC_LOCAL(Image*, resizeCornerImageLoRes, (Image::loadPlatformResource("textAreaResizeCorner").leakRef()));
-        resizeCornerImage = resizeCornerImageLoRes;
-        cornerResizerSize = resizeCornerImage->size();
-    }
-
-    if (renderer()->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
-        context->save();
-        context->translate(resizerCornerRect.x() + cornerResizerSize.width(), resizerCornerRect.y() + resizerCornerRect.height() - cornerResizerSize.height());
-        context->scale(FloatSize(-1.0, 1.0));
-        context->drawImage(resizeCornerImage.get(), IntRect(IntPoint(), cornerResizerSize));
-        context->restore();
-        return;
-    }
-    IntRect imageRect(resizerCornerRect.maxXMaxYCorner() - cornerResizerSize, cornerResizerSize);
-    context->drawImage(resizeCornerImage.get(), imageRect);
-}
-
-void RenderLayer::paintResizer(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect)
-{
-    if (renderer()->style()->resize() == RESIZE_NONE)
-        return;
-
-    RenderBox* box = renderBox();
-    ASSERT(box);
-
-    IntRect absRect = resizerCornerRect(box->pixelSnappedBorderBoxRect(), ResizerForPointer);
-    absRect.moveBy(paintOffset);
-    if (!absRect.intersects(damageRect))
-        return;
-
-    if (context->updatingControlTints()) {
-        updateResizerStyle();
-        return;
-    }
-
-    if (m_resizer) {
-        m_resizer->paintIntoRect(context, paintOffset, absRect);
-        return;
-    }
-
-    drawPlatformResizerImage(context, absRect);
-
-    // Draw a frame around the resizer (1px grey line) if there are any scrollbars present.
-    // Clipping will exclude the right and bottom edges of this frame.
-    if (!hasOverlayScrollbars() && m_scrollableArea->hasScrollbar()) {
-        GraphicsContextStateSaver stateSaver(*context);
-        context->clip(absRect);
-        IntRect largerCorner = absRect;
-        largerCorner.setSize(IntSize(largerCorner.width() + 1, largerCorner.height() + 1));
-        context->setStrokeColor(Color(217, 217, 217));
-        context->setStrokeThickness(1.0f);
-        context->setFillColor(Color::transparent);
-        context->drawRect(largerCorner);
-    }
-}
-
-bool RenderLayer::isPointInResizeControl(const IntPoint& absolutePoint,
-                                         ResizerHitTestType resizerHitTestType) const
-{
-    if (!renderer()->canResize())
-        return false;
-
-    RenderBox* box = renderBox();
-    ASSERT(box);
-
-    IntPoint localPoint = roundedIntPoint(absoluteToContents(absolutePoint));
-    IntRect localBounds (0, 0, box->pixelSnappedWidth(), box->pixelSnappedHeight());
-    return resizerCornerRect(localBounds, resizerHitTestType).contains(localPoint);
-}
-
-bool RenderLayer::hitTestOverflowControls(HitTestResult& result, const IntPoint& localPoint)
-{
-    if (!m_scrollableArea->hasScrollbar() && !renderer()->canResize())
-        return false;
-
-    RenderBox* box = renderBox();
-    ASSERT(box);
-
-    IntRect resizeControlRect;
-    if (renderer()->style()->resize() != RESIZE_NONE) {
-        resizeControlRect = resizerCornerRect(box->pixelSnappedBorderBoxRect(), ResizerForPointer);
-        if (resizeControlRect.contains(localPoint))
-            return true;
-    }
-
-    return m_scrollableArea->hitTestOverflowControls(result, localPoint, resizeControlRect);
-}
-
 bool RenderLayer::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
 {
     if (ScrollableArea* scrollableArea = this->scrollableArea())
@@ -3055,10 +2491,10 @@
         // but we need to ensure that we don't cache clip rects computed with the wrong root in this case.
         if (context->updatingControlTints() || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers)) {
             paintFlags |= PaintLayerTemporaryClipRects;
-        } else if (!backing()->paintsIntoCompositedAncestor()
+        } else if (!compositedLayerMapping()->paintsIntoCompositedAncestor()
             && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingReflection)
             && !paintForFixedRootBackground(this, paintFlags)) {
-            // If this RenderLayer should paint into its backing, that will be done via RenderLayerBacking::paintIntoLayer().
+            // If this RenderLayer should paint into its own backing, that will be done via CompositedLayerMapping::paintIntoLayer().
             return;
         }
     } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBoundsOutOfView) {
@@ -3188,6 +2624,7 @@
     bool hasClipPath = false;
     RenderStyle* style = renderer()->style();
     RenderSVGResourceClipper* resourceClipper = 0;
+    ClipperContext clipperContext;
     if (renderer()->hasClipPath() && !context->paintingDisabled() && style) {
         ASSERT(style->clipPath());
         if (style->clipPath()->getOperationType() == ClipPathOperation::SHAPE) {
@@ -3213,7 +2650,8 @@
                 }
 
                 resourceClipper = toRenderSVGResourceClipper(element->renderer()->toRenderSVGResourceContainer());
-                if (!resourceClipper->applyClippingToContext(renderer(), rootRelativeBounds, paintingInfo.paintDirtyRect, context)) {
+                if (!resourceClipper->applyClippingToContext(renderer(), rootRelativeBounds,
+                    paintingInfo.paintDirtyRect, context, clipperContext)) {
                     // No need to post-apply the clipper if this failed.
                     resourceClipper = 0;
                 }
@@ -3349,7 +2787,7 @@
     }
 
     if (resourceClipper)
-        resourceClipper->postApplyResource(renderer(), context, ApplyToDefaultMode, 0, 0);
+        resourceClipper->postApplyStatefulResource(renderer(), context, clipperContext);
 
     if (hasClipPath)
         context->restore();
@@ -4048,7 +3486,7 @@
     LayerFragments layerFragments;
     collectFragments(layerFragments, rootLayer, hitTestLocation.region(), hitTestRect, RootRelativeClipRects, IncludeOverlayScrollbarSize);
 
-    if (renderer()->canResize() && hitTestResizerInFragments(layerFragments, hitTestLocation)) {
+    if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFragments, hitTestLocation)) {
         renderer()->updateHitTestResult(result, hitTestLocation.point());
         return this;
     }
@@ -4123,20 +3561,6 @@
     return false;
 }
 
-bool RenderLayer::hitTestResizerInFragments(const LayerFragments& layerFragments, const HitTestLocation& hitTestLocation) const
-{
-    if (layerFragments.isEmpty())
-        return false;
-
-    for (int i = layerFragments.size() - 1; i >= 0; --i) {
-        const LayerFragment& fragment = layerFragments.at(i);
-        if (fragment.backgroundRect.intersects(hitTestLocation) && resizerCornerRect(pixelSnappedIntRect(fragment.layerBounds), ResizerForPointer).contains(hitTestLocation.roundedPoint()))
-            return true;
-    }
-
-    return false;
-}
-
 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
     const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset)
 {
@@ -4953,25 +4377,25 @@
     }
 }
 
-RenderLayerBacking* RenderLayer::ensureBacking()
+CompositedLayerMapping* RenderLayer::ensureCompositedLayerMapping()
 {
-    if (!m_backing) {
-        m_backing = adoptPtr(new RenderLayerBacking(this));
+    if (!m_compositedLayerMapping) {
+        m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(this));
         compositor()->layerBecameComposited(this);
 
         updateOrRemoveFilterEffectRenderer();
 
         if (RuntimeEnabledFeatures::cssCompositingEnabled())
-            backing()->setBlendMode(m_blendMode);
+            compositedLayerMapping()->setBlendMode(m_blendMode);
     }
-    return m_backing.get();
+    return m_compositedLayerMapping.get();
 }
 
-void RenderLayer::clearBacking(bool layerBeingDestroyed)
+void RenderLayer::clearCompositedLayerMapping(bool layerBeingDestroyed)
 {
-    if (m_backing && !renderer()->documentBeingDestroyed())
+    if (m_compositedLayerMapping && !renderer()->documentBeingDestroyed())
         compositor()->layerBecameNonComposited(this);
-    m_backing.clear();
+    m_compositedLayerMapping.clear();
 
     if (!layerBeingDestroyed)
         updateOrRemoveFilterEffectRenderer();
@@ -4979,37 +4403,12 @@
 
 bool RenderLayer::hasCompositedMask() const
 {
-    return m_backing && m_backing->hasMaskLayer();
+    return m_compositedLayerMapping && m_compositedLayerMapping->hasMaskLayer();
 }
 
 bool RenderLayer::hasCompositedClippingMask() const
 {
-    return m_backing && m_backing->hasChildClippingMaskLayer();
-}
-
-GraphicsLayer* RenderLayer::layerForScrolling() const
-{
-    return m_backing ? m_backing->scrollingContentsLayer() : 0;
-}
-
-GraphicsLayer* RenderLayer::layerForScrollChild() const
-{
-    return m_backing ? m_backing->childForSuperlayers() : 0;
-}
-
-GraphicsLayer* RenderLayer::layerForHorizontalScrollbar() const
-{
-    return m_backing ? m_backing->layerForHorizontalScrollbar() : 0;
-}
-
-GraphicsLayer* RenderLayer::layerForVerticalScrollbar() const
-{
-    return m_backing ? m_backing->layerForVerticalScrollbar() : 0;
-}
-
-GraphicsLayer* RenderLayer::layerForScrollCorner() const
-{
-    return m_backing ? m_backing->layerForScrollCorner() : 0;
+    return m_compositedLayerMapping && m_compositedLayerMapping->hasChildClippingMaskLayer();
 }
 
 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const
@@ -5220,6 +4619,9 @@
             Element* childElement = (child->node() && child->node()->isElementNode()) ? toElement(child->node()) : 0;
             if (childElement && childElement->isInTopLayer()) {
                 RenderLayer* layer = toRenderLayerModelObject(child)->layer();
+                // Create the buffer if it doesn't exist yet.
+                if (!posZOrderList)
+                    posZOrderList = adoptPtr(new Vector<RenderLayer*>);
                 posZOrderList->append(layer);
             }
         }
@@ -5323,7 +4725,7 @@
 void RenderLayer::setBackingNeedsRepaint()
 {
     ASSERT(isComposited());
-    backing()->setContentsNeedDisplay();
+    compositedLayerMapping()->setContentsNeedDisplay();
 }
 
 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r)
@@ -5342,18 +4744,8 @@
         RenderView* view = renderer()->view();
         if (view)
             view->repaintViewRectangle(absRect);
-    } else
-        backing()->setContentsNeedDisplayInRect(pixelSnappedIntRect(r));
-}
-
-// Since we're only painting non-composited layers, we know that they all share the same repaintContainer.
-void RenderLayer::repaintIncludingNonCompositingDescendants(RenderLayerModelObject* repaintContainer)
-{
-    renderer()->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(renderer()->clippedOverflowRectForRepaint(repaintContainer)));
-
-    for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) {
-        if (!curr->isComposited())
-            curr->repaintIncludingNonCompositingDescendants(repaintContainer);
+    } else {
+        compositedLayerMapping()->setContentsNeedDisplayInRect(pixelSnappedIntRect(r));
     }
 }
 
@@ -5377,7 +4769,8 @@
         || renderer()->hasClipPath()
         || renderer()->hasFilter()
         || renderer()->hasBlendMode()
-        || isTransparent();
+        || isTransparent()
+        || renderer()->isRenderRegion();
 
     return couldBeNormalFlow && !preventsElementFromBeingNormalFlow;
 }
@@ -5604,7 +4997,7 @@
     // However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation.
     bool shouldUpdateFilters = isComposited() && !renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter);
     if (shouldUpdateFilters)
-        backing()->updateFilters(renderer()->style());
+        compositedLayerMapping()->updateFilters(renderer()->style());
     updateOrRemoveFilterEffectRenderer();
 }
 
@@ -5612,8 +5005,8 @@
 {
     updateIsNormalFlowOnly();
 
-    updateResizerAreaSet();
-    m_scrollableArea->updateAfterStyleChange(oldStyle);
+    if (m_scrollableArea)
+        m_scrollableArea->updateAfterStyleChange(oldStyle);
     updateStackingContextsAfterStyleChange(oldStyle);
     updateVisibilityAfterStyleChange(oldStyle);
     // Overlay scrollbars can make this layer self-painting so we need
@@ -5626,12 +5019,10 @@
     else if (hasReflection()) {
         if (!m_reflection)
             createReflection();
-        UseCounter::count(&renderer()->document(), UseCounter::Reflection);
+        UseCounter::count(renderer()->document(), UseCounter::Reflection);
         updateReflectionStyle();
     }
 
-    updateResizerStyle();
-
     updateDescendantDependentFlags();
     updateTransform();
 
@@ -5651,20 +5042,7 @@
         || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintWithFilters))
         compositor()->setCompositingLayersNeedRebuild();
     else if (isComposited())
-        backing()->updateGraphicsLayerGeometry();
-}
-
-void RenderLayer::updateResizerAreaSet() {
-    Frame* frame = renderer()->frame();
-    if (!frame)
-        return;
-    FrameView* frameView = frame->view();
-    if (!frameView)
-        return;
-    if (renderer()->canResize())
-        frameView->addResizerArea(this);
-    else
-        frameView->removeResizerArea(this);
+        compositedLayerMapping()->updateGraphicsLayerGeometry();
 }
 
 void RenderLayer::updateScrollableAreaSet(bool hasOverflow)
@@ -5711,22 +5089,6 @@
     }
 }
 
-void RenderLayer::updateResizerStyle()
-{
-    RenderObject* actualRenderer = rendererForScrollbar(renderer());
-    RefPtr<RenderStyle> resizer = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(RESIZER), actualRenderer->style()) : PassRefPtr<RenderStyle>(0);
-    if (resizer) {
-        if (!m_resizer) {
-            m_resizer = RenderScrollbarPart::createAnonymous(&renderer()->document());
-            m_resizer->setParent(renderer());
-        }
-        m_resizer->setStyle(resizer.release());
-    } else if (m_resizer) {
-        m_resizer->destroy();
-        m_resizer = 0;
-    }
-}
-
 RenderLayer* RenderLayer::reflectionLayer() const
 {
     return m_reflection ? m_reflection->layer() : 0;
@@ -5790,7 +5152,7 @@
 {
     // We only want to enable shaders if WebGL is also enabled on this platform.
     const Settings* settings = renderer()->document().settings();
-    return settings && settings->isCSSCustomFilterEnabled() && settings->webGLEnabled();
+    return settings && RuntimeEnabledFeatures::cssCustomFilterEnabled() && settings->webGLEnabled();
 }
 
 FilterOperations RenderLayer::computeFilterOperations(const RenderStyle* style)
@@ -5883,7 +5245,7 @@
     RenderLayerFilterInfo* filterInfo = ensureFilterInfo();
     if (!filterInfo->renderer()) {
         RefPtr<FilterEffectRenderer> filterRenderer = FilterEffectRenderer::create();
-        RenderingMode renderingMode = renderer()->frame()->page()->settings().acceleratedFiltersEnabled() ? Accelerated : Unaccelerated;
+        RenderingMode renderingMode = renderer()->frame()->settings()->acceleratedFiltersEnabled() ? Accelerated : Unaccelerated;
         filterRenderer->setRenderingMode(renderingMode);
         filterInfo->setRenderer(filterRenderer.release());
 
@@ -5931,29 +5293,21 @@
         child->addLayerHitTestRects(rects);
 }
 
-const IntPoint& RenderLayer::scrollOrigin() const
-{
-    if (!m_scrollableArea) {
-        static IntPoint emptyPoint = IntPoint::zero();
-        return emptyPoint;
-    }
-
-    return m_scrollableArea->scrollOrigin();
-}
-
 int RenderLayer::scrollXOffset() const
 {
-    return m_scrollableArea->scrollXOffset();
+    // FIXME: We should add an ASSERT where it makes sense to force callers
+    // to check if we have a scrollable area before calling its methods.
+    return m_scrollableArea ? m_scrollableArea->scrollXOffset() : 0;
 }
 
 int RenderLayer::scrollYOffset() const
 {
-    return m_scrollableArea->scrollYOffset();
+    return m_scrollableArea ? m_scrollableArea->scrollYOffset() : 0;
 }
 
 IntSize RenderLayer::scrolledContentOffset() const
 {
-    return m_scrollableArea->scrollOffset();
+    return m_scrollableArea ? m_scrollableArea->scrollOffset() : IntSize();
 }
 
 bool RenderLayer::hasOverlayScrollbars() const
@@ -5961,36 +5315,70 @@
     return m_scrollableArea && m_scrollableArea->hasOverlayScrollbars();
 }
 
-Scrollbar* RenderLayer::horizontalScrollbar() const
-{
-    return m_scrollableArea->horizontalScrollbar();
-}
-
-Scrollbar* RenderLayer::verticalScrollbar() const
-{
-    return m_scrollableArea->verticalScrollbar();
-}
-
-bool RenderLayer::hasVerticalScrollbar() const
-{
-    return m_scrollableArea->hasVerticalScrollbar();
-}
-
-bool RenderLayer::hasHorizontalScrollbar() const
-{
-    return m_scrollableArea->hasHorizontalScrollbar();
-}
-
 int RenderLayer::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const
 {
+    if (!m_scrollableArea)
+        return 0;
+
     return m_scrollableArea->verticalScrollbarWidth(relevancy);
 }
 
 int RenderLayer::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy relevancy) const
 {
+    if (!m_scrollableArea)
+        return 0;
+
     return m_scrollableArea->horizontalScrollbarHeight(relevancy);
 }
 
+IntRect RenderLayer::scrollCornerAndResizerRect() const
+{
+    if (!m_scrollableArea)
+        return IntRect();
+
+    return m_scrollableArea->scrollCornerAndResizerRect();
+}
+
+void RenderLayer::positionOverflowControls(const IntSize& offsetFromRoot)
+{
+    if (m_scrollableArea)
+        m_scrollableArea->positionOverflowControls(offsetFromRoot);
+}
+
+void RenderLayer::paintScrollCorner(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect)
+{
+    if (m_scrollableArea)
+        m_scrollableArea->paintScrollCorner(context, paintOffset, damageRect);
+}
+
+bool RenderLayer::isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestType resizerHitTestType) const
+{
+    if (!m_scrollableArea)
+        return false;
+
+    return m_scrollableArea->isPointInResizeControl(absolutePoint, resizerHitTestType);
+}
+
+void RenderLayer::paintOverflowControls(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls)
+{
+    if (m_scrollableArea)
+        return m_scrollableArea->paintOverflowControls(context, paintOffset, damageRect, paintingOverlayControls);
+}
+
+bool RenderLayer::hitTestOverflowControls(HitTestResult& result, const IntPoint& localPoint)
+{
+    if (!m_scrollableArea)
+        return false;
+
+    return m_scrollableArea->hitTestOverflowControls(result, localPoint);
+}
+
+void RenderLayer::paintResizer(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect)
+{
+    if (m_scrollableArea)
+        m_scrollableArea->paintResizer(context, paintOffset, damageRect);
+}
+
 } // namespace WebCore
 
 #ifndef NDEBUG
diff --git a/Source/core/rendering/RenderLayer.h b/Source/core/rendering/RenderLayer.h
index a782789..af11f3e 100644
--- a/Source/core/rendering/RenderLayer.h
+++ b/Source/core/rendering/RenderLayer.h
@@ -49,6 +49,7 @@
 #include "core/rendering/CompositingReasons.h"
 #include "core/rendering/PaintInfo.h"
 #include "core/rendering/RenderBox.h"
+#include "core/rendering/RenderLayerRepainter.h"
 #include "core/rendering/RenderLayerScrollableArea.h"
 
 #include "wtf/OwnPtr.h"
@@ -65,7 +66,7 @@
 class PlatformEvent;
 class RenderFlowThread;
 class RenderGeometryMap;
-class RenderLayerBacking;
+class CompositedLayerMapping;
 class RenderLayerCompositor;
 class RenderReplica;
 class RenderScrollbarPart;
@@ -76,12 +77,6 @@
 
 enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelfForBorderRadius };
 
-enum RepaintStatus {
-    NeedsNormalRepaint = 0,
-    NeedsFullRepaint = 1 << 0,
-    NeedsFullRepaintForPositionedMovementLayout = 1 << 1
-};
-
 class RenderLayer {
 public:
     friend class RenderReplica;
@@ -113,7 +108,6 @@
     // if layer compositing is being used,
     void setBackingNeedsRepaint();
     void setBackingNeedsRepaintInRect(const LayoutRect&); // r is in the coordinate space of the layer's render object
-    void repaintIncludingNonCompositingDescendants(RenderLayerModelObject* repaintContainer);
 
     void styleChanged(StyleDifference, const RenderStyle* oldStyle);
 
@@ -147,12 +141,6 @@
 
     LayoutRect rect() const { return LayoutRect(location(), size()); }
 
-    // See comments on isPointInResizeControl.
-    IntRect resizerCornerRect(const IntRect& bounds, ResizerHitTestType) const;
-
-    int scrollWidth() const;
-    int scrollHeight() const;
-
     void panScrollFromPoint(const IntPoint&);
 
     // Scrolling methods for layers that can scroll their overflow.
@@ -180,8 +168,8 @@
     void autoscroll(const IntPoint&);
 
     void resize(const PlatformEvent&, const LayoutSize&);
-    bool inResizeMode() const { return m_inResizeMode; }
-    void setInResizeMode(bool b) { m_inResizeMode = b; }
+    bool inResizeMode() const;
+    void setInResizeMode(bool);
 
     bool isRootLayer() const { return m_isRootLayer; }
 
@@ -436,12 +424,6 @@
     // WARNING: This method returns the offset for the parent as this is what updateLayerPositions expects.
     LayoutPoint computeOffsetFromRoot(bool& hasLayerOffset) const;
 
-    // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint.
-    LayoutRect repaintRect() const { return m_repaintRect; }
-    LayoutRect repaintRectIncludingNonCompositingDescendants() const;
-
-    void setRepaintStatus(RepaintStatus status) { m_repaintStatus = status; }
-
     LayoutUnit staticInlinePosition() const { return m_staticInlinePosition; }
     LayoutUnit staticBlockPosition() const { return m_staticBlockPosition; }
 
@@ -474,12 +456,12 @@
     // Only safe to call from RenderLayerModelObject::destroyLayer()
     void operator delete(void*);
 
-    bool isComposited() const { return m_backing != 0; }
+    bool isComposited() const { return m_compositedLayerMapping; }
     bool hasCompositedMask() const;
     bool hasCompositedClippingMask() const;
-    RenderLayerBacking* backing() const { return m_backing.get(); }
-    RenderLayerBacking* ensureBacking();
-    void clearBacking(bool layerBeingDestroyed = false);
+    CompositedLayerMapping* compositedLayerMapping() const { return m_compositedLayerMapping.get(); }
+    CompositedLayerMapping* ensureCompositedLayerMapping();
+    void clearCompositedLayerMapping(bool layerBeingDestroyed = false);
     bool needsCompositedScrolling() const;
     bool needsToBeStackingContainer() const;
 
@@ -565,7 +547,9 @@
 
     void addLayerHitTestRects(LayerHitTestRects&) const;
 
-    ScrollableArea* scrollableArea() const { return m_scrollableArea.get(); }
+    // FIXME: This should probably return a ScrollableArea but a lot of internal methods are mistakenly exposed.
+    RenderLayerScrollableArea* scrollableArea() const { return m_scrollableArea.get(); }
+    RenderLayerRepainter& repainter() { return m_repainter; }
 
 private:
     enum CollectLayersBehavior {
@@ -607,16 +591,10 @@
     void dirtyNormalFlowListCanBePromotedToStackingContainer();
     void dirtySiblingStackingContextCanBePromotedToStackingContainer();
 
-    void computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* = 0);
-    void computeRepaintRectsIncludingDescendants();
-    void clearRepaintRects();
-
     void clipToRect(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&,
                     BorderRadiusClippingRule = IncludeSelfForBorderRadius);
     void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&);
 
-    bool shouldRepaintAfterLayout() const;
-
     void updateSelfPaintingLayer();
     void updateIsNormalFlowOnly();
     void updateVisibilityAfterStyleChange(const RenderStyle* oldStyle);
@@ -726,7 +704,6 @@
 
     bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect& layerBounds, const HitTestLocation&, HitTestFilter) const;
     bool hitTestContentsForFragments(const LayerFragments&, const HitTestRequest&, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect) const;
-    bool hitTestResizerInFragments(const LayerFragments&, const HitTestLocation&) const;
     RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest&, HitTestResult&,
         const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingTransformState* = 0, double* zOffset = 0);
 
@@ -739,23 +716,12 @@
 
     // Start of ScrollableArea interface
     // To be moved to RenderLayerScrollableArea
-    ScrollableArea* enclosingScrollableArea() const;
-
     void updateNeedsCompositedScrolling();
 
 public:
-    GraphicsLayer* layerForScrolling() const;
-    GraphicsLayer* layerForScrollChild() const;
-    GraphicsLayer* layerForHorizontalScrollbar() const;
-    GraphicsLayer* layerForVerticalScrollbar() const;
-    GraphicsLayer* layerForScrollCorner() const;
     bool usesCompositedScrolling() const;
 
     bool hasOverlayScrollbars() const;
-    Scrollbar* horizontalScrollbar() const;
-    Scrollbar* verticalScrollbar() const;
-    bool hasVerticalScrollbar() const;
-    bool hasHorizontalScrollbar() const;
     int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
     int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
 
@@ -764,35 +730,19 @@
     friend IntSize RenderBox::scrolledContentOffset() const;
     IntSize scrolledContentOffset() const;
     IntSize adjustedScrollOffset() const { return IntSize(scrollXOffset(), scrollYOffset()); }
-
-private:
-    void invalidateScrollCornerRect(const IntRect&);
-    bool isActive() const;
-    bool isScrollCornerVisible() const;
-    IntRect scrollCornerRect() const;
-    int scrollSize(ScrollbarOrientation) const;
-    int visibleHeight() const;
-    int visibleWidth() const;
-    IntSize overhangAmount() const;
-    IntPoint lastKnownMousePosition() const;
-    bool shouldSuspendScrollAnimations() const;
-    bool scrollbarsCanBeActive() const;
-    IntRect scrollableAreaBoundingBox() const;
-    bool userInputScrollable(ScrollbarOrientation) const;
-    bool shouldPlaceVerticalScrollbarOnLeft() const;
-    int pageStep(ScrollbarOrientation) const;
     // End of ScrollableArea interface
 
-    // FIXME: This should be removed once we have transitioned to RenderLayerScrollableArea.
-    const IntPoint& scrollOrigin() const;
-
+private:
     // Rectangle encompassing the scroll corner and resizer rect.
     IntRect scrollCornerAndResizerRect() const;
 
     void updateCompositingLayersAfterScroll();
 
-    bool requiresScrollableArea() const { return renderer()->style()->overflowX() != OVISIBLE || renderer()->canResize() || usesCompositedScrolling(); }
-    void updateResizerAreaSet();
+    // FIXME: We could lazily allocate our ScrollableArea based on style properties ('overflow', ...)
+    // but for now, we are always allocating it for RenderBox as it's safer.
+    bool requiresScrollableArea() const { return renderBox(); }
+    void updateScrollableArea();
+
     void updateScrollableAreaSet(bool hasOverflow);
 
     void dirtyAncestorChainVisibleDescendantStatus();
@@ -825,13 +775,7 @@
 
     RenderLayer* enclosingTransformedAncestor() const;
 
-    // Convert a point in absolute coords into layer coords, taking transforms into account
-    LayoutPoint absoluteToContents(const LayoutPoint&) const;
-
     void positionOverflowControls(const IntSize&);
-    void updateResizerStyle();
-
-    void drawPlatformResizerImage(GraphicsContext*, IntRect resizerCornerRect);
 
     void updatePagination();
 
@@ -847,16 +791,11 @@
     // Returns true if z ordering would not change if this layer were a stacking container.
     bool canBeStackingContainer() const;
 
-    friend class RenderLayerBacking;
+    friend class CompositedLayerMapping;
     friend class RenderLayerCompositor;
     friend class RenderLayerModelObject;
 
-    bool overflowControlsIntersectRect(const IntRect& localRect) const;
-
 protected:
-    // Keeps track of whether the layer is currently resizing, so events can cause resizing to start and stop.
-    unsigned m_inResizeMode : 1;
-
     unsigned m_zOrderListsDirty : 1;
     unsigned m_normalFlowListDirty: 1;
     unsigned m_isNormalFlowOnly : 1;
@@ -897,7 +836,6 @@
                                  // we ended up painting this layer or any descendants (and therefore need to
                                  // blend).
     unsigned m_paintingInsideReflection : 1; // A state bit tracking if we are painting inside a replica.
-    unsigned m_repaintStatus : 2; // RepaintStatus
 
     unsigned m_visibleContentStatusDirty : 1;
     unsigned m_hasVisibleContent : 1;
@@ -933,9 +871,6 @@
     RenderLayer* m_first;
     RenderLayer* m_last;
 
-    LayoutRect m_repaintRect; // Cached repaint rects. Used by layout.
-    LayoutRect m_outlineBox;
-
     // Our current relative position offset.
     LayoutSize m_offsetForInFlowPosition;
 
@@ -958,8 +893,6 @@
 
     OwnPtr<ClipRectsCache> m_clipRectsCache;
 
-    IntPoint m_cachedOverlayScrollbarOffset;
-
     // Cached normal flow values for absolute positioned elements with static left/top values.
     LayoutUnit m_staticInlinePosition;
     LayoutUnit m_staticBlockPosition;
@@ -969,9 +902,6 @@
     // May ultimately be extended to many replicas (with their own paint order).
     RenderReplica* m_reflection;
 
-    // Renderers to hold our custom resizer.
-    RenderScrollbarPart* m_resizer;
-
     // Pointer to the enclosing RenderLayer that caused us to be paginated. It is 0 if we are not paginated.
     RenderLayer* m_enclosingPaginationLayer;
 
@@ -1001,8 +931,10 @@
 private:
     IntRect m_blockSelectionGapsBounds;
 
-    OwnPtr<RenderLayerBacking> m_backing;
+    OwnPtr<CompositedLayerMapping> m_compositedLayerMapping;
     OwnPtr<RenderLayerScrollableArea> m_scrollableArea;
+
+    RenderLayerRepainter m_repainter;
 };
 
 inline void RenderLayer::clearZOrderLists()
diff --git a/Source/core/rendering/RenderLayerBacking.cpp b/Source/core/rendering/RenderLayerBacking.cpp
deleted file mode 100644
index 5a16fab..0000000
--- a/Source/core/rendering/RenderLayerBacking.cpp
+++ /dev/null
@@ -1,1966 +0,0 @@
-/*
- * Copyright (C) 2009, 2010, 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 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,
- * 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/rendering/RenderLayerBacking.h"
-
-#include "CSSPropertyNames.h"
-#include "HTMLNames.h"
-#include "RuntimeEnabledFeatures.h"
-#include "core/fetch/ImageResource.h"
-#include "core/html/HTMLIFrameElement.h"
-#include "core/html/HTMLMediaElement.h"
-#include "core/html/canvas/CanvasRenderingContext.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/page/Chrome.h"
-#include "core/page/FrameView.h"
-#include "core/page/Settings.h"
-#include "core/page/animation/AnimationController.h"
-#include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/platform/graphics/FontCache.h"
-#include "core/platform/graphics/GraphicsContext.h"
-#include "core/platform/graphics/GraphicsLayer.h"
-#include "core/plugins/PluginView.h"
-#include "core/rendering/RenderApplet.h"
-#include "core/rendering/RenderEmbeddedObject.h"
-#include "core/rendering/RenderIFrame.h"
-#include "core/rendering/RenderImage.h"
-#include "core/rendering/RenderLayer.h"
-#include "core/rendering/RenderLayerCompositor.h"
-#include "core/rendering/RenderVideo.h"
-#include "core/rendering/RenderView.h"
-#include "core/rendering/animation/WebAnimationProvider.h"
-#include "core/rendering/style/KeyframeList.h"
-#include "wtf/CurrentTime.h"
-#include "wtf/text/StringBuilder.h"
-
-#include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
-#include "core/rendering/FilterEffectRenderer.h"
-
-#include "core/platform/graphics/GraphicsContext3D.h"
-
-using namespace std;
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-static IntRect clipBox(RenderBox* renderer);
-
-static IntRect contentsRect(const RenderObject* renderer)
-{
-    if (!renderer->isBox())
-        return IntRect();
-
-    return renderer->isVideo() ?
-        toRenderVideo(renderer)->videoBox() :
-        pixelSnappedIntRect(toRenderBox(renderer)->contentBoxRect());
-}
-
-static IntRect backgroundRect(const RenderObject* renderer)
-{
-    if (!renderer->isBox())
-        return IntRect();
-
-    LayoutRect rect;
-    const RenderBox* box = toRenderBox(renderer);
-    EFillBox clip = box->style()->backgroundClip();
-    switch (clip) {
-    case BorderFillBox:
-        rect = box->borderBoxRect();
-        break;
-    case PaddingFillBox:
-        rect = box->paddingBoxRect();
-        break;
-    case ContentFillBox:
-        rect = box->contentBoxRect();
-        break;
-    case TextFillBox:
-        break;
-    }
-
-    return pixelSnappedIntRect(rect);
-}
-
-static inline bool isAcceleratedCanvas(const RenderObject* renderer)
-{
-    if (renderer->isCanvas()) {
-        HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
-        if (CanvasRenderingContext* context = canvas->renderingContext())
-            return context->isAccelerated();
-    }
-    return false;
-}
-
-static bool hasBoxDecorations(const RenderStyle* style)
-{
-    return style->hasBorder() || style->hasBorderRadius() || style->hasOutline() || style->hasAppearance() || style->boxShadow() || style->hasFilter();
-}
-
-static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle* style)
-{
-    return hasBoxDecorations(style) || style->hasBackgroundImage();
-}
-
-static bool contentLayerSupportsDirectBackgroundComposition(const RenderObject* renderer)
-{
-    // No support for decorations - border, border-radius or outline.
-    // Only simple background - solid color or transparent.
-    if (hasBoxDecorationsOrBackgroundImage(renderer->style()))
-        return false;
-
-    // If there is no background, there is nothing to support.
-    if (!renderer->style()->hasBackground())
-        return true;
-
-    // Simple background that is contained within the contents rect.
-    return contentsRect(renderer).contains(backgroundRect(renderer));
-}
-
-static inline bool isAcceleratedContents(RenderObject* renderer)
-{
-    return isAcceleratedCanvas(renderer)
-        || (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing())
-        || renderer->isVideo();
-}
-
-// Get the scrolling coordinator in a way that works inside RenderLayerBacking's destructor.
-static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer* layer)
-{
-    Page* page = layer->renderer()->frame()->page();
-    if (!page)
-        return 0;
-
-    return page->scrollingCoordinator();
-}
-
-RenderLayerBacking::RenderLayerBacking(RenderLayer* layer)
-    : m_owningLayer(layer)
-    , m_animationProvider(adoptPtr(new WebAnimationProvider))
-    , m_artificiallyInflatedBounds(false)
-    , m_boundsConstrainedByClipping(false)
-    , m_isMainFrameRenderViewLayer(false)
-    , m_requiresOwnBackingStore(true)
-    , m_canCompositeFilters(false)
-    , m_backgroundLayerPaintsFixedRootBackground(false)
-{
-    if (layer->isRootLayer()) {
-        Frame& frame = toRenderView(renderer())->frameView()->frame();
-        Page* page = frame.page();
-        if (page && page->mainFrame() == &frame) {
-            m_isMainFrameRenderViewLayer = true;
-        }
-    }
-
-    createPrimaryGraphicsLayer();
-}
-
-RenderLayerBacking::~RenderLayerBacking()
-{
-    updateClippingLayers(false, false);
-    updateOverflowControlsLayers(false, false, false);
-    updateForegroundLayer(false);
-    updateBackgroundLayer(false);
-    updateMaskLayer(false);
-    updateClippingMaskLayers(false);
-    updateScrollingLayers(false);
-    destroyGraphicsLayers();
-}
-
-PassOwnPtr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(CompositingReasons reasons)
-{
-    GraphicsLayerFactory* graphicsLayerFactory = 0;
-    if (Page* page = renderer()->frame()->page())
-        graphicsLayerFactory = page->chrome().client().graphicsLayerFactory();
-
-    OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, this);
-
-    graphicsLayer->setCompositingReasons(reasons);
-
-    return graphicsLayer.release();
-}
-
-void RenderLayerBacking::createPrimaryGraphicsLayer()
-{
-    m_graphicsLayer = createGraphicsLayer(m_owningLayer->compositingReasons());
-
-#if !OS(ANDROID)
-    if (m_isMainFrameRenderViewLayer)
-        m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true);
-#endif
-
-    updateOpacity(renderer()->style());
-    updateTransform(renderer()->style());
-    updateFilters(renderer()->style());
-
-    if (RuntimeEnabledFeatures::cssCompositingEnabled())
-        updateLayerBlendMode(renderer()->style());
-}
-
-void RenderLayerBacking::destroyGraphicsLayers()
-{
-    if (m_graphicsLayer)
-        m_graphicsLayer->removeFromParent();
-
-    m_ancestorClippingLayer = nullptr;
-    m_graphicsLayer = nullptr;
-    m_foregroundLayer = nullptr;
-    m_backgroundLayer = nullptr;
-    m_childContainmentLayer = nullptr;
-    m_maskLayer = nullptr;
-    m_childClippingMaskLayer = nullptr;
-
-    m_scrollingLayer = nullptr;
-    m_scrollingContentsLayer = nullptr;
-}
-
-void RenderLayerBacking::updateOpacity(const RenderStyle* style)
-{
-    m_graphicsLayer->setOpacity(compositingOpacity(style->opacity()));
-}
-
-void RenderLayerBacking::updateTransform(const RenderStyle* style)
-{
-    // FIXME: This could use m_owningLayer->transform(), but that currently has transform-origin
-    // baked into it, and we don't want that.
-    TransformationMatrix t;
-    if (m_owningLayer->hasTransform()) {
-        style->applyTransform(t, toRenderBox(renderer())->pixelSnappedBorderBoxRect().size(), RenderStyle::ExcludeTransformOrigin);
-        makeMatrixRenderable(t, compositor()->canRender3DTransforms());
-    }
-
-    m_graphicsLayer->setTransform(t);
-}
-
-void RenderLayerBacking::updateFilters(const RenderStyle* style)
-{
-    bool didCompositeFilters = m_canCompositeFilters;
-    m_canCompositeFilters = m_graphicsLayer->setFilters(owningLayer()->computeFilterOperations(style));
-    if (didCompositeFilters != m_canCompositeFilters) {
-        //
-        // If filters used to be painted in software and are now painted in the compositor, we need to:
-        // (1) Remove the FilterEffectRenderer, which was used for painting filters in software.
-        // (2) Repaint the layer contents to remove the software-applied filter because the compositor will apply it.
-        //
-        // Similarly, if filters used to be painted in the compositor and are now painted in software, we need to:
-        // (1) Create a FilterEffectRenderer.
-        // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it.
-        //
-        m_owningLayer->updateOrRemoveFilterEffectRenderer();
-        setContentsNeedDisplay();
-    }
-}
-
-void RenderLayerBacking::updateLayerBlendMode(const RenderStyle*)
-{
-}
-
-void RenderLayerBacking::updateContentsOpaque()
-{
-    // For non-root layers, background is always painted by the primary graphics layer.
-    ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer);
-    if (m_backgroundLayer) {
-        m_graphicsLayer->setContentsOpaque(false);
-        m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
-    } else {
-        m_graphicsLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
-    }
-}
-
-static bool hasNonZeroTransformOrigin(const RenderObject* renderer)
-{
-    RenderStyle* style = renderer->style();
-    return (style->transformOriginX().type() == Fixed && style->transformOriginX().value())
-        || (style->transformOriginY().type() == Fixed && style->transformOriginY().value());
-}
-
-static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer* layer)
-{
-    for (RenderLayer* curr = layer; curr; curr = curr->parent()) {
-        if (curr->hasTransform() || curr->needsCompositedScrolling())
-            return true;
-    }
-
-    return false;
-}
-
-bool RenderLayerBacking::shouldClipCompositedBounds() const
-{
-    // Scrollbar layers use this layer for relative positioning, so don't clip.
-    if (layerForHorizontalScrollbar() || layerForVerticalScrollbar())
-        return false;
-
-    if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer))
-        return false;
-
-    return true;
-}
-
-void RenderLayerBacking::updateCompositedBounds()
-{
-    IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);
-
-    // Clip to the size of the document or enclosing overflow-scroll layer.
-    // If this or an ancestor is transformed, we can't currently compute the correct rect to intersect with.
-    // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist.
-    if (shouldClipCompositedBounds()) {
-        RenderView* view = m_owningLayer->renderer()->view();
-        RenderLayer* rootLayer = view->layer();
-
-        LayoutRect clippingBounds;
-        if (renderer()->style()->position() == FixedPosition && renderer()->container() == view)
-            clippingBounds = view->frameView()->viewportConstrainedVisibleContentRect();
-        else
-            clippingBounds = view->unscaledDocumentRect();
-
-        if (m_owningLayer != rootLayer)
-            clippingBounds.intersect(m_owningLayer->backgroundClipRect(RenderLayer::ClipRectsContext(rootLayer, 0, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS regions.
-
-        LayoutPoint delta;
-        m_owningLayer->convertToLayerCoords(rootLayer, delta);
-        clippingBounds.move(-delta.x(), -delta.y());
-
-        layerBounds.intersect(pixelSnappedIntRect(clippingBounds));
-        m_boundsConstrainedByClipping = true;
-    } else
-        m_boundsConstrainedByClipping = false;
-
-    // If the element has a transform-origin that has fixed lengths, and the renderer has zero size,
-    // then we need to ensure that the compositing layer has non-zero size so that we can apply
-    // the transform-origin via the GraphicsLayer anchorPoint (which is expressed as a fractional value).
-    if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) {
-        layerBounds.setWidth(1);
-        layerBounds.setHeight(1);
-        m_artificiallyInflatedBounds = true;
-    } else
-        m_artificiallyInflatedBounds = false;
-
-    setCompositedBounds(layerBounds);
-}
-
-void RenderLayerBacking::updateAfterWidgetResize()
-{
-    if (renderer()->isRenderPart()) {
-        if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::frameContentsCompositor(toRenderPart(renderer()))) {
-            innerCompositor->frameViewDidChangeSize();
-            innerCompositor->frameViewDidChangeLocation(contentsBox().location());
-        }
-    }
-}
-
-void RenderLayerBacking::updateCompositingReasons()
-{
-    // All other layers owned by this backing will have the same compositing reason
-    // for their lifetime, so they are initialized only when created.
-    m_graphicsLayer->setCompositingReasons(m_owningLayer->compositingReasons());
-}
-
-void RenderLayerBacking::updateAfterLayout(UpdateAfterLayoutFlags flags)
-{
-    RenderLayerCompositor* layerCompositor = compositor();
-    if (!layerCompositor->compositingLayersNeedRebuild()) {
-        // Calling updateGraphicsLayerGeometry() here gives incorrect results, because the
-        // position of this layer's GraphicsLayer depends on the position of our compositing
-        // ancestor's GraphicsLayer. That cannot be determined until all the descendant
-        // RenderLayers of that ancestor have been processed via updateLayerPositions().
-        //
-        // The solution is to update compositing children of this layer here,
-        // via updateCompositingChildrenGeometry().
-        updateCompositedBounds();
-        layerCompositor->updateCompositingDescendantGeometry(m_owningLayer, m_owningLayer, flags & CompositingChildrenOnly);
-
-        if (flags & IsUpdateRoot) {
-            updateGraphicsLayerGeometry();
-            layerCompositor->updateRootLayerPosition();
-            RenderLayer* stackingContainer = m_owningLayer->enclosingStackingContainer();
-            if (!layerCompositor->compositingLayersNeedRebuild() && stackingContainer && (stackingContainer != m_owningLayer))
-                layerCompositor->updateCompositingDescendantGeometry(stackingContainer, stackingContainer, flags & CompositingChildrenOnly);
-        }
-    }
-
-    if (flags & NeedsFullRepaint && !paintsIntoCompositedAncestor())
-        setContentsNeedDisplay();
-}
-
-bool RenderLayerBacking::updateGraphicsLayerConfiguration()
-{
-    RenderLayerCompositor* compositor = this->compositor();
-    RenderObject* renderer = this->renderer();
-
-    m_owningLayer->updateDescendantDependentFlags();
-    m_owningLayer->updateZOrderLists();
-
-    bool layerConfigChanged = false;
-    setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgroundLayer(m_owningLayer));
-
-    // The background layer is currently only used for fixed root backgrounds.
-    if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground))
-        layerConfigChanged = true;
-
-    if (updateForegroundLayer(compositor->needsContentsCompositingLayer(m_owningLayer)))
-        layerConfigChanged = true;
-
-    bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants(m_owningLayer);
-
-    // Our scrolling layer will clip.
-    if (m_owningLayer->needsCompositedScrolling())
-        needsDescendentsClippingLayer = false;
-
-    RenderLayer* scrollParent = m_owningLayer->scrollParent();
-    bool needsAncestorClip = compositor->clippedByAncestor(m_owningLayer);
-    if (scrollParent) {
-        // If our containing block is our ancestor scrolling layer, then we'll already be clipped
-        // to it via our scroll parent and we don't need an ancestor clipping layer.
-        if (m_owningLayer->renderer()->containingBlock()->enclosingLayer() == m_owningLayer->ancestorScrollingLayer())
-            needsAncestorClip = false;
-    }
-    if (updateClippingLayers(needsAncestorClip, needsDescendentsClippingLayer))
-        layerConfigChanged = true;
-
-    if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), requiresVerticalScrollbarLayer(), requiresScrollCornerLayer()))
-        layerConfigChanged = true;
-
-    if (updateScrollingLayers(m_owningLayer->needsCompositedScrolling()))
-        layerConfigChanged = true;
-
-    updateScrollParent(scrollParent);
-    updateClipParent(m_owningLayer->clipParent());
-
-    if (layerConfigChanged)
-        updateInternalHierarchy();
-
-    if (updateMaskLayer(renderer->hasMask()))
-        m_graphicsLayer->setMaskLayer(m_maskLayer.get());
-
-    bool needsChildClippingMask = renderer->style()->hasBorderRadius() && isAcceleratedContents(renderer);
-    if (updateClippingMaskLayers(needsChildClippingMask))
-        m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.get());
-
-    if (m_owningLayer->hasReflection()) {
-        if (m_owningLayer->reflectionLayer()->backing()) {
-            GraphicsLayer* reflectionLayer = m_owningLayer->reflectionLayer()->backing()->graphicsLayer();
-            m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
-        }
-    } else
-        m_graphicsLayer->setReplicatedByLayer(0);
-
-    updateBackgroundColor(isSimpleContainerCompositingLayer());
-
-    if (isDirectlyCompositedImage())
-        updateImageContents();
-
-    if (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing()) {
-        PluginView* pluginView = toPluginView(toRenderWidget(renderer)->widget());
-        m_graphicsLayer->setContentsToMedia(pluginView->platformLayer());
-    } else if (renderer->isVideo()) {
-        HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer->node());
-        m_graphicsLayer->setContentsToMedia(mediaElement->platformLayer());
-    } else if (isAcceleratedCanvas(renderer)) {
-        HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
-        if (CanvasRenderingContext* context = canvas->renderingContext())
-            m_graphicsLayer->setContentsToCanvas(context->platformLayer());
-        layerConfigChanged = true;
-    }
-    if (renderer->isRenderPart())
-        layerConfigChanged = RenderLayerCompositor::parentFrameContentLayers(toRenderPart(renderer));
-
-    return layerConfigChanged;
-}
-
-static IntRect clipBox(RenderBox* renderer)
-{
-    LayoutRect result = PaintInfo::infiniteRect();
-    if (renderer->hasOverflowClip())
-        result = renderer->overflowClipRect(LayoutPoint(), 0); // FIXME: Incorrect for CSS regions.
-
-    if (renderer->hasClip())
-        result.intersect(renderer->clipRect(LayoutPoint(), 0)); // FIXME: Incorrect for CSS regions.
-
-    return pixelSnappedIntRect(result);
-}
-
-void RenderLayerBacking::updateGraphicsLayerGeometry()
-{
-    // If we haven't built z-order lists yet, wait until later.
-    if (m_owningLayer->isStackingContainer() && m_owningLayer->m_zOrderListsDirty)
-        return;
-
-    // Set transform property, if it is not animating. We have to do this here because the transform
-    // is affected by the layer dimensions.
-    if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitTransform))
-        updateTransform(renderer()->style());
-
-    // Set opacity, if it is not animating.
-    if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyOpacity))
-        updateOpacity(renderer()->style());
-
-    if (RuntimeEnabledFeatures::cssCompositingEnabled())
-        updateLayerBlendMode(renderer()->style());
-
-    bool isSimpleContainer = isSimpleContainerCompositingLayer();
-
-    m_owningLayer->updateDescendantDependentFlags();
-
-    // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer and its non-compositing
-    // descendants. So, the visibility flag for m_graphicsLayer should be true if there are any
-    // non-compositing visible layers.
-    bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCompositingDescendantLayers();
-    if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->isVideo()) {
-        HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer()->node());
-        if (mediaElement->isFullscreen())
-            contentsVisible = false;
-    }
-    m_graphicsLayer->setContentsVisible(contentsVisible);
-
-    RenderStyle* style = renderer()->style();
-    // FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959
-    bool preserves3D = style->transformStyle3D() == TransformStyle3DPreserve3D && !renderer()->hasReflection();
-    m_graphicsLayer->setPreserves3D(preserves3D);
-    m_graphicsLayer->setBackfaceVisibility(style->backfaceVisibility() == BackfaceVisibilityVisible);
-
-    RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer();
-
-    // We compute everything relative to the enclosing compositing layer.
-    IntRect ancestorCompositingBounds;
-    if (compAncestor) {
-        ASSERT(compAncestor->backing());
-        ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->backing()->compositedBounds());
-    }
-
-    IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds());
-
-    IntRect relativeCompositingBounds(localCompositingBounds);
-    IntPoint delta;
-    m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta);
-    relativeCompositingBounds.moveBy(delta);
-
-    IntPoint graphicsLayerParentLocation;
-    if (compAncestor && compAncestor->backing()->hasClippingLayer()) {
-        // If the compositing ancestor has a layer to clip children, we parent in that, and therefore
-        // position relative to it.
-        IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer()));
-        graphicsLayerParentLocation = clippingBox.location();
-    } else if (compAncestor)
-        graphicsLayerParentLocation = ancestorCompositingBounds.location();
-    else
-        graphicsLayerParentLocation = renderer()->view()->documentRect().location();
-
-    if (compAncestor && compAncestor->needsCompositedScrolling()) {
-        RenderBox* renderBox = toRenderBox(compAncestor->renderer());
-        IntSize scrollOffset = compAncestor->scrolledContentOffset();
-        IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop());
-        graphicsLayerParentLocation = scrollOrigin - scrollOffset;
-    }
-
-    if (compAncestor && m_ancestorClippingLayer) {
-        // Call calculateRects to get the backgroundRect which is what is used to clip the contents of this
-        // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects
-        // for a compositing layer, rootLayer is the layer itself.
-        RenderLayer::ClipRectsContext clipRectsContext(compAncestor, 0, TemporaryClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip);
-        IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundClipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions.
-        ASSERT(parentClipRect != PaintInfo::infiniteRect());
-        m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
-        m_ancestorClippingLayer->setSize(parentClipRect.size());
-
-        // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords.
-        m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - delta);
-
-        // The primary layer is then parented in, and positioned relative to this clipping layer.
-        graphicsLayerParentLocation = parentClipRect.location();
-    }
-
-    FloatSize contentsSize = relativeCompositingBounds.size();
-
-    m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
-    m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.location()));
-
-    FloatSize oldSize = m_graphicsLayer->size();
-    if (oldSize != contentsSize) {
-        m_graphicsLayer->setSize(contentsSize);
-        // Usually invalidation will happen via layout etc, but if we've affected the layer
-        // size by constraining relative to a clipping ancestor or the viewport, we
-        // have to invalidate to avoid showing stretched content.
-        if (m_boundsConstrainedByClipping)
-            m_graphicsLayer->setNeedsDisplay();
-    }
-
-    // If we have a layer that clips children, position it.
-    IntRect clippingBox;
-    if (GraphicsLayer* clipLayer = clippingLayer()) {
-        clippingBox = clipBox(toRenderBox(renderer()));
-        clipLayer->setPosition(FloatPoint(clippingBox.location() - localCompositingBounds.location()));
-        clipLayer->setSize(clippingBox.size());
-        clipLayer->setOffsetFromRenderer(toIntSize(clippingBox.location()));
-    }
-
-    if (m_maskLayer) {
-        if (m_maskLayer->size() != m_graphicsLayer->size()) {
-            m_maskLayer->setSize(m_graphicsLayer->size());
-            m_maskLayer->setNeedsDisplay();
-        }
-        m_maskLayer->setPosition(FloatPoint());
-        m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
-    }
-
-    if (m_owningLayer->hasTransform()) {
-        const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect();
-
-        // Get layout bounds in the coords of compAncestor to match relativeCompositingBounds.
-        IntRect layerBounds = IntRect(delta, borderBox.size());
-
-        // Update properties that depend on layer dimensions
-        FloatPoint3D transformOrigin = computeTransformOrigin(borderBox);
-        // Compute the anchor point, which is in the center of the renderer box unless transform-origin is set.
-        FloatPoint3D anchor(relativeCompositingBounds.width()  != 0.0f ? ((layerBounds.x() - relativeCompositingBounds.x()) + transformOrigin.x()) / relativeCompositingBounds.width()  : 0.5f,
-                            relativeCompositingBounds.height() != 0.0f ? ((layerBounds.y() - relativeCompositingBounds.y()) + transformOrigin.y()) / relativeCompositingBounds.height() : 0.5f,
-                            transformOrigin.z());
-        m_graphicsLayer->setAnchorPoint(anchor);
-
-        RenderStyle* style = renderer()->style();
-        GraphicsLayer* clipLayer = clippingLayer();
-        if (style->hasPerspective()) {
-            TransformationMatrix t = owningLayer()->perspectiveTransform();
-
-            if (clipLayer) {
-                clipLayer->setChildrenTransform(t);
-                m_graphicsLayer->setChildrenTransform(TransformationMatrix());
-            }
-            else
-                m_graphicsLayer->setChildrenTransform(t);
-        } else {
-            if (clipLayer)
-                clipLayer->setChildrenTransform(TransformationMatrix());
-            else
-                m_graphicsLayer->setChildrenTransform(TransformationMatrix());
-        }
-    } else {
-        m_graphicsLayer->setAnchorPoint(FloatPoint3D(0.5f, 0.5f, 0));
-    }
-
-    if (m_foregroundLayer) {
-        FloatPoint foregroundPosition;
-        FloatSize foregroundSize = contentsSize;
-        IntSize foregroundOffset = m_graphicsLayer->offsetFromRenderer();
-        if (hasClippingLayer()) {
-            // If we have a clipping layer (which clips descendants), then the foreground layer is a child of it,
-            // so that it gets correctly sorted with children. In that case, position relative to the clipping layer.
-            foregroundSize = FloatSize(clippingBox.size());
-            foregroundOffset = toIntSize(clippingBox.location());
-        }
-
-        m_foregroundLayer->setPosition(foregroundPosition);
-        if (foregroundSize != m_foregroundLayer->size()) {
-            m_foregroundLayer->setSize(foregroundSize);
-            m_foregroundLayer->setNeedsDisplay();
-        }
-        m_foregroundLayer->setOffsetFromRenderer(foregroundOffset);
-    }
-
-    if (m_backgroundLayer) {
-        FloatPoint backgroundPosition;
-        FloatSize backgroundSize = contentsSize;
-        if (backgroundLayerPaintsFixedRootBackground()) {
-            FrameView* frameView = toRenderView(renderer())->frameView();
-            backgroundSize = frameView->visibleContentRect().size();
-        }
-        m_backgroundLayer->setPosition(backgroundPosition);
-        if (backgroundSize != m_backgroundLayer->size()) {
-            m_backgroundLayer->setSize(backgroundSize);
-            m_backgroundLayer->setNeedsDisplay();
-        }
-        m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer());
-    }
-
-    if (m_owningLayer->reflectionLayer() && m_owningLayer->reflectionLayer()->isComposited()) {
-        RenderLayerBacking* reflectionBacking = m_owningLayer->reflectionLayer()->backing();
-        reflectionBacking->updateGraphicsLayerGeometry();
-
-        // The reflection layer has the bounds of m_owningLayer->reflectionLayer(),
-        // but the reflected layer is the bounds of this layer, so we need to position it appropriately.
-        FloatRect layerBounds = compositedBounds();
-        FloatRect reflectionLayerBounds = reflectionBacking->compositedBounds();
-        reflectionBacking->graphicsLayer()->setReplicatedLayerPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location()));
-    }
-
-    if (m_scrollingLayer) {
-        ASSERT(m_scrollingContentsLayer);
-        RenderBox* renderBox = toRenderBox(renderer());
-        IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect());
-        // FIXME: We should make RenderBox::clientBoxRect consider scrollbar placement.
-        if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
-            clientBox.move(renderBox->verticalScrollbarWidth(), 0);
-
-        IntSize adjustedScrollOffset = m_owningLayer->adjustedScrollOffset();
-        m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCompositingBounds.location()));
-        m_scrollingLayer->setSize(clientBox.size());
-
-        IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
-        m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()));
-
-        bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
-
-        IntSize scrollSize(m_owningLayer->scrollWidth(), m_owningLayer->scrollHeight());
-        if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetChanged)
-            m_scrollingContentsLayer->setNeedsDisplay();
-
-        IntSize scrollingContentsOffset = toIntSize(clientBox.location() - adjustedScrollOffset);
-        if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer() || scrollSize != m_scrollingContentsLayer->size()) {
-            bool scrollingCoordinatorHandlesOffset = compositor()->scrollingLayerDidChange(m_owningLayer);
-
-            if (scrollingCoordinatorHandlesOffset)
-                m_scrollingContentsLayer->setPosition(-m_owningLayer->scrollOrigin());
-            else
-                m_scrollingContentsLayer->setPosition(FloatPoint(-adjustedScrollOffset));
-        }
-
-        m_scrollingContentsLayer->setSize(scrollSize);
-        // FIXME: The paint offset and the scroll offset should really be separate concepts.
-        m_scrollingContentsLayer->setOffsetFromRenderer(scrollingContentsOffset, GraphicsLayer::DontSetNeedsDisplay);
-
-        if (m_foregroundLayer) {
-            if (m_foregroundLayer->size() != m_scrollingContentsLayer->size())
-                m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
-            m_foregroundLayer->setNeedsDisplay();
-            m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offsetFromRenderer());
-        }
-    }
-
-    // If this layer was created just for clipping or to apply perspective, it doesn't need its own backing store.
-    setRequiresOwnBackingStore(compositor()->requiresOwnBackingStore(m_owningLayer, compAncestor));
-
-    updateContentsRect(isSimpleContainer);
-    updateBackgroundColor(isSimpleContainer);
-    updateDrawsContent(isSimpleContainer);
-    updateContentsOpaque();
-    updateAfterWidgetResize();
-    registerScrollingLayers();
-
-    updateCompositingReasons();
-}
-
-void RenderLayerBacking::registerScrollingLayers()
-{
-    // Register fixed position layers and their containers with the scrolling coordinator.
-    ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer);
-    if (!scrollingCoordinator)
-        return;
-
-    compositor()->updateViewportConstraintStatus(m_owningLayer);
-
-    scrollingCoordinator->updateLayerPositionConstraint(m_owningLayer);
-
-    // Page scale is applied as a transform on the root render view layer. Because the scroll
-    // layer is further up in the hierarchy, we need to avoid marking the root render view
-    // layer as a container.
-    bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLayer();
-    scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSuperlayers(), isContainer);
-}
-
-void RenderLayerBacking::updateInternalHierarchy()
-{
-    // m_foregroundLayer has to be inserted in the correct order with child layers,
-    // so it's not inserted here.
-    if (m_ancestorClippingLayer)
-        m_ancestorClippingLayer->removeAllChildren();
-
-    m_graphicsLayer->removeFromParent();
-
-    if (m_ancestorClippingLayer)
-        m_ancestorClippingLayer->addChild(m_graphicsLayer.get());
-
-    if (m_childContainmentLayer) {
-        m_childContainmentLayer->removeFromParent();
-        m_graphicsLayer->addChild(m_childContainmentLayer.get());
-    }
-
-    if (m_scrollingLayer) {
-        GraphicsLayer* superlayer = m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsLayer.get();
-        m_scrollingLayer->removeFromParent();
-        superlayer->addChild(m_scrollingLayer.get());
-    }
-
-    // The clip for child layers does not include space for overflow controls, so they exist as
-    // siblings of the clipping layer if we have one. Normal children of this layer are set as
-    // children of the clipping layer.
-    if (m_layerForHorizontalScrollbar) {
-        m_layerForHorizontalScrollbar->removeFromParent();
-        m_graphicsLayer->addChild(m_layerForHorizontalScrollbar.get());
-    }
-    if (m_layerForVerticalScrollbar) {
-        m_layerForVerticalScrollbar->removeFromParent();
-        m_graphicsLayer->addChild(m_layerForVerticalScrollbar.get());
-    }
-    if (m_layerForScrollCorner) {
-        m_layerForScrollCorner->removeFromParent();
-        m_graphicsLayer->addChild(m_layerForScrollCorner.get());
-    }
-}
-
-void RenderLayerBacking::updateContentsRect(bool isSimpleContainer)
-{
-    IntRect contentsRect;
-    if (isSimpleContainer && renderer()->hasBackground())
-        contentsRect = backgroundBox();
-    else
-        contentsRect = contentsBox();
-
-    m_graphicsLayer->setContentsRect(contentsRect);
-}
-
-void RenderLayerBacking::updateDrawsContent(bool isSimpleContainer)
-{
-    if (m_scrollingLayer) {
-        // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere.
-        // m_graphicsLayer only needs backing store if the non-scrolling parts (background, outlines, borders, shadows etc) need to paint.
-        // m_scrollingLayer never has backing store.
-        // m_scrollingContentsLayer only needs backing store if the scrolled contents need to paint.
-        bool hasNonScrollingPaintedContent = m_owningLayer->hasVisibleContent() && m_owningLayer->hasBoxDecorationsOrBackground();
-        m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent);
-
-        bool hasScrollingPaintedContent = m_owningLayer->hasVisibleContent() && (renderer()->hasBackground() || paintsChildren());
-        m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent);
-        return;
-    }
-
-    bool hasPaintedContent = containsPaintedContent(isSimpleContainer);
-    if (hasPaintedContent && isAcceleratedCanvas(renderer())) {
-        CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node())->renderingContext();
-        // Content layer may be null if context is lost.
-        if (WebKit::WebLayer* contentLayer = context->platformLayer()) {
-            Color bgColor;
-            if (contentLayerSupportsDirectBackgroundComposition(renderer())) {
-                bgColor = rendererBackgroundColor();
-                hasPaintedContent = false;
-            }
-            contentLayer->setBackgroundColor(bgColor.rgb());
-        }
-    }
-
-    // FIXME: we could refine this to only allocate backing for one of these layers if possible.
-    m_graphicsLayer->setDrawsContent(hasPaintedContent);
-    if (m_foregroundLayer)
-        m_foregroundLayer->setDrawsContent(hasPaintedContent);
-
-    if (m_backgroundLayer)
-        m_backgroundLayer->setDrawsContent(hasPaintedContent);
-}
-
-// Return true if the layers changed.
-bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip)
-{
-    bool layersChanged = false;
-
-    if (needsAncestorClip) {
-        if (!m_ancestorClippingLayer) {
-            m_ancestorClippingLayer = createGraphicsLayer(CompositingReasonLayerForClip);
-            m_ancestorClippingLayer->setMasksToBounds(true);
-            layersChanged = true;
-        }
-    } else if (m_ancestorClippingLayer) {
-        m_ancestorClippingLayer->removeFromParent();
-        m_ancestorClippingLayer = nullptr;
-        layersChanged = true;
-    }
-
-    if (needsDescendantClip) {
-        // We don't need a child containment layer if we're the main frame render view
-        // layer. It's redundant as the frame clip above us will handle this clipping.
-        if (!m_childContainmentLayer && !m_isMainFrameRenderViewLayer) {
-            m_childContainmentLayer = createGraphicsLayer(CompositingReasonLayerForClip);
-            m_childContainmentLayer->setMasksToBounds(true);
-            layersChanged = true;
-        }
-    } else if (hasClippingLayer()) {
-        m_childContainmentLayer->removeFromParent();
-        m_childContainmentLayer = nullptr;
-        layersChanged = true;
-    }
-
-    return layersChanged;
-}
-
-void RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground(bool backgroundLayerPaintsFixedRootBackground)
-{
-    m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootBackground;
-}
-
-bool RenderLayerBacking::updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer)
-{
-    bool horizontalScrollbarLayerChanged = false;
-    if (needsHorizontalScrollbarLayer) {
-        if (!m_layerForHorizontalScrollbar) {
-            m_layerForHorizontalScrollbar = createGraphicsLayer(CompositingReasonLayerForScrollbar);
-            horizontalScrollbarLayerChanged = true;
-        }
-    } else if (m_layerForHorizontalScrollbar) {
-        m_layerForHorizontalScrollbar = nullptr;
-        horizontalScrollbarLayerChanged = true;
-    }
-
-    bool verticalScrollbarLayerChanged = false;
-    if (needsVerticalScrollbarLayer) {
-        if (!m_layerForVerticalScrollbar) {
-            m_layerForVerticalScrollbar = createGraphicsLayer(CompositingReasonLayerForScrollbar);
-            verticalScrollbarLayerChanged = true;
-        }
-    } else if (m_layerForVerticalScrollbar) {
-        m_layerForVerticalScrollbar = nullptr;
-        verticalScrollbarLayerChanged = true;
-    }
-
-    bool scrollCornerLayerChanged = false;
-    if (needsScrollCornerLayer) {
-        if (!m_layerForScrollCorner) {
-            m_layerForScrollCorner = createGraphicsLayer(CompositingReasonLayerForScrollbar);
-            scrollCornerLayerChanged = true;
-        }
-    } else if (m_layerForScrollCorner) {
-        m_layerForScrollCorner = nullptr;
-        scrollCornerLayerChanged = true;
-    }
-
-    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
-        if (horizontalScrollbarLayerChanged)
-            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer->scrollableArea(), HorizontalScrollbar);
-        if (verticalScrollbarLayerChanged)
-            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer->scrollableArea(), VerticalScrollbar);
-    }
-
-    return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || scrollCornerLayerChanged;
-}
-
-void RenderLayerBacking::positionOverflowControlsLayers(const IntSize& offsetFromRoot)
-{
-    IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer();
-    if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
-        Scrollbar* hBar = m_owningLayer->horizontalScrollbar();
-        if (hBar) {
-            layer->setPosition(hBar->frameRect().location() - offsetFromRoot - offsetFromRenderer);
-            layer->setSize(hBar->frameRect().size());
-            if (layer->hasContentsLayer())
-                layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().size()));
-        }
-        layer->setDrawsContent(hBar && !layer->hasContentsLayer());
-    }
-
-    if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
-        Scrollbar* vBar = m_owningLayer->verticalScrollbar();
-        if (vBar) {
-            layer->setPosition(vBar->frameRect().location() - offsetFromRoot - offsetFromRenderer);
-            layer->setSize(vBar->frameRect().size());
-            if (layer->hasContentsLayer())
-                layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().size()));
-        }
-        layer->setDrawsContent(vBar && !layer->hasContentsLayer());
-    }
-
-    if (GraphicsLayer* layer = layerForScrollCorner()) {
-        const LayoutRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect();
-        layer->setPosition(scrollCornerAndResizer.location() - offsetFromRenderer);
-        layer->setSize(scrollCornerAndResizer.size());
-        layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
-    }
-}
-
-bool RenderLayerBacking::hasUnpositionedOverflowControlsLayers() const
-{
-    if (GraphicsLayer* layer = layerForHorizontalScrollbar())
-        if (!layer->drawsContent())
-            return true;
-
-    if (GraphicsLayer* layer = layerForVerticalScrollbar())
-        if (!layer->drawsContent())
-            return true;
-
-    if (GraphicsLayer* layer = layerForScrollCorner())
-        if (!layer->drawsContent())
-            return true;
-
-    return false;
-}
-
-bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer)
-{
-    bool layerChanged = false;
-    if (needsForegroundLayer) {
-        if (!m_foregroundLayer) {
-            m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForForeground);
-            m_foregroundLayer->setDrawsContent(true);
-            m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
-            layerChanged = true;
-        }
-    } else if (m_foregroundLayer) {
-        m_foregroundLayer->removeFromParent();
-        m_foregroundLayer = nullptr;
-        layerChanged = true;
-    }
-
-    if (layerChanged)
-        m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
-
-    return layerChanged;
-}
-
-bool RenderLayerBacking::updateBackgroundLayer(bool needsBackgroundLayer)
-{
-    bool layerChanged = false;
-    if (needsBackgroundLayer) {
-        if (!m_backgroundLayer) {
-            m_backgroundLayer = createGraphicsLayer(CompositingReasonLayerForBackground);
-            m_backgroundLayer->setDrawsContent(true);
-            m_backgroundLayer->setAnchorPoint(FloatPoint3D());
-            m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground);
-#if !OS(ANDROID)
-            m_backgroundLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true);
-            m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(false);
-#endif
-            layerChanged = true;
-        }
-    } else {
-        if (m_backgroundLayer) {
-            m_backgroundLayer->removeFromParent();
-            m_backgroundLayer = nullptr;
-#if !OS(ANDROID)
-            m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true);
-#endif
-            layerChanged = true;
-        }
-    }
-
-    if (layerChanged && !m_owningLayer->renderer()->documentBeingDestroyed())
-        compositor()->rootFixedBackgroundsChanged();
-
-    return layerChanged;
-}
-
-bool RenderLayerBacking::updateMaskLayer(bool needsMaskLayer)
-{
-    bool layerChanged = false;
-    if (needsMaskLayer) {
-        if (!m_maskLayer) {
-            m_maskLayer = createGraphicsLayer(CompositingReasonLayerForMask);
-            m_maskLayer->setDrawsContent(true);
-            m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask);
-            layerChanged = true;
-        }
-    } else if (m_maskLayer) {
-        m_maskLayer = nullptr;
-        layerChanged = true;
-    }
-
-    if (layerChanged)
-        m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
-
-    return layerChanged;
-}
-
-bool RenderLayerBacking::updateClippingMaskLayers(bool needsChildClippingMaskLayer)
-{
-    bool layerChanged = false;
-    if (needsChildClippingMaskLayer) {
-        if (!m_childClippingMaskLayer) {
-            m_childClippingMaskLayer = createGraphicsLayer(CompositingReasonLayerForMask);
-            m_childClippingMaskLayer->setDrawsContent(true);
-            m_childClippingMaskLayer->setPaintingPhase(GraphicsLayerPaintChildClippingMask);
-            layerChanged = true;
-        }
-    } else if (m_childClippingMaskLayer) {
-        m_childClippingMaskLayer = nullptr;
-        layerChanged = true;
-    }
-    return layerChanged;
-}
-
-bool RenderLayerBacking::updateScrollingLayers(bool needsScrollingLayers)
-{
-    ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer);
-
-    bool layerChanged = false;
-    if (needsScrollingLayers) {
-        if (!m_scrollingLayer) {
-            // Outer layer which corresponds with the scroll view.
-            m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForClip);
-            m_scrollingLayer->setDrawsContent(false);
-            m_scrollingLayer->setMasksToBounds(true);
-
-            // Inner layer which renders the content that scrolls.
-            m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLayerForScrollingContainer);
-            m_scrollingContentsLayer->setDrawsContent(true);
-            GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowContents | GraphicsLayerPaintCompositedScroll;
-            if (!m_foregroundLayer)
-                paintPhase |= GraphicsLayerPaintForeground;
-            m_scrollingContentsLayer->setPaintingPhase(paintPhase);
-            m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
-
-            layerChanged = true;
-            if (scrollingCoordinator)
-                scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLayer->scrollableArea());
-        }
-    } else if (m_scrollingLayer) {
-        m_scrollingLayer = nullptr;
-        m_scrollingContentsLayer = nullptr;
-        layerChanged = true;
-        if (scrollingCoordinator)
-            scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLayer->scrollableArea());
-    }
-
-    if (layerChanged) {
-        updateInternalHierarchy();
-        m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
-        m_graphicsLayer->setNeedsDisplay();
-        if (renderer()->view())
-            compositor()->scrollingLayerDidChange(m_owningLayer);
-    }
-
-    return layerChanged;
-}
-
-void RenderLayerBacking::updateScrollParent(RenderLayer* scrollParent)
-{
-    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
-        if (m_ancestorClippingLayer) {
-            ASSERT(childForSuperlayers() == m_ancestorClippingLayer.get());
-            // If we have an ancestor clipping layer, it is the scroll child. The other layer that may have
-            // been the scroll child is the graphics layer. We will ensure that we clear its association
-            // with a scroll parent if it had one.
-            scrollingCoordinator->updateScrollParentForGraphicsLayer(m_ancestorClippingLayer.get(), scrollParent);
-            scrollingCoordinator->updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), 0);
-        } else {
-            ASSERT(childForSuperlayers() == m_graphicsLayer.get());
-            scrollingCoordinator->updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), scrollParent);
-        }
-    }
-}
-
-void RenderLayerBacking::updateClipParent(RenderLayer* clipParent)
-{
-    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer))
-        scrollingCoordinator->updateClipParentForGraphicsLayer(m_graphicsLayer.get(), clipParent);
-}
-
-GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() const
-{
-    unsigned phase = 0;
-    if (!m_backgroundLayer)
-        phase |= GraphicsLayerPaintBackground;
-    if (!m_foregroundLayer)
-        phase |= GraphicsLayerPaintForeground;
-    if (!m_maskLayer)
-        phase |= GraphicsLayerPaintMask;
-
-    if (m_scrollingContentsLayer) {
-        phase &= ~GraphicsLayerPaintForeground;
-        phase |= GraphicsLayerPaintCompositedScroll;
-    }
-
-    if (m_owningLayer->compositingReasons() & CompositingReasonOverflowScrollingParent)
-        phase |= GraphicsLayerPaintCompositedScroll;
-
-    return static_cast<GraphicsLayerPaintingPhase>(phase);
-}
-
-float RenderLayerBacking::compositingOpacity(float rendererOpacity) const
-{
-    float finalOpacity = rendererOpacity;
-
-    for (RenderLayer* curr = m_owningLayer->parent(); curr; curr = curr->parent()) {
-        // We only care about parents that are stacking contexts.
-        // Recall that opacity creates stacking context.
-        if (!curr->isStackingContainer())
-            continue;
-
-        // If we found a compositing layer, we want to compute opacity
-        // relative to it. So we can break here.
-        if (curr->isComposited())
-            break;
-
-        finalOpacity *= curr->renderer()->opacity();
-    }
-
-    return finalOpacity;
-}
-
-Color RenderLayerBacking::rendererBackgroundColor() const
-{
-    RenderObject* backgroundRenderer = renderer();
-    if (backgroundRenderer->isRoot())
-        backgroundRenderer = backgroundRenderer->rendererForRootBackground();
-
-    return backgroundRenderer->resolveColor(CSSPropertyBackgroundColor);
-}
-
-void RenderLayerBacking::updateBackgroundColor(bool isSimpleContainer)
-{
-    Color backgroundColor = rendererBackgroundColor();
-    if (isSimpleContainer) {
-        m_graphicsLayer->setContentsToSolidColor(backgroundColor);
-        m_graphicsLayer->setBackgroundColor(Color());
-    } else {
-        // An unset (invalid) color will remove the solid color.
-        m_graphicsLayer->setContentsToSolidColor(Color());
-        m_graphicsLayer->setBackgroundColor(backgroundColor);
-    }
-}
-
-static bool supportsDirectBoxDecorationsComposition(const RenderObject* renderer)
-{
-    if (!GraphicsLayer::supportsBackgroundColorContent())
-        return false;
-
-    if (renderer->hasClip())
-        return false;
-
-    if (hasBoxDecorationsOrBackgroundImage(renderer->style()))
-        return false;
-
-    // FIXME: we should be able to allow backgroundComposite; However since this is not a common use case it has been deferred for now.
-    if (renderer->style()->backgroundComposite() != CompositeSourceOver)
-        return false;
-
-    if (renderer->style()->backgroundClip() == TextFillBox)
-        return false;
-
-    return true;
-}
-
-bool RenderLayerBacking::paintsBoxDecorations() const
-{
-    if (!m_owningLayer->hasVisibleBoxDecorations())
-        return false;
-
-    if (!supportsDirectBoxDecorationsComposition(renderer()))
-        return true;
-
-    return false;
-}
-
-bool RenderLayerBacking::paintsChildren() const
-{
-    if (m_owningLayer->hasVisibleContent() && m_owningLayer->hasNonEmptyChildRenderers())
-        return true;
-
-    if (hasVisibleNonCompositingDescendantLayers())
-        return true;
-
-    return false;
-}
-
-static bool isCompositedPlugin(RenderObject* renderer)
-{
-    return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing();
-}
-
-// A "simple container layer" is a RenderLayer which has no visible content to render.
-// It may have no children, or all its children may be themselves composited.
-// This is a useful optimization, because it allows us to avoid allocating backing store.
-bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
-{
-    RenderObject* renderObject = renderer();
-    if (renderObject->hasMask()) // masks require special treatment
-        return false;
-
-    if (renderObject->isReplaced() && !isCompositedPlugin(renderObject))
-        return false;
-
-    if (paintsBoxDecorations() || paintsChildren())
-        return false;
-
-    if (renderObject->isRenderRegion())
-        return false;
-
-    if (renderObject->node() && renderObject->node()->isDocumentNode()) {
-        // Look to see if the root object has a non-simple background
-        RenderObject* rootObject = renderObject->document().documentElement() ? renderObject->document().documentElement()->renderer() : 0;
-        if (!rootObject)
-            return false;
-
-        RenderStyle* style = rootObject->style();
-
-        // Reject anything that has a border, a border-radius or outline,
-        // or is not a simple background (no background, or solid color).
-        if (hasBoxDecorationsOrBackgroundImage(style))
-            return false;
-
-        // Now look at the body's renderer.
-        HTMLElement* body = renderObject->document().body();
-        RenderObject* bodyObject = (body && body->hasLocalName(bodyTag)) ? body->renderer() : 0;
-        if (!bodyObject)
-            return false;
-
-        style = bodyObject->style();
-
-        if (hasBoxDecorationsOrBackgroundImage(style))
-            return false;
-    }
-
-    return true;
-}
-
-static bool hasVisibleNonCompositingDescendant(RenderLayer* parent)
-{
-    // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512.
-    parent->updateLayerListsIfNeeded();
-
-#if !ASSERT_DISABLED
-    LayerListMutationDetector mutationChecker(parent);
-#endif
-
-    if (Vector<RenderLayer*>* normalFlowList = parent->normalFlowList()) {
-        size_t listSize = normalFlowList->size();
-        for (size_t i = 0; i < listSize; ++i) {
-            RenderLayer* curLayer = normalFlowList->at(i);
-            if (!curLayer->isComposited()
-                && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
-                return true;
-        }
-    }
-
-    if (parent->isStackingContainer()) {
-        if (!parent->hasVisibleDescendant())
-            return false;
-
-        // Use the m_hasCompositingDescendant bit to optimize?
-        if (Vector<RenderLayer*>* negZOrderList = parent->negZOrderList()) {
-            size_t listSize = negZOrderList->size();
-            for (size_t i = 0; i < listSize; ++i) {
-                RenderLayer* curLayer = negZOrderList->at(i);
-                if (!curLayer->isComposited()
-                    && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
-                    return true;
-            }
-        }
-
-        if (Vector<RenderLayer*>* posZOrderList = parent->posZOrderList()) {
-            size_t listSize = posZOrderList->size();
-            for (size_t i = 0; i < listSize; ++i) {
-                RenderLayer* curLayer = posZOrderList->at(i);
-                if (!curLayer->isComposited()
-                    && (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer)))
-                    return true;
-            }
-        }
-    }
-
-    return false;
-}
-
-// Conservative test for having no rendered children.
-bool RenderLayerBacking::hasVisibleNonCompositingDescendantLayers() const
-{
-    return hasVisibleNonCompositingDescendant(m_owningLayer);
-}
-
-bool RenderLayerBacking::containsPaintedContent(bool isSimpleContainer) const
-{
-    if (isSimpleContainer || paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owningLayer->isReflection())
-        return false;
-
-    if (isDirectlyCompositedImage())
-        return false;
-
-    // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely,
-    // and set background color on the layer in that case, instead of allocating backing store and painting.
-    if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo())
-        return m_owningLayer->hasBoxDecorationsOrBackground();
-
-    return true;
-}
-
-// An image can be directly compositing if it's the sole content of the layer, and has no box decorations
-// that require painting. Direct compositing saves backing store.
-bool RenderLayerBacking::isDirectlyCompositedImage() const
-{
-    RenderObject* renderObject = renderer();
-
-    if (!renderObject->isImage() || m_owningLayer->hasBoxDecorationsOrBackground() || renderObject->hasClip())
-        return false;
-
-    RenderImage* imageRenderer = toRenderImage(renderObject);
-    if (ImageResource* cachedImage = imageRenderer->cachedImage()) {
-        if (!cachedImage->hasImage())
-            return false;
-
-        Image* image = cachedImage->imageForRenderer(imageRenderer);
-        if (!image->isBitmapImage())
-            return false;
-
-        return m_graphicsLayer->shouldDirectlyCompositeImage(image);
-    }
-
-    return false;
-}
-
-void RenderLayerBacking::contentChanged(ContentChangeType changeType)
-{
-    if ((changeType == ImageChanged) && isDirectlyCompositedImage()) {
-        updateImageContents();
-        return;
-    }
-
-    if ((changeType == MaskImageChanged) && m_maskLayer) {
-        // The composited layer bounds relies on box->maskClipRect(), which changes
-        // when the mask image becomes available.
-        updateAfterLayout(CompositingChildrenOnly | IsUpdateRoot);
-    }
-
-    if ((changeType == CanvasChanged || changeType == CanvasPixelsChanged) && isAcceleratedCanvas(renderer())) {
-        m_graphicsLayer->setContentsNeedsDisplay();
-        return;
-    }
-}
-
-void RenderLayerBacking::updateImageContents()
-{
-    ASSERT(renderer()->isImage());
-    RenderImage* imageRenderer = toRenderImage(renderer());
-
-    ImageResource* cachedImage = imageRenderer->cachedImage();
-    if (!cachedImage)
-        return;
-
-    Image* image = cachedImage->imageForRenderer(imageRenderer);
-    if (!image)
-        return;
-
-    // We have to wait until the image is fully loaded before setting it on the layer.
-    if (!cachedImage->isLoaded())
-        return;
-
-    // This is a no-op if the layer doesn't have an inner layer for the image.
-    m_graphicsLayer->setContentsToImage(image);
-    bool isSimpleContainer = false;
-    updateDrawsContent(isSimpleContainer);
-
-    // Image animation is "lazy", in that it automatically stops unless someone is drawing
-    // the image. So we have to kick the animation each time; this has the downside that the
-    // image will keep animating, even if its layer is not visible.
-    image->startAnimation();
-}
-
-FloatPoint3D RenderLayerBacking::computeTransformOrigin(const IntRect& borderBox) const
-{
-    RenderStyle* style = renderer()->style();
-
-    FloatPoint3D origin;
-    origin.setX(floatValueForLength(style->transformOriginX(), borderBox.width()));
-    origin.setY(floatValueForLength(style->transformOriginY(), borderBox.height()));
-    origin.setZ(style->transformOriginZ());
-
-    return origin;
-}
-
-FloatPoint RenderLayerBacking::computePerspectiveOrigin(const IntRect& borderBox) const
-{
-    RenderStyle* style = renderer()->style();
-
-    float boxWidth = borderBox.width();
-    float boxHeight = borderBox.height();
-
-    FloatPoint origin;
-    origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth));
-    origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight));
-
-    return origin;
-}
-
-// Return the offset from the top-left of this compositing layer at which the renderer's contents are painted.
-IntSize RenderLayerBacking::contentOffsetInCompostingLayer() const
-{
-    return IntSize(-m_compositedBounds.x(), -m_compositedBounds.y());
-}
-
-IntRect RenderLayerBacking::contentsBox() const
-{
-    IntRect contentsBox = contentsRect(renderer());
-    contentsBox.move(contentOffsetInCompostingLayer());
-    return contentsBox;
-}
-
-IntRect RenderLayerBacking::backgroundBox() const
-{
-    IntRect backgroundBox = backgroundRect(renderer());
-    backgroundBox.move(contentOffsetInCompostingLayer());
-    return backgroundBox;
-}
-
-GraphicsLayer* RenderLayerBacking::parentForSublayers() const
-{
-    if (m_scrollingContentsLayer)
-        return m_scrollingContentsLayer.get();
-
-    return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsLayer.get();
-}
-
-GraphicsLayer* RenderLayerBacking::childForSuperlayers() const
-{
-    if (m_ancestorClippingLayer)
-        return m_ancestorClippingLayer.get();
-
-    return m_graphicsLayer.get();
-}
-
-void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking)
-{
-    if (requiresOwnBacking == m_requiresOwnBackingStore)
-        return;
-
-    m_requiresOwnBackingStore = requiresOwnBacking;
-
-    // This affects the answer to paintsIntoCompositedAncestor(), which in turn affects
-    // cached clip rects, so when it changes we have to clear clip rects on descendants.
-    m_owningLayer->clearClipRectsIncludingDescendants(PaintingClipRects);
-    m_owningLayer->computeRepaintRectsIncludingDescendants();
-
-    compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds());
-}
-
-void RenderLayerBacking::setBlendMode(BlendMode)
-{
-}
-
-void RenderLayerBacking::setContentsNeedDisplay()
-{
-    ASSERT(!paintsIntoCompositedAncestor());
-
-    if (m_graphicsLayer && m_graphicsLayer->drawsContent())
-        m_graphicsLayer->setNeedsDisplay();
-
-    if (m_foregroundLayer && m_foregroundLayer->drawsContent())
-        m_foregroundLayer->setNeedsDisplay();
-
-    if (m_backgroundLayer && m_backgroundLayer->drawsContent())
-        m_backgroundLayer->setNeedsDisplay();
-
-    if (m_maskLayer && m_maskLayer->drawsContent())
-        m_maskLayer->setNeedsDisplay();
-
-    if (m_childClippingMaskLayer && m_childClippingMaskLayer->drawsContent())
-        m_childClippingMaskLayer->setNeedsDisplay();
-
-    if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent())
-        m_scrollingContentsLayer->setNeedsDisplay();
-}
-
-// r is in the coordinate space of the layer's render object
-void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r)
-{
-    ASSERT(!paintsIntoCompositedAncestor());
-
-    if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
-        IntRect layerDirtyRect = r;
-        layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer());
-        m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect);
-    }
-
-    if (m_foregroundLayer && m_foregroundLayer->drawsContent()) {
-        IntRect layerDirtyRect = r;
-        layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer());
-        m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect);
-    }
-
-    // FIXME: need to split out repaints for the background.
-    if (m_backgroundLayer && m_backgroundLayer->drawsContent()) {
-        IntRect layerDirtyRect = r;
-        layerDirtyRect.move(-m_backgroundLayer->offsetFromRenderer());
-        m_backgroundLayer->setNeedsDisplayInRect(layerDirtyRect);
-    }
-
-    if (m_maskLayer && m_maskLayer->drawsContent()) {
-        IntRect layerDirtyRect = r;
-        layerDirtyRect.move(-m_maskLayer->offsetFromRenderer());
-        m_maskLayer->setNeedsDisplayInRect(layerDirtyRect);
-    }
-
-    if (m_childClippingMaskLayer && m_childClippingMaskLayer->drawsContent()) {
-        IntRect layerDirtyRect = r;
-        layerDirtyRect.move(-m_childClippingMaskLayer->offsetFromRenderer());
-        m_childClippingMaskLayer->setNeedsDisplayInRect(layerDirtyRect);
-    }
-
-    if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) {
-        IntRect layerDirtyRect = r;
-        layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer());
-        m_scrollingContentsLayer->setNeedsDisplayInRect(layerDirtyRect);
-    }
-}
-
-void RenderLayerBacking::doPaintTask(GraphicsLayerPaintInfo& paintInfo, GraphicsContext* context,
-    const IntRect& clip) // In the coords of rootLayer.
-{
-    if (paintsIntoCompositedAncestor()) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    FontCachePurgePreventer fontCachePurgePreventer;
-
-    RenderLayer::PaintLayerFlags paintFlags = 0;
-    if (paintInfo.paintingPhase & GraphicsLayerPaintBackground)
-        paintFlags |= RenderLayer::PaintLayerPaintingCompositingBackgroundPhase;
-    if (paintInfo.paintingPhase & GraphicsLayerPaintForeground)
-        paintFlags |= RenderLayer::PaintLayerPaintingCompositingForegroundPhase;
-    if (paintInfo.paintingPhase & GraphicsLayerPaintMask)
-        paintFlags |= RenderLayer::PaintLayerPaintingCompositingMaskPhase;
-    if (paintInfo.paintingPhase & GraphicsLayerPaintChildClippingMask)
-        paintFlags |= RenderLayer::PaintLayerPaintingChildClippingMaskPhase;
-    if (paintInfo.paintingPhase & GraphicsLayerPaintOverflowContents)
-        paintFlags |= RenderLayer::PaintLayerPaintingOverflowContents;
-    if (paintInfo.paintingPhase & GraphicsLayerPaintCompositedScroll)
-        paintFlags |= RenderLayer::PaintLayerPaintingCompositingScrollingPhase;
-
-    if (paintInfo.isBackgroundLayer)
-        paintFlags |= (RenderLayer::PaintLayerPaintingRootBackgroundOnly | RenderLayer::PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhase to walk child layers.
-    else if (compositor()->fixedRootBackgroundLayer())
-        paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground;
-
-    InspectorInstrumentation::willPaint(paintInfo.renderLayer->renderer());
-
-    // Note carefully: in theory it is appropriate to invoke context->save() here
-    // and restore the context after painting. For efficiency, we are assuming that
-    // it is equivalent to manually undo this offset translation, which means we are
-    // assuming that the context's space was not affected by the RenderLayer
-    // painting code.
-
-    LayoutSize offset = paintInfo.offsetFromRenderer;
-    context->translate(-offset);
-    LayoutRect relativeClip(clip);
-    relativeClip.move(offset);
-
-    // The dirtyRect is in the coords of the painting root.
-    IntRect dirtyRect = pixelSnappedIntRect(relativeClip);
-    if (!(paintInfo.paintingPhase & GraphicsLayerPaintOverflowContents))
-        dirtyRect.intersect(paintInfo.compositedBounds);
-
-#ifndef NDEBUG
-    paintInfo.renderLayer->renderer()->assertSubtreeIsLaidOut();
-#endif
-
-    // FIXME: GraphicsLayers need a way to split for RenderRegions.
-    RenderLayer::LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBehaviorNormal, LayoutSize());
-    paintInfo.renderLayer->paintLayerContents(context, paintingInfo, paintFlags);
-
-    ASSERT(!paintInfo.isBackgroundLayer || paintFlags & RenderLayer::PaintLayerPaintingRootBackgroundOnly);
-
-    if (paintInfo.renderLayer->containsDirtyOverlayScrollbars())
-        paintInfo.renderLayer->paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerPaintingOverlayScrollbars);
-
-    ASSERT(!paintInfo.renderLayer->m_usedTransparency);
-
-    // Manually restore the context to its original state by applying the opposite translation.
-    context->translate(offset);
-
-    InspectorInstrumentation::didPaint(paintInfo.renderLayer->renderer(), context, clip);
-}
-
-static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
-{
-    if (!scrollbar)
-        return;
-
-    context.save();
-    const IntRect& scrollbarRect = scrollbar->frameRect();
-    context.translate(-scrollbarRect.x(), -scrollbarRect.y());
-    IntRect transformedClip = clip;
-    transformedClip.moveBy(scrollbarRect.location());
-    scrollbar->paint(&context, transformedClip);
-    context.restore();
-}
-
-// Up-call from compositing layer drawing callback.
-void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip)
-{
-#ifndef NDEBUG
-    if (Page* page = renderer()->frame()->page())
-        page->setIsPainting(true);
-#endif
-
-    if (graphicsLayer == m_graphicsLayer.get()
-        || graphicsLayer == m_foregroundLayer.get()
-        || graphicsLayer == m_backgroundLayer.get()
-        || graphicsLayer == m_maskLayer.get()
-        || graphicsLayer == m_childClippingMaskLayer.get()
-        || graphicsLayer == m_scrollingContentsLayer.get()) {
-
-        GraphicsLayerPaintInfo paintInfo;
-        paintInfo.renderLayer = m_owningLayer;
-        paintInfo.compositedBounds = compositedBounds();
-        paintInfo.offsetFromRenderer = graphicsLayer->offsetFromRenderer();
-        paintInfo.paintingPhase = paintingPhase;
-        paintInfo.isBackgroundLayer = (graphicsLayer == m_backgroundLayer);
-
-        // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
-        doPaintTask(paintInfo, &context, clip);
-    } else if (graphicsLayer == layerForHorizontalScrollbar()) {
-        paintScrollbar(m_owningLayer->horizontalScrollbar(), context, clip);
-    } else if (graphicsLayer == layerForVerticalScrollbar()) {
-        paintScrollbar(m_owningLayer->verticalScrollbar(), context, clip);
-    } else if (graphicsLayer == layerForScrollCorner()) {
-        const IntRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect();
-        context.save();
-        context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y());
-        IntRect transformedClip = clip;
-        transformedClip.moveBy(scrollCornerAndResizer.location());
-        m_owningLayer->paintScrollCorner(&context, IntPoint(), transformedClip);
-        m_owningLayer->paintResizer(&context, IntPoint(), transformedClip);
-        context.restore();
-    }
-#ifndef NDEBUG
-    if (Page* page = renderer()->frame()->page())
-        page->setIsPainting(false);
-#endif
-}
-
-void RenderLayerBacking::didCommitChangesForLayer(const GraphicsLayer* layer) const
-{
-}
-
-bool RenderLayerBacking::getCurrentTransform(const GraphicsLayer* graphicsLayer, TransformationMatrix& transform) const
-{
-    if (graphicsLayer != m_graphicsLayer.get())
-        return false;
-
-    if (m_owningLayer->hasTransform()) {
-        transform = m_owningLayer->currentTransform(RenderStyle::ExcludeTransformOrigin);
-        return true;
-    }
-    return false;
-}
-
-bool RenderLayerBacking::isTrackingRepaints() const
-{
-    GraphicsLayerClient* client = compositor();
-    return client ? client->isTrackingRepaints() : false;
-}
-
-#ifndef NDEBUG
-void RenderLayerBacking::verifyNotPainting()
-{
-    ASSERT(!renderer()->frame()->page() || !renderer()->frame()->page()->isPainting());
-}
-#endif
-
-bool RenderLayerBacking::startAnimation(double timeOffset, const CSSAnimationData* anim, const KeyframeList& keyframes)
-{
-    bool hasTransform = renderer()->isBox() && keyframes.containsProperty(CSSPropertyWebkitTransform);
-    IntSize boxSize;
-    if (hasTransform)
-        boxSize = toRenderBox(renderer())->pixelSnappedBorderBoxRect().size();
-    WebAnimations animations(m_animationProvider->startAnimation(timeOffset, anim, keyframes, hasTransform, boxSize));
-    if (animations.isEmpty())
-        return false;
-
-    bool hasOpacity = keyframes.containsProperty(CSSPropertyOpacity);
-    bool hasFilter = keyframes.containsProperty(CSSPropertyWebkitFilter);
-    int animationId = m_animationProvider->getWebAnimationId(keyframes.animationName());
-
-    // Animating only some properties of the animation is not supported. So if the
-    // GraphicsLayer rejects any property of the animation, we have to remove the
-    // animation and return false to indicate un-accelerated animation is required.
-    if (hasTransform) {
-        if (!animations.m_transformAnimation || !m_graphicsLayer->addAnimation(animations.m_transformAnimation.get()))
-            return false;
-    }
-    if (hasOpacity) {
-        if (!animations.m_opacityAnimation || !m_graphicsLayer->addAnimation(animations.m_opacityAnimation.get())) {
-            if (hasTransform)
-                m_graphicsLayer->removeAnimation(animationId);
-            return false;
-        }
-    }
-    if (hasFilter) {
-        if (!animations.m_filterAnimation || !m_graphicsLayer->addAnimation(animations.m_filterAnimation.get())) {
-            if (hasTransform || hasOpacity)
-                m_graphicsLayer->removeAnimation(animationId);
-            return false;
-        }
-    }
-    return true;
-}
-
-void RenderLayerBacking::animationPaused(double timeOffset, const String& animationName)
-{
-    int animationId = m_animationProvider->getWebAnimationId(animationName);
-    if (animationId)
-        m_graphicsLayer->pauseAnimation(animationId, timeOffset);
-}
-
-void RenderLayerBacking::animationFinished(const String& animationName)
-{
-    int animationId = m_animationProvider->getWebAnimationId(animationName);
-    if (animationId)
-        m_graphicsLayer->removeAnimation(animationId);
-}
-
-bool RenderLayerBacking::startTransition(double timeOffset, CSSPropertyID property, const RenderStyle* fromStyle, const RenderStyle* toStyle)
-{
-    ASSERT(property != CSSPropertyInvalid);
-    IntSize boxSize;
-    if (property == CSSPropertyWebkitTransform && m_owningLayer->hasTransform()) {
-        ASSERT(renderer()->isBox());
-        boxSize = toRenderBox(renderer())->pixelSnappedBorderBoxRect().size();
-    }
-    float fromOpacity = 0;
-    float toOpacity = 0;
-    if (property == CSSPropertyOpacity) {
-        fromOpacity = compositingOpacity(fromStyle->opacity());
-        toOpacity = compositingOpacity(toStyle->opacity());
-    }
-    WebAnimations animations(m_animationProvider->startTransition(timeOffset, property, fromStyle,
-        toStyle, m_owningLayer->hasTransform(), m_owningLayer->hasFilter(), boxSize, fromOpacity, toOpacity));
-    bool didAnimate = false;
-    if (animations.m_transformAnimation && m_graphicsLayer->addAnimation(animations.m_transformAnimation.get())) {
-        // To ensure that the correct transform is visible when the animation ends, also set the final transform.
-        updateTransform(toStyle);
-        didAnimate = true;
-    }
-    if (animations.m_opacityAnimation && m_graphicsLayer->addAnimation(animations.m_opacityAnimation.get())) {
-        // To ensure that the correct opacity is visible when the animation ends, also set the final opacity.
-        updateOpacity(toStyle);
-        didAnimate = true;
-    }
-    if (animations.m_filterAnimation && m_graphicsLayer->addAnimation(animations.m_filterAnimation.get())) {
-        // To ensure that the correct filter is visible when the animation ends, also set the final filter.
-        updateFilters(toStyle);
-        didAnimate = true;
-    }
-
-    return didAnimate;
-}
-
-void RenderLayerBacking::transitionPaused(double timeOffset, CSSPropertyID property)
-{
-    int animationId = m_animationProvider->getWebAnimationId(property);
-    if (animationId)
-        m_graphicsLayer->pauseAnimation(animationId, timeOffset);
-}
-
-void RenderLayerBacking::transitionFinished(CSSPropertyID property)
-{
-    int animationId = m_animationProvider->getWebAnimationId(property);
-    if (animationId)
-        m_graphicsLayer->removeAnimation(animationId);
-}
-
-void RenderLayerBacking::notifyAnimationStarted(const GraphicsLayer*, double time)
-{
-    renderer()->animation()->notifyAnimationStarted(renderer(), time);
-}
-
-// This is used for the 'freeze' API, for testing only.
-void RenderLayerBacking::suspendAnimations(double time)
-{
-    m_graphicsLayer->suspendAnimations(time);
-}
-
-void RenderLayerBacking::resumeAnimations()
-{
-    m_graphicsLayer->resumeAnimations();
-}
-
-IntRect RenderLayerBacking::compositedBounds() const
-{
-    return m_compositedBounds;
-}
-
-void RenderLayerBacking::setCompositedBounds(const IntRect& bounds)
-{
-    m_compositedBounds = bounds;
-}
-
-CompositingLayerType RenderLayerBacking::compositingLayerType() const
-{
-    if (m_graphicsLayer->hasContentsLayer())
-        return MediaCompositingLayer;
-
-    if (m_graphicsLayer->drawsContent())
-        return NormalCompositingLayer;
-
-    return ContainerCompositingLayer;
-}
-
-double RenderLayerBacking::backingStoreMemoryEstimate() const
-{
-    double backingMemory;
-
-    // m_ancestorClippingLayer and m_childContainmentLayer are just used for masking or containment, so have no backing.
-    backingMemory = m_graphicsLayer->backingStoreMemoryEstimate();
-    if (m_foregroundLayer)
-        backingMemory += m_foregroundLayer->backingStoreMemoryEstimate();
-    if (m_backgroundLayer)
-        backingMemory += m_backgroundLayer->backingStoreMemoryEstimate();
-    if (m_maskLayer)
-        backingMemory += m_maskLayer->backingStoreMemoryEstimate();
-    if (m_childClippingMaskLayer)
-        backingMemory += m_childClippingMaskLayer->backingStoreMemoryEstimate();
-
-    if (m_scrollingContentsLayer)
-        backingMemory += m_scrollingContentsLayer->backingStoreMemoryEstimate();
-
-    if (m_layerForHorizontalScrollbar)
-        backingMemory += m_layerForHorizontalScrollbar->backingStoreMemoryEstimate();
-
-    if (m_layerForVerticalScrollbar)
-        backingMemory += m_layerForVerticalScrollbar->backingStoreMemoryEstimate();
-
-    if (m_layerForScrollCorner)
-        backingMemory += m_layerForScrollCorner->backingStoreMemoryEstimate();
-
-    return backingMemory;
-}
-
-String RenderLayerBacking::debugName(const GraphicsLayer* graphicsLayer)
-{
-    String name;
-    if (graphicsLayer == m_graphicsLayer.get()) {
-        name = m_owningLayer->debugName();
-    } else if (graphicsLayer == m_ancestorClippingLayer.get()) {
-        name = "Ancestor Clipping Layer";
-    } else if (graphicsLayer == m_foregroundLayer.get()) {
-        name = m_owningLayer->debugName() + " (foreground) Layer";
-    } else if (graphicsLayer == m_backgroundLayer.get()) {
-        name = m_owningLayer->debugName() + " (background) Layer";
-    } else if (graphicsLayer == m_childContainmentLayer.get()) {
-        name = "Child Containment Layer";
-    } else if (graphicsLayer == m_maskLayer.get()) {
-        name = "Mask Layer";
-    } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
-        name = "Horizontal Scrollbar Layer";
-    } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
-        name = "Vertical Scrollbar Layer";
-    } else if (graphicsLayer == m_layerForScrollCorner.get()) {
-        name = "Scroll Corner Layer";
-    } else if (graphicsLayer == m_scrollingLayer.get()) {
-        name = "Scrolling Layer";
-    } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
-        name = "Scrolling Contents Layer";
-    } else {
-        ASSERT_NOT_REACHED();
-    }
-
-    return name;
-}
-
-} // namespace WebCore
diff --git a/Source/core/rendering/RenderLayerBacking.h b/Source/core/rendering/RenderLayerBacking.h
deleted file mode 100644
index a20c9af..0000000
--- a/Source/core/rendering/RenderLayerBacking.h
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright (C) 2009, 2010, 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 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,
- * 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 RenderLayerBacking_h
-#define RenderLayerBacking_h
-
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatPoint3D.h"
-#include "core/platform/graphics/GraphicsLayer.h"
-#include "core/platform/graphics/GraphicsLayerClient.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
-#include "core/rendering/RenderLayer.h"
-
-namespace WebCore {
-
-class KeyframeList;
-class RenderLayerCompositor;
-class WebAnimationProvider;
-
-enum CompositingLayerType {
-    NormalCompositingLayer, // non-tiled layer with backing store
-    MediaCompositingLayer, // layer that contains an image, video, webGL or plugin
-    ContainerCompositingLayer // layer with no backing store
-};
-
-
-// A GraphicsLayerPaintInfo contains all the info needed to paint a partial subtree of RenderLayers into a GraphicsLayer.
-struct GraphicsLayerPaintInfo {
-    RenderLayer* renderLayer;
-
-    IntRect compositedBounds;
-
-    IntSize offsetFromRenderer;
-
-    GraphicsLayerPaintingPhase paintingPhase;
-
-    bool isBackgroundLayer;
-};
-
-// RenderLayerBacking controls the compositing behavior for a single RenderLayer.
-// It holds the various GraphicsLayers, and makes decisions about intra-layer rendering
-// optimizations.
-//
-// There is one RenderLayerBacking for each RenderLayer that is composited.
-
-class RenderLayerBacking : public GraphicsLayerClient {
-    WTF_MAKE_NONCOPYABLE(RenderLayerBacking); WTF_MAKE_FAST_ALLOCATED;
-public:
-    explicit RenderLayerBacking(RenderLayer*);
-    ~RenderLayerBacking();
-
-    RenderLayer* owningLayer() const { return m_owningLayer; }
-
-    enum UpdateAfterLayoutFlag {
-        CompositingChildrenOnly = 1 << 0,
-        NeedsFullRepaint = 1 << 1,
-        IsUpdateRoot = 1 << 2
-    };
-    typedef unsigned UpdateAfterLayoutFlags;
-    void updateAfterLayout(UpdateAfterLayoutFlags);
-
-    // Returns true if layer configuration changed.
-    bool updateGraphicsLayerConfiguration();
-    // Update graphics layer position and bounds.
-    void updateGraphicsLayerGeometry(); // make private
-    // Update whether layer needs blending.
-    void updateContentsOpaque();
-
-    GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); }
-
-    // Layer to clip children
-    bool hasClippingLayer() const { return m_childContainmentLayer; }
-    GraphicsLayer* clippingLayer() const { return m_childContainmentLayer.get(); }
-
-    // Layer to get clipped by ancestor
-    bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer; }
-    GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer.get(); }
-
-    bool hasContentsLayer() const { return m_foregroundLayer != 0; }
-    GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); }
-
-    GraphicsLayer* backgroundLayer() const { return m_backgroundLayer.get(); }
-    bool backgroundLayerPaintsFixedRootBackground() const { return m_backgroundLayerPaintsFixedRootBackground; }
-
-    bool hasScrollingLayer() const { return m_scrollingLayer; }
-    GraphicsLayer* scrollingLayer() const { return m_scrollingLayer.get(); }
-    GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); }
-
-    bool hasMaskLayer() const { return m_maskLayer != 0; }
-    bool hasChildClippingMaskLayer() const { return m_childClippingMaskLayer; }
-
-    GraphicsLayer* parentForSublayers() const;
-    GraphicsLayer* childForSuperlayers() const;
-
-    // Returns true for a composited layer that has no backing store of its own, so
-    // paints into some ancestor layer.
-    bool paintsIntoCompositedAncestor() const { return !m_requiresOwnBackingStore; }
-
-    void setRequiresOwnBackingStore(bool);
-
-    void setContentsNeedDisplay();
-    // r is in the coordinate space of the layer's render object
-    void setContentsNeedDisplayInRect(const IntRect&);
-
-    // Notification from the renderer that its content changed.
-    void contentChanged(ContentChangeType);
-
-    // Interface to start, finish, suspend and resume animations and transitions
-    bool startTransition(double, CSSPropertyID, const RenderStyle* fromStyle, const RenderStyle* toStyle);
-    void transitionPaused(double timeOffset, CSSPropertyID);
-    void transitionFinished(CSSPropertyID);
-
-    bool startAnimation(double timeOffset, const CSSAnimationData* anim, const KeyframeList& keyframes);
-    void animationPaused(double timeOffset, const String& name);
-    void animationFinished(const String& name);
-
-    void suspendAnimations(double time = 0);
-    void resumeAnimations();
-
-    IntRect compositedBounds() const;
-    void setCompositedBounds(const IntRect&);
-    void updateCompositedBounds();
-
-    void updateAfterWidgetResize();
-    void positionOverflowControlsLayers(const IntSize& offsetFromRoot);
-    bool hasUnpositionedOverflowControlsLayers() const;
-
-    // GraphicsLayerClient interface
-    virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime) OVERRIDE;
-
-    virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip) OVERRIDE;
-
-    virtual void didCommitChangesForLayer(const GraphicsLayer*) const OVERRIDE;
-    virtual bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const OVERRIDE;
-
-    virtual bool isTrackingRepaints() const OVERRIDE;
-
-#ifndef NDEBUG
-    virtual void verifyNotPainting();
-#endif
-
-    IntRect contentsBox() const;
-    IntRect backgroundBox() const;
-
-    // For informative purposes only.
-    CompositingLayerType compositingLayerType() const;
-
-    GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
-    GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
-    GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
-
-    void updateFilters(const RenderStyle*);
-    bool canCompositeFilters() const { return m_canCompositeFilters; }
-
-    // Return an estimate of the backing store area (in pixels) allocated by this object's GraphicsLayers.
-    double backingStoreMemoryEstimate() const;
-
-    void setBlendMode(BlendMode);
-
-    virtual String debugName(const GraphicsLayer*) OVERRIDE;
-
-private:
-    void createPrimaryGraphicsLayer();
-    void destroyGraphicsLayers();
-
-    PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons);
-
-    RenderLayerModelObject* renderer() const { return m_owningLayer->renderer(); }
-    RenderLayerCompositor* compositor() const { return m_owningLayer->compositor(); }
-
-    void updateInternalHierarchy();
-    bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip);
-    bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer);
-    bool updateForegroundLayer(bool needsForegroundLayer);
-    bool updateBackgroundLayer(bool needsBackgroundLayer);
-    bool updateMaskLayer(bool needsMaskLayer);
-    bool updateClippingMaskLayers(bool needsChildClippingMaskLayer);
-    bool requiresHorizontalScrollbarLayer() const { return m_owningLayer->horizontalScrollbar(); }
-    bool requiresVerticalScrollbarLayer() const { return m_owningLayer->verticalScrollbar(); }
-    bool requiresScrollCornerLayer() const { return !m_owningLayer->scrollCornerAndResizerRect().isEmpty(); }
-    bool updateScrollingLayers(bool scrollingLayers);
-    void updateScrollParent(RenderLayer*);
-    void updateClipParent(RenderLayer*);
-    void updateDrawsContent(bool isSimpleContainer);
-    void registerScrollingLayers();
-
-    void setBackgroundLayerPaintsFixedRootBackground(bool);
-
-    GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const;
-
-    IntSize contentOffsetInCompostingLayer() const;
-    // Result is transform origin in pixels.
-    FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;
-    // Result is perspective origin in pixels.
-    FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const;
-
-    void updateOpacity(const RenderStyle*);
-    void updateTransform(const RenderStyle*);
-    void updateLayerBlendMode(const RenderStyle*);
-    // Return the opacity value that this layer should use for compositing.
-    float compositingOpacity(float rendererOpacity) const;
-
-    bool isMainFrameRenderViewLayer() const;
-
-    bool paintsBoxDecorations() const;
-    bool paintsChildren() const;
-
-    // Returns true if this compositing layer has no visible content.
-    bool isSimpleContainerCompositingLayer() const;
-    // Returns true if this layer has content that needs to be rendered by painting into the backing store.
-    bool containsPaintedContent(bool isSimpleContainer) const;
-    // Returns true if the RenderLayer just contains an image that we can composite directly.
-    bool isDirectlyCompositedImage() const;
-    void updateImageContents();
-
-    Color rendererBackgroundColor() const;
-    void updateBackgroundColor(bool isSimpleContainer);
-    void updateContentsRect(bool isSimpleContainer);
-
-    void updateCompositingReasons();
-
-    bool hasVisibleNonCompositingDescendantLayers() const;
-
-    bool shouldClipCompositedBounds() const;
-
-    void doPaintTask(GraphicsLayerPaintInfo&, GraphicsContext*, const IntRect& clip);
-
-    RenderLayer* m_owningLayer;
-
-    // The hierarchy of layers that is maintained by the RenderLayerBacking looks like this:
-    //
-    //  + m_ancestorClippingLayer [OPTIONAL]
-    //     + m_graphicsLayer
-    //        + m_childContainmentLayer [OPTIONAL] <-OR-> m_scrollingLayer [OPTIONAL]
-    //                                                     + m_scrollingContentsLayer [OPTIONAL]
-    //
-    // We need an ancestor clipping layer if our clipping ancestor is not our ancestor in the
-    // clipping tree. Here's what that might look like.
-    //
-    // Let A = the clipping ancestor,
-    //     B = the clip descendant, and
-    //     SC = the stacking context that is the ancestor of A and B in the stacking tree.
-    //
-    // SC
-    //  + A = m_graphicsLayer
-    //  |  + m_childContainmentLayer
-    //  |     + ...
-    //  ...
-    //  |
-    //  + B = m_ancestorClippingLayer [+]
-    //     + m_graphicsLayer
-    //        + ...
-    //
-    // In this case B is clipped by another layer that doesn't happen to be its ancestor: A.
-    // So we create an ancestor clipping layer for B, [+], which ensures that B is clipped
-    // as if it had been A's descendant.
-    OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context.
-    OwnPtr<GraphicsLayer> m_graphicsLayer;
-    OwnPtr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children.
-    OwnPtr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling.
-    OwnPtr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling.
-
-    // This layer is also added to the hierarchy by the RLB, but in a different way than
-    // the layers above. It's added to m_graphicsLayer as its mask layer (naturally) if
-    // we have a mask, and isn't part of the typical hierarchy (it has no children).
-    OwnPtr<GraphicsLayer> m_maskLayer; // Only used if we have a mask.
-    OwnPtr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path.
-
-    // There are two other (optional) layers whose painting is managed by the RenderLayerBacking,
-    // but whose position in the hierarchy is maintained by the RenderLayerCompositor. These
-    // are the foreground and background layers. The foreground layer exists if we have composited
-    // descendants with negative z-order. We need the extra layer in this case because the layer
-    // needs to draw both below (for the background, say) and above (for the normal flow content, say)
-    // the negative z-order descendants and this is impossible with a single layer. The RLC handles
-    // inserting m_foregroundLayer in the correct position in our descendant list for us (right after
-    // the neg z-order dsecendants).
-    //
-    // The background layer is only created if this is the root layer and our background is entirely
-    // fixed. In this case we want to put the background in a separate composited layer so that when
-    // we scroll, we don't have to re-raster the background into position. This layer is also inserted
-    // into the tree by the RLC as it gets a special home. This layer becomes a descendant of the
-    // frame clipping layer. That is:
-    //   ...
-    //     + frame clipping layer
-    //       + m_backgroundLayer
-    //       + frame scrolling layer
-    //         + root content layer
-    //
-    // With the hierarchy set up like this, the root content layer is able to scroll without affecting
-    // the background layer (or repainting).
-    OwnPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately.
-    OwnPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately.
-
-    OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar;
-    OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
-    OwnPtr<GraphicsLayer> m_layerForScrollCorner;
-
-    OwnPtr<WebAnimationProvider> m_animationProvider;
-
-    IntRect m_compositedBounds;
-
-    bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work
-    bool m_boundsConstrainedByClipping;
-    bool m_isMainFrameRenderViewLayer;
-    bool m_requiresOwnBackingStore;
-    bool m_canCompositeFilters;
-    bool m_backgroundLayerPaintsFixedRootBackground;
-};
-
-} // namespace WebCore
-
-#endif // RenderLayerBacking_h
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp
index 3511500..5f622e0 100644
--- a/Source/core/rendering/RenderLayerCompositor.cpp
+++ b/Source/core/rendering/RenderLayerCompositor.cpp
@@ -39,32 +39,31 @@
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/page/animation/AnimationController.h"
+#include "core/frame/animation/AnimationController.h"
 #include "core/page/scrolling/ScrollingConstraints.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
 #include "core/platform/HistogramSupport.h"
-#include "core/platform/Logging.h"
 #include "core/platform/ScrollbarTheme.h"
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/graphics/GraphicsLayer.h"
 #include "core/platform/graphics/GraphicsLayerClient.h"
 #include "core/platform/graphics/transforms/TransformState.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderApplet.h"
 #include "core/rendering/RenderEmbeddedObject.h"
 #include "core/rendering/RenderFullScreen.h"
 #include "core/rendering/RenderGeometryMap.h"
 #include "core/rendering/RenderIFrame.h"
-#include "core/rendering/RenderLayerBacking.h"
 #include "core/rendering/RenderReplica.h"
 #include "core/rendering/RenderVideo.h"
 #include "core/rendering/RenderView.h"
+#include "platform/Logging.h"
+#include "platform/TraceEvent.h"
 #include "wtf/TemporaryChange.h"
-#include "wtf/text/StringBuilder.h"
 
 #if !LOG_DISABLED
 #include "wtf/CurrentTime.h"
@@ -180,8 +179,8 @@
     RenderGeometryMap m_geometryMap;
 };
 
-struct CompositingState {
-    CompositingState(RenderLayer* compAncestor, bool testOverlap)
+struct CompositingRecursionData {
+    CompositingRecursionData(RenderLayer* compAncestor, bool testOverlap)
         : m_compositingAncestor(compAncestor)
         , m_subtreeIsCompositing(false)
         , m_testingOverlap(testOverlap)
@@ -191,7 +190,7 @@
     {
     }
 
-    CompositingState(const CompositingState& other)
+    CompositingRecursionData(const CompositingRecursionData& other)
         : m_compositingAncestor(other.m_compositingAncestor)
         , m_subtreeIsCompositing(other.m_subtreeIsCompositing)
         , m_testingOverlap(other.m_testingOverlap)
@@ -428,7 +427,7 @@
     if (checkForHierarchyUpdate) {
         // Go through the layers in presentation order, so that we can compute which RenderLayers need compositing layers.
         // FIXME: we could maybe do this and the hierarchy udpate in one pass, but the parenting logic would be more complex.
-        CompositingState compState(updateRoot, true);
+        CompositingRecursionData recursionData(updateRoot, true);
         bool layersChanged = false;
         bool saw3DTransform = false;
         {
@@ -440,7 +439,7 @@
             // should be removed as soon as proper overlap testing based on
             // scrolling and animation bounds is implemented (crbug.com/252472).
             Vector<RenderLayer*> unclippedDescendants;
-            computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap, compState, layersChanged, saw3DTransform, unclippedDescendants);
+            computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap, recursionData, layersChanged, saw3DTransform, unclippedDescendants);
         }
         needHierarchyUpdate |= layersChanged;
     }
@@ -470,10 +469,10 @@
             if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMainFrame()) {
                 RenderVideo* video = findFullscreenVideoRenderer(&m_renderView->document());
                 if (video) {
-                    RenderLayerBacking* backing = video->backing();
-                    if (backing) {
+                    CompositedLayerMapping* compositedLayerMapping = video->compositedLayerMapping();
+                    if (compositedLayerMapping) {
                         childList.clear();
-                        childList.append(backing->graphicsLayer());
+                        childList.append(compositedLayerMapping->mainGraphicsLayer());
                     }
                 }
             }
@@ -526,13 +525,13 @@
     if (!compositingLogEnabled())
         return;
 
-    RenderLayerBacking* backing = layer->backing();
+    CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping();
     if (requiresCompositing(directReasonsForCompositing(layer)) || layer->isRootLayer()) {
         ++m_obligateCompositedLayerCount;
-        m_obligatoryBackingStoreBytes += backing->backingStoreMemoryEstimate();
+        m_obligatoryBackingStoreBytes += compositedLayerMapping->backingStoreMemoryEstimate();
     } else {
         ++m_secondaryCompositedLayerCount;
-        m_secondaryBackingStoreBytes += backing->backingStoreMemoryEstimate();
+        m_secondaryBackingStoreBytes += compositedLayerMapping->backingStoreMemoryEstimate();
     }
 
     String layerName;
@@ -540,8 +539,8 @@
     layerName = layer->debugName();
 #endif
 
-    LOG(Compositing, "%*p %dx%d %.2fKB (%s) %s\n", 12 + depth * 2, layer, backing->compositedBounds().width(), backing->compositedBounds().height(),
-        backing->backingStoreMemoryEstimate() / 1024,
+    LOG(Compositing, "%*p %dx%d %.2fKB (%s) %s\n", 12 + depth * 2, layer, compositedLayerMapping->compositedBounds().width(), compositedLayerMapping->compositedBounds().height(),
+        compositedLayerMapping->backingStoreMemoryEstimate() / 1024,
         logReasonsForCompositing(layer), layerName.utf8().data());
 }
 #endif
@@ -556,24 +555,24 @@
     m_outOfFlowPositionedLayers.remove(layer);
 }
 
-bool RenderLayerCompositor::updateBacking(RenderLayer* layer, CompositingChangeRepaint shouldRepaint)
+bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* layer, CompositingChangeRepaint shouldRepaint)
 {
     bool layerChanged = false;
     RenderLayer::ViewportConstrainedNotCompositedReason viewportConstrainedNotCompositedReason = RenderLayer::NoNotCompositedReason;
     requiresCompositingForPosition(layer->renderer(), layer, &viewportConstrainedNotCompositedReason);
 
     // FIXME: It would be nice to directly use the layer's compositing reason,
-    // but updateBacking() also gets called without having updated compositing
+    // but allocateCompositedLayerMappingIfNeeded() also gets called without having updated compositing
     // requirements fully.
     if (needsToBeComposited(layer)) {
         enableCompositingMode();
 
-        if (!layer->backing()) {
-            // If we need to repaint, do so before making backing
+        if (!layer->compositedLayerMapping()) {
+            // If we need to repaint, do so before allocating the compositedLayerMapping
             if (shouldRepaint == CompositingChangeRepaintNow)
                 repaintOnCompositingChange(layer);
 
-            layer->ensureBacking();
+            layer->ensureCompositedLayerMapping();
 
             // At this time, the ScrollingCooridnator only supports the top-level frame.
             if (layer->isRootLayer() && !isMainFrame()) {
@@ -584,33 +583,33 @@
             // This layer and all of its descendants have cached repaints rects that are relative to
             // the repaint container, so change when compositing changes; we need to update them here.
             if (layer->parent())
-                layer->computeRepaintRectsIncludingDescendants();
+                layer->repainter().computeRepaintRectsIncludingDescendants();
 
             layerChanged = true;
         }
     } else {
-        if (layer->backing()) {
-            // If we're removing backing on a reflection, clear the source GraphicsLayer's pointer to
+        if (layer->compositedLayerMapping()) {
+            // If we're removing the compositedLayerMapping from a reflection, clear the source GraphicsLayer's pointer to
             // its replica GraphicsLayer. In practice this should never happen because reflectee and reflection
             // are both either composited, or not composited.
             if (layer->isReflection()) {
                 RenderLayer* sourceLayer = toRenderLayerModelObject(layer->renderer()->parent())->layer();
-                if (RenderLayerBacking* backing = sourceLayer->backing()) {
-                    ASSERT(backing->graphicsLayer()->replicaLayer() == layer->backing()->graphicsLayer());
-                    backing->graphicsLayer()->setReplicatedByLayer(0);
+                if (CompositedLayerMapping* compositedLayerMapping = sourceLayer->compositedLayerMapping()) {
+                    ASSERT(compositedLayerMapping->mainGraphicsLayer()->replicaLayer() == layer->compositedLayerMapping()->mainGraphicsLayer());
+                    compositedLayerMapping->mainGraphicsLayer()->setReplicatedByLayer(0);
                 }
             }
 
             removeViewportConstrainedLayer(layer);
 
-            layer->clearBacking();
+            layer->clearCompositedLayerMapping();
             layerChanged = true;
 
             // This layer and all of its descendants have cached repaints rects that are relative to
             // the repaint container, so change when compositing changes; we need to update them here.
-            layer->computeRepaintRectsIncludingDescendants();
+            layer->repainter().computeRepaintRectsIncludingDescendants();
 
-            // If we need to repaint, do so now that we've removed the backing
+            // If we need to repaint, do so now that we've removed the compositedLayerMapping
             if (shouldRepaint == CompositingChangeRepaintNow)
                 repaintOnCompositingChange(layer);
         }
@@ -625,7 +624,7 @@
     if (layerChanged)
         layer->clearClipRectsIncludingDescendants(PaintingClipRects);
 
-    // If a fixed position layer gained/lost a backing or the reason not compositing it changed,
+    // If a fixed position layer gained/lost a compositedLayerMapping or the reason not compositing it changed,
     // the scrolling coordinator needs to recalculate whether it can do fast scrolling.
     if (layer->renderer()->style()->position() == FixedPosition) {
         if (layer->viewportConstrainedNotCompositedReason() != viewportConstrainedNotCompositedReason) {
@@ -643,11 +642,11 @@
 
 bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer* layer, CompositingChangeRepaint shouldRepaint)
 {
-    bool layerChanged = updateBacking(layer, shouldRepaint);
+    bool layerChanged = allocateOrClearCompositedLayerMapping(layer, shouldRepaint);
 
     // See if we need content or clipping layers. Methods called here should assume
     // that the compositing state of descendant layers has not been updated yet.
-    if (layer->backing() && layer->backing()->updateGraphicsLayerConfiguration())
+    if (layer->compositedLayerMapping() && layer->compositedLayerMapping()->updateGraphicsLayerConfiguration())
         layerChanged = true;
 
     return layerChanged;
@@ -663,7 +662,7 @@
     if (!repaintContainer)
         repaintContainer = m_renderView;
 
-    layer->repaintIncludingNonCompositingDescendants(repaintContainer);
+    layer->repainter().repaintIncludingNonCompositingDescendants(repaintContainer);
 }
 
 // This method assumes that layout is up-to-date, unlike repaintOnCompositingChange().
@@ -671,7 +670,7 @@
 {
     RenderLayer* compositedAncestor = layer->enclosingCompositingLayerForRepaint(false /*exclude self*/);
     if (compositedAncestor) {
-        ASSERT(compositedAncestor->backing());
+        ASSERT(compositedAncestor->compositedLayerMapping());
 
         LayoutPoint offset;
         layer->convertToLayerCoords(compositedAncestor, offset);
@@ -710,7 +709,7 @@
         return;
 
     removeViewportConstrainedLayer(child);
-    repaintInCompositedAncestor(child, child->backing()->compositedBounds());
+    repaintInCompositedAncestor(child, child->compositedLayerMapping()->compositedBounds());
 
     setCompositingParent(child, 0);
     setCompositingLayersNeedRebuild();
@@ -806,7 +805,7 @@
 //      must be compositing so that its contents render over that child.
 //      This implies that its positive z-index children must also be compositing.
 //
-void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer* layer, OverlapMap* overlapMap, CompositingState& compositingState, bool& layersChanged, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants)
+void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer* layer, OverlapMap* overlapMap, CompositingRecursionData& currentRecursionData, bool& layersChanged, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants)
 {
     layer->updateLayerListsIfNeeded();
 
@@ -826,7 +825,7 @@
     // RenderLayer children and whose children can't use its backing to render
     // into. These children (the controls) always need to be promoted into their
     // own layers to draw on top of the accelerated video.
-    if (compositingState.m_compositingAncestor && compositingState.m_compositingAncestor->renderer()->isVideo())
+    if (currentRecursionData.m_compositingAncestor && currentRecursionData.m_compositingAncestor->renderer()->isVideo())
         directReasons |= CompositingReasonLayerForVideoOverlay;
 
     if (canBeComposited(layer)) {
@@ -837,7 +836,7 @@
     // Next, accumulate reasons related to overlap.
     // If overlap testing is used, this reason will be overridden. If overlap testing is not
     // used, we must assume we overlap if there is anything composited behind us in paint-order.
-    CompositingReasons overlapCompositingReason = compositingState.m_subtreeIsCompositing ? CompositingReasonAssumedOverlap : CompositingReasonNone;
+    CompositingReasons overlapCompositingReason = currentRecursionData.m_subtreeIsCompositing ? CompositingReasonAssumedOverlap : CompositingReasonNone;
 
     if (rootRenderLayer()->compositorDrivenAcceleratedScrollingEnabled()) {
         Vector<size_t> unclippedDescendantsToRemove;
@@ -867,7 +866,7 @@
     bool haveComputedBounds = false;
     IntRect absBounds;
     // If we know for sure the layer is going to be composited, don't bother looking it up in the overlap map.
-    if (overlapMap && !overlapMap->isEmpty() && compositingState.m_testingOverlap && !requiresCompositing(directReasons)) {
+    if (overlapMap && !overlapMap->isEmpty() && currentRecursionData.m_testingOverlap && !requiresCompositing(directReasons)) {
         // If we're testing for overlap, we only need to composite if we overlap something that is already composited.
         absBounds = enclosingIntRect(overlapMap->geometryMap().absoluteRect(layer->overlapBounds()));
 
@@ -883,15 +882,15 @@
     // The children of this layer don't need to composite, unless there is
     // a compositing layer among them, so start by inheriting the compositing
     // ancestor with m_subtreeIsCompositing set to false.
-    CompositingState childState(compositingState);
-    childState.m_subtreeIsCompositing = false;
+    CompositingRecursionData childRecursionData(currentRecursionData);
+    childRecursionData.m_subtreeIsCompositing = false;
 
     bool willBeComposited = canBeComposited(layer) && requiresCompositing(reasonsToComposite);
     if (willBeComposited) {
         // Tell the parent it has compositing descendants.
-        compositingState.m_subtreeIsCompositing = true;
+        currentRecursionData.m_subtreeIsCompositing = true;
         // This layer now acts as the ancestor for kids.
-        childState.m_compositingAncestor = layer;
+        childRecursionData.m_compositingAncestor = layer;
 
         // Here we know that all children and the layer's own contents can blindly paint into
         // this layer's backing, until a descendant is composited. So, we don't need to check
@@ -900,7 +899,7 @@
             overlapMap->beginNewOverlapTestingContext();
         // This layer is going to be composited, so children can safely ignore the fact that there's an
         // animation running behind this layer, meaning they can rely on the overlap map testing again.
-        childState.m_testingOverlap = true;
+        childRecursionData.m_testingOverlap = true;
     }
 
 #if !ASSERT_DISABLED
@@ -915,16 +914,16 @@
             size_t listSize = negZOrderList->size();
             for (size_t i = 0; i < listSize; ++i) {
                 RenderLayer* curLayer = negZOrderList->at(i);
-                computeCompositingRequirements(layer, curLayer, overlapMap, childState, layersChanged, anyDescendantHas3DTransform, unclippedDescendants);
+                computeCompositingRequirements(layer, curLayer, overlapMap, childRecursionData, layersChanged, anyDescendantHas3DTransform, unclippedDescendants);
 
                 // If we have to make a layer for this child, make one now so we can have a contents layer
                 // (since we need to ensure that the -ve z-order child renders underneath our contents).
-                if (childState.m_subtreeIsCompositing) {
+                if (childRecursionData.m_subtreeIsCompositing) {
                     reasonsToComposite |= CompositingReasonNegativeZIndexChildren;
 
                     if (!willBeComposited) {
                         // make layer compositing
-                        childState.m_compositingAncestor = layer;
+                        childRecursionData.m_compositingAncestor = layer;
                         overlapMap->beginNewOverlapTestingContext();
                         willBeComposited = true;
                         willHaveForegroundLayer = true;
@@ -957,14 +956,14 @@
         overlapMap->beginNewOverlapTestingContext();
         // This layer is going to be composited, so children can safely ignore the fact that there's an
         // animation running behind this layer, meaning they can rely on the overlap map testing again
-        childState.m_testingOverlap = true;
+        childRecursionData.m_testingOverlap = true;
     }
 
     if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
         size_t listSize = normalFlowList->size();
         for (size_t i = 0; i < listSize; ++i) {
             RenderLayer* curLayer = normalFlowList->at(i);
-            computeCompositingRequirements(layer, curLayer, overlapMap, childState, layersChanged, anyDescendantHas3DTransform, unclippedDescendants);
+            computeCompositingRequirements(layer, curLayer, overlapMap, childRecursionData, layersChanged, anyDescendantHas3DTransform, unclippedDescendants);
         }
     }
 
@@ -973,7 +972,7 @@
             size_t listSize = posZOrderList->size();
             for (size_t i = 0; i < listSize; ++i) {
                 RenderLayer* curLayer = posZOrderList->at(i);
-                computeCompositingRequirements(layer, curLayer, overlapMap, childState, layersChanged, anyDescendantHas3DTransform, unclippedDescendants);
+                computeCompositingRequirements(layer, curLayer, overlapMap, childRecursionData, layersChanged, anyDescendantHas3DTransform, unclippedDescendants);
             }
         }
     }
@@ -987,16 +986,16 @@
     }
 
     // All layers (even ones that aren't being composited) need to get added to
-    // the overlap map. Layers that do not composite will draw into their
+    // the overlap map. Layers that are not separately composited will paint into their
     // compositing ancestor's backing, and so are still considered for overlap.
-    if (overlapMap && childState.m_compositingAncestor && !childState.m_compositingAncestor->isRootLayer())
+    if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursionData.m_compositingAncestor->isRootLayer())
         addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
 
     // Now check for reasons to become composited that depend on the state of descendant layers.
-    CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing(layer->renderer(), childState.m_subtreeIsCompositing, anyDescendantHas3DTransform);
+    CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing(layer->renderer(), childRecursionData.m_subtreeIsCompositing, anyDescendantHas3DTransform);
     reasonsToComposite |= subtreeCompositingReasons;
     if (!willBeComposited && canBeComposited(layer) && requiresCompositing(subtreeCompositingReasons)) {
-        childState.m_compositingAncestor = layer;
+        childRecursionData.m_compositingAncestor = layer;
         if (overlapMap) {
             // FIXME: this context push is effectively a no-op but needs to exist for
             // now, because the code is designed to push overlap information to the
@@ -1015,28 +1014,28 @@
     }
 
     // Subsequent layers in the parent's stacking context may also need to composite.
-    if (childState.m_subtreeIsCompositing)
-        compositingState.m_subtreeIsCompositing = true;
+    if (childRecursionData.m_subtreeIsCompositing)
+        currentRecursionData.m_subtreeIsCompositing = true;
 
     // Set the flag to say that this SC has compositing children.
-    layer->setHasCompositingDescendant(childState.m_subtreeIsCompositing);
+    layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing);
 
 
     // Turn overlap testing off for later layers if it's already off, or if we have an animating transform.
     // Note that if the layer clips its descendants, there's no reason to propagate the child animation to the parent layers. That's because
     // we know for sure the animation is contained inside the clipping rectangle, which is already added to the overlap map.
     bool isCompositedClippingLayer = canBeComposited(layer) && (reasonsToComposite & CompositingReasonClipsCompositingDescendants);
-    if ((!childState.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer->renderer()))
-        compositingState.m_testingOverlap = false;
+    if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer->renderer()))
+        currentRecursionData.m_testingOverlap = false;
 
-    if (overlapMap && childState.m_compositingAncestor == layer && !layer->isRootLayer())
+    if (overlapMap && childRecursionData.m_compositingAncestor == layer && !layer->isRootLayer())
         overlapMap->finishCurrentOverlapTestingContext();
 
     // If we're back at the root, and no other layers need to be composited, and the root layer itself doesn't need
     // to be composited, then we can drop out of compositing mode altogether. However, don't drop out of compositing mode
     // if there are composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden).
     // FIXME: hasAnyAdditionalCompositedLayers() code seems fishy. We need to make root layer logic more obvious.
-    if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !requiresCompositing(directReasons) && !m_forceCompositingMode && !hasAnyAdditionalCompositedLayers(layer)) {
+    if (layer->isRootLayer() && !childRecursionData.m_subtreeIsCompositing && !requiresCompositing(directReasons) && !m_forceCompositingMode && !hasAnyAdditionalCompositedLayers(layer)) {
         enableCompositingMode(false);
         willBeComposited = false;
         reasonsToComposite = CompositingReasonNone;
@@ -1045,8 +1044,8 @@
     // At this point we have finished collecting all reasons to composite this layer.
     layer->setCompositingReasons(reasonsToComposite);
 
-    // Update backing now, so that we can use isComposited() reliably during tree traversal in rebuildCompositingLayerTree().
-    if (updateBacking(layer, CompositingChangeRepaintNow))
+    // Allocate or deallocate the compositedLayerMapping now, so that we can use isComposited() reliably during tree traversal in rebuildCompositingLayerTree().
+    if (allocateOrClearCompositedLayerMapping(layer, CompositingChangeRepaintNow))
         layersChanged = true;
 
     if (layer->reflectionLayer() && updateLayerCompositingState(layer->reflectionLayer(), CompositingChangeRepaintNow))
@@ -1070,19 +1069,20 @@
         return;
 
     if (parentLayer) {
-        GraphicsLayer* hostingLayer = parentLayer->backing()->parentForSublayers();
-        GraphicsLayer* hostedLayer = childLayer->backing()->childForSuperlayers();
+        GraphicsLayer* hostingLayer = parentLayer->compositedLayerMapping()->parentForSublayers();
+        GraphicsLayer* hostedLayer = childLayer->compositedLayerMapping()->childForSuperlayers();
 
         hostingLayer->addChild(hostedLayer);
-    } else
-        childLayer->backing()->childForSuperlayers()->removeFromParent();
+    } else {
+        childLayer->compositedLayerMapping()->childForSuperlayers()->removeFromParent();
+    }
 }
 
 void RenderLayerCompositor::removeCompositedChildren(RenderLayer* layer)
 {
     ASSERT(layer->isComposited());
 
-    GraphicsLayer* hostingLayer = layer->backing()->parentForSublayers();
+    GraphicsLayer* hostingLayer = layer->compositedLayerMapping()->parentForSublayers();
     hostingLayer->removeAllChildren();
 }
 
@@ -1110,19 +1110,19 @@
         pixelsAddedByPromotingAllTransitions = 0.0;
     }
 
-    RenderLayerBacking* layerBacking = layer->backing();
-    if (layerBacking) {
+    CompositedLayerMapping* currentCompositedLayerMapping = layer->compositedLayerMapping();
+    if (currentCompositedLayerMapping) {
         // The compositing state of all our children has been updated already, so now
         // we can compute and cache the composited bounds for this layer.
-        layerBacking->updateCompositedBounds();
+        currentCompositedLayerMapping->updateCompositedBounds();
 
         if (RenderLayer* reflection = layer->reflectionLayer()) {
-            if (reflection->backing())
-                reflection->backing()->updateCompositedBounds();
+            if (reflection->compositedLayerMapping())
+                reflection->compositedLayerMapping()->updateCompositedBounds();
         }
 
-        layerBacking->updateGraphicsLayerConfiguration();
-        layerBacking->updateGraphicsLayerGeometry();
+        currentCompositedLayerMapping->updateGraphicsLayerConfiguration();
+        currentCompositedLayerMapping->updateGraphicsLayerGeometry();
 
         if (!layer->parent())
             updateRootLayerPosition();
@@ -1132,7 +1132,7 @@
 #else
         UNUSED_PARAM(depth);
 #endif
-        if (layerBacking->hasUnpositionedOverflowControlsLayers())
+        if (currentCompositedLayerMapping->hasUnpositionedOverflowControlsLayers())
             layer->positionNewlyCreatedOverflowControls();
 
         pixelsWithoutPromotingAllTransitions += layer->size().height() * layer->size().width();
@@ -1143,10 +1143,10 @@
             pixelsAddedByPromotingAllTransitions += layer->size().height() * layer->size().width();
     }
 
-    // If this layer has backing, then we are collecting its children, otherwise appending
-    // to the compositing child list of an enclosing layer.
+    // If this layer has a compositedLayerMapping, then that is where we place subsequent children GraphicsLayers.
+    // Otherwise children continue to append to the child list of the enclosing layer.
     Vector<GraphicsLayer*> layerChildren;
-    Vector<GraphicsLayer*>& childList = layerBacking ? layerChildren : childLayersOfEnclosingLayer;
+    Vector<GraphicsLayer*>& childList = currentCompositedLayerMapping ? layerChildren : childLayersOfEnclosingLayer;
 
 #if !ASSERT_DISABLED
     LayerListMutationDetector mutationChecker(layer);
@@ -1162,8 +1162,8 @@
         }
 
         // If a negative z-order child is compositing, we get a foreground layer which needs to get parented.
-        if (layerBacking && layerBacking->foregroundLayer())
-            childList.append(layerBacking->foregroundLayer());
+        if (currentCompositedLayerMapping && currentCompositedLayerMapping->foregroundLayer())
+            childList.append(currentCompositedLayerMapping->foregroundLayer());
     }
 
     if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
@@ -1184,34 +1184,34 @@
         }
     }
 
-    if (layerBacking) {
+    if (currentCompositedLayerMapping) {
         bool parented = false;
         if (layer->renderer()->isRenderPart())
             parented = parentFrameContentLayers(toRenderPart(layer->renderer()));
 
         if (!parented)
-            layerBacking->parentForSublayers()->setChildren(layerChildren);
+            currentCompositedLayerMapping->parentForSublayers()->setChildren(layerChildren);
 
         // If the layer has a clipping layer the overflow controls layers will be siblings of the clipping layer.
         // Otherwise, the overflow control layers are normal children.
-        if (!layerBacking->hasClippingLayer() && !layerBacking->hasScrollingLayer()) {
-            if (GraphicsLayer* overflowControlLayer = layerBacking->layerForHorizontalScrollbar()) {
+        if (!currentCompositedLayerMapping->hasClippingLayer() && !currentCompositedLayerMapping->hasScrollingLayer()) {
+            if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapping->layerForHorizontalScrollbar()) {
                 overflowControlLayer->removeFromParent();
-                layerBacking->parentForSublayers()->addChild(overflowControlLayer);
+                currentCompositedLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
             }
 
-            if (GraphicsLayer* overflowControlLayer = layerBacking->layerForVerticalScrollbar()) {
+            if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapping->layerForVerticalScrollbar()) {
                 overflowControlLayer->removeFromParent();
-                layerBacking->parentForSublayers()->addChild(overflowControlLayer);
+                currentCompositedLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
             }
 
-            if (GraphicsLayer* overflowControlLayer = layerBacking->layerForScrollCorner()) {
+            if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapping->layerForScrollCorner()) {
                 overflowControlLayer->removeFromParent();
-                layerBacking->parentForSublayers()->addChild(overflowControlLayer);
+                currentCompositedLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
             }
         }
 
-        childLayersOfEnclosingLayer.append(layerBacking->childForSuperlayers());
+        childLayersOfEnclosingLayer.append(currentCompositedLayerMapping->childForSuperlayers());
     }
 
     if (!depth) {
@@ -1339,12 +1339,8 @@
 
     // The true root layer is not included in the dump, so if we want to report
     // its repaint rects, they must be included here.
-    if (flags & LayerTreeIncludesRepaintRects) {
-        StringBuilder layerTreeTextWithRootRepaintRects;
-        layerTreeTextWithRootRepaintRects.append(m_renderView->frameView()->trackedRepaintRectsAsText());
-        layerTreeTextWithRootRepaintRects.append(layerTreeText);
-        return layerTreeTextWithRootRepaintRects.toString();
-    }
+    if (flags & LayerTreeIncludesRepaintRects)
+        return m_renderView->frameView()->trackedRepaintRectsAsText() + layerTreeText;
 
     return layerTreeText;
 }
@@ -1372,8 +1368,8 @@
     if (!layer->isComposited())
         return false;
 
-    RenderLayerBacking* backing = layer->backing();
-    GraphicsLayer* hostingLayer = backing->parentForSublayers();
+    CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping();
+    GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers();
     GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer();
     if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != rootLayer) {
         hostingLayer->removeAllChildren();
@@ -1385,18 +1381,18 @@
 // This just updates layer geometry without changing the hierarchy.
 void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer, int depth)
 {
-    if (RenderLayerBacking* layerBacking = layer->backing()) {
+    if (CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping()) {
         // The compositing state of all our children has been updated already, so now
         // we can compute and cache the composited bounds for this layer.
-        layerBacking->updateCompositedBounds();
+        compositedLayerMapping->updateCompositedBounds();
 
         if (RenderLayer* reflection = layer->reflectionLayer()) {
-            if (reflection->backing())
-                reflection->backing()->updateCompositedBounds();
+            if (reflection->compositedLayerMapping())
+                reflection->compositedLayerMapping()->updateCompositedBounds();
         }
 
-        layerBacking->updateGraphicsLayerConfiguration();
-        layerBacking->updateGraphicsLayerGeometry();
+        compositedLayerMapping->updateGraphicsLayerConfiguration();
+        compositedLayerMapping->updateGraphicsLayerGeometry();
 
         if (!layer->parent())
             updateRootLayerPosition();
@@ -1439,15 +1435,15 @@
 void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayer* compositingAncestor, RenderLayer* layer, bool compositedChildrenOnly)
 {
     if (layer != compositingAncestor) {
-        if (RenderLayerBacking* layerBacking = layer->backing()) {
-            layerBacking->updateCompositedBounds();
+        if (CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping()) {
+            compositedLayerMapping->updateCompositedBounds();
 
             if (RenderLayer* reflection = layer->reflectionLayer()) {
-                if (reflection->backing())
-                    reflection->backing()->updateCompositedBounds();
+                if (reflection->compositedLayerMapping())
+                    reflection->compositedLayerMapping()->updateCompositedBounds();
             }
 
-            layerBacking->updateGraphicsLayerGeometry();
+            compositedLayerMapping->updateGraphicsLayerGeometry();
             if (compositedChildrenOnly)
                 return;
         }
@@ -1495,7 +1491,7 @@
 void RenderLayerCompositor::recursiveRepaintLayer(RenderLayer* layer, const IntRect* rect)
 {
     // FIXME: This method does not work correctly with transforms.
-    if (layer->isComposited() && !layer->backing()->paintsIntoCompositedAncestor()) {
+    if (layer->isComposited() && !layer->compositedLayerMapping()->paintsIntoCompositedAncestor()) {
         if (rect)
             layer->setBackingNeedsRepaintInRect(*rect);
         else
@@ -1583,23 +1579,23 @@
     }
 }
 
-void RenderLayerCompositor::clearBackingForLayerIncludingDescendants(RenderLayer* layer)
+void RenderLayerCompositor::clearMappingForRenderLayerIncludingDescendants(RenderLayer* layer)
 {
     if (!layer)
         return;
 
     if (layer->isComposited()) {
         removeViewportConstrainedLayer(layer);
-        layer->clearBacking();
+        layer->clearCompositedLayerMapping();
     }
 
     for (RenderLayer* currLayer = layer->firstChild(); currLayer; currLayer = currLayer->nextSibling())
-        clearBackingForLayerIncludingDescendants(currLayer);
+        clearMappingForRenderLayerIncludingDescendants(currLayer);
 }
 
-void RenderLayerCompositor::clearBackingForAllLayers()
+void RenderLayerCompositor::clearMappingForAllRenderLayers()
 {
-    clearBackingForLayerIncludingDescendants(m_renderView->layer());
+    clearMappingForRenderLayerIncludingDescendants(m_renderView->layer());
 }
 
 void RenderLayerCompositor::updateRootLayerPosition()
@@ -1643,8 +1639,8 @@
 {
     RenderObject* renderer = layer->renderer();
     if (compositingAncestorLayer
-        && !(compositingAncestorLayer->backing()->graphicsLayer()->drawsContent()
-            || compositingAncestorLayer->backing()->paintsIntoCompositedAncestor()))
+        && !(compositingAncestorLayer->compositedLayerMapping()->mainGraphicsLayer()->drawsContent()
+            || compositingAncestorLayer->compositedLayerMapping()->paintsIntoCompositedAncestor()))
         return true;
 
     if (layer->isRootLayer()
@@ -1887,7 +1883,8 @@
 {
     if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer->isVideo()) {
         HTMLMediaElement* media = toHTMLMediaElement(renderer->node());
-        return media->isFullscreen();
+        if (media->isFullscreen())
+            return true;
     }
 
     if (!(m_compositingTriggers & ChromeClient::VideoTrigger))
@@ -2237,13 +2234,13 @@
 
 GraphicsLayer* RenderLayerCompositor::fixedRootBackgroundLayer() const
 {
-    // Get the fixed root background from the RenderView layer's backing.
+    // Get the fixed root background from the RenderView layer's compositedLayerMapping.
     RenderLayer* viewLayer = m_renderView->layer();
     if (!viewLayer)
         return 0;
 
-    if (viewLayer->isComposited() && viewLayer->backing()->backgroundLayerPaintsFixedRootBackground())
-        return viewLayer->backing()->backgroundLayer();
+    if (viewLayer->isComposited() && viewLayer->compositedLayerMapping()->backgroundLayerPaintsFixedRootBackground())
+        return viewLayer->compositedLayerMapping()->backgroundLayer();
 
     return 0;
 }
@@ -2433,10 +2430,14 @@
         // Create a layer to host the clipping layer and the overflow controls layers.
         m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
 
-        // Create a clipping layer if this is an iframe
+        // Create a clipping layer if this is an iframe or settings require to clip.
         m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
-        if (!isMainFrame())
-            m_containerLayer->setMasksToBounds(true);
+        bool containerMasksToBounds = !isMainFrame();
+        if (Settings* settings = m_renderView->document().settings()) {
+            if (settings->mainFrameClipsContent())
+                containerMasksToBounds = true;
+        }
+        m_containerLayer->setMasksToBounds(containerMasksToBounds);
 
         m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
         if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
@@ -2526,7 +2527,7 @@
             break;
         }
         case RootLayerAttachedViaEnclosingFrame: {
-            // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration()
+            // The layer will get hooked up via CompositedLayerMapping::updateGraphicsLayerConfiguration()
             // for the frame's renderer in the parent document.
             m_renderView->document().ownerElement()->scheduleLayerUpdate();
             break;
@@ -2543,7 +2544,7 @@
 
     switch (m_rootLayerAttachment) {
     case RootLayerAttachedViaEnclosingFrame: {
-        // The layer will get unhooked up via RenderLayerBacking::updateGraphicsLayerConfiguration()
+        // The layer will get unhooked up via CompositedLayerMapping::updateGraphicsLayerConfiguration()
         // for the frame's renderer in the parent document.
         if (m_overflowControlsHostLayer)
             m_overflowControlsHostLayer->removeFromParent();
@@ -2692,7 +2693,7 @@
 
     FixedPositionViewportConstraints constraints;
 
-    GraphicsLayer* graphicsLayer = layer->backing()->graphicsLayer();
+    GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphicsLayer();
 
     constraints.setLayerPositionAtLastLayout(graphicsLayer->position());
     constraints.setViewportRectAtLastLayout(viewportRect);
@@ -2734,7 +2735,7 @@
 
     renderer->computeStickyPositionConstraints(constraints, viewportRect);
 
-    GraphicsLayer* graphicsLayer = layer->backing()->graphicsLayer();
+    GraphicsLayer* graphicsLayer = layer->compositedLayerMapping()->mainGraphicsLayer();
 
     constraints.setLayerPositionAtLastLayout(graphicsLayer->position());
     constraints.setStickyOffsetAtLastLayout(renderer->stickyPositionOffset());
diff --git a/Source/core/rendering/RenderLayerCompositor.h b/Source/core/rendering/RenderLayerCompositor.h
index 218928b..dbb735c 100644
--- a/Source/core/rendering/RenderLayerCompositor.h
+++ b/Source/core/rendering/RenderLayerCompositor.h
@@ -101,9 +101,9 @@
     // Update the geometry for compositing children of compositingAncestor.
     void updateCompositingDescendantGeometry(RenderLayer* compositingAncestor, RenderLayer*, bool compositedChildrenOnly);
 
-    // Whether layer's backing needs a graphics layer to do clipping by an ancestor (non-stacking-context parent with overflow).
+    // Whether layer's compositedLayerMapping needs a GraphicsLayer to do clipping by an ancestor (non-stacking-context parent with overflow).
     bool clippedByAncestor(const RenderLayer*) const;
-    // Whether layer's backing needs a graphics layer to clip z-order children of the given layer.
+    // Whether layer's compositedLayerMapping needs a GraphicsLayer to clip z-order children of the given RenderLayer.
     bool clipsCompositingDescendants(const RenderLayer*) const;
 
     // Whether the given layer needs an extra 'contents' layer.
@@ -151,7 +151,7 @@
 
     void setIsInWindow(bool);
 
-    void clearBackingForAllLayers();
+    void clearMappingForAllRenderLayers();
 
     void layerBecameComposited(const RenderLayer*) { ++m_compositedLayerCount; }
     void layerBecameNonComposited(const RenderLayer*);
@@ -226,10 +226,10 @@
     // Returns indirect reasons that a layer should be composited because of something in its subtree.
     CompositingReasons subtreeReasonsForCompositing(RenderObject*, bool hasCompositedDescendants, bool has3DTransformedDescendants) const;
 
-    // Make or destroy the backing for this layer; returns true if backing changed.
-    bool updateBacking(RenderLayer*, CompositingChangeRepaint shouldRepaint);
+    // Make or destroy the CompositedLayerMapping for this layer; returns true if the compositedLayerMapping changed.
+    bool allocateOrClearCompositedLayerMapping(RenderLayer*, CompositingChangeRepaint shouldRepaint);
 
-    void clearBackingForLayerIncludingDescendants(RenderLayer*);
+    void clearMappingForRenderLayerIncludingDescendants(RenderLayer*);
 
     // Repaint the given rect (which is layer's coords), and regions of child layers that intersect that rect.
     void recursiveRepaintLayer(RenderLayer*, const IntRect* = 0);
@@ -238,7 +238,7 @@
     void addToOverlapMapRecursive(OverlapMap&, RenderLayer*, RenderLayer* ancestorLayer = 0);
 
     // Returns true if any layer's compositing changed
-    void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer*, OverlapMap*, struct CompositingState&, bool& layersChanged, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants);
+    void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer*, OverlapMap*, struct CompositingRecursionData&, bool& layersChanged, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants);
 
     // Recurses down the tree, parenting descendant compositing layers and collecting an array of child layers for the current compositing layer.
     void rebuildCompositingLayerTree(RenderLayer*, Vector<GraphicsLayer*>& childGraphicsLayersOfEnclosingLayer, int depth);
diff --git a/Source/core/rendering/RenderLayerFilterInfo.h b/Source/core/rendering/RenderLayerFilterInfo.h
index 4e44b3f..c6ded2d 100644
--- a/Source/core/rendering/RenderLayerFilterInfo.h
+++ b/Source/core/rendering/RenderLayerFilterInfo.h
@@ -32,9 +32,9 @@
 
 #include "core/dom/Element.h"
 #include "core/fetch/DocumentResource.h"
-#include "core/platform/graphics/LayoutRect.h"
 #include "core/platform/graphics/filters/FilterOperation.h"
 #include "core/platform/graphics/filters/custom/CustomFilterProgramClient.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/HashMap.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/rendering/RenderLayerModelObject.cpp b/Source/core/rendering/RenderLayerModelObject.cpp
index 2019c7c..b079c76 100644
--- a/Source/core/rendering/RenderLayerModelObject.cpp
+++ b/Source/core/rendering/RenderLayerModelObject.cpp
@@ -25,7 +25,7 @@
 #include "config.h"
 #include "core/rendering/RenderLayerModelObject.h"
 
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderView.h"
 
@@ -154,7 +154,7 @@
                 setChildNeedsLayout();
             ensureLayer();
             if (parent() && !needsLayout() && containingBlock()) {
-                layer()->setRepaintStatus(NeedsFullRepaint);
+                layer()->repainter().setRepaintStatus(NeedsFullRepaint);
                 // There is only one layer to update, it is not worth using |cachedOffset| since
                 // we are not sure the value will be used.
                 layer()->updateLayerPositions(0);
@@ -206,9 +206,9 @@
     }
 }
 
-RenderLayerBacking* RenderLayerModelObject::backing() const
+CompositedLayerMapping* RenderLayerModelObject::compositedLayerMapping() const
 {
-    return m_layer ? m_layer->backing() : 0;
+    return m_layer ? m_layer->compositedLayerMapping() : 0;
 }
 
 } // namespace WebCore
diff --git a/Source/core/rendering/RenderLayerModelObject.h b/Source/core/rendering/RenderLayerModelObject.h
index 414fe36..bf2ab3f 100644
--- a/Source/core/rendering/RenderLayerModelObject.h
+++ b/Source/core/rendering/RenderLayerModelObject.h
@@ -28,7 +28,7 @@
 namespace WebCore {
 
 class RenderLayer;
-class RenderLayerBacking;
+class CompositedLayerMapping;
 class ScrollableArea;
 
 class RenderLayerModelObject : public RenderObject {
@@ -56,7 +56,7 @@
     // This is null for anonymous renderers.
     ContainerNode* node() const { return toContainerNode(RenderObject::node()); }
 
-    RenderLayerBacking* backing() const;
+    CompositedLayerMapping* compositedLayerMapping() const;
 
 protected:
     void ensureLayer();
diff --git a/Source/core/rendering/RenderLayerRepainter.cpp b/Source/core/rendering/RenderLayerRepainter.cpp
new file mode 100644
index 0000000..a6b1881
--- /dev/null
+++ b/Source/core/rendering/RenderLayerRepainter.cpp
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * 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.1 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
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#include "config.h"
+#include "core/rendering/RenderLayerRepainter.h"
+
+#include "core/rendering/CompositedLayerMapping.h"
+#include "core/rendering/RenderLayer.h"
+#include "core/rendering/RenderView.h"
+
+namespace WebCore {
+
+RenderLayerRepainter::RenderLayerRepainter(RenderLayerModelObject* renderer)
+    : m_renderer(renderer)
+    , m_repaintStatus(NeedsNormalRepaint)
+{
+}
+
+void RenderLayerRepainter::repaintAfterLayout(RenderGeometryMap* geometryMap, bool shouldCheckForRepaint)
+{
+    if (m_renderer->layer()->hasVisibleContent()) {
+        RenderView* view = m_renderer->view();
+        ASSERT(view);
+        // FIXME: LayoutState does not work with RenderLayers as there is not a 1-to-1
+        // mapping between them and the RenderObjects. It would be neat to enable
+        // LayoutState outside the layout() phase and use it here.
+        ASSERT(!view->layoutStateEnabled());
+
+        RenderLayerModelObject* repaintContainer = m_renderer->containerForRepaint();
+        LayoutRect oldRepaintRect = m_repaintRect;
+        LayoutRect oldOutlineBox = m_outlineBox;
+        computeRepaintRects(repaintContainer, geometryMap);
+
+        // FIXME: Should ASSERT that value calculated for m_outlineBox using the cached offset is the same
+        // as the value not using the cached offset, but we can't due to https://bugs.webkit.org/show_bug.cgi?id=37048
+        if (shouldCheckForRepaint) {
+            if (view && !view->document().printing()) {
+                if (m_repaintStatus & NeedsFullRepaint) {
+                    m_renderer->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldRepaintRect));
+                    if (m_repaintRect != oldRepaintRect)
+                        m_renderer->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_repaintRect));
+                } else if (shouldRepaintAfterLayout()) {
+                    m_renderer->repaintAfterLayoutIfNeeded(repaintContainer, oldRepaintRect, oldOutlineBox, &m_repaintRect, &m_outlineBox);
+                }
+            }
+        }
+    } else {
+        clearRepaintRects();
+    }
+
+    m_repaintStatus = NeedsNormalRepaint;
+
+}
+
+void RenderLayerRepainter::clearRepaintRects()
+{
+    ASSERT(!m_renderer->layer()->hasVisibleContent());
+
+    m_repaintRect = IntRect();
+    m_outlineBox = IntRect();
+}
+
+void RenderLayerRepainter::computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* geometryMap)
+{
+    m_repaintRect = m_renderer->clippedOverflowRectForRepaint(repaintContainer);
+    m_outlineBox = m_renderer->outlineBoundsForRepaint(repaintContainer, geometryMap);
+}
+
+void RenderLayerRepainter::computeRepaintRectsIncludingDescendants()
+{
+    // FIXME: computeRepaintRects() has to walk up the parent chain for every layer to compute the rects.
+    // We should make this more efficient.
+    // FIXME: it's wrong to call this when layout is not up-to-date, which we do.
+    computeRepaintRects(m_renderer->containerForRepaint());
+
+    for (RenderLayer* layer = m_renderer->layer()->firstChild(); layer; layer = layer->nextSibling())
+        layer->repainter().computeRepaintRectsIncludingDescendants();
+}
+
+inline bool RenderLayerRepainter::shouldRepaintAfterLayout() const
+{
+    if (m_repaintStatus == NeedsNormalRepaint)
+        return true;
+
+    // Composited layers that were moved during a positioned movement only
+    // layout, don't need to be repainted. They just need to be recomposited.
+    ASSERT(m_repaintStatus == NeedsFullRepaintForPositionedMovementLayout);
+    return !m_renderer->isComposited() || (m_renderer->isComposited() && m_renderer->layer()->compositedLayerMapping()->paintsIntoCompositedAncestor());
+}
+
+// Since we're only painting non-composited layers, we know that they all share the same repaintContainer.
+void RenderLayerRepainter::repaintIncludingNonCompositingDescendants(RenderLayerModelObject* repaintContainer)
+{
+    m_renderer->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_renderer->clippedOverflowRectForRepaint(repaintContainer)));
+
+    for (RenderLayer* curr = m_renderer->layer()->firstChild(); curr; curr = curr->nextSibling()) {
+        if (!curr->isComposited())
+            curr->repainter().repaintIncludingNonCompositingDescendants(repaintContainer);
+    }
+}
+
+LayoutRect RenderLayerRepainter::repaintRectIncludingNonCompositingDescendants() const
+{
+    LayoutRect repaintRect = m_repaintRect;
+    for (RenderLayer* child = m_renderer->layer()->firstChild(); child; child = child->nextSibling()) {
+        // Don't include repaint rects for composited child layers; they will paint themselves and have a different origin.
+        if (child->isComposited())
+            continue;
+
+        repaintRect.unite(child->repainter().repaintRectIncludingNonCompositingDescendants());
+    }
+    return repaintRect;
+}
+
+} // Namespace WebCore
diff --git a/Source/core/rendering/RenderLayerRepainter.h b/Source/core/rendering/RenderLayerRepainter.h
new file mode 100644
index 0000000..0430270
--- /dev/null
+++ b/Source/core/rendering/RenderLayerRepainter.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * 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.1 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
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef RenderLayerRepainter_h
+#define RenderLayerRepainter_h
+
+#include "platform/geometry/LayoutRect.h"
+#include "wtf/Noncopyable.h"
+
+namespace WebCore {
+
+enum RepaintStatus {
+    NeedsNormalRepaint = 0,
+    NeedsFullRepaint = 1 << 0,
+    NeedsFullRepaintForPositionedMovementLayout = 1 << 1
+};
+
+class RenderGeometryMap;
+class RenderLayer;
+class RenderLayerModelObject;
+
+class RenderLayerRepainter {
+    WTF_MAKE_NONCOPYABLE(RenderLayerRepainter);
+public:
+    RenderLayerRepainter(RenderLayerModelObject*);
+
+    // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint.
+    LayoutRect repaintRect() const { return m_repaintRect; }
+    LayoutRect repaintRectIncludingNonCompositingDescendants() const;
+
+    void repaintAfterLayout(RenderGeometryMap*, bool shouldCheckForRepaint);
+    void repaintIncludingNonCompositingDescendants(RenderLayerModelObject* repaintContainer);
+
+    void setRepaintStatus(RepaintStatus status) { m_repaintStatus = status; }
+
+    void computeRepaintRects(const RenderLayerModelObject* repaintContainer, const RenderGeometryMap* = 0);
+    void computeRepaintRectsIncludingDescendants();
+private:
+    bool shouldRepaintAfterLayout() const;
+
+    void clearRepaintRects();
+
+    RenderLayerModelObject* m_renderer;
+
+    unsigned m_repaintStatus; // RepaintStatus
+
+    LayoutRect m_repaintRect; // Cached repaint rects. Used by layout.
+    LayoutRect m_outlineBox;
+};
+
+} // namespace WebCore
+
+#endif // RenderLayerRepainter_h
diff --git a/Source/core/rendering/RenderLayerScrollableArea.cpp b/Source/core/rendering/RenderLayerScrollableArea.cpp
index e3ee6e6..3ed4338 100644
--- a/Source/core/rendering/RenderLayerScrollableArea.cpp
+++ b/Source/core/rendering/RenderLayerScrollableArea.cpp
@@ -49,28 +49,38 @@
 #include "core/editing/FrameSelection.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/page/FocusController.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
 #include "core/platform/ScrollAnimator.h"
+#include "core/platform/ScrollbarTheme.h"
+#include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/GraphicsLayer.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderScrollbar.h"
 #include "core/rendering/RenderScrollbarPart.h"
 #include "core/rendering/RenderView.h"
+#include "platform/PlatformGestureEvent.h"
+#include "platform/PlatformMouseEvent.h"
 
 namespace WebCore {
 
-RenderLayerScrollableArea::RenderLayerScrollableArea(RenderLayer* layer)
-    : m_layer(layer)
+const int ResizerControlExpandRatioForTouch = 2;
+
+RenderLayerScrollableArea::RenderLayerScrollableArea(RenderBox* box)
+    : m_box(box)
+    , m_inResizeMode(false)
     , m_scrollDimensionsDirty(true)
     , m_inOverflowRelayout(false)
     , m_scrollCorner(0)
+    , m_resizer(0)
 {
     ScrollableArea::setConstrainsScrollingToContentEdge(false);
 
-    Node* node = renderer()->node();
+    Node* node = m_box->node();
     if (node && node->isElementNode()) {
         // We save and restore only the scrollOffset as the other scroll values are recalculated.
         Element* element = toElement(node);
@@ -80,67 +90,85 @@
         element->setSavedLayerScrollOffset(IntSize());
     }
 
+    updateResizerAreaSet();
 }
 
 RenderLayerScrollableArea::~RenderLayerScrollableArea()
 {
-    if (Frame* frame = renderer()->frame()) {
+    if (inResizeMode() && !m_box->documentBeingDestroyed()) {
+        if (Frame* frame = m_box->frame())
+            frame->eventHandler()->resizeLayerDestroyed();
+    }
+
+    if (Frame* frame = m_box->frame()) {
         if (FrameView* frameView = frame->view()) {
             frameView->removeScrollableArea(this);
         }
     }
 
-    if (renderer()->frame() && renderer()->frame()->page()) {
-        if (ScrollingCoordinator* scrollingCoordinator = renderer()->frame()->page()->scrollingCoordinator())
+    if (m_box->frame() && m_box->frame()->page()) {
+        if (ScrollingCoordinator* scrollingCoordinator = m_box->frame()->page()->scrollingCoordinator())
             scrollingCoordinator->willDestroyScrollableArea(this);
     }
 
-    if (!renderer()->documentBeingDestroyed()) {
-        Node* node = renderer()->node();
+    if (!m_box->documentBeingDestroyed()) {
+        Node* node = m_box->node();
         if (node && node->isElementNode())
             toElement(node)->setSavedLayerScrollOffset(m_scrollOffset);
     }
 
+    if (Frame* frame = m_box->frame()) {
+        if (FrameView* frameView = frame->view())
+            frameView->removeResizerArea(m_box);
+    }
+
     destroyScrollbar(HorizontalScrollbar);
     destroyScrollbar(VerticalScrollbar);
 
     if (m_scrollCorner)
         m_scrollCorner->destroy();
+    if (m_resizer)
+        m_resizer->destroy();
 }
 
 ScrollableArea* RenderLayerScrollableArea::enclosingScrollableArea() const
 {
-    return m_layer->enclosingScrollableArea();
+    if (RenderBox* enclosingScrollableBox = m_box->enclosingScrollableBox())
+        return enclosingScrollableBox->layer()->scrollableArea();
+
+    // FIXME: We should return the frame view here (or possibly an ancestor frame view,
+    // if the frame view isn't scrollable.
+    return 0;
 }
 
 void RenderLayerScrollableArea::updateNeedsCompositedScrolling()
 {
-    m_layer->updateNeedsCompositedScrolling();
+    layer()->updateNeedsCompositedScrolling();
 }
 
 GraphicsLayer* RenderLayerScrollableArea::layerForScrolling() const
 {
-    return m_layer->layerForScrolling();
+    return m_box->compositedLayerMapping() ? m_box->compositedLayerMapping()->scrollingContentsLayer() : 0;
 }
 
 GraphicsLayer* RenderLayerScrollableArea::layerForHorizontalScrollbar() const
 {
-    return m_layer->layerForHorizontalScrollbar();
+    return m_box->compositedLayerMapping() ? m_box->compositedLayerMapping()->layerForHorizontalScrollbar() : 0;
 }
 
 GraphicsLayer* RenderLayerScrollableArea::layerForVerticalScrollbar() const
 {
-    return m_layer->layerForVerticalScrollbar();
+    return m_box->compositedLayerMapping() ? m_box->compositedLayerMapping()->layerForVerticalScrollbar() : 0;
 }
 
 GraphicsLayer* RenderLayerScrollableArea::layerForScrollCorner() const
 {
-    return m_layer->layerForScrollCorner();
+    return m_box->compositedLayerMapping() ? m_box->compositedLayerMapping()->layerForScrollCorner() : 0;
 }
 
 bool RenderLayerScrollableArea::usesCompositedScrolling() const
 {
-    return m_layer->usesCompositedScrolling();
+    return layer()->usesCompositedScrolling();
 }
 
 void RenderLayerScrollableArea::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
@@ -158,16 +186,15 @@
     }
 
     IntRect scrollRect = rect;
-    RenderBox* box = toRenderBox(renderer());
     // If we are not yet inserted into the tree, there is no need to repaint.
-    if (!box->parent())
+    if (!m_box->parent())
         return;
 
     if (scrollbar == m_vBar.get())
-        scrollRect.move(verticalScrollbarStart(0, box->width()), box->borderTop());
+        scrollRect.move(verticalScrollbarStart(0, m_box->width()), m_box->borderTop());
     else
-        scrollRect.move(horizontalScrollbarStart(0), box->height() - box->borderBottom() - scrollbar->height());
-    renderer()->repaintRectangle(scrollRect);
+        scrollRect.move(horizontalScrollbarStart(0), m_box->height() - m_box->borderBottom() - scrollbar->height());
+    m_box->repaintRectangle(scrollRect);
 }
 
 void RenderLayerScrollableArea::invalidateScrollCornerRect(const IntRect& rect)
@@ -179,65 +206,108 @@
 
     if (m_scrollCorner)
         m_scrollCorner->repaintRectangle(rect);
-    m_layer->invalidateScrollCornerRect(rect);
+    if (m_resizer)
+        m_resizer->repaintRectangle(rect);
 }
 
 bool RenderLayerScrollableArea::isActive() const
 {
-    return m_layer->isActive();
+    Page* page = m_box->frame()->page();
+    return page && page->focusController().isActive();
 }
 
 bool RenderLayerScrollableArea::isScrollCornerVisible() const
 {
-    return m_layer->isScrollCornerVisible();
+    return !scrollCornerRect().isEmpty();
 }
 
+static int cornerStart(const RenderStyle* style, int minX, int maxX, int thickness)
+{
+    if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+        return minX + style->borderLeftWidth();
+    return maxX - thickness - style->borderRightWidth();
+}
+
+static IntRect cornerRect(const RenderStyle* style, const Scrollbar* horizontalScrollbar, const Scrollbar* verticalScrollbar, const IntRect& bounds)
+{
+    int horizontalThickness;
+    int verticalThickness;
+    if (!verticalScrollbar && !horizontalScrollbar) {
+        // FIXME: This isn't right. We need to know the thickness of custom scrollbars
+        // even when they don't exist in order to set the resizer square size properly.
+        horizontalThickness = ScrollbarTheme::theme()->scrollbarThickness();
+        verticalThickness = horizontalThickness;
+    } else if (verticalScrollbar && !horizontalScrollbar) {
+        horizontalThickness = verticalScrollbar->width();
+        verticalThickness = horizontalThickness;
+    } else if (horizontalScrollbar && !verticalScrollbar) {
+        verticalThickness = horizontalScrollbar->height();
+        horizontalThickness = verticalThickness;
+    } else {
+        horizontalThickness = verticalScrollbar->width();
+        verticalThickness = horizontalScrollbar->height();
+    }
+    return IntRect(cornerStart(style, bounds.x(), bounds.maxX(), horizontalThickness),
+        bounds.maxY() - verticalThickness - style->borderBottomWidth(),
+        horizontalThickness, verticalThickness);
+}
+
+
 IntRect RenderLayerScrollableArea::scrollCornerRect() const
 {
-    return m_layer->scrollCornerRect();
+    // We have a scrollbar corner when a scrollbar is visible and not filling the entire length of the box.
+    // This happens when:
+    // (a) A resizer is present and at least one scrollbar is present
+    // (b) Both scrollbars are present.
+    bool hasHorizontalBar = horizontalScrollbar();
+    bool hasVerticalBar = verticalScrollbar();
+    bool hasResizer = m_box->style()->resize() != RESIZE_NONE;
+    if ((hasHorizontalBar && hasVerticalBar) || (hasResizer && (hasHorizontalBar || hasVerticalBar)))
+        return cornerRect(m_box->style(), horizontalScrollbar(), verticalScrollbar(), m_box->pixelSnappedBorderBoxRect());
+    return IntRect();
 }
 
 IntRect RenderLayerScrollableArea::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& scrollbarRect) const
 {
-    RenderView* view = renderer()->view();
+    RenderView* view = m_box->view();
     if (!view)
         return scrollbarRect;
 
     IntRect rect = scrollbarRect;
     rect.move(scrollbarOffset(scrollbar));
 
-    return view->frameView()->convertFromRenderer(renderer(), rect);
+    return view->frameView()->convertFromRenderer(m_box, rect);
 }
 
 IntRect RenderLayerScrollableArea::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
 {
-    RenderView* view = renderer()->view();
+    RenderView* view = m_box->view();
     if (!view)
         return parentRect;
 
-    IntRect rect = view->frameView()->convertToRenderer(renderer(), parentRect);
+    IntRect rect = view->frameView()->convertToRenderer(m_box, parentRect);
     rect.move(-scrollbarOffset(scrollbar));
     return rect;
 }
 
 IntPoint RenderLayerScrollableArea::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& scrollbarPoint) const
 {
-    RenderView* view = renderer()->view();
+    RenderView* view = m_box->view();
     if (!view)
         return scrollbarPoint;
 
     IntPoint point = scrollbarPoint;
     point.move(scrollbarOffset(scrollbar));
-    return view->frameView()->convertFromRenderer(renderer(), point);
+    return view->frameView()->convertFromRenderer(m_box, point);
 }
 
 IntPoint RenderLayerScrollableArea::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
 {
-    RenderView* view = renderer()->view();
+    RenderView* view = m_box->view();
     if (!view)
         return parentPoint;
 
-    IntPoint point = view->frameView()->convertToRenderer(renderer(), parentPoint);
+    IntPoint point = view->frameView()->convertToRenderer(m_box, parentPoint);
 
     point.move(-scrollbarOffset(scrollbar));
     return point;
@@ -245,12 +315,13 @@
 
 int RenderLayerScrollableArea::scrollSize(ScrollbarOrientation orientation) const
 {
-    return m_layer->scrollSize(orientation);
+    IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition();
+    return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scrollDimensions.height();
 }
 
 void RenderLayerScrollableArea::setScrollOffset(const IntPoint& newScrollOffset)
 {
-    if (!toRenderBox(renderer())->isMarquee()) {
+    if (!m_box->isMarquee()) {
         // Ensure that the dimensions will be computed if they need to be (for overflow:hidden blocks).
         if (m_scrollDimensionsDirty)
             computeScrollDimensions();
@@ -261,10 +332,10 @@
 
     setScrollOffset(toIntSize(newScrollOffset));
 
-    Frame* frame = renderer()->frame();
-    InspectorInstrumentation::willScrollLayer(renderer());
+    Frame* frame = m_box->frame();
+    InspectorInstrumentation::willScrollLayer(m_box);
 
-    RenderView* view = renderer()->view();
+    RenderView* view = m_box->view();
 
     // We should have a RenderView if we're trying to scroll.
     ASSERT(view);
@@ -274,22 +345,22 @@
     bool inLayout = view ? view->frameView()->isInLayout() : false;
     if (!inLayout) {
         // If we're in the middle of layout, we'll just update layers once layout has finished.
-        m_layer->updateLayerPositionsAfterOverflowScroll();
+        layer()->updateLayerPositionsAfterOverflowScroll();
         if (view) {
             // Update regions, scrolling may change the clip of a particular region.
             view->frameView()->updateAnnotatedRegions();
             view->updateWidgetPositions();
         }
 
-        m_layer->updateCompositingLayersAfterScroll();
+        layer()->updateCompositingLayersAfterScroll();
     }
 
-    RenderLayerModelObject* repaintContainer = renderer()->containerForRepaint();
+    RenderLayerModelObject* repaintContainer = m_box->containerForRepaint();
     if (frame) {
         // The caret rect needs to be invalidated after scrolling
         frame->selection().setCaretRectNeedsUpdate();
 
-        FloatQuad quadForFakeMouseMoveEvent = FloatQuad(m_layer->m_repaintRect);
+        FloatQuad quadForFakeMouseMoveEvent = FloatQuad(layer()->repainter().repaintRect());
         if (repaintContainer)
             quadForFakeMouseMoveEvent = repaintContainer->localToAbsoluteQuad(quadForFakeMouseMoveEvent);
         frame->eventHandler()->dispatchFakeMouseMoveEventSoonInQuad(quadForFakeMouseMoveEvent);
@@ -297,18 +368,18 @@
 
     bool requiresRepaint = true;
 
-    if (m_layer->compositor()->inCompositingMode() && m_layer->usesCompositedScrolling())
+    if (m_box->view()->compositor()->inCompositingMode() && layer()->usesCompositedScrolling())
         requiresRepaint = false;
 
     // Just schedule a full repaint of our object.
     if (view && requiresRepaint)
-        renderer()->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(m_layer->m_repaintRect));
+        m_box->repaintUsingContainer(repaintContainer, pixelSnappedIntRect(layer()->repainter().repaintRect()));
 
     // Schedule the scroll DOM event.
-    if (renderer()->node())
-        renderer()->node()->document().eventQueue()->enqueueOrDispatchScrollEvent(renderer()->node(), DocumentEventQueue::ScrollEventElementTarget);
+    if (m_box->node())
+        m_box->node()->document().enqueueScrollEventForNode(m_box->node());
 
-    InspectorInstrumentation::didScrollLayer(renderer());
+    InspectorInstrumentation::didScrollLayer(m_box);
 }
 
 IntPoint RenderLayerScrollableArea::scrollPosition() const
@@ -323,12 +394,10 @@
 
 IntPoint RenderLayerScrollableArea::maximumScrollPosition() const
 {
-    RenderBox* box = toRenderBox(renderer());
-
-    if (!box->hasOverflowClip())
+    if (!m_box->hasOverflowClip())
         return -scrollOrigin();
 
-    return -scrollOrigin() + enclosingIntRect(m_overflowRect).size() - enclosingIntRect(box->clientBoxRect()).size();
+    return -scrollOrigin() + enclosingIntRect(m_overflowRect).size() - enclosingIntRect(m_box->clientBoxRect()).size();
 }
 
 IntRect RenderLayerScrollableArea::visibleContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
@@ -341,17 +410,17 @@
     }
 
     return IntRect(IntPoint(scrollXOffset(), scrollYOffset()),
-        IntSize(max(0, m_layer->size().width() - verticalScrollbarWidth), max(0, m_layer->size().height() - horizontalScrollbarHeight)));
+        IntSize(max(0, layer()->size().width() - verticalScrollbarWidth), max(0, layer()->size().height() - horizontalScrollbarHeight)));
 }
 
 int RenderLayerScrollableArea::visibleHeight() const
 {
-    return m_layer->visibleHeight();
+    return layer()->size().height();
 }
 
 int RenderLayerScrollableArea::visibleWidth() const
 {
-    return m_layer->visibleWidth();
+    return layer()->size().width();
 }
 
 IntSize RenderLayerScrollableArea::contentsSize() const
@@ -361,78 +430,88 @@
 
 IntSize RenderLayerScrollableArea::overhangAmount() const
 {
-    return m_layer->overhangAmount();
+    return IntSize();
 }
 
 IntPoint RenderLayerScrollableArea::lastKnownMousePosition() const
 {
-    return m_layer->lastKnownMousePosition();
+    return m_box->frame() ? m_box->frame()->eventHandler()->lastKnownMousePosition() : IntPoint();
 }
 
 bool RenderLayerScrollableArea::shouldSuspendScrollAnimations() const
 {
-    return m_layer->shouldSuspendScrollAnimations();
+    RenderView* view = m_box->view();
+    if (!view)
+        return true;
+    return view->frameView()->shouldSuspendScrollAnimations();
 }
 
 bool RenderLayerScrollableArea::scrollbarsCanBeActive() const
 {
-    return m_layer->scrollbarsCanBeActive();
+    RenderView* view = m_box->view();
+    if (!view)
+        return false;
+    return view->frameView()->scrollbarsCanBeActive();
 }
 
 IntRect RenderLayerScrollableArea::scrollableAreaBoundingBox() const
 {
-    return m_layer->scrollableAreaBoundingBox();
+    return m_box->absoluteBoundingBoxRect();
 }
 
 bool RenderLayerScrollableArea::userInputScrollable(ScrollbarOrientation orientation) const
 {
-    return m_layer->userInputScrollable(orientation);
+    if (m_box->isIntristicallyScrollable(orientation))
+        return true;
+
+    EOverflow overflowStyle = (orientation == HorizontalScrollbar) ?
+        m_box->style()->overflowX() : m_box->style()->overflowY();
+    return (overflowStyle == OSCROLL || overflowStyle == OAUTO || overflowStyle == OOVERLAY);
 }
 
 bool RenderLayerScrollableArea::shouldPlaceVerticalScrollbarOnLeft() const
 {
-    return m_layer->shouldPlaceVerticalScrollbarOnLeft();
+    return m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft();
 }
 
 int RenderLayerScrollableArea::pageStep(ScrollbarOrientation orientation) const
 {
-    return m_layer->pageStep(orientation);
+    int length = (orientation == HorizontalScrollbar) ?
+        m_box->pixelSnappedClientWidth() : m_box->pixelSnappedClientHeight();
+    int minPageStep = static_cast<float>(length) * ScrollableArea::minFractionToStepWhenPaging();
+    int pageStep = max(minPageStep, length - ScrollableArea::maxOverlapBetweenPages());
+
+    return max(pageStep, 1);
 }
 
-RenderLayerModelObject* RenderLayerScrollableArea::renderer() const
+RenderLayer* RenderLayerScrollableArea::layer() const
 {
-    // Only RenderBoxes can have a scrollable area, however we allocate an
-    // RenderLayerScrollableArea for any renderers (FIXME).
-    return m_layer->renderer();
+    return m_box->layer();
 }
 
 int RenderLayerScrollableArea::scrollWidth() const
 {
-    RenderBox* box = toRenderBox(renderer());
     if (m_scrollDimensionsDirty)
         const_cast<RenderLayerScrollableArea*>(this)->computeScrollDimensions();
-    return snapSizeToPixel(m_overflowRect.width(), box->clientLeft() + box->x());
+    return snapSizeToPixel(m_overflowRect.width(), m_box->clientLeft() + m_box->x());
 }
 
 int RenderLayerScrollableArea::scrollHeight() const
 {
-    RenderBox* box = toRenderBox(renderer());
     if (m_scrollDimensionsDirty)
         const_cast<RenderLayerScrollableArea*>(this)->computeScrollDimensions();
-    return snapSizeToPixel(m_overflowRect.height(), box->clientTop() + box->y());
+    return snapSizeToPixel(m_overflowRect.height(), m_box->clientTop() + m_box->y());
 }
 
 void RenderLayerScrollableArea::computeScrollDimensions()
 {
-    RenderBox* box = toRenderBox(renderer());
-
     m_scrollDimensionsDirty = false;
 
-    m_overflowRect = box->layoutOverflowRect();
-    box->flipForWritingMode(m_overflowRect);
+    m_overflowRect = m_box->layoutOverflowRect();
+    m_box->flipForWritingMode(m_overflowRect);
 
-    int scrollableLeftOverflow = m_overflowRect.x() - box->borderLeft();
-    int scrollableTopOverflow = m_overflowRect.y() - box->borderTop();
+    int scrollableLeftOverflow = m_overflowRect.x() - m_box->borderLeft();
+    int scrollableTopOverflow = m_overflowRect.y() - m_box->borderTop();
     setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow));
 }
 
@@ -445,9 +524,8 @@
 
 void RenderLayerScrollableArea::updateAfterLayout()
 {
-    RenderBox* box = toRenderBox(renderer());
     // List box parts handle the scrollbars by themselves so we have nothing to do.
-    if (box->style()->appearance() == ListboxPart)
+    if (m_box->style()->appearance() == ListboxPart)
         return;
 
     m_scrollDimensionsDirty = true;
@@ -455,7 +533,7 @@
 
     computeScrollDimensions();
 
-    if (!box->isMarquee()) {
+    if (!m_box->isMarquee()) {
         // Layout may cause us to be at an invalid scroll position. In this case we need
         // to pull our scroll offsets back to the max (or push them up to the min).
         IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset());
@@ -470,41 +548,41 @@
     bool hasVerticalOverflow = this->hasVerticalOverflow();
 
     // overflow:scroll should just enable/disable.
-    if (renderer()->style()->overflowX() == OSCROLL)
+    if (m_box->style()->overflowX() == OSCROLL)
         horizontalScrollbar()->setEnabled(hasHorizontalOverflow);
-    if (renderer()->style()->overflowY() == OSCROLL)
+    if (m_box->style()->overflowY() == OSCROLL)
         verticalScrollbar()->setEnabled(hasVerticalOverflow);
 
     // overflow:auto may need to lay out again if scrollbars got added/removed.
-    bool autoHorizontalScrollBarChanged = box->hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow);
-    bool autoVerticalScrollBarChanged = box->hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow);
+    bool autoHorizontalScrollBarChanged = m_box->hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow);
+    bool autoVerticalScrollBarChanged = m_box->hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow);
 
     if (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged) {
-        if (box->hasAutoHorizontalScrollbar())
+        if (m_box->hasAutoHorizontalScrollbar())
             setHasHorizontalScrollbar(hasHorizontalOverflow);
-        if (box->hasAutoVerticalScrollbar())
+        if (m_box->hasAutoVerticalScrollbar())
             setHasVerticalScrollbar(hasVerticalOverflow);
 
-        m_layer->updateSelfPaintingLayer();
+        layer()->updateSelfPaintingLayer();
 
         // Force an update since we know the scrollbars have changed things.
-        if (renderer()->document().hasAnnotatedRegions())
-            renderer()->document().setAnnotatedRegionsDirty(true);
+        if (m_box->document().hasAnnotatedRegions())
+            m_box->document().setAnnotatedRegionsDirty(true);
 
-        renderer()->repaint();
+        m_box->repaint();
 
-        if (renderer()->style()->overflowX() == OAUTO || renderer()->style()->overflowY() == OAUTO) {
+        if (m_box->style()->overflowX() == OAUTO || m_box->style()->overflowY() == OAUTO) {
             if (!m_inOverflowRelayout) {
                 // Our proprietary overflow: overlay value doesn't trigger a layout.
                 m_inOverflowRelayout = true;
-                SubtreeLayoutScope layoutScope(renderer());
-                layoutScope.setNeedsLayout(renderer());
-                if (renderer()->isRenderBlock()) {
-                    RenderBlock* block = toRenderBlock(renderer());
+                SubtreeLayoutScope layoutScope(m_box);
+                layoutScope.setNeedsLayout(m_box);
+                if (m_box->isRenderBlock()) {
+                    RenderBlock* block = toRenderBlock(m_box);
                     block->scrollbarsChanged(autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
                     block->layoutBlock(true);
                 } else {
-                    renderer()->layout();
+                    m_box->layout();
                 }
                 m_inOverflowRelayout = false;
             }
@@ -513,39 +591,39 @@
 
     // Set up the range (and page step/line step).
     if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
-        int clientWidth = box->pixelSnappedClientWidth();
+        int clientWidth = m_box->pixelSnappedClientWidth();
         horizontalScrollbar->setProportion(clientWidth, overflowRect().width());
     }
     if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
-        int clientHeight = box->pixelSnappedClientHeight();
+        int clientHeight = m_box->pixelSnappedClientHeight();
         verticalScrollbar->setProportion(clientHeight, overflowRect().height());
     }
 
-    m_layer->updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
+    layer()->updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
 }
 
 bool RenderLayerScrollableArea::hasHorizontalOverflow() const
 {
     ASSERT(!m_scrollDimensionsDirty);
 
-    return scrollWidth() > toRenderBox(renderer())->pixelSnappedClientWidth();
+    return scrollWidth() > m_box->pixelSnappedClientWidth();
 }
 
 bool RenderLayerScrollableArea::hasVerticalOverflow() const
 {
     ASSERT(!m_scrollDimensionsDirty);
 
-    return scrollHeight() > toRenderBox(renderer())->pixelSnappedClientHeight();
+    return scrollHeight() > m_box->pixelSnappedClientHeight();
 }
 
 bool RenderLayerScrollableArea::hasScrollableHorizontalOverflow() const
 {
-    return hasHorizontalOverflow() && toRenderBox(renderer())->scrollsOverflowX();
+    return hasHorizontalOverflow() && m_box->scrollsOverflowX();
 }
 
 bool RenderLayerScrollableArea::hasScrollableVerticalOverflow() const
 {
-    return hasVerticalOverflow() && toRenderBox(renderer())->scrollsOverflowY();
+    return hasVerticalOverflow() && m_box->scrollsOverflowY();
 }
 
 static bool overflowRequiresScrollbar(EOverflow overflow)
@@ -560,21 +638,15 @@
 
 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldStyle)
 {
-    // Overflow are a box concept.
-    if (!renderer()->isBox())
-        return;
-
-    RenderBox* box = toRenderBox(renderer());
-
     // List box parts handle the scrollbars by themselves so we have nothing to do.
-    if (box->style()->appearance() == ListboxPart)
+    if (m_box->style()->appearance() == ListboxPart)
         return;
 
     if (!m_scrollDimensionsDirty)
-        m_layer->updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
+        layer()->updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
 
-    EOverflow overflowX = box->style()->overflowX();
-    EOverflow overflowY = box->style()->overflowY();
+    EOverflow overflowX = m_box->style()->overflowX();
+    EOverflow overflowY = m_box->style()->overflowY();
 
     // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep any automatic scrollbar that was already present.
     bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefinesAutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX);
@@ -601,14 +673,14 @@
         m_vBar->styleChanged();
 
     updateScrollCornerStyle();
+    updateResizerAreaSet();
+    updateResizerStyle();
 }
 
 IntSize RenderLayerScrollableArea::clampScrollOffset(const IntSize& scrollOffset) const
 {
-    RenderBox* box = toRenderBox(renderer());
-
-    int maxX = scrollWidth() - box->pixelSnappedClientWidth();
-    int maxY = scrollHeight() - box->pixelSnappedClientHeight();
+    int maxX = scrollWidth() - m_box->pixelSnappedClientWidth();
+    int maxY = scrollHeight() - m_box->pixelSnappedClientHeight();
 
     int x = std::max(std::min(scrollOffset.width(), maxX), 0);
     int y = std::max(std::min(scrollOffset.height(), maxY), 0);
@@ -620,12 +692,11 @@
     if (!m_hBar)
         return IntRect();
 
-    const RenderBox* box = toRenderBox(renderer());
     const IntRect& scrollCorner = scrollCornerRect();
 
     return IntRect(horizontalScrollbarStart(borderBoxRect.x()),
-        borderBoxRect.maxY() - box->borderBottom() - m_hBar->height(),
-        borderBoxRect.width() - (box->borderLeft() + box->borderRight()) - scrollCorner.width(),
+        borderBoxRect.maxY() - m_box->borderBottom() - m_hBar->height(),
+        borderBoxRect.width() - (m_box->borderLeft() + m_box->borderRight()) - scrollCorner.width(),
         m_hBar->height());
 }
 
@@ -634,41 +705,36 @@
     if (!m_vBar)
         return IntRect();
 
-    const RenderBox* box = toRenderBox(renderer());
     const IntRect& scrollCorner = scrollCornerRect();
 
     return IntRect(verticalScrollbarStart(borderBoxRect.x(), borderBoxRect.maxX()),
-        borderBoxRect.y() + box->borderTop(),
+        borderBoxRect.y() + m_box->borderTop(),
         m_vBar->width(),
-        borderBoxRect.height() - (box->borderTop() + box->borderBottom()) - scrollCorner.height());
+        borderBoxRect.height() - (m_box->borderTop() + m_box->borderBottom()) - scrollCorner.height());
 }
 
 LayoutUnit RenderLayerScrollableArea::verticalScrollbarStart(int minX, int maxX) const
 {
-    const RenderBox* box = toRenderBox(renderer());
-    if (renderer()->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
-        return minX + box->borderLeft();
-    return maxX - box->borderRight() - m_vBar->width();
+    if (m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+        return minX + m_box->borderLeft();
+    return maxX - m_box->borderRight() - m_vBar->width();
 }
 
 LayoutUnit RenderLayerScrollableArea::horizontalScrollbarStart(int minX) const
 {
-    const RenderBox* box = toRenderBox(renderer());
-    int x = minX + box->borderLeft();
-    if (renderer()->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
-        x += m_vBar ? m_vBar->width() : m_layer->resizerCornerRect(box->pixelSnappedBorderBoxRect(), ResizerForPointer).width();
+    int x = minX + m_box->borderLeft();
+    if (m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+        x += m_vBar ? m_vBar->width() : resizerCornerRect(m_box->pixelSnappedBorderBoxRect(), ResizerForPointer).width();
     return x;
 }
 
 IntSize RenderLayerScrollableArea::scrollbarOffset(const Scrollbar* scrollbar) const
 {
-    RenderBox* box = toRenderBox(renderer());
-
     if (scrollbar == m_vBar.get())
-        return IntSize(verticalScrollbarStart(0, box->width()), box->borderTop());
+        return IntSize(verticalScrollbarStart(0, m_box->width()), m_box->borderTop());
 
     if (scrollbar == m_hBar.get())
-        return IntSize(horizontalScrollbarStart(0), box->height() - box->borderBottom() - scrollbar->height());
+        return IntSize(horizontalScrollbarStart(0), m_box->height() - m_box->borderBottom() - scrollbar->height());
 
     ASSERT_NOT_REACHED();
     return IntSize();
@@ -689,7 +755,7 @@
 PassRefPtr<Scrollbar> RenderLayerScrollableArea::createScrollbar(ScrollbarOrientation orientation)
 {
     RefPtr<Scrollbar> widget;
-    RenderObject* actualRenderer = rendererForScrollbar(renderer());
+    RenderObject* actualRenderer = rendererForScrollbar(m_box);
     bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->style()->hasPseudoStyle(SCROLLBAR);
     if (hasCustomScrollbarStyle) {
         widget = RenderScrollbar::createCustomScrollbar(this, orientation, actualRenderer->node());
@@ -700,7 +766,7 @@
         else
             didAddVerticalScrollbar(widget.get());
     }
-    renderer()->document().view()->addChild(widget.get());
+    m_box->document().view()->addChild(widget.get());
     return widget.release();
 }
 
@@ -739,8 +805,8 @@
         m_vBar->styleChanged();
 
     // Force an update since we know the scrollbars have changed things.
-    if (renderer()->document().hasAnnotatedRegions())
-        renderer()->document().setAnnotatedRegionsDirty(true);
+    if (m_box->document().hasAnnotatedRegions())
+        m_box->document().setAnnotatedRegionsDirty(true);
 }
 
 void RenderLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar)
@@ -760,8 +826,8 @@
         m_vBar->styleChanged();
 
     // Force an update since we know the scrollbars have changed things.
-    if (renderer()->document().hasAnnotatedRegions())
-        renderer()->document().setAnnotatedRegionsDirty(true);
+    if (m_box->document().hasAnnotatedRegions())
+        m_box->document().setAnnotatedRegionsDirty(true);
 }
 
 int RenderLayerScrollableArea::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const
@@ -781,7 +847,10 @@
 
 void RenderLayerScrollableArea::positionOverflowControls(const IntSize& offsetFromRoot)
 {
-    const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect();
+    if (!hasScrollbar() && !m_box->canResize())
+        return;
+
+    const IntRect borderBox = m_box->pixelSnappedBorderBoxRect();
     if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
         IntRect vBarRect = rectForVerticalScrollbar(borderBox);
         vBarRect.move(offsetFromRoot);
@@ -797,16 +866,22 @@
     const IntRect& scrollCorner = scrollCornerRect();
     if (m_scrollCorner)
         m_scrollCorner->setFrameRect(scrollCorner);
+
+    if (m_resizer)
+        m_resizer->setFrameRect(resizerCornerRect(borderBox, ResizerForPointer));
+
+    if (m_box->compositedLayerMapping())
+        m_box->compositedLayerMapping()->positionOverflowControlsLayers(offsetFromRoot);
 }
 
 void RenderLayerScrollableArea::updateScrollCornerStyle()
 {
-    RenderObject* actualRenderer = rendererForScrollbar(renderer());
-    RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->style()) : PassRefPtr<RenderStyle>(0);
+    RenderObject* actualRenderer = rendererForScrollbar(m_box);
+    RefPtr<RenderStyle> corner = m_box->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->style()) : PassRefPtr<RenderStyle>(0);
     if (corner) {
         if (!m_scrollCorner) {
-            m_scrollCorner = RenderScrollbarPart::createAnonymous(&renderer()->document());
-            m_scrollCorner->setParent(renderer());
+            m_scrollCorner = RenderScrollbarPart::createAnonymous(&m_box->document());
+            m_scrollCorner->setParent(m_box);
         }
         m_scrollCorner->setStyle(corner.release());
     } else if (m_scrollCorner) {
@@ -815,9 +890,21 @@
     }
 }
 
-// FIXME: Move m_cachedOverlayScrollbarOffset.
 void RenderLayerScrollableArea::paintOverflowControls(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls)
 {
+    // Don't do anything if we have no overflow.
+    if (!m_box->hasOverflowClip())
+        return;
+
+    IntPoint adjustedPaintOffset = paintOffset;
+    if (paintingOverlayControls)
+        adjustedPaintOffset = m_cachedOverlayScrollbarOffset;
+
+    // Move the scrollbar widgets if necessary. We normally move and resize widgets during layout,
+    // but sometimes widgets can move without layout occurring (most notably when you scroll a
+    // document that contains fixed positioned elements).
+    positionOverflowControls(toIntSize(adjustedPaintOffset));
+
     // Overlay scrollbars paint in a second pass through the layer tree so that they will paint
     // on top of everything else. If this is the normal painting pass, paintingOverlayControls
     // will be false, and we should just tell the root layer that there are overlay scrollbars
@@ -825,18 +912,18 @@
     // and we'll paint the scrollbars then. In the meantime, cache tx and ty so that the
     // second pass doesn't need to re-enter the RenderTree to get it right.
     if (hasOverlayScrollbars() && !paintingOverlayControls) {
-        m_layer->m_cachedOverlayScrollbarOffset = paintOffset;
+        m_cachedOverlayScrollbarOffset = paintOffset;
         // It's not necessary to do the second pass if the scrollbars paint into layers.
         if ((m_hBar && layerForHorizontalScrollbar()) || (m_vBar && layerForVerticalScrollbar()))
             return;
         IntRect localDamgeRect = damageRect;
         localDamgeRect.moveBy(-paintOffset);
-        if (!m_layer->overflowControlsIntersectRect(localDamgeRect))
+        if (!overflowControlsIntersectRect(localDamgeRect))
             return;
 
-        RenderView* renderView = renderer()->view();
+        RenderView* renderView = m_box->view();
 
-        RenderLayer* paintingRoot = m_layer->enclosingCompositingLayer();
+        RenderLayer* paintingRoot = layer()->enclosingCompositingLayer();
         if (!paintingRoot)
             paintingRoot = renderView->layer();
 
@@ -859,17 +946,14 @@
 
     // We fill our scroll corner with white if we have a scrollbar that doesn't run all the way up to the
     // edge of the box.
-    IntPoint adjustedPaintOffset = paintOffset;
-    if (paintingOverlayControls)
-        adjustedPaintOffset = m_layer->m_cachedOverlayScrollbarOffset;
-
     paintScrollCorner(context, adjustedPaintOffset, damageRect);
+
+    // Paint our resizer last, since it sits on top of the scroll corner.
+    paintResizer(context, adjustedPaintOffset, damageRect);
 }
 
 void RenderLayerScrollableArea::paintScrollCorner(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect)
 {
-    ASSERT(renderer()->isBox());
-
     IntRect absRect = scrollCornerRect();
     absRect.moveBy(paintOffset);
     if (!absRect.intersects(damageRect))
@@ -891,16 +975,24 @@
         context->fillRect(absRect, Color::white);
 }
 
-bool RenderLayerScrollableArea::hitTestOverflowControls(HitTestResult& result, const IntPoint& localPoint, const IntRect& resizeControlRect)
+bool RenderLayerScrollableArea::hitTestOverflowControls(HitTestResult& result, const IntPoint& localPoint)
 {
-    RenderBox* box = toRenderBox(renderer());
+    if (!hasScrollbar() && !m_box->canResize())
+        return false;
+
+    IntRect resizeControlRect;
+    if (m_box->style()->resize() != RESIZE_NONE) {
+        resizeControlRect = resizerCornerRect(m_box->pixelSnappedBorderBoxRect(), ResizerForPointer);
+        if (resizeControlRect.contains(localPoint))
+            return true;
+    }
 
     int resizeControlSize = max(resizeControlRect.height(), 0);
     if (m_vBar && m_vBar->shouldParticipateInHitTesting()) {
-        LayoutRect vBarRect(verticalScrollbarStart(0, box->width()),
-            box->borderTop(),
+        LayoutRect vBarRect(verticalScrollbarStart(0, m_box->width()),
+            m_box->borderTop(),
             m_vBar->width(),
-            box->height() - (box->borderTop() + box->borderBottom()) - (m_hBar ? m_hBar->height() : resizeControlSize));
+            m_box->height() - (m_box->borderTop() + m_box->borderBottom()) - (m_hBar ? m_hBar->height() : resizeControlSize));
         if (vBarRect.contains(localPoint)) {
             result.setScrollbar(m_vBar.get());
             return true;
@@ -910,8 +1002,8 @@
     resizeControlSize = max(resizeControlRect.width(), 0);
     if (m_hBar && m_hBar->shouldParticipateInHitTesting()) {
         LayoutRect hBarRect(horizontalScrollbarStart(0),
-            box->height() - box->borderBottom() - m_hBar->height(),
-            box->width() - (box->borderLeft() + box->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize),
+            m_box->height() - m_box->borderBottom() - m_hBar->height(),
+            m_box->width() - (m_box->borderLeft() + m_box->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize),
             m_hBar->height());
         if (hBarRect.contains(localPoint)) {
             result.setScrollbar(m_hBar.get());
@@ -924,4 +1016,263 @@
     return false;
 }
 
+IntRect RenderLayerScrollableArea::resizerCornerRect(const IntRect& bounds, ResizerHitTestType resizerHitTestType) const
+{
+    if (m_box->style()->resize() == RESIZE_NONE)
+        return IntRect();
+    IntRect corner = cornerRect(m_box->style(), horizontalScrollbar(), verticalScrollbar(), bounds);
+
+    if (resizerHitTestType == ResizerForTouch) {
+        // We make the resizer virtually larger for touch hit testing. With the
+        // expanding ratio k = ResizerControlExpandRatioForTouch, we first move
+        // the resizer rect (of width w & height h), by (-w * (k-1), -h * (k-1)),
+        // then expand the rect by new_w/h = w/h * k.
+        int expandRatio = ResizerControlExpandRatioForTouch - 1;
+        corner.move(-corner.width() * expandRatio, -corner.height() * expandRatio);
+        corner.expand(corner.width() * expandRatio, corner.height() * expandRatio);
+    }
+
+    return corner;
+}
+
+IntRect RenderLayerScrollableArea::scrollCornerAndResizerRect() const
+{
+    IntRect scrollCornerAndResizer = scrollCornerRect();
+    if (scrollCornerAndResizer.isEmpty())
+        scrollCornerAndResizer = resizerCornerRect(m_box->pixelSnappedBorderBoxRect(), ResizerForPointer);
+    return scrollCornerAndResizer;
+}
+
+bool RenderLayerScrollableArea::overflowControlsIntersectRect(const IntRect& localRect) const
+{
+    const IntRect borderBox = m_box->pixelSnappedBorderBoxRect();
+
+    if (rectForHorizontalScrollbar(borderBox).intersects(localRect))
+        return true;
+
+    if (rectForVerticalScrollbar(borderBox).intersects(localRect))
+        return true;
+
+    if (scrollCornerRect().intersects(localRect))
+        return true;
+
+    if (resizerCornerRect(borderBox, ResizerForPointer).intersects(localRect))
+        return true;
+
+    return false;
+}
+
+void RenderLayerScrollableArea::paintResizer(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect)
+{
+    if (m_box->style()->resize() == RESIZE_NONE)
+        return;
+
+    IntRect absRect = resizerCornerRect(m_box->pixelSnappedBorderBoxRect(), ResizerForPointer);
+    absRect.moveBy(paintOffset);
+    if (!absRect.intersects(damageRect))
+        return;
+
+    if (context->updatingControlTints()) {
+        updateResizerStyle();
+        return;
+    }
+
+    if (m_resizer) {
+        m_resizer->paintIntoRect(context, paintOffset, absRect);
+        return;
+    }
+
+    drawPlatformResizerImage(context, absRect);
+
+    // Draw a frame around the resizer (1px grey line) if there are any scrollbars present.
+    // Clipping will exclude the right and bottom edges of this frame.
+    if (!hasOverlayScrollbars() && hasScrollbar()) {
+        GraphicsContextStateSaver stateSaver(*context);
+        context->clip(absRect);
+        IntRect largerCorner = absRect;
+        largerCorner.setSize(IntSize(largerCorner.width() + 1, largerCorner.height() + 1));
+        context->setStrokeColor(Color(217, 217, 217));
+        context->setStrokeThickness(1.0f);
+        context->setFillColor(Color::transparent);
+        context->drawRect(largerCorner);
+    }
+}
+
+bool RenderLayerScrollableArea::isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestType resizerHitTestType) const
+{
+    if (!m_box->canResize())
+        return false;
+
+    IntPoint localPoint = roundedIntPoint(m_box->absoluteToLocal(absolutePoint, UseTransforms));
+    IntRect localBounds(0, 0, m_box->pixelSnappedWidth(), m_box->pixelSnappedHeight());
+    return resizerCornerRect(localBounds, resizerHitTestType).contains(localPoint);
+}
+
+bool RenderLayerScrollableArea::hitTestResizerInFragments(const LayerFragments& layerFragments, const HitTestLocation& hitTestLocation) const
+{
+    if (!m_box->canResize())
+        return false;
+
+    if (layerFragments.isEmpty())
+        return false;
+
+    for (int i = layerFragments.size() - 1; i >= 0; --i) {
+        const LayerFragment& fragment = layerFragments.at(i);
+        if (fragment.backgroundRect.intersects(hitTestLocation) && resizerCornerRect(pixelSnappedIntRect(fragment.layerBounds), ResizerForPointer).contains(hitTestLocation.roundedPoint()))
+            return true;
+    }
+
+    return false;
+}
+
+void RenderLayerScrollableArea::updateResizerAreaSet()
+{
+    Frame* frame = m_box->frame();
+    if (!frame)
+        return;
+    FrameView* frameView = frame->view();
+    if (!frameView)
+        return;
+    if (m_box->canResize())
+        frameView->addResizerArea(m_box);
+    else
+        frameView->removeResizerArea(m_box);
+}
+
+void RenderLayerScrollableArea::updateResizerStyle()
+{
+    RenderObject* actualRenderer = rendererForScrollbar(m_box);
+    RefPtr<RenderStyle> resizer = m_box->hasOverflowClip() ? actualRenderer->getUncachedPseudoStyle(PseudoStyleRequest(RESIZER), actualRenderer->style()) : PassRefPtr<RenderStyle>(0);
+    if (resizer) {
+        if (!m_resizer) {
+            m_resizer = RenderScrollbarPart::createAnonymous(&m_box->document());
+            m_resizer->setParent(m_box);
+        }
+        m_resizer->setStyle(resizer.release());
+    } else if (m_resizer) {
+        m_resizer->destroy();
+        m_resizer = 0;
+    }
+}
+
+void RenderLayerScrollableArea::drawPlatformResizerImage(GraphicsContext* context, IntRect resizerCornerRect)
+{
+    float deviceScaleFactor = WebCore::deviceScaleFactor(m_box->frame());
+
+    RefPtr<Image> resizeCornerImage;
+    IntSize cornerResizerSize;
+    if (deviceScaleFactor >= 2) {
+        DEFINE_STATIC_LOCAL(Image*, resizeCornerImageHiRes, (Image::loadPlatformResource("textAreaResizeCorner@2x").leakRef()));
+        resizeCornerImage = resizeCornerImageHiRes;
+        cornerResizerSize = resizeCornerImage->size();
+        cornerResizerSize.scale(0.5f);
+    } else {
+        DEFINE_STATIC_LOCAL(Image*, resizeCornerImageLoRes, (Image::loadPlatformResource("textAreaResizeCorner").leakRef()));
+        resizeCornerImage = resizeCornerImageLoRes;
+        cornerResizerSize = resizeCornerImage->size();
+    }
+
+    if (m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
+        context->save();
+        context->translate(resizerCornerRect.x() + cornerResizerSize.width(), resizerCornerRect.y() + resizerCornerRect.height() - cornerResizerSize.height());
+        context->scale(FloatSize(-1.0, 1.0));
+        context->drawImage(resizeCornerImage.get(), IntRect(IntPoint(), cornerResizerSize));
+        context->restore();
+        return;
+    }
+    IntRect imageRect(resizerCornerRect.maxXMaxYCorner() - cornerResizerSize, cornerResizerSize);
+    context->drawImage(resizeCornerImage.get(), imageRect);
+}
+
+IntSize RenderLayerScrollableArea::offsetFromResizeCorner(const IntPoint& absolutePoint) const
+{
+    // Currently the resize corner is either the bottom right corner or the bottom left corner.
+    // FIXME: This assumes the location is 0, 0. Is this guaranteed to always be the case?
+    IntSize elementSize = layer()->size();
+    if (m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+        elementSize.setWidth(0);
+    IntPoint resizerPoint = IntPoint(elementSize);
+    IntPoint localPoint = roundedIntPoint(m_box->absoluteToLocal(absolutePoint, UseTransforms));
+    return localPoint - resizerPoint;
+}
+
+void RenderLayerScrollableArea::resize(const PlatformEvent& evt, const LayoutSize& oldOffset)
+{
+    // FIXME: This should be possible on generated content but is not right now.
+    if (!inResizeMode() || !m_box->canResize() || !m_box->node())
+        return;
+
+    ASSERT(m_box->node()->isElementNode());
+    Element* element = toElement(m_box->node());
+
+    Document& document = element->document();
+
+    IntPoint pos;
+    const PlatformGestureEvent* gevt = 0;
+
+    switch (evt.type()) {
+    case PlatformEvent::MouseMoved:
+        if (!document.frame()->eventHandler()->mousePressed())
+            return;
+        pos = static_cast<const PlatformMouseEvent*>(&evt)->position();
+        break;
+    case PlatformEvent::GestureScrollUpdate:
+    case PlatformEvent::GestureScrollUpdateWithoutPropagation:
+        pos = static_cast<const PlatformGestureEvent*>(&evt)->position();
+        gevt = static_cast<const PlatformGestureEvent*>(&evt);
+        pos = gevt->position();
+        pos.move(gevt->deltaX(), gevt->deltaY());
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    float zoomFactor = m_box->style()->effectiveZoom();
+
+    LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToContents(pos));
+    newOffset.setWidth(newOffset.width() / zoomFactor);
+    newOffset.setHeight(newOffset.height() / zoomFactor);
+
+    LayoutSize currentSize = LayoutSize(m_box->width() / zoomFactor, m_box->height() / zoomFactor);
+    LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
+    element->setMinimumSizeForResizing(minimumSize);
+
+    LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
+    if (m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
+        newOffset.setWidth(-newOffset.width());
+        adjustedOldOffset.setWidth(-adjustedOldOffset.width());
+    }
+
+    LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;
+
+    bool isBoxSizingBorder = m_box->style()->boxSizing() == BORDER_BOX;
+
+    EResize resize = m_box->style()->resize();
+    if (resize != RESIZE_VERTICAL && difference.width()) {
+        if (element->isFormControlElement()) {
+            // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>).
+            element->setInlineStyleProperty(CSSPropertyMarginLeft, m_box->marginLeft() / zoomFactor, CSSPrimitiveValue::CSS_PX);
+            element->setInlineStyleProperty(CSSPropertyMarginRight, m_box->marginRight() / zoomFactor, CSSPrimitiveValue::CSS_PX);
+        }
+        LayoutUnit baseWidth = m_box->width() - (isBoxSizingBorder ? LayoutUnit() : m_box->borderAndPaddingWidth());
+        baseWidth = baseWidth / zoomFactor;
+        element->setInlineStyleProperty(CSSPropertyWidth, roundToInt(baseWidth + difference.width()), CSSPrimitiveValue::CSS_PX);
+    }
+
+    if (resize != RESIZE_HORIZONTAL && difference.height()) {
+        if (element->isFormControlElement()) {
+            // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>).
+            element->setInlineStyleProperty(CSSPropertyMarginTop, m_box->marginTop() / zoomFactor, CSSPrimitiveValue::CSS_PX);
+            element->setInlineStyleProperty(CSSPropertyMarginBottom, m_box->marginBottom() / zoomFactor, CSSPrimitiveValue::CSS_PX);
+        }
+        LayoutUnit baseHeight = m_box->height() - (isBoxSizingBorder ? LayoutUnit() : m_box->borderAndPaddingHeight());
+        baseHeight = baseHeight / zoomFactor;
+        element->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight + difference.height()), CSSPrimitiveValue::CSS_PX);
+    }
+
+    document.updateLayout();
+
+    // FIXME (Radar 4118564): We should also autoscroll the window as necessary to keep the point under the cursor in view.
+}
+
 } // Namespace WebCore
diff --git a/Source/core/rendering/RenderLayerScrollableArea.h b/Source/core/rendering/RenderLayerScrollableArea.h
index 05e06d3..982274e 100644
--- a/Source/core/rendering/RenderLayerScrollableArea.h
+++ b/Source/core/rendering/RenderLayerScrollableArea.h
@@ -58,17 +58,21 @@
     ScrollOffsetClamped
 };
 
+class PlatformEvent;
+class RenderBox;
 class RenderLayer;
-class RenderLayerModelObject;
 class RenderScrollbarPart;
 
 class RenderLayerScrollableArea FINAL : public ScrollableArea {
     // FIXME: Remove once the bits from RenderLayer have been moved here.
     friend class RenderLayer;
 public:
-    RenderLayerScrollableArea(RenderLayer*);
+    RenderLayerScrollableArea(RenderBox*);
     virtual ~RenderLayerScrollableArea();
 
+    bool hasHorizontalScrollbar() const { return horizontalScrollbar(); }
+    bool hasVerticalScrollbar() const { return verticalScrollbar(); }
+
     virtual Scrollbar* horizontalScrollbar() const OVERRIDE { return m_hBar.get(); }
     virtual Scrollbar* verticalScrollbar() const OVERRIDE { return m_vBar.get(); }
     virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE;
@@ -125,15 +129,26 @@
     // FIXME: This should be removed.
     bool hasScrollCorner() const { return m_scrollCorner; }
 
+    void resize(const PlatformEvent&, const LayoutSize&);
+    IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;
+
+    bool inResizeMode() const { return m_inResizeMode; }
+    void setInResizeMode(bool inResizeMode) { m_inResizeMode = inResizeMode; }
+
+    IntRect touchResizerCornerRect(const IntRect& bounds) const
+    {
+        return resizerCornerRect(bounds, ResizerForTouch);
+    }
+
+    int scrollWidth() const;
+    int scrollHeight() const;
+
 private:
     bool hasHorizontalOverflow() const;
     bool hasVerticalOverflow() const;
     bool hasScrollableHorizontalOverflow() const;
     bool hasScrollableVerticalOverflow() const;
 
-    int scrollWidth() const;
-    int scrollHeight() const;
-
     void computeScrollDimensions();
 
     IntSize clampScrollOffset(const IntSize&) const;
@@ -150,9 +165,6 @@
     PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
     void destroyScrollbar(ScrollbarOrientation);
 
-    bool hasHorizontalScrollbar() const { return horizontalScrollbar(); }
-    bool hasVerticalScrollbar() const { return verticalScrollbar(); }
-
     void setHasHorizontalScrollbar(bool hasScrollbar);
     void setHasVerticalScrollbar(bool hasScrollbar);
 
@@ -163,11 +175,25 @@
     void updateScrollCornerStyle();
     void paintOverflowControls(GraphicsContext*, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls);
     void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& damageRect);
-    bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint, const IntRect&);
+    bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
 
-    RenderLayerModelObject* renderer() const;
+    // See comments on isPointInResizeControl.
+    IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const;
+    IntRect scrollCornerAndResizerRect() const;
+    bool overflowControlsIntersectRect(const IntRect& localRect) const;
+    void paintResizer(GraphicsContext*, const IntPoint& paintOffset, const IntRect& damageRect);
+    bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestType) const;
+    bool hitTestResizerInFragments(const LayerFragments&, const HitTestLocation&) const;
+    void updateResizerAreaSet();
+    void updateResizerStyle();
+    void drawPlatformResizerImage(GraphicsContext*, IntRect resizerCornerRect);
 
-    RenderLayer* m_layer;
+    RenderLayer* layer() const;
+
+    RenderBox* m_box;
+
+    // Keeps track of whether the layer is currently resizing, so events can cause resizing to start and stop.
+    unsigned m_inResizeMode : 1;
 
     unsigned m_scrollDimensionsDirty : 1;
     unsigned m_inOverflowRelayout : 1;
@@ -178,12 +204,17 @@
     // This is the (scroll) offset from scrollOrigin().
     IntSize m_scrollOffset;
 
+    IntPoint m_cachedOverlayScrollbarOffset;
+
     // For areas with overflow, we have a pair of scrollbars.
     RefPtr<Scrollbar> m_hBar;
     RefPtr<Scrollbar> m_vBar;
 
     // Renderers to hold our custom scroll corner.
     RenderScrollbarPart* m_scrollCorner;
+
+    // Renderers to hold our custom resizer.
+    RenderScrollbarPart* m_resizer;
 };
 
 } // Namespace WebCore
diff --git a/Source/core/rendering/RenderListBox.cpp b/Source/core/rendering/RenderListBox.cpp
index 1abdb9a..b0a9637 100644
--- a/Source/core/rendering/RenderListBox.cpp
+++ b/Source/core/rendering/RenderListBox.cpp
@@ -36,7 +36,6 @@
 #include "core/css/CSSFontSelector.h"
 #include "core/css/resolver/StyleResolver.h"
 #include "core/dom/Document.h"
-#include "core/events/DocumentEventQueue.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/editing/FrameSelection.h"
 #include "core/html/HTMLOptGroupElement.h"
@@ -44,8 +43,8 @@
 #include "core/html/HTMLSelectElement.h"
 #include "core/page/EventHandler.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/SpatialNavigation.h"
 #include "core/platform/Scrollbar.h"
@@ -638,7 +637,7 @@
 
     m_indexOffset = newOffset;
     repaint();
-    node()->document().eventQueue()->enqueueOrDispatchScrollEvent(node(), DocumentEventQueue::ScrollEventElementTarget);
+    node()->document().enqueueScrollEventForNode(node());
 }
 
 LayoutUnit RenderListBox::itemHeight() const
diff --git a/Source/core/rendering/RenderMarquee.cpp b/Source/core/rendering/RenderMarquee.cpp
index 5849222..b3275a5 100644
--- a/Source/core/rendering/RenderMarquee.cpp
+++ b/Source/core/rendering/RenderMarquee.cpp
@@ -48,7 +48,7 @@
 
 #include "HTMLNames.h"
 #include "core/html/HTMLMarqueeElement.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/UseCounter.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderView.h"
@@ -72,7 +72,7 @@
     , m_stopped(false)
     , m_direction(MAUTO)
 {
-    UseCounter::count(&document(), UseCounter::HTMLMarqueeElement);
+    UseCounter::count(document(), UseCounter::HTMLMarqueeElement);
 }
 
 RenderMarquee::~RenderMarquee()
@@ -162,27 +162,17 @@
     if (m_timer.isActive() || style()->marqueeIncrement().isZero())
         return;
 
-    // We may end up propagating a scroll event. It is important that we suspend events until
-    // the end of the function since they could delete the layer, including the marquee.
-    FrameView* frameView = document().view();
-    if (frameView)
-        frameView->pauseScheduledEvents();
-
     if (!m_suspended && !m_stopped) {
         if (isHorizontal())
             layer()->scrollToOffset(IntSize(m_start, 0));
         else
             layer()->scrollToOffset(IntSize(0, m_start));
-    }
-    else {
+    } else {
         m_suspended = false;
         m_stopped = false;
     }
 
     m_timer.startRepeating(speed() * 0.001);
-
-    if (frameView)
-        frameView->resumeScheduledEvents();
 }
 
 void RenderMarquee::suspend()
diff --git a/Source/core/rendering/RenderMarquee.h b/Source/core/rendering/RenderMarquee.h
index 8cf3a79..c311dd5 100644
--- a/Source/core/rendering/RenderMarquee.h
+++ b/Source/core/rendering/RenderMarquee.h
@@ -45,9 +45,9 @@
 #define RenderMarquee_h
 
 #include "core/platform/Length.h"
-#include "core/platform/Timer.h"
 #include "core/rendering/RenderBlockFlow.h"
 #include "core/rendering/style/RenderStyleConstants.h"
+#include "platform/Timer.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/RenderMediaControls.cpp b/Source/core/rendering/RenderMediaControls.cpp
index ae146c0..88cb469 100644
--- a/Source/core/rendering/RenderMediaControls.cpp
+++ b/Source/core/rendering/RenderMediaControls.cpp
@@ -1,5 +1,7 @@
 /*
- * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2009 Apple Inc.
+ * 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
@@ -24,12 +26,427 @@
  */
 
 #include "config.h"
-
 #include "core/rendering/RenderMediaControls.h"
 
-// FIXME: Unify more of the code for Mac and Win.
-
-using namespace std;
+#include "bindings/v8/ExceptionStatePlaceholder.h"
+#include "core/html/HTMLMediaElement.h"
+#include "core/html/TimeRanges.h"
+#include "core/platform/graphics/Gradient.h"
+#include "core/platform/graphics/GraphicsContext.h"
+#include "core/rendering/PaintInfo.h"
 
 namespace WebCore {
+
+typedef WTF::HashMap<const char*, Image*> MediaControlImageMap;
+static MediaControlImageMap* gMediaControlImageMap = 0;
+
+static Image* platformResource(const char* name)
+{
+    if (!gMediaControlImageMap)
+        gMediaControlImageMap = new MediaControlImageMap();
+    if (Image* image = gMediaControlImageMap->get(name))
+        return image;
+    if (Image* image = Image::loadPlatformResource(name).leakRef()) {
+        gMediaControlImageMap->set(name, image);
+        return image;
+    }
+    ASSERT_NOT_REACHED();
+    return 0;
 }
+
+static bool hasSource(const HTMLMediaElement* mediaElement)
+{
+    return mediaElement->networkState() != HTMLMediaElement::NETWORK_EMPTY
+        && mediaElement->networkState() != HTMLMediaElement::NETWORK_NO_SOURCE;
+}
+
+static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Image* image)
+{
+    context->drawImage(image, rect);
+    return true;
+}
+
+static bool paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    HTMLMediaElement* mediaElement = toParentMediaElement(object);
+    if (!mediaElement)
+        return false;
+
+    static Image* soundLevel3 = platformResource("mediaplayerSoundLevel3");
+    static Image* soundLevel2 = platformResource("mediaplayerSoundLevel2");
+    static Image* soundLevel1 = platformResource("mediaplayerSoundLevel1");
+    static Image* soundLevel0 = platformResource("mediaplayerSoundLevel0");
+    static Image* soundDisabled = platformResource("mediaplayerSoundDisabled");
+
+    if (!hasSource(mediaElement) || !mediaElement->hasAudio())
+        return paintMediaButton(paintInfo.context, rect, soundDisabled);
+
+    if (mediaElement->muted() || mediaElement->volume() <= 0)
+        return paintMediaButton(paintInfo.context, rect, soundLevel0);
+
+    if (mediaElement->volume() <= 0.33)
+        return paintMediaButton(paintInfo.context, rect, soundLevel1);
+
+    if (mediaElement->volume() <= 0.66)
+        return paintMediaButton(paintInfo.context, rect, soundLevel2);
+
+    return paintMediaButton(paintInfo.context, rect, soundLevel3);
+}
+
+static bool paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    HTMLMediaElement* mediaElement = toParentMediaElement(object);
+    if (!mediaElement)
+        return false;
+
+    static Image* mediaPlay = platformResource("mediaplayerPlay");
+    static Image* mediaPause = platformResource("mediaplayerPause");
+    static Image* mediaPlayDisabled = platformResource("mediaplayerPlayDisabled");
+
+    if (!hasSource(mediaElement))
+        return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled);
+
+    return paintMediaButton(paintInfo.context, rect, mediaElement->canPlay() ? mediaPlay : mediaPause);
+}
+
+static bool paintMediaOverlayPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    HTMLMediaElement* mediaElement = toParentMediaElement(object);
+    if (!mediaElement)
+        return false;
+
+    if (!hasSource(mediaElement) || !mediaElement->canPlay())
+        return false;
+
+    static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay");
+    return paintMediaButton(paintInfo.context, rect, mediaOverlayPlay);
+}
+
+static Image* getMediaSliderThumb()
+{
+    static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb");
+    return mediaSliderThumb;
+}
+
+static void paintRoundedSliderBackground(const IntRect& rect, const RenderStyle* style, GraphicsContext* context)
+{
+    int borderRadius = rect.height() / 2;
+    IntSize radii(borderRadius, borderRadius);
+    Color sliderBackgroundColor = Color(11, 11, 11);
+    context->save();
+    context->fillRoundedRect(rect, radii, radii, radii, radii, sliderBackgroundColor);
+    context->restore();
+}
+
+static void paintSliderRangeHighlight(const IntRect& rect, const RenderStyle* style, GraphicsContext* context, int startPosition, int endPosition, Color startColor, Color endColor)
+{
+    // Calculate border radius; need to avoid being smaller than half the slider height
+    // because of https://bugs.webkit.org/show_bug.cgi?id=30143.
+    int borderRadius = rect.height() / 2;
+    IntSize radii(borderRadius, borderRadius);
+
+    // Calculate highlight rectangle and edge dimensions.
+    int startOffset = startPosition;
+    int endOffset = rect.width() - endPosition;
+    int rangeWidth = endPosition - startPosition;
+
+    if (rangeWidth <= 0)
+        return;
+
+    // Make sure the range width is bigger than border radius at the edges to retain rounded corners.
+    if (startOffset < borderRadius && rangeWidth < borderRadius)
+        rangeWidth = borderRadius;
+    if (endOffset < borderRadius && rangeWidth < borderRadius) {
+        startPosition -= borderRadius - rangeWidth;
+        rangeWidth = borderRadius;
+    }
+
+    // Set rectangle to highlight range.
+    IntRect highlightRect = rect;
+    highlightRect.move(startOffset, 0);
+    highlightRect.setWidth(rangeWidth);
+
+    // Don't bother drawing an empty area.
+    if (highlightRect.isEmpty())
+        return;
+
+    // Calculate white-grey gradient.
+    IntPoint sliderTopLeft = highlightRect.location();
+    IntPoint sliderBottomLeft = sliderTopLeft;
+    sliderBottomLeft.move(0, highlightRect.height());
+    RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderBottomLeft);
+    gradient->addColorStop(0.0, startColor);
+    gradient->addColorStop(1.0, endColor);
+
+    // Fill highlight rectangle with gradient, potentially rounded if on left or right edge.
+    context->save();
+    context->setFillGradient(gradient);
+
+    if (startOffset < borderRadius && endOffset < borderRadius)
+        context->fillRoundedRect(highlightRect, radii, radii, radii, radii, startColor);
+    else if (startOffset < borderRadius)
+        context->fillRoundedRect(highlightRect, radii, IntSize(0, 0), radii, IntSize(0, 0), startColor);
+    else if (endOffset < borderRadius)
+        context->fillRoundedRect(highlightRect, IntSize(0, 0), radii, IntSize(0, 0), radii, startColor);
+    else
+        context->fillRect(highlightRect);
+
+    context->restore();
+}
+
+const int mediaSliderThumbWidth = 32;
+
+static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    HTMLMediaElement* mediaElement = toParentMediaElement(object);
+    if (!mediaElement)
+        return false;
+
+    RenderStyle* style = object->style();
+    GraphicsContext* context = paintInfo.context;
+
+    paintRoundedSliderBackground(rect, style, context);
+
+    // Draw the buffered range. Since the element may have multiple buffered ranges and it'd be
+    // distracting/'busy' to show all of them, show only the buffered range containing the current play head.
+    RefPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered();
+    float duration = mediaElement->duration();
+    float currentTime = mediaElement->currentTime();
+    if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan(currentTime))
+        return true;
+
+    for (unsigned i = 0; i < bufferedTimeRanges->length(); ++i) {
+        float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION);
+        float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION);
+        if (std::isnan(start) || std::isnan(end) || start > currentTime || end < currentTime)
+            continue;
+        int startPosition = int(start * rect.width() / duration);
+        int currentPosition = int(currentTime * rect.width() / duration);
+        int endPosition = int(end * rect.width() / duration);
+
+        // Add half the thumb width proportionally adjusted to the current painting position.
+        int thumbCenter = mediaSliderThumbWidth / 2;
+        int addWidth = thumbCenter * (1.0 - 2.0 * currentPosition / rect.width());
+        currentPosition += addWidth;
+
+        // Draw white-ish highlight before current time.
+        Color startColor = Color(195, 195, 195);
+        Color endColor = Color(217, 217, 217);
+        if (currentPosition > startPosition)
+            paintSliderRangeHighlight(rect, style, context, startPosition, currentPosition, startColor, endColor);
+
+        // Draw grey-ish highlight after current time.
+        startColor = Color(60, 60, 60);
+        endColor = Color(76, 76, 76);
+
+        if (endPosition > currentPosition)
+            paintSliderRangeHighlight(rect, style, context, currentPosition, endPosition, startColor, endColor);
+
+        return true;
+    }
+
+    return true;
+}
+
+static bool paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    ASSERT(object->node());
+    HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadowHost());
+    if (!mediaElement)
+        return false;
+
+    if (!hasSource(mediaElement))
+        return true;
+
+    Image* mediaSliderThumb = getMediaSliderThumb();
+    return paintMediaButton(paintInfo.context, rect, mediaSliderThumb);
+}
+
+const int mediaVolumeSliderThumbWidth = 24;
+
+static bool paintMediaVolumeSlider(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    HTMLMediaElement* mediaElement = toParentMediaElement(object);
+    if (!mediaElement)
+        return false;
+
+    GraphicsContext* context = paintInfo.context;
+    RenderStyle* style = object->style();
+
+    paintRoundedSliderBackground(rect, style, context);
+
+    // Calculate volume position for white background rectangle.
+    float volume = mediaElement->volume();
+    if (std::isnan(volume) || volume < 0)
+        return true;
+    if (volume > 1)
+        volume = 1;
+    if (!hasSource(mediaElement) || !mediaElement->hasAudio() || mediaElement->muted())
+        volume = 0;
+
+    // Calculate the position relative to the center of the thumb.
+    float fillWidth = 0;
+    if (volume > 0) {
+        float thumbCenter = mediaVolumeSliderThumbWidth / 2;
+        float zoomLevel = style->effectiveZoom();
+        float positionWidth = volume * (rect.width() - (zoomLevel * thumbCenter));
+        fillWidth = positionWidth + (zoomLevel * thumbCenter / 2);
+    }
+
+    Color startColor = Color(195, 195, 195);
+    Color endColor = Color(217, 217, 217);
+
+    paintSliderRangeHighlight(rect, style, context, 0.0, fillWidth, startColor, endColor);
+
+    return true;
+}
+
+static bool paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    ASSERT(object->node());
+    HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadowHost());
+    if (!mediaElement)
+        return false;
+
+    if (!hasSource(mediaElement) || !mediaElement->hasAudio())
+        return true;
+
+    static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSliderThumb");
+    return paintMediaButton(paintInfo.context, rect, mediaVolumeSliderThumb);
+}
+
+static bool paintMediaFullscreenButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    HTMLMediaElement* mediaElement = toParentMediaElement(object);
+    if (!mediaElement)
+        return false;
+
+    static Image* mediaFullscreenButton = platformResource("mediaplayerFullscreen");
+    return paintMediaButton(paintInfo.context, rect, mediaFullscreenButton);
+}
+
+static bool paintMediaToggleClosedCaptionsButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    HTMLMediaElement* mediaElement = toParentMediaElement(object);
+    if (!mediaElement)
+        return false;
+
+    static Image* mediaClosedCaptionButton = platformResource("mediaplayerClosedCaption");
+    static Image* mediaClosedCaptionButtonDisabled = platformResource("mediaplayerClosedCaptionDisabled");
+
+    if (mediaElement->closedCaptionsVisible())
+        return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButton);
+
+    return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButtonDisabled);
+}
+
+
+bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
+{
+    switch (part) {
+    case MediaMuteButton:
+    case MediaUnMuteButton:
+        return paintMediaMuteButton(object, paintInfo, rect);
+    case MediaPauseButton:
+    case MediaPlayButton:
+        return paintMediaPlayButton(object, paintInfo, rect);
+    case MediaShowClosedCaptionsButton:
+        return paintMediaToggleClosedCaptionsButton(object, paintInfo, rect);
+    case MediaSlider:
+        return paintMediaSlider(object, paintInfo, rect);
+    case MediaSliderThumb:
+        return paintMediaSliderThumb(object, paintInfo, rect);
+    case MediaVolumeSlider:
+        return paintMediaVolumeSlider(object, paintInfo, rect);
+    case MediaVolumeSliderThumb:
+        return paintMediaVolumeSliderThumb(object, paintInfo, rect);
+    case MediaEnterFullscreenButton:
+    case MediaExitFullscreenButton:
+        return paintMediaFullscreenButton(object, paintInfo, rect);
+    case MediaOverlayPlayButton:
+        return paintMediaOverlayPlayButton(object, paintInfo, rect);
+    case MediaVolumeSliderMuteButton:
+    case MediaSeekBackButton:
+    case MediaSeekForwardButton:
+    case MediaVolumeSliderContainer:
+    case MediaTimelineContainer:
+    case MediaCurrentTimeDisplay:
+    case MediaTimeRemainingDisplay:
+    case MediaControlsPanel:
+    case MediaRewindButton:
+    case MediaReturnToRealtimeButton:
+    case MediaStatusDisplay:
+    case MediaHideClosedCaptionsButton:
+    case MediaTextTrackDisplayContainer:
+    case MediaTextTrackDisplay:
+    case MediaFullScreenVolumeSlider:
+    case MediaFullScreenVolumeSliderThumb:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+    return false;
+}
+
+const int mediaSliderThumbHeight = 24;
+const int mediaVolumeSliderThumbHeight = 24;
+
+void RenderMediaControls::adjustMediaSliderThumbSize(RenderStyle* style)
+{
+    static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb");
+    static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSliderThumb");
+    int width = 0;
+    int height = 0;
+
+    Image* thumbImage = 0;
+    if (style->appearance() == MediaSliderThumbPart) {
+        thumbImage = mediaSliderThumb;
+        width = mediaSliderThumbWidth;
+        height = mediaSliderThumbHeight;
+    } else if (style->appearance() == MediaVolumeSliderThumbPart) {
+        thumbImage = mediaVolumeSliderThumb;
+        width = mediaVolumeSliderThumbWidth;
+        height = mediaVolumeSliderThumbHeight;
+    }
+
+    float zoomLevel = style->effectiveZoom();
+    if (thumbImage) {
+        style->setWidth(Length(static_cast<int>(width * zoomLevel), Fixed));
+        style->setHeight(Length(static_cast<int>(height * zoomLevel), Fixed));
+    }
+}
+
+static String formatChromiumMediaControlsTime(float time, float duration)
+{
+    if (!std::isfinite(time))
+        time = 0;
+    if (!std::isfinite(duration))
+        duration = 0;
+    int seconds = static_cast<int>(fabsf(time));
+    int hours = seconds / (60 * 60);
+    int minutes = (seconds / 60) % 60;
+    seconds %= 60;
+
+    // duration defines the format of how the time is rendered
+    int durationSecs = static_cast<int>(fabsf(duration));
+    int durationHours = durationSecs / (60 * 60);
+    int durationMins = (durationSecs / 60) % 60;
+
+    if (durationHours || hours)
+        return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
+    if (durationMins > 9)
+        return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
+
+    return String::format("%s%01d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
+}
+
+String RenderMediaControls::formatMediaControlsTime(float time)
+{
+    return formatChromiumMediaControlsTime(time, time);
+}
+
+String RenderMediaControls::formatMediaControlsCurrentTime(float currentTime, float duration)
+{
+    return formatChromiumMediaControlsTime(currentTime, duration);
+}
+
+} // namespace WebCore
diff --git a/Source/core/rendering/RenderMediaControls.h b/Source/core/rendering/RenderMediaControls.h
index aca27ba..8f40830 100644
--- a/Source/core/rendering/RenderMediaControls.h
+++ b/Source/core/rendering/RenderMediaControls.h
@@ -1,5 +1,7 @@
 /*
- * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2009 Apple Inc.
+ * 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
@@ -34,13 +36,14 @@
 
 class HTMLMediaElement;
 class IntRect;
-class IntSize;
-class RenderBox;
 class RenderObject;
-class RenderStyle;
 
 class RenderMediaControls {
 public:
+    static bool paintMediaControlsPart(MediaControlElementType, RenderObject*, const PaintInfo&, const IntRect&);
+    static void adjustMediaSliderThumbSize(RenderStyle*);
+    static String formatMediaControlsTime(float time);
+    static String formatMediaControlsCurrentTime(float currentTime, float duration);
 };
 
 } // namespace WebCore
diff --git a/Source/core/rendering/RenderMediaControlsChromium.cpp b/Source/core/rendering/RenderMediaControlsChromium.cpp
deleted file mode 100644
index 26fc395..0000000
--- a/Source/core/rendering/RenderMediaControlsChromium.cpp
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc.
- * 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 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/rendering/RenderMediaControlsChromium.h"
-
-#include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/html/HTMLMediaElement.h"
-#include "core/html/TimeRanges.h"
-#include "core/platform/graphics/Gradient.h"
-#include "core/platform/graphics/GraphicsContext.h"
-#include "core/rendering/PaintInfo.h"
-
-namespace WebCore {
-
-typedef WTF::HashMap<const char*, Image*> MediaControlImageMap;
-static MediaControlImageMap* gMediaControlImageMap = 0;
-
-static Image* platformResource(const char* name)
-{
-    if (!gMediaControlImageMap)
-        gMediaControlImageMap = new MediaControlImageMap();
-    if (Image* image = gMediaControlImageMap->get(name))
-        return image;
-    if (Image* image = Image::loadPlatformResource(name).leakRef()) {
-        gMediaControlImageMap->set(name, image);
-        return image;
-    }
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-static bool hasSource(const HTMLMediaElement* mediaElement)
-{
-    return mediaElement->networkState() != HTMLMediaElement::NETWORK_EMPTY
-        && mediaElement->networkState() != HTMLMediaElement::NETWORK_NO_SOURCE;
-}
-
-static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Image* image)
-{
-    context->drawImage(image, rect);
-    return true;
-}
-
-static bool paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-    HTMLMediaElement* mediaElement = toParentMediaElement(object);
-    if (!mediaElement)
-      return false;
-
-    static Image* soundLevel3 = platformResource("mediaplayerSoundLevel3");
-    static Image* soundLevel2 = platformResource("mediaplayerSoundLevel2");
-    static Image* soundLevel1 = platformResource("mediaplayerSoundLevel1");
-    static Image* soundLevel0 = platformResource("mediaplayerSoundLevel0");
-    static Image* soundDisabled = platformResource("mediaplayerSoundDisabled");
-
-    if (!hasSource(mediaElement) || !mediaElement->hasAudio())
-        return paintMediaButton(paintInfo.context, rect, soundDisabled);
-
-    if (mediaElement->muted() || mediaElement->volume() <= 0)
-        return paintMediaButton(paintInfo.context, rect, soundLevel0);
-
-    if (mediaElement->volume() <= 0.33)
-        return paintMediaButton(paintInfo.context, rect, soundLevel1);
-
-    if (mediaElement->volume() <= 0.66)
-        return paintMediaButton(paintInfo.context, rect, soundLevel2);
-
-    return paintMediaButton(paintInfo.context, rect, soundLevel3);
-}
-
-static bool paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-    HTMLMediaElement* mediaElement = toParentMediaElement(object);
-    if (!mediaElement)
-        return false;
-
-    static Image* mediaPlay = platformResource("mediaplayerPlay");
-    static Image* mediaPause = platformResource("mediaplayerPause");
-    static Image* mediaPlayDisabled = platformResource("mediaplayerPlayDisabled");
-
-    if (!hasSource(mediaElement))
-        return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled);
-
-    return paintMediaButton(paintInfo.context, rect, mediaElement->canPlay() ? mediaPlay : mediaPause);
-}
-
-static bool paintMediaOverlayPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-    HTMLMediaElement* mediaElement = toParentMediaElement(object);
-    if (!mediaElement)
-        return false;
-
-    if (!hasSource(mediaElement) || !mediaElement->canPlay())
-        return false;
-
-    static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay");
-    return paintMediaButton(paintInfo.context, rect, mediaOverlayPlay);
-}
-
-static Image* getMediaSliderThumb()
-{
-    static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb");
-    return mediaSliderThumb;
-}
-
-static void paintRoundedSliderBackground(const IntRect& rect, const RenderStyle* style, GraphicsContext* context)
-{
-    int borderRadius = rect.height() / 2;
-    IntSize radii(borderRadius, borderRadius);
-    Color sliderBackgroundColor = Color(11, 11, 11);
-    context->save();
-    context->fillRoundedRect(rect, radii, radii, radii, radii, sliderBackgroundColor);
-    context->restore();
-}
-
-static void paintSliderRangeHighlight(const IntRect& rect, const RenderStyle* style, GraphicsContext* context, int startPosition, int endPosition, Color startColor, Color endColor)
-{
-    // Calculate border radius; need to avoid being smaller than half the slider height
-    // because of https://bugs.webkit.org/show_bug.cgi?id=30143.
-    int borderRadius = rect.height() / 2;
-    IntSize radii(borderRadius, borderRadius);
-
-    // Calculate highlight rectangle and edge dimensions.
-    int startOffset = startPosition;
-    int endOffset = rect.width() - endPosition;
-    int rangeWidth = endPosition - startPosition;
-
-    if (rangeWidth <= 0)
-        return;
-
-    // Make sure the range width is bigger than border radius at the edges to retain rounded corners.
-    if (startOffset < borderRadius && rangeWidth < borderRadius)
-        rangeWidth = borderRadius;
-    if (endOffset < borderRadius && rangeWidth < borderRadius) {
-        startPosition -= borderRadius - rangeWidth;
-        rangeWidth = borderRadius;
-    }
-
-    // Set rectangle to highlight range.
-    IntRect highlightRect = rect;
-    highlightRect.move(startOffset, 0);
-    highlightRect.setWidth(rangeWidth);
-
-    // Don't bother drawing an empty area.
-    if (highlightRect.isEmpty())
-        return;
-
-    // Calculate white-grey gradient.
-    IntPoint sliderTopLeft = highlightRect.location();
-    IntPoint sliderBottomLeft = sliderTopLeft;
-    sliderBottomLeft.move(0, highlightRect.height());
-    RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderBottomLeft);
-    gradient->addColorStop(0.0, startColor);
-    gradient->addColorStop(1.0, endColor);
-
-    // Fill highlight rectangle with gradient, potentially rounded if on left or right edge.
-    context->save();
-    context->setFillGradient(gradient);
-
-    if (startOffset < borderRadius && endOffset < borderRadius)
-        context->fillRoundedRect(highlightRect, radii, radii, radii, radii, startColor);
-    else if (startOffset < borderRadius)
-        context->fillRoundedRect(highlightRect, radii, IntSize(0, 0), radii, IntSize(0, 0), startColor);
-    else if (endOffset < borderRadius)
-        context->fillRoundedRect(highlightRect, IntSize(0, 0), radii, IntSize(0, 0), radii, startColor);
-    else
-        context->fillRect(highlightRect);
-
-    context->restore();
-}
-
-const int mediaSliderThumbWidth = 32;
-
-static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-    HTMLMediaElement* mediaElement = toParentMediaElement(object);
-    if (!mediaElement)
-        return false;
-
-    RenderStyle* style = object->style();
-    GraphicsContext* context = paintInfo.context;
-
-    paintRoundedSliderBackground(rect, style, context);
-
-    // Draw the buffered range. Since the element may have multiple buffered ranges and it'd be
-    // distracting/'busy' to show all of them, show only the buffered range containing the current play head.
-    RefPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered();
-    float duration = mediaElement->duration();
-    float currentTime = mediaElement->currentTime();
-    if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan(currentTime))
-        return true;
-
-    for (unsigned i = 0; i < bufferedTimeRanges->length(); ++i) {
-        float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION);
-        float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION);
-        if (std::isnan(start) || std::isnan(end) || start > currentTime || end < currentTime)
-            continue;
-        int startPosition = int(start * rect.width() / duration);
-        int currentPosition = int(currentTime * rect.width() / duration);
-        int endPosition = int(end * rect.width() / duration);
-
-        // Add half the thumb width proportionally adjusted to the current painting position.
-        int thumbCenter = mediaSliderThumbWidth / 2;
-        int addWidth = thumbCenter * (1.0 - 2.0 * currentPosition / rect.width());
-        currentPosition += addWidth;
-
-        // Draw white-ish highlight before current time.
-        Color startColor = Color(195, 195, 195);
-        Color endColor = Color(217, 217, 217);
-        if (currentPosition > startPosition)
-            paintSliderRangeHighlight(rect, style, context, startPosition, currentPosition, startColor, endColor);
-
-        // Draw grey-ish highlight after current time.
-        startColor = Color(60, 60, 60);
-        endColor = Color(76, 76, 76);
-
-        if (endPosition > currentPosition)
-            paintSliderRangeHighlight(rect, style, context, currentPosition, endPosition, startColor, endColor);
-
-        return true;
-    }
-
-    return true;
-}
-
-static bool paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-    ASSERT(object->node());
-    HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadowHost());
-    if (!mediaElement)
-        return false;
-
-    if (!hasSource(mediaElement))
-        return true;
-
-    Image* mediaSliderThumb = getMediaSliderThumb();
-    return paintMediaButton(paintInfo.context, rect, mediaSliderThumb);
-}
-
-const int mediaVolumeSliderThumbWidth = 24;
-
-static bool paintMediaVolumeSlider(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-    HTMLMediaElement* mediaElement = toParentMediaElement(object);
-    if (!mediaElement)
-        return false;
-
-    GraphicsContext* context = paintInfo.context;
-    RenderStyle* style = object->style();
-
-    paintRoundedSliderBackground(rect, style, context);
-
-    // Calculate volume position for white background rectangle.
-    float volume = mediaElement->volume();
-    if (std::isnan(volume) || volume < 0)
-        return true;
-    if (volume > 1)
-        volume = 1;
-    if (!hasSource(mediaElement) || !mediaElement->hasAudio() || mediaElement->muted())
-        volume = 0;
-
-    // Calculate the position relative to the center of the thumb.
-    float fillWidth = 0;
-    if (volume > 0) {
-        float thumbCenter = mediaVolumeSliderThumbWidth / 2;
-        float zoomLevel = style->effectiveZoom();
-        float positionWidth = volume * (rect.width() - (zoomLevel * thumbCenter));
-        fillWidth = positionWidth + (zoomLevel * thumbCenter / 2);
-    }
-
-    Color startColor = Color(195, 195, 195);
-    Color endColor = Color(217, 217, 217);
-
-    paintSliderRangeHighlight(rect, style, context, 0.0, fillWidth, startColor, endColor);
-
-    return true;
-}
-
-static bool paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-    ASSERT(object->node());
-    HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadowHost());
-    if (!mediaElement)
-        return false;
-
-    if (!hasSource(mediaElement) || !mediaElement->hasAudio())
-        return true;
-
-    static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSliderThumb");
-    return paintMediaButton(paintInfo.context, rect, mediaVolumeSliderThumb);
-}
-
-static bool paintMediaFullscreenButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-    HTMLMediaElement* mediaElement = toParentMediaElement(object);
-    if (!mediaElement)
-        return false;
-
-    static Image* mediaFullscreenButton = platformResource("mediaplayerFullscreen");
-    return paintMediaButton(paintInfo.context, rect, mediaFullscreenButton);
-}
-
-static bool paintMediaToggleClosedCaptionsButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-    HTMLMediaElement* mediaElement = toParentMediaElement(object);
-    if (!mediaElement)
-        return false;
-
-    static Image* mediaClosedCaptionButton = platformResource("mediaplayerClosedCaption");
-    static Image* mediaClosedCaptionButtonDisabled = platformResource("mediaplayerClosedCaptionDisabled");
-
-    if (mediaElement->webkitClosedCaptionsVisible())
-        return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButton);
-
-    return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButtonDisabled);
-}
-
-
-bool RenderMediaControlsChromium::paintMediaControlsPart(MediaControlElementType part, RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
-{
-    switch (part) {
-    case MediaMuteButton:
-    case MediaUnMuteButton:
-        return paintMediaMuteButton(object, paintInfo, rect);
-    case MediaPauseButton:
-    case MediaPlayButton:
-        return paintMediaPlayButton(object, paintInfo, rect);
-    case MediaShowClosedCaptionsButton:
-        return paintMediaToggleClosedCaptionsButton(object, paintInfo, rect);
-    case MediaSlider:
-        return paintMediaSlider(object, paintInfo, rect);
-    case MediaSliderThumb:
-        return paintMediaSliderThumb(object, paintInfo, rect);
-    case MediaVolumeSlider:
-        return paintMediaVolumeSlider(object, paintInfo, rect);
-    case MediaVolumeSliderThumb:
-        return paintMediaVolumeSliderThumb(object, paintInfo, rect);
-    case MediaEnterFullscreenButton:
-    case MediaExitFullscreenButton:
-        return paintMediaFullscreenButton(object, paintInfo, rect);
-    case MediaOverlayPlayButton:
-        return paintMediaOverlayPlayButton(object, paintInfo, rect);
-    case MediaVolumeSliderMuteButton:
-    case MediaSeekBackButton:
-    case MediaSeekForwardButton:
-    case MediaVolumeSliderContainer:
-    case MediaTimelineContainer:
-    case MediaCurrentTimeDisplay:
-    case MediaTimeRemainingDisplay:
-    case MediaControlsPanel:
-    case MediaRewindButton:
-    case MediaReturnToRealtimeButton:
-    case MediaStatusDisplay:
-    case MediaHideClosedCaptionsButton:
-    case MediaTextTrackDisplayContainer:
-    case MediaTextTrackDisplay:
-    case MediaFullScreenVolumeSlider:
-    case MediaFullScreenVolumeSliderThumb:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-    return false;
-}
-
-const int mediaSliderThumbHeight = 24;
-const int mediaVolumeSliderThumbHeight = 24;
-
-void RenderMediaControlsChromium::adjustMediaSliderThumbSize(RenderStyle* style)
-{
-    static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb");
-    static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSliderThumb");
-    int width = 0;
-    int height = 0;
-
-    Image* thumbImage = 0;
-    if (style->appearance() == MediaSliderThumbPart) {
-        thumbImage = mediaSliderThumb;
-        width = mediaSliderThumbWidth;
-        height = mediaSliderThumbHeight;
-    } else if (style->appearance() == MediaVolumeSliderThumbPart) {
-        thumbImage = mediaVolumeSliderThumb;
-        width = mediaVolumeSliderThumbWidth;
-        height = mediaVolumeSliderThumbHeight;
-    }
-
-    float zoomLevel = style->effectiveZoom();
-    if (thumbImage) {
-        style->setWidth(Length(static_cast<int>(width * zoomLevel), Fixed));
-        style->setHeight(Length(static_cast<int>(height * zoomLevel), Fixed));
-    }
-}
-
-static String formatChromiumMediaControlsTime(float time, float duration)
-{
-    if (!std::isfinite(time))
-        time = 0;
-    if (!std::isfinite(duration))
-        duration = 0;
-    int seconds = static_cast<int>(fabsf(time));
-    int hours = seconds / (60 * 60);
-    int minutes = (seconds / 60) % 60;
-    seconds %= 60;
-
-    // duration defines the format of how the time is rendered
-    int durationSecs = static_cast<int>(fabsf(duration));
-    int durationHours = durationSecs / (60 * 60);
-    int durationMins = (durationSecs / 60) % 60;
-
-    if (durationHours || hours)
-        return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
-    if (durationMins > 9)
-        return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
-
-    return String::format("%s%01d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
-}
-
-String RenderMediaControlsChromium::formatMediaControlsTime(float time)
-{
-    return formatChromiumMediaControlsTime(time, time);
-}
-
-String RenderMediaControlsChromium::formatMediaControlsCurrentTime(float currentTime, float duration)
-{
-    return formatChromiumMediaControlsTime(currentTime, duration);
-}
-
-} // namespace WebCore
diff --git a/Source/core/rendering/RenderMediaControlsChromium.h b/Source/core/rendering/RenderMediaControlsChromium.h
deleted file mode 100644
index 9e9e810..0000000
--- a/Source/core/rendering/RenderMediaControlsChromium.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc.
- * 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 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 RenderMediaControlsChromium_h
-#define RenderMediaControlsChromium_h
-
-#include "core/html/shadow/MediaControlElements.h"
-
-namespace WebCore {
-
-struct PaintInfo;
-
-class HTMLMediaElement;
-class IntRect;
-class RenderObject;
-
-class RenderMediaControlsChromium {
-public:
-    static bool paintMediaControlsPart(MediaControlElementType, RenderObject*, const PaintInfo&, const IntRect&);
-    static void adjustMediaSliderThumbSize(RenderStyle*);
-    static String formatMediaControlsTime(float time);
-    static String formatMediaControlsCurrentTime(float currentTime, float duration);
-};
-
-} // namespace WebCore
-
-#endif // RenderMediaControlsChromium_h
diff --git a/Source/core/rendering/RenderMenuList.cpp b/Source/core/rendering/RenderMenuList.cpp
index df13d20..86b429b 100644
--- a/Source/core/rendering/RenderMenuList.cpp
+++ b/Source/core/rendering/RenderMenuList.cpp
@@ -36,16 +36,16 @@
 #include "core/html/HTMLOptionElement.h"
 #include "core/html/HTMLSelectElement.h"
 #include "core/page/Chrome.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/platform/PopupMenu.h"
 #include "core/platform/graphics/FontCache.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/rendering/RenderBR.h"
 #include "core/rendering/RenderScrollbar.h"
 #include "core/rendering/RenderTheme.h"
 #include "core/rendering/RenderView.h"
+#include "platform/geometry/IntSize.h"
 
 using namespace std;
 
@@ -387,7 +387,7 @@
 
     HTMLElement* listItem = select->listItems()[listIndex];
     ASSERT(listItem);
-    if (listItem->attached()) {
+    if (listItem->confusingAndOftenMisusedAttached()) {
         if (AccessibilityMenuList* menuList = toAccessibilityMenuList(document().axObjectCache()->get(this)))
             menuList->didUpdateActiveOption(optionIndex);
     }
diff --git a/Source/core/rendering/RenderMenuList.h b/Source/core/rendering/RenderMenuList.h
index a91f3b8..530f7a9 100644
--- a/Source/core/rendering/RenderMenuList.h
+++ b/Source/core/rendering/RenderMenuList.h
@@ -26,8 +26,8 @@
 
 #include "core/platform/PopupMenu.h"
 #include "core/platform/PopupMenuClient.h"
-#include "core/platform/graphics/LayoutRect.h"
 #include "core/rendering/RenderFlexibleBox.h"
+#include "platform/geometry/LayoutRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/RenderMultiColumnBlock.h b/Source/core/rendering/RenderMultiColumnBlock.h
index 1ca4701..25e3168 100644
--- a/Source/core/rendering/RenderMultiColumnBlock.h
+++ b/Source/core/rendering/RenderMultiColumnBlock.h
@@ -44,7 +44,7 @@
 
     RenderMultiColumnFlowThread* flowThread() const { return m_flowThread; }
 
-    bool requiresBalancing() const { return !m_columnHeightAvailable; }
+    bool requiresBalancing() const { return !m_columnHeightAvailable || style()->columnFill() == ColumnFillBalance; }
 
 private:
     virtual bool isRenderMultiColumnBlock() const { return true; }
diff --git a/Source/core/rendering/RenderMultiColumnSet.cpp b/Source/core/rendering/RenderMultiColumnSet.cpp
index e968725..4490737 100644
--- a/Source/core/rendering/RenderMultiColumnSet.cpp
+++ b/Source/core/rendering/RenderMultiColumnSet.cpp
@@ -282,39 +282,25 @@
     bool isLastColumn = index == colCount - 1;
     bool isLeftmostColumn = style()->isLeftToRightDirection() ? isFirstColumn : isLastColumn;
     bool isRightmostColumn = style()->isLeftToRightDirection() ? isLastColumn : isFirstColumn;
-    LayoutRect overflowRect(portionRect);
+
+    // Calculate the overflow rectangle, based on the flow thread's, clipped at column logical
+    // top/bottom unless it's the first/last column.
+    LayoutRect overflowRect = overflowRectForFlowThreadPortion(portionRect, isFirstColumn && isFirstRegion(), isLastColumn && isLastRegion());
+
+    // Avoid overflowing into neighboring columns, by clipping in the middle of adjacent column
+    // gaps. Also make sure that we avoid rounding errors.
     if (isHorizontalWritingMode()) {
-        if (isLeftmostColumn) {
-            // Shift to the logical left overflow of the flow thread to make sure it's all covered.
-            overflowRect.shiftXEdgeTo(min(flowThread()->visualOverflowRect().x(), portionRect.x()));
-        } else {
-            // Expand into half of the logical left column gap.
+        if (!isLeftmostColumn)
             overflowRect.shiftXEdgeTo(portionRect.x() - colGap / 2);
-        }
-        if (isRightmostColumn) {
-            // Shift to the logical right overflow of the flow thread to ensure content can spill out of the column.
-            overflowRect.shiftMaxXEdgeTo(max(flowThread()->visualOverflowRect().maxX(), portionRect.maxX()));
-        } else {
-            // Expand into half of the logical right column gap.
-            overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + colGap / 2);
-        }
+        if (!isRightmostColumn)
+            overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + colGap - colGap / 2);
     } else {
-        if (isLeftmostColumn) {
-            // Shift to the logical left overflow of the flow thread to make sure it's all covered.
-            overflowRect.shiftYEdgeTo(min(flowThread()->visualOverflowRect().y(), portionRect.y()));
-        } else {
-            // Expand into half of the logical left column gap.
+        if (!isLeftmostColumn)
             overflowRect.shiftYEdgeTo(portionRect.y() - colGap / 2);
-        }
-        if (isRightmostColumn) {
-            // Shift to the logical right overflow of the flow thread to ensure content can spill out of the column.
-            overflowRect.shiftMaxYEdgeTo(max(flowThread()->visualOverflowRect().maxY(), portionRect.maxY()));
-        } else {
-            // Expand into half of the logical right column gap.
-            overflowRect.shiftMaxYEdgeTo(portionRect.maxY() + colGap / 2);
-        }
+        if (!isRightmostColumn)
+            overflowRect.shiftMaxYEdgeTo(portionRect.maxY() + colGap - colGap / 2);
     }
-    return overflowRectForFlowThreadPortion(overflowRect, isFirstRegion() && isFirstColumn, isLastRegion() && isLastColumn);
+    return overflowRect;
 }
 
 void RenderMultiColumnSet::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
@@ -429,14 +415,25 @@
 
 void RenderMultiColumnSet::collectLayerFragments(LayerFragments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect)
 {
-    // Put the layer bounds into flow thread-local coordinates by flipping it first.
+    // The two rectangles passed to this method are physical, except that we pretend that there's
+    // only one long column (that's how a flow thread works).
+    //
+    // Then there's the output from this method - the stuff we put into the list of fragments. The
+    // fragment.paginationOffset point is the actual physical translation required to get from a
+    // location in the flow thread to a location in a given column. The fragment.paginationClip
+    // rectangle, on the other hand, is in the same coordinate system as the two rectangles passed
+    // to this method (flow thread coordinates).
+    //
+    // All other rectangles in this method are sized physically, and the inline direction coordinate
+    // is physical too, but the block direction coordinate is "logical top". This is the same as
+    // e.g. RenderBox::frameRect(). These rectangles also pretend that there's only one long column,
+    // i.e. they are for the flow thread.
+
+    // Put the layer bounds into flow thread-local coordinates by flipping it first. Since we're in
+    // a renderer, most rectangles are represented this way.
     LayoutRect layerBoundsInFlowThread(layerBoundingBox);
     flowThread()->flipForWritingMode(layerBoundsInFlowThread);
 
-    // Do the same for the dirty rect.
-    LayoutRect dirtyRectInFlowThread(dirtyRect);
-    flowThread()->flipForWritingMode(dirtyRectInFlowThread);
-
     // Now we can compare with the flow thread portions owned by each column. First let's
     // see if the rect intersects our flow thread portion at all.
     LayoutRect clippedRect(layerBoundsInFlowThread);
@@ -488,11 +485,11 @@
         // multicolumn block as well. This won't be an issue until we start creating multiple multicolumn sets.
 
         // Shift the dirty rect to be in flow thread coordinates with this translation applied.
-        LayoutRect translatedDirtyRect(dirtyRectInFlowThread);
+        LayoutRect translatedDirtyRect(dirtyRect);
         translatedDirtyRect.moveBy(-translationOffset);
 
         // See if we intersect the dirty rect.
-        clippedRect = layerBoundsInFlowThread;
+        clippedRect = layerBoundingBox;
         clippedRect.intersect(translatedDirtyRect);
         if (clippedRect.isEmpty())
             continue;
@@ -503,7 +500,8 @@
         fragment.paginationOffset = translationOffset;
 
         LayoutRect flippedFlowThreadOverflowPortion(flowThreadOverflowPortion);
-        flipForWritingMode(flippedFlowThreadOverflowPortion);
+        // Flip it into more a physical (RenderLayer-style) rectangle.
+        flowThread()->flipForWritingMode(flippedFlowThreadOverflowPortion);
         fragment.paginationClip = flippedFlowThreadOverflowPortion;
         fragments.append(fragment);
     }
diff --git a/Source/core/rendering/RenderNamedFlowThread.cpp b/Source/core/rendering/RenderNamedFlowThread.cpp
index 7d25ae6..9051dc5 100644
--- a/Source/core/rendering/RenderNamedFlowThread.cpp
+++ b/Source/core/rendering/RenderNamedFlowThread.cpp
@@ -82,7 +82,7 @@
 
         ASSERT(contentNode && contentNode->isElementNode());
         ASSERT(contentNode->inNamedFlow());
-        ASSERT(&contentNode->document() == &document());
+        ASSERT(contentNode->document() == document());
 
         contentNode->clearInNamedFlow();
     }
@@ -442,7 +442,7 @@
 void RenderNamedFlowThread::registerNamedFlowContentNode(Node* contentNode)
 {
     ASSERT(contentNode && contentNode->isElementNode());
-    ASSERT(&contentNode->document() == &document());
+    ASSERT(contentNode->document() == document());
 
     contentNode->setInNamedFlow();
 
@@ -465,7 +465,7 @@
     ASSERT(contentNode && contentNode->isElementNode());
     ASSERT(m_contentNodes.contains(contentNode));
     ASSERT(contentNode->inNamedFlow());
-    ASSERT(&contentNode->document() == &document());
+    ASSERT(contentNode->document() == document());
 
     contentNode->clearInNamedFlow();
     m_contentNodes.remove(contentNode);
diff --git a/Source/core/rendering/RenderNamedFlowThread.h b/Source/core/rendering/RenderNamedFlowThread.h
index c0dec6c..dfe4533 100644
--- a/Source/core/rendering/RenderNamedFlowThread.h
+++ b/Source/core/rendering/RenderNamedFlowThread.h
@@ -27,8 +27,8 @@
 #ifndef RenderNamedFlowThread_h
 #define RenderNamedFlowThread_h
 
-#include "core/platform/Timer.h"
 #include "core/rendering/RenderFlowThread.h"
+#include "platform/Timer.h"
 #include "wtf/HashCountedSet.h"
 #include "wtf/ListHashSet.h"
 #include "wtf/text/AtomicString.h"
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index a821287..1fee513 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -40,16 +40,15 @@
 #include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLTableElement.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/page/UseCounter.h"
-#include "core/page/animation/AnimationController.h"
-#include "core/platform/Partitions.h"
-#include "core/platform/graphics/FloatQuad.h"
+#include "core/frame/animation/AnimationController.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/transforms/TransformState.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/FlowThreadController.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderCounter.h"
@@ -61,7 +60,6 @@
 #include "core/rendering/RenderImageResourceStyleImage.h"
 #include "core/rendering/RenderInline.h"
 #include "core/rendering/RenderLayer.h"
-#include "core/rendering/RenderLayerBacking.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderListItem.h"
 #include "core/rendering/RenderMarquee.h"
@@ -80,6 +78,8 @@
 #include "core/rendering/style/ContentData.h"
 #include "core/rendering/style/CursorList.h"
 #include "core/rendering/svg/SVGRenderSupport.h"
+#include "platform/Partitions.h"
+#include "platform/geometry/FloatQuad.h"
 #include "wtf/RefCountedLeakCounter.h"
 #include "wtf/UnusedParam.h"
 #include "wtf/text/StringBuilder.h"
@@ -168,13 +168,13 @@
     // treat <rt> as ruby text ONLY if it still has its default treatment of block
     if (element->hasTagName(rtTag) && style->display() == BLOCK)
         return new RenderRubyText(element);
-    if (RuntimeEnabledFeatures::cssRegionsEnabled() && style->isDisplayRegionType() && !style->regionThread().isEmpty() && doc.renderView())
+    if (RuntimeEnabledFeatures::cssRegionsEnabled() && style->isDisplayRegionType() && style->hasFlowFrom() && doc.renderView())
         return new RenderRegion(element, 0);
 
     if (style->display() == RUN_IN)
-        UseCounter::count(&doc, UseCounter::CSSDisplayRunIn);
+        UseCounter::count(doc, UseCounter::CSSDisplayRunIn);
     else if (style->display() == COMPACT)
-        UseCounter::count(&doc, UseCounter::CSSDisplayCompact);
+        UseCounter::count(doc, UseCounter::CSSDisplayCompact);
 
     switch (style->display()) {
     case NONE:
@@ -609,6 +609,20 @@
     return 0;
 }
 
+RenderBox* RenderObject::enclosingScrollableBox() const
+{
+    for (RenderObject* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
+        if (!ancestor->isBox())
+            continue;
+
+        RenderBox* ancestorBox = toRenderBox(ancestor);
+        if (ancestorBox->canBeScrolledAndHasScrollableArea())
+            return ancestorBox;
+    }
+
+    return 0;
+}
+
 RenderFlowThread* RenderObject::locateFlowThreadContainingBlock() const
 {
     ASSERT(flowThreadState() != NotInsideFlowThread);
@@ -780,13 +794,13 @@
 void RenderObject::setLayerNeedsFullRepaint()
 {
     ASSERT(hasLayer());
-    toRenderLayerModelObject(this)->layer()->setRepaintStatus(NeedsFullRepaint);
+    toRenderLayerModelObject(this)->layer()->repainter().setRepaintStatus(NeedsFullRepaint);
 }
 
 void RenderObject::setLayerNeedsFullRepaintForPositionedMovementLayout()
 {
     ASSERT(hasLayer());
-    toRenderLayerModelObject(this)->layer()->setRepaintStatus(NeedsFullRepaintForPositionedMovementLayout);
+    toRenderLayerModelObject(this)->layer()->repainter().setRepaintStatus(NeedsFullRepaintForPositionedMovementLayout);
 }
 
 RenderBlock* RenderObject::containingBlock() const
@@ -916,211 +930,236 @@
         style = SOLID;
 
     switch (style) {
-        case BNONE:
-        case BHIDDEN:
-            return;
-        case DOTTED:
-        case DASHED: {
-            if (thickness > 0) {
-                bool wasAntialiased = graphicsContext->shouldAntialias();
-                StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle();
-                graphicsContext->setShouldAntialias(antialias);
-                graphicsContext->setStrokeColor(color);
-                graphicsContext->setStrokeThickness(thickness);
-                graphicsContext->setStrokeStyle(style == DASHED ? DashedStroke : DottedStroke);
-
-                switch (side) {
-                    case BSBottom:
-                    case BSTop:
-                        graphicsContext->drawLine(IntPoint(x1, (y1 + y2) / 2), IntPoint(x2, (y1 + y2) / 2));
-                        break;
-                    case BSRight:
-                    case BSLeft:
-                        graphicsContext->drawLine(IntPoint((x1 + x2) / 2, y1), IntPoint((x1 + x2) / 2, y2));
-                        break;
-                }
-                graphicsContext->setShouldAntialias(wasAntialiased);
-                graphicsContext->setStrokeStyle(oldStrokeStyle);
-            }
-            break;
-        }
-        case DOUBLE: {
-            int thirdOfThickness = (thickness + 1) / 3;
-            ASSERT(thirdOfThickness);
-
-            if (adjacentWidth1 == 0 && adjacentWidth2 == 0) {
-                StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle();
-                graphicsContext->setStrokeStyle(NoStroke);
-                graphicsContext->setFillColor(color);
-
-                bool wasAntialiased = graphicsContext->shouldAntialias();
-                graphicsContext->setShouldAntialias(antialias);
-
-                switch (side) {
-                    case BSTop:
-                    case BSBottom:
-                        graphicsContext->drawRect(IntRect(x1, y1, length, thirdOfThickness));
-                        graphicsContext->drawRect(IntRect(x1, y2 - thirdOfThickness, length, thirdOfThickness));
-                        break;
-                    case BSLeft:
-                    case BSRight:
-                        // FIXME: Why do we offset the border by 1 in this case but not the other one?
-                        if (length > 1) {
-                            graphicsContext->drawRect(IntRect(x1, y1 + 1, thirdOfThickness, length - 1));
-                            graphicsContext->drawRect(IntRect(x2 - thirdOfThickness, y1 + 1, thirdOfThickness, length - 1));
-                        }
-                        break;
-                }
-
-                graphicsContext->setShouldAntialias(wasAntialiased);
-                graphicsContext->setStrokeStyle(oldStrokeStyle);
-            } else {
-                int adjacent1BigThird = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacentWidth1 - 1) / 3;
-                int adjacent2BigThird = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacentWidth2 - 1) / 3;
-
-                switch (side) {
-                    case BSTop:
-                        drawLineForBoxSide(graphicsContext, x1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
-                                   y1, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness,
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        drawLineForBoxSide(graphicsContext, x1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
-                                   y2 - thirdOfThickness, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y2,
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        break;
-                    case BSLeft:
-                        drawLineForBoxSide(graphicsContext, x1, y1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
-                                   x1 + thirdOfThickness, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0),
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
-                                   x2, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0),
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        break;
-                    case BSBottom:
-                        drawLineForBoxSide(graphicsContext, x1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
-                                   y1, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness,
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        drawLineForBoxSide(graphicsContext, x1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
-                                   y2 - thirdOfThickness, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y2,
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        break;
-                    case BSRight:
-                        drawLineForBoxSide(graphicsContext, x1, y1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
-                                   x1 + thirdOfThickness, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0),
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
-                                   x2, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0),
-                                   side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
-                        break;
-                    default:
-                        break;
-                }
-            }
-            break;
-        }
-        case RIDGE:
-        case GROOVE: {
-            EBorderStyle s1;
-            EBorderStyle s2;
-            if (style == GROOVE) {
-                s1 = INSET;
-                s2 = OUTSET;
-            } else {
-                s1 = OUTSET;
-                s2 = INSET;
-            }
-
-            int adjacent1BigHalf = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacentWidth1 - 1) / 2;
-            int adjacent2BigHalf = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacentWidth2 - 1) / 2;
-
-            switch (side) {
-                case BSTop:
-                    drawLineForBoxSide(graphicsContext, x1 + max(-adjacentWidth1, 0) / 2, y1, x2 - max(-adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2,
-                               side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
-                    drawLineForBoxSide(graphicsContext, x1 + max(adjacentWidth1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - max(adjacentWidth2 + 1, 0) / 2, y2,
-                               side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
-                    break;
-                case BSLeft:
-                    drawLineForBoxSide(graphicsContext, x1, y1 + max(-adjacentWidth1, 0) / 2, (x1 + x2 + 1) / 2, y2 - max(-adjacentWidth2, 0) / 2,
-                               side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
-                    drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(adjacentWidth1 + 1, 0) / 2, x2, y2 - max(adjacentWidth2 + 1, 0) / 2,
-                               side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
-                    break;
-                case BSBottom:
-                    drawLineForBoxSide(graphicsContext, x1 + max(adjacentWidth1, 0) / 2, y1, x2 - max(adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2,
-                               side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
-                    drawLineForBoxSide(graphicsContext, x1 + max(-adjacentWidth1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - max(-adjacentWidth2 + 1, 0) / 2, y2,
-                               side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
-                    break;
-                case BSRight:
-                    drawLineForBoxSide(graphicsContext, x1, y1 + max(adjacentWidth1, 0) / 2, (x1 + x2 + 1) / 2, y2 - max(adjacentWidth2, 0) / 2,
-                               side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
-                    drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(-adjacentWidth1 + 1, 0) / 2, x2, y2 - max(-adjacentWidth2 + 1, 0) / 2,
-                               side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
-                    break;
-            }
-            break;
-        }
-        case INSET:
-            // FIXME: Maybe we should lighten the colors on one side like Firefox.
-            // https://bugs.webkit.org/show_bug.cgi?id=58608
-            if (side == BSTop || side == BSLeft)
-                color = color.dark();
-            // fall through
-        case OUTSET:
-            if (style == OUTSET && (side == BSBottom || side == BSRight))
-                color = color.dark();
-            // fall through
-        case SOLID: {
-            StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle();
-            graphicsContext->setStrokeStyle(NoStroke);
-            graphicsContext->setFillColor(color);
-            ASSERT(x2 >= x1);
-            ASSERT(y2 >= y1);
-            if (!adjacentWidth1 && !adjacentWidth2) {
-                // Turn off antialiasing to match the behavior of drawConvexPolygon();
-                // this matters for rects in transformed contexts.
-                bool wasAntialiased = graphicsContext->shouldAntialias();
-                graphicsContext->setShouldAntialias(antialias);
-                graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, y2 - y1));
-                graphicsContext->setShouldAntialias(wasAntialiased);
-                graphicsContext->setStrokeStyle(oldStrokeStyle);
-                return;
-            }
-            FloatPoint quad[4];
-            switch (side) {
-                case BSTop:
-                    quad[0] = FloatPoint(x1 + max(-adjacentWidth1, 0), y1);
-                    quad[1] = FloatPoint(x1 + max(adjacentWidth1, 0), y2);
-                    quad[2] = FloatPoint(x2 - max(adjacentWidth2, 0), y2);
-                    quad[3] = FloatPoint(x2 - max(-adjacentWidth2, 0), y1);
-                    break;
-                case BSBottom:
-                    quad[0] = FloatPoint(x1 + max(adjacentWidth1, 0), y1);
-                    quad[1] = FloatPoint(x1 + max(-adjacentWidth1, 0), y2);
-                    quad[2] = FloatPoint(x2 - max(-adjacentWidth2, 0), y2);
-                    quad[3] = FloatPoint(x2 - max(adjacentWidth2, 0), y1);
-                    break;
-                case BSLeft:
-                    quad[0] = FloatPoint(x1, y1 + max(-adjacentWidth1, 0));
-                    quad[1] = FloatPoint(x1, y2 - max(-adjacentWidth2, 0));
-                    quad[2] = FloatPoint(x2, y2 - max(adjacentWidth2, 0));
-                    quad[3] = FloatPoint(x2, y1 + max(adjacentWidth1, 0));
-                    break;
-                case BSRight:
-                    quad[0] = FloatPoint(x1, y1 + max(adjacentWidth1, 0));
-                    quad[1] = FloatPoint(x1, y2 - max(adjacentWidth2, 0));
-                    quad[2] = FloatPoint(x2, y2 - max(-adjacentWidth2, 0));
-                    quad[3] = FloatPoint(x2, y1 + max(-adjacentWidth1, 0));
-                    break;
-            }
-
-            graphicsContext->drawConvexPolygon(4, quad, antialias);
-            graphicsContext->setStrokeStyle(oldStrokeStyle);
-            break;
-        }
+    case BNONE:
+    case BHIDDEN:
+        return;
+    case DOTTED:
+    case DASHED:
+        drawDashedOrDottedBoxSide(graphicsContext, x1, y1, x2, y2, side,
+            color, thickness, style, antialias);
+        break;
+    case DOUBLE:
+        drawDoubleBoxSide(graphicsContext, x1, y1, x2, y2, length, side, color,
+            thickness, adjacentWidth1, adjacentWidth2, antialias);
+        break;
+    case RIDGE:
+    case GROOVE:
+        drawRidgeOrGrooveBoxSide(graphicsContext, x1, y1, x2, y2, side, color,
+            style, adjacentWidth1, adjacentWidth2, antialias);
+        break;
+    case INSET:
+        // FIXME: Maybe we should lighten the colors on one side like Firefox.
+        // https://bugs.webkit.org/show_bug.cgi?id=58608
+        if (side == BSTop || side == BSLeft)
+            color = color.dark();
+        // fall through
+    case OUTSET:
+        if (style == OUTSET && (side == BSBottom || side == BSRight))
+            color = color.dark();
+        // fall through
+    case SOLID:
+        drawSolidBoxSide(graphicsContext, x1, y1, x2, y2, side, color, adjacentWidth1, adjacentWidth2, antialias);
+        break;
     }
 }
 
+void RenderObject::drawDashedOrDottedBoxSide(GraphicsContext* graphicsContext, int x1, int y1, int x2, int y2,
+    BoxSide side, Color color, int thickness, EBorderStyle style, bool antialias)
+{
+    if (thickness <= 0)
+        return;
+
+    bool wasAntialiased = graphicsContext->shouldAntialias();
+    StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle();
+    graphicsContext->setShouldAntialias(antialias);
+    graphicsContext->setStrokeColor(color);
+    graphicsContext->setStrokeThickness(thickness);
+    graphicsContext->setStrokeStyle(style == DASHED ? DashedStroke : DottedStroke);
+
+    switch (side) {
+    case BSBottom:
+    case BSTop:
+        graphicsContext->drawLine(IntPoint(x1, (y1 + y2) / 2), IntPoint(x2, (y1 + y2) / 2));
+        break;
+    case BSRight:
+    case BSLeft:
+        graphicsContext->drawLine(IntPoint((x1 + x2) / 2, y1), IntPoint((x1 + x2) / 2, y2));
+        break;
+    }
+    graphicsContext->setShouldAntialias(wasAntialiased);
+    graphicsContext->setStrokeStyle(oldStrokeStyle);
+}
+
+void RenderObject::drawDoubleBoxSide(GraphicsContext* graphicsContext, int x1, int y1, int x2, int y2,
+    int length, BoxSide side, Color color, int thickness, int adjacentWidth1, int adjacentWidth2, bool antialias)
+{
+    int thirdOfThickness = (thickness + 1) / 3;
+    ASSERT(thirdOfThickness);
+
+    if (!adjacentWidth1 && !adjacentWidth2) {
+        StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle();
+        graphicsContext->setStrokeStyle(NoStroke);
+        graphicsContext->setFillColor(color);
+
+        bool wasAntialiased = graphicsContext->shouldAntialias();
+        graphicsContext->setShouldAntialias(antialias);
+
+        switch (side) {
+        case BSTop:
+        case BSBottom:
+            graphicsContext->drawRect(IntRect(x1, y1, length, thirdOfThickness));
+            graphicsContext->drawRect(IntRect(x1, y2 - thirdOfThickness, length, thirdOfThickness));
+            break;
+        case BSLeft:
+        case BSRight:
+            // FIXME: Why do we offset the border by 1 in this case but not the other one?
+            if (length > 1) {
+                graphicsContext->drawRect(IntRect(x1, y1 + 1, thirdOfThickness, length - 1));
+                graphicsContext->drawRect(IntRect(x2 - thirdOfThickness, y1 + 1, thirdOfThickness, length - 1));
+            }
+            break;
+        }
+
+        graphicsContext->setShouldAntialias(wasAntialiased);
+        graphicsContext->setStrokeStyle(oldStrokeStyle);
+        return;
+    }
+
+    int adjacent1BigThird = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacentWidth1 - 1) / 3;
+    int adjacent2BigThird = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacentWidth2 - 1) / 3;
+
+    switch (side) {
+    case BSTop:
+        drawLineForBoxSide(graphicsContext, x1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
+            y1, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness,
+            side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+        drawLineForBoxSide(graphicsContext, x1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
+            y2 - thirdOfThickness, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y2,
+            side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+        break;
+    case BSLeft:
+        drawLineForBoxSide(graphicsContext, x1, y1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
+            x1 + thirdOfThickness, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0),
+            side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+        drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
+            x2, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0),
+            side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+        break;
+    case BSBottom:
+        drawLineForBoxSide(graphicsContext, x1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
+            y1, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness,
+            side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+        drawLineForBoxSide(graphicsContext, x1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
+            y2 - thirdOfThickness, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y2,
+            side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+        break;
+    case BSRight:
+        drawLineForBoxSide(graphicsContext, x1, y1 + max((adjacentWidth1 * 2 + 1) / 3, 0),
+            x1 + thirdOfThickness, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0),
+            side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+        drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + max((-adjacentWidth1 * 2 + 1) / 3, 0),
+            x2, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0),
+            side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias);
+        break;
+    default:
+        break;
+    }
+}
+
+void RenderObject::drawRidgeOrGrooveBoxSide(GraphicsContext* graphicsContext, int x1, int y1, int x2, int y2,
+    BoxSide side, Color color, EBorderStyle style, int adjacentWidth1, int adjacentWidth2, bool antialias)
+{
+    EBorderStyle s1;
+    EBorderStyle s2;
+    if (style == GROOVE) {
+        s1 = INSET;
+        s2 = OUTSET;
+    } else {
+        s1 = OUTSET;
+        s2 = INSET;
+    }
+
+    int adjacent1BigHalf = ((adjacentWidth1 > 0) ? adjacentWidth1 + 1 : adjacentWidth1 - 1) / 2;
+    int adjacent2BigHalf = ((adjacentWidth2 > 0) ? adjacentWidth2 + 1 : adjacentWidth2 - 1) / 2;
+
+    switch (side) {
+    case BSTop:
+        drawLineForBoxSide(graphicsContext, x1 + max(-adjacentWidth1, 0) / 2, y1, x2 - max(-adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2,
+            side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
+        drawLineForBoxSide(graphicsContext, x1 + max(adjacentWidth1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - max(adjacentWidth2 + 1, 0) / 2, y2,
+            side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
+        break;
+    case BSLeft:
+        drawLineForBoxSide(graphicsContext, x1, y1 + max(-adjacentWidth1, 0) / 2, (x1 + x2 + 1) / 2, y2 - max(-adjacentWidth2, 0) / 2,
+            side, color, s1, adjacent1BigHalf, adjacent2BigHalf, antialias);
+        drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(adjacentWidth1 + 1, 0) / 2, x2, y2 - max(adjacentWidth2 + 1, 0) / 2,
+            side, color, s2, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
+        break;
+    case BSBottom:
+        drawLineForBoxSide(graphicsContext, x1 + max(adjacentWidth1, 0) / 2, y1, x2 - max(adjacentWidth2, 0) / 2, (y1 + y2 + 1) / 2,
+            side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
+        drawLineForBoxSide(graphicsContext, x1 + max(-adjacentWidth1 + 1, 0) / 2, (y1 + y2 + 1) / 2, x2 - max(-adjacentWidth2 + 1, 0) / 2, y2,
+            side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
+        break;
+    case BSRight:
+        drawLineForBoxSide(graphicsContext, x1, y1 + max(adjacentWidth1, 0) / 2, (x1 + x2 + 1) / 2, y2 - max(adjacentWidth2, 0) / 2,
+            side, color, s2, adjacent1BigHalf, adjacent2BigHalf, antialias);
+        drawLineForBoxSide(graphicsContext, (x1 + x2 + 1) / 2, y1 + max(-adjacentWidth1 + 1, 0) / 2, x2, y2 - max(-adjacentWidth2 + 1, 0) / 2,
+            side, color, s1, adjacentWidth1 / 2, adjacentWidth2 / 2, antialias);
+        break;
+    }
+}
+
+void RenderObject::drawSolidBoxSide(GraphicsContext* graphicsContext, int x1, int y1, int x2, int y2,
+    BoxSide side, Color color, int adjacentWidth1, int adjacentWidth2, bool antialias)
+{
+    StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle();
+    graphicsContext->setStrokeStyle(NoStroke);
+    graphicsContext->setFillColor(color);
+    ASSERT(x2 >= x1);
+    ASSERT(y2 >= y1);
+    if (!adjacentWidth1 && !adjacentWidth2) {
+        // Turn off antialiasing to match the behavior of drawConvexPolygon();
+        // this matters for rects in transformed contexts.
+        bool wasAntialiased = graphicsContext->shouldAntialias();
+        graphicsContext->setShouldAntialias(antialias);
+        graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, y2 - y1));
+        graphicsContext->setShouldAntialias(wasAntialiased);
+        graphicsContext->setStrokeStyle(oldStrokeStyle);
+        return;
+    }
+    FloatPoint quad[4];
+    switch (side) {
+    case BSTop:
+        quad[0] = FloatPoint(x1 + max(-adjacentWidth1, 0), y1);
+        quad[1] = FloatPoint(x1 + max(adjacentWidth1, 0), y2);
+        quad[2] = FloatPoint(x2 - max(adjacentWidth2, 0), y2);
+        quad[3] = FloatPoint(x2 - max(-adjacentWidth2, 0), y1);
+        break;
+    case BSBottom:
+        quad[0] = FloatPoint(x1 + max(adjacentWidth1, 0), y1);
+        quad[1] = FloatPoint(x1 + max(-adjacentWidth1, 0), y2);
+        quad[2] = FloatPoint(x2 - max(-adjacentWidth2, 0), y2);
+        quad[3] = FloatPoint(x2 - max(adjacentWidth2, 0), y1);
+        break;
+    case BSLeft:
+        quad[0] = FloatPoint(x1, y1 + max(-adjacentWidth1, 0));
+        quad[1] = FloatPoint(x1, y2 - max(-adjacentWidth2, 0));
+        quad[2] = FloatPoint(x2, y2 - max(adjacentWidth2, 0));
+        quad[3] = FloatPoint(x2, y1 + max(adjacentWidth1, 0));
+        break;
+    case BSRight:
+        quad[0] = FloatPoint(x1, y1 + max(adjacentWidth1, 0));
+        quad[1] = FloatPoint(x1, y2 - max(adjacentWidth2, 0));
+        quad[2] = FloatPoint(x2, y2 - max(-adjacentWidth2, 0));
+        quad[3] = FloatPoint(x2, y1 + max(-adjacentWidth1, 0));
+        break;
+    }
+
+    graphicsContext->drawConvexPolygon(4, quad, antialias);
+    graphicsContext->setStrokeStyle(oldStrokeStyle);
+}
+
 void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paintOffset, RenderStyle* style)
 {
     Vector<IntRect> focusRingRects;
@@ -1336,7 +1375,7 @@
     if (parentRenderFlowThread) {
         // The ancestor document will do the reparenting when the repaint propagates further up.
         // We're just a seamless child document, and we don't need to do the hacking.
-        if (&parentRenderFlowThread && &parentRenderFlowThread->document() != &document())
+        if (&parentRenderFlowThread && parentRenderFlowThread->document() != document())
             return repaintContainer;
         // If we have already found a repaint container then we will repaint into that container only if it is part of the same
         // flow thread. Otherwise we will need to catch the repaint call and send it to the flow thread.
@@ -1816,18 +1855,20 @@
     setStyle(pseudoStyle);
 }
 
-inline bool RenderObject::hasImmediateNonWhitespaceTextChild() const
+inline bool RenderObject::hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const
 {
     for (const RenderObject* r = firstChild(); r; r = r->nextSibling()) {
         if (r->isText() && !toRenderText(r)->isAllCollapsibleWhitespace())
             return true;
+        if (r->style()->hasOutline() || r->style()->hasBorder())
+            return true;
     }
     return false;
 }
 
 inline bool RenderObject::shouldRepaintForStyleDifference(StyleDifference diff) const
 {
-    return diff == StyleDifferenceRepaint || (diff == StyleDifferenceRepaintIfText && hasImmediateNonWhitespaceTextChild());
+    return diff == StyleDifferenceRepaint || (diff == StyleDifferenceRepaintIfTextOrColorChange && hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor());
 }
 
 void RenderObject::setStyle(PassRefPtr<RenderStyle> style)
@@ -1858,6 +1899,7 @@
     updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_style->maskBoxImage().image() : 0);
 
     updateShapeImage(oldStyle ? oldStyle->shapeInside() : 0, m_style ? m_style->shapeInside() : 0);
+    updateShapeImage(oldStyle ? oldStyle->shapeOutside() : 0, m_style ? m_style->shapeOutside() : 0);
 
     // We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen
     // during styleDidChange (it's used by clippedOverflowRectForRepaint()).
@@ -2039,7 +2081,7 @@
 
     if (oldStyle && !areCursorsEqual(oldStyle, style())) {
         if (Frame* frame = this->frame())
-            frame->eventHandler()->dispatchFakeMouseMoveEventSoon();
+            frame->eventHandler()->scheduleCursorUpdate();
     }
 }
 
@@ -2328,12 +2370,25 @@
     LayoutRect newContainerRect;
     computeSelfHitTestRects(ownRects, layerOffset);
 
+    // When we get to have a lot of rects on a layer, the performance cost of tracking those
+    // rects outweighs the benefit of doing compositor thread hit testing.
+    // FIXME: This limit needs to be low due to the O(n^2) algorithm in
+    // WebLayer::setTouchEventHandlerRegion - crbug.com/300282.
+    const size_t maxRectsPerLayer = 100;
+
     LayerHitTestRects::iterator iter = layerRects.find(currentLayer);
     if (iter == layerRects.end())
         iter = layerRects.add(currentLayer, Vector<LayoutRect>()).iterator;
     for (size_t i = 0; i < ownRects.size(); i++) {
         if (!containerRect.contains(ownRects[i])) {
             iter->value.append(ownRects[i]);
+            if (iter->value.size() > maxRectsPerLayer) {
+                // Just mark the entire layer instead, and switch to walking the layer
+                // tree instead of the render tree.
+                layerRects.remove(currentLayer);
+                currentLayer->addLayerHitTestRects(layerRects);
+                return;
+            }
             if (newContainerRect.isEmpty())
                 newContainerRect = ownRects[i];
         }
@@ -2502,10 +2557,11 @@
     // has a null frame, so we assert this. However, we don't want release builds to crash which is why we
     // check that the frame is not null.
     ASSERT(frame());
-    if (frame() && frame()->page())
-        frame()->page()->stopAutoscrollIfNeeded(this);
-
-    animation()->cancelAnimations(this);
+    if (Frame* frame = this->frame()) {
+        if (frame->page())
+            frame->page()->stopAutoscrollIfNeeded(this);
+        frame->animation()->cancelAnimations(this);
+    }
 
     // For accessibility management, notify the parent of the imminent change to its child set.
     // We do it now, before remove(), while the parent pointer is still available.
@@ -2698,6 +2754,7 @@
             maskBoxImage->removeClient(this);
 
         removeShapeImageClient(m_style->shapeInside());
+        removeShapeImageClient(m_style->shapeOutside());
     }
 
     delete this;
@@ -2723,15 +2780,6 @@
     return hasLayer() && toRenderLayerModelObject(this)->layer()->isComposited();
 }
 
-bool RenderObject::canResize() const
-{
-    // We need a special case for <iframe> because they never have
-    // hasOverflowClip(). However, they do "implicitly" clip their contents, so
-    // we want to allow resizing them also.
-    return (hasOverflowClip() || isRenderIFrame()) && style()->resize() != RESIZE_NONE;
-}
-
-
 bool RenderObject::hitTest(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestFilter hitTestFilter)
 {
     bool inside = false;
@@ -2992,14 +3040,16 @@
     if (style()->visibility() != VISIBLE || !isBox())
         return;
 
-    RenderBox* box = toRenderBox(this);
-    FloatPoint absPos = localToAbsolute();
-
     if (style()->getDraggableRegionMode() == DraggableRegionNone)
         return;
+
+    RenderBox* box = toRenderBox(this);
+    FloatRect localBounds(FloatPoint(), FloatSize(box->width(), box->height()));
+    FloatRect absBounds = localToAbsoluteQuad(localBounds).boundingBox();
+
     AnnotatedRegionValue region;
     region.draggable = style()->getDraggableRegionMode() == DraggableRegionDrag;
-    region.bounds = LayoutRect(absPos.x(), absPos.y(), box->width(), box->height());
+    region.bounds = LayoutRect(absBounds);
     regions.append(region);
 }
 
diff --git a/Source/core/rendering/RenderObject.h b/Source/core/rendering/RenderObject.h
index 69e7c07..8a20726 100644
--- a/Source/core/rendering/RenderObject.h
+++ b/Source/core/rendering/RenderObject.h
@@ -30,9 +30,6 @@
 #include "core/dom/Position.h"
 #include "core/dom/StyleEngine.h"
 #include "core/fetch/ImageResourceClient.h"
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/graphics/LayoutRect.h"
-#include "core/platform/graphics/transforms/TransformationMatrix.h"
 #include "core/rendering/LayoutIndicator.h"
 #include "core/rendering/PaintPhase.h"
 #include "core/rendering/RenderObjectChildList.h"
@@ -41,6 +38,9 @@
 #include "core/rendering/SubtreeLayoutScope.h"
 #include "core/rendering/style/RenderStyle.h"
 #include "core/rendering/style/StyleInheritedData.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/geometry/LayoutRect.h"
+#include "platform/transforms/TransformationMatrix.h"
 #include "wtf/HashSet.h"
 
 namespace WebCore {
@@ -206,6 +206,8 @@
     RenderBox* enclosingBox() const;
     RenderBoxModelObject* enclosingBoxModelObject() const;
 
+    RenderBox* enclosingScrollableBox() const;
+
     // Function to return our enclosing flow thread if we are contained inside one. This
     // function follows the containing block chain.
     RenderFlowThread* flowThreadContainingBlock() const
@@ -700,11 +702,6 @@
 
     bool isComposited() const;
 
-    // FIXME: This should be moved to RenderBox once the scrolling code
-    // has been completely separated from RenderLayer and made to assume
-    // it talks to a RenderBox, not just a RenderObject.
-    bool canResize() const;
-
     bool hitTest(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestFilter = HitTestAll);
     virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&);
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
@@ -923,9 +920,9 @@
      */
     virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0);
 
-    // When performing a global document tear-down, the renderer of the document is cleared.  We use this
-    // as a hook to detect the case of document destruction and don't waste time doing unnecessary work.
-    bool documentBeingDestroyed() const;
+    // FIXME: This should probably be named documetBeingDetached() or something else
+    // since the Document isn't neccesarily destroyed, it's view is just being torn down.
+    bool documentBeingDestroyed() const { return document().isStopping(); }
 
     void destroyAndCleanupAnonymousWrappers();
     virtual void destroy();
@@ -1008,6 +1005,14 @@
 
     void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide,
                             Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false);
+    void drawDashedOrDottedBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2,
+        BoxSide, Color, int thickness, EBorderStyle, bool antialias);
+    void drawDoubleBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2,
+        int length, BoxSide, Color, int thickness, int adjacentWidth1, int adjacentWidth2, bool antialias);
+    void drawRidgeOrGrooveBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2,
+        BoxSide, Color, EBorderStyle, int adjacentWidth1, int adjacentWidth2, bool antialias);
+    void drawSolidBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2,
+        BoxSide, Color, int adjacentWidth1, int adjacentWidth2, bool antialias);
 
     void paintFocusRing(PaintInfo&, const LayoutPoint&, RenderStyle*);
     void paintOutline(PaintInfo&, const LayoutRect&);
@@ -1048,7 +1053,7 @@
     void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
 
     bool shouldRepaintForStyleDifference(StyleDifference) const;
-    bool hasImmediateNonWhitespaceTextChild() const;
+    bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const;
 
     RenderStyle* cachedFirstLineStyle() const;
     StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
@@ -1198,11 +1203,6 @@
     static bool s_affectsParentBlock;
 };
 
-inline bool RenderObject::documentBeingDestroyed() const
-{
-    return !document().renderer();
-}
-
 inline bool RenderObject::isBeforeContent() const
 {
     if (style()->styleType() != BEFORE)
diff --git a/Source/core/rendering/RenderOverflow.h b/Source/core/rendering/RenderOverflow.h
index 49ad02a..2a965c7 100644
--- a/Source/core/rendering/RenderOverflow.h
+++ b/Source/core/rendering/RenderOverflow.h
@@ -21,7 +21,7 @@
 #ifndef RenderOverflow_h
 #define RenderOverflow_h
 
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 
 namespace WebCore
 {
diff --git a/Source/core/rendering/RenderOverflowTest.cpp b/Source/core/rendering/RenderOverflowTest.cpp
index 0a5b7c3..d46aa35 100644
--- a/Source/core/rendering/RenderOverflowTest.cpp
+++ b/Source/core/rendering/RenderOverflowTest.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/rendering/RenderOverflow.h"
 
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 
 #include <gtest/gtest.h>
 
diff --git a/Source/core/rendering/RenderPart.cpp b/Source/core/rendering/RenderPart.cpp
index 4670fc7..33db879 100644
--- a/Source/core/rendering/RenderPart.cpp
+++ b/Source/core/rendering/RenderPart.cpp
@@ -26,7 +26,7 @@
 #include "core/rendering/RenderPart.h"
 
 #include "core/html/HTMLFrameElementBase.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/plugins/PluginView.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderLayer.h"
diff --git a/Source/core/rendering/RenderRegion.cpp b/Source/core/rendering/RenderRegion.cpp
index 651b888..31555f3 100644
--- a/Source/core/rendering/RenderRegion.cpp
+++ b/Source/core/rendering/RenderRegion.cpp
@@ -550,7 +550,7 @@
 
 void RenderRegion::computeChildrenStyleInRegion(const RenderObject* object)
 {
-    for (RenderObject* child = object->firstChild(); child; child = child->nextSibling()) {
+    for (RenderObject* child = object->lastChild(); child; child = child->previousSibling()) {
 
         RenderObjectRegionStyleMap::iterator it = m_renderObjectRegionStyle.find(child);
 
@@ -602,7 +602,7 @@
     m_renderObjectRegionStyle.remove(object);
 
     // Clear the style for the children of this object.
-    for (RenderObject* child = object->firstChild(); child; child = child->nextSibling())
+    for (RenderObject* child = object->lastChild(); child; child = child->previousSibling())
         clearObjectStyleInRegion(child);
 }
 
@@ -647,8 +647,12 @@
 
     LayoutUnit newLogicalHeight = autoHeight + borderAndPaddingLogicalHeight();
     ASSERT(newLogicalHeight < LayoutUnit::max() / 2);
-    if (newLogicalHeight > logicalHeight())
+    if (newLogicalHeight > logicalHeight()) {
         setLogicalHeight(newLogicalHeight);
+        // Recalculate position of the render block after new logical height is set.
+        // (needed in absolute positioning case with bottom alignment for example)
+        RenderBlock::updateLogicalHeight();
+    }
 }
 
 } // namespace WebCore
diff --git a/Source/core/rendering/RenderReplaced.cpp b/Source/core/rendering/RenderReplaced.cpp
index f5b2bc4..7d82e17 100644
--- a/Source/core/rendering/RenderReplaced.cpp
+++ b/Source/core/rendering/RenderReplaced.cpp
@@ -28,6 +28,7 @@
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/rendering/LayoutRepainter.h"
 #include "core/rendering/RenderBlock.h"
+#include "core/rendering/RenderImage.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderView.h"
 
@@ -277,8 +278,11 @@
             ASSERT(!isPercentageIntrinsicSize);
 
         // Handle zoom & vertical writing modes here, as the embedded document doesn't know about them.
-        if (!isPercentageIntrinsicSize)
+        if (!isPercentageIntrinsicSize) {
             intrinsicSize.scale(style()->effectiveZoom());
+            if (isRenderImage())
+                intrinsicSize.scale(toRenderImage(this)->imageDevicePixelRatio());
+        }
 
         if (rendererHasAspectRatio(this) && isPercentageIntrinsicSize)
             intrinsicRatio = 1;
diff --git a/Source/core/rendering/RenderScrollbar.cpp b/Source/core/rendering/RenderScrollbar.cpp
index 2cef428..6925a3d 100644
--- a/Source/core/rendering/RenderScrollbar.cpp
+++ b/Source/core/rendering/RenderScrollbar.cpp
@@ -27,8 +27,8 @@
 #include "core/rendering/RenderScrollbar.h"
 
 #include "core/css/PseudoStyleRequest.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/RenderPart.h"
 #include "core/rendering/RenderScrollbarPart.h"
 #include "core/rendering/RenderScrollbarTheme.h"
diff --git a/Source/core/rendering/RenderScrollbarPart.h b/Source/core/rendering/RenderScrollbarPart.h
index fadaea7..b81e638 100644
--- a/Source/core/rendering/RenderScrollbarPart.h
+++ b/Source/core/rendering/RenderScrollbarPart.h
@@ -26,8 +26,8 @@
 #ifndef RenderScrollbarPart_h
 #define RenderScrollbarPart_h
 
-#include "core/platform/ScrollTypes.h"
 #include "core/rendering/RenderBlock.h"
+#include "platform/scroll/ScrollTypes.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/RenderScrollbarTheme.cpp b/Source/core/rendering/RenderScrollbarTheme.cpp
index 84185ff..846e906 100644
--- a/Source/core/rendering/RenderScrollbarTheme.cpp
+++ b/Source/core/rendering/RenderScrollbarTheme.cpp
@@ -24,9 +24,9 @@
  */
 
 #include "config.h"
-#include "core/platform/ScrollbarThemeClient.h"
 #include "core/rendering/RenderScrollbar.h"
 #include "core/rendering/RenderScrollbarTheme.h"
+#include "platform/scroll/ScrollbarThemeClient.h"
 #include "wtf/StdLibExtras.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/RenderSelectionInfo.h b/Source/core/rendering/RenderSelectionInfo.h
index 96d0027..d3ec42d 100644
--- a/Source/core/rendering/RenderSelectionInfo.h
+++ b/Source/core/rendering/RenderSelectionInfo.h
@@ -25,8 +25,8 @@
 #ifndef RenderSelectionInfo_h
 #define RenderSelectionInfo_h
 
-#include "core/platform/graphics/IntRect.h"
 #include "core/rendering/RenderBox.h"
+#include "platform/geometry/IntRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/RenderTable.cpp b/Source/core/rendering/RenderTable.cpp
index ead0702..299fafb 100644
--- a/Source/core/rendering/RenderTable.cpp
+++ b/Source/core/rendering/RenderTable.cpp
@@ -29,7 +29,7 @@
 #include "HTMLNames.h"
 #include "core/dom/Document.h"
 #include "core/html/HTMLTableElement.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/rendering/AutoTableLayout.h"
 #include "core/rendering/FixedTableLayout.h"
@@ -454,6 +454,11 @@
         } else if (child->isRenderTableCol()) {
             child->layoutIfNeeded();
             ASSERT(!child->needsLayout());
+        } else {
+            // FIXME: We should never have other type of children (they should be wrapped in an
+            // anonymous table section) but our code is too crazy and this can happen in practice.
+            // Until this is fixed, let's make sure we don't leave non laid out children in the tree.
+            child->layoutIfNeeded();
         }
     }
 
@@ -846,10 +851,6 @@
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
         if (child->isRenderTableCol())
             return toRenderTableCol(child);
-
-        // We allow only table-captions before columns or column-groups.
-        if (!child->isTableCaption())
-            return 0;
     }
 
     return 0;
diff --git a/Source/core/rendering/RenderTableCell.cpp b/Source/core/rendering/RenderTableCell.cpp
index 3782283..36f6742 100644
--- a/Source/core/rendering/RenderTableCell.cpp
+++ b/Source/core/rendering/RenderTableCell.cpp
@@ -28,7 +28,6 @@
 #include "HTMLNames.h"
 #include "core/css/StylePropertySet.h"
 #include "core/html/HTMLTableCellElement.h"
-#include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/transforms/TransformState.h"
 #include "core/rendering/PaintInfo.h"
@@ -36,6 +35,7 @@
 #include "core/rendering/RenderView.h"
 #include "core/rendering/SubtreeLayoutScope.h"
 #include "core/rendering/style/CollapsedBorderValue.h"
+#include "platform/geometry/FloatQuad.h"
 
 using namespace std;
 
@@ -163,6 +163,16 @@
     }
 }
 
+void RenderTableCell::addLayerHitTestRects(LayerHitTestRects& layerRects, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
+{
+    LayoutPoint adjustedLayerOffset = layerOffset;
+    // RenderTableCell's location includes the offset of it's containing RenderTableRow, so
+    // we need to subtract that again here (as for RenderTableCell::offsetFromContainer.
+    if (parent())
+        adjustedLayerOffset -= parentBox()->locationOffset();
+    RenderBox::addLayerHitTestRects(layerRects, currentLayer, adjustedLayerOffset, containerRect);
+}
+
 void RenderTableCell::computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope& layouter)
 {
     int oldIntrinsicPaddingBefore = intrinsicPaddingBefore();
diff --git a/Source/core/rendering/RenderTableCell.h b/Source/core/rendering/RenderTableCell.h
index 29439c5..6926749 100644
--- a/Source/core/rendering/RenderTableCell.h
+++ b/Source/core/rendering/RenderTableCell.h
@@ -219,6 +219,8 @@
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
     virtual void computePreferredLogicalWidths();
 
+    virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* currentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const OVERRIDE;
+
 private:
     virtual const char* renderName() const { return (isAnonymous() || isPseudoElement()) ? "RenderTableCell (anonymous)" : "RenderTableCell"; }
 
diff --git a/Source/core/rendering/RenderTableCol.cpp b/Source/core/rendering/RenderTableCol.cpp
index 48a537d..26c5935 100644
--- a/Source/core/rendering/RenderTableCol.cpp
+++ b/Source/core/rendering/RenderTableCol.cpp
@@ -153,13 +153,7 @@
     if (!next && parent()->isRenderTableCol())
         next = parent()->nextSibling();
 
-    for (; next && !next->isRenderTableCol(); next = next->nextSibling()) {
-        // We allow captions mixed with columns and column-groups.
-        if (next->isTableCaption())
-            continue;
-
-        return 0;
-    }
+    for (; next && !next->isRenderTableCol(); next = next->nextSibling()) { }
 
     return toRenderTableCol(next);
 }
diff --git a/Source/core/rendering/RenderTableSection.cpp b/Source/core/rendering/RenderTableSection.cpp
index 4845ec9..33b28e3 100644
--- a/Source/core/rendering/RenderTableSection.cpp
+++ b/Source/core/rendering/RenderTableSection.cpp
@@ -414,7 +414,7 @@
         return true;
     // Sorting lower row index first because first we need to apply the extra height of spanning cell which
     // comes first in the table so lower rows's position would increment in sequence.
-    if (cellIsFullyIncludedInOtherCell(cell2, cell1))
+    if (!cellIsFullyIncludedInOtherCell(cell2, cell1))
         return (cell1->rowIndex() < cell2->rowIndex());
 
     return false;
@@ -1283,8 +1283,7 @@
 {
     ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this);
 
-    // put this back in when all layout tests can handle it
-    // ASSERT(!needsLayout());
+    ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout());
     // avoid crashing on bugs that cause us to paint with dirty layout
     if (needsLayout())
         return;
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp
index b5f82e1..0fa5740 100644
--- a/Source/core/rendering/RenderText.cpp
+++ b/Source/core/rendering/RenderText.cpp
@@ -28,11 +28,8 @@
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/Text.h"
 #include "core/fetch/TextResourceDecoder.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Settings.h"
-#include "core/platform/graphics/FloatQuad.h"
-#include "core/platform/text/TextBreakIterator.h"
-#include "core/platform/text/transcoder/FontTranscoder.h"
 #include "core/rendering/EllipsisBox.h"
 #include "core/rendering/InlineTextBox.h"
 #include "core/rendering/RenderBlock.h"
@@ -40,6 +37,8 @@
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/break_lines.h"
+#include "platform/geometry/FloatQuad.h"
+#include "platform/text/TextBreakIterator.h"
 #include "wtf/text/StringBuffer.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/unicode/CharacterNames.h"
@@ -120,8 +119,8 @@
     result.reserveCapacity(length);
 
     int32_t endOfWord;
-    int32_t startOfWord = textBreakFirst(boundary);
-    for (endOfWord = textBreakNext(boundary); endOfWord != TextBreakDone; startOfWord = endOfWord, endOfWord = textBreakNext(boundary)) {
+    int32_t startOfWord = boundary->first();
+    for (endOfWord = boundary->next(); endOfWord != TextBreakDone; startOfWord = endOfWord, endOfWord = boundary->next()) {
         if (startOfWord) // Ignore first char of previous string
             result.append(input[startOfWord - 1] == noBreakSpace ? noBreakSpace : toTitleCase(stringWithPrevious[startOfWord]));
         for (int i = startOfWord + 1; i < endOfWord; i++)
@@ -137,7 +136,6 @@
     , m_linesDirty(false)
     , m_containsReversedText(false)
     , m_knownToHaveNoOverflowAndNoFallbackFonts(false)
-    , m_needsTranscoding(false)
     , m_minWidth(-1)
     , m_maxWidth(-1)
     , m_firstLineMinWidth(0)
@@ -184,12 +182,6 @@
     return false;
 }
 
-void RenderText::updateNeedsTranscoding()
-{
-    const WTF::TextEncoding* encoding = document().decoder() ? &document().decoder()->encoding() : 0;
-    m_needsTranscoding = fontTranscoder().needsTranscoding(style()->font().fontDescription(), encoding);
-}
-
 void RenderText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
 {
     // There is no need to ever schedule repaints from a style change of a text run, since
@@ -202,18 +194,9 @@
     }
 
     RenderStyle* newStyle = style();
-    bool needsResetText = false;
-    if (!oldStyle) {
-        updateNeedsTranscoding();
-        needsResetText = m_needsTranscoding;
-    } else if (oldStyle->font().needsTranscoding() != newStyle->font().needsTranscoding() || (newStyle->font().needsTranscoding() && oldStyle->font().family().family() != newStyle->font().family().family())) {
-        updateNeedsTranscoding();
-        needsResetText = true;
-    }
-
     ETextTransform oldTransform = oldStyle ? oldStyle->textTransform() : TTNONE;
     ETextSecurity oldSecurity = oldStyle ? oldStyle->textSecurity() : TSNONE;
-    if (needsResetText || oldTransform != newStyle->textTransform() || oldSecurity != newStyle->textSecurity())
+    if (oldTransform != newStyle->textTransform() || oldSecurity != newStyle->textSecurity())
         transformText();
 
     if (!text().containsOnlyWhitespace())
@@ -532,7 +515,8 @@
         affinity = offset > box->caretMinOffset() ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM;
         break;
     }
-    return box->renderer()->createPositionWithAffinity(offset, affinity);
+    int textStartOffset = box->renderer()->isText() ? toRenderText(box->renderer())->textStartOffset() : 0;
+    return box->renderer()->createPositionWithAffinity(offset + textStartOffset, affinity);
 }
 
 static PositionWithAffinity createPositionWithAffinityForBoxAfterAdjustingOffsetForBiDi(const InlineTextBox* box, int offset, ShouldAffinityBeDownstream shouldAffinityBeDownstream)
@@ -1316,10 +1300,10 @@
         makeCapitalized(&text, previousCharacter);
         break;
     case UPPERCASE:
-        text.makeUpper();
+        text = text.upper(style->locale());
         break;
     case LOWERCASE:
-        text.makeLower();
+        text = text.lower(style->locale());
         break;
     }
 }
@@ -1328,11 +1312,6 @@
 {
     ASSERT(text);
     m_text = text;
-    if (m_needsTranscoding) {
-        const WTF::TextEncoding* encoding = document().decoder() ? &document().decoder()->encoding() : 0;
-        fontTranscoder().convert(m_text, style()->font().fontDescription(), encoding);
-    }
-    ASSERT(m_text);
 
     if (style()) {
         applyTextTransform(style(), m_text, previousCharacter());
@@ -1366,17 +1345,17 @@
         return;
 
     int lastTypedCharacterOffsetToReveal = -1;
-    StringBuilder revealedText;
+    UChar revealedText;
     SecureTextTimer* secureTextTimer = gSecureTextTimers ? gSecureTextTimers->get(this) : 0;
     if (secureTextTimer && secureTextTimer->isActive()) {
         lastTypedCharacterOffsetToReveal = secureTextTimer->lastTypedCharacterOffset();
         if (lastTypedCharacterOffsetToReveal >= 0)
-            revealedText.append(m_text[lastTypedCharacterOffsetToReveal]);
+            revealedText = m_text[lastTypedCharacterOffsetToReveal];
     }
 
     m_text.fill(mask);
     if (lastTypedCharacterOffsetToReveal >= 0) {
-        m_text.replace(lastTypedCharacterOffsetToReveal, 1, revealedText.toString());
+        m_text.replace(lastTypedCharacterOffsetToReveal, 1, String(&revealedText, 1));
         // m_text may be updated later before timer fires. We invalidate the lastTypedCharacterOffset to avoid inconsistency.
         secureTextTimer->invalidate();
     }
@@ -1397,19 +1376,6 @@
         cache->textChanged(this);
 }
 
-String RenderText::textWithoutTranscoding() const
-{
-    // If m_text isn't transcoded or is secure, we can just return the modified text.
-    if (!m_needsTranscoding || style()->textSecurity() != TSNONE)
-        return text();
-
-    // Otherwise, we should use original text. If text-transform is
-    // specified, we should transform the text on the fly.
-    String text = originalText();
-    applyTextTransform(style(), text, previousCharacter());
-    return text;
-}
-
 void RenderText::dirtyLineBoxes(bool fullLayout)
 {
     if (fullLayout)
@@ -1663,7 +1629,7 @@
     if (!iterator)
         return current - 1;
 
-    long result = textBreakPreceding(iterator, current);
+    long result = iterator->preceding(current);
     if (result == TextBreakDone)
         result = current - 1;
 
@@ -1819,7 +1785,7 @@
     if (!iterator)
         return current + 1;
 
-    long result = textBreakFollowing(iterator, current);
+    long result = iterator->following(current);
     if (result == TextBreakDone)
         result = current + 1;
 
diff --git a/Source/core/rendering/RenderText.h b/Source/core/rendering/RenderText.h
index 1a49794..4313475 100644
--- a/Source/core/rendering/RenderText.h
+++ b/Source/core/rendering/RenderText.h
@@ -53,6 +53,7 @@
 
     const String& text() const { return m_text; }
     String textWithoutTranscoding() const;
+    virtual unsigned textStartOffset() const { return 0; }
 
     InlineTextBox* createInlineTextBox();
     void dirtyLineBoxes(bool fullLayout);
diff --git a/Source/core/rendering/RenderTextControl.h b/Source/core/rendering/RenderTextControl.h
index baf8e77..e4af77a 100644
--- a/Source/core/rendering/RenderTextControl.h
+++ b/Source/core/rendering/RenderTextControl.h
@@ -64,6 +64,11 @@
     virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
     virtual RenderObject* layoutSpecialExcludedChild(bool relayoutChildren, SubtreeLayoutScope&);
 
+    // We need to override this function because we don't want overflow:hidden on an <input>
+    // to affect the baseline calculation. This is necessary because we are an inline-block
+    // element as an implementation detail which would normally be affected by this.
+    virtual int inlineBlockBaseline(LineDirectionMode direction) const OVERRIDE { return lastLineBoxBaseline(direction); }
+
 private:
     virtual const char* renderName() const { return "RenderTextControl"; }
     virtual bool isTextControl() const { return true; }
diff --git a/Source/core/rendering/RenderTextControlSingleLine.cpp b/Source/core/rendering/RenderTextControlSingleLine.cpp
index 4725026..c7d16d7 100644
--- a/Source/core/rendering/RenderTextControlSingleLine.cpp
+++ b/Source/core/rendering/RenderTextControlSingleLine.cpp
@@ -28,12 +28,12 @@
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/FrameSelection.h"
 #include "core/html/shadow/ShadowElementNames.h"
-#include "core/page/Frame.h"
-#include "core/platform/PlatformKeyboardEvent.h"
+#include "core/frame/Frame.h"
 #include "core/platform/graphics/SimpleFontData.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderTheme.h"
+#include "platform/PlatformKeyboardEvent.h"
 
 using namespace std;
 
diff --git a/Source/core/rendering/RenderTextFragment.cpp b/Source/core/rendering/RenderTextFragment.cpp
index d36e9c7..759eb9d 100644
--- a/Source/core/rendering/RenderTextFragment.cpp
+++ b/Source/core/rendering/RenderTextFragment.cpp
@@ -24,6 +24,7 @@
 #include "core/rendering/RenderTextFragment.h"
 
 #include "core/dom/Text.h"
+#include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderBlock.h"
 
 namespace WebCore {
@@ -49,6 +50,15 @@
 {
 }
 
+RenderText* RenderTextFragment::firstRenderTextInFirstLetter() const
+{
+    for (RenderObject* current = m_firstLetter; current; current = current->nextInPreOrder(m_firstLetter)) {
+        if (current->isText())
+            return toRenderText(current);
+    }
+    return 0;
+}
+
 PassRefPtr<StringImpl> RenderTextFragment::originalText() const
 {
     Node* e = node();
@@ -122,4 +132,20 @@
     return 0;
 }
 
+void RenderTextFragment::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
+{
+    if (result.innerNode())
+        return;
+
+    RenderObject::updateHitTestResult(result, point);
+    if (m_firstLetter || !node())
+        return;
+    RenderObject* nodeRenderer = node()->renderer();
+    if (!nodeRenderer || !nodeRenderer->isText() || !toRenderText(nodeRenderer)->isTextFragment())
+        return;
+
+    if (isDescendantOf(toRenderTextFragment(nodeRenderer)->m_firstLetter))
+        result.setIsFirstLetter(true);
+}
+
 } // namespace WebCore
diff --git a/Source/core/rendering/RenderTextFragment.h b/Source/core/rendering/RenderTextFragment.h
index 3150616..a9ed0e2 100644
--- a/Source/core/rendering/RenderTextFragment.h
+++ b/Source/core/rendering/RenderTextFragment.h
@@ -43,9 +43,11 @@
 
     unsigned start() const { return m_start; }
     unsigned end() const { return m_end; }
+    virtual unsigned textStartOffset() const OVERRIDE { return start(); }
 
     RenderObject* firstLetter() const { return m_firstLetter; }
     void setFirstLetter(RenderObject* firstLetter) { m_firstLetter = firstLetter; }
+    RenderText* firstRenderTextInFirstLetter() const;
 
     StringImpl* contentString() const { return m_contentString.get(); }
     virtual PassRefPtr<StringImpl> originalText() const;
@@ -62,6 +64,7 @@
 
     virtual UChar previousCharacter() const;
     RenderBlock* blockForAccompanyingFirstLetter() const;
+    virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRIDE;
 
     unsigned m_start;
     unsigned m_end;
diff --git a/Source/core/rendering/RenderTextTrackCue.cpp b/Source/core/rendering/RenderTextTrackCue.cpp
index e54e923..b1327af 100644
--- a/Source/core/rendering/RenderTextTrackCue.cpp
+++ b/Source/core/rendering/RenderTextTrackCue.cpp
@@ -28,7 +28,6 @@
 #include "core/rendering/RenderTextTrackCue.h"
 
 #include "core/html/track/TextTrackCue.h"
-#include "core/html/track/TextTrackCueGeneric.h"
 #include "core/rendering/RenderView.h"
 
 namespace WebCore {
@@ -54,13 +53,12 @@
 
     LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
 
-    if (m_cue->cueType()== TextTrackCue::WebVTT) {
+    if (m_cue->cueType() == TextTrackCue::WebVTT) {
         if (m_cue->snapToLines())
             repositionCueSnapToLinesSet();
         else
             repositionCueSnapToLinesNotSet();
-    } else
-        repositionGenericCue();
+    }
 
     statePusher.pop();
 }
@@ -266,24 +264,6 @@
     }
 }
 
-void RenderTextTrackCue::repositionGenericCue()
-{
-    TextTrackCueGeneric* cue = static_cast<TextTrackCueGeneric*>(m_cue);
-    if (!cue->useDefaultPosition())
-        return;
-
-    ASSERT(firstChild());
-
-    InlineFlowBox* firstLineBox;
-    if (!findFirstLineBox(firstLineBox))
-        return;
-
-    LayoutUnit parentWidth = containingBlock()->logicalWidth();
-    LayoutUnit width = firstLineBox->width();
-    LayoutUnit right = (parentWidth / 2) - (width / 2);
-    setX(right);
-}
-
 void RenderTextTrackCue::repositionCueSnapToLinesNotSet()
 {
     // FIXME: Implement overlapping detection when snap-to-lines is not set. http://wkb.ug/84296
diff --git a/Source/core/rendering/RenderTextTrackCue.h b/Source/core/rendering/RenderTextTrackCue.h
index fb71e4c..ee02097 100644
--- a/Source/core/rendering/RenderTextTrackCue.h
+++ b/Source/core/rendering/RenderTextTrackCue.h
@@ -26,9 +26,9 @@
 #ifndef RenderTextTrackCue_h
 #define RenderTextTrackCue_h
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/rendering/RenderBlockFlow.h"
 #include "core/rendering/RenderInline.h"
+#include "platform/geometry/FloatPoint.h"
 
 namespace WebCore {
 
@@ -54,7 +54,6 @@
     void placeBoxInDefaultPosition(LayoutUnit, bool&);
     void repositionCueSnapToLinesSet();
     void repositionCueSnapToLinesNotSet();
-    void repositionGenericCue();
 
     TextTrackCue* m_cue;
     FloatPoint m_fallbackPosition;
diff --git a/Source/core/rendering/RenderTheme.cpp b/Source/core/rendering/RenderTheme.cpp
index 87c69d0..0680bd9 100644
--- a/Source/core/rendering/RenderTheme.cpp
+++ b/Source/core/rendering/RenderTheme.cpp
@@ -41,12 +41,9 @@
 #include "core/html/shadow/SpinButtonElement.h"
 #include "core/html/shadow/TextControlInnerElements.h"
 #include "core/page/FocusController.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/FileSystem.h"
-#include "core/platform/FloatConversion.h"
-#include "core/platform/LocalizedStrings.h"
 #include "core/platform/graphics/FontSelector.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/StringTruncator.h"
@@ -54,6 +51,9 @@
 #include "core/rendering/RenderMeter.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/style/RenderStyle.h"
+#include "platform/FileMetadata.h"
+#include "platform/FloatConversion.h"
+#include "platform/text/PlatformLocale.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebFallbackThemeEngine.h"
 #include "public/platform/WebRect.h"
@@ -1206,25 +1206,20 @@
     return customFocusRingColor().isValid() ? customFocusRingColor() : theme().platformFocusRingColor();
 }
 
-String RenderTheme::fileListDefaultLabel(bool multipleFilesAllowed) const
-{
-    if (multipleFilesAllowed)
-        return fileButtonNoFilesSelectedLabel();
-    return fileButtonNoFileSelectedLabel();
-}
-
-String RenderTheme::fileListNameForWidth(const FileList* fileList, const Font& font, int width, bool multipleFilesAllowed) const
+String RenderTheme::fileListNameForWidth(Locale& locale, const FileList* fileList, const Font& font, int width) const
 {
     if (width <= 0)
         return String();
 
     String string;
-    if (fileList->isEmpty())
-        string = fileListDefaultLabel(multipleFilesAllowed);
-    else if (fileList->length() == 1)
+    if (fileList->isEmpty()) {
+        string = locale.queryString(WebKit::WebLocalizedString::FileButtonNoFileSelectedLabel);
+    } else if (fileList->length() == 1) {
         string = fileList->item(0)->name();
-    else
-        return StringTruncator::rightTruncate(multipleFileUploadText(fileList->length()), width, font, StringTruncator::EnableRoundingHacks);
+    } else {
+        // FIXME: Localization of fileList->length().
+        return StringTruncator::rightTruncate(locale.queryString(WebKit::WebLocalizedString::MultipleFileUploadText, String::number(fileList->length())), width, font, StringTruncator::EnableRoundingHacks);
+    }
 
     return StringTruncator::centerTruncate(string, width, font, StringTruncator::EnableRoundingHacks);
 }
diff --git a/Source/core/rendering/RenderTheme.h b/Source/core/rendering/RenderTheme.h
index 8550b7b..e300ddd 100644
--- a/Source/core/rendering/RenderTheme.h
+++ b/Source/core/rendering/RenderTheme.h
@@ -23,7 +23,6 @@
 #ifndef RenderTheme_h
 #define RenderTheme_h
 
-#include "core/platform/ScrollTypes.h"
 #if USE(NEW_THEME)
 #include "core/platform/Theme.h"
 #else
@@ -31,6 +30,7 @@
 #endif
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/style/CachedUAStyle.h"
+#include "platform/scroll/ScrollTypes.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/text/WTFString.h"
@@ -203,8 +203,7 @@
     virtual bool popsMenuByArrowKeys() const { return false; }
     virtual bool popsMenuBySpaceOrReturn() const { return false; }
 
-    virtual String fileListDefaultLabel(bool multipleFilesAllowed) const;
-    virtual String fileListNameForWidth(const FileList*, const Font&, int width, bool multipleFilesAllowed) const;
+    virtual String fileListNameForWidth(Locale&, const FileList*, const Font&, int width) const;
 
     virtual bool shouldOpenPickerWithF4Key() const;
 
diff --git a/Source/core/rendering/RenderThemeChromiumAndroid.cpp b/Source/core/rendering/RenderThemeChromiumAndroid.cpp
index 0e69736..78ebcb1 100644
--- a/Source/core/rendering/RenderThemeChromiumAndroid.cpp
+++ b/Source/core/rendering/RenderThemeChromiumAndroid.cpp
@@ -28,14 +28,14 @@
 
 #include "CSSValueKeywords.h"
 #include "UserAgentStyleSheets.h"
-#include "core/platform/LayoutTestSupport.h"
 #include "core/platform/ScrollbarTheme.h"
 #include "core/platform/graphics/Color.h"
 #include "core/rendering/PaintInfo.h"
-#include "core/rendering/RenderMediaControlsChromium.h"
+#include "core/rendering/RenderMediaControls.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderProgress.h"
 #include "core/rendering/RenderSlider.h"
+#include "platform/LayoutTestSupport.h"
 
 #include "public/platform/android/WebThemeEngine.h"
 #include "public/platform/Platform.h"
@@ -92,7 +92,7 @@
 
 bool RenderThemeChromiumAndroid::paintMediaOverlayPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaOverlayPlayButton, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaOverlayPlayButton, object, paintInfo, rect);
 }
 
 int RenderThemeChromiumAndroid::menuListArrowPadding() const
diff --git a/Source/core/rendering/RenderThemeChromiumFontProviderWin.cpp b/Source/core/rendering/RenderThemeChromiumFontProviderWin.cpp
index e201d90..c17695b 100644
--- a/Source/core/rendering/RenderThemeChromiumFontProviderWin.cpp
+++ b/Source/core/rendering/RenderThemeChromiumFontProviderWin.cpp
@@ -30,8 +30,8 @@
 
 #include "CSSValueKeywords.h"
 #include "core/platform/graphics/FontDescription.h"
-#include "core/platform/win/HWndDC.h"
-#include "core/platform/win/SystemInfo.h"
+#include "platform/win/HWndDC.h"
+#include "platform/win/SystemInfo.h"
 #include "wtf/text/WTFString.h"
 
 #define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(structName, member) \
diff --git a/Source/core/rendering/RenderThemeChromiumMac.h b/Source/core/rendering/RenderThemeChromiumMac.h
index fbbf684..8cbe2ba 100644
--- a/Source/core/rendering/RenderThemeChromiumMac.h
+++ b/Source/core/rendering/RenderThemeChromiumMac.h
@@ -128,7 +128,7 @@
     virtual bool supportsClosedCaptioning() const { return true; }
 
 private:
-    virtual String fileListNameForWidth(const FileList*, const Font&, int width, bool multipleFilesAllowed) const OVERRIDE;
+    virtual String fileListNameForWidth(Locale&, const FileList*, const Font&, int width) const OVERRIDE;
 
     IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const;
 
diff --git a/Source/core/rendering/RenderThemeChromiumMac.mm b/Source/core/rendering/RenderThemeChromiumMac.mm
index c0d52c6..37c4bfb 100644
--- a/Source/core/rendering/RenderThemeChromiumMac.mm
+++ b/Source/core/rendering/RenderThemeChromiumMac.mm
@@ -34,10 +34,7 @@
 #import "core/html/HTMLPlugInImageElement.h"
 #import "core/html/TimeRanges.h"
 #import "core/html/shadow/MediaControlElements.h"
-#import "core/page/FrameView.h"
-#import "core/platform/LayoutTestSupport.h"
-#import "core/platform/LocalizedStrings.h"
-#import "core/platform/SharedBuffer.h"
+#import "core/frame/FrameView.h"
 #import "core/platform/graphics/BitmapImage.h"
 #import "core/platform/graphics/GraphicsContextStateSaver.h"
 #import "core/platform/graphics/Image.h"
@@ -52,11 +49,13 @@
 #import "core/rendering/RenderLayer.h"
 #import "core/rendering/RenderMedia.h"
 #import "core/rendering/RenderMediaControls.h"
-#import "core/rendering/RenderMediaControlsChromium.h"
 #import "core/rendering/RenderMeter.h"
 #import "core/rendering/RenderProgress.h"
 #import "core/rendering/RenderSlider.h"
 #import "core/rendering/RenderView.h"
+#import "platform/LayoutTestSupport.h"
+#import "platform/SharedBuffer.h"
+#import "platform/text/PlatformLocale.h"
 
 #import <AvailabilityMacros.h>
 #import <Carbon/Carbon.h>
@@ -1875,18 +1874,20 @@
     return m_textField.get();
 }
 
-String RenderThemeChromiumMac::fileListNameForWidth(const FileList* fileList, const Font& font, int width, bool multipleFilesAllowed) const
+String RenderThemeChromiumMac::fileListNameForWidth(Locale& locale, const FileList* fileList, const Font& font, int width) const
 {
     if (width <= 0)
         return String();
 
     String strToTruncate;
-    if (fileList->isEmpty())
-        strToTruncate = fileListDefaultLabel(multipleFilesAllowed);
-    else if (fileList->length() == 1)
+    if (fileList->isEmpty()) {
+        strToTruncate = locale.queryString(WebKit::WebLocalizedString::FileButtonNoFileSelectedLabel);
+    } else if (fileList->length() == 1) {
         strToTruncate = [[NSFileManager defaultManager] displayNameAtPath:(fileList->item(0)->path())];
-    else
-        return StringTruncator::rightTruncate(multipleFileUploadText(fileList->length()), width, font, StringTruncator::EnableRoundingHacks);
+    } else {
+        // FIXME: Localization of fileList->length().
+        return StringTruncator::rightTruncate(locale.queryString(WebKit::WebLocalizedString::MultipleFileUploadText, String::number(fileList->length())), width, font, StringTruncator::EnableRoundingHacks);
+    }
 
     return StringTruncator::centerTruncate(strToTruncate, width, font, StringTruncator::EnableRoundingHacks);
 }
@@ -1944,22 +1945,22 @@
 
 void RenderThemeChromiumMac::adjustMediaSliderThumbSize(RenderStyle* style) const
 {
-    RenderMediaControlsChromium::adjustMediaSliderThumbSize(style);
+    RenderMediaControls::adjustMediaSliderThumbSize(style);
 }
 
 bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaPlayButton, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaPlayButton, object, paintInfo, rect);
 }
 
 bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaMuteButton, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaMuteButton, object, paintInfo, rect);
 }
 
 bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaSlider, object, paintInfo, rect);
 }
 
 String RenderThemeChromiumMac::extraFullScreenStyleSheet()
@@ -1981,37 +1982,37 @@
 
 bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect);
 }
 
 bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect);
 }
 
 bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect);
 }
 
 String RenderThemeChromiumMac::formatMediaControlsTime(float time) const
 {
-    return RenderMediaControlsChromium::formatMediaControlsTime(time);
+    return RenderMediaControls::formatMediaControlsTime(time);
 }
 
 String RenderThemeChromiumMac::formatMediaControlsCurrentTime(float currentTime, float duration) const
 {
-    return RenderMediaControlsChromium::formatMediaControlsCurrentTime(currentTime, duration);
+    return RenderMediaControls::formatMediaControlsCurrentTime(currentTime, duration);
 }
 
 bool RenderThemeChromiumMac::paintMediaFullscreenButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaEnterFullscreenButton, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaEnterFullscreenButton, object, paintInfo, rect);
 }
 
 bool RenderThemeChromiumMac::paintMediaToggleClosedCaptionsButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaShowClosedCaptionsButton, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaShowClosedCaptionsButton, object, paintInfo, rect);
 }
 
 bool RenderThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const
diff --git a/Source/core/rendering/RenderThemeChromiumSkia.cpp b/Source/core/rendering/RenderThemeChromiumSkia.cpp
index ee4f442..246bd97 100644
--- a/Source/core/rendering/RenderThemeChromiumSkia.cpp
+++ b/Source/core/rendering/RenderThemeChromiumSkia.cpp
@@ -25,16 +25,16 @@
 #include "core/rendering/RenderThemeChromiumSkia.h"
 
 #include "UserAgentStyleSheets.h"
-#include "core/platform/LayoutTestSupport.h"
 #include "core/platform/ScrollbarTheme.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/Image.h"
 #include "core/rendering/PaintInfo.h"
 #include "core/rendering/RenderBox.h"
-#include "core/rendering/RenderMediaControlsChromium.h"
+#include "core/rendering/RenderMediaControls.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderProgress.h"
 #include "core/rendering/RenderThemeChromiumFontProvider.h"
+#include "platform/LayoutTestSupport.h"
 #include "wtf/CurrentTime.h"
 
 namespace WebCore {
@@ -293,57 +293,57 @@
 
 bool RenderThemeChromiumSkia::paintMediaSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaSlider, object, paintInfo, rect);
 }
 
 bool RenderThemeChromiumSkia::paintMediaVolumeSliderTrack(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaVolumeSlider, object, paintInfo, rect);
 }
 
 void RenderThemeChromiumSkia::adjustSliderThumbSize(RenderStyle* style, Element*) const
 {
-    RenderMediaControlsChromium::adjustMediaSliderThumbSize(style);
+    RenderMediaControls::adjustMediaSliderThumbSize(style);
 }
 
 bool RenderThemeChromiumSkia::paintMediaSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect);
 }
 
 bool RenderThemeChromiumSkia::paintMediaToggleClosedCaptionsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaShowClosedCaptionsButton, o, paintInfo, r);
+    return RenderMediaControls::paintMediaControlsPart(MediaShowClosedCaptionsButton, o, paintInfo, r);
 }
 
 bool RenderThemeChromiumSkia::paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaVolumeSliderThumb, object, paintInfo, rect);
 }
 
 bool RenderThemeChromiumSkia::paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaPlayButton, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaPlayButton, object, paintInfo, rect);
 }
 
 bool RenderThemeChromiumSkia::paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaMuteButton, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaMuteButton, object, paintInfo, rect);
 }
 
 String RenderThemeChromiumSkia::formatMediaControlsTime(float time) const
 {
-    return RenderMediaControlsChromium::formatMediaControlsTime(time);
+    return RenderMediaControls::formatMediaControlsTime(time);
 }
 
 String RenderThemeChromiumSkia::formatMediaControlsCurrentTime(float currentTime, float duration) const
 {
-    return RenderMediaControlsChromium::formatMediaControlsCurrentTime(currentTime, duration);
+    return RenderMediaControls::formatMediaControlsCurrentTime(currentTime, duration);
 }
 
 bool RenderThemeChromiumSkia::paintMediaFullscreenButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
-    return RenderMediaControlsChromium::paintMediaControlsPart(MediaEnterFullscreenButton, object, paintInfo, rect);
+    return RenderMediaControls::paintMediaControlsPart(MediaEnterFullscreenButton, object, paintInfo, rect);
 }
 
 void RenderThemeChromiumSkia::adjustMenuListStyle(RenderStyle* style, WebCore::Element*) const
diff --git a/Source/core/rendering/RenderThemeChromiumWin.cpp b/Source/core/rendering/RenderThemeChromiumWin.cpp
index 1abbd9f..749a2ef 100644
--- a/Source/core/rendering/RenderThemeChromiumWin.cpp
+++ b/Source/core/rendering/RenderThemeChromiumWin.cpp
@@ -33,24 +33,23 @@
 #include "HTMLNames.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/shadow/MediaControlElements.h"
-#include "core/platform/LayoutTestSupport.h"
 #include "core/platform/ScrollbarTheme.h"
 #include "core/platform/graphics/FontSelector.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/chromium/FontUtilsChromiumWin.h"
 #include "core/platform/graphics/chromium/TransparencyWin.h"
-#include "core/platform/win/SystemInfo.h"
 #include "core/rendering/PaintInfo.h"
 #include "core/rendering/RenderBox.h"
 #include "core/rendering/RenderProgress.h"
 #include "core/rendering/RenderSlider.h"
+#include "platform/LayoutTestSupport.h"
+#include "platform/win/SystemInfo.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebColor.h"
 #include "public/platform/WebRect.h"
 #include "public/platform/win/WebThemeEngine.h"
 #include "wtf/CurrentTime.h"
 
-
 // FIXME: This dependency should eventually be removed.
 #include <skia/ext/skia_utils_win.h>
 
diff --git a/Source/core/rendering/RenderTreeAsText.cpp b/Source/core/rendering/RenderTreeAsText.cpp
index 319f752..690d9f5 100644
--- a/Source/core/rendering/RenderTreeAsText.cpp
+++ b/Source/core/rendering/RenderTreeAsText.cpp
@@ -31,9 +31,10 @@
 #include "core/dom/Document.h"
 #include "core/editing/FrameSelection.h"
 #include "core/html/HTMLElement.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/PrintContext.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/FlowThreadController.h"
 #include "core/rendering/InlineTextBox.h"
 #include "core/rendering/RenderBR.h"
@@ -41,7 +42,6 @@
 #include "core/rendering/RenderFileUploadControl.h"
 #include "core/rendering/RenderInline.h"
 #include "core/rendering/RenderLayer.h"
-#include "core/rendering/RenderLayerBacking.h"
 #include "core/rendering/RenderListItem.h"
 #include "core/rendering/RenderListMarker.h"
 #include "core/rendering/RenderNamedFlowThread.h"
@@ -568,10 +568,10 @@
             ts << " scrollX " << l.scrollXOffset();
         if (l.scrollYOffset())
             ts << " scrollY " << l.scrollYOffset();
-        if (l.renderBox() && l.renderBox()->pixelSnappedClientWidth() != l.scrollWidth())
-            ts << " scrollWidth " << l.scrollWidth();
-        if (l.renderBox() && l.renderBox()->pixelSnappedClientHeight() != l.scrollHeight())
-            ts << " scrollHeight " << l.scrollHeight();
+        if (l.renderBox() && l.renderBox()->pixelSnappedClientWidth() != l.renderBox()->scrollWidth())
+            ts << " scrollWidth " << l.renderBox()->scrollWidth();
+        if (l.renderBox() && l.renderBox()->pixelSnappedClientHeight() != l.renderBox()->scrollHeight())
+            ts << " scrollHeight " << l.renderBox()->scrollHeight();
     }
 
     if (paintPhase == LayerPaintPhaseBackground)
@@ -580,8 +580,15 @@
         ts << " layerType: foreground only";
 
     if (behavior & RenderAsTextShowCompositedLayers) {
-        if (l.isComposited())
-            ts << " (composited, bounds=" << l.backing()->compositedBounds() << ", drawsContent=" << l.backing()->graphicsLayer()->drawsContent() << ", paints into ancestor=" << l.backing()->paintsIntoCompositedAncestor() << ")";
+        if (l.isComposited()) {
+            ts << " (composited, bounds="
+                << l.compositedLayerMapping()->compositedBounds()
+                << ", drawsContent="
+                << l.compositedLayerMapping()->mainGraphicsLayer()->drawsContent()
+                << ", paints into ancestor="
+                << l.compositedLayerMapping()->paintsIntoCompositedAncestor()
+                << ")";
+        }
     }
 
     ts << "\n";
diff --git a/Source/core/rendering/RenderTreeAsText.h b/Source/core/rendering/RenderTreeAsText.h
index 61bbadb..ddf534d 100644
--- a/Source/core/rendering/RenderTreeAsText.h
+++ b/Source/core/rendering/RenderTreeAsText.h
@@ -25,7 +25,7 @@
 
 #ifndef RenderTreeAsText_h
 #define RenderTreeAsText_h
-#include "core/platform/text/TextStream.h"
+#include "platform/text/TextStream.h"
 
 #include "wtf/Forward.h"
 
diff --git a/Source/core/rendering/RenderVideo.cpp b/Source/core/rendering/RenderVideo.cpp
index f551f99..fb198bd 100644
--- a/Source/core/rendering/RenderVideo.cpp
+++ b/Source/core/rendering/RenderVideo.cpp
@@ -30,8 +30,8 @@
 #include "HTMLNames.h"
 #include "core/dom/Document.h"
 #include "core/html/HTMLVideoElement.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/platform/graphics/MediaPlayer.h"
 #include "core/rendering/PaintInfo.h"
@@ -156,28 +156,14 @@
 {
     MediaPlayer* mediaPlayer = mediaElement()->player();
     bool displayingPoster = videoElement()->shouldDisplayPosterImage();
-
-    Page* page = 0;
-    if (Frame* frame = this->frame())
-        page = frame->page();
-
-    if (!displayingPoster && !mediaPlayer) {
-        if (page && paintInfo.phase == PaintPhaseForeground)
-            page->addRelevantUnpaintedObject(this, visualOverflowRect());
+    if (!displayingPoster && !mediaPlayer)
         return;
-    }
 
     LayoutRect rect = videoBox();
-    if (rect.isEmpty()) {
-        if (page && paintInfo.phase == PaintPhaseForeground)
-            page->addRelevantUnpaintedObject(this, visualOverflowRect());
+    if (rect.isEmpty())
         return;
-    }
     rect.moveBy(paintOffset);
 
-    if (page && paintInfo.phase == PaintPhaseForeground)
-        page->addRelevantRepaintedObject(this, rect);
-
     LayoutRect contentRect = contentBoxRect();
     contentRect.moveBy(paintOffset);
     GraphicsContext* context = paintInfo.context;
diff --git a/Source/core/rendering/RenderView.cpp b/Source/core/rendering/RenderView.cpp
index 474aff6..a861fe0 100644
--- a/Source/core/rendering/RenderView.cpp
+++ b/Source/core/rendering/RenderView.cpp
@@ -25,23 +25,24 @@
 #include "core/dom/Element.h"
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/html/HTMLIFrameElement.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h"
-#include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/transforms/TransformState.h"
 #include "core/rendering/ColumnInfo.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/FlowThreadController.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderFlowThread.h"
 #include "core/rendering/RenderGeometryMap.h"
 #include "core/rendering/RenderLayer.h"
-#include "core/rendering/RenderLayerBacking.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderSelectionInfo.h"
 #include "core/rendering/RenderWidget.h"
+#include "core/svg/SVGElement.h"
+#include "platform/geometry/FloatQuad.h"
 
 namespace WebCore {
 
@@ -73,6 +74,7 @@
 
 RenderView::~RenderView()
 {
+    document().clearRenderView();
 }
 
 bool RenderView::hitTest(const HitTestRequest& request, HitTestResult& result)
@@ -273,6 +275,12 @@
                     || child->style()->logicalMaxHeight().isViewportPercentage()
                     || child->isSVGRoot())
                 layoutScope.setChildNeedsLayout(child);
+
+            if (child->isSVGRoot()) {
+                ASSERT(child->node());
+                ASSERT(child->node()->isSVGElement());
+                toSVGElement(child->node())->invalidateRelativeLengthClients(&layoutScope);
+            }
         }
     }
 
@@ -520,18 +528,11 @@
     }
 }
 
-bool RenderView::shouldRepaint(const LayoutRect& r) const
+bool RenderView::shouldRepaint(const LayoutRect& rect) const
 {
-    if (document().printing() || r.width() == 0 || r.height() == 0)
+    if (document().printing())
         return false;
-
-    if (!m_frameView)
-        return false;
-
-    if (m_frameView->repaintsDisabled())
-        return false;
-
-    return true;
+    return m_frameView && !rect.isEmpty();
 }
 
 void RenderView::repaintViewRectangle(const LayoutRect& ur) const
@@ -628,8 +629,6 @@
 
 IntRect RenderView::selectionBounds(bool clipToVisibleContent) const
 {
-    document().updateStyleIfNeeded();
-
     typedef HashMap<RenderObject*, OwnPtr<RenderSelectionInfo> > SelectionMap;
     SelectionMap selectedObjects;
 
@@ -670,8 +669,6 @@
 
 void RenderView::repaintSelection() const
 {
-    document().updateStyleIfNeeded();
-
     HashSet<RenderBlock*> processedBlocks;
 
     RenderObject* end = rendererAfterPosition(m_selectionEnd, m_selectionEndPos);
@@ -835,7 +832,7 @@
     if (!m_frameView || blockRepaintMode == RepaintNothing)
         return;
 
-    m_frameView->beginDeferredRepaints();
+    FrameView::DeferredRepaintScope deferRepaints(*m_frameView);
 
     // Have any of the old selected objects changed compared to the new selection?
     for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObjectsEnd; ++i) {
@@ -877,8 +874,6 @@
     SelectedBlockMap::iterator newBlocksEnd = newSelectedBlocks.end();
     for (SelectedBlockMap::iterator i = newSelectedBlocks.begin(); i != newBlocksEnd; ++i)
         i->value->repaint();
-
-    m_frameView->endDeferredRepaints();
 }
 
 void RenderView::getSelection(RenderObject*& startRenderer, int& startOffset, RenderObject*& endRenderer, int& endOffset) const
diff --git a/Source/core/rendering/RenderView.h b/Source/core/rendering/RenderView.h
index 5ac228e..9298c1f 100644
--- a/Source/core/rendering/RenderView.h
+++ b/Source/core/rendering/RenderView.h
@@ -22,13 +22,13 @@
 #ifndef RenderView_h
 #define RenderView_h
 
-#include "core/page/FrameView.h"
-#include "core/platform/PODFreeListArena.h"
+#include "core/frame/FrameView.h"
 #include "core/platform/ScrollableArea.h"
 #include "core/rendering/LayoutIndicator.h"
 #include "core/rendering/LayoutState.h"
 #include "core/rendering/RenderBlockFlow.h"
 #include "core/rendering/RenderingConfiguration.h"
+#include "platform/PODFreeListArena.h"
 #include "wtf/OwnPtr.h"
 
 namespace WebCore {
@@ -321,11 +321,6 @@
 // This will catch anyone doing an unnecessary cast.
 void toRenderView(const RenderView*);
 
-ALWAYS_INLINE RenderView* Document::renderView() const
-{
-    return toRenderView(renderer());
-}
-
 // Stack-based class to assist with LayoutState push/pop
 class LayoutStateMaintainer {
     WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer);
diff --git a/Source/core/rendering/RenderWidget.cpp b/Source/core/rendering/RenderWidget.cpp
index 8a076db..672d6b0 100644
--- a/Source/core/rendering/RenderWidget.cpp
+++ b/Source/core/rendering/RenderWidget.cpp
@@ -25,59 +25,64 @@
 #include "core/rendering/RenderWidget.h"
 
 #include "core/accessibility/AXObjectCache.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/platform/graphics/GraphicsContext.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/RenderLayer.h"
-#include "core/rendering/RenderLayerBacking.h"
 #include "core/rendering/RenderView.h"
+#include "wtf/HashMap.h"
 
 using namespace std;
 
 namespace WebCore {
 
-static HashMap<const Widget*, RenderWidget*>& widgetRendererMap()
-{
-    static HashMap<const Widget*, RenderWidget*>* staticWidgetRendererMap = new HashMap<const Widget*, RenderWidget*>;
-    return *staticWidgetRendererMap;
-}
-
-unsigned WidgetHierarchyUpdatesSuspensionScope::s_widgetHierarchyUpdateSuspendCount = 0;
-
-WidgetHierarchyUpdatesSuspensionScope::WidgetToParentMap& WidgetHierarchyUpdatesSuspensionScope::widgetNewParentMap()
+typedef HashMap<RefPtr<Widget>, FrameView*> WidgetToParentMap;
+static WidgetToParentMap& widgetNewParentMap()
 {
     DEFINE_STATIC_LOCAL(WidgetToParentMap, map, ());
     return map;
 }
 
-void WidgetHierarchyUpdatesSuspensionScope::moveWidgets()
+static unsigned s_updateSuspendCount = 0;
+
+RenderWidget::UpdateSuspendScope::UpdateSuspendScope()
 {
-    WidgetToParentMap map;
-    widgetNewParentMap().swap(map);
-    WidgetToParentMap::iterator end = map.end();
-    for (WidgetToParentMap::iterator it = map.begin(); it != end; ++it) {
-        Widget* child = it->key.get();
-        ScrollView* currentParent = child->parent();
-        FrameView* newParent = it->value;
-        if (newParent != currentParent) {
-            if (currentParent)
-                currentParent->removeChild(child);
-            if (newParent)
-                newParent->addChild(child);
+    ++s_updateSuspendCount;
+}
+
+RenderWidget::UpdateSuspendScope::~UpdateSuspendScope()
+{
+    ASSERT(s_updateSuspendCount > 0);
+    if (s_updateSuspendCount == 1) {
+        WidgetToParentMap map;
+        widgetNewParentMap().swap(map);
+        WidgetToParentMap::iterator end = map.end();
+        for (WidgetToParentMap::iterator it = map.begin(); it != end; ++it) {
+            Widget* child = it->key.get();
+            ScrollView* currentParent = toScrollView(child->parent());
+            FrameView* newParent = it->value;
+            if (newParent != currentParent) {
+                if (currentParent)
+                    currentParent->removeChild(child);
+                if (newParent)
+                    newParent->addChild(child);
+            }
         }
     }
+    --s_updateSuspendCount;
 }
 
 static void moveWidgetToParentSoon(Widget* child, FrameView* parent)
 {
-    if (!WidgetHierarchyUpdatesSuspensionScope::isSuspended()) {
+    if (!s_updateSuspendCount) {
         if (parent)
             parent->addChild(child);
         else
-            child->removeFromParent();
+            toScrollView(child->parent())->removeChild(child);
         return;
     }
-    WidgetHierarchyUpdatesSuspensionScope::scheduleWidgetToMove(child, parent);
+    widgetNewParentMap().set(child, parent);
 }
 
 RenderWidget::RenderWidget(Element* element)
@@ -136,9 +141,9 @@
     IntRect clipRect = roundedIntRect(enclosingLayer()->childrenClipRect());
     IntRect newFrame = roundedIntRect(frame);
     bool clipChanged = m_clipRect != clipRect;
-    bool boundsChanged = m_widget->frameRect() != newFrame;
+    bool frameRectChanged = m_widget->frameRect() != newFrame;
 
-    if (!boundsChanged && !clipChanged)
+    if (!frameRectChanged && !clipChanged)
         return false;
 
     m_clipRect = clipRect;
@@ -147,12 +152,13 @@
     RefPtr<Node> protectedNode(node());
     m_widget->setFrameRect(newFrame);
 
-    if (clipChanged && !boundsChanged)
+    if (clipChanged && !frameRectChanged)
         m_widget->clipRectChanged();
 
     if (hasLayer() && layer()->isComposited())
-        layer()->backing()->updateAfterWidgetResize();
+        layer()->compositedLayerMapping()->updateAfterWidgetResize();
 
+    bool boundsChanged = m_widget->frameRect().size() != newFrame.size();
     return boundsChanged;
 }
 
@@ -175,12 +181,10 @@
 
     if (m_widget) {
         moveWidgetToParentSoon(m_widget.get(), 0);
-        widgetRendererMap().remove(m_widget.get());
         clearWidget();
     }
     m_widget = widget;
     if (m_widget) {
-        widgetRendererMap().add(m_widget.get(), this);
         // If we've already received a layout, apply the calculated space to the
         // widget immediately, but we have to have really been fully constructed (with a non-null
         // style pointer).
@@ -355,11 +359,6 @@
     m_widget = 0;
 }
 
-RenderWidget* RenderWidget::find(const Widget* widget)
-{
-    return widgetRendererMap().get(widget);
-}
-
 bool RenderWidget::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
 {
     bool hadResult = result.innerNode();
diff --git a/Source/core/rendering/RenderWidget.h b/Source/core/rendering/RenderWidget.h
index cd418c4..abbd6fc 100644
--- a/Source/core/rendering/RenderWidget.h
+++ b/Source/core/rendering/RenderWidget.h
@@ -22,37 +22,11 @@
 #ifndef RenderWidget_h
 #define RenderWidget_h
 
-#include "core/platform/Widget.h"
 #include "core/rendering/RenderReplaced.h"
+#include "platform/Widget.h"
 
 namespace WebCore {
 
-class WidgetHierarchyUpdatesSuspensionScope {
-public:
-    WidgetHierarchyUpdatesSuspensionScope()
-    {
-        s_widgetHierarchyUpdateSuspendCount++;
-    }
-    ~WidgetHierarchyUpdatesSuspensionScope()
-    {
-        ASSERT(s_widgetHierarchyUpdateSuspendCount);
-        if (s_widgetHierarchyUpdateSuspendCount == 1)
-            moveWidgets();
-        s_widgetHierarchyUpdateSuspendCount--;
-    }
-
-    static bool isSuspended() { return s_widgetHierarchyUpdateSuspendCount; }
-    static void scheduleWidgetToMove(Widget* widget, FrameView* frame) { widgetNewParentMap().set(widget, frame); }
-
-private:
-    typedef HashMap<RefPtr<Widget>, FrameView*> WidgetToParentMap;
-    static WidgetToParentMap& widgetNewParentMap();
-
-    void moveWidgets();
-
-    static unsigned s_widgetHierarchyUpdateSuspendCount;
-};
-
 class RenderWidget : public RenderReplaced {
 public:
     virtual ~RenderWidget();
@@ -60,8 +34,6 @@
     Widget* widget() const { return m_widget.get(); }
     virtual void setWidget(PassRefPtr<Widget>);
 
-    static RenderWidget* find(const Widget*);
-
     void updateWidgetPosition();
     void widgetPositionsUpdated();
     IntRect windowClipRect() const;
@@ -71,6 +43,12 @@
     void ref() { ++m_refCount; }
     void deref();
 
+    class UpdateSuspendScope {
+    public:
+        UpdateSuspendScope();
+        ~UpdateSuspendScope();
+    };
+
 protected:
     RenderWidget(Element*);
 
diff --git a/Source/core/rendering/RootInlineBox.cpp b/Source/core/rendering/RootInlineBox.cpp
index bb0887f..5892173 100644
--- a/Source/core/rendering/RootInlineBox.cpp
+++ b/Source/core/rendering/RootInlineBox.cpp
@@ -21,7 +21,6 @@
 #include "core/rendering/RootInlineBox.h"
 
 #include "core/dom/Document.h"
-#include "core/platform/text/BidiResolver.h"
 #include "core/rendering/EllipsisBox.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/InlineTextBox.h"
@@ -30,6 +29,7 @@
 #include "core/rendering/RenderFlowThread.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/VerticalPositionCache.h"
+#include "platform/text/BidiResolver.h"
 #include "wtf/unicode/Unicode.h"
 
 using namespace std;
diff --git a/Source/core/rendering/RootInlineBox.h b/Source/core/rendering/RootInlineBox.h
index f6ddc5f..53397c4 100644
--- a/Source/core/rendering/RootInlineBox.h
+++ b/Source/core/rendering/RootInlineBox.h
@@ -21,8 +21,8 @@
 #ifndef RootInlineBox_h
 #define RootInlineBox_h
 
-#include "core/platform/text/BidiContext.h"
 #include "core/rendering/InlineFlowBox.h"
+#include "platform/text/BidiContext.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/SubtreeLayoutScope.cpp b/Source/core/rendering/SubtreeLayoutScope.cpp
index 0484cba..d650513 100644
--- a/Source/core/rendering/SubtreeLayoutScope.cpp
+++ b/Source/core/rendering/SubtreeLayoutScope.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "core/rendering/SubtreeLayoutScope.h"
 
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/RenderObject.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/TextAutosizer.cpp b/Source/core/rendering/TextAutosizer.cpp
index 50a5154..57cf1a9 100644
--- a/Source/core/rendering/TextAutosizer.cpp
+++ b/Source/core/rendering/TextAutosizer.cpp
@@ -29,14 +29,14 @@
 #include "core/html/HTMLMetaElement.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/Settings.h"
-#include "core/platform/chromium/TraceEvent.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/rendering/RenderListItem.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderText.h"
 #include "core/rendering/RenderView.h"
 #include "core/rendering/style/RenderStyle.h"
 #include "core/rendering/style/StyleInheritedData.h"
+#include "platform/TraceEvent.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/Vector.h"
 
@@ -180,10 +180,8 @@
 
     // Window area, in logical (density-independent) pixels.
     windowInfo.windowSize = m_document->settings()->textAutosizingWindowSizeOverride();
-    if (windowInfo.windowSize.isEmpty()) {
-        bool includeScrollbars = !InspectorInstrumentation::shouldApplyScreenWidthOverride(mainFrame);
-        windowInfo.windowSize = mainFrame->view()->unscaledVisibleContentSize(includeScrollbars ? ScrollableArea::IncludeScrollbars : ScrollableArea::ExcludeScrollbars);
-    }
+    if (windowInfo.windowSize.isEmpty())
+        windowInfo.windowSize = mainFrame->view()->unscaledVisibleContentSize(ScrollableArea::IncludeScrollbars);
 
     // Largest area of block that can be visible at once (assuming the main
     // frame doesn't get scaled to less than overview scale), in CSS pixels.
diff --git a/Source/core/rendering/TextAutosizer.h b/Source/core/rendering/TextAutosizer.h
index d8f7f89..9632d82 100644
--- a/Source/core/rendering/TextAutosizer.h
+++ b/Source/core/rendering/TextAutosizer.h
@@ -27,7 +27,7 @@
 #define TextAutosizer_h
 
 #include "HTMLNames.h"
-#include "core/platform/text/WritingMode.h"
+#include "platform/text/WritingMode.h"
 #include "wtf/Noncopyable.h"
 #include "wtf/PassOwnPtr.h"
 
diff --git a/Source/core/rendering/VerticalPositionCache.h b/Source/core/rendering/VerticalPositionCache.h
index 9b65ed9..4ae17b4 100644
--- a/Source/core/rendering/VerticalPositionCache.h
+++ b/Source/core/rendering/VerticalPositionCache.h
@@ -26,7 +26,7 @@
 #ifndef VerticalPositionCache_h
 #define VerticalPositionCache_h
 
-#include "core/platform/graphics/FontBaseline.h"
+#include "platform/fonts/FontBaseline.h"
 #include "wtf/HashMap.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/animation/WebAnimationProvider.cpp b/Source/core/rendering/animation/WebAnimationProvider.cpp
index 79a5ccb..5532f77 100644
--- a/Source/core/rendering/animation/WebAnimationProvider.cpp
+++ b/Source/core/rendering/animation/WebAnimationProvider.cpp
@@ -58,9 +58,10 @@
     case CSSPropertyOpacity:
         return AnimatedPropertyOpacity;
     case CSSPropertyBackgroundColor:
+        ASSERT_NOT_REACHED();
         return AnimatedPropertyInvalid; // Chromium compositor cannot accelerate background color yet.
     case CSSPropertyWebkitFilter:
-        return AnimatedPropertyInvalid; // Chromium compositor cannot accelerate filter yet.
+        return AnimatedPropertyWebkitFilter;
     default:
         // It's fine if we see other css properties here; they are just not accelerated.
         break;
@@ -111,8 +112,7 @@
 int WebAnimationProvider::getWebAnimationId(CSSPropertyID property) const
 {
     AnimatedPropertyID animatedProperty = cssToGraphicsLayerProperty(property);
-    if (animatedProperty == AnimatedPropertyInvalid)
-        return 0;
+    ASSERT(animatedProperty != AnimatedPropertyInvalid);
     return getWebAnimationId(animationNameForTransition(animatedProperty));
 }
 
diff --git a/Source/core/rendering/break_lines.cpp b/Source/core/rendering/break_lines.cpp
index d1ab913..949e1ba 100644
--- a/Source/core/rendering/break_lines.cpp
+++ b/Source/core/rendering/break_lines.cpp
@@ -27,7 +27,7 @@
 #include "config.h"
 #include "core/rendering/break_lines.h"
 
-#include "core/platform/text/TextBreakIterator.h"
+#include "platform/text/TextBreakIterator.h"
 #include "wtf/ASCIICType.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/unicode/CharacterNames.h"
@@ -164,7 +164,7 @@
                 if (i || priorContextLength) {
                     TextBreakIterator* breakIterator = lazyBreakIterator.get(priorContextLength);
                     if (breakIterator) {
-                        nextBreak = textBreakFollowing(breakIterator, i - 1 + priorContextLength);
+                        nextBreak = breakIterator->following(i - 1 + priorContextLength);
                         if (nextBreak >= 0) {
                             nextBreak -= priorContextLength;
                         }
diff --git a/Source/core/rendering/shapes/PolygonShape.cpp b/Source/core/rendering/shapes/PolygonShape.cpp
index 61da7a3..5b155ed 100644
--- a/Source/core/rendering/shapes/PolygonShape.cpp
+++ b/Source/core/rendering/shapes/PolygonShape.cpp
@@ -30,8 +30,8 @@
 #include "config.h"
 #include "core/rendering/shapes/PolygonShape.h"
 
-#include "core/platform/graphics/LayoutPoint.h"
 #include "core/rendering/shapes/ShapeInterval.h"
+#include "platform/geometry/LayoutPoint.h"
 #include "wtf/MathExtras.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/shapes/RasterShape.cpp b/Source/core/rendering/shapes/RasterShape.cpp
index 55f3340..7453836 100644
--- a/Source/core/rendering/shapes/RasterShape.cpp
+++ b/Source/core/rendering/shapes/RasterShape.cpp
@@ -34,6 +34,45 @@
 
 namespace WebCore {
 
+class MarginIntervalGenerator {
+public:
+    MarginIntervalGenerator(unsigned radius);
+    void set(int y, int x1, int x2);
+    IntShapeInterval intervalAt(int y) const;
+
+private:
+    Vector<int> m_xIntercepts;
+    int m_y;
+    int m_x1;
+    int m_x2;
+};
+
+MarginIntervalGenerator::MarginIntervalGenerator(unsigned radius)
+    : m_y(0)
+    , m_x1(0)
+    , m_x2(0)
+{
+    m_xIntercepts.resize(radius + 1);
+    unsigned radiusSquared = radius * radius;
+    for (unsigned y = 0; y <= radius; y++)
+        m_xIntercepts[y] = sqrt(static_cast<double>(radiusSquared - y * y));
+}
+
+void MarginIntervalGenerator::set(int y, int x1, int x2)
+{
+    ASSERT(y >= 0 && x1 >= 0 && x2 > x1);
+    m_y = y;
+    m_x1 = x1;
+    m_x2 = x2;
+}
+
+IntShapeInterval MarginIntervalGenerator::intervalAt(int y) const
+{
+    unsigned xInterceptsIndex = abs(y - m_y);
+    int dx = (xInterceptsIndex >= m_xIntercepts.size()) ? 0 : m_xIntercepts[xInterceptsIndex];
+    return IntShapeInterval(std::max(0, m_x1 - dx), m_x2 + dx);
+}
+
 void RasterShapeIntervals::appendInterval(int y, int x1, int x2)
 {
     ASSERT(y >= 0 && y < size() && x1 >= 0 && x2 > x1 && (m_intervalLists[y].isEmpty() || x1 > m_intervalLists[y].last().x2()));
@@ -42,6 +81,20 @@
     m_intervalLists[y].append(IntShapeInterval(x1, x2));
 }
 
+void RasterShapeIntervals::uniteMarginInterval(int y, const IntShapeInterval& interval)
+{
+    ASSERT(m_intervalLists[y].size() <= 1);
+
+    if (m_intervalLists[y].isEmpty()) {
+        m_intervalLists[y].append(interval);
+    } else {
+        IntShapeInterval& resultInterval = m_intervalLists[y][0];
+        resultInterval.set(std::min(resultInterval.x1(), interval.x1()), std::max(resultInterval.x2(), interval.x2()));
+    }
+
+    m_bounds.unite(IntRect(interval.x1(), y, interval.width(), 1));
+}
+
 static inline bool shapeIntervalsContain(const IntShapeIntervals& intervals, const IntShapeInterval& interval)
 {
     for (unsigned i = 0; i < intervals.size(); i++) {
@@ -166,14 +219,36 @@
     }
 }
 
+PassOwnPtr<RasterShapeIntervals> RasterShapeIntervals::computeShapeMarginIntervals(unsigned margin) const
+{
+    OwnPtr<RasterShapeIntervals> result = adoptPtr(new RasterShapeIntervals(size() + margin));
+    MarginIntervalGenerator intervalGenerator(margin);
+
+    for (int y = bounds().y(); y < bounds().maxY(); ++y) {
+        const IntShapeIntervals& intervalsAtY = getIntervals(y);
+        if (intervalsAtY.isEmpty())
+            continue;
+        int marginY0 = std::max(0, clampToPositiveInteger(y - margin));
+        int marginY1 = std::min(result->size() - 1, clampToPositiveInteger(y + margin));
+        intervalGenerator.set(y, intervalsAtY[0].x1(), intervalsAtY.last().x2());
+        for (int marginY = marginY0; marginY <= marginY1; ++marginY)
+            result->uniteMarginInterval(marginY, intervalGenerator.intervalAt(marginY));
+    }
+
+    return result.release();
+}
+
 const RasterShapeIntervals& RasterShape::marginIntervals() const
 {
     ASSERT(shapeMargin() >= 0);
     if (!shapeMargin())
         return *m_intervals;
 
-    // FIXME: Add support for non-zero margin, see https://bugs.webkit.org/show_bug.cgi?id=116348.
-    return *m_intervals;
+    unsigned marginBoundaryRadius = std::min(clampToUnsigned(ceil(shapeMargin())), std::max<unsigned>(m_imageSize.width(), m_imageSize.height()));
+    if (!m_marginIntervals)
+        m_marginIntervals = m_intervals->computeShapeMarginIntervals(marginBoundaryRadius);
+
+    return *m_marginIntervals;
 }
 
 const RasterShapeIntervals& RasterShape::paddingIntervals() const
diff --git a/Source/core/rendering/shapes/RasterShape.h b/Source/core/rendering/shapes/RasterShape.h
index 492e50d..ff23446 100644
--- a/Source/core/rendering/shapes/RasterShape.h
+++ b/Source/core/rendering/shapes/RasterShape.h
@@ -30,9 +30,9 @@
 #ifndef RasterShape_h
 #define RasterShape_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/rendering/shapes/Shape.h"
 #include "core/rendering/shapes/ShapeInterval.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/Assertions.h"
 #include "wtf/Vector.h"
 
@@ -52,27 +52,31 @@
     void getIncludedIntervals(int y1, int y2, IntShapeIntervals& result) const;
     void getExcludedIntervals(int y1, int y2, IntShapeIntervals& result) const;
     bool firstIncludedIntervalY(int minY, const IntSize& minSize, LayoutUnit& result) const;
+    PassOwnPtr<RasterShapeIntervals> computeShapeMarginIntervals(unsigned margin) const;
 
 private:
     int size() const { return m_intervalLists.size(); }
+
     const IntShapeIntervals& getIntervals(int y) const
     {
         ASSERT(y >= 0 && y < size());
         return m_intervalLists[y];
     }
+
     bool contains(const IntRect&) const;
     bool getIntervalX1Values(int minY, int maxY, int minIntervalWidth, Vector<int>& result) const;
-
+    void uniteMarginInterval(int y, const IntShapeInterval&);
     IntRect m_bounds;
-    Vector<IntShapeIntervals > m_intervalLists;
+    Vector<IntShapeIntervals> m_intervalLists;
 };
 
 class RasterShape : public Shape {
     WTF_MAKE_NONCOPYABLE(RasterShape);
 public:
-    RasterShape(PassOwnPtr<RasterShapeIntervals> intervals)
+    RasterShape(PassOwnPtr<RasterShapeIntervals> intervals, const IntSize& imageSize)
         : Shape()
         , m_intervals(intervals)
+        , m_imageSize(imageSize)
     {
     }
 
@@ -88,6 +92,8 @@
     const RasterShapeIntervals& paddingIntervals() const;
 
     OwnPtr<RasterShapeIntervals> m_intervals;
+    mutable OwnPtr<RasterShapeIntervals> m_marginIntervals;
+    IntSize m_imageSize;
 };
 
 } // namespace WebCore
diff --git a/Source/core/rendering/shapes/RectangleShape.h b/Source/core/rendering/shapes/RectangleShape.h
index cd512d1..6db9921 100644
--- a/Source/core/rendering/shapes/RectangleShape.h
+++ b/Source/core/rendering/shapes/RectangleShape.h
@@ -30,10 +30,10 @@
 #ifndef RectangleShape_h
 #define RectangleShape_h
 
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/rendering/shapes/Shape.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/FloatSize.h"
 #include "wtf/Assertions.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/rendering/shapes/Shape.cpp b/Source/core/rendering/shapes/Shape.cpp
index 0d660ae..2bd3d84 100644
--- a/Source/core/rendering/shapes/Shape.cpp
+++ b/Source/core/rendering/shapes/Shape.cpp
@@ -32,12 +32,12 @@
 
 #include "core/css/LengthFunctions.h"
 #include "core/fetch/ImageResource.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/ImageBuffer.h"
 #include "core/platform/graphics/WindRule.h"
 #include "core/rendering/shapes/PolygonShape.h"
 #include "core/rendering/shapes/RasterShape.h"
 #include "core/rendering/shapes/RectangleShape.h"
+#include "platform/geometry/FloatSize.h"
 #include "wtf/MathExtras.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
@@ -135,7 +135,11 @@
         const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(basicShape);
         float centerX = floatValueForLength(circle->centerX(), boxWidth);
         float centerY = floatValueForLength(circle->centerY(), boxHeight);
-        float radius = floatValueForLength(circle->radius(), std::min(boxHeight, boxWidth));
+        // This method of computing the radius is as defined in SVG
+        // (http://www.w3.org/TR/SVG/coords.html#Units). It bases the radius
+        // off of the diagonal of the box and ensures that if the box is
+        // square, the radius is equal to half the diagonal.
+        float radius = floatValueForLength(circle->radius(), sqrtf((boxWidth * boxWidth + boxHeight * boxHeight) / 2));
         FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, centerY), logicalBoxSize.height(), writingMode);
 
         shape = createCircleShape(logicalCenter, radius);
@@ -236,7 +240,7 @@
         }
     }
 
-    OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(intervals.release()));
+    OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(intervals.release(), imageSize));
     rasterShape->m_writingMode = writingMode;
     rasterShape->m_margin = floatValueForLength(margin, 0);
     rasterShape->m_padding = floatValueForLength(padding, 0);
diff --git a/Source/core/rendering/shapes/Shape.h b/Source/core/rendering/shapes/Shape.h
index b1ea954..790f6da 100644
--- a/Source/core/rendering/shapes/Shape.h
+++ b/Source/core/rendering/shapes/Shape.h
@@ -30,10 +30,10 @@
 #ifndef Shape_h
 #define Shape_h
 
-#include "core/platform/graphics/LayoutRect.h"
-#include "core/platform/text/WritingMode.h"
 #include "core/rendering/style/BasicShapes.h"
 #include "core/rendering/style/StyleImage.h"
+#include "platform/geometry/LayoutRect.h"
+#include "platform/text/WritingMode.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/rendering/shapes/ShapeInfo.cpp b/Source/core/rendering/shapes/ShapeInfo.cpp
index 47699d2..6c74339 100644
--- a/Source/core/rendering/shapes/ShapeInfo.cpp
+++ b/Source/core/rendering/shapes/ShapeInfo.cpp
@@ -44,6 +44,7 @@
     WritingMode writingMode = m_renderer->style()->writingMode();
     Length margin = m_renderer->style()->shapeMargin();
     Length padding = m_renderer->style()->shapePadding();
+    float shapeImageThreshold = m_renderer->style()->shapeImageThreshold();
     const ShapeValue* shapeValue = this->shapeValue();
     ASSERT(shapeValue);
 
@@ -54,7 +55,7 @@
         break;
     case ShapeValue::Image:
         ASSERT(shapeValue->image());
-        m_shape = Shape::createShape(shapeValue->image(), 0, m_shapeLogicalSize, writingMode, margin, padding);
+        m_shape = Shape::createShape(shapeValue->image(), shapeImageThreshold, m_shapeLogicalSize, writingMode, margin, padding);
         break;
     default:
         ASSERT_NOT_REACHED();
@@ -65,23 +66,19 @@
 }
 
 template<class RenderType>
-bool ShapeInfo<RenderType>::computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight)
+SegmentList ShapeInfo<RenderType>::computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) const
 {
     ASSERT(lineHeight >= 0);
-    m_shapeLineTop = lineTop - logicalTopOffset();
-    m_lineHeight = lineHeight;
-    m_segments.clear();
+    SegmentList segments;
 
-    if (lineOverlapsShapeBounds())
-        getIntervals(m_shapeLineTop, std::min(m_lineHeight, shapeLogicalBottom() - lineTop), m_segments);
+    getIntervals((lineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - lineTop), segments);
 
-    LayoutUnit logicalLeftOffset = this->logicalLeftOffset();
-    for (size_t i = 0; i < m_segments.size(); i++) {
-        m_segments[i].logicalLeft += logicalLeftOffset;
-        m_segments[i].logicalRight += logicalLeftOffset;
+    for (size_t i = 0; i < segments.size(); i++) {
+        segments[i].logicalLeft += logicalLeftOffset();
+        segments[i].logicalRight += logicalLeftOffset();
     }
 
-    return m_segments.size();
+    return segments;
 }
 
 template class ShapeInfo<RenderBlock>;
diff --git a/Source/core/rendering/shapes/ShapeInfo.h b/Source/core/rendering/shapes/ShapeInfo.h
index 3468ccc..b79cc59 100644
--- a/Source/core/rendering/shapes/ShapeInfo.h
+++ b/Source/core/rendering/shapes/ShapeInfo.h
@@ -30,11 +30,11 @@
 #ifndef ShapeInfo_h
 #define ShapeInfo_h
 
-#include "core/platform/LayoutUnit.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/rendering/shapes/Shape.h"
 #include "core/rendering/style/RenderStyle.h"
 #include "core/rendering/style/ShapeValue.h"
+#include "platform/LayoutUnit.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/Vector.h"
 
@@ -81,8 +81,7 @@
         m_shapeLogicalSize = newLogicalSize;
     }
 
-    virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight);
-    void clearSegments() { m_segments.clear(); }
+    SegmentList computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) const;
 
     LayoutUnit shapeLogicalTop() const { return computedShapeLogicalBoundingBox().y() + logicalTopOffset(); }
     LayoutUnit shapeLogicalBottom() const { return computedShapeLogicalBoundingBox().maxY() + logicalTopOffset(); }
@@ -115,7 +114,6 @@
 
     LayoutUnit m_shapeLineTop;
     LayoutUnit m_lineHeight;
-    SegmentList m_segments;
 
     const RenderType* m_renderer;
 
diff --git a/Source/core/rendering/shapes/ShapeInsideInfo.cpp b/Source/core/rendering/shapes/ShapeInsideInfo.cpp
index c6e004d..fe8d53b 100644
--- a/Source/core/rendering/shapes/ShapeInsideInfo.cpp
+++ b/Source/core/rendering/shapes/ShapeInsideInfo.cpp
@@ -59,6 +59,30 @@
     return false;
 }
 
+bool ShapeInsideInfo::updateSegmentsForLine(LayoutSize lineOffset, LayoutUnit lineHeight)
+{
+    bool result = updateSegmentsForLine(lineOffset.height(), lineHeight);
+    for (size_t i = 0; i < m_segments.size(); i++) {
+        m_segments[i].logicalLeft -= lineOffset.width();
+        m_segments[i].logicalRight -= lineOffset.width();
+    }
+    return result;
+}
+
+bool ShapeInsideInfo::updateSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight)
+{
+    ASSERT(lineHeight >= 0);
+    m_shapeLineTop = lineTop - logicalTopOffset();
+    m_lineHeight = lineHeight;
+    m_segments.clear();
+    m_segmentRanges.clear();
+
+    if (lineOverlapsShapeBounds())
+        m_segments = computeSegmentsForLine(lineTop, lineHeight);
+
+    return m_segments.size();
+}
+
 bool ShapeInsideInfo::adjustLogicalLineTop(float minSegmentWidth)
 {
     const Shape* shape = computedShape();
@@ -81,4 +105,16 @@
     return m_renderer->style()->resolvedShapeInside();
 }
 
+LayoutUnit ShapeInsideInfo::computeFirstFitPositionForFloat(const LayoutSize floatSize) const
+{
+    if (!computedShape() || !floatSize.width() || shapeLogicalBottom() < logicalLineTop())
+        return 0;
+
+    LayoutUnit firstFitPosition = 0;
+    if (computedShape()->firstIncludedIntervalLogicalTop(m_shapeLineTop, floatSize, firstFitPosition) && (m_shapeLineTop <= firstFitPosition))
+        return firstFitPosition;
+
+    return 0;
+}
+
 }
diff --git a/Source/core/rendering/shapes/ShapeInsideInfo.h b/Source/core/rendering/shapes/ShapeInsideInfo.h
index a18af4c..4d21306 100644
--- a/Source/core/rendering/shapes/ShapeInsideInfo.h
+++ b/Source/core/rendering/shapes/ShapeInsideInfo.h
@@ -66,21 +66,8 @@
 
     static bool isEnabledFor(const RenderBlock* renderer);
 
-    bool computeSegmentsForLine(LayoutSize lineOffset, LayoutUnit lineHeight)
-    {
-        bool result = computeSegmentsForLine(lineOffset.height(), lineHeight);
-        for (size_t i = 0; i < m_segments.size(); i++) {
-            m_segments[i].logicalLeft -= lineOffset.width();
-            m_segments[i].logicalRight -= lineOffset.width();
-        }
-        return result;
-    }
-
-    virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) OVERRIDE
-    {
-        m_segmentRanges.clear();
-        return ShapeInfo<RenderBlock>::computeSegmentsForLine(lineTop, lineHeight);
-    }
+    bool updateSegmentsForLine(LayoutSize lineOffset, LayoutUnit lineHeight);
+    bool updateSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight);
 
     bool hasSegments() const
     {
@@ -100,7 +87,9 @@
         ASSERT(m_segmentRanges.size() < m_segments.size());
         return &m_segments[m_segmentRanges.size()];
     }
+    void clearSegments() { m_segments.clear(); }
     bool adjustLogicalLineTop(float minSegmentWidth);
+    LayoutUnit computeFirstFitPositionForFloat(const LayoutSize) const;
 
     void setNeedsLayout(bool value) { m_needsLayout = value; }
     bool needsLayout() { return m_needsLayout; }
@@ -127,6 +116,7 @@
 
     SegmentRangeList m_segmentRanges;
     bool m_needsLayout;
+    SegmentList m_segments;
 };
 
 }
diff --git a/Source/core/rendering/shapes/ShapeOutsideInfo.cpp b/Source/core/rendering/shapes/ShapeOutsideInfo.cpp
index 2cff8f8..cfa4218 100644
--- a/Source/core/rendering/shapes/ShapeOutsideInfo.cpp
+++ b/Source/core/rendering/shapes/ShapeOutsideInfo.cpp
@@ -53,27 +53,28 @@
     return false;
 }
 
-bool ShapeOutsideInfo::computeSegmentsForContainingBlockLine(const RenderBlock* containingBlock, const FloatingObject* floatingObject, LayoutUnit lineTop, LayoutUnit lineHeight)
+void ShapeOutsideInfo::updateDeltasForContainingBlockLine(const RenderBlock* containingBlock, const FloatingObject* floatingObject, LayoutUnit lineTop, LayoutUnit lineHeight)
 {
     LayoutUnit shapeTop = floatingObject->logicalTop(containingBlock->isHorizontalWritingMode()) + std::max(LayoutUnit(), containingBlock->marginBeforeForChild(m_renderer));
     LayoutUnit lineTopInShapeCoordinates = lineTop - shapeTop + logicalTopOffset();
-    return computeSegmentsForLine(lineTopInShapeCoordinates, lineHeight);
-}
 
-bool ShapeOutsideInfo::computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight)
-{
-    if (shapeSizeDirty() || m_lineTop != lineTop || m_lineHeight != lineHeight) {
-        if (ShapeInfo<RenderBox>::computeSegmentsForLine(lineTop, lineHeight)) {
-            m_leftSegmentMarginBoxDelta = m_segments[0].logicalLeft + m_renderer->marginStart();
-            m_rightSegmentMarginBoxDelta = m_segments[m_segments.size()-1].logicalRight - m_renderer->logicalWidth() - m_renderer->marginEnd();
-        } else {
-            m_leftSegmentMarginBoxDelta = m_renderer->logicalWidth() + m_renderer->marginStart();
-            m_rightSegmentMarginBoxDelta = -m_renderer->logicalWidth() - m_renderer->marginEnd();
+    if (shapeSizeDirty() || m_lineTop != lineTopInShapeCoordinates || m_lineHeight != lineHeight) {
+        m_lineTop = lineTopInShapeCoordinates;
+        m_shapeLineTop = lineTopInShapeCoordinates - logicalTopOffset();
+        m_lineHeight = lineHeight;
+
+        if (lineOverlapsShapeBounds()) {
+            SegmentList segments = computeSegmentsForLine(lineTopInShapeCoordinates, lineHeight);
+            if (segments.size()) {
+                m_leftMarginBoxDelta = segments.first().logicalLeft + containingBlock->marginStartForChild(m_renderer);
+                m_rightMarginBoxDelta = segments.last().logicalRight - containingBlock->logicalWidthForChild(m_renderer) - containingBlock->marginEndForChild(m_renderer);
+                return;
+            }
         }
-        m_lineTop = lineTop;
-    }
 
-    return m_segments.size();
+        m_leftMarginBoxDelta = containingBlock->logicalWidthForChild(m_renderer) + containingBlock->marginStartForChild(m_renderer);
+        m_rightMarginBoxDelta = -containingBlock->logicalWidthForChild(m_renderer) - containingBlock->marginEndForChild(m_renderer);
+    }
 }
 
 ShapeValue* ShapeOutsideInfo::shapeValue() const
diff --git a/Source/core/rendering/shapes/ShapeOutsideInfo.h b/Source/core/rendering/shapes/ShapeOutsideInfo.h
index d5f50fc..3db3e5d 100644
--- a/Source/core/rendering/shapes/ShapeOutsideInfo.h
+++ b/Source/core/rendering/shapes/ShapeOutsideInfo.h
@@ -30,8 +30,8 @@
 #ifndef ShapeOutsideInfo_h
 #define ShapeOutsideInfo_h
 
-#include "core/platform/graphics/LayoutSize.h"
 #include "core/rendering/shapes/ShapeInfo.h"
+#include "platform/geometry/LayoutSize.h"
 
 namespace WebCore {
 
@@ -41,11 +41,10 @@
 
 class ShapeOutsideInfo FINAL : public ShapeInfo<RenderBox>, public MappedInfo<RenderBox, ShapeOutsideInfo> {
 public:
-    LayoutUnit leftSegmentMarginBoxDelta() const { return m_leftSegmentMarginBoxDelta; }
-    LayoutUnit rightSegmentMarginBoxDelta() const { return m_rightSegmentMarginBoxDelta; }
+    LayoutUnit leftMarginBoxDelta() const { return m_leftMarginBoxDelta; }
+    LayoutUnit rightMarginBoxDelta() const { return m_rightMarginBoxDelta; }
 
-    bool computeSegmentsForContainingBlockLine(const RenderBlock*, const FloatingObject*, LayoutUnit lineTop, LayoutUnit lineHeight);
-    virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) OVERRIDE;
+    void updateDeltasForContainingBlockLine(const RenderBlock*, const FloatingObject*, LayoutUnit lineTop, LayoutUnit lineHeight);
 
     static PassOwnPtr<ShapeOutsideInfo> createInfo(const RenderBox* renderer) { return adoptPtr(new ShapeOutsideInfo(renderer)); }
     static bool isEnabledFor(const RenderBox*);
@@ -67,8 +66,8 @@
 private:
     ShapeOutsideInfo(const RenderBox* renderer) : ShapeInfo<RenderBox>(renderer) { }
 
-    LayoutUnit m_leftSegmentMarginBoxDelta;
-    LayoutUnit m_rightSegmentMarginBoxDelta;
+    LayoutUnit m_leftMarginBoxDelta;
+    LayoutUnit m_rightMarginBoxDelta;
     LayoutUnit m_lineTop;
 };
 
diff --git a/Source/core/rendering/style/BasicShapes.cpp b/Source/core/rendering/style/BasicShapes.cpp
index 559bfe6..070577f 100644
--- a/Source/core/rendering/style/BasicShapes.cpp
+++ b/Source/core/rendering/style/BasicShapes.cpp
@@ -30,9 +30,9 @@
 #include "config.h"
 
 #include "core/css/LengthFunctions.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/Path.h"
 #include "core/rendering/style/BasicShapes.h"
+#include "platform/geometry/FloatRect.h"
 
 namespace WebCore {
 
@@ -73,12 +73,12 @@
 
     const BasicShapeRectangle* o = static_cast<const BasicShapeRectangle*>(other);
     RefPtr<BasicShapeRectangle> result =  BasicShapeRectangle::create();
-    result->setX(m_x.blend(o->x(), progress));
-    result->setY(m_y.blend(o->y(), progress));
-    result->setWidth(m_width.blend(o->width(), progress));
-    result->setHeight(m_height.blend(o->height(), progress));
-    result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
-    result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
+    result->setX(m_x.blend(o->x(), progress, ValueRangeAll));
+    result->setY(m_y.blend(o->y(), progress, ValueRangeAll));
+    result->setWidth(m_width.blend(o->width(), progress, ValueRangeNonNegative));
+    result->setHeight(m_height.blend(o->height(), progress, ValueRangeNonNegative));
+    result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress, ValueRangeNonNegative));
+    result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress, ValueRangeNonNegative));
     return result.release();
 }
 
@@ -103,9 +103,9 @@
 
     const BasicShapeCircle* o = static_cast<const BasicShapeCircle*>(other);
     RefPtr<BasicShapeCircle> result =  BasicShapeCircle::create();
-    result->setCenterX(m_centerX.blend(o->centerX(), progress));
-    result->setCenterY(m_centerY.blend(o->centerY(), progress));
-    result->setRadius(m_radius.blend(o->radius(), progress));
+    result->setCenterX(m_centerX.blend(o->centerX(), progress, ValueRangeAll));
+    result->setCenterY(m_centerY.blend(o->centerY(), progress, ValueRangeAll));
+    result->setRadius(m_radius.blend(o->radius(), progress, ValueRangeNonNegative));
     return result.release();
 }
 
@@ -130,10 +130,10 @@
 
     const BasicShapeEllipse* o = static_cast<const BasicShapeEllipse*>(other);
     RefPtr<BasicShapeEllipse> result =  BasicShapeEllipse::create();
-    result->setCenterX(m_centerX.blend(o->centerX(), progress));
-    result->setCenterY(m_centerY.blend(o->centerY(), progress));
-    result->setRadiusX(m_radiusX.blend(o->radiusX(), progress));
-    result->setRadiusY(m_radiusY.blend(o->radiusY(), progress));
+    result->setCenterX(m_centerX.blend(o->centerX(), progress, ValueRangeAll));
+    result->setCenterY(m_centerY.blend(o->centerY(), progress, ValueRangeAll));
+    result->setRadiusX(m_radiusX.blend(o->radiusX(), progress, ValueRangeNonNegative));
+    result->setRadiusY(m_radiusY.blend(o->radiusY(), progress, ValueRangeNonNegative));
     return result.release();
 }
 
@@ -171,8 +171,8 @@
     result->setWindRule(o->windRule());
 
     for (size_t i = 0; i < length; i = i + 2) {
-        result->appendPoint(m_values.at(i).blend(o->values().at(i), progress),
-            m_values.at(i + 1).blend(o->values().at(i + 1), progress));
+        result->appendPoint(m_values.at(i).blend(o->values().at(i), progress, ValueRangeAll),
+            m_values.at(i + 1).blend(o->values().at(i + 1), progress, ValueRangeAll));
     }
 
     return result.release();
@@ -203,12 +203,12 @@
 
     const BasicShapeInsetRectangle* o = static_cast<const BasicShapeInsetRectangle*>(other);
     RefPtr<BasicShapeInsetRectangle> result =  BasicShapeInsetRectangle::create();
-    result->setTop(m_top.blend(o->top(), progress));
-    result->setRight(m_right.blend(o->right(), progress));
-    result->setBottom(m_bottom.blend(o->bottom(), progress));
-    result->setLeft(m_left.blend(o->left(), progress));
-    result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress));
-    result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress));
+    result->setTop(m_top.blend(o->top(), progress, ValueRangeNonNegative));
+    result->setRight(m_right.blend(o->right(), progress, ValueRangeNonNegative));
+    result->setBottom(m_bottom.blend(o->bottom(), progress, ValueRangeNonNegative));
+    result->setLeft(m_left.blend(o->left(), progress, ValueRangeNonNegative));
+    result->setCornerRadiusX(m_cornerRadiusX.blend(o->cornerRadiusX(), progress, ValueRangeNonNegative));
+    result->setCornerRadiusY(m_cornerRadiusY.blend(o->cornerRadiusY(), progress, ValueRangeNonNegative));
     return result.release();
 }
 }
diff --git a/Source/core/rendering/style/BorderData.h b/Source/core/rendering/style/BorderData.h
index 6c47601..8a9eb71 100644
--- a/Source/core/rendering/style/BorderData.h
+++ b/Source/core/rendering/style/BorderData.h
@@ -26,9 +26,9 @@
 #define BorderData_h
 
 #include "core/platform/LengthSize.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/rendering/style/BorderValue.h"
 #include "core/rendering/style/NinePieceImage.h"
+#include "platform/geometry/IntRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/style/CursorData.h b/Source/core/rendering/style/CursorData.h
index b5ec096..90934a2 100644
--- a/Source/core/rendering/style/CursorData.h
+++ b/Source/core/rendering/style/CursorData.h
@@ -25,8 +25,8 @@
 #ifndef CursorData_h
 #define CursorData_h
 
-#include "core/platform/graphics/IntPoint.h"
 #include "core/rendering/style/StyleImage.h"
+#include "platform/geometry/IntPoint.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/style/NinePieceImage.h b/Source/core/rendering/style/NinePieceImage.h
index d4d10c9..77d636a 100644
--- a/Source/core/rendering/style/NinePieceImage.h
+++ b/Source/core/rendering/style/NinePieceImage.h
@@ -24,10 +24,10 @@
 #ifndef NinePieceImage_h
 #define NinePieceImage_h
 
-#include "core/platform/LayoutUnit.h"
 #include "core/platform/LengthBox.h"
 #include "core/rendering/style/DataRef.h"
 #include "core/rendering/style/StyleImage.h"
+#include "platform/LayoutUnit.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/style/RenderStyle.cpp b/Source/core/rendering/style/RenderStyle.cpp
index ece4c74..2b878b7 100644
--- a/Source/core/rendering/style/RenderStyle.cpp
+++ b/Source/core/rendering/style/RenderStyle.cpp
@@ -496,6 +496,7 @@
             || rareInheritedData->textEmphasisPosition != other->rareInheritedData->textEmphasisPosition
             || rareInheritedData->textEmphasisCustomMark != other->rareInheritedData->textEmphasisCustomMark
             || rareInheritedData->m_textAlignLast != other->rareInheritedData->m_textAlignLast
+            || rareInheritedData->m_textJustify != other->rareInheritedData->m_textJustify
             || rareInheritedData->m_textOrientation != other->rareInheritedData->m_textOrientation
             || rareInheritedData->m_tabSize != other->rareInheritedData->m_tabSize
             || rareInheritedData->m_lineBoxContain != other->rareInheritedData->m_lineBoxContain
@@ -696,7 +697,7 @@
         || rareInheritedData->textStrokeColor != other->rareInheritedData->textStrokeColor
         || rareInheritedData->textEmphasisColor != other->rareInheritedData->textEmphasisColor
         || rareInheritedData->textEmphasisFill != other->rareInheritedData->textEmphasisFill)
-        return StyleDifferenceRepaintIfText;
+        return StyleDifferenceRepaintIfTextOrColorChange;
 
     // Cursors are not checked, since they will be set appropriately in response to mouse events,
     // so they don't need to cause any repaint or layout.
@@ -740,6 +741,12 @@
         rareInheritedData.access()->cursorData = 0;
 }
 
+void RenderStyle::addCallbackSelector(const String& selector)
+{
+    if (!rareNonInheritedData->m_callbackSelectors.contains(selector))
+        rareNonInheritedData.access()->m_callbackSelectors.append(selector);
+}
+
 void RenderStyle::clearContent()
 {
     if (rareNonInheritedData->m_content)
diff --git a/Source/core/rendering/style/RenderStyle.h b/Source/core/rendering/style/RenderStyle.h
index ce0e752..5e9e7d3 100644
--- a/Source/core/rendering/style/RenderStyle.h
+++ b/Source/core/rendering/style/RenderStyle.h
@@ -35,14 +35,9 @@
 #include "core/platform/ThemeTypes.h"
 #include "core/platform/animation/CSSAnimationDataList.h"
 #include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/FontBaseline.h"
 #include "core/platform/graphics/FontDescription.h"
 #include "core/platform/graphics/GraphicsTypes.h"
-#include "core/platform/graphics/LayoutBoxExtent.h"
-#include "core/platform/graphics/RoundedRect.h"
 #include "core/platform/graphics/transforms/TransformOperations.h"
-#include "core/platform/text/TextDirection.h"
-#include "core/platform/text/UnicodeBidi.h"
 #include "core/rendering/style/BorderValue.h"
 #include "core/rendering/style/CounterDirectives.h"
 #include "core/rendering/style/DataRef.h"
@@ -69,6 +64,11 @@
 #include "core/rendering/style/StyleTransformData.h"
 #include "core/rendering/style/StyleVisualData.h"
 #include "core/svg/SVGPaint.h"
+#include "platform/fonts/FontBaseline.h"
+#include "platform/geometry/LayoutBoxExtent.h"
+#include "platform/geometry/RoundedRect.h"
+#include "platform/text/TextDirection.h"
+#include "platform/text/UnicodeBidi.h"
 #include "wtf/Forward.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/RefCounted.h"
@@ -543,6 +543,7 @@
     TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(rareInheritedData->m_textIndentLine); }
     ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
     TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); }
+    TextJustify textJustify() const { return static_cast<TextJustify>(rareInheritedData->m_textJustify); }
     ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
     TextDecoration textDecorationsInEffect() const { return static_cast<TextDecoration>(inherited_flags._text_decorations); }
     TextDecoration textDecoration() const { return static_cast<TextDecoration>(visual->textDecoration); }
@@ -728,6 +729,7 @@
     EBoxPack boxPack() const { return static_cast<EBoxPack>(rareNonInheritedData->m_deprecatedFlexibleBox->pack); }
 
     int order() const { return rareNonInheritedData->m_order; }
+    const Vector<String>& callbackSelectors() const { return rareNonInheritedData->m_callbackSelectors; }
     float flexGrow() const { return rareNonInheritedData->m_flexibleBox->m_flexGrow; }
     float flexShrink() const { return rareNonInheritedData->m_flexibleBox->m_flexShrink; }
     Length flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
@@ -800,6 +802,7 @@
     bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
     bool specifiesAutoColumns() const { return hasAutoColumnCount() && hasAutoColumnWidth(); }
     bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth() || !hasInlineColumnAxis(); }
+    ColumnFill columnFill() const { return static_cast<ColumnFill>(rareNonInheritedData->m_multiCol->m_fill); }
     float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
     bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
     EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
@@ -849,6 +852,7 @@
     // End CSS3 Getters
 
     const AtomicString& flowThread() const { return rareNonInheritedData->m_flowThread; }
+    bool hasFlowFrom() const { return !rareNonInheritedData->m_regionThread.isNull(); }
     const AtomicString& regionThread() const { return rareNonInheritedData->m_regionThread; }
     RegionFragment regionFragment() const { return static_cast<RegionFragment>(rareNonInheritedData->m_regionFragment); }
 
@@ -1056,6 +1060,7 @@
     void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_textIndentLine, v); }
     void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
     void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); }
+    void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustify, v); }
     void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
     void addToTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_decorations |= v; }
     void setTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_decorations = v; }
@@ -1188,6 +1193,7 @@
     void setFlexShrink(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexShrink, f); }
     void setFlexBasis(Length length) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexBasis, length); }
     void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, o); }
+    void addCallbackSelector(const String& selector);
     void setAlignContent(EAlignContent p) { SET_VAR(rareNonInheritedData, m_alignContent, p); }
     void setAlignItems(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignItems, a); }
     void setAlignSelf(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); }
@@ -1238,6 +1244,7 @@
     void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); }
     void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); }
     void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
+    void setColumnFill(ColumnFill columnFill) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_fill, columnFill); }
     void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
     void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
     void setColumnRuleColor(const Color& c) { SET_BORDERVALUE_COLOR(rareNonInheritedData.access()->m_multiCol, m_rule, c); }
@@ -1403,6 +1410,14 @@
     void setShapeMargin(Length shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, shapeMargin); }
     static Length initialShapeMargin() { return Length(0, Fixed); }
 
+    float shapeImageThreshold() const { return rareNonInheritedData->m_shapeImageThreshold; }
+    void setShapeImageThreshold(float shapeImageThreshold)
+    {
+        float clampedShapeImageThreshold = clampTo<float>(shapeImageThreshold, 0, 1);
+        SET_VAR(rareNonInheritedData, m_shapeImageThreshold, clampedShapeImageThreshold);
+    }
+    static float initialShapeImageThreshold() { return 0; }
+
     bool hasContent() const { return contentData(); }
     const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); }
     bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->rareNonInheritedData); }
@@ -1517,6 +1532,7 @@
     static Length initialLineHeight() { return Length(-100.0, Percent); }
     static ETextAlign initialTextAlign() { return TASTART; }
     static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
+    static TextJustify initialTextJustify() { return TextJustifyAuto; }
     static TextDecoration initialTextDecoration() { return TextDecorationNone; }
 #if ENABLE(CSS3_TEXT)
     static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
@@ -1573,6 +1589,7 @@
     static Order initialRTLOrdering() { return LogicalOrder; }
     static float initialTextStrokeWidth() { return 0; }
     static unsigned short initialColumnCount() { return 1; }
+    static ColumnFill initialColumnFill() { return ColumnFillBalance; }
     static ColumnSpan initialColumnSpan() { return ColumnSpanNone; }
     static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
     static Length initialTransformOriginX() { return Length(50.0, Percent); }
diff --git a/Source/core/rendering/style/RenderStyleConstants.h b/Source/core/rendering/style/RenderStyleConstants.h
index 59c4ab8..6e5d9a0 100644
--- a/Source/core/rendering/style/RenderStyleConstants.h
+++ b/Source/core/rendering/style/RenderStyleConstants.h
@@ -46,7 +46,7 @@
 // (1) StyleDifferenceEqual - The two styles are identical.
 // (2) StyleDifferenceRecompositeLayer - The layer needs its position and transform updated, but no repaint.
 // (3) StyleDifferenceRepaint - The object just needs to be repainted.
-// (4) StyleDifferenceRepaintIfText - The object needs to be repainted if it contains text.
+// (4) StyleDifferenceRepaintIfTextOrColorChange - The object needs to be repainted if it contains text or properties dependent on color (e.g., border or outline).
 // (5) StyleDifferenceRepaintLayer - The layer and its descendant layers needs to be repainted.
 // (6) StyleDifferenceLayoutPositionedMovementOnly - Only the position of this positioned object has been updated.
 // (7) StyleDifferenceSimplifiedLayout - Only overflow needs to be recomputed.
@@ -56,7 +56,7 @@
     StyleDifferenceEqual,
     StyleDifferenceRecompositeLayer,
     StyleDifferenceRepaint,
-    StyleDifferenceRepaintIfText,
+    StyleDifferenceRepaintIfTextOrColorChange,
     StyleDifferenceRepaintLayer,
     StyleDifferenceLayoutPositionedMovementOnly,
     StyleDifferenceSimplifiedLayout,
@@ -90,6 +90,8 @@
     PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1)
 };
 
+enum ColumnFill { ColumnFillBalance, ColumnFillAuto };
+
 enum ColumnSpan { ColumnSpanNone = 0, ColumnSpanAll };
 
 enum EBorderCollapse { BSEPARATE = 0, BCOLLAPSE = 1 };
@@ -371,6 +373,10 @@
     TextAlignLastAuto, TextAlignLastStart, TextAlignLastEnd, TextAlignLastLeft, TextAlignLastRight, TextAlignLastCenter, TextAlignLastJustify
 };
 
+enum TextJustify {
+    TextJustifyAuto, TextJustifyNone, TextJustifyInterWord, TextJustifyDistribute
+};
+
 #if ENABLE(CSS3_TEXT)
 enum TextUnderlinePosition {
     // FIXME: Implement support for 'under left' and 'under right' values.
diff --git a/Source/core/rendering/style/ShadowData.cpp b/Source/core/rendering/style/ShadowData.cpp
index 52e391b..391d713 100644
--- a/Source/core/rendering/style/ShadowData.cpp
+++ b/Source/core/rendering/style/ShadowData.cpp
@@ -22,7 +22,7 @@
 #include "config.h"
 #include "core/rendering/style/ShadowData.h"
 
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/LayoutRect.h"
 
 using namespace std;
 
diff --git a/Source/core/rendering/style/ShadowData.h b/Source/core/rendering/style/ShadowData.h
index 86377c2..cb82aa5 100644
--- a/Source/core/rendering/style/ShadowData.h
+++ b/Source/core/rendering/style/ShadowData.h
@@ -26,8 +26,8 @@
 #define ShadowData_h
 
 #include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/LayoutRect.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
 
diff --git a/Source/core/rendering/style/StyleFetchedImageSet.h b/Source/core/rendering/style/StyleFetchedImageSet.h
index 178ec3c..c618047 100644
--- a/Source/core/rendering/style/StyleFetchedImageSet.h
+++ b/Source/core/rendering/style/StyleFetchedImageSet.h
@@ -28,8 +28,8 @@
 
 #include "core/fetch/ImageResourceClient.h"
 #include "core/fetch/ResourcePtr.h"
-#include "core/platform/graphics/LayoutSize.h"
 #include "core/rendering/style/StyleImage.h"
+#include "platform/geometry/LayoutSize.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/style/StyleImage.h b/Source/core/rendering/style/StyleImage.h
index e440c22..27bd826 100644
--- a/Source/core/rendering/style/StyleImage.h
+++ b/Source/core/rendering/style/StyleImage.h
@@ -26,8 +26,8 @@
 
 #include "core/css/CSSValue.h"
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/IntSize.h"
-#include "core/platform/graphics/LayoutSize.h"
+#include "platform/geometry/IntSize.h"
+#include "platform/geometry/LayoutSize.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/rendering/style/StyleMultiColData.cpp b/Source/core/rendering/style/StyleMultiColData.cpp
index 9a4eb5f..90897bb 100644
--- a/Source/core/rendering/style/StyleMultiColData.cpp
+++ b/Source/core/rendering/style/StyleMultiColData.cpp
@@ -33,6 +33,7 @@
     , m_autoWidth(true)
     , m_autoCount(true)
     , m_normalGap(true)
+    , m_fill(RenderStyle::initialColumnFill())
     , m_columnSpan(false)
     , m_breakBefore(RenderStyle::initialPageBreak())
     , m_breakAfter(RenderStyle::initialPageBreak())
@@ -52,6 +53,7 @@
     , m_autoWidth(o.m_autoWidth)
     , m_autoCount(o.m_autoCount)
     , m_normalGap(o.m_normalGap)
+    , m_fill(o.m_fill)
     , m_columnSpan(o.m_columnSpan)
     , m_breakBefore(o.m_breakBefore)
     , m_breakAfter(o.m_breakAfter)
@@ -64,10 +66,11 @@
 bool StyleMultiColData::operator==(const StyleMultiColData& o) const
 {
     return m_width == o.m_width && m_count == o.m_count && m_gap == o.m_gap
-           && m_rule == o.m_rule && m_visitedLinkColumnRuleColor == o.m_visitedLinkColumnRuleColor && m_breakBefore == o.m_breakBefore
-           && m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap
-           && m_columnSpan == o.m_columnSpan && m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside && m_axis == o.m_axis
-           && m_progression == o.m_progression;
+        && m_rule == o.m_rule && m_visitedLinkColumnRuleColor == o.m_visitedLinkColumnRuleColor && m_breakBefore == o.m_breakBefore
+        && m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap
+        && m_fill == o.m_fill && m_columnSpan == o.m_columnSpan
+        && m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside
+        && m_axis == o.m_axis && m_progression == o.m_progression;
 }
 
 } // namespace WebCore
diff --git a/Source/core/rendering/style/StyleMultiColData.h b/Source/core/rendering/style/StyleMultiColData.h
index dcd1478..f1516c2 100644
--- a/Source/core/rendering/style/StyleMultiColData.h
+++ b/Source/core/rendering/style/StyleMultiColData.h
@@ -62,6 +62,7 @@
     bool m_autoWidth : 1;
     bool m_autoCount : 1;
     bool m_normalGap : 1;
+    unsigned m_fill : 1; // ColumnFill
     unsigned m_columnSpan : 1;
     unsigned m_breakBefore : 2; // EPageBreak
     unsigned m_breakAfter : 2; // EPageBreak
diff --git a/Source/core/rendering/style/StylePendingImage.h b/Source/core/rendering/style/StylePendingImage.h
index dd5acc7..f9a00bc 100644
--- a/Source/core/rendering/style/StylePendingImage.h
+++ b/Source/core/rendering/style/StylePendingImage.h
@@ -47,8 +47,8 @@
 
     virtual PassRefPtr<CSSValue> cssValue() const { return m_value; }
     CSSImageValue* cssImageValue() const { return m_value->isImageValue() ? toCSSImageValue(m_value) : 0; }
-    CSSImageGeneratorValue* cssImageGeneratorValue() const { return m_value->isImageGeneratorValue() ? static_cast<CSSImageGeneratorValue*>(m_value) : 0; }
-    CSSCursorImageValue* cssCursorImageValue() const { return m_value->isCursorImageValue() ? static_cast<CSSCursorImageValue*>(m_value) : 0; }
+    CSSImageGeneratorValue* cssImageGeneratorValue() const { return m_value->isImageGeneratorValue() ? toCSSImageGeneratorValue(m_value) : 0; }
+    CSSCursorImageValue* cssCursorImageValue() const { return m_value->isCursorImageValue() ? toCSSCursorImageValue(m_value) : 0; }
     CSSImageSetValue* cssImageSetValue() const { return m_value->isImageSetValue() ? toCSSImageSetValue(m_value) : 0; }
 
     virtual LayoutSize imageSize(const RenderObject*, float /*multiplier*/) const OVERRIDE { return LayoutSize(); }
diff --git a/Source/core/rendering/style/StyleRareInheritedData.cpp b/Source/core/rendering/style/StyleRareInheritedData.cpp
index 3ca9ff2..5cc3386 100644
--- a/Source/core/rendering/style/StyleRareInheritedData.cpp
+++ b/Source/core/rendering/style/StyleRareInheritedData.cpp
@@ -75,6 +75,7 @@
     , textEmphasisMark(TextEmphasisMarkNone)
     , textEmphasisPosition(TextEmphasisPositionOver)
     , m_textAlignLast(RenderStyle::initialTextAlignLast())
+    , m_textJustify(RenderStyle::initialTextJustify())
     , m_textOrientation(TextOrientationVerticalRight)
     , m_textIndentLine(RenderStyle::initialTextIndentLine())
     , m_lineBoxContain(RenderStyle::initialLineBoxContain())
@@ -127,6 +128,7 @@
     , textEmphasisMark(o.textEmphasisMark)
     , textEmphasisPosition(o.textEmphasisPosition)
     , m_textAlignLast(o.m_textAlignLast)
+    , m_textJustify(o.m_textJustify)
     , m_textOrientation(o.m_textOrientation)
     , m_textIndentLine(o.m_textIndentLine)
     , m_lineBoxContain(o.m_lineBoxContain)
@@ -198,6 +200,7 @@
         && textEmphasisMark == o.textEmphasisMark
         && textEmphasisPosition == o.textEmphasisPosition
         && m_textAlignLast == o.m_textAlignLast
+        && m_textJustify == o.m_textJustify
         && m_textOrientation == o.m_textOrientation
         && m_textIndentLine == o.m_textIndentLine
         && m_lineBoxContain == o.m_lineBoxContain
diff --git a/Source/core/rendering/style/StyleRareInheritedData.h b/Source/core/rendering/style/StyleRareInheritedData.h
index 2e0bbb5..827da8b 100644
--- a/Source/core/rendering/style/StyleRareInheritedData.h
+++ b/Source/core/rendering/style/StyleRareInheritedData.h
@@ -94,6 +94,7 @@
     unsigned textEmphasisMark : 3; // TextEmphasisMark
     unsigned textEmphasisPosition : 1; // TextEmphasisPosition
     unsigned m_textAlignLast : 3; // TextAlignLast
+    unsigned m_textJustify : 2; // TextJustify
     unsigned m_textOrientation : 2; // TextOrientation
     unsigned m_textIndentLine : 1; // TextIndentEachLine
     unsigned m_lineBoxContain: 7; // LineBoxContain
diff --git a/Source/core/rendering/style/StyleRareNonInheritedData.cpp b/Source/core/rendering/style/StyleRareNonInheritedData.cpp
index 5428546..c97f2f9 100644
--- a/Source/core/rendering/style/StyleRareNonInheritedData.cpp
+++ b/Source/core/rendering/style/StyleRareNonInheritedData.cpp
@@ -45,6 +45,7 @@
     , m_shapeOutside(RenderStyle::initialShapeOutside())
     , m_shapeMargin(RenderStyle::initialShapeMargin())
     , m_shapePadding(RenderStyle::initialShapePadding())
+    , m_shapeImageThreshold(RenderStyle::initialShapeImageThreshold())
     , m_clipPath(RenderStyle::initialClipPath())
     , m_visitedLinkBackgroundColor(RenderStyle::initialBackgroundColor())
     , m_order(RenderStyle::initialOrder())
@@ -113,6 +114,7 @@
     , m_shapeOutside(o.m_shapeOutside)
     , m_shapeMargin(o.m_shapeMargin)
     , m_shapePadding(o.m_shapePadding)
+    , m_shapeImageThreshold(o.m_shapeImageThreshold)
     , m_clipPath(o.m_clipPath)
     , m_textDecorationColor(o.m_textDecorationColor)
     , m_visitedLinkTextDecorationColor(o.m_visitedLinkTextDecorationColor)
@@ -191,6 +193,7 @@
         && m_shapeOutside == o.m_shapeOutside
         && m_shapeMargin == o.m_shapeMargin
         && m_shapePadding == o.m_shapePadding
+        && m_shapeImageThreshold == o.m_shapeImageThreshold
         && m_clipPath == o.m_clipPath
         && m_textDecorationColor == o.m_textDecorationColor
         && m_visitedLinkTextDecorationColor == o.m_visitedLinkTextDecorationColor
@@ -202,6 +205,7 @@
         && m_visitedLinkBorderBottomColor == o.m_visitedLinkBorderBottomColor
         && m_order == o.m_order
         && m_objectPosition == o.m_objectPosition
+        && m_callbackSelectors == o.m_callbackSelectors
         && m_flowThread == o.m_flowThread
         && m_regionThread == o.m_regionThread
         && m_regionFragment == o.m_regionFragment
diff --git a/Source/core/rendering/style/StyleRareNonInheritedData.h b/Source/core/rendering/style/StyleRareNonInheritedData.h
index eadba19..4d555be 100644
--- a/Source/core/rendering/style/StyleRareNonInheritedData.h
+++ b/Source/core/rendering/style/StyleRareNonInheritedData.h
@@ -130,6 +130,7 @@
     RefPtr<ShapeValue> m_shapeOutside;
     Length m_shapeMargin;
     Length m_shapePadding;
+    float m_shapeImageThreshold;
 
     RefPtr<ClipPathOperation> m_clipPath;
 
@@ -146,6 +147,8 @@
 
     LengthPoint m_objectPosition;
 
+    Vector<String> m_callbackSelectors;
+
     AtomicString m_flowThread;
     AtomicString m_regionThread;
     unsigned m_regionFragment : 1; // RegionFragment
diff --git a/Source/core/rendering/svg/RenderSVGResource.cpp b/Source/core/rendering/svg/RenderSVGResource.cpp
index ea7931a..1b10f72 100644
--- a/Source/core/rendering/svg/RenderSVGResource.cpp
+++ b/Source/core/rendering/svg/RenderSVGResource.cpp
@@ -24,8 +24,8 @@
 
 #include "core/rendering/svg/RenderSVGResource.h"
 
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/svg/RenderSVGResourceClipper.h"
 #include "core/rendering/svg/RenderSVGResourceFilter.h"
 #include "core/rendering/svg/RenderSVGResourceMasker.h"
diff --git a/Source/core/rendering/svg/RenderSVGResourceClipper.cpp b/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
index 588a6a6..eaf1d81 100644
--- a/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceClipper.cpp
@@ -26,8 +26,8 @@
 
 #include "RuntimeEnabledFeatures.h"
 #include "SVGNames.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/rendering/HitTestResult.h"
 #include "core/rendering/svg/SVGRenderingContext.h"
@@ -53,24 +53,28 @@
 void RenderSVGResourceClipper::removeAllClientsFromCache(bool markForInvalidation)
 {
     m_clipBoundaries = FloatRect();
-    m_rendererToClipperMap.clear();
     markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInvalidation : ParentOnlyInvalidation);
 }
 
 void RenderSVGResourceClipper::removeClientFromCache(RenderObject* client, bool markForInvalidation)
 {
     ASSERT(client);
-    m_rendererToClipperMap.remove(client);
     markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
 }
 
-bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceClipper::applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short)
+{
+    // Clippers are always applied using stateful methods.
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+bool RenderSVGResourceClipper::applyStatefulResource(RenderObject* object, GraphicsContext*& context, ClipperContext& clipperContext)
 {
     ASSERT(object);
     ASSERT(context);
-    ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
 
-    return applyClippingToContext(object, object->objectBoundingBox(), object->repaintRectInLocalCoordinates(), context);
+    return applyClippingToContext(object, object->objectBoundingBox(), object->repaintRectInLocalCoordinates(), context, clipperContext);
 }
 
 bool RenderSVGResourceClipper::tryPathOnlyClipping(GraphicsContext* context,
@@ -137,30 +141,26 @@
 }
 
 bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* target, const FloatRect& targetBoundingBox,
-                                                      const FloatRect& repaintRect, GraphicsContext* context)
+    const FloatRect& repaintRect, GraphicsContext* context, ClipperContext& clipperContext)
 {
     ASSERT(target);
     ASSERT(context);
+    ASSERT(clipperContext.state == ClipperContext::NotAppliedState);
     ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout());
 
     if (repaintRect.isEmpty() || m_inClipExpansion)
         return false;
     TemporaryChange<bool> inClipExpansionChange(m_inClipExpansion, true);
 
-    // add(obj, 0) idiom -> lookup & add if not found.
-    OwnPtr<ClipperData>& clipperData = m_rendererToClipperMap.add(target, nullptr).iterator->value;
-    if (!clipperData)
-        clipperData = adoptPtr(new ClipperData);
-
     // First, try to apply the clip as a clipPath.
     AffineTransform animatedLocalTransform = toSVGClipPathElement(element())->animatedLocalTransform();
     if (tryPathOnlyClipping(context, animatedLocalTransform, targetBoundingBox)) {
-        clipperData->clipMode = ClipperData::PathOnlyClipMode;
+        clipperContext.state = ClipperContext::AppliedPathState;
         return true;
     }
 
     // Fall back to masking.
-    clipperData->clipMode = ClipperData::MaskClipMode;
+    clipperContext.state = ClipperContext::AppliedMaskState;
 
     // Mask layer start
     context->beginTransparencyLayer(1, &repaintRect);
@@ -171,8 +171,9 @@
         // clipPath can also be clipped by another clipPath.
         SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this);
         RenderSVGResourceClipper* clipPathClipper = 0;
+        ClipperContext clipPathClipperContext;
         if (resources && (clipPathClipper = resources->clipper())) {
-            if (!clipPathClipper->applyClippingToContext(this, targetBoundingBox, repaintRect, context)) {
+            if (!clipPathClipper->applyClippingToContext(this, targetBoundingBox, repaintRect, context, clipPathClipperContext)) {
                 // FIXME: Awkward state micro-management. Ideally, GraphicsContextStateSaver should
                 //   a) pop saveLayers also
                 //   b) pop multiple states if needed (similarly to SkCanvas::restoreToCount())
@@ -186,30 +187,36 @@
         drawMaskContent(context, targetBoundingBox);
 
         if (clipPathClipper)
-            clipPathClipper->postApplyResource(this, context, ApplyToDefaultMode, 0, 0);
+            clipPathClipper->postApplyStatefulResource(this, context, clipPathClipperContext);
     }
 
     // Masked content layer start.
-    context->beginMaskedLayer(repaintRect);
+    context->beginLayer(1, CompositeSourceIn, &repaintRect);
 
     return true;
 }
 
-void RenderSVGResourceClipper::postApplyResource(RenderObject* object, GraphicsContext*& context,
-    unsigned short resourceMode, const Path*, const RenderSVGShape*) {
-    ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
+void RenderSVGResourceClipper::postApplyResource(RenderObject*, GraphicsContext*&, unsigned short,
+    const Path*, const RenderSVGShape*) {
+    // Clippers are always applied using stateful methods.
+    ASSERT_NOT_REACHED();
+}
 
-    ClipperData* clipperData = m_rendererToClipperMap.get(object);
-    ASSERT(clipperData);
-
-    // Path-only clipping, no layers to restore.
-    if (clipperData->clipMode == ClipperData::PathOnlyClipMode)
-        return;
-
-    // Transfer content layer -> mask layer (SrcIn)
-    context->endLayer();
-    // Transfer mask layer -> bg layer (SrcOver)
-    context->endLayer();
+void RenderSVGResourceClipper::postApplyStatefulResource(RenderObject*, GraphicsContext*& context, ClipperContext& clipperContext)
+{
+    switch (clipperContext.state) {
+    case ClipperContext::AppliedPathState:
+        // Path-only clipping, no layers to restore.
+        break;
+    case ClipperContext::AppliedMaskState:
+        // Transfer content layer -> mask layer (SrcIn)
+        context->endLayer();
+        // Transfer mask layer -> bg layer (SrcOver)
+        context->endLayer();
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
 }
 
 void RenderSVGResourceClipper::drawMaskContent(GraphicsContext* context, const FloatRect& targetBoundingBox)
diff --git a/Source/core/rendering/svg/RenderSVGResourceClipper.h b/Source/core/rendering/svg/RenderSVGResourceClipper.h
index 9838d28..839583c 100644
--- a/Source/core/rendering/svg/RenderSVGResourceClipper.h
+++ b/Source/core/rendering/svg/RenderSVGResourceClipper.h
@@ -25,14 +25,17 @@
 
 namespace WebCore {
 
-struct ClipperData {
+struct ClipperContext {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    enum ClipMode { PathOnlyClipMode, MaskClipMode };
+    enum ClipperState { NotAppliedState, AppliedPathState, AppliedMaskState };
 
-    // We should eventually cache the combined clip path here, when switching to path ops clipping.
-    // For now we only cache a marker to let postApply know whether it needs to perform any work.
-    ClipMode clipMode;
+    ClipperContext()
+        : state(NotAppliedState)
+    {
+    }
+
+    ClipperState state;
 };
 
 class RenderSVGResourceClipper FINAL : public RenderSVGResourceContainer {
@@ -45,12 +48,19 @@
     virtual void removeAllClientsFromCache(bool markForInvalidation = true);
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
-    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) OVERRIDE;
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short, const Path*, const RenderSVGShape*) OVERRIDE;
+    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) OVERRIDE FINAL;
+    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short, const Path*, const RenderSVGShape*) OVERRIDE FINAL;
+
+    // FIXME: Filters are also stateful resources that could benefit from having their state managed
+    //        on the caller stack instead of the current hashmap. We should look at refactoring these
+    //        into a general interface that can be shared.
+    bool applyStatefulResource(RenderObject*, GraphicsContext*&, ClipperContext&);
+    void postApplyStatefulResource(RenderObject*, GraphicsContext*&, ClipperContext&);
+
     // clipPath can be clipped too, but don't have a boundingBox or repaintRect. So we can't call
     // applyResource directly and use the rects from the object, since they are empty for RenderSVGResources
     // FIXME: We made applyClippingToContext public because we cannot call applyResource on HTML elements (it asserts on RenderObject::objectBoundingBox)
-    bool applyClippingToContext(RenderObject*, const FloatRect&, const FloatRect&, GraphicsContext*);
+    bool applyClippingToContext(RenderObject*, const FloatRect&, const FloatRect&, GraphicsContext*, ClipperContext&);
 
     virtual FloatRect resourceBoundingBox(RenderObject*);
 
@@ -67,7 +77,6 @@
     void calculateClipContentRepaintRect();
 
     FloatRect m_clipBoundaries;
-    HashMap<const RenderObject*, OwnPtr<ClipperData> > m_rendererToClipperMap;
 
     // Reference cycle detection.
     bool m_inClipExpansion;
diff --git a/Source/core/rendering/svg/RenderSVGResourceContainer.cpp b/Source/core/rendering/svg/RenderSVGResourceContainer.cpp
index 575266e..78966fe 100644
--- a/Source/core/rendering/svg/RenderSVGResourceContainer.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceContainer.cpp
@@ -23,11 +23,12 @@
 
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderView.h"
-#include "core/rendering/svg/RenderSVGRoot.h"
 #include "core/rendering/svg/SVGRenderingContext.h"
 #include "core/rendering/svg/SVGResourcesCache.h"
 #include "core/svg/SVGGraphicsElement.h"
 
+#include "wtf/TemporaryChange.h"
+
 namespace WebCore {
 
 static inline SVGDocumentExtensions* svgExtensionsFromElement(SVGElement* element)
@@ -41,6 +42,7 @@
     , m_id(node->getIdAttribute())
     , m_registered(false)
     , m_isInvalidating(false)
+    , m_isInLayout(false)
 {
 }
 
@@ -52,9 +54,15 @@
 
 void RenderSVGResourceContainer::layout()
 {
+    ASSERT(needsLayout());
+    if (m_isInLayout)
+        return;
+
+    TemporaryChange<bool> inLayoutChange(m_isInLayout, true);
+
     // Invalidate all resources if our layout changed.
     if (everHadLayout() && selfNeedsLayout())
-        RenderSVGRoot::addResourceForClientInvalidation(this);
+        removeAllClientsFromCache();
 
     RenderSVGHiddenContainer::layout();
 }
diff --git a/Source/core/rendering/svg/RenderSVGResourceContainer.h b/Source/core/rendering/svg/RenderSVGResourceContainer.h
index efb5c18..9489a6f 100644
--- a/Source/core/rendering/svg/RenderSVGResourceContainer.h
+++ b/Source/core/rendering/svg/RenderSVGResourceContainer.h
@@ -60,12 +60,13 @@
     void markAllClientLayersForInvalidation();
     void markClientForInvalidation(RenderObject*, InvalidationMode);
 
+    bool m_isInLayout;
+
 private:
     friend class SVGResourcesCache;
     void addClient(RenderObject*);
     void removeClient(RenderObject*);
 
-private:
     virtual void willBeDestroyed() OVERRIDE FINAL;
     void registerResource();
 
diff --git a/Source/core/rendering/svg/RenderSVGResourceFilter.cpp b/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
index 09494b3..ba38c68 100644
--- a/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceFilter.cpp
@@ -25,7 +25,6 @@
 
 #include "core/rendering/svg/RenderSVGResourceFilter.h"
 
-#include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/graphics/filters/SourceAlpha.h"
 #include "core/platform/graphics/filters/SourceGraphic.h"
@@ -46,20 +45,12 @@
 
 RenderSVGResourceFilter::~RenderSVGResourceFilter()
 {
-    if (m_filter.isEmpty())
-        return;
-
-    deleteAllValues(m_filter);
     m_filter.clear();
 }
 
 void RenderSVGResourceFilter::removeAllClientsFromCache(bool markForInvalidation)
 {
-    if (!m_filter.isEmpty()) {
-        deleteAllValues(m_filter);
-        m_filter.clear();
-    }
-
+    m_filter.clear();
     markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInvalidation : ParentOnlyInvalidation);
 }
 
@@ -71,7 +62,7 @@
         if (filterData->savedContext)
             filterData->state = FilterData::MarkedForRemoval;
         else
-            delete m_filter.take(client);
+            m_filter.remove(client);
     }
 
     markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
@@ -227,7 +218,7 @@
     if (filterData->drawingRegion.isEmpty()) {
         ASSERT(!m_filter.contains(object));
         filterData->savedContext = context;
-        m_filter.set(object, filterData.leakPtr());
+        m_filter.set(object, filterData.release());
         return false;
     }
 
@@ -237,11 +228,11 @@
     effectiveTransform.multiply(filterData->shearFreeAbsoluteTransform);
 
     OwnPtr<ImageBuffer> sourceGraphic;
-    RenderingMode renderingMode = object->document().page()->settings().acceleratedFiltersEnabled() ? Accelerated : Unaccelerated;
+    RenderingMode renderingMode = object->document().settings()->acceleratedFiltersEnabled() ? Accelerated : Unaccelerated;
     if (!createImageBuffer(filterData->drawingRegion, effectiveTransform, sourceGraphic, renderingMode)) {
         ASSERT(!m_filter.contains(object));
         filterData->savedContext = context;
-        m_filter.set(object, filterData.leakPtr());
+        m_filter.set(object, filterData.release());
         return false;
     }
 
@@ -257,7 +248,7 @@
     context = sourceGraphicContext;
 
     ASSERT(!m_filter.contains(object));
-    m_filter.set(object, filterData.leakPtr());
+    m_filter.set(object, filterData.release());
 
     return true;
 }
@@ -274,7 +265,7 @@
 
     switch (filterData->state) {
     case FilterData::MarkedForRemoval:
-        delete m_filter.take(object);
+        m_filter.remove(object);
         return;
 
     case FilterData::CycleDetected:
@@ -341,12 +332,12 @@
 
 void RenderSVGResourceFilter::primitiveAttributeChanged(RenderObject* object, const QualifiedName& attribute)
 {
-    HashMap<RenderObject*, FilterData*>::iterator it = m_filter.begin();
-    HashMap<RenderObject*, FilterData*>::iterator end = m_filter.end();
+    FilterMap::iterator it = m_filter.begin();
+    FilterMap::iterator end = m_filter.end();
     SVGFilterPrimitiveStandardAttributes* primitve = static_cast<SVGFilterPrimitiveStandardAttributes*>(object->node());
 
     for (; it != end; ++it) {
-        FilterData* filterData = it->value;
+        FilterData* filterData = it->value.get();
         if (filterData->state != FilterData::Built)
             continue;
 
diff --git a/Source/core/rendering/svg/RenderSVGResourceFilter.h b/Source/core/rendering/svg/RenderSVGResourceFilter.h
index 25faa03..ebf2f29 100644
--- a/Source/core/rendering/svg/RenderSVGResourceFilter.h
+++ b/Source/core/rendering/svg/RenderSVGResourceFilter.h
@@ -85,7 +85,8 @@
 private:
     bool fitsInMaximumImageSize(const FloatSize&, FloatSize&);
 
-    HashMap<RenderObject*, FilterData*> m_filter;
+    typedef HashMap<RenderObject*, OwnPtr<FilterData> > FilterMap;
+    FilterMap m_filter;
 };
 
 inline RenderSVGResourceFilter* toRenderSVGResourceFilter(RenderObject* object)
diff --git a/Source/core/rendering/svg/RenderSVGResourceGradient.h b/Source/core/rendering/svg/RenderSVGResourceGradient.h
index 13c82fb..82ef84c 100644
--- a/Source/core/rendering/svg/RenderSVGResourceGradient.h
+++ b/Source/core/rendering/svg/RenderSVGResourceGradient.h
@@ -22,13 +22,12 @@
 #ifndef RenderSVGResourceGradient_h
 #define RenderSVGResourceGradient_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/Gradient.h"
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/svg/RenderSVGResourceContainer.h"
 #include "core/svg/SVGGradientElement.h"
-
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/HashMap.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/svg/RenderSVGResourceMarker.cpp b/Source/core/rendering/svg/RenderSVGResourceMarker.cpp
index 4b56522..5f3108d 100644
--- a/Source/core/rendering/svg/RenderSVGResourceMarker.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceMarker.cpp
@@ -25,11 +25,12 @@
 
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/rendering/svg/RenderSVGContainer.h"
-#include "core/rendering/svg/RenderSVGRoot.h"
 #include "core/rendering/svg/SVGRenderSupport.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGMarkerElement.h"
 
+#include "wtf/TemporaryChange.h"
+
 namespace WebCore {
 
 RenderSVGResourceType RenderSVGResourceMarker::s_resourceType = MarkerResourceType;
@@ -45,9 +46,15 @@
 
 void RenderSVGResourceMarker::layout()
 {
+    ASSERT(needsLayout());
+    if (m_isInLayout)
+        return;
+
+    TemporaryChange<bool> inLayoutChange(m_isInLayout, true);
+
     // Invalidate all resources if our layout changed.
     if (everHadLayout() && selfNeedsLayout())
-        RenderSVGRoot::addResourceForClientInvalidation(this);
+        removeAllClientsFromCache();
 
     // RenderSVGHiddenContainer overwrites layout(). We need the
     // layouting of RenderSVGContainer for calculating  local
diff --git a/Source/core/rendering/svg/RenderSVGResourceMarker.h b/Source/core/rendering/svg/RenderSVGResourceMarker.h
index b88869c..95396f0 100644
--- a/Source/core/rendering/svg/RenderSVGResourceMarker.h
+++ b/Source/core/rendering/svg/RenderSVGResourceMarker.h
@@ -20,11 +20,10 @@
 #ifndef RenderSVGResourceMarker_h
 #define RenderSVGResourceMarker_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/rendering/svg/RenderSVGResourceContainer.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGMarkerElement.h"
-
+#include "platform/geometry/FloatRect.h"
 #include "wtf/HashSet.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/svg/RenderSVGResourceMasker.cpp b/Source/core/rendering/svg/RenderSVGResourceMasker.cpp
index 0aae387..4939aa1 100644
--- a/Source/core/rendering/svg/RenderSVGResourceMasker.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceMasker.cpp
@@ -21,17 +21,16 @@
 
 #include "core/rendering/svg/RenderSVGResourceMasker.h"
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/svg/RenderSVGResource.h"
 #include "core/rendering/svg/SVGRenderingContext.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGMaskElement.h"
 #include "core/svg/SVGUnitTypes.h"
-
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/UnusedParam.h"
 #include "wtf/Vector.h"
 
@@ -73,37 +72,43 @@
     if (repaintRect.isEmpty() || !element()->hasChildNodes())
         return false;
 
-    const SVGRenderStyle* svgStyle = style()->svgStyle();
-    ASSERT(svgStyle);
-    ColorSpace colorSpace = svgStyle->colorInterpolation() == CI_LINEARRGB
-        ? ColorSpaceLinearRGB
-        : ColorSpaceDeviceRGB;
-
-    // Mask layer start.
-    context->beginTransparencyLayer(1, &repaintRect);
-    {
-        // Draw the mask with color conversion (when needed).
-        GraphicsContextStateSaver maskContentSaver(*context);
-        context->setColorSpaceConversion(ColorSpaceDeviceRGB, colorSpace);
-
-        drawMaskContent(context, object->objectBoundingBox());
-    }
-
     // Content layer start.
-    MaskType maskType = svgStyle->maskType() == MT_LUMINANCE ? LuminanceMaskType : AlphaMaskType;
-    context->beginMaskedLayer(repaintRect, maskType);
+    context->beginTransparencyLayer(1, &repaintRect);
 
     return true;
 }
 
-void RenderSVGResourceMasker::postApplyResource(RenderObject*, GraphicsContext*& context,
+void RenderSVGResourceMasker::postApplyResource(RenderObject* object, GraphicsContext*& context,
     unsigned short resourceMode, const Path*, const RenderSVGShape*)
 {
+    ASSERT(object);
+    ASSERT(context);
+    ASSERT(style());
     ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
+    ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout());
 
-    // Transfer content layer -> mask layer (SrcIn)
+    FloatRect repaintRect = object->repaintRectInLocalCoordinates();
+
+    const SVGRenderStyle* svgStyle = style()->svgStyle();
+    ASSERT(svgStyle);
+    ColorFilter maskLayerFilter = svgStyle->maskType() == MT_LUMINANCE
+        ? ColorFilterLuminanceToAlpha : ColorFilterNone;
+    ColorFilter maskContentFilter = svgStyle->colorInterpolation() == CI_LINEARRGB
+        ? ColorFilterSRGBToLinearRGB : ColorFilterNone;
+
+    // Mask layer start.
+    context->beginLayer(1, CompositeDestinationIn, &repaintRect, maskLayerFilter);
+    {
+        // Draw the mask with color conversion (when needed).
+        GraphicsContextStateSaver maskContentSaver(*context);
+        context->setColorFilter(maskContentFilter);
+
+        drawMaskContent(context, object->objectBoundingBox());
+    }
+
+    // Transfer mask layer -> content layer (DstIn)
     context->endLayer();
-    // Transfer mask layer -> bg layer (SrcOver)
+    // Transfer content layer -> backdrop (SrcOver)
     context->endLayer();
 }
 
diff --git a/Source/core/rendering/svg/RenderSVGResourceMasker.h b/Source/core/rendering/svg/RenderSVGResourceMasker.h
index 629950c..acfde04 100644
--- a/Source/core/rendering/svg/RenderSVGResourceMasker.h
+++ b/Source/core/rendering/svg/RenderSVGResourceMasker.h
@@ -20,13 +20,13 @@
 #ifndef RenderSVGResourceMasker_h
 #define RenderSVGResourceMasker_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/ImageBuffer.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/rendering/svg/RenderSVGResourceContainer.h"
 #include "core/svg/SVGMaskElement.h"
 #include "core/svg/SVGUnitTypes.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/IntSize.h"
 
 #include "wtf/HashMap.h"
 #include "wtf/OwnPtr.h"
diff --git a/Source/core/rendering/svg/RenderSVGResourcePattern.h b/Source/core/rendering/svg/RenderSVGResourcePattern.h
index ad47346..3206cdf 100644
--- a/Source/core/rendering/svg/RenderSVGResourcePattern.h
+++ b/Source/core/rendering/svg/RenderSVGResourcePattern.h
@@ -21,14 +21,14 @@
 #ifndef RenderSVGResourcePattern_h
 #define RenderSVGResourcePattern_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/platform/graphics/ImageBuffer.h"
 #include "core/platform/graphics/Pattern.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/svg/RenderSVGResourceContainer.h"
 #include "core/svg/PatternAttributes.h"
 #include "core/svg/SVGPatternElement.h"
 #include "core/svg/SVGUnitTypes.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/AffineTransform.h"
 
 #include "wtf/HashMap.h"
 #include "wtf/OwnPtr.h"
diff --git a/Source/core/rendering/svg/RenderSVGResourceSolidColor.cpp b/Source/core/rendering/svg/RenderSVGResourceSolidColor.cpp
index 5693fb1..eb60a76 100644
--- a/Source/core/rendering/svg/RenderSVGResourceSolidColor.cpp
+++ b/Source/core/rendering/svg/RenderSVGResourceSolidColor.cpp
@@ -21,8 +21,8 @@
 
 #include "core/rendering/svg/RenderSVGResourceSolidColor.h"
 
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/rendering/style/RenderStyle.h"
 #include "core/rendering/svg/RenderSVGShape.h"
diff --git a/Source/core/rendering/svg/RenderSVGResourceSolidColor.h b/Source/core/rendering/svg/RenderSVGResourceSolidColor.h
index c2ca000..ce31414 100644
--- a/Source/core/rendering/svg/RenderSVGResourceSolidColor.h
+++ b/Source/core/rendering/svg/RenderSVGResourceSolidColor.h
@@ -21,8 +21,8 @@
 #define RenderSVGResourceSolidColor_h
 
 #include "core/platform/graphics/Color.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/rendering/svg/RenderSVGResource.h"
+#include "platform/geometry/FloatRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/svg/RenderSVGRoot.cpp b/Source/core/rendering/svg/RenderSVGRoot.cpp
index a664493..4eb10c4 100644
--- a/Source/core/rendering/svg/RenderSVGRoot.cpp
+++ b/Source/core/rendering/svg/RenderSVGRoot.cpp
@@ -27,7 +27,7 @@
 
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/rendering/HitTestResult.h"
@@ -197,8 +197,6 @@
 {
     ASSERT(needsLayout());
 
-    m_resourcesNeedingToInvalidateClients.clear();
-
     // Arbitrary affine transforms are incompatible with LayoutState.
     LayoutStateDisabler layoutStateDisabler(view());
 
@@ -210,21 +208,13 @@
     updateLogicalHeight();
     buildLocalToBorderBoxTransform();
 
+    SVGRenderSupport::layoutResourcesIfNeeded(this);
+
     SVGSVGElement* svg = toSVGSVGElement(node());
     ASSERT(svg);
     m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size());
     SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filtersForceContainerLayout(this));
 
-    if (!m_resourcesNeedingToInvalidateClients.isEmpty()) {
-        // Invalidate resource clients, which may mark some nodes for layout.
-        HashSet<RenderSVGResourceContainer*>::iterator end = m_resourcesNeedingToInvalidateClients.end();
-        for (HashSet<RenderSVGResourceContainer*>::iterator it = m_resourcesNeedingToInvalidateClients.begin(); it != end; ++it)
-            (*it)->removeAllClientsFromCache();
-
-        m_isLayoutSizeChanged = false;
-        SVGRenderSupport::layoutChildren(this, false);
-    }
-
     // At this point LayoutRepainter already grabbed the old bounds,
     // recalculate them now so repaintAfterLayout() uses the new bounds.
     if (m_needsBoundariesOrTransformUpdate) {
@@ -256,23 +246,13 @@
     if (svg->hasEmptyViewBox())
         return;
 
-    Page* page = 0;
-    if (Frame* frame = this->frame())
-        page = frame->page();
-
     // Don't paint if we don't have kids, except if we have filters we should paint those.
     if (!firstChild()) {
         SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this);
-        if (!resources || !resources->filter()) {
-            if (page && paintInfo.phase == PaintPhaseForeground)
-                page->addRelevantUnpaintedObject(this, visualOverflowRect());
+        if (!resources || !resources->filter())
             return;
-        }
     }
 
-    if (page && paintInfo.phase == PaintPhaseForeground)
-        page->addRelevantRepaintedObject(this, visualOverflowRect());
-
     // Make a copy of the PaintInfo because applyTransform will modify the damage rect.
     PaintInfo childPaintInfo(paintInfo);
     childPaintInfo.context->save();
@@ -475,14 +455,4 @@
     return svg->intrinsicHeight(SVGSVGElement::IgnoreCSSProperties).isPercent();
 }
 
-void RenderSVGRoot::addResourceForClientInvalidation(RenderSVGResourceContainer* resource)
-{
-    RenderObject* svgRoot = resource->parent();
-    while (svgRoot && !svgRoot->isSVGRoot())
-        svgRoot = svgRoot->parent();
-    if (!svgRoot)
-        return;
-    toRenderSVGRoot(svgRoot)->m_resourcesNeedingToInvalidateClients.add(resource);
-}
-
 }
diff --git a/Source/core/rendering/svg/RenderSVGRoot.h b/Source/core/rendering/svg/RenderSVGRoot.h
index 26e8bc5..2d1a1d2 100644
--- a/Source/core/rendering/svg/RenderSVGRoot.h
+++ b/Source/core/rendering/svg/RenderSVGRoot.h
@@ -23,9 +23,9 @@
 #ifndef RenderSVGRoot_h
 #define RenderSVGRoot_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/rendering/RenderReplaced.h"
 #include "core/rendering/svg/SVGRenderSupport.h"
+#include "platform/geometry/FloatRect.h"
 
 namespace WebCore {
 
@@ -63,10 +63,6 @@
     // localToBorderBoxTransform maps local SVG viewport coordinates to local CSS box coordinates.
     const AffineTransform& localToBorderBoxTransform() const { return m_localToBorderBoxTransform; }
 
-    // The flag is cleared at the beginning of each layout() pass. Elements then call this
-    // method during layout when they are invalidated by a filter.
-    static void addResourceForClientInvalidation(RenderSVGResourceContainer*);
-
 private:
     virtual RenderObjectChildList* virtualChildren() { return children(); }
     virtual const RenderObjectChildList* virtualChildren() const { return children(); }
@@ -119,7 +115,6 @@
     FloatRect m_repaintBoundingBox;
     mutable AffineTransform m_localToParentTransform;
     AffineTransform m_localToBorderBoxTransform;
-    HashSet<RenderSVGResourceContainer*> m_resourcesNeedingToInvalidateClients;
     bool m_isLayoutSizeChanged : 1;
     bool m_needsBoundariesOrTransformUpdate : 1;
 };
diff --git a/Source/core/rendering/svg/RenderSVGShape.cpp b/Source/core/rendering/svg/RenderSVGShape.cpp
index 12b90a3..dd301c9 100644
--- a/Source/core/rendering/svg/RenderSVGShape.cpp
+++ b/Source/core/rendering/svg/RenderSVGShape.cpp
@@ -29,7 +29,6 @@
 
 #include "core/rendering/svg/RenderSVGShape.h"
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/rendering/HitTestRequest.h"
 #include "core/rendering/LayoutRepainter.h"
@@ -41,6 +40,7 @@
 #include "core/rendering/svg/SVGResources.h"
 #include "core/rendering/svg/SVGResourcesCache.h"
 #include "core/svg/SVGGraphicsElement.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/MathExtras.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/svg/RenderSVGShape.h b/Source/core/rendering/svg/RenderSVGShape.h
index 49295b4..e493306 100644
--- a/Source/core/rendering/svg/RenderSVGShape.h
+++ b/Source/core/rendering/svg/RenderSVGShape.h
@@ -26,10 +26,10 @@
 #ifndef RenderSVGShape_h
 #define RenderSVGShape_h
 
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/svg/RenderSVGModelObject.h"
 #include "core/rendering/svg/SVGMarkerData.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/rendering/svg/RenderSVGText.cpp b/Source/core/rendering/svg/RenderSVGText.cpp
index cc43f25..0d12697 100644
--- a/Source/core/rendering/svg/RenderSVGText.cpp
+++ b/Source/core/rendering/svg/RenderSVGText.cpp
@@ -28,8 +28,6 @@
 
 #include "core/rendering/svg/RenderSVGText.h"
 
-#include "core/platform/FloatConversion.h"
-#include "core/platform/graphics/FloatQuad.h"
 #include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/SimpleFontData.h"
@@ -50,6 +48,8 @@
 #include "core/svg/SVGTextElement.h"
 #include "core/svg/SVGTransformList.h"
 #include "core/svg/SVGURIReference.h"
+#include "platform/FloatConversion.h"
+#include "platform/geometry/FloatQuad.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/svg/RenderSVGText.h b/Source/core/rendering/svg/RenderSVGText.h
index 5f750c4..fa1f652 100644
--- a/Source/core/rendering/svg/RenderSVGText.h
+++ b/Source/core/rendering/svg/RenderSVGText.h
@@ -22,9 +22,9 @@
 #ifndef RenderSVGText_h
 #define RenderSVGText_h
 
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/svg/RenderSVGBlock.h"
 #include "core/rendering/svg/SVGTextLayoutAttributesBuilder.h"
+#include "platform/transforms/AffineTransform.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/svg/SVGInlineTextBox.cpp b/Source/core/rendering/svg/SVGInlineTextBox.cpp
index d15a979..e3b7c1b 100644
--- a/Source/core/rendering/svg/SVGInlineTextBox.cpp
+++ b/Source/core/rendering/svg/SVGInlineTextBox.cpp
@@ -22,9 +22,8 @@
 #include "config.h"
 #include "core/rendering/svg/SVGInlineTextBox.h"
 
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
-#include "core/platform/FloatConversion.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/platform/graphics/DrawLooper.h"
 #include "core/platform/graphics/FontCache.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
@@ -36,6 +35,7 @@
 #include "core/rendering/svg/RenderSVGResourceSolidColor.h"
 #include "core/rendering/svg/SVGResourcesCache.h"
 #include "core/rendering/svg/SVGTextRunRenderingContext.h"
+#include "platform/FloatConversion.h"
 
 using namespace std;
 
diff --git a/Source/core/rendering/svg/SVGMarkerData.h b/Source/core/rendering/svg/SVGMarkerData.h
index 61f90a3..d3d15df 100644
--- a/Source/core/rendering/svg/SVGMarkerData.h
+++ b/Source/core/rendering/svg/SVGMarkerData.h
@@ -20,8 +20,8 @@
 #ifndef SVGMarkerData_h
 #define SVGMarkerData_h
 
-#include "core/platform/FloatConversion.h"
 #include "core/platform/graphics/Path.h"
+#include "platform/FloatConversion.h"
 #include "wtf/MathExtras.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/svg/SVGRenderSupport.cpp b/Source/core/rendering/svg/SVGRenderSupport.cpp
index 1e48649..ad9d5ff 100644
--- a/Source/core/rendering/svg/SVGRenderSupport.cpp
+++ b/Source/core/rendering/svg/SVGRenderSupport.cpp
@@ -242,9 +242,15 @@
         }
 
         SubtreeLayoutScope layoutScope(child);
-        if (needsLayout)
+        // Resource containers are nasty: they can invalidate clients outside the current SubtreeLayoutScope.
+        // Since they only care about viewport size changes (to resolve their relative lengths), we trigger
+        // their invalidation directly from SVGSVGElement::svgAttributeChange() or at a higher
+        // SubtreeLayoutScope (in RenderView::layout()).
+        if (needsLayout && !child->isSVGResourceContainer())
             layoutScope.setNeedsLayout(child);
 
+        layoutResourcesIfNeeded(child);
+
         if (child->needsLayout()) {
             child->layout();
             // Renderers are responsible for repainting themselves when changing, except
@@ -268,6 +274,15 @@
         invalidateResourcesOfChildren(*it);
 }
 
+void SVGRenderSupport::layoutResourcesIfNeeded(const RenderObject* object)
+{
+    ASSERT(object);
+
+    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object);
+    if (resources)
+        resources->layoutIfNeeded();
+}
+
 bool SVGRenderSupport::isOverflowHidden(const RenderObject* object)
 {
     // SVG doesn't support independent x/y overflow
diff --git a/Source/core/rendering/svg/SVGRenderSupport.h b/Source/core/rendering/svg/SVGRenderSupport.h
index 285e447..4265f64 100644
--- a/Source/core/rendering/svg/SVGRenderSupport.h
+++ b/Source/core/rendering/svg/SVGRenderSupport.h
@@ -46,6 +46,9 @@
     // Shares child layouting code between RenderSVGRoot/RenderSVG(Hidden)Container
     static void layoutChildren(RenderObject*, bool selfNeedsLayout);
 
+    // Layout resources used by this node.
+    static void layoutResourcesIfNeeded(const RenderObject*);
+
     // Helper function determining wheter overflow is hidden
     static bool isOverflowHidden(const RenderObject*);
 
diff --git a/Source/core/rendering/svg/SVGRenderTreeAsText.cpp b/Source/core/rendering/svg/SVGRenderTreeAsText.cpp
index ada7f29..968eb23 100644
--- a/Source/core/rendering/svg/SVGRenderTreeAsText.cpp
+++ b/Source/core/rendering/svg/SVGRenderTreeAsText.cpp
@@ -274,7 +274,7 @@
             ts << " [stroke={" << s;
             writeSVGPaintingResource(ts, strokePaintingResource);
 
-            SVGLengthContext lengthContext(toSVGElement(shape.element()));
+            SVGLengthContext lengthContext(shape.element());
             double dashOffset = svgStyle->strokeDashOffset().value(lengthContext);
             double strokeWidth = svgStyle->strokeWidth().value(lengthContext);
             const Vector<SVGLength>& dashes = svgStyle->strokeDashArray();
diff --git a/Source/core/rendering/svg/SVGRenderTreeAsText.h b/Source/core/rendering/svg/SVGRenderTreeAsText.h
index 70b4e17..716bc89 100644
--- a/Source/core/rendering/svg/SVGRenderTreeAsText.h
+++ b/Source/core/rendering/svg/SVGRenderTreeAsText.h
@@ -26,7 +26,7 @@
 #ifndef SVGRenderTreeAsText_h
 #define SVGRenderTreeAsText_h
 
-#include "core/platform/text/TextStream.h"
+#include "platform/text/TextStream.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/svg/SVGRenderingContext.cpp b/Source/core/rendering/svg/SVGRenderingContext.cpp
index 216a847..5349b0e 100644
--- a/Source/core/rendering/svg/SVGRenderingContext.cpp
+++ b/Source/core/rendering/svg/SVGRenderingContext.cpp
@@ -26,8 +26,8 @@
 
 #include "core/rendering/svg/SVGRenderingContext.h"
 
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/rendering/RenderLayer.h"
 #include "core/rendering/svg/RenderSVGImage.h"
@@ -70,7 +70,7 @@
 
         if (m_clipper) {
             ASSERT(SVGResourcesCache::cachedResourcesForRenderObject(m_object)->clipper() == m_clipper);
-            m_clipper->postApplyResource(m_object, m_paintInfo->context, ApplyToDefaultMode, 0, 0);
+            m_clipper->postApplyStatefulResource(m_object, m_paintInfo->context, m_clipperContext);
         }
 
         if (m_masker) {
@@ -159,7 +159,7 @@
 
     RenderSVGResourceClipper* clipper = resources->clipper();
     if (!clipPathOperation && clipper) {
-        if (!clipper->applyResource(m_object, style, m_paintInfo->context, ApplyToDefaultMode))
+        if (!clipper->applyStatefulResource(m_object, m_paintInfo->context, m_clipperContext))
             return;
         m_clipper = clipper;
         m_renderingFlags |= PostApplyResources;
diff --git a/Source/core/rendering/svg/SVGRenderingContext.h b/Source/core/rendering/svg/SVGRenderingContext.h
index 3d063f5..5b679ba 100644
--- a/Source/core/rendering/svg/SVGRenderingContext.h
+++ b/Source/core/rendering/svg/SVGRenderingContext.h
@@ -27,13 +27,13 @@
 
 #include "core/platform/graphics/ImageBuffer.h"
 #include "core/rendering/PaintInfo.h"
+#include "core/rendering/svg/RenderSVGResourceClipper.h"
 
 namespace WebCore {
 
 class AffineTransform;
 class RenderObject;
 class FloatRect;
-class RenderSVGResourceClipper;
 class RenderSVGResourceFilter;
 class RenderSVGResourceMasker;
 
@@ -115,6 +115,7 @@
     IntRect m_savedPaintRect;
     RenderSVGResourceFilter* m_filter;
     RenderSVGResourceClipper* m_clipper;
+    ClipperContext m_clipperContext;
     RenderSVGResourceMasker* m_masker;
 };
 
diff --git a/Source/core/rendering/svg/SVGResources.cpp b/Source/core/rendering/svg/SVGResources.cpp
index b5b42ba..248d44b 100644
--- a/Source/core/rendering/svg/SVGResources.cpp
+++ b/Source/core/rendering/svg/SVGResources.cpp
@@ -277,6 +277,27 @@
     return foundResources;
 }
 
+void SVGResources::layoutIfNeeded()
+{
+    if (m_clipperFilterMaskerData) {
+        if (RenderSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipper)
+            clipper->layoutIfNeeded();
+        if (RenderSVGResourceMasker* masker = m_clipperFilterMaskerData->masker)
+            masker->layoutIfNeeded();
+        if (RenderSVGResourceFilter* filter = m_clipperFilterMaskerData->filter)
+            filter->layoutIfNeeded();
+    }
+
+    if (m_markerData) {
+        if (RenderSVGResourceMarker* marker = m_markerData->markerStart)
+            marker->layoutIfNeeded();
+        if (RenderSVGResourceMarker* marker = m_markerData->markerMid)
+            marker->layoutIfNeeded();
+        if (RenderSVGResourceMarker* marker = m_markerData->markerEnd)
+            marker->layoutIfNeeded();
+    }
+}
+
 void SVGResources::removeClientFromCache(RenderObject* object, bool markForInvalidation) const
 {
     if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource)
diff --git a/Source/core/rendering/svg/SVGResources.h b/Source/core/rendering/svg/SVGResources.h
index ec911bb..3df2a1f 100644
--- a/Source/core/rendering/svg/SVGResources.h
+++ b/Source/core/rendering/svg/SVGResources.h
@@ -43,6 +43,7 @@
     SVGResources();
 
     bool buildResources(const RenderObject*, const SVGRenderStyle*);
+    void layoutIfNeeded();
 
     // Ordinary resources
     RenderSVGResourceClipper* clipper() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->clipper : 0; }
diff --git a/Source/core/rendering/svg/SVGResourcesCache.cpp b/Source/core/rendering/svg/SVGResourcesCache.cpp
index 330ee7f..6790ec6 100644
--- a/Source/core/rendering/svg/SVGResourcesCache.cpp
+++ b/Source/core/rendering/svg/SVGResourcesCache.cpp
@@ -68,10 +68,9 @@
 
 void SVGResourcesCache::removeResourcesFromRenderObject(RenderObject* object)
 {
-    if (!m_cache.contains(object))
-        return;
-
     OwnPtr<SVGResources> resources = m_cache.take(object);
+    if (!resources)
+        return;
 
     // Walk resources and register the render object at each resources.
     HashSet<RenderSVGResourceContainer*> resourceSet;
@@ -122,11 +121,14 @@
 void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifference diff, const RenderStyle* newStyle)
 {
     ASSERT(renderer);
+    ASSERT(renderer->node());
+    ASSERT(renderer->node()->isSVGElement());
+
     if (diff == StyleDifferenceEqual || !renderer->parent())
         return;
 
     // In this case the proper SVGFE*Element will decide whether the modified CSS properties require a relayout or repaint.
-    if (renderer->isSVGResourceFilterPrimitive() && (diff == StyleDifferenceRepaint || diff == StyleDifferenceRepaintIfText))
+    if (renderer->isSVGResourceFilterPrimitive() && (diff == StyleDifferenceRepaint || diff == StyleDifferenceRepaintIfTextOrColorChange))
         return;
 
     // Dynamic changes of CSS properties like 'clip-path' may require us to recompute the associated resources for a renderer.
@@ -139,12 +141,6 @@
     }
 
     RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, false);
-
-    // FIXME: This doesn't look right, we often go through here in styleDidChange which means
-    // we're changing the needsStyleRecalc bits in the middle of recalcStyle on ourself which
-    // makes no sense. It's also not clear why we'd go through here for non-SVG elements.
-    if (renderer->node() && !renderer->node()->isSVGElement())
-        renderer->node()->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
 }
 
 void SVGResourcesCache::clientWasAddedToTree(RenderObject* renderer, const RenderStyle* newStyle)
diff --git a/Source/core/rendering/svg/SVGTextFragment.h b/Source/core/rendering/svg/SVGTextFragment.h
index 8790482..b9132bb 100644
--- a/Source/core/rendering/svg/SVGTextFragment.h
+++ b/Source/core/rendering/svg/SVGTextFragment.h
@@ -20,7 +20,7 @@
 #ifndef SVGTextFragment_h
 #define SVGTextFragment_h
 
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/transforms/AffineTransform.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp b/Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp
index 30870ed..4416f25 100644
--- a/Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp
+++ b/Source/core/rendering/svg/SVGTextLayoutEngineBaseline.cpp
@@ -22,11 +22,11 @@
 #include "core/rendering/svg/SVGTextLayoutEngineBaseline.h"
 
 #include "core/platform/graphics/Font.h"
-#include "core/platform/text/UnicodeRange.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/style/SVGRenderStyle.h"
 #include "core/rendering/svg/SVGTextMetrics.h"
 #include "core/svg/SVGLengthContext.h"
+#include "platform/text/UnicodeRange.h"
 
 namespace WebCore {
 
diff --git a/Source/core/rendering/svg/SVGTextMetricsBuilder.h b/Source/core/rendering/svg/SVGTextMetricsBuilder.h
index 6c3148a..fb83ba4 100644
--- a/Source/core/rendering/svg/SVGTextMetricsBuilder.h
+++ b/Source/core/rendering/svg/SVGTextMetricsBuilder.h
@@ -20,10 +20,10 @@
 #ifndef SVGTextMetricsBuilder_h
 #define SVGTextMetricsBuilder_h
 
-#include "core/platform/graphics/TextRun.h"
 #include "core/platform/graphics/WidthIterator.h"
 #include "core/rendering/svg/SVGTextLayoutAttributes.h"
 #include "core/rendering/svg/SVGTextMetrics.h"
+#include "platform/graphics/TextRun.h"
 #include "wtf/Vector.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/svg/SVGTextQuery.cpp b/Source/core/rendering/svg/SVGTextQuery.cpp
index 32674ab..4bf2a3c 100644
--- a/Source/core/rendering/svg/SVGTextQuery.cpp
+++ b/Source/core/rendering/svg/SVGTextQuery.cpp
@@ -20,14 +20,13 @@
 #include "config.h"
 #include "core/rendering/svg/SVGTextQuery.h"
 
-#include "core/platform/FloatConversion.h"
 #include "core/rendering/InlineFlowBox.h"
 #include "core/rendering/RenderBlock.h"
 #include "core/rendering/RenderInline.h"
 #include "core/rendering/svg/RenderSVGInlineText.h"
 #include "core/rendering/svg/SVGInlineTextBox.h"
 #include "core/rendering/svg/SVGTextMetrics.h"
-
+#include "platform/FloatConversion.h"
 #include "wtf/MathExtras.h"
 
 namespace WebCore {
diff --git a/Source/core/rendering/svg/SVGTextRunRenderingContext.h b/Source/core/rendering/svg/SVGTextRunRenderingContext.h
index 6b4793c..9e5a247 100644
--- a/Source/core/rendering/svg/SVGTextRunRenderingContext.h
+++ b/Source/core/rendering/svg/SVGTextRunRenderingContext.h
@@ -22,7 +22,7 @@
 #define SVGTextRunRenderingContext_h
 
 #include "core/platform/graphics/Font.h"
-#include "core/platform/graphics/TextRun.h"
+#include "platform/graphics/TextRun.h"
 
 namespace WebCore {
 
diff --git a/Source/core/scripts/Hasher.pm b/Source/core/scripts/Hasher.pm
deleted file mode 100644
index 05a43f5..0000000
--- a/Source/core/scripts/Hasher.pm
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright (C) 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
-# Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
-# Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
-# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
-# Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
-# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
-# Copyright (C) Research In Motion Limited 2010. All rights reserved.
-# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-# Copyright (C) 2011 Patrick Gansterer <paroga@webkit.org>
-# Copyright (C) 2012 Ericsson AB. 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
-# 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-package Hasher;
-
-use strict;
-
-sub leftShift($$) {
-    my ($value, $distance) = @_;
-    return (($value << $distance) & 0xFFFFFFFF);
-}
-
-# Paul Hsieh's SuperFastHash
-# http://www.azillionmonkeys.com/qed/hash.html
-sub GenerateHashValue
-{
-    my @chars = split(/ */, $_[0]);
-
-    # This hash is designed to work on 16-bit chunks at a time. But since the normal case
-    # (above) is to hash UTF-16 characters, we just treat the 8-bit chars as if they
-    # were 16-bit chunks, which should give matching results
-
-    my $EXP2_32 = 4294967296;
-
-    my $hash = 0x9e3779b9;
-    my $l    = scalar @chars; #I wish this was in Ruby --- Maks
-    my $rem  = $l & 1;
-    $l = $l >> 1;
-
-    my $s = 0;
-
-    # Main loop
-    for (; $l > 0; $l--) {
-        $hash   += ord($chars[$s]);
-        my $tmp = leftShift(ord($chars[$s+1]), 11) ^ $hash;
-        $hash   = (leftShift($hash, 16)% $EXP2_32) ^ $tmp;
-        $s += 2;
-        $hash += $hash >> 11;
-        $hash %= $EXP2_32;
-    }
-
-    # Handle end case
-    if ($rem != 0) {
-        $hash += ord($chars[$s]);
-        $hash ^= (leftShift($hash, 11)% $EXP2_32);
-        $hash += $hash >> 17;
-    }
-
-    # Force "avalanching" of final 127 bits
-    $hash ^= leftShift($hash, 3);
-    $hash += ($hash >> 5);
-    $hash = ($hash% $EXP2_32);
-    $hash ^= (leftShift($hash, 2)% $EXP2_32);
-    $hash += ($hash >> 15);
-    $hash = $hash% $EXP2_32;
-    $hash ^= (leftShift($hash, 10)% $EXP2_32);
-
-    # Save 8 bits for StringImpl to use as flags.
-    $hash &= 0xffffff;
-
-    # This avoids ever returning a hash code of 0, since that is used to
-    # signal "hash not computed yet". Setting the high bit maintains
-    # reasonable fidelity to a hash code of 0 because it is likely to yield
-    # exactly 0 when hash lookup masks out the high bits.
-    $hash = (0x80000000 >> 8) if ($hash == 0);
-
-    return $hash;
-}
-
-1;
diff --git a/Source/core/scripts/InFilesCompiler.pm b/Source/core/scripts/InFilesCompiler.pm
deleted file mode 100644
index 40cff49..0000000
--- a/Source/core/scripts/InFilesCompiler.pm
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/usr/bin/perl -w
-
-# Copyright (C) 2011 Adam Barth <abarth@webkit.org>
-#
-# 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 GOOGLE, 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,
-# 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.
-#
-
-use strict;
-
-use Config;
-use Getopt::Long;
-use File::Path;
-use File::Spec;
-use IO::File;
-use InFilesParser;
-
-require Config;
-
-package InFilesCompiler;
-
-my $inputFile = "";
-my $outputDir = ".";
-my $defaultItemFactory;
-
-my %parsedItems;
-my %parsedItemPaths;
-my %parsedParameters;
-
-sub itemHandler($$$)
-{
-    my ($itemName, $property, $value) = @_;
-
-    if ($itemName =~ /\//) {
-        my ($dirname, $basename) = $itemName =~ /^(.*)\/(.*)/;
-        $itemName = $basename;
-        $parsedItemPaths{$itemName} = $dirname;
-    }
-
-    $parsedItems{$itemName} = { &$defaultItemFactory($itemName) } if !defined($parsedItems{$itemName});
-
-    return unless $property;
-
-    die "Unknown property $property for $itemName\n" if !defined($parsedItems{$itemName}{$property});
-    $parsedItems{$itemName}{$property} = $value;
-}
-
-sub parameterHandler($$)
-{
-    my ($parameter, $value) = @_;
-
-    die "Unknown parameter $parameter\n" if !defined($parsedParameters{$parameter});
-    $parsedParameters{$parameter} = $value;
-}
-
-sub new()
-{
-    my $object = shift;
-    my $reference = { };
-
-    my $defaultParametersRef = shift;
-    %parsedParameters = %{ $defaultParametersRef };
-    $defaultItemFactory = shift;
-
-    %parsedItems = ();
-
-    bless($reference, $object);
-    return $reference;
-}
-
-sub initializeFromCommandLine()
-{
-    ::GetOptions(
-        'input=s' => \$inputFile,
-        'outputDir=s' => \$outputDir,
-    );
-
-    die "You must specify --input <file>" unless length($inputFile);
-
-    ::mkpath($outputDir);
-
-    # FIXME: Should we provide outputDir via an accessor?
-    return $outputDir;
-}
-
-sub compile()
-{
-    my $object = shift;
-    my $generateCode = shift;
-
-    my $file = new IO::File;
-    open($file, $inputFile) or die "Failed to open file: $!";
-
-    my $InParser = InFilesParser->new();
-    $InParser->parse($file, \&parameterHandler, \&itemHandler);
-
-    close($file);
-    die "Failed to read from file: $inputFile" if (keys %parsedItems == 0);
-
-    &$generateCode(\%parsedParameters, \%parsedItems, \%parsedItemPaths);
-}
-
-sub license()
-{
-    return "/*
- * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
- *
- * Copyright (C) 2011 Google Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GOOGLE, 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,
- * 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.
- */
-
-";
-}
-
-sub interfaceForItem($)
-{
-    my $object = shift;
-    my $itemName = shift;
-
-    my $interfaceName = $parsedItems{$itemName}{"interfaceName"};
-    $interfaceName = $itemName unless $interfaceName;
-
-    return $interfaceName;
-}
-
-
-sub preferredConditional()
-{
-    my $object = shift;
-    my $conditional = shift;
-
-    my @conditionals = split('\\|', $conditional);
-    return $conditionals[0];
-}
-
-sub conditionalStringFromAttributeValue()
-{
-    my $object = shift;
-    my $conditional = shift;
-
-    return "ENABLE(" . join(') || ENABLE(', split('\\|', $conditional)) . ")";
-}
-
-1;
diff --git a/Source/core/scripts/InFilesParser.pm b/Source/core/scripts/InFilesParser.pm
deleted file mode 100644
index eaaaa81..0000000
--- a/Source/core/scripts/InFilesParser.pm
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/usr/bin/perl -w
-
-# Copyright (C) 2008 Julien Chaffraix <jchaffraix@webkit.org>
-#
-# 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,
-# 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.
-#
-
-use strict;
-
-package InFilesParser;
-
-my $isParsingCommonParameters;
-my $hasStartedParsing;
-
-# Helper functions
-
-sub trimComment
-{
-    my $string = shift;
-    $string =~ s/#.+$//;
-    chomp($string);
-    return $string;
-}
-
-sub trimWS
-{
-    my $string = shift;
-    $string =~ s/^\s+//;
-    $string =~ s/\s+$//;
-    chomp($string);
-    return $string;
-}
-
-sub trimQuoteAndWS
-{
-    my $string = shift;
-    $string =~ s/\"([^\"]+)\"/$1/;
-    return trimWS($string);
-}
-
-# Default constructor
-
-sub new
-{
-    my $object = shift;
-    my $reference = { };
-
-    # Initialize the parser.
-    $isParsingCommonParameters = 1;
-    $hasStartedParsing = 0;
-
-    bless($reference, $object);
-    return $reference;
-}
-
-# parse take 3 attributes:
-# - the filestream to read from (the caller has to open / close it).
-# - the commonParameterHandler called when parsing the first part of the file with the parameter and the value.
-# - the perTagHandler called for each optional parameter with the element name, the parameter and its value.
-#   If no parameter were provided, it is called once with an empty parameter and value.
-sub parse($)
-{
-    my $object = shift;
-    my $fileStream = shift; # IO::File only
-    my $commonParameterHandler = shift;
-    my $perTagHandler = shift;
-
-    foreach (<$fileStream>) {
-        # Ignore whitespace, in case the .in files have the wrong EOL
-        # markers and those are getting treated as whitespace.
-        $_ = trimWS($_);
-
-        # Empty line, change from common parameter part
-        # to per tag part if we have started parsing.
-        if (/^$/) {
-            if ($hasStartedParsing) {
-                $isParsingCommonParameters = 0;
-            }
-            next;
-        }
-
-        # There may be a few empty lines at the beginning of the file
-        # so detect the first non empty line which starts the common
-        # parameters part.
-        $hasStartedParsing = 1;
-
-        if (/^#/) {
-            next;
-        }
-
-        $_ = trimComment($_);
-
-        if ($isParsingCommonParameters) {
-            my ($name, $value) = split '=', $_;
-
-            $name = trimWS($name);
-            if (defined($value)) {
-                $value = trimQuoteAndWS($value);
-            } else {
-                # We default to 1 as it eases the syntax.
-                $value = "1";
-            }
-
-            &$commonParameterHandler($name, $value);
-        } else {
-            # Parsing per-tag parameters.
-
-            # Split the tag name ($1) from the optionnal parameter(s) ($2)
-            /^(\S+)\s*(.*)$/;
-            my $elementName = $1;
-
-            if ($2) {
-                my @options = split "," , $2;
-                my ($option, $value);
-                for (my $i = 0; $i < @options; ++$i) {
-                    ($option, $value) = split "=", $options[$i];
-                    $option = trimWS($option);
-                    if (defined($value)) {
-                        $value = trimQuoteAndWS($value);
-                    } else {
-                        # We default to 1 as it eases the syntax.
-                        $value = "1";
-                    }
-
-                    &$perTagHandler($elementName, $option, $value);
-                }
-            } else {
-                # No parameter was given so call it with empty strings.
-                &$perTagHandler($elementName, "", "");
-            }
-        }
-    }
-}
-
-1;
diff --git a/Source/core/scripts/StaticString.pm b/Source/core/scripts/StaticString.pm
deleted file mode 100644
index a404d70..0000000
--- a/Source/core/scripts/StaticString.pm
+++ /dev/null
@@ -1,49 +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:
-# 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.
-
-package StaticString;
-
-use strict;
-use Hasher;
-
-sub GenerateStringImpls($)
-{
-    my $stringsRef = shift;
-    my %strings = %$stringsRef;
-
-    my @result = ();
-
-    push(@result, "\n");
-
-    while ( my ($name, $value) = each %strings ) {
-        my $length = length($value);
-        my $hash = Hasher::GenerateHashValue($value);
-        push(@result, "    StringImpl* ${name}Impl = StringImpl::createStatic(\"$value\", $length, $hash);\n");
-    }
-
-    push(@result, "\n");
-
-    return join "", @result;
-}
-
-1;
diff --git a/Source/core/scripts/action_derivedsourcesallinone.py b/Source/core/scripts/action_derivedsourcesallinone.py
deleted file mode 100644
index fec5088..0000000
--- a/Source/core/scripts/action_derivedsourcesallinone.py
+++ /dev/null
@@ -1,225 +0,0 @@
-#!/usr/bin/python
-#
-# 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
-# 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.
-#
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# action_derivedsourcesallinone.py generates a single cpp file that includes
-# all v8 bindings cpp files generated from idls. Files can be assigned into
-# multiple output files, to reduce maximum compilation unit size and allow
-# parallel compilation.
-#
-# usage: action_derivedsourcesallinone.py IDL_FILES_LIST -- OUTPUT_FILE1 OUTPUT_FILE2 ...
-#
-# Note that IDL_FILES_LIST is a text file containing the IDL file paths.
-
-import errno
-import os
-import os.path
-import re
-import subprocess
-import sys
-
-# A regexp for finding Conditional attributes in interface definitions.
-conditionalPattern = re.compile('interface[\s]*\[[^\]]*Conditional=([\_0-9a-zA-Z&|]*)')
-
-copyrightTemplate = """/*
- * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
- *
- * This file was generated by the action_derivedsourcesallinone.py script.
- *
- * 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 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,
- * 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.
- */
-"""
-
-
-# Wraps conditional with ENABLE() and replace '&','|' with '&&','||' if more than one conditional is specified.
-def formatConditional(conditional):
-    def wrapWithEnable(s):
-        if re.match('[|&]$', s):
-            return s * 2
-        return 'ENABLE(' + s + ')'
-    return ' '.join(map(wrapWithEnable, conditional))
-
-
-# Find the conditional interface attribute.
-def extractConditional(idlFilePath):
-    conditional = None
-
-    # Read file and look for "interface [ Conditional=XXX ]".
-    idlFile = open(idlFilePath)
-    idlContents = idlFile.read().replace('\n', '')
-    idlFile.close()
-
-    match = conditionalPattern.search(idlContents)
-    if match:
-        conditional = match.group(1)
-        conditional = re.split('([|&])', conditional)
-
-    return conditional
-
-# Extracts conditional and interface name from each IDL file.
-def extractMetaData(filePaths):
-    metaDataList = []
-
-    for f in filePaths:
-        metaData = {}
-        if len(f) == 0:
-            continue
-        if not os.path.exists(f):
-            print 'WARNING: file not found: "%s"' % f
-            continue
-
-        # Extract type name from file name
-        (parentPath, fileName) = os.path.split(f)
-        (interfaceName, ext) = os.path.splitext(fileName)
-
-        if not ext == '.idl':
-            continue
-
-        metaData = {
-            'conditional': extractConditional(f),
-            'name': interfaceName,
-        }
-
-        metaDataList.append(metaData)
-
-    return metaDataList
-
-
-def generateContent(filesMetaData, partition, totalPartitions):
-    # Sort files by conditionals.
-    filesMetaData.sort()
-
-    output = []
-
-    # Add fixed content.
-    output.append(copyrightTemplate)
-    output.append('#define NO_IMPLICIT_ATOMICSTRING\n\n')
-
-    # List all includes segmented by if and endif.
-    prevConditional = None
-    for metaData in filesMetaData:
-        name = metaData['name']
-        if (hash(name) % totalPartitions) != partition:
-            continue
-        conditional = metaData['conditional']
-
-        if prevConditional and prevConditional != conditional:
-            output.append('#endif\n')
-        if conditional and prevConditional != conditional:
-            output.append('\n#if %s\n' % formatConditional(conditional))
-
-        output.append('#include "bindings/V8%s.cpp"\n' % name)
-
-        prevConditional = conditional
-
-    if prevConditional:
-        output.append('#endif\n')
-
-    return ''.join(output)
-
-
-def writeContent(content, outputFileName):
-    (parentPath, fileName) = os.path.split(outputFileName)
-    if not os.path.exists(parentPath):
-        print parentPath
-        os.mkdir(parentPath)
-    f = open(outputFileName, 'w')
-    f.write(content)
-    f.close()
-
-
-def resolveCygpath(cygdriveNames):
-    cmd = ['cygpath', '-f', '-', '-wa']
-    process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    idlFileNames = []
-    for fileName in cygdriveNames:
-        process.stdin.write("%s\n" % fileName)
-        process.stdin.flush()
-        idlFileNames.append(process.stdout.readline().rstrip())
-    process.stdin.close()
-    process.wait()
-    return idlFileNames
-
-
-def main(args):
-    assert(len(args) > 3)
-    inOutBreakIndex = args.index('--')
-    inputFileName = args[1]
-    outputFileNames = args[inOutBreakIndex+1:]
-
-    inputFile = open(inputFileName, 'r')
-    idlFileNames = []
-    cygdriveNames = []
-    for line in inputFile:
-        idlFileName = line.rstrip().split(' ')[0]
-        if idlFileName.startswith("/cygdrive"):
-            cygdriveNames.append(idlFileName)
-        else:
-            idlFileNames.append(idlFileName)
-
-    if cygdriveNames:
-        idlFileNames.extend(resolveCygpath(cygdriveNames))
-    inputFile.close()
-
-    filesMetaData = extractMetaData(idlFileNames)
-    for fileName in outputFileNames:
-        partition = outputFileNames.index(fileName)
-        fileContents = generateContent(filesMetaData, partition, len(outputFileNames))
-        writeContent(fileContents, fileName)
-
-    return 0
-
-
-if __name__ == '__main__':
-    sys.exit(main(sys.argv))
diff --git a/Source/core/scripts/action_makenames.py b/Source/core/scripts/action_makenames.py
deleted file mode 100644
index 7687a81..0000000
--- a/Source/core/scripts/action_makenames.py
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/usr/bin/python
-#
-# 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
-# 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.
-#
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# action_makenames.py is a harness script to connect actions sections of
-# gyp-based builds to make_names.pl.
-#
-# usage: action_makenames.py OUTPUTS -- INPUTS [-- OPTIONS]
-#
-# Multiple OUTPUTS, INPUTS, and OPTIONS may be listed. The sections are
-# separated by -- arguments.
-#
-# The directory name of the first output is chosen as the directory in which
-# make_names will run. If the directory name for any subsequent output is
-# different, those files will be moved to the desired directory.
-#
-# Multiple INPUTS may be listed. An input with a basename matching
-# "make_names.pl" is taken as the path to that script. Inputs with names
-# ending in TagNames.in or tags.in are taken as tag inputs. Inputs with names
-# ending in AttributeNames.in or attrs.in are taken as attribute inputs. There
-# may be at most one tag input and one attribute input. A make_names.pl input
-# is required and at least one tag or attribute input must be present.
-#
-# OPTIONS is a list of additional options to pass to make_names.pl. This
-# section need not be present.
-
-
-import os
-import posixpath
-import shutil
-import subprocess
-import sys
-
-
-def SplitArgsIntoSections(args):
-    sections = []
-    while len(args) > 0:
-        if not '--' in args:
-            # If there is no '--' left, everything remaining is an entire section.
-            dashes = len(args)
-        else:
-            dashes = args.index('--')
-
-        sections.append(args[:dashes])
-
-        # Next time through the loop, look at everything after this '--'.
-        if dashes + 1 == len(args):
-            # If the '--' is at the end of the list, we won't come back through the
-            # loop again. Add an empty section now corresponding to the nothingness
-            # following the final '--'.
-            args = []
-            sections.append(args)
-        else:
-            args = args[dashes + 1:]
-
-    return sections
-
-
-def main(args):
-    sections = SplitArgsIntoSections(args[1:])
-    assert len(sections) == 2 or len(sections) == 3
-    (outputs, inputs) = sections[:2]
-    if len(sections) == 3:
-        options = sections[2]
-    else:
-        options = []
-
-    # Make all output pathnames absolute so that they can be accessed after
-    # changing directory.
-    for index in xrange(0, len(outputs)):
-        outputs[index] = os.path.abspath(outputs[index])
-
-    outputDir = os.path.dirname(outputs[0])
-
-    # Look at the inputs and figure out which ones are make_names.pl, tags, and
-    # attributes. There can be at most one of each, and those are the only
-    # input types supported. make_names.pl is required and at least one of tags
-    # and attributes is required.
-    makeNamesInput = None
-    tagInput = None
-    attrInput = None
-    eventsInput = None
-    for input in inputs:
-        # Make input pathnames absolute so they can be accessed after changing
-        # directory. On Windows, convert \ to / for inputs to the perl script to
-        # work around the intermix of activepython + cygwin perl.
-        inputAbs = os.path.abspath(input)
-        inputAbsPosix = inputAbs.replace(os.path.sep, posixpath.sep)
-        inputBasename = os.path.basename(input)
-        if inputBasename in ('make_names.pl', 'make_event_factory.pl', 'make_dom_exceptions.pl', 'make_settings.pl'):
-            assert makeNamesInput == None
-            makeNamesInput = inputAbs
-        elif inputBasename.endswith('TagNames.in'):
-            assert tagInput == None
-            tagInput = inputAbsPosix
-        elif inputBasename.endswith('AttributeNames.in') or inputBasename.endswith('attrs.in'):
-            assert attrInput == None
-            attrInput = inputAbsPosix
-        elif (inputBasename.endswith('EventTargetFactory.in') or inputBasename.endswith('EventNames.in')
-            or inputBasename.endswith('DOMExceptions.in') or inputBasename.endswith('Settings.in')):
-            eventsInput = inputAbsPosix
-        elif inputBasename.endswith('Names.in'):
-            options.append(inputAbsPosix)
-        elif inputBasename.endswith('.pm'):
-            continue
-        else:
-            assert False
-
-    assert makeNamesInput != None
-    assert tagInput != None or attrInput != None or eventsInput != None or ('--fonts' in options) or ('--resourceTypes' in options)
-
-    # scriptsPath is a Perl include directory, located relative to
-    # makeNamesInput.
-    scriptsPath = os.path.normpath(
-        os.path.join(os.path.dirname(makeNamesInput), os.pardir, 'scripts'))
-
-    # Change to the output directory because make_names.pl puts output in its
-    # working directory.
-    os.chdir(outputDir)
-
-    # Build up the command.
-    command = ['perl', '-I', scriptsPath, makeNamesInput]
-    if tagInput != None:
-        command.extend(['--tags', tagInput])
-    if attrInput != None:
-        command.extend(['--attrs', attrInput])
-    if eventsInput != None:
-        command.extend(['--input', eventsInput])
-    command.extend(options)
-
-    # Do it. check_call is new in 2.5, so simulate its behavior with call and
-    # assert.
-    returnCode = subprocess.call(command)
-    assert returnCode == 0
-
-    # Go through the outputs. Any output that belongs in a different directory
-    # is moved. Do a copy and delete instead of rename for maximum portability.
-    # Note that all paths used in this section are still absolute.
-    for output in outputs:
-        thisOutputDir = os.path.dirname(output)
-        if thisOutputDir != outputDir:
-            outputBasename = os.path.basename(output)
-            src = os.path.join(outputDir, outputBasename)
-            dst = os.path.join(thisOutputDir, outputBasename)
-            shutil.copyfile(src, dst)
-            os.unlink(src)
-
-    return returnCode
-
-
-if __name__ == '__main__':
-    sys.exit(main(sys.argv))
diff --git a/Source/core/scripts/action_useragentstylesheets.py b/Source/core/scripts/action_useragentstylesheets.py
deleted file mode 100644
index c0712b3..0000000
--- a/Source/core/scripts/action_useragentstylesheets.py
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/usr/bin/python
-#
-# 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
-# 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.
-#
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# usage:
-# action_useragentstylesheets.py OUTPUTS INPUTS -- MAINSCRIPT MODULES -- OPTIONS
-#
-# OUTPUTS must contain two items, in order: a path to UserAgentStyleSheets.h
-# and a path to UserAgentStyleSheetsData.cpp.
-# INPUTS contains one or more CSS files.
-#
-# MAINSCRIPT is the path to make-css-file-arrays.pl. MODULES may contain
-# multiple paths to additional perl modules.
-#
-# OPTIONS are passed as-is to MAINSCRIPT as additional arguments.
-
-
-import os
-import shlex
-import subprocess
-import sys
-
-
-def SplitArgsIntoSections(args):
-    sections = []
-    while len(args) > 0:
-        if not '--' in args:
-            # If there is no '--' left, everything remaining is an entire section.
-            dashes = len(args)
-        else:
-            dashes = args.index('--')
-
-        sections.append(args[:dashes])
-
-        # Next time through the loop, look at everything after this '--'.
-        if dashes + 1 == len(args):
-            # If the '--' is at the end of the list, we won't come back through the
-            # loop again. Add an empty section now corresponding to the nothingness
-            # following the final '--'.
-            args = []
-            sections.append(args)
-        else:
-            args = args[dashes + 1:]
-
-    return sections
-
-
-def main(args):
-    sections = SplitArgsIntoSections(args[1:])
-    assert len(sections) == 3
-    (outputsInputs, scripts, options) = sections
-
-    assert len(outputsInputs) >= 3
-    outputH = outputsInputs[0]
-    outputCpp = outputsInputs[1]
-    styleSheets = outputsInputs[2:]
-
-    assert len(scripts) >= 1
-    makeCssFileArrays = scripts[0]
-    perlModules = scripts[1:]
-
-    includeDirs = []
-    for perlModule in perlModules:
-        includeDir = os.path.dirname(perlModule)
-        if not includeDir in includeDirs:
-            includeDirs.append(includeDir)
-
-    # The defines come in as one flat string. Split it up into distinct arguments.
-    if '--defines' in options:
-        definesIndex = options.index('--defines')
-        if definesIndex + 1 < len(options):
-            splitOptions = shlex.split(options[definesIndex + 1])
-            if splitOptions:
-                options[definesIndex + 1] = ' '.join(splitOptions)
-
-    # Build up the command.
-    command = ['perl']
-    for includeDir in includeDirs:
-        command.extend(['-I', includeDir])
-    command.append(makeCssFileArrays)
-    command.extend(options)
-    command.extend([outputH, outputCpp])
-    command.extend(styleSheets)
-
-    # Do it. check_call is new in 2.5, so simulate its behavior with call and
-    # assert.
-    returnCode = subprocess.call(command)
-    assert returnCode == 0
-
-    return returnCode
-
-
-if __name__ == '__main__':
-    sys.exit(main(sys.argv))
diff --git a/Source/core/scripts/check_objc_rename.sh b/Source/core/scripts/check_objc_rename.sh
deleted file mode 100755
index 5a5176e..0000000
--- a/Source/core/scripts/check_objc_rename.sh
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2011 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-#     * 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.
-#
-
-# This script checks a WebCore static library for potential Objective-C
-# class name collisions with the system's copy of the WebCore framework.
-# See the postbuild action that calls it from ../WebCore.gyp for details.
-
-set -e
-set -o pipefail
-
-if [[ $# -ne 2 ]]; then
-  echo "usage: ${0} class_whitelist_pattern category_whitelist_pattern" >& 2
-  exit 1
-fi
-
-lib="${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}"
-nm_pattern='[atsATS] ([+-]\[|\.objc_class_name_)'
-
-class_whitelist_pattern="${1}"
-category_whitelist_pattern="${2}"
-
-# Send nm's stderr in the pipeline to /dev/null to avoid spewing
-# "nm: no name list" messages. This means that if the pipelined nm fails, there
-# won't be any output, so if the entire assignment fails, run nm again to get
-# some output.
-violators=$(nm -p "${lib}" 2> /dev/null | \
-    (grep -E "${nm_pattern}" || true) | \
-    (grep -Ev "${nm_pattern}(${class_whitelist_pattern})" || true) | \
-    (grep -Ev "\((${category_whitelist_pattern})\)" || true)) || nm -p "${lib}"
-
-if [[ -z "${violators}" ]]; then
-  # An empty list means that everything's clean.
-  exit 0
-fi
-
-cat << __EOF__ >&2
-These Objective-C symbols may clash with those provided by the system's own
-WebCore framework:
-${violators}
-
-These symbols were found in:
-${lib}
-
-This should be corrected by adding the appropriate definitions to
-$(dirname ${0})/../WebCore.gyp
-or by updating the whitelist in
-${0}
-__EOF__
-
-exit 1
diff --git a/Source/core/scripts/in_file.py b/Source/core/scripts/in_file.py
deleted file mode 100644
index d8d8235..0000000
--- a/Source/core/scripts/in_file.py
+++ /dev/null
@@ -1,160 +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.
-
-import copy
-import os
-
-# NOTE: This has only been used to parse
-# core/page/RuntimeEnabledFeatures.in and may not be capable
-# of parsing other .in files correctly.
-
-# .in file format is:
-# // comment
-# name1 arg=value, arg2=value2, arg2=value3
-#
-# InFile must be passed a dictionary of default values
-# with which to validate arguments against known names.
-# Sequence types as default values will produce sequences
-# as parse results.
-# Bare arguments (no '=') are treated as names with value True.
-# The first field will always be labeled 'name'.
-#
-# InFile.load_from_files(['file.in'], {'arg': None, 'arg2': []})
-#
-# Parsing produces an array of dictionaries:
-# [ { 'name' : 'name1', 'arg' :' value', arg2=['value2', 'value3'] }
-
-def _is_comment(line):
-    return line.startswith("//") or line.startswith("#")
-
-class InFile(object):
-    def __init__(self, lines, defaults, valid_values=None, default_parameters=None):
-        self.name_dictionaries = []
-        self.parameters = copy.deepcopy(default_parameters if default_parameters else {})
-        self._defaults = defaults
-        self._valid_values = copy.deepcopy(valid_values if valid_values else {})
-        self._parse(map(str.strip, lines))
-
-    @classmethod
-    def load_from_files(self, file_paths, defaults, valid_values, default_parameters):
-        lines = []
-        for path in file_paths:
-            with open(os.path.abspath(path)) as in_file:
-                lines += in_file.readlines()
-        return InFile(lines, defaults, valid_values, default_parameters)
-
-    def _is_sequence(self, arg):
-        return (not hasattr(arg, "strip")
-                and hasattr(arg, "__getitem__")
-                or hasattr(arg, "__iter__"))
-
-    def _parse(self, lines):
-        parsing_parameters = True
-        indices = {}
-        for line in lines:
-            if _is_comment(line):
-                continue
-            if not line:
-                parsing_parameters = False
-                continue
-            if parsing_parameters:
-                self._parse_parameter(line)
-            else:
-                entry = self._parse_line(line)
-                name = entry['name']
-                if name in indices:
-                    entry = self._merge_entries(entry, self.name_dictionaries[indices[name]])
-                    entry['name'] = name
-                    self.name_dictionaries[indices[name]] = entry
-                else:
-                    indices[name] = len(self.name_dictionaries)
-                    self.name_dictionaries.append(entry)
-
-
-    def _merge_entries(self, one, two):
-        merged = {}
-        for key in one:
-            if key not in two:
-                self._fatal("Expected key '%s' not found in entry: %s" % (key, two))
-            if one[key] and two[key]:
-                val_one = one[key]
-                val_two = two[key]
-                if isinstance(val_one, list) and isinstance(val_two, list):
-                    val = val_one + val_two
-                elif isinstance(val_one, list):
-                    val = val_one + [val_two]
-                elif isinstance(val_two, list):
-                    val = [val_one] + val_two
-                else:
-                    val = [val_one, val_two]
-                merged[key] = val
-            elif one[key]:
-                merged[key] = one[key]
-            else:
-                merged[key] = two[key]
-        return merged
-
-
-    def _parse_parameter(self, line):
-        if '=' in line:
-            name, value = line.split('=')
-        else:
-            name, value = line, True
-        if not name in self.parameters:
-            self._fatal("Unknown parameter: '%s' in line:\n%s\nKnown parameters: %s" % (name, line, self.parameters.keys()))
-        self.parameters[name] = value
-
-    def _parse_line(self, line):
-        args = copy.deepcopy(self._defaults)
-        parts = line.split(' ')
-        args['name'] = parts[0]
-        # re-join the rest of the line and split on ','
-        args_list = ' '.join(parts[1:]).strip().split(',')
-        for arg_string in args_list:
-            arg_string = arg_string.strip()
-            if not arg_string: # Ignore empty args
-                continue
-            if '=' in arg_string:
-                arg_name, arg_value = arg_string.split('=')
-            else:
-                arg_name, arg_value = arg_string, True
-            if arg_name not in self._defaults:
-                self._fatal("Unknown argument: '%s' in line:\n%s\nKnown arguments: %s" % (arg_name, line, self._defaults.keys()))
-            valid_values = self._valid_values.get(arg_name)
-            if valid_values and arg_value not in valid_values:
-                self._fatal("Unknown value: '%s' in line:\n%s\nKnown values: %s" % (arg_value, line, valid_values))
-            if self._is_sequence(args[arg_name]):
-                args[arg_name].append(arg_value)
-            else:
-                args[arg_name] = arg_value
-        return args
-
-    def _fatal(self, message):
-        # FIXME: This should probably raise instead of exit(1)
-        print message
-        exit(1)
diff --git a/Source/core/scripts/in_file_unittest.py b/Source/core/scripts/in_file_unittest.py
deleted file mode 100644
index e065d44..0000000
--- a/Source/core/scripts/in_file_unittest.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-# 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 unittest
-
-from in_file import InFile
-
-class InFileTest(unittest.TestCase):
-    def test_basic_parse(self):
-        contents = """
-name1 arg=value, arg2=value2, arg2=value3
-name2
-"""
-        lines = contents.split("\n")
-        defaults = {
-            'arg': None,
-            'arg2': [],
-        }
-        in_file = InFile(lines, defaults, None)
-        expected_values = [
-            {'name': 'name1', 'arg': 'value', 'arg2': ['value2', 'value3']},
-            {'name': 'name2', 'arg': None, 'arg2': []},
-        ]
-        self.assertEquals(in_file.name_dictionaries, expected_values)
-
-    def test_with_parameters(self):
-        contents = """namespace=TestNamespace
-fruit
-
-name1 arg=value, arg2=value2, arg2=value3
-name2
-"""
-        lines = contents.split("\n")
-        defaults = {
-            'arg': None,
-            'arg2': [],
-        }
-        default_parameters = {
-            'namespace': '',
-            'fruit': False,
-        }
-        in_file = InFile(lines, defaults, default_parameters)
-        expected_parameters = {
-            'namespace': 'TestNamespace',
-            'fruit': True,
-        }
-        self.assertEquals(in_file.parameters, expected_parameters)
-
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/Source/core/scripts/in_generator.py b/Source/core/scripts/in_generator.py
deleted file mode 100644
index b02d6e6..0000000
--- a/Source/core/scripts/in_generator.py
+++ /dev/null
@@ -1,119 +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.
-
-import os.path
-import shlex
-import shutil
-import optparse
-
-from in_file import InFile
-
-
-class Writer(object):
-    # Subclasses should override.
-    class_name = None
-    defaults = None
-    valid_values = None
-    default_parameters = None
-
-    def __init__(self, in_files, enabled_conditions):
-        if isinstance(in_files, basestring):
-            in_files = [in_files]
-        self.in_file = InFile.load_from_files(in_files, self.defaults, self.valid_values, self.default_parameters)
-        self._enabled_conditions = enabled_conditions
-        self._outputs = {}  # file_name -> generator
-
-    def wrap_with_condition(self, string, condition):
-        if not condition:
-            return string
-        return "#if ENABLE(%(condition)s)\n%(string)s\n#endif" % { 'condition' : condition, 'string' : string }
-
-    def _forcibly_create_text_file_at_path_with_contents(self, file_path, contents):
-        # FIXME: This method can be made less force-full anytime after 6/1/2013.
-        # A gyp error was briefly checked into the tree, causing
-        # a directory to have been generated in place of one of
-        # our output files.  Clean up after that error so that
-        # all users don't need to clobber their output directories.
-        shutil.rmtree(file_path, ignore_errors=True)
-        # The build system should ensure our output directory exists, but just in case.
-        directory = os.path.dirname(file_path)
-        if not os.path.exists(directory):
-            os.makedirs(directory)
-
-        with open(file_path, "w") as file_to_write:
-            file_to_write.write(contents)
-
-    def _write_file(self, output_dir, contents, file_name):
-        path = os.path.join(output_dir, file_name)
-        self._forcibly_create_text_file_at_path_with_contents(path, contents)
-
-    def write_files(self, output_dir):
-        for file_name, generator in self._outputs.items():
-            self._write_file(output_dir, generator(), file_name)
-
-
-class Maker(object):
-    def __init__(self, writer_class):
-        self._writer_class = writer_class
-
-    def _enabled_conditions_from_defines(self, defines_arg_string):
-        if not defines_arg_string:
-            return []
-
-        defines_strings = shlex.split(defines_arg_string)
-
-        # We only care about feature defines.
-        enable_prefix = 'ENABLE_'
-
-        enabled_conditions = []
-        for define_string in defines_strings:
-            split_define = define_string.split('=')
-            if split_define[1] != '1':
-                continue
-            define = split_define[0]
-            if not define.startswith(enable_prefix):
-                continue
-            enabled_conditions.append(define[len(enable_prefix):])
-        return enabled_conditions
-
-    def main(self, argv):
-        script_name = os.path.basename(argv[0])
-        args = argv[1:]
-        if len(args) < 1:
-            print "USAGE: %i INPUT_FILES" % script_name
-            exit(1)
-
-        parser = optparse.OptionParser()
-        parser.add_option("--defines")
-        parser.add_option("--output_dir", default=os.getcwd())
-        (options, args) = parser.parse_args()
-
-        enabled_conditions = self._enabled_conditions_from_defines(options.defines)
-
-        writer = self._writer_class(args, enabled_conditions)
-        writer.write_files(options.output_dir)
diff --git a/Source/core/scripts/license.py b/Source/core/scripts/license.py
deleted file mode 100644
index 32da980..0000000
--- a/Source/core/scripts/license.py
+++ /dev/null
@@ -1,62 +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.
-
-# FIXME: We should either not use license blocks in generated files
-# or we should read this from some central license file.
-
-def license_for_generated_cpp():
-    return """/*
- * 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.
- */
-"""
diff --git a/Source/core/scripts/list_idl_files_with_partial_interface.py b/Source/core/scripts/list_idl_files_with_partial_interface.py
deleted file mode 100644
index edebc51..0000000
--- a/Source/core/scripts/list_idl_files_with_partial_interface.py
+++ /dev/null
@@ -1,44 +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.
-
-"""This file returns a list of all the IDL files that contain a partial interface."""
-
-import re
-import sys
-
-partial_interface_regex = re.compile(r'partial\s+interface\s+(\w+).+\]', re.M | re.S)
-
-
-def DoMain(filenames):
-    partial_files = set()
-    for filename in filenames:
-        with open(filename) as f:
-            match = re.search(partial_interface_regex, f.read())
-            if match:
-                partial_files.add(filename)
-    return '\n'.join(partial_files)
diff --git a/Source/core/scripts/make-file-arrays.py b/Source/core/scripts/make-file-arrays.py
deleted file mode 100755
index 68af2ae..0000000
--- a/Source/core/scripts/make-file-arrays.py
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/usr/bin/env python
-# 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:
-#
-#     * 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.
-
-# Usage: make-file-arrays.py [--condition=condition-string] --out-h=<header-file-name> --out-cpp=<cpp-file-name> <input-file>...
-
-import os.path
-import re
-import sys
-from optparse import OptionParser
-
-
-def make_variable_name_and_read(file_name):
-    result = re.match(r"([\w\d_]+)\.([\w\d_]+)", os.path.basename(file_name))
-    if not result:
-        print "Invalid input file name:", os.path.basename(file_name)
-        sys.exit(1)
-    variable_name = result.group(1)[0].lower() + result.group(1)[1:] + result.group(2).capitalize()
-    file = open(file_name, "rb")
-    content = file.read()
-    file.close()
-    return (variable_name, content)
-
-
-def strip_whitespace_and_comments(file_name, content):
-    result = re.match(r".*\.([^.]+)", file_name)
-    if not result:
-        print "The file name has no extension:", file_name
-        sys.exit(1)
-    extension = result.group(1).lower()
-    multi_line_comment = re.compile(r"/\*.*?\*/", re.MULTILINE | re.DOTALL)
-    single_line_comment = re.compile(r"//.*$", re.MULTILINE)
-    repeating_space = re.compile(r"[ \t]+", re.MULTILINE)
-    leading_space = re.compile(r"^[ \t]+", re.MULTILINE)
-    trailing_space = re.compile(r"[ \t]+$", re.MULTILINE)
-    empty_line = re.compile(r"\n+")
-    if extension == "js":
-        content = multi_line_comment.sub("", content)
-        content = single_line_comment.sub("", content)
-        content = repeating_space.sub(" ", content)
-        content = leading_space.sub("", content)
-        content = trailing_space.sub("", content)
-        content = empty_line.sub("\n", content)
-    elif extension == "css":
-        content = multi_line_comment.sub("", content)
-        content = repeating_space.sub(" ", content)
-        content = leading_space.sub("", content)
-        content = trailing_space.sub("", content)
-        content = empty_line.sub("\n", content)
-    return content
-
-
-def main():
-    parser = OptionParser()
-    parser.add_option("--out-h", dest="out_header")
-    parser.add_option("--out-cpp", dest="out_cpp")
-    parser.add_option("--condition", dest="flag")
-    (options, args) = parser.parse_args()
-    if len(args) < 1:
-        parser.error("Need one or more input files")
-    if not options.out_header:
-        parser.error("Need to specify --out-h=filename")
-    if not options.out_cpp:
-        parser.error("Need to specify --out-cpp=filename")
-
-    if options.flag:
-        options.flag = options.flag.replace(" AND ", " && ")
-        options.flag = options.flag.replace(" OR ", " || ")
-
-    header_file = open(options.out_header, "w")
-    if options.flag:
-        header_file.write("#if " + options.flag + "\n")
-    header_file.write("namespace WebCore {\n")
-
-    cpp_file = open(options.out_cpp, "w")
-    cpp_file.write("#include \"config.h\"\n")
-    cpp_file.write("#include \"" + os.path.basename(options.out_header) + "\"\n")
-    if options.flag:
-        cpp_file.write("#if " + options.flag + "\n")
-    cpp_file.write("namespace WebCore {\n")
-
-    for file_name in args:
-        (variable_name, content) = make_variable_name_and_read(file_name)
-        content = strip_whitespace_and_comments(file_name, content)
-        size = len(content)
-        header_file.write("extern const char %s[%d];\n" % (variable_name, size))
-        cpp_file.write("const char %s[%d] = {\n" % (variable_name, size))
-        for index in range(size):
-            char_code = ord(content[index])
-            if char_code < 128:
-                cpp_file.write("%d" % char_code)
-            else:
-                cpp_file.write("'\\x%02x'" % char_code)
-            cpp_file.write("," if index != len(content) - 1 else "};\n")
-            if index % 20 == 19:
-                cpp_file.write("\n")
-        cpp_file.write("\n")
-
-    header_file.write("}\n")
-    if options.flag:
-        header_file.write("#endif\n")
-    header_file.close()
-
-    cpp_file.write("}\n")
-    if options.flag:
-        cpp_file.write("#endif\n")
-    cpp_file.close()
-
-
-if __name__ == "__main__":
-    main()
diff --git a/Source/core/scripts/make-hash-tools.pl b/Source/core/scripts/make-hash-tools.pl
deleted file mode 100644
index 5f77d2b..0000000
--- a/Source/core/scripts/make-hash-tools.pl
+++ /dev/null
@@ -1,44 +0,0 @@
-#! /usr/bin/perl
-#
-#   This file is part of the WebKit project
-#
-#   Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged
-#   Copyright (C) 2012 Apple Inc. 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
-#   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
-#   Library General Public License for more details.
-#
-#   You should have received a copy of the GNU Library General Public License
-#   along with this library; see the file COPYING.LIB.  If not, write to
-#   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-#   Boston, MA 02110-1301, USA.
-
-use strict;
-use File::Basename;
-
-my $outdir = $ARGV[0];
-shift;
-my $option = basename($ARGV[0],".gperf");
-
-if ($option eq "ColorData") {
-    my $colorDataGenerated         = "$outdir/ColorData.cpp";
-    my $colorDataGperf             = shift;
-    my $customGperf                = shift;
-
-    # gperf emits this filename literally in #line directives, but VS errors
-    # out because the filenames then contain unescaped \s, so replace the \
-    # with /.
-    $colorDataGperf =~ s/\\/\//g;
-    my $gperf = $ENV{GPERF} ? $ENV{GPERF} : ($customGperf ? $customGperf : "gperf");
-    system("\"$gperf\" --key-positions=\"*\" -D -s 2 $colorDataGperf --output-file=$colorDataGenerated") == 0 || die "calling gperf failed: $?";
-
-} else {
-    die "Unknown option.";
-}
diff --git a/Source/core/scripts/make_css_property_names.py b/Source/core/scripts/make_css_property_names.py
deleted file mode 100755
index ab137e9..0000000
--- a/Source/core/scripts/make_css_property_names.py
+++ /dev/null
@@ -1,257 +0,0 @@
-#!/usr/bin/env python
-
-import os.path
-import re
-import subprocess
-import sys
-
-from in_file import InFile
-import in_generator
-import license
-
-
-HEADER_TEMPLATE = """
-%(license)s
-
-#ifndef %(class_name)s_h
-#define %(class_name)s_h
-
-#include "core/css/CSSParserMode.h"
-#include "wtf/HashFunctions.h"
-#include "wtf/HashTraits.h"
-#include <string.h>
-
-namespace WTF {
-class AtomicString;
-class String;
-}
-
-namespace WebCore {
-
-enum CSSPropertyID {
-    CSSPropertyInvalid = 0,
-    CSSPropertyVariable = 1,
-%(property_enums)s
-};
-
-const int firstCSSProperty = %(first_property_id)s;
-const int numCSSProperties = %(properties_count)s;
-const int lastCSSProperty = %(last_property_id)d;
-const size_t maxCSSPropertyNameLength = %(max_name_length)d;
-
-const char* getPropertyName(CSSPropertyID);
-const WTF::AtomicString& getPropertyNameAtomicString(CSSPropertyID);
-WTF::String getPropertyNameString(CSSPropertyID);
-WTF::String getJSPropertyName(CSSPropertyID);
-bool isInternalProperty(CSSPropertyID id);
-
-inline CSSPropertyID convertToCSSPropertyID(int value)
-{
-    ASSERT((value >= firstCSSProperty && value <= lastCSSProperty) || value == CSSPropertyInvalid);
-    return static_cast<CSSPropertyID>(value);
-}
-
-} // namespace WebCore
-
-namespace WTF {
-template<> struct DefaultHash<WebCore::CSSPropertyID> { typedef IntHash<unsigned> Hash; };
-template<> struct HashTraits<WebCore::CSSPropertyID> : GenericHashTraits<WebCore::CSSPropertyID> {
-    static const bool emptyValueIsZero = true;
-    static const bool needsDestruction = false;
-    static void constructDeletedValue(WebCore::CSSPropertyID& slot) { slot = static_cast<WebCore::CSSPropertyID>(WebCore::lastCSSProperty + 1); }
-    static bool isDeletedValue(WebCore::CSSPropertyID value) { return value == (WebCore::lastCSSProperty + 1); }
-};
-}
-
-#endif // %(class_name)s_h
-"""
-
-GPERF_TEMPLATE = """
-%%{
-%(license)s
-
-#include "config.h"
-#include "%(class_name)s.h"
-#include "core/platform/HashTools.h"
-#include <string.h>
-
-#include "wtf/ASCIICType.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-static const char propertyNameStringsPool[] = {
-%(property_name_strings)s
-};
-
-static const unsigned short propertyNameStringsOffsets[] = {
-%(property_name_offsets)s
-};
-
-%%}
-%%struct-type
-struct Property;
-%%omit-struct-type
-%%language=C++
-%%readonly-tables
-%%global-table
-%%compare-strncmp
-%%define class-name %(class_name)sHash
-%%define lookup-function-name findPropertyImpl
-%%define hash-function-name propery_hash_function
-%%define slot-name nameOffset
-%%define word-array-name property_wordlist
-%%enum
-%%%%
-%(property_to_enum_map)s
-%%%%
-const Property* findProperty(register const char* str, register unsigned int len)
-{
-    return %(class_name)sHash::findPropertyImpl(str, len);
-}
-
-const char* getPropertyName(CSSPropertyID id)
-{
-    if (id < firstCSSProperty)
-        return 0;
-    int index = id - firstCSSProperty;
-    if (index >= numCSSProperties)
-        return 0;
-    return propertyNameStringsPool + propertyNameStringsOffsets[index];
-}
-
-const AtomicString& getPropertyNameAtomicString(CSSPropertyID id)
-{
-    if (id < firstCSSProperty)
-        return nullAtom;
-    int index = id - firstCSSProperty;
-    if (index >= numCSSProperties)
-        return nullAtom;
-
-    static AtomicString* propertyStrings = new AtomicString[numCSSProperties]; // Intentionally never destroyed.
-    AtomicString& propertyString = propertyStrings[index];
-    if (propertyString.isNull()) {
-        const char* propertyName = propertyNameStringsPool + propertyNameStringsOffsets[index];
-        propertyString = AtomicString(propertyName, strlen(propertyName), AtomicString::ConstructFromLiteral);
-    }
-    return propertyString;
-}
-
-String getPropertyNameString(CSSPropertyID id)
-{
-    // We share the StringImpl with the AtomicStrings.
-    return getPropertyNameAtomicString(id).string();
-}
-
-String getJSPropertyName(CSSPropertyID id)
-{
-    char result[maxCSSPropertyNameLength + 1];
-    const char* cssPropertyName = getPropertyName(id);
-    const char* propertyNamePointer = cssPropertyName;
-    if (!propertyNamePointer)
-        return emptyString();
-
-    char* resultPointer = result;
-    while (char character = *propertyNamePointer++) {
-        if (character == '-') {
-            char nextCharacter = *propertyNamePointer++;
-            if (!nextCharacter)
-                break;
-            character = (propertyNamePointer - 2 != cssPropertyName) ? toASCIIUpper(nextCharacter) : nextCharacter;
-        }
-        *resultPointer++ = character;
-    }
-    *resultPointer = '\\0';
-    return String(result);
-}
-
-bool isInternalProperty(CSSPropertyID id)
-{
-    switch (id) {
-        %(internal_properties)s
-            return true;
-        default:
-            return false;
-    }
-}
-
-} // namespace WebCore
-"""
-
-
-class CSSPropertiesWriter(in_generator.Writer):
-    class_name = "CSSPropertyNames"
-    defaults = {
-        'alias_for': None,
-        'condition': None,
-        'is_internal': False,
-    }
-
-    def __init__(self, file_paths, enabled_conditions):
-        in_generator.Writer.__init__(self, file_paths, enabled_conditions)
-        self._outputs = {(self.class_name + ".h"): self.generate_header,
-                         (self.class_name + ".cpp"): self.generate_implementation,
-                        }
-
-        all_properties = self.in_file.name_dictionaries
-        self._aliases = filter(lambda property: property['alias_for'], all_properties)
-        for offset, property in enumerate(self._aliases):
-            # Aliases use the enum_name that they are an alias for.
-            property['enum_name'] = self._enum_name_from_property_name(property['alias_for'])
-            # Aliases do not get an enum_value.
-
-        self._properties = filter(lambda property: not property['alias_for'] and not property['condition'] or property['condition'] in self._enabled_conditions, all_properties)
-        if len(self._properties) > 1024:
-            print "ERROR : There is more than 1024 CSS Properties, you need to update CSSProperty.h/StylePropertyMetadata m_propertyID accordingly."
-            exit(1)
-        self._first_property_id = 2  # We start after CSSPropertyInvalid and CSSPropertyVariable.
-        property_id = self._first_property_id
-        for offset, property in enumerate(self._properties):
-            property['enum_name'] = self._enum_name_from_property_name(property['name'])
-            property['enum_value'] = self._first_property_id + offset
-            if property['name'].startswith('-internal-'):
-                property['is_internal'] = True
-
-    def _enum_name_from_property_name(self, property_name):
-        return "CSSProperty" + re.sub(r'(^[^-])|-(.)', lambda match: (match.group(1) or match.group(2)).upper(), property_name)
-
-    def _enum_declaration(self, property):
-        return "    %(enum_name)s = %(enum_value)s," % property
-
-    def generate_header(self):
-        return HEADER_TEMPLATE % {
-            'license': license.license_for_generated_cpp(),
-            'class_name': self.class_name,
-            'property_enums': "\n".join(map(self._enum_declaration, self._properties)),
-            'first_property_id': self._first_property_id,
-            'properties_count': len(self._properties),
-            'last_property_id': self._first_property_id + len(self._properties) - 1,
-            'max_name_length': reduce(max, map(len, map(lambda property: property['name'], self._properties))),
-        }
-
-    def _case_properties(self, property):
-        return "case %(enum_name)s:" % property
-
-    def generate_implementation(self):
-        property_offsets = []
-        current_offset = 0
-        for property in self._properties:
-            property_offsets.append(current_offset)
-            current_offset += len(property["name"]) + 1
-
-        gperf_input = GPERF_TEMPLATE % {
-            'license': license.license_for_generated_cpp(),
-            'class_name': self.class_name,
-            'property_name_strings': '\n'.join(map(lambda property: '    "%(name)s\\0"' % property, self._properties)),
-            'property_name_offsets': '\n'.join(map(lambda offset: '    %d,' % offset, property_offsets)),
-            'property_to_enum_map': '\n'.join(map(lambda property: '%(name)s, %(enum_name)s' % property, self._properties + self._aliases)),
-            'internal_properties': '\n'.join(map(self._case_properties, filter(lambda property: property['is_internal'], self._properties))),
-        }
-        # FIXME: If we could depend on Python 2.7, we would use subprocess.check_output
-        gperf_args = ['gperf', '--key-positions=*', '-P', '-D', '-n', '-s', '2']
-        gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
-        return gperf.communicate(gperf_input)[0]
-
-
-if __name__ == "__main__":
-    in_generator.Maker(CSSPropertiesWriter).main(sys.argv)
diff --git a/Source/core/scripts/make_css_value_keywords.py b/Source/core/scripts/make_css_value_keywords.py
deleted file mode 100755
index 0b5a3d6..0000000
--- a/Source/core/scripts/make_css_value_keywords.py
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/usr/bin/env python
-
-import os.path
-import re
-import subprocess
-import sys
-
-from in_file import InFile
-import in_generator
-import license
-
-
-HEADER_TEMPLATE = """
-%(license)s
-
-#ifndef %(class_name)s_h
-#define %(class_name)s_h
-
-#include "core/css/CSSParserMode.h"
-#include <string.h>
-
-namespace WebCore {
-
-enum CSSValueID {
-%(value_keyword_enums)s
-};
-
-const int numCSSValueKeywords = %(value_keywords_count)d;
-const size_t maxCSSValueKeywordLength = %(max_value_keyword_length)d;
-
-const char* getValueName(unsigned short id);
-bool isValueAllowedInMode(unsigned short id, CSSParserMode mode);
-
-} // namespace WebCore
-
-#endif // %(class_name)s_h
-"""
-
-GPERF_TEMPLATE = """
-%%{
-%(license)s
-
-#include "config.h"
-#include "%(class_name)s.h"
-#include "core/platform/HashTools.h"
-#include <string.h>
-
-namespace WebCore {
-static const char valueListStringPool[] = {
-"\\0"
-%(value_keyword_strings)s
-};
-
-static const unsigned short valueListStringOffsets[] = {
-%(value_keyword_offsets)s
-};
-
-%%}
-%%struct-type
-struct Value;
-%%omit-struct-type
-%%language=C++
-%%readonly-tables
-%%compare-strncmp
-%%define class-name %(class_name)sHash
-%%define lookup-function-name findValueImpl
-%%define hash-function-name value_hash_function
-%%define slot-name nameOffset
-%%define word-array-name value_word_list
-%%pic
-%%enum
-%%%%
-%(value_keyword_to_enum_map)s
-%%%%
-const Value* findValue(register const char* str, register unsigned int len)
-{
-    return CSSValueKeywordsHash::findValueImpl(str, len);
-}
-
-const char* getValueName(unsigned short id)
-{
-    if (id >= numCSSValueKeywords || id <= 0)
-        return 0;
-    return valueListStringPool + valueListStringOffsets[id];
-}
-
-bool isValueAllowedInMode(unsigned short id, CSSParserMode mode)
-{
-    switch (id) {
-        %(ua_sheet_mode_values_keywords)s
-            return mode == UASheetMode;
-        %(quirks_mode_values_keywords)s
-            return mode == CSSQuirksMode;
-        %(quirks_mode_or_ua_sheet_mode_values_keywords)s
-            return mode == UASheetMode || mode == CSSQuirksMode;
-        default:
-            return true;
-    }
-}
-
-} // namespace WebCore
-"""
-
-
-class CSSValueKeywordsWriter(in_generator.Writer):
-    class_name = "CSSValueKeywords"
-    defaults = {
-        'condition': None,
-        'mode': None,
-    }
-
-    def __init__(self, file_paths, enabled_conditions):
-        in_generator.Writer.__init__(self, file_paths, enabled_conditions)
-        self._outputs = {(self.class_name + ".h"): self.generate_header,
-                         (self.class_name + ".cpp"): self.generate_implementation,
-                        }
-
-        all_properties = self.in_file.name_dictionaries
-        self._value_keywords = filter(lambda property: not property['condition'] or property['condition'] in self._enabled_conditions, all_properties)
-        first_property_id = 1
-        for offset, property in enumerate(self._value_keywords):
-            property['name'] = property['name'].lower()
-            property['enum_name'] = self._enum_name_from_value_keyword(property['name'])
-            property['enum_value'] = first_property_id + offset
-            if property['name'].startswith('-internal-'):
-                assert property['mode'] is None, 'Can\'t specify mode for value keywords with the prefix "-internal-".'
-                property['mode'] = 'UASheet'
-            else:
-                assert property['mode'] != 'UASheet', 'UASheet mode only value keywords should have the prefix "-internal-".'
-
-    def _enum_name_from_value_keyword(self, value_keyword):
-        return "CSSValue" + "".join(w.capitalize() for w in value_keyword.split("-"))
-
-    def _enum_declaration(self, property):
-        return "    %(enum_name)s = %(enum_value)s," % property
-
-    def _case_value_keyword(self, property):
-        return "case %(enum_name)s:" % property
-
-    def generate_header(self):
-        enum_enties = map(self._enum_declaration, [{'enum_name': 'CSSValueInvalid', 'enum_value': 0}] + self._value_keywords)
-        return HEADER_TEMPLATE % {
-            'license': license.license_for_generated_cpp(),
-            'class_name': self.class_name,
-            'value_keyword_enums': "\n".join(enum_enties),
-            'value_keywords_count': len(enum_enties),
-            'max_value_keyword_length': reduce(max, map(len, map(lambda property: property['name'], self._value_keywords))),
-        }
-
-    def _value_keywords_with_mode(self, mode):
-        return filter(lambda property: property['mode'] == mode, self._value_keywords)
-
-    def generate_implementation(self):
-        keyword_offsets = [0]
-        current_offset = 1
-        for keyword in self._value_keywords:
-            keyword_offsets.append(current_offset)
-            current_offset += len(keyword["name"]) + 1
-
-        gperf_input = GPERF_TEMPLATE % {
-            'license': license.license_for_generated_cpp(),
-            'class_name': self.class_name,
-            'value_keyword_strings': '\n'.join(map(lambda property: '    "%(name)s\\0"' % property, self._value_keywords)),
-            'value_keyword_offsets': '\n'.join(map(lambda offset: '  %d,' % offset, keyword_offsets)),
-            'value_keyword_to_enum_map': '\n'.join(map(lambda property: '%(name)s, %(enum_name)s' % property, self._value_keywords)),
-            'ua_sheet_mode_values_keywords': '\n        '.join(map(self._case_value_keyword, self._value_keywords_with_mode('UASheet'))),
-            'quirks_mode_values_keywords': '\n        '.join(map(self._case_value_keyword, self._value_keywords_with_mode('Quirks'))),
-            'quirks_mode_or_ua_sheet_mode_values_keywords': '\n    '.join(map(self._case_value_keyword, self._value_keywords_with_mode('QuirksOrUASheet'))),
-        }
-        # FIXME: If we could depend on Python 2.7, we would use subprocess.check_output
-        gperf_args = ['gperf', '--key-positions=*', '-D', '-n', '-s', '2']
-        gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
-        return gperf.communicate(gperf_input)[0]
-
-
-if __name__ == "__main__":
-    in_generator.Maker(CSSValueKeywordsWriter).main(sys.argv)
diff --git a/Source/core/scripts/make_event_factory.py b/Source/core/scripts/make_event_factory.py
deleted file mode 100644
index cdf2c35..0000000
--- a/Source/core/scripts/make_event_factory.py
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env python
-# 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.path
-import sys
-import shutil
-
-from in_file import InFile
-import name_macros
-from name_utilities import lower_first
-import license
-
-
-IMPLEMENTATION_TEMPLATE = """%(license)s
-#include "config.h"
-#include "core/events/%(class_name)sFactory.h"
-
-#include "%(class_name)sHeaders.h"
-#include "RuntimeEnabledFeatures.h"
-
-namespace WebCore {
-
-PassRefPtr<%(class_name)s> %(class_name)sFactory::create(const String& type)
-{
-%(factory_implementation)s
-    return 0;
-}
-
-} // namespace WebCore
-"""
-
-
-class EventFactoryWriter(name_macros.Writer):
-    defaults = {
-        'ImplementedAs': None,
-        'Conditional': None,
-        'EnabledAtRuntime': None,
-    }
-    default_parameters = {
-        'namespace': '',
-    }
-
-    def __init__(self, in_file_path, enabled_conditions):
-        super(EventFactoryWriter, self).__init__(in_file_path, enabled_conditions)
-        self._outputs[(self.class_name + ".cpp")] = self.generate_implementation
-
-    def _events(self):
-        return self.in_file.name_dictionaries
-
-    def _factory_implementation(self, event):
-        if event['EnabledAtRuntime']:
-            runtime_condition = ' && RuntimeEnabledFeatures::%s()' % lower_first(event['EnabledAtRuntime'])
-        else:
-            runtime_condition = ''
-        name = os.path.basename(event['name'])
-        class_name = self._class_name_for_entry(event)
-        implementation = """    if (type == "%(name)s"%(runtime_condition)s)
-        return %(class_name)s::create();""" % {
-            'name': name,
-            'runtime_condition': runtime_condition,
-            'class_name': class_name,
-        }
-        return self.wrap_with_condition(implementation, event['Conditional'])
-
-    def generate_implementation(self):
-        return IMPLEMENTATION_TEMPLATE % {
-            'class_name': self.class_name,
-            'license': license.license_for_generated_cpp(),
-            'factory_implementation': "\n".join(map(self._factory_implementation, self._events())),
-        }
-
-
-if __name__ == "__main__":
-    name_macros.Maker(EventFactoryWriter).main(sys.argv)
diff --git a/Source/core/scripts/make_internal_runtime_flags.py b/Source/core/scripts/make_internal_runtime_flags.py
deleted file mode 100755
index 522e00f..0000000
--- a/Source/core/scripts/make_internal_runtime_flags.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-# 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.path
-import sys
-
-import in_generator
-import make_runtime_features
-import template_expander
-
-
-# We want exactly the same parsing as RuntimeFeatureWriter
-# but generate different files.
-class InternalRuntimeFlagsWriter(make_runtime_features.RuntimeFeatureWriter):
-    class_name = "InternalRuntimeFlags"
-
-    def __init__(self, in_file_path, enabled_conditions):
-        super(InternalRuntimeFlagsWriter, self).__init__(in_file_path, enabled_conditions)
-        self._outputs = {(self.class_name + ".idl"): self.generate_idl,
-                         (self.class_name + ".h"): self.generate_header,
-                        }
-
-    @template_expander.use_jinja(class_name + ".idl.tmpl")
-    def generate_idl(self):
-        return {
-            'features': self._features,
-        }
-
-    @template_expander.use_jinja(class_name + ".h.tmpl")
-    def generate_header(self):
-        return {
-            'features': self._features,
-            'feature_sets': self._feature_sets(),
-        }
-
-
-if __name__ == "__main__":
-    in_generator.Maker(InternalRuntimeFlagsWriter).main(sys.argv)
diff --git a/Source/core/scripts/make_names.pl b/Source/core/scripts/make_names.pl
deleted file mode 100755
index 88ea51e..0000000
--- a/Source/core/scripts/make_names.pl
+++ /dev/null
@@ -1,1292 +0,0 @@
-#!/usr/bin/perl -w
-
-# Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
-# Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org>
-# Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
-# Copyright (C) 2011 Ericsson AB. 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.
-# 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.
-#
-# 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.
-
-use strict;
-
-use StaticString;
-use Config;
-use Getopt::Long;
-use File::Path;
-use File::Spec;
-use IO::File;
-use InFilesParser;
-
-sub readTags($$);
-sub readAttrs($$);
-
-my $printFactory = 0;
-my $fontNamesIn = "";
-my $resourceTypesIn = "";
-my $tagsFile = "";
-my $attrsFile = "";
-my $outputDir = ".";
-my %parsedTags = ();
-my %parsedAttrs = ();
-my %enabledTags = ();
-my %enabledAttrs = ();
-my %allTags = ();
-my %allAttrs = ();
-my %allStrings = ();
-my %parameters = ();
-my $extraDefines = 0;
-my $initDefaults = 1;
-my %extensionAttrs = ();
-
-require Config;
-
-my $gccLocation = "";
-if ($ENV{CC}) {
-    $gccLocation = $ENV{CC};
-} elsif (($Config::Config{'osname'}) =~ /solaris/i) {
-    $gccLocation = "/usr/sfw/bin/gcc";
-} else {
-    $gccLocation = "/usr/bin/gcc";
-}
-my $preprocessor = $gccLocation . " -E -x c++";
-
-GetOptions(
-    'tags=s' => \$tagsFile,
-    'attrs=s' => \$attrsFile,
-    'factory' => \$printFactory,
-    'outputDir=s' => \$outputDir,
-    'extraDefines=s' => \$extraDefines,
-    'preprocessor=s' => \$preprocessor,
-    'fonts=s' => \$fontNamesIn,
-    'resourceTypes=s' => \$resourceTypesIn
-);
-
-mkpath($outputDir);
-
-if (length($fontNamesIn)) {
-    my $familyNamesFileBase = "FontFamily";
-    my $familyNamesPrefix = "CSS";
-    createGenericNamesFile($fontNamesIn, $familyNamesFileBase, $familyNamesPrefix);
-}
-
-if (length($resourceTypesIn)) {
-    my $baseName = "FetchInitiatorType";
-    my $basePrefix = "Loader_Cache";
-    createGenericNamesFile($resourceTypesIn, $baseName, $basePrefix);
-}
-
-die "You must specify at least one of --tags <file> or --attrs <file>" unless (length($tagsFile) || length($attrsFile));
-
-if (length($tagsFile)) {
-    %allTags = %{readTags($tagsFile, 0)};
-    %enabledTags = %{readTags($tagsFile, 1)};
-    namesToStrings(\%allTags, \%allStrings);
-}
-
-if (length($attrsFile)) {
-    %allAttrs = %{readAttrs($attrsFile, 0)};
-    %enabledAttrs = %{readAttrs($attrsFile, 1)};
-    namesToStrings(\%allAttrs, \%allStrings);
-}
-
-die "You must specify a namespace (e.g. SVG) for <namespace>Names.h" unless $parameters{namespace};
-die "You must specify a namespaceURI (e.g. http://www.w3.org/2000/svg)" unless $parameters{namespaceURI};
-
-$parameters{namespacePrefix} = $parameters{namespace} unless $parameters{namespacePrefix};
-$parameters{fallbackJSInterfaceName} = $parameters{fallbackInterfaceName} unless $parameters{fallbackJSInterfaceName};
-
-my $namesBasePath = "$outputDir/$parameters{namespace}Names";
-my $factoryBasePath = "$outputDir/$parameters{namespace}ElementFactory";
-my $wrapperFactoryFileName = "$parameters{namespace}ElementWrapperFactory";
-
-printNamesHeaderFile("$namesBasePath.h");
-printNamesCppFile("$namesBasePath.cpp");
-
-if ($printFactory) {
-    printFactoryCppFile("$factoryBasePath.cpp");
-    printFactoryHeaderFile("$factoryBasePath.h");
-}
-
-printWrapperFactoryCppFile($outputDir, $wrapperFactoryFileName);
-printWrapperFactoryHeaderFile($outputDir, $wrapperFactoryFileName);
-
-### Hash initialization
-
-sub defaultTagPropertyHash
-{
-    return (
-        'constructorNeedsCreatedByParser' => 0,
-        'constructorNeedsFormElement' => 0,
-        'noConstructor' => 0,
-        'interfaceName' => defaultInterfaceName($_[0]),
-        # By default, the JSInterfaceName is the same as the interfaceName.
-        'JSInterfaceName' => defaultInterfaceName($_[0]),
-        'mapToTagName' => '',
-        'wrapperOnlyIfMediaIsAvailable' => 0,
-        'conditional' => 0,
-        'contextConditional' => 0,
-        'runtimeConditional' => 0
-    );
-}
-
-sub defaultParametersHash
-{
-    return (
-        'namespace' => '',
-        'namespacePrefix' => '',
-        'namespaceURI' => '',
-        'guardFactoryWith' => '',
-        'tagsNullNamespace' => 0,
-        'attrsNullNamespace' => 0,
-        'fallbackInterfaceName' => '',
-        'fallbackJSInterfaceName' => ''
-    );
-}
-
-sub defaultInterfaceName
-{
-    die "No namespace found" if !$parameters{namespace};
-    return $parameters{namespace} . upperCaseName($_[0]) . "Element"
-}
-
-### Parsing handlers
-
-sub valueForName
-{
-    my $name = shift;
-    my $value = $extensionAttrs{$name};
-
-    if (!$value) {
-        $value = $name;
-        $value =~ s/_/-/g;
-    }
-
-    return $value;
-}
-
-sub namesToStrings
-{
-    my $namesRef = shift;
-    my $stringsRef = shift;
-
-    my %names = %$namesRef;
-
-    for my $name (keys %names) {
-        $stringsRef->{$name} = valueForName($name);
-    }
-}
-
-sub tagsHandler
-{
-    my ($tag, $property, $value) = @_;
-
-    $tag =~ s/-/_/g;
-
-    # Initialize default property values.
-    $parsedTags{$tag} = { defaultTagPropertyHash($tag) } if !defined($parsedTags{$tag});
-
-    if ($property) {
-        die "Unknown property $property for tag $tag\n" if !defined($parsedTags{$tag}{$property});
-
-        # The code relies on JSInterfaceName deriving from interfaceName to check for custom JSInterfaceName.
-        # So override JSInterfaceName if it was not already set.
-        $parsedTags{$tag}{JSInterfaceName} = $value if $property eq "interfaceName" && $parsedTags{$tag}{JSInterfaceName} eq $parsedTags{$tag}{interfaceName};
-
-        $parsedTags{$tag}{$property} = $value;
-    }
-}
-
-sub attrsHandler
-{
-    my ($attr, $property, $value) = @_;
-    # Translate HTML5 extension attributes of the form 'x-webkit-feature' to 'webkitfeature'.
-    # We don't just check for the 'x-' prefix because there are attributes such as x-height
-    # which should follow the default path below.
-    if ($attr =~ m/^x-webkit-(.*)/) {
-        my $newAttr = "webkit$1";
-        $extensionAttrs{$newAttr} = $attr;
-        $attr = $newAttr;
-    }
-    $attr =~ s/-/_/g;
-
-    # Initialize default properties' values.
-    $parsedAttrs{$attr} = {} if !defined($parsedAttrs{$attr});
-
-    if ($property) {
-        die "Unknown property $property for attribute $attr\n" if !defined($parsedAttrs{$attr}{$property});
-        $parsedAttrs{$attr}{$property} = $value;
-    }
-}
-
-sub parametersHandler
-{
-    my ($parameter, $value) = @_;
-
-    # Initialize default properties' values.
-    %parameters = defaultParametersHash() if (!(keys %parameters) && $initDefaults);
-
-    # If the input is an array, we want the strings to have the same value as the key.
-    if ( $value eq 1) {
-        $value = $parameter;
-    }
-
-    die "Unknown parameter $parameter for tags/attrs\n" if (!defined($parameters{$parameter}) && $initDefaults);
-    $parameters{$parameter} = $value;
-}
-
-## Support routines
-
-sub preprocessorCommand()
-{
-    return $preprocessor if $extraDefines eq 0;
-    return $preprocessor . " -D" . join(" -D", split(" ", $extraDefines));
-}
-
-sub readNames($$$$)
-{
-    my ($namesFile, $hashToFillRef, $handler, $usePreprocessor) = @_;
-
-    my $names = new IO::File;
-    if ($usePreprocessor) {
-        open($names, preprocessorCommand() . " " . $namesFile . "|") or die "Failed to open file: $namesFile";
-    } else {
-        open($names, $namesFile) or die "Failed to open file: $namesFile";
-    }
-
-    my $InParser = InFilesParser->new();
-    $InParser->parse($names, \&parametersHandler, $handler);
-
-    close($names);
-    die "Failed to read names from file: $namesFile" if (keys %{$hashToFillRef} == 0);
-    return $hashToFillRef;
-}
-
-sub readAttrs($$)
-{
-    my ($namesFile, $usePreprocessor) = @_;
-    %parsedAttrs = ();
-    return readNames($namesFile, \%parsedAttrs, \&attrsHandler, $usePreprocessor);
-}
-
-sub readTags($$)
-{
-    my ($namesFile, $usePreprocessor) = @_;
-    %parsedTags = ();
-    return readNames($namesFile, \%parsedTags, \&tagsHandler, $usePreprocessor);
-}
-
-sub printMacros
-{
-    my ($F, $macro, $suffix, $namesRef) = @_;
-    my %names = %$namesRef;
-
-    for my $name (sort keys %names) {
-        print F "$macro $name","$suffix;\n";
-    }
-}
-
-sub usesDefaultWrapper
-{
-    my $tagName = shift;
-    return $tagName eq $parameters{namespace} . "Element";
-}
-
-# Build a direct mapping from the tags to the Element to create.
-sub buildConstructorMap
-{
-    my %tagConstructorMap = ();
-    for my $tagName (keys %enabledTags) {
-        my $interfaceName = $enabledTags{$tagName}{interfaceName};
-
-        if ($enabledTags{$tagName}{mapToTagName}) {
-            die "Cannot handle multiple mapToTagName for $tagName\n" if $enabledTags{$enabledTags{$tagName}{mapToTagName}}{mapToTagName};
-            $interfaceName = $enabledTags{ $enabledTags{$tagName}{mapToTagName} }{interfaceName};
-        }
-
-        # Chop the string to keep the interesting part.
-        $interfaceName =~ s/$parameters{namespace}(.*)Element/$1/;
-        $tagConstructorMap{$tagName} = lc($interfaceName);
-    }
-
-    return %tagConstructorMap;
-}
-
-# Helper method that print the constructor's signature avoiding
-# unneeded arguments.
-sub printConstructorSignature
-{
-    my ($F, $tagName, $constructorName, $constructorTagName) = @_;
-
-    print F "static PassRefPtr<$parameters{namespace}Element> ${constructorName}Constructor(const QualifiedName& $constructorTagName, Document& document";
-    if ($parameters{namespace} eq "HTML") {
-        print F ", HTMLFormElement*";
-        print F " formElement" if $enabledTags{$tagName}{constructorNeedsFormElement};
-    }
-    print F ", bool";
-    print F " createdByParser" if $enabledTags{$tagName}{constructorNeedsCreatedByParser};
-    print F ")\n{\n";
-}
-
-# Helper method to dump the constructor interior and call the
-# Element constructor with the right arguments.
-# The variable names should be kept in sync with the previous method.
-sub printConstructorInterior
-{
-    my ($F, $tagName, $interfaceName, $constructorTagName) = @_;
-
-    # Handle media elements.
-    if ($enabledTags{$tagName}{wrapperOnlyIfMediaIsAvailable}) {
-        print F <<END
-    Settings* settings = document.settings();
-    if (!RuntimeEnabledFeatures::mediaEnabled() || (settings && !settings->mediaEnabled()))
-        return 0;
-
-END
-;
-    }
-
-    my $contextConditional = $enabledTags{$tagName}{contextConditional};
-    if ($contextConditional) {
-        print F <<END
-    if (!ContextFeatures::${contextConditional}Enabled(&document))
-        return 0;
-END
-;
-    }
-
-    my $runtimeConditional = $enabledTags{$tagName}{runtimeConditional};
-    if ($runtimeConditional) {
-        print F <<END
-    if (!RuntimeEnabledFeatures::${runtimeConditional}Enabled())
-        return 0;
-END
-;
-    }
-
-    # Call the constructor with the right parameters.
-    print F "    return ${interfaceName}::create($constructorTagName, document";
-    print F ", formElement" if $enabledTags{$tagName}{constructorNeedsFormElement};
-    print F ", createdByParser" if $enabledTags{$tagName}{constructorNeedsCreatedByParser};
-    print F ");\n}\n\n";
-}
-
-sub printConstructors
-{
-    my ($F, $tagConstructorMapRef) = @_;
-    my %tagConstructorMap = %$tagConstructorMapRef;
-
-    # This is to avoid generating the same constructor several times.
-    my %uniqueTags = ();
-    for my $tagName (sort keys %tagConstructorMap) {
-        my $interfaceName = $enabledTags{$tagName}{interfaceName};
-
-        # Ignore the mapped tag
-        # FIXME: It could be moved inside this loop but was split for readibility.
-        next if (defined($uniqueTags{$interfaceName}) || $enabledTags{$tagName}{mapToTagName});
-        # Tags can have wrappers without constructors.
-        # This is useful to make user-agent shadow elements internally testable
-        # while keeping them from being avaialble in the HTML markup.
-        next if $enabledTags{$tagName}{noConstructor};
-
-        $uniqueTags{$interfaceName} = '1';
-
-        my $conditional = $enabledTags{$tagName}{conditional};
-        if ($conditional) {
-            my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")";
-            print F "#if ${conditionalString}\n\n";
-        }
-
-        printConstructorSignature($F, $tagName, $tagConstructorMap{$tagName}, "tagName");
-        printConstructorInterior($F, $tagName, $interfaceName, "tagName");
-
-        if ($conditional) {
-            print F "#endif\n";
-        }
-    }
-
-    # Mapped tag name uses a special wrapper to keep their prefix and namespaceURI while using the mapped localname.
-    for my $tagName (sort keys %tagConstructorMap) {
-        if ($enabledTags{$tagName}{mapToTagName}) {
-            my $mappedName = $enabledTags{$tagName}{mapToTagName};
-            printConstructorSignature($F, $mappedName, $mappedName . "To" . $tagName, "tagName");
-            printConstructorInterior($F, $mappedName, $enabledTags{$mappedName}{interfaceName}, "QualifiedName(tagName.prefix(), ${mappedName}Tag.localName(), tagName.namespaceURI())");
-        }
-    }
-}
-
-sub printFunctionInits
-{
-    my ($F, $tagConstructorMap) = @_;
-    my %tagConstructorMap = %$tagConstructorMap;
-
-    for my $tagName (sort keys %tagConstructorMap) {
-        next if $enabledTags{$tagName}{noConstructor};
-
-        my $conditional = $enabledTags{$tagName}{conditional};
-        if ($conditional) {
-            my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")";
-            print F "#if ${conditionalString}\n";
-        }
-
-        if ($enabledTags{$tagName}{mapToTagName}) {
-            print F "    addTag(${tagName}Tag, $enabledTags{$tagName}{mapToTagName}To${tagName}Constructor);\n";
-        } else {
-            print F "    addTag(${tagName}Tag, $tagConstructorMap{$tagName}Constructor);\n";
-        }
-
-        if ($conditional) {
-            print F "#endif\n\n";
-        }
-    }
-}
-
-sub svgCapitalizationHacks
-{
-    my $name = shift;
-
-    $name = "FE" . ucfirst $1 if $name =~ /^fe(.+)$/;
-
-    return $name;
-}
-
-sub upperCaseName
-{
-    my $name = shift;
-
-    $name = svgCapitalizationHacks($name) if ($parameters{namespace} eq "SVG");
-
-    while ($name =~ /^(.*?)_(.*)/) {
-        $name = $1 . ucfirst $2;
-    }
-
-    return ucfirst $name;
-}
-
-sub printHeaderHead
-{
-    my ($F, $prefix, $nsName, $includes) = @_;
-
-    print F "#ifndef ${prefix}_${nsName}Names_h\n";
-    print F "#define ${prefix}_${nsName}Names_h\n\n";
-    print F "$includes\n\n";
-
-    print F "namespace WebCore {\n\n";
-    print F "namespace ${nsName}Names {\n\n";
-
-    print F "#ifndef ${prefix}_${nsName}NAMES_HIDE_GLOBALS\n";
-}
-
-sub printCppHead
-{
-    my ($F, $prefix, $nsName, $usedNamespace) = @_;
-
-    print F "#include \"config.h\"\n\n";
-    print F "#ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC\n";
-    print F "#define ${prefix}_${nsName}NAMES_HIDE_GLOBALS 1\n";
-    print F "#else\n";
-    print F "#define QNAME_DEFAULT_CONSTRUCTOR 1\n";
-    print F "#endif\n\n";
-
-    print F "#include \"${nsName}Names.h\"\n\n";
-    print F "#include \"wtf/StaticConstructors.h\"\n";
-
-    print F "namespace WebCore {\n\n";
-    print F "namespace ${nsName}Names {\n\n";
-    print F "using namespace $usedNamespace;\n\n";
-}
-
-sub printInit
-{
-    my ($F, $isDefinition) = @_;
-
-    if ($isDefinition) {
-        print F "\nvoid init();\n\n";
-        print F "} }\n\n";
-        print F "#endif\n\n";
-        return;
-    }
-
-print F "\nvoid init()
-{
-    // Use placement new to initialize the globals.
-
-";
-}
-
-sub printLicenseHeader
-{
-    my $F = shift;
-    print F "/*
- * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
- *
- * This file was generated by the core/scripts/make_names.pl script.
- *
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 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,
- * 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.
- */
-
-";
-}
-
-sub printNamesHeaderFile
-{
-    my ($headerPath) = shift;
-    my $F;
-    open F, ">$headerPath";
-
-    printLicenseHeader($F);
-    printHeaderHead($F, "DOM", $parameters{namespace}, "#include \"core/dom/QualifiedName.h\"");
-
-    my $lowerNamespace = lc($parameters{namespacePrefix});
-    print F "// Namespace\n";
-    print F "extern const WTF::AtomicString ${lowerNamespace}NamespaceURI;\n\n";
-
-    if (keys %allTags) {
-        print F "// Tags\n";
-        printMacros($F, "extern const WebCore::QualifiedName", "Tag", \%allTags);
-    }
-
-    if (keys %allAttrs) {
-        print F "// Attributes\n";
-        printMacros($F, "extern const WebCore::QualifiedName", "Attr", \%allAttrs);
-    }
-    print F "#endif\n\n";
-
-    if (keys %allTags) {
-        print F "const unsigned $parameters{namespace}TagsCount = ", scalar(keys %allTags), ";\n";
-        print F "WebCore::QualifiedName** get$parameters{namespace}Tags();\n";
-    }
-
-    if (keys %allAttrs) {
-        print F "const unsigned $parameters{namespace}AttrsCount = ", scalar(keys %allAttrs), ";\n";
-        print F "WebCore::QualifiedName** get$parameters{namespace}Attrs();\n";
-    }
-
-    printInit($F, 1);
-    close F;
-}
-
-sub printNamesCppFile
-{
-    my $cppPath = shift;
-    my $F;
-    open F, ">$cppPath";
-
-    printLicenseHeader($F);
-    printCppHead($F, "DOM", $parameters{namespace}, "WebCore");
-
-    my $lowerNamespace = lc($parameters{namespacePrefix});
-
-    print F "DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI)\n\n";
-
-    if (keys %allTags) {
-        print F "// Tags\n";
-        for my $name (sort keys %allTags) {
-            print F "DEFINE_GLOBAL(QualifiedName, ", $name, "Tag)\n";
-        }
-
-        print F "\n\nWebCore::QualifiedName** get$parameters{namespace}Tags()\n";
-        print F "{\n    static WebCore::QualifiedName* $parameters{namespace}Tags[] = {\n";
-        for my $name (sort keys %allTags) {
-            print F "        (WebCore::QualifiedName*)&${name}Tag,\n";
-        }
-        print F "    };\n";
-        print F "    return $parameters{namespace}Tags;\n";
-        print F "}\n";
-    }
-
-    if (keys %allAttrs) {
-        print F "\n// Attributes\n";
-        for my $name (sort keys %allAttrs) {
-            print F "DEFINE_GLOBAL(QualifiedName, ", $name, "Attr)\n";
-        }
-        print F "\n\nWebCore::QualifiedName** get$parameters{namespace}Attrs()\n";
-        print F "{\n    static WebCore::QualifiedName* $parameters{namespace}Attr[] = {\n";
-        for my $name (sort keys %allAttrs) {
-            print F "        (WebCore::QualifiedName*)&${name}Attr,\n";
-        }
-        print F "    };\n";
-        print F "    return $parameters{namespace}Attr;\n";
-        print F "}\n";
-    }
-
-    printInit($F, 0);
-
-    print(F "    AtomicString ${lowerNamespace}NS(\"$parameters{namespaceURI}\", AtomicString::ConstructFromLiteral);\n\n");
-
-    print(F "    // Namespace\n");
-    print(F "    new ((void*)&${lowerNamespace}NamespaceURI) AtomicString(${lowerNamespace}NS);\n");
-    print(F "\n");
-    print F StaticString::GenerateStringImpls(\%allStrings);
-
-    if (keys %allTags) {
-        my $tagsNamespace = $parameters{tagsNullNamespace} ? "nullAtom" : "${lowerNamespace}NS";
-        printDefinitions($F, \%allTags, "tags", $tagsNamespace);
-    }
-    if (keys %allAttrs) {
-        my $attrsNamespace = $parameters{attrsNullNamespace} ? "nullAtom" : "${lowerNamespace}NS";
-        printDefinitions($F, \%allAttrs, "attributes", $attrsNamespace);
-    }
-
-    print F "}\n\n} }\n\n";
-    close F;
-}
-
-sub printJSElementIncludes
-{
-    my $F = shift;
-
-    my %tagsSeen;
-    for my $tagName (sort keys %enabledTags) {
-        my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName};
-        next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($tagName);
-        if ($enabledTags{$tagName}{conditional}) {
-            # We skip feature-define-specific #includes here since we handle them separately.
-            next;
-        }
-        $tagsSeen{$JSInterfaceName} = 1;
-
-        print F "#include \"V8${JSInterfaceName}.h\"\n";
-    }
-    print F "#include \"V8$parameters{fallbackJSInterfaceName}.h\"\n";
-}
-
-sub printElementIncludes
-{
-    my $F = shift;
-
-    my %tagsSeen;
-    for my $tagName (sort keys %enabledTags) {
-        my $interfaceName = $enabledTags{$tagName}{interfaceName};
-        next if defined($tagsSeen{$interfaceName});
-        if ($enabledTags{$tagName}{conditional}) {
-            # We skip feature-define-specific #includes here since we handle them separately.
-            next;
-        }
-        $tagsSeen{$interfaceName} = 1;
-
-        print F "#include \"${interfaceName}.h\"\n";
-    }
-    print F "#include \"$parameters{fallbackInterfaceName}.h\"\n";
-}
-
-sub printConditionalElementIncludes
-{
-    my ($F, $shouldIncludeV8Headers) = @_;
-
-    my %conditionals;
-    my %unconditionalElementIncludes;
-    my %unconditionalJSElementIncludes;
-
-    for my $tagName (keys %enabledTags) {
-        my $conditional = $enabledTags{$tagName}{conditional};
-        my $interfaceName = $enabledTags{$tagName}{interfaceName};
-        my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName};
-
-        if ($conditional) {
-            $conditionals{$conditional}{interfaceNames}{$interfaceName} = 1;
-            $conditionals{$conditional}{JSInterfaceNames}{$JSInterfaceName} = 1;
-        } else {
-            $unconditionalElementIncludes{$interfaceName} = 1;
-            $unconditionalJSElementIncludes{$JSInterfaceName} = 1;
-        }
-    }
-
-    for my $conditional (sort keys %conditionals) {
-        print F "\n#if ENABLE($conditional)\n";
-        for my $interfaceName (sort keys %{$conditionals{$conditional}{interfaceNames}}) {
-            next if $unconditionalElementIncludes{$interfaceName};
-            print F "#include \"$interfaceName.h\"\n";
-        }
-        if ($shouldIncludeV8Headers) {
-            for my $JSInterfaceName (sort keys %{$conditionals{$conditional}{JSInterfaceNames}}) {
-                next if $unconditionalJSElementIncludes{$JSInterfaceName};
-                print F "#include \"V8$JSInterfaceName.h\"\n";
-            }
-        }
-        print F "#endif\n";
-    }
-}
-
-sub printDefinitions
-{
-    my ($F, $namesRef, $type, $namespaceURI) = @_;
-    my $singularType = substr($type, 0, -1);
-    my $shortType = substr($singularType, 0, 4);
-    my $shortCamelType = ucfirst($shortType);
-    my $shortUpperType = uc($shortType);
-
-    print F "    // " . ucfirst($type) . "\n";
-
-    for my $name (sort keys %$namesRef) {
-        # To generate less code in init(), the common case of nullAtom for the namespace, we call createQualifiedName() without passing $namespaceURI.
-        if ($namespaceURI eq "nullAtom") {
-            print F "    createQualifiedName((void*)&$name","${shortCamelType}, ${name}Impl);\n";
-        } else {
-            print F "    createQualifiedName((void*)&$name","${shortCamelType}, ${name}Impl, $namespaceURI);\n";
-        }
-    }
-}
-
-## ElementFactory routines
-
-sub printFactoryCppFile
-{
-    my $cppPath = shift;
-    my $F;
-    open F, ">$cppPath";
-
-printLicenseHeader($F);
-
-print F <<END
-#include "config.h"
-END
-;
-
-print F "\n#if $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith};
-
-print F <<END
-#include "$parameters{namespace}ElementFactory.h"
-#include "$parameters{namespace}Names.h"
-END
-;
-
-printElementIncludes($F);
-
-print F "\n#include \"wtf/HashMap.h\"\n";
-
-printConditionalElementIncludes($F);
-
-print F <<END
-
-#include "RuntimeEnabledFeatures.h"
-#include "core/dom/ContextFeatures.h"
-#include "core/dom/CustomElement.h"
-#include "core/dom/CustomElementRegistrationContext.h"
-#include "core/dom/Document.h"
-#include "core/page/Settings.h"
-
-namespace WebCore {
-
-using namespace $parameters{namespace}Names;
-
-END
-;
-
-print F "typedef PassRefPtr<$parameters{namespace}Element> (*ConstructorFunction)(const QualifiedName&, Document&";
-print F ", HTMLFormElement*" if $parameters{namespace} eq "HTML";
-print F ", bool createdByParser);\n";
-print F <<END
-typedef HashMap<StringImpl*, ConstructorFunction> FunctionMap;
-
-static FunctionMap* gFunctionMap = 0;
-
-END
-;
-
-my %tagConstructorMap = buildConstructorMap();
-
-printConstructors($F, \%tagConstructorMap);
-
-print F <<END
-static void addTag(const QualifiedName& tag, ConstructorFunction func)
-{
-    gFunctionMap->set(tag.localName().impl(), func);
-}
-
-static void createFunctionMap()
-{
-    ASSERT(!gFunctionMap);
-
-    // Create the table.
-    gFunctionMap = new FunctionMap;
-
-    // Populate it with constructor functions.
-END
-;
-
-printFunctionInits($F, \%tagConstructorMap);
-
-print F "}\n";
-
-
-print F "\nPassRefPtr<$parameters{namespace}Element> $parameters{namespace}ElementFactory::create$parameters{namespace}Element(const QualifiedName& qName, Document* document";
-print F ", HTMLFormElement* formElement" if $parameters{namespace} eq "HTML";
-print F ", bool createdByParser)\n{\n";
-
-print F <<END
-    if (!document)
-        return 0;
-
-    if (CustomElement::isValidName(qName.localName()) && document->registrationContext()) {
-        RefPtr<Element> element = document->registrationContext()->createCustomTagElement(*document, qName, createdByParser ? CustomElementRegistrationContext::CreatedByParser : CustomElementRegistrationContext::NotCreatedByParser);
-        ASSERT_WITH_SECURITY_IMPLICATION(element->is$parameters{namespace}Element());
-        return static_pointer_cast<$parameters{namespace}Element>(element.release());
-    }
-
-    if (!gFunctionMap)
-        createFunctionMap();
-    if (ConstructorFunction function = gFunctionMap->get(qName.localName().impl())) {
-END
-;
-
-if ($parameters{namespace} eq "HTML") {
-    print F "        if (PassRefPtr<$parameters{namespace}Element> element = function(qName, *document, formElement, createdByParser))\n";
-    print F "            return element;\n";
-} else {
-    print F "        if (PassRefPtr<$parameters{namespace}Element> element = function(qName, *document, createdByParser))\n";
-    print F "            return element;\n";
-}
-print F <<END
-    }
-
-    return $parameters{fallbackInterfaceName}::create(qName, *document);
-}
-
-} // namespace WebCore
-
-END
-;
-
-    print F "#endif\n" if $parameters{guardFactoryWith};
-
-    close F;
-}
-
-sub printFactoryHeaderFile
-{
-    my $headerPath = shift;
-    my $F;
-    open F, ">$headerPath";
-
-    printLicenseHeader($F);
-
-    print F<<END
-#ifndef $parameters{namespace}ElementFactory_h
-#define $parameters{namespace}ElementFactory_h
-
-#include "wtf/Forward.h"
-#include "wtf/PassRefPtr.h"
-
-namespace WebCore {
-    class Element;
-    class Document;
-    class QualifiedName;
-}
-
-namespace WebCore {
-
-    class $parameters{namespace}Element;
-END
-;
-
-print F "     class HTMLFormElement;\n" if $parameters{namespace} eq "HTML";
-
-print F<<END
-    // The idea behind this class is that there will eventually be a mapping from namespace URIs to ElementFactories that can dispense
-    // elements. In a compound document world, the generic createElement function (will end up being virtual) will be called.
-    class $parameters{namespace}ElementFactory {
-    public:
-        PassRefPtr<Element> createElement(const WebCore::QualifiedName&, WebCore::Document*, bool createdByParser = true);
-END
-;
-print F "        static PassRefPtr<$parameters{namespace}Element> create$parameters{namespace}Element(const WebCore::QualifiedName&, WebCore::Document*";
-print F ", HTMLFormElement* = 0" if $parameters{namespace} eq "HTML";
-print F ", bool createdByParser = true);\n";
-
-printf F<<END
-    };
-}
-
-#endif // $parameters{namespace}ElementFactory_h
-
-END
-;
-
-    close F;
-}
-
-## Wrapper Factory routines
-
-sub usesDefaultJSWrapper
-{
-    my $name = shift;
-
-    # A tag reuses the default wrapper if its JSInterfaceName matches the default namespace Element.
-    return $enabledTags{$name}{JSInterfaceName} eq $parameters{namespace} . "Element";
-}
-
-sub printWrapperFunctions
-{
-    my $F = shift;
-
-    my %tagsSeen;
-    for my $tagName (sort keys %enabledTags) {
-        # Avoid defining the same wrapper method twice.
-        my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName};
-        next if defined($tagsSeen{$JSInterfaceName}) || (usesDefaultJSWrapper($tagName) && ($parameters{fallbackJSInterfaceName} eq $parameters{namespace} . "Element"));
-        $tagsSeen{$JSInterfaceName} = 1;
-
-        my $conditional = $enabledTags{$tagName}{conditional};
-        if ($conditional) {
-            my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")";
-            print F "#if ${conditionalString}\n\n";
-        }
-
-        if ($enabledTags{$tagName}{wrapperOnlyIfMediaIsAvailable}) {
-            print F <<END
-static v8::Handle<v8::Object> create${JSInterfaceName}Wrapper($parameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
-    Settings* settings = element->document().settings();
-    if (!RuntimeEnabledFeatures::mediaEnabled() || (settings && !settings->mediaEnabled()))
-        return createV8$parameters{namespace}DirectWrapper(element, creationContext, isolate);
-    return wrap(static_cast<${JSInterfaceName}*>(element), creationContext, isolate);
-}
-
-END
-;
-        } elsif ($enabledTags{$tagName}{contextConditional}) {
-            my $contextConditional = $enabledTags{$tagName}{contextConditional};
-            print F <<END
-static v8::Handle<v8::Object> create${JSInterfaceName}Wrapper($parameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
-    if (!ContextFeatures::${contextConditional}Enabled(&element->document()))
-        return createV8$parameters{namespace}FallbackWrapper(to$parameters{fallbackInterfaceName}(element), creationContext, isolate);
-    return wrap(static_cast<${JSInterfaceName}*>(element), creationContext, isolate);
-}
-END
-;
-        } elsif ($enabledTags{$tagName}{runtimeConditional}) {
-            my $runtimeConditional = $enabledTags{$tagName}{runtimeConditional};
-            print F <<END
-static v8::Handle<v8::Object> create${JSInterfaceName}Wrapper($parameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
-    if (!RuntimeEnabledFeatures::${runtimeConditional}Enabled())
-        return createV8$parameters{namespace}FallbackWrapper(to$parameters{fallbackInterfaceName}(element), creationContext, isolate);
-    return wrap(static_cast<${JSInterfaceName}*>(element), creationContext, isolate);
-}
-END
-;
-        } elsif (${JSInterfaceName} eq "HTMLElement") {
-            print F <<END
-static v8::Handle<v8::Object> create${JSInterfaceName}Wrapper($parameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
-    ASSERT_NOT_REACHED();
-    return v8::Handle<v8::Object>();
-}
-
-END
-;
-        } else {
-            print F <<END
-static v8::Handle<v8::Object> create${JSInterfaceName}Wrapper($parameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
-    return wrap(static_cast<${JSInterfaceName}*>(element), creationContext, isolate);
-}
-
-
-END
-;
-        }
-
-        if ($conditional) {
-            print F "#endif\n\n";
-        }
-    }
-}
-
-sub printWrapperFactoryCppFile
-{
-    my $outputDir = shift;
-    my $wrapperFactoryFileName = shift;
-    my $F;
-    open F, ">" . $outputDir . "/V8" . $wrapperFactoryFileName . ".cpp";
-
-    printLicenseHeader($F);
-
-    print F "#include \"config.h\"\n";
-    print F "#include \"V8$parameters{namespace}ElementWrapperFactory.h\"\n";
-
-    print F "\n#if $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith};
-
-    printJSElementIncludes($F);
-
-    print F "\n#include \"$parameters{namespace}Names.h\"\n\n";
-
-    printElementIncludes($F);
-
-    print F "\n#include \"wtf/StdLibExtras.h\"\n";
-
-    printConditionalElementIncludes($F, 1);
-
-    print F <<END
-
-#include "RuntimeEnabledFeatures.h"
-#include "core/dom/ContextFeatures.h"
-#include "core/dom/Document.h"
-#include "core/page/Settings.h"
-
-#include "V8$parameters{namespace}Element.h"
-
-#include "bindings/v8/CustomElementWrapper.h"
-
-#include <v8.h>
-
-namespace WebCore {
-
-using namespace $parameters{namespace}Names;
-
-typedef v8::Handle<v8::Object> (*Create$parameters{namespace}ElementWrapperFunction)($parameters{namespace}Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
-
-END
-;
-
-    printWrapperFunctions($F);
-
-    print F <<END
-v8::Handle<v8::Object> createV8$parameters{namespace}Wrapper($parameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
-    typedef HashMap<WTF::StringImpl*, Create$parameters{namespace}ElementWrapperFunction> FunctionMap;
-    DEFINE_STATIC_LOCAL(FunctionMap, map, ());
-    if (map.isEmpty()) {
-END
-;
-
-    for my $tag (sort keys %enabledTags) {
-        # Do not add the name to the map if it does not have a JS wrapper constructor or uses the default wrapper.
-        next if (usesDefaultJSWrapper($tag, \%enabledTags) && ($parameters{fallbackJSInterfaceName} eq $parameters{namespace} . "Element"));
-
-        my $conditional = $enabledTags{$tag}{conditional};
-        if ($conditional) {
-            my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")";
-            print F "#if ${conditionalString}\n";
-        }
-
-        my $ucTag = $enabledTags{$tag}{JSInterfaceName};
-        print F "       map.set(${tag}Tag.localName().impl(), create${ucTag}Wrapper);\n";
-
-        if ($conditional) {
-            print F "#endif\n";
-        }
-    }
-
-    print F <<END
-    }
-
-    Create$parameters{namespace}ElementWrapperFunction createWrapperFunction = map.get(element->localName().impl());
-END
-;
-    if ($parameters{namespace} eq "HTML") {
-        print F <<END
-    if (createWrapperFunction == createHTMLElementWrapper)
-        createWrapperFunction = createV8HTMLDirectWrapper;
-END
-;
-    }
-    print F <<END
-    if (element->isCustomElement())
-        return CustomElementWrapper<$parameters{namespace}Element, V8$parameters{namespace}Element>::wrap(element, creationContext, isolate, createWrapperFunction);
-
-    if (createWrapperFunction)
-        return createWrapperFunction(element, creationContext, isolate);
-END
-;
-    if ($parameters{namespace} eq "SVG") {
-        print F <<END
-    return V8SVGElement::createWrapper(element, creationContext, isolate);
-END
-;
-    } else {
-        print F <<END
-    return wrap(to$parameters{fallbackInterfaceName}(element), creationContext, isolate);
-END
-;
-    }
-
-    my $fallbackWrapper = $parameters{fallbackInterfaceName};
-    if ($parameters{namespace} eq "SVG") {
-        $fallbackWrapper = "SVGElement";
-    }
-
-    print F <<END
-}
-
-WrapperTypeInfo* findWrapperTypeFor$parameters{namespace}TagName(const AtomicString& name)
-{
-    typedef HashMap<WTF::StringImpl*, WrapperTypeInfo*> NameTypeMap;
-    DEFINE_STATIC_LOCAL(NameTypeMap, map, ());
-    if (map.isEmpty()) {
-END
-;
-
-    for my $tagName (sort keys %enabledTags) {
-        if (!usesDefaultJSWrapper($tagName)) {
-            my $conditional = $enabledTags{$tagName}{conditional};
-            if ($conditional) {
-                my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")";
-                print F "#if ${conditionalString}\n";
-            }
-
-            my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName};
-            print F "       map.set(${tagName}Tag.localName().impl(), WrapperTypeTraits<${JSInterfaceName}>::info());\n";
-
-            if ($conditional) {
-                print F "#endif\n";
-            }
-        }
-    }
-
-    print F <<END
-    }
-
-    if (WrapperTypeInfo* result = map.get(name.impl()))
-        return result;
-
-    return WrapperTypeTraits<$fallbackWrapper>::info();
-}
-
-END
-;
-
-    print F "}\n\n";
-    print F "#endif\n" if $parameters{guardFactoryWith};
-
-    close F;
-}
-
-sub printWrapperFactoryHeaderFile
-{
-    my $outputDir = shift;
-    my $wrapperFactoryFileName = shift;
-    my $F;
-    open F, ">" . $outputDir . "/V8" . $wrapperFactoryFileName . ".h";
-
-    printLicenseHeader($F);
-
-    print F "#ifndef V8$parameters{namespace}ElementWrapperFactory_h\n";
-    print F "#define V8$parameters{namespace}ElementWrapperFactory_h\n\n";
-
-    print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith};
-
-    print F <<END
-#include <V8$parameters{namespace}Element.h>
-#include <V8$parameters{fallbackJSInterfaceName}.h>
-#include <v8.h>
-
-namespace WebCore {
-
-    class $parameters{namespace}Element;
-
-    WrapperTypeInfo* findWrapperTypeFor$parameters{namespace}TagName(const AtomicString& name);
-
-    v8::Handle<v8::Object> createV8$parameters{namespace}Wrapper($parameters{namespace}Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
-    inline v8::Handle<v8::Object> createV8$parameters{namespace}DirectWrapper($parameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-    {
-        return V8$parameters{namespace}Element::createWrapper(element, creationContext, isolate);
-    }
-    inline v8::Handle<v8::Object> createV8$parameters{namespace}FallbackWrapper($parameters{fallbackJSInterfaceName}* element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-    {
-        return V8$parameters{fallbackJSInterfaceName}::createWrapper(element, creationContext, isolate);
-    }
-}
-END
-;
-    print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith};
-
-    print F "#endif // V8$parameters{namespace}ElementWrapperFactory_h\n";
-
-    close F;
-}
-
-sub createGenericNamesFile
-{
-    my $inputName = shift;
-    my $baseName = shift;
-    my $basePrefix = shift;
-
-    my $names = new IO::File;
-    open($names, $inputName) or die "Failed to open file: $inputName";
-
-    $initDefaults = 0;
-    my $Parser = InFilesParser->new();
-    my $dummy;
-    $Parser->parse($names, \&parametersHandler, \&dummy);
-
-    my $F;
-    my $header = File::Spec->catfile($outputDir, "${baseName}Names.h");
-    open F, ">$header" or die "Unable to open $header for writing.";
-
-    printLicenseHeader($F);
-    printHeaderHead($F, $basePrefix, $baseName, "#include \"wtf/text/AtomicString.h\"");
-
-    printMacros($F, "extern const WTF::AtomicString", "", \%parameters);
-    print F "#endif\n\n";
-
-    printInit($F, 1);
-    close F;
-
-    my $source = File::Spec->catfile($outputDir, "${baseName}Names.cpp");
-    open F, ">$source" or die "Unable to open $source for writing.";
-
-    printLicenseHeader($F);
-    printCppHead($F, $basePrefix, $baseName, "WTF");
-
-    while ( my ($name, $identifier) = each %parameters ) {
-        print F "DEFINE_GLOBAL(AtomicString, $name)\n";
-    }
-
-    printInit($F, 0);
-
-    print F "\n";
-    print F StaticString::GenerateStringImpls(\%parameters);
-
-    while ( my ($name, $identifier) = each %parameters ) {
-        print F "    new ((void*)&$name) AtomicString(${name}Impl);\n";
-    }
-
-    print F "}\n}\n}\n";
-    close F;
-    exit 0;
-}
diff --git a/Source/core/scripts/make_runtime_features.py b/Source/core/scripts/make_runtime_features.py
deleted file mode 100755
index ad84a25..0000000
--- a/Source/core/scripts/make_runtime_features.py
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env python
-# 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.path
-import sys
-
-from in_file import InFile
-import in_generator
-from name_utilities import lower_first
-import template_expander
-
-
-class RuntimeFeatureWriter(in_generator.Writer):
-    class_name = 'RuntimeEnabledFeatures'
-
-    # FIXME: valid_values and defaults should probably roll into one object.
-    valid_values = {
-        'status': ['stable', 'experimental', 'test'],
-    }
-    defaults = {
-        'condition' : None,
-        'depends_on' : [],
-        'custom': False,
-        'status': None,
-    }
-
-    def __init__(self, in_file_path, enabled_conditions):
-        super(RuntimeFeatureWriter, self).__init__(in_file_path, enabled_conditions)
-        self._outputs = {(self.class_name + ".h"): self.generate_header,
-                         (self.class_name + ".cpp"): self.generate_implementation,
-                        }
-
-        self._features = self.in_file.name_dictionaries
-        # Make sure the resulting dictionaries have all the keys we expect.
-        for feature in self._features:
-            feature['first_lowered_name'] = lower_first(feature['name'])
-            # Most features just check their isFooEnabled bool
-            # but some depend on more than one bool.
-            enabled_condition = "is%sEnabled" % feature['name']
-            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._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']
-
-    @template_expander.use_jinja(class_name + ".h.tmpl")
-    def generate_header(self):
-        return {
-            'features': self._features,
-            'feature_sets': self._feature_sets(),
-        }
-
-    @template_expander.use_jinja(class_name + ".cpp.tmpl")
-    def generate_implementation(self):
-        return {
-            'features': self._features,
-            'feature_sets': self._feature_sets(),
-        }
-
-
-if __name__ == "__main__":
-    in_generator.Maker(RuntimeFeatureWriter).main(sys.argv)
diff --git a/Source/core/scripts/make_style_builder.py b/Source/core/scripts/make_style_builder.py
deleted file mode 100755
index b408c94..0000000
--- a/Source/core/scripts/make_style_builder.py
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/env python
-# 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 re
-import sys
-
-import in_generator
-import template_expander
-
-
-class StyleBuilderWriter(in_generator.Writer):
-    class_name = 'StyleBuilder'
-
-    valid_values = {
-        'svg': [True, False],
-        'custom_all': [True, False],
-        'custom_initial': [True, False],
-        'custom_inherit': [True, False],
-        'custom_value': [True, False],
-    }
-    defaults = {
-        'condition': None,
-        'name_for_methods': None,
-        'use_handlers_for': None,
-        'svg': False,
-        'converter': None,
-# These depend on property name by default
-        'type_name': None,
-        'getter': None,
-        'setter': None,
-        'initial': None,
-# Setting these stops default handlers being generated
-# Setting custom_all is the same as setting the other three
-        'custom_all': False,
-        'custom_initial': False,
-        'custom_inherit': False,
-        'custom_value': False,
-    }
-
-    def __init__(self, in_files, enabled_conditions):
-        super(StyleBuilderWriter, self).__init__(in_files, enabled_conditions)
-        self._outputs = {("StyleBuilderFunctions.h"): self.generate_style_builder_functions_h,
-                         ("StyleBuilderFunctions.cpp"): self.generate_style_builder_functions_cpp,
-                         ("StyleBuilder.cpp"): self.generate_style_builder,
-                        }
-
-        self._properties = self.in_file.name_dictionaries
-
-        def set_if_none(property, key, value):
-            if property[key] is None:
-                property[key] = value
-
-        for property in self._properties:
-            cc = self._camelcase_property_name(property["name"])
-            property["property_id"] = "CSSProperty" + cc
-            cc = property["name_for_methods"] or cc.replace("Webkit", "")
-            property["camel_case_name"] = cc
-            set_if_none(property, "type_name", "E" + cc)
-            set_if_none(property, "getter", self._lower_first(cc))
-            set_if_none(property, "setter", "set" + cc)
-            set_if_none(property, "initial", "initial" + cc)
-            if property["custom_all"]:
-                property["custom_initial"] = True
-                property["custom_inherit"] = True
-                property["custom_value"] = True
-
-        self._properties = dict((property["property_id"], property) for property in self._properties)
-
-# FIXME: some of these might be better in a utils file
-    @staticmethod
-    def _camelcase_property_name(property_name):
-        return re.sub(r'(^[^-])|-(.)', lambda match: (match.group(1) or match.group(2)).upper(), property_name)
-
-    @staticmethod
-    def _lower_first(s):
-        return s[0].lower() + s[1:]
-
-    @staticmethod
-    def _upper_first(s):
-        return s[0].upper() + s[1:]
-
-    @template_expander.use_jinja("StyleBuilderFunctions.h.tmpl")
-    def generate_style_builder_functions_h(self):
-        return {
-            "properties": self._properties,
-        }
-
-    @template_expander.use_jinja("StyleBuilderFunctions.cpp.tmpl")
-    def generate_style_builder_functions_cpp(self):
-        return {
-            "properties": self._properties,
-        }
-
-    @template_expander.use_jinja("StyleBuilder.cpp.tmpl")
-    def generate_style_builder(self):
-        return {
-            "properties": self._properties,
-        }
-
-
-if __name__ == "__main__":
-    in_generator.Maker(StyleBuilderWriter).main(sys.argv)
diff --git a/Source/core/scripts/make_style_shorthands.py b/Source/core/scripts/make_style_shorthands.py
deleted file mode 100644
index c73de2f..0000000
--- a/Source/core/scripts/make_style_shorthands.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-# 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 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 re
-import sys
-from collections import defaultdict
-
-import in_generator
-import template_expander
-
-
-class StylePropertyShorthandWriter(in_generator.Writer):
-    class_name = 'StylePropertyShorthand'
-
-    defaults = {
-        'longhands': "",
-        'runtimeEnabledShorthand': None,
-    }
-
-    def __init__(self, in_files, enabled_conditions):
-        super(StylePropertyShorthandWriter, self).__init__(in_files, enabled_conditions)
-        self._outputs = {("StylePropertyShorthand.cpp"): self.generate_style_property_shorthand_cpp, ("StylePropertyShorthand.h"): self.generate_style_property_shorthand_h}
-
-        self._properties = self.in_file.name_dictionaries
-        self._longhand_dictionary = defaultdict(list)
-
-        for property in self._properties:
-            cc = self._camelcase_property_name(property["name"])
-            property["property_id"] = self._create_css_property_name_enum_value(cc)
-            cc = cc[0].lower() + cc[1:]
-            property["camel_case_name"] = cc
-            longhands = property["longhands"].split(';')
-            property["camel_case_longhands"] = list()
-            for longhand in longhands:
-                longhand = self._camelcase_property_name(longhand)
-                longhand = self._create_css_property_name_enum_value(longhand)
-                property["camel_case_longhands"].append(longhand)
-                self._longhand_dictionary[longhand].append(property)
-            if property["runtimeEnabledShorthand"] is not None:
-                lowerFirstConditional = self._lower_first(property["runtimeEnabledShorthand"])
-                property["runtime_conditional_getter"] = "%sEnabled" % lowerFirstConditional
-        self._properties = dict((property["property_id"], property) for property in self._properties)
-
-# FIXME: some of these might be better in a utils file
-    def _camelcase_property_name(self, property_name):
-        return re.sub(r'(^[^-])|-(.)', lambda match: (match.group(1) or match.group(2)).upper(), property_name)
-
-    def _create_css_property_name_enum_value(self, property_name):
-        return "CSSProperty" + property_name
-
-    def _lower_first(self, string):
-        lowered = string[0].lower() + string[1:]
-        lowered = lowered.replace("cSS", "css")
-        return lowered
-
-    @template_expander.use_jinja("StylePropertyShorthand.cpp.tmpl")
-    def generate_style_property_shorthand_cpp(self):
-        return {
-            "properties": self._properties,
-            "longhands_dictionary": self._longhand_dictionary,
-        }
-
-    @template_expander.use_jinja("StylePropertyShorthand.h.tmpl")
-    def generate_style_property_shorthand_h(self):
-        return {
-            "properties": self._properties,
-        }
-
-if __name__ == "__main__":
-    in_generator.Maker(StylePropertyShorthandWriter).main(sys.argv)
diff --git a/Source/core/scripts/make_token_matcher.py b/Source/core/scripts/make_token_matcher.py
deleted file mode 100755
index 10fae62..0000000
--- a/Source/core/scripts/make_token_matcher.py
+++ /dev/null
@@ -1,231 +0,0 @@
-#!/usr/bin/env python
-# 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 io
-import itertools
-import re
-import sys
-
-
-class BadInput(Exception):
-    """Unsupported input has been found."""
-
-
-class SwitchCase(object):
-    """Represents a CASE block."""
-    def __init__(self, identifier, block):
-        self.identifier = identifier
-        self.block = block
-
-
-class Optimizer(object):
-    """Generates optimized identifier matching code."""
-    def __init__(self, output_file, array_variable, length_variable):
-        self.output_file = output_file
-        self.array_variable = array_variable
-        self.length_variable = length_variable
-
-    def inspect(self, cases):
-        lengths = list(set([len(c.identifier) for c in cases]))
-        lengths.sort()
-
-        def response(length):
-            self.inspect_array([c for c in cases if len(c.identifier) == length], range(length))
-        self.write_selection(self.length_variable, lengths, str, response)
-
-    def score(self, alternatives):
-        return -sum([len(list(count)) ** 2 for _, count in itertools.groupby(sorted(alternatives))])
-
-    def choose_selection_pos(self, cases, pending):
-        candidates = [pos for pos in pending if all(alternative.isalpha() for alternative in [c.identifier[pos] for c in cases])]
-        if not candidates:
-            raise BadInput('Case-insensitive switching on non-alphabetic characters not yet implemented')
-        return sorted(candidates, key=lambda pos: self.score([c.identifier[pos] for c in cases]))[0]
-
-    def inspect_array(self, cases, pending):
-        assert len(cases) >= 1
-        if pending:
-            common = [pos for pos in pending
-                      if len(set([c.identifier[pos] for c in cases])) == 1]
-            if common:
-                identifier = cases[0].identifier
-                for index in xrange(len(common)):
-                    if index == 0:
-                        self.output_file.write(u'if (LIKELY(')
-                    else:
-                        self.output_file.write(u' && ')
-                    pos = common[index]
-                    if identifier[pos].isalpha():
-                        self.output_file.write("(%s[%d] | 0x20) == '%s'" %
-                                               (self.array_variable, pos, identifier[pos]))
-                    else:
-                        self.output_file.write("%s[%d] == '%s'" %
-                                               (self.array_variable, pos, identifier[pos]))
-                self.output_file.write(u')) {\n')
-                next_pending = list(set(pending) - set(common))
-                next_pending.sort()
-                self.inspect_array(cases, next_pending)
-                self.output_file.write(u'}\n')
-            else:
-                pos = self.choose_selection_pos(cases, pending)
-                next_pending = filter(lambda p: p != pos, pending)
-
-                alternatives = list(set([c.identifier[pos] for c in cases]))
-                alternatives.sort()
-
-                def literal(alternative):
-                    if isinstance(alternative, int):
-                        return str(alternative)
-                    else:
-                        return "'%s'" % alternative
-
-                def response(alternative):
-                    self.inspect_array([c for c in cases if c.identifier[pos] == alternative],
-                                       next_pending)
-
-                expression = '(%s[%d] | 0x20)' % (self.array_variable, pos)
-                self.write_selection(expression, alternatives, literal, response)
-        else:
-            assert len(cases) == 1
-            for block_line in cases[0].block:
-                self.output_file.write(block_line)
-
-    def write_selection(self, expression, alternatives, literal, response):
-        if len(alternatives) == 1:
-            self.output_file.write(u'if (LIKELY(%s == %s)) {\n' % (expression, literal(alternatives[0])))
-            response(alternatives[0])
-            self.output_file.write(u'}\n')
-        elif len(alternatives) == 2:
-            self.output_file.write(u'if (%s == %s) {\n' % (expression, literal(alternatives[0])))
-            response(alternatives[0])
-            self.output_file.write(u'} else if (LIKELY(%s == %s)) {\n' % (expression, literal(alternatives[1])))
-            response(alternatives[1])
-            self.output_file.write(u'}\n')
-        else:
-            self.output_file.write('switch (%s) {\n' % expression)
-            for alternative in alternatives:
-                self.output_file.write(u'case %s: {\n' % literal(alternative))
-                response(alternative)
-                self.output_file.write(u'} break;\n')
-            self.output_file.write(u'}\n')
-
-
-class LineProcessor(object):
-    def process_line(self, line):
-        pass
-
-
-class MainLineProcessor(LineProcessor):
-    """Processes the contents of an input file."""
-    SWITCH_PATTERN = re.compile(r'\s*SWITCH\s*\((\w*),\s*(\w*)\) \{$')
-
-    def __init__(self, output_file):
-        self.output_file = output_file
-
-    def process_line(self, line):
-        match_switch = MainLineProcessor.SWITCH_PATTERN.match(line)
-        if match_switch:
-            array_variable = match_switch.group(1)
-            length_variable = match_switch.group(2)
-            return SwitchLineProcessor(self, self.output_file, array_variable, length_variable)
-        else:
-            self.output_file.write(line)
-            return self
-
-
-class SwitchLineProcessor(LineProcessor):
-    """Processes the contents of a SWITCH block."""
-    CASE_PATTERN = re.compile(r'\s*CASE\s*\(\"([a-z0-9_\-\(]*)\"\) \{$')
-    CLOSE_BRACE_PATTERN = re.compile(r'\s*\}$')
-    EMPTY_PATTERN = re.compile(r'\s*$')
-
-    def __init__(self, parent, output_file, array_variable, length_variable):
-        self.parent = parent
-        self.output_file = output_file
-        self.array_variable = array_variable
-        self.length_variable = length_variable
-        self.cases = []
-
-    def process_line(self, line):
-        match_case = SwitchLineProcessor.CASE_PATTERN.match(line)
-        match_close_brace = SwitchLineProcessor.CLOSE_BRACE_PATTERN.match(line)
-        match_empty = SwitchLineProcessor.EMPTY_PATTERN.match(line)
-        if match_case:
-            identifier = match_case.group(1)
-            return CaseLineProcessor(self, self.output_file, identifier)
-        elif match_close_brace:
-            Optimizer(self.output_file, self.array_variable, self.length_variable).inspect(self.cases)
-            return self.parent
-        elif match_empty:
-            return self
-        else:
-            raise BadInput('Invalid line within SWITCH: %s' % line)
-
-    def add_case(self, latest_case):
-        if latest_case.identifier in [c.identifier for c in self.cases]:
-            raise BadInput('Repeated case: %s' % latest_case.identifier)
-        self.cases.append(latest_case)
-
-
-class CaseLineProcessor(LineProcessor):
-    """Processes the contents of a CASE block."""
-    CLOSE_BRACE_PATTERN = re.compile(r'\s*\}$')
-    BREAK_PATTERN = re.compile(r'break;')
-
-    def __init__(self, parent, output_file, identifier):
-        self.parent = parent
-        self.output_file = output_file
-        self.identifier = identifier
-        self.block = []
-
-    def process_line(self, line):
-        match_close_brace = CaseLineProcessor.CLOSE_BRACE_PATTERN.match(line)
-        match_break = CaseLineProcessor.BREAK_PATTERN.search(line)
-        if match_close_brace:
-            self.parent.add_case(SwitchCase(self.identifier, self.block))
-            return self.parent
-        elif match_break:
-            raise BadInput('break within CASE not supported: %s' % line)
-        else:
-            self.block.append(line)
-            return self
-
-
-def process_file(input_name, output_name):
-    """Transforms input file into legal C++ source code."""
-    with io.open(input_name, 'r', -1, 'utf-8') as input_file:
-        with io.open(output_name, 'w', -1, 'utf-8') as output_file:
-            processor = MainLineProcessor(output_file)
-            input_lines = input_file.readlines()
-            for line in input_lines:
-                processor = processor.process_line(line)
-
-
-if __name__ == '__main__':
-        process_file(sys.argv[1], sys.argv[2])
diff --git a/Source/core/scripts/make_token_matcher_unittest.py b/Source/core/scripts/make_token_matcher_unittest.py
deleted file mode 100755
index c0c8286..0000000
--- a/Source/core/scripts/make_token_matcher_unittest.py
+++ /dev/null
@@ -1,243 +0,0 @@
-#!/usr/bin/env python
-# 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 tempfile
-import unittest
-
-from make_token_matcher import BadInput, CaseLineProcessor, MainLineProcessor, Optimizer, process_file, SwitchCase, SwitchLineProcessor
-
-
-class OptimizerTest(unittest.TestCase):
-    def test_nonalphabetic(self):
-        optimizer = Optimizer(None, None, None)
-        self.assertRaises(
-            BadInput,
-            optimizer.inspect_array,
-            [SwitchCase('-', None), SwitchCase('x', None)],
-            [0])
-
-
-class MainLineProcessorTest(unittest.TestCase):
-    def test_switch(self):
-        processor = MainLineProcessor(None)
-        switchLineProcessor = processor.process_line('SWITCH(array, length) {')
-        self.assertIsInstance(switchLineProcessor, SwitchLineProcessor)
-        self.assertEquals('array', switchLineProcessor.array_variable)
-        self.assertEquals('length', switchLineProcessor.length_variable)
-
-
-class SwitchLineProcessorTest(unittest.TestCase):
-    def test_case(self):
-        processor = SwitchLineProcessor(None, None, None, None)
-        caseLineProcessor = processor.process_line('CASE("identifier") {')
-        self.assertIsInstance(caseLineProcessor, CaseLineProcessor)
-        self.assertEquals('identifier', caseLineProcessor.identifier)
-
-    def test_unexpected(self):
-        processor = SwitchLineProcessor(None, None, None, None)
-        self.assertRaises(
-            BadInput,
-            processor.process_line,
-            'unexpected')
-
-    def test_repeated(self):
-        processor = SwitchLineProcessor(None, None, None, None)
-        processor.process_line('CASE("x") {').process_line('}')
-        caseLineProcessor = processor.process_line('CASE("x") {')
-        self.assertRaises(
-            BadInput,
-            caseLineProcessor.process_line,
-            '}')
-
-
-class CaseLineProcessorTest(unittest.TestCase):
-    def test_break(self):
-        processor = CaseLineProcessor(None, None, None)
-        self.assertRaises(
-            BadInput,
-            processor.process_line,
-            'break;')
-
-
-class ProcessFileTest(unittest.TestCase):
-    SOURCE_SMALL = """
-        SWITCH(p, q) {
-            CASE("a(") {
-                X;
-            }
-            CASE("b(") {
-                Y;
-            }
-        }
-        """
-
-    EXPECTED_SMALL = """
-        if (LIKELY(q == 2)) {
-            if (LIKELY(p[1] == '(')) {
-                if ((p[0] | 0x20) == 'a') {
-                    X;
-                } else if (LIKELY((p[0] | 0x20) == 'b')) {
-                    Y;
-                }
-            }
-        }
-        """
-
-    SOURCE_MEDIUM = """
-        SWITCH (p, q) {
-            CASE ("ab") {
-                X;
-            }
-            CASE ("cd") {
-                Y;
-            }
-            CASE ("ed") {
-                Z;
-            }
-        }
-        """
-
-    EXPECTED_MEDIUM = """
-        if (LIKELY(q == 2)) {
-            if ((p[1] | 0x20) == 'b') {
-                if (LIKELY((p[0] | 0x20) == 'a')) {
-                    X;
-                }
-            } else if (LIKELY((p[1] | 0x20) == 'd')) {
-                if ((p[0] | 0x20) == 'c') {
-                    Y;
-                } else if (LIKELY((p[0] | 0x20) == 'e')) {
-                    Z;
-                }
-            }
-        }
-        """
-
-    SOURCE_LARGE = """
-        prefix;
-        SWITCH(p, q) {
-            CASE("hij") {
-                R;
-            }
-            CASE("efg") {
-                S;
-            }
-            CASE("c-") {
-                T;
-            }
-            CASE("klm") {
-                U;
-            }
-
-            CASE("d-") {
-                V;
-            }
-            CASE("a") {
-                W;
-                X;
-            }
-            CASE("b-") {
-                Y;
-                Z;
-            }
-        }
-        suffix;
-        """
-
-    EXPECTED_LARGE = """
-        prefix;
-        switch (q) {
-        case 1: {
-            if (LIKELY((p[0] | 0x20) == 'a')) {
-                W;
-                X;
-            }
-        } break;
-        case 2: {
-            if (LIKELY(p[1] == '-')) {
-                switch ((p[0] | 0x20)) {
-                case 'b': {
-                    Y;
-                    Z;
-                } break;
-                case 'c': {
-                    T;
-                } break;
-                case 'd': {
-                    V;
-                } break;
-                }
-            }
-        } break;
-        case 3: {
-            switch ((p[0] | 0x20)) {
-            case 'e': {
-                if (LIKELY((p[1] | 0x20) == 'f' && (p[2] | 0x20) == 'g')) {
-                    S;
-                }
-            } break;
-            case 'h': {
-                if (LIKELY((p[1] | 0x20) == 'i' && (p[2] | 0x20) == 'j')) {
-                    R;
-                }
-            } break;
-            case 'k': {
-                if (LIKELY((p[1] | 0x20) == 'l' && (p[2] | 0x20) == 'm')) {
-                    U;
-                }
-            } break;
-            }
-        } break;
-        }
-        suffix;
-        """
-
-    def validate(self, source, expected):
-        with tempfile.NamedTemporaryFile() as input_file:
-            with tempfile.NamedTemporaryFile() as generated_file:
-                input_file.write(source)
-                input_file.flush()
-                process_file(input_file.name, generated_file.name)
-                # Our code generation does not yet implement pretty indentation.
-                actual = generated_file.read().replace('    ', '')
-                expected = expected.replace('    ', '')
-                self.assertEquals(actual, expected)
-
-    def test_small(self):
-        self.validate(ProcessFileTest.SOURCE_SMALL, ProcessFileTest.EXPECTED_SMALL)
-
-    def test_medium(self):
-        self.validate(ProcessFileTest.SOURCE_MEDIUM, ProcessFileTest.EXPECTED_MEDIUM)
-
-    def test_large(self):
-        self.validate(ProcessFileTest.SOURCE_LARGE, ProcessFileTest.EXPECTED_LARGE)
-
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/Source/core/scripts/name_macros.py b/Source/core/scripts/name_macros.py
deleted file mode 100644
index 01d3644..0000000
--- a/Source/core/scripts/name_macros.py
+++ /dev/null
@@ -1,175 +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.
-
-import os.path
-import re
-
-import in_generator
-from in_generator import Maker
-import license
-
-
-HEADER_TEMPLATE = """%(license)s
-
-#ifndef %(class_name)sHeaders_h
-#define %(class_name)sHeaders_h
-
-%(includes)s
-
-#endif // %(class_name)sHeaders_h
-"""
-
-
-INTERFACES_HEADER_TEMPLATE = """%(license)s
-
-#ifndef %(class_name)sInterfaces_h
-#define %(class_name)sInterfaces_h
-
-%(declare_conditional_macros)s
-
-#define %(macro_style_name)s_INTERFACES_FOR_EACH(macro) \\
-    \\
-%(unconditional_macros)s
-    \\
-%(conditional_macros)s
-
-#endif // %(class_name)sInterfaces_h
-"""
-
-
-def _to_macro_style(name):
-    s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
-    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).upper()
-
-
-class Writer(in_generator.Writer):
-    def __init__(self, in_file_path, enabled_conditions):
-        super(Writer, self).__init__(in_file_path, enabled_conditions)
-        self.class_name = self.in_file.parameters['namespace'].strip('"')
-        self._entries_by_conditional = {}
-        self._unconditional_entries = []
-        self._sort_entries_by_conditional()
-        self._outputs = {(self.class_name + "Headers.h"): self.generate_headers_header,
-                         (self.class_name + "Interfaces.h"): self.generate_interfaces_header,
-                        }
-
-    def _sort_entries_by_conditional(self):
-        unconditional_names = set()
-        for entry in self.in_file.name_dictionaries:
-            conditional = entry['Conditional']
-            if not conditional:
-                name = self._class_name_for_entry(entry)
-                if name in unconditional_names:
-                    continue
-                unconditional_names.add(name)
-                self._unconditional_entries.append(entry)
-                continue
-        for entry in self.in_file.name_dictionaries:
-            name = self._class_name_for_entry(entry)
-            if name in unconditional_names:
-                continue
-            conditional = entry['Conditional']
-            if not conditional in self._entries_by_conditional:
-                self._entries_by_conditional[conditional] = []
-            self._entries_by_conditional[conditional].append(entry)
-
-    def _class_name_for_entry(self, entry):
-        if entry['ImplementedAs']:
-            return entry['ImplementedAs']
-        return os.path.basename(entry['name'])
-
-    def _headers_header_include_path(self, entry):
-        if entry['ImplementedAs']:
-            path = os.path.dirname(entry['name'])
-            if len(path):
-                path += '/'
-            path += entry['ImplementedAs']
-        else:
-            path = entry['name']
-        return path + '.h'
-
-    def _headers_header_includes(self, entries):
-        includes = dict()
-        for entry in entries:
-            class_name = self._class_name_for_entry(entry)
-            # Avoid duplicate includes.
-            if class_name in includes:
-                continue
-            include = '#include "%(path)s"\n#include "V8%(js_name)s.h"' % {
-                'path': self._headers_header_include_path(entry),
-                'js_name': os.path.basename(entry['name']),
-            }
-            includes[class_name] = self.wrap_with_condition(include, entry['Conditional'])
-        return includes.values()
-
-    def generate_headers_header(self):
-        return HEADER_TEMPLATE % {
-            'license': license.license_for_generated_cpp(),
-            'class_name': self.class_name,
-            'includes': '\n'.join(self._headers_header_includes(self.in_file.name_dictionaries)),
-        }
-
-    def _declare_one_conditional_macro(self, conditional, entries):
-        macro_name = '%(macro_style_name)s_INTERFACES_FOR_EACH_%(conditional)s' % {
-            'macro_style_name': _to_macro_style(self.class_name),
-            'conditional': conditional,
-        }
-        return self.wrap_with_condition("""#define %(macro_name)s(macro) \\
-%(declarations)s
-
-#else
-#define %(macro_name)s(macro)""" % {
-            'macro_name': macro_name,
-            'declarations': '\n'.join(sorted(set([
-                '    macro(%(name)s) \\' % {'name': self._class_name_for_entry(entry)}
-                for entry in entries]))),
-        }, conditional)
-
-    def _declare_conditional_macros(self):
-        return '\n'.join([
-            self._declare_one_conditional_macro(conditional, entries)
-            for conditional, entries in self._entries_by_conditional.items()])
-
-    def _unconditional_macro(self, entry):
-        return '    macro(%(name)s) \\' % {'name': self._class_name_for_entry(entry)}
-
-    def _conditional_macros(self, conditional):
-        return '    %(macro_style_name)s_INTERFACES_FOR_EACH_%(conditional)s(macro) \\' % {
-            'macro_style_name': _to_macro_style(self.class_name),
-            'conditional': conditional,
-        }
-
-    def generate_interfaces_header(self):
-        return INTERFACES_HEADER_TEMPLATE % {
-            'license': license.license_for_generated_cpp(),
-            'class_name': self.class_name,
-            'macro_style_name': _to_macro_style(self.class_name),
-            'declare_conditional_macros': self._declare_conditional_macros(),
-            'unconditional_macros': '\n'.join(sorted(set(map(self._unconditional_macro, self._unconditional_entries)))),
-            'conditional_macros': '\n'.join(map(self._conditional_macros, self._entries_by_conditional.keys())),
-        }
diff --git a/Source/core/scripts/name_utilities.py b/Source/core/scripts/name_utilities.py
deleted file mode 100644
index c4993b0..0000000
--- a/Source/core/scripts/name_utilities.py
+++ /dev/null
@@ -1,40 +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.
-
-ACRONYMS = ['CSS', 'HTML', 'IME', 'JS', 'SVG', 'URL', 'WOFF', 'XML', 'XSLT']
-
-
-def lower_first(name):
-    """Return name with first letter or initial acronym lowercased.
-
-    E.g., 'SetURL' becomes 'setURL', but 'URLFoo' becomes 'urlFoo'.
-    """
-    for acronym in ACRONYMS:
-        if name.startswith(acronym):
-            return name.replace(acronym, acronym.lower())
-    return name[0].lower() + name[1:]
diff --git a/Source/core/scripts/preprocessor.pm b/Source/core/scripts/preprocessor.pm
deleted file mode 100644
index 95995f0..0000000
--- a/Source/core/scripts/preprocessor.pm
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org>
-# Copyright (C) 2011 Google Inc.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-#
-
-use strict;
-use warnings;
-
-use Config;
-use IPC::Open2;
-use IPC::Open3;
-
-BEGIN {
-   use Exporter   ();
-   our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
-   $VERSION     = 1.00;
-   @ISA         = qw(Exporter);
-   @EXPORT      = qw(&applyPreprocessor);
-   %EXPORT_TAGS = ( );
-   @EXPORT_OK   = ();
-}
-
-# Returns an array of lines.
-sub applyPreprocessor
-{
-    my $fileName = shift;
-    my $defines = shift;
-    my $preprocessor = shift;
-
-    my @args = ();
-    if (!$preprocessor) {
-        require Config;
-        if ($ENV{CC}) {
-            $preprocessor = $ENV{CC};
-        } elsif (($Config::Config{'osname'}) =~ /solaris/i) {
-            $preprocessor = "/usr/sfw/bin/gcc";
-        } else {
-            $preprocessor = "/usr/bin/gcc";
-        }
-        push(@args, qw(-E -P -x c++));
-    }
-
-    # Remove double quotations from $defines and extract macros.
-    # For example, if $defines is ' "A=1" "B=1" C=1 ""    D  ',
-    # then it is converted into four macros -DA=1, -DB=1, -DC=1 and -DD.
-    $defines =~ s/\"//g;
-    my @macros = grep { $_ } split(/\s+/, $defines); # grep skips empty macros.
-    @macros = map { "-D$_" } @macros;
-
-    my $pid = 0;
-    if ($Config{osname} eq "cygwin" || $Config{osname} eq 'MSWin32') {
-        # This call can fail if Windows rebases cygwin, so retry a few times until it succeeds.
-        for (my $tries = 0; !$pid && ($tries < 20); $tries++) {
-            eval {
-                # Suppress STDERR so that if we're using cl.exe, the output
-                # name isn't needlessly echoed.
-                use Symbol 'gensym'; my $err = gensym;
-                $pid = open3(\*PP_IN, \*PP_OUT, $err, split(' ', $preprocessor), @args, @macros, $fileName);
-                1;
-            } or do {
-                sleep 1;
-            }
-        };
-    } else {
-        $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), @args, @macros, $fileName);
-    }
-    close PP_IN;
-    my @documentContent = <PP_OUT>;
-    close PP_OUT;
-    waitpid($pid, 0);
-    return @documentContent;
-}
-
-1;
diff --git a/Source/core/scripts/rule_bison.py b/Source/core/scripts/rule_bison.py
deleted file mode 100644
index 97a0541..0000000
--- a/Source/core/scripts/rule_bison.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/python
-#
-# 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
-# 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.
-#
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# usage: rule_bison.py INPUT_FILE OUTPUT_DIR [BISON_EXE]
-# INPUT_FILE is a path to either CSSGrammar.y or XPathGrammar.y.
-# OUTPUT_DIR is where the bison-generated .cpp and .h files should be placed.
-
-import errno
-import os
-import os.path
-import subprocess
-import sys
-
-assert len(sys.argv) == 3 or len(sys.argv) == 4
-
-inputFile = sys.argv[1]
-outputDir = sys.argv[2]
-bisonExe = 'bison'
-if len(sys.argv) > 3:
-    bisonExe = sys.argv[3]
-
-inputName = os.path.basename(inputFile)
-assert inputName == 'CSSGrammar.y' or inputName == 'XPathGrammar.y'
-prefix = {'CSSGrammar.y': 'cssyy', 'XPathGrammar.y': 'xpathyy'}[inputName]
-
-(inputRoot, inputExt) = os.path.splitext(inputName)
-
-# The generated .h will be in a different location depending on the bison
-# version.
-outputHTries = [
-    os.path.join(outputDir, inputRoot + '.cpp.h'),
-    os.path.join(outputDir, inputRoot + '.hpp'),
-]
-
-for outputHTry in outputHTries:
-    try:
-        os.unlink(outputHTry)
-    except OSError, e:
-        if e.errno != errno.ENOENT:
-            raise
-
-outputCpp = os.path.join(outputDir, inputRoot + '.cpp')
-
-returnCode = subprocess.call([bisonExe, '-d', '-p', prefix, inputFile, '-o', outputCpp])
-assert returnCode == 0
-
-# Find the name that bison used for the generated header file.
-outputHTmp = None
-for outputHTry in outputHTries:
-    try:
-        os.stat(outputHTry)
-        outputHTmp = outputHTry
-        break
-    except OSError, e:
-        if e.errno != errno.ENOENT:
-            raise
-
-assert outputHTmp != None
-
-# Read the header file in under the generated name and remove it.
-outputHFile = open(outputHTmp)
-outputHContents = outputHFile.read()
-outputHFile.close()
-os.unlink(outputHTmp)
-
-# Rewrite the generated header with #include guards.
-outputH = os.path.join(outputDir, inputRoot + '.h')
-
-outputHFile = open(outputH, 'w')
-print >>outputHFile, '#ifndef %sH' % inputRoot
-print >>outputHFile, '#define %sH' % inputRoot
-print >>outputHFile, outputHContents
-print >>outputHFile, '#endif'
-outputHFile.close()
diff --git a/Source/core/scripts/template_expander.py b/Source/core/scripts/template_expander.py
deleted file mode 100644
index b1e99b6..0000000
--- a/Source/core/scripts/template_expander.py
+++ /dev/null
@@ -1,54 +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.
-
-import os
-import sys
-
-_current_dir = os.path.dirname(os.path.realpath(__file__))
-# jinja2 is in chromium's third_party directory
-# Insert at front to override system libraries, and after path[0] == script dir
-sys.path.insert(1, 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]), keep_trailing_newline=True)
-    template = jinja_env.get_template(basename)
-    return template.render(params)
-
-
-def use_jinja(template_file_name):
-    def real_decorator(generator):
-        def generator_internal(*args, **kwargs):
-            parameters = generator(*args, **kwargs)
-            return apply_template(template_file_name, parameters)
-        generator_internal.func_name = generator.func_name
-        return generator_internal
-    return real_decorator
diff --git a/Source/core/scripts/templates/InternalRuntimeFlags.h.tmpl b/Source/core/scripts/templates/InternalRuntimeFlags.h.tmpl
deleted file mode 100644
index c2d1a36..0000000
--- a/Source/core/scripts/templates/InternalRuntimeFlags.h.tmpl
+++ /dev/null
@@ -1,39 +0,0 @@
-{% 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
deleted file mode 100644
index 92838f2..0000000
--- a/Source/core/scripts/templates/InternalRuntimeFlags.idl.tmpl
+++ /dev/null
@@ -1,14 +0,0 @@
-{% from "macros.tmpl" import license -%}
-{{ license() }}
-
-[
-] 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
deleted file mode 100644
index 9de600f..0000000
--- a/Source/core/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl
+++ /dev/null
@@ -1,24 +0,0 @@
-{% 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
deleted file mode 100644
index e9eab83..0000000
--- a/Source/core/scripts/templates/RuntimeEnabledFeatures.h.tmpl
+++ /dev/null
@@ -1,47 +0,0 @@
-{% 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/scripts/templates/StyleBuilder.cpp.tmpl b/Source/core/scripts/templates/StyleBuilder.cpp.tmpl
deleted file mode 100644
index 94b468d..0000000
--- a/Source/core/scripts/templates/StyleBuilder.cpp.tmpl
+++ /dev/null
@@ -1,85 +0,0 @@
-{% from "macros.tmpl" import wrap_with_condition, license -%}
-{{ license() }}
-
-#include "config.h"
-#include "core/css/resolver/StyleBuilder.h"
-
-#include "StyleBuilderFunctions.h"
-#include "core/css/CSSPrimitiveValueMappings.h"
-#include "core/css/resolver/StyleResolverState.h"
-
-// FIXME: currently we're just generating a switch statement, but we should
-//   test other variations for performance once we have more properties here.
-
-{%- macro set_value(property) %}
-{%- if property.svg -%}
-    state.style()->accessSVGStyle()->{{property.setter}}
-{%- else -%}
-    state.style()->{{property.setter}}
-{%- endif %}
-{%- endmacro %}
-
-namespace WebCore {
-
-{%- for property_id, property in properties.items() if not property.use_handlers_for %}
-{%- call wrap_with_condition(property.condition) %}
-{%- set apply_type = property.apply_type %}
-
-{%- if not property.custom_initial %}
-void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& state)
-{
-{%- if property.svg %}
-    {{ set_value(property) }}(SVGRenderStyle::{{property.initial}}());
-{%- else %}
-    {{ set_value(property) }}(RenderStyle::{{property.initial}}());
-{%- endif %}
-}
-{% endif %}
-
-{%- if not property.custom_inherit %}
-void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& state)
-{
-{%- if property.svg %}
-    {{ set_value(property) }}(state.parentStyle()->svgStyle()->{{property.getter}}());
-{%- else %}
-    {{ set_value(property) }}(state.parentStyle()->{{property.getter}}());
-{%- endif %}
-}
-{% endif %}
-
-{%- if not property.custom_value %}
-void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state, CSSValue* value)
-{
-{%- if property.converter %}
-    {{ set_value(property) }}(StyleBuilderConverter::{{property.converter}}(state, value));
-{%- else %}
-    {{ set_value(property) }}(static_cast<{{property.type_name}}>(*toCSSPrimitiveValue(value)));
-{%- endif %}
-}
-{% endif %}
-
-{%- endcall %}
-{%- endfor %}
-
-bool StyleBuilder::applyProperty(CSSPropertyID property, StyleResolverState& state, CSSValue* value, bool isInitial, bool isInherit) {
-    switch(property) {
-{%- for property_id, property in properties.items() %}
-{%- set used_property = properties[property.use_handlers_for] or property %}
-{%- set used_property_id = used_property.property_id %}
-{%- call wrap_with_condition(used_property.condition) %}
-    case {{ property_id }}:
-        if (isInitial)
-            StyleBuilderFunctions::applyInitial{{ used_property_id }}(state);
-        else if (isInherit)
-            StyleBuilderFunctions::applyInherit{{ used_property_id }}(state);
-        else
-            StyleBuilderFunctions::applyValue{{ used_property_id }}(state, value);
-        return true;
-{%- endcall %}
-{% endfor %}
-    default:
-        return false;
-    }
-}
-
-} // namespace WebCore
diff --git a/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl b/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl
deleted file mode 100644
index 4be798f..0000000
--- a/Source/core/scripts/templates/StyleBuilderFunctions.cpp.tmpl
+++ /dev/null
@@ -1,519 +0,0 @@
-{% from "macros.tmpl" import lower_first -%}
-
-{#
-    This file is for property handlers which use the templating engine to
-    reduce (handwritten) code duplication.
-
-    The `properties' dict can be used to access a property's parameters in
-    jinja2 templates (i.e. setter, getter, initial, type_name)
--#}
-
-#include "config.h"
-#include "StyleBuilderFunctions.h"
-
-#include "CSSValueKeywords.h"
-#include "core/css/BasicShapeFunctions.h"
-#include "core/css/CSSPrimitiveValueMappings.h"
-#include "core/css/Pair.h"
-#include "core/css/resolver/StyleResolverState.h"
-#include "core/platform/animation/CSSAnimationDataList.h"
-
-
-{%- macro declare_initial_function(property_id) -%}
-void StyleBuilderFunctions::applyInitial{{property_id}}(StyleResolverState& state)
-{%- endmacro %}
-
-{%- macro declare_inherit_function(property_id) -%}
-void StyleBuilderFunctions::applyInherit{{property_id}}(StyleResolverState& state)
-{%- endmacro %}
-
-{%- macro declare_value_function(property_id) -%}
-void StyleBuilderFunctions::applyValue{{property_id}}(StyleResolverState& state, CSSValue* value)
-{%- endmacro %}
-
-// FIXME: This is duplicated in StyleBuilder.cpp.tmpl, but we'll move the
-// function definitions there over to here later.
-{%- macro set_value(property) %}
-{%- if property.svg -%}
-    state.style()->accessSVGStyle()->{{property.setter}}
-{%- else -%}
-    state.style()->{{property.setter}}
-{%- endif -%}
-{%- endmacro %}
-
-namespace WebCore {
-
-{%- macro apply_animation(property_id, attribute, animation) %}
-{{ declare_initial_function(property_id) }}
-{
-    CSSAnimationDataList* list = state.style()->access{{animation}}();
-    if (list->isEmpty())
-        list->append(CSSAnimationData::create());
-    list->animation(0)->set{{attribute}}(CSSAnimationData::initialAnimation{{attribute}}());
-    {%- if property_id == "CSSPropertyWebkitTransitionProperty" %}
-        list->animation(0)->setAnimationMode(CSSAnimationData::AnimateAll);
-    {%- endif %}
-    for (size_t i = 1; i < list->size(); ++i)
-        list->animation(i)->clear{{attribute}}();
-}
-
-{{ declare_inherit_function(property_id) }}
-{
-    CSSAnimationDataList* list = state.style()->access{{animation}}();
-    const CSSAnimationDataList* parentList = state.parentStyle()->{{animation|lower}}();
-    size_t i = 0, parentSize = parentList ? parentList->size() : 0;
-    for ( ; i < parentSize && parentList->animation(i)->is{{attribute}}Set(); ++i) {
-        ASSERT(list->size() >= i);
-        if (list->size() == i)
-            list->append(CSSAnimationData::create());
-        list->animation(i)->set{{attribute}}(parentList->animation(i)->{{lower_first(attribute)}}());
-        list->animation(i)->setAnimationMode(parentList->animation(i)->animationMode());
-    }
-
-    // Reset any remaining animations to not have the property set.
-    for ( ; i < list->size(); ++i)
-        list->animation(i)->clear{{attribute}}();
-}
-
-{{ declare_value_function(property_id) }}
-{
-    CSSAnimationDataList* list = state.style()->access{{animation}}();
-    size_t childIndex = 0;
-    if (value->isValueList()) {
-        // Walk each value and put it into an animation, creating new animations as needed.
-        for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
-            ASSERT(list->size() >= childIndex);
-            if (list->size() == childIndex)
-                list->append(CSSAnimationData::create());
-            state.styleMap().mapAnimation{{attribute}}(list->animation(childIndex), i.value());
-            ++childIndex;
-        }
-    } else {
-        if (list->isEmpty())
-            list->append(CSSAnimationData::create());
-        state.styleMap().mapAnimation{{attribute}}(list->animation(childIndex), value);
-        childIndex = 1;
-    }
-    for ( ; childIndex < list->size(); ++childIndex) {
-        // Reset all remaining animations to not have the property set.
-        list->animation(childIndex)->clear{{attribute}}();
-    }
-}
-{%- endmacro %}
-
-{{ apply_animation("CSSPropertyWebkitAnimationDelay", "Delay", "Animations") }}
-{{ apply_animation("CSSPropertyWebkitAnimationDirection", "Direction", "Animations") }}
-{{ apply_animation("CSSPropertyWebkitAnimationDuration", "Duration", "Animations") }}
-{{ apply_animation("CSSPropertyWebkitAnimationFillMode", "FillMode", "Animations") }}
-{{ apply_animation("CSSPropertyWebkitAnimationIterationCount", "IterationCount", "Animations") }}
-{{ apply_animation("CSSPropertyWebkitAnimationName", "Name", "Animations") }}
-{{ apply_animation("CSSPropertyWebkitAnimationPlayState", "PlayState", "Animations") }}
-{{ apply_animation("CSSPropertyWebkitAnimationTimingFunction", "TimingFunction", "Animations") }}
-{{ apply_animation("CSSPropertyWebkitTransitionDelay", "Delay", "Transitions") }}
-{{ apply_animation("CSSPropertyWebkitTransitionDuration", "Duration", "Transitions") }}
-{{ apply_animation("CSSPropertyWebkitTransitionProperty", "Property", "Transitions") }}
-{{ apply_animation("CSSPropertyWebkitTransitionTimingFunction", "TimingFunction", "Transitions") }}
-
-{%- macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_identity="CSSValueAuto", compute_length=false) %}
-{%- set property = properties[property_id] %}
-{%- set auto_getter = auto_getter or "hasAuto" + property.camel_case_name %}
-{%- set auto_setter = auto_setter or "setHasAuto" + property.camel_case_name %}
-{{ declare_initial_function(property_id) }}
-{
-    state.style()->{{auto_setter}}();
-}
-
-{{ declare_inherit_function(property_id) }}
-{
-    if (state.parentStyle()->{{auto_getter}}())
-        state.style()->{{auto_setter}}();
-    else
-        {{ set_value(property) }}(state.parentStyle()->{{property.getter}}());
-}
-
-{{ declare_value_function(property_id) }}
-{
-    if (!value->isPrimitiveValue())
-        return;
-
-    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-    if (primitiveValue->getValueID() == {{auto_identity}})
-        state.style()->{{auto_setter}}();
-    else
-    {%- if compute_length %}
-        {{ set_value(property) }}(primitiveValue->computeLength<{{property.type_name}}>(state.style(), state.rootElementStyle(), state.style()->effectiveZoom()));
-    {%- else %}
-        {{ set_value(property) }}(*primitiveValue);
-    {%- endif %}
-}
-{%- endmacro %}
-
-{{ apply_auto("CSSPropertyOrphans") }}
-{{ apply_auto("CSSPropertyWebkitColumnCount") }}
-{{ apply_auto("CSSPropertyWebkitColumnGap", auto_getter="hasNormalColumnGap", auto_setter="setHasNormalColumnGap", auto_identity="CSSValueNormal", compute_length=true) }}
-{{ apply_auto("CSSPropertyWebkitColumnWidth", compute_length=true) }}
-{{ apply_auto("CSSPropertyWidows") }}
-{{ apply_auto("CSSPropertyZIndex") }}
-
-{%- macro apply_value_border_image(property_id) %}
-{{ declare_value_function(property_id) }}
-{
-    {%- set property = properties[property_id] %}
-    NinePieceImage image;
-    {%- if property_id == "CSSPropertyWebkitMaskBoxImage" %}
-    image.setMaskDefaults();
-    {%- endif %}
-    state.styleMap().mapNinePieceImage(state.style(), {{property_id}}, value, image);
-    {{ set_value(property) }}(image);
-}
-{%- endmacro %}
-
-{{ apply_value_border_image("CSSPropertyWebkitBorderImage") }}
-{{ apply_value_border_image("CSSPropertyWebkitMaskBoxImage") }}
-
-{%- macro apply_border_image_modifier(property_id, modifier_type) %}
-{%- set is_mask_box = "MaskBox" in property_id %}
-{%- set getter = "maskBoxImage" if is_mask_box else "borderImage" %}
-{%- set setter = "setMaskBoxImage" if is_mask_box else "setBorderImage" %}
-{{ declare_initial_function(property_id) }}
-{
-    NinePieceImage image(state.style()->{{getter}}());
-    {%- if modifier_type == "Outset" %}
-    image.setOutset(LengthBox(0));
-    {%- elif modifier_type == "Repeat" %}
-    image.setHorizontalRule(StretchImageRule);
-    image.setVerticalRule(StretchImageRule);
-    {%- elif modifier_type == "Slice" %}
-    // Masks have a different initial value for slices. Preserve the value of 0 for backwards compatibility.
-    image.setImageSlices(LengthBox({{ (["Length(100, Percent)"]*4) | join(", ") if not is_mask_box }}));
-    image.setFill(false);
-    {%- elif modifier_type == "Width" %}
-    // Masks have a different initial value for widths. Preserve the value of 0 for backwards compatibility.
-    image.setBorderSlices(LengthBox({{ (["Length(1, Relative)"]*4) | join(", ") if not is_mask_box }}));
-    {%- endif %}
-    state.style()->{{setter}}(image);
-}
-
-{{ declare_inherit_function(property_id) }}
-{
-    NinePieceImage image(state.style()->{{getter}}());
-    {%- if modifier_type == "Outset" %}
-    image.copyOutsetFrom(state.parentStyle()->{{getter}}());
-    {%- elif modifier_type == "Repeat" %}
-    image.copyRepeatFrom(state.parentStyle()->{{getter}}());
-    {%- elif modifier_type == "Slice" %}
-    image.copyImageSlicesFrom(state.parentStyle()->{{getter}}());
-    {%- elif modifier_type == "Width" %}
-    image.copyBorderSlicesFrom(state.parentStyle()->{{getter}}());
-    {%- endif %}
-    state.style()->{{setter}}(image);
-}
-
-{{ declare_value_function(property_id) }}
-{
-    NinePieceImage image(state.style()->{{getter}}());
-    {%- if modifier_type == "Outset" %}
-    image.setOutset(state.styleMap().mapNinePieceImageQuad(value));
-    {%- elif modifier_type == "Repeat" %}
-    state.styleMap().mapNinePieceImageRepeat(value, image);
-    {%- elif modifier_type == "Slice" %}
-    state.styleMap().mapNinePieceImageSlice(value, image);
-    {%- elif modifier_type == "Width" %}
-    image.setBorderSlices(state.styleMap().mapNinePieceImageQuad(value));
-    {%- endif %}
-    state.style()->{{setter}}(image);
-}
-{%- endmacro %}
-
-{{ apply_border_image_modifier("CSSPropertyBorderImageOutset", "Outset") }}
-{{ apply_border_image_modifier("CSSPropertyBorderImageRepeat", "Repeat") }}
-{{ apply_border_image_modifier("CSSPropertyBorderImageSlice", "Slice") }}
-{{ apply_border_image_modifier("CSSPropertyBorderImageWidth", "Width") }}
-{{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageOutset", "Outset") }}
-{{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageRepeat", "Repeat") }}
-{{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageSlice", "Slice") }}
-{{ apply_border_image_modifier("CSSPropertyWebkitMaskBoxImageWidth", "Width") }}
-
-{%- macro apply_value_border_image_source(property_id) %}
-{{ declare_value_function(property_id) }}
-{
-    {%- set property = properties[property_id] %}
-    {{ set_value(property) }}(state.styleImage({{property_id}}, value));
-}
-{%- endmacro %}
-
-{{ apply_value_border_image_source("CSSPropertyBorderImageSource") }}
-{{ apply_value_border_image_source("CSSPropertyWebkitMaskBoxImageSource") }}
-
-{%- macro apply_color(property_id, default_getter="color", initial_color=none, inherit_color=false) %}
-{%- set property = properties[property_id] %}
-{%- set visited_link_setter = "setVisitedLink" + property.camel_case_name %}
-{{ declare_initial_function(property_id) }}
-{
-    Color color = {{ initial_color or "Color" -}}();
-    if (state.applyPropertyToRegularStyle())
-        {{ set_value(property) }}(color);
-    if (state.applyPropertyToVisitedLinkStyle())
-        state.style()->{{visited_link_setter}}(color);
-}
-
-{{ declare_inherit_function(property_id) }}
-{
-    // Visited link style can never explicitly inherit from parent visited link style so no separate getters are needed.
-    Color color = state.parentStyle()->{{property.getter}}();
-    if (!color.isValid())
-        color = state.parentStyle()->{{default_getter}}();
-    if (state.applyPropertyToRegularStyle())
-        {{ set_value(property) }}(color);
-    if (state.applyPropertyToVisitedLinkStyle())
-        state.style()->{{visited_link_setter}}(color);
-}
-
-{{ declare_value_function(property_id) }}
-{
-    if (!value->isPrimitiveValue())
-        return;
-
-    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-
-{%- if inherit_color %}
-    if (primitiveValue->getValueID() == CSSValueCurrentcolor) {
-        applyInherit{{property_id}}(state);
-        return;
-    }
-{%- endif %}
-
-    if (state.applyPropertyToRegularStyle())
-        {{ set_value(property) }}(state.document().textLinkColors().colorFromPrimitiveValue(primitiveValue, state.style()->visitedDependentColor(CSSPropertyColor)));
-    if (state.applyPropertyToVisitedLinkStyle())
-        state.style()->{{visited_link_setter}}(state.document().textLinkColors().colorFromPrimitiveValue(primitiveValue, state.style()->visitedDependentColor(CSSPropertyColor), state.element()->isLink() /* forVisitedLink */));
-}
-{%- endmacro %}
-
-{{ apply_color("CSSPropertyBackgroundColor", default_getter="invalidColor") }}
-{{ apply_color("CSSPropertyBorderBottomColor") }}
-{{ apply_color("CSSPropertyBorderLeftColor") }}
-{{ apply_color("CSSPropertyBorderRightColor") }}
-{{ apply_color("CSSPropertyBorderTopColor") }}
-{{ apply_color("CSSPropertyColor", inherit_color=true, default_getter="invalidColor", initial_color="RenderStyle::initialColor") }}
-{{ apply_color("CSSPropertyOutlineColor") }}
-{{ apply_color("CSSPropertyTextDecorationColor") }}
-{{ apply_color("CSSPropertyWebkitColumnRuleColor") }}
-{{ apply_color("CSSPropertyWebkitTextEmphasisColor") }}
-{{ apply_color("CSSPropertyWebkitTextFillColor") }}
-{{ apply_color("CSSPropertyWebkitTextStrokeColor") }}
-
-{%- macro apply_counter(property_id, action) %}
-{%- set property = properties[property_id] %}
-{{ declare_initial_function(property_id) }} { }
-
-{{ declare_inherit_function(property_id) }}
-{
-    CounterDirectiveMap& map = state.style()->accessCounterDirectives();
-    CounterDirectiveMap& parentMap = state.parentStyle()->accessCounterDirectives();
-
-    typedef CounterDirectiveMap::iterator Iterator;
-    Iterator end = parentMap.end();
-    for (Iterator it = parentMap.begin(); it != end; ++it) {
-        CounterDirectives& directives = map.add(it->key, CounterDirectives()).iterator->value;
-        directives.inherit{{action}}(it->value);
-    }
-}
-
-{{ declare_value_function(property_id) }}
-{
-    if (!value->isValueList())
-        return;
-
-    CSSValueList* list = toCSSValueList(value);
-
-    CounterDirectiveMap& map = state.style()->accessCounterDirectives();
-    typedef CounterDirectiveMap::iterator Iterator;
-
-    Iterator end = map.end();
-    for (Iterator it = map.begin(); it != end; ++it)
-        it->value.clear{{action}}();
-
-    int length = list ? list->length() : 0;
-    for (int i = 0; i < length; ++i) {
-        CSSValue* currValue = list->itemWithoutBoundsCheck(i);
-        if (!currValue->isPrimitiveValue())
-            continue;
-
-        Pair* pair = toCSSPrimitiveValue(currValue)->getPairValue();
-        if (!pair || !pair->first() || !pair->second())
-            continue;
-
-        AtomicString identifier = pair->first()->getStringValue();
-        int value = pair->second()->getIntValue();
-        CounterDirectives& directives = map.add(identifier, CounterDirectives()).iterator->value;
-        {%- if action == "Reset" %}
-        directives.setResetValue(value);
-        {%- else %}
-        directives.addIncrementValue(value);
-        {%- endif %}
-    }
-}
-{%- endmacro %}
-
-{{ apply_counter("CSSPropertyCounterIncrement", "Increment") }}
-{{ apply_counter("CSSPropertyCounterReset", "Reset") }}
-
-{%- macro apply_fill_layer(property_id, fill_type) %}
-{%- set layer_type = "Background" if "Background" in property_id else "Mask" %}
-{%- set fill_layer_type = layer_type + "FillLayer" %}
-{%- set access_layers = "access" + layer_type + "Layers" %}
-{%- set map_fill = "mapFill" + fill_type %}
-{{ declare_initial_function(property_id) }}
-{
-    FillLayer* currChild = state.style()->{{access_layers}}();
-    currChild->set{{fill_type}}(FillLayer::initialFill{{fill_type}}({{fill_layer_type}}));
-    for (currChild = currChild->next(); currChild; currChild = currChild->next())
-        currChild->clear{{fill_type}}();
-}
-
-{{ declare_inherit_function(property_id) }}
-{
-    FillLayer* currChild = state.style()->{{access_layers}}();
-    FillLayer* prevChild = 0;
-    const FillLayer* currParent = state.parentStyle()->{{layer_type|lower}}Layers();
-    while (currParent && currParent->is{{fill_type}}Set()) {
-        if (!currChild) {
-            /* Need to make a new layer.*/
-            currChild = new FillLayer({{fill_layer_type}});
-            prevChild->setNext(currChild);
-        }
-        currChild->set{{fill_type}}(currParent->{{lower_first(fill_type)}}());
-        prevChild = currChild;
-        currChild = prevChild->next();
-        currParent = currParent->next();
-    }
-
-    while (currChild) {
-        /* Reset any remaining layers to not have the property set. */
-        currChild->clear{{fill_type}}();
-        currChild = currChild->next();
-    }
-}
-
-{{ declare_value_function(property_id) }}
-{
-    FillLayer* currChild = state.style()->{{access_layers}}();
-    FillLayer* prevChild = 0;
-    if (value->isValueList() && !value->isImageSetValue()) {
-        /* Walk each value and put it into a layer, creating new layers as needed. */
-        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 */
-                currChild = new FillLayer({{fill_layer_type}});
-                prevChild->setNext(currChild);
-            }
-            state.styleMap().{{map_fill}}({{property_id}}, currChild, valueList->itemWithoutBoundsCheck(i));
-            prevChild = currChild;
-            currChild = currChild->next();
-        }
-    } else {
-        state.styleMap().{{map_fill}}({{property_id}}, currChild, value);
-        currChild = currChild->next();
-    }
-    while (currChild) {
-        /* Reset all remaining layers to not have the property set. */
-        currChild->clear{{fill_type}}();
-        currChild = currChild->next();
-    }
-}
-{%- endmacro %}
-
-{{ apply_fill_layer("CSSPropertyBackgroundAttachment", "Attachment") }}
-{{ apply_fill_layer("CSSPropertyBackgroundBlendMode", "BlendMode") }}
-{{ apply_fill_layer("CSSPropertyBackgroundClip", "Clip") }}
-{{ apply_fill_layer("CSSPropertyBackgroundImage", "Image") }}
-{{ apply_fill_layer("CSSPropertyBackgroundOrigin", "Origin") }}
-{{ apply_fill_layer("CSSPropertyBackgroundPositionX", "XPosition") }}
-{{ apply_fill_layer("CSSPropertyBackgroundPositionY", "YPosition") }}
-{{ apply_fill_layer("CSSPropertyBackgroundRepeatX", "RepeatX") }}
-{{ apply_fill_layer("CSSPropertyBackgroundRepeatY", "RepeatY") }}
-{{ apply_fill_layer("CSSPropertyBackgroundSize", "Size") }}
-{{ apply_fill_layer("CSSPropertyMaskSourceType", "MaskSourceType") }}
-{{ apply_fill_layer("CSSPropertyWebkitBackgroundComposite", "Composite") }}
-{{ apply_fill_layer("CSSPropertyWebkitMaskClip", "Clip") }}
-{{ apply_fill_layer("CSSPropertyWebkitMaskComposite", "Composite") }}
-{{ apply_fill_layer("CSSPropertyWebkitMaskImage", "Image") }}
-{{ apply_fill_layer("CSSPropertyWebkitMaskOrigin", "Origin") }}
-{{ apply_fill_layer("CSSPropertyWebkitMaskPositionX", "XPosition") }}
-{{ apply_fill_layer("CSSPropertyWebkitMaskPositionY", "YPosition") }}
-{{ apply_fill_layer("CSSPropertyWebkitMaskRepeatX", "RepeatX") }}
-{{ apply_fill_layer("CSSPropertyWebkitMaskRepeatY", "RepeatY") }}
-{{ apply_fill_layer("CSSPropertyWebkitMaskSize", "Size") }}
-
-{%- macro apply_font(property_id, name_for_methods, initial, type_name) %}
-{#- We specify the getters/setters here since they are on FontDescription
-        and not RenderStyle #}
-{%- set getter = lower_first(name_for_methods) %}
-{%- set setter = "set" + name_for_methods %}
-{{ declare_initial_function(property_id) }}
-{
-    state.fontBuilder().{{setter}}({{initial}});
-}
-
-{{ declare_inherit_function(property_id) }}
-{
-    state.fontBuilder().{{setter}}(state.parentFontDescription().{{getter}}());
-}
-
-{{ declare_value_function(property_id) }}
-{
-    if (!value->isPrimitiveValue())
-        return;
-    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-    state.fontBuilder().{{setter}}(static_cast<{{type_name}}>(*primitiveValue));
-}
-{%- endmacro %}
-
-{{ apply_font("CSSPropertyFontStyle", "Italic", "FontItalicOff", "FontItalic") }}
-{{ apply_font("CSSPropertyFontVariant", "SmallCaps", "FontSmallCapsOff", "FontSmallCaps") }}
-{{ apply_font("CSSPropertyTextRendering", "TextRenderingMode", "AutoTextRendering", "TextRenderingMode") }}
-{{ apply_font("CSSPropertyWebkitFontKerning", "Kerning", "FontDescription::AutoKerning", "FontDescription::Kerning") }}
-{{ apply_font("CSSPropertyWebkitFontSmoothing", "FontSmoothing", "AutoSmoothing", "FontSmoothingMode") }}
-
-{%- macro apply_value_number(property_id, id_for_minus_one) %}
-{{ declare_value_function(property_id) }}
-{
-    {%- set property = properties[property_id] %}
-    if (!value->isPrimitiveValue())
-        return;
-
-    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-    if (primitiveValue->getValueID() == {{id_for_minus_one}})
-        {{ set_value(property) }}(-1);
-    else
-        {{ set_value(property) }}(primitiveValue->getValue<{{property.type_name}}>(CSSPrimitiveValue::CSS_NUMBER));
-}
-{%- endmacro %}
-
-{{ apply_value_number("CSSPropertyInternalMarqueeRepetition", "CSSValueInfinite") }}
-
-{%- macro apply_value_shape(property_id) %}
-{{ declare_value_function(property_id) }}
-{
-    {%- set property = properties[property_id] %}
-    if (value->isPrimitiveValue()) {
-        CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-        if (primitiveValue->getValueID() == CSSValueAuto)
-            {{ set_value(property) }}(0);
-        else if (primitiveValue->getValueID() == CSSValueOutsideShape)
-            {{ set_value(property) }}(ShapeValue::createOutsideValue());
-        else if (primitiveValue->isShape()) {
-            {{ set_value(property) }}(ShapeValue::createShapeValue(basicShapeForValue(state, primitiveValue->getShapeValue())));
-        }
-    } else if (value->isImageValue()) {
-        {{ set_value(property) }}(ShapeValue::createImageValue(state.styleImage({{property_id}}, value)));
-    }
-}
-{%- endmacro %}
-
-{{ apply_value_shape("CSSPropertyWebkitShapeInside") }}
-{{ apply_value_shape("CSSPropertyWebkitShapeOutside") }}
-
-} // namespace WebCore
diff --git a/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl b/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl
deleted file mode 100644
index a7063e2..0000000
--- a/Source/core/scripts/templates/StyleBuilderFunctions.h.tmpl
+++ /dev/null
@@ -1,29 +0,0 @@
-{% from "macros.tmpl" import wrap_with_condition, license -%}
-{{ license() }}
-
-#ifndef StyleBuilderFunctions_h
-#define StyleBuilderFunctions_h
-
-#include "core/css/resolver/StyleBuilderCustom.h"
-
-namespace WebCore {
-
-class CSSValue;
-class StyleResolverState;
-
-class StyleBuilderFunctions {
-public:
-
-{%- for property_id, property in properties.items() if not property.use_handlers_for %}
-{% call wrap_with_condition(property.condition) %}
-    static void applyInitial{{property_id}}(StyleResolverState&);
-    static void applyInherit{{property_id}}(StyleResolverState&);
-    static void applyValue{{property_id}}(StyleResolverState&, CSSValue*);
-{%- endcall %}
-{%- endfor %}
-
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl b/Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl
deleted file mode 100644
index 69086e1..0000000
--- a/Source/core/scripts/templates/StylePropertyShorthand.cpp.tmpl
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "StylePropertyShorthand.h"
-#include "RuntimeEnabledFeatures.h"
-
-#include "wtf/HashMap.h"
-#include "wtf/StdLibExtras.h"
-
-namespace WebCore {
-
-{%- for property_id, property in properties.items() %}
-
-const StylePropertyShorthand& {{ property.camel_case_name }}Shorthand()
-{
-    static const CSSPropertyID {{ property.camel_case_name }}Properties[] = {
-        {%- for longhand_id in property.camel_case_longhands %}
-        {{ longhand_id }},
-        {%- endfor %}
-    };
-    DEFINE_STATIC_LOCAL(StylePropertyShorthand, {{ property.camel_case_name }}Longhands, ({{ property_id }}, {{ property.camel_case_name }}Properties, WTF_ARRAY_LENGTH({{ property.camel_case_name }}Properties)));
-    return {{ property.camel_case_name }}Longhands;
-}
-{%- endfor %}
-
-// Returns an empty list if the property is not a shorthand
-const StylePropertyShorthand& shorthandForProperty(CSSPropertyID propertyID)
-{
-    DEFINE_STATIC_LOCAL(StylePropertyShorthand, emptyShorthand, ());
-    switch (propertyID) {
-{%- for property_id, property in properties.items() %}
-    {%- if property.camel_case_name not in ["width", "height", "marker"] %}
-        case {{ property_id }}:
-        {%- if property.runtime_conditional_getter %}
-            if (!RuntimeEnabledFeatures::{{ property.runtime_conditional_getter }}())
-                return emptyShorthand;
-        {%- endif %}
-            return {{ property.camel_case_name }}Shorthand();
-    {%- endif %}
-{%- endfor %}
-    default: {
-        return emptyShorthand;
-    }
-    }
-}
-
-const Vector<StylePropertyShorthand> matchingShorthandsForLonghand(CSSPropertyID propertyID)
-{
-    switch (propertyID) {
-{%- for longhand_id, shorthands in longhands_dictionary.items() %}
-    case {{ longhand_id }}: {
-{%- if shorthands|length == 1 %}
-    {% for shorthand in shorthands -%}
-       return Vector<StylePropertyShorthand>(1, {{ shorthand.camel_case_name }}Shorthand());
-    {%- endfor %}
-{%- else %}
-        Vector<StylePropertyShorthand> vectorShorthands;
-        vectorShorthands.reserveInitialCapacity({{ shorthands|length }});
-        {% for shorthand in shorthands -%}
-        vectorShorthands.uncheckedAppend({{ shorthand.camel_case_name }}Shorthand());
-        {% endfor -%}
-        return vectorShorthands;
-{% endif %}
-    }
-{%- endfor %}
-    default:
-        return Vector<StylePropertyShorthand>();
-    }
-}
-
-} // namespace WebCore
diff --git a/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl b/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl
deleted file mode 100644
index 5ef9feb..0000000
--- a/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2008 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
- * 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef StylePropertyShorthand_h
-#define StylePropertyShorthand_h
-
-#include "CSSPropertyNames.h"
-#include "wtf/Vector.h"
-
-namespace WebCore {
-
-class StylePropertyShorthand {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    StylePropertyShorthand()
-        : m_properties(0)
-        , m_propertiesForInitialization(0)
-        , m_length(0)
-        , m_shorthandID(CSSPropertyInvalid)
-    {
-    }
-
-    StylePropertyShorthand(CSSPropertyID id, const CSSPropertyID* properties, unsigned numProperties)
-        : m_properties(properties)
-        , m_propertiesForInitialization(0)
-        , m_length(numProperties)
-        , m_shorthandID(id)
-    {
-    }
-
-    StylePropertyShorthand(CSSPropertyID id, const CSSPropertyID* properties, const StylePropertyShorthand** propertiesForInitialization, unsigned numProperties)
-        : m_properties(properties)
-        , m_propertiesForInitialization(propertiesForInitialization)
-        , m_length(numProperties)
-        , m_shorthandID(id)
-    {
-    }
-
-    const CSSPropertyID* properties() const { return m_properties; }
-    const StylePropertyShorthand** propertiesForInitialization() const { return m_propertiesForInitialization; }
-    unsigned length() const { return m_length; }
-    CSSPropertyID id() const { return m_shorthandID; }
-
-private:
-    const CSSPropertyID* m_properties;
-    const StylePropertyShorthand** m_propertiesForInitialization;
-    unsigned m_length;
-    CSSPropertyID m_shorthandID;
-};
-
-{% for property_id, property in properties.items() %}
-{%- set camel_case_name = property.camel_case_name %}
-const StylePropertyShorthand& {{ camel_case_name }}Shorthand();
-{%- endfor %}
-
-// Returns an empty list if the property is not a shorthand, otherwise the list of longhands for parsing.
-const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID);
-
-// Returns an empty list if the property is not a shorthand.
-const StylePropertyShorthand& shorthandForProperty(CSSPropertyID);
-
-// Return the list of shorthands for a given longhand.
-const Vector<StylePropertyShorthand> matchingShorthandsForLonghand(CSSPropertyID);
-unsigned indexOfShorthandForLonghand(CSSPropertyID, const Vector<StylePropertyShorthand>&);
-
-bool isExpandedShorthand(CSSPropertyID);
-
-} // namespace WebCore
-
-#endif // StylePropertyShorthand_h
diff --git a/Source/core/scripts/templates/macros.tmpl b/Source/core/scripts/templates/macros.tmpl
deleted file mode 100644
index b805c98..0000000
--- a/Source/core/scripts/templates/macros.tmpl
+++ /dev/null
@@ -1,48 +0,0 @@
-{% 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) 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.
- */
-{%- endmacro %}
-
-{% macro lower_first(s) -%}
-{{ (s[0]|lower) + s[1:] }}
-{%- endmacro %}
diff --git a/Source/core/scripts/xxd.pl b/Source/core/scripts/xxd.pl
deleted file mode 100644
index 5ee08a5..0000000
--- a/Source/core/scripts/xxd.pl
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /usr/bin/perl
-
-# Copyright (C) 2010-2011 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-#    # 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.
-#
-
-$varname = shift;
-$fname = shift;
-$output = shift;
-
-open($input, '<', $fname) or die "Can't open file for read: $fname $!";
-$/ = undef;
-$text = <$input>;
-close($input);
-
-$text = join(', ', map('0x' . unpack("H*", $_), split(undef, $text)));
-
-open($output, '>', $output) or die "Can't open file for write: $output $!";
-print $output "const unsigned char $varname\[\] = {\n$text\n};\n";
-close($output);
diff --git a/Source/core/speech/SpeechInput.cpp b/Source/core/speech/SpeechInput.cpp
new file mode 100644
index 0000000..839ee08
--- /dev/null
+++ b/Source/core/speech/SpeechInput.cpp
@@ -0,0 +1,131 @@
+/*
+ * 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/speech/SpeechInput.h"
+
+#if ENABLE(INPUT_SPEECH)
+
+#include "core/speech/SpeechInputClient.h"
+#include "core/speech/SpeechInputListener.h"
+#include "wtf/PassOwnPtr.h"
+
+namespace WebCore {
+
+SpeechInput::SpeechInput(SpeechInputClient* client)
+    : m_client(client)
+    , m_nextListenerId(1)
+{
+    m_client->setListener(this);
+}
+
+SpeechInput::~SpeechInput()
+{
+    m_client->setListener(0);
+}
+
+PassOwnPtr<SpeechInput> SpeechInput::create(SpeechInputClient* client)
+{
+    return adoptPtr(new SpeechInput(client));
+}
+
+int SpeechInput::registerListener(SpeechInputListener* listener)
+{
+#if defined(DEBUG)
+    // Check if already present.
+    for (HashMap<int, SpeechInputListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
+        ASSERT(it->value != listener);
+#endif
+
+    m_listeners.add(m_nextListenerId, listener);
+    return m_nextListenerId++;
+}
+
+void SpeechInput::unregisterListener(int listenerId)
+{
+    if (m_listeners.contains(listenerId))
+        m_listeners.remove(listenerId);
+}
+
+void SpeechInput::didCompleteRecording(int listenerId)
+{
+    // Don't assert if not present as the element might have been removed by the page while
+    // this event was on the way.
+    if (m_listeners.contains(listenerId))
+        m_listeners.get(listenerId)->didCompleteRecording(listenerId);
+}
+
+void SpeechInput::didCompleteRecognition(int listenerId)
+{
+    // Don't assert if not present as the element might have been removed by the page while
+    // this event was on the way.
+    if (m_listeners.contains(listenerId))
+        m_listeners.get(listenerId)->didCompleteRecognition(listenerId);
+}
+
+void SpeechInput::setRecognitionResult(int listenerId, const SpeechInputResultArray& result)
+{
+    // Don't assert if not present as the element might have been removed by the page while
+    // this event was on the way.
+    if (m_listeners.contains(listenerId))
+        m_listeners.get(listenerId)->setRecognitionResult(listenerId, result);
+}
+
+bool SpeechInput::startRecognition(int listenerId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin* origin)
+{
+    ASSERT(m_listeners.contains(listenerId));
+    return m_client->startRecognition(listenerId, elementRect, language, grammar, origin);
+}
+
+void SpeechInput::stopRecording(int listenerId)
+{
+    ASSERT(m_listeners.contains(listenerId));
+    m_client->stopRecording(listenerId);
+}
+
+void SpeechInput::cancelRecognition(int listenerId)
+{
+    ASSERT(m_listeners.contains(listenerId));
+    m_client->cancelRecognition(listenerId);
+}
+
+const char* SpeechInput::supplementName()
+{
+    return "SpeechInput";
+}
+
+void provideSpeechInputTo(Page* page, SpeechInputClient* client)
+{
+    SpeechInput::provideTo(page, SpeechInput::supplementName(), SpeechInput::create(client));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INPUT_SPEECH)
diff --git a/Source/core/speech/SpeechInput.h b/Source/core/speech/SpeechInput.h
new file mode 100644
index 0000000..dcc7171
--- /dev/null
+++ b/Source/core/speech/SpeechInput.h
@@ -0,0 +1,90 @@
+/*
+ * 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 SpeechInput_h
+#define SpeechInput_h
+
+#if ENABLE(INPUT_SPEECH)
+
+#include "core/page/Page.h"
+#include "core/speech/SpeechInputListener.h"
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+
+namespace WebCore {
+
+class IntRect;
+class SecurityOrigin;
+class SpeechInputClient;
+class SpeechInputListener;
+
+// This class connects the input elements requiring speech input with the platform specific
+// speech recognition engine. It provides methods for the input elements to activate speech
+// recognition and methods for the speech recognition engine to return back the results.
+class SpeechInput : public SpeechInputListener, public Supplement<Page> {
+    WTF_MAKE_NONCOPYABLE(SpeechInput);
+public:
+    virtual ~SpeechInput();
+
+    static PassOwnPtr<SpeechInput> create(SpeechInputClient*);
+    static const char* supplementName();
+    static SpeechInput* from(Page* page) { return static_cast<SpeechInput*>(Supplement<Page>::from(page, supplementName())); }
+
+    // Generates a unique ID for the given listener to be used for speech requests.
+    // This should be the first call made by listeners before anything else.
+    int registerListener(SpeechInputListener*);
+
+    // Invoked when the listener is done with recording or getting destroyed.
+    // Failure to unregister may result in crashes if there were any pending speech events.
+    void unregisterListener(int);
+
+    // Methods invoked by the input elements.
+    bool startRecognition(int listenerId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin*);
+    void stopRecording(int);
+    void cancelRecognition(int);
+
+    // SpeechInputListener methods.
+    virtual void didCompleteRecording(int);
+    virtual void didCompleteRecognition(int);
+    virtual void setRecognitionResult(int, const SpeechInputResultArray&);
+
+private:
+    explicit SpeechInput(SpeechInputClient*);
+
+    SpeechInputClient* m_client;
+    HashMap<int, SpeechInputListener*> m_listeners;
+    int m_nextListenerId;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INPUT_SPEECH)
+
+#endif // SpeechInput_h
diff --git a/Source/core/page/SpeechInputClient.h b/Source/core/speech/SpeechInputClient.h
similarity index 100%
rename from Source/core/page/SpeechInputClient.h
rename to Source/core/speech/SpeechInputClient.h
diff --git a/Source/core/speech/SpeechInputEvent.cpp b/Source/core/speech/SpeechInputEvent.cpp
new file mode 100644
index 0000000..f0222e9
--- /dev/null
+++ b/Source/core/speech/SpeechInputEvent.cpp
@@ -0,0 +1,74 @@
+/*
+ * 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_SPEECH)
+
+#include "core/speech/SpeechInputEvent.h"
+
+#include "core/events/ThreadLocalEventNames.h"
+
+namespace WebCore {
+
+PassRefPtr<SpeechInputEvent> SpeechInputEvent::create()
+{
+    return adoptRef(new SpeechInputEvent);
+}
+
+PassRefPtr<SpeechInputEvent> SpeechInputEvent::create(const AtomicString& eventType, const SpeechInputResultArray& results)
+{
+    return adoptRef(new SpeechInputEvent(eventType, results));
+}
+
+SpeechInputEvent::SpeechInputEvent()
+{
+    ScriptWrappable::init(this);
+}
+
+SpeechInputEvent::SpeechInputEvent(const AtomicString& eventType, const SpeechInputResultArray& results)
+    : Event(eventType, true, false) // Can bubble, not cancelable
+    , m_results(SpeechInputResultList::create(results))
+{
+    ScriptWrappable::init(this);
+}
+
+SpeechInputEvent::~SpeechInputEvent()
+{
+}
+
+const AtomicString& SpeechInputEvent::interfaceName() const
+{
+    return EventNames::SpeechInputEvent;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INPUT_SPEECH)
diff --git a/Source/core/speech/SpeechInputEvent.h b/Source/core/speech/SpeechInputEvent.h
new file mode 100644
index 0000000..1a00925
--- /dev/null
+++ b/Source/core/speech/SpeechInputEvent.h
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 SpeechInputEvent_h
+#define SpeechInputEvent_h
+
+#if ENABLE(INPUT_SPEECH)
+
+#include "core/events/Event.h"
+#include "core/speech/SpeechInputResultList.h"
+
+#include "wtf/PassRefPtr.h"
+
+namespace WebCore {
+
+class SpeechInputEvent : public Event {
+public:
+    static PassRefPtr<SpeechInputEvent> create();
+    static PassRefPtr<SpeechInputEvent> create(const AtomicString& eventType, const SpeechInputResultArray& results);
+    ~SpeechInputEvent();
+
+    SpeechInputResultList* results() const { return m_results.get(); }
+
+    virtual const AtomicString& interfaceName() const;
+
+private:
+    SpeechInputEvent();
+    SpeechInputEvent(const AtomicString& eventType, const SpeechInputResultArray& results);
+
+    RefPtr<SpeechInputResultList> m_results;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INPUT_SPEECH)
+
+#endif // SpeechInputEvent_h
diff --git a/Source/core/page/SpeechInputEvent.idl b/Source/core/speech/SpeechInputEvent.idl
similarity index 100%
rename from Source/core/page/SpeechInputEvent.idl
rename to Source/core/speech/SpeechInputEvent.idl
diff --git a/Source/core/speech/SpeechInputListener.h b/Source/core/speech/SpeechInputListener.h
new file mode 100644
index 0000000..b4fc017
--- /dev/null
+++ b/Source/core/speech/SpeechInputListener.h
@@ -0,0 +1,67 @@
+/*
+ * 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 SpeechInputListener_h
+#define SpeechInputListener_h
+
+#if ENABLE(INPUT_SPEECH)
+
+#include "core/speech/SpeechInputResult.h"
+#include "wtf/Forward.h"
+
+namespace WebCore {
+
+// Interface to be implemented by the element which invokes SpeechInput.
+class SpeechInputListener {
+public:
+    // Informs that audio recording has completed and recognition is underway.
+    virtual void didCompleteRecording(int requestId) = 0;
+
+    // Informs that speech recognition has completed. This gets invoked irrespective of whether
+    // recognition was succesful or not, whether setRecognitionResult() was invoked or not. The
+    // handler typically frees up any temporary resources allocated and waits for the next speech
+    // recognition request.
+    virtual void didCompleteRecognition(int requestId) = 0;
+
+    // Gives results from speech recognition, either partial or the final results.
+    // This method can potentially get called multiple times if there are partial results
+    // available as the user keeps speaking. If the speech could not be recognized properly
+    // or if there was any other errors in the process, this method may never be called.
+    virtual void setRecognitionResult(int requestId, const SpeechInputResultArray&) = 0;
+
+protected:
+    virtual ~SpeechInputListener() { }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INPUT_SPEECH)
+
+#endif // SpeechInputListener_h
diff --git a/Source/core/speech/SpeechInputResult.cpp b/Source/core/speech/SpeechInputResult.cpp
new file mode 100644
index 0000000..1673455
--- /dev/null
+++ b/Source/core/speech/SpeechInputResult.cpp
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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/speech/SpeechInputResult.h"
+
+#if ENABLE(INPUT_SPEECH)
+
+namespace WebCore {
+
+PassRefPtr<SpeechInputResult> SpeechInputResult::create(const String& utterance, double confidence)
+{
+    return adoptRef(new SpeechInputResult(utterance, confidence));
+}
+
+PassRefPtr<SpeechInputResult> SpeechInputResult::create(const SpeechInputResult& source)
+{
+    return adoptRef(new SpeechInputResult(source.m_utterance, source.m_confidence));
+}
+
+SpeechInputResult::SpeechInputResult(const String& utterance, double confidence)
+    : m_utterance(utterance)
+    , m_confidence(confidence)
+{
+    ScriptWrappable::init(this);
+}
+
+double SpeechInputResult::confidence() const
+{
+    return m_confidence;
+}
+
+const String& SpeechInputResult::utterance() const
+{
+    return m_utterance;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INPUT_SPEECH)
diff --git a/Source/core/page/SpeechInputResult.h b/Source/core/speech/SpeechInputResult.h
similarity index 100%
rename from Source/core/page/SpeechInputResult.h
rename to Source/core/speech/SpeechInputResult.h
diff --git a/Source/core/page/SpeechInputResult.idl b/Source/core/speech/SpeechInputResult.idl
similarity index 100%
rename from Source/core/page/SpeechInputResult.idl
rename to Source/core/speech/SpeechInputResult.idl
diff --git a/Source/core/speech/SpeechInputResultList.cpp b/Source/core/speech/SpeechInputResultList.cpp
new file mode 100644
index 0000000..86f7fda
--- /dev/null
+++ b/Source/core/speech/SpeechInputResultList.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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/speech/SpeechInputResultList.h"
+
+#if ENABLE(INPUT_SPEECH)
+
+namespace WebCore {
+
+PassRefPtr<SpeechInputResultList> SpeechInputResultList::create(const SpeechInputResultArray& results)
+{
+    return adoptRef(new SpeechInputResultList(results));
+}
+
+SpeechInputResult* SpeechInputResultList::item(unsigned index)
+{
+    return index >= m_results.size() ? 0 : m_results[index].get();
+}
+
+SpeechInputResultList::SpeechInputResultList(const SpeechInputResultArray& results)
+    : m_results(results) // Takes a copy of the array of RefPtrs.
+{
+    ScriptWrappable::init(this);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INPUT_SPEECH)
diff --git a/Source/core/speech/SpeechInputResultList.h b/Source/core/speech/SpeechInputResultList.h
new file mode 100644
index 0000000..3edb9d5
--- /dev/null
+++ b/Source/core/speech/SpeechInputResultList.h
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 SpeechInputResultList_h
+#define SpeechInputResultList_h
+
+#if ENABLE(INPUT_SPEECH)
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/speech/SpeechInputResult.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class SpeechInputResultList : public RefCounted<SpeechInputResultList>, public ScriptWrappable {
+public:
+    static PassRefPtr<SpeechInputResultList> create(const SpeechInputResultArray& results);
+
+    // Methods from the IDL.
+    size_t length() { return m_results.size(); }
+    SpeechInputResult* item(unsigned index);
+
+private:
+    explicit SpeechInputResultList(const SpeechInputResultArray& results);
+
+    SpeechInputResultArray m_results;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INPUT_SPEECH)
+
+#endif // SpeechInputResultList_h
diff --git a/Source/core/page/SpeechInputResultList.idl b/Source/core/speech/SpeechInputResultList.idl
similarity index 100%
rename from Source/core/page/SpeechInputResultList.idl
rename to Source/core/speech/SpeechInputResultList.idl
diff --git a/Source/core/storage/Storage.h b/Source/core/storage/Storage.h
index 825dad3..34e1317 100644
--- a/Source/core/storage/Storage.h
+++ b/Source/core/storage/Storage.h
@@ -27,7 +27,7 @@
 #define Storage_h
 
 #include "bindings/v8/ScriptWrappable.h"
-#include "core/page/DOMWindowProperty.h"
+#include "core/frame/DOMWindowProperty.h"
 #include "core/storage/StorageArea.h"
 #include "wtf/Forward.h"
 #include "wtf/RefCounted.h"
diff --git a/Source/core/storage/Storage.idl b/Source/core/storage/Storage.idl
index e3b5c70..15cdf26 100644
--- a/Source/core/storage/Storage.idl
+++ b/Source/core/storage/Storage.idl
@@ -32,9 +32,9 @@
     [ImplementedAs=anonymousNamedDeleter, RaisesException] deleter boolean (DOMString name);
     [NotEnumerable, GetterRaisesException] readonly attribute unsigned long length;
     [NotEnumerable, TreatReturnedNullStringAs=Null, RaisesException] DOMString key(unsigned long index);
-    [NotEnumerable, TreatReturnedNullStringAs=Null, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] DOMString getItem(DOMString key);
-    [NotEnumerable, RaisesException, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] void setItem(DOMString key, DOMString data);
-    [NotEnumerable, RaisesException, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] void removeItem(DOMString key);
-    [NotEnumerable, RaisesException, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] void clear();
+    [NotEnumerable, TreatReturnedNullStringAs=Null, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds, RaisesException] DOMString getItem(DOMString key);
+    [NotEnumerable, RaisesException, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds] void setItem(DOMString key, DOMString data);
+    [NotEnumerable, RaisesException, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds] void removeItem(DOMString key);
+    [NotEnumerable, RaisesException, PerWorldBindings, ActivityLogging=AccessForIsolatedWorlds] void clear();
 };
 
diff --git a/Source/core/storage/StorageEvent.cpp b/Source/core/storage/StorageEvent.cpp
index 86b3434..1c434f3 100644
--- a/Source/core/storage/StorageEvent.cpp
+++ b/Source/core/storage/StorageEvent.cpp
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/storage/StorageEvent.h"
 
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/storage/Storage.h"
 
 namespace WebCore {
@@ -97,7 +97,7 @@
 
 const AtomicString& StorageEvent::interfaceName() const
 {
-    return eventNames().interfaceForStorageEvent;
+    return EventNames::StorageEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/svg/PatternAttributes.h b/Source/core/svg/PatternAttributes.h
index 1400e82..7e4ae75 100644
--- a/Source/core/svg/PatternAttributes.h
+++ b/Source/core/svg/PatternAttributes.h
@@ -20,9 +20,9 @@
 #ifndef PatternAttributes_h
 #define PatternAttributes_h
 
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/svg/SVGLength.h"
 #include "core/svg/SVGPreserveAspectRatio.h"
+#include "platform/transforms/AffineTransform.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGAElement.cpp b/Source/core/svg/SVGAElement.cpp
index cc18a60..b22f9af 100644
--- a/Source/core/svg/SVGAElement.cpp
+++ b/Source/core/svg/SVGAElement.cpp
@@ -29,9 +29,9 @@
 #include "core/dom/Attr.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
-#include "core/events/EventNames.h"
 #include "core/events/KeyboardEvent.h"
 #include "core/events/MouseEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/parser/HTMLParserIdioms.h"
@@ -40,15 +40,15 @@
 #include "core/loader/FrameLoaderTypes.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
-#include "core/platform/PlatformMouseEvent.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/rendering/svg/RenderSVGInline.h"
 #include "core/rendering/svg/RenderSVGText.h"
 #include "core/rendering/svg/RenderSVGTransformableContainer.h"
 #include "core/svg/SVGElementInstance.h"
 #include "core/svg/animation/SVGSMILElement.h"
+#include "platform/PlatformMouseEvent.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGAnimateColorElement.cpp b/Source/core/svg/SVGAnimateColorElement.cpp
index ce8d772..b01d7f3 100644
--- a/Source/core/svg/SVGAnimateColorElement.cpp
+++ b/Source/core/svg/SVGAnimateColorElement.cpp
@@ -33,7 +33,7 @@
     ASSERT(hasTagName(SVGNames::animateColorTag));
     ScriptWrappable::init(this);
 
-    UseCounter::count(&document, UseCounter::SVGAnimateColorElement);
+    UseCounter::count(document, UseCounter::SVGAnimateColorElement);
 }
 
 PassRefPtr<SVGAnimateColorElement> SVGAnimateColorElement::create(const QualifiedName& tagName, Document& document)
diff --git a/Source/core/svg/SVGAnimateElement.cpp b/Source/core/svg/SVGAnimateElement.cpp
index f356c68..d90e22e 100644
--- a/Source/core/svg/SVGAnimateElement.cpp
+++ b/Source/core/svg/SVGAnimateElement.cpp
@@ -32,7 +32,6 @@
 #include "core/svg/SVGAnimatedType.h"
 #include "core/svg/SVGAnimatedTypeAnimator.h"
 #include "core/svg/SVGAnimatorFactory.h"
-#include "core/svg/SVGDocumentExtensions.h"
 
 namespace WebCore {
 
@@ -51,8 +50,6 @@
 
 SVGAnimateElement::~SVGAnimateElement()
 {
-    if (targetElement())
-        clearAnimatedType(targetElement());
 }
 
 bool SVGAnimateElement::hasValidAttributeType()
@@ -214,10 +211,6 @@
     if (shouldApply == ApplyXMLAnimation) {
         // SVG DOM animVal animation code-path.
         m_animatedProperties = animator->findAnimatedPropertiesForAttributeName(targetElement, attributeName);
-        SVGElementAnimatedPropertyList::const_iterator end = m_animatedProperties.end();
-        for (SVGElementAnimatedPropertyList::const_iterator it = m_animatedProperties.begin(); it != end; ++it)
-            document().accessSVGExtensions()->addElementReferencingTarget(this, it->element);
-
         ASSERT(!m_animatedProperties.isEmpty());
 
         ASSERT(propertyTypesAreConsistent(m_animatedPropertyType, m_animatedProperties));
@@ -247,7 +240,7 @@
 
 static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSPropertyID id, const String& value)
 {
-    ASSERT(!targetElement->m_deletionHasBegun);
+    ASSERT_WITH_SECURITY_IMPLICATION(!targetElement->m_deletionHasBegun);
 
     MutableStylePropertySet* propertySet = targetElement->ensureAnimatedSMILStyleProperties();
     if (!propertySet->setProperty(id, value, false, 0))
@@ -258,7 +251,7 @@
 
 static inline void removeCSSPropertyFromTarget(SVGElement* targetElement, CSSPropertyID id)
 {
-    ASSERT(!targetElement->m_deletionHasBegun);
+    ASSERT_WITH_SECURITY_IMPLICATION(!targetElement->m_deletionHasBegun);
     targetElement->ensureAnimatedSMILStyleProperties()->removeProperty(id);
     targetElement->setNeedsStyleRecalc(LocalStyleChange);
 }
@@ -305,7 +298,7 @@
 
 static inline void notifyTargetAboutAnimValChange(SVGElement* targetElement, const QualifiedName& attributeName)
 {
-    ASSERT(!targetElement->m_deletionHasBegun);
+    ASSERT_WITH_SECURITY_IMPLICATION(!targetElement->m_deletionHasBegun);
     targetElement->svgAttributeChanged(attributeName);
 }
 
diff --git a/Source/core/svg/SVGAnimateMotionElement.cpp b/Source/core/svg/SVGAnimateMotionElement.cpp
index c5f2de8..70a94ce 100644
--- a/Source/core/svg/SVGAnimateMotionElement.cpp
+++ b/Source/core/svg/SVGAnimateMotionElement.cpp
@@ -24,7 +24,6 @@
 #include "core/svg/SVGAnimateMotionElement.h"
 
 #include "SVGNames.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/svg/RenderSVGResource.h"
 #include "core/rendering/svg/SVGPathData.h"
@@ -33,6 +32,7 @@
 #include "core/svg/SVGParserUtilities.h"
 #include "core/svg/SVGPathElement.h"
 #include "core/svg/SVGPathUtilities.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/MathExtras.h"
 #include "wtf/StdLibExtras.h"
 
@@ -49,12 +49,6 @@
     ScriptWrappable::init(this);
 }
 
-SVGAnimateMotionElement::~SVGAnimateMotionElement()
-{
-    if (targetElement())
-        clearAnimatedType(targetElement());
-}
-
 PassRefPtr<SVGAnimateMotionElement> SVGAnimateMotionElement::create(const QualifiedName& tagName, Document& document)
 {
     return adoptRef(new SVGAnimateMotionElement(tagName, document));
diff --git a/Source/core/svg/SVGAnimateMotionElement.h b/Source/core/svg/SVGAnimateMotionElement.h
index 3993759..79c8415 100644
--- a/Source/core/svg/SVGAnimateMotionElement.h
+++ b/Source/core/svg/SVGAnimateMotionElement.h
@@ -30,8 +30,6 @@
 
 class SVGAnimateMotionElement FINAL : public SVGAnimationElement {
 public:
-    virtual ~SVGAnimateMotionElement();
-
     static PassRefPtr<SVGAnimateMotionElement> create(const QualifiedName&, Document&);
     void updateAnimationPath();
 
diff --git a/Source/core/svg/SVGAnimationElement.cpp b/Source/core/svg/SVGAnimationElement.cpp
index 21873d7..323ba5c 100644
--- a/Source/core/svg/SVGAnimationElement.cpp
+++ b/Source/core/svg/SVGAnimationElement.cpp
@@ -31,10 +31,10 @@
 #include "core/css/CSSComputedStyleDeclaration.h"
 #include "core/css/CSSParser.h"
 #include "core/page/UseCounter.h"
-#include "core/platform/FloatConversion.h"
 #include "core/svg/SVGAnimateElement.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGParserUtilities.h"
+#include "platform/FloatConversion.h"
 #include "wtf/MathExtras.h"
 
 namespace WebCore {
@@ -60,7 +60,7 @@
     ScriptWrappable::init(this);
     registerAnimatedPropertiesForSVGAnimationElement();
 
-    UseCounter::count(&document, UseCounter::SVGAnimationElement);
+    UseCounter::count(document, UseCounter::SVGAnimationElement);
 }
 
 static void parseKeyTimes(const String& string, Vector<float>& result, bool verifyOrder)
diff --git a/Source/core/svg/SVGAnimationElement.h b/Source/core/svg/SVGAnimationElement.h
index 11410e1..087529f 100644
--- a/Source/core/svg/SVGAnimationElement.h
+++ b/Source/core/svg/SVGAnimationElement.h
@@ -25,11 +25,11 @@
 #ifndef SVGAnimationElement_h
 #define SVGAnimationElement_h
 
-#include "core/platform/graphics/UnitBezier.h"
 #include "core/svg/SVGAnimatedBoolean.h"
 #include "core/svg/SVGExternalResourcesRequired.h"
 #include "core/svg/SVGTests.h"
 #include "core/svg/animation/SVGSMILElement.h"
+#include "platform/animation/UnitBezier.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGCircleElement.h b/Source/core/svg/SVGCircleElement.h
index ae702f6..f720aa6 100644
--- a/Source/core/svg/SVGCircleElement.h
+++ b/Source/core/svg/SVGCircleElement.h
@@ -56,11 +56,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGCircleElement* toSVGCircleElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::circleTag));
-    return static_cast<SVGCircleElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGCircleElement, hasTagName(SVGNames::circleTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGClipPathElement.h b/Source/core/svg/SVGClipPathElement.h
index 80f6be9..d098e69 100644
--- a/Source/core/svg/SVGClipPathElement.h
+++ b/Source/core/svg/SVGClipPathElement.h
@@ -56,11 +56,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGClipPathElement* toSVGClipPathElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::clipPathTag));
-    return static_cast<SVGClipPathElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGClipPathElement, hasTagName(SVGNames::clipPathTag));
 
 }
 
diff --git a/Source/core/svg/SVGColor.h b/Source/core/svg/SVGColor.h
index 554fe77..42875ed 100644
--- a/Source/core/svg/SVGColor.h
+++ b/Source/core/svg/SVGColor.h
@@ -93,6 +93,22 @@
     SVGColorType m_colorType;
 };
 
+// This will catch anyone doing an unnecessary cast.
+SVGColor* toSVGColor(const SVGColor*);
+
+inline SVGColor* toSVGColor(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isSVGColor());
+    return static_cast<SVGColor*>(value);
+}
+
+inline const SVGColor* toSVGColor(const CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isSVGColor());
+    return static_cast<const SVGColor*>(value);
+}
+
+
 } // namespace WebCore
 
 #endif // SVGColor_h
diff --git a/Source/core/svg/SVGDocument.cpp b/Source/core/svg/SVGDocument.cpp
index d9bfe18..406f067 100644
--- a/Source/core/svg/SVGDocument.cpp
+++ b/Source/core/svg/SVGDocument.cpp
@@ -23,8 +23,8 @@
 
 #include "SVGNames.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
-#include "core/events/EventNames.h"
-#include "core/page/FrameView.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/FrameView.h"
 #include "core/rendering/RenderView.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGSVGElement.h"
@@ -52,7 +52,7 @@
 void SVGDocument::dispatchZoomEvent(float prevScale, float newScale)
 {
     RefPtr<SVGZoomEvent> event = static_pointer_cast<SVGZoomEvent>(createEvent("SVGZoomEvents", IGNORE_EXCEPTION));
-    event->initEvent(eventNames().zoomEvent, true, false);
+    event->initEvent(EventTypeNames::zoom, true, false);
     event->setPreviousScale(prevScale);
     event->setNewScale(newScale);
     rootElement()->dispatchEvent(event.release(), IGNORE_EXCEPTION);
@@ -61,7 +61,7 @@
 void SVGDocument::dispatchScrollEvent()
 {
     RefPtr<Event> event = createEvent("SVGEvents", IGNORE_EXCEPTION);
-    event->initEvent(eventNames().scrollEvent, true, false);
+    event->initEvent(EventTypeNames::scroll, true, false);
     rootElement()->dispatchEvent(event.release(), IGNORE_EXCEPTION);
 }
 
diff --git a/Source/core/svg/SVGDocument.h b/Source/core/svg/SVGDocument.h
index bddf66f..79fc464 100644
--- a/Source/core/svg/SVGDocument.h
+++ b/Source/core/svg/SVGDocument.h
@@ -22,7 +22,7 @@
 #define SVGDocument_h
 
 #include "core/dom/Document.h"
-#include "core/platform/graphics/FloatPoint.h"
+#include "platform/geometry/FloatPoint.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGDocument.idl b/Source/core/svg/SVGDocument.idl
index 64ec90c..dced411 100644
--- a/Source/core/svg/SVGDocument.idl
+++ b/Source/core/svg/SVGDocument.idl
@@ -19,9 +19,7 @@
  * Boston, MA 02110-1301, USA.
  */
 
-[
-    CustomToV8
-] interface SVGDocument : Document {
+interface SVGDocument : Document {
     readonly attribute SVGSVGElement        rootElement;
 
     // Overwrite the one in events::DocumentEvent
diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp
index 19a8b99..60ae7be 100644
--- a/Source/core/svg/SVGElement.cpp
+++ b/Source/core/svg/SVGElement.cpp
@@ -47,6 +47,8 @@
 #include "core/svg/SVGSVGElement.h"
 #include "core/svg/SVGUseElement.h"
 
+#include "wtf/TemporaryChange.h"
+
 namespace WebCore {
 
 // Animated property definitions
@@ -71,6 +73,9 @@
 
 SVGElement::SVGElement(const QualifiedName& tagName, Document& document, ConstructionType constructionType)
     : Element(tagName, &document, constructionType)
+#if !ASSERT_DISABLED
+    , m_inRelativeLengthClientsInvalidation(false)
+#endif
 {
     ScriptWrappable::init(this);
     registerAnimatedPropertiesForSVGElement();
@@ -79,7 +84,6 @@
 
 SVGElement::~SVGElement()
 {
-    SVGAnimatedProperty::detachAnimatedPropertiesWrappersForElement(this);
     if (!hasSVGRareData())
         ASSERT(!SVGElementRareData::rareDataMap().contains(this));
     else {
@@ -107,7 +111,8 @@
     }
     document().accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);
     document().accessSVGExtensions()->removeAllElementReferencesForTarget(this);
-    SVGAnimatedProperty::detachAnimatedPropertiesForElement(this);
+
+    ASSERT(inDocument() || !hasRelativeLengths());
 }
 
 void SVGElement::willRecalcStyle(StyleRecalcChange change)
@@ -120,8 +125,7 @@
         return;
     // If the style changes because of a regular property change (not induced by SMIL animations themselves)
     // reset the "computed style without SMIL style properties", so the base value change gets reflected.
-    if (change > NoChange || needsStyleRecalc())
-        svgRareData()->setNeedsOverrideComputedStyleUpdate();
+    svgRareData()->setNeedsOverrideComputedStyleUpdate();
 }
 
 void SVGElement::buildPendingResourcesIfNeeded()
@@ -184,12 +188,6 @@
     if (!hasTagName(SVGNames::svgTag))
         return false;
 
-    // If we're living in a shadow tree, we're a <svg> element that got created as replacement
-    // for a <symbol> element or a cloned <svg> element in the referenced tree. In that case
-    // we're always an inner <svg> element.
-    if (isInShadowTree() && parentOrShadowHostElement() && parentOrShadowHostElement()->isSVGElement())
-        return false;
-
     // Element may not be in the document, pretend we're outermost for viewport(), getCTM(), etc.
     if (!parentNode())
         return true;
@@ -198,6 +196,12 @@
     if (parentNode()->hasTagName(SVGNames::foreignObjectTag))
         return true;
 
+    // If we're living in a shadow tree, we're a <svg> element that got created as replacement
+    // for a <symbol> element or a cloned <svg> element in the referenced tree. In that case
+    // we're always an inner <svg> element.
+    if (isInShadowTree() && parentOrShadowHostElement() && parentOrShadowHostElement()->isSVGElement())
+        return false;
+
     // This is true whenever this is the outermost SVG, even if there are HTML elements outside it
     return !parentNode()->isSVGElement();
 }
@@ -330,8 +334,19 @@
 {
     bool wasInDocument = rootParent->inDocument();
 
-    if (wasInDocument)
-        updateRelativeLengthsInformation(false, this);
+    if (wasInDocument && hasRelativeLengths()) {
+        // The root of the subtree being removed should take itself out from its parent's relative
+        // length set. For the other nodes in the subtree we don't need to do anything: they will
+        // get their own removedFrom() notification and just clear their sets.
+        if (rootParent->isSVGElement() && !parentNode()) {
+            ASSERT(toSVGElement(rootParent)->m_elementsWithRelativeLengths.contains(this));
+            toSVGElement(rootParent)->updateRelativeLengthsInformation(false, this);
+        }
+
+        m_elementsWithRelativeLengths.clear();
+    }
+
+    ASSERT_WITH_SECURITY_IMPLICATION(!rootParent->isSVGElement() || !toSVGElement(rootParent)->m_elementsWithRelativeLengths.contains(this));
 
     Element::removedFrom(rootParent);
 
@@ -429,7 +444,7 @@
     return propertyNameToIdMap->get(attrName.localName().impl());
 }
 
-void SVGElement::updateRelativeLengthsInformation(bool hasRelativeLengths, SVGElement* element)
+void SVGElement::updateRelativeLengthsInformation(bool clientHasRelativeLengths, SVGElement* clientElement)
 {
     // If we're not yet in a document, this function will be called again from insertedInto(). Do nothing now.
     if (!inDocument())
@@ -438,28 +453,44 @@
     // An element wants to notify us that its own relative lengths state changed.
     // Register it in the relative length map, and register us in the parent relative length map.
     // Register the parent in the grandparents map, etc. Repeat procedure until the root of the SVG tree.
-    if (hasRelativeLengths) {
-        m_elementsWithRelativeLengths.add(element);
-    } else {
-        if (!m_elementsWithRelativeLengths.contains(element)) {
-            // We were never registered. Do nothing.
-            return;
-        }
+    for (ContainerNode* currentNode = this; currentNode && currentNode->isSVGElement(); currentNode = currentNode->parentNode()) {
+        SVGElement* currentElement = toSVGElement(currentNode);
+        ASSERT(!currentElement->m_inRelativeLengthClientsInvalidation);
 
-        m_elementsWithRelativeLengths.remove(element);
-    }
+        bool hadRelativeLengths = currentElement->hasRelativeLengths();
+        if (clientHasRelativeLengths)
+            currentElement->m_elementsWithRelativeLengths.add(clientElement);
+        else
+            currentElement->m_elementsWithRelativeLengths.remove(clientElement);
 
-    // Find first styled parent node, and notify it that we've changed our relative length state.
-    ContainerNode* node = parentNode();
-    while (node) {
-        if (!node->isSVGElement())
+        // If the relative length state hasn't changed, we can stop propagating the notfication.
+        if (hadRelativeLengths == currentElement->hasRelativeLengths())
             break;
 
-        SVGElement* element = toSVGElement(node);
+        clientElement = currentElement;
+        clientHasRelativeLengths = clientElement->hasRelativeLengths();
+    }
+}
 
-        // Register us in the parent element map.
-        element->updateRelativeLengthsInformation(hasRelativeLengths, this);
-        break;
+void SVGElement::invalidateRelativeLengthClients(SubtreeLayoutScope* layoutScope)
+{
+    if (!inDocument())
+        return;
+
+    ASSERT(!m_inRelativeLengthClientsInvalidation);
+#if !ASSERT_DISABLED
+    TemporaryChange<bool> inRelativeLengthClientsInvalidationChange(m_inRelativeLengthClientsInvalidation, true);
+#endif
+
+    HashSet<SVGElement*>::iterator end = m_elementsWithRelativeLengths.end();
+    for (HashSet<SVGElement*>::iterator it = m_elementsWithRelativeLengths.begin(); it != end; ++it) {
+        if (*it == this)
+            continue;
+
+        if ((*it)->renderer() && (*it)->selfHasRelativeLengths())
+            (*it)->renderer()->setNeedsLayout(MarkContainingBlockChain, layoutScope);
+
+        (*it)->invalidateRelativeLengthClients(layoutScope);
     }
 }
 
@@ -586,29 +617,29 @@
 {
     // standard events
     if (name == onloadAttr)
-        setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::load, createAttributeEventListener(this, name, value));
     else if (name == onclickAttr)
-        setAttributeEventListener(eventNames().clickEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::click, createAttributeEventListener(this, name, value));
     else if (name == onmousedownAttr)
-        setAttributeEventListener(eventNames().mousedownEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::mousedown, createAttributeEventListener(this, name, value));
     else if (name == onmouseenterAttr)
-        setAttributeEventListener(eventNames().mouseenterEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::mouseenter, createAttributeEventListener(this, name, value));
     else if (name == onmouseleaveAttr)
-        setAttributeEventListener(eventNames().mouseleaveEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::mouseleave, createAttributeEventListener(this, name, value));
     else if (name == onmousemoveAttr)
-        setAttributeEventListener(eventNames().mousemoveEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::mousemove, createAttributeEventListener(this, name, value));
     else if (name == onmouseoutAttr)
-        setAttributeEventListener(eventNames().mouseoutEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::mouseout, createAttributeEventListener(this, name, value));
     else if (name == onmouseoverAttr)
-        setAttributeEventListener(eventNames().mouseoverEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::mouseover, createAttributeEventListener(this, name, value));
     else if (name == onmouseupAttr)
-        setAttributeEventListener(eventNames().mouseupEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::mouseup, createAttributeEventListener(this, name, value));
     else if (name == SVGNames::onfocusinAttr)
-        setAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::focusin, createAttributeEventListener(this, name, value));
     else if (name == SVGNames::onfocusoutAttr)
-        setAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::focusout, createAttributeEventListener(this, name, value));
     else if (name == SVGNames::onactivateAttr)
-        setAttributeEventListener(eventNames().DOMActivateEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::DOMActivate, createAttributeEventListener(this, name, value));
     else if (name == HTMLNames::classAttr) {
         // SVG animation has currently requires special storage of values so we set
         // the className here. svgAttributeChanged actually causes the resulting
@@ -810,11 +841,11 @@
 
 static bool hasLoadListener(Element* element)
 {
-    if (element->hasEventListeners(eventNames().loadEvent))
+    if (element->hasEventListeners(EventTypeNames::load))
         return true;
 
     for (element = element->parentOrShadowHostElement(); element; element = element->parentOrShadowHostElement()) {
-        const EventListenerVector& entry = element->getEventListeners(eventNames().loadEvent);
+        const EventListenerVector& entry = element->getEventListeners(EventTypeNames::load);
         for (size_t i = 0; i < entry.size(); ++i) {
             if (entry[i].useCapture)
                 return true;
@@ -838,9 +869,9 @@
         if (sendParentLoadEvents)
             parent = currentTarget->parentOrShadowHostElement(); // save the next parent to dispatch too incase dispatching the event changes the tree
         if (hasLoadListener(currentTarget.get()))
-            currentTarget->dispatchEvent(Event::create(eventNames().loadEvent));
+            currentTarget->dispatchEvent(Event::create(EventTypeNames::load));
         currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : RefPtr<SVGElement>();
-        SVGElement* element = toSVGElement(currentTarget.get());
+        SVGElement* element = currentTarget.get();
         if (!element || !element->isOutermostSVGSVGElement())
             continue;
 
@@ -1025,7 +1056,7 @@
 
 bool SVGElement::hasFocusEventListeners() const
 {
-    return hasEventListeners(eventNames().focusinEvent) || hasEventListeners(eventNames().focusoutEvent);
+    return hasEventListeners(EventTypeNames::focusin) || hasEventListeners(EventTypeNames::focusout);
 }
 
 bool SVGElement::isKeyboardFocusable() const
diff --git a/Source/core/svg/SVGElement.h b/Source/core/svg/SVGElement.h
index 1f22c61..5dd3f16 100644
--- a/Source/core/svg/SVGElement.h
+++ b/Source/core/svg/SVGElement.h
@@ -23,13 +23,13 @@
 #define SVGElement_h
 
 #include "core/dom/Element.h"
-#include "core/platform/Timer.h"
 #include "core/svg/SVGAnimatedString.h"
 #include "core/svg/SVGLangSpace.h"
 #include "core/svg/SVGLocatable.h"
 #include "core/svg/SVGParsingError.h"
 #include "core/svg/properties/SVGAnimatedPropertyMacros.h"
 #include "core/svg/properties/SVGPropertyInfo.h"
+#include "platform/Timer.h"
 #include "wtf/HashMap.h"
 
 namespace WebCore {
@@ -37,6 +37,7 @@
 class AffineTransform;
 class CSSCursorImageValue;
 class Document;
+class SubtreeLayoutScope;
 class SVGAttributeToPropertyMap;
 class SVGCursorElement;
 class SVGDocumentExtensions;
@@ -133,6 +134,8 @@
 
     virtual bool shouldMoveToFlowThread(RenderStyle*) const OVERRIDE;
 
+    void invalidateRelativeLengthClients(SubtreeLayoutScope* = 0);
+
 protected:
     SVGElement(const QualifiedName&, Document&, ConstructionType = CreateSVGElement);
 
@@ -186,6 +189,10 @@
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGElement)
         DECLARE_ANIMATED_STRING(ClassName, className)
     END_DECLARE_ANIMATED_PROPERTIES
+
+#if !ASSERT_DISABLED
+    bool m_inRelativeLengthClientsInvalidation;
+#endif
 };
 
 struct SVGAttributeHashTranslator {
@@ -200,17 +207,7 @@
     static bool equal(const QualifiedName& a, const QualifiedName& b) { return a.matches(b); }
 };
 
-inline SVGElement* toSVGElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isSVGElement());
-    return static_cast<SVGElement*>(node);
-}
-
-inline const SVGElement* toSVGElement(const Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isSVGElement());
-    return static_cast<const SVGElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGElement, isSVGElement());
 
 }
 
diff --git a/Source/core/svg/SVGElementInstance.cpp b/Source/core/svg/SVGElementInstance.cpp
index 5132de1..7bf6048 100644
--- a/Source/core/svg/SVGElementInstance.cpp
+++ b/Source/core/svg/SVGElementInstance.cpp
@@ -26,7 +26,7 @@
 #include "core/dom/ContainerNodeAlgorithms.h"
 #include "core/events/Event.h"
 #include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGElementInstanceList.h"
 #include "core/svg/SVGUseElement.h"
@@ -125,7 +125,7 @@
 // delete an SVGElementInstance at each deref call site.
 void SVGElementInstance::removedLastRef()
 {
-#ifndef NDEBUG
+#if SECURITY_ASSERT_ENABLED
     m_deletionHasBegun = true;
 #endif
     delete this;
@@ -200,10 +200,10 @@
 
 const AtomicString& SVGElementInstance::interfaceName() const
 {
-    return eventNames().interfaceForSVGElementInstance;
+    return EventTargetNames::SVGElementInstance;
 }
 
-ScriptExecutionContext* SVGElementInstance::scriptExecutionContext() const
+ExecutionContext* SVGElementInstance::executionContext() const
 {
     return &m_element->document();
 }
@@ -248,12 +248,12 @@
     return 0;
 }
 
-EventTargetData* SVGElementInstance::ensureEventTargetData()
+EventTargetData& SVGElementInstance::ensureEventTargetData()
 {
     // EventTarget would use these methods if we were actually using its add/removeEventListener logic.
     // As we're forwarding those calls to the correspondingElement(), no one should ever call this function.
     ASSERT_NOT_REACHED();
-    return 0;
+    return *eventTargetData();
 }
 
 SVGElementInstance::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetElement)
diff --git a/Source/core/svg/SVGElementInstance.h b/Source/core/svg/SVGElementInstance.h
index 721fd81..1b6c207 100644
--- a/Source/core/svg/SVGElementInstance.h
+++ b/Source/core/svg/SVGElementInstance.h
@@ -22,8 +22,8 @@
 #define SVGElementInstance_h
 
 #include "bindings/v8/ScriptWrappable.h"
+#include "core/dom/TreeShared.h"
 #include "core/events/EventTarget.h"
-#include "core/platform/TreeShared.h"
 
 namespace WebCore {
 
@@ -47,7 +47,7 @@
     void setParentOrShadowHostNode(SVGElementInstance* instance) { m_parentInstance = instance; }
 
     virtual const AtomicString& interfaceName() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const;
+    virtual ExecutionContext* executionContext() const;
 
     virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
     virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
@@ -174,10 +174,10 @@
     void setNextSibling(SVGElementInstance* sibling) { m_nextSibling = sibling; }
     void setPreviousSibling(SVGElementInstance* sibling) { m_previousSibling = sibling; }
 
-    virtual void refEventTarget() { ref(); }
-    virtual void derefEventTarget() { deref(); }
-    virtual EventTargetData* eventTargetData();
-    virtual EventTargetData* ensureEventTargetData();
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
+    virtual EventTargetData* eventTargetData() OVERRIDE;
+    virtual EventTargetData& ensureEventTargetData() OVERRIDE;
 
     SVGElementInstance* m_parentInstance;
 
diff --git a/Source/core/svg/SVGEllipseElement.h b/Source/core/svg/SVGEllipseElement.h
index dcfc5ec..1c34b9b 100644
--- a/Source/core/svg/SVGEllipseElement.h
+++ b/Source/core/svg/SVGEllipseElement.h
@@ -57,11 +57,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGEllipseElement* toSVGEllipseElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::ellipseTag));
-    return static_cast<SVGEllipseElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGEllipseElement, hasTagName(SVGNames::ellipseTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFEConvolveMatrixElement.cpp b/Source/core/svg/SVGFEConvolveMatrixElement.cpp
index 9453bf7..dc42d93 100644
--- a/Source/core/svg/SVGFEConvolveMatrixElement.cpp
+++ b/Source/core/svg/SVGFEConvolveMatrixElement.cpp
@@ -22,13 +22,13 @@
 #include "core/svg/SVGFEConvolveMatrixElement.h"
 
 #include "SVGNames.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/IntPoint.h"
-#include "core/platform/graphics/IntSize.h"
 #include "core/platform/graphics/filters/FilterEffect.h"
 #include "core/svg/SVGElementInstance.h"
 #include "core/svg/SVGParserUtilities.h"
 #include "core/svg/graphics/filters/SVGFilterBuilder.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/IntPoint.h"
+#include "platform/geometry/IntSize.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGFEDiffuseLightingElement.h b/Source/core/svg/SVGFEDiffuseLightingElement.h
index efd8e3f..dc10343 100644
--- a/Source/core/svg/SVGFEDiffuseLightingElement.h
+++ b/Source/core/svg/SVGFEDiffuseLightingElement.h
@@ -57,11 +57,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGFEDiffuseLightingElement* toSVGFEDiffuseLightingElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feDiffuseLightingTag));
-    return static_cast<SVGFEDiffuseLightingElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFEDiffuseLightingElement, hasTagName(SVGNames::feDiffuseLightingTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFEFuncAElement.h b/Source/core/svg/SVGFEFuncAElement.h
index 7f6cfdc..fcd7aee 100644
--- a/Source/core/svg/SVGFEFuncAElement.h
+++ b/Source/core/svg/SVGFEFuncAElement.h
@@ -34,11 +34,7 @@
     SVGFEFuncAElement(const QualifiedName&, Document&);
 };
 
-inline SVGFEFuncAElement* toSVGFEFuncAElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feFuncATag));
-    return static_cast<SVGFEFuncAElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFEFuncAElement, hasTagName(SVGNames::feFuncATag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFEFuncBElement.h b/Source/core/svg/SVGFEFuncBElement.h
index 6bf582e..4639acb 100644
--- a/Source/core/svg/SVGFEFuncBElement.h
+++ b/Source/core/svg/SVGFEFuncBElement.h
@@ -34,11 +34,7 @@
     SVGFEFuncBElement(const QualifiedName&, Document&);
 };
 
-inline SVGFEFuncBElement* toSVGFEFuncBElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feFuncBTag));
-    return static_cast<SVGFEFuncBElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFEFuncBElement, hasTagName(SVGNames::feFuncBTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFEFuncGElement.h b/Source/core/svg/SVGFEFuncGElement.h
index 5b29bdc..d8fcb05 100644
--- a/Source/core/svg/SVGFEFuncGElement.h
+++ b/Source/core/svg/SVGFEFuncGElement.h
@@ -34,11 +34,7 @@
     SVGFEFuncGElement(const QualifiedName&, Document&);
 };
 
-inline SVGFEFuncGElement* toSVGFEFuncGElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feFuncGTag));
-    return static_cast<SVGFEFuncGElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFEFuncGElement, hasTagName(SVGNames::feFuncGTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFEFuncRElement.h b/Source/core/svg/SVGFEFuncRElement.h
index 4822a0b..6b309a3 100644
--- a/Source/core/svg/SVGFEFuncRElement.h
+++ b/Source/core/svg/SVGFEFuncRElement.h
@@ -34,11 +34,7 @@
     SVGFEFuncRElement(const QualifiedName&, Document&);
 };
 
-inline SVGFEFuncRElement* toSVGFEFuncRElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feFuncRTag));
-    return static_cast<SVGFEFuncRElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFEFuncRElement, hasTagName(SVGNames::feFuncRTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFEImageElement.h b/Source/core/svg/SVGFEImageElement.h
index c769e55..78864b5 100644
--- a/Source/core/svg/SVGFEImageElement.h
+++ b/Source/core/svg/SVGFEImageElement.h
@@ -72,11 +72,7 @@
     ResourcePtr<ImageResource> m_cachedImage;
 };
 
-inline SVGFEImageElement* toSVGFEImageElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feImageTag));
-    return static_cast<SVGFEImageElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFEImageElement, hasTagName(SVGNames::feImageTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFEMergeNodeElement.h b/Source/core/svg/SVGFEMergeNodeElement.h
index 9bfe59a..b93938a 100644
--- a/Source/core/svg/SVGFEMergeNodeElement.h
+++ b/Source/core/svg/SVGFEMergeNodeElement.h
@@ -45,11 +45,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGFEMergeNodeElement* toSVGFEMergeNodeElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feMergeNodeTag));
-    return static_cast<SVGFEMergeNodeElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFEMergeNodeElement, hasTagName(SVGNames::feMergeNodeTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFESpecularLightingElement.h b/Source/core/svg/SVGFESpecularLightingElement.h
index 38d5d62..4b562fe 100644
--- a/Source/core/svg/SVGFESpecularLightingElement.h
+++ b/Source/core/svg/SVGFESpecularLightingElement.h
@@ -57,11 +57,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGFESpecularLightingElement* toSVGFESpecularLightingElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feSpecularLightingTag));
-    return static_cast<SVGFESpecularLightingElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFESpecularLightingElement, hasTagName(SVGNames::feSpecularLightingTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFilterElement.h b/Source/core/svg/SVGFilterElement.h
index d344fd2..f929a3e 100644
--- a/Source/core/svg/SVGFilterElement.h
+++ b/Source/core/svg/SVGFilterElement.h
@@ -79,11 +79,7 @@
     HashSet<RefPtr<Node> > m_clientsToAdd;
 };
 
-inline SVGFilterElement* toSVGFilterElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::filterTag));
-    return static_cast<SVGFilterElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFilterElement, hasTagName(SVGNames::filterTag));
 
 }
 
diff --git a/Source/core/svg/SVGFitToViewBox.cpp b/Source/core/svg/SVGFitToViewBox.cpp
index ed7de02..1971541 100644
--- a/Source/core/svg/SVGFitToViewBox.cpp
+++ b/Source/core/svg/SVGFitToViewBox.cpp
@@ -25,11 +25,11 @@
 #include "SVGNames.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "core/svg/SVGParserUtilities.h"
 #include "core/svg/SVGPreserveAspectRatio.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/text/StringImpl.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGFitToViewBox.h b/Source/core/svg/SVGFitToViewBox.h
index 6528445..7b5544c 100644
--- a/Source/core/svg/SVGFitToViewBox.h
+++ b/Source/core/svg/SVGFitToViewBox.h
@@ -23,8 +23,8 @@
 
 #include "SVGNames.h"
 #include "core/dom/QualifiedName.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/svg/SVGPreserveAspectRatio.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/HashSet.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGFontData.cpp b/Source/core/svg/SVGFontData.cpp
index 45a5d49..5054eaf 100644
--- a/Source/core/svg/SVGFontData.cpp
+++ b/Source/core/svg/SVGFontData.cpp
@@ -25,7 +25,6 @@
 #include "SVGNames.h"
 #include "XMLNames.h"
 #include "core/platform/graphics/SVGGlyph.h"
-#include "core/platform/graphics/TextRun.h"
 #include "core/platform/graphics/WidthIterator.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/svg/SVGTextRunRenderingContext.h"
@@ -33,6 +32,7 @@
 #include "core/svg/SVGFontElement.h"
 #include "core/svg/SVGFontFaceElement.h"
 #include "core/svg/SVGGlyphElement.h"
+#include "platform/graphics/TextRun.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/unicode/CharacterNames.h"
 #include "wtf/unicode/Unicode.h"
diff --git a/Source/core/svg/SVGFontElement.cpp b/Source/core/svg/SVGFontElement.cpp
index ab333c0..bfc92ff 100644
--- a/Source/core/svg/SVGFontElement.cpp
+++ b/Source/core/svg/SVGFontElement.cpp
@@ -51,7 +51,7 @@
     ScriptWrappable::init(this);
     registerAnimatedPropertiesForSVGFontElement();
 
-    UseCounter::count(&document, UseCounter::SVGFontElement);
+    UseCounter::count(document, UseCounter::SVGFontElement);
 }
 
 PassRefPtr<SVGFontElement> SVGFontElement::create(const QualifiedName& tagName, Document& document)
diff --git a/Source/core/svg/SVGFontElement.h b/Source/core/svg/SVGFontElement.h
index fefa0a5..2ac4d45 100644
--- a/Source/core/svg/SVGFontElement.h
+++ b/Source/core/svg/SVGFontElement.h
@@ -89,11 +89,7 @@
     bool m_isGlyphCacheValid;
 };
 
-inline SVGFontElement* toSVGFontElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::fontTag));
-    return static_cast<SVGFontElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFontElement, hasTagName(SVGNames::fontTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFontFaceElement.h b/Source/core/svg/SVGFontFaceElement.h
index 5e77bd7..e671ff4 100644
--- a/Source/core/svg/SVGFontFaceElement.h
+++ b/Source/core/svg/SVGFontFaceElement.h
@@ -67,11 +67,7 @@
     SVGFontElement* m_fontElement;
 };
 
-inline SVGFontFaceElement* toSVGFontFaceElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::font_faceTag));
-    return static_cast<SVGFontFaceElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFontFaceElement, hasTagName(SVGNames::font_faceTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFontFaceNameElement.h b/Source/core/svg/SVGFontFaceNameElement.h
index 1339e4a..3d83e20 100644
--- a/Source/core/svg/SVGFontFaceNameElement.h
+++ b/Source/core/svg/SVGFontFaceNameElement.h
@@ -40,11 +40,7 @@
     virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
 };
 
-inline SVGFontFaceNameElement* toSVGFontFaceNameElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::font_face_nameTag));
-    return static_cast<SVGFontFaceNameElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFontFaceNameElement, hasTagName(SVGNames::font_face_nameTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGFontFaceUriElement.h b/Source/core/svg/SVGFontFaceUriElement.h
index 8a3f84e..61a3478 100644
--- a/Source/core/svg/SVGFontFaceUriElement.h
+++ b/Source/core/svg/SVGFontFaceUriElement.h
@@ -52,11 +52,7 @@
     ResourcePtr<FontResource> m_resource;
 };
 
-inline SVGFontFaceUriElement* toSVGFontFaceUriElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::font_face_uriTag));
-    return static_cast<SVGFontFaceUriElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGFontFaceUriElement, hasTagName(SVGNames::font_face_uriTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGForeignObjectElement.h b/Source/core/svg/SVGForeignObjectElement.h
index 83018a8..68ed016 100644
--- a/Source/core/svg/SVGForeignObjectElement.h
+++ b/Source/core/svg/SVGForeignObjectElement.h
@@ -58,11 +58,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGForeignObjectElement* toSVGForeignObjectElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::foreignObjectTag));
-    return static_cast<SVGForeignObjectElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGForeignObjectElement, hasTagName(SVGNames::foreignObjectTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGGlyphElement.h b/Source/core/svg/SVGGlyphElement.h
index 2598356..a08bc82 100644
--- a/Source/core/svg/SVGGlyphElement.h
+++ b/Source/core/svg/SVGGlyphElement.h
@@ -58,11 +58,7 @@
     void invalidateGlyphCache();
 };
 
-inline SVGGlyphElement* toSVGGlyphElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::glyphTag));
-    return static_cast<SVGGlyphElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGGlyphElement, hasTagName(SVGNames::glyphTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGGlyphMap.h b/Source/core/svg/SVGGlyphMap.h
index ea45597..237f017 100644
--- a/Source/core/svg/SVGGlyphMap.h
+++ b/Source/core/svg/SVGGlyphMap.h
@@ -23,7 +23,7 @@
 #if ENABLE(SVG_FONTS)
 #include "core/platform/graphics/Latin1TextIterator.h"
 #include "core/platform/graphics/SVGGlyph.h"
-#include "core/platform/graphics/SurrogatePairAwareTextIterator.h"
+#include "platform/text/SurrogatePairAwareTextIterator.h"
 #include "wtf/HashMap.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/svg/SVGGlyphRefElement.h b/Source/core/svg/SVGGlyphRefElement.h
index 21a2e4f..9afe97d 100644
--- a/Source/core/svg/SVGGlyphRefElement.h
+++ b/Source/core/svg/SVGGlyphRefElement.h
@@ -65,11 +65,7 @@
     float m_dy;
 };
 
-inline SVGGlyphRefElement* toSVGGlyphRefElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::glyphRefTag));
-    return static_cast<SVGGlyphRefElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGGlyphRefElement, hasTagName(SVGNames::glyphRefTag));
 
 }
 
diff --git a/Source/core/svg/SVGGlyphRefElement.idl b/Source/core/svg/SVGGlyphRefElement.idl
index e10bf7b..76a4e4a 100644
--- a/Source/core/svg/SVGGlyphRefElement.idl
+++ b/Source/core/svg/SVGGlyphRefElement.idl
@@ -22,7 +22,7 @@
 ] interface SVGGlyphRefElement : SVGElement {
     // FIXME: Use [Reflect] after https://bugs.webkit.org/show_bug.cgi?id=64843 is fixed.
     attribute DOMString glyphRef;
-    [Reflect] attribute DOMString format;
+    [Reflect, TreatNullAs=NullString] attribute DOMString format;
     attribute float x;
     attribute float y;
     attribute float dx;
diff --git a/Source/core/svg/SVGGraphicsElement.cpp b/Source/core/svg/SVGGraphicsElement.cpp
index 2fec716..9da02b3 100644
--- a/Source/core/svg/SVGGraphicsElement.cpp
+++ b/Source/core/svg/SVGGraphicsElement.cpp
@@ -23,11 +23,11 @@
 #include "core/svg/SVGGraphicsElement.h"
 
 #include "SVGNames.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/svg/RenderSVGPath.h"
 #include "core/rendering/svg/RenderSVGResource.h"
 #include "core/rendering/svg/SVGPathData.h"
 #include "core/svg/SVGElementInstance.h"
+#include "platform/transforms/AffineTransform.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGHKernElement.h b/Source/core/svg/SVGHKernElement.h
index c60d624..719a5aa 100644
--- a/Source/core/svg/SVGHKernElement.h
+++ b/Source/core/svg/SVGHKernElement.h
@@ -43,11 +43,7 @@
     virtual bool rendererIsNeeded(const RenderStyle&) { return false; }
 };
 
-inline SVGHKernElement* toSVGHKernElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::hkernTag));
-    return static_cast<SVGHKernElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGHKernElement, hasTagName(SVGNames::hkernTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGImageElement.cpp b/Source/core/svg/SVGImageElement.cpp
index d2ce3c0..9533db1 100644
--- a/Source/core/svg/SVGImageElement.cpp
+++ b/Source/core/svg/SVGImageElement.cpp
@@ -238,7 +238,7 @@
     addSubresourceURL(urls, document().completeURL(hrefCurrentValue()));
 }
 
-void SVGImageElement::didMoveToNewDocument(Document* oldDocument)
+void SVGImageElement::didMoveToNewDocument(Document& oldDocument)
 {
     m_imageLoader.elementDidMoveToNewDocument();
     SVGGraphicsElement::didMoveToNewDocument(oldDocument);
diff --git a/Source/core/svg/SVGImageElement.h b/Source/core/svg/SVGImageElement.h
index fc4e157..c58bde7 100644
--- a/Source/core/svg/SVGImageElement.h
+++ b/Source/core/svg/SVGImageElement.h
@@ -63,7 +63,7 @@
     virtual bool haveLoadedRequiredResources();
 
     virtual bool selfHasRelativeLengths() const;
-    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
+    virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
 
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement)
         DECLARE_ANIMATED_LENGTH(X, x)
@@ -78,11 +78,7 @@
     SVGImageLoader m_imageLoader;
 };
 
-inline SVGImageElement* toSVGImageElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::imageTag));
-    return static_cast<SVGImageElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGImageElement, hasTagName(SVGNames::imageTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGImageLoader.cpp b/Source/core/svg/SVGImageLoader.cpp
index fc405f6..e889c61 100644
--- a/Source/core/svg/SVGImageLoader.cpp
+++ b/Source/core/svg/SVGImageLoader.cpp
@@ -23,7 +23,7 @@
 #include "core/svg/SVGImageLoader.h"
 
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/fetch/ImageResource.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/svg/SVGImageElement.h"
@@ -38,7 +38,7 @@
 void SVGImageLoader::dispatchLoadEvent()
 {
     if (image()->errorOccurred())
-        element()->dispatchEvent(Event::create(eventNames().errorEvent));
+        element()->dispatchEvent(Event::create(EventTypeNames::error));
     else {
         SVGImageElement* imageElement = toSVGImageElement(element());
         if (imageElement->externalResourcesRequiredBaseValue())
diff --git a/Source/core/svg/SVGLengthContext.h b/Source/core/svg/SVGLengthContext.h
index c2fea4e..5bb2130 100644
--- a/Source/core/svg/SVGLengthContext.h
+++ b/Source/core/svg/SVGLengthContext.h
@@ -20,8 +20,8 @@
 #ifndef SVGLengthContext_h
 #define SVGLengthContext_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/svg/SVGUnitTypes.h"
+#include "platform/geometry/FloatRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGLineElement.h b/Source/core/svg/SVGLineElement.h
index af514be..ad09477 100644
--- a/Source/core/svg/SVGLineElement.h
+++ b/Source/core/svg/SVGLineElement.h
@@ -57,11 +57,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGLineElement* toSVGLineElement(Element* element)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!element || element->hasTagName(SVGNames::lineTag));
-    return static_cast<SVGLineElement*>(element);
-}
+DEFINE_NODE_TYPE_CASTS(SVGLineElement, hasTagName(SVGNames::lineTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGLinearGradientElement.h b/Source/core/svg/SVGLinearGradientElement.h
index 7f5f5eb..758ee9c 100644
--- a/Source/core/svg/SVGLinearGradientElement.h
+++ b/Source/core/svg/SVGLinearGradientElement.h
@@ -54,11 +54,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGLinearGradientElement* toSVGLinearGradientElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::linearGradientTag));
-    return static_cast<SVGLinearGradientElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGLinearGradientElement, hasTagName(SVGNames::linearGradientTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGLocatable.h b/Source/core/svg/SVGLocatable.h
index 6ab6aad..10e1ff7 100644
--- a/Source/core/svg/SVGLocatable.h
+++ b/Source/core/svg/SVGLocatable.h
@@ -22,8 +22,8 @@
 #ifndef SVGLocatable_h
 #define SVGLocatable_h
 
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/svg/SVGRect.h"
+#include "platform/transforms/AffineTransform.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGMPathElement.h b/Source/core/svg/SVGMPathElement.h
index 62e50a5..b07d8fd 100644
--- a/Source/core/svg/SVGMPathElement.h
+++ b/Source/core/svg/SVGMPathElement.h
@@ -64,11 +64,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGMPathElement* toSVGMPathElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::mpathTag));
-    return static_cast<SVGMPathElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGMPathElement, hasTagName(SVGNames::mpathTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGMarkerElement.h b/Source/core/svg/SVGMarkerElement.h
index 05e50e2..08c21ca 100644
--- a/Source/core/svg/SVGMarkerElement.h
+++ b/Source/core/svg/SVGMarkerElement.h
@@ -165,11 +165,7 @@
     mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType;
 };
 
-inline SVGMarkerElement* toSVGMarkerElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::markerTag));
-    return static_cast<SVGMarkerElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGMarkerElement, hasTagName(SVGNames::markerTag));
 
 }
 
diff --git a/Source/core/svg/SVGMaskElement.h b/Source/core/svg/SVGMaskElement.h
index dd4043a..e53a824 100644
--- a/Source/core/svg/SVGMaskElement.h
+++ b/Source/core/svg/SVGMaskElement.h
@@ -68,11 +68,7 @@
     virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); }
 };
 
-inline SVGMaskElement* toSVGMaskElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::maskTag));
-    return static_cast<SVGMaskElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGMaskElement, hasTagName(SVGNames::maskTag));
 
 }
 
diff --git a/Source/core/svg/SVGMatrix.h b/Source/core/svg/SVGMatrix.h
index e892b2d..ea00ea5 100644
--- a/Source/core/svg/SVGMatrix.h
+++ b/Source/core/svg/SVGMatrix.h
@@ -22,7 +22,7 @@
 
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/transforms/AffineTransform.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGMissingGlyphElement.h b/Source/core/svg/SVGMissingGlyphElement.h
index 6ff776d..0ba5189 100644
--- a/Source/core/svg/SVGMissingGlyphElement.h
+++ b/Source/core/svg/SVGMissingGlyphElement.h
@@ -36,11 +36,7 @@
     virtual bool rendererIsNeeded(const RenderStyle&) { return false; }
 };
 
-inline SVGMissingGlyphElement* toSVGMissingGlyphElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::missing_glyphTag));
-    return static_cast<SVGMissingGlyphElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGMissingGlyphElement, hasTagName(SVGNames::missing_glyphTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGPaint.h b/Source/core/svg/SVGPaint.h
index f4f387d..9d6379b 100644
--- a/Source/core/svg/SVGPaint.h
+++ b/Source/core/svg/SVGPaint.h
@@ -116,6 +116,21 @@
     String m_uri;
 };
 
+// This will catch anyone doing an unnecessary cast.
+SVGPaint* toSVGPaint(const SVGColor*);
+
+inline SVGPaint* toSVGPaint(CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isSVGPaint());
+    return static_cast<SVGPaint*>(value);
+}
+
+inline const SVGPaint* toSVGPaint(const CSSValue* value)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isSVGPaint());
+    return static_cast<const SVGPaint*>(value);
+}
+
 } // namespace WebCore
 
 #endif // SVGPaint_h
diff --git a/Source/core/svg/SVGParserUtilities.cpp b/Source/core/svg/SVGParserUtilities.cpp
index bee9c1b..cf7c225 100644
--- a/Source/core/svg/SVGParserUtilities.cpp
+++ b/Source/core/svg/SVGParserUtilities.cpp
@@ -24,8 +24,8 @@
 #include "core/svg/SVGParserUtilities.h"
 
 #include "core/dom/Document.h"
-#include "core/platform/graphics/FloatRect.h"
 #include "core/svg/SVGPointList.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/ASCIICType.h"
 #include <limits>
 
diff --git a/Source/core/svg/SVGParserUtilities.h b/Source/core/svg/SVGParserUtilities.h
index 656e8b7..74cbb83 100644
--- a/Source/core/svg/SVGParserUtilities.h
+++ b/Source/core/svg/SVGParserUtilities.h
@@ -22,7 +22,7 @@
 #ifndef SVGParserUtilities_h
 #define SVGParserUtilities_h
 
-#include "core/platform/text/ParserUtilities.h"
+#include "platform/text/ParserUtilities.h"
 #include "wtf/HashSet.h"
 
 typedef pair<unsigned, unsigned> UnicodeRange;
diff --git a/Source/core/svg/SVGPathBuilder.h b/Source/core/svg/SVGPathBuilder.h
index e3a9c4d..0c6a15d 100644
--- a/Source/core/svg/SVGPathBuilder.h
+++ b/Source/core/svg/SVGPathBuilder.h
@@ -24,8 +24,8 @@
 #ifndef SVGPathBuilder_h
 #define SVGPathBuilder_h
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/svg/SVGPathConsumer.h"
+#include "platform/geometry/FloatPoint.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGPathByteStreamBuilder.h b/Source/core/svg/SVGPathByteStreamBuilder.h
index 06c26e6..b3fd747 100644
--- a/Source/core/svg/SVGPathByteStreamBuilder.h
+++ b/Source/core/svg/SVGPathByteStreamBuilder.h
@@ -20,9 +20,9 @@
 #ifndef SVGPathByteStreamBuilder_h
 #define SVGPathByteStreamBuilder_h
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/svg/SVGPathByteStream.h"
 #include "core/svg/SVGPathConsumer.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/svg/SVGPathByteStreamSource.h b/Source/core/svg/SVGPathByteStreamSource.h
index ebdb90a..9dedab5 100644
--- a/Source/core/svg/SVGPathByteStreamSource.h
+++ b/Source/core/svg/SVGPathByteStreamSource.h
@@ -20,9 +20,9 @@
 #ifndef SVGPathByteStreamSource_h
 #define SVGPathByteStreamSource_h
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/svg/SVGPathByteStream.h"
 #include "core/svg/SVGPathSource.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/PassOwnPtr.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGPathConsumer.h b/Source/core/svg/SVGPathConsumer.h
index fbd9e56..dfb841f 100644
--- a/Source/core/svg/SVGPathConsumer.h
+++ b/Source/core/svg/SVGPathConsumer.h
@@ -24,7 +24,7 @@
 #ifndef SVGPathConsumer_h
 #define SVGPathConsumer_h
 
-#include "core/platform/graphics/FloatPoint.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/FastAllocBase.h"
 #include "wtf/Noncopyable.h"
 
diff --git a/Source/core/svg/SVGPathElement.h b/Source/core/svg/SVGPathElement.h
index 3065a0e..766dd1d 100644
--- a/Source/core/svg/SVGPathElement.h
+++ b/Source/core/svg/SVGPathElement.h
@@ -130,11 +130,7 @@
     bool m_isAnimValObserved;
 };
 
-inline SVGPathElement* toSVGPathElement(Element* element)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!element || element->hasTagName(SVGNames::pathTag));
-    return static_cast<SVGPathElement*>(element);
-}
+DEFINE_NODE_TYPE_CASTS(SVGPathElement, hasTagName(SVGNames::pathTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGPathParser.cpp b/Source/core/svg/SVGPathParser.cpp
index 62c90c8..6b7ac43 100644
--- a/Source/core/svg/SVGPathParser.cpp
+++ b/Source/core/svg/SVGPathParser.cpp
@@ -24,8 +24,8 @@
 #include "config.h"
 #include "core/svg/SVGPathParser.h"
 
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/svg/SVGPathSource.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/MathExtras.h"
 
 static const float gOneOverThree = 1 / 3.f;
diff --git a/Source/core/svg/SVGPathSegListBuilder.h b/Source/core/svg/SVGPathSegListBuilder.h
index 1c9e06d..7b5c3aa 100644
--- a/Source/core/svg/SVGPathSegListBuilder.h
+++ b/Source/core/svg/SVGPathSegListBuilder.h
@@ -24,9 +24,9 @@
 #ifndef SVGPathSegListBuilder_h
 #define SVGPathSegListBuilder_h
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/svg/SVGPathConsumer.h"
 #include "core/svg/SVGPathSegList.h"
+#include "platform/geometry/FloatPoint.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGPathSegListSource.h b/Source/core/svg/SVGPathSegListSource.h
index b0e0cdd..9ff02c4 100644
--- a/Source/core/svg/SVGPathSegListSource.h
+++ b/Source/core/svg/SVGPathSegListSource.h
@@ -20,10 +20,10 @@
 #ifndef SVGPathSegListSource_h
 #define SVGPathSegListSource_h
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/svg/SVGPathSeg.h"
 #include "core/svg/SVGPathSegList.h"
 #include "core/svg/SVGPathSource.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
 
diff --git a/Source/core/svg/SVGPathStringBuilder.h b/Source/core/svg/SVGPathStringBuilder.h
index 8e20442..6893894 100644
--- a/Source/core/svg/SVGPathStringBuilder.h
+++ b/Source/core/svg/SVGPathStringBuilder.h
@@ -20,8 +20,8 @@
 #ifndef SVGPathStringBuilder_h
 #define SVGPathStringBuilder_h
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/svg/SVGPathConsumer.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGPathStringSource.cpp b/Source/core/svg/SVGPathStringSource.cpp
index 92c8ca6..ecde69f 100644
--- a/Source/core/svg/SVGPathStringSource.cpp
+++ b/Source/core/svg/SVGPathStringSource.cpp
@@ -22,8 +22,8 @@
 
 #include "core/svg/SVGPathStringSource.h"
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/svg/SVGParserUtilities.h"
+#include "platform/geometry/FloatPoint.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGPathTraversalStateBuilder.cpp b/Source/core/svg/SVGPathTraversalStateBuilder.cpp
index 99d9363..1fe2b5c 100644
--- a/Source/core/svg/SVGPathTraversalStateBuilder.cpp
+++ b/Source/core/svg/SVGPathTraversalStateBuilder.cpp
@@ -21,7 +21,7 @@
  */
 
 #include "config.h"
-#include "core/platform/graphics/PathTraversalState.h"
+#include "platform/graphics/PathTraversalState.h"
 
 #include "core/svg/SVGPathTraversalStateBuilder.h"
 
diff --git a/Source/core/svg/SVGPathUtilities.cpp b/Source/core/svg/SVGPathUtilities.cpp
index 2d93800..dcbeb40 100644
--- a/Source/core/svg/SVGPathUtilities.cpp
+++ b/Source/core/svg/SVGPathUtilities.cpp
@@ -21,7 +21,6 @@
 
 #include "core/svg/SVGPathUtilities.h"
 
-#include "core/platform/graphics/PathTraversalState.h"
 #include "core/svg/SVGPathBlender.h"
 #include "core/svg/SVGPathBuilder.h"
 #include "core/svg/SVGPathByteStreamBuilder.h"
@@ -32,6 +31,7 @@
 #include "core/svg/SVGPathStringBuilder.h"
 #include "core/svg/SVGPathStringSource.h"
 #include "core/svg/SVGPathTraversalStateBuilder.h"
+#include "platform/graphics/PathTraversalState.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGPatternElement.cpp b/Source/core/svg/SVGPatternElement.cpp
index 0fdf163..7a3851d 100644
--- a/Source/core/svg/SVGPatternElement.cpp
+++ b/Source/core/svg/SVGPatternElement.cpp
@@ -25,11 +25,11 @@
 
 #include "SVGNames.h"
 #include "XLinkNames.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/svg/RenderSVGResourcePattern.h"
 #include "core/svg/PatternAttributes.h"
 #include "core/svg/SVGElementInstance.h"
 #include "core/svg/SVGFitToViewBox.h"
+#include "platform/transforms/AffineTransform.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGPatternElement.h b/Source/core/svg/SVGPatternElement.h
index 2afb90d..1378011 100644
--- a/Source/core/svg/SVGPatternElement.h
+++ b/Source/core/svg/SVGPatternElement.h
@@ -86,11 +86,7 @@
     virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); }
 };
 
-inline SVGPatternElement* toSVGPatternElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::patternTag));
-    return static_cast<SVGPatternElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGPatternElement, hasTagName(SVGNames::patternTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGPoint.h b/Source/core/svg/SVGPoint.h
index 78f91bb..c258a0f 100644
--- a/Source/core/svg/SVGPoint.h
+++ b/Source/core/svg/SVGPoint.h
@@ -26,7 +26,7 @@
 #ifndef SVGPoint_h
 #define SVGPoint_h
 
-#include "core/platform/graphics/FloatRect.h"
+#include "platform/geometry/FloatRect.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGPointList.cpp b/Source/core/svg/SVGPointList.cpp
index 10013e6..3b7d9b9 100644
--- a/Source/core/svg/SVGPointList.cpp
+++ b/Source/core/svg/SVGPointList.cpp
@@ -21,7 +21,7 @@
 #include "config.h"
 #include "core/svg/SVGPointList.h"
 
-#include "core/platform/graphics/FloatPoint.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/WTFString.h"
 
diff --git a/Source/core/svg/SVGPolygonElement.h b/Source/core/svg/SVGPolygonElement.h
index 0076f64..89626b0 100644
--- a/Source/core/svg/SVGPolygonElement.h
+++ b/Source/core/svg/SVGPolygonElement.h
@@ -34,11 +34,7 @@
     SVGPolygonElement(const QualifiedName&, Document&);
 };
 
-inline SVGPolygonElement* toSVGPolygonElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::polygonTag));
-    return static_cast<SVGPolygonElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGPolygonElement, hasTagName(SVGNames::polygonTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGPolylineElement.h b/Source/core/svg/SVGPolylineElement.h
index fe1a5c0..97fc80e 100644
--- a/Source/core/svg/SVGPolylineElement.h
+++ b/Source/core/svg/SVGPolylineElement.h
@@ -34,11 +34,7 @@
     SVGPolylineElement(const QualifiedName&, Document&);
 };
 
-inline SVGPolylineElement* toSVGPolylineElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::polylineTag));
-    return static_cast<SVGPolylineElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGPolylineElement, hasTagName(SVGNames::polylineTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGPreserveAspectRatio.cpp b/Source/core/svg/SVGPreserveAspectRatio.cpp
index 7870071..9430d9f 100644
--- a/Source/core/svg/SVGPreserveAspectRatio.cpp
+++ b/Source/core/svg/SVGPreserveAspectRatio.cpp
@@ -24,9 +24,9 @@
 
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/svg/SVGParserUtilities.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGRadialGradientElement.h b/Source/core/svg/SVGRadialGradientElement.h
index 4b7c376..5ea1175 100644
--- a/Source/core/svg/SVGRadialGradientElement.h
+++ b/Source/core/svg/SVGRadialGradientElement.h
@@ -56,11 +56,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGRadialGradientElement* toSVGRadialGradientElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::radialGradientTag));
-    return static_cast<SVGRadialGradientElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGRadialGradientElement, hasTagName(SVGNames::radialGradientTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGRect.h b/Source/core/svg/SVGRect.h
index a5c2212..0517baf 100644
--- a/Source/core/svg/SVGRect.h
+++ b/Source/core/svg/SVGRect.h
@@ -20,8 +20,8 @@
 #ifndef SVGRect_h
 #define SVGRect_h
 
-#include "core/platform/graphics/FloatRect.h"
 #include "core/svg/properties/SVGPropertyTraits.h"
+#include "platform/geometry/FloatRect.h"
 #include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGRectElement.h b/Source/core/svg/SVGRectElement.h
index 2c631b8..750d4ea 100644
--- a/Source/core/svg/SVGRectElement.h
+++ b/Source/core/svg/SVGRectElement.h
@@ -59,11 +59,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGRectElement* toSVGRectElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::rectTag));
-    return static_cast<SVGRectElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGRectElement, hasTagName(SVGNames::rectTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGSVGElement.cpp b/Source/core/svg/SVGSVGElement.cpp
index 93cdcd7..2120ff8 100644
--- a/Source/core/svg/SVGSVGElement.cpp
+++ b/Source/core/svg/SVGSVGElement.cpp
@@ -29,18 +29,15 @@
 #include "core/css/CSSHelper.h"
 #include "core/dom/Document.h"
 #include "core/dom/ElementTraversal.h"
-#include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
 #include "core/dom/NodeTraversal.h"
 #include "core/dom/StaticNodeList.h"
 #include "core/editing/FrameSelection.h"
-#include "core/page/Frame.h"
+#include "core/events/EventListener.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/Frame.h"
 #include "core/page/FrameTree.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/UseCounter.h"
-#include "core/platform/FloatConversion.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderPart.h"
 #include "core/rendering/svg/RenderSVGModelObject.h"
@@ -56,6 +53,9 @@
 #include "core/svg/SVGViewElement.h"
 #include "core/svg/SVGViewSpec.h"
 #include "core/svg/animation/SMILTimeContainer.h"
+#include "platform/FloatConversion.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/StdLibExtras.h"
 
 namespace WebCore {
@@ -94,7 +94,7 @@
     ScriptWrappable::init(this);
     registerAnimatedPropertiesForSVGSVGElement();
 
-    UseCounter::count(&doc, UseCounter::SVGSVGElement);
+    UseCounter::count(doc, UseCounter::SVGSVGElement);
 }
 
 PassRefPtr<SVGSVGElement> SVGSVGElement::create(const QualifiedName& tagName, Document& document)
@@ -221,7 +221,7 @@
     if (RenderObject* object = renderer())
         object->setNeedsLayout();
 
-    if (parentNode() == &document() && document().renderer())
+    if (parentNode() == document() && document().renderer())
         document().renderer()->repaint();
 }
 
@@ -234,13 +234,13 @@
 
         // Only handle events if we're the outermost <svg> element
         if (name == HTMLNames::onunloadAttr)
-            document().setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document().frame(), name, value));
+            document().setWindowAttributeEventListener(EventTypeNames::unload, createAttributeEventListener(document().frame(), name, value));
         else if (name == HTMLNames::onresizeAttr)
-            document().setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document().frame(), name, value));
+            document().setWindowAttributeEventListener(EventTypeNames::resize, createAttributeEventListener(document().frame(), name, value));
         else if (name == HTMLNames::onscrollAttr)
-            document().setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document().frame(), name, value));
+            document().setWindowAttributeEventListener(EventTypeNames::scroll, createAttributeEventListener(document().frame(), name, value));
         else if (name == SVGNames::onzoomAttr)
-            document().setWindowAttributeEventListener(eventNames().zoomEvent, createAttributeEventListener(document().frame(), name, value));
+            document().setWindowAttributeEventListener(EventTypeNames::zoom, createAttributeEventListener(document().frame(), name, value));
         else
             setListener = false;
 
@@ -249,9 +249,9 @@
     }
 
     if (name == HTMLNames::onabortAttr)
-        document().setWindowAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::abort, createAttributeEventListener(document().frame(), name, value));
     else if (name == HTMLNames::onerrorAttr)
-        document().setWindowAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(document().frame(), name, value));
+        document().setWindowAttributeEventListener(EventTypeNames::error, createAttributeEventListener(document().frame(), name, value));
     else if (name == SVGNames::xAttr)
         setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
@@ -280,6 +280,7 @@
         || attrName == SVGNames::yAttr) {
         updateRelativeLengthsOrViewBox = true;
         updateRelativeLengthsInformation();
+        invalidateRelativeLengthClients();
 
         // At the SVG/HTML boundary (aka RenderSVGRoot), the width attribute can
         // affect the replaced size so we need to mark it for updating.
diff --git a/Source/core/svg/SVGScriptElement.cpp b/Source/core/svg/SVGScriptElement.cpp
index fc9f3cb..832dfba 100644
--- a/Source/core/svg/SVGScriptElement.cpp
+++ b/Source/core/svg/SVGScriptElement.cpp
@@ -27,8 +27,8 @@
 #include "bindings/v8/ScriptEventListener.h"
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ScriptLoader.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/svg/SVGElementInstance.h"
 #include "core/svg/properties/SVGAnimatedStaticPropertyTearOff.h"
 
@@ -83,7 +83,7 @@
     }
 
     if (name == HTMLNames::onerrorAttr) {
-        setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, name, value));
+        setAttributeEventListener(EventTypeNames::error, createAttributeEventListener(this, name, value));
         return;
     }
 
diff --git a/Source/core/svg/SVGScriptElement.h b/Source/core/svg/SVGScriptElement.h
index 10c5d45..544838b 100644
--- a/Source/core/svg/SVGScriptElement.h
+++ b/Source/core/svg/SVGScriptElement.h
@@ -94,11 +94,7 @@
     OwnPtr<ScriptLoader> m_loader;
 };
 
-inline SVGScriptElement* toSVGScriptElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::scriptTag));
-    return static_cast<SVGScriptElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGScriptElement, hasTagName(SVGNames::scriptTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGStyleElement.h b/Source/core/svg/SVGStyleElement.h
index 35cf7be..4106d28 100644
--- a/Source/core/svg/SVGStyleElement.h
+++ b/Source/core/svg/SVGStyleElement.h
@@ -68,11 +68,7 @@
     Timer<SVGElement> m_svgLoadEventTimer;
 };
 
-inline SVGStyleElement* toSVGStyleElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::styleTag));
-    return static_cast<SVGStyleElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGStyleElement, hasTagName(SVGNames::styleTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGSwitchElement.cpp b/Source/core/svg/SVGSwitchElement.cpp
index 0791666..c0db5bc 100644
--- a/Source/core/svg/SVGSwitchElement.cpp
+++ b/Source/core/svg/SVGSwitchElement.cpp
@@ -43,7 +43,7 @@
     ScriptWrappable::init(this);
     registerAnimatedPropertiesForSVGSwitchElement();
 
-    UseCounter::count(&document, UseCounter::SVGSwitchElement);
+    UseCounter::count(document, UseCounter::SVGSwitchElement);
 }
 
 PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(const QualifiedName& tagName, Document& document)
diff --git a/Source/core/svg/SVGTests.cpp b/Source/core/svg/SVGTests.cpp
index 2c30955..e7d49ad 100644
--- a/Source/core/svg/SVGTests.cpp
+++ b/Source/core/svg/SVGTests.cpp
@@ -24,7 +24,7 @@
 
 #include "SVGNames.h"
 #include "core/dom/DOMImplementation.h"
-#include "core/platform/Language.h"
+#include "platform/Language.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGStringList.h"
 
@@ -155,9 +155,9 @@
         return true;
 
     bool valid = targetElement->isValid();
-    if (valid && !targetElement->attached() && targetElement->parentNode()->attached())
+    if (valid && !targetElement->confusingAndOftenMisusedAttached() && targetElement->parentNode()->confusingAndOftenMisusedAttached())
         targetElement->lazyAttach();
-    else if (!valid && targetElement->attached())
+    else if (!valid && targetElement->confusingAndOftenMisusedAttached())
         targetElement->detach();
 
     return true;
diff --git a/Source/core/svg/SVGTextContentElement.cpp b/Source/core/svg/SVGTextContentElement.cpp
index 35deceb..6c87c15 100644
--- a/Source/core/svg/SVGTextContentElement.cpp
+++ b/Source/core/svg/SVGTextContentElement.cpp
@@ -28,7 +28,7 @@
 #include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
 #include "core/editing/FrameSelection.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/svg/RenderSVGResource.h"
 #include "core/rendering/svg/SVGTextQuery.h"
diff --git a/Source/core/svg/SVGTextElement.h b/Source/core/svg/SVGTextElement.h
index 55b63e6..7e05359 100644
--- a/Source/core/svg/SVGTextElement.h
+++ b/Source/core/svg/SVGTextElement.h
@@ -41,11 +41,7 @@
     virtual bool childShouldCreateRenderer(const Node& child) const;
 };
 
-inline SVGTextElement* toSVGTextElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::textTag));
-    return static_cast<SVGTextElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGTextElement, hasTagName(SVGNames::textTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGTextPathElement.h b/Source/core/svg/SVGTextPathElement.h
index 1ea5d11..d540780 100644
--- a/Source/core/svg/SVGTextPathElement.h
+++ b/Source/core/svg/SVGTextPathElement.h
@@ -140,11 +140,7 @@
     END_DECLARE_ANIMATED_PROPERTIES
 };
 
-inline SVGTextPathElement* toSVGTextPathElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::textPathTag));
-    return static_cast<SVGTextPathElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGTextPathElement, hasTagName(SVGNames::textPathTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGTitleElement.cpp b/Source/core/svg/SVGTitleElement.cpp
index 7e6a1ce..acb2fd1 100644
--- a/Source/core/svg/SVGTitleElement.cpp
+++ b/Source/core/svg/SVGTitleElement.cpp
@@ -43,6 +43,7 @@
     SVGElement::insertedInto(rootParent);
     if (!rootParent->inDocument())
         return InsertionDone;
+    // FIXME: It's possible to register SVGTitleElement to an HTMLDocument.
     if (firstChild())
         document().setTitleElement(textContent(), this);
     return InsertionDone;
diff --git a/Source/core/svg/SVGTransform.cpp b/Source/core/svg/SVGTransform.cpp
index 2c44d36..8983a81 100644
--- a/Source/core/svg/SVGTransform.cpp
+++ b/Source/core/svg/SVGTransform.cpp
@@ -21,9 +21,9 @@
 #include "config.h"
 #include "core/svg/SVGTransform.h"
 
-#include "core/platform/FloatConversion.h"
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatSize.h"
+#include "platform/FloatConversion.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatSize.h"
 #include "wtf/MathExtras.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/WTFString.h"
diff --git a/Source/core/svg/SVGTransform.h b/Source/core/svg/SVGTransform.h
index 3053d4f..71f7668 100644
--- a/Source/core/svg/SVGTransform.h
+++ b/Source/core/svg/SVGTransform.h
@@ -21,8 +21,8 @@
 #ifndef SVGTransform_h
 #define SVGTransform_h
 
-#include "core/platform/graphics/FloatPoint.h"
 #include "core/svg/SVGMatrix.h"
+#include "platform/geometry/FloatPoint.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGTransformDistance.cpp b/Source/core/svg/SVGTransformDistance.cpp
index 47a5443..8867465 100644
--- a/Source/core/svg/SVGTransformDistance.cpp
+++ b/Source/core/svg/SVGTransformDistance.cpp
@@ -21,10 +21,9 @@
 
 #include "core/svg/SVGTransformDistance.h"
 
-#include "core/platform/graphics/FloatPoint.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/svg/SVGTransform.h"
-
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatSize.h"
 #include <math.h>
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGTransformList.cpp b/Source/core/svg/SVGTransformList.cpp
index 3d3e58f..76b94a8 100644
--- a/Source/core/svg/SVGTransformList.cpp
+++ b/Source/core/svg/SVGTransformList.cpp
@@ -21,10 +21,10 @@
 #include "config.h"
 #include "core/svg/SVGTransformList.h"
 
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/svg/SVGSVGElement.h"
 #include "core/svg/SVGTransform.h"
 #include "core/svg/SVGTransformable.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/text/StringBuilder.h"
 
 namespace WebCore {
diff --git a/Source/core/svg/SVGTransformable.cpp b/Source/core/svg/SVGTransformable.cpp
index 9c35dc3..a7d1ea5 100644
--- a/Source/core/svg/SVGTransformable.cpp
+++ b/Source/core/svg/SVGTransformable.cpp
@@ -23,9 +23,9 @@
 
 #include "core/svg/SVGTransformable.h"
 
-#include "core/platform/graphics/transforms/AffineTransform.h"
 #include "core/svg/SVGParserUtilities.h"
 #include "core/svg/SVGTransformList.h"
+#include "platform/transforms/AffineTransform.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp
index 6449f66..fc7fc11 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -657,7 +657,7 @@
     while (instance) {
         SVGElement* element = instance->correspondingElement();
 
-        if (element->hasID() && element->getIdAttribute() == targetId && &element->document() == &newTarget->document())
+        if (element->hasID() && element->getIdAttribute() == targetId && element->document() == newTarget->document())
             return true;
 
         instance = instance->parentNode();
@@ -891,7 +891,7 @@
 
 void SVGUseElement::invalidateShadowTree()
 {
-    if (!attached() || m_needsShadowTreeRecreation)
+    if (!confusingAndOftenMisusedAttached() || m_needsShadowTreeRecreation)
         return;
     m_needsShadowTreeRecreation = true;
     setNeedsStyleRecalc();
@@ -940,7 +940,7 @@
     if (!element)
         return false;
 
-    return toSVGElement(element)->hasRelativeLengths();
+    return element->hasRelativeLengths();
 }
 
 void SVGUseElement::notifyFinished(Resource* resource)
@@ -950,7 +950,7 @@
 
     invalidateShadowTree();
     if (resource->errorOccurred())
-        dispatchEvent(Event::create(eventNames().errorEvent));
+        dispatchEvent(Event::create(EventTypeNames::error));
     else if (!resource->wasCanceled())
         SVGExternalResourcesRequired::dispatchLoadEvent(this);
 }
diff --git a/Source/core/svg/SVGUseElement.h b/Source/core/svg/SVGUseElement.h
index 459cb2b..3cc6b6b 100644
--- a/Source/core/svg/SVGUseElement.h
+++ b/Source/core/svg/SVGUseElement.h
@@ -126,11 +126,7 @@
     Timer<SVGElement> m_svgLoadEventTimer;
 };
 
-inline SVGUseElement* toSVGUseElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::useTag));
-    return static_cast<SVGUseElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGUseElement, hasTagName(SVGNames::useTag));
 
 }
 
diff --git a/Source/core/svg/SVGVKernElement.h b/Source/core/svg/SVGVKernElement.h
index 185b0de..6dfc55d 100644
--- a/Source/core/svg/SVGVKernElement.h
+++ b/Source/core/svg/SVGVKernElement.h
@@ -42,11 +42,7 @@
     virtual bool rendererIsNeeded(const RenderStyle&) { return false; }
 };
 
-inline SVGVKernElement* toSVGVKernElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::vkernTag));
-    return static_cast<SVGVKernElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGVKernElement, hasTagName(SVGNames::vkernTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGViewElement.h b/Source/core/svg/SVGViewElement.h
index 881bfaf..dc40c62 100644
--- a/Source/core/svg/SVGViewElement.h
+++ b/Source/core/svg/SVGViewElement.h
@@ -66,11 +66,7 @@
     SVGStringList m_viewTarget;
 };
 
-inline SVGViewElement* toSVGViewElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::viewTag));
-    return static_cast<SVGViewElement*>(node);
-}
+DEFINE_NODE_TYPE_CASTS(SVGViewElement, hasTagName(SVGNames::viewTag));
 
 } // namespace WebCore
 
diff --git a/Source/core/svg/SVGZoomEvent.cpp b/Source/core/svg/SVGZoomEvent.cpp
index 055b86c..fe5d283 100644
--- a/Source/core/svg/SVGZoomEvent.cpp
+++ b/Source/core/svg/SVGZoomEvent.cpp
@@ -20,11 +20,10 @@
  */
 
 #include "config.h"
-
-
-#include "core/events/EventNames.h"
 #include "core/svg/SVGZoomEvent.h"
 
+#include "core/events/ThreadLocalEventNames.h"
+
 namespace WebCore {
 
 SVGZoomEvent::SVGZoomEvent()
@@ -71,7 +70,7 @@
 
 const AtomicString& SVGZoomEvent::interfaceName() const
 {
-    return eventNames().interfaceForSVGZoomEvent;
+    return EventNames::SVGZoomEvent;
 }
 
 } // namespace WebCore
diff --git a/Source/core/svg/animation/SMILTimeContainer.h b/Source/core/svg/animation/SMILTimeContainer.h
index af3fb01..86b24ab 100644
--- a/Source/core/svg/animation/SMILTimeContainer.h
+++ b/Source/core/svg/animation/SMILTimeContainer.h
@@ -27,8 +27,8 @@
 #define SMILTimeContainer_h
 
 #include "core/dom/QualifiedName.h"
-#include "core/platform/Timer.h"
 #include "core/svg/animation/SMILTime.h"
+#include "platform/Timer.h"
 #include "wtf/HashMap.h"
 #include "wtf/HashSet.h"
 #include "wtf/PassRefPtr.h"
diff --git a/Source/core/svg/animation/SVGSMILElement.cpp b/Source/core/svg/animation/SVGSMILElement.cpp
index f5a6b57..6e09485 100644
--- a/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/Source/core/svg/animation/SVGSMILElement.cpp
@@ -32,11 +32,11 @@
 #include "core/dom/Document.h"
 #include "core/events/EventListener.h"
 #include "core/events/EventSender.h"
-#include "core/platform/FloatConversion.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "core/svg/SVGSVGElement.h"
 #include "core/svg/SVGURIReference.h"
 #include "core/svg/animation/SMILTimeContainer.h"
+#include "platform/FloatConversion.h"
 #include "wtf/MathExtras.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/Vector.h"
@@ -127,7 +127,7 @@
     {
     }
 
-    virtual void handleEvent(ScriptExecutionContext*, Event*);
+    virtual void handleEvent(ExecutionContext*, Event*);
 
     SVGSMILElement* m_animation;
     SVGSMILElement::Condition* m_condition;
@@ -140,7 +140,7 @@
     return false;
 }
 
-void ConditionEventListener::handleEvent(ScriptExecutionContext*, Event* event)
+void ConditionEventListener::handleEvent(ExecutionContext*, Event* event)
 {
     if (!m_animation)
         return;
@@ -551,8 +551,6 @@
     else if (attrName.matches(XLinkNames::hrefAttr)) {
         SVGElementInstance::InvalidationGuard invalidationGuard(this);
         buildPendingResource();
-        if (m_targetElement)
-            clearAnimatedType(m_targetElement);
     } else if (inDocument()) {
         if (attrName == SVGNames::beginAttr)
             beginListChanged(elapsed());
diff --git a/Source/core/svg/graphics/SVGImage.cpp b/Source/core/svg/graphics/SVGImage.cpp
index e44c11b..16665f7 100644
--- a/Source/core/svg/graphics/SVGImage.cpp
+++ b/Source/core/svg/graphics/SVGImage.cpp
@@ -33,13 +33,12 @@
 #include "core/dom/shadow/ComposedTreeWalker.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/page/Chrome.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Settings.h"
 #include "core/platform/graphics/GraphicsContextStateSaver.h"
 #include "core/platform/graphics/ImageBuffer.h"
 #include "core/platform/graphics/ImageObserver.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/rendering/style/RenderStyle.h"
 #include "core/rendering/svg/RenderSVGRoot.h"
 #include "core/svg/SVGDocument.h"
@@ -47,6 +46,7 @@
 #include "core/svg/SVGImageElement.h"
 #include "core/svg/SVGSVGElement.h"
 #include "core/svg/graphics/SVGImageChromeClient.h"
+#include "platform/geometry/IntRect.h"
 #include "wtf/PassRefPtr.h"
 
 namespace WebCore {
@@ -202,7 +202,7 @@
 }
 
 void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize containerSize, float zoom, const FloatRect& srcRect,
-    const FloatSize& scale, const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
+    const FloatSize& scale, const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode, const IntSize& repeatSpacing)
 {
     FloatRect zoomedContainerRect = FloatRect(FloatPoint(), containerSize);
     zoomedContainerRect.scale(zoom);
@@ -229,7 +229,7 @@
     FloatRect scaledSrcRect = srcRect;
     scaledSrcRect.scale(imageBufferScale.width(), imageBufferScale.height());
 
-    image->drawPattern(context, scaledSrcRect, scaleWithoutCTM, phase, compositeOp, dstRect, blendMode);
+    image->drawPattern(context, scaledSrcRect, scaleWithoutCTM, phase, compositeOp, dstRect, blendMode, repeatSpacing);
 }
 
 void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode)
@@ -361,6 +361,8 @@
 
 bool SVGImage::dataChanged(bool allDataReceived)
 {
+    TRACE_EVENT0("webkit", "SVGImage::dataChanged");
+
     // Don't do anything if is an empty image.
     if (!data()->size())
         return true;
diff --git a/Source/core/svg/graphics/SVGImage.h b/Source/core/svg/graphics/SVGImage.h
index b75dd70..6ee9608 100644
--- a/Source/core/svg/graphics/SVGImage.h
+++ b/Source/core/svg/graphics/SVGImage.h
@@ -86,7 +86,6 @@
     // FIXME: SVGImages are underreporting decoded sizes and will be unable
     // to prune because these functions are not implemented yet.
     virtual void destroyDecodedData(bool) OVERRIDE { }
-    virtual unsigned decodedSize() const OVERRIDE { return 0; }
 
     // FIXME: Implement this to be less conservative.
     virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; }
@@ -95,7 +94,7 @@
     virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator, BlendMode) OVERRIDE;
     void drawForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode);
     void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatSize&, const FloatPoint&,
-        CompositeOperator, const FloatRect&, BlendMode);
+        CompositeOperator, const FloatRect&, BlendMode, const IntSize& repeatSpacing);
 
     OwnPtr<SVGImageChromeClient> m_chromeClient;
     OwnPtr<Page> m_page;
diff --git a/Source/core/svg/graphics/SVGImageCache.cpp b/Source/core/svg/graphics/SVGImageCache.cpp
index 81153b3..0e85ee9 100644
--- a/Source/core/svg/graphics/SVGImageCache.cpp
+++ b/Source/core/svg/graphics/SVGImageCache.cpp
@@ -22,7 +22,7 @@
 #include "core/svg/graphics/SVGImageCache.h"
 
 #include "core/fetch/ImageResource.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/ImageBuffer.h"
@@ -46,9 +46,7 @@
 void SVGImageCache::removeClientFromCache(const ImageResourceClient* client)
 {
     ASSERT(client);
-
-    if (m_imageForContainerMap.contains(client))
-        m_imageForContainerMap.remove(client);
+    m_imageForContainerMap.remove(client);
 }
 
 void SVGImageCache::setContainerSizeForRenderer(const ImageResourceClient* client, const IntSize& containerSize, float containerZoom)
diff --git a/Source/core/svg/graphics/SVGImageCache.h b/Source/core/svg/graphics/SVGImageCache.h
index b2aef4c..677444e 100644
--- a/Source/core/svg/graphics/SVGImageCache.h
+++ b/Source/core/svg/graphics/SVGImageCache.h
@@ -20,9 +20,9 @@
 #ifndef SVGImageCache_h
 #define SVGImageCache_h
 
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/Image.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/HashMap.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/svg/graphics/SVGImageForContainer.cpp b/Source/core/svg/graphics/SVGImageForContainer.cpp
index 27f9a94..72c5032 100644
--- a/Source/core/svg/graphics/SVGImageForContainer.cpp
+++ b/Source/core/svg/graphics/SVGImageForContainer.cpp
@@ -20,10 +20,10 @@
 #include "config.h"
 #include "core/svg/graphics/SVGImageForContainer.h"
 
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/Image.h"
 #include "core/svg/graphics/SVGImage.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/FloatSize.h"
 #include "wtf/PassRefPtr.h"
 
 namespace WebCore {
@@ -42,9 +42,9 @@
 }
 
 void SVGImageForContainer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const FloatSize& scale,
-    const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
+    const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode, const IntSize& repeatSpacing)
 {
-    m_image->drawPatternForContainer(context, m_containerSize, m_zoom, srcRect, scale, phase, compositeOp, dstRect, blendMode);
+    m_image->drawPatternForContainer(context, m_containerSize, m_zoom, srcRect, scale, phase, compositeOp, dstRect, blendMode, repeatSpacing);
 }
 
 PassRefPtr<NativeImageSkia> SVGImageForContainer::nativeImageForCurrentFrame()
diff --git a/Source/core/svg/graphics/SVGImageForContainer.h b/Source/core/svg/graphics/SVGImageForContainer.h
index a90f652..98492bb 100644
--- a/Source/core/svg/graphics/SVGImageForContainer.h
+++ b/Source/core/svg/graphics/SVGImageForContainer.h
@@ -26,10 +26,10 @@
 #ifndef SVGImageForContainer_h
 #define SVGImageForContainer_h
 
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/Image.h"
 #include "core/svg/graphics/SVGImage.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/FloatSize.h"
 
 namespace WebCore {
 
@@ -54,7 +54,7 @@
 
     virtual void draw(GraphicsContext*, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode) OVERRIDE;
 
-    virtual void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const FloatPoint&, CompositeOperator, const FloatRect&, BlendMode) OVERRIDE;
+    virtual void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const FloatPoint&, CompositeOperator, const FloatRect&, BlendMode, const IntSize& repeatSpacing) OVERRIDE;
 
     // FIXME: Implement this to be less conservative.
     virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; }
@@ -70,7 +70,6 @@
     }
 
     virtual void destroyDecodedData(bool) OVERRIDE { }
-    virtual unsigned decodedSize() const OVERRIDE { return 0; }
 
     SVGImage* m_image;
     const FloatSize m_containerSize;
diff --git a/Source/core/svg/graphics/filters/SVGFEImage.cpp b/Source/core/svg/graphics/filters/SVGFEImage.cpp
index f61a702..7f592c2 100644
--- a/Source/core/svg/graphics/filters/SVGFEImage.cpp
+++ b/Source/core/svg/graphics/filters/SVGFEImage.cpp
@@ -28,14 +28,14 @@
 #include "SkBitmapSource.h"
 #include "core/platform/graphics/GraphicsContext.h"
 #include "core/platform/graphics/filters/Filter.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
-#include "core/platform/text/TextStream.h"
 #include "core/rendering/RenderObject.h"
 #include "core/rendering/RenderTreeAsText.h"
 #include "core/rendering/svg/SVGRenderingContext.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGPreserveAspectRatio.h"
 #include "core/svg/SVGURIReference.h"
+#include "platform/text/TextStream.h"
+#include "platform/transforms/AffineTransform.h"
 
 namespace WebCore {
 
diff --git a/Source/core/svg/graphics/filters/SVGFilter.h b/Source/core/svg/graphics/filters/SVGFilter.h
index d140541..6ddccef 100644
--- a/Source/core/svg/graphics/filters/SVGFilter.h
+++ b/Source/core/svg/graphics/filters/SVGFilter.h
@@ -21,11 +21,11 @@
 #ifndef SVGFilter_h
 #define SVGFilter_h
 
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/FloatSize.h"
 #include "core/platform/graphics/filters/Filter.h"
 #include "core/platform/graphics/filters/FilterEffect.h"
-#include "core/platform/graphics/transforms/AffineTransform.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/transforms/AffineTransform.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
diff --git a/Source/core/svg/properties/SVGAnimatedListPropertyTearOff.h b/Source/core/svg/properties/SVGAnimatedListPropertyTearOff.h
index f63a625..fdbd217 100644
--- a/Source/core/svg/properties/SVGAnimatedListPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGAnimatedListPropertyTearOff.h
@@ -109,18 +109,16 @@
     {
         ASSERT(m_isAnimating);
         ASSERT(m_animVal);
-        ASSERT(contextElement());
+        ASSERT(m_values.size() == m_wrappers.size());
 
         ListProperty* animVal = static_cast<ListProperty*>(m_animVal.get());
-        if (animVal->wrappers().size()) {
-            ASSERT(m_values.size() == m_wrappers.size());
-            ASSERT(animVal->values().size() == animVal->wrappers().size());
-            ASSERT(animVal->wrappers().size() == m_animatedWrappers.size());
+        ASSERT(animVal->values().size() == animVal->wrappers().size());
+        ASSERT(animVal->wrappers().size() == m_animatedWrappers.size());
 
-            animVal->setValuesAndWrappers(&m_values, &m_wrappers, false);
-            ASSERT(animVal->values().size() == animVal->wrappers().size());
-            ASSERT(animVal->wrappers().size() == m_wrappers.size());
-        }
+        animVal->setValuesAndWrappers(&m_values, &m_wrappers, false);
+        ASSERT(animVal->values().size() == animVal->wrappers().size());
+        ASSERT(animVal->wrappers().size() == m_wrappers.size());
+
         m_animatedWrappers.clear();
         m_isAnimating = false;
     }
@@ -155,14 +153,6 @@
         synchronizeWrappersIfNeeded();
     }
 
-    virtual void detachWrappers() OVERRIDE
-    {
-        if (m_animVal) {
-            ListProperty* animVal = static_cast<ListProperty*>(m_animVal.get());
-            animVal->detachListWrappers(0);
-        }
-    }
-
     static PassRefPtr<SVGAnimatedListPropertyTearOff<PropertyType> > create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& values)
     {
         ASSERT(contextElement);
@@ -178,14 +168,6 @@
             m_wrappers.fill(0, values.size());
     }
 
-    ~SVGAnimatedListPropertyTearOff()
-    {
-        if (m_baseVal)
-            static_cast<ListPropertyTearOff*>(m_baseVal.get())->clearAnimatedProperty();
-        if (m_animVal)
-            static_cast<ListPropertyTearOff*>(m_animVal.get())->clearAnimatedProperty();
-    }
-
     PropertyType& m_values;
 
     ListWrapperCache m_wrappers;
diff --git a/Source/core/svg/properties/SVGAnimatedProperty.cpp b/Source/core/svg/properties/SVGAnimatedProperty.cpp
index 0922ac9..cfaf2a4 100644
--- a/Source/core/svg/properties/SVGAnimatedProperty.cpp
+++ b/Source/core/svg/properties/SVGAnimatedProperty.cpp
@@ -36,43 +36,24 @@
 
 SVGAnimatedProperty::~SVGAnimatedProperty()
 {
-    // Assure that animationEnded() was called, if animationStarted() was called before.
-    ASSERT(!m_isAnimating);
-}
-
-void SVGAnimatedProperty::detachAnimatedPropertiesWrappersForElement(SVGElement* element)
-{
+    // Remove wrapper from cache.
     Cache* cache = animatedPropertyCache();
     const Cache::const_iterator end = cache->end();
     for (Cache::const_iterator it = cache->begin(); it != end; ++it) {
-        if (it->key.m_element == element)
-            it->value->detachWrappers();
-    }
-}
-
-void SVGAnimatedProperty::detachAnimatedPropertiesForElement(SVGElement* element)
-{
-    // Remove wrappers from cache.
-    Cache* cache = animatedPropertyCache();
-
-    Vector<SVGAnimatedPropertyDescription> keysToRemove;
-
-    const Cache::const_iterator end = cache->end();
-    for (Cache::const_iterator it = cache->begin(); it != end; ++it) {
-        if (it->key.m_element == element) {
-            it->value->resetContextElement();
-            keysToRemove.append(it->key);
+        if (it->value == this) {
+            cache->remove(it->key);
+            break;
         }
     }
 
-    for (Vector<SVGAnimatedPropertyDescription>::const_iterator it = keysToRemove.begin(); it != keysToRemove.end(); ++it)
-        cache->remove(*it);
+    // Assure that animationEnded() was called, if animationStarted() was called before.
+    ASSERT(!m_isAnimating);
 }
 
 void SVGAnimatedProperty::commitChange()
 {
     ASSERT(m_contextElement);
-    ASSERT(!m_contextElement->m_deletionHasBegun);
+    ASSERT_WITH_SECURITY_IMPLICATION(!m_contextElement->m_deletionHasBegun);
     m_contextElement->invalidateSVGAttributes();
     m_contextElement->svgAttributeChanged(m_attributeName);
 }
diff --git a/Source/core/svg/properties/SVGAnimatedProperty.h b/Source/core/svg/properties/SVGAnimatedProperty.h
index acf0e74..37eba88 100644
--- a/Source/core/svg/properties/SVGAnimatedProperty.h
+++ b/Source/core/svg/properties/SVGAnimatedProperty.h
@@ -31,8 +31,7 @@
 
 class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty> {
 public:
-    SVGElement* contextElement() const { return m_contextElement; }
-    void resetContextElement() { m_contextElement = 0; }
+    SVGElement* contextElement() const { return m_contextElement.get(); }
     const QualifiedName& attributeName() const { return m_attributeName; }
     AnimatedPropertyType animatedPropertyType() const { return m_animatedPropertyType; }
     bool isAnimating() const { return m_isAnimating; }
@@ -42,10 +41,9 @@
     void commitChange();
 
     virtual bool isAnimatedListTearOff() const { return false; }
-    virtual void detachWrappers() { }
 
     // Caching facilities.
-    typedef HashMap<SVGAnimatedPropertyDescription, RefPtr<SVGAnimatedProperty>, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> Cache;
+    typedef HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> Cache;
 
     virtual ~SVGAnimatedProperty();
 
@@ -59,7 +57,7 @@
             wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property);
             if (info->animatedPropertyState == PropertyIsReadOnly)
                 wrapper->setIsReadOnly();
-            animatedPropertyCache()->set(key, wrapper);
+            animatedPropertyCache()->set(key, wrapper.get());
         }
         return static_pointer_cast<TearOffType>(wrapper);
     }
@@ -78,16 +76,13 @@
         return lookupWrapper<OwnerType, TearOffType>(const_cast<OwnerType*>(element), info);
     }
 
-    static void detachAnimatedPropertiesWrappersForElement(SVGElement*);
-    static void detachAnimatedPropertiesForElement(SVGElement*);
-
 protected:
     SVGAnimatedProperty(SVGElement*, const QualifiedName&, AnimatedPropertyType);
 
 private:
     static Cache* animatedPropertyCache();
 
-    SVGElement* m_contextElement;
+    RefPtr<SVGElement> m_contextElement;
     const QualifiedName& m_attributeName;
     AnimatedPropertyType m_animatedPropertyType;
 
diff --git a/Source/core/svg/properties/SVGListPropertyTearOff.h b/Source/core/svg/properties/SVGListPropertyTearOff.h
index 640d724..c6246d7 100644
--- a/Source/core/svg/properties/SVGListPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGListPropertyTearOff.h
@@ -92,8 +92,7 @@
 
     PassListItemTearOff getItem(unsigned index, ExceptionState& es)
     {
-        ASSERT(m_animatedProperty);
-        return Base::getItemValuesAndWrappers(m_animatedProperty, index, es);
+        return Base::getItemValuesAndWrappers(m_animatedProperty.get(), index, es);
     }
 
     PassListItemTearOff insertItemBefore(PassListItemTearOff passNewItem, unsigned index, ExceptionState& es)
@@ -108,8 +107,7 @@
 
     PassListItemTearOff removeItem(unsigned index, ExceptionState& es)
     {
-        ASSERT(m_animatedProperty);
-        return Base::removeItemValuesAndWrappers(m_animatedProperty, index, es);
+        return Base::removeItemValuesAndWrappers(m_animatedProperty.get(), index, es);
     }
 
     PassListItemTearOff appendItem(PassListItemTearOff passNewItem, ExceptionState& es)
@@ -117,27 +115,11 @@
         return Base::appendItemValuesAndWrappers(passNewItem, es);
     }
 
-    SVGElement* contextElement() const
-    {
-        ASSERT(m_animatedProperty);
-        return m_animatedProperty->contextElement();
-    }
-
-    void clearAnimatedProperty()
-    {
-        ASSERT(m_animatedProperty);
-        Base::detachListWrappers(0);
-        m_animatedProperty = 0;
-        m_values = 0;
-        m_wrappers = 0;
-    }
-
 protected:
     SVGListPropertyTearOff(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role, PropertyType& values, ListWrapperCache& wrappers)
         : SVGListProperty<PropertyType>(role, values, &wrappers)
         , m_animatedProperty(animatedProperty)
     {
-        ASSERT(m_animatedProperty);
     }
 
     virtual bool isReadOnly() const
@@ -153,7 +135,6 @@
     {
         ASSERT(m_values);
         ASSERT(m_wrappers);
-        ASSERT(m_animatedProperty);
 
         // Update existing wrappers, as the index in the values list has changed.
         unsigned size = m_wrappers->size();
@@ -162,7 +143,7 @@
             ListItemTearOff* item = m_wrappers->at(i).get();
             if (!item)
                 continue;
-            item->setAnimatedProperty(m_animatedProperty);
+            item->setAnimatedProperty(m_animatedProperty.get());
             item->setValue(m_values->at(i));
         }
 
@@ -198,7 +179,6 @@
 
         // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
         // 'newItem' is already living in another list. If it's not our list, synchronize the other lists wrappers after the removal.
-        ASSERT(m_animatedProperty);
         bool livesInOtherList = animatedPropertyOfItem != m_animatedProperty;
         AnimatedListPropertyTearOff* propertyTearOff = static_cast<AnimatedListPropertyTearOff*>(animatedPropertyOfItem);
         int indexToRemove = propertyTearOff->findItem(newItem.get());
@@ -226,7 +206,7 @@
 
     // Back pointer to the animated property that created us
     // For example (text.x.baseVal): m_animatedProperty points to the 'x' SVGAnimatedLengthList object
-    AnimatedListPropertyTearOff* m_animatedProperty;
+    RefPtr<AnimatedListPropertyTearOff> m_animatedProperty;
 };
 
 }
diff --git a/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h b/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h
index 58791d7..56055ed 100644
--- a/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h
@@ -41,9 +41,6 @@
         return adoptRef(new SVGPathSegListPropertyTearOff(animatedProperty, role, pathSegRole, values, wrappers));
     }
 
-    SVGPathElement* contextElement() const;
-    SVGAnimatedProperty* animatedProperty() const { return m_animatedProperty.get(); }
-
     int findItem(const ListItemType& item) const
     {
         ASSERT(m_values);
@@ -122,6 +119,8 @@
     {
     }
 
+    SVGPathElement* contextElement() const;
+
     void clearContextAndRoles();
 
     using Base::m_role;
diff --git a/Source/core/svg/properties/SVGPropertyTearOff.h b/Source/core/svg/properties/SVGPropertyTearOff.h
index 8866bcc..a78bdea 100644
--- a/Source/core/svg/properties/SVGPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGPropertyTearOff.h
@@ -56,8 +56,10 @@
 
     void setValue(PropertyType& value)
     {
-        if (m_valueIsCopy)
+        if (m_valueIsCopy) {
+            detachChildren();
             delete m_value;
+        }
         m_valueIsCopy = false;
         m_value = &value;
     }
@@ -74,8 +76,7 @@
     {
         if (!m_animatedProperty || m_valueIsCopy)
             return 0;
-        ASSERT(m_contextElement);
-        return m_contextElement;
+        return m_contextElement.get();
     }
 
     void addChild(WeakPtr<SVGPropertyTearOffBase> child)
@@ -155,7 +156,7 @@
         m_childTearOffs.clear();
     }
 
-    SVGElement* m_contextElement;
+    RefPtr<SVGElement> m_contextElement;
     SVGAnimatedProperty* m_animatedProperty;
     SVGPropertyRole m_role;
     PropertyType* m_value;
diff --git a/Source/core/svg/properties/SVGStaticListPropertyTearOff.h b/Source/core/svg/properties/SVGStaticListPropertyTearOff.h
index 1488c59..367560f 100644
--- a/Source/core/svg/properties/SVGStaticListPropertyTearOff.h
+++ b/Source/core/svg/properties/SVGStaticListPropertyTearOff.h
@@ -43,8 +43,6 @@
         return adoptRef(new SVGStaticListPropertyTearOff<PropertyType>(contextElement, values));
     }
 
-    SVGElement* contextElement() const { return m_contextElement; }
-
     // SVGList API
     void clear(ExceptionState& es)
     {
@@ -96,8 +94,7 @@
     virtual void commitChange()
     {
         ASSERT(m_values);
-        ASSERT(m_contextElement);
-        m_values->commitChange(m_contextElement);
+        m_values->commitChange(m_contextElement.get());
     }
 
     virtual bool processIncomingListItemValue(const ListItemType&, unsigned*)
@@ -113,7 +110,7 @@
     }
 
 private:
-    SVGElement* m_contextElement;
+    RefPtr<SVGElement> m_contextElement;
 };
 
 }
diff --git a/Source/core/testing/InspectorFrontendClientLocal.cpp b/Source/core/testing/InspectorFrontendClientLocal.cpp
index 3d57d26..30c1f7e 100644
--- a/Source/core/testing/InspectorFrontendClientLocal.cpp
+++ b/Source/core/testing/InspectorFrontendClientLocal.cpp
@@ -36,7 +36,7 @@
 #include "core/inspector/InspectorFrontendHost.h"
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebThread.h"
 #include "wtf/Deque.h"
diff --git a/Source/core/testing/InternalSettings.cpp b/Source/core/testing/InternalSettings.cpp
index 4d62633..8f7c22d 100644
--- a/Source/core/testing/InternalSettings.cpp
+++ b/Source/core/testing/InternalSettings.cpp
@@ -33,8 +33,8 @@
 #include "core/page/Page.h"
 #include "core/page/Settings.h"
 #include "core/platform/ColorChooser.h"
-#include "core/platform/Supplementable.h"
-#include "core/platform/text/LocaleToScriptMapping.h"
+#include "platform/Supplementable.h"
+#include "platform/text/LocaleToScriptMapping.h"
 
 #define InternalSettingsGuardForSettingsReturn(returnValue) \
     if (!settings()) { \
@@ -98,6 +98,7 @@
     settings->setShouldDisplayTextDescriptions(m_shouldDisplayTextDescriptions);
     settings->setDefaultVideoPosterURL(m_defaultVideoPosterURL);
     settings->setCompositorDrivenAcceleratedScrollingEnabled(m_originalCompositorDrivenAcceleratedScrollEnabled);
+    settings->resetFontFamilies();
 }
 
 // We can't use RefCountedSupplement because that would try to make InternalSettings RefCounted
diff --git a/Source/core/testing/InternalSettings.h b/Source/core/testing/InternalSettings.h
index 7433e1e..5a1842a 100644
--- a/Source/core/testing/InternalSettings.h
+++ b/Source/core/testing/InternalSettings.h
@@ -29,7 +29,7 @@
 
 #include "InternalSettingsGenerated.h"
 #include "core/editing/EditingBehaviorTypes.h"
-#include "core/platform/graphics/IntSize.h"
+#include "platform/geometry/IntSize.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/text/WTFString.h"
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index ac656d8..b37e324 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "Internals.h"
 
+#include <v8.h>
 #include "HTMLNames.h"
 #include "InspectorFrontendClientLocal.h"
 #include "InternalProfilers.h"
@@ -57,9 +58,8 @@
 #include "core/dom/PseudoElement.h"
 #include "core/dom/Range.h"
 #include "core/dom/StaticNodeList.h"
-#include "core/dom/TouchController.h"
 #include "core/dom/TreeScope.h"
-#include "core/dom/ViewportArguments.h"
+#include "core/dom/ViewportDescription.h"
 #include "core/dom/WheelController.h"
 #include "core/dom/shadow/ComposedTreeWalker.h"
 #include "core/dom/shadow/ElementShadow.h"
@@ -67,9 +67,12 @@
 #include "core/dom/shadow/ShadowRoot.h"
 #include "core/editing/Editor.h"
 #include "core/editing/SpellCheckRequester.h"
+#include "core/editing/SpellChecker.h"
 #include "core/editing/TextIterator.h"
 #include "core/fetch/MemoryCache.h"
 #include "core/fetch/ResourceFetcher.h"
+#include "core/frame/DOMPoint.h"
+#include "core/frame/Frame.h"
 #include "core/history/BackForwardController.h"
 #include "core/history/HistoryItem.h"
 #include "core/html/HTMLInputElement.h"
@@ -89,29 +92,24 @@
 #include "core/loader/FrameLoader.h"
 #include "core/page/Chrome.h"
 #include "core/page/ChromeClient.h"
-#include "core/page/DOMPoint.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 #include "core/page/EventHandler.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/FrameView.h"
 #include "core/page/Page.h"
 #include "core/page/PagePopupController.h"
 #include "core/page/PrintContext.h"
 #include "core/page/Settings.h"
-#include "core/page/animation/AnimationController.h"
+#include "core/frame/animation/AnimationController.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
 #include "core/platform/ColorChooser.h"
 #include "core/platform/Cursor.h"
-#include "core/platform/Language.h"
-#include "core/platform/chromium/TraceEvent.h"
 #include "core/platform/graphics/GraphicsLayer.h"
-#include "core/platform/graphics/IntRect.h"
 #include "core/platform/graphics/filters/FilterOperation.h"
 #include "core/platform/graphics/filters/FilterOperations.h"
 #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h"
 #include "core/platform/mock/PlatformSpeechSynthesizerMock.h"
+#include "core/rendering/CompositedLayerMapping.h"
 #include "core/rendering/RenderLayer.h"
-#include "core/rendering/RenderLayerBacking.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderMenuList.h"
 #include "core/rendering/RenderObject.h"
@@ -121,11 +119,13 @@
 #include "core/workers/WorkerThread.h"
 #include "modules/speech/DOMWindowSpeechSynthesis.h"
 #include "modules/speech/SpeechSynthesis.h"
+#include "platform/Language.h"
+#include "platform/TraceEvent.h"
+#include "platform/geometry/IntRect.h"
 #include "public/platform/WebLayer.h"
 #include "weborigin/SchemeRegistry.h"
 #include "wtf/dtoa.h"
 #include "wtf/text/StringBuffer.h"
-#include <v8.h>
 
 namespace WebCore {
 
@@ -173,7 +173,7 @@
 {
     if (!document || !document->frame())
         return 0;
-    return &document->frame()->editor().spellCheckRequester();
+    return &document->frame()->spellChecker().spellCheckRequester();
 }
 
 const char* Internals::internalsId = "internals";
@@ -199,8 +199,8 @@
     delete s_pagePopupDriver;
     s_pagePopupDriver = 0;
     page->chrome().client().resetPagePopupDriver();
-    if (!page->mainFrame()->editor().isContinuousSpellCheckingEnabled())
-        page->mainFrame()->editor().toggleContinuousSpellChecking();
+    if (!page->mainFrame()->spellChecker().isContinuousSpellCheckingEnabled())
+        page->mainFrame()->spellChecker().toggleContinuousSpellChecking();
     if (page->mainFrame()->editor().isOverwriteModeEnabled())
         page->mainFrame()->editor().toggleOverwriteModeEnabled();
 }
@@ -214,7 +214,7 @@
 
 Document* Internals::contextDocument() const
 {
-    return toDocument(scriptExecutionContext());
+    return toDocument(executionContext());
 }
 
 Frame* Internals::frame() const
@@ -495,7 +495,7 @@
         return false;
     }
 
-    return node->attached();
+    return node->confusingAndOftenMisusedAttached();
 }
 
 Node* Internals::nextSiblingByWalker(Node* node, ExceptionState& es)
@@ -977,8 +977,8 @@
     IntSize initialViewportSize(availableWidth, availableHeight);
     document->page()->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero(), initialViewportSize));
 
-    ViewportArguments arguments = page->viewportArguments();
-    PageScaleConstraints constraints = arguments.resolve(initialViewportSize);
+    ViewportDescription description = page->viewportDescription();
+    PageScaleConstraints constraints = description.resolve(initialViewportSize);
 
     constraints.fitToContentsWidth(constraints.layoutSize.width(), availableWidth);
 
@@ -997,7 +997,7 @@
     builder.append(String::number(constraints.maximumScale));
 
     builder.appendLiteral("] and userScalable ");
-    builder.append(arguments.userZoom ? "true" : "false");
+    builder.append(description.userZoom ? "true" : "false");
 
     return builder.toString();
 }
@@ -1081,11 +1081,11 @@
 
 void Internals::setAutofilled(Element* element, bool enabled, ExceptionState& es)
 {
-    if (!element->hasTagName(inputTag)) {
+    if (!element->isFormControlElement()) {
         es.throwUninformativeAndGenericDOMException(InvalidAccessError);
         return;
     }
-    toHTMLInputElement(element)->setAutofilled(enabled);
+    toHTMLFormControlElement(element)->setAutofilled(enabled);
 }
 
 void Internals::scrollElementToRect(Element* element, long x, long y, long w, long h, ExceptionState& es)
@@ -1317,7 +1317,7 @@
         return 0;
     }
 
-    const TouchEventTargetSet* touchHandlers = TouchController::from(document)->touchEventTargets();
+    const TouchEventTargetSet* touchHandlers = document->touchEventTargets();
     if (!touchHandlers)
         return 0;
 
@@ -1329,25 +1329,29 @@
 
 static RenderLayer* findRenderLayerForGraphicsLayer(RenderLayer* searchRoot, GraphicsLayer* graphicsLayer, String* layerType)
 {
-    if (searchRoot->backing() && graphicsLayer == searchRoot->backing()->graphicsLayer())
+    if (searchRoot->compositedLayerMapping() && graphicsLayer == searchRoot->compositedLayerMapping()->mainGraphicsLayer())
         return searchRoot;
 
-    if (graphicsLayer == searchRoot->layerForScrolling()) {
+    GraphicsLayer* layerForScrolling = searchRoot->scrollableArea() ? searchRoot->scrollableArea()->layerForScrolling() : 0;
+    if (graphicsLayer == layerForScrolling) {
         *layerType = "scrolling";
         return searchRoot;
     }
 
-    if (graphicsLayer == searchRoot->layerForHorizontalScrollbar()) {
+    GraphicsLayer* layerForHorizontalScrollbar = searchRoot->scrollableArea() ? searchRoot->scrollableArea()->layerForHorizontalScrollbar() : 0;
+    if (graphicsLayer == layerForHorizontalScrollbar) {
         *layerType = "horizontalScrollbar";
         return searchRoot;
     }
 
-    if (graphicsLayer == searchRoot->layerForVerticalScrollbar()) {
+    GraphicsLayer* layerForVerticalScrollbar = searchRoot->scrollableArea() ? searchRoot->scrollableArea()->layerForVerticalScrollbar() : 0;
+    if (graphicsLayer == layerForVerticalScrollbar) {
         *layerType = "verticalScrollbar";
         return searchRoot;
     }
 
-    if (graphicsLayer == searchRoot->layerForScrollCorner()) {
+    GraphicsLayer* layerForScrollCorner = searchRoot->scrollableArea() ? searchRoot->scrollableArea()->layerForScrollCorner() : 0;
+    if (graphicsLayer == layerForScrollCorner) {
         *layerType = "scrollCorner";
         return searchRoot;
     }
@@ -1514,7 +1518,7 @@
     if (!document || !document->frame())
         return 0;
 
-    return document->frame()->editor().selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length);
+    return document->frame()->spellChecker().selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length);
 }
 
 void Internals::setContinuousSpellCheckingEnabled(bool enabled, ExceptionState&)
@@ -1522,8 +1526,8 @@
     if (!contextDocument() || !contextDocument()->frame())
         return;
 
-    if (enabled != contextDocument()->frame()->editor().isContinuousSpellCheckingEnabled())
-        contextDocument()->frame()->editor().toggleContinuousSpellChecking();
+    if (enabled != contextDocument()->frame()->spellChecker().isContinuousSpellCheckingEnabled())
+        contextDocument()->frame()->spellChecker().toggleContinuousSpellChecking();
 }
 
 bool Internals::isOverwriteModeEnabled(Document* document, ExceptionState&)
@@ -1608,7 +1612,7 @@
 
     m_frontendChannel.release();
 
-    m_frontendWindow->close(m_frontendWindow->scriptExecutionContext());
+    m_frontendWindow->close(m_frontendWindow->executionContext());
     m_frontendWindow.release();
 }
 
@@ -1637,7 +1641,7 @@
     if (!document || !document->frame())
         return 0;
 
-    return document->frame()->editor().selectionStartHasMarkerFor(DocumentMarker::Grammar, from, length);
+    return document->frame()->spellChecker().selectionStartHasMarkerFor(DocumentMarker::Grammar, from, length);
 }
 
 unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionState&)
@@ -1788,13 +1792,13 @@
 
     RenderLayer* layer = toRenderBox(renderer)->layer();
     if (!layer
-        || !layer->backing()
-        || !layer->backing()->graphicsLayer()) {
+        || !layer->compositedLayerMapping()
+        || !layer->compositedLayerMapping()->mainGraphicsLayer()) {
         // Don't raise exception in these cases which may be normally used in tests.
         return String();
     }
 
-    return layer->backing()->graphicsLayer()->layerTreeAsText(flags);
+    return layer->compositedLayerMapping()->mainGraphicsLayer()->layerTreeAsText(flags);
 }
 
 static RenderLayer* getRenderLayerForElement(Element* element, ExceptionState& es)
@@ -2087,6 +2091,35 @@
     frameView->setTracksRepaints(false);
 }
 
+PassRefPtr<ClientRectList> Internals::draggableRegions(Document* document, ExceptionState& es)
+{
+    return annotatedRegions(document, true, es);
+}
+
+PassRefPtr<ClientRectList> Internals::nonDraggableRegions(Document* document, ExceptionState& es)
+{
+    return annotatedRegions(document, false, es);
+}
+
+PassRefPtr<ClientRectList> Internals::annotatedRegions(Document* document, bool draggable, ExceptionState& es)
+{
+    if (!document || !document->view()) {
+        es.throwUninformativeAndGenericDOMException(InvalidAccessError);
+        return ClientRectList::create();
+    }
+
+    document->updateLayout();
+    document->view()->updateAnnotatedRegions();
+    Vector<AnnotatedRegionValue> regions = document->annotatedRegions();
+
+    Vector<FloatQuad> quads;
+    for (size_t i = 0; i < regions.size(); ++i) {
+        if (regions[i].draggable == draggable)
+            quads.append(FloatQuad(regions[i].bounds));
+    }
+    return ClientRectList::create(quads);
+}
+
 static const char* cursorTypeToString(Cursor::Type cursorType)
 {
     switch (cursorType) {
diff --git a/Source/core/testing/Internals.h b/Source/core/testing/Internals.h
index 18350ec..42814df 100644
--- a/Source/core/testing/Internals.h
+++ b/Source/core/testing/Internals.h
@@ -61,7 +61,7 @@
 class Page;
 class PagePopupController;
 class Range;
-class ScriptExecutionContext;
+class ExecutionContext;
 class SerializedScriptValue;
 class ShadowRoot;
 class TypeConversions;
@@ -276,6 +276,9 @@
     void startTrackingRepaints(Document*, ExceptionState&);
     void stopTrackingRepaints(Document*, ExceptionState&);
 
+    PassRefPtr<ClientRectList> draggableRegions(Document*, ExceptionState&);
+    PassRefPtr<ClientRectList> nonDraggableRegions(Document*, ExceptionState&);
+
     PassRefPtr<ArrayBuffer> serializeObject(PassRefPtr<SerializedScriptValue>) const;
     PassRefPtr<SerializedScriptValue> deserializeBuffer(PassRefPtr<ArrayBuffer>) const;
 
@@ -301,6 +304,7 @@
     Document* contextDocument() const;
     Frame* frame() const;
     Vector<String> iconURLs(Document*, int iconTypesMask) const;
+    PassRefPtr<ClientRectList> annotatedRegions(Document*, bool draggable, ExceptionState&);
 
     DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionState&);
     RefPtr<DOMWindow> m_frontendWindow;
diff --git a/Source/core/testing/Internals.idl b/Source/core/testing/Internals.idl
index ed9b51d..5a6847b 100644
--- a/Source/core/testing/Internals.idl
+++ b/Source/core/testing/Internals.idl
@@ -240,6 +240,10 @@
     [RaisesException] void startTrackingRepaints(Document document);
     [RaisesException] void stopTrackingRepaints(Document document);
 
+    // Returns a list of draggable/non-draggable regions in the document.
+    [RaisesException] ClientRectList draggableRegions(Document document);
+    [RaisesException] ClientRectList nonDraggableRegions(Document document);
+
     // Returns a string with information about the mouse cursor used at the specified client location.
     [RaisesException] DOMString getCurrentCursorInfo(Document document);
 
diff --git a/Source/core/testing/MockPagePopupDriver.cpp b/Source/core/testing/MockPagePopupDriver.cpp
index 5ca92ce..48fceda 100644
--- a/Source/core/testing/MockPagePopupDriver.cpp
+++ b/Source/core/testing/MockPagePopupDriver.cpp
@@ -33,11 +33,11 @@
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/DocumentWriter.h"
 #include "core/loader/FrameLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/PagePopup.h"
 #include "core/page/PagePopupClient.h"
 #include "core/page/PagePopupController.h"
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 
 namespace WebCore {
 
diff --git a/Source/core/testing/v8/WebCoreTestSupport.cpp b/Source/core/testing/v8/WebCoreTestSupport.cpp
index e18e369..10b8d9e 100644
--- a/Source/core/testing/v8/WebCoreTestSupport.cpp
+++ b/Source/core/testing/v8/WebCoreTestSupport.cpp
@@ -30,8 +30,8 @@
 #include "Internals.h"
 #include "V8Internals.h"
 #include "core/dom/Document.h"
-#include "core/dom/ScriptExecutionContext.h"
-#include "core/page/Frame.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/frame/Frame.h"
 
 #include <v8.h>
 
@@ -43,7 +43,7 @@
 {
     v8::Context::Scope contextScope(context);
     v8::HandleScope scope(context->GetIsolate());
-    ScriptExecutionContext* scriptContext = getScriptExecutionContext();
+    ExecutionContext* scriptContext = getExecutionContext();
     if (scriptContext->isDocument())
         context->Global()->Set(v8::String::New(Internals::internalsId), toV8(Internals::create(toDocument(scriptContext)), v8::Handle<v8::Object>(), context->GetIsolate()));
 }
@@ -57,7 +57,7 @@
     v8::Context::Scope contextScope(context);
     v8::HandleScope scope(context->GetIsolate());
 
-    ScriptExecutionContext* scriptContext = getScriptExecutionContext();
+    ExecutionContext* scriptContext = getExecutionContext();
     Page* page = toDocument(scriptContext)->frame()->page();
     Internals::resetToConsistentState(page);
     InternalSettings::from(page)->resetToConsistentState();
diff --git a/Source/core/tests/ArenaTestHelpers.h b/Source/core/tests/ArenaTestHelpers.h
deleted file mode 100644
index dd94743..0000000
--- a/Source/core/tests/ArenaTestHelpers.h
+++ /dev/null
@@ -1,80 +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.
- */
-
-#ifndef ArenaTestHelpers_h
-#define ArenaTestHelpers_h
-
-#include "core/platform/PODArena.h"
-#include "wtf/NotFound.h"
-#include "wtf/Vector.h"
-
-#include <gtest/gtest.h>
-
-namespace WebCore {
-namespace ArenaTestHelpers {
-
-// An allocator for the PODArena which tracks the regions which have
-// been allocated.
-class TrackedAllocator : public PODArena::FastMallocAllocator {
-public:
-    static PassRefPtr<TrackedAllocator> create()
-    {
-        return adoptRef(new TrackedAllocator);
-    }
-
-    virtual void* allocate(size_t size)
-    {
-        void* result = PODArena::FastMallocAllocator::allocate(size);
-        m_allocatedRegions.append(result);
-        return result;
-    }
-
-    virtual void free(void* ptr)
-    {
-        size_t slot = m_allocatedRegions.find(ptr);
-        ASSERT_NE(slot, kNotFound);
-        m_allocatedRegions.remove(slot);
-        PODArena::FastMallocAllocator::free(ptr);
-    }
-
-    bool isEmpty() const
-    {
-        return !numRegions();
-    }
-
-    int numRegions() const
-    {
-        return m_allocatedRegions.size();
-    }
-
-private:
-    TrackedAllocator() { }
-    Vector<void*> m_allocatedRegions;
-};
-
-} // namespace ArenaTestHelpers
-} // namespace WebCore
-
-#endif // ArenaTestHelpers_h
diff --git a/Source/core/tests/FakeWebGraphicsContext3D.h b/Source/core/tests/FakeWebGraphicsContext3D.h
deleted file mode 100644
index 693e246..0000000
--- a/Source/core/tests/FakeWebGraphicsContext3D.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE 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 FakeWebGraphicsContext3D_h
-#define FakeWebGraphicsContext3D_h
-
-#include "core/platform/graphics/GraphicsContext3D.h"
-#include "public/platform/WebGraphicsContext3D.h"
-
-namespace WebKit {
-
-// WebGraphicsContext3D base class for use in WebKit unit tests.
-// All operations are no-ops (returning 0 if necessary).
-class FakeWebGraphicsContext3D : public WebGraphicsContext3D {
-public:
-    FakeWebGraphicsContext3D()
-        : m_nextTextureId(1)
-    {
-    }
-
-    virtual bool makeContextCurrent() { return true; }
-
-    virtual int width() { return 0; }
-    virtual int height() { return 0; }
-
-    virtual void reshape(int width, int height) { }
-
-    virtual void prepareTexture() { }
-
-    virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) { }
-
-    virtual void synthesizeGLError(WGC3Denum) { }
-
-    virtual bool isContextLost() { return false; }
-
-    virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, WGC3Denum access) { return 0; }
-    virtual void unmapBufferSubDataCHROMIUM(const void*) { }
-    virtual void* mapTexSubImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, WGC3Denum access) { return 0; }
-    virtual void unmapTexSubImage2DCHROMIUM(const void*) { }
-
-    virtual void setVisibilityCHROMIUM(bool visible) { }
-
-    virtual void discardFramebufferEXT(WGC3Denum target, WGC3Dsizei numAttachments, const WGC3Denum* attachments) { }
-    virtual void ensureFramebufferCHROMIUM() { }
-
-    virtual void setMemoryAllocationChangedCallbackCHROMIUM(WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) { }
-
-    virtual WebString getRequestableExtensionsCHROMIUM() { return WebString(); }
-    virtual void requestExtensionCHROMIUM(const char*) { }
-
-    virtual void blitFramebufferCHROMIUM(WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, WGC3Dbitfield mask, WGC3Denum filter) { }
-    virtual void renderbufferStorageMultisampleCHROMIUM(WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) { }
-
-    virtual void activeTexture(WGC3Denum texture) { }
-    virtual void attachShader(WebGLId program, WebGLId shader) { }
-    virtual void bindAttribLocation(WebGLId program, WGC3Duint index, const WGC3Dchar* name) { }
-    virtual void bindBuffer(WGC3Denum target, WebGLId buffer) { }
-    virtual void bindFramebuffer(WGC3Denum target, WebGLId framebuffer) { }
-    virtual void bindRenderbuffer(WGC3Denum target, WebGLId renderbuffer) { }
-    virtual void bindTexture(WGC3Denum target, WebGLId texture) { }
-    virtual void blendColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) { }
-    virtual void blendEquation(WGC3Denum mode) { }
-    virtual void blendEquationSeparate(WGC3Denum modeRGB, WGC3Denum modeAlpha) { }
-    virtual void blendFunc(WGC3Denum sfactor, WGC3Denum dfactor) { }
-    virtual void blendFuncSeparate(WGC3Denum srcRGB, WGC3Denum dstRGB, WGC3Denum srcAlpha, WGC3Denum dstAlpha) { }
-
-    virtual void bufferData(WGC3Denum target, WGC3Dsizeiptr size, const void* data, WGC3Denum usage) { }
-    virtual void bufferSubData(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, const void* data) { }
-
-    virtual WGC3Denum checkFramebufferStatus(WGC3Denum target)
-    {
-        return WebCore::GraphicsContext3D::FRAMEBUFFER_COMPLETE;
-    }
-
-    virtual void clear(WGC3Dbitfield mask) { }
-    virtual void clearColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) { }
-    virtual void clearDepth(WGC3Dclampf depth) { }
-    virtual void clearStencil(WGC3Dint s) { }
-    virtual void colorMask(WGC3Dboolean red, WGC3Dboolean green, WGC3Dboolean blue, WGC3Dboolean alpha) { }
-    virtual void compileShader(WebGLId shader) { }
-
-    virtual void compressedTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Dsizei imageSize, const void* data) { }
-    virtual void compressedTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Dsizei imageSize, const void* data) { }
-    virtual void copyTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border) { }
-    virtual void copyTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) { }
-    virtual void cullFace(WGC3Denum mode) { }
-    virtual void depthFunc(WGC3Denum func) { }
-    virtual void depthMask(WGC3Dboolean flag) { }
-    virtual void depthRange(WGC3Dclampf zNear, WGC3Dclampf zFar) { }
-    virtual void detachShader(WebGLId program, WebGLId shader) { }
-    virtual void disable(WGC3Denum cap) { }
-    virtual void disableVertexAttribArray(WGC3Duint index) { }
-    virtual void drawArrays(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count) { }
-    virtual void drawElements(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset) { }
-
-    virtual void enable(WGC3Denum cap) { }
-    virtual void enableVertexAttribArray(WGC3Duint index) { }
-    virtual void finish() { }
-    virtual void flush() { }
-    virtual void framebufferRenderbuffer(WGC3Denum target, WGC3Denum attachment, WGC3Denum renderbuffertarget, WebGLId renderbuffer) { }
-    virtual void framebufferTexture2D(WGC3Denum target, WGC3Denum attachment, WGC3Denum textarget, WebGLId texture, WGC3Dint level) { }
-    virtual void frontFace(WGC3Denum mode) { }
-    virtual void generateMipmap(WGC3Denum target) { }
-
-    virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&) { return false; }
-    virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&) { return false; }
-    virtual void getAttachedShaders(WebGLId program, WGC3Dsizei maxCount, WGC3Dsizei* count, WebGLId* shaders) { }
-    virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name) { return 0; }
-    virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value) { }
-    virtual void getBufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { }
-    virtual Attributes getContextAttributes() { return m_attrs; }
-    virtual WGC3Denum getError() { return 0; }
-    virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value) { }
-    virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, WGC3Denum attachment, WGC3Denum pname, WGC3Dint* value) { }
-
-    virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value)
-    {
-        if (pname == WebCore::GraphicsContext3D::MAX_TEXTURE_SIZE)
-            *value = 1024;
-    }
-
-    virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value)
-    {
-        if (pname == WebCore::GraphicsContext3D::LINK_STATUS)
-            *value = 1;
-    }
-
-    virtual WebString getProgramInfoLog(WebGLId program) { return WebString(); }
-    virtual void getRenderbufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { }
-
-    virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value)
-    {
-        if (pname == WebCore::GraphicsContext3D::COMPILE_STATUS)
-            *value = 1;
-    }
-
-    virtual WebString getShaderInfoLog(WebGLId shader) { return WebString(); }
-    virtual void getShaderPrecisionFormat(WGC3Denum shadertype, WGC3Denum precisiontype, WGC3Dint* range, WGC3Dint* precision) { }
-    virtual WebString getShaderSource(WebGLId shader) { return WebString(); }
-    virtual WebString getString(WGC3Denum name) { return WebString(); }
-    virtual void getTexParameterfv(WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value) { }
-    virtual void getTexParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { }
-    virtual void getUniformfv(WebGLId program, WGC3Dint location, WGC3Dfloat* value) { }
-    virtual void getUniformiv(WebGLId program, WGC3Dint location, WGC3Dint* value) { }
-    virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name) { return 0; }
-    virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, WGC3Dfloat* value) { }
-    virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, WGC3Dint* value) { }
-    virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) { return 0; }
-
-    virtual void hint(WGC3Denum target, WGC3Denum mode) { }
-    virtual WGC3Dboolean isBuffer(WebGLId buffer) { return false; }
-    virtual WGC3Dboolean isEnabled(WGC3Denum cap) { return false; }
-    virtual WGC3Dboolean isFramebuffer(WebGLId framebuffer) { return false; }
-    virtual WGC3Dboolean isProgram(WebGLId program) { return false; }
-    virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer) { return false; }
-    virtual WGC3Dboolean isShader(WebGLId shader) { return false; }
-    virtual WGC3Dboolean isTexture(WebGLId texture) { return false; }
-    virtual void lineWidth(WGC3Dfloat) { }
-    virtual void linkProgram(WebGLId program) { }
-    virtual void pixelStorei(WGC3Denum pname, WGC3Dint param) { }
-    virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units) { }
-
-    virtual void readPixels(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, void* pixels) { }
-
-    virtual void releaseShaderCompiler() { }
-
-    virtual void renderbufferStorage(WGC3Denum target, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) { }
-    virtual void sampleCoverage(WGC3Dclampf value, WGC3Dboolean invert) { }
-    virtual void scissor(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) { }
-    virtual void shaderSource(WebGLId shader, const WGC3Dchar* string) { }
-    virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask) { }
-    virtual void stencilFuncSeparate(WGC3Denum face, WGC3Denum func, WGC3Dint ref, WGC3Duint mask) { }
-    virtual void stencilMask(WGC3Duint mask) { }
-    virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask) { }
-    virtual void stencilOp(WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) { }
-    virtual void stencilOpSeparate(WGC3Denum face, WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) { }
-
-    virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) { }
-
-    virtual void texParameterf(WGC3Denum target, WGC3Denum pname, WGC3Dfloat param) { }
-    virtual void texParameteri(WGC3Denum target, WGC3Denum pname, WGC3Dint param) { }
-
-    virtual void texSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, const void* pixels) { }
-
-    virtual void uniform1f(WGC3Dint location, WGC3Dfloat x) { }
-    virtual void uniform1fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) { }
-    virtual void uniform1i(WGC3Dint location, WGC3Dint x) { }
-    virtual void uniform1iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) { }
-    virtual void uniform2f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y) { }
-    virtual void uniform2fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) { }
-    virtual void uniform2i(WGC3Dint location, WGC3Dint x, WGC3Dint y) { }
-    virtual void uniform2iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) { }
-    virtual void uniform3f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z) { }
-    virtual void uniform3fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) { }
-    virtual void uniform3i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z) { }
-    virtual void uniform3iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) { }
-    virtual void uniform4f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w) { }
-    virtual void uniform4fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) { }
-    virtual void uniform4i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z, WGC3Dint w) { }
-    virtual void uniform4iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) { }
-    virtual void uniformMatrix2fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) { }
-    virtual void uniformMatrix3fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) { }
-    virtual void uniformMatrix4fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) { }
-
-    virtual void useProgram(WebGLId program) { }
-    virtual void validateProgram(WebGLId program) { }
-
-    virtual void vertexAttrib1f(WGC3Duint index, WGC3Dfloat x) { }
-    virtual void vertexAttrib1fv(WGC3Duint index, const WGC3Dfloat* values) { }
-    virtual void vertexAttrib2f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y) { }
-    virtual void vertexAttrib2fv(WGC3Duint index, const WGC3Dfloat* values) { }
-    virtual void vertexAttrib3f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z) { }
-    virtual void vertexAttrib3fv(WGC3Duint index, const WGC3Dfloat* values) { }
-    virtual void vertexAttrib4f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w) { }
-    virtual void vertexAttrib4fv(WGC3Duint index, const WGC3Dfloat* values) { }
-    virtual void vertexAttribPointer(WGC3Duint index, WGC3Dint size, WGC3Denum type, WGC3Dboolean normalized, WGC3Dsizei stride, WGC3Dintptr offset) { }
-
-    virtual void viewport(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) { }
-
-    virtual WebGLId createBuffer() { return 1; }
-    virtual WebGLId createFramebuffer() { return 1; }
-    virtual WebGLId createProgram() { return 1; }
-    virtual WebGLId createRenderbuffer() { return 1; }
-    virtual WebGLId createShader(WGC3Denum) { return 1; }
-    virtual WebGLId createTexture() { return m_nextTextureId++; }
-
-    virtual void deleteBuffer(WebGLId) { }
-    virtual void deleteFramebuffer(WebGLId) { }
-    virtual void deleteProgram(WebGLId) { }
-    virtual void deleteRenderbuffer(WebGLId) { }
-    virtual void deleteShader(WebGLId) { }
-    virtual void deleteTexture(WebGLId) { }
-
-    virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, WGC3Dint width, WGC3Dint height) { }
-
-    virtual WebGLId createQueryEXT() { return 1; }
-    virtual void deleteQueryEXT(WebGLId) { }
-    virtual GC3Dboolean isQueryEXT(WebGLId) { return true; }
-    virtual void beginQueryEXT(GC3Denum, WebGLId) { }
-    virtual void endQueryEXT(GC3Denum) { }
-    virtual void getQueryivEXT(GC3Denum, GC3Denum, GC3Dint*) { }
-    virtual void getQueryObjectuivEXT(WebGLId, GC3Denum, GC3Duint*) { }
-
-protected:
-    unsigned m_nextTextureId;
-    Attributes m_attrs;
-};
-
-} // namespace WebKit
-
-#endif // FakeWebGraphicsContext3D_h
diff --git a/Source/core/tests/LayoutUnit.cpp b/Source/core/tests/LayoutUnit.cpp
deleted file mode 100644
index 0953f93..0000000
--- a/Source/core/tests/LayoutUnit.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * 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:
- *
- *     * 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/LayoutUnit.h"
-
-#include <gtest/gtest.h>
-#include <limits.h>
-
-using namespace WebCore;
-
-namespace {
-
-TEST(WebCoreLayoutUnit, LayoutUnitInt)
-{
-    ASSERT_EQ(LayoutUnit(INT_MIN).toInt(), intMinForLayoutUnit);
-    ASSERT_EQ(LayoutUnit(INT_MIN / 2).toInt(), intMinForLayoutUnit);
-    ASSERT_EQ(LayoutUnit(intMinForLayoutUnit - 1).toInt(), intMinForLayoutUnit);
-    ASSERT_EQ(LayoutUnit(intMinForLayoutUnit).toInt(), intMinForLayoutUnit);
-    ASSERT_EQ(LayoutUnit(intMinForLayoutUnit + 1).toInt(), intMinForLayoutUnit + 1);
-    ASSERT_EQ(LayoutUnit(intMinForLayoutUnit / 2).toInt(), intMinForLayoutUnit / 2);
-    ASSERT_EQ(LayoutUnit(-10000).toInt(), -10000);
-    ASSERT_EQ(LayoutUnit(-1000).toInt(), -1000);
-    ASSERT_EQ(LayoutUnit(-100).toInt(), -100);
-    ASSERT_EQ(LayoutUnit(-10).toInt(), -10);
-    ASSERT_EQ(LayoutUnit(-1).toInt(), -1);
-    ASSERT_EQ(LayoutUnit(0).toInt(), 0);
-    ASSERT_EQ(LayoutUnit(1).toInt(), 1);
-    ASSERT_EQ(LayoutUnit(100).toInt(), 100);
-    ASSERT_EQ(LayoutUnit(1000).toInt(), 1000);
-    ASSERT_EQ(LayoutUnit(10000).toInt(), 10000);
-    ASSERT_EQ(LayoutUnit(intMaxForLayoutUnit / 2).toInt(), intMaxForLayoutUnit / 2);
-    ASSERT_EQ(LayoutUnit(intMaxForLayoutUnit - 1).toInt(), intMaxForLayoutUnit - 1);
-    ASSERT_EQ(LayoutUnit(intMaxForLayoutUnit).toInt(), intMaxForLayoutUnit);
-    ASSERT_EQ(LayoutUnit(intMaxForLayoutUnit + 1).toInt(), intMaxForLayoutUnit);
-    ASSERT_EQ(LayoutUnit(INT_MAX / 2).toInt(), intMaxForLayoutUnit);
-    ASSERT_EQ(LayoutUnit(INT_MAX).toInt(), intMaxForLayoutUnit);
-}
-
-TEST(WebCoreLayoutUnit, LayoutUnitFloat)
-{
-    const float tolerance = 1.0f / kFixedPointDenominator;
-    ASSERT_FLOAT_EQ(LayoutUnit(1.0f).toFloat(), 1.0f);
-    ASSERT_FLOAT_EQ(LayoutUnit(1.25f).toFloat(), 1.25f);
-    ASSERT_NEAR(LayoutUnit(1.1f).toFloat(), 1.1f, tolerance);
-    ASSERT_NEAR(LayoutUnit(1.33f).toFloat(), 1.33f, tolerance);
-    ASSERT_NEAR(LayoutUnit(1.3333f).toFloat(), 1.3333f, tolerance);
-    ASSERT_NEAR(LayoutUnit(1.53434f).toFloat(), 1.53434f, tolerance);
-    ASSERT_NEAR(LayoutUnit(345634).toFloat(), 345634.0f, tolerance);
-    ASSERT_NEAR(LayoutUnit(345634.12335f).toFloat(), 345634.12335f, tolerance);
-    ASSERT_NEAR(LayoutUnit(-345634.12335f).toFloat(), -345634.12335f, tolerance);
-    ASSERT_NEAR(LayoutUnit(-345634).toFloat(), -345634.0f, tolerance);
-}
-
-TEST(WebCoreLayoutUnit, LayoutUnitRounding)
-{
-    ASSERT_EQ(LayoutUnit(-1.9f).round(), -2);
-    ASSERT_EQ(LayoutUnit(-1.6f).round(), -2);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(-1.51f).round(), -2);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(-1.5f).round(), -1);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(-1.49f).round(), -1);
-    ASSERT_EQ(LayoutUnit(-1.0f).round(), -1);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(-0.99f).round(), -1);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(-0.51f).round(), -1);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(-0.50f).round(), 0);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(-0.49f).round(), 0);
-    ASSERT_EQ(LayoutUnit(-0.1f).round(), 0);
-    ASSERT_EQ(LayoutUnit(0.0f).round(), 0);
-    ASSERT_EQ(LayoutUnit(0.1f).round(), 0);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(0.49f).round(), 0);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(0.50f).round(), 1);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(0.51f).round(), 1);
-    ASSERT_EQ(LayoutUnit(0.99f).round(), 1);
-    ASSERT_EQ(LayoutUnit(1.0f).round(), 1);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(1.49f).round(), 1);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(1.5f).round(), 2);
-    ASSERT_EQ(LayoutUnit::fromFloatRound(1.51f).round(), 2);
-}
-
-TEST(WebCoreLayoutUnit, LayoutUnitSnapSizeToPixel)
-{
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1), LayoutUnit(0)), 1);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1), LayoutUnit(0.5)), 1);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1.5), LayoutUnit(0)), 2);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1.5), LayoutUnit(0.49)), 2);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1.5), LayoutUnit(0.5)), 1);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1.5), LayoutUnit(0.75)), 1);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1.5), LayoutUnit(0.99)), 1);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1.5), LayoutUnit(1)), 2);
-
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(0.5), LayoutUnit(1.5)), 0);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(0.99), LayoutUnit(1.5)), 0);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1.0), LayoutUnit(1.5)), 1);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1.49), LayoutUnit(1.5)), 1);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(1.5), LayoutUnit(1.5)), 1);
-
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(100.5), LayoutUnit(100)), 101);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(intMaxForLayoutUnit), LayoutUnit(0.3)), intMaxForLayoutUnit);
-    ASSERT_EQ(snapSizeToPixel(LayoutUnit(intMinForLayoutUnit), LayoutUnit(-0.3)), intMinForLayoutUnit);
-}
-
-TEST(WebCoreLayoutUnit, LayoutUnitMultiplication)
-{
-    ASSERT_EQ((LayoutUnit(1) * LayoutUnit(1)).toInt(), 1);
-    ASSERT_EQ((LayoutUnit(1) * LayoutUnit(2)).toInt(), 2);
-    ASSERT_EQ((LayoutUnit(2) * LayoutUnit(1)).toInt(), 2);
-    ASSERT_EQ((LayoutUnit(2) * LayoutUnit(0.5)).toInt(), 1);
-    ASSERT_EQ((LayoutUnit(0.5) * LayoutUnit(2)).toInt(), 1);
-    ASSERT_EQ((LayoutUnit(100) * LayoutUnit(1)).toInt(), 100);
-
-    ASSERT_EQ((LayoutUnit(-1) * LayoutUnit(1)).toInt(), -1);
-    ASSERT_EQ((LayoutUnit(-1) * LayoutUnit(2)).toInt(), -2);
-    ASSERT_EQ((LayoutUnit(-2) * LayoutUnit(1)).toInt(), -2);
-    ASSERT_EQ((LayoutUnit(-2) * LayoutUnit(0.5)).toInt(), -1);
-    ASSERT_EQ((LayoutUnit(-0.5) * LayoutUnit(2)).toInt(), -1);
-    ASSERT_EQ((LayoutUnit(-100) * LayoutUnit(1)).toInt(), -100);
-
-    ASSERT_EQ((LayoutUnit(-1) * LayoutUnit(-1)).toInt(), 1);
-    ASSERT_EQ((LayoutUnit(-1) * LayoutUnit(-2)).toInt(), 2);
-    ASSERT_EQ((LayoutUnit(-2) * LayoutUnit(-1)).toInt(), 2);
-    ASSERT_EQ((LayoutUnit(-2) * LayoutUnit(-0.5)).toInt(), 1);
-    ASSERT_EQ((LayoutUnit(-0.5) * LayoutUnit(-2)).toInt(), 1);
-    ASSERT_EQ((LayoutUnit(-100) * LayoutUnit(-1)).toInt(), 100);
-
-    ASSERT_EQ((LayoutUnit(100) * LayoutUnit(3.33)).round(), 333);
-    ASSERT_EQ((LayoutUnit(-100) * LayoutUnit(3.33)).round(), -333);
-    ASSERT_EQ((LayoutUnit(-100) * LayoutUnit(-3.33)).round(), 333);
-
-    size_t aHundredSizeT = 100;
-    ASSERT_EQ((LayoutUnit(aHundredSizeT) * LayoutUnit(1)).toInt(), 100);
-    ASSERT_EQ((aHundredSizeT * LayoutUnit(4)).toInt(), 400);
-    ASSERT_EQ((LayoutUnit(4) * aHundredSizeT).toInt(), 400);
-
-    int quarterMax = intMaxForLayoutUnit / 4;
-    ASSERT_EQ((LayoutUnit(quarterMax) * LayoutUnit(2)).toInt(), quarterMax * 2);
-    ASSERT_EQ((LayoutUnit(quarterMax) * LayoutUnit(3)).toInt(), quarterMax * 3);
-    ASSERT_EQ((LayoutUnit(quarterMax) * LayoutUnit(4)).toInt(), quarterMax * 4);
-    ASSERT_EQ((LayoutUnit(quarterMax) * LayoutUnit(5)).toInt(), intMaxForLayoutUnit);
-
-    size_t overflowIntSizeT = intMaxForLayoutUnit * 4;
-    ASSERT_EQ((LayoutUnit(overflowIntSizeT) * LayoutUnit(2)).toInt(), intMaxForLayoutUnit);
-    ASSERT_EQ((overflowIntSizeT * LayoutUnit(4)).toInt(), intMaxForLayoutUnit);
-    ASSERT_EQ((LayoutUnit(4) * overflowIntSizeT).toInt(), intMaxForLayoutUnit);
-}
-
-TEST(WebCoreLayoutUnit, LayoutUnitDivision)
-{
-    ASSERT_EQ((LayoutUnit(1) / LayoutUnit(1)).toInt(), 1);
-    ASSERT_EQ((LayoutUnit(1) / LayoutUnit(2)).toInt(), 0);
-    ASSERT_EQ((LayoutUnit(2) / LayoutUnit(1)).toInt(), 2);
-    ASSERT_EQ((LayoutUnit(2) / LayoutUnit(0.5)).toInt(), 4);
-    ASSERT_EQ((LayoutUnit(0.5) / LayoutUnit(2)).toInt(), 0);
-    ASSERT_EQ((LayoutUnit(100) / LayoutUnit(10)).toInt(), 10);
-    ASSERT_FLOAT_EQ((LayoutUnit(1) / LayoutUnit(2)).toFloat(), 0.5f);
-    ASSERT_FLOAT_EQ((LayoutUnit(0.5) / LayoutUnit(2)).toFloat(), 0.25f);
-
-    ASSERT_EQ((LayoutUnit(-1) / LayoutUnit(1)).toInt(), -1);
-    ASSERT_EQ((LayoutUnit(-1) / LayoutUnit(2)).toInt(), 0);
-    ASSERT_EQ((LayoutUnit(-2) / LayoutUnit(1)).toInt(), -2);
-    ASSERT_EQ((LayoutUnit(-2) / LayoutUnit(0.5)).toInt(), -4);
-    ASSERT_EQ((LayoutUnit(-0.5) / LayoutUnit(2)).toInt(), 0);
-    ASSERT_EQ((LayoutUnit(-100) / LayoutUnit(10)).toInt(), -10);
-    ASSERT_FLOAT_EQ((LayoutUnit(-1) / LayoutUnit(2)).toFloat(), -0.5f);
-    ASSERT_FLOAT_EQ((LayoutUnit(-0.5) / LayoutUnit(2)).toFloat(), -0.25f);
-
-    ASSERT_EQ((LayoutUnit(-1) / LayoutUnit(-1)).toInt(), 1);
-    ASSERT_EQ((LayoutUnit(-1) / LayoutUnit(-2)).toInt(), 0);
-    ASSERT_EQ((LayoutUnit(-2) / LayoutUnit(-1)).toInt(), 2);
-    ASSERT_EQ((LayoutUnit(-2) / LayoutUnit(-0.5)).toInt(), 4);
-    ASSERT_EQ((LayoutUnit(-0.5) / LayoutUnit(-2)).toInt(), 0);
-    ASSERT_EQ((LayoutUnit(-100) / LayoutUnit(-10)).toInt(), 10);
-    ASSERT_FLOAT_EQ((LayoutUnit(-1) / LayoutUnit(-2)).toFloat(), 0.5f);
-    ASSERT_FLOAT_EQ((LayoutUnit(-0.5) / LayoutUnit(-2)).toFloat(), 0.25f);
-
-    size_t aHundredSizeT = 100;
-    ASSERT_EQ((LayoutUnit(aHundredSizeT) / LayoutUnit(2)).toInt(), 50);
-    ASSERT_EQ((aHundredSizeT / LayoutUnit(4)).toInt(), 25);
-    ASSERT_EQ((LayoutUnit(400) / aHundredSizeT).toInt(), 4);
-
-    ASSERT_EQ((LayoutUnit(intMaxForLayoutUnit) / LayoutUnit(2)).toInt(), intMaxForLayoutUnit / 2);
-    ASSERT_EQ((LayoutUnit(intMaxForLayoutUnit) / LayoutUnit(0.5)).toInt(), intMaxForLayoutUnit);
-}
-
-TEST(WebCoreLayoutUnit, LayoutUnitCeil)
-{
-    ASSERT_EQ(LayoutUnit(0).ceil(), 0);
-    ASSERT_EQ(LayoutUnit(0.1).ceil(), 1);
-    ASSERT_EQ(LayoutUnit(0.5).ceil(), 1);
-    ASSERT_EQ(LayoutUnit(0.9).ceil(), 1);
-    ASSERT_EQ(LayoutUnit(1.0).ceil(), 1);
-    ASSERT_EQ(LayoutUnit(1.1).ceil(), 2);
-
-    ASSERT_EQ(LayoutUnit(-0.1).ceil(), 0);
-    ASSERT_EQ(LayoutUnit(-0.5).ceil(), 0);
-    ASSERT_EQ(LayoutUnit(-0.9).ceil(), 0);
-    ASSERT_EQ(LayoutUnit(-1.0).ceil(), -1);
-
-    ASSERT_EQ(LayoutUnit(intMaxForLayoutUnit).ceil(), intMaxForLayoutUnit);
-    ASSERT_EQ((LayoutUnit(intMaxForLayoutUnit) - LayoutUnit(0.5)).ceil(), intMaxForLayoutUnit);
-    ASSERT_EQ((LayoutUnit(intMaxForLayoutUnit) - LayoutUnit(1)).ceil(), intMaxForLayoutUnit - 1);
-
-    ASSERT_EQ(LayoutUnit(intMinForLayoutUnit).ceil(), intMinForLayoutUnit);
-}
-
-TEST(WebCoreLayoutUnit, LayoutUnitFloor)
-{
-    ASSERT_EQ(LayoutUnit(0).floor(), 0);
-    ASSERT_EQ(LayoutUnit(0.1).floor(), 0);
-    ASSERT_EQ(LayoutUnit(0.5).floor(), 0);
-    ASSERT_EQ(LayoutUnit(0.9).floor(), 0);
-    ASSERT_EQ(LayoutUnit(1.0).floor(), 1);
-    ASSERT_EQ(LayoutUnit(1.1).floor(), 1);
-
-    ASSERT_EQ(LayoutUnit(-0.1).floor(), -1);
-    ASSERT_EQ(LayoutUnit(-0.5).floor(), -1);
-    ASSERT_EQ(LayoutUnit(-0.9).floor(), -1);
-    ASSERT_EQ(LayoutUnit(-1.0).floor(), -1);
-
-    ASSERT_EQ(LayoutUnit(intMaxForLayoutUnit).floor(), intMaxForLayoutUnit);
-
-    ASSERT_EQ(LayoutUnit(intMinForLayoutUnit).floor(), intMinForLayoutUnit);
-    ASSERT_EQ((LayoutUnit(intMinForLayoutUnit) + LayoutUnit(0.5)).floor(), intMinForLayoutUnit);
-    ASSERT_EQ((LayoutUnit(intMinForLayoutUnit) + LayoutUnit(1)).floor(), intMinForLayoutUnit + 1);
-}
-
-} // namespace
diff --git a/Source/core/tests/LinkRelAttribute.cpp b/Source/core/tests/LinkRelAttribute.cpp
deleted file mode 100644
index f404e53..0000000
--- a/Source/core/tests/LinkRelAttribute.cpp
+++ /dev/null
@@ -1,87 +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.
- */
-
-#include "config.h"
-
-#include <gtest/gtest.h>
-#include "core/html/LinkRelAttribute.h"
-
-using namespace WebCore;
-
-namespace {
-
-static inline void testLinkRelAttribute(String value, bool isStyleSheet, IconType iconType, bool isAlternate, bool isDNSPrefetch, bool isLinkSubresource, bool isLinkPrerender, bool isImport = false)
-{
-    LinkRelAttribute linkRelAttribute(value);
-    ASSERT_EQ(isStyleSheet, linkRelAttribute.isStyleSheet()) << value.utf8().data();
-    ASSERT_EQ(iconType, linkRelAttribute.iconType()) << value.utf8().data();
-    ASSERT_EQ(isAlternate, linkRelAttribute.isAlternate()) << value.utf8().data();
-    ASSERT_EQ(isDNSPrefetch, linkRelAttribute.isDNSPrefetch()) << value.utf8().data();
-    ASSERT_EQ(isLinkSubresource, linkRelAttribute.isLinkSubresource()) << value.utf8().data();
-    ASSERT_EQ(isLinkPrerender, linkRelAttribute.isLinkPrerender()) << value.utf8().data();
-    ASSERT_EQ(isImport, linkRelAttribute.isImport()) << value.utf8().data();
-}
-
-TEST(CoreLinkRelAttribute, Constructor)
-{
-    testLinkRelAttribute("stylesheet", true, InvalidIcon, false, false, false, false);
-    testLinkRelAttribute("sTyLeShEeT", true, InvalidIcon, false, false, false, false);
-
-    testLinkRelAttribute("icon", false, Favicon, false, false, false, false);
-    testLinkRelAttribute("iCoN", false, Favicon, false, false, false, false);
-    testLinkRelAttribute("shortcut icon", false, Favicon, false, false, false, false);
-    testLinkRelAttribute("sHoRtCuT iCoN", false, Favicon, false, false, false, false);
-
-#if ENABLE(TOUCH_ICON_LOADING)
-    testLinkRelAttribute("apple-touch-icon", false, TouchIcon, false, false, false, false);
-    testLinkRelAttribute("aPpLe-tOuCh-IcOn", false, TouchIcon, false, false, false, false);
-
-    testLinkRelAttribute("apple-touch-icon-precomposed", false, TouchPrecomposedIcon, false, false, false, false);
-    testLinkRelAttribute("aPpLe-tOuCh-IcOn-pReCoMpOsEd", false, TouchPrecomposedIcon, false, false, false, false);
-#endif
-
-    testLinkRelAttribute("dns-prefetch", false, InvalidIcon, false, true, false, false);
-    testLinkRelAttribute("dNs-pReFeTcH", false, InvalidIcon, false, true, false, false);
-
-    testLinkRelAttribute("alternate stylesheet", true, InvalidIcon, true, false, false, false);
-    testLinkRelAttribute("stylesheet alternate", true, InvalidIcon, true, false, false, false);
-    testLinkRelAttribute("aLtErNaTe sTyLeShEeT", true, InvalidIcon, true, false, false, false);
-    testLinkRelAttribute("sTyLeShEeT aLtErNaTe", true, InvalidIcon, true, false, false, false);
-
-    testLinkRelAttribute("stylesheet icon prerender aLtErNaTe", true, Favicon, true, false, false, true);
-    testLinkRelAttribute("alternate subresource", false, InvalidIcon, true, false, true, false);
-    testLinkRelAttribute("alternate icon stylesheet", true, Favicon, true, false, false, false);
-
-    testLinkRelAttribute("import", false, InvalidIcon, false, false, false, false, true);
-    // "import" is mutually exclusive and "stylesheet" wins when they conflict.
-    testLinkRelAttribute("stylesheet import", true, InvalidIcon, false, false, false, false, false);
-}
-
-} // namespace
diff --git a/Source/core/tests/PODArenaTest.cpp b/Source/core/tests/PODArenaTest.cpp
deleted file mode 100644
index 48da6ce..0000000
--- a/Source/core/tests/PODArenaTest.cpp
+++ /dev/null
@@ -1,106 +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.
- */
-
-#include "config.h"
-#include "core/platform/PODArena.h"
-
-#include "ArenaTestHelpers.h"
-#include "wtf/FastMalloc.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-
-#include <algorithm>
-#include <gtest/gtest.h>
-
-namespace WebCore {
-
-using ArenaTestHelpers::TrackedAllocator;
-
-namespace {
-
-// A couple of simple structs to allocate.
-struct TestClass1 {
-    TestClass1()
-        : x(0), y(0), z(0), w(1) { }
-
-    float x, y, z, w;
-};
-
-struct TestClass2 {
-    TestClass2()
-        : a(1), b(2), c(3), d(4) { }
-
-    float a, b, c, d;
-};
-
-} // anonymous namespace
-
-class PODArenaTest : public testing::Test {
-};
-
-// Make sure the arena can successfully allocate from more than one
-// region.
-TEST_F(PODArenaTest, CanAllocateFromMoreThanOneRegion)
-{
-    RefPtr<TrackedAllocator> allocator = TrackedAllocator::create();
-    RefPtr<PODArena> arena = PODArena::create(allocator);
-    int numIterations = 10 * PODArena::DefaultChunkSize / sizeof(TestClass1);
-    for (int i = 0; i < numIterations; ++i)
-        arena->allocateObject<TestClass1>();
-    EXPECT_GT(allocator->numRegions(), 1);
-}
-
-// Make sure the arena frees all allocated regions during destruction.
-TEST_F(PODArenaTest, FreesAllAllocatedRegions)
-{
-    RefPtr<TrackedAllocator> allocator = TrackedAllocator::create();
-    {
-        RefPtr<PODArena> arena = PODArena::create(allocator);
-        for (int i = 0; i < 3; i++)
-            arena->allocateObject<TestClass1>();
-        EXPECT_GT(allocator->numRegions(), 0);
-    }
-    EXPECT_TRUE(allocator->isEmpty());
-}
-
-// Make sure the arena runs constructors of the objects allocated within.
-TEST_F(PODArenaTest, RunsConstructors)
-{
-    RefPtr<PODArena> arena = PODArena::create();
-    for (int i = 0; i < 10000; i++) {
-        TestClass1* tc1 = arena->allocateObject<TestClass1>();
-        EXPECT_EQ(0, tc1->x);
-        EXPECT_EQ(0, tc1->y);
-        EXPECT_EQ(0, tc1->z);
-        EXPECT_EQ(1, tc1->w);
-        TestClass2* tc2 = arena->allocateObject<TestClass2>();
-        EXPECT_EQ(1, tc2->a);
-        EXPECT_EQ(2, tc2->b);
-        EXPECT_EQ(3, tc2->c);
-        EXPECT_EQ(4, tc2->d);
-    }
-}
-
-} // namespace WebCore
diff --git a/Source/core/tests/PODFreeListArenaTest.cpp b/Source/core/tests/PODFreeListArenaTest.cpp
deleted file mode 100644
index 26febe5..0000000
--- a/Source/core/tests/PODFreeListArenaTest.cpp
+++ /dev/null
@@ -1,142 +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:
- *
- * 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/PODFreeListArena.h"
-
-#include "ArenaTestHelpers.h"
-#include "wtf/FastMalloc.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
-
-#include <gtest/gtest.h>
-
-namespace WebCore {
-
-using ArenaTestHelpers::TrackedAllocator;
-
-namespace {
-
-// A couple of simple structs to allocate.
-struct TestClass1 {
-    TestClass1()
-        : x(0), y(0), z(0), w(1) { }
-
-    float x, y, z, w;
-};
-
-struct TestClass2 {
-    TestClass2()
-        : padding(0)
-    {
-        static int TestIds = 0;
-        id = TestIds++;
-    }
-    int id;
-    int padding;
-};
-
-} // anonymous namespace
-
-class PODFreeListArenaTest : public testing::Test {
-protected:
-    int getFreeListSize(const PassRefPtr<PODFreeListArena<TestClass1> > arena) const
-    {
-        return arena->getFreeListSizeForTesting();
-    }
-};
-
-// Make sure the arena can successfully allocate from more than one
-// region.
-TEST_F(PODFreeListArenaTest, CanAllocateFromMoreThanOneRegion)
-{
-    RefPtr<TrackedAllocator> allocator = TrackedAllocator::create();
-    RefPtr<PODFreeListArena<TestClass1> > arena = PODFreeListArena<TestClass1>::create(allocator);
-    int numIterations = 10 * PODArena::DefaultChunkSize / sizeof(TestClass1);
-    for (int i = 0; i < numIterations; ++i)
-        arena->allocateObject();
-    EXPECT_GT(allocator->numRegions(), 1);
-}
-
-// Make sure the arena frees all allocated regions during destruction.
-TEST_F(PODFreeListArenaTest, FreesAllAllocatedRegions)
-{
-    RefPtr<TrackedAllocator> allocator = TrackedAllocator::create();
-    {
-        RefPtr<PODFreeListArena<TestClass1> > arena = PODFreeListArena<TestClass1>::create(allocator);
-        for (int i = 0; i < 3; i++)
-            arena->allocateObject();
-        EXPECT_GT(allocator->numRegions(), 0);
-    }
-    EXPECT_TRUE(allocator->isEmpty());
-}
-
-// Make sure the arena runs constructors of the objects allocated within.
-TEST_F(PODFreeListArenaTest, RunsConstructors)
-{
-    RefPtr<PODFreeListArena<TestClass1> > arena = PODFreeListArena<TestClass1>::create();
-    for (int i = 0; i < 10000; i++) {
-        TestClass1* tc1 = arena->allocateObject();
-        EXPECT_EQ(0, tc1->x);
-        EXPECT_EQ(0, tc1->y);
-        EXPECT_EQ(0, tc1->z);
-        EXPECT_EQ(1, tc1->w);
-    }
-}
-
-// Make sure freeObject puts the object in the free list.
-TEST_F(PODFreeListArenaTest, AddsFreedObjectsToFreedList)
-{
-    std::vector<TestClass1*> objects;
-    RefPtr<PODFreeListArena<TestClass1> > arena = PODFreeListArena<TestClass1>::create();
-    for (int i = 0; i < 100; i++) {
-        objects.push_back(arena->allocateObject());
-    }
-    for (std::vector<TestClass1*>::iterator it = objects.begin(); it != objects.end(); ++it) {
-        arena->freeObject(*it);
-    }
-    EXPECT_EQ(100, getFreeListSize(arena));
-}
-
-// Make sure allocations use previously freed memory.
-TEST_F(PODFreeListArenaTest, ReusesPreviouslyFreedObjects)
-{
-    std::set<TestClass2*> objects;
-    RefPtr<PODFreeListArena<TestClass2> > arena = PODFreeListArena<TestClass2>::create();
-    for (int i = 0; i < 100; i++) {
-        objects.insert(arena->allocateObject());
-    }
-    for (std::set<TestClass2*>::iterator it = objects.begin(); it != objects.end(); ++it) {
-        arena->freeObject(*it);
-    }
-    for (int i = 0; i < 100; i++) {
-        TestClass2* cur = arena->allocateObject();
-        EXPECT_TRUE(objects.find(cur) != objects.end());
-        EXPECT_TRUE(cur->id >= 100 && cur->id < 200);
-        objects.erase(cur);
-    }
-}
-
-} // namespace WebCore
diff --git a/Source/core/tests/PODIntervalTreeTest.cpp b/Source/core/tests/PODIntervalTreeTest.cpp
deleted file mode 100644
index 367c321..0000000
--- a/Source/core/tests/PODIntervalTreeTest.cpp
+++ /dev/null
@@ -1,356 +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.
- */
-
-// Tests for the interval tree class.
-
-#include "config.h"
-#include "core/platform/PODIntervalTree.h"
-
-#include "TreeTestHelpers.h"
-#include "core/platform/Logging.h"
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-
-#include <gtest/gtest.h>
-
-namespace WebCore {
-
-using TreeTestHelpers::generateSeed;
-using TreeTestHelpers::initRandom;
-using TreeTestHelpers::nextRandom;
-
-#ifndef NDEBUG
-template<>
-struct ValueToString<float> {
-    static String string(const float& value) { return String::number(value); }
-};
-
-template<>
-struct ValueToString<void*> {
-    static String string(void* const& value)
-    {
-        return String::format("0x%p", value);
-    }
-};
-#endif
-
-TEST(PODIntervalTreeTest, TestInsertion)
-{
-    PODIntervalTree<float> tree;
-    tree.add(PODInterval<float>(2, 4));
-    ASSERT_TRUE(tree.checkInvariants());
-}
-
-TEST(PODIntervalTreeTest, TestInsertionAndQuery)
-{
-    PODIntervalTree<float> tree;
-    tree.add(PODInterval<float>(2, 4));
-    ASSERT_TRUE(tree.checkInvariants());
-    Vector<PODInterval<float> > result = tree.allOverlaps(PODInterval<float>(1, 3));
-    EXPECT_EQ(1U, result.size());
-    EXPECT_EQ(2, result[0].low());
-    EXPECT_EQ(4, result[0].high());
-}
-
-TEST(PODIntervalTreeTest, TestQueryAgainstZeroSizeInterval)
-{
-    PODIntervalTree<float> tree;
-    tree.add(PODInterval<float>(1, 2.5));
-    tree.add(PODInterval<float>(3.5, 5));
-    tree.add(PODInterval<float>(2, 4));
-    ASSERT_TRUE(tree.checkInvariants());
-    Vector<PODInterval<float> > result = tree.allOverlaps(PODInterval<float>(3, 3));
-    EXPECT_EQ(1U, result.size());
-    EXPECT_EQ(2, result[0].low());
-    EXPECT_EQ(4, result[0].high());
-}
-
-#ifndef NDEBUG
-template<>
-struct ValueToString<int*> {
-    static String string(int* const& value)
-    {
-        return String::format("0x%p", value);
-    }
-};
-#endif
-
-TEST(PODIntervalTreeTest, TestDuplicateElementInsertion)
-{
-    PODIntervalTree<float, int*> tree;
-    int tmp1 = 1;
-    int tmp2 = 2;
-    typedef PODIntervalTree<float, int*>::IntervalType IntervalType;
-    IntervalType interval1(1, 3, &tmp1);
-    IntervalType interval2(1, 3, &tmp2);
-    tree.add(interval1);
-    tree.add(interval2);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(interval1));
-    EXPECT_TRUE(tree.contains(interval2));
-    EXPECT_TRUE(tree.remove(interval1));
-    EXPECT_TRUE(tree.contains(interval2));
-    EXPECT_FALSE(tree.contains(interval1));
-    EXPECT_TRUE(tree.remove(interval2));
-    EXPECT_EQ(0, tree.size());
-}
-
-namespace {
-
-struct UserData1 {
-public:
-    UserData1()
-        : a(0), b(1) { }
-
-    float a;
-    int b;
-};
-
-} // anonymous namespace
-
-#ifndef NDEBUG
-template<>
-struct ValueToString<UserData1> {
-    static String string(const UserData1& value)
-    {
-        return String("[UserData1 a=") + String::number(value.a) + " b=" + String::number(value.b) + "]";
-    }
-};
-#endif
-
-TEST(PODIntervalTreeTest, TestInsertionOfComplexUserData)
-{
-    PODIntervalTree<float, UserData1> tree;
-    UserData1 data1;
-    data1.a = 5;
-    data1.b = 6;
-    tree.add(tree.createInterval(2, 4, data1));
-    ASSERT_TRUE(tree.checkInvariants());
-}
-
-TEST(PODIntervalTreeTest, TestQueryingOfComplexUserData)
-{
-    PODIntervalTree<float, UserData1> tree;
-    UserData1 data1;
-    data1.a = 5;
-    data1.b = 6;
-    tree.add(tree.createInterval(2, 4, data1));
-    ASSERT_TRUE(tree.checkInvariants());
-    Vector<PODInterval<float, UserData1> > overlaps = tree.allOverlaps(tree.createInterval(3, 5, data1));
-    EXPECT_EQ(1U, overlaps.size());
-    EXPECT_EQ(5, overlaps[0].data().a);
-    EXPECT_EQ(6, overlaps[0].data().b);
-}
-
-namespace {
-
-class EndpointType1 {
-public:
-    explicit EndpointType1(int value)
-        : m_value(value) { }
-
-    int value() const { return m_value; }
-
-    bool operator<(const EndpointType1& other) const { return m_value < other.m_value; }
-    bool operator==(const EndpointType1& other) const { return m_value == other.m_value; }
-
-private:
-    int m_value;
-    // These operators should not be called by the interval tree.
-    bool operator>(const EndpointType1& other);
-    bool operator<=(const EndpointType1& other);
-    bool operator>=(const EndpointType1& other);
-    bool operator!=(const EndpointType1& other);
-};
-
-} // anonymous namespace
-
-#ifndef NDEBUG
-template<>
-struct ValueToString<EndpointType1> {
-    static String string(const EndpointType1& value)
-    {
-        return String("[EndpointType1 value=") + String::number(value.value()) + "]";
-    }
-};
-#endif
-
-TEST(PODIntervalTreeTest, TestTreeDoesNotRequireMostOperators)
-{
-    PODIntervalTree<EndpointType1> tree;
-    tree.add(tree.createInterval(EndpointType1(1), EndpointType1(2)));
-    ASSERT_TRUE(tree.checkInvariants());
-}
-
-// Uncomment to debug a failure of the insertion and deletion test. Won't work
-// in release builds.
-// #define DEBUG_INSERTION_AND_DELETION_TEST
-
-#ifndef NDEBUG
-template<>
-struct ValueToString<int> {
-    static String string(const int& value) { return String::number(value); }
-};
-#endif
-
-namespace {
-
-void InsertionAndDeletionTest(int32_t seed, int treeSize)
-{
-    initRandom(seed);
-    int maximumValue = treeSize;
-    // Build the tree
-    PODIntervalTree<int> tree;
-    Vector<PODInterval<int> > addedElements;
-    Vector<PODInterval<int> > removedElements;
-    for (int i = 0; i < treeSize; i++) {
-        int left = nextRandom(maximumValue);
-        int length = nextRandom(maximumValue);
-        PODInterval<int> interval(left, left + length);
-        tree.add(interval);
-#ifdef DEBUG_INSERTION_AND_DELETION_TEST
-        LOG_ERROR("*** Adding element %s", ValueToString<PODInterval<int> >::string(interval).ascii().data());
-#endif
-        addedElements.append(interval);
-    }
-    // Churn the tree's contents.
-    // First remove half of the elements in random order.
-    for (int i = 0; i < treeSize / 2; i++) {
-        int index = nextRandom(addedElements.size());
-#ifdef DEBUG_INSERTION_AND_DELETION_TEST
-        LOG_ERROR("*** Removing element %s", ValueToString<PODInterval<int> >::string(addedElements[index]).ascii().data());
-#endif
-        ASSERT_TRUE(tree.contains(addedElements[index])) << "Test failed for seed " << seed;
-        tree.remove(addedElements[index]);
-        removedElements.append(addedElements[index]);
-        addedElements.remove(index);
-        ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed;
-    }
-    // Now randomly add or remove elements.
-    for (int i = 0; i < 2 * treeSize; i++) {
-        bool add = false;
-        if (!addedElements.size())
-            add = true;
-        else if (!removedElements.size())
-            add = false;
-        else
-            add = (nextRandom(2) == 1);
-        if (add) {
-            int index = nextRandom(removedElements.size());
-#ifdef DEBUG_INSERTION_AND_DELETION_TEST
-            LOG_ERROR("*** Adding element %s", ValueToString<PODInterval<int> >::string(removedElements[index]).ascii().data());
-#endif
-            tree.add(removedElements[index]);
-            addedElements.append(removedElements[index]);
-            removedElements.remove(index);
-        } else {
-            int index = nextRandom(addedElements.size());
-#ifdef DEBUG_INSERTION_AND_DELETION_TEST
-            LOG_ERROR("*** Removing element %s", ValueToString<PODInterval<int> >::string(addedElements[index]).ascii().data());
-#endif
-            ASSERT_TRUE(tree.contains(addedElements[index])) << "Test failed for seed " << seed;
-            ASSERT_TRUE(tree.remove(addedElements[index])) << "Test failed for seed " << seed;
-            removedElements.append(addedElements[index]);
-            addedElements.remove(index);
-        }
-        ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed;
-    }
-}
-
-} // anonymous namespace
-
-TEST(PODIntervalTreeTest, RandomDeletionAndInsertionRegressionTest1)
-{
-    InsertionAndDeletionTest(13972, 100);
-}
-
-TEST(PODIntervalTreeTest, RandomDeletionAndInsertionRegressionTest2)
-{
-    InsertionAndDeletionTest(1283382113, 10);
-}
-
-TEST(PODIntervalTreeTest, RandomDeletionAndInsertionRegressionTest3)
-{
-    // This is the sequence of insertions and deletions that triggered
-    // the failure in RandomDeletionAndInsertionRegressionTest2.
-    PODIntervalTree<int> tree;
-    tree.add(tree.createInterval(0, 5));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(4, 5));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(8, 9));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(1, 4));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(3, 5));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(4, 12));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(0, 2));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(0, 2));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(9, 13));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(0, 1));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.remove(tree.createInterval(0, 2));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.remove(tree.createInterval(9, 13));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.remove(tree.createInterval(0, 2));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.remove(tree.createInterval(0, 1));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.remove(tree.createInterval(4, 5));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.remove(tree.createInterval(4, 12));
-    ASSERT_TRUE(tree.checkInvariants());
-}
-
-TEST(PODIntervalTreeTest, RandomDeletionAndInsertionRegressionTest4)
-{
-    // Even further reduced test case for RandomDeletionAndInsertionRegressionTest3.
-    PODIntervalTree<int> tree;
-    tree.add(tree.createInterval(0, 5));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(8, 9));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(1, 4));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(3, 5));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(tree.createInterval(4, 12));
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.remove(tree.createInterval(4, 12));
-    ASSERT_TRUE(tree.checkInvariants());
-}
-
-TEST(PODIntervalTreeTest, TestRandomDeletionAndInsertion)
-{
-    InsertionAndDeletionTest(generateSeed(), 1000);
-}
-
-} // namespace WebCore
diff --git a/Source/core/tests/PODRedBlackTreeTest.cpp b/Source/core/tests/PODRedBlackTreeTest.cpp
deleted file mode 100644
index 5d26617..0000000
--- a/Source/core/tests/PODRedBlackTreeTest.cpp
+++ /dev/null
@@ -1,214 +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.
- */
-
-// Tests for the red-black tree class.
-
-#include "config.h"
-#include "core/platform/PODRedBlackTree.h"
-
-#include "ArenaTestHelpers.h"
-#include "TreeTestHelpers.h"
-#include "wtf/Vector.h"
-
-#include <gtest/gtest.h>
-
-namespace WebCore {
-
-using ArenaTestHelpers::TrackedAllocator;
-using TreeTestHelpers::generateSeed;
-using TreeTestHelpers::initRandom;
-using TreeTestHelpers::nextRandom;
-
-TEST(PODRedBlackTreeTest, TestTreeAllocatesFromArena)
-{
-    RefPtr<TrackedAllocator> allocator = TrackedAllocator::create();
-    {
-        typedef PODFreeListArena<PODRedBlackTree<int>::Node> PODIntegerArena;
-        RefPtr<PODIntegerArena> arena = PODIntegerArena::create(allocator);
-        PODRedBlackTree<int> tree(arena);
-        int numAdditions = 2 * PODArena::DefaultChunkSize / sizeof(int);
-        for (int i = 0; i < numAdditions; ++i)
-            tree.add(i);
-        EXPECT_GT(allocator->numRegions(), 1);
-    }
-    EXPECT_EQ(allocator->numRegions(), 0);
-}
-
-TEST(PODRedBlackTreeTest, TestSingleElementInsertion)
-{
-    PODRedBlackTree<int> tree;
-    tree.add(5);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(5));
-}
-
-TEST(PODRedBlackTreeTest, TestMultipleElementInsertion)
-{
-    PODRedBlackTree<int> tree;
-    tree.add(4);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(4));
-    tree.add(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(3));
-    tree.add(5);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(5));
-    EXPECT_TRUE(tree.contains(4));
-    EXPECT_TRUE(tree.contains(3));
-}
-
-TEST(PODRedBlackTreeTest, TestDuplicateElementInsertion)
-{
-    PODRedBlackTree<int> tree;
-    tree.add(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_EQ(3, tree.size());
-    EXPECT_TRUE(tree.contains(3));
-}
-
-TEST(PODRedBlackTreeTest, TestSingleElementInsertionAndDeletion)
-{
-    PODRedBlackTree<int> tree;
-    tree.add(5);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(5));
-    tree.remove(5);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_FALSE(tree.contains(5));
-}
-
-TEST(PODRedBlackTreeTest, TestMultipleElementInsertionAndDeletion)
-{
-    PODRedBlackTree<int> tree;
-    tree.add(4);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(4));
-    tree.add(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(3));
-    tree.add(5);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(5));
-    EXPECT_TRUE(tree.contains(4));
-    EXPECT_TRUE(tree.contains(3));
-    tree.remove(4);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(3));
-    EXPECT_FALSE(tree.contains(4));
-    EXPECT_TRUE(tree.contains(5));
-    tree.remove(5);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_TRUE(tree.contains(3));
-    EXPECT_FALSE(tree.contains(4));
-    EXPECT_FALSE(tree.contains(5));
-    EXPECT_EQ(1, tree.size());
-}
-
-TEST(PODRedBlackTreeTest, TestDuplicateElementInsertionAndDeletion)
-{
-    PODRedBlackTree<int> tree;
-    tree.add(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_EQ(3, tree.size());
-    EXPECT_TRUE(tree.contains(3));
-    tree.remove(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.remove(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_EQ(1, tree.size());
-    EXPECT_TRUE(tree.contains(3));
-    tree.remove(3);
-    ASSERT_TRUE(tree.checkInvariants());
-    EXPECT_EQ(0, tree.size());
-    EXPECT_FALSE(tree.contains(3));
-}
-
-TEST(PODRedBlackTreeTest, FailingInsertionRegressionTest1)
-{
-    // These numbers came from a previously-failing randomized test run.
-    PODRedBlackTree<int> tree;
-    tree.add(5113);
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(4517);
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(3373);
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(9307);
-    ASSERT_TRUE(tree.checkInvariants());
-    tree.add(7077);
-    ASSERT_TRUE(tree.checkInvariants());
-}
-
-namespace {
-void InsertionAndDeletionTest(const int32_t seed, const int treeSize)
-{
-    initRandom(seed);
-    const int maximumValue = treeSize;
-    // Build the tree.
-    PODRedBlackTree<int> tree;
-    Vector<int> values;
-    for (int i = 0; i < treeSize; i++) {
-        int value = nextRandom(maximumValue);
-        tree.add(value);
-        ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed;
-        values.append(value);
-    }
-    // Churn the tree's contents.
-    for (int i = 0; i < treeSize; i++) {
-        // Pick a random value to remove.
-        int index = nextRandom(treeSize);
-        int value = values[index];
-        // Remove this value.
-        tree.remove(value);
-        ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed;
-        // Replace it with a new one.
-        value = nextRandom(maximumValue);
-        values[index] = value;
-        tree.add(value);
-        ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed;
-    }
-}
-} // anonymous namespace
-
-TEST(PODRedBlackTreeTest, RandomDeletionAndInsertionRegressionTest1)
-{
-    InsertionAndDeletionTest(12311, 100);
-}
-
-TEST(PODRedBlackTreeTest, TestRandomDeletionAndInsertion)
-{
-    InsertionAndDeletionTest(generateSeed(), 100);
-}
-
-} // namespace WebCore
diff --git a/Source/core/tests/TreeTestHelpers.cpp b/Source/core/tests/TreeTestHelpers.cpp
deleted file mode 100644
index c7f404c..0000000
--- a/Source/core/tests/TreeTestHelpers.cpp
+++ /dev/null
@@ -1,60 +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.
- */
-
-#include "config.h"
-#include "TreeTestHelpers.h"
-
-#include "wtf/CurrentTime.h"
-
-#include <cstdlib>
-
-namespace WebCore {
-namespace TreeTestHelpers {
-
-int32_t generateSeed()
-{
-    // A seed of 1 has the special behavior of resetting the random
-    // number generator. Assume that if we call this routine that we
-    // don't want this behavior.
-    int32_t seed;
-    do {
-        seed = static_cast<int32_t>(currentTime());
-    } while (seed <= 1);
-    return seed;
-}
-
-void initRandom(const int32_t seed)
-{
-    srand(seed);
-}
-
-int32_t nextRandom(const int32_t maximumValue)
-{
-    // rand_r is not available on Windows
-    return rand() % maximumValue;
-}
-
-} // namespace TreeTestHelpers
-} // namespace WebCore
diff --git a/Source/core/tests/TreeTestHelpers.h b/Source/core/tests/TreeTestHelpers.h
deleted file mode 100644
index af07b2a..0000000
--- a/Source/core/tests/TreeTestHelpers.h
+++ /dev/null
@@ -1,53 +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.
- */
-
-// Simple pseudorandom number generator helper functions, used by the
-// red-black and interval tree tests.
-//
-// These are **not** thread safe!
-
-#ifndef TreeTestHelpers_h
-#define TreeTestHelpers_h
-
-#include <stdint.h>
-
-namespace WebCore {
-namespace TreeTestHelpers {
-
-// Generates a seed value to be passed to initRandom().
-int32_t generateSeed();
-
-// Initializes the pseudo-random number generator with a specific seed.
-void initRandom(const int32_t seed);
-
-// Produces the next pseudo-random number in the sequence, in the
-// range from [0..maximumValue). Negative numbers are not allowed and will
-// produce undefined results.
-int32_t nextRandom(const int32_t maximumValue);
-
-} // namespace TreeTestHelpers
-} // namespace WebCore
-
-#endif // TreeTestHelpers_h
diff --git a/Source/core/timing/MemoryInfo.cpp b/Source/core/timing/MemoryInfo.cpp
new file mode 100644
index 0000000..3978482
--- /dev/null
+++ b/Source/core/timing/MemoryInfo.cpp
@@ -0,0 +1,150 @@
+/*
+ * 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/timing/MemoryInfo.h"
+
+#include <limits>
+#include "bindings/v8/ScriptGCEvent.h"
+#include "core/frame/Frame.h"
+#include "core/page/Settings.h"
+#include "wtf/CurrentTime.h"
+#include "wtf/MainThread.h"
+#include "wtf/MathExtras.h"
+
+namespace WebCore {
+
+
+class HeapSizeCache {
+    WTF_MAKE_NONCOPYABLE(HeapSizeCache); WTF_MAKE_FAST_ALLOCATED;
+public:
+    HeapSizeCache()
+        : m_lastUpdateTime(0)
+    {
+    }
+
+    void getCachedHeapSize(HeapInfo& info)
+    {
+        maybeUpdate();
+        info = m_info;
+    }
+
+private:
+    void maybeUpdate()
+    {
+        // We rate-limit queries to once every twenty minutes to make it more difficult
+        // for attackers to compare memory usage before and after some event.
+        const double TwentyMinutesInSeconds = 20 * 60;
+
+        double now = monotonicallyIncreasingTime();
+        if (now - m_lastUpdateTime >= TwentyMinutesInSeconds) {
+            update();
+            m_lastUpdateTime = now;
+        }
+    }
+
+    void update()
+    {
+        ScriptGCEvent::getHeapSize(m_info);
+        m_info.usedJSHeapSize = quantizeMemorySize(m_info.usedJSHeapSize);
+        m_info.totalJSHeapSize = quantizeMemorySize(m_info.totalJSHeapSize);
+        m_info.jsHeapSizeLimit = quantizeMemorySize(m_info.jsHeapSizeLimit);
+    }
+
+    double m_lastUpdateTime;
+
+    HeapInfo m_info;
+};
+
+// We quantize the sizes to make it more difficult for an attacker to see precise
+// impact of operations on memory. The values are used for performance tuning,
+// and hence don't need to be as refined when the value is large, so we threshold
+// at a list of exponentially separated buckets.
+size_t quantizeMemorySize(size_t size)
+{
+    const int numberOfBuckets = 100;
+    DEFINE_STATIC_LOCAL(Vector<size_t>, bucketSizeList, ());
+
+    ASSERT(isMainThread());
+    if (bucketSizeList.isEmpty()) {
+        bucketSizeList.resize(numberOfBuckets);
+
+        float sizeOfNextBucket = 10000000.0; // First bucket size is roughly 10M.
+        const float largestBucketSize = 4000000000.0; // Roughly 4GB.
+        // We scale with the Nth root of the ratio, so that we use all the bucktes.
+        const float scalingFactor = exp(log(largestBucketSize / sizeOfNextBucket) / numberOfBuckets);
+
+        size_t nextPowerOfTen = static_cast<size_t>(pow(10, floor(log10(sizeOfNextBucket)) + 1) + 0.5);
+        size_t granularity = nextPowerOfTen / 1000; // We want 3 signficant digits.
+
+        for (int i = 0; i < numberOfBuckets; ++i) {
+            size_t currentBucketSize = static_cast<size_t>(sizeOfNextBucket);
+            bucketSizeList[i] = currentBucketSize - (currentBucketSize % granularity);
+
+            sizeOfNextBucket *= scalingFactor;
+            if (sizeOfNextBucket >= nextPowerOfTen) {
+                if (std::numeric_limits<size_t>::max() / 10 <= nextPowerOfTen) {
+                    nextPowerOfTen = std::numeric_limits<size_t>::max();
+                } else {
+                    nextPowerOfTen *= 10;
+                    granularity *= 10;
+                }
+            }
+
+            // Watch out for overflow, if the range is too large for size_t.
+            if (i > 0 && bucketSizeList[i] < bucketSizeList[i - 1])
+                bucketSizeList[i] = std::numeric_limits<size_t>::max();
+        }
+    }
+
+    for (int i = 0; i < numberOfBuckets; ++i) {
+        if (size <= bucketSizeList[i])
+            return bucketSizeList[i];
+    }
+
+    return bucketSizeList[numberOfBuckets - 1];
+}
+
+
+MemoryInfo::MemoryInfo(Frame* frame)
+{
+    ScriptWrappable::init(this);
+    if (!frame || !frame->settings())
+        return;
+
+    if (frame->settings()->memoryInfoEnabled()) {
+        ScriptGCEvent::getHeapSize(m_info);
+    } else {
+        DEFINE_STATIC_LOCAL(HeapSizeCache, heapSizeCache, ());
+        heapSizeCache.getCachedHeapSize(m_info);
+    }
+}
+
+} // namespace WebCore
diff --git a/Source/core/page/MemoryInfo.h b/Source/core/timing/MemoryInfo.h
similarity index 100%
rename from Source/core/page/MemoryInfo.h
rename to Source/core/timing/MemoryInfo.h
diff --git a/Source/core/page/MemoryInfo.idl b/Source/core/timing/MemoryInfo.idl
similarity index 100%
rename from Source/core/page/MemoryInfo.idl
rename to Source/core/timing/MemoryInfo.idl
diff --git a/Source/core/timing/Performance.cpp b/Source/core/timing/Performance.cpp
new file mode 100644
index 0000000..95f4728
--- /dev/null
+++ b/Source/core/timing/Performance.cpp
@@ -0,0 +1,284 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Intel 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/timing/Performance.h"
+
+#include "core/dom/Document.h"
+#include "core/loader/DocumentLoader.h"
+#include "core/timing/ResourceTimingInfo.h"
+#include "core/timing/MemoryInfo.h"
+#include "core/timing/PerformanceEntry.h"
+#include "core/timing/PerformanceNavigation.h"
+#include "core/timing/PerformanceResourceTiming.h"
+#include "core/timing/PerformanceTiming.h"
+#include "core/timing/PerformanceUserTiming.h"
+#include "weborigin/SecurityOrigin.h"
+#include "wtf/CurrentTime.h"
+
+#include "core/frame/Frame.h"
+
+namespace WebCore {
+
+static const size_t defaultResourceTimingBufferSize = 150;
+
+Performance::Performance(Frame* frame)
+    : DOMWindowProperty(frame)
+    , m_resourceTimingBufferSize(defaultResourceTimingBufferSize)
+    , m_userTiming(0)
+    , m_referenceTime(frame->document()->loader()->timing()->referenceMonotonicTime())
+{
+    ASSERT(m_referenceTime);
+    ScriptWrappable::init(this);
+}
+
+Performance::~Performance()
+{
+}
+
+const AtomicString& Performance::interfaceName() const
+{
+    return EventTargetNames::Performance;
+}
+
+ExecutionContext* Performance::executionContext() const
+{
+    if (!frame())
+        return 0;
+    return frame()->document();
+}
+
+PassRefPtr<MemoryInfo> Performance::memory() const
+{
+    return MemoryInfo::create(m_frame);
+}
+
+PerformanceNavigation* Performance::navigation() const
+{
+    if (!m_navigation)
+        m_navigation = PerformanceNavigation::create(m_frame);
+
+    return m_navigation.get();
+}
+
+PerformanceTiming* Performance::timing() const
+{
+    if (!m_timing)
+        m_timing = PerformanceTiming::create(m_frame);
+
+    return m_timing.get();
+}
+
+Vector<RefPtr<PerformanceEntry> > Performance::getEntries() const
+{
+    Vector<RefPtr<PerformanceEntry> > entries;
+
+    entries.append(m_resourceTimingBuffer);
+
+    if (m_userTiming) {
+        entries.append(m_userTiming->getMarks());
+        entries.append(m_userTiming->getMeasures());
+    }
+
+    std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompareLessThan);
+    return entries;
+}
+
+Vector<RefPtr<PerformanceEntry> > Performance::getEntriesByType(const String& entryType)
+{
+    Vector<RefPtr<PerformanceEntry> > entries;
+
+    if (equalIgnoringCase(entryType, "resource"))
+        for (Vector<RefPtr<PerformanceEntry> >::const_iterator resource = m_resourceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
+            entries.append(*resource);
+
+    if (m_userTiming) {
+        if (equalIgnoringCase(entryType, "mark"))
+            entries.append(m_userTiming->getMarks());
+        else if (equalIgnoringCase(entryType, "measure"))
+            entries.append(m_userTiming->getMeasures());
+    }
+
+    std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompareLessThan);
+    return entries;
+}
+
+Vector<RefPtr<PerformanceEntry> > Performance::getEntriesByName(const String& name, const String& entryType)
+{
+    Vector<RefPtr<PerformanceEntry> > entries;
+
+    if (entryType.isNull() || equalIgnoringCase(entryType, "resource"))
+        for (Vector<RefPtr<PerformanceEntry> >::const_iterator resource = m_resourceTimingBuffer.begin(); resource != m_resourceTimingBuffer.end(); ++resource)
+            if ((*resource)->name() == name)
+                entries.append(*resource);
+
+    if (m_userTiming) {
+        if (entryType.isNull() || equalIgnoringCase(entryType, "mark"))
+            entries.append(m_userTiming->getMarks(name));
+        if (entryType.isNull() || equalIgnoringCase(entryType, "measure"))
+            entries.append(m_userTiming->getMeasures(name));
+    }
+
+    std::sort(entries.begin(), entries.end(), PerformanceEntry::startTimeCompareLessThan);
+    return entries;
+}
+
+void Performance::webkitClearResourceTimings()
+{
+    m_resourceTimingBuffer.clear();
+}
+
+void Performance::webkitSetResourceTimingBufferSize(unsigned size)
+{
+    m_resourceTimingBufferSize = size;
+    if (isResourceTimingBufferFull())
+        dispatchEvent(Event::create(EventTypeNames::webkitresourcetimingbufferfull));
+}
+
+static bool passesTimingAllowCheck(const ResourceResponse& response, Document* requestingDocument)
+{
+    AtomicallyInitializedStatic(AtomicString&, timingAllowOrigin = *new AtomicString("timing-allow-origin"));
+
+    RefPtr<SecurityOrigin> resourceOrigin = SecurityOrigin::create(response.url());
+    if (resourceOrigin->isSameSchemeHostPort(requestingDocument->securityOrigin()))
+        return true;
+
+    const String& timingAllowOriginString = response.httpHeaderField(timingAllowOrigin);
+    if (timingAllowOriginString.isEmpty() || equalIgnoringCase(timingAllowOriginString, "null"))
+        return false;
+
+    if (timingAllowOriginString == "*")
+        return true;
+
+    const String& securityOrigin = requestingDocument->securityOrigin()->toString();
+    Vector<String> timingAllowOrigins;
+    timingAllowOriginString.split(" ", timingAllowOrigins);
+    for (size_t i = 0; i < timingAllowOrigins.size(); ++i) {
+        if (timingAllowOrigins[i] == securityOrigin)
+            return true;
+    }
+
+    return false;
+}
+
+static bool allowsTimingRedirect(const Vector<ResourceResponse>& redirectChain, const ResourceResponse& finalResponse, Document* initiatorDocument)
+{
+    if (!passesTimingAllowCheck(finalResponse, initiatorDocument))
+        return false;
+
+    for (size_t i = 0; i < redirectChain.size(); i++) {
+        if (!passesTimingAllowCheck(redirectChain[i], initiatorDocument))
+            return false;
+    }
+
+    return true;
+}
+
+void Performance::addResourceTiming(const ResourceTimingInfo& info, Document* initiatorDocument)
+{
+    if (isResourceTimingBufferFull())
+        return;
+
+    const ResourceResponse& finalResponse = info.finalResponse();
+    bool allowTimingDetails = passesTimingAllowCheck(finalResponse, initiatorDocument);
+    double startTime = info.initialTime();
+
+    if (info.redirectChain().isEmpty()) {
+        RefPtr<PerformanceEntry> entry = PerformanceResourceTiming::create(info, initiatorDocument, startTime, allowTimingDetails);
+        addResourceTimingBuffer(entry);
+        return;
+    }
+
+    const Vector<ResourceResponse>& redirectChain = info.redirectChain();
+    bool allowRedirectDetails = allowsTimingRedirect(redirectChain, finalResponse, initiatorDocument);
+
+    if (!allowRedirectDetails) {
+        ResourceLoadTiming* finalTiming = finalResponse.resourceLoadTiming();
+        ASSERT(finalTiming);
+        if (finalTiming)
+            startTime = finalTiming->requestTime;
+    }
+
+    ResourceLoadTiming* lastRedirectTiming = redirectChain.last().resourceLoadTiming();
+    ASSERT(lastRedirectTiming);
+    double lastRedirectEndTime = lastRedirectTiming->receiveHeadersEnd;
+
+    RefPtr<PerformanceEntry> entry = PerformanceResourceTiming::create(info, initiatorDocument, startTime, lastRedirectEndTime, allowTimingDetails, allowRedirectDetails);
+    addResourceTimingBuffer(entry);
+}
+
+void Performance::addResourceTimingBuffer(PassRefPtr<PerformanceEntry> entry)
+{
+    m_resourceTimingBuffer.append(entry);
+
+    if (isResourceTimingBufferFull())
+        dispatchEvent(Event::create(EventTypeNames::webkitresourcetimingbufferfull));
+}
+
+bool Performance::isResourceTimingBufferFull()
+{
+    return m_resourceTimingBuffer.size() >= m_resourceTimingBufferSize;
+}
+
+void Performance::mark(const String& markName, ExceptionState& es)
+{
+    if (!m_userTiming)
+        m_userTiming = UserTiming::create(this);
+    m_userTiming->mark(markName, es);
+}
+
+void Performance::clearMarks(const String& markName)
+{
+    if (!m_userTiming)
+        m_userTiming = UserTiming::create(this);
+    m_userTiming->clearMarks(markName);
+}
+
+void Performance::measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState& es)
+{
+    if (!m_userTiming)
+        m_userTiming = UserTiming::create(this);
+    m_userTiming->measure(measureName, startMark, endMark, es);
+}
+
+void Performance::clearMeasures(const String& measureName)
+{
+    if (!m_userTiming)
+        m_userTiming = UserTiming::create(this);
+    m_userTiming->clearMeasures(measureName);
+}
+
+double Performance::now() const
+{
+    return 1000.0 * (monotonicallyIncreasingTime() - m_referenceTime);
+}
+
+} // namespace WebCore
diff --git a/Source/core/timing/Performance.h b/Source/core/timing/Performance.h
new file mode 100644
index 0000000..87709cb
--- /dev/null
+++ b/Source/core/timing/Performance.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Intel 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 Performance_h
+#define Performance_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/events/EventTarget.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "core/timing/MemoryInfo.h"
+#include "core/timing/PerformanceEntry.h"
+#include "core/timing/PerformanceNavigation.h"
+#include "core/timing/PerformanceTiming.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class Document;
+class ExceptionState;
+class ResourceRequest;
+class ResourceResponse;
+class ResourceTimingInfo;
+class UserTiming;
+
+class Performance : public ScriptWrappable, public RefCounted<Performance>, public DOMWindowProperty, public EventTargetWithInlineData {
+public:
+    static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Performance(frame)); }
+    ~Performance();
+
+    virtual const AtomicString& interfaceName() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
+
+    PassRefPtr<MemoryInfo> memory() const;
+    PerformanceNavigation* navigation() const;
+    PerformanceTiming* timing() const;
+    double now() const;
+
+    Vector<RefPtr<PerformanceEntry> > getEntries() const;
+    Vector<RefPtr<PerformanceEntry> > getEntriesByType(const String& entryType);
+    Vector<RefPtr<PerformanceEntry> > getEntriesByName(const String& name, const String& entryType);
+
+    void webkitClearResourceTimings();
+    void webkitSetResourceTimingBufferSize(unsigned int);
+
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull);
+
+    void addResourceTiming(const ResourceTimingInfo&, Document*);
+
+    using RefCounted<Performance>::ref;
+    using RefCounted<Performance>::deref;
+
+    void mark(const String& markName, ExceptionState&);
+    void clearMarks(const String& markName);
+
+    void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState&);
+    void clearMeasures(const String& measureName);
+
+private:
+    explicit Performance(Frame*);
+
+    virtual void refEventTarget() OVERRIDE { ref(); }
+    virtual void derefEventTarget() OVERRIDE { deref(); }
+
+    bool isResourceTimingBufferFull();
+    void addResourceTimingBuffer(PassRefPtr<PerformanceEntry>);
+
+    mutable RefPtr<PerformanceNavigation> m_navigation;
+    mutable RefPtr<PerformanceTiming> m_timing;
+
+    Vector<RefPtr<PerformanceEntry> > m_resourceTimingBuffer;
+    unsigned m_resourceTimingBufferSize;
+    double m_referenceTime;
+
+    RefPtr<UserTiming> m_userTiming;
+};
+
+}
+
+#endif // Performance_h
diff --git a/Source/core/timing/Performance.idl b/Source/core/timing/Performance.idl
new file mode 100644
index 0000000..b29b83e
--- /dev/null
+++ b/Source/core/timing/Performance.idl
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Intel 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.
+ */
+
+// See: http://www.w3.org/TR/navigation-timing/
+interface Performance : EventTarget {
+    readonly attribute PerformanceNavigation navigation;
+    readonly attribute PerformanceTiming timing;
+    readonly attribute MemoryInfo memory;
+
+    [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntries();
+    [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByType(DOMString entryType);
+    [MeasureAs=UnprefixedPerformanceTimeline] sequence<PerformanceEntry> getEntriesByName(DOMString name, [Default=NullString] optional DOMString entryType);
+    [DeprecateAs=PrefixedPerformanceTimeline,ImplementedAs=getEntries] sequence<PerformanceEntry> webkitGetEntries();
+    [DeprecateAs=PrefixedPerformanceTimeline,ImplementedAs=getEntriesByType] sequence<PerformanceEntry> webkitGetEntriesByType(DOMString entryType);
+    [DeprecateAs=PrefixedPerformanceTimeline,ImplementedAs=getEntriesByName] sequence<PerformanceEntry> webkitGetEntriesByName(DOMString name, [Default=NullString] optional DOMString entryType);
+
+    void webkitClearResourceTimings();
+    void webkitSetResourceTimingBufferSize(unsigned long maxSize);
+
+    attribute EventHandler onwebkitresourcetimingbufferfull;
+
+    // See http://www.w3.org/TR/2012/CR-user-timing-20120726/
+    [RaisesException,MeasureAs=UnprefixedUserTiming] void mark(DOMString markName);
+    [MeasureAs=UnprefixedUserTiming] void clearMarks([Default=NullString] optional  DOMString markName);
+
+    [RaisesException,MeasureAs=UnprefixedUserTiming] void measure(DOMString measureName, [Default=NullString] optional DOMString startMark, [Default=NullString] optional DOMString endMark);
+    [MeasureAs=UnprefixedUserTiming] void clearMeasures([Default=NullString] optional DOMString measureName);
+
+    [RaisesException,DeprecateAs=PrefixedUserTiming,ImplementedAs=mark] void webkitMark(DOMString markName);
+    [DeprecateAs=PrefixedUserTiming,ImplementedAs=clearMarks] void webkitClearMarks([Default=NullString] optional  DOMString markName);
+
+    [RaisesException,DeprecateAs=PrefixedUserTiming,ImplementedAs=measure] void webkitMeasure(DOMString measureName, [Default=NullString] optional DOMString startMark, [Default=NullString] optional DOMString endMark);
+    [DeprecateAs=PrefixedUserTiming,ImplementedAs=clearMeasures] void webkitClearMeasures([Default=NullString] optional DOMString measureName);
+
+    // See http://www.w3.org/TR/hr-time/ for details.
+    double now();
+};
+
diff --git a/Source/core/timing/PerformanceEntry.cpp b/Source/core/timing/PerformanceEntry.cpp
new file mode 100644
index 0000000..ee61528
--- /dev/null
+++ b/Source/core/timing/PerformanceEntry.cpp
@@ -0,0 +1,69 @@
+/*
+ * 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:
+ *
+ *     * 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/timing/PerformanceEntry.h"
+
+namespace WebCore {
+
+PerformanceEntry::PerformanceEntry(const String& name, const String& entryType, double startTime, double finishTime)
+    : m_name(name)
+    , m_entryType(entryType)
+    , m_startTime(startTime)
+    , m_duration(finishTime - startTime)
+{
+    ScriptWrappable::init(this);
+}
+
+PerformanceEntry::~PerformanceEntry()
+{
+}
+
+String PerformanceEntry::name() const
+{
+    return m_name;
+}
+
+String PerformanceEntry::entryType() const
+{
+    return m_entryType;
+}
+
+double PerformanceEntry::startTime() const
+{
+    return m_startTime;
+}
+
+double PerformanceEntry::duration() const
+{
+    return m_duration;
+}
+
+} // namespace WebCore
diff --git a/Source/core/page/PerformanceEntry.h b/Source/core/timing/PerformanceEntry.h
similarity index 100%
rename from Source/core/page/PerformanceEntry.h
rename to Source/core/timing/PerformanceEntry.h
diff --git a/Source/core/page/PerformanceEntry.idl b/Source/core/timing/PerformanceEntry.idl
similarity index 100%
rename from Source/core/page/PerformanceEntry.idl
rename to Source/core/timing/PerformanceEntry.idl
diff --git a/Source/core/timing/PerformanceMark.h b/Source/core/timing/PerformanceMark.h
new file mode 100644
index 0000000..793a7cd
--- /dev/null
+++ b/Source/core/timing/PerformanceMark.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 Intel 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 PerformanceMark_h
+#define PerformanceMark_h
+
+#include "core/timing/PerformanceEntry.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class PerformanceMark : public PerformanceEntry {
+public:
+    static PassRefPtr<PerformanceMark> create(const String& name, double startTime) { return adoptRef(new PerformanceMark(name, startTime)); }
+
+    virtual bool isMark() { return true; }
+
+private:
+    PerformanceMark(const String& name, double startTime) : PerformanceEntry(name, "mark", startTime, startTime)
+    {
+        ScriptWrappable::init(this);
+    }
+
+    ~PerformanceMark() { }
+};
+
+}
+
+#endif // !defined(PerformanceMark_h)
diff --git a/Source/core/page/PerformanceMark.idl b/Source/core/timing/PerformanceMark.idl
similarity index 100%
rename from Source/core/page/PerformanceMark.idl
rename to Source/core/timing/PerformanceMark.idl
diff --git a/Source/core/timing/PerformanceMeasure.h b/Source/core/timing/PerformanceMeasure.h
new file mode 100644
index 0000000..9d24142
--- /dev/null
+++ b/Source/core/timing/PerformanceMeasure.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2012 Intel 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 PerformanceMeasure_h
+#define PerformanceMeasure_h
+
+#include "core/timing/PerformanceEntry.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class PerformanceMeasure : public PerformanceEntry {
+public:
+    static PassRefPtr<PerformanceMeasure> create(const String& name, double startTime, double endTime) { return adoptRef(new PerformanceMeasure(name, startTime, endTime)); }
+
+    virtual bool isMeasure() { return true; }
+
+private:
+    PerformanceMeasure(const String& name, double startTime, double endTime) : PerformanceEntry(name, "measure", startTime, endTime)
+    {
+        ScriptWrappable::init(this);
+    }
+    ~PerformanceMeasure() { }
+};
+
+}
+
+#endif // !defined(PerformanceMeasure_h)
diff --git a/Source/core/page/PerformanceMeasure.idl b/Source/core/timing/PerformanceMeasure.idl
similarity index 100%
rename from Source/core/page/PerformanceMeasure.idl
rename to Source/core/timing/PerformanceMeasure.idl
diff --git a/Source/core/timing/PerformanceNavigation.cpp b/Source/core/timing/PerformanceNavigation.cpp
new file mode 100644
index 0000000..2a19b71
--- /dev/null
+++ b/Source/core/timing/PerformanceNavigation.cpp
@@ -0,0 +1,82 @@
+/*
+ * 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/timing/PerformanceNavigation.h"
+
+#include "core/loader/DocumentLoader.h"
+#include "core/loader/FrameLoaderTypes.h"
+#include "core/frame/Frame.h"
+
+namespace WebCore {
+
+PerformanceNavigation::PerformanceNavigation(Frame* frame)
+    : DOMWindowProperty(frame)
+{
+    ScriptWrappable::init(this);
+}
+
+unsigned short PerformanceNavigation::type() const
+{
+    if (!m_frame)
+        return TYPE_NAVIGATE;
+
+    DocumentLoader* documentLoader = m_frame->loader()->documentLoader();
+    if (!documentLoader)
+        return TYPE_NAVIGATE;
+
+    WebCore::NavigationType navigationType = documentLoader->triggeringAction().type();
+    switch (navigationType) {
+    case NavigationTypeReload:
+        return TYPE_RELOAD;
+    case NavigationTypeBackForward:
+        return TYPE_BACK_FORWARD;
+    default:
+        return TYPE_NAVIGATE;
+    }
+}
+
+unsigned short PerformanceNavigation::redirectCount() const
+{
+    if (!m_frame)
+        return 0;
+
+    DocumentLoader* loader = m_frame->loader()->documentLoader();
+    if (!loader)
+        return 0;
+
+    DocumentLoadTiming* timing = loader->timing();
+    if (timing->hasCrossOriginRedirect())
+        return 0;
+
+    return timing->redirectCount();
+}
+
+} // namespace WebCore
diff --git a/Source/core/timing/PerformanceNavigation.h b/Source/core/timing/PerformanceNavigation.h
new file mode 100644
index 0000000..2444b39
--- /dev/null
+++ b/Source/core/timing/PerformanceNavigation.h
@@ -0,0 +1,63 @@
+/*
+ * 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 PerformanceNavigation_h
+#define PerformanceNavigation_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class Frame;
+
+class PerformanceNavigation : public RefCounted<PerformanceNavigation>, public ScriptWrappable, public DOMWindowProperty {
+public:
+    static PassRefPtr<PerformanceNavigation> create(Frame* frame) { return adoptRef(new PerformanceNavigation(frame)); }
+
+    enum PerformanceNavigationType {
+        TYPE_NAVIGATE,
+        TYPE_RELOAD,
+        TYPE_BACK_FORWARD,
+        TYPE_RESERVED = 255
+    };
+
+    unsigned short type() const;
+    unsigned short redirectCount() const;
+
+private:
+    explicit PerformanceNavigation(Frame*);
+};
+
+}
+
+#endif // !defined(PerformanceNavigation_h)
diff --git a/Source/core/page/PerformanceNavigation.idl b/Source/core/timing/PerformanceNavigation.idl
similarity index 100%
rename from Source/core/page/PerformanceNavigation.idl
rename to Source/core/timing/PerformanceNavigation.idl
diff --git a/Source/core/timing/PerformanceResourceTiming.cpp b/Source/core/timing/PerformanceResourceTiming.cpp
new file mode 100644
index 0000000..3620a89
--- /dev/null
+++ b/Source/core/timing/PerformanceResourceTiming.cpp
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Intel 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/timing/PerformanceResourceTiming.h"
+
+#include "core/dom/Document.h"
+#include "core/loader/DocumentLoadTiming.h"
+#include "core/loader/DocumentLoader.h"
+#include "core/timing/ResourceTimingInfo.h"
+#include "core/platform/network/ResourceRequest.h"
+#include "core/platform/network/ResourceResponse.h"
+
+namespace WebCore {
+
+static double monotonicTimeToDocumentMilliseconds(Document* document, double seconds)
+{
+    ASSERT(seconds >= 0.0);
+    return document->loader()->timing()->monotonicTimeToZeroBasedDocumentTime(seconds) * 1000.0;
+}
+
+PerformanceResourceTiming::PerformanceResourceTiming(const ResourceTimingInfo& info, Document* requestingDocument, double startTime, double lastRedirectEndTime, bool allowTimingDetails, bool allowRedirectDetails)
+    : PerformanceEntry(info.initialRequest().url().string(), "resource", monotonicTimeToDocumentMilliseconds(requestingDocument, startTime), monotonicTimeToDocumentMilliseconds(requestingDocument, info.loadFinishTime()))
+    , m_initiatorType(info.initiatorType())
+    , m_timing(info.finalResponse().resourceLoadTiming())
+    , m_lastRedirectEndTime(lastRedirectEndTime)
+    , m_finishTime(info.loadFinishTime())
+    , m_didReuseConnection(info.finalResponse().connectionReused())
+    , m_allowTimingDetails(allowTimingDetails)
+    , m_allowRedirectDetails(allowRedirectDetails)
+    , m_requestingDocument(requestingDocument)
+{
+    ScriptWrappable::init(this);
+}
+
+PerformanceResourceTiming::~PerformanceResourceTiming()
+{
+}
+
+AtomicString PerformanceResourceTiming::initiatorType() const
+{
+    return m_initiatorType;
+}
+
+double PerformanceResourceTiming::redirectStart() const
+{
+    if (!m_lastRedirectEndTime || !m_allowRedirectDetails)
+        return 0.0;
+
+    return PerformanceEntry::startTime();
+}
+
+double PerformanceResourceTiming::redirectEnd() const
+{
+    if (!m_lastRedirectEndTime || !m_allowRedirectDetails)
+        return 0.0;
+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_lastRedirectEndTime);
+}
+
+double PerformanceResourceTiming::fetchStart() const
+{
+    if (m_lastRedirectEndTime) {
+        // FIXME: ASSERT(m_timing) should be in constructor once timeticks of
+        // AppCache is exposed from chrome network stack, crbug/251100
+        ASSERT(m_timing);
+        return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->requestTime);
+    }
+
+    return PerformanceEntry::startTime();
+}
+
+double PerformanceResourceTiming::domainLookupStart() const
+{
+    if (!m_allowTimingDetails)
+        return 0.0;
+
+    if (!m_timing || m_timing->dnsStart == 0.0)
+        return fetchStart();
+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->dnsStart);
+}
+
+double PerformanceResourceTiming::domainLookupEnd() const
+{
+    if (!m_allowTimingDetails)
+        return 0.0;
+
+    if (!m_timing || m_timing->dnsEnd == 0.0)
+        return domainLookupStart();
+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->dnsEnd);
+}
+
+double PerformanceResourceTiming::connectStart() const
+{
+    if (!m_allowTimingDetails)
+        return 0.0;
+
+    // connectStart will be zero when a network request is not made.
+    if (!m_timing || m_timing->connectStart == 0.0 || m_didReuseConnection)
+        return domainLookupEnd();
+
+    // connectStart includes any DNS time, so we may need to trim that off.
+    double connectStart = m_timing->connectStart;
+    if (m_timing->dnsEnd > 0.0)
+        connectStart = m_timing->dnsEnd;
+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), connectStart);
+}
+
+double PerformanceResourceTiming::connectEnd() const
+{
+    if (!m_allowTimingDetails)
+        return 0.0;
+
+    // connectStart will be zero when a network request is not made.
+    if (!m_timing || m_timing->connectEnd == 0.0 || m_didReuseConnection)
+        return connectStart();
+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->connectEnd);
+}
+
+double PerformanceResourceTiming::secureConnectionStart() const
+{
+    if (!m_allowTimingDetails)
+        return 0.0;
+
+    if (!m_timing || m_timing->sslStart == 0.0) // Secure connection not negotiated.
+        return 0.0;
+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->sslStart);
+}
+
+double PerformanceResourceTiming::requestStart() const
+{
+    if (!m_allowTimingDetails)
+        return 0.0;
+
+    if (!m_timing)
+        return connectEnd();
+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->sendStart);
+}
+
+double PerformanceResourceTiming::responseStart() const
+{
+    if (!m_allowTimingDetails)
+        return 0.0;
+
+    if (!m_timing)
+        return requestStart();
+
+    // FIXME: This number isn't exactly correct. See the notes in PerformanceTiming::responseStart().
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_timing->receiveHeadersEnd);
+}
+
+double PerformanceResourceTiming::responseEnd() const
+{
+    if (!m_finishTime)
+        return responseStart();
+
+    return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_finishTime);
+}
+
+} // namespace WebCore
diff --git a/Source/core/timing/PerformanceResourceTiming.h b/Source/core/timing/PerformanceResourceTiming.h
new file mode 100644
index 0000000..2c1c7ad
--- /dev/null
+++ b/Source/core/timing/PerformanceResourceTiming.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Intel 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 PerformanceResourceTiming_h
+#define PerformanceResourceTiming_h
+
+#include "core/timing/PerformanceEntry.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+class Document;
+class KURL;
+class ResourceLoadTiming;
+class ResourceRequest;
+class ResourceResponse;
+class ResourceTimingInfo;
+
+class PerformanceResourceTiming : public PerformanceEntry {
+public:
+    static PassRefPtr<PerformanceResourceTiming> create(const ResourceTimingInfo& info, Document* requestingDocument, double startTime, double lastRedirectEndTime, bool m_allowTimingDetails, bool m_allowRedirectDetails)
+    {
+        return adoptRef(new PerformanceResourceTiming(info, requestingDocument, startTime, lastRedirectEndTime, m_allowTimingDetails, m_allowRedirectDetails));
+    }
+
+    static PassRefPtr<PerformanceResourceTiming> create(const ResourceTimingInfo& info, Document* requestingDocument, double startTime, bool m_allowTimingDetails)
+    {
+        return adoptRef(new PerformanceResourceTiming(info, requestingDocument, startTime, 0.0, m_allowTimingDetails, false));
+    }
+
+    AtomicString initiatorType() const;
+
+    double redirectStart() const;
+    double redirectEnd() const;
+    double fetchStart() const;
+    double domainLookupStart() const;
+    double domainLookupEnd() const;
+    double connectStart() const;
+    double connectEnd() const;
+    double secureConnectionStart() const;
+    double requestStart() const;
+    double responseStart() const;
+    double responseEnd() const;
+
+    virtual bool isResource() { return true; }
+
+private:
+    PerformanceResourceTiming(const ResourceTimingInfo&, Document* requestingDocument, double startTime, double lastRedirectEndTime, bool m_allowTimingDetails, bool m_allowRedirectDetails);
+    ~PerformanceResourceTiming();
+
+    AtomicString m_initiatorType;
+    RefPtr<ResourceLoadTiming> m_timing;
+    double m_lastRedirectEndTime;
+    double m_finishTime;
+    bool m_didReuseConnection;
+    bool m_allowTimingDetails;
+    bool m_allowRedirectDetails;
+    RefPtr<Document> m_requestingDocument;
+};
+
+}
+
+#endif // !defined(PerformanceResourceTiming_h)
diff --git a/Source/core/page/PerformanceResourceTiming.idl b/Source/core/timing/PerformanceResourceTiming.idl
similarity index 100%
rename from Source/core/page/PerformanceResourceTiming.idl
rename to Source/core/timing/PerformanceResourceTiming.idl
diff --git a/Source/core/timing/PerformanceTiming.cpp b/Source/core/timing/PerformanceTiming.cpp
new file mode 100644
index 0000000..21e8a2d
--- /dev/null
+++ b/Source/core/timing/PerformanceTiming.cpp
@@ -0,0 +1,356 @@
+/*
+ * 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/timing/PerformanceTiming.h"
+
+#include "core/dom/Document.h"
+#include "core/dom/DocumentTiming.h"
+#include "core/loader/DocumentLoadTiming.h"
+#include "core/loader/DocumentLoader.h"
+#include "core/loader/FrameLoader.h"
+#include "core/frame/Frame.h"
+#include "core/platform/network/ResourceLoadTiming.h"
+#include "core/platform/network/ResourceResponse.h"
+
+namespace WebCore {
+
+static unsigned long long toIntegerMilliseconds(double seconds)
+{
+    ASSERT(seconds >= 0);
+    return static_cast<unsigned long long>(seconds * 1000.0);
+}
+
+PerformanceTiming::PerformanceTiming(Frame* frame)
+    : DOMWindowProperty(frame)
+{
+    ScriptWrappable::init(this);
+}
+
+unsigned long long PerformanceTiming::navigationStart() const
+{
+    DocumentLoadTiming* timing = documentLoadTiming();
+    if (!timing)
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->navigationStart());
+}
+
+unsigned long long PerformanceTiming::unloadEventStart() const
+{
+    DocumentLoadTiming* timing = documentLoadTiming();
+    if (!timing)
+        return 0;
+
+    if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument())
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->unloadEventStart());
+}
+
+unsigned long long PerformanceTiming::unloadEventEnd() const
+{
+    DocumentLoadTiming* timing = documentLoadTiming();
+    if (!timing)
+        return 0;
+
+    if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument())
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->unloadEventEnd());
+}
+
+unsigned long long PerformanceTiming::redirectStart() const
+{
+    DocumentLoadTiming* timing = documentLoadTiming();
+    if (!timing)
+        return 0;
+
+    if (timing->hasCrossOriginRedirect())
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->redirectStart());
+}
+
+unsigned long long PerformanceTiming::redirectEnd() const
+{
+    DocumentLoadTiming* timing = documentLoadTiming();
+    if (!timing)
+        return 0;
+
+    if (timing->hasCrossOriginRedirect())
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->redirectEnd());
+}
+
+unsigned long long PerformanceTiming::fetchStart() const
+{
+    DocumentLoadTiming* timing = documentLoadTiming();
+    if (!timing)
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->fetchStart());
+}
+
+unsigned long long PerformanceTiming::domainLookupStart() const
+{
+    ResourceLoadTiming* timing = resourceLoadTiming();
+    if (!timing)
+        return fetchStart();
+
+    // This will be zero when a DNS request is not performed.
+    // Rather than exposing a special value that indicates no DNS, we "backfill" with fetchStart.
+    double dnsStart = timing->dnsStart;
+    if (dnsStart == 0.0)
+        return fetchStart();
+
+    return monotonicTimeToIntegerMilliseconds(dnsStart);
+}
+
+unsigned long long PerformanceTiming::domainLookupEnd() const
+{
+    ResourceLoadTiming* timing = resourceLoadTiming();
+    if (!timing)
+        return domainLookupStart();
+
+    // This will be zero when a DNS request is not performed.
+    // Rather than exposing a special value that indicates no DNS, we "backfill" with domainLookupStart.
+    double dnsEnd = timing->dnsEnd;
+    if (dnsEnd == 0.0)
+        return domainLookupStart();
+
+    return monotonicTimeToIntegerMilliseconds(dnsEnd);
+}
+
+unsigned long long PerformanceTiming::connectStart() const
+{
+    DocumentLoader* loader = documentLoader();
+    if (!loader)
+        return domainLookupEnd();
+
+    ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
+    if (!timing)
+        return domainLookupEnd();
+
+    // connectStart will be zero when a network request is not made.
+    // Rather than exposing a special value that indicates no new connection, we "backfill" with domainLookupEnd.
+    double connectStart = timing->connectStart;
+    if (connectStart == 0.0 || loader->response().connectionReused())
+        return domainLookupEnd();
+
+    // ResourceLoadTiming's connect phase includes DNS, however Navigation Timing's
+    // connect phase should not. So if there is DNS time, trim it from the start.
+    if (timing->dnsEnd > 0.0 && timing->dnsEnd > connectStart)
+        connectStart = timing->dnsEnd;
+
+    return monotonicTimeToIntegerMilliseconds(connectStart);
+}
+
+unsigned long long PerformanceTiming::connectEnd() const
+{
+    DocumentLoader* loader = documentLoader();
+    if (!loader)
+        return connectStart();
+
+    ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
+    if (!timing)
+        return connectStart();
+
+    // connectEnd will be zero when a network request is not made.
+    // Rather than exposing a special value that indicates no new connection, we "backfill" with connectStart.
+    double connectEnd = timing->connectEnd;
+    if (connectEnd == 0.0 || loader->response().connectionReused())
+        return connectStart();
+
+    return monotonicTimeToIntegerMilliseconds(connectEnd);
+}
+
+unsigned long long PerformanceTiming::secureConnectionStart() const
+{
+    DocumentLoader* loader = documentLoader();
+    if (!loader)
+        return 0;
+
+    ResourceLoadTiming* timing = loader->response().resourceLoadTiming();
+    if (!timing)
+        return 0;
+
+    double sslStart = timing->sslStart;
+    if (sslStart == 0.0)
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(sslStart);
+}
+
+unsigned long long PerformanceTiming::requestStart() const
+{
+    ResourceLoadTiming* timing = resourceLoadTiming();
+
+    if (!timing || timing->sendStart == 0.0)
+        return connectEnd();
+
+    return monotonicTimeToIntegerMilliseconds(timing->sendStart);
+}
+
+unsigned long long PerformanceTiming::responseStart() const
+{
+    ResourceLoadTiming* timing = resourceLoadTiming();
+    if (!timing || timing->receiveHeadersEnd == 0.0)
+        return requestStart();
+
+    // FIXME: Response start needs to be the time of the first received byte.
+    // However, the ResourceLoadTiming API currently only supports the time
+    // the last header byte was received. For many responses with reasonable
+    // sized cookies, the HTTP headers fit into a single packet so this time
+    // is basically equivalent. But for some responses, particularly those with
+    // headers larger than a single packet, this time will be too late.
+    return monotonicTimeToIntegerMilliseconds(timing->receiveHeadersEnd);
+}
+
+unsigned long long PerformanceTiming::responseEnd() const
+{
+    DocumentLoadTiming* timing = documentLoadTiming();
+    if (!timing)
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->responseEnd());
+}
+
+unsigned long long PerformanceTiming::domLoading() const
+{
+    const DocumentTiming* timing = documentTiming();
+    if (!timing)
+        return fetchStart();
+
+    return monotonicTimeToIntegerMilliseconds(timing->domLoading);
+}
+
+unsigned long long PerformanceTiming::domInteractive() const
+{
+    const DocumentTiming* timing = documentTiming();
+    if (!timing)
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->domInteractive);
+}
+
+unsigned long long PerformanceTiming::domContentLoadedEventStart() const
+{
+    const DocumentTiming* timing = documentTiming();
+    if (!timing)
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventStart);
+}
+
+unsigned long long PerformanceTiming::domContentLoadedEventEnd() const
+{
+    const DocumentTiming* timing = documentTiming();
+    if (!timing)
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventEnd);
+}
+
+unsigned long long PerformanceTiming::domComplete() const
+{
+    const DocumentTiming* timing = documentTiming();
+    if (!timing)
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->domComplete);
+}
+
+unsigned long long PerformanceTiming::loadEventStart() const
+{
+    DocumentLoadTiming* timing = documentLoadTiming();
+    if (!timing)
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->loadEventStart());
+}
+
+unsigned long long PerformanceTiming::loadEventEnd() const
+{
+    DocumentLoadTiming* timing = documentLoadTiming();
+    if (!timing)
+        return 0;
+
+    return monotonicTimeToIntegerMilliseconds(timing->loadEventEnd());
+}
+
+DocumentLoader* PerformanceTiming::documentLoader() const
+{
+    if (!m_frame)
+        return 0;
+
+    return m_frame->loader()->documentLoader();
+}
+
+const DocumentTiming* PerformanceTiming::documentTiming() const
+{
+    if (!m_frame)
+        return 0;
+
+    Document* document = m_frame->document();
+    if (!document)
+        return 0;
+
+    return document->timing();
+}
+
+DocumentLoadTiming* PerformanceTiming::documentLoadTiming() const
+{
+    DocumentLoader* loader = documentLoader();
+    if (!loader)
+        return 0;
+
+    return loader->timing();
+}
+
+ResourceLoadTiming* PerformanceTiming::resourceLoadTiming() const
+{
+    DocumentLoader* loader = documentLoader();
+    if (!loader)
+        return 0;
+
+    return loader->response().resourceLoadTiming();
+}
+
+unsigned long long PerformanceTiming::monotonicTimeToIntegerMilliseconds(double monotonicSeconds) const
+{
+    ASSERT(monotonicSeconds >= 0);
+    const DocumentLoadTiming* timing = documentLoadTiming();
+    ASSERT(timing);
+    return toIntegerMilliseconds(timing->monotonicTimeToPseudoWallTime(monotonicSeconds));
+}
+
+} // namespace WebCore
diff --git a/Source/core/timing/PerformanceTiming.h b/Source/core/timing/PerformanceTiming.h
new file mode 100644
index 0000000..cd8ffae
--- /dev/null
+++ b/Source/core/timing/PerformanceTiming.h
@@ -0,0 +1,86 @@
+/*
+ * 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 PerformanceTiming_h
+#define PerformanceTiming_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class DocumentLoadTiming;
+class DocumentLoader;
+struct DocumentTiming;
+class Frame;
+class ResourceLoadTiming;
+
+class PerformanceTiming : public RefCounted<PerformanceTiming>, public ScriptWrappable, public DOMWindowProperty {
+public:
+    static PassRefPtr<PerformanceTiming> create(Frame* frame) { return adoptRef(new PerformanceTiming(frame)); }
+
+    unsigned long long navigationStart() const;
+    unsigned long long unloadEventStart() const;
+    unsigned long long unloadEventEnd() const;
+    unsigned long long redirectStart() const;
+    unsigned long long redirectEnd() const;
+    unsigned long long fetchStart() const;
+    unsigned long long domainLookupStart() const;
+    unsigned long long domainLookupEnd() const;
+    unsigned long long connectStart() const;
+    unsigned long long connectEnd() const;
+    unsigned long long secureConnectionStart() const;
+    unsigned long long requestStart() const;
+    unsigned long long responseStart() const;
+    unsigned long long responseEnd() const;
+    unsigned long long domLoading() const;
+    unsigned long long domInteractive() const;
+    unsigned long long domContentLoadedEventStart() const;
+    unsigned long long domContentLoadedEventEnd() const;
+    unsigned long long domComplete() const;
+    unsigned long long loadEventStart() const;
+    unsigned long long loadEventEnd() const;
+
+private:
+    explicit PerformanceTiming(Frame*);
+
+    const DocumentTiming* documentTiming() const;
+    DocumentLoader* documentLoader() const;
+    DocumentLoadTiming* documentLoadTiming() const;
+    ResourceLoadTiming* resourceLoadTiming() const;
+
+    unsigned long long monotonicTimeToIntegerMilliseconds(double) const;
+};
+
+}
+
+#endif // !defined(PerformanceTiming_h)
diff --git a/Source/core/page/PerformanceTiming.idl b/Source/core/timing/PerformanceTiming.idl
similarity index 100%
rename from Source/core/page/PerformanceTiming.idl
rename to Source/core/timing/PerformanceTiming.idl
diff --git a/Source/core/timing/PerformanceUserTiming.cpp b/Source/core/timing/PerformanceUserTiming.cpp
new file mode 100644
index 0000000..7600337
--- /dev/null
+++ b/Source/core/timing/PerformanceUserTiming.cpp
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2012 Intel 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/timing/PerformanceUserTiming.h"
+
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/ExceptionCode.h"
+#include "core/timing/Performance.h"
+#include "core/timing/PerformanceMark.h"
+#include "core/timing/PerformanceMeasure.h"
+#include "core/platform/HistogramSupport.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+namespace {
+
+typedef HashMap<String, NavigationTimingFunction> RestrictedKeyMap;
+static RestrictedKeyMap restrictedKeyMap()
+{
+    DEFINE_STATIC_LOCAL(RestrictedKeyMap, map, ());
+    if (map.isEmpty()) {
+        map.add("navigationStart", &PerformanceTiming::navigationStart);
+        map.add("unloadEventStart", &PerformanceTiming::unloadEventStart);
+        map.add("unloadEventEnd", &PerformanceTiming::unloadEventEnd);
+        map.add("redirectStart", &PerformanceTiming::redirectStart);
+        map.add("redirectEnd", &PerformanceTiming::redirectEnd);
+        map.add("fetchStart", &PerformanceTiming::fetchStart);
+        map.add("domainLookupStart", &PerformanceTiming::domainLookupStart);
+        map.add("domainLookupEnd", &PerformanceTiming::domainLookupEnd);
+        map.add("connectStart", &PerformanceTiming::connectStart);
+        map.add("connectEnd", &PerformanceTiming::connectEnd);
+        map.add("secureConnectionStart", &PerformanceTiming::secureConnectionStart);
+        map.add("requestStart", &PerformanceTiming::requestStart);
+        map.add("responseStart", &PerformanceTiming::responseStart);
+        map.add("responseEnd", &PerformanceTiming::responseEnd);
+        map.add("domLoading", &PerformanceTiming::domLoading);
+        map.add("domInteractive", &PerformanceTiming::domInteractive);
+        map.add("domContentLoadedEventStart", &PerformanceTiming::domContentLoadedEventStart);
+        map.add("domContentLoadedEventEnd", &PerformanceTiming::domContentLoadedEventEnd);
+        map.add("domComplete", &PerformanceTiming::domComplete);
+        map.add("loadEventStart", &PerformanceTiming::loadEventStart);
+        map.add("loadEventEnd", &PerformanceTiming::loadEventEnd);
+    }
+    return map;
+}
+
+} // namespace anonymous
+
+UserTiming::UserTiming(Performance* performance)
+    : m_performance(performance)
+{
+}
+
+static void insertPerformanceEntry(PerformanceEntryMap& performanceEntryMap, PassRefPtr<PerformanceEntry> performanceEntry)
+{
+    RefPtr<PerformanceEntry> entry = performanceEntry;
+    PerformanceEntryMap::iterator it = performanceEntryMap.find(entry->name());
+    if (it != performanceEntryMap.end())
+        it->value.append(entry);
+    else {
+        Vector<RefPtr<PerformanceEntry> > v(1);
+        v[0] = entry;
+        performanceEntryMap.set(entry->name(), v);
+    }
+}
+
+static void clearPeformanceEntries(PerformanceEntryMap& performanceEntryMap, const String& name)
+{
+    if (name.isNull()) {
+        performanceEntryMap.clear();
+        return;
+    }
+
+    if (performanceEntryMap.contains(name))
+        performanceEntryMap.remove(name);
+}
+
+void UserTiming::mark(const String& markName, ExceptionState& es)
+{
+    if (restrictedKeyMap().contains(markName)) {
+        es.throwDOMException(SyntaxError, "'" + markName + "' is part of the PerformanceTiming interface, and cannot be used as a mark name.");
+        return;
+    }
+
+    double startTime = m_performance->now();
+    insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTime));
+    HistogramSupport::histogramCustomCounts("PLT.UserTiming_Mark", static_cast<int>(startTime), 0, 600000, 100);
+}
+
+void UserTiming::clearMarks(const String& markName)
+{
+    clearPeformanceEntries(m_marksMap, markName);
+}
+
+double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionState& es)
+{
+    if (m_marksMap.contains(markName))
+        return m_marksMap.get(markName).last()->startTime();
+
+    if (restrictedKeyMap().contains(markName)) {
+        double value = static_cast<double>((m_performance->timing()->*(restrictedKeyMap().get(markName)))());
+        if (!value) {
+            es.throwDOMException(InvalidAccessError, "'" + markName + "' is empty: either the event hasn't happened yet, or it would provide cross-origin timing information.");
+            return 0.0;
+        }
+        return value - m_performance->timing()->navigationStart();
+    }
+
+    es.throwDOMException(SyntaxError, "The mark '" + markName + "' does not exist.");
+    return 0.0;
+}
+
+void UserTiming::measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState& es)
+{
+    double startTime = 0.0;
+    double endTime = 0.0;
+
+    if (startMark.isNull())
+        endTime = m_performance->now();
+    else if (endMark.isNull()) {
+        endTime = m_performance->now();
+        startTime = findExistingMarkStartTime(startMark, es);
+        if (es.hadException())
+            return;
+    } else {
+        endTime = findExistingMarkStartTime(endMark, es);
+        if (es.hadException())
+            return;
+        startTime = findExistingMarkStartTime(startMark, es);
+        if (es.hadException())
+            return;
+    }
+
+    insertPerformanceEntry(m_measuresMap, PerformanceMeasure::create(measureName, startTime, endTime));
+    if (endTime >= startTime)
+        HistogramSupport::histogramCustomCounts("PLT.UserTiming_MeasureDuration", static_cast<int>(endTime - startTime), 0, 600000, 100);
+}
+
+void UserTiming::clearMeasures(const String& measureName)
+{
+    clearPeformanceEntries(m_measuresMap, measureName);
+}
+
+static Vector<RefPtr<PerformanceEntry> > convertToEntrySequence(const PerformanceEntryMap& performanceEntryMap)
+{
+    Vector<RefPtr<PerformanceEntry> > entries;
+
+    for (PerformanceEntryMap::const_iterator it = performanceEntryMap.begin(); it != performanceEntryMap.end(); ++it)
+        entries.append(it->value);
+
+    return entries;
+}
+
+static Vector<RefPtr<PerformanceEntry> > getEntrySequenceByName(const PerformanceEntryMap& performanceEntryMap, const String& name)
+{
+    Vector<RefPtr<PerformanceEntry> > entries;
+
+    PerformanceEntryMap::const_iterator it = performanceEntryMap.find(name);
+    if (it != performanceEntryMap.end())
+        entries.append(it->value);
+
+    return entries;
+}
+
+Vector<RefPtr<PerformanceEntry> > UserTiming::getMarks() const
+{
+    return convertToEntrySequence(m_marksMap);
+}
+
+Vector<RefPtr<PerformanceEntry> > UserTiming::getMarks(const String& name) const
+{
+    return getEntrySequenceByName(m_marksMap, name);
+}
+
+Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures() const
+{
+    return convertToEntrySequence(m_measuresMap);
+}
+
+Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) const
+{
+    return getEntrySequenceByName(m_measuresMap, name);
+}
+
+} // namespace WebCore
diff --git a/Source/core/timing/PerformanceUserTiming.h b/Source/core/timing/PerformanceUserTiming.h
new file mode 100644
index 0000000..c12d6cf
--- /dev/null
+++ b/Source/core/timing/PerformanceUserTiming.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 Intel 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 PerformanceUserTiming_h
+#define PerformanceUserTiming_h
+
+#include "core/timing/PerformanceTiming.h"
+#include "wtf/HashMap.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/StringHash.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class ExceptionState;
+class Performance;
+class PerformanceEntry;
+
+typedef unsigned long long (PerformanceTiming::*NavigationTimingFunction)() const;
+typedef HashMap<String, Vector<RefPtr<PerformanceEntry> > > PerformanceEntryMap;
+
+class UserTiming : public RefCounted<UserTiming> {
+public:
+    static PassRefPtr<UserTiming> create(Performance* performance) { return adoptRef(new UserTiming(performance)); }
+
+    void mark(const String& markName, ExceptionState&);
+    void clearMarks(const String& markName);
+
+    void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState&);
+    void clearMeasures(const String& measureName);
+
+    Vector<RefPtr<PerformanceEntry> > getMarks() const;
+    Vector<RefPtr<PerformanceEntry> > getMeasures() const;
+
+    Vector<RefPtr<PerformanceEntry> > getMarks(const String& name) const;
+    Vector<RefPtr<PerformanceEntry> > getMeasures(const String& name) const;
+
+private:
+    explicit UserTiming(Performance*);
+
+    double findExistingMarkStartTime(const String& markName, ExceptionState&);
+    Performance* m_performance;
+    PerformanceEntryMap m_marksMap;
+    PerformanceEntryMap m_measuresMap;
+};
+
+}
+
+#endif // !defined(PerformanceUserTiming_h)
diff --git a/Source/core/page/ResourceTimingInfo.h b/Source/core/timing/ResourceTimingInfo.h
similarity index 100%
rename from Source/core/page/ResourceTimingInfo.h
rename to Source/core/timing/ResourceTimingInfo.h
diff --git a/Source/core/webcore_derived.target.darwin-arm.mk b/Source/core/webcore_derived.target.darwin-arm.mk
index 5ae778d..86f2703 100644
--- a/Source/core/webcore_derived.target.darwin-arm.mk
+++ b/Source/core/webcore_derived.target.darwin-arm.mk
@@ -76,20 +76,32 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSValueKeywords.cpp: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/Event.cpp: $(gyp_shared_intermediate_dir)/blink/Event.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTargetNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp: $(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp
@@ -100,18 +112,14 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLEntityTable.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLEntityTable.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLMetaElement.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp
@@ -157,24 +165,28 @@
 	$(gyp_intermediate_dir)/ColorData.cpp \
 	$(gyp_intermediate_dir)/CSSPropertyNames.cpp \
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
-	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
-	$(gyp_intermediate_dir)/HTMLNames.cpp \
-	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
+	$(gyp_intermediate_dir)/EventNames.cpp \
+	$(gyp_intermediate_dir)/EventTargetNames.cpp \
+	$(gyp_intermediate_dir)/EventTypeNames.cpp \
+	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
+	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
+	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
+	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/MathMLNames.cpp \
 	$(gyp_intermediate_dir)/PickerCommon.cpp \
+	$(gyp_intermediate_dir)/SVGNames.cpp \
 	$(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp \
 	$(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp \
 	$(gyp_intermediate_dir)/XLinkNames.cpp \
 	$(gyp_intermediate_dir)/XMLNSNames.cpp \
 	$(gyp_intermediate_dir)/XMLNames.cpp \
-	$(gyp_intermediate_dir)/SVGNames.cpp \
-	$(gyp_intermediate_dir)/MathMLNames.cpp \
-	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
 	$(gyp_intermediate_dir)/CSSParser.cpp \
+	$(gyp_intermediate_dir)/HTMLMetaElement.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -217,7 +229,6 @@
 	third_party/WebKit/Source/bindings/v8/ScriptFunctionCall.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptGCEvent.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptHeapSnapshot.cpp \
-	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptPreprocessor.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
@@ -261,8 +272,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8AlgorithmCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioContextCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8AudioNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp \
@@ -271,7 +280,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8CSSValueCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContextCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ClipboardCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \
@@ -281,8 +289,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceMotionEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DocumentCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8DocumentLocationCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntryCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntrySyncCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EventCustom.cpp \
@@ -328,7 +334,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8SVGDocumentCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGLengthCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGPathSegCustom.cpp \
@@ -394,20 +399,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -457,7 +461,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
@@ -553,20 +557,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -616,7 +619,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
diff --git a/Source/core/webcore_derived.target.darwin-mips.mk b/Source/core/webcore_derived.target.darwin-mips.mk
index e7e881f..ca3f507 100644
--- a/Source/core/webcore_derived.target.darwin-mips.mk
+++ b/Source/core/webcore_derived.target.darwin-mips.mk
@@ -76,20 +76,32 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSValueKeywords.cpp: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/Event.cpp: $(gyp_shared_intermediate_dir)/blink/Event.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTargetNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp: $(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp
@@ -100,18 +112,14 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLEntityTable.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLEntityTable.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLMetaElement.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp
@@ -157,24 +165,28 @@
 	$(gyp_intermediate_dir)/ColorData.cpp \
 	$(gyp_intermediate_dir)/CSSPropertyNames.cpp \
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
-	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
-	$(gyp_intermediate_dir)/HTMLNames.cpp \
-	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
+	$(gyp_intermediate_dir)/EventNames.cpp \
+	$(gyp_intermediate_dir)/EventTargetNames.cpp \
+	$(gyp_intermediate_dir)/EventTypeNames.cpp \
+	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
+	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
+	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
+	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/MathMLNames.cpp \
 	$(gyp_intermediate_dir)/PickerCommon.cpp \
+	$(gyp_intermediate_dir)/SVGNames.cpp \
 	$(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp \
 	$(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp \
 	$(gyp_intermediate_dir)/XLinkNames.cpp \
 	$(gyp_intermediate_dir)/XMLNSNames.cpp \
 	$(gyp_intermediate_dir)/XMLNames.cpp \
-	$(gyp_intermediate_dir)/SVGNames.cpp \
-	$(gyp_intermediate_dir)/MathMLNames.cpp \
-	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
 	$(gyp_intermediate_dir)/CSSParser.cpp \
+	$(gyp_intermediate_dir)/HTMLMetaElement.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -217,7 +229,6 @@
 	third_party/WebKit/Source/bindings/v8/ScriptFunctionCall.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptGCEvent.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptHeapSnapshot.cpp \
-	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptPreprocessor.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
@@ -261,8 +272,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8AlgorithmCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioContextCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8AudioNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp \
@@ -271,7 +280,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8CSSValueCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContextCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ClipboardCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \
@@ -281,8 +289,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceMotionEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DocumentCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8DocumentLocationCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntryCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntrySyncCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EventCustom.cpp \
@@ -328,7 +334,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8SVGDocumentCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGLengthCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGPathSegCustom.cpp \
@@ -394,20 +399,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -457,7 +461,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
@@ -553,20 +557,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -616,7 +619,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
diff --git a/Source/core/webcore_derived.target.darwin-x86.mk b/Source/core/webcore_derived.target.darwin-x86.mk
index abc1c41..7eadfb0 100644
--- a/Source/core/webcore_derived.target.darwin-x86.mk
+++ b/Source/core/webcore_derived.target.darwin-x86.mk
@@ -76,20 +76,32 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSValueKeywords.cpp: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/Event.cpp: $(gyp_shared_intermediate_dir)/blink/Event.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTargetNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp: $(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp
@@ -100,18 +112,14 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLEntityTable.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLEntityTable.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLMetaElement.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp
@@ -157,24 +165,28 @@
 	$(gyp_intermediate_dir)/ColorData.cpp \
 	$(gyp_intermediate_dir)/CSSPropertyNames.cpp \
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
-	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
-	$(gyp_intermediate_dir)/HTMLNames.cpp \
-	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
+	$(gyp_intermediate_dir)/EventNames.cpp \
+	$(gyp_intermediate_dir)/EventTargetNames.cpp \
+	$(gyp_intermediate_dir)/EventTypeNames.cpp \
+	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
+	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
+	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
+	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/MathMLNames.cpp \
 	$(gyp_intermediate_dir)/PickerCommon.cpp \
+	$(gyp_intermediate_dir)/SVGNames.cpp \
 	$(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp \
 	$(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp \
 	$(gyp_intermediate_dir)/XLinkNames.cpp \
 	$(gyp_intermediate_dir)/XMLNSNames.cpp \
 	$(gyp_intermediate_dir)/XMLNames.cpp \
-	$(gyp_intermediate_dir)/SVGNames.cpp \
-	$(gyp_intermediate_dir)/MathMLNames.cpp \
-	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
 	$(gyp_intermediate_dir)/CSSParser.cpp \
+	$(gyp_intermediate_dir)/HTMLMetaElement.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -217,7 +229,6 @@
 	third_party/WebKit/Source/bindings/v8/ScriptFunctionCall.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptGCEvent.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptHeapSnapshot.cpp \
-	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptPreprocessor.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
@@ -261,8 +272,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8AlgorithmCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioContextCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8AudioNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp \
@@ -271,7 +280,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8CSSValueCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContextCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ClipboardCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \
@@ -281,8 +289,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceMotionEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DocumentCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8DocumentLocationCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntryCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntrySyncCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EventCustom.cpp \
@@ -328,7 +334,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8SVGDocumentCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGLengthCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGPathSegCustom.cpp \
@@ -396,20 +401,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -459,7 +463,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
@@ -558,20 +562,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -621,7 +624,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
diff --git a/Source/core/webcore_derived.target.linux-arm.mk b/Source/core/webcore_derived.target.linux-arm.mk
index 5ae778d..86f2703 100644
--- a/Source/core/webcore_derived.target.linux-arm.mk
+++ b/Source/core/webcore_derived.target.linux-arm.mk
@@ -76,20 +76,32 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSValueKeywords.cpp: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/Event.cpp: $(gyp_shared_intermediate_dir)/blink/Event.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTargetNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp: $(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp
@@ -100,18 +112,14 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLEntityTable.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLEntityTable.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLMetaElement.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp
@@ -157,24 +165,28 @@
 	$(gyp_intermediate_dir)/ColorData.cpp \
 	$(gyp_intermediate_dir)/CSSPropertyNames.cpp \
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
-	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
-	$(gyp_intermediate_dir)/HTMLNames.cpp \
-	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
+	$(gyp_intermediate_dir)/EventNames.cpp \
+	$(gyp_intermediate_dir)/EventTargetNames.cpp \
+	$(gyp_intermediate_dir)/EventTypeNames.cpp \
+	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
+	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
+	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
+	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/MathMLNames.cpp \
 	$(gyp_intermediate_dir)/PickerCommon.cpp \
+	$(gyp_intermediate_dir)/SVGNames.cpp \
 	$(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp \
 	$(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp \
 	$(gyp_intermediate_dir)/XLinkNames.cpp \
 	$(gyp_intermediate_dir)/XMLNSNames.cpp \
 	$(gyp_intermediate_dir)/XMLNames.cpp \
-	$(gyp_intermediate_dir)/SVGNames.cpp \
-	$(gyp_intermediate_dir)/MathMLNames.cpp \
-	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
 	$(gyp_intermediate_dir)/CSSParser.cpp \
+	$(gyp_intermediate_dir)/HTMLMetaElement.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -217,7 +229,6 @@
 	third_party/WebKit/Source/bindings/v8/ScriptFunctionCall.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptGCEvent.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptHeapSnapshot.cpp \
-	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptPreprocessor.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
@@ -261,8 +272,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8AlgorithmCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioContextCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8AudioNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp \
@@ -271,7 +280,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8CSSValueCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContextCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ClipboardCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \
@@ -281,8 +289,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceMotionEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DocumentCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8DocumentLocationCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntryCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntrySyncCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EventCustom.cpp \
@@ -328,7 +334,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8SVGDocumentCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGLengthCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGPathSegCustom.cpp \
@@ -394,20 +399,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -457,7 +461,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
@@ -553,20 +557,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -616,7 +619,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
diff --git a/Source/core/webcore_derived.target.linux-mips.mk b/Source/core/webcore_derived.target.linux-mips.mk
index e7e881f..ca3f507 100644
--- a/Source/core/webcore_derived.target.linux-mips.mk
+++ b/Source/core/webcore_derived.target.linux-mips.mk
@@ -76,20 +76,32 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSValueKeywords.cpp: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/Event.cpp: $(gyp_shared_intermediate_dir)/blink/Event.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTargetNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp: $(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp
@@ -100,18 +112,14 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLEntityTable.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLEntityTable.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLMetaElement.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp
@@ -157,24 +165,28 @@
 	$(gyp_intermediate_dir)/ColorData.cpp \
 	$(gyp_intermediate_dir)/CSSPropertyNames.cpp \
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
-	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
-	$(gyp_intermediate_dir)/HTMLNames.cpp \
-	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
+	$(gyp_intermediate_dir)/EventNames.cpp \
+	$(gyp_intermediate_dir)/EventTargetNames.cpp \
+	$(gyp_intermediate_dir)/EventTypeNames.cpp \
+	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
+	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
+	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
+	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/MathMLNames.cpp \
 	$(gyp_intermediate_dir)/PickerCommon.cpp \
+	$(gyp_intermediate_dir)/SVGNames.cpp \
 	$(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp \
 	$(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp \
 	$(gyp_intermediate_dir)/XLinkNames.cpp \
 	$(gyp_intermediate_dir)/XMLNSNames.cpp \
 	$(gyp_intermediate_dir)/XMLNames.cpp \
-	$(gyp_intermediate_dir)/SVGNames.cpp \
-	$(gyp_intermediate_dir)/MathMLNames.cpp \
-	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
 	$(gyp_intermediate_dir)/CSSParser.cpp \
+	$(gyp_intermediate_dir)/HTMLMetaElement.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -217,7 +229,6 @@
 	third_party/WebKit/Source/bindings/v8/ScriptFunctionCall.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptGCEvent.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptHeapSnapshot.cpp \
-	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptPreprocessor.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
@@ -261,8 +272,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8AlgorithmCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioContextCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8AudioNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp \
@@ -271,7 +280,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8CSSValueCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContextCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ClipboardCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \
@@ -281,8 +289,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceMotionEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DocumentCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8DocumentLocationCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntryCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntrySyncCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EventCustom.cpp \
@@ -328,7 +334,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8SVGDocumentCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGLengthCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGPathSegCustom.cpp \
@@ -394,20 +399,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -457,7 +461,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
@@ -553,20 +557,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -616,7 +619,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
diff --git a/Source/core/webcore_derived.target.linux-x86.mk b/Source/core/webcore_derived.target.linux-x86.mk
index abc1c41..7eadfb0 100644
--- a/Source/core/webcore_derived.target.linux-x86.mk
+++ b/Source/core/webcore_derived.target.linux-x86.mk
@@ -76,20 +76,32 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSValueKeywords.cpp: $(gyp_shared_intermediate_dir)/blink/CSSValueKeywords.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CalendarPicker.cpp: $(gyp_shared_intermediate_dir)/blink/CalendarPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/ColorSuggestionPicker.cpp: $(gyp_shared_intermediate_dir)/blink/ColorSuggestionPicker.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/Event.cpp: $(gyp_shared_intermediate_dir)/blink/Event.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTargetNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTargetNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/EventTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/EventTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp: $(gyp_shared_intermediate_dir)/blink/FetchInitiatorTypeNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLElementFactory.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLElementFactory.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLNames.cpp
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/PickerCommon.cpp: $(gyp_shared_intermediate_dir)/blink/PickerCommon.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp: $(gyp_shared_intermediate_dir)/blink/UserAgentStyleSheetsData.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp: $(gyp_shared_intermediate_dir)/blink/V8HTMLElementWrapperFactory.cpp
@@ -100,18 +112,14 @@
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/XMLNames.cpp
 	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/SVGNames.cpp: $(gyp_shared_intermediate_dir)/blink/SVGNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/MathMLNames.cpp: $(gyp_shared_intermediate_dir)/blink/MathMLNames.cpp
-	mkdir -p $(@D); cp $< $@
-$(gyp_intermediate_dir)/FontFamilyNames.cpp: $(gyp_shared_intermediate_dir)/blink/FontFamilyNames.cpp
-	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/HTMLEntityTable.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLEntityTable.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp: $(gyp_shared_intermediate_dir)/blink/RuntimeEnabledFeatures.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSParser.cpp: $(gyp_shared_intermediate_dir)/blink/CSSParser.cpp
 	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/HTMLMetaElement.cpp: $(gyp_shared_intermediate_dir)/blink/HTMLMetaElement.cpp
+	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/CSSGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/CSSGrammar.cpp
 	mkdir -p $(@D); cp $< $@
 $(gyp_intermediate_dir)/XPathGrammar.cpp: $(gyp_shared_intermediate_dir)/blink/XPathGrammar.cpp
@@ -157,24 +165,28 @@
 	$(gyp_intermediate_dir)/ColorData.cpp \
 	$(gyp_intermediate_dir)/CSSPropertyNames.cpp \
 	$(gyp_intermediate_dir)/CSSValueKeywords.cpp \
-	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
-	$(gyp_intermediate_dir)/HTMLNames.cpp \
-	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
 	$(gyp_intermediate_dir)/CalendarPicker.cpp \
 	$(gyp_intermediate_dir)/ColorSuggestionPicker.cpp \
 	$(gyp_intermediate_dir)/Event.cpp \
+	$(gyp_intermediate_dir)/EventNames.cpp \
+	$(gyp_intermediate_dir)/EventTargetNames.cpp \
+	$(gyp_intermediate_dir)/EventTypeNames.cpp \
+	$(gyp_intermediate_dir)/FetchInitiatorTypeNames.cpp \
+	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
+	$(gyp_intermediate_dir)/HTMLElementFactory.cpp \
+	$(gyp_intermediate_dir)/HTMLNames.cpp \
+	$(gyp_intermediate_dir)/MathMLNames.cpp \
 	$(gyp_intermediate_dir)/PickerCommon.cpp \
+	$(gyp_intermediate_dir)/SVGNames.cpp \
 	$(gyp_intermediate_dir)/UserAgentStyleSheetsData.cpp \
 	$(gyp_intermediate_dir)/V8HTMLElementWrapperFactory.cpp \
 	$(gyp_intermediate_dir)/XLinkNames.cpp \
 	$(gyp_intermediate_dir)/XMLNSNames.cpp \
 	$(gyp_intermediate_dir)/XMLNames.cpp \
-	$(gyp_intermediate_dir)/SVGNames.cpp \
-	$(gyp_intermediate_dir)/MathMLNames.cpp \
-	$(gyp_intermediate_dir)/FontFamilyNames.cpp \
 	$(gyp_intermediate_dir)/HTMLEntityTable.cpp \
 	$(gyp_intermediate_dir)/RuntimeEnabledFeatures.cpp \
 	$(gyp_intermediate_dir)/CSSParser.cpp \
+	$(gyp_intermediate_dir)/HTMLMetaElement.cpp \
 	$(gyp_intermediate_dir)/CSSGrammar.cpp \
 	$(gyp_intermediate_dir)/XPathGrammar.cpp \
 	$(gyp_intermediate_dir)/InspectorFrontend.cpp \
@@ -217,7 +229,6 @@
 	third_party/WebKit/Source/bindings/v8/ScriptFunctionCall.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptGCEvent.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptHeapSnapshot.cpp \
-	third_party/WebKit/Source/bindings/v8/ScriptInstance.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptObject.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptPreprocessor.cpp \
 	third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp \
@@ -261,8 +272,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8AlgorithmCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioBufferSourceNodeCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8AudioContextCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8AudioNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BiquadFilterNodeCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp \
@@ -271,7 +280,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8CSSValueCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CanvasRenderingContextCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ClipboardCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \
@@ -281,8 +289,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceMotionEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DeviceOrientationEventCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8DocumentCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8DocumentLocationCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8ElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntryCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EntrySyncCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8EventCustom.cpp \
@@ -328,7 +334,6 @@
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp \
-	third_party/WebKit/Source/bindings/v8/custom/V8SVGDocumentCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGElementCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGLengthCustom.cpp \
 	third_party/WebKit/Source/bindings/v8/custom/V8SVGPathSegCustom.cpp \
@@ -396,20 +401,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -459,7 +463,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
@@ -558,20 +562,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -621,7 +624,7 @@
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(LOCAL_PATH)/third_party/ots/include \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/external/icu4c/common \
diff --git a/Source/core/webcore_dom.target.darwin-arm.mk b/Source/core/webcore_dom.target.darwin-arm.mk
index 41e847d..ea73e44 100644
--- a/Source/core/webcore_dom.target.darwin-arm.mk
+++ b/Source/core/webcore_dom.target.darwin-arm.mk
@@ -25,8 +25,10 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/dom/ActiveDOMObject.cpp \
+	third_party/WebKit/Source/core/dom/AddConsoleMessageTask.cpp \
 	third_party/WebKit/Source/core/dom/Attr.cpp \
 	third_party/WebKit/Source/core/dom/CDATASection.cpp \
+	third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp \
 	third_party/WebKit/Source/core/dom/CharacterData.cpp \
 	third_party/WebKit/Source/core/dom/ChildListMutationScope.cpp \
 	third_party/WebKit/Source/core/dom/ChildNodeList.cpp \
@@ -40,26 +42,16 @@
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElement.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackDispatcher.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackInvocation.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackQueue.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackScheduler.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementException.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistrationContext.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/DatasetDOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DataTransferItem.cpp \
+	third_party/WebKit/Source/core/dom/DataTransferItemList.cpp \
 	third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp \
-	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp \
-	third_party/WebKit/Source/core/dom/DeviceOrientationController.cpp \
 	third_party/WebKit/Source/core/dom/Document.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFragment.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFullscreen.cpp \
 	third_party/WebKit/Source/core/dom/DocumentInit.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
@@ -77,8 +69,12 @@
 	third_party/WebKit/Source/core/dom/DOMStringList.cpp \
 	third_party/WebKit/Source/core/dom/DOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DOMTokenList.cpp \
+	third_party/WebKit/Source/core/dom/DOMURL.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtils.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtilsReadOnly.cpp \
 	third_party/WebKit/Source/core/dom/Element.cpp \
 	third_party/WebKit/Source/core/dom/ElementRareData.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContextTask.cpp \
 	third_party/WebKit/Source/core/dom/FullscreenElementStack.cpp \
 	third_party/WebKit/Source/core/dom/IconURL.cpp \
 	third_party/WebKit/Source/core/dom/IdTargetObserver.cpp \
@@ -98,6 +94,7 @@
 	third_party/WebKit/Source/core/dom/NamedNodesCollection.cpp \
 	third_party/WebKit/Source/core/dom/NameNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Node.cpp \
+	third_party/WebKit/Source/core/dom/NodeChildRemovalTracker.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilter.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilterCondition.cpp \
 	third_party/WebKit/Source/core/dom/NodeIterator.cpp \
@@ -116,11 +113,23 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
-	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContext.cpp \
 	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/SecurityContext.cpp \
 	third_party/WebKit/Source/core/dom/SelectorQuery.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElement.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementBaseElementQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackDispatcher.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackInvocation.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackScheduler.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementException.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementObserver.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistrationContext.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ComposedTreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ContentDistribution.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp \
@@ -139,7 +148,6 @@
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
-	third_party/WebKit/Source/core/dom/TouchController.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
 	third_party/WebKit/Source/core/dom/TransformSourceLibxslt.cpp \
 	third_party/WebKit/Source/core/dom/Traversal.cpp \
@@ -147,9 +155,7 @@
 	third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp \
 	third_party/WebKit/Source/core/dom/TreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/UserActionElementSet.cpp \
-	third_party/WebKit/Source/core/dom/UserGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/UserTypingGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/ViewportArguments.cpp \
+	third_party/WebKit/Source/core/dom/ViewportDescription.cpp \
 	third_party/WebKit/Source/core/dom/VisitedLinkState.cpp \
 	third_party/WebKit/Source/core/dom/WheelController.cpp \
 	third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp \
@@ -164,7 +170,6 @@
 	third_party/WebKit/Source/core/events/EventDispatcher.cpp \
 	third_party/WebKit/Source/core/events/EventDispatchMediator.cpp \
 	third_party/WebKit/Source/core/events/EventListenerMap.cpp \
-	third_party/WebKit/Source/core/events/EventNames.cpp \
 	third_party/WebKit/Source/core/events/EventPathWalker.cpp \
 	third_party/WebKit/Source/core/events/EventRetargeter.cpp \
 	third_party/WebKit/Source/core/events/EventTarget.cpp \
@@ -239,20 +244,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -297,7 +301,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -393,20 +397,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -451,7 +454,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_dom.target.darwin-mips.mk b/Source/core/webcore_dom.target.darwin-mips.mk
index 50b92bd..97876b4 100644
--- a/Source/core/webcore_dom.target.darwin-mips.mk
+++ b/Source/core/webcore_dom.target.darwin-mips.mk
@@ -25,8 +25,10 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/dom/ActiveDOMObject.cpp \
+	third_party/WebKit/Source/core/dom/AddConsoleMessageTask.cpp \
 	third_party/WebKit/Source/core/dom/Attr.cpp \
 	third_party/WebKit/Source/core/dom/CDATASection.cpp \
+	third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp \
 	third_party/WebKit/Source/core/dom/CharacterData.cpp \
 	third_party/WebKit/Source/core/dom/ChildListMutationScope.cpp \
 	third_party/WebKit/Source/core/dom/ChildNodeList.cpp \
@@ -40,26 +42,16 @@
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElement.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackDispatcher.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackInvocation.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackQueue.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackScheduler.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementException.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistrationContext.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/DatasetDOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DataTransferItem.cpp \
+	third_party/WebKit/Source/core/dom/DataTransferItemList.cpp \
 	third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp \
-	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp \
-	third_party/WebKit/Source/core/dom/DeviceOrientationController.cpp \
 	third_party/WebKit/Source/core/dom/Document.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFragment.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFullscreen.cpp \
 	third_party/WebKit/Source/core/dom/DocumentInit.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
@@ -77,8 +69,12 @@
 	third_party/WebKit/Source/core/dom/DOMStringList.cpp \
 	third_party/WebKit/Source/core/dom/DOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DOMTokenList.cpp \
+	third_party/WebKit/Source/core/dom/DOMURL.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtils.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtilsReadOnly.cpp \
 	third_party/WebKit/Source/core/dom/Element.cpp \
 	third_party/WebKit/Source/core/dom/ElementRareData.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContextTask.cpp \
 	third_party/WebKit/Source/core/dom/FullscreenElementStack.cpp \
 	third_party/WebKit/Source/core/dom/IconURL.cpp \
 	third_party/WebKit/Source/core/dom/IdTargetObserver.cpp \
@@ -98,6 +94,7 @@
 	third_party/WebKit/Source/core/dom/NamedNodesCollection.cpp \
 	third_party/WebKit/Source/core/dom/NameNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Node.cpp \
+	third_party/WebKit/Source/core/dom/NodeChildRemovalTracker.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilter.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilterCondition.cpp \
 	third_party/WebKit/Source/core/dom/NodeIterator.cpp \
@@ -116,11 +113,23 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
-	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContext.cpp \
 	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/SecurityContext.cpp \
 	third_party/WebKit/Source/core/dom/SelectorQuery.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElement.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementBaseElementQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackDispatcher.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackInvocation.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackScheduler.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementException.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementObserver.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistrationContext.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ComposedTreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ContentDistribution.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp \
@@ -139,7 +148,6 @@
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
-	third_party/WebKit/Source/core/dom/TouchController.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
 	third_party/WebKit/Source/core/dom/TransformSourceLibxslt.cpp \
 	third_party/WebKit/Source/core/dom/Traversal.cpp \
@@ -147,9 +155,7 @@
 	third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp \
 	third_party/WebKit/Source/core/dom/TreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/UserActionElementSet.cpp \
-	third_party/WebKit/Source/core/dom/UserGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/UserTypingGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/ViewportArguments.cpp \
+	third_party/WebKit/Source/core/dom/ViewportDescription.cpp \
 	third_party/WebKit/Source/core/dom/VisitedLinkState.cpp \
 	third_party/WebKit/Source/core/dom/WheelController.cpp \
 	third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp \
@@ -164,7 +170,6 @@
 	third_party/WebKit/Source/core/events/EventDispatcher.cpp \
 	third_party/WebKit/Source/core/events/EventDispatchMediator.cpp \
 	third_party/WebKit/Source/core/events/EventListenerMap.cpp \
-	third_party/WebKit/Source/core/events/EventNames.cpp \
 	third_party/WebKit/Source/core/events/EventPathWalker.cpp \
 	third_party/WebKit/Source/core/events/EventRetargeter.cpp \
 	third_party/WebKit/Source/core/events/EventTarget.cpp \
@@ -239,20 +244,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -297,7 +301,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -393,20 +397,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -451,7 +454,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_dom.target.darwin-x86.mk b/Source/core/webcore_dom.target.darwin-x86.mk
index b5b2123..026ec0d 100644
--- a/Source/core/webcore_dom.target.darwin-x86.mk
+++ b/Source/core/webcore_dom.target.darwin-x86.mk
@@ -25,8 +25,10 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/dom/ActiveDOMObject.cpp \
+	third_party/WebKit/Source/core/dom/AddConsoleMessageTask.cpp \
 	third_party/WebKit/Source/core/dom/Attr.cpp \
 	third_party/WebKit/Source/core/dom/CDATASection.cpp \
+	third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp \
 	third_party/WebKit/Source/core/dom/CharacterData.cpp \
 	third_party/WebKit/Source/core/dom/ChildListMutationScope.cpp \
 	third_party/WebKit/Source/core/dom/ChildNodeList.cpp \
@@ -40,26 +42,16 @@
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElement.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackDispatcher.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackInvocation.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackQueue.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackScheduler.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementException.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistrationContext.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/DatasetDOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DataTransferItem.cpp \
+	third_party/WebKit/Source/core/dom/DataTransferItemList.cpp \
 	third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp \
-	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp \
-	third_party/WebKit/Source/core/dom/DeviceOrientationController.cpp \
 	third_party/WebKit/Source/core/dom/Document.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFragment.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFullscreen.cpp \
 	third_party/WebKit/Source/core/dom/DocumentInit.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
@@ -77,8 +69,12 @@
 	third_party/WebKit/Source/core/dom/DOMStringList.cpp \
 	third_party/WebKit/Source/core/dom/DOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DOMTokenList.cpp \
+	third_party/WebKit/Source/core/dom/DOMURL.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtils.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtilsReadOnly.cpp \
 	third_party/WebKit/Source/core/dom/Element.cpp \
 	third_party/WebKit/Source/core/dom/ElementRareData.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContextTask.cpp \
 	third_party/WebKit/Source/core/dom/FullscreenElementStack.cpp \
 	third_party/WebKit/Source/core/dom/IconURL.cpp \
 	third_party/WebKit/Source/core/dom/IdTargetObserver.cpp \
@@ -98,6 +94,7 @@
 	third_party/WebKit/Source/core/dom/NamedNodesCollection.cpp \
 	third_party/WebKit/Source/core/dom/NameNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Node.cpp \
+	third_party/WebKit/Source/core/dom/NodeChildRemovalTracker.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilter.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilterCondition.cpp \
 	third_party/WebKit/Source/core/dom/NodeIterator.cpp \
@@ -116,11 +113,23 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
-	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContext.cpp \
 	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/SecurityContext.cpp \
 	third_party/WebKit/Source/core/dom/SelectorQuery.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElement.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementBaseElementQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackDispatcher.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackInvocation.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackScheduler.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementException.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementObserver.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistrationContext.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ComposedTreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ContentDistribution.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp \
@@ -139,7 +148,6 @@
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
-	third_party/WebKit/Source/core/dom/TouchController.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
 	third_party/WebKit/Source/core/dom/TransformSourceLibxslt.cpp \
 	third_party/WebKit/Source/core/dom/Traversal.cpp \
@@ -147,9 +155,7 @@
 	third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp \
 	third_party/WebKit/Source/core/dom/TreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/UserActionElementSet.cpp \
-	third_party/WebKit/Source/core/dom/UserGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/UserTypingGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/ViewportArguments.cpp \
+	third_party/WebKit/Source/core/dom/ViewportDescription.cpp \
 	third_party/WebKit/Source/core/dom/VisitedLinkState.cpp \
 	third_party/WebKit/Source/core/dom/WheelController.cpp \
 	third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp \
@@ -164,7 +170,6 @@
 	third_party/WebKit/Source/core/events/EventDispatcher.cpp \
 	third_party/WebKit/Source/core/events/EventDispatchMediator.cpp \
 	third_party/WebKit/Source/core/events/EventListenerMap.cpp \
-	third_party/WebKit/Source/core/events/EventNames.cpp \
 	third_party/WebKit/Source/core/events/EventPathWalker.cpp \
 	third_party/WebKit/Source/core/events/EventRetargeter.cpp \
 	third_party/WebKit/Source/core/events/EventTarget.cpp \
@@ -241,20 +246,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -299,7 +303,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -398,20 +402,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -456,7 +459,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_dom.target.linux-arm.mk b/Source/core/webcore_dom.target.linux-arm.mk
index 41e847d..ea73e44 100644
--- a/Source/core/webcore_dom.target.linux-arm.mk
+++ b/Source/core/webcore_dom.target.linux-arm.mk
@@ -25,8 +25,10 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/dom/ActiveDOMObject.cpp \
+	third_party/WebKit/Source/core/dom/AddConsoleMessageTask.cpp \
 	third_party/WebKit/Source/core/dom/Attr.cpp \
 	third_party/WebKit/Source/core/dom/CDATASection.cpp \
+	third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp \
 	third_party/WebKit/Source/core/dom/CharacterData.cpp \
 	third_party/WebKit/Source/core/dom/ChildListMutationScope.cpp \
 	third_party/WebKit/Source/core/dom/ChildNodeList.cpp \
@@ -40,26 +42,16 @@
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElement.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackDispatcher.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackInvocation.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackQueue.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackScheduler.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementException.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistrationContext.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/DatasetDOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DataTransferItem.cpp \
+	third_party/WebKit/Source/core/dom/DataTransferItemList.cpp \
 	third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp \
-	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp \
-	third_party/WebKit/Source/core/dom/DeviceOrientationController.cpp \
 	third_party/WebKit/Source/core/dom/Document.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFragment.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFullscreen.cpp \
 	third_party/WebKit/Source/core/dom/DocumentInit.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
@@ -77,8 +69,12 @@
 	third_party/WebKit/Source/core/dom/DOMStringList.cpp \
 	third_party/WebKit/Source/core/dom/DOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DOMTokenList.cpp \
+	third_party/WebKit/Source/core/dom/DOMURL.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtils.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtilsReadOnly.cpp \
 	third_party/WebKit/Source/core/dom/Element.cpp \
 	third_party/WebKit/Source/core/dom/ElementRareData.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContextTask.cpp \
 	third_party/WebKit/Source/core/dom/FullscreenElementStack.cpp \
 	third_party/WebKit/Source/core/dom/IconURL.cpp \
 	third_party/WebKit/Source/core/dom/IdTargetObserver.cpp \
@@ -98,6 +94,7 @@
 	third_party/WebKit/Source/core/dom/NamedNodesCollection.cpp \
 	third_party/WebKit/Source/core/dom/NameNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Node.cpp \
+	third_party/WebKit/Source/core/dom/NodeChildRemovalTracker.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilter.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilterCondition.cpp \
 	third_party/WebKit/Source/core/dom/NodeIterator.cpp \
@@ -116,11 +113,23 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
-	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContext.cpp \
 	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/SecurityContext.cpp \
 	third_party/WebKit/Source/core/dom/SelectorQuery.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElement.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementBaseElementQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackDispatcher.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackInvocation.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackScheduler.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementException.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementObserver.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistrationContext.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ComposedTreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ContentDistribution.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp \
@@ -139,7 +148,6 @@
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
-	third_party/WebKit/Source/core/dom/TouchController.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
 	third_party/WebKit/Source/core/dom/TransformSourceLibxslt.cpp \
 	third_party/WebKit/Source/core/dom/Traversal.cpp \
@@ -147,9 +155,7 @@
 	third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp \
 	third_party/WebKit/Source/core/dom/TreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/UserActionElementSet.cpp \
-	third_party/WebKit/Source/core/dom/UserGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/UserTypingGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/ViewportArguments.cpp \
+	third_party/WebKit/Source/core/dom/ViewportDescription.cpp \
 	third_party/WebKit/Source/core/dom/VisitedLinkState.cpp \
 	third_party/WebKit/Source/core/dom/WheelController.cpp \
 	third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp \
@@ -164,7 +170,6 @@
 	third_party/WebKit/Source/core/events/EventDispatcher.cpp \
 	third_party/WebKit/Source/core/events/EventDispatchMediator.cpp \
 	third_party/WebKit/Source/core/events/EventListenerMap.cpp \
-	third_party/WebKit/Source/core/events/EventNames.cpp \
 	third_party/WebKit/Source/core/events/EventPathWalker.cpp \
 	third_party/WebKit/Source/core/events/EventRetargeter.cpp \
 	third_party/WebKit/Source/core/events/EventTarget.cpp \
@@ -239,20 +244,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -297,7 +301,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -393,20 +397,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -451,7 +454,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_dom.target.linux-mips.mk b/Source/core/webcore_dom.target.linux-mips.mk
index 50b92bd..97876b4 100644
--- a/Source/core/webcore_dom.target.linux-mips.mk
+++ b/Source/core/webcore_dom.target.linux-mips.mk
@@ -25,8 +25,10 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/dom/ActiveDOMObject.cpp \
+	third_party/WebKit/Source/core/dom/AddConsoleMessageTask.cpp \
 	third_party/WebKit/Source/core/dom/Attr.cpp \
 	third_party/WebKit/Source/core/dom/CDATASection.cpp \
+	third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp \
 	third_party/WebKit/Source/core/dom/CharacterData.cpp \
 	third_party/WebKit/Source/core/dom/ChildListMutationScope.cpp \
 	third_party/WebKit/Source/core/dom/ChildNodeList.cpp \
@@ -40,26 +42,16 @@
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElement.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackDispatcher.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackInvocation.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackQueue.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackScheduler.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementException.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistrationContext.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/DatasetDOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DataTransferItem.cpp \
+	third_party/WebKit/Source/core/dom/DataTransferItemList.cpp \
 	third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp \
-	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp \
-	third_party/WebKit/Source/core/dom/DeviceOrientationController.cpp \
 	third_party/WebKit/Source/core/dom/Document.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFragment.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFullscreen.cpp \
 	third_party/WebKit/Source/core/dom/DocumentInit.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
@@ -77,8 +69,12 @@
 	third_party/WebKit/Source/core/dom/DOMStringList.cpp \
 	third_party/WebKit/Source/core/dom/DOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DOMTokenList.cpp \
+	third_party/WebKit/Source/core/dom/DOMURL.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtils.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtilsReadOnly.cpp \
 	third_party/WebKit/Source/core/dom/Element.cpp \
 	third_party/WebKit/Source/core/dom/ElementRareData.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContextTask.cpp \
 	third_party/WebKit/Source/core/dom/FullscreenElementStack.cpp \
 	third_party/WebKit/Source/core/dom/IconURL.cpp \
 	third_party/WebKit/Source/core/dom/IdTargetObserver.cpp \
@@ -98,6 +94,7 @@
 	third_party/WebKit/Source/core/dom/NamedNodesCollection.cpp \
 	third_party/WebKit/Source/core/dom/NameNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Node.cpp \
+	third_party/WebKit/Source/core/dom/NodeChildRemovalTracker.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilter.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilterCondition.cpp \
 	third_party/WebKit/Source/core/dom/NodeIterator.cpp \
@@ -116,11 +113,23 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
-	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContext.cpp \
 	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/SecurityContext.cpp \
 	third_party/WebKit/Source/core/dom/SelectorQuery.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElement.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementBaseElementQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackDispatcher.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackInvocation.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackScheduler.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementException.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementObserver.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistrationContext.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ComposedTreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ContentDistribution.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp \
@@ -139,7 +148,6 @@
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
-	third_party/WebKit/Source/core/dom/TouchController.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
 	third_party/WebKit/Source/core/dom/TransformSourceLibxslt.cpp \
 	third_party/WebKit/Source/core/dom/Traversal.cpp \
@@ -147,9 +155,7 @@
 	third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp \
 	third_party/WebKit/Source/core/dom/TreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/UserActionElementSet.cpp \
-	third_party/WebKit/Source/core/dom/UserGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/UserTypingGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/ViewportArguments.cpp \
+	third_party/WebKit/Source/core/dom/ViewportDescription.cpp \
 	third_party/WebKit/Source/core/dom/VisitedLinkState.cpp \
 	third_party/WebKit/Source/core/dom/WheelController.cpp \
 	third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp \
@@ -164,7 +170,6 @@
 	third_party/WebKit/Source/core/events/EventDispatcher.cpp \
 	third_party/WebKit/Source/core/events/EventDispatchMediator.cpp \
 	third_party/WebKit/Source/core/events/EventListenerMap.cpp \
-	third_party/WebKit/Source/core/events/EventNames.cpp \
 	third_party/WebKit/Source/core/events/EventPathWalker.cpp \
 	third_party/WebKit/Source/core/events/EventRetargeter.cpp \
 	third_party/WebKit/Source/core/events/EventTarget.cpp \
@@ -239,20 +244,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -297,7 +301,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -393,20 +397,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -451,7 +454,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_dom.target.linux-x86.mk b/Source/core/webcore_dom.target.linux-x86.mk
index b5b2123..026ec0d 100644
--- a/Source/core/webcore_dom.target.linux-x86.mk
+++ b/Source/core/webcore_dom.target.linux-x86.mk
@@ -25,8 +25,10 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/dom/ActiveDOMObject.cpp \
+	third_party/WebKit/Source/core/dom/AddConsoleMessageTask.cpp \
 	third_party/WebKit/Source/core/dom/Attr.cpp \
 	third_party/WebKit/Source/core/dom/CDATASection.cpp \
+	third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp \
 	third_party/WebKit/Source/core/dom/CharacterData.cpp \
 	third_party/WebKit/Source/core/dom/ChildListMutationScope.cpp \
 	third_party/WebKit/Source/core/dom/ChildNodeList.cpp \
@@ -40,26 +42,16 @@
 	third_party/WebKit/Source/core/dom/ContextFeatures.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/ContextLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElement.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackDispatcher.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackInvocation.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackQueue.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementCallbackScheduler.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementDefinition.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementException.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementObserver.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistrationContext.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp \
-	third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/DatasetDOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DataTransferItem.cpp \
+	third_party/WebKit/Source/core/dom/DataTransferItemList.cpp \
 	third_party/WebKit/Source/core/dom/DecodedDataDocumentParser.cpp \
-	third_party/WebKit/Source/core/dom/default/chromium/PlatformMessagePortChannelChromium.cpp \
-	third_party/WebKit/Source/core/dom/DeviceOrientationController.cpp \
 	third_party/WebKit/Source/core/dom/Document.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFragment.cpp \
 	third_party/WebKit/Source/core/dom/DocumentFullscreen.cpp \
 	third_party/WebKit/Source/core/dom/DocumentInit.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp \
+	third_party/WebKit/Source/core/dom/DocumentLifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/dom/DocumentLifecycleObserver.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarker.cpp \
 	third_party/WebKit/Source/core/dom/DocumentMarkerController.cpp \
@@ -77,8 +69,12 @@
 	third_party/WebKit/Source/core/dom/DOMStringList.cpp \
 	third_party/WebKit/Source/core/dom/DOMStringMap.cpp \
 	third_party/WebKit/Source/core/dom/DOMTokenList.cpp \
+	third_party/WebKit/Source/core/dom/DOMURL.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtils.cpp \
+	third_party/WebKit/Source/core/dom/DOMURLUtilsReadOnly.cpp \
 	third_party/WebKit/Source/core/dom/Element.cpp \
 	third_party/WebKit/Source/core/dom/ElementRareData.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContextTask.cpp \
 	third_party/WebKit/Source/core/dom/FullscreenElementStack.cpp \
 	third_party/WebKit/Source/core/dom/IconURL.cpp \
 	third_party/WebKit/Source/core/dom/IdTargetObserver.cpp \
@@ -98,6 +94,7 @@
 	third_party/WebKit/Source/core/dom/NamedNodesCollection.cpp \
 	third_party/WebKit/Source/core/dom/NameNodeList.cpp \
 	third_party/WebKit/Source/core/dom/Node.cpp \
+	third_party/WebKit/Source/core/dom/NodeChildRemovalTracker.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilter.cpp \
 	third_party/WebKit/Source/core/dom/NodeFilterCondition.cpp \
 	third_party/WebKit/Source/core/dom/NodeIterator.cpp \
@@ -116,11 +113,23 @@
 	third_party/WebKit/Source/core/dom/Range.cpp \
 	third_party/WebKit/Source/core/dom/ScriptableDocumentParser.cpp \
 	third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp \
-	third_party/WebKit/Source/core/dom/ScriptExecutionContext.cpp \
+	third_party/WebKit/Source/core/dom/ExecutionContext.cpp \
 	third_party/WebKit/Source/core/dom/ScriptLoader.cpp \
 	third_party/WebKit/Source/core/dom/ScriptRunner.cpp \
 	third_party/WebKit/Source/core/dom/SecurityContext.cpp \
 	third_party/WebKit/Source/core/dom/SelectorQuery.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElement.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementBaseElementQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackDispatcher.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackInvocation.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackQueue.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementCallbackScheduler.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementException.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementObserver.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistrationContext.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp \
+	third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeCandidateMap.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ComposedTreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ContentDistribution.cpp \
 	third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp \
@@ -139,7 +148,6 @@
 	third_party/WebKit/Source/core/dom/Text.cpp \
 	third_party/WebKit/Source/core/dom/TextLinkColors.cpp \
 	third_party/WebKit/Source/core/dom/Touch.cpp \
-	third_party/WebKit/Source/core/dom/TouchController.cpp \
 	third_party/WebKit/Source/core/dom/TouchList.cpp \
 	third_party/WebKit/Source/core/dom/TransformSourceLibxslt.cpp \
 	third_party/WebKit/Source/core/dom/Traversal.cpp \
@@ -147,9 +155,7 @@
 	third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp \
 	third_party/WebKit/Source/core/dom/TreeWalker.cpp \
 	third_party/WebKit/Source/core/dom/UserActionElementSet.cpp \
-	third_party/WebKit/Source/core/dom/UserGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/UserTypingGestureIndicator.cpp \
-	third_party/WebKit/Source/core/dom/ViewportArguments.cpp \
+	third_party/WebKit/Source/core/dom/ViewportDescription.cpp \
 	third_party/WebKit/Source/core/dom/VisitedLinkState.cpp \
 	third_party/WebKit/Source/core/dom/WheelController.cpp \
 	third_party/WebKit/Source/core/events/BeforeTextInsertedEvent.cpp \
@@ -164,7 +170,6 @@
 	third_party/WebKit/Source/core/events/EventDispatcher.cpp \
 	third_party/WebKit/Source/core/events/EventDispatchMediator.cpp \
 	third_party/WebKit/Source/core/events/EventListenerMap.cpp \
-	third_party/WebKit/Source/core/events/EventNames.cpp \
 	third_party/WebKit/Source/core/events/EventPathWalker.cpp \
 	third_party/WebKit/Source/core/events/EventRetargeter.cpp \
 	third_party/WebKit/Source/core/events/EventTarget.cpp \
@@ -241,20 +246,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -299,7 +303,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -398,20 +402,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -456,7 +459,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_html.target.darwin-arm.mk b/Source/core/webcore_html.target.darwin-arm.mk
index 45d9e7b..736a535 100644
--- a/Source/core/webcore_html.target.darwin-arm.mk
+++ b/Source/core/webcore_html.target.darwin-arm.mk
@@ -26,9 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/html/ClassList.cpp \
 	third_party/WebKit/Source/core/html/DOMFormData.cpp \
-	third_party/WebKit/Source/core/html/DOMURL.cpp \
 	third_party/WebKit/Source/core/html/FormAssociatedElement.cpp \
-	third_party/WebKit/Source/core/html/FormDataList.cpp \
 	third_party/WebKit/Source/core/html/HTMLAllCollection.cpp \
 	third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLAppletElement.cpp \
@@ -80,7 +78,6 @@
 	third_party/WebKit/Source/core/html/HTMLMarqueeElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMediaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMenuElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLMetaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMeterElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLModElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLNameCollection.cpp \
@@ -99,7 +96,6 @@
 	third_party/WebKit/Source/core/html/HTMLQuoteElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLScriptElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSelectElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLSelectElementWin.cpp \
 	third_party/WebKit/Source/core/html/HTMLSourceElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSpanElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLStyleElement.cpp \
@@ -278,7 +274,6 @@
 	third_party/WebKit/Source/core/html/track/LoadableTextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCue.cpp \
-	third_party/WebKit/Source/core/html/track/TextTrackCueGeneric.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCueList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackRegion.cpp \
@@ -337,20 +332,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -395,7 +389,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -491,20 +485,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -549,7 +542,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_html.target.darwin-mips.mk b/Source/core/webcore_html.target.darwin-mips.mk
index cbfed54..1743558 100644
--- a/Source/core/webcore_html.target.darwin-mips.mk
+++ b/Source/core/webcore_html.target.darwin-mips.mk
@@ -26,9 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/html/ClassList.cpp \
 	third_party/WebKit/Source/core/html/DOMFormData.cpp \
-	third_party/WebKit/Source/core/html/DOMURL.cpp \
 	third_party/WebKit/Source/core/html/FormAssociatedElement.cpp \
-	third_party/WebKit/Source/core/html/FormDataList.cpp \
 	third_party/WebKit/Source/core/html/HTMLAllCollection.cpp \
 	third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLAppletElement.cpp \
@@ -80,7 +78,6 @@
 	third_party/WebKit/Source/core/html/HTMLMarqueeElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMediaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMenuElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLMetaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMeterElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLModElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLNameCollection.cpp \
@@ -99,7 +96,6 @@
 	third_party/WebKit/Source/core/html/HTMLQuoteElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLScriptElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSelectElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLSelectElementWin.cpp \
 	third_party/WebKit/Source/core/html/HTMLSourceElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSpanElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLStyleElement.cpp \
@@ -278,7 +274,6 @@
 	third_party/WebKit/Source/core/html/track/LoadableTextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCue.cpp \
-	third_party/WebKit/Source/core/html/track/TextTrackCueGeneric.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCueList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackRegion.cpp \
@@ -337,20 +332,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -395,7 +389,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -491,20 +485,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -549,7 +542,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_html.target.darwin-x86.mk b/Source/core/webcore_html.target.darwin-x86.mk
index 2a795d6..907c7f2 100644
--- a/Source/core/webcore_html.target.darwin-x86.mk
+++ b/Source/core/webcore_html.target.darwin-x86.mk
@@ -26,9 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/html/ClassList.cpp \
 	third_party/WebKit/Source/core/html/DOMFormData.cpp \
-	third_party/WebKit/Source/core/html/DOMURL.cpp \
 	third_party/WebKit/Source/core/html/FormAssociatedElement.cpp \
-	third_party/WebKit/Source/core/html/FormDataList.cpp \
 	third_party/WebKit/Source/core/html/HTMLAllCollection.cpp \
 	third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLAppletElement.cpp \
@@ -80,7 +78,6 @@
 	third_party/WebKit/Source/core/html/HTMLMarqueeElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMediaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMenuElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLMetaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMeterElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLModElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLNameCollection.cpp \
@@ -99,7 +96,6 @@
 	third_party/WebKit/Source/core/html/HTMLQuoteElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLScriptElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSelectElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLSelectElementWin.cpp \
 	third_party/WebKit/Source/core/html/HTMLSourceElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSpanElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLStyleElement.cpp \
@@ -278,7 +274,6 @@
 	third_party/WebKit/Source/core/html/track/LoadableTextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCue.cpp \
-	third_party/WebKit/Source/core/html/track/TextTrackCueGeneric.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCueList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackRegion.cpp \
@@ -339,20 +334,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -397,7 +391,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -496,20 +490,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -554,7 +547,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_html.target.linux-arm.mk b/Source/core/webcore_html.target.linux-arm.mk
index 45d9e7b..736a535 100644
--- a/Source/core/webcore_html.target.linux-arm.mk
+++ b/Source/core/webcore_html.target.linux-arm.mk
@@ -26,9 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/html/ClassList.cpp \
 	third_party/WebKit/Source/core/html/DOMFormData.cpp \
-	third_party/WebKit/Source/core/html/DOMURL.cpp \
 	third_party/WebKit/Source/core/html/FormAssociatedElement.cpp \
-	third_party/WebKit/Source/core/html/FormDataList.cpp \
 	third_party/WebKit/Source/core/html/HTMLAllCollection.cpp \
 	third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLAppletElement.cpp \
@@ -80,7 +78,6 @@
 	third_party/WebKit/Source/core/html/HTMLMarqueeElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMediaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMenuElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLMetaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMeterElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLModElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLNameCollection.cpp \
@@ -99,7 +96,6 @@
 	third_party/WebKit/Source/core/html/HTMLQuoteElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLScriptElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSelectElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLSelectElementWin.cpp \
 	third_party/WebKit/Source/core/html/HTMLSourceElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSpanElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLStyleElement.cpp \
@@ -278,7 +274,6 @@
 	third_party/WebKit/Source/core/html/track/LoadableTextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCue.cpp \
-	third_party/WebKit/Source/core/html/track/TextTrackCueGeneric.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCueList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackRegion.cpp \
@@ -337,20 +332,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -395,7 +389,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -491,20 +485,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -549,7 +542,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_html.target.linux-mips.mk b/Source/core/webcore_html.target.linux-mips.mk
index cbfed54..1743558 100644
--- a/Source/core/webcore_html.target.linux-mips.mk
+++ b/Source/core/webcore_html.target.linux-mips.mk
@@ -26,9 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/html/ClassList.cpp \
 	third_party/WebKit/Source/core/html/DOMFormData.cpp \
-	third_party/WebKit/Source/core/html/DOMURL.cpp \
 	third_party/WebKit/Source/core/html/FormAssociatedElement.cpp \
-	third_party/WebKit/Source/core/html/FormDataList.cpp \
 	third_party/WebKit/Source/core/html/HTMLAllCollection.cpp \
 	third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLAppletElement.cpp \
@@ -80,7 +78,6 @@
 	third_party/WebKit/Source/core/html/HTMLMarqueeElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMediaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMenuElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLMetaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMeterElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLModElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLNameCollection.cpp \
@@ -99,7 +96,6 @@
 	third_party/WebKit/Source/core/html/HTMLQuoteElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLScriptElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSelectElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLSelectElementWin.cpp \
 	third_party/WebKit/Source/core/html/HTMLSourceElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSpanElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLStyleElement.cpp \
@@ -278,7 +274,6 @@
 	third_party/WebKit/Source/core/html/track/LoadableTextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCue.cpp \
-	third_party/WebKit/Source/core/html/track/TextTrackCueGeneric.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCueList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackRegion.cpp \
@@ -337,20 +332,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -395,7 +389,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -491,20 +485,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -549,7 +542,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_html.target.linux-x86.mk b/Source/core/webcore_html.target.linux-x86.mk
index 2a795d6..907c7f2 100644
--- a/Source/core/webcore_html.target.linux-x86.mk
+++ b/Source/core/webcore_html.target.linux-x86.mk
@@ -26,9 +26,7 @@
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/html/ClassList.cpp \
 	third_party/WebKit/Source/core/html/DOMFormData.cpp \
-	third_party/WebKit/Source/core/html/DOMURL.cpp \
 	third_party/WebKit/Source/core/html/FormAssociatedElement.cpp \
-	third_party/WebKit/Source/core/html/FormDataList.cpp \
 	third_party/WebKit/Source/core/html/HTMLAllCollection.cpp \
 	third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLAppletElement.cpp \
@@ -80,7 +78,6 @@
 	third_party/WebKit/Source/core/html/HTMLMarqueeElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMediaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMenuElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLMetaElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLMeterElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLModElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLNameCollection.cpp \
@@ -99,7 +96,6 @@
 	third_party/WebKit/Source/core/html/HTMLQuoteElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLScriptElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSelectElement.cpp \
-	third_party/WebKit/Source/core/html/HTMLSelectElementWin.cpp \
 	third_party/WebKit/Source/core/html/HTMLSourceElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLSpanElement.cpp \
 	third_party/WebKit/Source/core/html/HTMLStyleElement.cpp \
@@ -278,7 +274,6 @@
 	third_party/WebKit/Source/core/html/track/LoadableTextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrack.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCue.cpp \
-	third_party/WebKit/Source/core/html/track/TextTrackCueGeneric.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackCueList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackList.cpp \
 	third_party/WebKit/Source/core/html/track/TextTrackRegion.cpp \
@@ -339,20 +334,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -397,7 +391,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -496,20 +490,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -554,7 +547,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform.target.darwin-arm.mk b/Source/core/webcore_platform.target.darwin-arm.mk
index 084e252..e47daae 100644
--- a/Source/core/webcore_platform.target.darwin-arm.mk
+++ b/Source/core/webcore_platform.target.darwin-arm.mk
@@ -25,39 +25,25 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/platform/CalculationValue.cpp \
-	third_party/WebKit/Source/core/platform/ContentType.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenu.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenuItem.cpp \
 	third_party/WebKit/Source/core/platform/CrossThreadCopier.cpp \
 	third_party/WebKit/Source/core/platform/Cursor.cpp \
-	third_party/WebKit/Source/core/platform/DateComponents.cpp \
-	third_party/WebKit/Source/core/platform/Decimal.cpp \
 	third_party/WebKit/Source/core/platform/DragData.cpp \
 	third_party/WebKit/Source/core/platform/DragImage.cpp \
-	third_party/WebKit/Source/core/platform/EventTracer.cpp \
-	third_party/WebKit/Source/core/platform/FileChooser.cpp \
-	third_party/WebKit/Source/core/platform/JSONValues.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 \
 	third_party/WebKit/Source/core/platform/Length.cpp \
 	third_party/WebKit/Source/core/platform/LengthBox.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleContext.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleObserver.cpp \
-	third_party/WebKit/Source/core/platform/LinkHash.cpp \
-	third_party/WebKit/Source/core/platform/LocalizedStrings.cpp \
-	third_party/WebKit/Source/core/platform/Logging.cpp \
 	third_party/WebKit/Source/core/platform/MIMETypeFromURL.cpp \
-	third_party/WebKit/Source/core/platform/NotImplemented.cpp \
-	third_party/WebKit/Source/core/platform/Partitions.cpp \
 	third_party/WebKit/Source/core/platform/Pasteboard.cpp \
-	third_party/WebKit/Source/core/platform/PlatformEvent.cpp \
 	third_party/WebKit/Source/core/platform/PlatformInstrumentation.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisUtterance.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisVoice.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesizer.cpp \
-	third_party/WebKit/Source/core/platform/PurgeableBuffer.cpp \
+	third_party/WebKit/Source/core/platform/Prerender.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimator.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimatorNone.cpp \
 	third_party/WebKit/Source/core/platform/ScrollView.cpp \
@@ -67,81 +53,19 @@
 	third_party/WebKit/Source/core/platform/ScrollbarThemeAndroid.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeNonMacCommon.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeOverlay.cpp \
-	third_party/WebKit/Source/core/platform/SecureTextInput.cpp \
-	third_party/WebKit/Source/core/platform/SharedBuffer.cpp \
-	third_party/WebKit/Source/core/platform/SharedBufferChunkReader.cpp \
-	third_party/WebKit/Source/core/platform/ThreadGlobalData.cpp \
-	third_party/WebKit/Source/core/platform/ThreadTimers.cpp \
-	third_party/WebKit/Source/core/platform/Timer.cpp \
-	third_party/WebKit/Source/core/platform/UUID.cpp \
-	third_party/WebKit/Source/core/platform/Widget.cpp \
 	third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationData.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.cpp \
 	third_party/WebKit/Source/core/platform/animation/KeyframeValueList.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioBus.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioChannel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioDSPKernelProcessor.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioPullFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResamplerKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioUtilities.cpp \
-	third_party/WebKit/Source/core/platform/audio/Biquad.cpp \
-	third_party/WebKit/Source/core/platform/audio/Cone.cpp \
-	third_party/WebKit/Source/core/platform/audio/DirectConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/Distance.cpp \
-	third_party/WebKit/Source/core/platform/audio/DownSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressor.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressorKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/EqualPowerPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrame.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrameStub.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabase.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabaseLoader.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFElevation.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/MultiChannelResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/Panner.cpp \
-	third_party/WebKit/Source/core/platform/audio/Reverb.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbAccumulationBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolverStage.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbInputBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/SincResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/UpSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/VectorMath.cpp \
-	third_party/WebKit/Source/core/platform/audio/ZeroPole.cpp \
-	third_party/WebKit/Source/core/platform/audio/chromium/AudioBusChromium.cpp \
-	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/ipp/FFTFrameIPP.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionAndroid.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MemoryUsageSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MIMETypeRegistryChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PlatformKeyboardEventChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformScreenChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformSpeechSynthesizerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/Prerender.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PrerenderHandle.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SSLKeyGeneratorChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SharedTimerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SoundChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/StatsCounterChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SuddenTerminationChromium.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ANGLEWebKitBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/BitmapImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModule.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModuleSession.cpp \
@@ -151,14 +75,10 @@
 	third_party/WebKit/Source/core/platform/graphics/Extensions3D.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Font.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontCache.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontDescription.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFallbackList.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFamily.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFeatureSettings.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFastPath.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FrameData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutBoxExtent.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratorGeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GlyphPageTreeNode.cpp \
@@ -171,21 +91,16 @@
 	third_party/WebKit/Source/core/platform/graphics/GraphicsTypes.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Image.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageBuffer.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ImageOrientation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageSource.cpp \
 	third_party/WebKit/Source/core/platform/graphics/MediaPlayer.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Path.cpp \
-	third_party/WebKit/Source/core/platform/graphics/PathTraversalState.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Pattern.cpp \
-	third_party/WebKit/Source/core/platform/graphics/RoundedRect.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SegmentedFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ShadowBlur.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SimpleFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SVGGlyph.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StringTruncator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StrokeData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/SurrogatePairAwareTextIterator.cpp \
-	third_party/WebKit/Source/core/platform/graphics/TextRun.cpp \
 	third_party/WebKit/Source/core/platform/graphics/WidthIterator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerManager.cpp \
@@ -287,52 +202,16 @@
 	third_party/WebKit/Source/core/platform/mediastream/RTCDTMFSenderHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.cpp \
-	third_party/WebKit/Source/core/platform/midi/MIDIAccessor.cpp \
-	third_party/WebKit/Source/core/platform/mock/DeviceOrientationClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.cpp \
-	third_party/WebKit/Source/core/platform/mock/MIDIClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/PlatformSpeechSynthesizerMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/ScrollbarThemeMock.cpp \
 	third_party/WebKit/Source/core/platform/network/BlobData.cpp \
-	third_party/WebKit/Source/core/platform/network/DNS.cpp \
 	third_party/WebKit/Source/core/platform/network/FormData.cpp \
 	third_party/WebKit/Source/core/platform/network/FormDataBuilder.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPHeaderMap.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPParsers.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPRequest.cpp \
-	third_party/WebKit/Source/core/platform/network/MIMEHeader.cpp \
-	third_party/WebKit/Source/core/platform/network/NetworkStateNotifier.cpp \
-	third_party/WebKit/Source/core/platform/network/ParsedContentType.cpp \
-	third_party/WebKit/Source/core/platform/network/ProxyServer.cpp \
-	third_party/WebKit/Source/core/platform/network/ResourceError.cpp \
+	third_party/WebKit/Source/core/platform/network/FormDataList.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceRequest.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceResponse.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamError.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamHandle.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLValue.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteAuthorizer.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteTransaction.cpp \
-	third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp \
-	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/LineEnding.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleICU.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleToScriptMappingDefault.cpp \
-	third_party/WebKit/Source/core/platform/text/PlatformLocale.cpp \
-	third_party/WebKit/Source/core/platform/text/QuotedPrintable.cpp \
-	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp \
-	third_party/WebKit/Source/core/platform/text/SegmentedString.cpp \
-	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/transcoder/FontTranscoder.cpp
+	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -382,20 +261,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -440,7 +318,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -537,20 +415,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -595,7 +472,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform.target.darwin-mips.mk b/Source/core/webcore_platform.target.darwin-mips.mk
index c3e7f80..69d1f65 100644
--- a/Source/core/webcore_platform.target.darwin-mips.mk
+++ b/Source/core/webcore_platform.target.darwin-mips.mk
@@ -25,39 +25,25 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/platform/CalculationValue.cpp \
-	third_party/WebKit/Source/core/platform/ContentType.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenu.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenuItem.cpp \
 	third_party/WebKit/Source/core/platform/CrossThreadCopier.cpp \
 	third_party/WebKit/Source/core/platform/Cursor.cpp \
-	third_party/WebKit/Source/core/platform/DateComponents.cpp \
-	third_party/WebKit/Source/core/platform/Decimal.cpp \
 	third_party/WebKit/Source/core/platform/DragData.cpp \
 	third_party/WebKit/Source/core/platform/DragImage.cpp \
-	third_party/WebKit/Source/core/platform/EventTracer.cpp \
-	third_party/WebKit/Source/core/platform/FileChooser.cpp \
-	third_party/WebKit/Source/core/platform/JSONValues.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 \
 	third_party/WebKit/Source/core/platform/Length.cpp \
 	third_party/WebKit/Source/core/platform/LengthBox.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleContext.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleObserver.cpp \
-	third_party/WebKit/Source/core/platform/LinkHash.cpp \
-	third_party/WebKit/Source/core/platform/LocalizedStrings.cpp \
-	third_party/WebKit/Source/core/platform/Logging.cpp \
 	third_party/WebKit/Source/core/platform/MIMETypeFromURL.cpp \
-	third_party/WebKit/Source/core/platform/NotImplemented.cpp \
-	third_party/WebKit/Source/core/platform/Partitions.cpp \
 	third_party/WebKit/Source/core/platform/Pasteboard.cpp \
-	third_party/WebKit/Source/core/platform/PlatformEvent.cpp \
 	third_party/WebKit/Source/core/platform/PlatformInstrumentation.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisUtterance.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisVoice.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesizer.cpp \
-	third_party/WebKit/Source/core/platform/PurgeableBuffer.cpp \
+	third_party/WebKit/Source/core/platform/Prerender.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimator.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimatorNone.cpp \
 	third_party/WebKit/Source/core/platform/ScrollView.cpp \
@@ -67,81 +53,19 @@
 	third_party/WebKit/Source/core/platform/ScrollbarThemeAndroid.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeNonMacCommon.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeOverlay.cpp \
-	third_party/WebKit/Source/core/platform/SecureTextInput.cpp \
-	third_party/WebKit/Source/core/platform/SharedBuffer.cpp \
-	third_party/WebKit/Source/core/platform/SharedBufferChunkReader.cpp \
-	third_party/WebKit/Source/core/platform/ThreadGlobalData.cpp \
-	third_party/WebKit/Source/core/platform/ThreadTimers.cpp \
-	third_party/WebKit/Source/core/platform/Timer.cpp \
-	third_party/WebKit/Source/core/platform/UUID.cpp \
-	third_party/WebKit/Source/core/platform/Widget.cpp \
 	third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationData.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.cpp \
 	third_party/WebKit/Source/core/platform/animation/KeyframeValueList.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioBus.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioChannel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioDSPKernelProcessor.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioPullFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResamplerKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioUtilities.cpp \
-	third_party/WebKit/Source/core/platform/audio/Biquad.cpp \
-	third_party/WebKit/Source/core/platform/audio/Cone.cpp \
-	third_party/WebKit/Source/core/platform/audio/DirectConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/Distance.cpp \
-	third_party/WebKit/Source/core/platform/audio/DownSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressor.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressorKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/EqualPowerPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrame.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrameStub.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabase.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabaseLoader.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFElevation.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/MultiChannelResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/Panner.cpp \
-	third_party/WebKit/Source/core/platform/audio/Reverb.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbAccumulationBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolverStage.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbInputBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/SincResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/UpSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/VectorMath.cpp \
-	third_party/WebKit/Source/core/platform/audio/ZeroPole.cpp \
-	third_party/WebKit/Source/core/platform/audio/chromium/AudioBusChromium.cpp \
-	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/ipp/FFTFrameIPP.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionAndroid.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MemoryUsageSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MIMETypeRegistryChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PlatformKeyboardEventChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformScreenChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformSpeechSynthesizerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/Prerender.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PrerenderHandle.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SSLKeyGeneratorChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SharedTimerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SoundChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/StatsCounterChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SuddenTerminationChromium.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ANGLEWebKitBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/BitmapImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModule.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModuleSession.cpp \
@@ -151,14 +75,10 @@
 	third_party/WebKit/Source/core/platform/graphics/Extensions3D.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Font.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontCache.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontDescription.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFallbackList.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFamily.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFeatureSettings.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFastPath.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FrameData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutBoxExtent.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratorGeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GlyphPageTreeNode.cpp \
@@ -171,21 +91,16 @@
 	third_party/WebKit/Source/core/platform/graphics/GraphicsTypes.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Image.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageBuffer.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ImageOrientation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageSource.cpp \
 	third_party/WebKit/Source/core/platform/graphics/MediaPlayer.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Path.cpp \
-	third_party/WebKit/Source/core/platform/graphics/PathTraversalState.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Pattern.cpp \
-	third_party/WebKit/Source/core/platform/graphics/RoundedRect.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SegmentedFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ShadowBlur.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SimpleFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SVGGlyph.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StringTruncator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StrokeData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/SurrogatePairAwareTextIterator.cpp \
-	third_party/WebKit/Source/core/platform/graphics/TextRun.cpp \
 	third_party/WebKit/Source/core/platform/graphics/WidthIterator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerManager.cpp \
@@ -287,52 +202,16 @@
 	third_party/WebKit/Source/core/platform/mediastream/RTCDTMFSenderHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.cpp \
-	third_party/WebKit/Source/core/platform/midi/MIDIAccessor.cpp \
-	third_party/WebKit/Source/core/platform/mock/DeviceOrientationClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.cpp \
-	third_party/WebKit/Source/core/platform/mock/MIDIClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/PlatformSpeechSynthesizerMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/ScrollbarThemeMock.cpp \
 	third_party/WebKit/Source/core/platform/network/BlobData.cpp \
-	third_party/WebKit/Source/core/platform/network/DNS.cpp \
 	third_party/WebKit/Source/core/platform/network/FormData.cpp \
 	third_party/WebKit/Source/core/platform/network/FormDataBuilder.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPHeaderMap.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPParsers.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPRequest.cpp \
-	third_party/WebKit/Source/core/platform/network/MIMEHeader.cpp \
-	third_party/WebKit/Source/core/platform/network/NetworkStateNotifier.cpp \
-	third_party/WebKit/Source/core/platform/network/ParsedContentType.cpp \
-	third_party/WebKit/Source/core/platform/network/ProxyServer.cpp \
-	third_party/WebKit/Source/core/platform/network/ResourceError.cpp \
+	third_party/WebKit/Source/core/platform/network/FormDataList.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceRequest.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceResponse.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamError.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamHandle.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLValue.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteAuthorizer.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteTransaction.cpp \
-	third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp \
-	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/LineEnding.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleICU.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleToScriptMappingDefault.cpp \
-	third_party/WebKit/Source/core/platform/text/PlatformLocale.cpp \
-	third_party/WebKit/Source/core/platform/text/QuotedPrintable.cpp \
-	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp \
-	third_party/WebKit/Source/core/platform/text/SegmentedString.cpp \
-	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/transcoder/FontTranscoder.cpp
+	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -382,20 +261,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -440,7 +318,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -537,20 +415,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -595,7 +472,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform.target.darwin-x86.mk b/Source/core/webcore_platform.target.darwin-x86.mk
index 054e56d..4bf5a83 100644
--- a/Source/core/webcore_platform.target.darwin-x86.mk
+++ b/Source/core/webcore_platform.target.darwin-x86.mk
@@ -25,39 +25,25 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/platform/CalculationValue.cpp \
-	third_party/WebKit/Source/core/platform/ContentType.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenu.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenuItem.cpp \
 	third_party/WebKit/Source/core/platform/CrossThreadCopier.cpp \
 	third_party/WebKit/Source/core/platform/Cursor.cpp \
-	third_party/WebKit/Source/core/platform/DateComponents.cpp \
-	third_party/WebKit/Source/core/platform/Decimal.cpp \
 	third_party/WebKit/Source/core/platform/DragData.cpp \
 	third_party/WebKit/Source/core/platform/DragImage.cpp \
-	third_party/WebKit/Source/core/platform/EventTracer.cpp \
-	third_party/WebKit/Source/core/platform/FileChooser.cpp \
-	third_party/WebKit/Source/core/platform/JSONValues.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 \
 	third_party/WebKit/Source/core/platform/Length.cpp \
 	third_party/WebKit/Source/core/platform/LengthBox.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleContext.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleObserver.cpp \
-	third_party/WebKit/Source/core/platform/LinkHash.cpp \
-	third_party/WebKit/Source/core/platform/LocalizedStrings.cpp \
-	third_party/WebKit/Source/core/platform/Logging.cpp \
 	third_party/WebKit/Source/core/platform/MIMETypeFromURL.cpp \
-	third_party/WebKit/Source/core/platform/NotImplemented.cpp \
-	third_party/WebKit/Source/core/platform/Partitions.cpp \
 	third_party/WebKit/Source/core/platform/Pasteboard.cpp \
-	third_party/WebKit/Source/core/platform/PlatformEvent.cpp \
 	third_party/WebKit/Source/core/platform/PlatformInstrumentation.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisUtterance.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisVoice.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesizer.cpp \
-	third_party/WebKit/Source/core/platform/PurgeableBuffer.cpp \
+	third_party/WebKit/Source/core/platform/Prerender.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimator.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimatorNone.cpp \
 	third_party/WebKit/Source/core/platform/ScrollView.cpp \
@@ -67,81 +53,19 @@
 	third_party/WebKit/Source/core/platform/ScrollbarThemeAndroid.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeNonMacCommon.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeOverlay.cpp \
-	third_party/WebKit/Source/core/platform/SecureTextInput.cpp \
-	third_party/WebKit/Source/core/platform/SharedBuffer.cpp \
-	third_party/WebKit/Source/core/platform/SharedBufferChunkReader.cpp \
-	third_party/WebKit/Source/core/platform/ThreadGlobalData.cpp \
-	third_party/WebKit/Source/core/platform/ThreadTimers.cpp \
-	third_party/WebKit/Source/core/platform/Timer.cpp \
-	third_party/WebKit/Source/core/platform/UUID.cpp \
-	third_party/WebKit/Source/core/platform/Widget.cpp \
 	third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationData.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.cpp \
 	third_party/WebKit/Source/core/platform/animation/KeyframeValueList.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioBus.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioChannel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioDSPKernelProcessor.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioPullFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResamplerKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioUtilities.cpp \
-	third_party/WebKit/Source/core/platform/audio/Biquad.cpp \
-	third_party/WebKit/Source/core/platform/audio/Cone.cpp \
-	third_party/WebKit/Source/core/platform/audio/DirectConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/Distance.cpp \
-	third_party/WebKit/Source/core/platform/audio/DownSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressor.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressorKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/EqualPowerPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrame.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrameStub.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabase.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabaseLoader.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFElevation.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/MultiChannelResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/Panner.cpp \
-	third_party/WebKit/Source/core/platform/audio/Reverb.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbAccumulationBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolverStage.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbInputBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/SincResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/UpSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/VectorMath.cpp \
-	third_party/WebKit/Source/core/platform/audio/ZeroPole.cpp \
-	third_party/WebKit/Source/core/platform/audio/chromium/AudioBusChromium.cpp \
-	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/ipp/FFTFrameIPP.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionAndroid.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MemoryUsageSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MIMETypeRegistryChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PlatformKeyboardEventChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformScreenChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformSpeechSynthesizerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/Prerender.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PrerenderHandle.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SSLKeyGeneratorChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SharedTimerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SoundChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/StatsCounterChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SuddenTerminationChromium.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ANGLEWebKitBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/BitmapImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModule.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModuleSession.cpp \
@@ -151,14 +75,10 @@
 	third_party/WebKit/Source/core/platform/graphics/Extensions3D.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Font.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontCache.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontDescription.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFallbackList.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFamily.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFeatureSettings.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFastPath.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FrameData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutBoxExtent.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratorGeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GlyphPageTreeNode.cpp \
@@ -171,21 +91,16 @@
 	third_party/WebKit/Source/core/platform/graphics/GraphicsTypes.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Image.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageBuffer.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ImageOrientation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageSource.cpp \
 	third_party/WebKit/Source/core/platform/graphics/MediaPlayer.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Path.cpp \
-	third_party/WebKit/Source/core/platform/graphics/PathTraversalState.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Pattern.cpp \
-	third_party/WebKit/Source/core/platform/graphics/RoundedRect.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SegmentedFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ShadowBlur.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SimpleFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SVGGlyph.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StringTruncator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StrokeData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/SurrogatePairAwareTextIterator.cpp \
-	third_party/WebKit/Source/core/platform/graphics/TextRun.cpp \
 	third_party/WebKit/Source/core/platform/graphics/WidthIterator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerManager.cpp \
@@ -287,52 +202,16 @@
 	third_party/WebKit/Source/core/platform/mediastream/RTCDTMFSenderHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.cpp \
-	third_party/WebKit/Source/core/platform/midi/MIDIAccessor.cpp \
-	third_party/WebKit/Source/core/platform/mock/DeviceOrientationClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.cpp \
-	third_party/WebKit/Source/core/platform/mock/MIDIClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/PlatformSpeechSynthesizerMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/ScrollbarThemeMock.cpp \
 	third_party/WebKit/Source/core/platform/network/BlobData.cpp \
-	third_party/WebKit/Source/core/platform/network/DNS.cpp \
 	third_party/WebKit/Source/core/platform/network/FormData.cpp \
 	third_party/WebKit/Source/core/platform/network/FormDataBuilder.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPHeaderMap.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPParsers.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPRequest.cpp \
-	third_party/WebKit/Source/core/platform/network/MIMEHeader.cpp \
-	third_party/WebKit/Source/core/platform/network/NetworkStateNotifier.cpp \
-	third_party/WebKit/Source/core/platform/network/ParsedContentType.cpp \
-	third_party/WebKit/Source/core/platform/network/ProxyServer.cpp \
-	third_party/WebKit/Source/core/platform/network/ResourceError.cpp \
+	third_party/WebKit/Source/core/platform/network/FormDataList.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceRequest.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceResponse.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamError.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamHandle.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLValue.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteAuthorizer.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteTransaction.cpp \
-	third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp \
-	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/LineEnding.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleICU.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleToScriptMappingDefault.cpp \
-	third_party/WebKit/Source/core/platform/text/PlatformLocale.cpp \
-	third_party/WebKit/Source/core/platform/text/QuotedPrintable.cpp \
-	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp \
-	third_party/WebKit/Source/core/platform/text/SegmentedString.cpp \
-	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/transcoder/FontTranscoder.cpp
+	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -384,20 +263,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -442,7 +320,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -542,20 +420,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -600,7 +477,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform.target.linux-arm.mk b/Source/core/webcore_platform.target.linux-arm.mk
index 084e252..e47daae 100644
--- a/Source/core/webcore_platform.target.linux-arm.mk
+++ b/Source/core/webcore_platform.target.linux-arm.mk
@@ -25,39 +25,25 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/platform/CalculationValue.cpp \
-	third_party/WebKit/Source/core/platform/ContentType.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenu.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenuItem.cpp \
 	third_party/WebKit/Source/core/platform/CrossThreadCopier.cpp \
 	third_party/WebKit/Source/core/platform/Cursor.cpp \
-	third_party/WebKit/Source/core/platform/DateComponents.cpp \
-	third_party/WebKit/Source/core/platform/Decimal.cpp \
 	third_party/WebKit/Source/core/platform/DragData.cpp \
 	third_party/WebKit/Source/core/platform/DragImage.cpp \
-	third_party/WebKit/Source/core/platform/EventTracer.cpp \
-	third_party/WebKit/Source/core/platform/FileChooser.cpp \
-	third_party/WebKit/Source/core/platform/JSONValues.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 \
 	third_party/WebKit/Source/core/platform/Length.cpp \
 	third_party/WebKit/Source/core/platform/LengthBox.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleContext.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleObserver.cpp \
-	third_party/WebKit/Source/core/platform/LinkHash.cpp \
-	third_party/WebKit/Source/core/platform/LocalizedStrings.cpp \
-	third_party/WebKit/Source/core/platform/Logging.cpp \
 	third_party/WebKit/Source/core/platform/MIMETypeFromURL.cpp \
-	third_party/WebKit/Source/core/platform/NotImplemented.cpp \
-	third_party/WebKit/Source/core/platform/Partitions.cpp \
 	third_party/WebKit/Source/core/platform/Pasteboard.cpp \
-	third_party/WebKit/Source/core/platform/PlatformEvent.cpp \
 	third_party/WebKit/Source/core/platform/PlatformInstrumentation.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisUtterance.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisVoice.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesizer.cpp \
-	third_party/WebKit/Source/core/platform/PurgeableBuffer.cpp \
+	third_party/WebKit/Source/core/platform/Prerender.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimator.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimatorNone.cpp \
 	third_party/WebKit/Source/core/platform/ScrollView.cpp \
@@ -67,81 +53,19 @@
 	third_party/WebKit/Source/core/platform/ScrollbarThemeAndroid.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeNonMacCommon.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeOverlay.cpp \
-	third_party/WebKit/Source/core/platform/SecureTextInput.cpp \
-	third_party/WebKit/Source/core/platform/SharedBuffer.cpp \
-	third_party/WebKit/Source/core/platform/SharedBufferChunkReader.cpp \
-	third_party/WebKit/Source/core/platform/ThreadGlobalData.cpp \
-	third_party/WebKit/Source/core/platform/ThreadTimers.cpp \
-	third_party/WebKit/Source/core/platform/Timer.cpp \
-	third_party/WebKit/Source/core/platform/UUID.cpp \
-	third_party/WebKit/Source/core/platform/Widget.cpp \
 	third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationData.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.cpp \
 	third_party/WebKit/Source/core/platform/animation/KeyframeValueList.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioBus.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioChannel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioDSPKernelProcessor.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioPullFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResamplerKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioUtilities.cpp \
-	third_party/WebKit/Source/core/platform/audio/Biquad.cpp \
-	third_party/WebKit/Source/core/platform/audio/Cone.cpp \
-	third_party/WebKit/Source/core/platform/audio/DirectConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/Distance.cpp \
-	third_party/WebKit/Source/core/platform/audio/DownSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressor.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressorKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/EqualPowerPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrame.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrameStub.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabase.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabaseLoader.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFElevation.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/MultiChannelResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/Panner.cpp \
-	third_party/WebKit/Source/core/platform/audio/Reverb.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbAccumulationBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolverStage.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbInputBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/SincResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/UpSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/VectorMath.cpp \
-	third_party/WebKit/Source/core/platform/audio/ZeroPole.cpp \
-	third_party/WebKit/Source/core/platform/audio/chromium/AudioBusChromium.cpp \
-	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/ipp/FFTFrameIPP.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionAndroid.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MemoryUsageSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MIMETypeRegistryChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PlatformKeyboardEventChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformScreenChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformSpeechSynthesizerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/Prerender.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PrerenderHandle.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SSLKeyGeneratorChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SharedTimerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SoundChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/StatsCounterChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SuddenTerminationChromium.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ANGLEWebKitBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/BitmapImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModule.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModuleSession.cpp \
@@ -151,14 +75,10 @@
 	third_party/WebKit/Source/core/platform/graphics/Extensions3D.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Font.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontCache.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontDescription.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFallbackList.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFamily.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFeatureSettings.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFastPath.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FrameData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutBoxExtent.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratorGeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GlyphPageTreeNode.cpp \
@@ -171,21 +91,16 @@
 	third_party/WebKit/Source/core/platform/graphics/GraphicsTypes.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Image.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageBuffer.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ImageOrientation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageSource.cpp \
 	third_party/WebKit/Source/core/platform/graphics/MediaPlayer.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Path.cpp \
-	third_party/WebKit/Source/core/platform/graphics/PathTraversalState.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Pattern.cpp \
-	third_party/WebKit/Source/core/platform/graphics/RoundedRect.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SegmentedFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ShadowBlur.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SimpleFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SVGGlyph.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StringTruncator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StrokeData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/SurrogatePairAwareTextIterator.cpp \
-	third_party/WebKit/Source/core/platform/graphics/TextRun.cpp \
 	third_party/WebKit/Source/core/platform/graphics/WidthIterator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerManager.cpp \
@@ -287,52 +202,16 @@
 	third_party/WebKit/Source/core/platform/mediastream/RTCDTMFSenderHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.cpp \
-	third_party/WebKit/Source/core/platform/midi/MIDIAccessor.cpp \
-	third_party/WebKit/Source/core/platform/mock/DeviceOrientationClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.cpp \
-	third_party/WebKit/Source/core/platform/mock/MIDIClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/PlatformSpeechSynthesizerMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/ScrollbarThemeMock.cpp \
 	third_party/WebKit/Source/core/platform/network/BlobData.cpp \
-	third_party/WebKit/Source/core/platform/network/DNS.cpp \
 	third_party/WebKit/Source/core/platform/network/FormData.cpp \
 	third_party/WebKit/Source/core/platform/network/FormDataBuilder.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPHeaderMap.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPParsers.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPRequest.cpp \
-	third_party/WebKit/Source/core/platform/network/MIMEHeader.cpp \
-	third_party/WebKit/Source/core/platform/network/NetworkStateNotifier.cpp \
-	third_party/WebKit/Source/core/platform/network/ParsedContentType.cpp \
-	third_party/WebKit/Source/core/platform/network/ProxyServer.cpp \
-	third_party/WebKit/Source/core/platform/network/ResourceError.cpp \
+	third_party/WebKit/Source/core/platform/network/FormDataList.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceRequest.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceResponse.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamError.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamHandle.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLValue.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteAuthorizer.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteTransaction.cpp \
-	third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp \
-	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/LineEnding.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleICU.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleToScriptMappingDefault.cpp \
-	third_party/WebKit/Source/core/platform/text/PlatformLocale.cpp \
-	third_party/WebKit/Source/core/platform/text/QuotedPrintable.cpp \
-	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp \
-	third_party/WebKit/Source/core/platform/text/SegmentedString.cpp \
-	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/transcoder/FontTranscoder.cpp
+	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -382,20 +261,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -440,7 +318,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -537,20 +415,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -595,7 +472,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform.target.linux-mips.mk b/Source/core/webcore_platform.target.linux-mips.mk
index c3e7f80..69d1f65 100644
--- a/Source/core/webcore_platform.target.linux-mips.mk
+++ b/Source/core/webcore_platform.target.linux-mips.mk
@@ -25,39 +25,25 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/platform/CalculationValue.cpp \
-	third_party/WebKit/Source/core/platform/ContentType.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenu.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenuItem.cpp \
 	third_party/WebKit/Source/core/platform/CrossThreadCopier.cpp \
 	third_party/WebKit/Source/core/platform/Cursor.cpp \
-	third_party/WebKit/Source/core/platform/DateComponents.cpp \
-	third_party/WebKit/Source/core/platform/Decimal.cpp \
 	third_party/WebKit/Source/core/platform/DragData.cpp \
 	third_party/WebKit/Source/core/platform/DragImage.cpp \
-	third_party/WebKit/Source/core/platform/EventTracer.cpp \
-	third_party/WebKit/Source/core/platform/FileChooser.cpp \
-	third_party/WebKit/Source/core/platform/JSONValues.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 \
 	third_party/WebKit/Source/core/platform/Length.cpp \
 	third_party/WebKit/Source/core/platform/LengthBox.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleContext.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleObserver.cpp \
-	third_party/WebKit/Source/core/platform/LinkHash.cpp \
-	third_party/WebKit/Source/core/platform/LocalizedStrings.cpp \
-	third_party/WebKit/Source/core/platform/Logging.cpp \
 	third_party/WebKit/Source/core/platform/MIMETypeFromURL.cpp \
-	third_party/WebKit/Source/core/platform/NotImplemented.cpp \
-	third_party/WebKit/Source/core/platform/Partitions.cpp \
 	third_party/WebKit/Source/core/platform/Pasteboard.cpp \
-	third_party/WebKit/Source/core/platform/PlatformEvent.cpp \
 	third_party/WebKit/Source/core/platform/PlatformInstrumentation.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisUtterance.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisVoice.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesizer.cpp \
-	third_party/WebKit/Source/core/platform/PurgeableBuffer.cpp \
+	third_party/WebKit/Source/core/platform/Prerender.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimator.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimatorNone.cpp \
 	third_party/WebKit/Source/core/platform/ScrollView.cpp \
@@ -67,81 +53,19 @@
 	third_party/WebKit/Source/core/platform/ScrollbarThemeAndroid.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeNonMacCommon.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeOverlay.cpp \
-	third_party/WebKit/Source/core/platform/SecureTextInput.cpp \
-	third_party/WebKit/Source/core/platform/SharedBuffer.cpp \
-	third_party/WebKit/Source/core/platform/SharedBufferChunkReader.cpp \
-	third_party/WebKit/Source/core/platform/ThreadGlobalData.cpp \
-	third_party/WebKit/Source/core/platform/ThreadTimers.cpp \
-	third_party/WebKit/Source/core/platform/Timer.cpp \
-	third_party/WebKit/Source/core/platform/UUID.cpp \
-	third_party/WebKit/Source/core/platform/Widget.cpp \
 	third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationData.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.cpp \
 	third_party/WebKit/Source/core/platform/animation/KeyframeValueList.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioBus.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioChannel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioDSPKernelProcessor.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioPullFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResamplerKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioUtilities.cpp \
-	third_party/WebKit/Source/core/platform/audio/Biquad.cpp \
-	third_party/WebKit/Source/core/platform/audio/Cone.cpp \
-	third_party/WebKit/Source/core/platform/audio/DirectConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/Distance.cpp \
-	third_party/WebKit/Source/core/platform/audio/DownSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressor.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressorKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/EqualPowerPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrame.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrameStub.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabase.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabaseLoader.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFElevation.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/MultiChannelResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/Panner.cpp \
-	third_party/WebKit/Source/core/platform/audio/Reverb.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbAccumulationBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolverStage.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbInputBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/SincResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/UpSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/VectorMath.cpp \
-	third_party/WebKit/Source/core/platform/audio/ZeroPole.cpp \
-	third_party/WebKit/Source/core/platform/audio/chromium/AudioBusChromium.cpp \
-	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/ipp/FFTFrameIPP.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionAndroid.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MemoryUsageSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MIMETypeRegistryChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PlatformKeyboardEventChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformScreenChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformSpeechSynthesizerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/Prerender.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PrerenderHandle.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SSLKeyGeneratorChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SharedTimerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SoundChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/StatsCounterChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SuddenTerminationChromium.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ANGLEWebKitBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/BitmapImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModule.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModuleSession.cpp \
@@ -151,14 +75,10 @@
 	third_party/WebKit/Source/core/platform/graphics/Extensions3D.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Font.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontCache.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontDescription.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFallbackList.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFamily.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFeatureSettings.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFastPath.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FrameData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutBoxExtent.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratorGeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GlyphPageTreeNode.cpp \
@@ -171,21 +91,16 @@
 	third_party/WebKit/Source/core/platform/graphics/GraphicsTypes.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Image.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageBuffer.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ImageOrientation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageSource.cpp \
 	third_party/WebKit/Source/core/platform/graphics/MediaPlayer.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Path.cpp \
-	third_party/WebKit/Source/core/platform/graphics/PathTraversalState.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Pattern.cpp \
-	third_party/WebKit/Source/core/platform/graphics/RoundedRect.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SegmentedFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ShadowBlur.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SimpleFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SVGGlyph.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StringTruncator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StrokeData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/SurrogatePairAwareTextIterator.cpp \
-	third_party/WebKit/Source/core/platform/graphics/TextRun.cpp \
 	third_party/WebKit/Source/core/platform/graphics/WidthIterator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerManager.cpp \
@@ -287,52 +202,16 @@
 	third_party/WebKit/Source/core/platform/mediastream/RTCDTMFSenderHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.cpp \
-	third_party/WebKit/Source/core/platform/midi/MIDIAccessor.cpp \
-	third_party/WebKit/Source/core/platform/mock/DeviceOrientationClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.cpp \
-	third_party/WebKit/Source/core/platform/mock/MIDIClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/PlatformSpeechSynthesizerMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/ScrollbarThemeMock.cpp \
 	third_party/WebKit/Source/core/platform/network/BlobData.cpp \
-	third_party/WebKit/Source/core/platform/network/DNS.cpp \
 	third_party/WebKit/Source/core/platform/network/FormData.cpp \
 	third_party/WebKit/Source/core/platform/network/FormDataBuilder.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPHeaderMap.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPParsers.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPRequest.cpp \
-	third_party/WebKit/Source/core/platform/network/MIMEHeader.cpp \
-	third_party/WebKit/Source/core/platform/network/NetworkStateNotifier.cpp \
-	third_party/WebKit/Source/core/platform/network/ParsedContentType.cpp \
-	third_party/WebKit/Source/core/platform/network/ProxyServer.cpp \
-	third_party/WebKit/Source/core/platform/network/ResourceError.cpp \
+	third_party/WebKit/Source/core/platform/network/FormDataList.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceRequest.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceResponse.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamError.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamHandle.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLValue.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteAuthorizer.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteTransaction.cpp \
-	third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp \
-	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/LineEnding.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleICU.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleToScriptMappingDefault.cpp \
-	third_party/WebKit/Source/core/platform/text/PlatformLocale.cpp \
-	third_party/WebKit/Source/core/platform/text/QuotedPrintable.cpp \
-	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp \
-	third_party/WebKit/Source/core/platform/text/SegmentedString.cpp \
-	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/transcoder/FontTranscoder.cpp
+	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -382,20 +261,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -440,7 +318,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -537,20 +415,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -595,7 +472,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform.target.linux-x86.mk b/Source/core/webcore_platform.target.linux-x86.mk
index 054e56d..4bf5a83 100644
--- a/Source/core/webcore_platform.target.linux-x86.mk
+++ b/Source/core/webcore_platform.target.linux-x86.mk
@@ -25,39 +25,25 @@
 
 LOCAL_SRC_FILES := \
 	third_party/WebKit/Source/core/platform/CalculationValue.cpp \
-	third_party/WebKit/Source/core/platform/ContentType.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenu.cpp \
 	third_party/WebKit/Source/core/platform/ContextMenuItem.cpp \
 	third_party/WebKit/Source/core/platform/CrossThreadCopier.cpp \
 	third_party/WebKit/Source/core/platform/Cursor.cpp \
-	third_party/WebKit/Source/core/platform/DateComponents.cpp \
-	third_party/WebKit/Source/core/platform/Decimal.cpp \
 	third_party/WebKit/Source/core/platform/DragData.cpp \
 	third_party/WebKit/Source/core/platform/DragImage.cpp \
-	third_party/WebKit/Source/core/platform/EventTracer.cpp \
-	third_party/WebKit/Source/core/platform/FileChooser.cpp \
-	third_party/WebKit/Source/core/platform/JSONValues.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 \
 	third_party/WebKit/Source/core/platform/Length.cpp \
 	third_party/WebKit/Source/core/platform/LengthBox.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleContext.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleNotifier.cpp \
 	third_party/WebKit/Source/core/platform/LifecycleObserver.cpp \
-	third_party/WebKit/Source/core/platform/LinkHash.cpp \
-	third_party/WebKit/Source/core/platform/LocalizedStrings.cpp \
-	third_party/WebKit/Source/core/platform/Logging.cpp \
 	third_party/WebKit/Source/core/platform/MIMETypeFromURL.cpp \
-	third_party/WebKit/Source/core/platform/NotImplemented.cpp \
-	third_party/WebKit/Source/core/platform/Partitions.cpp \
 	third_party/WebKit/Source/core/platform/Pasteboard.cpp \
-	third_party/WebKit/Source/core/platform/PlatformEvent.cpp \
 	third_party/WebKit/Source/core/platform/PlatformInstrumentation.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisUtterance.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesisVoice.cpp \
 	third_party/WebKit/Source/core/platform/PlatformSpeechSynthesizer.cpp \
-	third_party/WebKit/Source/core/platform/PurgeableBuffer.cpp \
+	third_party/WebKit/Source/core/platform/Prerender.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimator.cpp \
 	third_party/WebKit/Source/core/platform/ScrollAnimatorNone.cpp \
 	third_party/WebKit/Source/core/platform/ScrollView.cpp \
@@ -67,81 +53,19 @@
 	third_party/WebKit/Source/core/platform/ScrollbarThemeAndroid.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeNonMacCommon.cpp \
 	third_party/WebKit/Source/core/platform/ScrollbarThemeOverlay.cpp \
-	third_party/WebKit/Source/core/platform/SecureTextInput.cpp \
-	third_party/WebKit/Source/core/platform/SharedBuffer.cpp \
-	third_party/WebKit/Source/core/platform/SharedBufferChunkReader.cpp \
-	third_party/WebKit/Source/core/platform/ThreadGlobalData.cpp \
-	third_party/WebKit/Source/core/platform/ThreadTimers.cpp \
-	third_party/WebKit/Source/core/platform/Timer.cpp \
-	third_party/WebKit/Source/core/platform/UUID.cpp \
-	third_party/WebKit/Source/core/platform/Widget.cpp \
 	third_party/WebKit/Source/core/platform/animation/AnimationTranslationUtil.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationData.cpp \
 	third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.cpp \
 	third_party/WebKit/Source/core/platform/animation/KeyframeValueList.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioBus.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioChannel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioDSPKernelProcessor.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioPullFIFO.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioResamplerKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/AudioUtilities.cpp \
-	third_party/WebKit/Source/core/platform/audio/Biquad.cpp \
-	third_party/WebKit/Source/core/platform/audio/Cone.cpp \
-	third_party/WebKit/Source/core/platform/audio/DirectConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/Distance.cpp \
-	third_party/WebKit/Source/core/platform/audio/DownSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressor.cpp \
-	third_party/WebKit/Source/core/platform/audio/DynamicsCompressorKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/EqualPowerPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrame.cpp \
-	third_party/WebKit/Source/core/platform/audio/FFTFrameStub.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabase.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFDatabaseLoader.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFElevation.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFKernel.cpp \
-	third_party/WebKit/Source/core/platform/audio/HRTFPanner.cpp \
-	third_party/WebKit/Source/core/platform/audio/MultiChannelResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/Panner.cpp \
-	third_party/WebKit/Source/core/platform/audio/Reverb.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbAccumulationBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolver.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbConvolverStage.cpp \
-	third_party/WebKit/Source/core/platform/audio/ReverbInputBuffer.cpp \
-	third_party/WebKit/Source/core/platform/audio/SincResampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/UpSampler.cpp \
-	third_party/WebKit/Source/core/platform/audio/VectorMath.cpp \
-	third_party/WebKit/Source/core/platform/audio/ZeroPole.cpp \
-	third_party/WebKit/Source/core/platform/audio/chromium/AudioBusChromium.cpp \
-	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/ipp/FFTFrameIPP.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp \
 	third_party/WebKit/Source/core/platform/chromium/ChromiumDataObjectItem.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardMimeTypes.cpp \
-	third_party/WebKit/Source/core/platform/chromium/ClipboardUtilitiesChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/FileSystemChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/FramelessScrollView.cpp \
 	third_party/WebKit/Source/core/platform/chromium/HistogramSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/KeyCodeConversionAndroid.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MemoryUsageSupportChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/MIMETypeRegistryChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PlatformKeyboardEventChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformScreenChromium.cpp \
 	third_party/WebKit/Source/core/platform/chromium/PlatformSpeechSynthesizerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/Prerender.cpp \
-	third_party/WebKit/Source/core/platform/chromium/PrerenderHandle.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SSLKeyGeneratorChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SharedTimerChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SoundChromiumPosix.cpp \
-	third_party/WebKit/Source/core/platform/chromium/StatsCounterChromium.cpp \
-	third_party/WebKit/Source/core/platform/chromium/SuddenTerminationChromium.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ANGLEWebKitBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/BitmapImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModule.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ContentDecryptionModuleSession.cpp \
@@ -151,14 +75,10 @@
 	third_party/WebKit/Source/core/platform/graphics/Extensions3D.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Font.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontCache.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontDescription.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFallbackList.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFamily.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FontFeatureSettings.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FontFastPath.cpp \
 	third_party/WebKit/Source/core/platform/graphics/FrameData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutBoxExtent.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratorGeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GeneratedImage.cpp \
 	third_party/WebKit/Source/core/platform/graphics/GlyphPageTreeNode.cpp \
@@ -171,21 +91,16 @@
 	third_party/WebKit/Source/core/platform/graphics/GraphicsTypes.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Image.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageBuffer.cpp \
-	third_party/WebKit/Source/core/platform/graphics/ImageOrientation.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ImageSource.cpp \
 	third_party/WebKit/Source/core/platform/graphics/MediaPlayer.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Path.cpp \
-	third_party/WebKit/Source/core/platform/graphics/PathTraversalState.cpp \
 	third_party/WebKit/Source/core/platform/graphics/Pattern.cpp \
-	third_party/WebKit/Source/core/platform/graphics/RoundedRect.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SegmentedFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/ShadowBlur.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SimpleFontData.cpp \
 	third_party/WebKit/Source/core/platform/graphics/SVGGlyph.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StringTruncator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/StrokeData.cpp \
-	third_party/WebKit/Source/core/platform/graphics/SurrogatePairAwareTextIterator.cpp \
-	third_party/WebKit/Source/core/platform/graphics/TextRun.cpp \
 	third_party/WebKit/Source/core/platform/graphics/WidthIterator.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp \
 	third_party/WebKit/Source/core/platform/graphics/chromium/Canvas2DLayerManager.cpp \
@@ -287,52 +202,16 @@
 	third_party/WebKit/Source/core/platform/mediastream/RTCDTMFSenderHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCDataChannelHandler.cpp \
 	third_party/WebKit/Source/core/platform/mediastream/RTCPeerConnectionHandler.cpp \
-	third_party/WebKit/Source/core/platform/midi/MIDIAccessor.cpp \
-	third_party/WebKit/Source/core/platform/mock/DeviceOrientationClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/GeolocationClientMock.cpp \
-	third_party/WebKit/Source/core/platform/mock/MIDIClientMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/PlatformSpeechSynthesizerMock.cpp \
 	third_party/WebKit/Source/core/platform/mock/ScrollbarThemeMock.cpp \
 	third_party/WebKit/Source/core/platform/network/BlobData.cpp \
-	third_party/WebKit/Source/core/platform/network/DNS.cpp \
 	third_party/WebKit/Source/core/platform/network/FormData.cpp \
 	third_party/WebKit/Source/core/platform/network/FormDataBuilder.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPHeaderMap.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPParsers.cpp \
-	third_party/WebKit/Source/core/platform/network/HTTPRequest.cpp \
-	third_party/WebKit/Source/core/platform/network/MIMEHeader.cpp \
-	third_party/WebKit/Source/core/platform/network/NetworkStateNotifier.cpp \
-	third_party/WebKit/Source/core/platform/network/ParsedContentType.cpp \
-	third_party/WebKit/Source/core/platform/network/ProxyServer.cpp \
-	third_party/WebKit/Source/core/platform/network/ResourceError.cpp \
+	third_party/WebKit/Source/core/platform/network/FormDataList.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceRequest.cpp \
 	third_party/WebKit/Source/core/platform/network/ResourceResponse.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamError.cpp \
-	third_party/WebKit/Source/core/platform/network/SocketStreamHandle.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLValue.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteAuthorizer.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp \
-	third_party/WebKit/Source/core/platform/sql/SQLiteTransaction.cpp \
-	third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp \
-	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/LineEnding.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleICU.cpp \
-	third_party/WebKit/Source/core/platform/text/LocaleToScriptMappingDefault.cpp \
-	third_party/WebKit/Source/core/platform/text/PlatformLocale.cpp \
-	third_party/WebKit/Source/core/platform/text/QuotedPrintable.cpp \
-	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp \
-	third_party/WebKit/Source/core/platform/text/SegmentedString.cpp \
-	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/transcoder/FontTranscoder.cpp
+	third_party/WebKit/Source/core/platform/text/RegularExpression.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -384,20 +263,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -442,7 +320,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -542,20 +420,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -600,7 +477,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform_geometry.target.darwin-arm.mk b/Source/core/webcore_platform_geometry.target.darwin-arm.mk
index 2e6273f..26a0dbb 100644
--- a/Source/core/webcore_platform_geometry.target.darwin-arm.mk
+++ b/Source/core/webcore_platform_geometry.target.darwin-arm.mk
@@ -24,17 +24,7 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint3D.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatQuad.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatSize.cpp \
-	third_party/WebKit/Source/core/platform/graphics/IntRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/Region.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/TransformationMatrix.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/AffineTransform.cpp
+	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -84,20 +74,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -142,7 +131,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -238,20 +227,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -296,7 +284,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform_geometry.target.darwin-mips.mk b/Source/core/webcore_platform_geometry.target.darwin-mips.mk
index 53c3b99..8f5d0f1 100644
--- a/Source/core/webcore_platform_geometry.target.darwin-mips.mk
+++ b/Source/core/webcore_platform_geometry.target.darwin-mips.mk
@@ -24,17 +24,7 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint3D.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatQuad.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatSize.cpp \
-	third_party/WebKit/Source/core/platform/graphics/IntRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/Region.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/TransformationMatrix.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/AffineTransform.cpp
+	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -84,20 +74,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -142,7 +131,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -238,20 +227,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -296,7 +284,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform_geometry.target.darwin-x86.mk b/Source/core/webcore_platform_geometry.target.darwin-x86.mk
index 5af0ac3..d589c7b 100644
--- a/Source/core/webcore_platform_geometry.target.darwin-x86.mk
+++ b/Source/core/webcore_platform_geometry.target.darwin-x86.mk
@@ -24,17 +24,7 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint3D.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatQuad.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatSize.cpp \
-	third_party/WebKit/Source/core/platform/graphics/IntRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/Region.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/TransformationMatrix.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/AffineTransform.cpp
+	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -86,20 +76,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -144,7 +133,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -243,20 +232,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -301,7 +289,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform_geometry.target.linux-arm.mk b/Source/core/webcore_platform_geometry.target.linux-arm.mk
index 2e6273f..26a0dbb 100644
--- a/Source/core/webcore_platform_geometry.target.linux-arm.mk
+++ b/Source/core/webcore_platform_geometry.target.linux-arm.mk
@@ -24,17 +24,7 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint3D.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatQuad.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatSize.cpp \
-	third_party/WebKit/Source/core/platform/graphics/IntRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/Region.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/TransformationMatrix.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/AffineTransform.cpp
+	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -84,20 +74,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -142,7 +131,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -238,20 +227,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -296,7 +284,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform_geometry.target.linux-mips.mk b/Source/core/webcore_platform_geometry.target.linux-mips.mk
index 53c3b99..8f5d0f1 100644
--- a/Source/core/webcore_platform_geometry.target.linux-mips.mk
+++ b/Source/core/webcore_platform_geometry.target.linux-mips.mk
@@ -24,17 +24,7 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint3D.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatQuad.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatSize.cpp \
-	third_party/WebKit/Source/core/platform/graphics/IntRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/Region.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/TransformationMatrix.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/AffineTransform.cpp
+	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -84,20 +74,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -142,7 +131,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -238,20 +227,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -296,7 +284,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_platform_geometry.target.linux-x86.mk b/Source/core/webcore_platform_geometry.target.linux-x86.mk
index 5af0ac3..d589c7b 100644
--- a/Source/core/webcore_platform_geometry.target.linux-x86.mk
+++ b/Source/core/webcore_platform_geometry.target.linux-x86.mk
@@ -24,17 +24,7 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatPoint3D.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatQuad.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/FloatSize.cpp \
-	third_party/WebKit/Source/core/platform/graphics/IntRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/LayoutRect.cpp \
-	third_party/WebKit/Source/core/platform/graphics/Region.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/TransformationMatrix.cpp \
-	third_party/WebKit/Source/core/platform/graphics/transforms/AffineTransform.cpp
+	third_party/WebKit/Source/core/platform/graphics/FloatPolygon.cpp
 
 
 # Flags passed to both C and C++ files.
@@ -86,20 +76,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -144,7 +133,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -243,20 +232,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -301,7 +289,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_prerequisites.target.darwin-arm.mk b/Source/core/webcore_prerequisites.target.darwin-arm.mk
index 9b63115..1b1fd9e 100644
--- a/Source/core/webcore_prerequisites.target.darwin-arm.mk
+++ b/Source/core/webcore_prerequisites.target.darwin-arm.mk
@@ -24,9 +24,9 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_platform_blink_platform_gyp)/third_party_WebKit_Source_platform_blink_platform_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,third_party_angle_dx11_src_translator_glsl_gyp)/third_party_angle_dx11_src_translator_glsl_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
+	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_angle_dx11_src_translator_gyp)/third_party_angle_dx11_src_translator_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_iccjpeg_iccjpeg_gyp)/third_party_iccjpeg_iccjpeg_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_libpng_libpng_gyp)/third_party_libpng_libpng_gyp.a \
 	$(call intermediates-dir-for,GYP,third_party_libwebp_libwebp_gyp)/webp.stamp \
diff --git a/Source/core/webcore_prerequisites.target.darwin-mips.mk b/Source/core/webcore_prerequisites.target.darwin-mips.mk
index 9b63115..1b1fd9e 100644
--- a/Source/core/webcore_prerequisites.target.darwin-mips.mk
+++ b/Source/core/webcore_prerequisites.target.darwin-mips.mk
@@ -24,9 +24,9 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_platform_blink_platform_gyp)/third_party_WebKit_Source_platform_blink_platform_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,third_party_angle_dx11_src_translator_glsl_gyp)/third_party_angle_dx11_src_translator_glsl_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
+	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_angle_dx11_src_translator_gyp)/third_party_angle_dx11_src_translator_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_iccjpeg_iccjpeg_gyp)/third_party_iccjpeg_iccjpeg_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_libpng_libpng_gyp)/third_party_libpng_libpng_gyp.a \
 	$(call intermediates-dir-for,GYP,third_party_libwebp_libwebp_gyp)/webp.stamp \
diff --git a/Source/core/webcore_prerequisites.target.darwin-x86.mk b/Source/core/webcore_prerequisites.target.darwin-x86.mk
index 9b63115..1b1fd9e 100644
--- a/Source/core/webcore_prerequisites.target.darwin-x86.mk
+++ b/Source/core/webcore_prerequisites.target.darwin-x86.mk
@@ -24,9 +24,9 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_platform_blink_platform_gyp)/third_party_WebKit_Source_platform_blink_platform_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,third_party_angle_dx11_src_translator_glsl_gyp)/third_party_angle_dx11_src_translator_glsl_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
+	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_angle_dx11_src_translator_gyp)/third_party_angle_dx11_src_translator_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_iccjpeg_iccjpeg_gyp)/third_party_iccjpeg_iccjpeg_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_libpng_libpng_gyp)/third_party_libpng_libpng_gyp.a \
 	$(call intermediates-dir-for,GYP,third_party_libwebp_libwebp_gyp)/webp.stamp \
diff --git a/Source/core/webcore_prerequisites.target.linux-arm.mk b/Source/core/webcore_prerequisites.target.linux-arm.mk
index 9b63115..1b1fd9e 100644
--- a/Source/core/webcore_prerequisites.target.linux-arm.mk
+++ b/Source/core/webcore_prerequisites.target.linux-arm.mk
@@ -24,9 +24,9 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_platform_blink_platform_gyp)/third_party_WebKit_Source_platform_blink_platform_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,third_party_angle_dx11_src_translator_glsl_gyp)/third_party_angle_dx11_src_translator_glsl_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
+	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_angle_dx11_src_translator_gyp)/third_party_angle_dx11_src_translator_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_iccjpeg_iccjpeg_gyp)/third_party_iccjpeg_iccjpeg_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_libpng_libpng_gyp)/third_party_libpng_libpng_gyp.a \
 	$(call intermediates-dir-for,GYP,third_party_libwebp_libwebp_gyp)/webp.stamp \
diff --git a/Source/core/webcore_prerequisites.target.linux-mips.mk b/Source/core/webcore_prerequisites.target.linux-mips.mk
index 9b63115..1b1fd9e 100644
--- a/Source/core/webcore_prerequisites.target.linux-mips.mk
+++ b/Source/core/webcore_prerequisites.target.linux-mips.mk
@@ -24,9 +24,9 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_platform_blink_platform_gyp)/third_party_WebKit_Source_platform_blink_platform_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,third_party_angle_dx11_src_translator_glsl_gyp)/third_party_angle_dx11_src_translator_glsl_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
+	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_angle_dx11_src_translator_gyp)/third_party_angle_dx11_src_translator_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_iccjpeg_iccjpeg_gyp)/third_party_iccjpeg_iccjpeg_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_libpng_libpng_gyp)/third_party_libpng_libpng_gyp.a \
 	$(call intermediates-dir-for,GYP,third_party_libwebp_libwebp_gyp)/webp.stamp \
diff --git a/Source/core/webcore_prerequisites.target.linux-x86.mk b/Source/core/webcore_prerequisites.target.linux-x86.mk
index 9b63115..1b1fd9e 100644
--- a/Source/core/webcore_prerequisites.target.linux-x86.mk
+++ b/Source/core/webcore_prerequisites.target.linux-x86.mk
@@ -24,9 +24,9 @@
 	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_config_gyp)/config.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_WebKit_Source_platform_blink_platform_gyp)/third_party_WebKit_Source_platform_blink_platform_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,third_party_angle_dx11_src_translator_glsl_gyp)/third_party_angle_dx11_src_translator_glsl_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,gpu_gles2_c_lib_gyp)/gpu_gles2_c_lib_gyp.a \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
+	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_angle_dx11_src_translator_gyp)/third_party_angle_dx11_src_translator_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_iccjpeg_iccjpeg_gyp)/third_party_iccjpeg_iccjpeg_gyp.a \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,third_party_libpng_libpng_gyp)/third_party_libpng_libpng_gyp.a \
 	$(call intermediates-dir-for,GYP,third_party_libwebp_libwebp_gyp)/webp.stamp \
diff --git a/Source/core/webcore_remaining.target.darwin-arm.mk b/Source/core/webcore_remaining.target.darwin-arm.mk
index 8866fa8..5d3e484 100644
--- a/Source/core/webcore_remaining.target.darwin-arm.mk
+++ b/Source/core/webcore_remaining.target.darwin-arm.mk
@@ -52,10 +52,18 @@
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableColumn.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableHeaderContainer.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableRow.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableClipPathOperation.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableColor.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableDouble.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableImage.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLength.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableLengthBox.cpp \
-	third_party/WebKit/Source/core/animation/AnimatableNumber.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLengthSize.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableRepeatable.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGLength.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableShapeValue.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableStrokeDasharrayList.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableTransform.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableVisibility.cpp \
@@ -87,7 +95,9 @@
 	third_party/WebKit/Source/core/css/CSSFontFaceRule.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp \
+	third_party/WebKit/Source/core/css/CSSFontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFontSelector.cpp \
+	third_party/WebKit/Source/core/css/CSSFontValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGradientValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGridTemplateValue.cpp \
@@ -116,9 +126,11 @@
 	third_party/WebKit/Source/core/css/CSSRule.cpp \
 	third_party/WebKit/Source/core/css/CSSRuleList.cpp \
 	third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp \
+	third_party/WebKit/Source/core/css/CSSSegmentedFontFaceCache.cpp \
 	third_party/WebKit/Source/core/css/CSSSelector.cpp \
 	third_party/WebKit/Source/core/css/CSSSelectorList.cpp \
 	third_party/WebKit/Source/core/css/CSSShaderValue.cpp \
+	third_party/WebKit/Source/core/css/CSSShadowValue.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleRule.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleSheet.cpp \
@@ -138,9 +150,7 @@
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
 	third_party/WebKit/Source/core/css/FontFaceSet.cpp \
 	third_party/WebKit/Source/core/css/FontFace.cpp \
-	third_party/WebKit/Source/core/css/FontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/FontSize.cpp \
-	third_party/WebKit/Source/core/css/FontValue.cpp \
 	third_party/WebKit/Source/core/css/InspectorCSSOMWrappers.cpp \
 	third_party/WebKit/Source/core/css/LengthFunctions.cpp \
 	third_party/WebKit/Source/core/css/MediaFeatureNames.cpp \
@@ -161,7 +171,6 @@
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
-	third_party/WebKit/Source/core/css/ShadowValue.cpp \
 	third_party/WebKit/Source/core/css/StyleInvalidationAnalysis.cpp \
 	third_party/WebKit/Source/core/css/StyleMedia.cpp \
 	third_party/WebKit/Source/core/css/StylePropertySerializer.cpp \
@@ -227,6 +236,7 @@
 	third_party/WebKit/Source/core/editing/SetSelectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SimplifyMarkupCommand.cpp \
 	third_party/WebKit/Source/core/editing/SmartReplaceICU.cpp \
+	third_party/WebKit/Source/core/editing/SpellChecker.cpp \
 	third_party/WebKit/Source/core/editing/SpellCheckRequester.cpp \
 	third_party/WebKit/Source/core/editing/SpellingCorrectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SplitElementCommand.cpp \
@@ -375,42 +385,40 @@
 	third_party/WebKit/Source/core/loader/archive/MHTMLArchive.cpp \
 	third_party/WebKit/Source/core/loader/archive/MHTMLParser.cpp \
 	third_party/WebKit/Source/core/page/AutoscrollController.cpp \
-	third_party/WebKit/Source/core/page/BarProp.cpp \
+	third_party/WebKit/Source/core/frame/BarProp.cpp \
 	third_party/WebKit/Source/core/page/Chrome.cpp \
-	third_party/WebKit/Source/core/page/Console.cpp \
-	third_party/WebKit/Source/core/page/ConsoleBase.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicy.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicyResponseHeaders.cpp \
+	third_party/WebKit/Source/core/frame/Console.cpp \
+	third_party/WebKit/Source/core/frame/ConsoleBase.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicyResponseHeaders.cpp \
 	third_party/WebKit/Source/core/page/ContextMenuController.cpp \
 	third_party/WebKit/Source/core/page/CreateWindow.cpp \
-	third_party/WebKit/Source/core/page/DeviceController.cpp \
-	third_party/WebKit/Source/core/page/DiagnosticLoggingKeys.cpp \
-	third_party/WebKit/Source/core/page/DOMSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/DOMSecurityPolicy.cpp \
 	third_party/WebKit/Source/core/page/DOMSelection.cpp \
-	third_party/WebKit/Source/core/page/DOMTimer.cpp \
-	third_party/WebKit/Source/core/page/DOMWindow.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowBase64.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowTimers.cpp \
+	third_party/WebKit/Source/core/frame/DOMTimer.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindow.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowBase64.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleNotifier.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleObserver.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowTimers.cpp \
 	third_party/WebKit/Source/core/page/DOMWindowPagePopup.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowProperty.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowProperty.cpp \
 	third_party/WebKit/Source/core/page/DragController.cpp \
 	third_party/WebKit/Source/core/page/EventHandler.cpp \
 	third_party/WebKit/Source/core/page/EventSource.cpp \
 	third_party/WebKit/Source/core/page/FocusController.cpp \
-	third_party/WebKit/Source/core/page/Frame.cpp \
-	third_party/WebKit/Source/core/page/FrameActionScheduler.cpp \
-	third_party/WebKit/Source/core/page/FrameDestructionObserver.cpp \
+	third_party/WebKit/Source/core/frame/Frame.cpp \
+	third_party/WebKit/Source/core/frame/FrameDestructionObserver.cpp \
 	third_party/WebKit/Source/core/page/FrameTree.cpp \
-	third_party/WebKit/Source/core/page/FrameView.cpp \
-	third_party/WebKit/Source/core/page/History.cpp \
-	third_party/WebKit/Source/core/page/ImageBitmap.cpp \
-	third_party/WebKit/Source/core/page/Location.cpp \
-	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
+	third_party/WebKit/Source/core/frame/FrameView.cpp \
+	third_party/WebKit/Source/core/frame/History.cpp \
+	third_party/WebKit/Source/core/frame/ImageBitmap.cpp \
+	third_party/WebKit/Source/core/frame/Location.cpp \
+	third_party/WebKit/Source/core/timing/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
-	third_party/WebKit/Source/core/page/Navigator.cpp \
-	third_party/WebKit/Source/core/page/NavigatorID.cpp \
+	third_party/WebKit/Source/core/frame/Navigator.cpp \
+	third_party/WebKit/Source/core/frame/NavigatorID.cpp \
+	third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp \
 	third_party/WebKit/Source/core/page/Page.cpp \
 	third_party/WebKit/Source/core/page/PageConsole.cpp \
 	third_party/WebKit/Source/core/page/PageGroup.cpp \
@@ -420,40 +428,34 @@
 	third_party/WebKit/Source/core/page/PagePopupController.cpp \
 	third_party/WebKit/Source/core/page/PagePopupClient.cpp \
 	third_party/WebKit/Source/core/page/PageScaleConstraints.cpp \
-	third_party/WebKit/Source/core/page/PageScaleConstraintsSet.cpp \
 	third_party/WebKit/Source/core/page/PageSerializer.cpp \
 	third_party/WebKit/Source/core/page/PageVisibilityState.cpp \
-	third_party/WebKit/Source/core/page/Performance.cpp \
-	third_party/WebKit/Source/core/page/PerformanceEntry.cpp \
-	third_party/WebKit/Source/core/page/PerformanceNavigation.cpp \
-	third_party/WebKit/Source/core/page/PerformanceResourceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceUserTiming.cpp \
+	third_party/WebKit/Source/core/timing/Performance.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceEntry.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceNavigation.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp \
 	third_party/WebKit/Source/core/page/PointerLockController.cpp \
 	third_party/WebKit/Source/core/page/PrintContext.cpp \
 	third_party/WebKit/Source/core/page/RuntimeCSSEnabled.cpp \
 	third_party/WebKit/Source/core/page/RuntimeEnabledFeaturesCustom.cpp \
-	third_party/WebKit/Source/core/page/Screen.cpp \
+	third_party/WebKit/Source/core/frame/Screen.cpp \
 	third_party/WebKit/Source/core/page/Settings.cpp \
 	third_party/WebKit/Source/core/page/SpatialNavigation.cpp \
-	third_party/WebKit/Source/core/page/SpeechInput.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputEvent.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResult.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResultList.cpp \
-	third_party/WebKit/Source/core/page/SuspendableTimer.cpp \
+	third_party/WebKit/Source/core/frame/SuspendableTimer.cpp \
 	third_party/WebKit/Source/core/page/TouchAdjustment.cpp \
 	third_party/WebKit/Source/core/page/TouchDisambiguation.cpp \
 	third_party/WebKit/Source/core/page/UseCounter.cpp \
-	third_party/WebKit/Source/core/page/UserContentURLPattern.cpp \
 	third_party/WebKit/Source/core/page/WindowFeatures.cpp \
 	third_party/WebKit/Source/core/page/WindowFocusAllowedIndicator.cpp \
-	third_party/WebKit/Source/core/page/WorkerNavigator.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationBase.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationController.cpp \
-	third_party/WebKit/Source/core/page/animation/CompositeAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/CSSPropertyAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/ImplicitAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/KeyframeAnimation.cpp \
+	third_party/WebKit/Source/core/workers/WorkerNavigator.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationBase.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationController.cpp \
+	third_party/WebKit/Source/core/frame/animation/CompositeAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/CSSPropertyAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/ImplicitAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/KeyframeAnimation.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingConstraints.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp \
 	third_party/WebKit/Source/core/plugins/DOMMimeType.cpp \
@@ -463,6 +465,10 @@
 	third_party/WebKit/Source/core/plugins/PluginData.cpp \
 	third_party/WebKit/Source/core/plugins/PluginListBuilder.cpp \
 	third_party/WebKit/Source/core/plugins/PluginOcclusionSupport.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInput.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputEvent.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResult.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResultList.cpp \
 	third_party/WebKit/Source/core/storage/Storage.cpp \
 	third_party/WebKit/Source/core/storage/StorageEvent.cpp \
 	third_party/WebKit/Source/core/workers/AbstractWorker.cpp \
@@ -476,7 +482,6 @@
 	third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScopeProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp \
-	third_party/WebKit/Source/core/workers/WorkerLocation.cpp \
 	third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerRunLoop.cpp \
 	third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp \
@@ -563,20 +568,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -621,7 +625,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -718,20 +722,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -776,7 +779,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_remaining.target.darwin-mips.mk b/Source/core/webcore_remaining.target.darwin-mips.mk
index 8f3d77f..e07c57d 100644
--- a/Source/core/webcore_remaining.target.darwin-mips.mk
+++ b/Source/core/webcore_remaining.target.darwin-mips.mk
@@ -52,10 +52,18 @@
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableColumn.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableHeaderContainer.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableRow.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableClipPathOperation.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableColor.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableDouble.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableImage.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLength.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableLengthBox.cpp \
-	third_party/WebKit/Source/core/animation/AnimatableNumber.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLengthSize.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableRepeatable.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGLength.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableShapeValue.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableStrokeDasharrayList.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableTransform.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableVisibility.cpp \
@@ -87,7 +95,9 @@
 	third_party/WebKit/Source/core/css/CSSFontFaceRule.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp \
+	third_party/WebKit/Source/core/css/CSSFontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFontSelector.cpp \
+	third_party/WebKit/Source/core/css/CSSFontValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGradientValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGridTemplateValue.cpp \
@@ -116,9 +126,11 @@
 	third_party/WebKit/Source/core/css/CSSRule.cpp \
 	third_party/WebKit/Source/core/css/CSSRuleList.cpp \
 	third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp \
+	third_party/WebKit/Source/core/css/CSSSegmentedFontFaceCache.cpp \
 	third_party/WebKit/Source/core/css/CSSSelector.cpp \
 	third_party/WebKit/Source/core/css/CSSSelectorList.cpp \
 	third_party/WebKit/Source/core/css/CSSShaderValue.cpp \
+	third_party/WebKit/Source/core/css/CSSShadowValue.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleRule.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleSheet.cpp \
@@ -138,9 +150,7 @@
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
 	third_party/WebKit/Source/core/css/FontFaceSet.cpp \
 	third_party/WebKit/Source/core/css/FontFace.cpp \
-	third_party/WebKit/Source/core/css/FontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/FontSize.cpp \
-	third_party/WebKit/Source/core/css/FontValue.cpp \
 	third_party/WebKit/Source/core/css/InspectorCSSOMWrappers.cpp \
 	third_party/WebKit/Source/core/css/LengthFunctions.cpp \
 	third_party/WebKit/Source/core/css/MediaFeatureNames.cpp \
@@ -161,7 +171,6 @@
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
-	third_party/WebKit/Source/core/css/ShadowValue.cpp \
 	third_party/WebKit/Source/core/css/StyleInvalidationAnalysis.cpp \
 	third_party/WebKit/Source/core/css/StyleMedia.cpp \
 	third_party/WebKit/Source/core/css/StylePropertySerializer.cpp \
@@ -227,6 +236,7 @@
 	third_party/WebKit/Source/core/editing/SetSelectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SimplifyMarkupCommand.cpp \
 	third_party/WebKit/Source/core/editing/SmartReplaceICU.cpp \
+	third_party/WebKit/Source/core/editing/SpellChecker.cpp \
 	third_party/WebKit/Source/core/editing/SpellCheckRequester.cpp \
 	third_party/WebKit/Source/core/editing/SpellingCorrectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SplitElementCommand.cpp \
@@ -375,42 +385,40 @@
 	third_party/WebKit/Source/core/loader/archive/MHTMLArchive.cpp \
 	third_party/WebKit/Source/core/loader/archive/MHTMLParser.cpp \
 	third_party/WebKit/Source/core/page/AutoscrollController.cpp \
-	third_party/WebKit/Source/core/page/BarProp.cpp \
+	third_party/WebKit/Source/core/frame/BarProp.cpp \
 	third_party/WebKit/Source/core/page/Chrome.cpp \
-	third_party/WebKit/Source/core/page/Console.cpp \
-	third_party/WebKit/Source/core/page/ConsoleBase.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicy.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicyResponseHeaders.cpp \
+	third_party/WebKit/Source/core/frame/Console.cpp \
+	third_party/WebKit/Source/core/frame/ConsoleBase.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicyResponseHeaders.cpp \
 	third_party/WebKit/Source/core/page/ContextMenuController.cpp \
 	third_party/WebKit/Source/core/page/CreateWindow.cpp \
-	third_party/WebKit/Source/core/page/DeviceController.cpp \
-	third_party/WebKit/Source/core/page/DiagnosticLoggingKeys.cpp \
-	third_party/WebKit/Source/core/page/DOMSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/DOMSecurityPolicy.cpp \
 	third_party/WebKit/Source/core/page/DOMSelection.cpp \
-	third_party/WebKit/Source/core/page/DOMTimer.cpp \
-	third_party/WebKit/Source/core/page/DOMWindow.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowBase64.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowTimers.cpp \
+	third_party/WebKit/Source/core/frame/DOMTimer.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindow.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowBase64.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleNotifier.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleObserver.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowTimers.cpp \
 	third_party/WebKit/Source/core/page/DOMWindowPagePopup.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowProperty.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowProperty.cpp \
 	third_party/WebKit/Source/core/page/DragController.cpp \
 	third_party/WebKit/Source/core/page/EventHandler.cpp \
 	third_party/WebKit/Source/core/page/EventSource.cpp \
 	third_party/WebKit/Source/core/page/FocusController.cpp \
-	third_party/WebKit/Source/core/page/Frame.cpp \
-	third_party/WebKit/Source/core/page/FrameActionScheduler.cpp \
-	third_party/WebKit/Source/core/page/FrameDestructionObserver.cpp \
+	third_party/WebKit/Source/core/frame/Frame.cpp \
+	third_party/WebKit/Source/core/frame/FrameDestructionObserver.cpp \
 	third_party/WebKit/Source/core/page/FrameTree.cpp \
-	third_party/WebKit/Source/core/page/FrameView.cpp \
-	third_party/WebKit/Source/core/page/History.cpp \
-	third_party/WebKit/Source/core/page/ImageBitmap.cpp \
-	third_party/WebKit/Source/core/page/Location.cpp \
-	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
+	third_party/WebKit/Source/core/frame/FrameView.cpp \
+	third_party/WebKit/Source/core/frame/History.cpp \
+	third_party/WebKit/Source/core/frame/ImageBitmap.cpp \
+	third_party/WebKit/Source/core/frame/Location.cpp \
+	third_party/WebKit/Source/core/timing/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
-	third_party/WebKit/Source/core/page/Navigator.cpp \
-	third_party/WebKit/Source/core/page/NavigatorID.cpp \
+	third_party/WebKit/Source/core/frame/Navigator.cpp \
+	third_party/WebKit/Source/core/frame/NavigatorID.cpp \
+	third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp \
 	third_party/WebKit/Source/core/page/Page.cpp \
 	third_party/WebKit/Source/core/page/PageConsole.cpp \
 	third_party/WebKit/Source/core/page/PageGroup.cpp \
@@ -420,40 +428,34 @@
 	third_party/WebKit/Source/core/page/PagePopupController.cpp \
 	third_party/WebKit/Source/core/page/PagePopupClient.cpp \
 	third_party/WebKit/Source/core/page/PageScaleConstraints.cpp \
-	third_party/WebKit/Source/core/page/PageScaleConstraintsSet.cpp \
 	third_party/WebKit/Source/core/page/PageSerializer.cpp \
 	third_party/WebKit/Source/core/page/PageVisibilityState.cpp \
-	third_party/WebKit/Source/core/page/Performance.cpp \
-	third_party/WebKit/Source/core/page/PerformanceEntry.cpp \
-	third_party/WebKit/Source/core/page/PerformanceNavigation.cpp \
-	third_party/WebKit/Source/core/page/PerformanceResourceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceUserTiming.cpp \
+	third_party/WebKit/Source/core/timing/Performance.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceEntry.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceNavigation.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp \
 	third_party/WebKit/Source/core/page/PointerLockController.cpp \
 	third_party/WebKit/Source/core/page/PrintContext.cpp \
 	third_party/WebKit/Source/core/page/RuntimeCSSEnabled.cpp \
 	third_party/WebKit/Source/core/page/RuntimeEnabledFeaturesCustom.cpp \
-	third_party/WebKit/Source/core/page/Screen.cpp \
+	third_party/WebKit/Source/core/frame/Screen.cpp \
 	third_party/WebKit/Source/core/page/Settings.cpp \
 	third_party/WebKit/Source/core/page/SpatialNavigation.cpp \
-	third_party/WebKit/Source/core/page/SpeechInput.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputEvent.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResult.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResultList.cpp \
-	third_party/WebKit/Source/core/page/SuspendableTimer.cpp \
+	third_party/WebKit/Source/core/frame/SuspendableTimer.cpp \
 	third_party/WebKit/Source/core/page/TouchAdjustment.cpp \
 	third_party/WebKit/Source/core/page/TouchDisambiguation.cpp \
 	third_party/WebKit/Source/core/page/UseCounter.cpp \
-	third_party/WebKit/Source/core/page/UserContentURLPattern.cpp \
 	third_party/WebKit/Source/core/page/WindowFeatures.cpp \
 	third_party/WebKit/Source/core/page/WindowFocusAllowedIndicator.cpp \
-	third_party/WebKit/Source/core/page/WorkerNavigator.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationBase.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationController.cpp \
-	third_party/WebKit/Source/core/page/animation/CompositeAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/CSSPropertyAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/ImplicitAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/KeyframeAnimation.cpp \
+	third_party/WebKit/Source/core/workers/WorkerNavigator.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationBase.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationController.cpp \
+	third_party/WebKit/Source/core/frame/animation/CompositeAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/CSSPropertyAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/ImplicitAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/KeyframeAnimation.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingConstraints.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp \
 	third_party/WebKit/Source/core/plugins/DOMMimeType.cpp \
@@ -463,6 +465,10 @@
 	third_party/WebKit/Source/core/plugins/PluginData.cpp \
 	third_party/WebKit/Source/core/plugins/PluginListBuilder.cpp \
 	third_party/WebKit/Source/core/plugins/PluginOcclusionSupport.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInput.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputEvent.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResult.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResultList.cpp \
 	third_party/WebKit/Source/core/storage/Storage.cpp \
 	third_party/WebKit/Source/core/storage/StorageEvent.cpp \
 	third_party/WebKit/Source/core/workers/AbstractWorker.cpp \
@@ -476,7 +482,6 @@
 	third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScopeProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp \
-	third_party/WebKit/Source/core/workers/WorkerLocation.cpp \
 	third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerRunLoop.cpp \
 	third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp \
@@ -563,20 +568,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -621,7 +625,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -718,20 +722,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -776,7 +779,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_remaining.target.darwin-x86.mk b/Source/core/webcore_remaining.target.darwin-x86.mk
index 1bb045e..fd818da 100644
--- a/Source/core/webcore_remaining.target.darwin-x86.mk
+++ b/Source/core/webcore_remaining.target.darwin-x86.mk
@@ -52,10 +52,18 @@
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableColumn.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableHeaderContainer.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableRow.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableClipPathOperation.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableColor.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableDouble.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableImage.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLength.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableLengthBox.cpp \
-	third_party/WebKit/Source/core/animation/AnimatableNumber.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLengthSize.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableRepeatable.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGLength.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableShapeValue.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableStrokeDasharrayList.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableTransform.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableVisibility.cpp \
@@ -87,7 +95,9 @@
 	third_party/WebKit/Source/core/css/CSSFontFaceRule.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp \
+	third_party/WebKit/Source/core/css/CSSFontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFontSelector.cpp \
+	third_party/WebKit/Source/core/css/CSSFontValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGradientValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGridTemplateValue.cpp \
@@ -116,9 +126,11 @@
 	third_party/WebKit/Source/core/css/CSSRule.cpp \
 	third_party/WebKit/Source/core/css/CSSRuleList.cpp \
 	third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp \
+	third_party/WebKit/Source/core/css/CSSSegmentedFontFaceCache.cpp \
 	third_party/WebKit/Source/core/css/CSSSelector.cpp \
 	third_party/WebKit/Source/core/css/CSSSelectorList.cpp \
 	third_party/WebKit/Source/core/css/CSSShaderValue.cpp \
+	third_party/WebKit/Source/core/css/CSSShadowValue.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleRule.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleSheet.cpp \
@@ -138,9 +150,7 @@
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
 	third_party/WebKit/Source/core/css/FontFaceSet.cpp \
 	third_party/WebKit/Source/core/css/FontFace.cpp \
-	third_party/WebKit/Source/core/css/FontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/FontSize.cpp \
-	third_party/WebKit/Source/core/css/FontValue.cpp \
 	third_party/WebKit/Source/core/css/InspectorCSSOMWrappers.cpp \
 	third_party/WebKit/Source/core/css/LengthFunctions.cpp \
 	third_party/WebKit/Source/core/css/MediaFeatureNames.cpp \
@@ -161,7 +171,6 @@
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
-	third_party/WebKit/Source/core/css/ShadowValue.cpp \
 	third_party/WebKit/Source/core/css/StyleInvalidationAnalysis.cpp \
 	third_party/WebKit/Source/core/css/StyleMedia.cpp \
 	third_party/WebKit/Source/core/css/StylePropertySerializer.cpp \
@@ -227,6 +236,7 @@
 	third_party/WebKit/Source/core/editing/SetSelectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SimplifyMarkupCommand.cpp \
 	third_party/WebKit/Source/core/editing/SmartReplaceICU.cpp \
+	third_party/WebKit/Source/core/editing/SpellChecker.cpp \
 	third_party/WebKit/Source/core/editing/SpellCheckRequester.cpp \
 	third_party/WebKit/Source/core/editing/SpellingCorrectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SplitElementCommand.cpp \
@@ -375,42 +385,40 @@
 	third_party/WebKit/Source/core/loader/archive/MHTMLArchive.cpp \
 	third_party/WebKit/Source/core/loader/archive/MHTMLParser.cpp \
 	third_party/WebKit/Source/core/page/AutoscrollController.cpp \
-	third_party/WebKit/Source/core/page/BarProp.cpp \
+	third_party/WebKit/Source/core/frame/BarProp.cpp \
 	third_party/WebKit/Source/core/page/Chrome.cpp \
-	third_party/WebKit/Source/core/page/Console.cpp \
-	third_party/WebKit/Source/core/page/ConsoleBase.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicy.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicyResponseHeaders.cpp \
+	third_party/WebKit/Source/core/frame/Console.cpp \
+	third_party/WebKit/Source/core/frame/ConsoleBase.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicyResponseHeaders.cpp \
 	third_party/WebKit/Source/core/page/ContextMenuController.cpp \
 	third_party/WebKit/Source/core/page/CreateWindow.cpp \
-	third_party/WebKit/Source/core/page/DeviceController.cpp \
-	third_party/WebKit/Source/core/page/DiagnosticLoggingKeys.cpp \
-	third_party/WebKit/Source/core/page/DOMSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/DOMSecurityPolicy.cpp \
 	third_party/WebKit/Source/core/page/DOMSelection.cpp \
-	third_party/WebKit/Source/core/page/DOMTimer.cpp \
-	third_party/WebKit/Source/core/page/DOMWindow.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowBase64.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowTimers.cpp \
+	third_party/WebKit/Source/core/frame/DOMTimer.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindow.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowBase64.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleNotifier.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleObserver.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowTimers.cpp \
 	third_party/WebKit/Source/core/page/DOMWindowPagePopup.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowProperty.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowProperty.cpp \
 	third_party/WebKit/Source/core/page/DragController.cpp \
 	third_party/WebKit/Source/core/page/EventHandler.cpp \
 	third_party/WebKit/Source/core/page/EventSource.cpp \
 	third_party/WebKit/Source/core/page/FocusController.cpp \
-	third_party/WebKit/Source/core/page/Frame.cpp \
-	third_party/WebKit/Source/core/page/FrameActionScheduler.cpp \
-	third_party/WebKit/Source/core/page/FrameDestructionObserver.cpp \
+	third_party/WebKit/Source/core/frame/Frame.cpp \
+	third_party/WebKit/Source/core/frame/FrameDestructionObserver.cpp \
 	third_party/WebKit/Source/core/page/FrameTree.cpp \
-	third_party/WebKit/Source/core/page/FrameView.cpp \
-	third_party/WebKit/Source/core/page/History.cpp \
-	third_party/WebKit/Source/core/page/ImageBitmap.cpp \
-	third_party/WebKit/Source/core/page/Location.cpp \
-	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
+	third_party/WebKit/Source/core/frame/FrameView.cpp \
+	third_party/WebKit/Source/core/frame/History.cpp \
+	third_party/WebKit/Source/core/frame/ImageBitmap.cpp \
+	third_party/WebKit/Source/core/frame/Location.cpp \
+	third_party/WebKit/Source/core/timing/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
-	third_party/WebKit/Source/core/page/Navigator.cpp \
-	third_party/WebKit/Source/core/page/NavigatorID.cpp \
+	third_party/WebKit/Source/core/frame/Navigator.cpp \
+	third_party/WebKit/Source/core/frame/NavigatorID.cpp \
+	third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp \
 	third_party/WebKit/Source/core/page/Page.cpp \
 	third_party/WebKit/Source/core/page/PageConsole.cpp \
 	third_party/WebKit/Source/core/page/PageGroup.cpp \
@@ -420,40 +428,34 @@
 	third_party/WebKit/Source/core/page/PagePopupController.cpp \
 	third_party/WebKit/Source/core/page/PagePopupClient.cpp \
 	third_party/WebKit/Source/core/page/PageScaleConstraints.cpp \
-	third_party/WebKit/Source/core/page/PageScaleConstraintsSet.cpp \
 	third_party/WebKit/Source/core/page/PageSerializer.cpp \
 	third_party/WebKit/Source/core/page/PageVisibilityState.cpp \
-	third_party/WebKit/Source/core/page/Performance.cpp \
-	third_party/WebKit/Source/core/page/PerformanceEntry.cpp \
-	third_party/WebKit/Source/core/page/PerformanceNavigation.cpp \
-	third_party/WebKit/Source/core/page/PerformanceResourceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceUserTiming.cpp \
+	third_party/WebKit/Source/core/timing/Performance.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceEntry.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceNavigation.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp \
 	third_party/WebKit/Source/core/page/PointerLockController.cpp \
 	third_party/WebKit/Source/core/page/PrintContext.cpp \
 	third_party/WebKit/Source/core/page/RuntimeCSSEnabled.cpp \
 	third_party/WebKit/Source/core/page/RuntimeEnabledFeaturesCustom.cpp \
-	third_party/WebKit/Source/core/page/Screen.cpp \
+	third_party/WebKit/Source/core/frame/Screen.cpp \
 	third_party/WebKit/Source/core/page/Settings.cpp \
 	third_party/WebKit/Source/core/page/SpatialNavigation.cpp \
-	third_party/WebKit/Source/core/page/SpeechInput.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputEvent.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResult.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResultList.cpp \
-	third_party/WebKit/Source/core/page/SuspendableTimer.cpp \
+	third_party/WebKit/Source/core/frame/SuspendableTimer.cpp \
 	third_party/WebKit/Source/core/page/TouchAdjustment.cpp \
 	third_party/WebKit/Source/core/page/TouchDisambiguation.cpp \
 	third_party/WebKit/Source/core/page/UseCounter.cpp \
-	third_party/WebKit/Source/core/page/UserContentURLPattern.cpp \
 	third_party/WebKit/Source/core/page/WindowFeatures.cpp \
 	third_party/WebKit/Source/core/page/WindowFocusAllowedIndicator.cpp \
-	third_party/WebKit/Source/core/page/WorkerNavigator.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationBase.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationController.cpp \
-	third_party/WebKit/Source/core/page/animation/CompositeAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/CSSPropertyAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/ImplicitAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/KeyframeAnimation.cpp \
+	third_party/WebKit/Source/core/workers/WorkerNavigator.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationBase.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationController.cpp \
+	third_party/WebKit/Source/core/frame/animation/CompositeAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/CSSPropertyAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/ImplicitAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/KeyframeAnimation.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingConstraints.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp \
 	third_party/WebKit/Source/core/plugins/DOMMimeType.cpp \
@@ -463,6 +465,10 @@
 	third_party/WebKit/Source/core/plugins/PluginData.cpp \
 	third_party/WebKit/Source/core/plugins/PluginListBuilder.cpp \
 	third_party/WebKit/Source/core/plugins/PluginOcclusionSupport.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInput.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputEvent.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResult.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResultList.cpp \
 	third_party/WebKit/Source/core/storage/Storage.cpp \
 	third_party/WebKit/Source/core/storage/StorageEvent.cpp \
 	third_party/WebKit/Source/core/workers/AbstractWorker.cpp \
@@ -476,7 +482,6 @@
 	third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScopeProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp \
-	third_party/WebKit/Source/core/workers/WorkerLocation.cpp \
 	third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerRunLoop.cpp \
 	third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp \
@@ -565,20 +570,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -623,7 +627,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -723,20 +727,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -781,7 +784,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_remaining.target.linux-arm.mk b/Source/core/webcore_remaining.target.linux-arm.mk
index 8866fa8..5d3e484 100644
--- a/Source/core/webcore_remaining.target.linux-arm.mk
+++ b/Source/core/webcore_remaining.target.linux-arm.mk
@@ -52,10 +52,18 @@
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableColumn.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableHeaderContainer.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableRow.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableClipPathOperation.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableColor.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableDouble.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableImage.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLength.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableLengthBox.cpp \
-	third_party/WebKit/Source/core/animation/AnimatableNumber.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLengthSize.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableRepeatable.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGLength.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableShapeValue.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableStrokeDasharrayList.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableTransform.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableVisibility.cpp \
@@ -87,7 +95,9 @@
 	third_party/WebKit/Source/core/css/CSSFontFaceRule.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp \
+	third_party/WebKit/Source/core/css/CSSFontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFontSelector.cpp \
+	third_party/WebKit/Source/core/css/CSSFontValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGradientValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGridTemplateValue.cpp \
@@ -116,9 +126,11 @@
 	third_party/WebKit/Source/core/css/CSSRule.cpp \
 	third_party/WebKit/Source/core/css/CSSRuleList.cpp \
 	third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp \
+	third_party/WebKit/Source/core/css/CSSSegmentedFontFaceCache.cpp \
 	third_party/WebKit/Source/core/css/CSSSelector.cpp \
 	third_party/WebKit/Source/core/css/CSSSelectorList.cpp \
 	third_party/WebKit/Source/core/css/CSSShaderValue.cpp \
+	third_party/WebKit/Source/core/css/CSSShadowValue.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleRule.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleSheet.cpp \
@@ -138,9 +150,7 @@
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
 	third_party/WebKit/Source/core/css/FontFaceSet.cpp \
 	third_party/WebKit/Source/core/css/FontFace.cpp \
-	third_party/WebKit/Source/core/css/FontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/FontSize.cpp \
-	third_party/WebKit/Source/core/css/FontValue.cpp \
 	third_party/WebKit/Source/core/css/InspectorCSSOMWrappers.cpp \
 	third_party/WebKit/Source/core/css/LengthFunctions.cpp \
 	third_party/WebKit/Source/core/css/MediaFeatureNames.cpp \
@@ -161,7 +171,6 @@
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
-	third_party/WebKit/Source/core/css/ShadowValue.cpp \
 	third_party/WebKit/Source/core/css/StyleInvalidationAnalysis.cpp \
 	third_party/WebKit/Source/core/css/StyleMedia.cpp \
 	third_party/WebKit/Source/core/css/StylePropertySerializer.cpp \
@@ -227,6 +236,7 @@
 	third_party/WebKit/Source/core/editing/SetSelectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SimplifyMarkupCommand.cpp \
 	third_party/WebKit/Source/core/editing/SmartReplaceICU.cpp \
+	third_party/WebKit/Source/core/editing/SpellChecker.cpp \
 	third_party/WebKit/Source/core/editing/SpellCheckRequester.cpp \
 	third_party/WebKit/Source/core/editing/SpellingCorrectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SplitElementCommand.cpp \
@@ -375,42 +385,40 @@
 	third_party/WebKit/Source/core/loader/archive/MHTMLArchive.cpp \
 	third_party/WebKit/Source/core/loader/archive/MHTMLParser.cpp \
 	third_party/WebKit/Source/core/page/AutoscrollController.cpp \
-	third_party/WebKit/Source/core/page/BarProp.cpp \
+	third_party/WebKit/Source/core/frame/BarProp.cpp \
 	third_party/WebKit/Source/core/page/Chrome.cpp \
-	third_party/WebKit/Source/core/page/Console.cpp \
-	third_party/WebKit/Source/core/page/ConsoleBase.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicy.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicyResponseHeaders.cpp \
+	third_party/WebKit/Source/core/frame/Console.cpp \
+	third_party/WebKit/Source/core/frame/ConsoleBase.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicyResponseHeaders.cpp \
 	third_party/WebKit/Source/core/page/ContextMenuController.cpp \
 	third_party/WebKit/Source/core/page/CreateWindow.cpp \
-	third_party/WebKit/Source/core/page/DeviceController.cpp \
-	third_party/WebKit/Source/core/page/DiagnosticLoggingKeys.cpp \
-	third_party/WebKit/Source/core/page/DOMSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/DOMSecurityPolicy.cpp \
 	third_party/WebKit/Source/core/page/DOMSelection.cpp \
-	third_party/WebKit/Source/core/page/DOMTimer.cpp \
-	third_party/WebKit/Source/core/page/DOMWindow.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowBase64.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowTimers.cpp \
+	third_party/WebKit/Source/core/frame/DOMTimer.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindow.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowBase64.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleNotifier.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleObserver.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowTimers.cpp \
 	third_party/WebKit/Source/core/page/DOMWindowPagePopup.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowProperty.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowProperty.cpp \
 	third_party/WebKit/Source/core/page/DragController.cpp \
 	third_party/WebKit/Source/core/page/EventHandler.cpp \
 	third_party/WebKit/Source/core/page/EventSource.cpp \
 	third_party/WebKit/Source/core/page/FocusController.cpp \
-	third_party/WebKit/Source/core/page/Frame.cpp \
-	third_party/WebKit/Source/core/page/FrameActionScheduler.cpp \
-	third_party/WebKit/Source/core/page/FrameDestructionObserver.cpp \
+	third_party/WebKit/Source/core/frame/Frame.cpp \
+	third_party/WebKit/Source/core/frame/FrameDestructionObserver.cpp \
 	third_party/WebKit/Source/core/page/FrameTree.cpp \
-	third_party/WebKit/Source/core/page/FrameView.cpp \
-	third_party/WebKit/Source/core/page/History.cpp \
-	third_party/WebKit/Source/core/page/ImageBitmap.cpp \
-	third_party/WebKit/Source/core/page/Location.cpp \
-	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
+	third_party/WebKit/Source/core/frame/FrameView.cpp \
+	third_party/WebKit/Source/core/frame/History.cpp \
+	third_party/WebKit/Source/core/frame/ImageBitmap.cpp \
+	third_party/WebKit/Source/core/frame/Location.cpp \
+	third_party/WebKit/Source/core/timing/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
-	third_party/WebKit/Source/core/page/Navigator.cpp \
-	third_party/WebKit/Source/core/page/NavigatorID.cpp \
+	third_party/WebKit/Source/core/frame/Navigator.cpp \
+	third_party/WebKit/Source/core/frame/NavigatorID.cpp \
+	third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp \
 	third_party/WebKit/Source/core/page/Page.cpp \
 	third_party/WebKit/Source/core/page/PageConsole.cpp \
 	third_party/WebKit/Source/core/page/PageGroup.cpp \
@@ -420,40 +428,34 @@
 	third_party/WebKit/Source/core/page/PagePopupController.cpp \
 	third_party/WebKit/Source/core/page/PagePopupClient.cpp \
 	third_party/WebKit/Source/core/page/PageScaleConstraints.cpp \
-	third_party/WebKit/Source/core/page/PageScaleConstraintsSet.cpp \
 	third_party/WebKit/Source/core/page/PageSerializer.cpp \
 	third_party/WebKit/Source/core/page/PageVisibilityState.cpp \
-	third_party/WebKit/Source/core/page/Performance.cpp \
-	third_party/WebKit/Source/core/page/PerformanceEntry.cpp \
-	third_party/WebKit/Source/core/page/PerformanceNavigation.cpp \
-	third_party/WebKit/Source/core/page/PerformanceResourceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceUserTiming.cpp \
+	third_party/WebKit/Source/core/timing/Performance.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceEntry.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceNavigation.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp \
 	third_party/WebKit/Source/core/page/PointerLockController.cpp \
 	third_party/WebKit/Source/core/page/PrintContext.cpp \
 	third_party/WebKit/Source/core/page/RuntimeCSSEnabled.cpp \
 	third_party/WebKit/Source/core/page/RuntimeEnabledFeaturesCustom.cpp \
-	third_party/WebKit/Source/core/page/Screen.cpp \
+	third_party/WebKit/Source/core/frame/Screen.cpp \
 	third_party/WebKit/Source/core/page/Settings.cpp \
 	third_party/WebKit/Source/core/page/SpatialNavigation.cpp \
-	third_party/WebKit/Source/core/page/SpeechInput.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputEvent.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResult.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResultList.cpp \
-	third_party/WebKit/Source/core/page/SuspendableTimer.cpp \
+	third_party/WebKit/Source/core/frame/SuspendableTimer.cpp \
 	third_party/WebKit/Source/core/page/TouchAdjustment.cpp \
 	third_party/WebKit/Source/core/page/TouchDisambiguation.cpp \
 	third_party/WebKit/Source/core/page/UseCounter.cpp \
-	third_party/WebKit/Source/core/page/UserContentURLPattern.cpp \
 	third_party/WebKit/Source/core/page/WindowFeatures.cpp \
 	third_party/WebKit/Source/core/page/WindowFocusAllowedIndicator.cpp \
-	third_party/WebKit/Source/core/page/WorkerNavigator.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationBase.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationController.cpp \
-	third_party/WebKit/Source/core/page/animation/CompositeAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/CSSPropertyAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/ImplicitAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/KeyframeAnimation.cpp \
+	third_party/WebKit/Source/core/workers/WorkerNavigator.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationBase.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationController.cpp \
+	third_party/WebKit/Source/core/frame/animation/CompositeAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/CSSPropertyAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/ImplicitAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/KeyframeAnimation.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingConstraints.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp \
 	third_party/WebKit/Source/core/plugins/DOMMimeType.cpp \
@@ -463,6 +465,10 @@
 	third_party/WebKit/Source/core/plugins/PluginData.cpp \
 	third_party/WebKit/Source/core/plugins/PluginListBuilder.cpp \
 	third_party/WebKit/Source/core/plugins/PluginOcclusionSupport.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInput.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputEvent.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResult.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResultList.cpp \
 	third_party/WebKit/Source/core/storage/Storage.cpp \
 	third_party/WebKit/Source/core/storage/StorageEvent.cpp \
 	third_party/WebKit/Source/core/workers/AbstractWorker.cpp \
@@ -476,7 +482,6 @@
 	third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScopeProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp \
-	third_party/WebKit/Source/core/workers/WorkerLocation.cpp \
 	third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerRunLoop.cpp \
 	third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp \
@@ -563,20 +568,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -621,7 +625,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -718,20 +722,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -776,7 +779,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_remaining.target.linux-mips.mk b/Source/core/webcore_remaining.target.linux-mips.mk
index 8f3d77f..e07c57d 100644
--- a/Source/core/webcore_remaining.target.linux-mips.mk
+++ b/Source/core/webcore_remaining.target.linux-mips.mk
@@ -52,10 +52,18 @@
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableColumn.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableHeaderContainer.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableRow.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableClipPathOperation.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableColor.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableDouble.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableImage.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLength.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableLengthBox.cpp \
-	third_party/WebKit/Source/core/animation/AnimatableNumber.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLengthSize.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableRepeatable.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGLength.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableShapeValue.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableStrokeDasharrayList.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableTransform.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableVisibility.cpp \
@@ -87,7 +95,9 @@
 	third_party/WebKit/Source/core/css/CSSFontFaceRule.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp \
+	third_party/WebKit/Source/core/css/CSSFontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFontSelector.cpp \
+	third_party/WebKit/Source/core/css/CSSFontValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGradientValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGridTemplateValue.cpp \
@@ -116,9 +126,11 @@
 	third_party/WebKit/Source/core/css/CSSRule.cpp \
 	third_party/WebKit/Source/core/css/CSSRuleList.cpp \
 	third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp \
+	third_party/WebKit/Source/core/css/CSSSegmentedFontFaceCache.cpp \
 	third_party/WebKit/Source/core/css/CSSSelector.cpp \
 	third_party/WebKit/Source/core/css/CSSSelectorList.cpp \
 	third_party/WebKit/Source/core/css/CSSShaderValue.cpp \
+	third_party/WebKit/Source/core/css/CSSShadowValue.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleRule.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleSheet.cpp \
@@ -138,9 +150,7 @@
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
 	third_party/WebKit/Source/core/css/FontFaceSet.cpp \
 	third_party/WebKit/Source/core/css/FontFace.cpp \
-	third_party/WebKit/Source/core/css/FontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/FontSize.cpp \
-	third_party/WebKit/Source/core/css/FontValue.cpp \
 	third_party/WebKit/Source/core/css/InspectorCSSOMWrappers.cpp \
 	third_party/WebKit/Source/core/css/LengthFunctions.cpp \
 	third_party/WebKit/Source/core/css/MediaFeatureNames.cpp \
@@ -161,7 +171,6 @@
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
-	third_party/WebKit/Source/core/css/ShadowValue.cpp \
 	third_party/WebKit/Source/core/css/StyleInvalidationAnalysis.cpp \
 	third_party/WebKit/Source/core/css/StyleMedia.cpp \
 	third_party/WebKit/Source/core/css/StylePropertySerializer.cpp \
@@ -227,6 +236,7 @@
 	third_party/WebKit/Source/core/editing/SetSelectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SimplifyMarkupCommand.cpp \
 	third_party/WebKit/Source/core/editing/SmartReplaceICU.cpp \
+	third_party/WebKit/Source/core/editing/SpellChecker.cpp \
 	third_party/WebKit/Source/core/editing/SpellCheckRequester.cpp \
 	third_party/WebKit/Source/core/editing/SpellingCorrectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SplitElementCommand.cpp \
@@ -375,42 +385,40 @@
 	third_party/WebKit/Source/core/loader/archive/MHTMLArchive.cpp \
 	third_party/WebKit/Source/core/loader/archive/MHTMLParser.cpp \
 	third_party/WebKit/Source/core/page/AutoscrollController.cpp \
-	third_party/WebKit/Source/core/page/BarProp.cpp \
+	third_party/WebKit/Source/core/frame/BarProp.cpp \
 	third_party/WebKit/Source/core/page/Chrome.cpp \
-	third_party/WebKit/Source/core/page/Console.cpp \
-	third_party/WebKit/Source/core/page/ConsoleBase.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicy.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicyResponseHeaders.cpp \
+	third_party/WebKit/Source/core/frame/Console.cpp \
+	third_party/WebKit/Source/core/frame/ConsoleBase.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicyResponseHeaders.cpp \
 	third_party/WebKit/Source/core/page/ContextMenuController.cpp \
 	third_party/WebKit/Source/core/page/CreateWindow.cpp \
-	third_party/WebKit/Source/core/page/DeviceController.cpp \
-	third_party/WebKit/Source/core/page/DiagnosticLoggingKeys.cpp \
-	third_party/WebKit/Source/core/page/DOMSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/DOMSecurityPolicy.cpp \
 	third_party/WebKit/Source/core/page/DOMSelection.cpp \
-	third_party/WebKit/Source/core/page/DOMTimer.cpp \
-	third_party/WebKit/Source/core/page/DOMWindow.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowBase64.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowTimers.cpp \
+	third_party/WebKit/Source/core/frame/DOMTimer.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindow.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowBase64.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleNotifier.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleObserver.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowTimers.cpp \
 	third_party/WebKit/Source/core/page/DOMWindowPagePopup.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowProperty.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowProperty.cpp \
 	third_party/WebKit/Source/core/page/DragController.cpp \
 	third_party/WebKit/Source/core/page/EventHandler.cpp \
 	third_party/WebKit/Source/core/page/EventSource.cpp \
 	third_party/WebKit/Source/core/page/FocusController.cpp \
-	third_party/WebKit/Source/core/page/Frame.cpp \
-	third_party/WebKit/Source/core/page/FrameActionScheduler.cpp \
-	third_party/WebKit/Source/core/page/FrameDestructionObserver.cpp \
+	third_party/WebKit/Source/core/frame/Frame.cpp \
+	third_party/WebKit/Source/core/frame/FrameDestructionObserver.cpp \
 	third_party/WebKit/Source/core/page/FrameTree.cpp \
-	third_party/WebKit/Source/core/page/FrameView.cpp \
-	third_party/WebKit/Source/core/page/History.cpp \
-	third_party/WebKit/Source/core/page/ImageBitmap.cpp \
-	third_party/WebKit/Source/core/page/Location.cpp \
-	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
+	third_party/WebKit/Source/core/frame/FrameView.cpp \
+	third_party/WebKit/Source/core/frame/History.cpp \
+	third_party/WebKit/Source/core/frame/ImageBitmap.cpp \
+	third_party/WebKit/Source/core/frame/Location.cpp \
+	third_party/WebKit/Source/core/timing/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
-	third_party/WebKit/Source/core/page/Navigator.cpp \
-	third_party/WebKit/Source/core/page/NavigatorID.cpp \
+	third_party/WebKit/Source/core/frame/Navigator.cpp \
+	third_party/WebKit/Source/core/frame/NavigatorID.cpp \
+	third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp \
 	third_party/WebKit/Source/core/page/Page.cpp \
 	third_party/WebKit/Source/core/page/PageConsole.cpp \
 	third_party/WebKit/Source/core/page/PageGroup.cpp \
@@ -420,40 +428,34 @@
 	third_party/WebKit/Source/core/page/PagePopupController.cpp \
 	third_party/WebKit/Source/core/page/PagePopupClient.cpp \
 	third_party/WebKit/Source/core/page/PageScaleConstraints.cpp \
-	third_party/WebKit/Source/core/page/PageScaleConstraintsSet.cpp \
 	third_party/WebKit/Source/core/page/PageSerializer.cpp \
 	third_party/WebKit/Source/core/page/PageVisibilityState.cpp \
-	third_party/WebKit/Source/core/page/Performance.cpp \
-	third_party/WebKit/Source/core/page/PerformanceEntry.cpp \
-	third_party/WebKit/Source/core/page/PerformanceNavigation.cpp \
-	third_party/WebKit/Source/core/page/PerformanceResourceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceUserTiming.cpp \
+	third_party/WebKit/Source/core/timing/Performance.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceEntry.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceNavigation.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp \
 	third_party/WebKit/Source/core/page/PointerLockController.cpp \
 	third_party/WebKit/Source/core/page/PrintContext.cpp \
 	third_party/WebKit/Source/core/page/RuntimeCSSEnabled.cpp \
 	third_party/WebKit/Source/core/page/RuntimeEnabledFeaturesCustom.cpp \
-	third_party/WebKit/Source/core/page/Screen.cpp \
+	third_party/WebKit/Source/core/frame/Screen.cpp \
 	third_party/WebKit/Source/core/page/Settings.cpp \
 	third_party/WebKit/Source/core/page/SpatialNavigation.cpp \
-	third_party/WebKit/Source/core/page/SpeechInput.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputEvent.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResult.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResultList.cpp \
-	third_party/WebKit/Source/core/page/SuspendableTimer.cpp \
+	third_party/WebKit/Source/core/frame/SuspendableTimer.cpp \
 	third_party/WebKit/Source/core/page/TouchAdjustment.cpp \
 	third_party/WebKit/Source/core/page/TouchDisambiguation.cpp \
 	third_party/WebKit/Source/core/page/UseCounter.cpp \
-	third_party/WebKit/Source/core/page/UserContentURLPattern.cpp \
 	third_party/WebKit/Source/core/page/WindowFeatures.cpp \
 	third_party/WebKit/Source/core/page/WindowFocusAllowedIndicator.cpp \
-	third_party/WebKit/Source/core/page/WorkerNavigator.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationBase.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationController.cpp \
-	third_party/WebKit/Source/core/page/animation/CompositeAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/CSSPropertyAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/ImplicitAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/KeyframeAnimation.cpp \
+	third_party/WebKit/Source/core/workers/WorkerNavigator.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationBase.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationController.cpp \
+	third_party/WebKit/Source/core/frame/animation/CompositeAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/CSSPropertyAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/ImplicitAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/KeyframeAnimation.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingConstraints.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp \
 	third_party/WebKit/Source/core/plugins/DOMMimeType.cpp \
@@ -463,6 +465,10 @@
 	third_party/WebKit/Source/core/plugins/PluginData.cpp \
 	third_party/WebKit/Source/core/plugins/PluginListBuilder.cpp \
 	third_party/WebKit/Source/core/plugins/PluginOcclusionSupport.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInput.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputEvent.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResult.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResultList.cpp \
 	third_party/WebKit/Source/core/storage/Storage.cpp \
 	third_party/WebKit/Source/core/storage/StorageEvent.cpp \
 	third_party/WebKit/Source/core/workers/AbstractWorker.cpp \
@@ -476,7 +482,6 @@
 	third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScopeProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp \
-	third_party/WebKit/Source/core/workers/WorkerLocation.cpp \
 	third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerRunLoop.cpp \
 	third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp \
@@ -563,20 +568,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -621,7 +625,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -718,20 +722,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -776,7 +779,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_remaining.target.linux-x86.mk b/Source/core/webcore_remaining.target.linux-x86.mk
index 1bb045e..fd818da 100644
--- a/Source/core/webcore_remaining.target.linux-x86.mk
+++ b/Source/core/webcore_remaining.target.linux-x86.mk
@@ -52,10 +52,18 @@
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableColumn.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableHeaderContainer.cpp \
 	third_party/WebKit/Source/core/accessibility/AccessibilityTableRow.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableClipPathOperation.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableColor.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableDouble.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableImage.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLength.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableLengthBox.cpp \
-	third_party/WebKit/Source/core/animation/AnimatableNumber.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableLengthSize.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableRepeatable.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGLength.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableSVGPaint.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableShapeValue.cpp \
+	third_party/WebKit/Source/core/animation/AnimatableStrokeDasharrayList.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableTransform.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableValue.cpp \
 	third_party/WebKit/Source/core/animation/AnimatableVisibility.cpp \
@@ -87,7 +95,9 @@
 	third_party/WebKit/Source/core/css/CSSFontFaceRule.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp \
 	third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp \
+	third_party/WebKit/Source/core/css/CSSFontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFontSelector.cpp \
+	third_party/WebKit/Source/core/css/CSSFontValue.cpp \
 	third_party/WebKit/Source/core/css/CSSFunctionValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGradientValue.cpp \
 	third_party/WebKit/Source/core/css/CSSGridTemplateValue.cpp \
@@ -116,9 +126,11 @@
 	third_party/WebKit/Source/core/css/CSSRule.cpp \
 	third_party/WebKit/Source/core/css/CSSRuleList.cpp \
 	third_party/WebKit/Source/core/css/CSSSegmentedFontFace.cpp \
+	third_party/WebKit/Source/core/css/CSSSegmentedFontFaceCache.cpp \
 	third_party/WebKit/Source/core/css/CSSSelector.cpp \
 	third_party/WebKit/Source/core/css/CSSSelectorList.cpp \
 	third_party/WebKit/Source/core/css/CSSShaderValue.cpp \
+	third_party/WebKit/Source/core/css/CSSShadowValue.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleDeclaration.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleRule.cpp \
 	third_party/WebKit/Source/core/css/CSSStyleSheet.cpp \
@@ -138,9 +150,7 @@
 	third_party/WebKit/Source/core/css/ElementRuleCollector.cpp \
 	third_party/WebKit/Source/core/css/FontFaceSet.cpp \
 	third_party/WebKit/Source/core/css/FontFace.cpp \
-	third_party/WebKit/Source/core/css/FontFeatureValue.cpp \
 	third_party/WebKit/Source/core/css/FontSize.cpp \
-	third_party/WebKit/Source/core/css/FontValue.cpp \
 	third_party/WebKit/Source/core/css/InspectorCSSOMWrappers.cpp \
 	third_party/WebKit/Source/core/css/LengthFunctions.cpp \
 	third_party/WebKit/Source/core/css/MediaFeatureNames.cpp \
@@ -161,7 +171,6 @@
 	third_party/WebKit/Source/core/css/SelectorChecker.cpp \
 	third_party/WebKit/Source/core/css/SelectorCheckerFastPath.cpp \
 	third_party/WebKit/Source/core/css/SelectorFilter.cpp \
-	third_party/WebKit/Source/core/css/ShadowValue.cpp \
 	third_party/WebKit/Source/core/css/StyleInvalidationAnalysis.cpp \
 	third_party/WebKit/Source/core/css/StyleMedia.cpp \
 	third_party/WebKit/Source/core/css/StylePropertySerializer.cpp \
@@ -227,6 +236,7 @@
 	third_party/WebKit/Source/core/editing/SetSelectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SimplifyMarkupCommand.cpp \
 	third_party/WebKit/Source/core/editing/SmartReplaceICU.cpp \
+	third_party/WebKit/Source/core/editing/SpellChecker.cpp \
 	third_party/WebKit/Source/core/editing/SpellCheckRequester.cpp \
 	third_party/WebKit/Source/core/editing/SpellingCorrectionCommand.cpp \
 	third_party/WebKit/Source/core/editing/SplitElementCommand.cpp \
@@ -375,42 +385,40 @@
 	third_party/WebKit/Source/core/loader/archive/MHTMLArchive.cpp \
 	third_party/WebKit/Source/core/loader/archive/MHTMLParser.cpp \
 	third_party/WebKit/Source/core/page/AutoscrollController.cpp \
-	third_party/WebKit/Source/core/page/BarProp.cpp \
+	third_party/WebKit/Source/core/frame/BarProp.cpp \
 	third_party/WebKit/Source/core/page/Chrome.cpp \
-	third_party/WebKit/Source/core/page/Console.cpp \
-	third_party/WebKit/Source/core/page/ConsoleBase.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicy.cpp \
-	third_party/WebKit/Source/core/page/ContentSecurityPolicyResponseHeaders.cpp \
+	third_party/WebKit/Source/core/frame/Console.cpp \
+	third_party/WebKit/Source/core/frame/ConsoleBase.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/ContentSecurityPolicyResponseHeaders.cpp \
 	third_party/WebKit/Source/core/page/ContextMenuController.cpp \
 	third_party/WebKit/Source/core/page/CreateWindow.cpp \
-	third_party/WebKit/Source/core/page/DeviceController.cpp \
-	third_party/WebKit/Source/core/page/DiagnosticLoggingKeys.cpp \
-	third_party/WebKit/Source/core/page/DOMSecurityPolicy.cpp \
+	third_party/WebKit/Source/core/frame/DOMSecurityPolicy.cpp \
 	third_party/WebKit/Source/core/page/DOMSelection.cpp \
-	third_party/WebKit/Source/core/page/DOMTimer.cpp \
-	third_party/WebKit/Source/core/page/DOMWindow.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowBase64.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowTimers.cpp \
+	third_party/WebKit/Source/core/frame/DOMTimer.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindow.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowBase64.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleNotifier.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowLifecycleObserver.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowTimers.cpp \
 	third_party/WebKit/Source/core/page/DOMWindowPagePopup.cpp \
-	third_party/WebKit/Source/core/page/DOMWindowProperty.cpp \
+	third_party/WebKit/Source/core/frame/DOMWindowProperty.cpp \
 	third_party/WebKit/Source/core/page/DragController.cpp \
 	third_party/WebKit/Source/core/page/EventHandler.cpp \
 	third_party/WebKit/Source/core/page/EventSource.cpp \
 	third_party/WebKit/Source/core/page/FocusController.cpp \
-	third_party/WebKit/Source/core/page/Frame.cpp \
-	third_party/WebKit/Source/core/page/FrameActionScheduler.cpp \
-	third_party/WebKit/Source/core/page/FrameDestructionObserver.cpp \
+	third_party/WebKit/Source/core/frame/Frame.cpp \
+	third_party/WebKit/Source/core/frame/FrameDestructionObserver.cpp \
 	third_party/WebKit/Source/core/page/FrameTree.cpp \
-	third_party/WebKit/Source/core/page/FrameView.cpp \
-	third_party/WebKit/Source/core/page/History.cpp \
-	third_party/WebKit/Source/core/page/ImageBitmap.cpp \
-	third_party/WebKit/Source/core/page/Location.cpp \
-	third_party/WebKit/Source/core/page/MemoryInfo.cpp \
+	third_party/WebKit/Source/core/frame/FrameView.cpp \
+	third_party/WebKit/Source/core/frame/History.cpp \
+	third_party/WebKit/Source/core/frame/ImageBitmap.cpp \
+	third_party/WebKit/Source/core/frame/Location.cpp \
+	third_party/WebKit/Source/core/timing/MemoryInfo.cpp \
 	third_party/WebKit/Source/core/page/MouseEventWithHitTestResults.cpp \
-	third_party/WebKit/Source/core/page/Navigator.cpp \
-	third_party/WebKit/Source/core/page/NavigatorID.cpp \
+	third_party/WebKit/Source/core/frame/Navigator.cpp \
+	third_party/WebKit/Source/core/frame/NavigatorID.cpp \
+	third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp \
 	third_party/WebKit/Source/core/page/Page.cpp \
 	third_party/WebKit/Source/core/page/PageConsole.cpp \
 	third_party/WebKit/Source/core/page/PageGroup.cpp \
@@ -420,40 +428,34 @@
 	third_party/WebKit/Source/core/page/PagePopupController.cpp \
 	third_party/WebKit/Source/core/page/PagePopupClient.cpp \
 	third_party/WebKit/Source/core/page/PageScaleConstraints.cpp \
-	third_party/WebKit/Source/core/page/PageScaleConstraintsSet.cpp \
 	third_party/WebKit/Source/core/page/PageSerializer.cpp \
 	third_party/WebKit/Source/core/page/PageVisibilityState.cpp \
-	third_party/WebKit/Source/core/page/Performance.cpp \
-	third_party/WebKit/Source/core/page/PerformanceEntry.cpp \
-	third_party/WebKit/Source/core/page/PerformanceNavigation.cpp \
-	third_party/WebKit/Source/core/page/PerformanceResourceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceTiming.cpp \
-	third_party/WebKit/Source/core/page/PerformanceUserTiming.cpp \
+	third_party/WebKit/Source/core/timing/Performance.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceEntry.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceNavigation.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceTiming.cpp \
+	third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp \
 	third_party/WebKit/Source/core/page/PointerLockController.cpp \
 	third_party/WebKit/Source/core/page/PrintContext.cpp \
 	third_party/WebKit/Source/core/page/RuntimeCSSEnabled.cpp \
 	third_party/WebKit/Source/core/page/RuntimeEnabledFeaturesCustom.cpp \
-	third_party/WebKit/Source/core/page/Screen.cpp \
+	third_party/WebKit/Source/core/frame/Screen.cpp \
 	third_party/WebKit/Source/core/page/Settings.cpp \
 	third_party/WebKit/Source/core/page/SpatialNavigation.cpp \
-	third_party/WebKit/Source/core/page/SpeechInput.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputEvent.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResult.cpp \
-	third_party/WebKit/Source/core/page/SpeechInputResultList.cpp \
-	third_party/WebKit/Source/core/page/SuspendableTimer.cpp \
+	third_party/WebKit/Source/core/frame/SuspendableTimer.cpp \
 	third_party/WebKit/Source/core/page/TouchAdjustment.cpp \
 	third_party/WebKit/Source/core/page/TouchDisambiguation.cpp \
 	third_party/WebKit/Source/core/page/UseCounter.cpp \
-	third_party/WebKit/Source/core/page/UserContentURLPattern.cpp \
 	third_party/WebKit/Source/core/page/WindowFeatures.cpp \
 	third_party/WebKit/Source/core/page/WindowFocusAllowedIndicator.cpp \
-	third_party/WebKit/Source/core/page/WorkerNavigator.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationBase.cpp \
-	third_party/WebKit/Source/core/page/animation/AnimationController.cpp \
-	third_party/WebKit/Source/core/page/animation/CompositeAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/CSSPropertyAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/ImplicitAnimation.cpp \
-	third_party/WebKit/Source/core/page/animation/KeyframeAnimation.cpp \
+	third_party/WebKit/Source/core/workers/WorkerNavigator.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationBase.cpp \
+	third_party/WebKit/Source/core/frame/animation/AnimationController.cpp \
+	third_party/WebKit/Source/core/frame/animation/CompositeAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/CSSPropertyAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/ImplicitAnimation.cpp \
+	third_party/WebKit/Source/core/frame/animation/KeyframeAnimation.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingConstraints.cpp \
 	third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp \
 	third_party/WebKit/Source/core/plugins/DOMMimeType.cpp \
@@ -463,6 +465,10 @@
 	third_party/WebKit/Source/core/plugins/PluginData.cpp \
 	third_party/WebKit/Source/core/plugins/PluginListBuilder.cpp \
 	third_party/WebKit/Source/core/plugins/PluginOcclusionSupport.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInput.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputEvent.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResult.cpp \
+	third_party/WebKit/Source/core/speech/SpeechInputResultList.cpp \
 	third_party/WebKit/Source/core/storage/Storage.cpp \
 	third_party/WebKit/Source/core/storage/StorageEvent.cpp \
 	third_party/WebKit/Source/core/workers/AbstractWorker.cpp \
@@ -476,7 +482,6 @@
 	third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScopeProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp \
-	third_party/WebKit/Source/core/workers/WorkerLocation.cpp \
 	third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp \
 	third_party/WebKit/Source/core/workers/WorkerRunLoop.cpp \
 	third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp \
@@ -565,20 +570,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -623,7 +627,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -723,20 +727,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -781,7 +784,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_rendering.target.darwin-arm.mk b/Source/core/webcore_rendering.target.darwin-arm.mk
index 676e4b0..f70c1d7 100644
--- a/Source/core/webcore_rendering.target.darwin-arm.mk
+++ b/Source/core/webcore_rendering.target.darwin-arm.mk
@@ -27,6 +27,7 @@
 	third_party/WebKit/Source/core/rendering/AutoTableLayout.cpp \
 	third_party/WebKit/Source/core/rendering/BidiRun.cpp \
 	third_party/WebKit/Source/core/rendering/ClipRect.cpp \
+	third_party/WebKit/Source/core/rendering/CompositedLayerMapping.cpp \
 	third_party/WebKit/Source/core/rendering/CounterNode.cpp \
 	third_party/WebKit/Source/core/rendering/EllipsisBox.cpp \
 	third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp \
@@ -78,10 +79,10 @@
 	third_party/WebKit/Source/core/rendering/RenderInline.cpp \
 	third_party/WebKit/Source/core/rendering/RenderInputSpeech.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayer.cpp \
-	third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp \
+	third_party/WebKit/Source/core/rendering/RenderLayerRepainter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerModelObject.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderListBox.cpp \
@@ -91,7 +92,6 @@
 	third_party/WebKit/Source/core/rendering/RenderMedia.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControlElements.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControls.cpp \
-	third_party/WebKit/Source/core/rendering/RenderMediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMenuList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMeter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMultiColumnBlock.cpp \
@@ -232,20 +232,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -290,7 +289,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -386,20 +385,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -444,7 +442,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_rendering.target.darwin-mips.mk b/Source/core/webcore_rendering.target.darwin-mips.mk
index 6b03c3a..8ce0786 100644
--- a/Source/core/webcore_rendering.target.darwin-mips.mk
+++ b/Source/core/webcore_rendering.target.darwin-mips.mk
@@ -27,6 +27,7 @@
 	third_party/WebKit/Source/core/rendering/AutoTableLayout.cpp \
 	third_party/WebKit/Source/core/rendering/BidiRun.cpp \
 	third_party/WebKit/Source/core/rendering/ClipRect.cpp \
+	third_party/WebKit/Source/core/rendering/CompositedLayerMapping.cpp \
 	third_party/WebKit/Source/core/rendering/CounterNode.cpp \
 	third_party/WebKit/Source/core/rendering/EllipsisBox.cpp \
 	third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp \
@@ -78,10 +79,10 @@
 	third_party/WebKit/Source/core/rendering/RenderInline.cpp \
 	third_party/WebKit/Source/core/rendering/RenderInputSpeech.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayer.cpp \
-	third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp \
+	third_party/WebKit/Source/core/rendering/RenderLayerRepainter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerModelObject.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderListBox.cpp \
@@ -91,7 +92,6 @@
 	third_party/WebKit/Source/core/rendering/RenderMedia.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControlElements.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControls.cpp \
-	third_party/WebKit/Source/core/rendering/RenderMediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMenuList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMeter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMultiColumnBlock.cpp \
@@ -232,20 +232,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -290,7 +289,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -386,20 +385,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -444,7 +442,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_rendering.target.darwin-x86.mk b/Source/core/webcore_rendering.target.darwin-x86.mk
index 3239bd3..7468567 100644
--- a/Source/core/webcore_rendering.target.darwin-x86.mk
+++ b/Source/core/webcore_rendering.target.darwin-x86.mk
@@ -27,6 +27,7 @@
 	third_party/WebKit/Source/core/rendering/AutoTableLayout.cpp \
 	third_party/WebKit/Source/core/rendering/BidiRun.cpp \
 	third_party/WebKit/Source/core/rendering/ClipRect.cpp \
+	third_party/WebKit/Source/core/rendering/CompositedLayerMapping.cpp \
 	third_party/WebKit/Source/core/rendering/CounterNode.cpp \
 	third_party/WebKit/Source/core/rendering/EllipsisBox.cpp \
 	third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp \
@@ -78,10 +79,10 @@
 	third_party/WebKit/Source/core/rendering/RenderInline.cpp \
 	third_party/WebKit/Source/core/rendering/RenderInputSpeech.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayer.cpp \
-	third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp \
+	third_party/WebKit/Source/core/rendering/RenderLayerRepainter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerModelObject.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderListBox.cpp \
@@ -91,7 +92,6 @@
 	third_party/WebKit/Source/core/rendering/RenderMedia.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControlElements.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControls.cpp \
-	third_party/WebKit/Source/core/rendering/RenderMediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMenuList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMeter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMultiColumnBlock.cpp \
@@ -235,20 +235,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -293,7 +292,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -393,20 +392,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -451,7 +449,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_rendering.target.linux-arm.mk b/Source/core/webcore_rendering.target.linux-arm.mk
index 676e4b0..f70c1d7 100644
--- a/Source/core/webcore_rendering.target.linux-arm.mk
+++ b/Source/core/webcore_rendering.target.linux-arm.mk
@@ -27,6 +27,7 @@
 	third_party/WebKit/Source/core/rendering/AutoTableLayout.cpp \
 	third_party/WebKit/Source/core/rendering/BidiRun.cpp \
 	third_party/WebKit/Source/core/rendering/ClipRect.cpp \
+	third_party/WebKit/Source/core/rendering/CompositedLayerMapping.cpp \
 	third_party/WebKit/Source/core/rendering/CounterNode.cpp \
 	third_party/WebKit/Source/core/rendering/EllipsisBox.cpp \
 	third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp \
@@ -78,10 +79,10 @@
 	third_party/WebKit/Source/core/rendering/RenderInline.cpp \
 	third_party/WebKit/Source/core/rendering/RenderInputSpeech.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayer.cpp \
-	third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp \
+	third_party/WebKit/Source/core/rendering/RenderLayerRepainter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerModelObject.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderListBox.cpp \
@@ -91,7 +92,6 @@
 	third_party/WebKit/Source/core/rendering/RenderMedia.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControlElements.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControls.cpp \
-	third_party/WebKit/Source/core/rendering/RenderMediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMenuList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMeter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMultiColumnBlock.cpp \
@@ -232,20 +232,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -290,7 +289,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -386,20 +385,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -444,7 +442,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_rendering.target.linux-mips.mk b/Source/core/webcore_rendering.target.linux-mips.mk
index 6b03c3a..8ce0786 100644
--- a/Source/core/webcore_rendering.target.linux-mips.mk
+++ b/Source/core/webcore_rendering.target.linux-mips.mk
@@ -27,6 +27,7 @@
 	third_party/WebKit/Source/core/rendering/AutoTableLayout.cpp \
 	third_party/WebKit/Source/core/rendering/BidiRun.cpp \
 	third_party/WebKit/Source/core/rendering/ClipRect.cpp \
+	third_party/WebKit/Source/core/rendering/CompositedLayerMapping.cpp \
 	third_party/WebKit/Source/core/rendering/CounterNode.cpp \
 	third_party/WebKit/Source/core/rendering/EllipsisBox.cpp \
 	third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp \
@@ -78,10 +79,10 @@
 	third_party/WebKit/Source/core/rendering/RenderInline.cpp \
 	third_party/WebKit/Source/core/rendering/RenderInputSpeech.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayer.cpp \
-	third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp \
+	third_party/WebKit/Source/core/rendering/RenderLayerRepainter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerModelObject.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderListBox.cpp \
@@ -91,7 +92,6 @@
 	third_party/WebKit/Source/core/rendering/RenderMedia.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControlElements.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControls.cpp \
-	third_party/WebKit/Source/core/rendering/RenderMediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMenuList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMeter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMultiColumnBlock.cpp \
@@ -232,20 +232,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -290,7 +289,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -386,20 +385,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -444,7 +442,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_rendering.target.linux-x86.mk b/Source/core/webcore_rendering.target.linux-x86.mk
index 3239bd3..7468567 100644
--- a/Source/core/webcore_rendering.target.linux-x86.mk
+++ b/Source/core/webcore_rendering.target.linux-x86.mk
@@ -27,6 +27,7 @@
 	third_party/WebKit/Source/core/rendering/AutoTableLayout.cpp \
 	third_party/WebKit/Source/core/rendering/BidiRun.cpp \
 	third_party/WebKit/Source/core/rendering/ClipRect.cpp \
+	third_party/WebKit/Source/core/rendering/CompositedLayerMapping.cpp \
 	third_party/WebKit/Source/core/rendering/CounterNode.cpp \
 	third_party/WebKit/Source/core/rendering/EllipsisBox.cpp \
 	third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp \
@@ -78,10 +79,10 @@
 	third_party/WebKit/Source/core/rendering/RenderInline.cpp \
 	third_party/WebKit/Source/core/rendering/RenderInputSpeech.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayer.cpp \
-	third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerCompositor.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerScrollableArea.cpp \
+	third_party/WebKit/Source/core/rendering/RenderLayerRepainter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLayerModelObject.cpp \
 	third_party/WebKit/Source/core/rendering/RenderLineBoxList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderListBox.cpp \
@@ -91,7 +92,6 @@
 	third_party/WebKit/Source/core/rendering/RenderMedia.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControlElements.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMediaControls.cpp \
-	third_party/WebKit/Source/core/rendering/RenderMediaControlsChromium.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMenuList.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMeter.cpp \
 	third_party/WebKit/Source/core/rendering/RenderMultiColumnBlock.cpp \
@@ -235,20 +235,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -293,7 +292,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -393,20 +392,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -451,7 +449,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_svg.target.darwin-arm.mk b/Source/core/webcore_svg.target.darwin-arm.mk
index 1339d10..8505969 100644
--- a/Source/core/webcore_svg.target.darwin-arm.mk
+++ b/Source/core/webcore_svg.target.darwin-arm.mk
@@ -292,20 +292,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -350,7 +349,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -446,20 +445,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -504,7 +502,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_svg.target.darwin-mips.mk b/Source/core/webcore_svg.target.darwin-mips.mk
index 9e109f5..d93647b 100644
--- a/Source/core/webcore_svg.target.darwin-mips.mk
+++ b/Source/core/webcore_svg.target.darwin-mips.mk
@@ -292,20 +292,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -350,7 +349,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -446,20 +445,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -504,7 +502,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_svg.target.darwin-x86.mk b/Source/core/webcore_svg.target.darwin-x86.mk
index 6de279a..f91382a 100644
--- a/Source/core/webcore_svg.target.darwin-x86.mk
+++ b/Source/core/webcore_svg.target.darwin-x86.mk
@@ -294,20 +294,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -352,7 +351,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -451,20 +450,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -509,7 +507,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_svg.target.linux-arm.mk b/Source/core/webcore_svg.target.linux-arm.mk
index 1339d10..8505969 100644
--- a/Source/core/webcore_svg.target.linux-arm.mk
+++ b/Source/core/webcore_svg.target.linux-arm.mk
@@ -292,20 +292,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -350,7 +349,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -446,20 +445,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -504,7 +502,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_svg.target.linux-mips.mk b/Source/core/webcore_svg.target.linux-mips.mk
index 9e109f5..d93647b 100644
--- a/Source/core/webcore_svg.target.linux-mips.mk
+++ b/Source/core/webcore_svg.target.linux-mips.mk
@@ -292,20 +292,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -350,7 +349,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -446,20 +445,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -504,7 +502,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/webcore_svg.target.linux-x86.mk b/Source/core/webcore_svg.target.linux-x86.mk
index 6de279a..f91382a 100644
--- a/Source/core/webcore_svg.target.linux-x86.mk
+++ b/Source/core/webcore_svg.target.linux-x86.mk
@@ -294,20 +294,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -352,7 +351,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -451,20 +450,19 @@
 	'-DUSE_LIBJPEG_TURBO=1' \
 	'-DUSE_PROPRIETARY_CODECS' \
 	'-DENABLE_CONFIGURATION_POLICY' \
-	'-DENABLE_GPU=1' \
 	'-DUSE_OPENSSL=1' \
 	'-DENABLE_EGLIMAGE=1' \
 	'-DCLD_VERSION=1' \
 	'-DBLINK_IMPLEMENTATION=1' \
-	'-DINSIDE_WEBKIT' \
+	'-DINSIDE_BLINK' \
 	'-DENABLE_CSS3_TEXT=0' \
 	'-DENABLE_CSS_EXCLUSIONS=1' \
 	'-DENABLE_CSS_REGIONS=1' \
 	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
 	'-DENABLE_ENCRYPTED_MEDIA_V2=1' \
 	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_GDI_FONTS_ON_WINDOWS=0' \
 	'-DENABLE_TOUCH_ICON_LOADING=1' \
-	'-DENABLE_GDI_FONTS_ON_WINDOWS=1' \
 	'-DWTF_USE_CONCATENATED_IMPULSE_RESPONSES=1' \
 	'-DENABLE_CALENDAR_PICKER=0' \
 	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
@@ -509,7 +507,7 @@
 	$(LOCAL_PATH)/third_party/WebKit/Source \
 	$(gyp_shared_intermediate_dir)/blink \
 	$(gyp_shared_intermediate_dir)/blink/bindings \
-	$(LOCAL_PATH)/third_party/angle_dx11/include/GLSLANG \
+	$(LOCAL_PATH)/third_party/angle_dx11/include \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/Source/core/workers/AbstractWorker.cpp b/Source/core/workers/AbstractWorker.cpp
index d0d8be1..6d02bb9 100644
--- a/Source/core/workers/AbstractWorker.cpp
+++ b/Source/core/workers/AbstractWorker.cpp
@@ -32,15 +32,15 @@
 #include "core/workers/AbstractWorker.h"
 
 #include "bindings/v8/ExceptionState.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/dom/ScriptExecutionContext.h"
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "weborigin/SecurityOrigin.h"
 
 namespace WebCore {
 
-AbstractWorker::AbstractWorker(ScriptExecutionContext* context)
+AbstractWorker::AbstractWorker(ExecutionContext* context)
     : ActiveDOMObject(context)
 {
 }
@@ -62,19 +62,19 @@
     }
 
     // FIXME: This should use the dynamic global scope (bug #27887)
-    KURL scriptURL = scriptExecutionContext()->completeURL(url);
+    KURL scriptURL = executionContext()->completeURL(url);
     if (!scriptURL.isValid()) {
         es.throwDOMException(SyntaxError, "Failed to create a worker: '" + url + "' is not a valid URL.");
         return KURL();
     }
 
     // We can safely expose the URL in the following exceptions, as these checks happen synchronously before redirection. JavaScript receives no new information.
-    if (!scriptExecutionContext()->securityOrigin()->canRequest(scriptURL)) {
-        es.throwSecurityError("Failed to create a worker: script at '" + scriptURL.elidedString() + "' cannot be accessed from origin '" + scriptExecutionContext()->securityOrigin()->toString() + "'.");
+    if (!executionContext()->securityOrigin()->canRequest(scriptURL)) {
+        es.throwSecurityError("Failed to create a worker: script at '" + scriptURL.elidedString() + "' cannot be accessed from origin '" + executionContext()->securityOrigin()->toString() + "'.");
         return KURL();
     }
 
-    if (scriptExecutionContext()->contentSecurityPolicy() && !scriptExecutionContext()->contentSecurityPolicy()->allowScriptFromSource(scriptURL)) {
+    if (executionContext()->contentSecurityPolicy() && !executionContext()->contentSecurityPolicy()->allowScriptFromSource(scriptURL)) {
         es.throwSecurityError("Failed to create a worker: access to the script at '" + scriptURL.elidedString() + "' is denied by the document's Content Security Policy.");
         return KURL();
     }
@@ -82,14 +82,4 @@
     return scriptURL;
 }
 
-EventTargetData* AbstractWorker::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* AbstractWorker::ensureEventTargetData()
-{
-    return &m_eventTargetData;
-}
-
 } // namespace WebCore
diff --git a/Source/core/workers/AbstractWorker.h b/Source/core/workers/AbstractWorker.h
index 4e77e8e..29bee87 100644
--- a/Source/core/workers/AbstractWorker.h
+++ b/Source/core/workers/AbstractWorker.h
@@ -34,8 +34,8 @@
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/ActiveDOMObject.h"
 #include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
 #include "core/events/EventTarget.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
@@ -45,12 +45,12 @@
 
 class ExceptionState;
 class KURL;
-class ScriptExecutionContext;
+class ExecutionContext;
 
-class AbstractWorker : public RefCounted<AbstractWorker>, public EventTarget, public ActiveDOMObject {
+class AbstractWorker : public RefCounted<AbstractWorker>, public EventTargetWithInlineData, public ActiveDOMObject {
 public:
     // EventTarget APIs
-    virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE { return ActiveDOMObject::scriptExecutionContext(); }
+    virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveDOMObject::executionContext(); }
 
     DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
 
@@ -58,7 +58,7 @@
     using RefCounted<AbstractWorker>::deref;
 
     virtual void contextDestroyed() OVERRIDE;
-    AbstractWorker(ScriptExecutionContext*);
+    AbstractWorker(ExecutionContext*);
     virtual ~AbstractWorker();
 
 protected:
@@ -69,10 +69,6 @@
 private:
     virtual void refEventTarget() OVERRIDE { ref(); }
     virtual void derefEventTarget() OVERRIDE { deref(); }
-    virtual EventTargetData* eventTargetData() OVERRIDE;
-    virtual EventTargetData* ensureEventTargetData() OVERRIDE;
-
-    EventTargetData m_eventTargetData;
 };
 
 } // namespace WebCore
diff --git a/Source/core/workers/DedicatedWorkerGlobalScope.cpp b/Source/core/workers/DedicatedWorkerGlobalScope.cpp
index 5585cdf..ed4fbb1 100644
--- a/Source/core/workers/DedicatedWorkerGlobalScope.cpp
+++ b/Source/core/workers/DedicatedWorkerGlobalScope.cpp
@@ -32,7 +32,7 @@
 #include "core/workers/DedicatedWorkerGlobalScope.h"
 
 #include "bindings/v8/ExceptionState.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 #include "core/workers/DedicatedWorkerThread.h"
 #include "core/workers/WorkerClients.h"
 #include "core/workers/WorkerObjectProxy.h"
@@ -59,7 +59,7 @@
 
 const AtomicString& DedicatedWorkerGlobalScope::interfaceName() const
 {
-    return eventNames().interfaceForDedicatedWorkerGlobalScope;
+    return EventTargetNames::DedicatedWorkerGlobalScope;
 }
 
 void DedicatedWorkerGlobalScope::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& es)
diff --git a/Source/core/workers/DedicatedWorkerGlobalScope.h b/Source/core/workers/DedicatedWorkerGlobalScope.h
index 3aea000..1555111 100644
--- a/Source/core/workers/DedicatedWorkerGlobalScope.h
+++ b/Source/core/workers/DedicatedWorkerGlobalScope.h
@@ -32,7 +32,7 @@
 #define DedicatedWorkerGlobalScope_h
 
 #include "core/dom/MessagePort.h"
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "core/workers/WorkerGlobalScope.h"
 
 namespace WebCore {
diff --git a/Source/core/workers/DedicatedWorkerThread.h b/Source/core/workers/DedicatedWorkerThread.h
index 9701929..c8f44c7 100644
--- a/Source/core/workers/DedicatedWorkerThread.h
+++ b/Source/core/workers/DedicatedWorkerThread.h
@@ -30,7 +30,7 @@
 #ifndef DedicatedWorkerThread_h
 #define DedicatedWorkerThread_h
 
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "core/workers/WorkerThread.h"
 
 namespace WebCore {
diff --git a/Source/core/workers/DefaultSharedWorkerRepository.h b/Source/core/workers/DefaultSharedWorkerRepository.h
index 6cf1ee1..d0da7a3 100644
--- a/Source/core/workers/DefaultSharedWorkerRepository.h
+++ b/Source/core/workers/DefaultSharedWorkerRepository.h
@@ -31,7 +31,7 @@
 #ifndef DefaultSharedWorkerRepository_h
 #define DefaultSharedWorkerRepository_h
 
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "wtf/Forward.h"
 #include "wtf/HashMap.h"
 #include "wtf/Noncopyable.h"
@@ -47,7 +47,7 @@
     class ExceptionState;
     class KURL;
     class MessagePortChannel;
-    class ScriptExecutionContext;
+    class ExecutionContext;
     class SharedWorker;
     class SharedWorkerProxy;
 
@@ -56,10 +56,10 @@
         WTF_MAKE_NONCOPYABLE(DefaultSharedWorkerRepository); WTF_MAKE_FAST_ALLOCATED;
     public:
         // Invoked once the worker script has been loaded to fire up the worker thread.
-        void workerScriptLoaded(SharedWorkerProxy&, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+        void workerScriptLoaded(SharedWorkerProxy&, const String& userAgent, const String& workerScript, PassRefPtr<MessagePortChannel>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
 
         // Internal implementation of SharedWorkerRepository::connect()
-        void connectToWorker(PassRefPtr<SharedWorker>, PassOwnPtr<MessagePortChannel>, const KURL&, const String& name, ExceptionState&);
+        void connectToWorker(PassRefPtr<SharedWorker>, PassRefPtr<MessagePortChannel>, const KURL&, const String& name, ExceptionState&);
 
         // Notification that a document has been detached.
         void documentDetached(Document*);
diff --git a/Source/core/workers/SharedWorker.cpp b/Source/core/workers/SharedWorker.cpp
index 484cbe8..781c4f6 100644
--- a/Source/core/workers/SharedWorker.cpp
+++ b/Source/core/workers/SharedWorker.cpp
@@ -34,9 +34,9 @@
 
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/ExceptionCode.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/dom/MessageChannel.h"
 #include "core/dom/MessagePort.h"
-#include "core/dom/ScriptExecutionContext.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/UseCounter.h"
 #include "core/workers/SharedWorkerRepository.h"
@@ -45,13 +45,13 @@
 
 namespace WebCore {
 
-inline SharedWorker::SharedWorker(ScriptExecutionContext* context)
+inline SharedWorker::SharedWorker(ExecutionContext* context)
     : AbstractWorker(context)
 {
     ScriptWrappable::init(this);
 }
 
-PassRefPtr<SharedWorker> SharedWorker::create(ScriptExecutionContext* context, const String& url, const String& name, ExceptionState& es)
+PassRefPtr<SharedWorker> SharedWorker::create(ExecutionContext* context, const String& url, const String& name, ExceptionState& es)
 {
     ASSERT(isMainThread());
     UseCounter::count(toDocument(context)->domWindow(), UseCounter::SharedWorkerStart);
@@ -60,7 +60,7 @@
 
     RefPtr<MessageChannel> channel = MessageChannel::create(context);
     worker->m_port = channel->port1();
-    OwnPtr<MessagePortChannel> remotePort = channel->port2()->disentangle();
+    RefPtr<MessagePortChannel> remotePort = channel->port2()->disentangle();
     ASSERT(remotePort);
 
     worker->suspendIfNeeded();
@@ -88,7 +88,7 @@
 
 const AtomicString& SharedWorker::interfaceName() const
 {
-    return eventNames().interfaceForSharedWorker;
+    return EventTargetNames::SharedWorker;
 }
 
 } // namespace WebCore
diff --git a/Source/core/workers/SharedWorker.h b/Source/core/workers/SharedWorker.h
index 6ec7506..d6b54d8 100644
--- a/Source/core/workers/SharedWorker.h
+++ b/Source/core/workers/SharedWorker.h
@@ -40,7 +40,7 @@
 
 class SharedWorker : public AbstractWorker, public ScriptWrappable {
 public:
-    static PassRefPtr<SharedWorker> create(ScriptExecutionContext*, const String& url, const String& name, ExceptionState&);
+    static PassRefPtr<SharedWorker> create(ExecutionContext*, const String& url, const String& name, ExceptionState&);
     virtual ~SharedWorker();
 
     MessagePort* port() const { return m_port.get(); }
@@ -48,7 +48,7 @@
     virtual const AtomicString& interfaceName() const OVERRIDE;
 
 private:
-    explicit SharedWorker(ScriptExecutionContext*);
+    explicit SharedWorker(ExecutionContext*);
 
     RefPtr<MessagePort> m_port;
 };
diff --git a/Source/core/workers/SharedWorker.idl b/Source/core/workers/SharedWorker.idl
index 6bba130..a6e4d02 100644
--- a/Source/core/workers/SharedWorker.idl
+++ b/Source/core/workers/SharedWorker.idl
@@ -30,9 +30,9 @@
  */
 
 [
-    EnabledAtRuntime=SharedWorker,
+    RuntimeEnabled=SharedWorker,
     Constructor(DOMString scriptURL, [Default=NullString] optional DOMString name),
-    ConstructorCallWith=ScriptExecutionContext,
+    ConstructorCallWith=ExecutionContext,
     ConstructorRaisesException,
     ActiveDOMObject
 ] interface SharedWorker : EventTarget {
diff --git a/Source/core/workers/SharedWorkerGlobalScope.cpp b/Source/core/workers/SharedWorkerGlobalScope.cpp
index e883936..600f7b1 100644
--- a/Source/core/workers/SharedWorkerGlobalScope.cpp
+++ b/Source/core/workers/SharedWorkerGlobalScope.cpp
@@ -32,10 +32,10 @@
 
 #include "core/workers/SharedWorkerGlobalScope.h"
 
-#include "core/events/EventNames.h"
 #include "core/events/MessageEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/inspector/ScriptCallStack.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 #include "core/workers/SharedWorkerThread.h"
 #include "core/workers/WorkerClients.h"
 #include "core/workers/WorkerThreadStartupData.h"
@@ -47,7 +47,7 @@
 {
     RefPtr<MessagePort> port = prpPort;
     RefPtr<MessageEvent> event = MessageEvent::create(adoptPtr(new MessagePortArray(1, port)), String(), String(), port);
-    event->initEvent(eventNames().connectEvent, false, false);
+    event->initEvent(EventTypeNames::connect, false, false);
     return event.release();
 }
 
@@ -72,7 +72,7 @@
 
 const AtomicString& SharedWorkerGlobalScope::interfaceName() const
 {
-    return eventNames().interfaceForSharedWorkerGlobalScope;
+    return EventTargetNames::SharedWorkerGlobalScope;
 }
 
 SharedWorkerThread* SharedWorkerGlobalScope::thread()
diff --git a/Source/core/workers/SharedWorkerGlobalScope.h b/Source/core/workers/SharedWorkerGlobalScope.h
index be91077..a87e0a6 100644
--- a/Source/core/workers/SharedWorkerGlobalScope.h
+++ b/Source/core/workers/SharedWorkerGlobalScope.h
@@ -31,7 +31,7 @@
 #ifndef SharedWorkerGlobalScope_h
 #define SharedWorkerGlobalScope_h
 
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "core/workers/WorkerGlobalScope.h"
 #include "core/workers/WorkerThreadStartupData.h"
 
diff --git a/Source/core/workers/SharedWorkerRepository.h b/Source/core/workers/SharedWorkerRepository.h
index 26d15cb..e9ab044 100644
--- a/Source/core/workers/SharedWorkerRepository.h
+++ b/Source/core/workers/SharedWorkerRepository.h
@@ -50,7 +50,7 @@
         static bool isAvailable();
 
         // Connects the passed SharedWorker object with the specified worker thread, creating a new thread if necessary.
-        static void connect(PassRefPtr<SharedWorker>, PassOwnPtr<MessagePortChannel>, const KURL&, const String& name, ExceptionState&);
+        static void connect(PassRefPtr<SharedWorker>, PassRefPtr<MessagePortChannel>, const KURL&, const String& name, ExceptionState&);
 
         // Invoked when a document has been detached.
         static void documentDetached(Document*);
diff --git a/Source/core/workers/SharedWorkerThread.h b/Source/core/workers/SharedWorkerThread.h
index 70a5d0e..ca1f15e 100644
--- a/Source/core/workers/SharedWorkerThread.h
+++ b/Source/core/workers/SharedWorkerThread.h
@@ -30,7 +30,7 @@
 #ifndef SharedWorkerThread_h
 #define SharedWorkerThread_h
 
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "core/workers/WorkerThread.h"
 
 namespace WebCore {
diff --git a/Source/core/workers/Worker.cpp b/Source/core/workers/Worker.cpp
index fc5b16a..32bdb3a 100644
--- a/Source/core/workers/Worker.cpp
+++ b/Source/core/workers/Worker.cpp
@@ -31,11 +31,11 @@
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
 #include "core/events/MessageEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/fetch/ResourceFetcher.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/DOMWindow.h"
 #include "core/page/UseCounter.h"
 #include "core/workers/WorkerGlobalScopeProxy.h"
 #include "core/workers/WorkerScriptLoader.h"
@@ -44,14 +44,14 @@
 
 namespace WebCore {
 
-inline Worker::Worker(ScriptExecutionContext* context)
+inline Worker::Worker(ExecutionContext* context)
     : AbstractWorker(context)
     , m_contextProxy(WorkerGlobalScopeProxy::create(this))
 {
     ScriptWrappable::init(this);
 }
 
-PassRefPtr<Worker> Worker::create(ScriptExecutionContext* context, const String& url, ExceptionState& es)
+PassRefPtr<Worker> Worker::create(ExecutionContext* context, const String& url, ExceptionState& es)
 {
     ASSERT(isMainThread());
     UseCounter::count(toDocument(context)->domWindow(), UseCounter::WorkerStart);
@@ -76,13 +76,13 @@
 Worker::~Worker()
 {
     ASSERT(isMainThread());
-    ASSERT(scriptExecutionContext()); // The context is protected by worker context proxy, so it cannot be destroyed while a Worker exists.
+    ASSERT(executionContext()); // The context is protected by worker context proxy, so it cannot be destroyed while a Worker exists.
     m_contextProxy->workerObjectDestroyed();
 }
 
 const AtomicString& Worker::interfaceName() const
 {
-    return eventNames().interfaceForWorker;
+    return EventTargetNames::Worker;
 }
 
 void Worker::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& es)
@@ -99,12 +99,6 @@
     m_contextProxy->terminateWorkerGlobalScope();
 }
 
-bool Worker::canSuspend() const
-{
-    // FIXME: It is not currently possible to suspend a worker, so pages with workers can not go into page cache.
-    return false;
-}
-
 void Worker::stop()
 {
     terminate();
@@ -117,19 +111,19 @@
 
 void Worker::didReceiveResponse(unsigned long identifier, const ResourceResponse&)
 {
-    InspectorInstrumentation::didReceiveScriptResponse(scriptExecutionContext(), identifier);
+    InspectorInstrumentation::didReceiveScriptResponse(executionContext(), identifier);
 }
 
 void Worker::notifyFinished()
 {
     if (m_scriptLoader->failed()) {
-        dispatchEvent(Event::createCancelable(eventNames().errorEvent));
+        dispatchEvent(Event::createCancelable(EventTypeNames::error));
     } else {
         WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart;
-        if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(scriptExecutionContext()))
+        if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(executionContext()))
             startMode = PauseWorkerGlobalScopeOnStart;
-        m_contextProxy->startWorkerGlobalScope(m_scriptLoader->url(), scriptExecutionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), startMode);
-        InspectorInstrumentation::scriptImported(scriptExecutionContext(), m_scriptLoader->identifier(), m_scriptLoader->script());
+        m_contextProxy->startWorkerGlobalScope(m_scriptLoader->url(), executionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), startMode);
+        InspectorInstrumentation::scriptImported(executionContext(), m_scriptLoader->identifier(), m_scriptLoader->script());
     }
     m_scriptLoader = nullptr;
 
diff --git a/Source/core/workers/Worker.h b/Source/core/workers/Worker.h
index 3f276d0..bb2c6a6 100644
--- a/Source/core/workers/Worker.h
+++ b/Source/core/workers/Worker.h
@@ -28,10 +28,10 @@
 #define Worker_h
 
 #include "core/dom/ActiveDOMObject.h"
-#include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
-#include "core/events/EventTarget.h"
 #include "core/dom/MessagePort.h"
+#include "core/events/EventListener.h"
+#include "core/events/EventTarget.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/workers/AbstractWorker.h"
 #include "core/workers/WorkerScriptLoaderClient.h"
 #include "wtf/Forward.h"
@@ -42,13 +42,13 @@
 namespace WebCore {
 
 class ExceptionState;
-class ScriptExecutionContext;
+class ExecutionContext;
 class WorkerGlobalScopeProxy;
 class WorkerScriptLoader;
 
 class Worker : public AbstractWorker, public ScriptWrappable, private WorkerScriptLoaderClient {
 public:
-    static PassRefPtr<Worker> create(ScriptExecutionContext*, const String& url, ExceptionState&);
+    static PassRefPtr<Worker> create(ExecutionContext*, const String& url, ExceptionState&);
     virtual ~Worker();
 
     virtual const AtomicString& interfaceName() const OVERRIDE;
@@ -57,14 +57,13 @@
 
     void terminate();
 
-    virtual bool canSuspend() const OVERRIDE;
     virtual void stop() OVERRIDE;
     virtual bool hasPendingActivity() const OVERRIDE;
 
     DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
 
 private:
-    explicit Worker(ScriptExecutionContext*);
+    explicit Worker(ExecutionContext*);
 
     // WorkerScriptLoaderClient callbacks
     virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&) OVERRIDE;
diff --git a/Source/core/workers/Worker.idl b/Source/core/workers/Worker.idl
index 40567a7..dc8b019 100644
--- a/Source/core/workers/Worker.idl
+++ b/Source/core/workers/Worker.idl
@@ -27,7 +27,7 @@
 
 [
     Constructor(DOMString scriptUrl),
-    ConstructorCallWith=ScriptExecutionContext,
+    ConstructorCallWith=ExecutionContext,
     ConstructorRaisesException,
     ActiveDOMObject
 ] interface Worker : EventTarget {
diff --git a/Source/core/workers/WorkerClients.h b/Source/core/workers/WorkerClients.h
index b362662..8cc4aa2 100644
--- a/Source/core/workers/WorkerClients.h
+++ b/Source/core/workers/WorkerClients.h
@@ -31,7 +31,7 @@
 #ifndef WorkerClients_h
 #define WorkerClients_h
 
-#include "core/platform/Supplementable.h"
+#include "platform/Supplementable.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
diff --git a/Source/core/workers/WorkerConsole.cpp b/Source/core/workers/WorkerConsole.cpp
index e3b34b9..7d71d73 100644
--- a/Source/core/workers/WorkerConsole.cpp
+++ b/Source/core/workers/WorkerConsole.cpp
@@ -39,12 +39,12 @@
 #include "core/inspector/ScriptCallStack.h"
 #include "core/inspector/ScriptProfile.h"
 #include "core/inspector/WorkerInspectorController.h"
-#include "core/page/ConsoleBase.h"
-#include "core/page/ConsoleTypes.h"
-#include "core/platform/chromium/TraceEvent.h"
+#include "core/frame/ConsoleBase.h"
+#include "core/frame/ConsoleTypes.h"
 #include "core/workers/WorkerGlobalScope.h"
 #include "core/workers/WorkerReportingProxy.h"
 #include "core/workers/WorkerThread.h"
+#include "platform/TraceEvent.h"
 
 #include "wtf/text/WTFString.h"
 
@@ -66,11 +66,11 @@
     m_scope->thread()->workerReportingProxy().postConsoleMessageToWorkerObject(ConsoleAPIMessageSource, level, message, lastCaller.lineNumber(), lastCaller.sourceURL());
 }
 
-ScriptExecutionContext* WorkerConsole::context()
+ExecutionContext* WorkerConsole::context()
 {
     if (!m_scope)
         return 0;
-    return m_scope->scriptExecutionContext();
+    return m_scope->executionContext();
 }
 
 bool WorkerConsole::profilerEnabled()
diff --git a/Source/core/workers/WorkerConsole.h b/Source/core/workers/WorkerConsole.h
index b5b8263..b39002d 100644
--- a/Source/core/workers/WorkerConsole.h
+++ b/Source/core/workers/WorkerConsole.h
@@ -33,8 +33,8 @@
 #include "bindings/v8/ScriptState.h"
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/inspector/ConsoleAPITypes.h"
-#include "core/page/ConsoleBase.h"
-#include "core/page/ConsoleTypes.h"
+#include "core/frame/ConsoleBase.h"
+#include "core/frame/ConsoleTypes.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 #include "wtf/RefPtr.h"
@@ -53,7 +53,7 @@
     virtual ~WorkerConsole();
 
 protected:
-    virtual ScriptExecutionContext* context();
+    virtual ExecutionContext* context();
     virtual void reportMessageToClient(MessageLevel, const String& message, PassRefPtr<ScriptCallStack>) OVERRIDE;
     virtual bool profilerEnabled();
 
diff --git a/Source/core/workers/WorkerEventQueue.cpp b/Source/core/workers/WorkerEventQueue.cpp
index 90638e3..6e9d01f 100644
--- a/Source/core/workers/WorkerEventQueue.cpp
+++ b/Source/core/workers/WorkerEventQueue.cpp
@@ -27,18 +27,19 @@
 #include "config.h"
 #include "core/workers/WorkerEventQueue.h"
 
+#include "core/dom/ExecutionContext.h"
+#include "core/dom/ExecutionContextTask.h"
 #include "core/events/Event.h"
-#include "core/dom/ScriptExecutionContext.h"
 
 namespace WebCore {
 
-PassOwnPtr<WorkerEventQueue> WorkerEventQueue::create(ScriptExecutionContext* context)
+PassOwnPtr<WorkerEventQueue> WorkerEventQueue::create(ExecutionContext* context)
 {
     return adoptPtr(new WorkerEventQueue(context));
 }
 
-WorkerEventQueue::WorkerEventQueue(ScriptExecutionContext* context)
-    : m_scriptExecutionContext(context)
+WorkerEventQueue::WorkerEventQueue(ExecutionContext* context)
+    : m_executionContext(context)
     , m_isClosed(false)
 {
 }
@@ -48,7 +49,7 @@
     close();
 }
 
-class WorkerEventQueue::EventDispatcherTask : public ScriptExecutionContext::Task {
+class WorkerEventQueue::EventDispatcherTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<EventDispatcherTask> create(PassRefPtr<Event> event, WorkerEventQueue* eventQueue)
     {
@@ -61,12 +62,12 @@
             m_eventQueue->removeEvent(m_event.get());
     }
 
-    void dispatchEvent(ScriptExecutionContext*, PassRefPtr<Event> event)
+    void dispatchEvent(ExecutionContext*, PassRefPtr<Event> event)
     {
         event->target()->dispatchEvent(event);
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ExecutionContext* context)
     {
         if (m_isCancelled)
             return;
@@ -106,7 +107,7 @@
     RefPtr<Event> event = prpEvent;
     OwnPtr<EventDispatcherTask> task = EventDispatcherTask::create(event, this);
     m_eventTaskMap.add(event.release(), task.get());
-    m_scriptExecutionContext->postTask(task.release());
+    m_executionContext->postTask(task.release());
     return true;
 }
 
diff --git a/Source/core/workers/WorkerEventQueue.h b/Source/core/workers/WorkerEventQueue.h
index 525e297..6a66901 100644
--- a/Source/core/workers/WorkerEventQueue.h
+++ b/Source/core/workers/WorkerEventQueue.h
@@ -37,13 +37,13 @@
 
 class Event;
 class Node;
-class ScriptExecutionContext;
+class ExecutionContext;
 
 class WorkerEventQueue : public EventQueue {
     WTF_MAKE_FAST_ALLOCATED;
 public:
 
-    static PassOwnPtr<WorkerEventQueue> create(ScriptExecutionContext*);
+    static PassOwnPtr<WorkerEventQueue> create(ExecutionContext*);
     virtual ~WorkerEventQueue();
 
     // EventQueue
@@ -52,10 +52,10 @@
     virtual void close() OVERRIDE;
 
 private:
-    explicit WorkerEventQueue(ScriptExecutionContext*);
+    explicit WorkerEventQueue(ExecutionContext*);
     void removeEvent(Event*);
 
-    ScriptExecutionContext* m_scriptExecutionContext;
+    ExecutionContext* m_executionContext;
     bool m_isClosed;
 
     class EventDispatcherTask;
diff --git a/Source/core/workers/WorkerGlobalScope.cpp b/Source/core/workers/WorkerGlobalScope.cpp
index f0ec554..583c380 100644
--- a/Source/core/workers/WorkerGlobalScope.cpp
+++ b/Source/core/workers/WorkerGlobalScope.cpp
@@ -33,20 +33,21 @@
 #include "bindings/v8/ScriptSourceCode.h"
 #include "bindings/v8/ScriptValue.h"
 #include "core/dom/ActiveDOMObject.h"
+#include "core/dom/AddConsoleMessageTask.h"
 #include "core/dom/ContextLifecycleNotifier.h"
-#include "core/events/ErrorEvent.h"
-#include "core/events/Event.h"
+#include "core/dom/DOMURL.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/dom/MessagePort.h"
-#include "core/html/DOMURL.h"
+#include "core/events/ErrorEvent.h"
+#include "core/events/Event.h"
 #include "core/inspector/InspectorConsoleInstrumentation.h"
 #include "core/inspector/ScriptCallStack.h"
 #include "core/inspector/WorkerInspectorController.h"
 #include "core/loader/WorkerThreadableLoader.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/WorkerNavigator.h"
-#include "core/platform/NotImplemented.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/DOMWindow.h"
+#include "core/workers/WorkerNavigator.h"
+#include "platform/NotImplemented.h"
 #include "core/workers/WorkerClients.h"
 #include "core/workers/WorkerLocation.h"
 #include "core/workers/WorkerObjectProxy.h"
@@ -59,14 +60,14 @@
 
 namespace WebCore {
 
-class CloseWorkerGlobalScopeTask : public ScriptExecutionContext::Task {
+class CloseWorkerGlobalScopeTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<CloseWorkerGlobalScopeTask> create()
     {
         return adoptPtr(new CloseWorkerGlobalScopeTask);
     }
 
-    virtual void performTask(ScriptExecutionContext *context)
+    virtual void performTask(ExecutionContext *context)
     {
         WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
         // Notify parent that this context is closed. Parent is responsible for calling WorkerThread::stop().
@@ -88,6 +89,7 @@
     , m_workerClients(workerClients)
 {
     ScriptWrappable::init(this);
+    setClient(this);
     setSecurityOrigin(SecurityOrigin::create(url));
     m_workerClients->reattachThread();
 }
@@ -101,6 +103,8 @@
 
     // Notify proxy that we are going away. This can free the WorkerThread object, so do not access it after this.
     thread()->workerReportingProxy().workerGlobalScopeDestroyed();
+
+    setClient(0);
 }
 
 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
@@ -109,7 +113,7 @@
     contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType);
 }
 
-ScriptExecutionContext* WorkerGlobalScope::scriptExecutionContext() const
+ExecutionContext* WorkerGlobalScope::executionContext() const
 {
     return const_cast<WorkerGlobalScope*>(this);
 }
@@ -144,6 +148,11 @@
     m_script->disableEval(errorMessage);
 }
 
+double WorkerGlobalScope::timerAlignmentInterval() const
+{
+    return DOMTimer::visiblePageAlignmentInterval();
+}
+
 WorkerLocation* WorkerGlobalScope::location() const
 {
     if (!m_location)
@@ -177,7 +186,7 @@
     return m_navigator.get();
 }
 
-void WorkerGlobalScope::postTask(PassOwnPtr<Task> task)
+void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task)
 {
     thread()->runLoop().postTask(task);
 }
@@ -193,7 +202,7 @@
     Vector<String>::const_iterator urlsEnd = urls.end();
     Vector<KURL> completedURLs;
     for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) {
-        const KURL& url = scriptExecutionContext()->completeURL(*it);
+        const KURL& url = executionContext()->completeURL(*it);
         if (!url.isValid()) {
             es.throwDOMException(SyntaxError, "Failed to execute 'importScripts': the URL '" + *it + "' is invalid.");
             return;
@@ -205,7 +214,7 @@
     for (Vector<KURL>::const_iterator it = completedURLs.begin(); it != end; ++it) {
         RefPtr<WorkerScriptLoader> scriptLoader(WorkerScriptLoader::create());
         scriptLoader->setTargetType(ResourceRequest::TargetIsScript);
-        scriptLoader->loadSynchronously(scriptExecutionContext(), *it, AllowCrossOriginRequests);
+        scriptLoader->loadSynchronously(executionContext(), *it, AllowCrossOriginRequests);
 
         // If the fetching attempt failed, throw a NetworkError exception and abort all these steps.
         if (scriptLoader->failed()) {
@@ -213,7 +222,7 @@
             return;
         }
 
-        InspectorInstrumentation::scriptImported(scriptExecutionContext(), scriptLoader->identifier(), scriptLoader->script());
+        InspectorInstrumentation::scriptImported(executionContext(), scriptLoader->identifier(), scriptLoader->script());
 
         RefPtr<ErrorEvent> errorEvent;
         m_script->evaluate(ScriptSourceCode(scriptLoader->script(), scriptLoader->responseURL()), &errorEvent);
@@ -263,16 +272,6 @@
     return m_script->isExecutionForbidden();
 }
 
-EventTargetData* WorkerGlobalScope::eventTargetData()
-{
-    return &m_eventTargetData;
-}
-
-EventTargetData* WorkerGlobalScope::ensureEventTargetData()
-{
-    return &m_eventTargetData;
-}
-
 WorkerGlobalScope::Observer::Observer(WorkerGlobalScope* context)
     : m_context(context)
 {
@@ -330,4 +329,9 @@
     return m_eventQueue.get();
 }
 
+PassOwnPtr<LifecycleNotifier> WorkerGlobalScope::createLifecycleNotifier()
+{
+    return ContextLifecycleNotifier::create(this);
+}
+
 } // namespace WebCore
diff --git a/Source/core/workers/WorkerGlobalScope.h b/Source/core/workers/WorkerGlobalScope.h
index 7145f95..15d04a2 100644
--- a/Source/core/workers/WorkerGlobalScope.h
+++ b/Source/core/workers/WorkerGlobalScope.h
@@ -29,13 +29,14 @@
 
 #include "bindings/v8/ScriptWrappable.h"
 #include "bindings/v8/WorkerScriptController.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
 #include "core/events/EventTarget.h"
-#include "core/dom/ScriptExecutionContext.h"
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "core/workers/WorkerConsole.h"
 #include "core/workers/WorkerEventQueue.h"
+#include "core/workers/WorkerSupplementable.h"
 #include "wtf/Assertions.h"
 #include "wtf/HashMap.h"
 #include "wtf/OwnPtr.h"
@@ -57,13 +58,13 @@
     class WorkerNavigator;
     class WorkerThread;
 
-    class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public ScriptWrappable, public ScriptExecutionContext, public EventTarget {
+    class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public ScriptWrappable, public ExecutionContext, public ExecutionContextClient, public WorkerSupplementable, public EventTargetWithInlineData {
     public:
         virtual ~WorkerGlobalScope();
 
         virtual bool isWorkerGlobalScope() const OVERRIDE { return true; }
 
-        virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+        virtual ExecutionContext* executionContext() const OVERRIDE;
 
         virtual bool isSharedWorkerGlobalScope() const { return false; }
         virtual bool isDedicatedWorkerGlobalScope() const { return false; }
@@ -72,7 +73,6 @@
         KURL completeURL(const String&) const;
 
         virtual String userAgent(const KURL&) const;
-
         virtual void disableEval(const String& errorMessage) OVERRIDE;
 
         WorkerScriptController* script() { return m_script.get(); }
@@ -81,7 +81,7 @@
 
         WorkerThread* thread() const { return m_thread; }
 
-        virtual void postTask(PassOwnPtr<Task>) OVERRIDE; // Executes the task on context's thread asynchronously.
+        virtual void postTask(PassOwnPtr<ExecutionContextTask>) OVERRIDE; // Executes the task on context's thread asynchronously.
 
         // WorkerGlobalScope
         WorkerGlobalScope* self() { return this; }
@@ -95,12 +95,14 @@
         virtual void importScripts(const Vector<String>& urls, ExceptionState&);
         WorkerNavigator* navigator() const;
 
-        // ScriptExecutionContext
+        // ExecutionContextClient
         virtual WorkerEventQueue* eventQueue() const OVERRIDE;
 
         virtual bool isContextThread() const OVERRIDE;
         virtual bool isJSExecutionForbidden() const OVERRIDE;
 
+        virtual double timerAlignmentInterval() const OVERRIDE;
+
         WorkerInspectorController* workerInspectorController() { return m_workerInspectorController.get(); }
         // These methods are used for GC marking. See JSWorkerGlobalScope::visitChildrenVirtual(SlotVisitor&) in
         // JSWorkerGlobalScopeCustom.cpp.
@@ -143,13 +145,12 @@
         void addMessageToWorkerConsole(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, ScriptState*);
 
     private:
-        virtual void refScriptExecutionContext() OVERRIDE { ref(); }
-        virtual void derefScriptExecutionContext() OVERRIDE { deref(); }
+        virtual void refExecutionContext() OVERRIDE { ref(); }
+        virtual void derefExecutionContext() OVERRIDE { deref(); }
+        virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE;
 
         virtual void refEventTarget() OVERRIDE { ref(); }
         virtual void derefEventTarget() OVERRIDE { deref(); }
-        virtual EventTargetData* eventTargetData() OVERRIDE;
-        virtual EventTargetData* ensureEventTargetData() OVERRIDE;
 
         virtual const KURL& virtualURL() const OVERRIDE;
         virtual KURL virtualCompleteURL(const String&) const;
@@ -171,7 +172,6 @@
         mutable RefPtr<DOMURL> m_domURL;
         OwnPtr<WorkerInspectorController> m_workerInspectorController;
         bool m_closing;
-        EventTargetData m_eventTargetData;
 
         HashSet<Observer*> m_workerObservers;
 
@@ -182,7 +182,7 @@
         double m_timeOrigin;
     };
 
-inline WorkerGlobalScope* toWorkerGlobalScope(ScriptExecutionContext* context)
+inline WorkerGlobalScope* toWorkerGlobalScope(ExecutionContext* context)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!context || context->isWorkerGlobalScope());
     return static_cast<WorkerGlobalScope*>(context);
diff --git a/Source/core/workers/WorkerLoaderProxy.h b/Source/core/workers/WorkerLoaderProxy.h
index f3eed8d..9c00c13 100644
--- a/Source/core/workers/WorkerLoaderProxy.h
+++ b/Source/core/workers/WorkerLoaderProxy.h
@@ -31,7 +31,7 @@
 #ifndef WorkerLoaderProxy_h
 #define WorkerLoaderProxy_h
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
 #include "wtf/Forward.h"
 #include "wtf/PassOwnPtr.h"
 
@@ -51,12 +51,12 @@
         virtual ~WorkerLoaderProxy() { }
 
         // Posts a task to the thread which runs the loading code (normally, the main thread).
-        virtual void postTaskToLoader(PassOwnPtr<ScriptExecutionContext::Task>) = 0;
+        virtual void postTaskToLoader(PassOwnPtr<ExecutionContextTask>) = 0;
 
         // Posts callbacks from loading code to the WorkerGlobalScope. The 'mode' is used to differentiate
         // specific synchronous loading requests so they can be 'nested', per spec.
         // Returns true if the task was posted successfully.
-        virtual bool postTaskForModeToWorkerGlobalScope(PassOwnPtr<ScriptExecutionContext::Task>, const String& mode) = 0;
+        virtual bool postTaskForModeToWorkerGlobalScope(PassOwnPtr<ExecutionContextTask>, const String& mode) = 0;
 
         // Spans divergent class hierarchies for dedicated and shared workers.
         virtual WebKit::WebWorkerBase* toWebWorkerBase() = 0;
diff --git a/Source/core/workers/WorkerLocation.cpp b/Source/core/workers/WorkerLocation.cpp
deleted file mode 100644
index c93e8d1..0000000
--- a/Source/core/workers/WorkerLocation.cpp
+++ /dev/null
@@ -1,75 +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 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,
- * 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/workers/WorkerLocation.h"
-
-#include "wtf/text/WTFString.h"
-
-namespace WebCore {
-
-String WorkerLocation::href() const
-{
-    return m_url.string();
-}
-
-String WorkerLocation::protocol() const
-{
-    return m_url.protocol() + ":";
-}
-
-String WorkerLocation::host() const
-{
-    return m_url.port() ? m_url.host() + ":" + String::number(m_url.port()) : m_url.host();
-}
-
-String WorkerLocation::hostname() const
-{
-    return m_url.host();
-}
-
-String WorkerLocation::port() const
-{
-    return m_url.port() ? String::number(m_url.port()) : "";
-}
-
-String WorkerLocation::pathname() const
-{
-    return m_url.path().isEmpty() ? "/" : m_url.path();
-}
-
-String WorkerLocation::search() const
-{
-    return m_url.query().isEmpty() ? emptyString() : "?" + m_url.query();
-}
-
-String WorkerLocation::hash() const
-{
-    return m_url.fragmentIdentifier().isEmpty() ? emptyString() : "#" + m_url.fragmentIdentifier();
-}
-
-
-} // namespace WebCore
diff --git a/Source/core/workers/WorkerLocation.h b/Source/core/workers/WorkerLocation.h
index 420338a..cd930e2 100644
--- a/Source/core/workers/WorkerLocation.h
+++ b/Source/core/workers/WorkerLocation.h
@@ -28,6 +28,7 @@
 #define WorkerLocation_h
 
 #include "bindings/v8/ScriptWrappable.h"
+#include "core/dom/DOMURLUtilsReadOnly.h"
 #include "weborigin/KURL.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
@@ -36,27 +37,19 @@
 
 namespace WebCore {
 
-class WorkerLocation : public RefCounted<WorkerLocation>, public ScriptWrappable {
+class WorkerLocation : public RefCounted<WorkerLocation>, public ScriptWrappable, public DOMURLUtilsReadOnly {
 public:
     static PassRefPtr<WorkerLocation> create(const KURL& url)
     {
         return adoptRef(new WorkerLocation(url));
     }
 
-    const KURL& url() const { return m_url; }
-
-    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;
-
-    String toString() const { return href(); }
+    virtual KURL url() const OVERRIDE { return m_url; }
+    virtual String input() const OVERRIDE
+    {
+        ASSERT_NOT_REACHED();
+        return String();
+    }
 
 private:
     explicit WorkerLocation(const KURL& url) : m_url(url)
diff --git a/Source/core/workers/WorkerLocation.idl b/Source/core/workers/WorkerLocation.idl
index 0d8399b..7afd84b 100644
--- a/Source/core/workers/WorkerLocation.idl
+++ b/Source/core/workers/WorkerLocation.idl
@@ -29,15 +29,7 @@
 [
     GlobalContext=WorkerGlobalScope
 ] interface WorkerLocation {
-    readonly attribute DOMString href;
-    readonly attribute DOMString protocol;
-    readonly attribute DOMString host;
-    readonly attribute DOMString hostname;
-    readonly attribute DOMString port;
-    readonly attribute DOMString pathname;
-    readonly attribute DOMString search;
-    readonly attribute DOMString hash;
-
-    [NotEnumerable] DOMString toString();
 };
 
+// Force rebuild: crbug.com/307023
+WorkerLocation implements URLUtilsReadOnly;
diff --git a/Source/core/workers/WorkerMessagingProxy.cpp b/Source/core/workers/WorkerMessagingProxy.cpp
index ecd4557..58c3756 100644
--- a/Source/core/workers/WorkerMessagingProxy.cpp
+++ b/Source/core/workers/WorkerMessagingProxy.cpp
@@ -31,29 +31,29 @@
 
 #include "core/dom/CrossThreadTask.h"
 #include "core/dom/Document.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/events/ErrorEvent.h"
 #include "core/events/MessageEvent.h"
-#include "core/dom/ScriptExecutionContext.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/inspector/ScriptCallStack.h"
 #include "core/inspector/WorkerDebuggerAgent.h"
 #include "core/inspector/WorkerInspectorController.h"
 #include "core/loader/DocumentLoadTiming.h"
 #include "core/loader/DocumentLoader.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/DOMWindow.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/DOMWindow.h"
 #include "core/page/PageGroup.h"
-#include "core/platform/NotImplemented.h"
 #include "core/workers/DedicatedWorkerGlobalScope.h"
 #include "core/workers/DedicatedWorkerThread.h"
 #include "core/workers/Worker.h"
 #include "core/workers/WorkerClients.h"
 #include "core/workers/WorkerThreadStartupData.h"
+#include "platform/NotImplemented.h"
 #include "wtf/MainThread.h"
 
 namespace WebCore {
 
-class MessageWorkerGlobalScopeTask : public ScriptExecutionContext::Task {
+class MessageWorkerGlobalScopeTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<MessageWorkerGlobalScopeTask> create(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
     {
@@ -67,7 +67,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* scriptContext)
+    virtual void performTask(ExecutionContext* scriptContext)
     {
         ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isWorkerGlobalScope());
         DedicatedWorkerGlobalScope* context = static_cast<DedicatedWorkerGlobalScope*>(scriptContext);
@@ -81,7 +81,7 @@
     OwnPtr<MessagePortChannelArray> m_channels;
 };
 
-class MessageWorkerTask : public ScriptExecutionContext::Task {
+class MessageWorkerTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<MessageWorkerTask> create(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels, WorkerMessagingProxy* messagingProxy)
     {
@@ -96,7 +96,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* scriptContext)
+    virtual void performTask(ExecutionContext* scriptContext)
     {
         Worker* workerObject = m_messagingProxy->workerObject();
         if (!workerObject || m_messagingProxy->askedToTerminate())
@@ -112,7 +112,7 @@
     WorkerMessagingProxy* m_messagingProxy;
 };
 
-class WorkerExceptionTask : public ScriptExecutionContext::Task {
+class WorkerExceptionTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<WorkerExceptionTask> create(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, WorkerMessagingProxy* messagingProxy)
     {
@@ -129,7 +129,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ExecutionContext* context)
     {
         Worker* workerObject = m_messagingProxy->workerObject();
         if (!workerObject)
@@ -151,7 +151,7 @@
     WorkerMessagingProxy* m_messagingProxy;
 };
 
-class WorkerGlobalScopeDestroyedTask : public ScriptExecutionContext::Task {
+class WorkerGlobalScopeDestroyedTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<WorkerGlobalScopeDestroyedTask> create(WorkerMessagingProxy* messagingProxy)
     {
@@ -164,7 +164,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext*)
+    virtual void performTask(ExecutionContext*)
     {
         m_messagingProxy->workerGlobalScopeDestroyedInternal();
     }
@@ -172,7 +172,7 @@
     WorkerMessagingProxy* m_messagingProxy;
 };
 
-class WorkerTerminateTask : public ScriptExecutionContext::Task {
+class WorkerTerminateTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<WorkerTerminateTask> create(WorkerMessagingProxy* messagingProxy)
     {
@@ -185,7 +185,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext*)
+    virtual void performTask(ExecutionContext*)
     {
         m_messagingProxy->terminateWorkerGlobalScope();
     }
@@ -193,7 +193,7 @@
     WorkerMessagingProxy* m_messagingProxy;
 };
 
-class WorkerThreadActivityReportTask : public ScriptExecutionContext::Task {
+class WorkerThreadActivityReportTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<WorkerThreadActivityReportTask> create(WorkerMessagingProxy* messagingProxy, bool confirmingMessage, bool hasPendingActivity)
     {
@@ -208,7 +208,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext*)
+    virtual void performTask(ExecutionContext*)
     {
         m_messagingProxy->reportPendingActivityInternal(m_confirmingMessage, m_hasPendingActivity);
     }
@@ -218,7 +218,7 @@
     bool m_hasPendingActivity;
 };
 
-class PostMessageToPageInspectorTask : public ScriptExecutionContext::Task {
+class PostMessageToPageInspectorTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<PostMessageToPageInspectorTask> create(WorkerMessagingProxy* messagingProxy, const String& message)
     {
@@ -232,7 +232,7 @@
     {
     }
 
-    virtual void performTask(ScriptExecutionContext*)
+    virtual void performTask(ExecutionContext*)
     {
         if (WorkerGlobalScopeProxy::PageInspector* pageInspector = m_messagingProxy->m_pageInspector)
             pageInspector->dispatchMessageFromWorker(m_message);
@@ -243,7 +243,7 @@
 };
 
 WorkerMessagingProxy::WorkerMessagingProxy(Worker* workerObject, PassOwnPtr<WorkerClients> workerClients)
-    : m_scriptExecutionContext(workerObject->scriptExecutionContext())
+    : m_executionContext(workerObject->executionContext())
     , m_workerObject(workerObject)
     , m_mayBeDestroyed(false)
     , m_unconfirmedMessageCount(0)
@@ -253,22 +253,22 @@
     , m_workerClients(workerClients)
 {
     ASSERT(m_workerObject);
-    ASSERT((m_scriptExecutionContext->isDocument() && isMainThread())
-        || (m_scriptExecutionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_scriptExecutionContext.get())->thread()->isCurrentThread()));
+    ASSERT((m_executionContext->isDocument() && isMainThread())
+        || (m_executionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_executionContext.get())->thread()->isCurrentThread()));
 }
 
 WorkerMessagingProxy::~WorkerMessagingProxy()
 {
     ASSERT(!m_workerObject);
-    ASSERT((m_scriptExecutionContext->isDocument() && isMainThread())
-        || (m_scriptExecutionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_scriptExecutionContext.get())->thread()->isCurrentThread()));
+    ASSERT((m_executionContext->isDocument() && isMainThread())
+        || (m_executionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_executionContext.get())->thread()->isCurrentThread()));
 }
 
 void WorkerMessagingProxy::startWorkerGlobalScope(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerThreadStartMode startMode)
 {
     // FIXME: This need to be revisited when we support nested worker one day
-    ASSERT(m_scriptExecutionContext->isDocument());
-    Document* document = toDocument(m_scriptExecutionContext.get());
+    ASSERT(m_executionContext->isDocument());
+    Document* document = toDocument(m_executionContext.get());
 
     OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode, startMode, document->contentSecurityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedHeaderType(), m_workerClients.release());
     double originTime = document->loader() ? document->loader()->timing()->referenceMonotonicTime() : monotonicallyIncreasingTime();
@@ -276,12 +276,12 @@
     RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(*this, *this, originTime, startupData.release());
     workerThreadCreated(thread);
     thread->start();
-    InspectorInstrumentation::didStartWorkerGlobalScope(m_scriptExecutionContext.get(), this, scriptURL);
+    InspectorInstrumentation::didStartWorkerGlobalScope(m_executionContext.get(), this, scriptURL);
 }
 
 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
 {
-    m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, channels, this));
+    m_executionContext->postTask(MessageWorkerTask::create(message, channels, this));
 }
 
 void WorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
@@ -296,7 +296,7 @@
         m_queuedEarlyTasks.append(MessageWorkerGlobalScopeTask::create(message, channels));
 }
 
-bool WorkerMessagingProxy::postTaskForModeToWorkerGlobalScope(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode)
+bool WorkerMessagingProxy::postTaskForModeToWorkerGlobalScope(PassOwnPtr<ExecutionContextTask> task, const String& mode)
 {
     if (m_askedToTerminate)
         return false;
@@ -306,19 +306,19 @@
     return true;
 }
 
-void WorkerMessagingProxy::postTaskToLoader(PassOwnPtr<ScriptExecutionContext::Task> task)
+void WorkerMessagingProxy::postTaskToLoader(PassOwnPtr<ExecutionContextTask> task)
 {
     // FIXME: In case of nested workers, this should go directly to the root Document context.
-    ASSERT(m_scriptExecutionContext->isDocument());
-    m_scriptExecutionContext->postTask(task);
+    ASSERT(m_executionContext->isDocument());
+    m_executionContext->postTask(task);
 }
 
 void WorkerMessagingProxy::postExceptionToWorkerObject(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL)
 {
-    m_scriptExecutionContext->postTask(WorkerExceptionTask::create(errorMessage, lineNumber, columnNumber, sourceURL, this));
+    m_executionContext->postTask(WorkerExceptionTask::create(errorMessage, lineNumber, columnNumber, sourceURL, this));
 }
 
-static void postConsoleMessageTask(ScriptExecutionContext* context, WorkerMessagingProxy* messagingProxy, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+static void postConsoleMessageTask(ExecutionContext* context, WorkerMessagingProxy* messagingProxy, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
 {
     if (messagingProxy->askedToTerminate())
         return;
@@ -327,7 +327,7 @@
 
 void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageSource source, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
 {
-    m_scriptExecutionContext->postTask(createCallbackTask(&postConsoleMessageTask, AllowCrossThreadAccess(this), source, level, message, lineNumber, sourceURL));
+    m_executionContext->postTask(createCallbackTask(&postConsoleMessageTask, AllowCrossThreadAccess(this), source, level, message, lineNumber, sourceURL));
 }
 
 void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<DedicatedWorkerThread> workerThread)
@@ -352,10 +352,10 @@
 void WorkerMessagingProxy::workerObjectDestroyed()
 {
     m_workerObject = 0;
-    m_scriptExecutionContext->postTask(createCallbackTask(&workerObjectDestroyedInternal, AllowCrossThreadAccess(this)));
+    m_executionContext->postTask(createCallbackTask(&workerObjectDestroyedInternal, AllowCrossThreadAccess(this)));
 }
 
-void WorkerMessagingProxy::workerObjectDestroyedInternal(ScriptExecutionContext*, WorkerMessagingProxy* proxy)
+void WorkerMessagingProxy::workerObjectDestroyedInternal(ExecutionContext*, WorkerMessagingProxy* proxy)
 {
     proxy->m_mayBeDestroyed = true;
     if (proxy->m_workerThread)
@@ -364,7 +364,7 @@
         proxy->workerGlobalScopeDestroyedInternal();
 }
 
-static void connectToWorkerGlobalScopeInspectorTask(ScriptExecutionContext* context, bool)
+static void connectToWorkerGlobalScopeInspectorTask(ExecutionContext* context, bool)
 {
     toWorkerGlobalScope(context)->workerInspectorController()->connectFrontend();
 }
@@ -378,7 +378,7 @@
     m_workerThread->runLoop().postTaskForMode(createCallbackTask(connectToWorkerGlobalScopeInspectorTask, true), WorkerDebuggerAgent::debuggerTaskMode);
 }
 
-static void disconnectFromWorkerGlobalScopeInspectorTask(ScriptExecutionContext* context, bool)
+static void disconnectFromWorkerGlobalScopeInspectorTask(ExecutionContext* context, bool)
 {
     toWorkerGlobalScope(context)->workerInspectorController()->disconnectFrontend();
 }
@@ -391,7 +391,7 @@
     m_workerThread->runLoop().postTaskForMode(createCallbackTask(disconnectFromWorkerGlobalScopeInspectorTask, true), WorkerDebuggerAgent::debuggerTaskMode);
 }
 
-static void dispatchOnInspectorBackendTask(ScriptExecutionContext* context, const String& message)
+static void dispatchOnInspectorBackendTask(ExecutionContext* context, const String& message)
 {
     toWorkerGlobalScope(context)->workerInspectorController()->dispatchMessageFromFrontend(message);
 }
@@ -406,14 +406,14 @@
 
 void WorkerMessagingProxy::workerGlobalScopeDestroyed()
 {
-    m_scriptExecutionContext->postTask(WorkerGlobalScopeDestroyedTask::create(this));
+    m_executionContext->postTask(WorkerGlobalScopeDestroyedTask::create(this));
     // Will execute workerGlobalScopeDestroyedInternal() on context's thread.
 }
 
 void WorkerMessagingProxy::workerGlobalScopeClosed()
 {
     // Executes terminateWorkerGlobalScope() on parent context's thread.
-    m_scriptExecutionContext->postTask(WorkerTerminateTask::create(this));
+    m_executionContext->postTask(WorkerTerminateTask::create(this));
 }
 
 void WorkerMessagingProxy::workerGlobalScopeDestroyedInternal()
@@ -423,7 +423,7 @@
     m_askedToTerminate = true;
     m_workerThread = 0;
 
-    InspectorInstrumentation::workerGlobalScopeTerminated(m_scriptExecutionContext.get(), this);
+    InspectorInstrumentation::workerGlobalScopeTerminated(m_executionContext.get(), this);
 
     if (m_mayBeDestroyed)
         delete this;
@@ -438,12 +438,12 @@
     if (m_workerThread)
         m_workerThread->stop();
 
-    InspectorInstrumentation::workerGlobalScopeTerminated(m_scriptExecutionContext.get(), this);
+    InspectorInstrumentation::workerGlobalScopeTerminated(m_executionContext.get(), this);
 }
 
 void WorkerMessagingProxy::postMessageToPageInspector(const String& message)
 {
-    m_scriptExecutionContext->postTask(PostMessageToPageInspectorTask::create(this, message));
+    m_executionContext->postTask(PostMessageToPageInspectorTask::create(this, message));
 }
 
 void WorkerMessagingProxy::updateInspectorStateCookie(const String&)
@@ -453,13 +453,13 @@
 
 void WorkerMessagingProxy::confirmMessageFromWorkerObject(bool hasPendingActivity)
 {
-    m_scriptExecutionContext->postTask(WorkerThreadActivityReportTask::create(this, true, hasPendingActivity));
+    m_executionContext->postTask(WorkerThreadActivityReportTask::create(this, true, hasPendingActivity));
     // Will execute reportPendingActivityInternal() on context's thread.
 }
 
 void WorkerMessagingProxy::reportPendingActivity(bool hasPendingActivity)
 {
-    m_scriptExecutionContext->postTask(WorkerThreadActivityReportTask::create(this, false, hasPendingActivity));
+    m_executionContext->postTask(WorkerThreadActivityReportTask::create(this, false, hasPendingActivity));
     // Will execute reportPendingActivityInternal() on context's thread.
 }
 
diff --git a/Source/core/workers/WorkerMessagingProxy.h b/Source/core/workers/WorkerMessagingProxy.h
index 26566bf..7146234 100644
--- a/Source/core/workers/WorkerMessagingProxy.h
+++ b/Source/core/workers/WorkerMessagingProxy.h
@@ -27,7 +27,7 @@
 #ifndef WorkerMessagingProxy_h
 #define WorkerMessagingProxy_h
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/workers/WorkerGlobalScopeProxy.h"
 #include "core/workers/WorkerLoaderProxy.h"
 #include "core/workers/WorkerObjectProxy.h"
@@ -41,7 +41,7 @@
 namespace WebCore {
 
     class DedicatedWorkerThread;
-    class ScriptExecutionContext;
+    class ExecutionContext;
     class Worker;
     class WorkerClients;
 
@@ -76,8 +76,8 @@
         // Implementation of WorkerLoaderProxy.
         // These methods are called on different threads to schedule loading
         // requests and to send callbacks back to WorkerGlobalScope.
-        virtual void postTaskToLoader(PassOwnPtr<ScriptExecutionContext::Task>) OVERRIDE;
-        virtual bool postTaskForModeToWorkerGlobalScope(PassOwnPtr<ScriptExecutionContext::Task>, const String& mode) OVERRIDE;
+        virtual void postTaskToLoader(PassOwnPtr<ExecutionContextTask>) OVERRIDE;
+        virtual bool postTaskForModeToWorkerGlobalScope(PassOwnPtr<ExecutionContextTask>, const String& mode) OVERRIDE;
 
         void workerThreadCreated(PassRefPtr<DedicatedWorkerThread>);
 
@@ -95,11 +95,11 @@
         friend class WorkerThreadActivityReportTask;
 
         void workerGlobalScopeDestroyedInternal();
-        static void workerObjectDestroyedInternal(ScriptExecutionContext*, WorkerMessagingProxy*);
+        static void workerObjectDestroyedInternal(ExecutionContext*, WorkerMessagingProxy*);
         void reportPendingActivityInternal(bool confirmingMessage, bool hasPendingActivity);
         Worker* workerObject() const { return m_workerObject; }
 
-        RefPtr<ScriptExecutionContext> m_scriptExecutionContext;
+        RefPtr<ExecutionContext> m_executionContext;
         Worker* m_workerObject;
         bool m_mayBeDestroyed;
         RefPtr<DedicatedWorkerThread> m_workerThread;
@@ -109,7 +109,7 @@
 
         bool m_askedToTerminate;
 
-        Vector<OwnPtr<ScriptExecutionContext::Task> > m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created.
+        Vector<OwnPtr<ExecutionContextTask> > m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created.
         WorkerGlobalScopeProxy::PageInspector* m_pageInspector;
 
         OwnPtr<WorkerClients> m_workerClients;
diff --git a/Source/core/workers/WorkerNavigator.cpp b/Source/core/workers/WorkerNavigator.cpp
new file mode 100644
index 0000000..7ad476c
--- /dev/null
+++ b/Source/core/workers/WorkerNavigator.cpp
@@ -0,0 +1,48 @@
+/*
+ * 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 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,
+ * 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/workers/WorkerNavigator.h"
+
+namespace WebCore {
+
+WorkerNavigator::WorkerNavigator(const String& userAgent)
+    : m_userAgent(userAgent)
+{
+    ScriptWrappable::init(this);
+}
+
+WorkerNavigator::~WorkerNavigator()
+{
+}
+
+String WorkerNavigator::userAgent() const
+{
+    return m_userAgent;
+}
+
+} // namespace WebCore
diff --git a/Source/core/workers/WorkerNavigator.h b/Source/core/workers/WorkerNavigator.h
new file mode 100644
index 0000000..61c0618
--- /dev/null
+++ b/Source/core/workers/WorkerNavigator.h
@@ -0,0 +1,53 @@
+/*
+ * 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 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,
+ * 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 WorkerNavigator_h
+#define WorkerNavigator_h
+
+#include "bindings/v8/ScriptWrappable.h"
+#include "core/frame/NavigatorBase.h"
+#include "platform/Supplementable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class WorkerNavigator : public RefCounted<WorkerNavigator>, public ScriptWrappable, public NavigatorBase, public Supplementable<WorkerNavigator> {
+public:
+    static PassRefPtr<WorkerNavigator> create(const String& userAgent) { return adoptRef(new WorkerNavigator(userAgent)); }
+    virtual ~WorkerNavigator();
+
+    virtual String userAgent() const OVERRIDE;
+
+private:
+    explicit WorkerNavigator(const String&);
+
+    String m_userAgent;
+};
+
+} // namespace WebCore
+
+#endif // WorkerNavigator_h
diff --git a/Source/core/page/WorkerNavigator.idl b/Source/core/workers/WorkerNavigator.idl
similarity index 100%
rename from Source/core/page/WorkerNavigator.idl
rename to Source/core/workers/WorkerNavigator.idl
diff --git a/Source/core/workers/WorkerReportingProxy.h b/Source/core/workers/WorkerReportingProxy.h
index daa8f50..ee53c1d 100644
--- a/Source/core/workers/WorkerReportingProxy.h
+++ b/Source/core/workers/WorkerReportingProxy.h
@@ -31,7 +31,7 @@
 #ifndef WorkerReportingProxy_h
 #define WorkerReportingProxy_h
 
-#include "core/page/ConsoleTypes.h"
+#include "core/frame/ConsoleTypes.h"
 #include "wtf/Forward.h"
 
 namespace WebCore {
diff --git a/Source/core/workers/WorkerRunLoop.cpp b/Source/core/workers/WorkerRunLoop.cpp
index 5dedc0e..66dfd64 100644
--- a/Source/core/workers/WorkerRunLoop.cpp
+++ b/Source/core/workers/WorkerRunLoop.cpp
@@ -31,13 +31,14 @@
 #include "config.h"
 #include "core/workers/WorkerRunLoop.h"
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/platform/SharedTimer.h"
 #include "core/platform/ThreadGlobalData.h"
-#include "core/platform/ThreadTimers.h"
 #include "core/workers/WorkerGlobalScope.h"
 #include "core/workers/WorkerThread.h"
+#include "platform/PlatformThreadData.h"
+#include "platform/SharedTimer.h"
+#include "platform/ThreadTimers.h"
 #include "wtf/CurrentTime.h"
 
 namespace WebCore {
@@ -112,7 +113,7 @@
         , m_context(context)
     {
         if (!m_runLoop.m_nestedCount)
-            threadGlobalData().threadTimers().setSharedTimer(m_runLoop.m_sharedTimer.get());
+            PlatformThreadData::current().threadTimers().setSharedTimer(m_runLoop.m_sharedTimer.get());
         m_runLoop.m_nestedCount++;
         InspectorInstrumentation::willEnterNestedRunLoop(m_context);
     }
@@ -121,7 +122,7 @@
     {
         m_runLoop.m_nestedCount--;
         if (!m_runLoop.m_nestedCount)
-            threadGlobalData().threadTimers().setSharedTimer(0);
+            PlatformThreadData::current().threadTimers().setSharedTimer(0);
         InspectorInstrumentation::didLeaveNestedRunLoop(m_context);
     }
 private:
@@ -224,34 +225,34 @@
     m_messageQueue.kill();
 }
 
-bool WorkerRunLoop::postTask(PassOwnPtr<ScriptExecutionContext::Task> task)
+bool WorkerRunLoop::postTask(PassOwnPtr<ExecutionContextTask> task)
 {
     return postTaskForMode(task, defaultMode());
 }
 
-void WorkerRunLoop::postTaskAndTerminate(PassOwnPtr<ScriptExecutionContext::Task> task)
+void WorkerRunLoop::postTaskAndTerminate(PassOwnPtr<ExecutionContextTask> task)
 {
     m_messageQueue.appendAndKill(Task::create(task, defaultMode().isolatedCopy()));
 }
 
-bool WorkerRunLoop::postTaskForMode(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode)
+bool WorkerRunLoop::postTaskForMode(PassOwnPtr<ExecutionContextTask> task, const String& mode)
 {
     return m_messageQueue.append(Task::create(task, mode.isolatedCopy()));
 }
 
-PassOwnPtr<WorkerRunLoop::Task> WorkerRunLoop::Task::create(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode)
+PassOwnPtr<WorkerRunLoop::Task> WorkerRunLoop::Task::create(PassOwnPtr<ExecutionContextTask> task, const String& mode)
 {
     return adoptPtr(new Task(task, mode));
 }
 
-void WorkerRunLoop::Task::performTask(const WorkerRunLoop& runLoop, ScriptExecutionContext* context)
+void WorkerRunLoop::Task::performTask(const WorkerRunLoop& runLoop, ExecutionContext* context)
 {
     WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
     if ((!workerGlobalScope->isClosing() && !runLoop.terminated()) || m_task->isCleanupTask())
         m_task->performTask(context);
 }
 
-WorkerRunLoop::Task::Task(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode)
+WorkerRunLoop::Task::Task(PassOwnPtr<ExecutionContextTask> task, const String& mode)
     : m_task(task)
     , m_mode(mode.isolatedCopy())
 {
diff --git a/Source/core/workers/WorkerRunLoop.h b/Source/core/workers/WorkerRunLoop.h
index 8ee3e8e..5792a3f 100644
--- a/Source/core/workers/WorkerRunLoop.h
+++ b/Source/core/workers/WorkerRunLoop.h
@@ -31,7 +31,8 @@
 #ifndef WorkerRunLoop_h
 #define WorkerRunLoop_h
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
+#include "core/dom/ExecutionContextTask.h"
 #include "wtf/MessageQueue.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/PassOwnPtr.h"
@@ -59,10 +60,10 @@
         bool terminated() const { return m_messageQueue.killed(); }
 
         // Returns true if the loop is still alive, false if it has been terminated.
-        bool postTask(PassOwnPtr<ScriptExecutionContext::Task>);
-        void postTaskAndTerminate(PassOwnPtr<ScriptExecutionContext::Task>);
+        bool postTask(PassOwnPtr<ExecutionContextTask>);
+        void postTaskAndTerminate(PassOwnPtr<ExecutionContextTask>);
         // Returns true if the loop is still alive, false if it has been terminated.
-        bool postTaskForMode(PassOwnPtr<ScriptExecutionContext::Task>, const String& mode);
+        bool postTaskForMode(PassOwnPtr<ExecutionContextTask>, const String& mode);
 
         unsigned long createUniqueId() { return ++m_uniqueId; }
 
@@ -71,15 +72,15 @@
         class Task {
             WTF_MAKE_NONCOPYABLE(Task); WTF_MAKE_FAST_ALLOCATED;
         public:
-            static PassOwnPtr<Task> create(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode);
+            static PassOwnPtr<Task> create(PassOwnPtr<ExecutionContextTask>, const String& mode);
             ~Task() { }
             const String& mode() const { return m_mode; }
-            void performTask(const WorkerRunLoop&, ScriptExecutionContext*);
+            void performTask(const WorkerRunLoop&, ExecutionContext*);
 
         private:
-            Task(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode);
+            Task(PassOwnPtr<ExecutionContextTask>, const String& mode);
 
-            OwnPtr<ScriptExecutionContext::Task> m_task;
+            OwnPtr<ExecutionContextTask> m_task;
             String m_mode;
         };
 
diff --git a/Source/core/workers/WorkerScriptLoader.cpp b/Source/core/workers/WorkerScriptLoader.cpp
index 7e0e930..586d4fd 100644
--- a/Source/core/workers/WorkerScriptLoader.cpp
+++ b/Source/core/workers/WorkerScriptLoader.cpp
@@ -28,7 +28,7 @@
 #include "config.h"
 #include "core/workers/WorkerScriptLoader.h"
 
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/ExecutionContext.h"
 #include "core/fetch/TextResourceDecoder.h"
 #include "core/loader/WorkerThreadableLoader.h"
 #include "core/platform/network/ResourceResponse.h"
@@ -54,7 +54,7 @@
 {
 }
 
-void WorkerScriptLoader::loadSynchronously(ScriptExecutionContext* scriptExecutionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy)
+void WorkerScriptLoader::loadSynchronously(ExecutionContext* executionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy)
 {
     m_url = url;
 
@@ -62,7 +62,7 @@
     if (!request)
         return;
 
-    ASSERT_WITH_SECURITY_IMPLICATION(scriptExecutionContext->isWorkerGlobalScope());
+    ASSERT_WITH_SECURITY_IMPLICATION(executionContext->isWorkerGlobalScope());
 
     ThreadableLoaderOptions options;
     options.allowCredentials = AllowStoredCredentials;
@@ -71,10 +71,10 @@
     // FIXME: Should we add EnforceScriptSrcDirective here?
     options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPolicy;
 
-    WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(scriptExecutionContext), *request, *this, options);
+    WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(executionContext), *request, *this, options);
 }
 
-void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext* scriptExecutionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, WorkerScriptLoaderClient* client)
+void WorkerScriptLoader::loadAsynchronously(ExecutionContext* executionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, WorkerScriptLoaderClient* client)
 {
     ASSERT(client);
     m_client = client;
@@ -91,7 +91,7 @@
 
     // During create, callbacks may happen which remove the last reference to this object.
     RefPtr<WorkerScriptLoader> protect(this);
-    m_threadableLoader = ThreadableLoader::create(scriptExecutionContext, this, *request, options);
+    m_threadableLoader = ThreadableLoader::create(executionContext, this, *request, options);
 }
 
 const KURL& WorkerScriptLoader::responseURL() const
diff --git a/Source/core/workers/WorkerScriptLoader.h b/Source/core/workers/WorkerScriptLoader.h
index ef4b655..d09e6d6 100644
--- a/Source/core/workers/WorkerScriptLoader.h
+++ b/Source/core/workers/WorkerScriptLoader.h
@@ -41,7 +41,7 @@
 
     class ResourceRequest;
     class ResourceResponse;
-    class ScriptExecutionContext;
+    class ExecutionContext;
     class TextResourceDecoder;
     class WorkerScriptLoaderClient;
 
@@ -53,8 +53,8 @@
             return adoptRef(new WorkerScriptLoader());
         }
 
-        void loadSynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRequestPolicy);
-        void loadAsynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRequestPolicy, WorkerScriptLoaderClient*);
+        void loadSynchronously(ExecutionContext*, const KURL&, CrossOriginRequestPolicy);
+        void loadAsynchronously(ExecutionContext*, const KURL&, CrossOriginRequestPolicy, WorkerScriptLoaderClient*);
 
         void notifyError();
 
diff --git a/Source/core/workers/WorkerSupplementable.h b/Source/core/workers/WorkerSupplementable.h
new file mode 100644
index 0000000..f091474
--- /dev/null
+++ b/Source/core/workers/WorkerSupplementable.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2001 Dirk Mueller (mueller@kde.org)
+ *           (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2013 Google Inc. 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
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WorkerSupplementable_h
+#define WorkerSupplementable_h
+
+#include "platform/Supplementable.h"
+
+namespace WebCore {
+
+class WorkerGlobalScope;
+
+typedef Supplementable<WorkerGlobalScope> WorkerSupplementable;
+typedef Supplement<WorkerGlobalScope> WorkerSupplement;
+
+} // namespace WebCore
+
+#endif // WorkerSupplementable_h
diff --git a/Source/core/workers/WorkerThread.cpp b/Source/core/workers/WorkerThread.cpp
index eed8047..10a31a0 100644
--- a/Source/core/workers/WorkerThread.cpp
+++ b/Source/core/workers/WorkerThread.cpp
@@ -36,6 +36,7 @@
 #include "core/workers/WorkerThreadStartupData.h"
 #include "modules/webdatabase/DatabaseManager.h"
 #include "modules/webdatabase/DatabaseTask.h"
+#include "platform/PlatformThreadData.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebWorkerRunLoop.h"
 #include "weborigin/KURL.h"
@@ -135,8 +136,8 @@
     // We cannot let any objects survive past thread exit, because no other thread will run GC or otherwise destroy them.
     m_workerGlobalScope = 0;
 
-    // Clean up WebCore::ThreadGlobalData before WTF::WTFThreadData goes away!
-    threadGlobalData().destroy();
+    // Clean up PlatformThreadData before WTF::WTFThreadData goes away!
+    PlatformThreadData::current().destroy();
 
     // The thread object may be already destroyed from notification now, don't try to access "this".
     detachThread(threadID);
@@ -148,14 +149,14 @@
     m_runLoop.run(m_workerGlobalScope.get());
 }
 
-class WorkerThreadShutdownFinishTask : public ScriptExecutionContext::Task {
+class WorkerThreadShutdownFinishTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<WorkerThreadShutdownFinishTask> create()
     {
         return adoptPtr(new WorkerThreadShutdownFinishTask());
     }
 
-    virtual void performTask(ScriptExecutionContext *context)
+    virtual void performTask(ExecutionContext *context)
     {
         WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
         workerGlobalScope->clearInspector();
@@ -166,14 +167,14 @@
     virtual bool isCleanupTask() const { return true; }
 };
 
-class WorkerThreadShutdownStartTask : public ScriptExecutionContext::Task {
+class WorkerThreadShutdownStartTask : public ExecutionContextTask {
 public:
     static PassOwnPtr<WorkerThreadShutdownStartTask> create()
     {
         return adoptPtr(new WorkerThreadShutdownStartTask());
     }
 
-    virtual void performTask(ScriptExecutionContext *context)
+    virtual void performTask(ExecutionContext *context)
     {
         WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
 
@@ -222,8 +223,8 @@
     return m_threadID == currentThread();
 }
 
-class ReleaseFastMallocFreeMemoryTask : public ScriptExecutionContext::Task {
-    virtual void performTask(ScriptExecutionContext*) OVERRIDE { WTF::releaseFastMallocFreeMemory(); }
+class ReleaseFastMallocFreeMemoryTask : public ExecutionContextTask {
+    virtual void performTask(ExecutionContext*) OVERRIDE { WTF::releaseFastMallocFreeMemory(); }
 };
 
 void WorkerThread::releaseFastMallocFreeMemoryInAllThreads()
diff --git a/Source/core/workers/WorkerThread.h b/Source/core/workers/WorkerThread.h
index c019d80..d65ab0a 100644
--- a/Source/core/workers/WorkerThread.h
+++ b/Source/core/workers/WorkerThread.h
@@ -27,7 +27,7 @@
 #ifndef WorkerThread_h
 #define WorkerThread_h
 
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "core/workers/WorkerRunLoop.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/Forward.h"
diff --git a/Source/core/workers/WorkerThreadStartupData.h b/Source/core/workers/WorkerThreadStartupData.h
index 2ff3ff8..de24ef4 100644
--- a/Source/core/workers/WorkerThreadStartupData.h
+++ b/Source/core/workers/WorkerThreadStartupData.h
@@ -31,7 +31,7 @@
 #ifndef WorkerThreadStartupData_h
 #define WorkerThreadStartupData_h
 
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "core/workers/WorkerClients.h"
 #include "core/workers/WorkerThread.h"
 #include "weborigin/KURL.h"
diff --git a/Source/core/xml/DOMParser.cpp b/Source/core/xml/DOMParser.cpp
index 25c1cb6..29a37da 100644
--- a/Source/core/xml/DOMParser.cpp
+++ b/Source/core/xml/DOMParser.cpp
@@ -20,14 +20,23 @@
 #include "core/xml/DOMParser.h"
 
 #include "core/dom/DOMImplementation.h"
+#include "core/dom/ExceptionCode.h"
 #include "wtf/text/WTFString.h"
 
 namespace WebCore {
 
-PassRefPtr<Document> DOMParser::parseFromString(const String& str, const String& contentType)
+PassRefPtr<Document> DOMParser::parseFromString(const String& str, const String& contentType, ExceptionState& es)
 {
-    if (!DOMImplementation::isXMLMIMEType(contentType) && contentType != "text/html")
+    // HTML5 is very explicit about which types we're allowed to support here:
+    // http://domparsing.spec.whatwg.org/#the-domparser-interface
+    if (contentType != "text/html"
+        && contentType != "text/xml"
+        && contentType != "application/xml"
+        && contentType != "application/xhtml+xml"
+        && contentType != "image/svg+xml") {
+        es.throwDOMException(TypeError, "Unsupported mime-type specified.");
         return 0;
+    }
 
     RefPtr<Document> doc = DOMImplementation::createDocument(contentType, 0, KURL(), false);
     doc->setContent(str);
diff --git a/Source/core/xml/DOMParser.h b/Source/core/xml/DOMParser.h
index 020deba..afe0d16 100644
--- a/Source/core/xml/DOMParser.h
+++ b/Source/core/xml/DOMParser.h
@@ -27,12 +27,13 @@
 namespace WebCore {
 
 class Document;
+class ExceptionState;
 
 class DOMParser : public RefCounted<DOMParser>, public ScriptWrappable {
 public:
     static PassRefPtr<DOMParser> create() { return adoptRef(new DOMParser); }
 
-    PassRefPtr<Document> parseFromString(const String&, const String& contentType);
+    PassRefPtr<Document> parseFromString(const String&, const String& contentType, ExceptionState&);
 
 private:
     DOMParser()
diff --git a/Source/core/xml/DOMParser.idl b/Source/core/xml/DOMParser.idl
index 5cbe49e..ff6af34 100644
--- a/Source/core/xml/DOMParser.idl
+++ b/Source/core/xml/DOMParser.idl
@@ -20,6 +20,6 @@
 [
     Constructor
 ] interface DOMParser {
-    Document parseFromString([Default=Undefined] optional DOMString str,
+    [RaisesException] Document parseFromString([Default=Undefined] optional DOMString str,
                              [Default=Undefined] optional DOMString contentType);
 };
diff --git a/Source/core/xml/DocumentXPathEvaluator.cpp b/Source/core/xml/DocumentXPathEvaluator.cpp
index b5a3e5c..9352c4f 100644
--- a/Source/core/xml/DocumentXPathEvaluator.cpp
+++ b/Source/core/xml/DocumentXPathEvaluator.cpp
@@ -27,7 +27,7 @@
 #include "core/xml/DocumentXPathEvaluator.h"
 
 #include "bindings/v8/ExceptionState.h"
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/dom/Document.h"
 #include "core/xml/XPathEvaluator.h"
 #include "core/xml/XPathExpression.h"
 #include "core/xml/XPathNSResolver.h"
@@ -43,38 +43,38 @@
 {
 }
 
-DocumentXPathEvaluator* DocumentXPathEvaluator::from(ScriptExecutionContext* context)
+DocumentXPathEvaluator* DocumentXPathEvaluator::from(DocumentSupplementable* document)
 {
-    DocumentXPathEvaluator* cache = static_cast<DocumentXPathEvaluator*>(Supplement<ScriptExecutionContext>::from(context, supplementName()));
+    DocumentXPathEvaluator* cache = static_cast<DocumentXPathEvaluator*>(DocumentSupplement::from(document, supplementName()));
     if (!cache) {
         cache = new DocumentXPathEvaluator();
-        Supplement<ScriptExecutionContext>::provideTo(context, supplementName(), adoptPtr(cache));
+        DocumentSupplement::provideTo(document, supplementName(), adoptPtr(cache));
     }
     return cache;
 }
 
-PassRefPtr<XPathExpression> DocumentXPathEvaluator::createExpression(ScriptExecutionContext* context,
+PassRefPtr<XPathExpression> DocumentXPathEvaluator::createExpression(DocumentSupplementable* document,
     const String& expression, XPathNSResolver* resolver, ExceptionState& es)
 {
-    DocumentXPathEvaluator* suplement = from(context);
+    DocumentXPathEvaluator* suplement = from(document);
     if (!suplement->m_xpathEvaluator)
         suplement->m_xpathEvaluator = XPathEvaluator::create();
     return suplement->m_xpathEvaluator->createExpression(expression, resolver, es);
 }
 
-PassRefPtr<XPathNSResolver> DocumentXPathEvaluator::createNSResolver(ScriptExecutionContext* context, Node* nodeResolver)
+PassRefPtr<XPathNSResolver> DocumentXPathEvaluator::createNSResolver(DocumentSupplementable* document, Node* nodeResolver)
 {
-    DocumentXPathEvaluator* suplement = from(context);
+    DocumentXPathEvaluator* suplement = from(document);
     if (!suplement->m_xpathEvaluator)
         suplement->m_xpathEvaluator = XPathEvaluator::create();
     return suplement->m_xpathEvaluator->createNSResolver(nodeResolver);
 }
 
-PassRefPtr<XPathResult> DocumentXPathEvaluator::evaluate(ScriptExecutionContext* context, const String& expression,
+PassRefPtr<XPathResult> DocumentXPathEvaluator::evaluate(DocumentSupplementable* document, const String& expression,
     Node* contextNode, XPathNSResolver* resolver, unsigned short type,
     XPathResult* result, ExceptionState& es)
 {
-    DocumentXPathEvaluator* suplement = from(context);
+    DocumentXPathEvaluator* suplement = from(document);
     if (!suplement->m_xpathEvaluator)
         suplement->m_xpathEvaluator = XPathEvaluator::create();
     return suplement->m_xpathEvaluator->evaluate(expression, contextNode, resolver, type, result, es);
diff --git a/Source/core/xml/DocumentXPathEvaluator.h b/Source/core/xml/DocumentXPathEvaluator.h
index eda4f2d..d081b26 100644
--- a/Source/core/xml/DocumentXPathEvaluator.h
+++ b/Source/core/xml/DocumentXPathEvaluator.h
@@ -26,27 +26,26 @@
 #ifndef DocumentXPathEvaluator_h
 #define DocumentXPathEvaluator_h
 
-#include "core/platform/Supplementable.h"
+#include "core/dom/DocumentSupplementable.h"
 #include "core/xml/XPathEvaluator.h"
 
 namespace WebCore {
 
 class ExceptionState;
-class ScriptExecutionContext;
 class XPathExpression;
 class XPathNSResolver;
 class XPathResult;
 
-class DocumentXPathEvaluator : public Supplement<ScriptExecutionContext> {
+class DocumentXPathEvaluator : public DocumentSupplement {
 public:
     virtual ~DocumentXPathEvaluator();
 
-    static DocumentXPathEvaluator* from(ScriptExecutionContext*);
+    static DocumentXPathEvaluator* from(DocumentSupplementable*);
 
-    static PassRefPtr<XPathExpression> createExpression(ScriptExecutionContext*,
+    static PassRefPtr<XPathExpression> createExpression(DocumentSupplementable*,
         const String& expression, XPathNSResolver*, ExceptionState&);
-    static PassRefPtr<XPathNSResolver> createNSResolver(ScriptExecutionContext*, Node* nodeResolver);
-    static PassRefPtr<XPathResult> evaluate(ScriptExecutionContext*,
+    static PassRefPtr<XPathNSResolver> createNSResolver(DocumentSupplementable*, Node* nodeResolver);
+    static PassRefPtr<XPathResult> evaluate(DocumentSupplementable*,
         const String& expression, Node* contextNode, XPathNSResolver*,
         unsigned short type, XPathResult*, ExceptionState&);
 
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index 0264d80..8dbe677 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -29,11 +29,11 @@
 #include "bindings/v8/ExceptionState.h"
 #include "core/dom/ContextFeatures.h"
 #include "core/dom/DOMImplementation.h"
-#include "core/events/Event.h"
-#include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
 #include "core/dom/ExceptionCode.h"
 #include "core/editing/markup.h"
+#include "core/events/Event.h"
+#include "core/events/EventListener.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/fetch/CrossOriginAccessControl.h"
 #include "core/fetch/TextResourceDecoder.h"
 #include "core/fileapi/Blob.h"
@@ -43,17 +43,18 @@
 #include "core/html/HTMLDocument.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/loader/ThreadableLoader.h"
-#include "core/page/ContentSecurityPolicy.h"
+#include "core/frame/ContentSecurityPolicy.h"
 #include "core/page/Settings.h"
 #include "core/platform/HistogramSupport.h"
-#include "core/platform/SharedBuffer.h"
 #include "core/platform/network/BlobData.h"
-#include "core/platform/network/HTTPParsers.h"
-#include "core/platform/network/ParsedContentType.h"
-#include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/xml/XMLHttpRequestProgressEvent.h"
 #include "core/xml/XMLHttpRequestUpload.h"
+#include "platform/Logging.h"
+#include "platform/SharedBuffer.h"
+#include "platform/network/HTTPParsers.h"
+#include "platform/network/ParsedContentType.h"
+#include "platform/network/ResourceError.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/ArrayBuffer.h"
 #include "wtf/ArrayBufferView.h"
@@ -148,7 +149,7 @@
     return dummy;
 }
 
-static void logConsoleError(ScriptExecutionContext* context, const String& message)
+static void logConsoleError(ExecutionContext* context, const String& message)
 {
     if (!context)
         return;
@@ -157,7 +158,7 @@
     context->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message);
 }
 
-PassRefPtr<XMLHttpRequest> XMLHttpRequest::create(ScriptExecutionContext* context, PassRefPtr<SecurityOrigin> securityOrigin)
+PassRefPtr<XMLHttpRequest> XMLHttpRequest::create(ExecutionContext* context, PassRefPtr<SecurityOrigin> securityOrigin)
 {
     RefPtr<XMLHttpRequest> xmlHttpRequest(adoptRef(new XMLHttpRequest(context, securityOrigin)));
     xmlHttpRequest->suspendIfNeeded();
@@ -165,7 +166,7 @@
     return xmlHttpRequest.release();
 }
 
-XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext* context, PassRefPtr<SecurityOrigin> securityOrigin)
+XMLHttpRequest::XMLHttpRequest(ExecutionContext* context, PassRefPtr<SecurityOrigin> securityOrigin)
     : ActiveDOMObject(context)
     , m_async(true)
     , m_includeCredentials(false)
@@ -200,13 +201,13 @@
 
 Document* XMLHttpRequest::document() const
 {
-    ASSERT(scriptExecutionContext()->isDocument());
-    return toDocument(scriptExecutionContext());
+    ASSERT(executionContext()->isDocument());
+    return toDocument(executionContext());
 }
 
 SecurityOrigin* XMLHttpRequest::securityOrigin() const
 {
-    return m_securityOrigin ? m_securityOrigin.get() : scriptExecutionContext()->securityOrigin();
+    return m_securityOrigin ? m_securityOrigin.get() : executionContext()->securityOrigin();
 }
 
 XMLHttpRequest::State XMLHttpRequest::readyState() const
@@ -251,7 +252,7 @@
         // If it is text/html, then the responseType of "document" must have been supplied explicitly.
         if ((m_response.isHTTP() && !responseIsXML() && !isHTML)
             || (isHTML && m_responseTypeCode == ResponseTypeDefault)
-            || scriptExecutionContext()->isWorkerGlobalScope()) {
+            || executionContext()->isWorkerGlobalScope()) {
             m_responseDocument = 0;
         } else {
             DocumentInit init = DocumentInit::fromContext(document()->contextDocument(), m_url);
@@ -299,7 +300,7 @@
             blobData->setContentType(responseMIMEType()); // responseMIMEType defaults to text/xml which may be incorrect.
             m_binaryResponseBuilder.clear();
         }
-        m_responseBlob = Blob::create(blobData.release(), size);
+        m_responseBlob = Blob::create(BlobDataHandle::create(blobData.release(), size));
     }
 
     return m_responseBlob.get();
@@ -338,7 +339,7 @@
 {
     // FIXME: Need to trigger or update the timeout Timer here, if needed. http://webkit.org/b/98156
     // XHR2 spec, 4.7.3. "This implies that the timeout attribute can be set while fetching is in progress. If that occurs it will still be measured relative to the start of fetching."
-    if (scriptExecutionContext()->isDocument() && !m_async) {
+    if (executionContext()->isDocument() && !m_async) {
         es.throwDOMException(InvalidAccessError, ExceptionMessages::failedToSet("timeout", "XMLHttpRequest", "timeouts cannot be set for synchronous requests made from a document."));
         return;
     }
@@ -356,7 +357,7 @@
     // attempt to discourage synchronous XHR use. responseType is one such piece of functionality.
     // We'll only disable this functionality for HTTP(S) requests since sync requests for local protocols
     // such as file: and data: still make sense to allow.
-    if (!m_async && scriptExecutionContext()->isDocument() && m_url.protocolIsInHTTPFamily()) {
+    if (!m_async && executionContext()->isDocument() && m_url.protocolIsInHTTPFamily()) {
         es.throwDOMException(InvalidAccessError, ExceptionMessages::failedToSet("responseType", "XMLHttpRequest", "the response type can only be changed for asynchronous HTTP requests made from a document."));
         return;
     }
@@ -415,26 +416,26 @@
 {
     if (m_state != newState) {
         m_state = newState;
-        callReadyStateChangeListener();
+        dispatchReadyStateChangeEvent();
     }
 }
 
-void XMLHttpRequest::callReadyStateChangeListener()
+void XMLHttpRequest::dispatchReadyStateChangeEvent()
 {
-    if (!scriptExecutionContext())
+    if (!executionContext())
         return;
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(scriptExecutionContext(), this);
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(executionContext(), this);
 
     if (m_async || (m_state <= OPENED || m_state == DONE))
-        m_progressEventThrottle.dispatchReadyStateChangeEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
+        m_progressEventThrottle.dispatchReadyStateChangeEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::readystatechange), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
 
     InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(cookie);
     if (m_state == DONE && !m_error) {
-        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRLoadEvent(scriptExecutionContext(), this);
-        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadEvent));
+        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRLoadEvent(executionContext(), this);
+        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::load));
         InspectorInstrumentation::didDispatchXHRLoadEvent(cookie);
-        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent));
+        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::loadend));
     }
 }
 
@@ -457,12 +458,29 @@
 
 String XMLHttpRequest::uppercaseKnownHTTPMethod(const String& method)
 {
-    if (equalIgnoringCase(method, "COPY") || equalIgnoringCase(method, "DELETE") || equalIgnoringCase(method, "GET")
-        || equalIgnoringCase(method, "HEAD") || equalIgnoringCase(method, "INDEX") || equalIgnoringCase(method, "LOCK")
-        || equalIgnoringCase(method, "M-POST") || equalIgnoringCase(method, "MKCOL") || equalIgnoringCase(method, "MOVE")
-        || equalIgnoringCase(method, "OPTIONS") || equalIgnoringCase(method, "POST") || equalIgnoringCase(method, "PROPFIND")
-        || equalIgnoringCase(method, "PROPPATCH") || equalIgnoringCase(method, "PUT") || equalIgnoringCase(method, "UNLOCK")) {
-        return method.upper();
+    const char* const methods[] = {
+        "COPY",
+        "DELETE",
+        "GET",
+        "HEAD",
+        "INDEX",
+        "LOCK",
+        "M-POST",
+        "MKCOL",
+        "MOVE",
+        "OPTIONS",
+        "POST",
+        "PROPFIND",
+        "PROPPATCH",
+        "PUT",
+        "UNLOCK" };
+    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(methods); ++i) {
+        if (equalIgnoringCase(method, methods[i])) {
+            // Don't bother allocating a new string if it's already all uppercase.
+            if (method == methods[i])
+                return method;
+            return methods[i];
+        }
     }
     return method;
 }
@@ -481,6 +499,8 @@
 
 void XMLHttpRequest::open(const String& method, const KURL& url, bool async, ExceptionState& es)
 {
+    LOG(Network, "XMLHttpRequest %p open('%s', '%s', %d)", this, method.utf8().data(), url.elidedString().utf8().data(), async);
+
     if (!internalAbort())
         return;
 
@@ -505,13 +525,13 @@
         return;
     }
 
-    if (!ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) && !scriptExecutionContext()->contentSecurityPolicy()->allowConnectToSource(url)) {
+    if (!ContentSecurityPolicy::shouldBypassMainWorld(executionContext()) && !executionContext()->contentSecurityPolicy()->allowConnectToSource(url)) {
         // We can safely expose the URL to JavaScript, as these checks happen synchronously before redirection. JavaScript receives no new information.
         es.throwSecurityError("Refused to connect to '" + url.elidedString() + "' because it violates the document's Content Security Policy.");
         return;
     }
 
-    if (!async && scriptExecutionContext()->isDocument()) {
+    if (!async && executionContext()->isDocument()) {
         if (document()->settings() && !document()->settings()->syncXHRInDocumentsEnabled()) {
             es.throwDOMException(InvalidAccessError, ExceptionMessages::failedToExecute("open", "XMLHttpRequest", "synchronous requests are disabled for this page."));
             return;
@@ -568,7 +588,7 @@
 
 bool XMLHttpRequest::initSend(ExceptionState& es)
 {
-    if (!scriptExecutionContext())
+    if (!executionContext())
         return false;
 
     if (m_state != OPENED || m_loader) {
@@ -592,6 +612,8 @@
 
 void XMLHttpRequest::send(Document* document, ExceptionState& es)
 {
+    LOG(Network, "XMLHttpRequest %p send() Document %p", this, document);
+
     ASSERT(document);
 
     if (!initSend(es))
@@ -619,6 +641,8 @@
 
 void XMLHttpRequest::send(const String& body, ExceptionState& es)
 {
+    LOG(Network, "XMLHttpRequest %p send() String '%s'", this, body.utf8().data());
+
     if (!initSend(es))
         return;
 
@@ -641,6 +665,8 @@
 
 void XMLHttpRequest::send(Blob* body, ExceptionState& es)
 {
+    LOG(Network, "XMLHttpRequest %p send() Blob '%s'", this, body->uuid().utf8().data());
+
     if (!initSend(es))
         return;
 
@@ -661,7 +687,7 @@
         if (body->isFile())
             m_requestEntityBody->appendFile(toFile(body)->path());
         else
-            m_requestEntityBody->appendBlob(body->url());
+            m_requestEntityBody->appendBlob(body->uuid(), body->blobDataHandle());
     }
 
     createRequest(es);
@@ -669,11 +695,13 @@
 
 void XMLHttpRequest::send(DOMFormData* body, ExceptionState& es)
 {
+    LOG(Network, "XMLHttpRequest %p send() DOMFormData %p", this, body);
+
     if (!initSend(es))
         return;
 
     if (areMethodAndURLValidForSend()) {
-        m_requestEntityBody = FormData::createMultiPart(*(static_cast<FormDataList*>(body)), body->encoding(), document());
+        m_requestEntityBody = FormData::createMultiPart(*(static_cast<FormDataList*>(body)), body->encoding());
 
         String contentType = getRequestHeader("Content-Type");
         if (contentType.isEmpty()) {
@@ -687,8 +715,10 @@
 
 void XMLHttpRequest::send(ArrayBuffer* body, ExceptionState& es)
 {
+    LOG(Network, "XMLHttpRequest %p send() ArrayBuffer %p", this, body);
+
     String consoleMessage("ArrayBuffer is deprecated in XMLHttpRequest.send(). Use ArrayBufferView instead.");
-    scriptExecutionContext()->addConsoleMessage(JSMessageSource, WarningMessageLevel, consoleMessage);
+    executionContext()->addConsoleMessage(JSMessageSource, WarningMessageLevel, consoleMessage);
 
     HistogramSupport::histogramEnumeration("WebCore.XHR.send.ArrayBufferOrView", XMLHttpRequestSendArrayBuffer, XMLHttpRequestSendArrayBufferOrViewMax);
 
@@ -697,6 +727,8 @@
 
 void XMLHttpRequest::send(ArrayBufferView* body, ExceptionState& es)
 {
+    LOG(Network, "XMLHttpRequest %p send() ArrayBufferView %p", this, body);
+
     HistogramSupport::histogramEnumeration("WebCore.XHR.send.ArrayBufferOrView", XMLHttpRequestSendArrayBufferView, XMLHttpRequestSendArrayBufferOrViewMax);
 
     sendBytesData(body->baseAddress(), body->byteLength(), es);
@@ -736,10 +768,10 @@
     // Also, only async requests support upload progress events.
     bool uploadEvents = false;
     if (m_async) {
-        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent));
+        m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::loadstart));
         if (m_requestEntityBody && m_upload) {
             uploadEvents = m_upload->hasEventListeners();
-            m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent));
+            m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::loadstart));
         }
     }
 
@@ -753,7 +785,7 @@
     request.setHTTPMethod(m_method);
     request.setTargetType(ResourceRequest::TargetIsXHR);
 
-    InspectorInstrumentation::willLoadXHR(scriptExecutionContext(), this, m_method, m_url, m_async, m_requestEntityBody ? m_requestEntityBody->deepCopy() : 0, m_requestHeaders, m_includeCredentials);
+    InspectorInstrumentation::willLoadXHR(executionContext(), this, m_method, m_url, m_async, m_requestEntityBody ? m_requestEntityBody->deepCopy() : 0, m_requestHeaders, m_includeCredentials);
 
     if (m_requestEntityBody) {
         ASSERT(m_method != "GET");
@@ -773,8 +805,9 @@
     options.crossOriginRequestPolicy = UseAccessControl;
     options.securityOrigin = securityOrigin();
     options.initiator = FetchInitiatorTypeNames::xmlhttprequest;
-    options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective;
-    options.mixedContentBlockingTreatment = TreatAsActiveContent;
+    options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(executionContext()) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective;
+    // TODO(tsepez): Specify TreatAsActiveContent per http://crbug.com/305303.
+    options.mixedContentBlockingTreatment = TreatAsPassiveContent;
     options.timeoutMilliseconds = m_timeoutMilliseconds;
 
     m_exceptionCode = 0;
@@ -789,7 +822,7 @@
         // FIXME: Maybe we need to be able to send XMLHttpRequests from onunload, <http://bugs.webkit.org/show_bug.cgi?id=10904>.
         // FIXME: Maybe create() can return null for other reasons too?
         ASSERT(!m_loader);
-        m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options);
+        m_loader = ThreadableLoader::create(executionContext(), this, request, options);
         if (m_loader) {
             // Neither this object nor the JavaScript wrapper should be deleted while
             // a request is in progress because we need to keep the listeners alive,
@@ -797,7 +830,7 @@
             setPendingActivity(this);
         }
     } else {
-        ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, options);
+        ThreadableLoader::loadResourceSynchronously(executionContext(), request, *this, options);
     }
 
     if (!m_exceptionCode && m_error)
@@ -808,6 +841,8 @@
 
 void XMLHttpRequest::abort()
 {
+    LOG(Network, "XMLHttpRequest %p abort()", this);
+
     // internalAbort() calls dropProtection(), which may release the last reference.
     RefPtr<XMLHttpRequest> protect(this);
 
@@ -829,23 +864,30 @@
         m_state = UNSENT;
     }
 
-    m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
+    m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(EventTypeNames::abort));
     if (!m_uploadComplete) {
         m_uploadComplete = true;
         if (m_upload && m_uploadEventsAllowed)
-            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent));
+            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(EventTypeNames::abort));
     }
 }
 
+void XMLHttpRequest::clearVariablesForLoading()
+{
+    // FIXME: when we add the support for multi-part XHR, we will have to think be careful with this initialization.
+    m_receivedLength = 0;
+    m_decoder = 0;
+
+    m_responseEncoding = String();
+}
+
 bool XMLHttpRequest::internalAbort(DropProtection async)
 {
     m_error = true;
 
-    // FIXME: when we add the support for multi-part XHR, we will have to think be careful with this initialization.
-    m_receivedLength = 0;
-    m_decoder = 0;
+    clearVariablesForLoading();
 
-    InspectorInstrumentation::didFailXHRLoading(scriptExecutionContext(), this);
+    InspectorInstrumentation::didFailXHRLoading(executionContext(), this);
 
     if (m_responseStream && m_state != DONE)
         m_responseStream->abort();
@@ -887,11 +929,16 @@
 void XMLHttpRequest::clearResponseBuffers()
 {
     m_responseText.clear();
-    m_responseEncoding = String();
+
     m_createdDocument = false;
     m_responseDocument = 0;
+
     m_responseBlob = 0;
+
     m_responseStream = 0;
+
+    // These variables may referred by the response accessors. So, we can clear
+    // this only when we clear the response holder variables above.
     m_binaryResponseBuilder.clear();
     m_responseArrayBuffer.clear();
 }
@@ -922,13 +969,15 @@
 
 void XMLHttpRequest::handleNetworkError()
 {
+    LOG(Network, "XMLHttpRequest %p handleNetworkError()", this);
+
     m_exceptionCode = NetworkError;
 
     handleDidFailGeneric();
 
     if (m_async) {
         changeState(DONE);
-        dispatchEventAndLoadEnd(eventNames().errorEvent);
+        dispatchEventAndLoadEnd(EventTypeNames::error);
     } else {
         m_state = DONE;
     }
@@ -938,6 +987,8 @@
 
 void XMLHttpRequest::handleDidCancel()
 {
+    LOG(Network, "XMLHttpRequest %p handleDidCancel()", this);
+
     m_exceptionCode = AbortError;
 
     handleDidFailGeneric();
@@ -948,7 +999,7 @@
     }
     changeState(DONE);
 
-    dispatchEventAndLoadEnd(eventNames().abortEvent);
+    dispatchEventAndLoadEnd(EventTypeNames::abort);
 }
 
 void XMLHttpRequest::dropProtectionSoon()
@@ -987,7 +1038,7 @@
 
     // No script (privileged or not) can set unsafe headers.
     if (!isAllowedHTTPHeader(name)) {
-        logConsoleError(scriptExecutionContext(), "Refused to set unsafe header \"" + name + "\"");
+        logConsoleError(executionContext(), "Refused to set unsafe header \"" + name + "\"");
         return;
     }
 
@@ -1051,7 +1102,7 @@
 
     // See comment in getAllResponseHeaders above.
     if (isSetCookieHeader(name) && !securityOrigin()->canLoadLocalResources()) {
-        logConsoleError(scriptExecutionContext(), "Refused to get unsafe header \"" + name + "\"");
+        logConsoleError(executionContext(), "Refused to get unsafe header \"" + name + "\"");
         return String();
     }
 
@@ -1059,7 +1110,7 @@
     parseAccessControlExposeHeadersAllowList(m_response.httpHeaderField("Access-Control-Expose-Headers"), accessControlExposeHeaderSet);
 
     if (!m_sameOriginRequest && !isOnAccessControlResponseHeaderWhitelist(name) && !accessControlExposeHeaderSet.contains(name)) {
-        logConsoleError(scriptExecutionContext(), "Refused to get unsafe header \"" + name + "\"");
+        logConsoleError(executionContext(), "Refused to get unsafe header \"" + name + "\"");
         return String();
     }
     return m_response.httpHeaderField(name);
@@ -1089,33 +1140,30 @@
 
 int XMLHttpRequest::status(ExceptionState& es) const
 {
+    if (m_state == UNSENT || m_state == OPENED || m_error)
+        return 0;
+
     if (m_response.httpStatusCode())
         return m_response.httpStatusCode();
 
-    if (m_state == OPENED) {
-        // Firefox only raises an exception in this state; we match it.
-        // Note the case of local file requests, where we have no HTTP response code! Firefox never raises an exception for those, but we match HTTP case for consistency.
-        es.throwDOMException(InvalidStateError, ExceptionMessages::failedToGet("status", "XMLHttpRequest", "the object's state must not be OPENED."));
-    }
-
     return 0;
 }
 
 String XMLHttpRequest::statusText(ExceptionState& es) const
 {
+    if (m_state == UNSENT || m_state == OPENED || m_error)
+        return String();
+
     if (!m_response.httpStatusText().isNull())
         return m_response.httpStatusText();
 
-    if (m_state == OPENED) {
-        // See comments in status() above.
-        es.throwDOMException(InvalidStateError, ExceptionMessages::failedToGet("statusText", "XMLHttpRequest", "the object's state must not be OPENED."));
-    }
-
     return String();
 }
 
 void XMLHttpRequest::didFail(const ResourceError& error)
 {
+    LOG(Network, "XMLHttpRequest %p didFail()", this);
+
     // If we are already in an error state, for instance we called abort(), bail out early.
     if (m_error)
         return;
@@ -1132,18 +1180,22 @@
 
     // Network failures are already reported to Web Inspector by ResourceLoader.
     if (error.domain() == errorDomainWebKitInternal)
-        logConsoleError(scriptExecutionContext(), "XMLHttpRequest cannot load " + error.failingURL() + ". " + error.localizedDescription());
+        logConsoleError(executionContext(), "XMLHttpRequest cannot load " + error.failingURL() + ". " + error.localizedDescription());
 
     handleNetworkError();
 }
 
 void XMLHttpRequest::didFailRedirectCheck()
 {
+    LOG(Network, "XMLHttpRequest %p didFailRedirectCheck()", this);
+
     handleNetworkError();
 }
 
 void XMLHttpRequest::didFinishLoading(unsigned long identifier, double)
 {
+    LOG(Network, "XMLHttpRequest %p didFinishLoading(%lu)", this, identifier);
+
     if (m_error)
         return;
 
@@ -1153,10 +1205,12 @@
     if (m_decoder)
         m_responseText = m_responseText.concatenateWith(m_decoder->flush());
 
+    clearVariablesForLoading();
+
     if (m_responseStream)
         m_responseStream->finalize();
 
-    InspectorInstrumentation::didFinishXHRLoading(scriptExecutionContext(), this, identifier, m_responseText, m_url, m_lastSendURL, m_lastSendLineNumber);
+    InspectorInstrumentation::didFinishXHRLoading(executionContext(), this, identifier, m_responseText, m_url, m_lastSendURL, m_lastSendLineNumber);
 
     // Prevent dropProtection releasing the last reference, and retain |this| until the end of this method.
     RefPtr<XMLHttpRequest> protect(this);
@@ -1167,28 +1221,30 @@
     }
 
     changeState(DONE);
-    m_responseEncoding = String();
-    m_decoder = 0;
 }
 
 void XMLHttpRequest::didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
 {
+    LOG(Network, "XMLHttpRequest %p didSendData(%llu, %llu)", this, bytesSent, totalBytesToBeSent);
+
     if (!m_upload)
         return;
 
     if (m_uploadEventsAllowed)
-        m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, true, bytesSent, totalBytesToBeSent));
+        m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::progress, true, bytesSent, totalBytesToBeSent));
 
     if (bytesSent == totalBytesToBeSent && !m_uploadComplete) {
         m_uploadComplete = true;
         if (m_uploadEventsAllowed)
-            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().loadEvent));
+            m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(EventTypeNames::load));
     }
 }
 
 void XMLHttpRequest::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
 {
-    InspectorInstrumentation::didReceiveXHRResponse(scriptExecutionContext(), identifier);
+    LOG(Network, "XMLHttpRequest %p didReceiveResponse(%lu)", this, identifier);
+
+    InspectorInstrumentation::didReceiveXHRResponse(executionContext(), identifier);
 
     m_response = response;
     if (!m_mimeTypeOverride.isEmpty()) {
@@ -1245,26 +1301,35 @@
         m_responseStream->addData(data, len);
     }
 
-    if (!m_error) {
+    if (m_error)
+        return;
+
+    m_receivedLength += len;
+
+    if (m_async) {
         long long expectedLength = m_response.expectedContentLength();
-        m_receivedLength += len;
+        bool lengthComputable = expectedLength > 0 && m_receivedLength <= expectedLength;
+        unsigned long long total = lengthComputable ? expectedLength : 0;
 
-        if (m_async) {
-            bool lengthComputable = expectedLength > 0 && m_receivedLength <= expectedLength;
-            unsigned long long total = lengthComputable ? expectedLength : 0;
-            m_progressEventThrottle.dispatchProgressEvent(lengthComputable, m_receivedLength, total);
-        }
+        m_progressEventThrottle.dispatchProgressEvent(lengthComputable, m_receivedLength, total);
+    }
 
-        if (m_state != LOADING)
-            changeState(LOADING);
-        else
-            // Firefox calls readyStateChanged every time it receives data, 4449442
-            callReadyStateChangeListener();
+    if (m_state != LOADING) {
+        changeState(LOADING);
+    } else {
+        // Firefox calls readyStateChanged every time it receives data. Do
+        // the same to align with Firefox.
+        //
+        // FIXME: Make our implementation and the spec consistent. This
+        // behavior was needed when the progress event was not available.
+        dispatchReadyStateChangeEvent();
     }
 }
 
 void XMLHttpRequest::handleDidTimeout()
 {
+    LOG(Network, "XMLHttpRequest %p handleDidTimeout()", this);
+
     // internalAbort() calls dropProtection(), which may release the last reference.
     RefPtr<XMLHttpRequest> protect(this);
 
@@ -1281,15 +1346,10 @@
     }
     changeState(DONE);
 
-    dispatchEventAndLoadEnd(eventNames().timeoutEvent);
+    dispatchEventAndLoadEnd(EventTypeNames::timeout);
 }
 
-bool XMLHttpRequest::canSuspend() const
-{
-    return !m_loader;
-}
-
-void XMLHttpRequest::suspend(ReasonForSuspension)
+void XMLHttpRequest::suspend()
 {
     m_progressEventThrottle.suspend();
 }
@@ -1312,12 +1372,12 @@
 
 const AtomicString& XMLHttpRequest::interfaceName() const
 {
-    return eventNames().interfaceForXMLHttpRequest;
+    return EventTargetNames::XMLHttpRequest;
 }
 
-ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const
+ExecutionContext* XMLHttpRequest::executionContext() const
 {
-    return ActiveDOMObject::scriptExecutionContext();
+    return ActiveDOMObject::executionContext();
 }
 
 } // namespace WebCore
diff --git a/Source/core/xml/XMLHttpRequest.h b/Source/core/xml/XMLHttpRequest.h
index 56fe38b..67e7ece 100644
--- a/Source/core/xml/XMLHttpRequest.h
+++ b/Source/core/xml/XMLHttpRequest.h
@@ -26,7 +26,7 @@
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/ActiveDOMObject.h"
 #include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/loader/ThreadableLoaderClient.h"
 #include "core/platform/network/FormData.h"
 #include "core/platform/network/ResourceResponse.h"
@@ -55,7 +55,7 @@
 class XMLHttpRequest : public ScriptWrappable, public RefCounted<XMLHttpRequest>, public XMLHttpRequestEventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<XMLHttpRequest> create(ScriptExecutionContext*, PassRefPtr<SecurityOrigin> = 0);
+    static PassRefPtr<XMLHttpRequest> create(ExecutionContext*, PassRefPtr<SecurityOrigin> = 0);
     ~XMLHttpRequest();
 
     // These exact numeric values are important because JS expects them.
@@ -83,13 +83,12 @@
     };
 
     virtual void contextDestroyed();
-    virtual bool canSuspend() const;
-    virtual void suspend(ReasonForSuspension);
+    virtual void suspend();
     virtual void resume();
     virtual void stop();
 
     virtual const AtomicString& interfaceName() const OVERRIDE;
-    virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
 
     const KURL& url() const { return m_url; }
     String statusText(ExceptionState&) const;
@@ -146,7 +145,7 @@
     using RefCounted<XMLHttpRequest>::deref;
 
 private:
-    XMLHttpRequest(ScriptExecutionContext*, PassRefPtr<SecurityOrigin>);
+    XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>);
 
     virtual void refEventTarget() OVERRIDE { ref(); }
     virtual void derefEventTarget() OVERRIDE { deref(); }
@@ -175,12 +174,18 @@
     // Changes m_state and dispatches a readyStateChange event if new m_state
     // value is different from last one.
     void changeState(State newState);
-    void callReadyStateChangeListener();
+    void dispatchReadyStateChangeEvent();
+
     void dropProtectionSoon();
     void dropProtection(Timer<XMLHttpRequest>* = 0);
+    // Clears variables used only while the resource is being loaded.
+    void clearVariablesForLoading();
     // Returns false iff reentry happened and a new load is started.
     bool internalAbort(DropProtection = DropProtectionSync);
+    // Clears variables holding response header and body data. If it's needed
+    // to keep response header data, use clearResponseBuffers().
     void clearResponse();
+    // Clears variables holding response body data.
     void clearResponseBuffers();
     void clearRequest();
 
@@ -220,6 +225,8 @@
     RefPtr<TextResourceDecoder> m_decoder;
 
     ScriptString m_responseText;
+    // Used to skip m_responseDocument creation if it's done previously. We need
+    // this separate flag since m_responseDocument can be 0 for some cases.
     mutable bool m_createdDocument;
     mutable RefPtr<Document> m_responseDocument;
 
diff --git a/Source/core/xml/XMLHttpRequest.idl b/Source/core/xml/XMLHttpRequest.idl
index 069129d..7078141 100644
--- a/Source/core/xml/XMLHttpRequest.idl
+++ b/Source/core/xml/XMLHttpRequest.idl
@@ -40,7 +40,7 @@
     GlobalContext=Window&WorkerGlobalScope,
     ActiveDOMObject,
     Constructor,
-    ConstructorCallWith=ScriptExecutionContext,
+    ConstructorCallWith=ExecutionContext,
     CustomConstructor(optional XMLHttpRequestOptions options)
 ] interface XMLHttpRequest : XMLHttpRequestEventTarget {
     // event handler attributes
@@ -58,9 +58,9 @@
 
     [SetterRaisesException] attribute boolean withCredentials;
 
-    [Custom, ActivityLog=Access, RaisesException] void open(DOMString method, DOMString url, optional boolean async, optional DOMString user, optional DOMString password);
+    [Custom, ActivityLogging=Access, RaisesException] void open(DOMString method, DOMString url, optional boolean async, optional DOMString user, optional DOMString password);
 
-    [ActivityLog=Access, RaisesException] void setRequestHeader(DOMString header, DOMString value);
+    [ActivityLogging=Access, RaisesException] void setRequestHeader(DOMString header, DOMString value);
 
     [Custom, RaisesException] void send();
 
diff --git a/Source/core/xml/XMLHttpRequestEventTarget.h b/Source/core/xml/XMLHttpRequestEventTarget.h
index af81417..2d027ab 100644
--- a/Source/core/xml/XMLHttpRequestEventTarget.h
+++ b/Source/core/xml/XMLHttpRequestEventTarget.h
@@ -35,7 +35,7 @@
 
 namespace WebCore {
 
-class XMLHttpRequestEventTarget : public EventTarget {
+class XMLHttpRequestEventTarget : public EventTargetWithInlineData {
 public:
     DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
@@ -44,13 +44,6 @@
     DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(progress);
     DEFINE_ATTRIBUTE_EVENT_LISTENER(timeout);
-
-protected:
-    virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetData; }
-    virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventTargetData; }
-
-private:
-    EventTargetData m_eventTargetData;
 };
 
 } // namespace WebCore
diff --git a/Source/core/xml/XMLHttpRequestProgressEvent.h b/Source/core/xml/XMLHttpRequestProgressEvent.h
index f742113..c6ab4a4 100644
--- a/Source/core/xml/XMLHttpRequestProgressEvent.h
+++ b/Source/core/xml/XMLHttpRequestProgressEvent.h
@@ -27,8 +27,8 @@
 #ifndef XMLHttpRequestProgressEvent_h
 #define XMLHttpRequestProgressEvent_h
 
-#include "core/events/EventNames.h"
 #include "core/events/ProgressEvent.h"
+#include "core/events/ThreadLocalEventNames.h"
 
 namespace WebCore {
 
@@ -47,7 +47,7 @@
     unsigned long long position() const { return loaded(); }
     unsigned long long totalSize() const { return total(); }
 
-    virtual const AtomicString& interfaceName() const { return eventNames().interfaceForXMLHttpRequestProgressEvent; }
+    virtual const AtomicString& interfaceName() const { return EventNames::XMLHttpRequestProgressEvent; }
 
 private:
     XMLHttpRequestProgressEvent()
diff --git a/Source/core/xml/XMLHttpRequestProgressEventThrottle.cpp b/Source/core/xml/XMLHttpRequestProgressEventThrottle.cpp
index 39b5227..212bf9d 100644
--- a/Source/core/xml/XMLHttpRequestProgressEventThrottle.cpp
+++ b/Source/core/xml/XMLHttpRequestProgressEventThrottle.cpp
@@ -52,7 +52,7 @@
 {
     if (m_deferEvents) {
         // Only store the latest progress event while suspended.
-        m_deferredProgressEvent = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total);
+        m_deferredProgressEvent = XMLHttpRequestProgressEvent::create(EventTypeNames::progress, lengthComputable, loaded, total);
         return;
     }
 
@@ -64,7 +64,7 @@
         ASSERT(!m_loaded);
         ASSERT(!m_total);
 
-        dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, lengthComputable, loaded, total));
+        dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::progress, lengthComputable, loaded, total));
         startRepeating(minimumProgressEventDispatchingIntervalInSeconds);
         return;
     }
@@ -87,7 +87,7 @@
 {
     ASSERT(event);
     if (m_deferEvents) {
-        if (m_deferredEvents.size() > 1 && event->type() == eventNames().readystatechangeEvent && event->type() == m_deferredEvents.last()->type()) {
+        if (m_deferredEvents.size() > 1 && event->type() == EventTypeNames::readystatechange && event->type() == m_deferredEvents.last()->type()) {
             // Readystatechange events are state-less so avoid repeating two identical events in a row on resume.
             return;
         }
@@ -98,10 +98,10 @@
 
 void XMLHttpRequestProgressEventThrottle::dispatchEventAndLoadEnd(PassRefPtr<Event> event)
 {
-    ASSERT(event->type() == eventNames().loadEvent || event->type() == eventNames().abortEvent || event->type() == eventNames().errorEvent || event->type() == eventNames().timeoutEvent);
+    ASSERT(event->type() == EventTypeNames::load || event->type() == EventTypeNames::abort || event->type() == EventTypeNames::error || event->type() == EventTypeNames::timeout);
 
     dispatchEvent(event);
-    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent));
+    dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::loadend));
 }
 
 void XMLHttpRequestProgressEventThrottle::flushProgressEvent()
@@ -116,7 +116,7 @@
     if (!hasEventToDispatch())
         return;
 
-    PassRefPtr<Event> event = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total);
+    PassRefPtr<Event> event = XMLHttpRequestProgressEvent::create(EventTypeNames::progress, m_lengthComputable, m_loaded, m_total);
     m_loaded = 0;
     m_total = 0;
 
@@ -159,7 +159,7 @@
         return;
     }
 
-    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total));
+    dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::progress, m_lengthComputable, m_loaded, m_total));
     m_total = 0;
     m_loaded = 0;
 }
@@ -186,7 +186,7 @@
     // If we have a progress event waiting to be dispatched,
     // just defer it.
     if (hasEventToDispatch()) {
-        m_deferredProgressEvent = XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total);
+        m_deferredProgressEvent = XMLHttpRequestProgressEvent::create(EventTypeNames::progress, m_lengthComputable, m_loaded, m_total);
         m_total = 0;
         m_loaded = 0;
     }
@@ -203,7 +203,7 @@
         return;
     }
 
-    // Do not dispatch events inline here, since ScriptExecutionContext is iterating over
+    // Do not dispatch events inline here, since ExecutionContext is iterating over
     // the list of active DOM objects to resume them, and any activated JS event-handler
     // could insert new active DOM objects to the list.
     // m_deferEvents is kept true until all deferred events have been dispatched.
diff --git a/Source/core/xml/XMLHttpRequestProgressEventThrottle.h b/Source/core/xml/XMLHttpRequestProgressEventThrottle.h
index 7cc993f..36eddc5 100644
--- a/Source/core/xml/XMLHttpRequestProgressEventThrottle.h
+++ b/Source/core/xml/XMLHttpRequestProgressEventThrottle.h
@@ -27,7 +27,7 @@
 #ifndef XMLHttpRequestProgressEventThrottle_h
 #define XMLHttpRequestProgressEventThrottle_h
 
-#include "core/platform/Timer.h"
+#include "platform/Timer.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/Vector.h"
 
diff --git a/Source/core/xml/XMLHttpRequestUpload.cpp b/Source/core/xml/XMLHttpRequestUpload.cpp
index 6ad56e5..d9fd5f6 100644
--- a/Source/core/xml/XMLHttpRequestUpload.cpp
+++ b/Source/core/xml/XMLHttpRequestUpload.cpp
@@ -27,7 +27,7 @@
 #include "core/xml/XMLHttpRequestUpload.h"
 
 #include "core/events/Event.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/xml/XMLHttpRequest.h"
 #include "core/xml/XMLHttpRequestProgressEvent.h"
 #include "wtf/Assertions.h"
@@ -43,20 +43,20 @@
 
 const AtomicString& XMLHttpRequestUpload::interfaceName() const
 {
-    return eventNames().interfaceForXMLHttpRequestUpload;
+    return EventTargetNames::XMLHttpRequestUpload;
 }
 
-ScriptExecutionContext* XMLHttpRequestUpload::scriptExecutionContext() const
+ExecutionContext* XMLHttpRequestUpload::executionContext() const
 {
-    return m_xmlHttpRequest->scriptExecutionContext();
+    return m_xmlHttpRequest->executionContext();
 }
 
 void XMLHttpRequestUpload::dispatchEventAndLoadEnd(PassRefPtr<Event> event)
 {
-    ASSERT(event->type() == eventNames().loadEvent || event->type() == eventNames().abortEvent || event->type() == eventNames().errorEvent || event->type() == eventNames().timeoutEvent);
+    ASSERT(event->type() == EventTypeNames::load || event->type() == EventTypeNames::abort || event->type() == EventTypeNames::error || event->type() == EventTypeNames::timeout);
 
     dispatchEvent(event);
-    dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadendEvent));
+    dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::loadend));
 }
 
 
diff --git a/Source/core/xml/XMLHttpRequestUpload.h b/Source/core/xml/XMLHttpRequestUpload.h
index 2e9797d..f9a8d14 100644
--- a/Source/core/xml/XMLHttpRequestUpload.h
+++ b/Source/core/xml/XMLHttpRequestUpload.h
@@ -28,7 +28,7 @@
 
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/events/EventListener.h"
-#include "core/events/EventNames.h"
+#include "core/events/ThreadLocalEventNames.h"
 #include "core/xml/XMLHttpRequest.h"
 #include "core/xml/XMLHttpRequestEventTarget.h"
 #include "wtf/Forward.h"
@@ -41,7 +41,7 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
+class ExecutionContext;
 class XMLHttpRequest;
 
 class XMLHttpRequestUpload : public ScriptWrappable, public XMLHttpRequestEventTarget {
@@ -56,7 +56,7 @@
     XMLHttpRequest* xmlHttpRequest() const { return m_xmlHttpRequest; }
 
     virtual const AtomicString& interfaceName() const OVERRIDE;
-    virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+    virtual ExecutionContext* executionContext() const OVERRIDE;
 
     void dispatchEventAndLoadEnd(PassRefPtr<Event>);
 
diff --git a/Source/core/xml/XMLTreeViewer.cpp b/Source/core/xml/XMLTreeViewer.cpp
index 04bfa13..d7a1f7b 100644
--- a/Source/core/xml/XMLTreeViewer.cpp
+++ b/Source/core/xml/XMLTreeViewer.cpp
@@ -37,7 +37,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/dom/Text.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 
 using namespace std;
 
@@ -52,9 +52,9 @@
 {
     m_document->setIsViewSource(true);
     String scriptString(reinterpret_cast<const char*>(XMLViewer_js), sizeof(XMLViewer_js));
-    m_document->frame()->script()->executeScriptInMainWorld(ScriptSourceCode(scriptString));
+    m_document->frame()->script()->executeScriptInMainWorld(scriptString, ScriptController::ExecuteScriptWhenScriptsDisabled);
     String noStyleMessage("This XML file does not appear to have any style information associated with it. The document tree is shown below.");
-    m_document->frame()->script()->executeScriptInMainWorld(ScriptSourceCode("prepareWebKitXMLViewer('" + noStyleMessage + "');"));
+    m_document->frame()->script()->executeScriptInMainWorld("prepareWebKitXMLViewer('" + noStyleMessage + "');", ScriptController::ExecuteScriptWhenScriptsDisabled);
 
     String cssString(reinterpret_cast<const char*>(XMLViewer_css), sizeof(XMLViewer_css));
     RefPtr<Text> text = m_document->createTextNode(cssString);
diff --git a/Source/core/xml/XSLImportRule.h b/Source/core/xml/XSLImportRule.h
index e78fc08..954e046 100644
--- a/Source/core/xml/XSLImportRule.h
+++ b/Source/core/xml/XSLImportRule.h
@@ -23,6 +23,7 @@
 #ifndef XSLImportRule_h
 #define XSLImportRule_h
 
+#include "RuntimeEnabledFeatures.h"
 #include "core/fetch/ResourcePtr.h"
 #include "core/fetch/StyleSheetResourceClient.h"
 #include "core/xml/XSLStyleSheet.h"
@@ -37,6 +38,7 @@
 public:
     static PassOwnPtr<XSLImportRule> create(XSLStyleSheet* parentSheet, const String& href)
     {
+        ASSERT(RuntimeEnabledFeatures::xsltEnabled());
         return adoptPtr(new XSLImportRule(parentSheet, href));
     }
 
diff --git a/Source/core/xml/XSLStyleSheet.h b/Source/core/xml/XSLStyleSheet.h
index 6b21a11..8471795 100644
--- a/Source/core/xml/XSLStyleSheet.h
+++ b/Source/core/xml/XSLStyleSheet.h
@@ -23,12 +23,14 @@
 #ifndef XSLStyleSheet_h
 #define XSLStyleSheet_h
 
-#include <libxml/tree.h>
-#include <libxslt/transform.h>
+#include "RuntimeEnabledFeatures.h"
 #include "core/css/StyleSheet.h"
 #include "core/dom/ProcessingInstruction.h"
 #include "wtf/PassRefPtr.h"
 
+#include <libxml/tree.h>
+#include <libxslt/transform.h>
+
 namespace WebCore {
 
 class ResourceFetcher;
@@ -38,14 +40,17 @@
 public:
     static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL)
     {
+        ASSERT(RuntimeEnabledFeatures::xsltEnabled());
         return adoptRef(new XSLStyleSheet(parentImport, originalURL, finalURL));
     }
     static PassRefPtr<XSLStyleSheet> create(ProcessingInstruction* parentNode, const String& originalURL, const KURL& finalURL)
     {
+        ASSERT(RuntimeEnabledFeatures::xsltEnabled());
         return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, false));
     }
     static PassRefPtr<XSLStyleSheet> createEmbedded(ProcessingInstruction* parentNode, const KURL& finalURL)
     {
+        ASSERT(RuntimeEnabledFeatures::xsltEnabled());
         return adoptRef(new XSLStyleSheet(parentNode, finalURL.string(), finalURL, true));
     }
 
@@ -53,6 +58,7 @@
     // XSLTProcessor ensures that the stylesheet doesn't outlive its parent, in part by not exposing it to JavaScript.
     static PassRefPtr<XSLStyleSheet> createForXSLTProcessor(Node* parentNode, const String& originalURL, const KURL& finalURL)
     {
+        ASSERT(RuntimeEnabledFeatures::xsltEnabled());
         return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, false));
     }
 
@@ -93,8 +99,6 @@
     virtual KURL baseURL() const OVERRIDE { return m_finalURL; }
     virtual bool isLoading() const OVERRIDE;
 
-    virtual bool isXSLStyleSheet() const OVERRIDE { return true; }
-
 private:
     XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded);
     XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL);
diff --git a/Source/core/xml/XSLStyleSheetLibxslt.cpp b/Source/core/xml/XSLStyleSheetLibxslt.cpp
index b7b8326..398afdd 100644
--- a/Source/core/xml/XSLStyleSheetLibxslt.cpp
+++ b/Source/core/xml/XSLStyleSheetLibxslt.cpp
@@ -25,7 +25,7 @@
 #include "core/dom/Document.h"
 #include "core/dom/Node.h"
 #include "core/dom/TransformSource.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/xml/XSLImportRule.h"
 #include "core/xml/XSLTProcessor.h"
diff --git a/Source/core/xml/XSLTExtensions.cpp b/Source/core/xml/XSLTExtensions.cpp
index eea9417..064d609 100644
--- a/Source/core/xml/XSLTExtensions.cpp
+++ b/Source/core/xml/XSLTExtensions.cpp
@@ -27,6 +27,8 @@
 #include "config.h"
 
 #include "core/xml/XSLTExtensions.h"
+#include "RuntimeEnabledFeatures.h"
+#include "wtf/Assertions.h"
 
 #include <libxml/xpathInternals.h>
 
@@ -70,6 +72,7 @@
 
 void registerXSLTExtensions(xsltTransformContextPtr ctxt)
 {
+    ASSERT(RuntimeEnabledFeatures::xsltEnabled());
     xsltRegisterExtFunction(ctxt, (const xmlChar*)"node-set", (const xmlChar*)"http://exslt.org/common", exsltNodeSetFunction);
 }
 
diff --git a/Source/core/xml/XSLTProcessor.cpp b/Source/core/xml/XSLTProcessor.cpp
index 083736a..f6418d9 100644
--- a/Source/core/xml/XSLTProcessor.cpp
+++ b/Source/core/xml/XSLTProcessor.cpp
@@ -26,10 +26,10 @@
 #include "core/dom/DOMImplementation.h"
 #include "core/dom/DocumentFragment.h"
 #include "core/editing/markup.h"
-#include "core/page/ContentSecurityPolicy.h"
-#include "core/page/DOMWindow.h"
-#include "core/page/Frame.h"
-#include "core/page/FrameView.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/DOMWindow.h"
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/Assertions.h"
 #include "wtf/Vector.h"
@@ -60,7 +60,7 @@
 PassRefPtr<Document> XSLTProcessor::createDocumentFromSource(const String& sourceString,
     const String& sourceEncoding, const String& sourceMIMEType, Node* sourceNode, Frame* frame)
 {
-    RefPtr<Document> ownerDocument = &sourceNode->document();
+    RefPtr<Document> ownerDocument(sourceNode->document());
     bool sourceIsDocument = (sourceNode == ownerDocument.get());
     String documentSource = sourceString;
 
diff --git a/Source/core/xml/XSLTProcessor.h b/Source/core/xml/XSLTProcessor.h
index 3722f1f..23272c2 100644
--- a/Source/core/xml/XSLTProcessor.h
+++ b/Source/core/xml/XSLTProcessor.h
@@ -23,6 +23,7 @@
 #ifndef XSLTProcessor_h
 #define XSLTProcessor_h
 
+#include "RuntimeEnabledFeatures.h"
 #include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/Node.h"
 #include "core/xml/XSLStyleSheet.h"
@@ -40,7 +41,11 @@
 
 class XSLTProcessor : public RefCounted<XSLTProcessor>, public ScriptWrappable {
 public:
-    static PassRefPtr<XSLTProcessor> create() { return adoptRef(new XSLTProcessor); }
+    static PassRefPtr<XSLTProcessor> create()
+    {
+        ASSERT(RuntimeEnabledFeatures::xsltEnabled());
+        return adoptRef(new XSLTProcessor);
+    }
     ~XSLTProcessor();
 
     void setXSLStyleSheet(PassRefPtr<XSLStyleSheet> styleSheet) { m_stylesheet = styleSheet; }
diff --git a/Source/core/xml/XSLTProcessor.idl b/Source/core/xml/XSLTProcessor.idl
index f552ed1..7c99868 100644
--- a/Source/core/xml/XSLTProcessor.idl
+++ b/Source/core/xml/XSLTProcessor.idl
@@ -32,12 +32,13 @@
 
 [
     Constructor,
+    RuntimeEnabled=XSLT,
     MeasureAs=XSLTProcessor
 ] interface XSLTProcessor {
 
     void importStylesheet([Default=Undefined] optional Node stylesheet);
-    [CustomElementCallbacks=Enable] DocumentFragment transformToFragment([Default=Undefined] optional Node source, [Default=Undefined] optional Document docVal);
-    [CustomElementCallbacks=Enable] Document transformToDocument([Default=Undefined] optional Node source);
+    [CustomElementCallbacks] DocumentFragment transformToFragment([Default=Undefined] optional Node source, [Default=Undefined] optional Document docVal);
+    [CustomElementCallbacks] Document transformToDocument([Default=Undefined] optional Node source);
 
     [Custom] void setParameter(DOMString namespaceURI, DOMString localName, DOMString value);
     [Custom, TreatReturnedNullStringAs=Undefined] DOMString getParameter(DOMString namespaceURI, DOMString localName);
diff --git a/Source/core/xml/XSLTProcessorLibxslt.cpp b/Source/core/xml/XSLTProcessorLibxslt.cpp
index 30b3151..1246fb0 100644
--- a/Source/core/xml/XSLTProcessorLibxslt.cpp
+++ b/Source/core/xml/XSLTProcessorLibxslt.cpp
@@ -29,17 +29,17 @@
 #include "core/editing/markup.h"
 #include "core/fetch/Resource.h"
 #include "core/fetch/ResourceFetcher.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/Page.h"
 #include "core/page/PageConsole.h"
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/network/ResourceError.h"
+#include "platform/SharedBuffer.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
 #include "core/xml/XSLStyleSheet.h"
 #include "core/xml/XSLTExtensions.h"
 #include "core/xml/XSLTUnicodeSort.h"
 #include "core/xml/parser/XMLDocumentParser.h"
+#include "platform/network/ResourceError.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/Assertions.h"
 #include "wtf/Vector.h"
@@ -239,7 +239,7 @@
 
 static inline xmlDocPtr xmlDocPtrFromNode(Node* sourceNode, bool& shouldDelete)
 {
-    RefPtr<Document> ownerDocument = &sourceNode->document();
+    RefPtr<Document> ownerDocument(sourceNode->document());
     bool sourceIsDocument = (sourceNode == ownerDocument.get());
 
     xmlDocPtr sourceDoc = 0;
@@ -274,7 +274,7 @@
 
 bool XSLTProcessor::transformToString(Node* sourceNode, String& mimeType, String& resultString, String& resultEncoding)
 {
-    RefPtr<Document> ownerDocument = &sourceNode->document();
+    RefPtr<Document> ownerDocument(sourceNode->document());
 
     setXSLTLoadCallBack(docLoaderFunc, this, ownerDocument->fetcher());
     xsltStylesheetPtr sheet = xsltStylesheetPointer(m_stylesheet, m_stylesheetRootNode.get());
diff --git a/Source/core/xml/parser/MarkupTokenizerInlines.h b/Source/core/xml/parser/MarkupTokenizerInlines.h
index af15fd1..57df139 100644
--- a/Source/core/xml/parser/MarkupTokenizerInlines.h
+++ b/Source/core/xml/parser/MarkupTokenizerInlines.h
@@ -28,7 +28,7 @@
 #ifndef MarkupTokenizerInlines_h
 #define MarkupTokenizerInlines_h
 
-#include "core/platform/text/SegmentedString.h"
+#include "platform/text/SegmentedString.h"
 
 namespace WebCore {
 
diff --git a/Source/core/xml/parser/XMLDocumentParser.cpp b/Source/core/xml/parser/XMLDocumentParser.cpp
index 98942d6..4e2ffdd 100644
--- a/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -28,6 +28,7 @@
 
 #include "FetchInitiatorTypeNames.h"
 #include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
 #include "XMLNSNames.h"
 #include "bindings/v8/ExceptionState.h"
 #include "bindings/v8/ExceptionStatePlaceholder.h"
@@ -49,16 +50,16 @@
 #include "core/html/parser/HTMLEntityParser.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/ImageLoader.h"
-#include "core/page/Frame.h"
+#include "core/frame/Frame.h"
 #include "core/page/UseCounter.h"
-#include "core/platform/SharedBuffer.h"
-#include "core/platform/network/ResourceError.h"
 #include "core/platform/network/ResourceRequest.h"
 #include "core/platform/network/ResourceResponse.h"
 #include "core/xml/XMLErrors.h"
 #include "core/xml/XMLTreeViewer.h"
 #include "core/xml/parser/XMLDocumentParserScope.h"
 #include "core/xml/parser/XMLParserInput.h"
+#include "platform/SharedBuffer.h"
+#include "platform/network/ResourceError.h"
 #include "weborigin/SecurityOrigin.h"
 #include "wtf/StringExtras.h"
 #include "wtf/TemporaryChange.h"
@@ -784,7 +785,7 @@
     , m_parsingFragment(false)
 {
     // This is XML being used as a document resource.
-    UseCounter::count(document, UseCounter::XMLDocument);
+    UseCounter::count(*document, UseCounter::XMLDocument);
 }
 
 XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parentElement, ParserContentPolicy parserContentPolicy)
@@ -1155,6 +1156,10 @@
 
     if (pi->isCSS())
         m_sawCSS = true;
+
+    if (!RuntimeEnabledFeatures::xsltEnabled())
+        return;
+
     m_sawXSLTransform = !m_sawFirstElement && pi->isXSL();
     if (m_sawXSLTransform && !document()->transformSourceDocument())
         stopParsing();
diff --git a/Source/core/xml/parser/XMLDocumentParser.h b/Source/core/xml/parser/XMLDocumentParser.h
index 64b1898..2db50a0 100644
--- a/Source/core/xml/parser/XMLDocumentParser.h
+++ b/Source/core/xml/parser/XMLDocumentParser.h
@@ -29,8 +29,8 @@
 #include "core/dom/ScriptableDocumentParser.h"
 #include "core/fetch/ResourceClient.h"
 #include "core/fetch/ResourcePtr.h"
-#include "core/platform/text/SegmentedString.h"
 #include "core/xml/XMLErrors.h"
+#include "platform/text/SegmentedString.h"
 #include "wtf/HashMap.h"
 #include "wtf/OwnPtr.h"
 #include "wtf/text/CString.h"